@synkro-sh/cli 1.6.36 → 1.6.37
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 +56 -91
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -602,54 +602,14 @@ var init_mcpConfig = __esm({
|
|
|
602
602
|
});
|
|
603
603
|
|
|
604
604
|
// cli/installer/skillParser.ts
|
|
605
|
-
import {
|
|
606
|
-
import { resolve as resolve2
|
|
607
|
-
function parseSection(heading, body) {
|
|
608
|
-
const lines = body.split("\n");
|
|
609
|
-
const meta = {};
|
|
610
|
-
const textLines = [];
|
|
611
|
-
for (const line of lines) {
|
|
612
|
-
const m = line.match(/^(mode|severity|category)\s*:\s*(.+)/i);
|
|
613
|
-
if (m && META_KEYS.has(m[1].toLowerCase())) {
|
|
614
|
-
meta[m[1].toLowerCase()] = m[2].trim();
|
|
615
|
-
} else if (line.trim()) {
|
|
616
|
-
textLines.push(line.trim());
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
const description = textLines.join(" ").trim();
|
|
620
|
-
const text = description ? `${heading}: ${description}` : heading;
|
|
621
|
-
return {
|
|
622
|
-
text,
|
|
623
|
-
mode: meta.mode || "ask",
|
|
624
|
-
severity: meta.severity || "medium",
|
|
625
|
-
category: meta.category || "custom"
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
function parseSkillFile(filePath) {
|
|
629
|
-
if (!existsSync4(filePath)) return null;
|
|
630
|
-
const content = readFileSync4(filePath, "utf-8");
|
|
631
|
-
const source = `skill:${basename(filePath)}`;
|
|
632
|
-
const sections = content.split(/^## /m).slice(1);
|
|
633
|
-
if (sections.length === 0) return null;
|
|
634
|
-
const rules = [];
|
|
635
|
-
for (const section of sections) {
|
|
636
|
-
const newlineIdx = section.indexOf("\n");
|
|
637
|
-
if (newlineIdx === -1) continue;
|
|
638
|
-
const heading = section.slice(0, newlineIdx).trim();
|
|
639
|
-
const body = section.slice(newlineIdx + 1);
|
|
640
|
-
if (!heading) continue;
|
|
641
|
-
rules.push(parseSection(heading, body));
|
|
642
|
-
}
|
|
643
|
-
return rules.length > 0 ? { source, rules } : null;
|
|
644
|
-
}
|
|
605
|
+
import { existsSync as existsSync4 } from "fs";
|
|
606
|
+
import { resolve as resolve2 } from "path";
|
|
645
607
|
function resolveSkillPaths(skills, repoRoot) {
|
|
646
608
|
return skills.filter((s) => s.endsWith(".md")).map((s) => resolve2(repoRoot, s)).filter((p) => existsSync4(p));
|
|
647
609
|
}
|
|
648
|
-
var META_KEYS;
|
|
649
610
|
var init_skillParser = __esm({
|
|
650
611
|
"cli/installer/skillParser.ts"() {
|
|
651
612
|
"use strict";
|
|
652
|
-
META_KEYS = /* @__PURE__ */ new Set(["mode", "severity", "category"]);
|
|
653
613
|
}
|
|
654
614
|
});
|
|
655
615
|
|
|
@@ -6056,7 +6016,7 @@ __export(stub_exports, {
|
|
|
6056
6016
|
saveCredentials: () => saveCredentials
|
|
6057
6017
|
});
|
|
6058
6018
|
import { createServer } from "http";
|
|
6059
|
-
import { writeFileSync as writeFileSync4, readFileSync as
|
|
6019
|
+
import { writeFileSync as writeFileSync4, readFileSync as readFileSync4, existsSync as existsSync5, mkdirSync as mkdirSync4, unlinkSync as unlinkSync2 } from "fs";
|
|
6060
6020
|
import { homedir as homedir4, platform } from "os";
|
|
6061
6021
|
import { join as join3, dirname as dirname4 } from "path";
|
|
6062
6022
|
import { execFile } from "child_process";
|
|
@@ -6097,7 +6057,7 @@ function loadCredentials() {
|
|
|
6097
6057
|
return null;
|
|
6098
6058
|
}
|
|
6099
6059
|
try {
|
|
6100
|
-
const content =
|
|
6060
|
+
const content = readFileSync4(AUTH_FILE, "utf8");
|
|
6101
6061
|
return JSON.parse(content);
|
|
6102
6062
|
} catch (error) {
|
|
6103
6063
|
return null;
|
|
@@ -6955,7 +6915,7 @@ __export(macKeychain_exports, {
|
|
|
6955
6915
|
writeCursorApiKey: () => writeCursorApiKey,
|
|
6956
6916
|
writeRefreshAgent: () => writeRefreshAgent
|
|
6957
6917
|
});
|
|
6958
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync6, writeFileSync as writeFileSync6, chmodSync, readFileSync as
|
|
6918
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync6, writeFileSync as writeFileSync6, chmodSync, readFileSync as readFileSync5, statSync } from "fs";
|
|
6959
6919
|
import { homedir as homedir5, platform as platform2 } from "os";
|
|
6960
6920
|
import { join as join5 } from "path";
|
|
6961
6921
|
import { spawnSync } from "child_process";
|
|
@@ -6983,7 +6943,7 @@ function exportKeychainCreds() {
|
|
|
6983
6943
|
}
|
|
6984
6944
|
function cursorApiKeyConfigured() {
|
|
6985
6945
|
try {
|
|
6986
|
-
return existsSync7(CURSOR_API_KEY_FILE) &&
|
|
6946
|
+
return existsSync7(CURSOR_API_KEY_FILE) && readFileSync5(CURSOR_API_KEY_FILE, "utf-8").trim().length > 0;
|
|
6987
6947
|
} catch {
|
|
6988
6948
|
return false;
|
|
6989
6949
|
}
|
|
@@ -6999,7 +6959,7 @@ function writeCursorApiKey(key) {
|
|
|
6999
6959
|
async function validateCursorApiKey() {
|
|
7000
6960
|
let key;
|
|
7001
6961
|
try {
|
|
7002
|
-
key =
|
|
6962
|
+
key = readFileSync5(CURSOR_API_KEY_FILE, "utf-8").trim();
|
|
7003
6963
|
} catch {
|
|
7004
6964
|
return null;
|
|
7005
6965
|
}
|
|
@@ -7093,7 +7053,7 @@ function refreshCreds() {
|
|
|
7093
7053
|
}
|
|
7094
7054
|
function readExportedCreds() {
|
|
7095
7055
|
try {
|
|
7096
|
-
return
|
|
7056
|
+
return readFileSync5(CLAUDE_CREDS_FILE, "utf-8");
|
|
7097
7057
|
} catch {
|
|
7098
7058
|
return null;
|
|
7099
7059
|
}
|
|
@@ -7142,7 +7102,7 @@ __export(dockerInstall_exports, {
|
|
|
7142
7102
|
splitWorkers: () => splitWorkers,
|
|
7143
7103
|
waitForContainerReady: () => waitForContainerReady
|
|
7144
7104
|
});
|
|
7145
|
-
import { copyFileSync, existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as
|
|
7105
|
+
import { copyFileSync, existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync6, readdirSync as readdirSync2 } from "fs";
|
|
7146
7106
|
import { homedir as homedir6 } from "os";
|
|
7147
7107
|
import { join as join6 } from "path";
|
|
7148
7108
|
import { execSync as execSync4, spawnSync as spawnSync2 } from "child_process";
|
|
@@ -7212,7 +7172,7 @@ function readSynkroFileConfig() {
|
|
|
7212
7172
|
if (!root) return { pool: "auto" };
|
|
7213
7173
|
const fp = join6(root, ".synkro");
|
|
7214
7174
|
if (!existsSync8(fp)) return { pool: "auto" };
|
|
7215
|
-
const raw =
|
|
7175
|
+
const raw = readFileSync6(fp, "utf-8");
|
|
7216
7176
|
const parsed = raw.trimStart().startsWith("{") ? JSON.parse(raw) : parseSynkroYaml(raw);
|
|
7217
7177
|
const pool = ["auto", "claude", "cursor"].includes(parsed?.grader?.pool) ? parsed.grader.pool : "auto";
|
|
7218
7178
|
const cw = typeof parsed?.workers?.claude === "number" ? Math.max(0, Math.floor(parsed.workers.claude)) : void 0;
|
|
@@ -7674,14 +7634,14 @@ __export(setupGithub_exports, {
|
|
|
7674
7634
|
import { createInterface as createInterface2 } from "readline/promises";
|
|
7675
7635
|
import { stdin as input, stdout as output } from "process";
|
|
7676
7636
|
import { execSync as execSync5, spawn as nodeSpawn } from "child_process";
|
|
7677
|
-
import { existsSync as existsSync9, readFileSync as
|
|
7637
|
+
import { existsSync as existsSync9, readFileSync as readFileSync7, unlinkSync as unlinkSync3 } from "fs";
|
|
7678
7638
|
import { homedir as homedir7, platform as platform3 } from "os";
|
|
7679
7639
|
import { join as join7 } from "path";
|
|
7680
7640
|
import { execFile as execFile2 } from "child_process";
|
|
7681
7641
|
function readConfig() {
|
|
7682
7642
|
if (!existsSync9(CONFIG_PATH)) return {};
|
|
7683
7643
|
const out = {};
|
|
7684
|
-
for (const line of
|
|
7644
|
+
for (const line of readFileSync7(CONFIG_PATH, "utf-8").split("\n")) {
|
|
7685
7645
|
const t = line.trim();
|
|
7686
7646
|
if (!t || t.startsWith("#")) continue;
|
|
7687
7647
|
const eq = t.indexOf("=");
|
|
@@ -7751,7 +7711,7 @@ function captureClaudeSetupToken() {
|
|
|
7751
7711
|
proc.on("close", (code) => {
|
|
7752
7712
|
let raw = "";
|
|
7753
7713
|
try {
|
|
7754
|
-
raw =
|
|
7714
|
+
raw = readFileSync7(tmpFile, "utf-8");
|
|
7755
7715
|
} catch (e) {
|
|
7756
7716
|
reject(new Error(`Could not read script output file: ${e.message}`));
|
|
7757
7717
|
return;
|
|
@@ -8038,7 +7998,7 @@ __export(install_exports, {
|
|
|
8038
7998
|
syncSkillFiles: () => syncSkillFiles,
|
|
8039
7999
|
writeHookScripts: () => writeHookScripts
|
|
8040
8000
|
});
|
|
8041
|
-
import { existsSync as existsSync10, mkdirSync as mkdirSync8, writeFileSync as writeFileSync7, chmodSync as chmodSync2, readFileSync as
|
|
8001
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync8, writeFileSync as writeFileSync7, chmodSync as chmodSync2, readFileSync as readFileSync8, readdirSync as readdirSync3 } from "fs";
|
|
8042
8002
|
import { homedir as homedir8 } from "os";
|
|
8043
8003
|
import { join as join8 } from "path";
|
|
8044
8004
|
import { execSync as execSync6, spawnSync as spawnSync3 } from "child_process";
|
|
@@ -8284,7 +8244,7 @@ function writeConfigEnv(opts) {
|
|
|
8284
8244
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
8285
8245
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
8286
8246
|
`SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
|
|
8287
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.6.
|
|
8247
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.6.37")}`
|
|
8288
8248
|
];
|
|
8289
8249
|
if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
|
|
8290
8250
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
@@ -8307,7 +8267,7 @@ function resolveDeploymentMode() {
|
|
|
8307
8267
|
if (envOverride === "bare-host" || envOverride === "docker") return envOverride;
|
|
8308
8268
|
try {
|
|
8309
8269
|
if (existsSync10(CONFIG_PATH2)) {
|
|
8310
|
-
const m =
|
|
8270
|
+
const m = readFileSync8(CONFIG_PATH2, "utf-8").match(/^SYNKRO_DEPLOYMENT_MODE='([^']*)'/m);
|
|
8311
8271
|
const val = m?.[1]?.toLowerCase();
|
|
8312
8272
|
if (val === "bare-host" || val === "docker") return val;
|
|
8313
8273
|
}
|
|
@@ -8336,14 +8296,14 @@ function collectLocalMetadata(includeClaudeCode = true) {
|
|
|
8336
8296
|
}
|
|
8337
8297
|
const claudeDir = join8(homedir8(), ".claude");
|
|
8338
8298
|
try {
|
|
8339
|
-
const settings = JSON.parse(
|
|
8299
|
+
const settings = JSON.parse(readFileSync8(join8(claudeDir, "settings.json"), "utf-8"));
|
|
8340
8300
|
const plugins = Object.keys(settings.enabledPlugins ?? {}).filter((k) => settings.enabledPlugins[k]);
|
|
8341
8301
|
if (plugins.length) meta.enabled_plugins = plugins;
|
|
8342
8302
|
if (settings.permissions?.defaultMode) meta.permissions_mode = settings.permissions.defaultMode;
|
|
8343
8303
|
} catch {
|
|
8344
8304
|
}
|
|
8345
8305
|
try {
|
|
8346
|
-
const mcpCache = JSON.parse(
|
|
8306
|
+
const mcpCache = JSON.parse(readFileSync8(join8(claudeDir, "mcp-needs-auth-cache.json"), "utf-8"));
|
|
8347
8307
|
const mcpNames = Object.keys(mcpCache);
|
|
8348
8308
|
if (mcpNames.length) meta.mcp_servers = mcpNames;
|
|
8349
8309
|
} catch {
|
|
@@ -8358,7 +8318,7 @@ function collectLocalMetadata(includeClaudeCode = true) {
|
|
|
8358
8318
|
const sessionsDir = join8(claudeDir, "sessions");
|
|
8359
8319
|
const files = readdirSync3(sessionsDir).filter((f) => f.endsWith(".json")).slice(-5);
|
|
8360
8320
|
for (const f of files) {
|
|
8361
|
-
const s = JSON.parse(
|
|
8321
|
+
const s = JSON.parse(readFileSync8(join8(sessionsDir, f), "utf-8"));
|
|
8362
8322
|
if (s.version) {
|
|
8363
8323
|
meta.cc_version = meta.cc_version || s.version;
|
|
8364
8324
|
break;
|
|
@@ -8490,7 +8450,7 @@ async function installCommand(opts = {}) {
|
|
|
8490
8450
|
for (const mode of ["edit", "bash"]) {
|
|
8491
8451
|
const pidFile = join8(SYNKRO_DIR4, "daemon", mode, "daemon.pid");
|
|
8492
8452
|
try {
|
|
8493
|
-
const pid = parseInt(
|
|
8453
|
+
const pid = parseInt(readFileSync8(pidFile, "utf-8").trim(), 10);
|
|
8494
8454
|
if (pid > 0) {
|
|
8495
8455
|
process.kill(pid, "SIGTERM");
|
|
8496
8456
|
console.log(`Stopped stale ${mode} grader daemon (pid ${pid})`);
|
|
@@ -8727,7 +8687,7 @@ async function installCommand(opts = {}) {
|
|
|
8727
8687
|
const ready = await waitForContainerReady(6e4);
|
|
8728
8688
|
if (ready) {
|
|
8729
8689
|
console.log(" \u2713 container ready");
|
|
8730
|
-
const mcpJwt =
|
|
8690
|
+
const mcpJwt = readFileSync8(join8(SYNKRO_DIR4, ".mcp-jwt"), "utf-8").trim();
|
|
8731
8691
|
try {
|
|
8732
8692
|
const ingestResp = await fetch(`http://127.0.0.1:${hostMcpPort}/api/ingest`, {
|
|
8733
8693
|
method: "POST",
|
|
@@ -8759,7 +8719,7 @@ async function installCommand(opts = {}) {
|
|
|
8759
8719
|
try {
|
|
8760
8720
|
let mcpToken = "";
|
|
8761
8721
|
try {
|
|
8762
|
-
mcpToken =
|
|
8722
|
+
mcpToken = readFileSync8(join8(SYNKRO_DIR4, ".mcp-jwt"), "utf-8").trim();
|
|
8763
8723
|
} catch {
|
|
8764
8724
|
}
|
|
8765
8725
|
if (mcpToken) {
|
|
@@ -8919,7 +8879,7 @@ function readSynkroFilePool() {
|
|
|
8919
8879
|
if (!root) return "auto";
|
|
8920
8880
|
const fp = join8(root, ".synkro");
|
|
8921
8881
|
if (!existsSync10(fp)) return "auto";
|
|
8922
|
-
const parsed = parseSynkroFileRaw(
|
|
8882
|
+
const parsed = parseSynkroFileRaw(readFileSync8(fp, "utf-8"));
|
|
8923
8883
|
const pool = parsed?.grader?.pool;
|
|
8924
8884
|
if (pool === "cursor" || pool === "claude") return pool;
|
|
8925
8885
|
} catch {
|
|
@@ -8932,7 +8892,7 @@ function readFullSynkroFile() {
|
|
|
8932
8892
|
if (!root) return null;
|
|
8933
8893
|
const fp = join8(root, ".synkro");
|
|
8934
8894
|
if (!existsSync10(fp)) return null;
|
|
8935
|
-
const parsed = parseSynkroFileRaw(
|
|
8895
|
+
const parsed = parseSynkroFileRaw(readFileSync8(fp, "utf-8"));
|
|
8936
8896
|
const valid = ["claude-code", "cursor"];
|
|
8937
8897
|
const harness = Array.isArray(parsed.harness) ? parsed.harness.filter((h) => valid.includes(h)) : ["claude-code", "cursor"];
|
|
8938
8898
|
return {
|
|
@@ -8983,7 +8943,7 @@ function reconcileHarness() {
|
|
|
8983
8943
|
});
|
|
8984
8944
|
console.log(" \u2713 Claude Code hooks registered");
|
|
8985
8945
|
try {
|
|
8986
|
-
const mcpJwt =
|
|
8946
|
+
const mcpJwt = readFileSync8(join8(SYNKRO_DIR4, ".mcp-jwt"), "utf-8").trim();
|
|
8987
8947
|
if (mcpJwt) {
|
|
8988
8948
|
installMcpConfig({ gatewayUrl: "", bearerToken: mcpJwt, local: true });
|
|
8989
8949
|
console.log(" \u2713 Claude Code MCP registered");
|
|
@@ -9047,23 +9007,28 @@ async function syncSkillFiles() {
|
|
|
9047
9007
|
if (resolved.length === 0) return;
|
|
9048
9008
|
const mcpPort = process.env.SYNKRO_MCP_PORT || "18931";
|
|
9049
9009
|
for (const fp of resolved) {
|
|
9050
|
-
const
|
|
9051
|
-
if (!
|
|
9010
|
+
const content = readFileSync8(fp, "utf-8");
|
|
9011
|
+
if (!content.trim()) continue;
|
|
9012
|
+
const source = `skill:${fp.split("/").pop()}`;
|
|
9052
9013
|
try {
|
|
9053
9014
|
const resp = await fetch(`http://127.0.0.1:${mcpPort}/api/local/skills/sync`, {
|
|
9054
9015
|
method: "POST",
|
|
9055
9016
|
headers: { "Content-Type": "application/json" },
|
|
9056
|
-
body: JSON.stringify(
|
|
9057
|
-
signal: AbortSignal.timeout(
|
|
9017
|
+
body: JSON.stringify({ source, content }),
|
|
9018
|
+
signal: AbortSignal.timeout(65e3)
|
|
9058
9019
|
});
|
|
9059
9020
|
if (resp.ok) {
|
|
9060
9021
|
const result = await resp.json();
|
|
9061
|
-
|
|
9022
|
+
if (result.created > 0) {
|
|
9023
|
+
console.log(` \u2713 skill ${source}: ${result.created} new rules added`);
|
|
9024
|
+
} else {
|
|
9025
|
+
console.log(` \u2713 skill ${source}: ${result.message || "up to date"}`);
|
|
9026
|
+
}
|
|
9062
9027
|
} else {
|
|
9063
|
-
console.warn(` \u26A0 skill ${
|
|
9028
|
+
console.warn(` \u26A0 skill ${source}: sync failed (${resp.status})`);
|
|
9064
9029
|
}
|
|
9065
9030
|
} catch (e) {
|
|
9066
|
-
console.warn(` \u26A0 skill ${
|
|
9031
|
+
console.warn(` \u26A0 skill ${source}: ${e.message}`);
|
|
9067
9032
|
}
|
|
9068
9033
|
}
|
|
9069
9034
|
}
|
|
@@ -9095,7 +9060,7 @@ function extractSessionInsights(projectsDir) {
|
|
|
9095
9060
|
const sessionId = file.replace(".jsonl", "");
|
|
9096
9061
|
const filePath = join8(projectsDir, file);
|
|
9097
9062
|
try {
|
|
9098
|
-
const content =
|
|
9063
|
+
const content = readFileSync8(filePath, "utf-8");
|
|
9099
9064
|
const lines = content.split("\n").filter(Boolean);
|
|
9100
9065
|
for (let i = 0; i < lines.length; i++) {
|
|
9101
9066
|
try {
|
|
@@ -9171,7 +9136,7 @@ function extractTextContent(content) {
|
|
|
9171
9136
|
return "";
|
|
9172
9137
|
}
|
|
9173
9138
|
function parseTranscriptFile(filePath) {
|
|
9174
|
-
const content =
|
|
9139
|
+
const content = readFileSync8(filePath, "utf-8");
|
|
9175
9140
|
const lines = content.split("\n").filter(Boolean);
|
|
9176
9141
|
const messages = [];
|
|
9177
9142
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -9241,7 +9206,7 @@ async function syncTranscriptsLocal(mcpPort, mcpToken, repo) {
|
|
|
9241
9206
|
process.stdout.write(`\r Progress: ${i + 1}/${files.length} sessions (${totalMessages} messages embedded) `);
|
|
9242
9207
|
}
|
|
9243
9208
|
try {
|
|
9244
|
-
const content =
|
|
9209
|
+
const content = readFileSync8(join8(projectsDir, file), "utf-8");
|
|
9245
9210
|
const lineCount = content.split("\n").filter(Boolean).length;
|
|
9246
9211
|
writeFileSync7(join8(OFFSETS_DIR, sessionId), String(lineCount), "utf-8");
|
|
9247
9212
|
} catch {
|
|
@@ -9295,7 +9260,7 @@ async function syncTranscriptsBulk(gatewayUrl, token, repo) {
|
|
|
9295
9260
|
const sessionId = file.replace(".jsonl", "");
|
|
9296
9261
|
const filePath = join8(projectsDir, file);
|
|
9297
9262
|
try {
|
|
9298
|
-
const content =
|
|
9263
|
+
const content = readFileSync8(filePath, "utf-8");
|
|
9299
9264
|
const lineCount = content.split("\n").filter(Boolean).length;
|
|
9300
9265
|
writeFileSync7(join8(OFFSETS_DIR, sessionId), String(lineCount), "utf-8");
|
|
9301
9266
|
} catch {
|
|
@@ -9375,7 +9340,7 @@ rl.on('line', async (line) => {
|
|
|
9375
9340
|
});
|
|
9376
9341
|
|
|
9377
9342
|
// cli/local-cc/install.ts
|
|
9378
|
-
import { existsSync as existsSync11, mkdirSync as mkdirSync9, writeFileSync as writeFileSync8, readFileSync as
|
|
9343
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync9, writeFileSync as writeFileSync8, readFileSync as readFileSync9, chmodSync as chmodSync3, copyFileSync as copyFileSync2, renameSync as renameSync4, unlinkSync as unlinkSync4, openSync, fsyncSync, closeSync } from "fs";
|
|
9379
9344
|
import { join as join9 } from "path";
|
|
9380
9345
|
import { homedir as homedir9 } from "os";
|
|
9381
9346
|
import { spawnSync as spawnSync4 } from "child_process";
|
|
@@ -9414,7 +9379,7 @@ function safelyMutateClaudeJson(mutator) {
|
|
|
9414
9379
|
if (!existsSync11(CLAUDE_JSON_PATH)) {
|
|
9415
9380
|
return;
|
|
9416
9381
|
}
|
|
9417
|
-
const originalText =
|
|
9382
|
+
const originalText = readFileSync9(CLAUDE_JSON_PATH, "utf-8");
|
|
9418
9383
|
let parsed;
|
|
9419
9384
|
try {
|
|
9420
9385
|
parsed = JSON.parse(originalText);
|
|
@@ -9984,7 +9949,7 @@ var init_disconnect = __esm({
|
|
|
9984
9949
|
});
|
|
9985
9950
|
|
|
9986
9951
|
// cli/local-cc/turnLog.ts
|
|
9987
|
-
import { appendFileSync, existsSync as existsSync13, mkdirSync as mkdirSync10, openSync as openSync2, readFileSync as
|
|
9952
|
+
import { appendFileSync, existsSync as existsSync13, mkdirSync as mkdirSync10, openSync as openSync2, readFileSync as readFileSync10, readSync, closeSync as closeSync2, statSync as statSync2, watchFile, unwatchFile } from "fs";
|
|
9988
9953
|
import { dirname as dirname6, join as join11 } from "path";
|
|
9989
9954
|
import { homedir as homedir11 } from "os";
|
|
9990
9955
|
function truncate(s, max = PREVIEW_MAX) {
|
|
@@ -10026,7 +9991,7 @@ function readRecentTurns(n = 20) {
|
|
|
10026
9991
|
try {
|
|
10027
9992
|
const size = statSync2(TURN_LOG_PATH).size;
|
|
10028
9993
|
if (size === 0) return [];
|
|
10029
|
-
const text =
|
|
9994
|
+
const text = readFileSync10(TURN_LOG_PATH, "utf-8");
|
|
10030
9995
|
const lines = text.split("\n").filter(Boolean);
|
|
10031
9996
|
const lastN = lines.slice(-n).reverse();
|
|
10032
9997
|
return lastN.map((line) => {
|
|
@@ -10472,13 +10437,13 @@ var init_pueue = __esm({
|
|
|
10472
10437
|
});
|
|
10473
10438
|
|
|
10474
10439
|
// cli/local-cc/settings.ts
|
|
10475
|
-
import { existsSync as existsSync14, readFileSync as
|
|
10440
|
+
import { existsSync as existsSync14, readFileSync as readFileSync11 } from "fs";
|
|
10476
10441
|
import { homedir as homedir13 } from "os";
|
|
10477
10442
|
import { join as join13 } from "path";
|
|
10478
10443
|
function isLocalCCEnabled() {
|
|
10479
10444
|
if (!existsSync14(CONFIG_PATH3)) return false;
|
|
10480
10445
|
try {
|
|
10481
|
-
const content =
|
|
10446
|
+
const content = readFileSync11(CONFIG_PATH3, "utf-8");
|
|
10482
10447
|
const match = content.match(/^SYNKRO_LOCAL_INFERENCE='([^']*)'/m);
|
|
10483
10448
|
return match?.[1] === "yes";
|
|
10484
10449
|
} catch {
|
|
@@ -10502,7 +10467,7 @@ import { spawnSync as spawnSync7 } from "child_process";
|
|
|
10502
10467
|
import { homedir as homedir14 } from "os";
|
|
10503
10468
|
import { join as join14 } from "path";
|
|
10504
10469
|
import { readFileSync as fsReadFileSync, existsSync as fsExistsSync } from "fs";
|
|
10505
|
-
import { existsSync as existsSync15, readFileSync as
|
|
10470
|
+
import { existsSync as existsSync15, readFileSync as readFileSync12, writeFileSync as writeFileSync9 } from "fs";
|
|
10506
10471
|
function deploymentMode() {
|
|
10507
10472
|
const env = (process.env.SYNKRO_DEPLOYMENT_MODE || "").toLowerCase();
|
|
10508
10473
|
if (env === "docker") return "docker";
|
|
@@ -10609,14 +10574,14 @@ TROUBLESHOOTING
|
|
|
10609
10574
|
}
|
|
10610
10575
|
function readGatewayUrl() {
|
|
10611
10576
|
if (existsSync15(CONFIG_PATH4)) {
|
|
10612
|
-
const m =
|
|
10577
|
+
const m = readFileSync12(CONFIG_PATH4, "utf-8").match(/^SYNKRO_GATEWAY_URL='([^']*)'/m);
|
|
10613
10578
|
if (m) return m[1];
|
|
10614
10579
|
}
|
|
10615
10580
|
return "https://api.synkro.sh";
|
|
10616
10581
|
}
|
|
10617
10582
|
function updateLocalInferenceFlag(enabled) {
|
|
10618
10583
|
if (!existsSync15(CONFIG_PATH4)) return;
|
|
10619
|
-
let content =
|
|
10584
|
+
let content = readFileSync12(CONFIG_PATH4, "utf-8");
|
|
10620
10585
|
const flag = enabled ? "yes" : "no";
|
|
10621
10586
|
if (content.includes("SYNKRO_LOCAL_INFERENCE=")) {
|
|
10622
10587
|
content = content.replace(/^SYNKRO_LOCAL_INFERENCE='[^']*'/m, `SYNKRO_LOCAL_INFERENCE='${flag}'`);
|
|
@@ -11159,13 +11124,13 @@ var config_exports = {};
|
|
|
11159
11124
|
__export(config_exports, {
|
|
11160
11125
|
configCommand: () => configCommand
|
|
11161
11126
|
});
|
|
11162
|
-
import { readFileSync as
|
|
11127
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync10, existsSync as existsSync16 } from "fs";
|
|
11163
11128
|
import { join as join15 } from "path";
|
|
11164
11129
|
import { homedir as homedir15 } from "os";
|
|
11165
11130
|
function readConfigEnv() {
|
|
11166
11131
|
if (!existsSync16(CONFIG_PATH5)) return {};
|
|
11167
11132
|
const out = {};
|
|
11168
|
-
for (const line of
|
|
11133
|
+
for (const line of readFileSync13(CONFIG_PATH5, "utf-8").split("\n")) {
|
|
11169
11134
|
const t = line.trim();
|
|
11170
11135
|
if (!t || t.startsWith("#")) continue;
|
|
11171
11136
|
const eq = t.indexOf("=");
|
|
@@ -11178,7 +11143,7 @@ function updateConfigValue(key, value) {
|
|
|
11178
11143
|
console.error("No config found. Run `synkro install` first.");
|
|
11179
11144
|
process.exit(1);
|
|
11180
11145
|
}
|
|
11181
|
-
const lines =
|
|
11146
|
+
const lines = readFileSync13(CONFIG_PATH5, "utf-8").split("\n");
|
|
11182
11147
|
const pattern = new RegExp(`^${key}=`);
|
|
11183
11148
|
let found = false;
|
|
11184
11149
|
const updated = lines.map((line) => {
|
|
@@ -11305,14 +11270,14 @@ var init_config = __esm({
|
|
|
11305
11270
|
});
|
|
11306
11271
|
|
|
11307
11272
|
// cli/bootstrap.js
|
|
11308
|
-
import { readFileSync as
|
|
11273
|
+
import { readFileSync as readFileSync14, existsSync as existsSync17 } from "fs";
|
|
11309
11274
|
import { resolve as resolve3 } from "path";
|
|
11310
11275
|
var envCandidates = [
|
|
11311
11276
|
resolve3(process.env.HOME ?? "", ".synkro", "config.env")
|
|
11312
11277
|
];
|
|
11313
11278
|
for (const envPath of envCandidates) {
|
|
11314
11279
|
if (!existsSync17(envPath)) continue;
|
|
11315
|
-
const envContent =
|
|
11280
|
+
const envContent = readFileSync14(envPath, "utf-8");
|
|
11316
11281
|
for (const line of envContent.split("\n")) {
|
|
11317
11282
|
const trimmed = line.trim();
|
|
11318
11283
|
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
@@ -11327,7 +11292,7 @@ var args = process.argv.slice(2);
|
|
|
11327
11292
|
var cmd = args[0] || "";
|
|
11328
11293
|
var subArgs = args.slice(1);
|
|
11329
11294
|
function printVersion() {
|
|
11330
|
-
console.log("1.6.
|
|
11295
|
+
console.log("1.6.37");
|
|
11331
11296
|
}
|
|
11332
11297
|
function printHelp2() {
|
|
11333
11298
|
console.log(`Synkro CLI \u2014 runtime safety for AI coding agents
|