@synkro-sh/cli 1.7.3 → 1.7.5

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
@@ -1426,7 +1426,7 @@ export function effectiveGraderPool(synkroFile: SynkroFileConfig, hookAgentKind:
1426
1426
  // Falls back to synkro.toml whenever the server pool is absent, so a missing
1427
1427
  // value never breaks grading \u2014 it just reverts to today's behavior.
1428
1428
  const managed = process.env.SYNKRO_DEPLOY_LOCATION === 'cloud'
1429
- || (process.env.SYNKRO_GRADING_MODE || synkroFile.grader?.mode || config?.gradingMode) === 'byok';
1429
+ || (process.env.SYNKRO_GRADING_MODE || config?.gradingMode || synkroFile.grader?.mode) === 'byok';
1430
1430
  const pool = (managed && config?.graderPool)
1431
1431
  ? normalizePoolToken(config.graderPool)
1432
1432
  : normalizePoolToken(synkroFile.grader.pool);
@@ -1632,7 +1632,7 @@ export async function loadConfig(jwt: string, query?: string): Promise<HookConfi
1632
1632
  // \u2500\u2500\u2500 Routing \u2500\u2500\u2500
1633
1633
 
1634
1634
  export async function route(config: HookConfig, synkroFile?: SynkroFileConfig): Promise<'local' | 'cloud'> {
1635
- const gradingMode = synkroFile?.grader?.mode || process.env.SYNKRO_GRADING_MODE || config.gradingMode || 'local';
1635
+ const gradingMode = process.env.SYNKRO_GRADING_MODE || config.gradingMode || synkroFile?.grader?.mode || 'local';
1636
1636
  if (gradingMode === 'byok') return 'cloud';
1637
1637
  // Cloud-container deploy ([grader] location = cloud): grade via localGrade(),
1638
1638
  // which routes to the hosted container (containers.synkro.sh) and emits the
@@ -1653,7 +1653,7 @@ export async function route(config: HookConfig, synkroFile?: SynkroFileConfig):
1653
1653
  }
1654
1654
 
1655
1655
  export async function cweRoute(config: HookConfig, synkroFile?: SynkroFileConfig): Promise<'local' | 'byok' | 'skip'> {
1656
- const gradingMode = synkroFile?.grader?.mode || process.env.SYNKRO_GRADING_MODE || config.gradingMode || 'local';
1656
+ const gradingMode = process.env.SYNKRO_GRADING_MODE || config.gradingMode || synkroFile?.grader?.mode || 'local';
1657
1657
  if (gradingMode === 'byok') return 'byok';
1658
1658
  // Cloud-container: CWE scanning runs on the hosted container via localGradeCwe()
1659
1659
  // (which honors SYNKRO_DEPLOY_LOCATION). Without this, cweChannelUp() is false in
@@ -5487,10 +5487,10 @@ async function main() {
5487
5487
  const id = m.replace(/<\/?rule_id>/g, '').trim().replace(/^cwe-/, 'CWE-');
5488
5488
  if (id && !cweIds.includes(id)) cweIds.push(id);
5489
5489
  }
5490
- const fMatches = gradeResp.match(/<suggested_fix>([^<]+)<\/suggested_fix>/g) || [];
5490
+ const fMatches = gradeResp.match(/<(?:suggested_fix|required_fix)>([\s\S]*?)<\/(?:suggested_fix|required_fix)>/g) || [];
5491
5491
  const respIds = ruleIdMatches.map(rm => rm.replace(/<\/?rule_id>/g, '').trim().replace(/^cwe-/, 'CWE-'));
5492
5492
  for (let i = 0; i < Math.min(respIds.length, fMatches.length); i++) {
5493
- if (!fixes[respIds[i]]) fixes[respIds[i]] = fMatches[i].replace(/<\/?suggested_fix>/g, '').trim();
5493
+ if (!fixes[respIds[i]]) fixes[respIds[i]] = fMatches[i].replace(/<\/?(?:suggested_fix|required_fix)>/g, '').trim();
5494
5494
  }
5495
5495
  // Per-<violation> pass for the verbatim snippet (code may contain '<'),
5496
5496
  // paired with its rule_id so each finding carries its own offending code.
@@ -5540,9 +5540,9 @@ async function main() {
5540
5540
  // Fix is dropped when it just restates the explanation so no line double-prints.
5541
5541
  const cweBlocks = activeCweIds.map(id => {
5542
5542
  const why = oneSentence(reasons[id] || verdict.reason || cweNameMap.get(id.toUpperCase()) || 'code weakness detected');
5543
- const fix = fixes[id] ? oneSentence(fixes[id]) : '';
5543
+ const fix = fixes[id] ? String(fixes[id]).replace(/[\x00-\x08\x0B-\x1F\x7F]/g, ' ').trim().slice(0, 1200) : '';
5544
5544
  const showFix = !!fix && !why.toLowerCase().includes(fix.slice(0, 40).toLowerCase());
5545
- return '[' + id + '] ' + why + (showFix ? ' Fix: ' + fix : '');
5545
+ return '[' + id + '] ' + why + (showFix ? ' REQUIRED FIX (apply exactly — do not substitute a different library/format/approach): ' + fix : '');
5546
5546
  });
5547
5547
  // Bound the total: list as many CWEs as fit, spill the rest to a "+N more" note.
5548
5548
  let denyDetail = cweBlocks.join('\n');
@@ -5553,7 +5553,7 @@ async function main() {
5553
5553
  const more = cweBlocks.length - kept.length;
5554
5554
  denyDetail = kept.join('\n') + (more > 0 ? '\n(+' + more + ' more CWE weakness' + (more === 1 ? '' : 'es') + ' — fix these first, then re-run to surface the rest)' : '');
5555
5555
  }
5556
- const ctx = 'CWE weaknesses to fix (' + count + '):\n' + denyDetail + '\nFix ALL of the above before retrying. Do NOT ask the user to make the edit manually — resolve every weakness in code yourself.';
5556
+ const ctx = 'CWE weaknesses to fix (' + count + '):\n' + denyDetail + '\nThese are REQUIRED FIXES apply each one exactly as given; do NOT substitute your own approach or a different library/format. Do NOT ask the user to make the edit manually — resolve every weakness in code yourself.';
5557
5557
 
5558
5558
  emitBlockScanFindings(
5559
5559
  jwt,
@@ -11611,7 +11611,7 @@ function writeConfigEnv(opts) {
11611
11611
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
11612
11612
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
11613
11613
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
11614
- `SYNKRO_VERSION=${shellQuoteSingle("1.7.3")}`
11614
+ `SYNKRO_VERSION=${shellQuoteSingle("1.7.5")}`
11615
11615
  ];
11616
11616
  if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
11617
11617
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
@@ -15674,7 +15674,7 @@ var args = process.argv.slice(2);
15674
15674
  var cmd = args[0] || "";
15675
15675
  var subArgs = args.slice(1);
15676
15676
  function printVersion() {
15677
- console.log("1.7.3");
15677
+ console.log("1.7.5");
15678
15678
  }
15679
15679
  function printHelp2() {
15680
15680
  console.log(`Synkro CLI \u2014 runtime safety for AI coding agents