@synkro-sh/cli 1.5.1 → 1.5.2
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 +35 -18
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -51,18 +51,6 @@ function detectAgents() {
|
|
|
51
51
|
version: claudeBinary ? getVersion("claude") : void 0
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
const codexBinary = which("codex");
|
|
55
|
-
const codexConfigDir = join(home, ".codex");
|
|
56
|
-
if (codexBinary || existsSync(codexConfigDir)) {
|
|
57
|
-
agents.push({
|
|
58
|
-
kind: "codex",
|
|
59
|
-
name: "Codex",
|
|
60
|
-
binaryPath: codexBinary,
|
|
61
|
-
configDir: codexConfigDir,
|
|
62
|
-
settingsPath: join(codexConfigDir, "config.toml"),
|
|
63
|
-
version: codexBinary ? getVersion("codex") : void 0
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
54
|
const cursorBinary = which("cursor");
|
|
67
55
|
const cursorConfigDir = join(home, ".cursor");
|
|
68
56
|
if (cursorBinary || existsSync(cursorConfigDir)) {
|
|
@@ -5645,6 +5633,30 @@ function parseArgs(argv) {
|
|
|
5645
5633
|
}
|
|
5646
5634
|
return opts;
|
|
5647
5635
|
}
|
|
5636
|
+
async function promptAgentSelection(detected) {
|
|
5637
|
+
if (detected.length <= 1) return detected;
|
|
5638
|
+
console.log("Multiple coding agents detected. Which ones do you want Synkro guardrails installed for?");
|
|
5639
|
+
detected.forEach((a, i) => console.log(` ${i + 1}. ${a.name}`));
|
|
5640
|
+
console.log(` ${detected.length + 1}. Both / all (default)`);
|
|
5641
|
+
const rl = createInterface3({ input: process.stdin, output: process.stdout });
|
|
5642
|
+
const ask2 = () => new Promise((resolve3) => {
|
|
5643
|
+
rl.question(`Pick [1-${detected.length + 1}] (default: all): `, (answer) => {
|
|
5644
|
+
const t = answer.trim().toLowerCase();
|
|
5645
|
+
if (t === "" || t === String(detected.length + 1) || t === "both" || t === "all") {
|
|
5646
|
+
rl.close();
|
|
5647
|
+
return resolve3(detected);
|
|
5648
|
+
}
|
|
5649
|
+
const n = parseInt(t, 10);
|
|
5650
|
+
if (Number.isInteger(n) && n >= 1 && n <= detected.length) {
|
|
5651
|
+
rl.close();
|
|
5652
|
+
return resolve3([detected[n - 1]]);
|
|
5653
|
+
}
|
|
5654
|
+
console.log("Invalid choice. Try again.");
|
|
5655
|
+
resolve3(ask2());
|
|
5656
|
+
});
|
|
5657
|
+
});
|
|
5658
|
+
return ask2();
|
|
5659
|
+
}
|
|
5648
5660
|
function ensureSynkroDir() {
|
|
5649
5661
|
mkdirSync8(SYNKRO_DIR4, { recursive: true });
|
|
5650
5662
|
mkdirSync8(HOOKS_DIR, { recursive: true });
|
|
@@ -5746,7 +5758,7 @@ function writeConfigEnv(opts) {
|
|
|
5746
5758
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
5747
5759
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
5748
5760
|
`SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
|
|
5749
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.5.
|
|
5761
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.5.2")}`
|
|
5750
5762
|
];
|
|
5751
5763
|
if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
|
|
5752
5764
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
@@ -5938,16 +5950,21 @@ async function installCommand(opts = {}) {
|
|
|
5938
5950
|
}
|
|
5939
5951
|
setApiBaseUrl(`${gatewayUrl}/api`);
|
|
5940
5952
|
await promptRepoConnection({ linkRepo: opts.linkRepo });
|
|
5941
|
-
const
|
|
5942
|
-
if (
|
|
5943
|
-
console.error("No
|
|
5953
|
+
const detected = detectAgents();
|
|
5954
|
+
if (detected.length === 0) {
|
|
5955
|
+
console.error("No supported coding agents detected. Install Claude Code or Cursor first.");
|
|
5944
5956
|
process.exit(1);
|
|
5945
5957
|
}
|
|
5946
5958
|
console.log("Detected agents:");
|
|
5947
|
-
for (const a of
|
|
5959
|
+
for (const a of detected) {
|
|
5948
5960
|
console.log(` \u2713 ${a.name}${a.version ? ` (${a.version})` : ""}`);
|
|
5949
5961
|
}
|
|
5950
5962
|
console.log();
|
|
5963
|
+
const agents = await promptAgentSelection(detected);
|
|
5964
|
+
if (agents.length < detected.length) {
|
|
5965
|
+
console.log(`Installing hooks for: ${agents.map((a) => a.name).join(", ")}
|
|
5966
|
+
`);
|
|
5967
|
+
}
|
|
5951
5968
|
ensureSynkroDir();
|
|
5952
5969
|
const scripts = writeHookScripts();
|
|
5953
5970
|
console.log("Wrote hook scripts:");
|
|
@@ -7131,7 +7148,7 @@ var args = process.argv.slice(2);
|
|
|
7131
7148
|
var cmd = args[0] || "";
|
|
7132
7149
|
var subArgs = args.slice(1);
|
|
7133
7150
|
function printVersion() {
|
|
7134
|
-
console.log("1.5.
|
|
7151
|
+
console.log("1.5.2");
|
|
7135
7152
|
}
|
|
7136
7153
|
function printHelp() {
|
|
7137
7154
|
console.log(`Synkro CLI \u2014 runtime safety for AI coding agents
|