@synkro-sh/cli 1.4.8 → 1.4.10
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 +83 -116
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -709,25 +709,12 @@ ensure_fresh_jwt() {
|
|
|
709
709
|
|
|
710
710
|
ensure_fresh_jwt
|
|
711
711
|
|
|
712
|
-
# Resolve tier
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
SYNKRO_CAPTURE_DEPTH=""
|
|
717
|
-
if find "$TIER_CACHE_FILE" -mmin -60 2>/dev/null | grep -q .; then
|
|
718
|
-
SYNKRO_INFERENCE_TIER=$(cat "$TIER_CACHE_FILE" 2>/dev/null)
|
|
719
|
-
fi
|
|
720
|
-
if [ -z "$SYNKRO_INFERENCE_TIER" ] || [ -z "$SYNKRO_CAPTURE_DEPTH" ]; then
|
|
721
|
-
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null || echo "")
|
|
722
|
-
if [ -n "$ME_RESP" ]; then
|
|
723
|
-
SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null)
|
|
724
|
-
[ -n "$SYNKRO_INFERENCE_TIER" ] && printf '%s' "$SYNKRO_INFERENCE_TIER" > "$TIER_CACHE_FILE" 2>/dev/null || true
|
|
725
|
-
SYNKRO_CAPTURE_DEPTH=$(echo "$ME_RESP" | jq -r '.capture_depth // empty' 2>/dev/null)
|
|
726
|
-
[ -n "$SYNKRO_CAPTURE_DEPTH" ] && printf '%s' "$SYNKRO_CAPTURE_DEPTH" > "$CD_CACHE_FILE" 2>/dev/null || true
|
|
727
|
-
fi
|
|
728
|
-
fi
|
|
712
|
+
# Resolve tier + capture_depth live from /cli/me every call. Default to local_only (fail-safe).
|
|
713
|
+
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 3 2>/dev/null || echo "")
|
|
714
|
+
SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null)
|
|
715
|
+
SYNKRO_CAPTURE_DEPTH=$(echo "$ME_RESP" | jq -r '.capture_depth // empty' 2>/dev/null)
|
|
729
716
|
SYNKRO_INFERENCE_TIER="\${SYNKRO_INFERENCE_TIER:-fast}"
|
|
730
|
-
SYNKRO_CAPTURE_DEPTH="\${SYNKRO_CAPTURE_DEPTH:-
|
|
717
|
+
SYNKRO_CAPTURE_DEPTH="\${SYNKRO_CAPTURE_DEPTH:-local_only}"
|
|
731
718
|
|
|
732
719
|
USE_LOCAL=false
|
|
733
720
|
if command -v claude >/dev/null 2>&1; then
|
|
@@ -1230,25 +1217,12 @@ ensure_fresh_jwt() {
|
|
|
1230
1217
|
ensure_fresh_jwt
|
|
1231
1218
|
|
|
1232
1219
|
|
|
1233
|
-
# Resolve tier
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
SYNKRO_CAPTURE_DEPTH=""
|
|
1238
|
-
if find "$TIER_CACHE_FILE" -mmin -60 2>/dev/null | grep -q .; then
|
|
1239
|
-
SYNKRO_INFERENCE_TIER=$(cat "$TIER_CACHE_FILE" 2>/dev/null)
|
|
1240
|
-
fi
|
|
1241
|
-
if [ -z "$SYNKRO_INFERENCE_TIER" ] || [ -z "$SYNKRO_CAPTURE_DEPTH" ]; then
|
|
1242
|
-
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null || echo "")
|
|
1243
|
-
if [ -n "$ME_RESP" ]; then
|
|
1244
|
-
SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null)
|
|
1245
|
-
[ -n "$SYNKRO_INFERENCE_TIER" ] && printf '%s' "$SYNKRO_INFERENCE_TIER" > "$TIER_CACHE_FILE" 2>/dev/null || true
|
|
1246
|
-
SYNKRO_CAPTURE_DEPTH=$(echo "$ME_RESP" | jq -r '.capture_depth // empty' 2>/dev/null)
|
|
1247
|
-
[ -n "$SYNKRO_CAPTURE_DEPTH" ] && printf '%s' "$SYNKRO_CAPTURE_DEPTH" > "$CD_CACHE_FILE" 2>/dev/null || true
|
|
1248
|
-
fi
|
|
1249
|
-
fi
|
|
1220
|
+
# Resolve tier + capture_depth live from /cli/me every call. Default to local_only (fail-safe).
|
|
1221
|
+
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 3 2>/dev/null || echo "")
|
|
1222
|
+
SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null)
|
|
1223
|
+
SYNKRO_CAPTURE_DEPTH=$(echo "$ME_RESP" | jq -r '.capture_depth // empty' 2>/dev/null)
|
|
1250
1224
|
SYNKRO_INFERENCE_TIER="\${SYNKRO_INFERENCE_TIER:-fast}"
|
|
1251
|
-
SYNKRO_CAPTURE_DEPTH="\${SYNKRO_CAPTURE_DEPTH:-
|
|
1225
|
+
SYNKRO_CAPTURE_DEPTH="\${SYNKRO_CAPTURE_DEPTH:-local_only}"
|
|
1252
1226
|
|
|
1253
1227
|
if synkro_channel_up || { [ "$SYNKRO_INFERENCE_TIER" = "free" ] && command -v claude >/dev/null 2>&1; }; then
|
|
1254
1228
|
# \u2500\u2500\u2500 LOCAL PATH: channel-grader first, then \`claude --print\` cold fallback. \u2500\u2500\u2500
|
|
@@ -1687,26 +1661,12 @@ if [ -n "$SESSION_ID" ] && [ -n "$TOOL_USE_ID" ]; then
|
|
|
1687
1661
|
) &
|
|
1688
1662
|
fi
|
|
1689
1663
|
|
|
1690
|
-
# Resolve tier + capture_depth
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
SYNKRO_CAPTURE_DEPTH=""
|
|
1695
|
-
if find "$TIER_CACHE_FILE" -mmin -60 2>/dev/null | grep -q .; then
|
|
1696
|
-
SYNKRO_INFERENCE_TIER=$(cat "$TIER_CACHE_FILE" 2>/dev/null || true)
|
|
1697
|
-
SYNKRO_CAPTURE_DEPTH=$(cat "$CD_CACHE_FILE" 2>/dev/null || true)
|
|
1698
|
-
fi
|
|
1699
|
-
if [ -z "$SYNKRO_INFERENCE_TIER" ] || [ -z "$SYNKRO_CAPTURE_DEPTH" ]; then
|
|
1700
|
-
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 2 2>/dev/null || echo "")
|
|
1701
|
-
if [ -n "$ME_RESP" ]; then
|
|
1702
|
-
SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null || true)
|
|
1703
|
-
[ -n "$SYNKRO_INFERENCE_TIER" ] && printf '%s' "$SYNKRO_INFERENCE_TIER" > "$TIER_CACHE_FILE" 2>/dev/null || true
|
|
1704
|
-
SYNKRO_CAPTURE_DEPTH=$(echo "$ME_RESP" | jq -r '.capture_depth // empty' 2>/dev/null || true)
|
|
1705
|
-
[ -n "$SYNKRO_CAPTURE_DEPTH" ] && printf '%s' "$SYNKRO_CAPTURE_DEPTH" > "$CD_CACHE_FILE" 2>/dev/null || true
|
|
1706
|
-
fi
|
|
1707
|
-
fi
|
|
1664
|
+
# Resolve tier + capture_depth live from /cli/me every call. Default to local_only (fail-safe).
|
|
1665
|
+
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 3 2>/dev/null || echo "")
|
|
1666
|
+
SYNKRO_INFERENCE_TIER=$(echo "$ME_RESP" | jq -r '.tier // empty' 2>/dev/null)
|
|
1667
|
+
SYNKRO_CAPTURE_DEPTH=$(echo "$ME_RESP" | jq -r '.capture_depth // empty' 2>/dev/null)
|
|
1708
1668
|
SYNKRO_INFERENCE_TIER="\${SYNKRO_INFERENCE_TIER:-fast}"
|
|
1709
|
-
SYNKRO_CAPTURE_DEPTH="\${SYNKRO_CAPTURE_DEPTH:-
|
|
1669
|
+
SYNKRO_CAPTURE_DEPTH="\${SYNKRO_CAPTURE_DEPTH:-local_only}"
|
|
1710
1670
|
|
|
1711
1671
|
if synkro_channel_up || { [ "$SYNKRO_INFERENCE_TIER" = "free" ] && command -v claude >/dev/null 2>&1; }; then
|
|
1712
1672
|
# \u2500\u2500\u2500 LOCAL PATH: channel-grader first, then \`claude --print\` cold fallback. \u2500\u2500\u2500
|
|
@@ -2191,14 +2151,15 @@ CREDS_PATH="\${SYNKRO_CREDENTIALS_PATH:-$HOME/.synkro/credentials.json}"
|
|
|
2191
2151
|
if [ ! -f "$CREDS_PATH" ]; then echo '{}'; exit 0; fi
|
|
2192
2152
|
if [ "\${SYNKRO_TRANSCRIPT_CONSENT:-yes}" = "no" ]; then echo '{}'; exit 0; fi
|
|
2193
2153
|
|
|
2194
|
-
# Hard-skip in local_only privacy mode \u2014 conversation content must never leave the device.
|
|
2195
|
-
CD_CACHE_FILE="$HOME/.synkro/.tier-cache-\${SYNKRO_USER_ID:-default}.cd"
|
|
2196
|
-
SYNKRO_CAPTURE_DEPTH=$(cat "$CD_CACHE_FILE" 2>/dev/null || echo "full")
|
|
2197
|
-
if [ "$SYNKRO_CAPTURE_DEPTH" = "local_only" ]; then echo '{}'; exit 0; fi
|
|
2198
|
-
|
|
2199
2154
|
JWT=$(jq -r '.access_token // empty' "$CREDS_PATH" 2>/dev/null)
|
|
2200
2155
|
if [ -z "$JWT" ]; then echo '{}'; exit 0; fi
|
|
2201
2156
|
|
|
2157
|
+
# Hard-skip in local_only privacy mode \u2014 conversation content must never leave the device.
|
|
2158
|
+
ME_RESP=$(curl -sS "\${GATEWAY_URL}/api/v1/cli/me" -H "Authorization: Bearer $JWT" --max-time 3 2>/dev/null || echo "")
|
|
2159
|
+
SYNKRO_CAPTURE_DEPTH=$(echo "$ME_RESP" | jq -r '.capture_depth // empty' 2>/dev/null)
|
|
2160
|
+
SYNKRO_CAPTURE_DEPTH="\${SYNKRO_CAPTURE_DEPTH:-local_only}"
|
|
2161
|
+
if [ "$SYNKRO_CAPTURE_DEPTH" = "local_only" ]; then echo '{}'; exit 0; fi
|
|
2162
|
+
|
|
2202
2163
|
PAYLOAD=$(cat)
|
|
2203
2164
|
SESSION_ID=$(echo "$PAYLOAD" | jq -r '.session_id // empty' 2>/dev/null)
|
|
2204
2165
|
TRANSCRIPT_PATH=$(echo "$PAYLOAD" | jq -r '.transcript_path // empty' 2>/dev/null)
|
|
@@ -4471,31 +4432,38 @@ var init_pueue = __esm({
|
|
|
4471
4432
|
});
|
|
4472
4433
|
|
|
4473
4434
|
// cli/local-cc/prompts.ts
|
|
4474
|
-
import {
|
|
4435
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
4475
4436
|
import { homedir as homedir9 } from "os";
|
|
4476
4437
|
import { join as join10 } from "path";
|
|
4477
|
-
function
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
throw new Error("Prompts cache not found. Run `synkro install` or `synkro update` first.");
|
|
4481
|
-
}
|
|
4438
|
+
async function fetchPrimers() {
|
|
4439
|
+
let jwt2 = "";
|
|
4440
|
+
let gatewayUrl = "";
|
|
4482
4441
|
try {
|
|
4483
|
-
|
|
4484
|
-
|
|
4442
|
+
const creds = JSON.parse(readFileSync9(CREDS_PATH, "utf-8"));
|
|
4443
|
+
jwt2 = creds.access_token || "";
|
|
4444
|
+
gatewayUrl = creds.gateway_url || "https://api.synkro.sh";
|
|
4485
4445
|
} catch {
|
|
4486
|
-
throw new Error("
|
|
4446
|
+
throw new Error("No credentials found. Run `synkro install` first.");
|
|
4487
4447
|
}
|
|
4448
|
+
if (!jwt2) throw new Error("No access token. Run `synkro install` first.");
|
|
4449
|
+
const resp = await fetch(`${gatewayUrl}/api/v1/cli/judge-prompts`, {
|
|
4450
|
+
headers: { Authorization: `Bearer ${jwt2}` },
|
|
4451
|
+
signal: AbortSignal.timeout(5e3)
|
|
4452
|
+
});
|
|
4453
|
+
if (!resp.ok) throw new Error(`Failed to fetch prompts: ${resp.status}`);
|
|
4454
|
+
return resp.json();
|
|
4488
4455
|
}
|
|
4489
|
-
function getPrimer(role) {
|
|
4490
|
-
const
|
|
4491
|
-
const primer = role === "grade-edit" ?
|
|
4456
|
+
async function getPrimer(role) {
|
|
4457
|
+
const prompts = await fetchPrimers();
|
|
4458
|
+
const primer = role === "grade-edit" ? prompts.grader_primer_edit : prompts.grader_primer_bash;
|
|
4492
4459
|
if (!primer) {
|
|
4493
|
-
throw new Error(`No
|
|
4460
|
+
throw new Error(`No primer for role "${role}" returned from API.`);
|
|
4494
4461
|
}
|
|
4495
4462
|
return primer;
|
|
4496
4463
|
}
|
|
4497
|
-
function buildChannelContent(role, payload) {
|
|
4498
|
-
|
|
4464
|
+
async function buildChannelContent(role, payload) {
|
|
4465
|
+
const primer = await getPrimer(role);
|
|
4466
|
+
return `${primer}
|
|
4499
4467
|
|
|
4500
4468
|
${CHANNEL_REPLY_INSTRUCTIONS}
|
|
4501
4469
|
|
|
@@ -4504,12 +4472,11 @@ PAYLOAD (the input to evaluate):
|
|
|
4504
4472
|
|
|
4505
4473
|
${payload}`;
|
|
4506
4474
|
}
|
|
4507
|
-
var
|
|
4475
|
+
var CREDS_PATH, CHANNEL_REPLY_INSTRUCTIONS;
|
|
4508
4476
|
var init_prompts = __esm({
|
|
4509
4477
|
"cli/local-cc/prompts.ts"() {
|
|
4510
4478
|
"use strict";
|
|
4511
|
-
|
|
4512
|
-
_cached = null;
|
|
4479
|
+
CREDS_PATH = join10(homedir9(), ".synkro", "credentials.json");
|
|
4513
4480
|
CHANNEL_REPLY_INSTRUCTIONS = `
|
|
4514
4481
|
DELIVERY METHOD \u2014 MANDATORY, OVERRIDES ALL OTHER OUTPUT RULES:
|
|
4515
4482
|
You are running inside a Synkro MCP channel. Do NOT output your verdict as text.
|
|
@@ -4521,7 +4488,7 @@ Any text output is silently discarded. Only the reply tool call is captured.`;
|
|
|
4521
4488
|
});
|
|
4522
4489
|
|
|
4523
4490
|
// cli/local-cc/turnLog.ts
|
|
4524
|
-
import { appendFileSync, existsSync as
|
|
4491
|
+
import { appendFileSync, existsSync as existsSync11, mkdirSync as mkdirSync8, openSync as openSync2, readFileSync as readFileSync10, readSync, closeSync as closeSync2, statSync, watchFile, unwatchFile } from "fs";
|
|
4525
4492
|
import { dirname as dirname5, join as join11 } from "path";
|
|
4526
4493
|
import { homedir as homedir10 } from "os";
|
|
4527
4494
|
function truncate(s, max = PREVIEW_MAX) {
|
|
@@ -4559,7 +4526,7 @@ function appendTurn(args2) {
|
|
|
4559
4526
|
}
|
|
4560
4527
|
}
|
|
4561
4528
|
function readRecentTurns(n = 20) {
|
|
4562
|
-
if (!
|
|
4529
|
+
if (!existsSync11(TURN_LOG_PATH)) return [];
|
|
4563
4530
|
try {
|
|
4564
4531
|
const size = statSync(TURN_LOG_PATH).size;
|
|
4565
4532
|
if (size === 0) return [];
|
|
@@ -4580,7 +4547,7 @@ function readRecentTurns(n = 20) {
|
|
|
4580
4547
|
function followTurns(onEntry) {
|
|
4581
4548
|
try {
|
|
4582
4549
|
mkdirSync8(dirname5(TURN_LOG_PATH), { recursive: true });
|
|
4583
|
-
if (!
|
|
4550
|
+
if (!existsSync11(TURN_LOG_PATH)) {
|
|
4584
4551
|
appendFileSync(TURN_LOG_PATH, "", "utf-8");
|
|
4585
4552
|
}
|
|
4586
4553
|
} catch {
|
|
@@ -4651,7 +4618,7 @@ var init_turnLog = __esm({
|
|
|
4651
4618
|
import { request as httpRequest } from "http";
|
|
4652
4619
|
import { connect as connect2 } from "net";
|
|
4653
4620
|
async function submitToChannel(role, payload, opts = {}) {
|
|
4654
|
-
const content = buildChannelContent(role, payload);
|
|
4621
|
+
const content = await buildChannelContent(role, payload);
|
|
4655
4622
|
const body = JSON.stringify({ role, content });
|
|
4656
4623
|
const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
4657
4624
|
const startedAt = Date.now();
|
|
@@ -4748,7 +4715,7 @@ __export(install_exports, {
|
|
|
4748
4715
|
installCommand: () => installCommand,
|
|
4749
4716
|
parseArgs: () => parseArgs
|
|
4750
4717
|
});
|
|
4751
|
-
import { existsSync as
|
|
4718
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync9, writeFileSync as writeFileSync8, chmodSync as chmodSync2, readFileSync as readFileSync11, readdirSync } from "fs";
|
|
4752
4719
|
import { homedir as homedir11 } from "os";
|
|
4753
4720
|
import { join as join12 } from "path";
|
|
4754
4721
|
import { execSync as execSync5 } from "child_process";
|
|
@@ -4852,7 +4819,7 @@ function shellQuoteSingle(value) {
|
|
|
4852
4819
|
}
|
|
4853
4820
|
function resolveSynkroBundle() {
|
|
4854
4821
|
const scriptPath = process.argv[1];
|
|
4855
|
-
if (scriptPath &&
|
|
4822
|
+
if (scriptPath && existsSync12(scriptPath)) return scriptPath;
|
|
4856
4823
|
return null;
|
|
4857
4824
|
}
|
|
4858
4825
|
function writeConfigEnv(opts) {
|
|
@@ -4872,7 +4839,7 @@ function writeConfigEnv(opts) {
|
|
|
4872
4839
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
4873
4840
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
4874
4841
|
`SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
|
|
4875
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.4.
|
|
4842
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.4.10")}`
|
|
4876
4843
|
];
|
|
4877
4844
|
if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
|
|
4878
4845
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
@@ -4887,7 +4854,7 @@ function writeConfigEnv(opts) {
|
|
|
4887
4854
|
chmodSync2(CONFIG_PATH3, 384);
|
|
4888
4855
|
}
|
|
4889
4856
|
function updateLocalInferenceFlag(enabled) {
|
|
4890
|
-
if (!
|
|
4857
|
+
if (!existsSync12(CONFIG_PATH3)) return;
|
|
4891
4858
|
let content = readFileSync11(CONFIG_PATH3, "utf-8");
|
|
4892
4859
|
const flag = enabled ? "yes" : "no";
|
|
4893
4860
|
if (content.includes("SYNKRO_LOCAL_INFERENCE=")) {
|
|
@@ -5004,10 +4971,10 @@ function isAlreadyInstalled() {
|
|
|
5004
4971
|
join12(HOOKS_DIR, "cc-stop-summary.sh"),
|
|
5005
4972
|
join12(HOOKS_DIR, "cc-session-start.sh")
|
|
5006
4973
|
];
|
|
5007
|
-
if (!requiredScripts.every((p) =>
|
|
5008
|
-
if (!
|
|
4974
|
+
if (!requiredScripts.every((p) => existsSync12(p))) return false;
|
|
4975
|
+
if (!existsSync12(CONFIG_PATH3)) return false;
|
|
5009
4976
|
const settingsPath = join12(homedir11(), ".claude", "settings.json");
|
|
5010
|
-
if (!
|
|
4977
|
+
if (!existsSync12(settingsPath)) return false;
|
|
5011
4978
|
try {
|
|
5012
4979
|
const settings = JSON.parse(readFileSync11(settingsPath, "utf-8"));
|
|
5013
4980
|
const hooks = settings?.hooks;
|
|
@@ -5306,7 +5273,7 @@ function getClaudeProjectsFolder() {
|
|
|
5306
5273
|
const cwd = process.cwd();
|
|
5307
5274
|
const sanitized = "-" + cwd.replace(/\//g, "-");
|
|
5308
5275
|
const projectsDir = join12(homedir11(), ".claude", "projects", sanitized);
|
|
5309
|
-
return
|
|
5276
|
+
return existsSync12(projectsDir) ? projectsDir : null;
|
|
5310
5277
|
}
|
|
5311
5278
|
function extractSessionInsights(projectsDir) {
|
|
5312
5279
|
const insights = [];
|
|
@@ -5580,11 +5547,11 @@ var status_exports = {};
|
|
|
5580
5547
|
__export(status_exports, {
|
|
5581
5548
|
statusCommand: () => statusCommand
|
|
5582
5549
|
});
|
|
5583
|
-
import { existsSync as
|
|
5550
|
+
import { existsSync as existsSync13, readFileSync as readFileSync12 } from "fs";
|
|
5584
5551
|
import { homedir as homedir12 } from "os";
|
|
5585
5552
|
import { join as join13 } from "path";
|
|
5586
5553
|
function readConfigEnv() {
|
|
5587
|
-
if (!
|
|
5554
|
+
if (!existsSync13(CONFIG_PATH4)) return {};
|
|
5588
5555
|
const out = {};
|
|
5589
5556
|
const raw = readFileSync12(CONFIG_PATH4, "utf-8");
|
|
5590
5557
|
for (const line of raw.split("\n")) {
|
|
@@ -5680,17 +5647,17 @@ async function statusCommand() {
|
|
|
5680
5647
|
const cursorBashFollowupScript = join13(SYNKRO_DIR3, "hooks", "cursor-bash-followup.sh");
|
|
5681
5648
|
const commonScript = join13(SYNKRO_DIR3, "hooks", "_synkro-common.sh");
|
|
5682
5649
|
console.log("Hook scripts:");
|
|
5683
|
-
console.log(` ${
|
|
5684
|
-
console.log(` ${
|
|
5685
|
-
console.log(` ${
|
|
5686
|
-
console.log(` ${
|
|
5687
|
-
console.log(` ${
|
|
5688
|
-
console.log(` ${
|
|
5689
|
-
console.log(` ${
|
|
5690
|
-
console.log(` ${
|
|
5691
|
-
console.log(` ${
|
|
5692
|
-
console.log(` ${
|
|
5693
|
-
console.log(` ${
|
|
5650
|
+
console.log(` ${existsSync13(bashScript) ? "\u2713" : "\u2717"} ${bashScript}`);
|
|
5651
|
+
console.log(` ${existsSync13(bashFollowupScript) ? "\u2713" : "\u2717"} ${bashFollowupScript}`);
|
|
5652
|
+
console.log(` ${existsSync13(editPrecheckScript) ? "\u2713" : "\u2717"} ${editPrecheckScript}`);
|
|
5653
|
+
console.log(` ${existsSync13(editCaptureScript) ? "\u2713" : "\u2717"} ${editCaptureScript}`);
|
|
5654
|
+
console.log(` ${existsSync13(stopSummaryScript) ? "\u2713" : "\u2717"} ${stopSummaryScript}`);
|
|
5655
|
+
console.log(` ${existsSync13(sessionStartScript) ? "\u2713" : "\u2717"} ${sessionStartScript}`);
|
|
5656
|
+
console.log(` ${existsSync13(commonScript) ? "\u2713" : "\u2717"} ${commonScript}`);
|
|
5657
|
+
console.log(` ${existsSync13(cursorBashJudgeScript) ? "\u2713" : "\u2717"} ${cursorBashJudgeScript}`);
|
|
5658
|
+
console.log(` ${existsSync13(cursorEditPrecheckScript) ? "\u2713" : "\u2717"} ${cursorEditPrecheckScript}`);
|
|
5659
|
+
console.log(` ${existsSync13(cursorEditCaptureScript) ? "\u2713" : "\u2717"} ${cursorEditCaptureScript}`);
|
|
5660
|
+
console.log(` ${existsSync13(cursorBashFollowupScript) ? "\u2713" : "\u2717"} ${cursorBashFollowupScript}`);
|
|
5694
5661
|
console.log();
|
|
5695
5662
|
const mcp = inspectMcpConfig();
|
|
5696
5663
|
console.log("Guardrails MCP server (Claude Code):");
|
|
@@ -5801,11 +5768,11 @@ var config_exports = {};
|
|
|
5801
5768
|
__export(config_exports, {
|
|
5802
5769
|
configCommand: () => configCommand
|
|
5803
5770
|
});
|
|
5804
|
-
import { readFileSync as readFileSync13, writeFileSync as writeFileSync9, existsSync as
|
|
5771
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync9, existsSync as existsSync14 } from "fs";
|
|
5805
5772
|
import { join as join14 } from "path";
|
|
5806
5773
|
import { homedir as homedir13 } from "os";
|
|
5807
5774
|
function readConfigEnv2() {
|
|
5808
|
-
if (!
|
|
5775
|
+
if (!existsSync14(CONFIG_PATH5)) return {};
|
|
5809
5776
|
const out = {};
|
|
5810
5777
|
for (const line of readFileSync13(CONFIG_PATH5, "utf-8").split("\n")) {
|
|
5811
5778
|
const t = line.trim();
|
|
@@ -5816,7 +5783,7 @@ function readConfigEnv2() {
|
|
|
5816
5783
|
return out;
|
|
5817
5784
|
}
|
|
5818
5785
|
function updateConfigValue(key, value) {
|
|
5819
|
-
if (!
|
|
5786
|
+
if (!existsSync14(CONFIG_PATH5)) {
|
|
5820
5787
|
console.error("No config found. Run `synkro install` first.");
|
|
5821
5788
|
process.exit(1);
|
|
5822
5789
|
}
|
|
@@ -5898,7 +5865,7 @@ __export(scanPr_exports, {
|
|
|
5898
5865
|
scanPrCommand: () => scanPrCommand
|
|
5899
5866
|
});
|
|
5900
5867
|
import { execSync as execSync6, spawn as spawn2 } from "child_process";
|
|
5901
|
-
import { readFileSync as readFileSync14, existsSync as
|
|
5868
|
+
import { readFileSync as readFileSync14, existsSync as existsSync15 } from "fs";
|
|
5902
5869
|
import { join as join15 } from "path";
|
|
5903
5870
|
function parseMatchSpec(condition) {
|
|
5904
5871
|
if (!condition.startsWith("match_spec:")) return null;
|
|
@@ -6379,7 +6346,7 @@ function shouldFail(findings, threshold) {
|
|
|
6379
6346
|
}
|
|
6380
6347
|
function readRepoDeps() {
|
|
6381
6348
|
const pkgPath = join15(process.cwd(), "package.json");
|
|
6382
|
-
if (!
|
|
6349
|
+
if (!existsSync15(pkgPath)) return {};
|
|
6383
6350
|
try {
|
|
6384
6351
|
const pkg = JSON.parse(readFileSync14(pkgPath, "utf-8"));
|
|
6385
6352
|
return { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
@@ -6643,7 +6610,7 @@ var disconnect_exports = {};
|
|
|
6643
6610
|
__export(disconnect_exports, {
|
|
6644
6611
|
disconnectCommand: () => disconnectCommand
|
|
6645
6612
|
});
|
|
6646
|
-
import { existsSync as
|
|
6613
|
+
import { existsSync as existsSync16, rmSync } from "fs";
|
|
6647
6614
|
import { homedir as homedir14 } from "os";
|
|
6648
6615
|
import { join as join16 } from "path";
|
|
6649
6616
|
function tearDownLocalCC() {
|
|
@@ -6678,13 +6645,13 @@ function disconnectCommand(args2 = []) {
|
|
|
6678
6645
|
console.log(`${mcpRemoved ? "\u2713" : "\xB7"} MCP guardrails server: ${mcpRemoved ? "removed entry from ~/.claude.json" : "no Synkro MCP entry found"}`);
|
|
6679
6646
|
}
|
|
6680
6647
|
if (purge) {
|
|
6681
|
-
if (
|
|
6648
|
+
if (existsSync16(SYNKRO_DIR5)) {
|
|
6682
6649
|
rmSync(SYNKRO_DIR5, { recursive: true, force: true });
|
|
6683
6650
|
console.log(`\u2713 Removed ${SYNKRO_DIR5}`);
|
|
6684
6651
|
} else {
|
|
6685
6652
|
console.log(`\xB7 ${SYNKRO_DIR5} already gone, nothing to remove`);
|
|
6686
6653
|
}
|
|
6687
|
-
} else if (
|
|
6654
|
+
} else if (existsSync16(SYNKRO_DIR5)) {
|
|
6688
6655
|
console.log(`Config preserved at ${SYNKRO_DIR5}. Run with --purge to remove.`);
|
|
6689
6656
|
}
|
|
6690
6657
|
console.log("\nSynkro disconnected.");
|
|
@@ -6748,7 +6715,7 @@ __export(localCc_exports, {
|
|
|
6748
6715
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
6749
6716
|
import { homedir as homedir15 } from "os";
|
|
6750
6717
|
import { join as join17 } from "path";
|
|
6751
|
-
import { existsSync as
|
|
6718
|
+
import { existsSync as existsSync17, readFileSync as readFileSync15, writeFileSync as writeFileSync10 } from "fs";
|
|
6752
6719
|
function printHelp() {
|
|
6753
6720
|
console.log(`synkro local-cc \u2014 manage the local Claude Code inference session
|
|
6754
6721
|
|
|
@@ -6838,14 +6805,14 @@ TROUBLESHOOTING
|
|
|
6838
6805
|
`);
|
|
6839
6806
|
}
|
|
6840
6807
|
function readGatewayUrl() {
|
|
6841
|
-
if (
|
|
6808
|
+
if (existsSync17(CONFIG_PATH6)) {
|
|
6842
6809
|
const m = readFileSync15(CONFIG_PATH6, "utf-8").match(/^SYNKRO_GATEWAY_URL='([^']*)'/m);
|
|
6843
6810
|
if (m) return m[1];
|
|
6844
6811
|
}
|
|
6845
6812
|
return "https://api.synkro.sh";
|
|
6846
6813
|
}
|
|
6847
6814
|
function updateLocalInferenceFlag2(enabled) {
|
|
6848
|
-
if (!
|
|
6815
|
+
if (!existsSync17(CONFIG_PATH6)) return;
|
|
6849
6816
|
let content = readFileSync15(CONFIG_PATH6, "utf-8");
|
|
6850
6817
|
const flag = enabled ? "yes" : "no";
|
|
6851
6818
|
if (content.includes("SYNKRO_LOCAL_INFERENCE=")) {
|
|
@@ -7182,14 +7149,14 @@ var init_grade = __esm({
|
|
|
7182
7149
|
});
|
|
7183
7150
|
|
|
7184
7151
|
// cli/bootstrap.js
|
|
7185
|
-
import { readFileSync as readFileSync16, existsSync as
|
|
7152
|
+
import { readFileSync as readFileSync16, existsSync as existsSync18 } from "fs";
|
|
7186
7153
|
import { resolve } from "path";
|
|
7187
7154
|
var envCandidates = [
|
|
7188
7155
|
resolve(process.cwd(), ".env"),
|
|
7189
7156
|
resolve(process.env.HOME ?? "", ".synkro", "config.env")
|
|
7190
7157
|
];
|
|
7191
7158
|
for (const envPath of envCandidates) {
|
|
7192
|
-
if (!
|
|
7159
|
+
if (!existsSync18(envPath)) continue;
|
|
7193
7160
|
const envContent = readFileSync16(envPath, "utf-8");
|
|
7194
7161
|
for (const line of envContent.split("\n")) {
|
|
7195
7162
|
const trimmed = line.trim();
|