- Add boocode-lift-analysis.md: comprehensive 30-repo lift matrix across 25 domains - Add openspec/ change docs: domain2-code-intelligence, domain3-multi-agent, impeccable-wave, streaming-codeblocks - Update .gitignore: .impeccable/, .omo/, bun.lock, DESIGN.md, PRODUCT.md - Update dependencies in package.json + pnpm-lock.yaml - Update .codesight/ analysis cache
73 lines
4.4 KiB
Markdown
73 lines
4.4 KiB
Markdown
# Domain 2 — Codebase Context & Code Intelligence
|
|
|
|
**Status:** Proposed
|
|
**Epic:** domain2-code-intelligence
|
|
**Depends on:** v2.8.8-type-inject-mcp, v2.8.12-hashline-audit-hooks
|
|
|
|
## Why
|
|
|
|
BooCode has two parallel code intelligence systems — and neither is fully wired:
|
|
|
|
1. Old Go codecontext sidecar (http://codecontext:8080) — 16 tool wrappers in apps/server/src/services/tools/codecontext/ — called via codecontext_client.ts HTTP client. Limited to codesight-level analysis (routes, schema, middleware, hot files). No type recovery, no health grades, no impact analysis.
|
|
|
|
2. New boocontext MCP server (registered in data/mcp.json as node /opt/forks/boocontext/dist/standalone.js) — 7 aggregated tools (overview, map, health, symbols, callgraph, impact, types) backed by child MCP servers. Already running but only available to agents through MCP discovery as boocontext_* tools — not integrated as first-class BooCode agent tools.
|
|
|
|
The lift analysis (boocode-lift-analysis.md) rates the boocontext swap as Tier 1 / Critical: 7 tools instead of 5, session caching, call graph, health grades, impact analysis, TS type recovery. Written in TS (BooCode's stack). Fixes 0% TS type recovery.
|
|
|
|
## What Changes
|
|
|
|
### Phase 1: Go sidecar → boocontext migration (high confidence)
|
|
|
|
1. Update codecontext_client.ts to optionally route through boocontext MCP instead of the Go HTTP sidecar. Add a CODECONTEXT_MCP env toggle. When boocontext MCP is active, call the MCP tool directly instead of HTTP POST to http://codecontext:8080/v1/{toolName}.
|
|
|
|
2. Add 4 new first-class tool wrappers for boocontext-only capabilities:
|
|
- get_code_health — wraps boocontext_health (A-F grades per file, 7 dimensions)
|
|
- get_code_impact — wraps boocontext_impact (symbol trace + blast radius merged)
|
|
- get_type_info — wraps boocontext_types (TypeScript type signatures, cross-file resolution)
|
|
- get_code_map — wraps boocontext_map (compressible context map with DCP)
|
|
|
|
3. Register new tools in ALL_TOOLS in tools/registry.ts. Add to agent whitelists in data/AGENTS.md.
|
|
|
|
### Phase 2: Child MCP server hardening (high confidence)
|
|
|
|
4. Switch type-inject child path from hardcoded /opt/forks/type-inject/packages/mcp/dist/index.js to npx @nick-vi/type-inject-mcp. Set BOOCONTEXT_TYPE_INJECT_NPX=@nick-vi/type-inject-mcp env var on the boocontext MCP process.
|
|
|
|
5. Add graceful degradation on child server failure. If tree-sitter-analyzer or type-inject is unavailable, fall back to codesight-only mode instead of failing hard.
|
|
|
|
### Phase 3: Wiki mode + scanning (medium confidence)
|
|
|
|
6. Add get_wiki_article tool — wraps codesight --wiki output. Generates targeted persistent articles per project, cached on disk.
|
|
|
|
7. Add token-efficient scanning — adopt codesight's scanner pattern for get_codebase_overview. Uses DCP compression for large payloads.
|
|
|
|
### Phase 4: Teardown (future)
|
|
|
|
8. Deprecate Go sidecar — once all tool wrappers verify against boocontext MCP, mark the Go codecontext sidecar as deprecated. Remove from docker-compose.yml and codecontext/Dockerfile when no remaining consumers.
|
|
|
|
## Non-Goals
|
|
- No changes to the boocontext fork itself (consumed as-is via dist/standalone.js)
|
|
- No removal of the Go sidecar in this batch (parallel running OK)
|
|
- No changes to boocontext's child-server architecture
|
|
- No new framework detectors (boocontext already has 20+ language extractors)
|
|
|
|
## Capabilities
|
|
|
|
### New Capabilities
|
|
- get_code_health — A-F code health grades per file, project health summary, hotspot identification, refactoring candidate ranking
|
|
- get_code_impact — Symbol-level trace merged with file-level blast radius. Single call replaces two-step get_symbol_info → get_blast_radius
|
|
- get_type_info — TypeScript type recovery: type signatures, interface definitions, generic constraints, cross-file type resolution
|
|
- get_code_map — DCP-compressed context map with compress toggle
|
|
- get_wiki_article — Persistent codebase wiki article by name, cached on disk
|
|
|
|
### Modified Capabilities
|
|
- Existing 12 codecontext tools transparently upgraded to boocontext backend (same agent interface, better data)
|
|
- codecontext_client.ts — gains MCP routing layer with Go sidecar fallback
|
|
|
|
## Metrics
|
|
- Go sidecar HTTP calls → 0 (all migrated to boocontext MCP)
|
|
- New tool surface area: 16 → 20 first-class tools
|
|
- Agent-visible tools: 16 unchanged names + 4 new names
|
|
- TypeScript type recovery: 0% → full TS-visible types on file context
|
|
- Code health awareness: 0 tools → 1 tool
|
|
- Impact analysis: 2-step → 1-step
|