project-librarian 0.5.6 → 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.
package/README.ko.md CHANGED
@@ -31,7 +31,7 @@ npx project-librarian@latest install --scope user --agents all
31
31
  npx project-librarian@latest install --scope project --agents all
32
32
  ```
33
33
 
34
- `install`은 재사용 가능한 실행 파일과 스킬 파일만 복사합니다. `AGENTS.md`, 에이전트 훅, `wiki/`, git 훅 파일, 진단, 선택적 코드 근거 지원을 만들거나 갱신하는 것은 에이전트가 실행하는 생명주기 명령입니다. `install-skill`은 호환성 별칭으로 계속 지원됩니다.
34
+ `install`은 재사용 가능한 실행 파일, 스킬 파일, 로컬 실행기에 필요한 필수 런타임 의존성을 복사합니다. `AGENTS.md`, 에이전트 훅, `wiki/`, git 훅 파일, 진단, 선택적 코드 근거 지원을 만들거나 갱신하는 것은 에이전트가 실행하는 생명주기 명령입니다. `install-skill`은 호환성 별칭으로 계속 지원됩니다.
35
35
 
36
36
  ## 업데이트
37
37
 
package/README.md CHANGED
@@ -31,7 +31,7 @@ The installed skill resolves the local runner and executes the right command fro
31
31
  npx project-librarian@latest install --scope project --agents all
32
32
  ```
33
33
 
34
- `install` copies reusable runner and skill files only. 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.
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
 
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 = exports.codeIndexEngineMode = exports.codeIndexEngine = 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;
@@ -22,6 +22,7 @@ const flagDefinitions = [
22
22
  { name: "--code-index-full", value: "none", aliases: ["--code-evidence-index-full"] },
23
23
  { name: "--code-index-health", value: "none" },
24
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"] },
25
26
  { name: "--code-index-out", value: "value", aliases: ["--code-evidence-out"] },
26
27
  { name: "--code-parser", value: "value", aliases: ["--code-evidence-parser"] },
27
28
  { name: "--code-query", value: "value", aliases: ["--code-evidence-query"] },
@@ -185,6 +186,7 @@ function parseArgs(argv) {
185
186
  codeIndexFullMode: hasAnyFlag("--code-index-full"),
186
187
  codeIndexHealthMode: args.has("--code-index-health"),
187
188
  codeIndexIncrementalMode: hasAnyFlag("--code-index-incremental"),
189
+ codeIndexMigrateMode: hasAnyFlag("--code-index-migrate"),
188
190
  codeIndexMode: hasAnyFlag("--code-index"),
189
191
  codeIndexOutput: argValueFromAny("--code-index-out") || ".project-wiki/code-evidence.sqlite",
190
192
  codeIndexScopes: argValuesFromAny("--code-scope"),
@@ -308,6 +310,7 @@ exports.codeIndexMode = exports.parsedArgs.codeIndexMode;
308
310
  exports.codeIndexEngine = exports.parsedArgs.codeIndexEngine;
309
311
  exports.codeIndexEngineMode = exports.parsedArgs.codeIndexEngineMode;
310
312
  exports.codeIndexIncrementalMode = exports.parsedArgs.codeIndexIncrementalMode;
313
+ exports.codeIndexMigrateMode = exports.parsedArgs.codeIndexMigrateMode;
311
314
  exports.codeIndexFullMode = exports.parsedArgs.codeIndexFullMode;
312
315
  exports.codeIndexHealthMode = exports.parsedArgs.codeIndexHealthMode;
313
316
  exports.codeReportMode = exports.parsedArgs.codeReportMode;
@@ -79,8 +79,8 @@ function readScopes(scopesJson, scopesText, fallback) {
79
79
  const scopes = scopesText.split(",").map((scope) => scope.trim()).filter(Boolean);
80
80
  return scopes.length > 0 ? scopes : fallback;
81
81
  }
82
- function rebuildCommand(indexableFiles, smallRepoThreshold) {
83
- const parts = ["project-librarian", "--code-index", "--code-index-full"];
82
+ function rebuildCommand(indexableFiles, smallRepoThreshold, options = {}) {
83
+ const parts = ["project-librarian", "--code-index", options.schemaMigration ? "--code-index-migrate" : "--code-index-full"];
84
84
  if (indexableFiles !== null && indexableFiles < smallRepoThreshold)
85
85
  parts.push("--acknowledge-small-repo");
86
86
  return parts.join(" ");
@@ -126,6 +126,7 @@ function inspectCodeIndexHealth(options) {
126
126
  const indexedFiles = indexedFilesText ? Number(indexedFilesText) : null;
127
127
  const indexableFiles = safeDiscoverCodeFiles(options.discoverCodeFiles, scopes.length > 0 ? scopes : options.defaultScopes);
128
128
  const compatible = foundSchemaVersion === options.expectedSchemaVersion;
129
+ const schemaMigration = Boolean(foundSchemaVersion) && !compatible;
129
130
  return {
130
131
  database_path: options.relativePath,
131
132
  expected_schema_version: options.expectedSchemaVersion,
@@ -136,7 +137,7 @@ function inspectCodeIndexHealth(options) {
136
137
  ? `code evidence index is compatible: schema ${foundSchemaVersion}`
137
138
  : `code evidence index schema version ${foundSchemaVersion || "(missing)"} is incompatible with ${options.expectedSchemaVersion}`,
138
139
  parser_mode: parserMode,
139
- recommended_rebuild_command: rebuildCommand(indexableFiles, options.smallRepoThreshold),
140
+ recommended_rebuild_command: rebuildCommand(indexableFiles, options.smallRepoThreshold, { schemaMigration }),
140
141
  scopes,
141
142
  status: compatible ? "compatible" : "incompatible_schema",
142
143
  tables,
@@ -71,6 +71,49 @@ function requireCompatibleDatabase(database, runtime) {
71
71
  ].join("\n"));
72
72
  }
73
73
  }
74
+ function schemaMigrationRequired(reason) {
75
+ return reason.startsWith("existing schema version ") && !reason.includes("(missing)");
76
+ }
77
+ function shellQuote(value) {
78
+ if (/^[A-Za-z0-9_./:=@+-]+$/.test(value))
79
+ return value;
80
+ return `'${value.replace(/'/g, "'\\''")}'`;
81
+ }
82
+ function schemaMigrationApprovalCommand(options) {
83
+ const parts = ["project-librarian", "--code-index", "--code-index-migrate"];
84
+ for (const scope of options.scopes) {
85
+ if (scope !== ".")
86
+ parts.push("--code-scope", scope);
87
+ }
88
+ if (args_1.codeIndexOutput !== ".project-wiki/code-evidence.sqlite")
89
+ parts.push("--code-index-out", args_1.codeIndexOutput);
90
+ if (args_1.acknowledgeSmallRepoMode)
91
+ parts.push("--acknowledge-small-repo");
92
+ if (options.requestedEngine !== "auto")
93
+ parts.push("--code-index-engine", options.requestedEngine);
94
+ if (options.parserMode !== "default")
95
+ parts.push("--code-parser", options.parserMode);
96
+ return parts.map(shellQuote).join(" ");
97
+ }
98
+ function schemaMigrationRequiredMessage(runtime, reason, options) {
99
+ const databasePath = runtime.codeEvidenceDatabasePath();
100
+ return [
101
+ `code evidence index schema migration required: ${reason}`,
102
+ "The existing disposable code evidence index must be replaced before this version can write it.",
103
+ `approve: ${schemaMigrationApprovalCommand(options)}`,
104
+ "inspect: project-librarian --code-index-health",
105
+ `database: ${databasePath.relativePath}`,
106
+ ].join("\n");
107
+ }
108
+ function unreadableIndexMessage(runtime) {
109
+ const health = runtime.codeIndexHealth();
110
+ return [
111
+ health.message,
112
+ "inspect: project-librarian --code-index-health",
113
+ `rebuild: ${health.recommended_rebuild_command}`,
114
+ `database: ${health.database_path}`,
115
+ ].join("\n");
116
+ }
74
117
  function elapsedMs(started) {
75
118
  return Number(process.hrtime.bigint() - started) / 1_000_000;
76
119
  }
@@ -125,6 +168,33 @@ function runCodeIndexMode(runtime) {
125
168
  runtime.fail(scaleGate.warning);
126
169
  const engineSelectionContext = runtime.codeIndexEngineSelectionContext(discoveredFiles, parserMode);
127
170
  const engine = resolveCodeIndexEngine(requestedEngine, engineSelectionContext, runtime.shouldUseNativeCodeIndexAuto);
171
+ const existingIndex = fs.existsSync(databasePath.absolutePath);
172
+ if (args_1.codeIndexIncrementalMode && !existingIndex) {
173
+ runtime.fail(`--incremental requires an existing compatible code evidence index: ${databasePath.relativePath}`);
174
+ }
175
+ let compatibility = { compatible: false, reason: "compatibility was not checked" };
176
+ let checkedCompatibility = false;
177
+ if (existingIndex) {
178
+ try {
179
+ measurePhase(phaseTimings, "compatibility_ms", () => {
180
+ const existingDatabase = runtime.openDatabase(databasePath.absolutePath);
181
+ try {
182
+ compatibility = (0, schema_1.incrementalCompatibility)(existingDatabase, scopes, parserMode);
183
+ checkedCompatibility = true;
184
+ }
185
+ finally {
186
+ existingDatabase.close();
187
+ }
188
+ });
189
+ }
190
+ catch {
191
+ if (!args_1.codeIndexFullMode && !args_1.codeIndexMigrateMode)
192
+ runtime.fail(unreadableIndexMessage(runtime));
193
+ }
194
+ if (!compatibility.compatible && schemaMigrationRequired(compatibility.reason) && !args_1.codeIndexMigrateMode) {
195
+ runtime.fail(schemaMigrationRequiredMessage(runtime, compatibility.reason, { parserMode, requestedEngine, scopes }));
196
+ }
197
+ }
128
198
  if (engine === "native-rust") {
129
199
  if (!args_1.codeIndexIncrementalMode) {
130
200
  try {
@@ -140,23 +210,9 @@ function runCodeIndexMode(runtime) {
140
210
  }
141
211
  }
142
212
  }
143
- const existingIndex = fs.existsSync(databasePath.absolutePath);
144
- if (args_1.codeIndexIncrementalMode && !existingIndex) {
145
- runtime.fail(`--incremental requires an existing compatible code evidence index: ${databasePath.relativePath}`);
146
- }
147
213
  let incremental = false;
148
- if (existingIndex && !args_1.codeIndexFullMode) {
149
- let compatibility = { compatible: false, reason: "compatibility was not checked" };
150
- measurePhase(phaseTimings, "compatibility_ms", () => {
151
- const existingDatabase = runtime.openDatabase(databasePath.absolutePath);
152
- try {
153
- compatibility = (0, schema_1.incrementalCompatibility)(existingDatabase, scopes, parserMode);
154
- }
155
- finally {
156
- existingDatabase.close();
157
- }
158
- });
159
- incremental = !args_1.codeIndexFullMode && compatibility.compatible;
214
+ if (existingIndex && checkedCompatibility && !args_1.codeIndexFullMode && !args_1.codeIndexMigrateMode) {
215
+ incremental = compatibility.compatible;
160
216
  if (args_1.codeIndexIncrementalMode && !compatibility.compatible)
161
217
  runtime.fail(`--incremental cannot update ${databasePath.relativePath}: ${compatibility.reason}`);
162
218
  }
@@ -62,6 +62,7 @@ Options:
62
62
  --acknowledge-small-repo With --code-index, proceed below the small-repo scale gate after its cost warning.
63
63
  --incremental With --code-index, require an existing compatible index and update only changes.
64
64
  --code-index-full With --code-index, force a full rebuild even when incremental update is possible.
65
+ --code-index-migrate With --code-index, approve replacing an incompatible schema-version index.
65
66
  --code-index-engine <engine> With --code-index, override default auto engine: typescript or native-rust.
66
67
  --code-parser <mode> With --code-index, use parser mode default or tree-sitter.
67
68
  --code-query <sql> Run conservative read-only SQL over the code evidence index.
@@ -166,6 +167,10 @@ if (args_1.codeIndexFullMode && !args_1.codeIndexMode) {
166
167
  console.error("--code-index-full is only supported with --code-index.");
167
168
  process.exit(1);
168
169
  }
170
+ if (args_1.codeIndexMigrateMode && !args_1.codeIndexMode) {
171
+ console.error("--code-index-migrate is only supported with --code-index.");
172
+ process.exit(1);
173
+ }
169
174
  if (args_1.codeIndexEngineMode && !args_1.codeIndexMode) {
170
175
  console.error("--code-index-engine is only supported with --code-index.");
171
176
  process.exit(1);
@@ -178,6 +183,10 @@ if (args_1.codeIndexIncrementalMode && args_1.codeIndexFullMode) {
178
183
  console.error("Use one code index update mode at a time: --incremental or --code-index-full.");
179
184
  process.exit(1);
180
185
  }
186
+ if (args_1.codeIndexIncrementalMode && args_1.codeIndexMigrateMode) {
187
+ console.error("Use one code index update mode at a time: --incremental or --code-index-migrate.");
188
+ process.exit(1);
189
+ }
181
190
  const activeHandoffModes = [
182
191
  args_1.handoffSaveMode ? "--handoff-save" : "",
183
192
  args_1.handoffShowMode ? "--handoff-show" : "",
@@ -52,6 +52,7 @@ const packageFiles = [
52
52
  "package.json",
53
53
  "agents",
54
54
  ];
55
+ const runtimeDependencyPackages = ["typescript"];
55
56
  function fail(message) {
56
57
  console.error(message);
57
58
  process.exit(1);
@@ -83,6 +84,18 @@ function installAgents() {
83
84
  function packageRoot() {
84
85
  return path.resolve(__dirname, "..");
85
86
  }
87
+ function runtimeDependencySource(packageName) {
88
+ try {
89
+ return path.dirname(require.resolve(`${packageName}/package.json`, { paths: [packageRoot()] }));
90
+ }
91
+ catch (error) {
92
+ const message = error instanceof Error ? error.message : String(error);
93
+ return fail(`missing runtime dependency ${packageName}: run npm install before installing the Project Librarian skill. Error: ${message}`);
94
+ }
95
+ }
96
+ function runtimeDependencyTarget(packageName) {
97
+ return path.join("node_modules", ...packageName.split("/"));
98
+ }
86
99
  function userAgentRoot(agent) {
87
100
  const home = os.homedir();
88
101
  if (agent === "codex")
@@ -236,11 +249,18 @@ function installedProjectSkillSurfaces() {
236
249
  }
237
250
  function copyPackageFiles(targetRoot, dryRun, labelRoot = targetRoot) {
238
251
  const root = packageRoot();
239
- return packageFiles.map((relativePath) => {
252
+ const packageRows = packageFiles.map((relativePath) => {
240
253
  const source = path.join(root, relativePath);
241
254
  const target = path.join(targetRoot, relativePath);
242
255
  return [path.join(labelRoot, relativePath), copyPath(source, target, targetRoot, dryRun)];
243
256
  });
257
+ const dependencyRows = runtimeDependencyPackages.map((packageName) => {
258
+ const relativePath = runtimeDependencyTarget(packageName);
259
+ const source = runtimeDependencySource(packageName);
260
+ const target = path.join(targetRoot, relativePath);
261
+ return [path.join(labelRoot, relativePath), copyPath(source, target, targetRoot, dryRun)];
262
+ });
263
+ return [...packageRows, ...dependencyRows];
244
264
  }
245
265
  function syncProjectSkillInstall(agent) {
246
266
  return copyPackageFiles(projectSkillTarget(agent), false, projectSkillRelativeRoot(agent)).map(([label, status]) => {
@@ -261,7 +281,7 @@ function runInstallSkillMode() {
261
281
  console.log(`Project Librarian skill ${dryRun ? "install dry-run" : "install"} complete.`);
262
282
  console.log(`scope: ${scope}`);
263
283
  console.log(`agents: ${agents.join(", ")}`);
264
- console.log("note: install only installs the reusable skill files; 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.");
284
+ console.log("note: install only installs the reusable skill files and required local-runner runtime dependencies; 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.");
265
285
  console.log("compatibility: install-skill remains supported as an alias for install.");
266
286
  console.log("next: ask your agent to use Project Librarian from the target project root; the installed skill resolves the local runner.");
267
287
  for (const [label, status] of rows) {
@@ -53,7 +53,7 @@
53
53
  "architecture": "arm64",
54
54
  "format": "pe",
55
55
  "path": "dist/native/win32-arm64/project-librarian-indexer.exe",
56
- "sha256": "392157f4d3591c48a66ee674b99a8a34cda3d38cc76df6343276becb23a7055c",
56
+ "sha256": "e8e5200660a8852d1b7554daf0d16361e29e5599baa5cd406eb3f2266abd98f6",
57
57
  "size": 2098688,
58
58
  "triple": "win32-arm64"
59
59
  },
@@ -61,7 +61,7 @@
61
61
  "architecture": "x64",
62
62
  "format": "pe",
63
63
  "path": "dist/native/win32-x64/project-librarian-indexer.exe",
64
- "sha256": "fabe69234daa9a6a738d0b7160c84573853d7a9e3be14c19ec6a27ca171e3f8a",
64
+ "sha256": "dc076bd61271f23ab87b428c7cbfa3af45911c00f7bf7986a2ed9d517e1cfb6f",
65
65
  "size": 2375680,
66
66
  "triple": "win32-x64"
67
67
  }
@@ -9,13 +9,13 @@ node .codex/skills/project-librarian/dist/init-project-wiki.js install [--scope
9
9
 
10
10
  `install-skill` remains a compatibility alias for `install`.
11
11
 
12
- `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.
12
+ `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 and required local-runner runtime dependencies into those project skill directories before refreshing the managed setup.
13
13
 
14
14
  ### Important Options
15
15
 
16
16
  | Option | Purpose |
17
17
  | --- | --- |
18
- | `install --scope user|project --agents <list> --dry-run` | Install reusable skill files globally or into the current repository; `--dry-run` previews copied files for install only. |
18
+ | `install --scope user|project --agents <list> --dry-run` | Install reusable skill files and required local-runner runtime dependencies globally or into the current repository; `--dry-run` previews copied files for install only. |
19
19
  | `update --agents <list>` | Refresh an existing setup and existing project-scoped skill copies; selected surfaces can be `codex`, `claude`, `cursor`, `gemini`, or `all`. |
20
20
  | `--migrate`, `--adopt-existing` | Preserve an existing wiki as `wiki_legacy*`, create migration inboxes, and generate unit-map/split-plan/coverage review files. |
21
21
  | `--lint` | Validate generated setup without editing files. |
@@ -48,6 +48,7 @@ node .codex/skills/project-librarian/dist/init-project-wiki.js install [--scope
48
48
  | `--code-index-out <path>` | Use a custom SQLite output path under `.project-wiki/`; applies to index and read modes. |
49
49
  | `--acknowledge-small-repo` | With `--code-index`, proceed below the ~5k-file scale gate after the cost warning. |
50
50
  | `--incremental`, `--code-index-incremental`, `--code-index-full` | With `--code-index`, require an incremental update or force a full rebuild. |
51
+ | `--code-index-migrate` | With `--code-index`, explicitly approve replacing an existing index whose schema version differs from the current package. |
51
52
  | `--code-parser <mode>` | With `--code-index`, select `default` or optional `tree-sitter` extraction. |
52
53
  | `--code-index-health` | Inspect code evidence cache compatibility and print rebuild guidance without writing. |
53
54
  | `--code-index-engine <engine>` | Override the default `auto` index engine with `typescript` or `native-rust`. |
@@ -78,6 +78,12 @@ The matrix lists languages with implemented symbol/import extraction. Other reco
78
78
 
79
79
  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.
80
80
 
81
+ ## Schema Migration
82
+
83
+ The code evidence index is disposable, but Project Librarian still treats schema-version changes as an explicit migration boundary. If an existing `.project-wiki/code-evidence.sqlite` has a different schema version, `--code-index` stops before replacing the database and prints a migration-required message with the approval command.
84
+
85
+ Run `project-librarian --code-index-health` to inspect the current index. To approve replacing an incompatible-schema index, rerun the build with `--code-index --code-index-migrate` plus the same scope/parser options you want for the new index. `--incremental` cannot migrate schema versions.
86
+
81
87
  ## Native Helper Policy
82
88
 
83
89
  Experimental `--code-index-engine native-rust` runs the native helper for `typescript-ast`, `config`, the listed `*-light` profiles, and inventory-only source files. Omitted `--code-index-engine` means `auto`; full-index auto uses the native helper when a helper is available and at least one structurally extracted native profile is present, while config-only or inventory-only repositories stay on TypeScript. Compatible incremental auto uses the Rust direct-writer when a helper is available and the changed files are native-eligible.
@@ -9,13 +9,13 @@ node .codex/skills/project-librarian/dist/init-project-wiki.js install [--scope
9
9
 
10
10
  `install-skill`은 `install`의 호환성 별칭으로 계속 지원됩니다.
11
11
 
12
- `update`는 기존 프로젝트 갱신을 명시하는 명령입니다. `--migrate`와 `--adopt-existing`를 거부합니다. 기존 문서나 위키 내용을 `wiki_legacy*`로 보존하고 검토해야 한다면 top-level `--migrate`를 사용합니다. 선택된 에이전트 표면에 프로젝트 범위 Project Librarian 스킬 설치가 이미 있으면 `update`는 현재 패키지의 재사용 가능한 스킬 파일을 해당 프로젝트 스킬 디렉터리에 복사한 뒤 관리 설정을 갱신합니다.
12
+ `update`는 기존 프로젝트 갱신을 명시하는 명령입니다. `--migrate`와 `--adopt-existing`를 거부합니다. 기존 문서나 위키 내용을 `wiki_legacy*`로 보존하고 검토해야 한다면 top-level `--migrate`를 사용합니다. 선택된 에이전트 표면에 프로젝트 범위 Project Librarian 스킬 설치가 이미 있으면 `update`는 현재 패키지의 재사용 가능한 스킬 파일과 로컬 실행기에 필요한 필수 런타임 의존성을 해당 프로젝트 스킬 디렉터리에 복사한 뒤 관리 설정을 갱신합니다.
13
13
 
14
14
  ### 주요 옵션
15
15
 
16
16
  | 옵션 | 목적 |
17
17
  | --- | --- |
18
- | `install --scope user|project --agents <list> --dry-run` | 재사용 가능한 스킬 파일을 전역 또는 현재 저장소에 설치합니다. `--dry-run`은 install에서 복사될 파일을 미리 보여줍니다. |
18
+ | `install --scope user|project --agents <list> --dry-run` | 재사용 가능한 스킬 파일과 로컬 실행기에 필요한 필수 런타임 의존성을 전역 또는 현재 저장소에 설치합니다. `--dry-run`은 install에서 복사될 파일을 미리 보여줍니다. |
19
19
  | `update --agents <list>` | 기존 설정과 기존 프로젝트 범위 스킬 복사본을 갱신합니다. 표면은 `codex`, `claude`, `cursor`, `gemini`, `all` 중 하나입니다. |
20
20
  | `--migrate`, `--adopt-existing` | 기존 위키를 `wiki_legacy*`로 보존하고 migration inbox, unit-map, split-plan, coverage 검토 파일을 만듭니다. |
21
21
  | `--lint` | 파일을 수정하지 않고 생성된 설정을 검증합니다. |
@@ -48,6 +48,7 @@ node .codex/skills/project-librarian/dist/init-project-wiki.js install [--scope
48
48
  | `--code-index-out <path>` | `.project-wiki/` 아래 사용자 지정 SQLite 출력 경로를 사용합니다. index와 read mode에 모두 적용됩니다. |
49
49
  | `--acknowledge-small-repo` | `--code-index`와 함께 사용해 약 5k 파일 미만 규모 경고 후에도 진행합니다. |
50
50
  | `--incremental`, `--code-index-incremental`, `--code-index-full` | `--code-index`와 함께 사용해 증분 갱신을 요구하거나 전체 재생성을 강제합니다. |
51
+ | `--code-index-migrate` | `--code-index`와 함께 사용해 기존 인덱스의 스키마 버전이 현재 패키지와 다를 때 교체를 명시적으로 승인합니다. |
51
52
  | `--code-parser <mode>` | `--code-index`와 함께 사용해 `default` 또는 선택적 `tree-sitter` 추출을 선택합니다. |
52
53
  | `--code-index-health` | 파일을 쓰지 않고 코드 근거 캐시 호환성과 재빌드 안내를 출력합니다. |
53
54
  | `--code-index-engine <engine>` | 기본 `auto` 인덱스 엔진을 `typescript` 또는 `native-rust`로 override합니다. |
@@ -78,6 +78,12 @@ codex mcp add project-librarian -- node .codex/skills/project-librarian/dist/ini
78
78
 
79
79
  `.rb`, `.vue`, `.css`는 인식하지만 inventory-only입니다. `.json`, `.yaml`, `.yml`, `.toml`, `.env.example`, `package.json`, `tsconfig.json`, `Dockerfile`, `Makefile`은 설정 또는 inventory 근거로 인덱싱됩니다.
80
80
 
81
+ ## 스키마 마이그레이션
82
+
83
+ 코드 근거 인덱스는 폐기 가능한 캐시지만, Project Librarian은 스키마 버전 변경을 명시적 마이그레이션 경계로 취급합니다. 기존 `.project-wiki/code-evidence.sqlite`의 스키마 버전이 현재 패키지와 다르면 `--code-index`는 데이터베이스를 교체하기 전에 멈추고 마이그레이션 필요 메시지와 승인 명령을 출력합니다.
84
+
85
+ 현재 인덱스 상태는 `project-librarian --code-index-health`로 확인합니다. 호환되지 않는 스키마의 인덱스 교체를 승인하려면 새 인덱스에 적용할 scope/parser 옵션과 함께 `--code-index --code-index-migrate`를 다시 실행합니다. `--incremental`은 스키마 버전을 마이그레이션할 수 없습니다.
86
+
81
87
  ## 네이티브 헬퍼 정책
82
88
 
83
89
  실험적 `--code-index-engine native-rust`는 `typescript-ast`, `config`, 표의 `*-light` 프로파일, inventory-only 소스 파일을 네이티브 헬퍼로 처리합니다. `--code-index-engine`을 생략하면 `auto`입니다. full-index auto는 헬퍼를 사용할 수 있고 구조적으로 추출되는 네이티브 프로파일이 하나 이상 있을 때 네이티브 헬퍼를 사용하며, config-only 또는 inventory-only 저장소는 TypeScript 경로에 남깁니다. 호환되는 incremental auto는 헬퍼를 사용할 수 있고 변경 파일이 native-eligible이면 Rust direct-writer를 사용합니다.
package/docs/ko/usage.md CHANGED
@@ -16,7 +16,7 @@ npx project-librarian@latest install --scope user --agents all
16
16
  npx project-librarian@latest install --scope project --agents all
17
17
  ```
18
18
 
19
- `install`은 재사용 가능한 스킬 파일만 복사합니다. `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `wiki/`, `.cursor/rules/`, `.cursor/hooks.json`, `.gemini/settings.json`, `.codex/hooks.json`, `.claude/settings.json`은 만들거나 갱신하지 않습니다. `install-skill`은 호환성 별칭으로 계속 지원됩니다.
19
+ `install`은 재사용 가능한 스킬 파일과 로컬 실행기에 필요한 필수 런타임 의존성을 복사합니다. `AGENTS.md`, `CLAUDE.md`, `GEMINI.md`, `wiki/`, `.cursor/rules/`, `.cursor/hooks.json`, `.gemini/settings.json`, `.codex/hooks.json`, `.claude/settings.json`은 만들거나 갱신하지 않습니다. `install-skill`은 호환성 별칭으로 계속 지원됩니다.
20
20
 
21
21
  | 상황 | 명령 |
22
22
  | --- | --- |
@@ -34,7 +34,7 @@ npx project-librarian@latest install --scope project --agents all
34
34
 
35
35
  마이그레이션 없는 기존 설정 갱신은 저장소에 이미 있는 에이전트 표면만 보존해서 갱신합니다. 따라서 Codex와 Claude 파일만 있던 저장소는 일반 갱신만으로 Cursor나 Gemini 파일이 새로 생기지 않습니다. 새 표면을 의도적으로 추가하려면 `project-librarian update --agents cursor` 또는 `project-librarian update --agents all`처럼 명시합니다. 목록에 없는 표면을 삭제하지는 않습니다.
36
36
 
37
- `project-librarian update`는 선택된 표면에 이미 프로젝트 범위 Project Librarian 스킬 설치가 있으면 현재 실행 중인 패키지의 재사용 가능한 스킬 파일을 그 프로젝트 스킬 디렉터리로 동기화합니다. 기본적으로 새 프로젝트 범위 스킬 설치를 만들지는 않고, 사용자 범위 스킬 설치도 갱신하지 않습니다. 사용자 범위 스킬은 `install --scope user`로 명시적으로 갱신합니다.
37
+ `project-librarian update`는 선택된 표면에 이미 프로젝트 범위 Project Librarian 스킬 설치가 있으면 현재 실행 중인 패키지의 재사용 가능한 스킬 파일과 프로젝트 로컬 실행기에 필요한 런타임 의존성을 그 프로젝트 스킬 디렉터리로 동기화합니다. 기본적으로 새 프로젝트 범위 스킬 설치를 만들지는 않고, 사용자 범위 스킬 설치도 갱신하지 않습니다. 사용자 범위 스킬은 `install --scope user`로 명시적으로 갱신합니다.
38
38
 
39
39
  ## 실행 경로
40
40
 
@@ -87,6 +87,7 @@ npx project-librarian@latest install --scope project --agents all
87
87
  | 여러 범위 빌드 | "`src`와 `packages/api`에 대해 Project Librarian 코드 근거를 만들어줘." | `--code-index --code-scope src --code-scope packages/api` |
88
88
  | 증분 갱신 요구 | "Project Librarian 코드 근거 인덱스를 증분 갱신해줘." | `--code-index --incremental` |
89
89
  | 전체 재생성 강제 | "Project Librarian 코드 근거 인덱스를 전체 재생성해줘." | `--code-index --code-index-full` |
90
+ | 스키마 마이그레이션 승인 | "Project Librarian 코드 근거 인덱스 스키마를 마이그레이션해줘." | `--code-index --code-index-migrate` |
90
91
  | 선택적 Tree-sitter 백엔드 사용 | "Tree-sitter 파서로 Project Librarian 코드 근거를 만들어줘." | `--code-index --code-parser tree-sitter` |
91
92
  | 캐시 호환성 진단 | "Project Librarian 코드 근거 캐시 상태와 호환성을 진단해줘." | `--code-index-health` |
92
93
  | 캐시 상태 확인 | "Project Librarian 코드 근거 상태를 보여줘." | `--code-status` |
@@ -98,7 +99,7 @@ npx project-librarian@latest install --scope project --agents all
98
99
  | 심볼 검색 | "`Auth` 심볼을 Project Librarian 코드 근거에서 찾아줘." | `--code-search-symbol Auth` |
99
100
  | 보수적 읽기 전용 SQL | "파일 경로를 위한 읽기 전용 Project Librarian 코드 근거 쿼리를 실행해줘." | `--code-query "select path from files order by path"` |
100
101
 
101
- 한 번에 하나의 코드 근거 모드만 실행할 수 있습니다. `--incremental`, `--code-index-full`, `--code-parser`는 `--code-index`와 함께 사용할 때만 유효합니다.
102
+ 한 번에 하나의 코드 근거 모드만 실행할 수 있습니다. `--incremental`, `--code-index-full`, `--code-index-migrate`, `--code-parser`는 `--code-index`와 함께 사용할 때만 유효합니다. `--code-index-migrate`는 기존 폐기형 인덱스의 스키마 버전이 현재 패키지와 다를 때 교체를 승인한다는 명시적 표시입니다.
102
103
 
103
104
  ## 설치되는 파일
104
105
 
package/docs/usage.md CHANGED
@@ -16,7 +16,7 @@ Install into the current repository instead:
16
16
  npx project-librarian@latest install --scope project --agents all
17
17
  ```
18
18
 
19
- `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.
19
+ `install` copies reusable skill files and required local-runner runtime dependencies. 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.
20
20
 
21
21
  | Situation | Command |
22
22
  | --- | --- |
@@ -32,7 +32,7 @@ npx project-librarian@latest install --scope project --agents all
32
32
 
33
33
  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.
34
34
 
35
- `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.
35
+ `project-librarian update` also syncs any project-scoped Project Librarian skill installs that already exist for the selected surfaces from the currently running package, including the runtime dependencies needed by the project-local runner. 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.
36
36
 
37
37
  ## Runner Paths
38
38
 
@@ -85,6 +85,7 @@ Code evidence:
85
85
  | Build multiple scopes | "Build Project Librarian code evidence for `src` and `packages/api`." | `--code-index --code-scope src --code-scope packages/api` |
86
86
  | Require incremental update | "Update the Project Librarian code evidence index incrementally." | `--code-index --incremental` |
87
87
  | Force a full rebuild | "Fully rebuild the Project Librarian code evidence index." | `--code-index --code-index-full` |
88
+ | Approve a schema migration | "Migrate the Project Librarian code evidence index schema." | `--code-index --code-index-migrate` |
88
89
  | Use optional Tree-sitter backend | "Build Project Librarian code evidence with the Tree-sitter parser." | `--code-index --code-parser tree-sitter` |
89
90
  | Inspect cache compatibility | "Inspect Project Librarian code evidence cache health." | `--code-index-health` |
90
91
  | Show cache status | "Show Project Librarian code evidence status." | `--code-status` |
@@ -96,7 +97,7 @@ Code evidence:
96
97
  | Search indexed symbols | "Search Project Librarian code evidence for symbol `Auth`." | `--code-search-symbol Auth` |
97
98
  | 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"` |
98
99
 
99
- Only one code evidence mode can run at a time. `--incremental`, `--code-index-full`, and `--code-parser` are valid only with `--code-index`.
100
+ Only one code evidence mode can run at a time. `--incremental`, `--code-index-full`, `--code-index-migrate`, and `--code-parser` are valid only with `--code-index`. `--code-index-migrate` is explicit approval to replace an existing disposable index when its schema version differs from the current package.
100
101
 
101
102
  ## What Gets Installed
102
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-librarian",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "Create and maintain compact project context for humans and LLM coding agents.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",