|
| 1 | +# DOX: CLI Source |
| 2 | + |
| 3 | +## Purpose |
| 4 | + |
| 5 | +- Own all TypeScript runtime source for the terminal CLI, including agent orchestration, tools, TUI, auth, MCP, memory, permissions, hooks, config, sessions, and headless/server modes. |
| 6 | + |
| 7 | +## Ownership |
| 8 | + |
| 9 | +- `agent/` owns model-turn orchestration and agent-level features. |
| 10 | +- `tools/` owns tool implementations and permission/effect boundaries. |
| 11 | +- `ui/` and `ui-pi/` own interactive terminal interfaces. |
| 12 | +- `auth/` owns cloud auth, OAuth, token refresh, and credential storage. |
| 13 | +- `mcp/` owns MCP config, clients, protocol translation, and tool adaptation. |
| 14 | +- `memory/` owns durable memory extraction/injection/store. |
| 15 | +- `permissions/` owns command/effect allow/block state. |
| 16 | +- `commands/` owns slash-command registry and command handlers. |
| 17 | +- `config/` owns local/global config stores and output styles. |
| 18 | +- `hooks/` owns lifecycle hook loading/execution. |
| 19 | +- `sessions/` and `checkpoint/` own durable conversation/file-state rollback data. |
| 20 | +- `skills/`, `subagents/`, `ssh/`, `plan/`, `projects/`, and `app-server/` own their named subsystems. |
| 21 | + |
| 22 | +## Local Contracts |
| 23 | + |
| 24 | +- Public command behavior and CLI flags are user-facing API. |
| 25 | +- Tool effects must be explicit and permission-aware. |
| 26 | +- Path handling must resolve inside the intended cwd/worktree and handle symlinks/platform temp paths carefully. |
| 27 | +- Long-running work must stream status and remain interruptible. |
| 28 | +- Tests should avoid relying on host-specific absolute temp path spellings. |
| 29 | + |
| 30 | +## Work Guidance |
| 31 | + |
| 32 | +- Keep tests near source files and name them `<module>.test.ts`. |
| 33 | +- Prefer dependency injection for network/filesystem/process boundaries so tests can run offline. |
| 34 | +- Avoid importing from `dist/`; source imports should target `src/` modules. |
| 35 | + |
| 36 | +## Verification |
| 37 | + |
| 38 | +- Run targeted Vitest for touched subsystem files. |
| 39 | +- Run `npm run check` for cross-cutting source changes. |
| 40 | +- Run `npm run build` after changes affecting exported types, bin entrypoints, or package output. |
| 41 | + |
| 42 | +## Child DOX Index |
| 43 | + |
| 44 | +- `agent/AGENTS.md` — agent orchestration, tournament, rewind, prompts, models. |
| 45 | +- `tools/AGENTS.md` — tool implementations and permission boundaries. |
| 46 | +- `ui/AGENTS.md` — React/Ink TUI. |
| 47 | +- `ui-pi/AGENTS.md` — pi-based TUI/runtime widgets. |
| 48 | +- `auth/AGENTS.md` — OAuth/cloud credentials. |
| 49 | +- `mcp/AGENTS.md` — MCP clients/config/tool bridge. |
| 50 | +- `memory/AGENTS.md` — durable memory. |
| 51 | +- `permissions/AGENTS.md` — permission stores and command-prefix policy. |
| 52 | +- `commands/AGENTS.md` — slash commands and registry. |
| 53 | +- `config/AGENTS.md` — config, local LLM, output styles. |
| 54 | +- `hooks/AGENTS.md` — lifecycle hooks. |
| 55 | +- `sessions/AGENTS.md` — session persistence. |
| 56 | +- `checkpoint/AGENTS.md` — file/conversation checkpoint state. |
| 57 | +- `compaction/AGENTS.md` — conversation compaction and token budgeting. |
| 58 | +- `diagnostics/AGENTS.md` — health/check diagnostics. |
| 59 | +- `dotenv/AGENTS.md` — environment file loading. |
| 60 | +- `glue/AGENTS.md` — cloud glue APIs for intent/narration. |
| 61 | +- `headless/AGENTS.md` — non-interactive CLI runner. |
| 62 | +- `projects/AGENTS.md` — cloud project APIs and project commands. |
| 63 | +- `clipboard/AGENTS.md` — clipboard copy/image handling. |
| 64 | +- `user-queries/AGENTS.md` — queued user query persistence. |
| 65 | +- `skills/AGENTS.md` — skill loaders and registry. |
| 66 | +- `ssh/AGENTS.md` — SSH host config and command execution. |
| 67 | +- `subagents/AGENTS.md` — subagent definitions. |
| 68 | +- `plan/AGENTS.md` — plan mode. |
| 69 | +- `app-server/AGENTS.md` — local app/server protocol. |
0 commit comments