@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.js CHANGED
@@ -1224,7 +1224,7 @@ async function publishSnapshot(rootPath, filesRepo, snapshotsRepo, syncClient, l
1224
1224
  }
1225
1225
 
1226
1226
  // src/service/InitialSync.ts
1227
- async function runInitialSyncPipeline(runtime) {
1227
+ async function runInitialSyncPipeline(runtime, options) {
1228
1228
  const inventoryLogger = runtime.logger.child({ scope: "inventory" });
1229
1229
  await runInventory({
1230
1230
  rootPath: runtime.config.rootPath,
@@ -1240,19 +1240,37 @@ async function runInitialSyncPipeline(runtime) {
1240
1240
  hashLogger.debug("Hasher processed batch");
1241
1241
  }
1242
1242
  }
1243
- const syncLogger = runtime.logger.child({ scope: "snapshot" });
1244
- const result = await publishSnapshot(
1245
- runtime.config.rootPath,
1246
- runtime.filesRepo,
1247
- runtime.snapshotsRepo,
1248
- runtime.clients.sync,
1249
- syncLogger,
1250
- {
1251
- maxAttempts: runtime.config.maxSnapshotAttempts,
1252
- uploadChunkSize: runtime.config.uploadChunkSize
1253
- }
1243
+ if (options?.blockUntilReady !== false) {
1244
+ const syncLogger = runtime.logger.child({ scope: "snapshot" });
1245
+ const result = await publishSnapshot(
1246
+ runtime.config.rootPath,
1247
+ runtime.filesRepo,
1248
+ runtime.snapshotsRepo,
1249
+ runtime.clients.sync,
1250
+ syncLogger,
1251
+ {
1252
+ maxAttempts: runtime.config.maxSnapshotAttempts,
1253
+ uploadChunkSize: runtime.config.uploadChunkSize
1254
+ }
1255
+ );
1256
+ return result;
1257
+ }
1258
+ const computation = computeSnapshot(runtime.filesRepo);
1259
+ const createdAt = Date.now();
1260
+ runtime.snapshotsRepo.insert(
1261
+ computation.snapshotHash,
1262
+ computation.filesCount,
1263
+ computation.totalSize,
1264
+ createdAt
1254
1265
  );
1255
- return result;
1266
+ runtime.outbox.enqueueSnapshot(runtime.config.rootId, 0);
1267
+ return {
1268
+ snapshotHash: computation.snapshotHash,
1269
+ filesCount: computation.filesCount,
1270
+ totalSize: computation.totalSize,
1271
+ status: "READY",
1272
+ createdAt
1273
+ };
1256
1274
  }
1257
1275
  async function createChokidarWatcher(options, usePolling) {
1258
1276
  const log = options.logger.child({
@@ -1716,7 +1734,9 @@ function awaitShutdownSignals() {
1716
1734
  async function runInitialSync(params) {
1717
1735
  const runtime = await bootstrap(params);
1718
1736
  try {
1719
- const result = await runInitialSyncPipeline(runtime);
1737
+ const result = await runInitialSyncPipeline(runtime, {
1738
+ blockUntilReady: true
1739
+ });
1720
1740
  runtime.logger.info(
1721
1741
  {
1722
1742
  snapshotHash: result.snapshotHash,
@@ -1740,7 +1760,9 @@ async function runService(params) {
1740
1760
  await runner.prepareWatcher(true);
1741
1761
  let initialCreatedAt;
1742
1762
  try {
1743
- const initial = await runInitialSyncPipeline(runtime);
1763
+ const initial = await runInitialSyncPipeline(runtime, {
1764
+ blockUntilReady: false
1765
+ });
1744
1766
  runtime.logger.info(
1745
1767
  {
1746
1768
  snapshotHash: initial.snapshotHash,