- Monorepo with workspaces in
apps/,packages/,plugins/,docs/, andops/. - Core logic and persistence live in
packages/core; shared client types inpackages/sharedandpackages/client. - Frontends: web UI in
apps/web, TUI inapps/tui, CLI tools inapps/admin-cli, Discord bot inapps/discord-bot, and server entry inapps/server. - Documentation builds from
docs; scripts and utilities sit inscripts/andops/. - Tests reside alongside sources as
*.test.ts(example:packages/core/src/runtime/gameloop.test.ts).
- Install deps:
bun install. - Run dev servers:
bun run dev:server(core),bun run dev:web,bun run dev:tui,bun run dev:cli,bun run dev:discord. Run in separate terminals as needed. - Lint/format:
bun lint(oxlint) andbun format(oxfmt). Check-only:bun format --check. - Type checks:
bun --filter '*' check:typesor scopedbun --filter '@lotus/op-*' check. - Tests:
bun test(usebun test --only-failuresviabun run check:testfor quick iteration). - Docs:
bun run build:docsto build docs and playground,bun run dev:docsfor VitePress dev,bun run preview:docsto preview. - Database reset (destructive):
bun run db:wipeinpackages/core.
- TypeScript-first, strict config (
@tsconfig/strictest); prefer 2-space indentation. - Use ES modules and camelCase for variables/functions; PascalCase for types/classes; kebab-case for file and folder names.
- Keep imports sorted logically (built-ins, external, internal). Favor explicit type imports.
- Use
oxfmtbefore commits; CI assumes formatted sources. Avoid unused symbols (oxlint enforces).
- Framework:
bun:test. Place specs next to code with.test.tssuffix. - Write deterministic tests; mock external effects (
bun:testmock) where appropriate. - Prioritize core behaviors (permissions, runtime, scripting). Add regression tests for bug fixes.
- Run
bun test(or the targeted package viabun --filter <pkg> test) before opening PRs.
- Follow Conventional Commits (
feat(scope): ...,fix(scope): ...) as seen ingit log(e.g.,fix(core): inherit gas limit in nested verb calls). - Commits should stay focused; include tests and formatting changes.
- PRs: provide a short summary, linked issues, reproduction steps, and screenshots for UI-facing changes. Note any schema or migration impacts and how to migrate data.
- Ensure linters/tests pass locally; mention if any checks are intentionally skipped with rationale.
- Do not commit secrets or generated SQLite files (
world.sqlite*). Use local env vars for tokens. - Treat
db:wipeas destructive; back up any local state inbackups/before running.
- Keep commits scoped to one logical change; run
bun lint,bun format, andbun test(or targeted package tests) before pushing. - Record discovered issues or design decisions in
TODO.mdor docs so they’re not lost between sessions. - Prefer the provided Bun scripts over ad-hoc commands to avoid diverging from expected workflows.