@synkro-sh/cli 1.4.20 → 1.4.22
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 +184 -228
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -2580,80 +2580,36 @@ var init_setupGithub = __esm({
|
|
|
2580
2580
|
});
|
|
2581
2581
|
|
|
2582
2582
|
// cli/installer/promptFetcher.ts
|
|
2583
|
-
import { existsSync as existsSync8, readFileSync as readFileSync6, writeFileSync as writeFileSync6, mkdirSync as mkdirSync6 } from "fs";
|
|
2584
|
-
import { homedir as homedir5 } from "os";
|
|
2585
|
-
import { join as join6 } from "path";
|
|
2586
|
-
function readCache() {
|
|
2587
|
-
if (!existsSync8(CACHE_PATH)) return null;
|
|
2588
|
-
try {
|
|
2589
|
-
return JSON.parse(readFileSync6(CACHE_PATH, "utf-8"));
|
|
2590
|
-
} catch {
|
|
2591
|
-
return null;
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
function writeCache(entry) {
|
|
2595
|
-
mkdirSync6(join6(homedir5(), ".synkro", "prompts"), { recursive: true });
|
|
2596
|
-
writeFileSync6(CACHE_PATH, JSON.stringify(entry, null, 2), "utf-8");
|
|
2597
|
-
}
|
|
2598
|
-
function isCacheFresh(cache) {
|
|
2599
|
-
const ageMs = Date.now() - cache.fetched_at;
|
|
2600
|
-
const ttlMs = cache.ttl_hours * 60 * 60 * 1e3;
|
|
2601
|
-
return ageMs < ttlMs;
|
|
2602
|
-
}
|
|
2603
2583
|
async function fetchJudgePrompts(opts) {
|
|
2604
|
-
|
|
2605
|
-
const cache = readCache();
|
|
2606
|
-
if (cache && isCacheFresh(cache)) {
|
|
2607
|
-
return mapResponse(cache);
|
|
2608
|
-
}
|
|
2609
|
-
}
|
|
2610
|
-
const url = `${opts.gatewayUrl.replace(/\/$/, "")}/api/v1/cli/judge-prompts`;
|
|
2584
|
+
const url = `${opts.gatewayUrl.replace(/\/$/, "")}/api/v1/hook/config`;
|
|
2611
2585
|
const resp = await fetch(url, {
|
|
2612
2586
|
method: "GET",
|
|
2613
2587
|
headers: {
|
|
2614
2588
|
"Authorization": `Bearer ${opts.jwt}`,
|
|
2615
2589
|
"User-Agent": "synkro-cli/1.0"
|
|
2616
|
-
}
|
|
2590
|
+
},
|
|
2591
|
+
signal: AbortSignal.timeout(5e3)
|
|
2617
2592
|
});
|
|
2618
2593
|
if (!resp.ok) {
|
|
2619
|
-
|
|
2594
|
+
return { version: "unknown" };
|
|
2620
2595
|
}
|
|
2621
2596
|
const data = await resp.json();
|
|
2622
|
-
|
|
2623
|
-
throw new Error("Gateway returned empty edit_write_prompt");
|
|
2624
|
-
}
|
|
2625
|
-
writeCache({ ...data, fetched_at: Date.now() });
|
|
2626
|
-
return mapResponse(data);
|
|
2627
|
-
}
|
|
2628
|
-
function mapResponse(data) {
|
|
2629
|
-
return {
|
|
2630
|
-
editWritePrompt: data.edit_write_prompt,
|
|
2631
|
-
editAutofixAgentPrompt: data.edit_autofix_agent_prompt,
|
|
2632
|
-
editPrecheckAgentPrompt: data.edit_precheck_agent_prompt,
|
|
2633
|
-
graderPrimerBash: data.grader_primer_bash,
|
|
2634
|
-
graderPrimerEdit: data.grader_primer_edit,
|
|
2635
|
-
classificationPrompt: data.classification_prompt,
|
|
2636
|
-
intentClassifyPrompt: data.intent_classify_prompt,
|
|
2637
|
-
remediateIntentClassifyPrompt: data.remediate_intent_classify_prompt,
|
|
2638
|
-
version: data.version
|
|
2639
|
-
};
|
|
2597
|
+
return { version: data.prompts?.version ?? "unknown" };
|
|
2640
2598
|
}
|
|
2641
|
-
var CACHE_PATH;
|
|
2642
2599
|
var init_promptFetcher = __esm({
|
|
2643
2600
|
"cli/installer/promptFetcher.ts"() {
|
|
2644
2601
|
"use strict";
|
|
2645
|
-
CACHE_PATH = join6(homedir5(), ".synkro", "prompts", "judge-prompts.json");
|
|
2646
2602
|
}
|
|
2647
2603
|
});
|
|
2648
2604
|
|
|
2649
2605
|
// cli/local-cc/settings.ts
|
|
2650
|
-
import { existsSync as
|
|
2651
|
-
import { homedir as
|
|
2652
|
-
import { join as
|
|
2606
|
+
import { existsSync as existsSync8, readFileSync as readFileSync6 } from "fs";
|
|
2607
|
+
import { homedir as homedir5 } from "os";
|
|
2608
|
+
import { join as join6 } from "path";
|
|
2653
2609
|
function isLocalCCEnabled() {
|
|
2654
|
-
if (!
|
|
2610
|
+
if (!existsSync8(CONFIG_PATH2)) return false;
|
|
2655
2611
|
try {
|
|
2656
|
-
const content =
|
|
2612
|
+
const content = readFileSync6(CONFIG_PATH2, "utf-8");
|
|
2657
2613
|
const match = content.match(/^SYNKRO_LOCAL_INFERENCE='([^']*)'/m);
|
|
2658
2614
|
return match?.[1] === "yes";
|
|
2659
2615
|
} catch {
|
|
@@ -2664,7 +2620,7 @@ var CONFIG_PATH2;
|
|
|
2664
2620
|
var init_settings = __esm({
|
|
2665
2621
|
"cli/local-cc/settings.ts"() {
|
|
2666
2622
|
"use strict";
|
|
2667
|
-
CONFIG_PATH2 =
|
|
2623
|
+
CONFIG_PATH2 = join6(homedir5(), ".synkro", "config.env");
|
|
2668
2624
|
}
|
|
2669
2625
|
});
|
|
2670
2626
|
|
|
@@ -2818,17 +2774,17 @@ await mcp.connect(new StdioServerTransport());
|
|
|
2818
2774
|
});
|
|
2819
2775
|
|
|
2820
2776
|
// cli/local-cc/install.ts
|
|
2821
|
-
import { existsSync as
|
|
2822
|
-
import { join as
|
|
2823
|
-
import { homedir as
|
|
2777
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync6, writeFileSync as writeFileSync6, readFileSync as readFileSync7, chmodSync, copyFileSync, renameSync as renameSync4, unlinkSync as unlinkSync4, openSync, fsyncSync, closeSync } from "fs";
|
|
2778
|
+
import { join as join7 } from "path";
|
|
2779
|
+
import { homedir as homedir6 } from "os";
|
|
2824
2780
|
import { spawnSync } from "child_process";
|
|
2825
2781
|
function writePluginFiles() {
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2782
|
+
mkdirSync6(SESSION_DIR, { recursive: true });
|
|
2783
|
+
mkdirSync6(PLUGIN_SETTINGS_DIR, { recursive: true });
|
|
2784
|
+
writeFileSync6(PLUGIN_PATH, CHANNEL_PLUGIN_SOURCE, "utf-8");
|
|
2829
2785
|
chmodSync(PLUGIN_PATH, 493);
|
|
2830
|
-
|
|
2831
|
-
|
|
2786
|
+
writeFileSync6(PLUGIN_PKG_PATH, PLUGIN_PACKAGE_JSON, "utf-8");
|
|
2787
|
+
writeFileSync6(
|
|
2832
2788
|
PLUGIN_SETTINGS_PATH,
|
|
2833
2789
|
JSON.stringify({
|
|
2834
2790
|
fastMode: true,
|
|
@@ -2840,7 +2796,7 @@ function writePluginFiles() {
|
|
|
2840
2796
|
}, null, 2) + "\n",
|
|
2841
2797
|
"utf-8"
|
|
2842
2798
|
);
|
|
2843
|
-
|
|
2799
|
+
writeFileSync6(RUN_SCRIPT_PATH, RUN_SCRIPT_SOURCE, "utf-8");
|
|
2844
2800
|
chmodSync(RUN_SCRIPT_PATH, 493);
|
|
2845
2801
|
}
|
|
2846
2802
|
function runBunInstall() {
|
|
@@ -2856,10 +2812,10 @@ function runBunInstall() {
|
|
|
2856
2812
|
}
|
|
2857
2813
|
}
|
|
2858
2814
|
function safelyMutateClaudeJson(mutator) {
|
|
2859
|
-
if (!
|
|
2815
|
+
if (!existsSync9(CLAUDE_JSON_PATH)) {
|
|
2860
2816
|
return;
|
|
2861
2817
|
}
|
|
2862
|
-
const originalText =
|
|
2818
|
+
const originalText = readFileSync7(CLAUDE_JSON_PATH, "utf-8");
|
|
2863
2819
|
let parsed;
|
|
2864
2820
|
try {
|
|
2865
2821
|
parsed = JSON.parse(originalText);
|
|
@@ -2891,7 +2847,7 @@ function safelyMutateClaudeJson(mutator) {
|
|
|
2891
2847
|
copyFileSync(CLAUDE_JSON_PATH, CLAUDE_JSON_BACKUP_PATH);
|
|
2892
2848
|
const tmpPath = `${CLAUDE_JSON_PATH}.synkro-tmp.${process.pid}`;
|
|
2893
2849
|
try {
|
|
2894
|
-
|
|
2850
|
+
writeFileSync6(tmpPath, newText, "utf-8");
|
|
2895
2851
|
const fd = openSync(tmpPath, "r");
|
|
2896
2852
|
try {
|
|
2897
2853
|
fsyncSync(fd);
|
|
@@ -2923,7 +2879,7 @@ function writeProjectMcpJson() {
|
|
|
2923
2879
|
}
|
|
2924
2880
|
}
|
|
2925
2881
|
};
|
|
2926
|
-
|
|
2882
|
+
writeFileSync6(PROJECT_MCP_PATH, JSON.stringify(mcp, null, 2) + "\n", "utf-8");
|
|
2927
2883
|
}
|
|
2928
2884
|
function patchClaudeJson() {
|
|
2929
2885
|
safelyMutateClaudeJson((parsed) => {
|
|
@@ -2996,15 +2952,15 @@ var init_install = __esm({
|
|
|
2996
2952
|
"cli/local-cc/install.ts"() {
|
|
2997
2953
|
"use strict";
|
|
2998
2954
|
init_channelSource();
|
|
2999
|
-
CLAUDE_JSON_BACKUP_PATH =
|
|
3000
|
-
SESSION_DIR =
|
|
3001
|
-
PLUGIN_PATH =
|
|
3002
|
-
PLUGIN_PKG_PATH =
|
|
3003
|
-
PLUGIN_SETTINGS_DIR =
|
|
3004
|
-
PLUGIN_SETTINGS_PATH =
|
|
3005
|
-
PROJECT_MCP_PATH =
|
|
3006
|
-
CLAUDE_JSON_PATH =
|
|
3007
|
-
RUN_SCRIPT_PATH =
|
|
2955
|
+
CLAUDE_JSON_BACKUP_PATH = join7(homedir6(), ".claude.json.synkro-bak");
|
|
2956
|
+
SESSION_DIR = join7(homedir6(), ".synkro", "cc_sessions");
|
|
2957
|
+
PLUGIN_PATH = join7(SESSION_DIR, "synkro-channel.ts");
|
|
2958
|
+
PLUGIN_PKG_PATH = join7(SESSION_DIR, "package.json");
|
|
2959
|
+
PLUGIN_SETTINGS_DIR = join7(SESSION_DIR, ".claude");
|
|
2960
|
+
PLUGIN_SETTINGS_PATH = join7(PLUGIN_SETTINGS_DIR, "settings.json");
|
|
2961
|
+
PROJECT_MCP_PATH = join7(SESSION_DIR, ".mcp.json");
|
|
2962
|
+
CLAUDE_JSON_PATH = join7(homedir6(), ".claude.json");
|
|
2963
|
+
RUN_SCRIPT_PATH = join7(SESSION_DIR, "run-claude.sh");
|
|
3008
2964
|
TMUX_SESSION_NAME = "synkro-local-cc";
|
|
3009
2965
|
RUN_SCRIPT_SOURCE = `#!/usr/bin/env bash
|
|
3010
2966
|
# Auto-generated by \`synkro install\`. Do not edit.
|
|
@@ -3056,8 +3012,8 @@ done
|
|
|
3056
3012
|
|
|
3057
3013
|
// cli/local-cc/pueue.ts
|
|
3058
3014
|
import { execFileSync, spawnSync as spawnSync2, spawn } from "child_process";
|
|
3059
|
-
import { homedir as
|
|
3060
|
-
import { join as
|
|
3015
|
+
import { homedir as homedir7 } from "os";
|
|
3016
|
+
import { join as join8 } from "path";
|
|
3061
3017
|
import { connect } from "net";
|
|
3062
3018
|
function pueueAvailable() {
|
|
3063
3019
|
const r = spawnSync2("pueue", ["--version"], { encoding: "utf-8" });
|
|
@@ -3112,7 +3068,7 @@ function startTask(opts = {}) {
|
|
|
3112
3068
|
if (existing) {
|
|
3113
3069
|
spawnSync2("pueue", ["remove", String(existing.id)], { encoding: "utf-8" });
|
|
3114
3070
|
}
|
|
3115
|
-
const runScript =
|
|
3071
|
+
const runScript = join8(cwd, "run-claude.sh");
|
|
3116
3072
|
const args2 = [
|
|
3117
3073
|
"add",
|
|
3118
3074
|
"--label",
|
|
@@ -3230,7 +3186,7 @@ var init_pueue = __esm({
|
|
|
3230
3186
|
"use strict";
|
|
3231
3187
|
TASK_LABEL = "synkro-local-cc";
|
|
3232
3188
|
TMUX_SESSION = "synkro-local-cc";
|
|
3233
|
-
SESSION_DIR2 =
|
|
3189
|
+
SESSION_DIR2 = join8(homedir7(), ".synkro", "cc_sessions");
|
|
3234
3190
|
PueueError = class extends Error {
|
|
3235
3191
|
constructor(message, cause) {
|
|
3236
3192
|
super(message);
|
|
@@ -3243,14 +3199,14 @@ var init_pueue = __esm({
|
|
|
3243
3199
|
});
|
|
3244
3200
|
|
|
3245
3201
|
// cli/local-cc/prompts.ts
|
|
3246
|
-
import { readFileSync as
|
|
3247
|
-
import { homedir as
|
|
3248
|
-
import { join as
|
|
3202
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
3203
|
+
import { homedir as homedir8 } from "os";
|
|
3204
|
+
import { join as join9 } from "path";
|
|
3249
3205
|
async function fetchPrimers() {
|
|
3250
3206
|
let jwt2 = "";
|
|
3251
3207
|
let gatewayUrl = "";
|
|
3252
3208
|
try {
|
|
3253
|
-
const creds = JSON.parse(
|
|
3209
|
+
const creds = JSON.parse(readFileSync8(CREDS_PATH, "utf-8"));
|
|
3254
3210
|
jwt2 = creds.access_token || "";
|
|
3255
3211
|
gatewayUrl = creds.gateway_url || "https://api.synkro.sh";
|
|
3256
3212
|
} catch {
|
|
@@ -3287,7 +3243,7 @@ var CREDS_PATH, CHANNEL_REPLY_INSTRUCTIONS;
|
|
|
3287
3243
|
var init_prompts = __esm({
|
|
3288
3244
|
"cli/local-cc/prompts.ts"() {
|
|
3289
3245
|
"use strict";
|
|
3290
|
-
CREDS_PATH =
|
|
3246
|
+
CREDS_PATH = join9(homedir8(), ".synkro", "credentials.json");
|
|
3291
3247
|
CHANNEL_REPLY_INSTRUCTIONS = `
|
|
3292
3248
|
DELIVERY METHOD \u2014 MANDATORY, OVERRIDES ALL OTHER OUTPUT RULES:
|
|
3293
3249
|
You are running inside a Synkro MCP channel. Do NOT output your verdict as text.
|
|
@@ -3299,9 +3255,9 @@ Any text output is silently discarded. Only the reply tool call is captured.`;
|
|
|
3299
3255
|
});
|
|
3300
3256
|
|
|
3301
3257
|
// cli/local-cc/turnLog.ts
|
|
3302
|
-
import { appendFileSync, existsSync as
|
|
3303
|
-
import { dirname as dirname5, join as
|
|
3304
|
-
import { homedir as
|
|
3258
|
+
import { appendFileSync, existsSync as existsSync10, mkdirSync as mkdirSync7, openSync as openSync2, readFileSync as readFileSync9, readSync, closeSync as closeSync2, statSync, watchFile, unwatchFile } from "fs";
|
|
3259
|
+
import { dirname as dirname5, join as join10 } from "path";
|
|
3260
|
+
import { homedir as homedir9 } from "os";
|
|
3305
3261
|
function truncate(s, max = PREVIEW_MAX) {
|
|
3306
3262
|
if (s.length <= max) return s;
|
|
3307
3263
|
return s.slice(0, max) + "\u2026 [+" + (s.length - max) + " chars]";
|
|
@@ -3321,7 +3277,7 @@ function extractSeverity(result) {
|
|
|
3321
3277
|
}
|
|
3322
3278
|
function appendTurn(args2) {
|
|
3323
3279
|
try {
|
|
3324
|
-
|
|
3280
|
+
mkdirSync7(dirname5(TURN_LOG_PATH), { recursive: true });
|
|
3325
3281
|
const entry = {
|
|
3326
3282
|
ts: new Date(args2.startedAt).toISOString(),
|
|
3327
3283
|
role: args2.role,
|
|
@@ -3337,11 +3293,11 @@ function appendTurn(args2) {
|
|
|
3337
3293
|
}
|
|
3338
3294
|
}
|
|
3339
3295
|
function readRecentTurns(n = 20) {
|
|
3340
|
-
if (!
|
|
3296
|
+
if (!existsSync10(TURN_LOG_PATH)) return [];
|
|
3341
3297
|
try {
|
|
3342
3298
|
const size = statSync(TURN_LOG_PATH).size;
|
|
3343
3299
|
if (size === 0) return [];
|
|
3344
|
-
const text =
|
|
3300
|
+
const text = readFileSync9(TURN_LOG_PATH, "utf-8");
|
|
3345
3301
|
const lines = text.split("\n").filter(Boolean);
|
|
3346
3302
|
const lastN = lines.slice(-n).reverse();
|
|
3347
3303
|
return lastN.map((line) => {
|
|
@@ -3357,8 +3313,8 @@ function readRecentTurns(n = 20) {
|
|
|
3357
3313
|
}
|
|
3358
3314
|
function followTurns(onEntry) {
|
|
3359
3315
|
try {
|
|
3360
|
-
|
|
3361
|
-
if (!
|
|
3316
|
+
mkdirSync7(dirname5(TURN_LOG_PATH), { recursive: true });
|
|
3317
|
+
if (!existsSync10(TURN_LOG_PATH)) {
|
|
3362
3318
|
appendFileSync(TURN_LOG_PATH, "", "utf-8");
|
|
3363
3319
|
}
|
|
3364
3320
|
} catch {
|
|
@@ -3420,7 +3376,7 @@ var TURN_LOG_PATH, PREVIEW_MAX;
|
|
|
3420
3376
|
var init_turnLog = __esm({
|
|
3421
3377
|
"cli/local-cc/turnLog.ts"() {
|
|
3422
3378
|
"use strict";
|
|
3423
|
-
TURN_LOG_PATH =
|
|
3379
|
+
TURN_LOG_PATH = join10(homedir9(), ".synkro", "cc_sessions", "turns.log");
|
|
3424
3380
|
PREVIEW_MAX = 400;
|
|
3425
3381
|
}
|
|
3426
3382
|
});
|
|
@@ -3526,9 +3482,9 @@ __export(install_exports, {
|
|
|
3526
3482
|
installCommand: () => installCommand,
|
|
3527
3483
|
parseArgs: () => parseArgs
|
|
3528
3484
|
});
|
|
3529
|
-
import { existsSync as
|
|
3530
|
-
import { homedir as
|
|
3531
|
-
import { join as
|
|
3485
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync8, writeFileSync as writeFileSync7, chmodSync as chmodSync2, readFileSync as readFileSync10, readdirSync } from "fs";
|
|
3486
|
+
import { homedir as homedir10 } from "os";
|
|
3487
|
+
import { join as join11 } from "path";
|
|
3532
3488
|
import { execSync as execSync5 } from "child_process";
|
|
3533
3489
|
import { createInterface as createInterface3 } from "readline";
|
|
3534
3490
|
function sanitizeGatewayCandidate(raw) {
|
|
@@ -3565,36 +3521,36 @@ async function promptTranscriptConsent() {
|
|
|
3565
3521
|
});
|
|
3566
3522
|
}
|
|
3567
3523
|
function ensureSynkroDir() {
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3524
|
+
mkdirSync8(SYNKRO_DIR2, { recursive: true });
|
|
3525
|
+
mkdirSync8(HOOKS_DIR, { recursive: true });
|
|
3526
|
+
mkdirSync8(BIN_DIR, { recursive: true });
|
|
3527
|
+
mkdirSync8(OFFSETS_DIR, { recursive: true });
|
|
3572
3528
|
}
|
|
3573
3529
|
function writeHookScripts() {
|
|
3574
|
-
const bashScriptPath =
|
|
3575
|
-
const bashFollowupScriptPath =
|
|
3576
|
-
const editCaptureScriptPath =
|
|
3577
|
-
const editPrecheckScriptPath =
|
|
3578
|
-
const stopSummaryScriptPath =
|
|
3579
|
-
const sessionStartScriptPath =
|
|
3580
|
-
const transcriptSyncScriptPath =
|
|
3581
|
-
const commonScriptPath =
|
|
3582
|
-
const cursorBashJudgePath =
|
|
3583
|
-
const cursorEditPrecheckPath =
|
|
3584
|
-
const cursorEditCapturePath =
|
|
3585
|
-
const cursorBashFollowupPath =
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3530
|
+
const bashScriptPath = join11(HOOKS_DIR, "cc-bash-judge.sh");
|
|
3531
|
+
const bashFollowupScriptPath = join11(HOOKS_DIR, "cc-bash-followup.sh");
|
|
3532
|
+
const editCaptureScriptPath = join11(HOOKS_DIR, "cc-edit-capture.sh");
|
|
3533
|
+
const editPrecheckScriptPath = join11(HOOKS_DIR, "cc-edit-precheck.sh");
|
|
3534
|
+
const stopSummaryScriptPath = join11(HOOKS_DIR, "cc-stop-summary.sh");
|
|
3535
|
+
const sessionStartScriptPath = join11(HOOKS_DIR, "cc-session-start.sh");
|
|
3536
|
+
const transcriptSyncScriptPath = join11(HOOKS_DIR, "cc-transcript-sync.sh");
|
|
3537
|
+
const commonScriptPath = join11(HOOKS_DIR, "_synkro-common.sh");
|
|
3538
|
+
const cursorBashJudgePath = join11(HOOKS_DIR, "cursor-bash-judge.sh");
|
|
3539
|
+
const cursorEditPrecheckPath = join11(HOOKS_DIR, "cursor-edit-precheck.sh");
|
|
3540
|
+
const cursorEditCapturePath = join11(HOOKS_DIR, "cursor-edit-capture.sh");
|
|
3541
|
+
const cursorBashFollowupPath = join11(HOOKS_DIR, "cursor-bash-followup.sh");
|
|
3542
|
+
writeFileSync7(bashScriptPath, CC_BASH_JUDGE_SCRIPT, "utf-8");
|
|
3543
|
+
writeFileSync7(bashFollowupScriptPath, CC_BASH_FOLLOWUP_SCRIPT, "utf-8");
|
|
3544
|
+
writeFileSync7(editCaptureScriptPath, CC_EDIT_CAPTURE_SCRIPT, "utf-8");
|
|
3545
|
+
writeFileSync7(editPrecheckScriptPath, CC_EDIT_PRECHECK_SCRIPT, "utf-8");
|
|
3546
|
+
writeFileSync7(stopSummaryScriptPath, CC_STOP_SUMMARY_SCRIPT, "utf-8");
|
|
3547
|
+
writeFileSync7(sessionStartScriptPath, CC_SESSION_START_SCRIPT, "utf-8");
|
|
3548
|
+
writeFileSync7(transcriptSyncScriptPath, CC_TRANSCRIPT_SYNC_SCRIPT, "utf-8");
|
|
3549
|
+
writeFileSync7(commonScriptPath, SYNKRO_COMMON_SCRIPT, "utf-8");
|
|
3550
|
+
writeFileSync7(cursorBashJudgePath, CURSOR_BASH_JUDGE_SCRIPT, "utf-8");
|
|
3551
|
+
writeFileSync7(cursorEditPrecheckPath, CURSOR_EDIT_PRECHECK_SCRIPT, "utf-8");
|
|
3552
|
+
writeFileSync7(cursorEditCapturePath, CURSOR_EDIT_CAPTURE_SCRIPT, "utf-8");
|
|
3553
|
+
writeFileSync7(cursorBashFollowupPath, CURSOR_BASH_FOLLOWUP_SCRIPT, "utf-8");
|
|
3598
3554
|
chmodSync2(bashScriptPath, 493);
|
|
3599
3555
|
chmodSync2(bashFollowupScriptPath, 493);
|
|
3600
3556
|
chmodSync2(editCaptureScriptPath, 493);
|
|
@@ -3630,11 +3586,11 @@ function shellQuoteSingle(value) {
|
|
|
3630
3586
|
}
|
|
3631
3587
|
function resolveSynkroBundle() {
|
|
3632
3588
|
const scriptPath = process.argv[1];
|
|
3633
|
-
if (scriptPath &&
|
|
3589
|
+
if (scriptPath && existsSync11(scriptPath)) return scriptPath;
|
|
3634
3590
|
return null;
|
|
3635
3591
|
}
|
|
3636
3592
|
function writeConfigEnv(opts) {
|
|
3637
|
-
const credsPath =
|
|
3593
|
+
const credsPath = join11(SYNKRO_DIR2, "credentials.json");
|
|
3638
3594
|
const safeGateway = sanitizeConfigValue(opts.gatewayUrl);
|
|
3639
3595
|
const safeUserId = sanitizeConfigValue(opts.userId);
|
|
3640
3596
|
const safeOrgId = sanitizeConfigValue(opts.orgId);
|
|
@@ -3650,7 +3606,7 @@ function writeConfigEnv(opts) {
|
|
|
3650
3606
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
3651
3607
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
3652
3608
|
`SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
|
|
3653
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.4.
|
|
3609
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.4.22")}`
|
|
3654
3610
|
];
|
|
3655
3611
|
if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
|
|
3656
3612
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
@@ -3661,12 +3617,12 @@ function writeConfigEnv(opts) {
|
|
|
3661
3617
|
}
|
|
3662
3618
|
lines.push(`SYNKRO_LOCAL_INFERENCE=${shellQuoteSingle(opts.localInference ? "yes" : "no")}`);
|
|
3663
3619
|
lines.push("");
|
|
3664
|
-
|
|
3620
|
+
writeFileSync7(CONFIG_PATH3, lines.join("\n"), "utf-8");
|
|
3665
3621
|
chmodSync2(CONFIG_PATH3, 384);
|
|
3666
3622
|
}
|
|
3667
3623
|
function updateLocalInferenceFlag(enabled) {
|
|
3668
|
-
if (!
|
|
3669
|
-
let content =
|
|
3624
|
+
if (!existsSync11(CONFIG_PATH3)) return;
|
|
3625
|
+
let content = readFileSync10(CONFIG_PATH3, "utf-8");
|
|
3670
3626
|
const flag = enabled ? "yes" : "no";
|
|
3671
3627
|
if (content.includes("SYNKRO_LOCAL_INFERENCE=")) {
|
|
3672
3628
|
content = content.replace(/^SYNKRO_LOCAL_INFERENCE='[^']*'/m, `SYNKRO_LOCAL_INFERENCE='${flag}'`);
|
|
@@ -3675,7 +3631,7 @@ function updateLocalInferenceFlag(enabled) {
|
|
|
3675
3631
|
SYNKRO_LOCAL_INFERENCE='${flag}'
|
|
3676
3632
|
`;
|
|
3677
3633
|
}
|
|
3678
|
-
|
|
3634
|
+
writeFileSync7(CONFIG_PATH3, content, "utf-8");
|
|
3679
3635
|
}
|
|
3680
3636
|
function collectLocalMetadata() {
|
|
3681
3637
|
const meta = { platform: process.platform };
|
|
@@ -3695,16 +3651,16 @@ function collectLocalMetadata() {
|
|
|
3695
3651
|
meta.cc_version = execSync5("claude --version", { encoding: "utf-8", timeout: 5e3 }).trim().split("\n")[0];
|
|
3696
3652
|
} catch {
|
|
3697
3653
|
}
|
|
3698
|
-
const claudeDir =
|
|
3654
|
+
const claudeDir = join11(homedir10(), ".claude");
|
|
3699
3655
|
try {
|
|
3700
|
-
const settings = JSON.parse(
|
|
3656
|
+
const settings = JSON.parse(readFileSync10(join11(claudeDir, "settings.json"), "utf-8"));
|
|
3701
3657
|
const plugins = Object.keys(settings.enabledPlugins ?? {}).filter((k) => settings.enabledPlugins[k]);
|
|
3702
3658
|
if (plugins.length) meta.enabled_plugins = plugins;
|
|
3703
3659
|
if (settings.permissions?.defaultMode) meta.permissions_mode = settings.permissions.defaultMode;
|
|
3704
3660
|
} catch {
|
|
3705
3661
|
}
|
|
3706
3662
|
try {
|
|
3707
|
-
const mcpCache = JSON.parse(
|
|
3663
|
+
const mcpCache = JSON.parse(readFileSync10(join11(claudeDir, "mcp-needs-auth-cache.json"), "utf-8"));
|
|
3708
3664
|
const mcpNames = Object.keys(mcpCache);
|
|
3709
3665
|
if (mcpNames.length) meta.mcp_servers = mcpNames;
|
|
3710
3666
|
} catch {
|
|
@@ -3716,10 +3672,10 @@ function collectLocalMetadata() {
|
|
|
3716
3672
|
} catch {
|
|
3717
3673
|
}
|
|
3718
3674
|
try {
|
|
3719
|
-
const sessionsDir =
|
|
3675
|
+
const sessionsDir = join11(claudeDir, "sessions");
|
|
3720
3676
|
const files = readdirSync(sessionsDir).filter((f) => f.endsWith(".json")).slice(-5);
|
|
3721
3677
|
for (const f of files) {
|
|
3722
|
-
const s = JSON.parse(
|
|
3678
|
+
const s = JSON.parse(readFileSync10(join11(sessionsDir, f), "utf-8"));
|
|
3723
3679
|
if (s.version) {
|
|
3724
3680
|
meta.cc_version = meta.cc_version || s.version;
|
|
3725
3681
|
break;
|
|
@@ -3775,19 +3731,19 @@ function assertGatewayAllowed(gatewayUrl) {
|
|
|
3775
3731
|
}
|
|
3776
3732
|
function isAlreadyInstalled() {
|
|
3777
3733
|
const requiredScripts = [
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3734
|
+
join11(HOOKS_DIR, "cc-bash-judge.sh"),
|
|
3735
|
+
join11(HOOKS_DIR, "cc-bash-followup.sh"),
|
|
3736
|
+
join11(HOOKS_DIR, "cc-edit-precheck.sh"),
|
|
3737
|
+
join11(HOOKS_DIR, "cc-edit-capture.sh"),
|
|
3738
|
+
join11(HOOKS_DIR, "cc-stop-summary.sh"),
|
|
3739
|
+
join11(HOOKS_DIR, "cc-session-start.sh")
|
|
3784
3740
|
];
|
|
3785
|
-
if (!requiredScripts.every((p) =>
|
|
3786
|
-
if (!
|
|
3787
|
-
const settingsPath =
|
|
3788
|
-
if (!
|
|
3741
|
+
if (!requiredScripts.every((p) => existsSync11(p))) return false;
|
|
3742
|
+
if (!existsSync11(CONFIG_PATH3)) return false;
|
|
3743
|
+
const settingsPath = join11(homedir10(), ".claude", "settings.json");
|
|
3744
|
+
if (!existsSync11(settingsPath)) return false;
|
|
3789
3745
|
try {
|
|
3790
|
-
const settings = JSON.parse(
|
|
3746
|
+
const settings = JSON.parse(readFileSync10(settingsPath, "utf-8"));
|
|
3791
3747
|
const hooks = settings?.hooks;
|
|
3792
3748
|
if (!hooks || typeof hooks !== "object") return false;
|
|
3793
3749
|
const hasManaged = (kind) => Array.isArray(hooks[kind]) && hooks[kind].some((entry) => entry?.__synkro_managed__ === true);
|
|
@@ -3918,9 +3874,9 @@ async function installCommand(opts = {}) {
|
|
|
3918
3874
|
console.log(` ${scripts.transcriptSyncScript}
|
|
3919
3875
|
`);
|
|
3920
3876
|
for (const mode of ["edit", "bash"]) {
|
|
3921
|
-
const pidFile =
|
|
3877
|
+
const pidFile = join11(SYNKRO_DIR2, "daemon", mode, "daemon.pid");
|
|
3922
3878
|
try {
|
|
3923
|
-
const pid = parseInt(
|
|
3879
|
+
const pid = parseInt(readFileSync10(pidFile, "utf-8").trim(), 10);
|
|
3924
3880
|
if (pid > 0) {
|
|
3925
3881
|
process.kill(pid, "SIGTERM");
|
|
3926
3882
|
console.log(`Stopped stale ${mode} grader daemon (pid ${pid})`);
|
|
@@ -4012,7 +3968,7 @@ async function installCommand(opts = {}) {
|
|
|
4012
3968
|
else console.warn(" \u26A0 Could not resolve synkro bundle path; hooks will fall back to PATH lookup of `synkro`.");
|
|
4013
3969
|
try {
|
|
4014
3970
|
const prompts = await fetchJudgePrompts({ gatewayUrl, jwt: token });
|
|
4015
|
-
console.log(` prompts: ${prompts.version} (
|
|
3971
|
+
console.log(` prompts: ${prompts.version} (live)`);
|
|
4016
3972
|
} catch (err) {
|
|
4017
3973
|
console.warn(` \u26A0 Could not cache judge prompts: ${err.message}`);
|
|
4018
3974
|
}
|
|
@@ -4092,17 +4048,17 @@ function detectGitRepo2() {
|
|
|
4092
4048
|
function getClaudeProjectsFolder() {
|
|
4093
4049
|
const cwd = process.cwd();
|
|
4094
4050
|
const sanitized = "-" + cwd.replace(/\//g, "-");
|
|
4095
|
-
const projectsDir =
|
|
4096
|
-
return
|
|
4051
|
+
const projectsDir = join11(homedir10(), ".claude", "projects", sanitized);
|
|
4052
|
+
return existsSync11(projectsDir) ? projectsDir : null;
|
|
4097
4053
|
}
|
|
4098
4054
|
function extractSessionInsights(projectsDir) {
|
|
4099
4055
|
const insights = [];
|
|
4100
4056
|
const files = readdirSync(projectsDir).filter((f) => f.endsWith(".jsonl"));
|
|
4101
4057
|
for (const file of files) {
|
|
4102
4058
|
const sessionId = file.replace(".jsonl", "");
|
|
4103
|
-
const filePath =
|
|
4059
|
+
const filePath = join11(projectsDir, file);
|
|
4104
4060
|
try {
|
|
4105
|
-
const content =
|
|
4061
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
4106
4062
|
const lines = content.split("\n").filter(Boolean);
|
|
4107
4063
|
for (let i = 0; i < lines.length; i++) {
|
|
4108
4064
|
try {
|
|
@@ -4178,7 +4134,7 @@ function extractTextContent(content) {
|
|
|
4178
4134
|
return "";
|
|
4179
4135
|
}
|
|
4180
4136
|
function parseTranscriptFile(filePath) {
|
|
4181
|
-
const content =
|
|
4137
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
4182
4138
|
const lines = content.split("\n").filter(Boolean);
|
|
4183
4139
|
const messages = [];
|
|
4184
4140
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -4229,7 +4185,7 @@ async function syncTranscriptsBulk(gatewayUrl, token, repo) {
|
|
|
4229
4185
|
const sessions = [];
|
|
4230
4186
|
for (const file of batch) {
|
|
4231
4187
|
const sessionId = file.replace(".jsonl", "");
|
|
4232
|
-
const filePath =
|
|
4188
|
+
const filePath = join11(projectsDir, file);
|
|
4233
4189
|
try {
|
|
4234
4190
|
const allMessages = parseTranscriptFile(filePath);
|
|
4235
4191
|
const messages = allMessages.length > maxMessagesPerSession ? allMessages.slice(-maxMessagesPerSession) : allMessages;
|
|
@@ -4258,11 +4214,11 @@ async function syncTranscriptsBulk(gatewayUrl, token, repo) {
|
|
|
4258
4214
|
}
|
|
4259
4215
|
for (const file of batch) {
|
|
4260
4216
|
const sessionId = file.replace(".jsonl", "");
|
|
4261
|
-
const filePath =
|
|
4217
|
+
const filePath = join11(projectsDir, file);
|
|
4262
4218
|
try {
|
|
4263
|
-
const content =
|
|
4219
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
4264
4220
|
const lineCount = content.split("\n").filter(Boolean).length;
|
|
4265
|
-
|
|
4221
|
+
writeFileSync7(join11(OFFSETS_DIR, sessionId), String(lineCount), "utf-8");
|
|
4266
4222
|
} catch {
|
|
4267
4223
|
}
|
|
4268
4224
|
}
|
|
@@ -4287,11 +4243,11 @@ var init_install2 = __esm({
|
|
|
4287
4243
|
init_install();
|
|
4288
4244
|
init_pueue();
|
|
4289
4245
|
init_client();
|
|
4290
|
-
SYNKRO_DIR2 =
|
|
4291
|
-
HOOKS_DIR =
|
|
4292
|
-
BIN_DIR =
|
|
4293
|
-
CONFIG_PATH3 =
|
|
4294
|
-
OFFSETS_DIR =
|
|
4246
|
+
SYNKRO_DIR2 = join11(homedir10(), ".synkro");
|
|
4247
|
+
HOOKS_DIR = join11(SYNKRO_DIR2, "hooks");
|
|
4248
|
+
BIN_DIR = join11(SYNKRO_DIR2, "bin");
|
|
4249
|
+
CONFIG_PATH3 = join11(SYNKRO_DIR2, "config.env");
|
|
4250
|
+
OFFSETS_DIR = join11(SYNKRO_DIR2, ".transcript-offsets");
|
|
4295
4251
|
}
|
|
4296
4252
|
});
|
|
4297
4253
|
|
|
@@ -4367,13 +4323,13 @@ var status_exports = {};
|
|
|
4367
4323
|
__export(status_exports, {
|
|
4368
4324
|
statusCommand: () => statusCommand
|
|
4369
4325
|
});
|
|
4370
|
-
import { existsSync as
|
|
4371
|
-
import { homedir as
|
|
4372
|
-
import { join as
|
|
4326
|
+
import { existsSync as existsSync12, readFileSync as readFileSync11 } from "fs";
|
|
4327
|
+
import { homedir as homedir11 } from "os";
|
|
4328
|
+
import { join as join12 } from "path";
|
|
4373
4329
|
function readConfigEnv() {
|
|
4374
|
-
if (!
|
|
4330
|
+
if (!existsSync12(CONFIG_PATH4)) return {};
|
|
4375
4331
|
const out = {};
|
|
4376
|
-
const raw =
|
|
4332
|
+
const raw = readFileSync11(CONFIG_PATH4, "utf-8");
|
|
4377
4333
|
for (const line of raw.split("\n")) {
|
|
4378
4334
|
const trimmed = line.trim();
|
|
4379
4335
|
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
@@ -4455,29 +4411,29 @@ async function statusCommand() {
|
|
|
4455
4411
|
}
|
|
4456
4412
|
}
|
|
4457
4413
|
console.log();
|
|
4458
|
-
const bashScript =
|
|
4459
|
-
const bashFollowupScript =
|
|
4460
|
-
const editPrecheckScript =
|
|
4461
|
-
const editCaptureScript =
|
|
4462
|
-
const stopSummaryScript =
|
|
4463
|
-
const sessionStartScript =
|
|
4464
|
-
const cursorBashJudgeScript =
|
|
4465
|
-
const cursorEditPrecheckScript =
|
|
4466
|
-
const cursorEditCaptureScript =
|
|
4467
|
-
const cursorBashFollowupScript =
|
|
4468
|
-
const commonScript =
|
|
4414
|
+
const bashScript = join12(SYNKRO_DIR3, "hooks", "cc-bash-judge.sh");
|
|
4415
|
+
const bashFollowupScript = join12(SYNKRO_DIR3, "hooks", "cc-bash-followup.sh");
|
|
4416
|
+
const editPrecheckScript = join12(SYNKRO_DIR3, "hooks", "cc-edit-precheck.sh");
|
|
4417
|
+
const editCaptureScript = join12(SYNKRO_DIR3, "hooks", "cc-edit-capture.sh");
|
|
4418
|
+
const stopSummaryScript = join12(SYNKRO_DIR3, "hooks", "cc-stop-summary.sh");
|
|
4419
|
+
const sessionStartScript = join12(SYNKRO_DIR3, "hooks", "cc-session-start.sh");
|
|
4420
|
+
const cursorBashJudgeScript = join12(SYNKRO_DIR3, "hooks", "cursor-bash-judge.sh");
|
|
4421
|
+
const cursorEditPrecheckScript = join12(SYNKRO_DIR3, "hooks", "cursor-edit-precheck.sh");
|
|
4422
|
+
const cursorEditCaptureScript = join12(SYNKRO_DIR3, "hooks", "cursor-edit-capture.sh");
|
|
4423
|
+
const cursorBashFollowupScript = join12(SYNKRO_DIR3, "hooks", "cursor-bash-followup.sh");
|
|
4424
|
+
const commonScript = join12(SYNKRO_DIR3, "hooks", "_synkro-common.sh");
|
|
4469
4425
|
console.log("Hook scripts:");
|
|
4470
|
-
console.log(` ${
|
|
4471
|
-
console.log(` ${
|
|
4472
|
-
console.log(` ${
|
|
4473
|
-
console.log(` ${
|
|
4474
|
-
console.log(` ${
|
|
4475
|
-
console.log(` ${
|
|
4476
|
-
console.log(` ${
|
|
4477
|
-
console.log(` ${
|
|
4478
|
-
console.log(` ${
|
|
4479
|
-
console.log(` ${
|
|
4480
|
-
console.log(` ${
|
|
4426
|
+
console.log(` ${existsSync12(bashScript) ? "\u2713" : "\u2717"} ${bashScript}`);
|
|
4427
|
+
console.log(` ${existsSync12(bashFollowupScript) ? "\u2713" : "\u2717"} ${bashFollowupScript}`);
|
|
4428
|
+
console.log(` ${existsSync12(editPrecheckScript) ? "\u2713" : "\u2717"} ${editPrecheckScript}`);
|
|
4429
|
+
console.log(` ${existsSync12(editCaptureScript) ? "\u2713" : "\u2717"} ${editCaptureScript}`);
|
|
4430
|
+
console.log(` ${existsSync12(stopSummaryScript) ? "\u2713" : "\u2717"} ${stopSummaryScript}`);
|
|
4431
|
+
console.log(` ${existsSync12(sessionStartScript) ? "\u2713" : "\u2717"} ${sessionStartScript}`);
|
|
4432
|
+
console.log(` ${existsSync12(commonScript) ? "\u2713" : "\u2717"} ${commonScript}`);
|
|
4433
|
+
console.log(` ${existsSync12(cursorBashJudgeScript) ? "\u2713" : "\u2717"} ${cursorBashJudgeScript}`);
|
|
4434
|
+
console.log(` ${existsSync12(cursorEditPrecheckScript) ? "\u2713" : "\u2717"} ${cursorEditPrecheckScript}`);
|
|
4435
|
+
console.log(` ${existsSync12(cursorEditCaptureScript) ? "\u2713" : "\u2717"} ${cursorEditCaptureScript}`);
|
|
4436
|
+
console.log(` ${existsSync12(cursorBashFollowupScript) ? "\u2713" : "\u2717"} ${cursorBashFollowupScript}`);
|
|
4481
4437
|
console.log();
|
|
4482
4438
|
const mcp = inspectMcpConfig();
|
|
4483
4439
|
console.log("Guardrails MCP server (Claude Code):");
|
|
@@ -4498,8 +4454,8 @@ var init_status = __esm({
|
|
|
4498
4454
|
init_ccHookConfig();
|
|
4499
4455
|
init_cursorHookConfig();
|
|
4500
4456
|
init_mcpConfig();
|
|
4501
|
-
SYNKRO_DIR3 =
|
|
4502
|
-
CONFIG_PATH4 =
|
|
4457
|
+
SYNKRO_DIR3 = join12(homedir11(), ".synkro");
|
|
4458
|
+
CONFIG_PATH4 = join12(SYNKRO_DIR3, "config.env");
|
|
4503
4459
|
}
|
|
4504
4460
|
});
|
|
4505
4461
|
|
|
@@ -4588,13 +4544,13 @@ var config_exports = {};
|
|
|
4588
4544
|
__export(config_exports, {
|
|
4589
4545
|
configCommand: () => configCommand
|
|
4590
4546
|
});
|
|
4591
|
-
import { readFileSync as
|
|
4592
|
-
import { join as
|
|
4593
|
-
import { homedir as
|
|
4547
|
+
import { readFileSync as readFileSync12, writeFileSync as writeFileSync8, existsSync as existsSync13 } from "fs";
|
|
4548
|
+
import { join as join13 } from "path";
|
|
4549
|
+
import { homedir as homedir12 } from "os";
|
|
4594
4550
|
function readConfigEnv2() {
|
|
4595
|
-
if (!
|
|
4551
|
+
if (!existsSync13(CONFIG_PATH5)) return {};
|
|
4596
4552
|
const out = {};
|
|
4597
|
-
for (const line of
|
|
4553
|
+
for (const line of readFileSync12(CONFIG_PATH5, "utf-8").split("\n")) {
|
|
4598
4554
|
const t = line.trim();
|
|
4599
4555
|
if (!t || t.startsWith("#")) continue;
|
|
4600
4556
|
const eq = t.indexOf("=");
|
|
@@ -4603,11 +4559,11 @@ function readConfigEnv2() {
|
|
|
4603
4559
|
return out;
|
|
4604
4560
|
}
|
|
4605
4561
|
function updateConfigValue(key, value) {
|
|
4606
|
-
if (!
|
|
4562
|
+
if (!existsSync13(CONFIG_PATH5)) {
|
|
4607
4563
|
console.error("No config found. Run `synkro install` first.");
|
|
4608
4564
|
process.exit(1);
|
|
4609
4565
|
}
|
|
4610
|
-
const lines =
|
|
4566
|
+
const lines = readFileSync12(CONFIG_PATH5, "utf-8").split("\n");
|
|
4611
4567
|
const pattern = new RegExp(`^${key}=`);
|
|
4612
4568
|
let found = false;
|
|
4613
4569
|
const updated = lines.map((line) => {
|
|
@@ -4618,7 +4574,7 @@ function updateConfigValue(key, value) {
|
|
|
4618
4574
|
return line;
|
|
4619
4575
|
});
|
|
4620
4576
|
if (!found) updated.splice(updated.length - 1, 0, `${key}='${value}'`);
|
|
4621
|
-
|
|
4577
|
+
writeFileSync8(CONFIG_PATH5, updated.join("\n"), "utf-8");
|
|
4622
4578
|
}
|
|
4623
4579
|
async function configCommand(args2) {
|
|
4624
4580
|
if (args2.length === 0) {
|
|
@@ -4674,8 +4630,8 @@ var init_config = __esm({
|
|
|
4674
4630
|
"cli/commands/config.ts"() {
|
|
4675
4631
|
"use strict";
|
|
4676
4632
|
init_stub();
|
|
4677
|
-
SYNKRO_DIR4 =
|
|
4678
|
-
CONFIG_PATH5 =
|
|
4633
|
+
SYNKRO_DIR4 = join13(homedir12(), ".synkro");
|
|
4634
|
+
CONFIG_PATH5 = join13(SYNKRO_DIR4, "config.env");
|
|
4679
4635
|
}
|
|
4680
4636
|
});
|
|
4681
4637
|
|
|
@@ -4685,8 +4641,8 @@ __export(scanPr_exports, {
|
|
|
4685
4641
|
scanPrCommand: () => scanPrCommand
|
|
4686
4642
|
});
|
|
4687
4643
|
import { execSync as execSync6, spawn as spawn2 } from "child_process";
|
|
4688
|
-
import { readFileSync as
|
|
4689
|
-
import { join as
|
|
4644
|
+
import { readFileSync as readFileSync13, existsSync as existsSync14 } from "fs";
|
|
4645
|
+
import { join as join14 } from "path";
|
|
4690
4646
|
function parseMatchSpec(condition) {
|
|
4691
4647
|
if (!condition.startsWith("match_spec:")) return null;
|
|
4692
4648
|
try {
|
|
@@ -5165,10 +5121,10 @@ function shouldFail(findings, threshold) {
|
|
|
5165
5121
|
return findings.some((f) => order.indexOf(f.severity) >= thresholdIdx);
|
|
5166
5122
|
}
|
|
5167
5123
|
function readRepoDeps() {
|
|
5168
|
-
const pkgPath =
|
|
5169
|
-
if (!
|
|
5124
|
+
const pkgPath = join14(process.cwd(), "package.json");
|
|
5125
|
+
if (!existsSync14(pkgPath)) return {};
|
|
5170
5126
|
try {
|
|
5171
|
-
const pkg = JSON.parse(
|
|
5127
|
+
const pkg = JSON.parse(readFileSync13(pkgPath, "utf-8"));
|
|
5172
5128
|
return { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
5173
5129
|
} catch {
|
|
5174
5130
|
return {};
|
|
@@ -5430,9 +5386,9 @@ var disconnect_exports = {};
|
|
|
5430
5386
|
__export(disconnect_exports, {
|
|
5431
5387
|
disconnectCommand: () => disconnectCommand
|
|
5432
5388
|
});
|
|
5433
|
-
import { existsSync as
|
|
5434
|
-
import { homedir as
|
|
5435
|
-
import { join as
|
|
5389
|
+
import { existsSync as existsSync15, rmSync } from "fs";
|
|
5390
|
+
import { homedir as homedir13 } from "os";
|
|
5391
|
+
import { join as join15 } from "path";
|
|
5436
5392
|
function tearDownLocalCC() {
|
|
5437
5393
|
let hadTask = false;
|
|
5438
5394
|
try {
|
|
@@ -5465,13 +5421,13 @@ function disconnectCommand(args2 = []) {
|
|
|
5465
5421
|
console.log(`${mcpRemoved ? "\u2713" : "\xB7"} MCP guardrails server: ${mcpRemoved ? "removed entry from ~/.claude.json" : "no Synkro MCP entry found"}`);
|
|
5466
5422
|
}
|
|
5467
5423
|
if (purge) {
|
|
5468
|
-
if (
|
|
5424
|
+
if (existsSync15(SYNKRO_DIR5)) {
|
|
5469
5425
|
rmSync(SYNKRO_DIR5, { recursive: true, force: true });
|
|
5470
5426
|
console.log(`\u2713 Removed ${SYNKRO_DIR5}`);
|
|
5471
5427
|
} else {
|
|
5472
5428
|
console.log(`\xB7 ${SYNKRO_DIR5} already gone, nothing to remove`);
|
|
5473
5429
|
}
|
|
5474
|
-
} else if (
|
|
5430
|
+
} else if (existsSync15(SYNKRO_DIR5)) {
|
|
5475
5431
|
console.log(`Config preserved at ${SYNKRO_DIR5}. Run with --purge to remove.`);
|
|
5476
5432
|
}
|
|
5477
5433
|
console.log("\nSynkro disconnected.");
|
|
@@ -5486,7 +5442,7 @@ var init_disconnect = __esm({
|
|
|
5486
5442
|
init_mcpConfig();
|
|
5487
5443
|
init_pueue();
|
|
5488
5444
|
init_install();
|
|
5489
|
-
SYNKRO_DIR5 =
|
|
5445
|
+
SYNKRO_DIR5 = join15(homedir13(), ".synkro");
|
|
5490
5446
|
}
|
|
5491
5447
|
});
|
|
5492
5448
|
|
|
@@ -5533,9 +5489,9 @@ __export(localCc_exports, {
|
|
|
5533
5489
|
localCcCommand: () => localCcCommand
|
|
5534
5490
|
});
|
|
5535
5491
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
5536
|
-
import { homedir as
|
|
5537
|
-
import { join as
|
|
5538
|
-
import { existsSync as
|
|
5492
|
+
import { homedir as homedir14 } from "os";
|
|
5493
|
+
import { join as join16 } from "path";
|
|
5494
|
+
import { existsSync as existsSync16, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
|
|
5539
5495
|
function printHelp() {
|
|
5540
5496
|
console.log(`synkro local-cc \u2014 manage the local Claude Code inference session
|
|
5541
5497
|
|
|
@@ -5625,15 +5581,15 @@ TROUBLESHOOTING
|
|
|
5625
5581
|
`);
|
|
5626
5582
|
}
|
|
5627
5583
|
function readGatewayUrl() {
|
|
5628
|
-
if (
|
|
5629
|
-
const m =
|
|
5584
|
+
if (existsSync16(CONFIG_PATH6)) {
|
|
5585
|
+
const m = readFileSync14(CONFIG_PATH6, "utf-8").match(/^SYNKRO_GATEWAY_URL='([^']*)'/m);
|
|
5630
5586
|
if (m) return m[1];
|
|
5631
5587
|
}
|
|
5632
5588
|
return "https://api.synkro.sh";
|
|
5633
5589
|
}
|
|
5634
5590
|
function updateLocalInferenceFlag2(enabled) {
|
|
5635
|
-
if (!
|
|
5636
|
-
let content =
|
|
5591
|
+
if (!existsSync16(CONFIG_PATH6)) return;
|
|
5592
|
+
let content = readFileSync14(CONFIG_PATH6, "utf-8");
|
|
5637
5593
|
const flag = enabled ? "yes" : "no";
|
|
5638
5594
|
if (content.includes("SYNKRO_LOCAL_INFERENCE=")) {
|
|
5639
5595
|
content = content.replace(/^SYNKRO_LOCAL_INFERENCE='[^']*'/m, `SYNKRO_LOCAL_INFERENCE='${flag}'`);
|
|
@@ -5642,7 +5598,7 @@ function updateLocalInferenceFlag2(enabled) {
|
|
|
5642
5598
|
SYNKRO_LOCAL_INFERENCE='${flag}'
|
|
5643
5599
|
`;
|
|
5644
5600
|
}
|
|
5645
|
-
|
|
5601
|
+
writeFileSync9(CONFIG_PATH6, content, "utf-8");
|
|
5646
5602
|
}
|
|
5647
5603
|
async function setServerGradingProvider(provider) {
|
|
5648
5604
|
await ensureValidToken();
|
|
@@ -5917,7 +5873,7 @@ var init_localCc = __esm({
|
|
|
5917
5873
|
init_settings();
|
|
5918
5874
|
init_client();
|
|
5919
5875
|
init_stub();
|
|
5920
|
-
CONFIG_PATH6 =
|
|
5876
|
+
CONFIG_PATH6 = join16(homedir14(), ".synkro", "config.env");
|
|
5921
5877
|
}
|
|
5922
5878
|
});
|
|
5923
5879
|
|
|
@@ -5969,15 +5925,15 @@ var init_grade = __esm({
|
|
|
5969
5925
|
});
|
|
5970
5926
|
|
|
5971
5927
|
// cli/bootstrap.js
|
|
5972
|
-
import { readFileSync as
|
|
5928
|
+
import { readFileSync as readFileSync15, existsSync as existsSync17 } from "fs";
|
|
5973
5929
|
import { resolve } from "path";
|
|
5974
5930
|
var envCandidates = [
|
|
5975
5931
|
resolve(process.cwd(), ".env"),
|
|
5976
5932
|
resolve(process.env.HOME ?? "", ".synkro", "config.env")
|
|
5977
5933
|
];
|
|
5978
5934
|
for (const envPath of envCandidates) {
|
|
5979
|
-
if (!
|
|
5980
|
-
const envContent =
|
|
5935
|
+
if (!existsSync17(envPath)) continue;
|
|
5936
|
+
const envContent = readFileSync15(envPath, "utf-8");
|
|
5981
5937
|
for (const line of envContent.split("\n")) {
|
|
5982
5938
|
const trimmed = line.trim();
|
|
5983
5939
|
if (!trimmed || trimmed.startsWith("#")) continue;
|