From d84468681423ff1fc75429cf34cb9a3733e11e8a Mon Sep 17 00:00:00 2001 From: PatrickSys Date: Mon, 19 Oct 2026 23:40:07 +0200 Subject: [PATCH 1/2] docs: use published npm install commands --- README.md | 30 +++++++------ docs/capabilities.md | 22 +++++----- docs/cli.md | 52 +++++++++++------------ docs/client-setup.md | 58 ++++++++++++------------- docs/demo.md | 14 +++---- docs/review-context.md | 6 +-- tests/release-truth-surfaces.test.ts | 63 ++++++++++------------------ 7 files changed, 112 insertions(+), 133 deletions(-) diff --git a/README.md b/README.md index adab80b..6a45197 100644 --- a/README.md +++ b/README.md @@ -6,19 +6,17 @@ Codebase Context gives coding agents a map of your repository through MCP, for d ## Set up your AI client -**These commands use 2.4.0.** If that version is not available on npm yet, use the published 2.2.0 [setup guide](https://github.com/PatrickSys/codebase-context/blob/10ba0a635ff73cd5c5b011ffd5b31e7ed4656c65/docs/client-setup.md). - -Use Node.js 22 or newer. Choose your coding tool and run its command once; the examples target the 2.4.0 release: +Use Node.js 22 or newer. These commands use the current npm release of Codebase Context: ```bash # Claude Code -claude mcp add --scope user --transport stdio codebase-context -- npx -y codebase-context@2.4.0 +claude mcp add --scope user --transport stdio codebase-context -- npx -y codebase-context # Codex CLI -codex mcp add codebase-context -- npx -y codebase-context@2.4.0 +codex mcp add codebase-context -- npx -y codebase-context # OpenCode 1.x (keep the quoted separator on Windows) -opencode mcp add codebase-context '--' npx -y codebase-context@2.4.0 +opencode mcp add codebase-context '--' npx -y codebase-context ``` Start a new agent session in your project, then ask: @@ -27,7 +25,7 @@ Start a new agent session in your project, then ask: Replace `[feature]` with something you want to find. The first run downloads a local model and indexes the repository; time depends on repository size, CPU and model. -### New in 2.4.0 +### Planned for 2.4.0 (not yet published) - NestJS support from community contributor Aaron Olin. See the [analyzer details](./docs/capabilities.md#analyzers). - Better React/Next.js detection and a fix for reranker passage scoring. @@ -42,7 +40,7 @@ For Codex Desktop, create or merge `.codex/config.toml` in the project you want ```toml [mcp_servers.codebase-context] command = "npx" -args = ["-y", "codebase-context@2.4.0"] +args = ["-y", "codebase-context"] startup_timeout_sec = 120 ``` @@ -52,10 +50,10 @@ Other clients use their own setup commands: | Client | Shortest current setup | | --------------------------- | ---------------------------------------------------------------------------- | -| Gemini CLI | `gemini mcp add --scope user codebase-context npx -y codebase-context@2.4.0` | +| Gemini CLI | `gemini mcp add --scope user codebase-context npx -y codebase-context` | | Cursor | Add `.cursor/mcp.json` | | VS Code with GitHub Copilot | Add `.vscode/mcp.json` | -| GitHub Copilot CLI | `copilot mcp add codebase-context -- npx -y codebase-context@2.4.0` | +| GitHub Copilot CLI | `copilot mcp add codebase-context -- npx -y codebase-context` | | Windsurf | Add `~/.codeium/windsurf/mcp_config.json` | Check an existing same-name entry before replacing it. To give the server a default folder, append that folder's absolute path to the `npx` arguments. The [client setup guide](./docs/client-setup.md) covers scopes, optional fixed-folder configuration and the interactive setup wizard's limitations. @@ -72,7 +70,7 @@ The default connection is `stdio` (standard input/output): your client starts th ### Team patterns and examples -`get_team_patterns` shows the approaches used in the repository and points to representative files. Version `2.4.0` includes dedicated analyzers for Angular, React, Next.js and NestJS, with a generic analyzer for other stacks. +`get_team_patterns` shows the approaches used in the repository and points to representative files. Dedicated analyzers for Angular, React, Next.js and NestJS are planned for 2.4.0, which is not yet published on npm; the current npm release is 2.2.0. ### Project memory @@ -92,16 +90,16 @@ The same information is available from the terminal. Run these commands from you ```bash # Build or refresh the local index -npx -y codebase-context@2.4.0 reindex +npx -y codebase-context reindex # Repository structure, patterns, and representative files -npx -y codebase-context@2.4.0 map +npx -y codebase-context map # Ranked code search -npx -y codebase-context@2.4.0 search --query "auth middleware" +npx -y codebase-context search --query "auth middleware" # Current team patterns -npx -y codebase-context@2.4.0 patterns +npx -y codebase-context patterns ``` One stdio server can route across several repositories. Supply `project` in tool calls to select the intended repository; a successful selection becomes the default for later calls in that process. Some clients also announce workspace roots: one root can auto-select, while an ambiguous selection asks for a project instead of guessing. MCP deprecated Roots in its July 2026 revision, so explicit project selection is the documented default rather than a dependency on client discovery. @@ -157,7 +155,7 @@ The method and failures are documented so the measurements can be inspected with - Retrieval measurements describe expected-file coverage, file precision, and reported `peakPrivateGb`, not patch correctness or end-to-end coding quality. - The paired token observation covers two frozen investigation tasks and records observed agent behavior; it is not a universal token or time guarantee. - Setup checks differ by client. The detailed guide distinguishes a written config, a config recognized by the client, a local connection, and instructions checked only against official docs. -- Version `2.4.0` has dedicated Angular, React, Next.js and NestJS analyzers. Other projects use the generic analyzer and the language parsers available for that stack. +- Dedicated Angular, React, Next.js and NestJS analyzers are planned for 2.4.0, which is not yet published. Other projects use the generic analyzer and the language parsers available for that stack. - The default searchable-chunk limit is 5,000 per project. In `~/.codebase-context/config.json`, set `projects[].parsing.maxChunks` for a project that needs a higher limit. - The agent must identify its repository in tool calls when no default or unambiguous client root is available. Concurrent HTTP client isolation is not established by the stdio routing checks. diff --git a/docs/capabilities.md b/docs/capabilities.md index 7d1dea8..59eb9b5 100644 --- a/docs/capabilities.md +++ b/docs/capabilities.md @@ -1,8 +1,8 @@ # Capabilities Reference -Technical reference for Codebase Context 2.4.0. Start with the repository map, then search for relevant code. For an overview, see [README.md](../README.md). +Technical reference for the current Codebase Context npm release and the upcoming 2.4.0 source. Start with the repository map, then search for relevant code. For an overview, see [README.md](../README.md). -**These commands use 2.4.0.** If that version is not available on npm yet, use the published 2.2.0 [setup guide](https://github.com/PatrickSys/codebase-context/blob/10ba0a635ff73cd5c5b011ffd5b31e7ed4656c65/docs/client-setup.md). +Commands use the current npm release. Features marked as planned for 2.4.0 are not yet available from npm; the current published version is 2.2.0. ## Transport Modes @@ -10,8 +10,8 @@ The server supports two transport modes: | Mode | Command | MCP endpoint | | ------------------- | ------------------------------------------------- | ---------------------------- | -| **stdio** (default) | `npx -y codebase-context@2.4.0` | Spawned process stdin/stdout | -| **HTTP** | `npx -y codebase-context@2.4.0 --http [--port N]` | `http://127.0.0.1:3100/mcp` | +| **stdio** (default) | `npx -y codebase-context` | Spawned process stdin/stdout | +| **HTTP** | `npx -y codebase-context --http [--port N]` | `http://127.0.0.1:3100/mcp` | HTTP defaults to `127.0.0.1:3100`. Override with `--port`, `CODEBASE_CONTEXT_PORT`, or `server.port` in `~/.codebase-context/config.json`. @@ -29,7 +29,7 @@ Copy-pasteable client config templates are shipped in the package: - `templates/mcp/stdio/.mcp.json` — stdio setup for `.mcp.json`-style clients - `templates/mcp/http/.mcp.json` — HTTP setup for `.mcp.json`-style clients -Use Node.js 22 or newer with the 2.4.0 commands shown here. For setup commands and what was checked, see the [client setup guide](./client-setup.md). +Use Node.js 22 or newer with the commands shown here. For setup commands and what was checked, see the [client setup guide](./client-setup.md). ## CLI Reference @@ -56,11 +56,11 @@ Commands that list `--json` above support raw JSON output. Follow the [client se ```bash # Quick examples -npx -y codebase-context@2.4.0 status -npx -y codebase-context@2.4.0 search --query "auth middleware" --intent edit -npx -y codebase-context@2.4.0 refs --symbol "UserService" --limit 10 -npx -y codebase-context@2.4.0 cycles --scope src/features -npx -y codebase-context@2.4.0 reindex --incremental +npx -y codebase-context status +npx -y codebase-context search --query "auth middleware" --intent edit +npx -y codebase-context refs --symbol "UserService" --limit 10 +npx -y codebase-context cycles --scope src/features +npx -y codebase-context reindex --incremental ``` ## Tool Surface @@ -305,6 +305,6 @@ Reproducible evaluation is shipped as a CLI entrypoint backed by shared scoring - **Symbol refs are not a call-graph.** `get_symbol_references` counts identifier-node occurrences in the AST (comments/strings excluded via Tree-sitter). It does not distinguish call sites from type annotations, variable assignments, or imports. Full call-site-specific analysis (`call_expression` nodes only) is a roadmap item. - **Impact is 2-hop max.** `computeImpactCandidates` walks direct importers then their importers. Full BFS reachability is on the roadmap. -- **Version 2.4.0 has dedicated Angular, React, Next.js and NestJS analyzers.** Other languages use the Generic analyzer (30+ languages, chunking + import graph, no framework-specific signal extraction). +- **Planned for unpublished 2.4.0:** dedicated Angular, React, Next.js and NestJS analyzers. Other languages use the Generic analyzer (30+ languages, chunking + import graph, no framework-specific signal extraction). - **Default embedding model is `bge-small-en-v1.5` (512-token context).** Granite (8192 context) is opt-in via `EMBEDDING_MODEL`. OpenAI is opt-in via `EMBEDDING_PROVIDER=openai` — sends code externally. - **Patterns are file-level frequency counts.** Not semantic clustering. Rising/Declining trend is derived from git commit recency for files using each pattern, not from usage semantics. diff --git a/docs/cli.md b/docs/cli.md index 88d5b96..c561ab9 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -10,20 +10,20 @@ > Output depends on the repo you run it against. The examples below are illustrative (paths, counts, and detected frameworks will vary). > -> **These commands use 2.4.0.** If that version is not available on npm yet, use the published 2.2.0 [setup guide](https://github.com/PatrickSys/codebase-context/blob/10ba0a635ff73cd5c5b011ffd5b31e7ed4656c65/docs/client-setup.md). +> These commands use the current npm release. The examples are illustrative and were not captured from the current npm package. > -> These output examples come from an earlier CLI run; they were not captured from `2.4.0` and do not verify an MCP connection. +> These output examples come from an earlier CLI run and do not verify the current npm package or an MCP connection. > -> The commands below use `codebase-context@2.4.0` and require Node.js 22 or newer. The CLI is intentionally single-project per invocation and targets one root via `CODEBASE_ROOT` or the current working directory. MCP registration and project selection are covered in the [client setup guide](./client-setup.md). +> The commands below use `codebase-context` and require Node.js 22 or newer. The CLI is intentionally single-project per invocation and targets one root via `CODEBASE_ROOT` or the current working directory. MCP registration and project selection are covered in the [client setup guide](./client-setup.md). ## How to run ```bash # CLI only: run from a repo root, or set CODEBASE_ROOT explicitly: -CODEBASE_ROOT=/path/to/repo npx -y codebase-context@2.4.0 status +CODEBASE_ROOT=/path/to/repo npx -y codebase-context status # Commands that show --json in their help support machine output. Human mode is default. -npx -y codebase-context@2.4.0 patterns --json +npx -y codebase-context patterns --json ``` ### ASCII fallback @@ -31,7 +31,7 @@ npx -y codebase-context@2.4.0 patterns --json If your terminal doesn’t render Unicode box-drawing cleanly: ```bash -CODEBASE_CONTEXT_ASCII=1 npx -y codebase-context@2.4.0 patterns +CODEBASE_CONTEXT_ASCII=1 npx -y codebase-context patterns ``` ## Commands @@ -46,7 +46,7 @@ CODEBASE_CONTEXT_ASCII=1 npx -y codebase-context@2.4.0 patterns - `reindex` — rebuild index (full or incremental) - `style-guide` — find style guide sections in docs - `memory list|add|remove` — manage team memory (stored in `.codebase-context/memory.json`) -- MCP client registration — use the 2.4.0 recipes in the [client setup guide](./client-setup.md); `init` is an interactive HTTP setup wizard with the limitations described there +- MCP client registration — use the recipes in the [client setup guide](./client-setup.md); `init` is an interactive HTTP setup wizard with the limitations described there --- @@ -55,9 +55,9 @@ CODEBASE_CONTEXT_ASCII=1 npx -y codebase-context@2.4.0 patterns Run these CLI commands from the project root. Build or refresh the local index first; the first run downloads a local model and indexes the repository; time depends on repository size, CPU and model. Then inspect the conventions map and search for the code you need: ```bash -npx -y codebase-context@2.4.0 reindex -npx -y codebase-context@2.4.0 map -npx -y codebase-context@2.4.0 search --query "auth middleware" +npx -y codebase-context reindex +npx -y codebase-context map +npx -y codebase-context search --query "auth middleware" ``` This is the CLI preparation flow. It is separate from MCP client registration and does not by itself show that an MCP client connected successfully. @@ -65,8 +65,8 @@ This is the CLI preparation flow. It is separate from MCP client registration an ## `map` ```bash -npx -y codebase-context@2.4.0 reindex -npx -y codebase-context@2.4.0 map +npx -y codebase-context reindex +npx -y codebase-context map ``` The conventions map - run this first on an unfamiliar repo. It shows architecture layers, active patterns with adoption rates and trend direction, and the golden files the team treats as the strongest examples. This is also what the MCP server delivers to AI agents via the `codebase://context` resource on first call, before search narrows to a specific local example. @@ -101,7 +101,7 @@ Example output (truncated): ## `metadata` ```bash -npx -y codebase-context@2.4.0 metadata +npx -y codebase-context metadata ``` Example output: @@ -122,7 +122,7 @@ Example output: ## `patterns` ```bash -npx -y codebase-context@2.4.0 patterns +npx -y codebase-context patterns ``` Example output (truncated): @@ -144,8 +144,8 @@ Example output (truncated): ## `search` ```bash -npx -y codebase-context@2.4.0 reindex -npx -y codebase-context@2.4.0 search --query "file watcher" --intent edit --limit 3 +npx -y codebase-context reindex +npx -y codebase-context search --query "file watcher" --intent edit --limit 3 ``` Example output (truncated): @@ -166,7 +166,7 @@ Example output (truncated): ## `refs` ```bash -npx -y codebase-context@2.4.0 refs --symbol "startFileWatcher" --limit 10 +npx -y codebase-context refs --symbol "startFileWatcher" --limit 10 ``` Example output (truncated): @@ -185,7 +185,7 @@ Example output (truncated): ## `cycles` ```bash -npx -y codebase-context@2.4.0 cycles --scope src +npx -y codebase-context cycles --scope src ``` Example output: @@ -201,7 +201,7 @@ Example output: ## `status` ```bash -npx -y codebase-context@2.4.0 status +npx -y codebase-context status ``` Example output: @@ -220,8 +220,8 @@ Example output: ## `reindex` ```bash -npx -y codebase-context@2.4.0 reindex -npx -y codebase-context@2.4.0 reindex --incremental --reason "changed watcher logic" +npx -y codebase-context reindex +npx -y codebase-context reindex --incremental --reason "changed watcher logic" ``` > **MCP server mode**: if you're running codebase-context as an MCP server (long-running process), the index auto-refreshes via a file watcher — you don't need to call `reindex` between edits. Use `reindex` for one-shot CLI runs or to force a full rebuild. @@ -229,7 +229,7 @@ npx -y codebase-context@2.4.0 reindex --incremental --reason "changed watcher lo ## `style-guide` ```bash -npx -y codebase-context@2.4.0 style-guide --query "naming" +npx -y codebase-context style-guide --query "naming" ``` Example output: @@ -242,14 +242,14 @@ No style guides found. ## `memory` ```bash -npx -y codebase-context@2.4.0 memory list -npx -y codebase-context@2.4.0 memory list --query "watcher" +npx -y codebase-context memory list +npx -y codebase-context memory list --query "watcher" -npx -y codebase-context@2.4.0 memory add \ +npx -y codebase-context memory add \ --type gotcha \ --category tooling \ --memory "Use pnpm, not npm" \ --reason "Workspace support and speed" -npx -y codebase-context@2.4.0 memory remove +npx -y codebase-context memory remove ``` diff --git a/docs/client-setup.md b/docs/client-setup.md index 91e74e2..89b4965 100644 --- a/docs/client-setup.md +++ b/docs/client-setup.md @@ -1,18 +1,18 @@ # Client Setup -**These commands use 2.4.0.** If that version is not available on npm yet, use the published 2.2.0 [setup guide](https://github.com/PatrickSys/codebase-context/blob/10ba0a635ff73cd5c5b011ffd5b31e7ed4656c65/docs/client-setup.md). +These commands use the current npm release because the package name is unpinned. The current published version is 2.2.0; 2.4.0 is not yet published. -Codebase Context runs as a local MCP server: a tool your AI editor or command-line client can call while it works. Register it without a fixed folder, then let the agent supply its current repository through the `project` tool parameter. These recipes target the 2.4.0 release. +Codebase Context runs as a local MCP server: a tool your AI editor or command-line client can call while it works. Register it without a fixed folder, then let the agent supply its current repository through the `project` tool parameter. Use Node.js 22 or newer, as required by the package. The copyable registration commands target PowerShell or a POSIX terminal. Windows Command Prompt was not tested; OpenCode's quoted separator is shell-dependent. -## Client recipes for 2.4.0 +## Client recipes Claude Code, Codex CLI and OpenCode registration commands were checked again on October 6 without a project argument. The other clients retain their older config-shape evidence; no-folder native agent use is unverified for them. See the dated notes below. -Each client section says how far its earlier Windows check went. Those checks used published `2.2.0` unless another build is named; they do not verify the 2.4.0 commands: +Each client section says how far its earlier Windows check went. Those checks used published `2.2.0` unless another build is named; they do not verify upcoming unpublished changes: | Status | What it means | | ------------------------------ | ------------------------------------------------------------------------------------------ | @@ -27,7 +27,7 @@ After registration, start a new agent session in your project and ask: > Use Codebase Context to find [feature] in this repository. Pass this repository's absolute path as project when checking get_indexing_status and searching. Wait for indexing if needed, read codebase://context, then search_codebase and open a returned source file. Show me the relevant files. -The first run downloads a local model and indexes the repository; time depends on repository size, CPU and model. You can prepare it separately with `npx -y codebase-context@2.4.0 reindex` from the project folder. Index readiness, client connection and useful agent behavior are separate checks. +The first run downloads a local model and indexes the repository; time depends on repository size, CPU and model. You can prepare it separately with `npx -y codebase-context reindex` from the project folder. Index readiness, client connection and useful agent behavior are separate checks. ## Claude Code @@ -40,13 +40,13 @@ The first run downloads a local model and indexes the repository; time depends o User setup: ```bash -claude mcp add --scope user --transport stdio codebase-context -- npx -y codebase-context@2.4.0 +claude mcp add --scope user --transport stdio codebase-context -- npx -y codebase-context ``` Optional shared project setup: ```bash -claude mcp add --scope project --transport stdio codebase-context -- npx -y codebase-context@2.4.0 +claude mcp add --scope project --transport stdio codebase-context -- npx -y codebase-context ``` `--scope project` writes shared `.mcp.json` and requires project-server approval. `--scope local` instead stores a private association for the current project in `~/.claude.json`; it does not write `.mcp.json`. @@ -66,7 +66,7 @@ claude mcp add --scope project --transport stdio codebase-context -- npx -y code **Scope:** The command writes user config. A trusted project can use a project `.codex/config.toml` instead. ```bash -codex mcp add codebase-context -- npx -y codebase-context@2.4.0 +codex mcp add codebase-context -- npx -y codebase-context ``` Equivalent project config: @@ -74,7 +74,7 @@ Equivalent project config: ```toml [mcp_servers.codebase-context] command = "npx" -args = ["-y", "codebase-context@2.4.0"] +args = ["-y", "codebase-context"] startup_timeout_sec = 120 ``` @@ -84,14 +84,14 @@ startup_timeout_sec = 120 **Official docs:** [Codex MCP configuration](https://learn.chatgpt.com/docs/extend/mcp?surface=cli). The supported `startup_timeout_sec` option defaults to ten seconds; the project example allows 120 seconds for initial `npx` package preparation. This does not prove Desktop startup or guarantee completion of a cold download. -## Codex Desktop: 2.4.0 recipe +## Codex Desktop recipe Create or merge `.codex/config.toml` in the project you want to search. Preserve any existing settings: ```toml [mcp_servers.codebase-context] command = "npx" -args = ["-y", "codebase-context@2.4.0"] +args = ["-y", "codebase-context"] startup_timeout_sec = 120 ``` @@ -107,10 +107,10 @@ Run setup from the project you want the client to search: ```bash # Claude Code -npx -y codebase-context@2.4.0 init --client claude-code --yes +npx -y codebase-context init --client claude-code --yes # Codex -npx -y codebase-context@2.4.0 init --client codex --yes +npx -y codebase-context init --client codex --yes ``` Claude Code writes `.mcp.json`; Codex writes `.codex/config.toml`. Both configs start the installed server with the selected project. Setup uses the current folder unless `--root` or `CODEBASE_ROOT` selects another one; `--root` takes priority. @@ -121,15 +121,15 @@ Existing settings are kept. If a different Codebase Context entry is already pre ## Optional fixed-folder setup and CLI preparation -To set a default project before the first tool call, append its full path to the server arguments, for example `args = ["-y", "codebase-context@2.4.0", "C:/projects/my-app"]`. Use a quoted literal shell argument in registration commands. This makes the default fixed across repositories when the registration is user-scoped; explicit tool selection can still choose another allowed project. +To set a default project before the first tool call, append its full path to the server arguments, for example `args = ["-y", "codebase-context", "C:/projects/my-app"]`. Use a quoted literal shell argument in registration commands. This makes the default fixed across repositories when the registration is user-scoped; explicit tool selection can still choose another allowed project. To prepare the index separately, run from the project folder: ```powershell -npx -y codebase-context@2.4.0 reindex +npx -y codebase-context reindex ``` -The interactive wizard limitations described above are still present in the 2.4.0 source. A successful wizard exit alone does not establish working client registration. +The interactive wizard limitations described above are still present in the current source. A successful wizard exit alone does not establish working client registration. ## Gemini CLI @@ -142,13 +142,13 @@ The interactive wizard limitations described above are still present in the 2.4. User setup: ```bash -gemini mcp add --scope user codebase-context npx -y codebase-context@2.4.0 +gemini mcp add --scope user codebase-context npx -y codebase-context ``` Project setup: ```bash -gemini mcp add --scope project codebase-context npx -y codebase-context@2.4.0 +gemini mcp add --scope project codebase-context npx -y codebase-context ``` Gemini writes an `mcpServers` entry in its settings. Claude, Codex, and Copilot CLI use `--`; Gemini does not. @@ -174,7 +174,7 @@ Create `.cursor/mcp.json`: "mcpServers": { "codebase-context": { "command": "npx", - "args": ["-y", "codebase-context@2.4.0"] + "args": ["-y", "codebase-context"] } } } @@ -199,7 +199,7 @@ Checked config shape: `.cursor/mcp.json with mcpServers.codebase-context command Official user command: ```powershell -code --add-mcp '{"name":"codebase-context","command":"npx","args":["-y","codebase-context@2.4.0"]}' +code --add-mcp '{"name":"codebase-context","command":"npx","args":["-y","codebase-context"]}' ``` Deterministic workspace config at `.vscode/mcp.json`: @@ -209,7 +209,7 @@ Deterministic workspace config at `.vscode/mcp.json`: "servers": { "codebase-context": { "command": "npx", - "args": ["-y", "codebase-context@2.4.0"] + "args": ["-y", "codebase-context"] } } } @@ -230,7 +230,7 @@ Deterministic workspace config at `.vscode/mcp.json`: **Scope:** User config. ```bash -copilot mcp add codebase-context -- npx -y codebase-context@2.4.0 +copilot mcp add codebase-context -- npx -y codebase-context ``` **What was checked:** The command ran with an isolated `--config-dir` and wrote the expected `mcp-config.json` command, arguments, and tool filter. @@ -250,7 +250,7 @@ copilot mcp add codebase-context -- npx -y codebase-context@2.4.0 Run once: ```bash -opencode mcp add codebase-context '--' npx -y codebase-context@2.4.0 +opencode mcp add codebase-context '--' npx -y codebase-context ``` Keep the quoted `'--'`: the installed Windows PowerShell npm shim consumes an unquoted separator. The quoted form also works in POSIX shells. @@ -263,7 +263,7 @@ For a project-local alternative, merge this into `opencode.json`: "mcp": { "codebase-context": { "type": "local", - "command": ["npx", "-y", "codebase-context@2.4.0"], + "command": ["npx", "-y", "codebase-context"], "enabled": true, "timeout": 120000 } @@ -296,7 +296,7 @@ Create `~/.codeium/windsurf/mcp_config.json`: "mcpServers": { "codebase-context": { "command": "npx", - "args": ["-y", "codebase-context@2.4.0"] + "args": ["-y", "codebase-context"] } } } @@ -315,11 +315,11 @@ Checked config shape: `~/.codeium/windsurf/mcp_config.json with mcpServers.codeb Use `stdio` for the simplest setup. HTTP can let several clients share one long-running local process, but support depends on the client and this path is not part of the default setup proof: ```bash -npx -y codebase-context@2.4.0 --http -npx -y codebase-context@2.4.0 --http --port 4000 +npx -y codebase-context --http +npx -y codebase-context --http --port 4000 ``` -The documented default endpoint is `http://127.0.0.1:3100/mcp`. Config-shape templates are available in [`templates/mcp/stdio/.mcp.json`](../templates/mcp/stdio/.mcp.json) and [`templates/mcp/http/.mcp.json`](../templates/mcp/http/.mcp.json); pin the published package as in the recipes above. HTTP does not discover a client's project folder; the agent still has to select its repository. +The documented default endpoint is `http://127.0.0.1:3100/mcp`. Config-shape templates are available in [`templates/mcp/stdio/.mcp.json`](../templates/mcp/stdio/.mcp.json) and [`templates/mcp/http/.mcp.json`](../templates/mcp/http/.mcp.json); the recipes use the current npm release. HTTP does not discover a client's project folder; the agent still has to select its repository. The [MCP July 28, 2026 HTTP revision](https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http) removed protocol sessions and the GET stream endpoint. This source checkout uses SDK 1.27.1 and the earlier protocol/session model. The stdio checks do not validate its concurrent HTTP project isolation or compatibility with the new revision. A protocol migration and host testing are separate from these setup recipes. @@ -335,7 +335,7 @@ Some clients also announce workspace roots. One valid root can auto-select; seve [MCP deprecated Roots on July 28, 2026](https://modelcontextprotocol.io/specification/2026-07-28/client/roots), recommending explicit directories/files in tool parameters, resource URIs or server configuration. CBC's older Roots support remains a compatibility aid rather than a required setup step. -October 6 verification: 18 focused current-source routing tests passed, including ambiguous roots, explicit selection, subsequent calls and root changes. The exact published `2.2.0` server also switched between two isolated prepared repositories A to B to A in one no-roots stdio process; search paths, context map and subsequent status calls followed each selection, and the runner host opened the expected distinct sources. This historical package check does not verify `2.4.0` or establish concurrent HTTP isolation. A native agent session across real repositories remains a validation step; stdio process-local selection does not establish concurrent HTTP isolation. +October 6 verification: 18 focused current-source routing tests passed, including ambiguous roots, explicit selection, subsequent calls and root changes. The exact published `2.2.0` server also switched between two isolated prepared repositories A to B to A in one no-roots stdio process; search paths, context map and subsequent status calls followed each selection, and the runner host opened the expected distinct sources. This historical package check does not verify newer source changes or establish concurrent HTTP isolation. A native agent session across real repositories remains a validation step; stdio process-local selection does not establish concurrent HTTP isolation. A follow-up recorded raw `search_codebase` calls containing only `query` and `mode`, with no `project`: they returned A, B and A after those explicit selections. The caller does not automatically add the full path; CBC routes omitted-project calls using its selected project. This state lasts for that stdio process. Select again after a server restart or when changing repositories. diff --git a/docs/demo.md b/docs/demo.md index 81d0021..407fd82 100644 --- a/docs/demo.md +++ b/docs/demo.md @@ -2,16 +2,16 @@ This walkthrough shows real CLI output captured from the open-source `angular-spotify` repository during a local proof run. That sample checkout is not bundled here. -**These commands use 2.4.0.** If that version is not available on npm yet, use the published 2.2.0 [setup guide](https://github.com/PatrickSys/codebase-context/blob/10ba0a635ff73cd5c5b011ffd5b31e7ed4656c65/docs/client-setup.md). +These commands use the current npm release. The output shown below is historical and does not establish behavior of that release. -To try the same CLI flow, use Node.js 22 or newer and open a terminal in the repository you want to inspect. These commands target `codebase-context@2.4.0`; the CLI uses the current directory as the project root. MCP registration and project selection are covered in the [client setup guide](./client-setup.md). +To try the same CLI flow, use Node.js 22 or newer and open a terminal in the repository you want to inspect. These commands target `codebase-context`; the CLI uses the current directory as the project root. MCP registration and project selection are covered in the [client setup guide](./client-setup.md). -The saved output below is from an earlier CLI run, not from `2.4.0` or the commands shown here. The machine-specific repository root is omitted from the returned file path. This capture does not verify the current package or an MCP connection. +The saved output below is from an earlier CLI run, not from the current commands. The machine-specific repository root is omitted from the returned file path. This capture does not verify the current package or an MCP connection. ## 0. Build The Local Index ```bash -npx -y codebase-context@2.4.0 reindex +npx -y codebase-context reindex ``` Run this before the first map or search in a repository. Later runs can use `reindex --incremental` after the code changes. @@ -19,7 +19,7 @@ Run this before the first map or search in a repository. Later runs can use `rei ## 1. Start With The Conventions Map ```bash -npx -y codebase-context@2.4.0 map --json +npx -y codebase-context map --json ``` Captured output excerpt: @@ -52,7 +52,7 @@ What this shows: ## 2. Search With Edit Intent ```bash -npx -y codebase-context@2.4.0 search --query "auth headers" --intent edit --limit 3 --json +npx -y codebase-context search --query "auth headers" --intent edit --limit 3 --json ``` Captured output excerpt: @@ -93,7 +93,7 @@ What this shows: ## 3. Check A Team Pattern Directly ```bash -npx -y codebase-context@2.4.0 patterns --category state --json +npx -y codebase-context patterns --category state --json ``` Captured output excerpt: diff --git a/docs/review-context.md b/docs/review-context.md index f21b3d6..1968f56 100644 --- a/docs/review-context.md +++ b/docs/review-context.md @@ -4,7 +4,7 @@ It is deliberately **not** an AI reviewer. It does not call an LLM, decide whether code is correct, or post comments. Its job is narrower and testable: compile the changed surface, stable diff signals, related codebase context, and current conventions into a versioned input for a reviewer or evaluation harness. -**These commands use 2.4.0.** If that version is not available on npm yet, use the published 2.2.0 [setup guide](https://github.com/PatrickSys/codebase-context/blob/10ba0a635ff73cd5c5b011ffd5b31e7ed4656c65/docs/client-setup.md). +These commands use the current npm release through the unpinned package name. ## Why this exists @@ -28,13 +28,13 @@ node dist/review-bin.js --base origin/main --head HEAD After package publication, the package also exposes: ```bash -npm exec --yes --package=codebase-context@2.4.0 -- codebase-context-review --base origin/main --head HEAD +npm exec --yes --package=codebase-context -- codebase-context-review --base origin/main --head HEAD ``` Use `--json` for the complete machine-readable packet: ```bash -npm exec --yes --package=codebase-context@2.4.0 -- codebase-context-review \ +npm exec --yes --package=codebase-context -- codebase-context-review \ --base origin/main \ --head HEAD \ --max-queries 8 \ diff --git a/tests/release-truth-surfaces.test.ts b/tests/release-truth-surfaces.test.ts index b2186a2..f0ecc30 100644 --- a/tests/release-truth-surfaces.test.ts +++ b/tests/release-truth-surfaces.test.ts @@ -126,47 +126,28 @@ describe('release truth surfaces', () => { ); }); - it('keeps 2.4.0 setup guidance accurate before and after publication', () => { - const versionNotice = 'These commands use 2.4.0.'; - const fallbackNotice = 'If that version is not available on npm yet, use the published 2.2.0'; - const currentVersionGuide = - 'https://github.com/PatrickSys/codebase-context/blob/10ba0a635ff73cd5c5b011ffd5b31e7ed4656c65/docs/client-setup.md'; - const setupPages = [ - [ - 'README.md', - 'claude mcp add --scope user --transport stdio codebase-context -- npx -y codebase-context@2.4.0' - ], - [ - 'docs/client-setup.md', - 'claude mcp add --scope user --transport stdio codebase-context -- npx -y codebase-context@2.4.0' - ], - ['docs/capabilities.md', '| **stdio** (default) |'], - ['docs/cli.md', 'CODEBASE_ROOT=/path/to/repo npx -y codebase-context@2.4.0 status'], - ['docs/demo.md', 'npx -y codebase-context@2.4.0 reindex'], - ['docs/review-context.md', 'pnpm build'] - ] as const; - - for (const [path, firstCommand] of setupPages) { - const page = readText(path); - const noticeIndex = page.indexOf(versionNotice); - const guideIndex = page.indexOf(currentVersionGuide); - const commandIndex = page.indexOf(firstCommand); - - expect( - noticeIndex, - `${path} should explain the current-version fallback` - ).toBeGreaterThanOrEqual(0); - expect(guideIndex, `${path} should link the published 2.2.0 setup`).toBeGreaterThan( - noticeIndex - ); - expect(page.slice(noticeIndex, guideIndex)).toContain(fallbackNotice); - expect(page.slice(noticeIndex, guideIndex)).toContain('[setup guide]('); - expect(page).not.toContain('**2.4.0 setup preview:**'); - expect(commandIndex, `${path} should retain its first runnable command`).toBeGreaterThan(0); - expect(noticeIndex, `${path} should qualify commands before they appear`).toBeLessThan( - commandIndex - ); - } + it('keeps pinned install commands on the published npm version', () => { + const publishedVersion = '2.2.0'; + const userFacingDocs = [ + 'README.md', + 'docs/capabilities.md', + 'docs/cli.md', + 'docs/client-setup.md', + 'docs/demo.md', + 'docs/review-context.md', + 'docs/templates.md' + ]; + const pinnedCommands = userFacingDocs.flatMap((path) => { + const page = readOptionalText(path); + if (!page) return []; + return [...page.matchAll(/codebase-context@(\d+\.\d+\.\d+)/g)] + .filter((match) => match[1] !== publishedVersion) + .map((match) => `${path}: ${match[0]}`); + }); + + expect(pinnedCommands).toEqual([]); + expect(readText('README.md')).toContain('npx -y codebase-context'); + expect(readText('docs/client-setup.md')).toContain('npx -y codebase-context'); }); it('does not describe the unpublished 2.4.0 preview as current or published', () => { From 4bacc277dea0a787422a5f2cf7047e33f9f2b2cf Mon Sep 17 00:00:00 2001 From: PatrickSys Date: Tue, 20 Oct 2026 09:06:46 +0200 Subject: [PATCH 2/2] docs: keep 2.2.0 analyzers current and mark 2.4.0-only commands Addresses Codex/Greptile review on #141: Angular/React/Next.js analyzers ship in 2.2.0 (only NestJS is upcoming); init --client/--yes, codebase-context-review and parsing.maxChunks require unpublished 2.4.0, so those commands are pinned and labelled. Release-truth test allows 2.4.0 pins only next to a 'requires 2.4.0' note. --- README.md | 6 +++--- docs/capabilities.md | 6 +++--- docs/client-setup.md | 12 +++++++----- docs/review-context.md | 10 +++++----- tests/release-truth-surfaces.test.ts | 23 ++++++++++++++++++++++- 5 files changed, 40 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 6a45197..aa7f416 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ The default connection is `stdio` (standard input/output): your client starts th ### Team patterns and examples -`get_team_patterns` shows the approaches used in the repository and points to representative files. Dedicated analyzers for Angular, React, Next.js and NestJS are planned for 2.4.0, which is not yet published on npm; the current npm release is 2.2.0. +`get_team_patterns` shows the approaches used in the repository and points to representative files. Dedicated analyzers for Angular, React, and Next.js ship in published 2.2.0; NestJS support (along with React and Next.js detection improvements and a reranker fix) is planned for unpublished 2.4.0. ### Project memory @@ -155,8 +155,8 @@ The method and failures are documented so the measurements can be inspected with - Retrieval measurements describe expected-file coverage, file precision, and reported `peakPrivateGb`, not patch correctness or end-to-end coding quality. - The paired token observation covers two frozen investigation tasks and records observed agent behavior; it is not a universal token or time guarantee. - Setup checks differ by client. The detailed guide distinguishes a written config, a config recognized by the client, a local connection, and instructions checked only against official docs. -- Dedicated Angular, React, Next.js and NestJS analyzers are planned for 2.4.0, which is not yet published. Other projects use the generic analyzer and the language parsers available for that stack. -- The default searchable-chunk limit is 5,000 per project. In `~/.codebase-context/config.json`, set `projects[].parsing.maxChunks` for a project that needs a higher limit. +- Dedicated Angular, React, and Next.js analyzers ship in published 2.2.0; NestJS support is planned for unpublished 2.4.0. Other projects use the generic analyzer and the language parsers available for that stack. +- The default searchable-chunk limit is 5,000 per project. Customizing this via `projects[].parsing.maxChunks` in `~/.codebase-context/config.json` requires 2.4.0 (not yet published). - The agent must identify its repository in tool calls when no default or unambiguous client root is available. Concurrent HTTP client isolation is not established by the stdio routing checks. ## Reference diff --git a/docs/capabilities.md b/docs/capabilities.md index 59eb9b5..825c2fe 100644 --- a/docs/capabilities.md +++ b/docs/capabilities.md @@ -22,7 +22,7 @@ Per-project config overrides supported today: - `projects[].excludePatterns`: merged with the built-in exclusion set for that project at index time - `projects[].analyzerHints.analyzer`: prefers a registered analyzer by name for that project and falls back safely when the name is missing or invalid - `projects[].analyzerHints.extensions`: adds project-local source extensions for indexing and auto-refresh watching without changing defaults for other projects -- `projects[].parsing.maxChunks`: sets the maximum number of searchable chunks indexed for that project +- `projects[].parsing.maxChunks`: sets the maximum number of searchable chunks indexed for that project (requires 2.4.0, not yet published) Copy-pasteable client config templates are shipped in the package: @@ -276,7 +276,7 @@ Impact is 2-hop transitive: direct importers (hop 1) and their importers (hop 2) - **Angular**: signals, standalone components, control flow syntax, lifecycle hooks, DI patterns, component metadata - **React**: function/class components, custom hooks, context usage, memoization, Suspense, ecosystem signal extraction - **Next.js**: App Router and Pages Router detection, route/API classification, route paths, `"use client"`, metadata exports -- **NestJS**: modules, controllers, providers and route handlers, contributed by Aaron Olin. Matching NestJS source is detected automatically. +- **NestJS** (planned for 2.4.0, not yet published): modules, controllers, providers and route handlers, contributed by Aaron Olin. Matching NestJS source is detected automatically. - **Generic**: 30+ have indexing/retrieval coverage including PHP, Ruby, Swift, Scala, Shell, config/markup., 10 languages have full symbol extraction (Tree-sitter: TypeScript, JavaScript, Python, Java, Kotlin, C, C++, C#, Go, Rust). Notes: @@ -305,6 +305,6 @@ Reproducible evaluation is shipped as a CLI entrypoint backed by shared scoring - **Symbol refs are not a call-graph.** `get_symbol_references` counts identifier-node occurrences in the AST (comments/strings excluded via Tree-sitter). It does not distinguish call sites from type annotations, variable assignments, or imports. Full call-site-specific analysis (`call_expression` nodes only) is a roadmap item. - **Impact is 2-hop max.** `computeImpactCandidates` walks direct importers then their importers. Full BFS reachability is on the roadmap. -- **Planned for unpublished 2.4.0:** dedicated Angular, React, Next.js and NestJS analyzers. Other languages use the Generic analyzer (30+ languages, chunking + import graph, no framework-specific signal extraction). +- **Planned for unpublished 2.4.0:** NestJS analyzer support, React and Next.js detection improvements, and reranker fixes. Dedicated Angular, React, and Next.js analyzers already ship in published 2.2.0. Other languages use the Generic analyzer (30+ languages, chunking + import graph, no framework-specific signal extraction). - **Default embedding model is `bge-small-en-v1.5` (512-token context).** Granite (8192 context) is opt-in via `EMBEDDING_MODEL`. OpenAI is opt-in via `EMBEDDING_PROVIDER=openai` — sends code externally. - **Patterns are file-level frequency counts.** Not semantic clustering. Rising/Declining trend is derived from git commit recency for files using each pattern, not from usage semantics. diff --git a/docs/client-setup.md b/docs/client-setup.md index 89b4965..4ad2c3e 100644 --- a/docs/client-setup.md +++ b/docs/client-setup.md @@ -103,19 +103,21 @@ On October 6 the exact published `2.2.0` `npx` entrypoint was tested without a f ## Interactive setup wizard +> **Requires 2.4.0 (not yet published)**: The non-interactive `--client` and `--yes` flags are not available in published 2.2.0 (which runs an interactive HTTP wizard). These commands require the unpublished 2.4.0 release and will not work with the current npm release. + Run setup from the project you want the client to search: ```bash -# Claude Code -npx -y codebase-context init --client claude-code --yes +# Claude Code (requires 2.4.0, not yet published) +npx -y codebase-context@2.4.0 init --client claude-code --yes -# Codex -npx -y codebase-context init --client codex --yes +# Codex (requires 2.4.0, not yet published) +npx -y codebase-context@2.4.0 init --client codex --yes ``` Claude Code writes `.mcp.json`; Codex writes `.codex/config.toml`. Both configs start the installed server with the selected project. Setup uses the current folder unless `--root` or `CODEBASE_ROOT` selects another one; `--root` takes priority. -`--yes` writes the config without prompts. Run `init` without flags to choose a client interactively and optionally add project instructions. Cursor and OpenCode still use HTTP and need a separately running server. +`--yes` writes the config without prompts. In 2.2.0, running `init` without flags starts the older interactive wizard. Cursor and OpenCode still use HTTP and need a separately running server. Existing settings are kept. If a different Codebase Context entry is already present, setup leaves the file unchanged and reports the conflict. Restart the client after setup and approve the server if asked. The first use builds the code index. Rerun setup if the Codebase Context installation moves, because the config uses its installed location. diff --git a/docs/review-context.md b/docs/review-context.md index 1968f56..964a9b4 100644 --- a/docs/review-context.md +++ b/docs/review-context.md @@ -4,7 +4,7 @@ It is deliberately **not** an AI reviewer. It does not call an LLM, decide whether code is correct, or post comments. Its job is narrower and testable: compile the changed surface, stable diff signals, related codebase context, and current conventions into a versioned input for a reviewer or evaluation harness. -These commands use the current npm release through the unpinned package name. +The packaged review CLI requires the unpublished 2.4.0 release (the `codebase-context-review` executable does not exist in published 2.2.0); until then, use the source-build command shown below. ## Why this exists @@ -25,16 +25,16 @@ pnpm build node dist/review-bin.js --base origin/main --head HEAD ``` -After package publication, the package also exposes: +Requires 2.4.0 (not yet published): after package publication, the package also exposes: ```bash -npm exec --yes --package=codebase-context -- codebase-context-review --base origin/main --head HEAD +npm exec --yes --package=codebase-context@2.4.0 -- codebase-context-review --base origin/main --head HEAD ``` -Use `--json` for the complete machine-readable packet: +Use `--json` for the complete machine-readable packet (requires 2.4.0, not yet published): ```bash -npm exec --yes --package=codebase-context -- codebase-context-review \ +npm exec --yes --package=codebase-context@2.4.0 -- codebase-context-review \ --base origin/main \ --head HEAD \ --max-queries 8 \ diff --git a/tests/release-truth-surfaces.test.ts b/tests/release-truth-surfaces.test.ts index f0ecc30..593c096 100644 --- a/tests/release-truth-surfaces.test.ts +++ b/tests/release-truth-surfaces.test.ts @@ -141,13 +141,34 @@ describe('release truth surfaces', () => { const page = readOptionalText(path); if (!page) return []; return [...page.matchAll(/codebase-context@(\d+\.\d+\.\d+)/g)] - .filter((match) => match[1] !== publishedVersion) + .filter((match) => { + const version = match[1]; + if (version === publishedVersion) { + return false; + } + if ( + version === '2.4.0' && + (path === 'docs/review-context.md' || path === 'docs/client-setup.md') + ) { + const index = match.index ?? 0; + const surroundingText = page.slice( + Math.max(0, index - 300), + Math.min(page.length, index + 300) + ); + if (/requires\s+(?:the\s+unpublished\s+)?2\.4\.0/i.test(surroundingText)) { + return false; + } + } + return true; + }) .map((match) => `${path}: ${match[0]}`); }); expect(pinnedCommands).toEqual([]); expect(readText('README.md')).toContain('npx -y codebase-context'); expect(readText('docs/client-setup.md')).toContain('npx -y codebase-context'); + expect(readText('docs/client-setup.md')).toContain('codebase-context@2.4.0 init'); + expect(readText('docs/review-context.md')).toContain('--package=codebase-context@2.4.0'); }); it('does not describe the unpublished 2.4.0 preview as current or published', () => {