Skip to content

Commit abec46c

Browse files
committed
harden: doc fact-check fixes and roadmap prune
Lift shipped agent milestones to agents.md, prune roadmap [x] backlog, and align docs with code (apply conflict count, SCHEMA_VERSION 40, benchmark fan-out pairing, marketplace/substrate plan metadata).
1 parent bd0b094 commit abec46c

10 files changed

Lines changed: 34 additions & 38 deletions

File tree

.agents/skills/audit-pr-architecture/SKILL.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ Use codemap's own queries — same substrate for boundary checks, dead code, com
9696
bun src/index.ts audit --base origin/main --json # delta vs base ref
9797
bun src/index.ts query --json --recipe untested-and-dead
9898
bun src/index.ts query --json --recipe unimported-exports
99+
bun src/index.ts query --json --recipe duplicates
100+
# high-complexity-untested: ingest coverage first or COALESCE treats missing as 0%
99101
bun src/index.ts query --json --recipe high-complexity-untested
100102
```
101103

@@ -109,7 +111,7 @@ Apply these verdicts to results:
109111
| `high-complexity-untested` row added by the PR | **Untested orchestration** — split or test before merge. |
110112
| Unused dependency in `package.json` | Out of scope for this audit unless the PR added it. |
111113

112-
Duplication / structural-clone detection (AST-hash) is a [roadmap item](../../../docs/roadmap.md#backlog) and not yet a substrate column — for now, eyeball clones in the diff or use ad-hoc text grep.
114+
Duplication / structural-clone detection ships via `symbols.body_hash` and the `duplicates` recipe — see [glossary § body_hash](../../../docs/glossary.md#symbolsbody_hash--structural-duplicate-bodies). For diff review, eyeball clones or use ad-hoc text grep.
113115

114116
### 4. Cross-check structural STOP signals
115117

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ await cm.index({ quiet: true });
293293
const rows = cm.query("SELECT name FROM symbols LIMIT 5");
294294
```
295295

296-
`createCodemap` configures a process-global runtime (`initCodemap`); only **one active project per process** is supported. Advanced: `runCodemapIndex` for an open DB handle. **Module layout:** [docs/architecture.md § Layering](docs/architecture.md#layering).
296+
`createCodemap` configures a process-global runtime (`initCodemap`); only **one active project per process** is supported. Advanced: `runCodemapIndex` when you hold a `CodemapDatabase` handle (library integration — not a separate public `openDb()` export; use `createCodemap` for the supported path). **Module layout:** [docs/architecture.md § Layering](docs/architecture.md#layering).
297297

298298
---
299299

docs/agents.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,16 @@ Warning goes to stderr only so `codemap skill > file.md` stays clean.
218218

219219
Do **not** duplicate long IDE matrices, **`--force`** / pointer behavior, **`codemap-pointer`** details, section assembler shape, or pointer-version semantics in **README.md** or **packaging.md** — link **here** instead.
220220

221+
## Shipped agent & indexing milestones
222+
223+
Maintainer inventory — contracts live in [architecture.md](./architecture.md), [golden-queries.md](./golden-queries.md), and [glossary.md](./glossary.md); not duplicated on [roadmap.md](./roadmap.md).
224+
225+
**Wave 1–2** ([#126](https://github.com/stainless-code/codemap/pull/126)[#138](https://github.com/stainless-code/codemap/pull/138)): MCP instructions, allowlist, WSL watch, git hooks, trace/explore/node, `agents init --mcp`, affected tests, index lock/`unlock`, parse-worker hardening, field-qualified search.
226+
227+
**Agent eval** ([#139](https://github.com/stainless-code/codemap/pull/139) probe + [#144](https://github.com/stainless-code/codemap/pull/144) live MCP arms + log comparison): see [benchmark § Agent eval harness](./benchmark.md#agent-eval-harness).
228+
229+
**Warm-path / bootstrap**`index_freshness` on `context` / tool metadata / HTTP headers ([#149](https://github.com/stainless-code/codemap/pull/149)); `start_here` composer ([#151](https://github.com/stainless-code/codemap/pull/151)); adaptive output budgets ([#152](https://github.com/stainless-code/codemap/pull/152)); MCP session lifecycle ([#153](https://github.com/stainless-code/codemap/pull/153); **no MCP idle timeout**[architecture § Session lifecycle](./architecture.md#session-lifecycle-wiring)); PM-aware MCP spawn ([#154](https://github.com/stainless-code/codemap/pull/154)); safer init re-runs ([#155](https://github.com/stainless-code/codemap/pull/155)); VS Code workspace root in MCP ([#156](https://github.com/stainless-code/codemap/pull/156)); `agents init --targets` ([#158](https://github.com/stainless-code/codemap/pull/158)).
230+
221231
## Related
222232

223233
- [architecture.md](./architecture.md) — CLI chunks, layering.

docs/architecture.md

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

docs/benchmark.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ CODEMAP_ROOT=/absolute/path/to/your-app CODEMAP_BENCHMARK_CONFIG=fixtures/benchm
9696

9797
- **Tracked example:** [fixtures/benchmark/scenarios.example.json](../fixtures/benchmark/scenarios.example.json) — copy to `*.local.json` (see [.gitignore](../.gitignore); do not commit proprietary paths).
9898
- **`CODEMAP_BENCHMARK_CONFIG`** is passed to **`path.resolve()`** from **`process.cwd()`** — use an absolute path or a path relative to where you run the command (not relative to **`src/`**).
99-
- Each entry has **`name`**, **`indexedSql`**, and **`traditional`**: either **`{ "globs": [...], "regex": "...", "mode": "files" | "matches" }`** or **`{ "builtin": "fanoutImportLines" }`** (same traditional path as **`--recipe fan-out`**). **`indexedSql`** must be a **single** read-only **`SELECT`** (or **`WITH``SELECT`**) — mutating statements are **rejected** at load time.
99+
- Each entry has **`name`**, **`indexedSql`**, and **`traditional`**: either **`{ "globs": [...], "regex": "...", "mode": "files" | "matches" }`** or **`{ "builtin": "fanoutImportLines" }`** (line-scan proxy paired with indexed **`--recipe fan-out`** SQL in default scenario 8 — not the same code path). **`indexedSql`** must be a **single** read-only **`SELECT`** (or **`WITH``SELECT`**) — mutating statements are **rejected** at load time.
100100
- **`traditional.regex`:** treated as trusted input from your local JSON (benchmark tooling is developer-facing). **`mode": "files"`** reuses one **`RegExp`** per scenario for efficiency.
101101
- **`replaceDefault`:** `true` (default) uses only this list; `false` **appends** these scenarios after the built-in eight.
102102

docs/glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Third apply transport for **caller-supplied unified diff text** — parses git-s
4141

4242
### `codemap apply` / apply tool
4343

44-
Substrate-shaped fix executor — reads the same row contract `--format diff-json` emits and applies hunks to disk. Recipe SQL is the synthesis surface; codemap is the executor (Moat-A — verdict-shape "should we fix this?" stays on the recipe author). **Three CLI input modes** (mutually exclusive): (1) **recipe** — `codemap apply <recipe-id> [--params k=v[,k=v]]`; MCP/HTTP `apply` `{recipe, params?, dry_run?, yes?, force?, until_empty?, max_passes?, commit_message?}`. (2) **rows** — `codemap apply --rows -|<file.json>`; MCP/HTTP [`apply_rows`](#apply_rows-mcp-tool--cli-mode). (3) **diff** — `codemap apply --diff-input <unified-diff>`; MCP/HTTP [`apply_diff_input`](#apply_diff_input-mcp-tool--cli-mode). Shared flags: `--dry-run` (phase-1 only), `--yes` (skip TTY prompt; required for non-TTY writes), `--json`. **Recipe-only flags:** `--force` / MCP `force` (bypass `auto_fixable` + allowlist); `--until-empty` / `until_empty` + `--max-passes` / `max_passes` (fixpoint on recipe `apply` only). **Git commit:** `--commit` / `commit_message` on recipe `apply` and `apply_diff_input`. **diff-json preview:** each hunk includes `ambiguity_count` (extra `before_pattern` matches on the line; apply rewrites first match only). **Policy (recipe mode only):** recipes with `auto_fixable: false` in `<id>.md` frontmatter reject writes unless `--force` / MCP `force: true`; `apply.autoApplyRecipes` in [user config](./architecture.md#user-config) allowlists recipe ids for non-interactive CLI without `--yes` (MCP/HTTP writes still need `yes: true`). Bundled diff-shape recipe ids: `rename-preview`, `migrate-import-source`, `replace-marker-kind` (`auto_fixable: true`); `stale-imports`, `migrate-deprecated`, `deprecated-usages`, `add-jsdoc-deprecated`, `migrate-jsx-prop` (force-gated unless allowlisted). **`rename-preview` homonyms:** pass `define_in=<symbols.file_path>` to scope the rename to one definition; omit to union all homonyms (use `find-symbol-references` to pick the anchor first). CLI shorthand: `codemap rename <old> <new> [--define-in <file_path>] [--in-file <prefix>] [--kind <k>]` → `apply rename-preview` (thin alias — same recipe + policy gates). **`--commit` / `commit_message`:** recipe `apply` and `apply_diff_input` only (not `apply_rows`); with `--until-empty`, commit only when `terminated_by` is `empty`. **Phase 1** validates every row via `actual.includes(before_pattern)` (substring match); seven conflict reasons (`file missing` / `line out of range` / `line content drifted` / `path escapes project root` / `path is a symlink` / `duplicate edit on same line`). **Phase 2** (gated on `!dryRun && zero conflicts`) writes via sibling temp + `renameSync` per file; **all-or-nothing** across files on conflicts (no cross-file rollback on crash mid-phase-2). **Q6 gate** — TTY without `--yes` prompts `Proceed? [y/N]`; MCP/HTTP have no prompt path. Result envelope: `{mode, applied, files, conflicts, summary}` (+ optional `passes`, `terminated_by`). Re-apply on stale disk → `line content drifted`; re-index then vacuous zero-row pass (Q7). Engine: `application/apply-engine.ts` (`applyDiffPayload`); orchestration: `application/apply-run.ts`. Full transport matrix: [`architecture.md` § Apply — input modes](./architecture.md#apply--input-modes-transport-and-policy). Boundary kit: [§ Boundary verification — apply write path](./architecture.md#boundary-verification--apply-write-path).
44+
Substrate-shaped fix executor — reads the same row contract `--format diff-json` emits and applies hunks to disk. Recipe SQL is the synthesis surface; codemap is the executor (Moat-A — verdict-shape "should we fix this?" stays on the recipe author). **Three CLI input modes** (mutually exclusive): (1) **recipe** — `codemap apply <recipe-id> [--params k=v[,k=v]]`; MCP/HTTP `apply` `{recipe, params?, dry_run?, yes?, force?, until_empty?, max_passes?, commit_message?}`. (2) **rows** — `codemap apply --rows -|<file.json>`; MCP/HTTP [`apply_rows`](#apply_rows-mcp-tool--cli-mode). (3) **diff** — `codemap apply --diff-input <unified-diff>`; MCP/HTTP [`apply_diff_input`](#apply_diff_input-mcp-tool--cli-mode). Shared flags: `--dry-run` (phase-1 only), `--yes` (skip TTY prompt; required for non-TTY writes), `--json`. **Recipe-only flags:** `--force` / MCP `force` (bypass `auto_fixable` + allowlist); `--until-empty` / `until_empty` + `--max-passes` / `max_passes` (fixpoint on recipe `apply` only). **Git commit:** `--commit` / `commit_message` on recipe `apply` and `apply_diff_input`. **diff-json preview:** each hunk includes `ambiguity_count` (extra `before_pattern` matches on the line; apply rewrites first match only). **Policy (recipe mode only):** recipes with `auto_fixable: false` in `<id>.md` frontmatter reject writes unless `--force` / MCP `force: true`; `apply.autoApplyRecipes` in [user config](./architecture.md#user-config) allowlists recipe ids for non-interactive CLI without `--yes` (MCP/HTTP writes still need `yes: true`). Bundled diff-shape recipe ids: `rename-preview`, `migrate-import-source`, `replace-marker-kind` (`auto_fixable: true`); `stale-imports`, `migrate-deprecated`, `deprecated-usages`, `add-jsdoc-deprecated`, `migrate-jsx-prop` (force-gated unless allowlisted). **`rename-preview` homonyms:** pass `define_in=<symbols.file_path>` to scope the rename to one definition; omit to union all homonyms (use `find-symbol-references` to pick the anchor first). CLI shorthand: `codemap rename <old> <new> [--define-in <file_path>] [--in-file <prefix>] [--kind <k>]` → `apply rename-preview` (thin alias — same recipe + policy gates). **`--commit` / `commit_message`:** recipe `apply` and `apply_diff_input` only (not `apply_rows`); with `--until-empty`, commit only when `terminated_by` is `empty`. **Phase 1** validates every row via `actual.includes(before_pattern)` (substring match); six conflict reasons (`file missing` / `line out of range` / `line content drifted` / `path escapes project root` / `path is a symlink` / `duplicate edit on same line`). **Phase 2** (gated on `!dryRun && zero conflicts`) writes via sibling temp + `renameSync` per file; **all-or-nothing** across files on conflicts (no cross-file rollback on crash mid-phase-2). **Q6 gate** — TTY without `--yes` prompts `Proceed? [y/N]`; MCP/HTTP have no prompt path. Result envelope: `{mode, applied, files, conflicts, summary}` (+ optional `passes`, `terminated_by`). Re-apply on stale disk → `line content drifted`; re-index then vacuous zero-row pass (Q7). Engine: `application/apply-engine.ts` (`applyDiffPayload`); orchestration: `application/apply-run.ts`. Full transport matrix: [`architecture.md` § Apply — input modes](./architecture.md#apply--input-modes-transport-and-policy). Boundary kit: [§ Boundary verification — apply write path](./architecture.md#boundary-verification--apply-write-path).
4545

4646
### audit
4747

docs/plans/github-marketplace-action.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
>
55
> **Motivator:** GitHub Marketplace is the dominant discovery + adoption surface for tools in the codebase-intelligence cohort, and codemap is currently absent from it. The in-repo Action closes the CI wrapper gap once it is tagged and listed; until then consumers can use the CLI surfaces directly or a local-path action ref.
66
>
7-
> **Tier:** M effort. Wraps existing CLI surface; no schema changes, no new engines, no new transports. Only new substrate is the optional PR-comment writer (~one TS module).
7+
> **Tier:** M effort. Wraps existing CLI surface; no schema changes, no new engines, no new transports. PR-comment writer shipped (Slice 3); open work is listing/tags/smoke (Slice 5).
88
>
99
> **Roadmap:** [§ Core substrate & platform](../roadmap.md#core-substrate--platform)
1010

docs/plans/substrate-extraction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> **Status:** open (tiers **7–8**, **13**) · tiers **1–6** shipped · tiers **9–12** partial — live tables and `SCHEMA_VERSION` in [`architecture.md § Schema`](../architecture.md#schema) / [`src/db.ts`](../../src/db.ts). Apply executor + eight diff-shape recipes shipped — [`architecture.md § Apply`](../architecture.md#apply--input-modes-transport-and-policy).
44
>
5-
> **Per-tier ship status (fact-checked 2026-06; `SCHEMA_VERSION` 37):** Tiers **1–6** shipped. Tier headings carry the PR landing date for that slice; the remainder wave closed **2026-05-19** (tiers 1–6 foundation landed **2026-05-14****15**). Tier **1**: call-shape columns, side-effect `import_specifiers` + `import_id`. Tier **2**: `bindings.resolution_kind='re-exported'`. Tier **3**: `jsx_elements` / `jsx_attributes`. Tier **5**: `async_calls`, `try_catch`, `decorators`, `jsdoc_tags`. Tier **4** partial: `symbols.{return_type,is_async,is_generator}` + `function_params`; `generic_params` / `type_predicates` deferred. Tier **6** partial: `dynamic_imports`, `files.{is_barrel,has_side_effects}`; `files.is_entry` deferred to [`c9-plugin-layer.md`](./c9-plugin-layer.md). Tiers **9–12** partial; **7–8** + **13** open.
5+
> **Per-tier ship status (fact-checked 2026-06; `SCHEMA_VERSION` 40):** Tiers **1–6** shipped. Tier headings carry the PR landing date for that slice; the remainder wave closed **2026-05-19** (tiers 1–6 foundation landed **2026-05-14****15**). Tier **1**: call-shape columns, side-effect `import_specifiers` + `import_id`. Tier **2**: `bindings.resolution_kind='re-exported'`. Tier **3**: `jsx_elements` / `jsx_attributes`. Tier **5**: `async_calls`, `try_catch`, `decorators`, `jsdoc_tags`. Tier **4** partial: `symbols.{return_type,is_async,is_generator}` + `function_params`; `generic_params` / `type_predicates` deferred. Tier **6** partial: `dynamic_imports`, `files.{is_barrel,has_side_effects}`; `files.is_entry` deferred to [`c9-plugin-layer.md`](./c9-plugin-layer.md). Tiers **9–12** partial; **7–8** + **13** open.
66
>
77
> **Motivator:** Codemap's distinctive value is the SQL-against-structural-index substrate. Per [Moat B](../roadmap.md#moats-load-bearing)_"Extracted structure ≥ verdicts. Schema breadth is the substrate every recipe layers on."_ — the load-bearing growth axis is **what oxc / Lightning CSS / config loaders give us that the index doesn't yet expose.** Tiers **1–6** shipped: position-precise calls/imports/exports, `references` / `scopes` / `bindings`, JSX, behavioral facts, module-graph flags, and more — see [architecture § Schema](../architecture.md#schema). **Open tiers 7–8 + 13** below enumerate CSS rule depth, project meta, ORM/SQL tracking, and other AST surfaces we discard at parse time today. Each remaining tier ships as an independent tracer-bullet PR that compounds into a maximal substrate.
88
>
@@ -515,7 +515,7 @@ Tier 8 (project meta) — parallel-safe; cheapest; ship first or last.
515515
- Tier 9 depends on Tier 1 + Tier 2.
516516
- Tier 10 depends on Tier 2 (`scope_id`).
517517
- Tier 11 has no hard deps but Tier 2's `scope_id` enriches some metrics.
518-
- Tier 12 depends on Tier 6 (`files.is_entry`).
518+
- Tier 12 optionally enriched by C.9 (`files.is_entry` — deferred to [`c9-plugin-layer.md`](./c9-plugin-layer.md)); ships heuristic entry detection without it.
519519
- Tier 13 depends on Tier 1 + Tier 5 (decorators for TypeORM).
520520

521521
**Parallel-safe:** Tier 7 (CSS), Tier 8 (project meta) can ship anytime.

0 commit comments

Comments
 (0)