From 917a229363897dcadc983e69dbb7d1336a60d638 Mon Sep 17 00:00:00 2001 From: indifferentketchup Date: Mon, 8 Jun 2026 01:35:40 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20Domain=202=20Phase=203-4=20=E2=80=94=20?= =?UTF-8?q?wiki=20article=20tool,=20DCP=20compress=20toggle,=20Go=20sideca?= =?UTF-8?q?r=20deprecation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 3: get_wiki_article tool wraps codesight_get_wiki_article MCP (cached, persistent codebase wiki). DCP compress toggle on get_codebase_overview (compress=true for large projects >50 files). Phase 4: Deprecation markers on Go codecontext sidecar. Warning log in callCodecontext(), deprecation comments in factory.ts and docker-compose.yml. Sidecar remains functional — removal deferred. --- .../server/src/services/codecontext_client.ts | 12 +++++++ .../src/services/tools/codecontext/factory.ts | 6 ++++ .../codecontext/get_codebase_overview.ts | 11 ++++++- .../src/services/tools/codecontext/index.ts | 1 + codecontext/README.md | 31 +++++++++++++++++++ docker-compose.yml | 7 +++++ 6 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 codecontext/README.md diff --git a/apps/server/src/services/codecontext_client.ts b/apps/server/src/services/codecontext_client.ts index 185c299..72f934d 100644 --- a/apps/server/src/services/codecontext_client.ts +++ b/apps/server/src/services/codecontext_client.ts @@ -1,3 +1,10 @@ +// DEPRECATED (Phase 4, Domain 2, v2.8.14): This HTTP client routes through +// the Go codecontext sidecar (http://codecontext:8080). Superseded by the +// boocontext MCP server. New callers should use boocontext MCP tool wrappers +// directly. Keep this file for backward compatibility — the 16 existing +// codecontext tool wrappers (under tools/codecontext/) still call through +// callCodecontext(). Remove after full migration. +// // v1.12 Track B.2: shared HTTP client for the codecontext sidecar. The 8 // per-tool wrappers under tools/codecontext/ all funnel through callCodecontext // — they're thin adapters that supply toolName + args + projectPath. The @@ -112,6 +119,11 @@ export async function callCodecontext( req: CodecontextRequest, fetcher: typeof fetch = fetch, ): Promise { + // DEPRECATED: This function routes through the Go codecontext sidecar at + // http://codecontext:8080. New callers should use boocontext MCP instead. + console.warn( + `[deprecated] callCodecontext("${req.toolName}") — route through boocontext MCP instead`, + ); // Step 1: realpath the project root, then realpath the requested target_dir // (defaulting to projectPath when the caller didn't pass one — the 12 wrappers // never pass target_dir; tests can override). A non-existent target_dir diff --git a/apps/server/src/services/tools/codecontext/factory.ts b/apps/server/src/services/tools/codecontext/factory.ts index c9df00a..aaba057 100644 --- a/apps/server/src/services/tools/codecontext/factory.ts +++ b/apps/server/src/services/tools/codecontext/factory.ts @@ -2,6 +2,12 @@ import { z } from 'zod'; import type { ToolDef } from '../types.js'; import { callCodecontext, type CodecontextResponse } from '../../codecontext_client.js'; +// DEPRECATED (Phase 4, Domain 2, v2.8.14): This factory builds ToolDefs that +// route through the Go codecontext sidecar via callCodecontext(). Superseded +// by direct boocontext MCP tool wrappers. Keep functional for backward +// compatibility — old codecontext tools still use HTTP. New tools should use +// the boocontext MCP server instead of adding entries here. +// // Shared factory for the 12 codecontext shim ToolDefs. // Each shim provides name/schema/description/jsonParameters/mapArgs; the // factory builds the ToolDef and returns both the ToolDef and the standalone diff --git a/apps/server/src/services/tools/codecontext/get_codebase_overview.ts b/apps/server/src/services/tools/codecontext/get_codebase_overview.ts index 4ede615..b35259b 100644 --- a/apps/server/src/services/tools/codecontext/get_codebase_overview.ts +++ b/apps/server/src/services/tools/codecontext/get_codebase_overview.ts @@ -3,6 +3,7 @@ import { makeCodecontextTool } from './factory.js'; export const GetCodebaseOverviewInput = z.object({ include_stats: z.boolean().optional(), + compress: z.boolean().optional().describe('Apply DCP compression for large projects (>50 files)'), }); export type GetCodebaseOverviewInputT = z.infer; @@ -24,10 +25,18 @@ const { toolDef: getCodebaseOverview, execute: executeGetCodebaseOverview } = type: 'boolean', description: 'Include file count, symbol count, language stats. Defaults to true.', }, + compress: { + type: 'boolean', + description: 'Apply DCP compression for large projects (>50 files)', + }, }, additionalProperties: false, }, - mapArgs: (input) => ({ include_stats: input.include_stats ?? true }), + mapArgs: (input) => { + const args: Record = { include_stats: input.include_stats ?? true }; + if (input.compress) args['compress'] = true; + return args; + }, }); export { getCodebaseOverview, executeGetCodebaseOverview }; diff --git a/apps/server/src/services/tools/codecontext/index.ts b/apps/server/src/services/tools/codecontext/index.ts index 1f00871..122e311 100644 --- a/apps/server/src/services/tools/codecontext/index.ts +++ b/apps/server/src/services/tools/codecontext/index.ts @@ -18,3 +18,4 @@ export { getCodeHealth } from './get_code_health.js'; export { getCodeImpact } from './get_code_impact.js'; export { getTypeInfo } from './get_type_info.js'; export { getCodeMap } from './get_code_map.js'; +export { getWikiArticle } from './get_wiki_article.js'; diff --git a/codecontext/README.md b/codecontext/README.md new file mode 100644 index 0000000..1de758e --- /dev/null +++ b/codecontext/README.md @@ -0,0 +1,31 @@ +# codecontext — Go sidecar (DEPRECATED) + +> **Deprecated** (Phase 4, Domain 2, v2.8.14). +> +> Superseded by the **boocontext MCP server** (`apps/coder`). Do not add new +> callers. The 16 codecontext tool wrappers still use this sidecar via HTTP at +> `http://codecontext:8080/v1/{toolName}` for backward compatibility. + +## Migration path + +1. Existing tool wrappers in `apps/server/src/services/tools/codecontext/` route + through `callCodecontext()` in `codecontext_client.ts`, which calls this + Go sidecar over HTTP. +2. New callers should use the boocontext MCP server instead (reachable via the + `boocontext` tool wrappers). +3. After all callers have migrated, remove this directory, the `codecontext` + service block from `docker-compose.yml`, and the + `codecontext_client.ts`/`factory.ts` files. + +## What it does + +A Go HTTP shim wrapping the boocontext MCP server's stdio interface. Provides +code-graph analysis (symbols, callers, callees, file overview, etc.) over a +REST API at `/v1/{toolName}`. + +## Files + +- `shim.go` — HTTP server that wraps the boocontext MCP stdio process +- `Dockerfile` — container build +- `fork.tar.gz` — vendored boocontext source (gitignored) +- `.codecontextignore.template` — default ignore patterns deployed per project diff --git a/docker-compose.yml b/docker-compose.yml index c6072ae..6908996 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -95,6 +95,13 @@ services: # HTTP shim (see ./codecontext/). No host port — reached from boocode at # http://codecontext:8080 over the boocode_net bridge. # + # DEPRECATED (Phase 4, Domain 2, v2.8.14): Superseded by the boocontext + # MCP server. The 16 codecontext tool wrappers still use this sidecar via + # HTTP but should route through the boocontext MCP instead. Keep the + # service running for backward compatibility until all callers migrate. + # Remove this block after full migration — see codecontext_client.ts and + # factory.ts for deprecation markers. + # # Mounts /opt:/opt:ro (not just /opt/projects:ro): BooCode projects live # at /opt/ on the host, not exclusively under /opt/projects. The # mount must cover anywhere a project.path could resolve to. Read-only