@synkro-sh/cli 1.6.37 → 1.6.39

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/bootstrap.js CHANGED
@@ -7100,7 +7100,8 @@ __export(dockerInstall_exports, {
7100
7100
  readContainerConfig: () => readContainerConfig,
7101
7101
  resolveWorkerConfig: () => resolveWorkerConfig,
7102
7102
  splitWorkers: () => splitWorkers,
7103
- waitForContainerReady: () => waitForContainerReady
7103
+ waitForContainerReady: () => waitForContainerReady,
7104
+ waitForWorkersReady: () => waitForWorkersReady
7104
7105
  });
7105
7106
  import { copyFileSync, existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync6, readdirSync as readdirSync2 } from "fs";
7106
7107
  import { homedir as homedir6 } from "os";
@@ -7427,6 +7428,22 @@ async function waitForContainerReady(timeoutMs = 6e4) {
7427
7428
  }
7428
7429
  return false;
7429
7430
  }
7431
+ async function waitForWorkersReady(timeoutMs = 6e4) {
7432
+ const start = Date.now();
7433
+ const url = `http://127.0.0.1:${HOST_GRADER_PORT}/healthz`;
7434
+ while (Date.now() - start < timeoutMs) {
7435
+ try {
7436
+ const r = await fetch(url, { signal: AbortSignal.timeout(2e3) });
7437
+ if (r.ok) {
7438
+ const data = await r.json();
7439
+ if ((data.healthy || 0) > 0) return true;
7440
+ }
7441
+ } catch {
7442
+ }
7443
+ await new Promise((r) => setTimeout(r, 1e3));
7444
+ }
7445
+ return false;
7446
+ }
7430
7447
  function dockerRemove() {
7431
7448
  spawnSync2("docker", ["rm", CONTAINER_NAME], { encoding: "utf-8", timeout: 3e4 });
7432
7449
  }
@@ -8244,7 +8261,7 @@ function writeConfigEnv(opts) {
8244
8261
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
8245
8262
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
8246
8263
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
8247
- `SYNKRO_VERSION=${shellQuoteSingle("1.6.37")}`
8264
+ `SYNKRO_VERSION=${shellQuoteSingle("1.6.39")}`
8248
8265
  ];
8249
8266
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
8250
8267
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
@@ -8704,7 +8721,13 @@ async function installCommand(opts = {}) {
8704
8721
  } catch {
8705
8722
  console.warn(" \u26A0 ingest endpoint unreachable \u2014 telemetry spool may not drain.");
8706
8723
  }
8707
- await syncSkillFiles();
8724
+ const workersUp = await waitForWorkersReady(3e4);
8725
+ if (workersUp) {
8726
+ console.log(" \u2713 workers ready");
8727
+ await syncSkillFiles();
8728
+ } else {
8729
+ console.warn(" \u26A0 workers did not register within 30s \u2014 skill sync skipped");
8730
+ }
8708
8731
  } else {
8709
8732
  console.error(" \u2717 container did not become healthy within 60s");
8710
8733
  console.error(" Run `docker logs synkro-server` to debug.");
@@ -9006,29 +9029,30 @@ async function syncSkillFiles() {
9006
9029
  const resolved = resolveSkillPaths(sf.skills, sf._repoRoot);
9007
9030
  if (resolved.length === 0) return;
9008
9031
  const mcpPort = process.env.SYNKRO_MCP_PORT || "18931";
9009
- for (const fp of resolved) {
9032
+ const tasks = resolved.map((fp) => {
9010
9033
  const content = readFileSync8(fp, "utf-8");
9011
- if (!content.trim()) continue;
9012
9034
  const source = `skill:${fp.split("/").pop()}`;
9013
- try {
9014
- const resp = await fetch(`http://127.0.0.1:${mcpPort}/api/local/skills/sync`, {
9015
- method: "POST",
9016
- headers: { "Content-Type": "application/json" },
9017
- body: JSON.stringify({ source, content }),
9018
- signal: AbortSignal.timeout(65e3)
9019
- });
9020
- if (resp.ok) {
9021
- const result = await resp.json();
9022
- if (result.created > 0) {
9023
- console.log(` \u2713 skill ${source}: ${result.created} new rules added`);
9024
- } else {
9025
- console.log(` \u2713 skill ${source}: ${result.message || "up to date"}`);
9026
- }
9027
- } else {
9028
- console.warn(` \u26A0 skill ${source}: sync failed (${resp.status})`);
9029
- }
9030
- } catch (e) {
9031
- console.warn(` \u26A0 skill ${source}: ${e.message}`);
9035
+ if (!content.trim()) return null;
9036
+ return { source, content };
9037
+ }).filter(Boolean);
9038
+ if (tasks.length === 0) return;
9039
+ const results = await Promise.allSettled(tasks.map(async ({ source, content }) => {
9040
+ const resp = await fetch(`http://127.0.0.1:${mcpPort}/api/local/skills/sync`, {
9041
+ method: "POST",
9042
+ headers: { "Content-Type": "application/json" },
9043
+ body: JSON.stringify({ source, content }),
9044
+ signal: AbortSignal.timeout(65e3)
9045
+ });
9046
+ if (!resp.ok) throw new Error(`${resp.status}`);
9047
+ const result = await resp.json();
9048
+ return { source, ...result };
9049
+ }));
9050
+ for (const r of results) {
9051
+ if (r.status === "fulfilled") {
9052
+ const { source, created, message } = r.value;
9053
+ console.log(created > 0 ? ` \u2713 skill ${source}: ${created} new rules added` : ` \u2713 skill ${source}: ${message || "up to date"}`);
9054
+ } else {
9055
+ console.warn(` \u26A0 skill sync failed: ${r.reason}`);
9032
9056
  }
9033
9057
  }
9034
9058
  }
@@ -10773,7 +10797,11 @@ async function cmdRestart(rest = []) {
10773
10797
  await dockerUpdate({ claudeWorkers, cursorWorkers });
10774
10798
  const ready = await waitForContainerReady(6e4);
10775
10799
  console.log(ready ? "\u2713 container ready" : "\u26A0 container did not pass /healthz within 60s");
10776
- if (ready) await syncSkillFiles();
10800
+ if (ready) {
10801
+ const workersUp = await waitForWorkersReady(3e4);
10802
+ console.log(workersUp ? "\u2713 workers ready" : "\u26A0 workers did not register within 30s");
10803
+ if (workersUp) await syncSkillFiles();
10804
+ }
10777
10805
  return;
10778
10806
  }
10779
10807
  stopTask(CHANNEL_PRIMARY);
@@ -11292,7 +11320,7 @@ var args = process.argv.slice(2);
11292
11320
  var cmd = args[0] || "";
11293
11321
  var subArgs = args.slice(1);
11294
11322
  function printVersion() {
11295
- console.log("1.6.37");
11323
+ console.log("1.6.39");
11296
11324
  }
11297
11325
  function printHelp2() {
11298
11326
  console.log(`Synkro CLI \u2014 runtime safety for AI coding agents