@coderule/mcp 2.0.0 → 2.0.1
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/dist/mcp-cli.cjs +41 -1
- package/dist/mcp-cli.cjs.map +1 -1
- package/dist/mcp-cli.js +41 -1
- package/dist/mcp-cli.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp-cli.cjs
CHANGED
|
@@ -1441,6 +1441,21 @@ async function runInitialSyncPipeline(runtime, options) {
|
|
|
1441
1441
|
hashLogger.debug("Hasher processed batch");
|
|
1442
1442
|
}
|
|
1443
1443
|
}
|
|
1444
|
+
if (options?.blockUntilReady !== false) {
|
|
1445
|
+
const syncLogger = runtime.logger.child({ scope: "snapshot" });
|
|
1446
|
+
const result = await publishSnapshot(
|
|
1447
|
+
runtime.config.rootPath,
|
|
1448
|
+
runtime.filesRepo,
|
|
1449
|
+
runtime.snapshotsRepo,
|
|
1450
|
+
runtime.clients.sync,
|
|
1451
|
+
syncLogger,
|
|
1452
|
+
{
|
|
1453
|
+
maxAttempts: runtime.config.maxSnapshotAttempts,
|
|
1454
|
+
uploadChunkSize: runtime.config.uploadChunkSize
|
|
1455
|
+
}
|
|
1456
|
+
);
|
|
1457
|
+
return result;
|
|
1458
|
+
}
|
|
1444
1459
|
const computation = computeSnapshot(runtime.filesRepo);
|
|
1445
1460
|
const createdAt = Date.now();
|
|
1446
1461
|
runtime.snapshotsRepo.insert(
|
|
@@ -2266,6 +2281,9 @@ function printUsage() {
|
|
|
2266
2281
|
console.log(
|
|
2267
2282
|
" --clean, --reindex Remove existing local state before running"
|
|
2268
2283
|
);
|
|
2284
|
+
console.log(
|
|
2285
|
+
" --exit Exit after reindex (use with --reindex)"
|
|
2286
|
+
);
|
|
2269
2287
|
console.log(
|
|
2270
2288
|
" --inline-hasher Force inline hashing (debug only)"
|
|
2271
2289
|
);
|
|
@@ -2313,6 +2331,7 @@ function parseArgs(argv) {
|
|
|
2313
2331
|
let token = process.env.CODERULE_TOKEN;
|
|
2314
2332
|
let rootPath;
|
|
2315
2333
|
let clean = false;
|
|
2334
|
+
let exit = false;
|
|
2316
2335
|
let inlineHasher = false;
|
|
2317
2336
|
const env = {};
|
|
2318
2337
|
const args = [...argv];
|
|
@@ -2326,6 +2345,10 @@ function parseArgs(argv) {
|
|
|
2326
2345
|
clean = true;
|
|
2327
2346
|
continue;
|
|
2328
2347
|
}
|
|
2348
|
+
if (arg === "--exit") {
|
|
2349
|
+
exit = true;
|
|
2350
|
+
continue;
|
|
2351
|
+
}
|
|
2329
2352
|
if (arg === "--inline-hasher") {
|
|
2330
2353
|
inlineHasher = true;
|
|
2331
2354
|
continue;
|
|
@@ -2382,7 +2405,7 @@ function parseArgs(argv) {
|
|
|
2382
2405
|
"Missing token. Provide via argument or CODERULE_TOKEN environment variable."
|
|
2383
2406
|
);
|
|
2384
2407
|
}
|
|
2385
|
-
return { token, rootPath, clean, inlineHasher, env };
|
|
2408
|
+
return { token, rootPath, clean, exit, inlineHasher, env };
|
|
2386
2409
|
}
|
|
2387
2410
|
async function ensureClean(configToken, rootPath) {
|
|
2388
2411
|
const config = await resolveConfig({ token: configToken, rootPath });
|
|
@@ -2435,6 +2458,23 @@ async function main() {
|
|
|
2435
2458
|
rootPath: options.rootPath
|
|
2436
2459
|
});
|
|
2437
2460
|
const runner = new ServiceRunner(runtime);
|
|
2461
|
+
if (options.exit && options.clean) {
|
|
2462
|
+
try {
|
|
2463
|
+
const initial = await runInitialSyncPipeline(runtime, {
|
|
2464
|
+
blockUntilReady: true
|
|
2465
|
+
});
|
|
2466
|
+
runtime.logger.info(
|
|
2467
|
+
{
|
|
2468
|
+
snapshotHash: initial.snapshotHash,
|
|
2469
|
+
filesCount: initial.filesCount
|
|
2470
|
+
},
|
|
2471
|
+
"Reindex completed; exiting"
|
|
2472
|
+
);
|
|
2473
|
+
} finally {
|
|
2474
|
+
await runner.stop();
|
|
2475
|
+
}
|
|
2476
|
+
return;
|
|
2477
|
+
}
|
|
2438
2478
|
try {
|
|
2439
2479
|
await runner.prepareWatcher(true);
|
|
2440
2480
|
const server = createMcpServer({ runtime, runner });
|