You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): codemap validate, codemap context, --performance, friendlier no-DB error; JSDoc the public type surface
CLI commands and flags
- codemap validate [--json] [paths...] — diffs disk SHA-256 against
files.content_hash; statuses: stale | missing | unindexed; exits 1 on
any drift (git-status semantics) so agents can branch on $?
- codemap context [--compact] [--for "<intent>"] — stable JSON envelope
(project metadata, top hubs, recent markers, recipe catalog). --for runs
lightweight intent classification (refactor / debug / test / feature /
explore / other) and returns matched recipe ids plus a hint
- codemap --performance — per-phase breakdown
(collect / parse / insert / index_create) plus top-10 slowest files by
parse time during full rebuild; surfaces pathological inputs
- Friendlier no-.codemap.db error — `no such table: <X>` rewrites to an
actionable hint pointing at `codemap` / `codemap --full`, on both the
JSON and human paths
- bootstrap.ts whitelists the new subcommands and flag
Public type surface (visible in dist/index.d.mts via the existing index re-exports)
- New IndexPerformanceReport; IndexRunStats.performance? field
- Per-field JSDoc on IndexResult, IndexRunStats, IndexPerformanceReport,
IndexTableStats (snake_case key note), ResolvedCodemapConfig
- Interface-level JSDoc on every db.ts row interface (FileRow, SymbolRow,
ImportRow, ExportRow, ComponentRow, DependencyRow, MarkerRow,
CssVariableRow, CssClassRow, CssKeyframeRow, CallRow, TypeMemberRow)
with cross-links to docs/architecture.md § Schema as the single source
- Per-field JSDoc on ParsedFile (clarifies error vs parseError, category
semantics, CSS-only fields, cssImportSources main-thread conversion)
- @param/@returns on getAdapterForExtension
Implementation plumbing
- ParsedFile gains optional parseMs?, populated by parse-worker-core.ts
- RunIndexOptions.performance threads through index-engine.ts and run-index.ts
- index-engine.ts times collect / parse / insert / createIndexes phases when
the flag is on; bottom-of-summary block prints the breakdown plus the
slowest_files list
Auto-fixes from the new lint baseline
- import type hoisting (consistent-type-specifier-style: prefer-top-level)
- type X = {...} → interface X {...} for object shapes (ValidateRow,
ValidateOpts, ContextEnvelope, ContextOpts)
- switch case braces in src/parser.ts (12 keyword-mapping cases) and
src/agents-init.ts
Tests
- 9 new tests for cmd-validate (parse + computeValidateRows: stale, missing,
unindexed, dedup, sort)
- 14 new tests for cmd-context (parse + classifyIntent: 6 categories + fallback)
- 2 new cases on cmd-query for -r
Changeset entered as patch (matches 0.x precedent for additive changes;
schema unchanged).
Agent-friendly CLI surface: `codemap validate`, `codemap context`, `--performance`, `-r` recipe alias, and four new bundled query recipes.
6
+
7
+
-**New: `codemap validate [--json] [paths...]`** — diffs the on-disk SHA-256 of indexed files against `files.content_hash` and prints stale / missing / unindexed rows. Lets agents skip re-reads they don't need; exits `1` on any drift (git-status semantics)
8
+
-**New: `codemap context [--compact] [--for "<intent>"]`** — emits a stable JSON envelope (project metadata, top hubs, recent markers, recipe catalog) for any agent or editor that wants the index in one cheap shot. `--for` runs lightweight intent classification (refactor / debug / test / feature / explore / other) and returns matched recipe ids plus a hint
9
+
-**New: `codemap --performance`** flag — prints a per-phase timing breakdown (collect / parse / insert / index_create) and the top-10 slowest files by parse time during full rebuilds, for triaging giant or pathological inputs
10
+
-**New: `-r` short alias for `codemap query --recipe`** + cleaner organized `codemap query --help` (sectioned flags, dynamic recipe-id padding, examples for both forms)
-**Friendlier no-`.codemap.db` error**: `no such table: <X>` now rewrites to an actionable hint pointing at `codemap` / `codemap --full`, on both the JSON and human paths
13
+
-**Public type surface**: new `IndexPerformanceReport`; `IndexRunStats.performance?` field; per-field JSDoc coverage on `IndexResult`, `IndexRunStats`, `ResolvedCodemapConfig`, all `db.ts` row interfaces (`FileRow`, `SymbolRow`, `ImportRow`, `ExportRow`, `ComponentRow`, `DependencyRow`, `MarkerRow`, `CssVariableRow`, `CssClassRow`, `CssKeyframeRow`, `CallRow`, `TypeMemberRow`), and `ParsedFile`
14
+
-**Documentation**: README now leads with a "What you get" Grep/Read vs Codemap capability table and a "Daily commands" stripe; `docs/why-codemap.md` adds a "What Codemap is **not**" anti-pitch section and a scenario-keyed token-savings table (single lookup → 50-turn session) replacing the earlier hand-wave
0 commit comments