@coderule/mcp 1.6.0 → 1.6.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/cli.cjs CHANGED
@@ -1239,7 +1239,7 @@ async function publishSnapshot(rootPath, filesRepo, snapshotsRepo, syncClient, l
1239
1239
  }
1240
1240
 
1241
1241
  // src/service/InitialSync.ts
1242
- async function runInitialSyncPipeline(runtime) {
1242
+ async function runInitialSyncPipeline(runtime, options) {
1243
1243
  const inventoryLogger = runtime.logger.child({ scope: "inventory" });
1244
1244
  await runInventory({
1245
1245
  rootPath: runtime.config.rootPath,
@@ -1255,19 +1255,37 @@ async function runInitialSyncPipeline(runtime) {
1255
1255
  hashLogger.debug("Hasher processed batch");
1256
1256
  }
1257
1257
  }
1258
- const syncLogger = runtime.logger.child({ scope: "snapshot" });
1259
- const result = await publishSnapshot(
1260
- runtime.config.rootPath,
1261
- runtime.filesRepo,
1262
- runtime.snapshotsRepo,
1263
- runtime.clients.sync,
1264
- syncLogger,
1265
- {
1266
- maxAttempts: runtime.config.maxSnapshotAttempts,
1267
- uploadChunkSize: runtime.config.uploadChunkSize
1268
- }
1258
+ if (options?.blockUntilReady !== false) {
1259
+ const syncLogger = runtime.logger.child({ scope: "snapshot" });
1260
+ const result = await publishSnapshot(
1261
+ runtime.config.rootPath,
1262
+ runtime.filesRepo,
1263
+ runtime.snapshotsRepo,
1264
+ runtime.clients.sync,
1265
+ syncLogger,
1266
+ {
1267
+ maxAttempts: runtime.config.maxSnapshotAttempts,
1268
+ uploadChunkSize: runtime.config.uploadChunkSize
1269
+ }
1270
+ );
1271
+ return result;
1272
+ }
1273
+ const computation = computeSnapshot(runtime.filesRepo);
1274
+ const createdAt = Date.now();
1275
+ runtime.snapshotsRepo.insert(
1276
+ computation.snapshotHash,
1277
+ computation.filesCount,
1278
+ computation.totalSize,
1279
+ createdAt
1269
1280
  );
1270
- return result;
1281
+ runtime.outbox.enqueueSnapshot(runtime.config.rootId, 0);
1282
+ return {
1283
+ snapshotHash: computation.snapshotHash,
1284
+ filesCount: computation.filesCount,
1285
+ totalSize: computation.totalSize,
1286
+ status: "READY",
1287
+ createdAt
1288
+ };
1271
1289
  }
1272
1290
  async function createChokidarWatcher(options, usePolling) {
1273
1291
  const log = options.logger.child({
@@ -1731,7 +1749,9 @@ function awaitShutdownSignals() {
1731
1749
  async function runInitialSync(params) {
1732
1750
  const runtime = await bootstrap(params);
1733
1751
  try {
1734
- const result = await runInitialSyncPipeline(runtime);
1752
+ const result = await runInitialSyncPipeline(runtime, {
1753
+ blockUntilReady: true
1754
+ });
1735
1755
  runtime.logger.info(
1736
1756
  {
1737
1757
  snapshotHash: result.snapshotHash,
@@ -1755,7 +1775,9 @@ async function runService(params) {
1755
1775
  await runner.prepareWatcher(true);
1756
1776
  let initialCreatedAt;
1757
1777
  try {
1758
- const initial = await runInitialSyncPipeline(runtime);
1778
+ const initial = await runInitialSyncPipeline(runtime, {
1779
+ blockUntilReady: false
1780
+ });
1759
1781
  runtime.logger.info(
1760
1782
  {
1761
1783
  snapshotHash: initial.snapshotHash,