Add code map to AGENTS.md, add DEVELOPMENT.md for coding-agent

This commit is contained in:
Mario Zechner 2025-12-09 01:23:06 +01:00
parent 6c9a264b63
commit 0c1a9c3091
3 changed files with 279 additions and 0 deletions

View file

@ -76,3 +76,54 @@ When closing issues via commit:
```
5. **Add new [Unreleased] section** at top of CHANGELOG.md for next cycle, commit it
## coding-agent Code Map
```
packages/coding-agent/src/
├── cli.ts # CLI entry point
├── main.ts # Main orchestration, mode routing
├── index.ts # Public exports
├── cli/ # CLI-specific utilities
│ ├── args.ts # Argument parsing, help display
│ ├── file-processor.ts # @file argument processing
│ └── session-picker.ts # TUI session selector for --resume
├── core/ # Core business logic (mode-agnostic)
│ ├── agent-session.ts # AgentSession: unified session management
│ ├── bash-executor.ts # Bash command execution
│ ├── compaction.ts # Context compaction logic
│ ├── export-html.ts # HTML export functionality
│ ├── messages.ts # Message types and transformers
│ ├── model-config.ts # Model configuration loading
│ ├── model-resolver.ts # Model resolution and scoping
│ ├── session-manager.ts # Session persistence (JSONL)
│ ├── settings-manager.ts # User settings persistence
│ ├── slash-commands.ts # Slash command loading
│ ├── system-prompt.ts # System prompt construction
│ ├── oauth/ # OAuth authentication
│ └── tools/ # Tool implementations (read, bash, edit, write, etc.)
├── modes/ # Run mode implementations
│ ├── index.ts # Mode exports
│ ├── print-mode.ts # Non-interactive print mode
│ ├── rpc-mode.ts # RPC/JSON mode for programmatic use
│ └── interactive/ # Interactive TUI mode
│ ├── interactive-mode.ts # InteractiveMode class
│ ├── components/ # TUI components
│ └── theme/ # Theme definitions
└── utils/ # Generic utilities
├── changelog.ts # Changelog parsing
├── clipboard.ts # Clipboard operations
├── config.ts # App configuration, paths
├── fuzzy.ts # Fuzzy matching
├── shell.ts # Shell detection
└── tools-manager.ts # External tool management (fd, etc.)
```
Key abstractions:
- `AgentSession` (core/agent-session.ts): Central session management, wraps Agent with persistence, compaction, model cycling
- `InteractiveMode` (modes/interactive/interactive-mode.ts): TUI rendering and user interaction
- `runPrintMode` / `runRpcMode`: Non-interactive output modes