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