Skip to content

Commit 87b6dfa

Browse files
phernandezclaude
andcommitted
docs: add CliContainer tests and architecture documentation
- Add tests/cli/test_cli_container.py with 9 tests for CLI composition root - Create docs/ARCHITECTURE.md with comprehensive architecture documentation - Update CLAUDE.md to reference architecture docs and document new patterns Addresses code review feedback requesting CliContainer tests to maintain 100% coverage parity with API and MCP containers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 043e3e5 commit 87b6dfa

3 files changed

Lines changed: 533 additions & 4 deletions

File tree

CLAUDE.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,38 @@ counter += 1 # track retries for backoff calculation
117117

118118
### Codebase Architecture
119119

120+
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for detailed architecture documentation.
121+
122+
**Directory Structure:**
120123
- `/alembic` - Alembic db migrations
121-
- `/api` - FastAPI implementation of REST endpoints
122-
- `/cli` - Typer command-line interface
124+
- `/api` - FastAPI REST endpoints + `container.py` composition root
125+
- `/cli` - Typer CLI + `container.py` composition root
126+
- `/deps` - Feature-scoped FastAPI dependencies (config, db, projects, repositories, services, importers)
123127
- `/importers` - Import functionality for Claude, ChatGPT, and other sources
124128
- `/markdown` - Markdown parsing and processing
125-
- `/mcp` - Model Context Protocol server implementation
129+
- `/mcp` - MCP server + `container.py` composition root + `clients/` typed API clients
126130
- `/models` - SQLAlchemy ORM models
127131
- `/repository` - Data access layer
128132
- `/schemas` - Pydantic models for validation
129133
- `/services` - Business logic layer
130-
- `/sync` - File synchronization services
134+
- `/sync` - File synchronization services + `coordinator.py` for lifecycle management
135+
136+
**Composition Roots:**
137+
Each entrypoint (API, MCP, CLI) has a composition root that:
138+
- Reads `ConfigManager` (the only place that reads global config)
139+
- Resolves runtime mode via `RuntimeMode` enum (TEST > CLOUD > LOCAL)
140+
- Provides dependencies to downstream code explicitly
141+
142+
**Typed API Clients (MCP):**
143+
MCP tools use typed clients in `mcp/clients/` to communicate with the API:
144+
- `KnowledgeClient` - Entity CRUD operations
145+
- `SearchClient` - Search operations
146+
- `MemoryClient` - Context building
147+
- `DirectoryClient` - Directory listing
148+
- `ResourceClient` - Resource reading
149+
- `ProjectClient` - Project management
150+
151+
Flow: MCP Tool → Typed Client → HTTP API → Router → Service → Repository
131152

132153
### Development Notes
133154

0 commit comments

Comments
 (0)