@synkro-sh/cli 1.4.51 → 1.4.53

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
@@ -997,17 +997,13 @@ export function detectRepo(cwd: string): string {
997
997
  // \u2500\u2500\u2500 Channel Health \u2500\u2500\u2500
998
998
 
999
999
  export async function channelUp(port = 8929): Promise<boolean> {
1000
- try {
1001
- await fetch('http://127.0.0.1:' + port, { signal: AbortSignal.timeout(500) });
1002
- return true;
1003
- } catch (e: any) {
1004
- // If we got a connection error vs a response error, check:
1005
- // fetch throws TypeError for connection refused, but any HTTP response means the port is open
1006
- if (e?.name === 'TimeoutError') return false;
1007
- if (e?.cause?.code === 'ECONNREFUSED' || e?.code === 'ECONNREFUSED') return false;
1008
- // Any other error (like bad response) means the port is actually open
1009
- return true;
1010
- }
1000
+ return new Promise(resolve => {
1001
+ const sock = require('node:net').connect(port, '127.0.0.1');
1002
+ const done = (ok: boolean) => { try { sock.destroy(); } catch {} resolve(ok); };
1003
+ sock.once('connect', () => done(true));
1004
+ sock.once('error', () => done(false));
1005
+ sock.setTimeout(500, () => done(false));
1006
+ });
1011
1007
  }
1012
1008
 
1013
1009
  export async function cweChannelUp(): Promise<boolean> {
@@ -1137,8 +1133,7 @@ export async function localGrade(surface: string, prompt: string): Promise<strin
1137
1133
  }
1138
1134
 
1139
1135
  export async function localGradeCwe(prompt: string): Promise<string> {
1140
- if (!(await cweChannelUp())) throw new Error('SYNKRO_CHANNEL_DOWN');
1141
- return spawnGrade('cwe', prompt, { SYNKRO_CHANNEL_PORT: '8930' }, 12000);
1136
+ return spawnGrade('cwe', prompt, { SYNKRO_CHANNEL_PORT: '8930' }, 22000);
1142
1137
  }
1143
1138
 
1144
1139
  // \u2500\u2500\u2500 Verdict Parsing \u2500\u2500\u2500
@@ -1876,8 +1871,9 @@ async function main() {
1876
1871
  let gradeResp: string;
1877
1872
  try {
1878
1873
  gradeResp = await localGradeCwe(graderPrompt);
1879
- } catch {
1880
- outputJson({ systemMessage: cweTag + ' ' + fileShort + ' \\u2192 grader unavailable, skipped' });
1874
+ } catch (gradeErr: any) {
1875
+ const reason = gradeErr?.message || String(gradeErr);
1876
+ outputJson({ systemMessage: cweTag + ' ' + fileShort + ' \\u2192 grader unavailable (' + reason + '), skipped' });
1881
1877
  return;
1882
1878
  }
1883
1879
 
@@ -5049,7 +5045,7 @@ function writeConfigEnv(opts) {
5049
5045
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
5050
5046
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
5051
5047
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
5052
- `SYNKRO_VERSION=${shellQuoteSingle("1.4.51")}`
5048
+ `SYNKRO_VERSION=${shellQuoteSingle("1.4.53")}`
5053
5049
  ];
5054
5050
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
5055
5051
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
@@ -5909,7 +5905,8 @@ async function statusCommand() {
5909
5905
  const config = readConfigEnv();
5910
5906
  const gatewayUrl = (config.SYNKRO_GATEWAY_URL || "https://api.synkro.sh").replace(/^['"]|['"]$/g, "");
5911
5907
  let serverTier = config.SYNKRO_TIER || "(unset)";
5912
- let serverInference = config.SYNKRO_INFERENCE || "fast";
5908
+ let serverInference = config.SYNKRO_INFERENCE || "(unset)";
5909
+ let localInference = false;
5913
5910
  await ensureValidToken();
5914
5911
  const token = getAccessToken();
5915
5912
  if (token) {
@@ -5921,6 +5918,7 @@ async function statusCommand() {
5921
5918
  if (resp.ok) {
5922
5919
  const data = await resp.json();
5923
5920
  serverInference = data.fast_inference ? "fast" : "standard";
5921
+ localInference = !!data.local_inference;
5924
5922
  serverTier = data.plan_tier ?? data.tier ?? serverTier;
5925
5923
  }
5926
5924
  } catch {
@@ -5930,7 +5928,7 @@ async function statusCommand() {
5930
5928
  console.log(` gateway: ${gatewayUrl}`);
5931
5929
  console.log(` credentials: ${config.SYNKRO_CREDENTIALS_PATH ?? "(unset)"}`);
5932
5930
  console.log(` tier: ${serverTier}`);
5933
- const inferenceLabel = serverInference === "fast" ? "'fast' (server-side grading)" : "'standard' (local grading)";
5931
+ const inferenceLabel = localInference ? "'local' (grading via Claude Code channels)" : "'server' (grading via provider keys)";
5934
5932
  console.log(` inference: ${inferenceLabel}`);
5935
5933
  console.log(` version: ${config.SYNKRO_VERSION ?? "(unset)"}`);
5936
5934
  console.log();
@@ -5946,10 +5944,10 @@ async function statusCommand() {
5946
5944
  const hooks = inspectCCHooks(a.settingsPath);
5947
5945
  console.log(` hooks installed: ${hooks.installed ? "\u2713" : "\u2717"}`);
5948
5946
  if (hooks.installed) {
5949
- console.log(` \u2022 PreToolUse Bash: ${hooks.preToolUseBash ? "\u2713" : "\u2717"}`);
5950
- console.log(` \u2022 PostToolUse Edit: ${hooks.postToolUseEdit ? "\u2713" : "\u2717"}`);
5951
- console.log(` \u2022 SessionEnd summary: ${hooks.sessionEnd ? "\u2713" : "\u2717"}`);
5952
- console.log(` \u2022 SessionStart: ${hooks.sessionStart ? "\u2713" : "\u2717"}`);
5947
+ console.log(` \u2022 PreToolUse Bash: ${hooks.preToolUseBash ? "\u2713" : "\u2717"}`);
5948
+ console.log(` \u2022 PreToolUse Edit: ${hooks.postToolUseEdit ? "\u2713" : "\u2717"}`);
5949
+ console.log(` \u2022 SessionEnd summary: ${hooks.sessionEnd ? "\u2713" : "\u2717"}`);
5950
+ console.log(` \u2022 SessionStart: ${hooks.sessionStart ? "\u2713" : "\u2717"}`);
5953
5951
  }
5954
5952
  } else if (a.kind === "cursor") {
5955
5953
  const hooks = inspectCursorHooks(a.settingsPath);
@@ -5964,30 +5962,57 @@ async function statusCommand() {
5964
5962
  }
5965
5963
  }
5966
5964
  console.log();
5967
- const bashScript = join12(SYNKRO_DIR3, "hooks", "cc-bash-judge.sh");
5968
- const bashFollowupScript = join12(SYNKRO_DIR3, "hooks", "cc-bash-followup.sh");
5969
- const editPrecheckScript = join12(SYNKRO_DIR3, "hooks", "cc-edit-precheck.sh");
5970
- const editCaptureScript = join12(SYNKRO_DIR3, "hooks", "cc-edit-capture.sh");
5971
- const stopSummaryScript = join12(SYNKRO_DIR3, "hooks", "cc-stop-summary.sh");
5972
- const sessionStartScript = join12(SYNKRO_DIR3, "hooks", "cc-session-start.sh");
5973
- const cursorBashJudgeScript = join12(SYNKRO_DIR3, "hooks", "cursor-bash-judge.sh");
5974
- const cursorEditPrecheckScript = join12(SYNKRO_DIR3, "hooks", "cursor-edit-precheck.sh");
5975
- const cursorEditCaptureScript = join12(SYNKRO_DIR3, "hooks", "cursor-edit-capture.sh");
5976
- const cursorBashFollowupScript = join12(SYNKRO_DIR3, "hooks", "cursor-bash-followup.sh");
5977
- const commonScript = join12(SYNKRO_DIR3, "hooks", "_synkro-common.sh");
5978
- console.log("Hook scripts:");
5979
- console.log(` ${existsSync12(bashScript) ? "\u2713" : "\u2717"} ${bashScript}`);
5980
- console.log(` ${existsSync12(bashFollowupScript) ? "\u2713" : "\u2717"} ${bashFollowupScript}`);
5981
- console.log(` ${existsSync12(editPrecheckScript) ? "\u2713" : "\u2717"} ${editPrecheckScript}`);
5982
- console.log(` ${existsSync12(editCaptureScript) ? "\u2713" : "\u2717"} ${editCaptureScript}`);
5983
- console.log(` ${existsSync12(stopSummaryScript) ? "\u2713" : "\u2717"} ${stopSummaryScript}`);
5984
- console.log(` ${existsSync12(sessionStartScript) ? "\u2713" : "\u2717"} ${sessionStartScript}`);
5985
- console.log(` ${existsSync12(commonScript) ? "\u2713" : "\u2717"} ${commonScript}`);
5986
- console.log(` ${existsSync12(cursorBashJudgeScript) ? "\u2713" : "\u2717"} ${cursorBashJudgeScript}`);
5987
- console.log(` ${existsSync12(cursorEditPrecheckScript) ? "\u2713" : "\u2717"} ${cursorEditPrecheckScript}`);
5988
- console.log(` ${existsSync12(cursorEditCaptureScript) ? "\u2713" : "\u2717"} ${cursorEditCaptureScript}`);
5989
- console.log(` ${existsSync12(cursorBashFollowupScript) ? "\u2713" : "\u2717"} ${cursorBashFollowupScript}`);
5965
+ const HOOKS_DIR2 = join12(SYNKRO_DIR3, "hooks");
5966
+ const ccHooks = [
5967
+ "cc-bash-judge.ts",
5968
+ "cc-bash-followup.ts",
5969
+ "cc-edit-precheck.ts",
5970
+ "cc-cwe-precheck.ts",
5971
+ "cc-cve-precheck.ts",
5972
+ "cc-plan-judge.ts",
5973
+ "cc-stop-summary.ts",
5974
+ "cc-session-start.ts",
5975
+ "cc-transcript-sync.ts",
5976
+ "cc-user-prompt-submit.ts",
5977
+ "_synkro-common.ts"
5978
+ ];
5979
+ const cursorHooks = [
5980
+ "cursor-bash-judge.sh",
5981
+ "cursor-edit-precheck.sh",
5982
+ "cursor-bash-followup.sh",
5983
+ "_synkro-common.sh"
5984
+ ];
5985
+ console.log("Hook scripts (Claude Code):");
5986
+ for (const f of ccHooks) {
5987
+ const p = join12(HOOKS_DIR2, f);
5988
+ console.log(` ${existsSync12(p) ? "\u2713" : "\u2717"} ${p}`);
5989
+ }
5990
+ console.log("Hook scripts (Cursor):");
5991
+ for (const f of cursorHooks) {
5992
+ const p = join12(HOOKS_DIR2, f);
5993
+ console.log(` ${existsSync12(p) ? "\u2713" : "\u2717"} ${p}`);
5994
+ }
5990
5995
  console.log();
5996
+ if (localInference) {
5997
+ console.log("Local-CC channels:");
5998
+ try {
5999
+ const t1 = findTask(CHANNEL_PRIMARY);
6000
+ if (t1) {
6001
+ console.log(` Channel 1 (org rules): pueue id=${t1.id} status=${t1.status}`);
6002
+ } else {
6003
+ console.log(" Channel 1 (org rules): not running");
6004
+ }
6005
+ const t2 = findTask(CHANNEL_SECONDARY);
6006
+ if (t2) {
6007
+ console.log(` Channel 2 (CWE scan): pueue id=${t2.id} status=${t2.status}`);
6008
+ } else {
6009
+ console.log(" Channel 2 (CWE scan): not running");
6010
+ }
6011
+ } catch {
6012
+ console.log(" (pueue not available)");
6013
+ }
6014
+ console.log();
6015
+ }
5991
6016
  const mcp = inspectMcpConfig();
5992
6017
  console.log("Guardrails MCP server (Claude Code):");
5993
6018
  if (mcp.installed) {
@@ -6007,6 +6032,7 @@ var init_status = __esm({
6007
6032
  init_ccHookConfig();
6008
6033
  init_cursorHookConfig();
6009
6034
  init_mcpConfig();
6035
+ init_pueue();
6010
6036
  SYNKRO_DIR3 = join12(homedir11(), ".synkro");
6011
6037
  CONFIG_PATH4 = join12(SYNKRO_DIR3, "config.env");
6012
6038
  }
@@ -6945,11 +6971,14 @@ import { join as join15 } from "path";
6945
6971
  function tearDownLocalCC() {
6946
6972
  let hadTask = false;
6947
6973
  try {
6948
- hadTask = !!findTask();
6974
+ const t1 = findTask();
6975
+ const t2 = findTask(CHANNEL_SECONDARY);
6976
+ hadTask = !!(t1 || t2);
6949
6977
  stopTask();
6978
+ stopTask(CHANNEL_SECONDARY);
6950
6979
  } catch {
6951
6980
  }
6952
- console.log(`${hadTask ? "\u2713" : "\xB7"} local-cc runtime: ${hadTask ? "stopped pueue task + tmux session" : "no live task"}`);
6981
+ console.log(`${hadTask ? "\u2713" : "\xB7"} local-cc runtime: ${hadTask ? "stopped both channels" : "no live tasks"}`);
6953
6982
  uninstallLocalCC();
6954
6983
  console.log("\u2713 local-cc config: cleaned ~/.claude.json entries");
6955
6984
  }