Files
boocode/openspec/changes/domain2-code-intelligence/tasks.md
indifferentketchup 6fde7002aa docs: boocode-lift-analysis, openspec change docs, codesight cache, deps
- 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
2026-06-08 03:49:26 +00:00

5.2 KiB

Tasks — Domain 2: Codebase Context & Code Intelligence

Phase 1: Migration (5 tasks)

1. Route codecontext_client through boocontext MCP

Update apps/server/src/services/codecontext_client.ts to support dual routing:

  • Check CODECONTEXT_MCP env var — when set, route tool calls through the boocontext MCP client instead of HTTP to the Go sidecar
  • Map old tool names to boocontext equivalents:
    • get_codebase_overview → boocontext_overview
    • get_file_analysis → boocontext_map
    • get_symbol_info + get_symbol_details + search_symbols → boocontext_symbols
    • get_semantic_neighborhoods → boocontext_map
    • get_hot_files → boocontext_overview
    • get_framework_analysis → boocontext_overview
    • get_blast_radius → boocontext_impact
    • get_routes → boocontext_overview
    • get_middleware → boocontext_overview
    • get_dependencies → boocontext_callgraph
    • watch_changes → keep as-is (no boocontext equivalent)
  • Fall back to Go sidecar HTTP when boocontext unavailable
  • Preserve .codecontextignore handling, path validation, and truncation logic Verification: tsc --noEmit passes. Existing codecontext tests pass with both routing modes.

2. Add get_code_health tool

Create apps/server/src/services/tools/codecontext/get_code_health.ts

  • Wrap boocontext_health MCP tool
  • Schema: project path, optional file path for single-file health
  • Output: A-F grade per dimension (cohesion, coupling, complexity, documentation, duplication, unit size, test coverage) + project health summary + hotspots list + refactoring candidates
  • Register in tools/registry.ts ALL_TOOLS
  • Add to Architect, Refactorer, and Code Reviewer agent tool whitelists in data/AGENTS.md Verification: tsc --noEmit passes. Tool appears as get_code_health in /api/tools response.

3. Add get_code_impact tool

Create apps/server/src/services/tools/codecontext/get_code_impact.ts

  • Wrap boocontext_impact MCP tool
  • Schema: project path, symbol name, optional file path, depth (default 1)
  • Merges tree-sitter-analyzer symbol trace with codesight blast radius — single call
  • Register in ALL_TOOLS
  • Add to Architect and Planner agent whitelists Verification: tsc --noEmit passes. curl /api/tools shows get_code_impact.

4. Add get_type_info tool

Create apps/server/src/services/tools/codecontext/get_type_info.ts

  • Wrap boocontext_types MCP tool (backed by @nick-vi/type-inject-mcp)
  • Schema: project path, symbol name (regex), optional file path, kind filter (interface/type/class/function)
  • Output: type signatures, interface definitions, generic constraints, JSDoc, import paths
  • Register in ALL_TOOLS
  • Add to Code Reviewer, Debugger, Architect agent whitelists Verification: tsc --noEmit passes. Tool returns correct TypeScript types for known symbols.

5. Add get_code_map tool

Create apps/server/src/services/tools/codecontext/get_code_map.ts

  • Wrap boocontext_map MCP tool
  • Schema: project path, compress (boolean, default true)
  • DCP-compressed context map with filenames, sizes, import relationships
  • Register in ALL_TOOLS
  • Add to Recon agent whitelist Verification: tsc --noEmit passes. Map output is valid JSON with compress toggle working.

Phase 2: Hardening (2 tasks)

6. Fix type-inject child path

Update boocontext MCP environment:

  • Set BOOCONTEXT_TYPE_INJECT_NPX=@nick-vi/type-inject-mcp in docker-compose.yml or the boocontext MCP process env
  • Verify the hardcoded path /opt/forks/type-inject/packages/mcp/dist/index.js is no longer used Verification: boocontext_types tool works without /opt/forks/type-inject existing.

7. Add graceful degradation

Update boocontext child-server.ts or the tool wrappers:

  • On child MCP server failure (tree-sitter-analyzer or type-inject), retry once then fall back to codesight-only result
  • Return partial result with a warning message instead of hard error
  • Log the child failure for observability Verification: Unplug tree-sitter-analyzer → boocontext tools still return codesight-level results with a warning.

Phase 3: Wiki + Scanning (2 tasks)

8. Add get_wiki_article tool

Create apps/server/src/services/tools/codecontext/get_wiki_article.ts

  • Wraps codesight --wiki output via boocontext MCP
  • Schema: project path, article name (string)
  • Cache generated wiki articles to .codesight/ directory
  • First request generates the wiki; subsequent requests read cache
  • Register in ALL_TOOLS Verification: First call generates wiki; second call reads cache. Article content matches project structure.

9. Enable DCP compression on get_codebase_overview

Update get_codebase_overview.ts to pass compress: true for large projects

  • Adds configurable compress toggle (default: auto — compress when >50 files)
  • Matches boocontext_map's DCP pattern Verification: Large projects return compressed output under truncation limit.

Phase 4: Teardown (future, 1 task)

10. Deprecate Go sidecar

After all tools verified on boocontext MCP:

  • Mark codecontext Go sidecar as deprecated in docker-compose.yml comment
  • Add deprecation notice to codecontext/README.md
  • Remove from docker-compose.yml services block in a future batch
  • Remove codecontext/Dockerfile
  • Remove codecontext_client.ts Go HTTP path (keep MCP-only path)