project-librarian 0.5.5 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CONTRIBUTING.md +36 -0
  2. package/README.ko.md +58 -365
  3. package/README.md +56 -363
  4. package/SKILL.md +7 -0
  5. package/dist/args.js +9 -1
  6. package/dist/code-index/extractors/light-languages.js +285 -0
  7. package/dist/code-index/extractors/registry.js +12 -0
  8. package/dist/code-index/extractors/shared.js +18 -1
  9. package/dist/code-index/extractors/typescript.js +30 -16
  10. package/dist/code-index/index-health.js +4 -3
  11. package/dist/code-index/modes.js +193 -33
  12. package/dist/code-index/native-helper-matrix.js +99 -0
  13. package/dist/code-index/native-helper.js +292 -0
  14. package/dist/code-index/schema.js +72 -13
  15. package/dist/code-index/search.js +1 -1
  16. package/dist/code-index-file-policy.js +9 -1
  17. package/dist/code-index.js +363 -12
  18. package/dist/init-project-wiki.js +14 -0
  19. package/dist/install-skill.js +22 -2
  20. package/dist/native/darwin-arm64/project-librarian-indexer +0 -0
  21. package/dist/native/darwin-x64/project-librarian-indexer +0 -0
  22. package/dist/native/linux-arm64/project-librarian-indexer +0 -0
  23. package/dist/native/linux-arm64-musl/project-librarian-indexer +0 -0
  24. package/dist/native/linux-x64/project-librarian-indexer +0 -0
  25. package/dist/native/linux-x64-musl/project-librarian-indexer +0 -0
  26. package/dist/native/project-librarian-indexer-manifest.json +70 -0
  27. package/dist/native/win32-arm64/project-librarian-indexer.exe +0 -0
  28. package/dist/native/win32-x64/project-librarian-indexer.exe +0 -0
  29. package/docs/README.md +11 -0
  30. package/docs/benchmarks.md +64 -0
  31. package/docs/cli-reference.md +61 -0
  32. package/docs/code-evidence.md +93 -0
  33. package/docs/ko/README.md +13 -0
  34. package/docs/ko/benchmarks.md +64 -0
  35. package/docs/ko/cli-reference.md +61 -0
  36. package/docs/ko/code-evidence.md +93 -0
  37. package/docs/ko/maintainer.md +76 -0
  38. package/docs/ko/usage.md +168 -0
  39. package/docs/maintainer.md +76 -0
  40. package/docs/usage.md +176 -0
  41. package/package.json +11 -1
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22.13-brightgreen.svg)](https://nodejs.org/)
6
6
  [![Code evidence index](https://img.shields.io/badge/code%20evidence-node%3Asqlite-blue.svg)](https://nodejs.org/api/sqlite.html)
7
7
 
8
- **Give every AI coding agent the same durable memory of your project.** Project Librarian keeps a compact, repo-local planning wiki plus an optional code-evidence index that Codex, Claude Code, Cursor, and Gemini CLI read at session start, so they stop rediscovering your codebase from scratch every time.
8
+ **Give every AI coding agent the same durable memory of your project.** Project Librarian keeps a compact, repo-local planning wiki, plus an optional code-evidence index, that Codex, Claude Code, Cursor, and Gemini CLI can read at session start.
9
9
 
10
10
  Languages: [English](README.md) | [한국어](README.ko.md)
11
11
 
@@ -13,7 +13,7 @@ Languages: [English](README.md) | [한국어](README.ko.md)
13
13
 
14
14
  Most users should ask their coding agent to run Project Librarian rather than run lifecycle commands by hand.
15
15
 
16
- Install the reusable skill files once, or ask an agent with shell access to do it:
16
+ Install the reusable skill files once:
17
17
 
18
18
  ```bash
19
19
  npx project-librarian@latest install --scope user --agents all
@@ -25,23 +25,23 @@ Then ask Codex, Claude Code, Cursor, or Gemini CLI from the target repository:
25
25
  - "Use Project Librarian to migrate the existing docs/wiki content."
26
26
  - "Search the Project Librarian wiki for authentication decisions."
27
27
 
28
- The installed skill tells the agent to resolve the local runner and execute the right command from the project root. Prefer a project-local install only when you want that runner stored inside the target repository's agent setup:
28
+ The installed skill resolves the local runner and executes the right command from the project root. Use a project-local install only when you want the runner stored inside that repository's agent setup:
29
29
 
30
30
  ```bash
31
31
  npx project-librarian@latest install --scope project --agents all
32
32
  ```
33
33
 
34
- `install` copies the reusable runner and skill files. The agent-run lifecycle command is what creates or updates `AGENTS.md`, agent hooks, `wiki/`, git hook files, diagnostics, and optional code-evidence support. `install-skill` remains supported as a compatibility alias.
34
+ `install` copies reusable runner and skill files plus required local-runner runtime dependencies. The agent-run lifecycle command creates or updates `AGENTS.md`, agent hooks, `wiki/`, git hook files, diagnostics, and optional code-evidence support. `install-skill` remains a compatibility alias.
35
35
 
36
36
  ## Update
37
37
 
38
- To refresh an existing Project Librarian setup without migrating the wiki, run the latest package from the repository root:
38
+ To refresh an existing setup without migrating the wiki, run:
39
39
 
40
40
  ```bash
41
41
  npx project-librarian@latest update
42
42
  ```
43
43
 
44
- That updates managed setup files, agent hooks, wiki operating/meta files, and existing project-scoped Project Librarian skill copies for the selected agent surfaces. It preserves the current `wiki/` and rejects migration flags, so it will not rename the wiki to `wiki_legacy*`.
44
+ That updates managed setup files, agent hooks, wiki operating/meta files, and existing project-scoped skill copies. It preserves the current `wiki/` and rejects migration flags, so it will not rename the wiki to `wiki_legacy*`.
45
45
 
46
46
  Use `--agents` when you intentionally want to add or refresh a specific project surface:
47
47
 
@@ -56,108 +56,92 @@ User-scoped skill installs are global agent tooling and are not changed by a pro
56
56
  npx project-librarian@latest install --scope user --agents all
57
57
  ```
58
58
 
59
- ## Highlights
60
-
61
- - **Small first read.** Session-start hooks inject only `wiki/startup.md` and `wiki/index.md`; agents route to deeper pages on demand instead of grepping the whole repo cold.
62
- - **One setup, four agents.** Codex, Claude Code, Cursor, and Gemini CLI share the same wiki-first contract, hooks, and rules.
63
- - **Structured wiki writing.** New project content is classified through `wiki/meta/document-taxonomy.md` before it is written or consolidated, so PRDs, policies, UX, data, APIs, QA, release, and operations notes do not collapse into one catch-all page.
64
- - **Inspectable wiki graph.** `--wiki-visualize` writes a self-contained HTML graph under `.project-wiki/`, showing page types, router depth, backlinks, and decision references without adding to startup context.
65
- - **Measured, not hand-wavy.** Every performance claim comes from hermetic Codex benchmarks — and the cases where it costs *more* are shown right next to the wins.
66
- - **Local session handoff.** `--handoff-save` writes generated resume notes under `.project-wiki/session/`; startup hooks only point to it, so rolling execution memory does not become canonical wiki truth.
67
- - **Optional code evidence.** A regenerable SQLite index plus answer-shaped MCP tools answer impact, ownership, and workspace-graph questions without adding an MCP SDK dependency.
68
- - **Safe to re-run.** Bootstrap is idempotent and preservation-first; diagnostics flag broken routes, unreachable pages, and stale truth before they mislead an agent.
69
-
70
59
  ## Why It Exists
71
60
 
72
61
  LLM coding agents waste context and tool calls when every session starts by rediscovering the project: reading old chats, scanning markdown, grepping source, and guessing which files matter.
73
62
 
74
- Project Librarian gives agents two local sources of truth:
63
+ Project Librarian gives agents a small first read and reliable routes to deeper truth:
75
64
 
76
65
  | Surface | What It Gives The Agent |
77
66
  | --- | --- |
78
- | `wiki/startup.md` + `wiki/index.md` | A compact session-start summary and router, so only the relevant planning pages are read. |
79
- | `wiki/canonical/`, `wiki/roadmaps/`, `wiki/plans/`, and `wiki/decisions/` | Current truth stays in canonical pages, broad future work stays in roadmaps, detailed execution stays in plans, and durable rationale stays in decisions. |
80
- | `wiki/meta/document-taxonomy.md` | A service-lifecycle classification map that tells agents where PRD, policy, UX, data, engineering, QA, release, and operations truth should live. |
81
- | `.codex/`, `.claude/`, `.cursor/`, and `.gemini/` hooks | Automatic startup context for Codex, Claude Code, Cursor, and Gemini CLI without loading the full wiki. |
82
- | `GEMINI.md` and `.cursor/rules/` | Gemini CLI and Cursor instruction files that route agents to the same compact wiki-first contract. |
83
- | `.project-wiki/code-evidence.sqlite` | Regenerable code evidence for files, symbols, imports, routes, ownership, workspace graph, reports, and impact checks. |
84
- | `.project-wiki/session/last-handoff.md` | Optional generated local handoff for the last session's goal, state, blockers, next actions, decisions, commands, and verification. It is reference data, not project truth. |
85
- | `.project-wiki/wiki-graph.html` | Optional static wiki graph visualizer with derived concept types, router reachability, links, backlinks, and decision references. |
86
- | Diagnostics and migration modes | Link checks, quality checks, migration inboxes, stale-signal reports, and issue drafts when the workflow exposes a problem. |
67
+ | `wiki/startup.md` + `wiki/index.md` | A compact session-start summary and router, so only relevant planning pages are read. |
68
+ | `wiki/canonical/`, `wiki/roadmaps/`, `wiki/plans/`, `wiki/decisions/` | Current truth, future scope, execution plans, and durable rationale stay separated. |
69
+ | Agent hooks and rules | Codex, Claude Code, Cursor, and Gemini CLI start from the same wiki-first contract. |
70
+ | `.project-wiki/code-evidence.sqlite` | Optional, regenerable code evidence for impact, ownership, routes, symbols, imports, and workspace graph questions. |
71
+ | Diagnostics and migration modes | Link checks, quality checks, migration review files, stale-signal reports, and issue drafts. |
87
72
 
88
73
  The core idea is not "write more docs." It is "keep the first agent read small, then give it reliable routes to deeper project truth and code evidence."
89
74
 
90
- The taxonomy is a routing aid, not a mandate to create every possible document. It is strongest for service and product development. Library, infrastructure, research, or other non-service projects can use only the relevant slices and leave the rest as intentionally unused categories instead of forcing artificial pages.
75
+ ## Highlights
91
76
 
92
- ## Benchmark Results
77
+ - **Small first read.** Startup hooks inject only `wiki/startup.md` and `wiki/index.md`; agents route to deeper pages on demand.
78
+ - **One setup, four agents.** Codex, Claude Code, Cursor, and Gemini CLI share the same repo-local memory contract.
79
+ - **Structured wiki writing.** New project content is classified before it is written or consolidated, so PRDs, policies, UX, data, APIs, QA, release, and operations notes do not collapse into one catch-all page.
80
+ - **Inspectable wiki graph.** `--wiki-visualize` writes a static HTML graph under `.project-wiki/` without adding to startup context.
81
+ - **Measured claims.** Benchmark wins and losses are published together, with claim boundaries attached.
82
+ - **Local session handoff.** `--handoff-save` stores generated resume notes under `.project-wiki/session/` without turning execution memory into canonical project truth.
83
+ - **Optional code evidence.** A SQLite index plus answer-shaped MCP tools answer expensive traversal questions on large repositories without adding an MCP SDK dependency.
84
+ - **Safe to re-run.** Bootstrap is idempotent and preservation-first.
93
85
 
94
- These numbers are maintainer release evidence, not a blanket promise. Every value is real Codex JSONL usage and local wall-clock time (ChatGPT/Codex auth, `gpt-5.5`), measured hermetically — isolated Codex home, allowlist-only environment, clean tree, post-run fixture validation — with 3 measured runs plus 1 warmup per scenario against an `organic` control that has no Project Librarian.
86
+ ## Common Requests
95
87
 
96
- In the tables below, **"less" / "more"** compares cost-weighted tokens against that control, and **"faster" / "slower"** compares wall-clock time. (Cost-weighted = uncached input + 0.1 × cached input + output + reasoning output; cached resends are discounted, and raw merged totals would unfairly penalize any tool that adds a turn.) The wiki-routing track and the code-graph track are measured and reported separately — a win on one never backs a claim about the other. Generated benchmark reports under `benchmarks/reports/llm/` are ignored by default; maintainers should commit deliberate release baselines only when they are meant to support a public claim. Reproduce a release candidate with:
88
+ Ask your agent for the outcome you want; the installed skill maps the request to the local runner.
97
89
 
98
- ```bash
99
- npm run benchmark:release:preview
100
- npm run benchmark:release -- --allow-codex-run
101
- ```
90
+ | Goal | Ask The Agent |
91
+ | --- | --- |
92
+ | Create or update the wiki | "Use Project Librarian to set up or update this repository's planning wiki." |
93
+ | Update without migration | "Update this repository's Project Librarian setup without migrating the wiki." |
94
+ | Migrate existing docs/wiki content | "Use Project Librarian to migrate the existing docs/wiki content." |
95
+ | Run diagnostics | "Run Project Librarian diagnostics." |
96
+ | Search project memory | "Search the Project Librarian wiki for authentication decisions." |
97
+ | Build code evidence | "Build Project Librarian code evidence for `src`." |
98
+ | Inspect code impact | "Show Project Librarian impact evidence for `healthHandler`." |
99
+ | Save a handoff | "Save a Project Librarian session handoff for the current work." |
102
100
 
103
- Measured release runs stream `[benchmark:progress]` lines to stderr for the scenario count, expected Codex exec total, current exec ordinal, phase, prompt id, exit status, elapsed time, and raw JSONL path. stdout stays reserved for the final JSON result.
101
+ See [Usage](docs/usage.md) for install scopes, runner paths, generated files, migration behavior, and the full agent-request table.
104
102
 
105
- ### Wiki track (planning-doc routing)
103
+ ## Benchmarks
106
104
 
107
- Cost-weighted tokens, Project Librarian vs control:
105
+ These numbers are maintainer release evidence, not a blanket promise. Every value is real Codex JSONL usage and local wall-clock time, measured hermetically against an `organic` control with no Project Librarian. The wiki-routing track and the code-graph track are measured separately; a win on one never backs a claim about the other.
108
106
 
109
- | Scale | decision_lookup | aggregation | multi_session (2nd session) |
107
+ Wiki track, cost-weighted tokens vs control:
108
+
109
+ | Scale | decision_lookup | aggregation | multi_session |
110
110
  | --- | --- | --- | --- |
111
111
  | Small | 14.4% less | 81.0% more | 22.0% less |
112
112
  | Medium | 52.0% less | 19.0% less | 54.1% less |
113
113
  | Large | 71.1% less | 29.0% less | 71.8% less |
114
114
 
115
- Latest synthetic wiki-track release candidate: 2026-06-19, `gpt-5.5`, 42 scenarios, 3 measured runs plus 1 warmup each. The overall claim gate **passed**: 42/42 scenarios passed correctness, all 42 scenarios were claimable, and every corpus gate met the 3-run minimum. The release claim is still bounded to the synthetic wiki-routing track and the listed task families; it is not a claim about code-graph behavior, real repositories, every agent surface, or every question shape. Published boundaries remain visible: small `aggregation` still costs 81.0% more with the wiki, small `release_policy` costs 9.4% more in the full report, and `aggregation` stays slower at every scale even when token cost drops.
116
-
117
- ### Code-graph track (code evidence index, real repositories)
115
+ Latest synthetic wiki-routing track release candidate: 2026-06-19, `gpt-5.5`, 42 scenarios, 3 measured runs plus 1 warmup each. The overall claim gate **passed**. This is bounded to the synthetic wiki-routing track and listed task families; it is not a claim about code-graph behavior, real repositories, every agent surface, or every question shape.
118
116
 
119
- Measured on two SHA-pinned open-source repositories with hand-authored answer keys and the answer-shaped MCP tools injected into the hermetic Codex home. The claim gate passed with 30/30 runs correct after two evaluator false positives were fixed and the report was re-scored from raw JSONL; recompute-from-raw is the standing audit policy. Cost-weighted tokens, Project Librarian vs control:
117
+ Code-graph track, cost-weighted tokens vs control:
120
118
 
121
119
  | Question | excalidraw (~1.2k files) | backstage (~11.8k files) |
122
120
  | --- | --- | --- |
123
121
  | impact_trace | 117% more | **27.7% less** |
124
122
  | workspace_graph | 106% more | 2.6% less |
125
- | ownership_lookup | | 99% more |
126
-
127
- The claim is a scale crossover, and the losses are published next to the win: on the 11.8k-file repository the tool wins the expensive traversal question (impact_trace 27.7% fewer cost-weighted tokens, 24.5% fewer scan bytes) and breaks even on the workspace graph, but everything loses on the small repository and cheap lookups (CODEOWNERS ownership) lose at every measured scale. In short, the code-evidence index pays off only on genuinely large repositories for expensive-traversal questions — exactly what the CLI's scale-aware gates encode: below ~5k indexable files, `--code-index` asks for explicit acknowledgement and bootstrap skips MCP auto-registration, citing these measurements.
123
+ | ownership_lookup | - | 99% more |
128
124
 
129
- ### What the benchmark names mean
125
+ The code-evidence index pays off only on genuinely large repositories for expensive traversal questions. Below ~5k indexable files, `--code-index` halts unless `--acknowledge-small-repo` is passed, and bootstrap skips MCP auto-registration unless an existing `.project-wiki` SQLite index shows the user already opted in.
130
126
 
131
- Repositories under test:
127
+ Before citing `--code-report`, `--code-impact`, `--code-context-pack`, or MCP tool output as current code-structure evidence, run `project-librarian --code-status` or MCP `code_status` and require `stale_files: 0`. Stale reports are pointers for rebuild, not authoritative project truth.
132
128
 
133
- - **excalidraw** a real open-source whiteboard/diagramming app (~1.2k files); the small-repo data point.
134
- - **backstage** — Spotify's open-source developer-portal platform (~11.8k files); the large-repo data point.
129
+ See [Benchmark Evidence](docs/benchmarks.md) for methodology, task-family definitions, reproduction commands, and the published losses.
135
130
 
136
- Question types (task families):
131
+ ## Documentation
137
132
 
138
- - **decision_lookup** find the latest project decision and its date from the wiki.
139
- - **aggregation** answer a question whose facts are scattered across several pages and must be synthesized.
140
- - **multi_session** a second session on the same project, measuring whether the durable wiki helps the next session, not just the first.
141
- - **impact_trace** "if this module changes, what else is affected?": trace the full set of direct and indirect importers.
142
- - **ownership_lookup** "who owns this file?": resolve the owner by CODEOWNERS last-match precedence.
143
- - **workspace_graph** "what does this package depend on across the monorepo?": the workspace/package dependency graph.
133
+ | Document | Use It For |
134
+ | --- | --- |
135
+ | [Usage](docs/usage.md) | Install scopes, runner paths, generated files, migration, and common agent requests. |
136
+ | [Code Evidence](docs/code-evidence.md) | MCP server behavior, freshness contract, scale gate, language support, and native helper policy. |
137
+ | [CLI Reference](docs/cli-reference.md) | Complete command and option reference. |
138
+ | [Benchmark Evidence](docs/benchmarks.md) | Public benchmark claims, limits, and maintainer benchmark commands. |
139
+ | [Maintainer Guide](docs/maintainer.md) | Development, release readiness, trusted publishing, and benchmark operations. |
140
+ | [Contributing](CONTRIBUTING.md) | Local contribution workflow and verification expectations. |
141
+ | [Security Policy](SECURITY.md) | Supported versions, private reporting, and supply-chain boundary. |
144
142
 
145
143
  ## Install Details
146
144
 
147
- Use this section when you need to choose an install scope or target agent. Use `npx` for initial skill installation or for an explicit registry-version project update:
148
-
149
- ```bash
150
- npx project-librarian@latest install --scope user --agents all
151
- ```
152
-
153
- Install into the current repository instead:
154
-
155
- ```bash
156
- npx project-librarian@latest install --scope project --agents all
157
- ```
158
-
159
- `install` copies reusable skill files only. It does not create or update `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `wiki/`, `.cursor/rules/`, `.cursor/hooks.json`, `.gemini/settings.json`, `.codex/hooks.json`, or `.claude/settings.json`. `install-skill` remains supported as a compatibility alias.
160
-
161
145
  | Situation | Command |
162
146
  | --- | --- |
163
147
  | Install globally for all supported agents | `npx project-librarian@latest install --scope user --agents all` |
@@ -168,298 +152,7 @@ npx project-librarian@latest install --scope project --agents all
168
152
  | Install only Gemini CLI | `npx project-librarian@latest install --agents gemini` |
169
153
  | Preview install output | `npx project-librarian@latest install --scope project --agents all --dry-run` |
170
154
 
171
- `--agents` also accepts comma-separated values such as `codex,claude,cursor,gemini`. `all` targets every supported agent. `--scope` accepts `user` or `project`.
172
-
173
- The project setup/update runner also accepts `--agents`. Fresh setup defaults to all supported agent surfaces only when no project-scoped Project Librarian skill install is present. If the repository already has project-scoped skills such as `.codex/skills/project-librarian/` and `.claude/skills/project-librarian/`, the first setup uses that installed agent set by default. Existing non-migration updates preserve the agent surfaces already present in the repository, so a repo that has only Codex and Claude files will not gain Cursor or Gemini files on a plain update. Use `project-librarian update --agents cursor` or `project-librarian update --agents all` when you intentionally want to add newly supported surfaces; unlisted surfaces are not deleted.
174
-
175
- `project-librarian update` also syncs any project-scoped Project Librarian skill installs that already exist for the selected surfaces from the currently running package. This means `npx project-librarian@latest update` can refresh the repository's managed setup, hooks, wiki meta files, and existing project-scoped skill copies without migration. It does not create new project-scoped skill installs by default and does not update user-scoped skill installs; use `install --scope user` for that.
176
-
177
- ## Runner Paths
178
-
179
- These paths are mainly for agents and automation. After installation, agents should run the installed local copy with `node`, not `npx`. This avoids network access and unpinned package execution in restricted agent environments.
180
-
181
- | Installation | Runner |
182
- | --- | --- |
183
- | Project-scoped Codex skill | `node .codex/skills/project-librarian/dist/init-project-wiki.js` |
184
- | Project-scoped Claude skill | `node .claude/skills/project-librarian/dist/init-project-wiki.js` |
185
- | Project-scoped Cursor skill | `node .cursor/skills/project-librarian/dist/init-project-wiki.js` |
186
- | Project-scoped Gemini skill | `node .gemini/skills/project-librarian/dist/init-project-wiki.js` |
187
- | User-scoped Codex skill | `node ~/.codex/skills/project-librarian/dist/init-project-wiki.js` |
188
- | User-scoped Claude skill | `node ~/.claude/skills/project-librarian/dist/init-project-wiki.js` |
189
- | User-scoped Cursor skill | `node ~/.cursor/skills/project-librarian/dist/init-project-wiki.js` |
190
- | User-scoped Gemini skill | `node ~/.gemini/skills/project-librarian/dist/init-project-wiki.js` |
191
-
192
- ## Common Agent Requests
193
-
194
- Ask your agent for the outcome you want; the skill maps the request to the local runner internally.
195
-
196
- Wiki setup and maintenance:
197
-
198
- | Goal | Ask The Agent | Internal Action |
199
- | --- | --- | --- |
200
- | Create or update the wiki | "Use Project Librarian to set up or update this repository's planning wiki." | `[init]` |
201
- | Update existing setup without migration | "Update this repository's Project Librarian setup without migrating the wiki." | `update` |
202
- | Update from the npm latest package without migration | "Run the latest Project Librarian update for this repository without migrating the wiki." | `npx project-librarian@latest update` |
203
- | Add a specific agent surface to an existing setup | "Add the Cursor Project Librarian surface without migrating the wiki." | `update --agents cursor` |
204
- | Migrate existing docs/wiki content | "Use Project Librarian to migrate the existing docs/wiki content." | `--migrate` |
205
- | Validate generated setup | "Run Project Librarian validation." | `--lint` |
206
- | Check links and document quality | "Run Project Librarian diagnostics." | `--doctor` |
207
- | Refresh generated routing before diagnostics | "Refresh Project Librarian routing and then run diagnostics." | `--doctor --fix` |
208
- | Search project wiki content | "Search the Project Librarian wiki for authentication decisions." | `--query "authentication decisions"` |
209
- | Show backlinks and decision citations for a page | "Show Project Librarian wiki impact for decisions/release-policy." | `--wiki-impact "decisions/release-policy"` |
210
- | Generate a wiki graph visualizer | "Generate the Project Librarian wiki graph visualizer." | `--wiki-visualize` |
211
- | Capture a candidate note | "Capture this as a Project Librarian candidate note: <details>." | `--capture-inbox --title "Candidate" --content "Details"` |
212
- | Save a session handoff | "Save a Project Librarian session handoff for the current work." | `--handoff-save --goal "..." --state "..." --next "..."` |
213
- | Resume from a handoff | "Show the last Project Librarian session handoff." | `--handoff-show` |
214
- | Promote handoff candidates | "Promote the last Project Librarian handoff to the wiki inbox." | `--handoff-promote-inbox` |
215
- | Opt in to full handoff injection | "Enable the Project Librarian full handoff injection experiment." | `--handoff-injection-enable` |
216
- | Report stale or unresolved wiki pages | "Check Project Librarian for stale or unresolved pages." | `--prune-check` |
217
- | Report only higher-signal stale or unresolved wiki pages | "Check Project Librarian for strict stale or unresolved pages." | `--prune-check --prune-check-strict` |
218
- | Install hook files without changing git config | "Set up Project Librarian hook files without changing git config." | `--no-git-config` |
219
-
220
- Code evidence:
221
-
222
- | Goal | Ask The Agent | Internal Action |
223
- | --- | --- | --- |
224
- | Build the default evidence cache | "Build Project Librarian code evidence for `src`." | `--code-index --code-scope src` |
225
- | Build multiple scopes | "Build Project Librarian code evidence for `src` and `packages/api`." | `--code-index --code-scope src --code-scope packages/api` |
226
- | Require incremental update | "Update the Project Librarian code evidence index incrementally." | `--code-index --incremental` |
227
- | Force a full rebuild | "Fully rebuild the Project Librarian code evidence index." | `--code-index --code-index-full` |
228
- | Use optional Tree-sitter backend | "Build Project Librarian code evidence with the Tree-sitter parser." | `--code-index --code-parser tree-sitter` |
229
- | Inspect cache compatibility | "Inspect Project Librarian code evidence cache health." | `--code-index-health` |
230
- | Show cache status | "Show Project Librarian code evidence status." | `--code-status` |
231
- | List indexed files | "List files in the Project Librarian code evidence index." | `--code-files` |
232
- | Print architecture and ownership report | "Show the Project Librarian code report." | `--code-report` |
233
- | Print one report section | "Show the routes section of the Project Librarian code report." | `--code-report --code-report-section routes` |
234
- | Inspect impact evidence | "Show Project Librarian impact evidence for `healthHandler`." | `--code-impact healthHandler` |
235
- | Build a context pack | "Build a Project Librarian context pack for `healthHandler`." | `--code-context-pack healthHandler` |
236
- | Search indexed symbols | "Search Project Librarian code evidence for symbol `Auth`." | `--code-search-symbol Auth` |
237
- | Run conservative read-only SQL | "Run a read-only Project Librarian code evidence query for file paths." | `--code-query "select path from files order by path"` |
238
-
239
- Only one code evidence mode can run at a time. `--incremental`, `--code-index-full`, and `--code-parser` are valid only with `--code-index`.
240
-
241
- ## What Gets Installed
242
-
243
- Fresh setup installs the supported agent surfaces below unless you pass `--agents` or the repository already has project-scoped Project Librarian skills for a narrower agent set. Existing non-migration updates preserve the detected surface set by default and update only those selected surfaces plus the common wiki/git-hook files.
244
-
245
- Project instruction files:
246
-
247
- - `AGENTS.md`
248
- - `CLAUDE.md`
249
- - `GEMINI.md`
250
- - `wiki/AGENTS.md`
251
- - `.cursor/rules/project-librarian.mdc`
252
-
253
- Startup hooks:
254
-
255
- - `.codex/hooks.json`
256
- - `.codex/hooks/wiki-session-start.js`
257
- - `.claude/settings.json`
258
- - `.claude/hooks/wiki-session-start.js`
259
- - `.cursor/hooks.json`
260
- - `.cursor/hooks/wiki-session-start.js`
261
- - `.gemini/settings.json`
262
- - `.gemini/hooks/wiki-session-start.js`
263
-
264
- Git hook files:
265
-
266
- - `.githooks/prepare-commit-msg`
267
- - `.githooks/wiki-commit-trailers.js`
268
-
269
- Wiki directories:
270
-
271
- - `wiki/canonical/`
272
- - `wiki/roadmaps/`
273
- - `wiki/plans/`
274
- - `wiki/decisions/`
275
- - `wiki/inbox/`
276
- - `wiki/meta/`
277
- - `wiki/sources/`
278
- - `wiki/migration/`
279
-
280
- Seed wiki pages and routers:
281
-
282
- - `wiki/startup.md`
283
- - `wiki/index.md`
284
- - `wiki/meta/document-taxonomy.md`
285
-
286
- Empty project pages such as `canonical/project-brief.md`, `canonical/open-questions.md`, `canonical/assumptions.md`, `canonical/risks.md`, and ADR templates are not created until there is real content to store. The router can discover them later with `--refresh-index`. During migration, form-only legacy templates are recorded as skipped in `wiki/migration/inventory.md` instead of becoming review rows or new wiki pages.
287
-
288
- MCP server registration (preservation-first merge into `mcpServers`):
289
-
290
- - `.mcp.json` (Claude Code)
291
- - `.cursor/mcp.json` (Cursor)
292
- - `.gemini/settings.json` `mcpServers` (Gemini CLI)
293
-
294
- Disposable code evidence cache:
295
-
296
- - `.project-wiki/code-evidence.sqlite`
297
-
298
- ## Code Evidence MCP Server
299
-
300
- `project-librarian mcp` runs a hand-rolled stdio MCP server (JSON-RPC 2.0 over newline-delimited JSON, no MCP SDK dependency) that serves the existing `.project-wiki` code-evidence index read-only. The package's hard runtime dependency is `typescript`; code evidence also uses Node's `node:sqlite`, with Tree-sitter grammars remaining optional. The server exposes answer-shaped tools — `code_context_pack`, `code_impact`, `code_ownership` (CODEOWNERS last-match precedence), `code_workspace_graph`, `code_search`, and `code_status` — whose responses lead with a one-line answer, follow with compact path/symbol/signature evidence, cap each reply, and prepend a warning when `code_status` reports the index is stale.
301
-
302
- Before citing `--code-report`, `--code-impact`, `--code-context-pack`, or MCP tool output as current code-structure evidence, run `project-librarian --code-status` or MCP `code_status` and require `stale_files: 0`. Stale reports are pointers for rebuild, not authoritative project truth.
303
-
304
- The server also exposes fixed resources — `project-librarian://wiki/startup`, `project-librarian://wiki/index`, and `project-librarian://code/status` — plus prompt templates for wiki taxonomy updates, code impact traces, maintenance improvement reviews, and retrieval quality reviews. Resource reads come from a fixed URI registry rather than arbitrary filesystem paths.
305
-
306
- Bootstrap registers the server for Claude Code (`.mcp.json`), Cursor (`.cursor/mcp.json`), and Gemini CLI (`mcpServers` in `.gemini/settings.json`), preserving any existing servers and keys and reporting `exists` on a re-run. When the repository contains a local runner the registration uses `node <runner> mcp`; otherwise it uses the installed `project-librarian mcp` binary.
307
-
308
- Codex registers MCP servers at the user level only (`codex mcp add`), so bootstrap does not write a project-level Codex MCP config. To use the server with Codex, run it once per machine:
309
-
310
- ```bash
311
- codex mcp add project-librarian -- node .codex/skills/project-librarian/dist/init-project-wiki.js mcp
312
- ```
313
-
314
- ## How It Works
315
-
316
- 1. Bootstrap creates a preservation-first wiki structure and marker-bounded agent instruction sections.
317
- 2. Session-start hooks inject only `wiki/startup.md` and `wiki/index.md`, with character budgets.
318
- 3. Bootstrap avoids empty form-only project pages; focused canonical, decision, source, and meta pages are created when content actually exists.
319
- 4. Detailed planning truth stays in canonical, decision, source, and meta pages that agents read on demand.
320
- 5. New project-planning content is classified through `wiki/meta/document-taxonomy.md` before it is written or consolidated, keeping upstream/downstream document relationships visible.
321
- 6. `--refresh-index` routes newly discovered wiki pages; large route sets are split into `wiki/indexes/auto-*.md` scoped routers.
322
- 7. `--code-index` creates a disposable SQLite evidence cache under `.project-wiki/`.
323
- 8. `--code-report`, `--code-impact`, `--code-context-pack`, `--code-search-symbol`, and `--code-query` expose code-backed evidence for planning updates.
324
- 9. Read-only wiki consumers share a concept read model that derives user-facing page types from paths and frontmatter without rewriting the canonical wiki schema.
325
- 10. Wiki producers keep writing the canonical markdown/YAML schema, while read-only consumers such as diagnostics, MCP, and the visualizer use derived projections instead of mutating source documents.
326
- 11. `--wiki-visualize` writes a static graph artifact to `.project-wiki/`, reusing the wiki graph and concept read model instead of introducing a database or server.
327
- 12. Diagnostics report broken links, duplicate routes, orphan pages, stale pages, missing TL;DRs, evidence gaps, and migration policy violations.
328
-
329
- Migration is intentionally review-first. `--migrate` preserves an existing `wiki/` as `wiki_legacy*`, skips form-only/template legacy files, splits mixed legacy pages into meaning units, classifies each unit through the document taxonomy, and writes review files under `wiki/migration/`:
330
-
331
- - `inventory.md` records migratable legacy markdown files, file-level classification, and form-only/template files skipped from semantic migration.
332
- - `unit-map.md` records each heading, paragraph, list item, table row, and code block with its suggested taxonomy area and target page.
333
- - `split-plan.md` groups those units by suggested new wiki target, so one legacy page that mixes API specs, features, UX, QA, policy, or operations can be rewritten into separate files.
334
- - `coverage.md` is the editable status ledger for each unit: pending, adopted, merged, superseded, rejected, resolved, or needs-human-review.
335
- - `verification.md` and `review.md` summarize coverage and semantic completion after `--review-migration`.
336
-
337
- `--migration-lint` validates that `coverage.md`, `unit-map.md`, and `split-plan.md` still account for the current migration batch, including duplicate/stale unit IDs, invalid storage/confidence/status values, split count drift, target drift, and old coverage-table schemas. When a legacy page has units that point to multiple targets, `--review-migration` will not let a file-level inbox status complete every unit; unit-level coverage must be resolved instead.
338
-
339
- Retained or copied legacy content is acceptable when it fits the new wiki policy and structure; the new wiki must not depend on citing `wiki_legacy*`.
340
-
341
- ## Language Support Matrix
342
-
343
- The matrix lists languages with implemented symbol/import extraction. Other recognized extensions are inventory-only. Default mode uses `typescript-ast`, `python-light`, `go-light`, config extraction, and inventory rows. `--code-parser tree-sitter` switches supported source files to `tree-sitter-*` profiles.
344
-
345
- | Language | Extensions | Default extraction | Tree-sitter extraction | Indexed evidence |
346
- | --- | --- | --- | --- | --- |
347
- | TypeScript | `.ts`, `.tsx`, `.cts`, `.mts` | `typescript-ast` | `tree-sitter-typescript`, `tree-sitter-tsx` | functions, classes, methods, variables, interfaces, types, enums, imports, exports, calls, common HTTP routes |
348
- | JavaScript | `.js`, `.jsx`, `.cjs`, `.mjs` | `typescript-ast` | `tree-sitter-javascript` | functions, classes, methods, variables, imports, exports, `require()` calls, calls, common HTTP routes |
349
- | Python | `.py` | `python-light` | `tree-sitter-python` | functions, classes, `import`, `from ... import` |
350
- | Go | `.go` | `go-light` | `tree-sitter-go` | functions, methods, types, consts, vars, single imports, import blocks |
351
- | Rust | `.rs` | inventory-only | `tree-sitter-rust` | functions, structs, enums, traits, impls, `use` imports |
352
- | Java | `.java` | inventory-only | `tree-sitter-java` | classes, interfaces, enums, methods, imports |
353
- | PHP | `.php` | inventory-only | `tree-sitter-php` | functions, classes, interfaces, traits, methods, namespace uses |
354
- | Kotlin | `.kt`, `.kts` | inventory-only | `tree-sitter-kotlin` | functions, classes, objects, imports |
355
- | Swift | `.swift` | inventory-only | `tree-sitter-swift` | functions, classes, structs, protocols, enums, imports |
356
- | C | `.c`, `.h` | inventory-only | `tree-sitter-c` | functions, structs, enums, includes |
357
- | C++ | `.cc`, `.cpp`, `.cxx`, `.hpp`, `.hh`, `.hxx` | inventory-only | `tree-sitter-cpp` | functions, classes/structs, namespaces, enums, includes/usings |
358
- | C# | `.cs` | inventory-only | `tree-sitter-csharp` | classes, interfaces, structs, enums, methods, usings |
359
-
360
- Recognized but inventory-only extensions include `.rb`, `.vue`, and `.css`. Config files (`.json`, `.yaml`, `.yml`, `.toml`, `.env.example`, `package.json`, `tsconfig.json`, `Dockerfile`, and `Makefile`) are indexed as configuration or inventory evidence.
361
-
362
- ## CLI Reference
363
-
364
- Use the resolved local runner for automation or direct CLI execution:
365
-
366
- ```bash
367
- node .codex/skills/project-librarian/dist/init-project-wiki.js [init|update] [options]
368
- node .codex/skills/project-librarian/dist/init-project-wiki.js install [--scope user|project] [--agents codex|claude|cursor|gemini|all]
369
- ```
370
-
371
- `install-skill` remains a compatibility alias for `install`.
372
-
373
- `update` is the explicit existing-project update command. It rejects `--migrate` and `--adopt-existing`; use top-level `--migrate` when legacy docs or wiki content should be preserved into `wiki_legacy*` and reviewed. When project-scoped Project Librarian skill installs already exist for the selected agent surfaces, `update` copies the current package's reusable skill files into those project skill directories before refreshing the managed setup.
374
-
375
- Important options:
376
-
377
- | Option | Purpose |
378
- | --- | --- |
379
- | `--migrate`, `--adopt-existing` | Preserve an existing wiki as `wiki_legacy*`, create migration inboxes, and generate unit-map/split-plan/coverage review files. |
380
- | `--lint` | Validate generated setup without editing files. |
381
- | `--link-check` | Report broken wiki links, duplicate routes, orphan pages, and pages the startup router cannot reach within the depth budget. |
382
- | `--quality-check` | Report stale, conflicting, and low-quality wiki document signals. |
383
- | `--doctor` | Run lint, link-check, and quality-check together. |
384
- | `--doctor --fix` | Safely refresh generated index routing before diagnostics. |
385
- | `--migration-lint` | Validate migration coverage, unit-map, split-plan, and review scaffolding separately from normal lint. |
386
- | `--migration-quality-check` | Report migration policy/structure signals separately from normal quality-check. |
387
- | `--migration-doctor` | Run migration-lint and migration-quality-check together. |
388
- | `--query <terms>` | Search wiki paths, metadata, titles, and bodies; answer-first output with per-page TL;DR lines under a hard size cap. |
389
- | `--wiki-impact <page-or-term>` | Show wiki backlinks, `decision_ref` citations, outgoing links, and router depth for matching pages. |
390
- | `--wiki-visualize` | Write a self-contained static wiki graph visualizer to `.project-wiki/wiki-graph.html`. |
391
- | `--wiki-visualize-out <path>` | With `--wiki-visualize`, write to a custom repository-relative path under `.project-wiki/`. |
392
- | `--refresh-index` | Update generated auto-discovered wiki routing. |
393
- | `--capture-inbox --title <title> --content <content>` | Append a candidate note to the wiki inbox. |
394
- | `--handoff-save --goal <goal> --state <state> --next <action>` | Save generated local session handoff state under `.project-wiki/session/`. Repeat `--next`, `--decision`, `--blocked`, `--open-question`, and `--verification` as needed. |
395
- | `--handoff-show`, `--handoff-status`, `--handoff-clear` | Print, inspect, or remove generated session handoff state. Startup hooks mention the handoff when it exists but do not inject the full file by default. |
396
- | `--handoff-promote-inbox` | Append selected generated handoff facts to `wiki/inbox/project-candidates.md` as a pending candidate. It does not write canonical, plan, or decision pages. |
397
- | `--handoff-injection-enable`, `--handoff-injection-disable`, `--handoff-injection-status` | Opt in, opt out, or inspect the capped full handoff injection experiment. Default startup behavior remains pointer-only. |
398
- | `--issue-draft --issue-title <title>` | Print a read-only GitHub issue body draft for problems or side effects. |
399
- | `--issue-create --issue-title <title>` | Create a GitHub issue through `gh` after explicit user approval. |
400
- | `--glossary-init` | Create and route the optional glossary page. |
401
- | `--prune-check` | Report active pages with stale or unresolved lifecycle signals. |
402
- | `--prune-check --prune-check-strict` | Omit pages selected only because their `updated` date is older than today. |
403
- | `--review-migration`, `--semantic-migrate` | Sync migration coverage and inbox statuses into migration review files. |
404
- | `--no-git-config` | Install hook files without changing `git core.hooksPath`. |
405
- | `--code-index` | Build the disposable code evidence index. |
406
- | `--code-index-health` | Inspect code evidence cache compatibility and print rebuild guidance without writing. |
407
- | `--code-report` | Print architecture and ownership summaries from the evidence index. |
408
- | `--code-report-section <section>` | Print one section: `coverage`, `ownership`, `languages`, `parsers`, `workspaces`, `workspace-graph`, `routes`, `hotspots`, `configs`, or `edges`. |
409
- | `--code-impact <term>` | Show file, symbol, route, import, edge, and owner impact evidence. |
410
- | `--code-context-pack <term>` | Print a budgeted first-pass context pack with structural file, symbol, route, import, edge, and ownership evidence. |
411
- | `--code-search-symbol <term>` | Search indexed symbols. |
412
- | `--code-query <sql>` | Run conservative read-only SQL over the evidence index. |
413
-
414
- ## Development
415
-
416
- The source is TypeScript. The committed `dist/` directory is the compiled JavaScript used by the npm binary and installed skill copies.
417
-
418
- ```bash
419
- npm install
420
- npm run typecheck
421
- npm run build
422
- npm run check:dist
423
- npm test
424
- npm run test:coverage
425
- npm run benchmark:llm:raw-audit
426
- npm run benchmark:llm:delta-analysis
427
- npm run benchmark:claim-ledger
428
- npm run release:check
429
- npm pack --dry-run
430
- ```
431
-
432
- When editing TypeScript under `src/`, rebuild before committing so `dist/` stays current. `npm run check:dist` verifies that the checked-in generated files still match the latest build output.
433
-
434
- `npm run test:coverage` uses Node's native test coverage with conservative line, branch, and function thresholds so coverage is a regression gate, not only a report.
435
-
436
- The supported runtime floor is Node.js 22.13+. Development type definitions should stay aligned with the Node 22 support contract or be backed by a Node 22 compatibility check so TypeScript does not admit APIs unavailable to supported users.
437
-
438
- `npm run release:check` is a local-only maintainer gate: it runs tests, native Node coverage, benchmark parser smoke, the real-corpus offline demo, benchmark release preview, benchmark claim-ledger classification, raw hygiene audit, package dry-run inspection, dist executable/parity checks, and README benchmark-claim boundary checks. It never publishes, never deletes raw benchmark artifacts, and never launches a measured Codex benchmark.
439
-
440
- Treat a green `release:check` as a reproducible release-readiness bundle, not a runtime guarantee: it proves those local gates on the current checkout, including that the package dry run stays inside the expected publish boundary (`agents/`, `dist/`, `LICENSE`, `README.md`, `README.ko.md`, and `SKILL.md`) and excludes source files, tests, repo-local wiki/workflow state, raw benchmark output, and local caches.
441
-
442
- Publishing is handled by `.github/workflows/publish.yml` after a GitHub Release is published. The workflow targets the protected `npm-publish` GitHub Environment, uses npm trusted publishing through GitHub OIDC (`id-token: write`) and `npm publish --access public`, and generates npm provenance automatically; it must not use `NODE_AUTH_TOKEN` or npm token secrets, and release-critical first-party GitHub Actions are pinned to full commit SHAs. `release:check` verifies this workflow contract locally.
443
-
444
- Trusted publishing and npm provenance prove the package was published through that GitHub OIDC workflow. They do not prove benchmark correctness, code-evidence freshness in an end-user repository, or a security audit; those remain separate evidence tracks.
445
-
446
- Maintainer benchmark commands live in [benchmarks/README.md](benchmarks/README.md). They are for release evidence and public claim validation, not normal end-user setup.
447
-
448
- For code-evidence runtime/storage checks, `npm run perf:code-efficiency` generates 3k/10k/50k fixtures and writes `benchmarks/reports/code-performance-efficiency/current.json` plus `.md`. Command timings include CLI startup and freshness checks; the `query_groups` section reports direct DB timings for representative file/symbol/route/import/edge queries. The report also measures checked-in `mixed-monorepo`, `web-service`, `python-cli`, and `docs-heavy` corpora separately from synthetic scale fixtures.
449
-
450
- Measured LLM benchmark runs automatically prune stale prior raw run directories and isolated Codex homes older than 1 day, then prune the current run's homes even on claimable-run failure; raw JSONL, stderr, reports, and manifests remain for runs inside the retention window. Old ignored raw output can still be audited with the dry-run-first helper before deleting retained isolated Codex homes:
451
-
452
- ```bash
453
- npm run benchmark:llm:raw-audit -- --older-than-days 14
454
- npm run benchmark:llm:prune-raw -- --older-than-days 14
455
- npm run benchmark:llm:prune-raw -- --older-than-days 14 --execute
456
- ```
457
-
458
- `npm run benchmark:llm:delta-analysis` reads the checked-in measured LLM report and ranks cost-weighted regressions without launching Codex. Add `-- --include-traces` to include representative raw JSONL command traces and classify broad-search/router-read drivers. It is the first diagnostic stop for weak cells such as small-scale aggregation before adding new benchmark claims.
459
-
460
- Measured LLM runs default to `--scenario-order run-major-balanced`: each measured run index executes all selected scenarios, reversing the order on alternating repetitions so with/without pairs are not grouped by condition across repeated runs. Use `--scenario-order scenario-major` only when reproducing older scenario-grouped diagnostics.
461
-
462
- `npm run typecheck:ts7` is an opt-in TypeScript 7 RC compatibility probe. It uses `npx` and is intentionally outside `test`, `release:check`, and CI gates until the compiler API and this project's TypeScript extractor have a measured parity record.
155
+ `--agents` also accepts comma-separated values such as `codex,claude,cursor,gemini`. `all` targets every supported agent. `--scope` accepts `user` or `project`. Direct CLI and automation details are in [CLI Reference](docs/cli-reference.md).
463
156
 
464
157
  ## Inspiration
465
158
 
package/SKILL.md CHANGED
@@ -175,6 +175,13 @@ Require a compatible existing cache for changed-file-only updates with `--increm
175
175
  $PROJECT_LIBRARIAN --code-index --incremental --code-scope src
176
176
  ```
177
177
 
178
+ If the cache schema version differs from the current runner, inspect it and require explicit replacement approval before rebuilding:
179
+
180
+ ```bash
181
+ $PROJECT_LIBRARIAN --code-index-health
182
+ $PROJECT_LIBRARIAN --code-index --code-index-migrate --code-scope src
183
+ ```
184
+
178
185
  Run read-only SQL over the cache with `--code-query`:
179
186
 
180
187
  ```bash
package/dist/args.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.codeIndexMode = exports.acknowledgeSmallRepoMode = exports.noGitConfigMode = exports.reviewMigrationMode = exports.pruneCheckStrictMode = exports.pruneCheckMode = exports.captureInboxMode = exports.refreshIndexMode = exports.issueDraftMode = exports.issueCreateMode = exports.handoffVerification = exports.handoffStatusMode = exports.handoffState = exports.handoffShowMode = exports.handoffSaveMode = exports.handoffPromoteInboxMode = exports.handoffInjectionStatusMode = exports.handoffInjectionEnableMode = exports.handoffInjectionDisableMode = exports.handoffOpenQuestions = exports.handoffNextActions = exports.handoffLastSuccessCommand = exports.handoffLastFailureCommand = exports.handoffInputMode = exports.handoffGoal = exports.handoffDecisions = exports.handoffClearMode = exports.handoffBlocked = exports.glossaryMode = exports.fixMode = exports.doctorMode = exports.qualityCheckMode = exports.linkCheckMode = exports.migrationQualityCheckMode = exports.migrationLintMode = exports.migrationDoctorMode = exports.lintMode = exports.migrateMode = exports.invalidAgentTargets = exports.missingValueOptions = exports.unexpectedValueOptions = exports.unknownOptions = exports.args = exports.commandArgs = exports.command = exports.unknownCommand = exports.helpMode = exports.agentTargets = exports.parsedArgs = exports.rawArgs = void 0;
4
- exports.issueDraftTitle = exports.issueBodyFile = exports.captureCategory = exports.captureContent = exports.captureTitle = exports.codeIndexScopes = exports.codeParser = exports.codeIndexOutput = exports.codeSearchSymbol = exports.codeReportSection = exports.codeQuerySql = exports.codeImpactTarget = exports.codeContextPackTarget = exports.wikiVisualizeOutput = exports.wikiVisualizeMode = exports.wikiImpactTarget = exports.wikiImpactMode = exports.queryTerm = exports.codeSearchSymbolMode = exports.codeQueryMode = exports.codeImpactMode = exports.codeParserMode = exports.codeContextPackMode = exports.codeFilesMode = exports.codeStatusMode = exports.codeReportMode = exports.codeIndexHealthMode = exports.codeIndexFullMode = exports.codeIndexIncrementalMode = void 0;
4
+ exports.issueDraftTitle = exports.issueBodyFile = exports.captureCategory = exports.captureContent = exports.captureTitle = exports.codeIndexScopes = exports.codeParser = exports.codeIndexOutput = exports.codeSearchSymbol = exports.codeReportSection = exports.codeQuerySql = exports.codeImpactTarget = exports.codeContextPackTarget = exports.wikiVisualizeOutput = exports.wikiVisualizeMode = exports.wikiImpactTarget = exports.wikiImpactMode = exports.queryTerm = exports.codeSearchSymbolMode = exports.codeQueryMode = exports.codeImpactMode = exports.codeParserMode = exports.codeContextPackMode = exports.codeFilesMode = exports.codeStatusMode = exports.codeReportMode = exports.codeIndexHealthMode = exports.codeIndexFullMode = exports.codeIndexMigrateMode = exports.codeIndexIncrementalMode = exports.codeIndexEngineMode = exports.codeIndexEngine = void 0;
5
5
  exports.parseArgs = parseArgs;
6
6
  exports.argValue = argValue;
7
7
  exports.argValues = argValues;
@@ -18,9 +18,11 @@ const flagDefinitions = [
18
18
  { name: "--code-files", value: "none", aliases: ["--code-evidence-files"] },
19
19
  { name: "--code-impact", value: "value", aliases: ["--code-evidence-impact"] },
20
20
  { name: "--code-index", value: "none", aliases: ["--code-evidence-index"] },
21
+ { name: "--code-index-engine", value: "value", aliases: ["--code-evidence-index-engine"] },
21
22
  { name: "--code-index-full", value: "none", aliases: ["--code-evidence-index-full"] },
22
23
  { name: "--code-index-health", value: "none" },
23
24
  { name: "--code-index-incremental", value: "none", aliases: ["--incremental", "--code-incremental", "--code-evidence-index-incremental"] },
25
+ { name: "--code-index-migrate", value: "none", aliases: ["--code-evidence-index-migrate"] },
24
26
  { name: "--code-index-out", value: "value", aliases: ["--code-evidence-out"] },
25
27
  { name: "--code-parser", value: "value", aliases: ["--code-evidence-parser"] },
26
28
  { name: "--code-query", value: "value", aliases: ["--code-evidence-query"] },
@@ -179,9 +181,12 @@ function parseArgs(argv) {
179
181
  codeFilesMode: hasAnyFlag("--code-files"),
180
182
  codeImpactMode: hasAnyFlag("--code-impact"),
181
183
  codeImpactTarget,
184
+ codeIndexEngine: argValueFromAny("--code-index-engine") || "auto",
185
+ codeIndexEngineMode: hasAnyFlag("--code-index-engine"),
182
186
  codeIndexFullMode: hasAnyFlag("--code-index-full"),
183
187
  codeIndexHealthMode: args.has("--code-index-health"),
184
188
  codeIndexIncrementalMode: hasAnyFlag("--code-index-incremental"),
189
+ codeIndexMigrateMode: hasAnyFlag("--code-index-migrate"),
185
190
  codeIndexMode: hasAnyFlag("--code-index"),
186
191
  codeIndexOutput: argValueFromAny("--code-index-out") || ".project-wiki/code-evidence.sqlite",
187
192
  codeIndexScopes: argValuesFromAny("--code-scope"),
@@ -302,7 +307,10 @@ exports.reviewMigrationMode = exports.parsedArgs.reviewMigrationMode;
302
307
  exports.noGitConfigMode = exports.parsedArgs.noGitConfigMode;
303
308
  exports.acknowledgeSmallRepoMode = exports.parsedArgs.acknowledgeSmallRepoMode;
304
309
  exports.codeIndexMode = exports.parsedArgs.codeIndexMode;
310
+ exports.codeIndexEngine = exports.parsedArgs.codeIndexEngine;
311
+ exports.codeIndexEngineMode = exports.parsedArgs.codeIndexEngineMode;
305
312
  exports.codeIndexIncrementalMode = exports.parsedArgs.codeIndexIncrementalMode;
313
+ exports.codeIndexMigrateMode = exports.parsedArgs.codeIndexMigrateMode;
306
314
  exports.codeIndexFullMode = exports.parsedArgs.codeIndexFullMode;
307
315
  exports.codeIndexHealthMode = exports.parsedArgs.codeIndexHealthMode;
308
316
  exports.codeReportMode = exports.parsedArgs.codeReportMode;