@synkro-sh/cli 1.5.6 → 1.5.7

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
@@ -2804,7 +2804,7 @@ import {
2804
2804
  parseVerdict, dispatchCapture, dispatchFinding, ruleMode, postWithRetry, readStdin,
2805
2805
  extractTranscript, readLastPrompt, appendSessionAction, readSessionLog, compressSessionLog, log,
2806
2806
  outputJson, outputEmpty, setupCursorHookSignals, isShellTool, hookSessionId, GATEWAY_URL,
2807
- logGraderUnavailable,
2807
+ logGraderUnavailable, isPathUnder,
2808
2808
  type HookConfig, type Rule,
2809
2809
  } from './_synkro-common.ts';
2810
2810
 
@@ -2849,6 +2849,24 @@ async function main() {
2849
2849
  const cmdShort = command.slice(0, 80);
2850
2850
  log('bashGuard checking: ' + cmdShort);
2851
2851
 
2852
+ // Load JWT + routing config eagerly so even the short-circuit message
2853
+ // carries the live pack name + local/cloud tag. Cost: ~200-500ms for the
2854
+ // config fetch (network call, no caching). The fetch is unavoidable for
2855
+ // the LLM path anyway — we just pay it sooner so the short-circuit can
2856
+ // produce a properly-tagged system message.
2857
+ let jwt = loadJwt();
2858
+ if (!jwt) { outputEmpty(); return; }
2859
+ jwt = await ensureFreshJwt(jwt);
2860
+
2861
+ const config = await loadConfig(jwt);
2862
+ const rt = await route(config);
2863
+ const tagStr = tag(rt, config);
2864
+
2865
+ if (config.silent) {
2866
+ outputJson({ systemMessage: tagStr + ' bashGuard → skipped (silent mode)' });
2867
+ return;
2868
+ }
2869
+
2852
2870
  // ─── Hook-side short-circuit for safe in-repo reads ───
2853
2871
  // The judge primer already deterministically allows these, but the round
2854
2872
  // trip + batch queue still costs 1–25s per call. Skipping the grade for
@@ -2953,14 +2971,16 @@ async function main() {
2953
2971
 
2954
2972
  if (isSafeInRepoRead(toolName, command, cwd)) {
2955
2973
  log('bashGuard ' + cmdShort + ' → instant allow (safe in-repo read)');
2956
- outputJson({ hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: 'Synkro: safe in-repo read, deterministic allow.' } });
2974
+ outputJson({
2975
+ systemMessage: tagStr + ' bashGuard → pass: safe in-repo read',
2976
+ hookSpecificOutput: {
2977
+ hookEventName: 'PreToolUse',
2978
+ additionalContext: tagStr + ' bashGuard pass: safe in-repo read.',
2979
+ },
2980
+ });
2957
2981
  return;
2958
2982
  }
2959
2983
 
2960
- let jwt = loadJwt();
2961
- if (!jwt) { outputEmpty(); return; }
2962
- jwt = await ensureFreshJwt(jwt);
2963
-
2964
2984
  // ─── Install protection: server-side pkg-scan (CVE + typosquat + tarball + reputation) ───
2965
2985
  let installScanMsg = '';
2966
2986
  if (toolName === 'Bash') {
@@ -3069,15 +3089,9 @@ async function main() {
3069
3089
 
3070
3090
  const lastPrompt = readLastPrompt(sessionId);
3071
3091
 
3072
- const config = await loadConfig(jwt);
3073
- const rt = await route(config);
3074
- const tagStr = tag(rt, config);
3075
-
3076
- if (config.silent) {
3077
- const msg = (installScanMsg ? installScanMsg + '\\n' : '') + tagStr + ' bashGuard → skipped (silent mode)';
3078
- outputJson({ systemMessage: msg, hookSpecificOutput: { hookEventName: 'PreToolUse', additionalContext: msg } });
3079
- return;
3080
- }
3092
+ // jwt + config + rt + tagStr already loaded eagerly at top of main
3093
+ // (so the short-circuit could emit a properly-tagged message). Silent
3094
+ // mode was also checked up there.
3081
3095
 
3082
3096
  if (rt === 'local') {
3083
3097
  const sessionLog = compressSessionLog(readSessionLog(sessionId));
@@ -5907,7 +5921,7 @@ function writeConfigEnv(opts) {
5907
5921
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
5908
5922
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
5909
5923
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
5910
- `SYNKRO_VERSION=${shellQuoteSingle("1.5.6")}`
5924
+ `SYNKRO_VERSION=${shellQuoteSingle("1.5.7")}`
5911
5925
  ];
5912
5926
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
5913
5927
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
@@ -7297,7 +7311,7 @@ var args = process.argv.slice(2);
7297
7311
  var cmd = args[0] || "";
7298
7312
  var subArgs = args.slice(1);
7299
7313
  function printVersion() {
7300
- console.log("1.5.6");
7314
+ console.log("1.5.7");
7301
7315
  }
7302
7316
  function printHelp() {
7303
7317
  console.log(`Synkro CLI \u2014 runtime safety for AI coding agents