@synkro-sh/cli 1.4.47 → 1.4.49
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 +115 -94
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -1864,11 +1864,10 @@ async function main() {
|
|
|
1864
1864
|
return;
|
|
1865
1865
|
}
|
|
1866
1866
|
|
|
1867
|
-
const proposedShort = proposed.slice(0, 4000);
|
|
1868
1867
|
const graderPrompt = [
|
|
1869
1868
|
'File: ' + filePath,
|
|
1870
|
-
'Content
|
|
1871
|
-
|
|
1869
|
+
'Content:',
|
|
1870
|
+
proposed,
|
|
1872
1871
|
'',
|
|
1873
1872
|
'CWE rules to check against:',
|
|
1874
1873
|
JSON.stringify(cweRules),
|
|
@@ -4465,9 +4464,14 @@ function findTask(channel = CHANNEL_PRIMARY) {
|
|
|
4465
4464
|
function startTask(opts = {}) {
|
|
4466
4465
|
const ch = opts.channel ?? CHANNEL_PRIMARY;
|
|
4467
4466
|
const cwd = opts.cwd ?? ch.sessionDir;
|
|
4468
|
-
|
|
4469
|
-
|
|
4467
|
+
let existing = findTask(ch);
|
|
4468
|
+
while (existing) {
|
|
4469
|
+
if (existing.status === "Running") {
|
|
4470
|
+
spawnSync2("tmux", ["kill-session", "-t", ch.tmuxSession], { encoding: "utf-8" });
|
|
4471
|
+
spawnSync2("pueue", ["kill", String(existing.id)], { encoding: "utf-8" });
|
|
4472
|
+
}
|
|
4470
4473
|
spawnSync2("pueue", ["remove", String(existing.id)], { encoding: "utf-8" });
|
|
4474
|
+
existing = findTask(ch);
|
|
4471
4475
|
}
|
|
4472
4476
|
const runScript = join8(cwd, "run-claude.sh");
|
|
4473
4477
|
const args2 = [
|
|
@@ -4895,7 +4899,7 @@ __export(install_exports, {
|
|
|
4895
4899
|
import { existsSync as existsSync11, mkdirSync as mkdirSync8, writeFileSync as writeFileSync7, chmodSync as chmodSync2, readFileSync as readFileSync10, readdirSync } from "fs";
|
|
4896
4900
|
import { homedir as homedir10 } from "os";
|
|
4897
4901
|
import { join as join11 } from "path";
|
|
4898
|
-
import { execSync as execSync5 } from "child_process";
|
|
4902
|
+
import { execSync as execSync5, spawnSync as spawnSync3 } from "child_process";
|
|
4899
4903
|
import { createInterface as createInterface3 } from "readline";
|
|
4900
4904
|
function sanitizeGatewayCandidate(raw) {
|
|
4901
4905
|
if (!raw) return void 0;
|
|
@@ -4939,7 +4943,6 @@ function ensureSynkroDir() {
|
|
|
4939
4943
|
function writeHookScripts() {
|
|
4940
4944
|
const bashScriptPath = join11(HOOKS_DIR, "cc-bash-judge.ts");
|
|
4941
4945
|
const bashFollowupScriptPath = join11(HOOKS_DIR, "cc-bash-followup.ts");
|
|
4942
|
-
const editCaptureScriptPath = join11(HOOKS_DIR, "cc-edit-capture.sh");
|
|
4943
4946
|
const editPrecheckScriptPath = join11(HOOKS_DIR, "cc-edit-precheck.ts");
|
|
4944
4947
|
const cwePrecheckScriptPath = join11(HOOKS_DIR, "cc-cwe-precheck.ts");
|
|
4945
4948
|
const cvePrecheckScriptPath = join11(HOOKS_DIR, "cc-cve-precheck.ts");
|
|
@@ -4956,7 +4959,6 @@ function writeHookScripts() {
|
|
|
4956
4959
|
const cursorBashFollowupPath = join11(HOOKS_DIR, "cursor-bash-followup.sh");
|
|
4957
4960
|
writeFileSync7(bashScriptPath, BASH_JUDGE_TS, "utf-8");
|
|
4958
4961
|
writeFileSync7(bashFollowupScriptPath, BASH_FOLLOWUP_TS, "utf-8");
|
|
4959
|
-
writeFileSync7(editCaptureScriptPath, "", "utf-8");
|
|
4960
4962
|
writeFileSync7(editPrecheckScriptPath, EDIT_PRECHECK_TS, "utf-8");
|
|
4961
4963
|
writeFileSync7(cwePrecheckScriptPath, CWE_PRECHECK_TS, "utf-8");
|
|
4962
4964
|
writeFileSync7(cvePrecheckScriptPath, CVE_PRECHECK_TS, "utf-8");
|
|
@@ -4973,7 +4975,6 @@ function writeHookScripts() {
|
|
|
4973
4975
|
writeFileSync7(cursorBashFollowupPath, CURSOR_BASH_FOLLOWUP_SCRIPT, "utf-8");
|
|
4974
4976
|
chmodSync2(bashScriptPath, 493);
|
|
4975
4977
|
chmodSync2(bashFollowupScriptPath, 493);
|
|
4976
|
-
chmodSync2(editCaptureScriptPath, 493);
|
|
4977
4978
|
chmodSync2(editPrecheckScriptPath, 493);
|
|
4978
4979
|
chmodSync2(cwePrecheckScriptPath, 493);
|
|
4979
4980
|
chmodSync2(cvePrecheckScriptPath, 493);
|
|
@@ -4991,7 +4992,6 @@ function writeHookScripts() {
|
|
|
4991
4992
|
return {
|
|
4992
4993
|
bashScript: bashScriptPath,
|
|
4993
4994
|
bashFollowupScript: bashFollowupScriptPath,
|
|
4994
|
-
editCaptureScript: editCaptureScriptPath,
|
|
4995
4995
|
editPrecheckScript: editPrecheckScriptPath,
|
|
4996
4996
|
cwePrecheckScript: cwePrecheckScriptPath,
|
|
4997
4997
|
cvePrecheckScript: cvePrecheckScriptPath,
|
|
@@ -5035,7 +5035,7 @@ function writeConfigEnv(opts) {
|
|
|
5035
5035
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
5036
5036
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
5037
5037
|
`SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
|
|
5038
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.4.
|
|
5038
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.4.49")}`
|
|
5039
5039
|
];
|
|
5040
5040
|
if (safeSynkroBin) lines.push(`SYNKRO_CLI_BIN=${shellQuoteSingle(safeSynkroBin)}`);
|
|
5041
5041
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
@@ -5160,13 +5160,14 @@ function assertGatewayAllowed(gatewayUrl) {
|
|
|
5160
5160
|
}
|
|
5161
5161
|
function isAlreadyInstalled() {
|
|
5162
5162
|
const requiredScripts = [
|
|
5163
|
-
join11(HOOKS_DIR, "cc-bash-judge.
|
|
5164
|
-
join11(HOOKS_DIR, "cc-bash-followup.
|
|
5165
|
-
join11(HOOKS_DIR, "cc-edit-precheck.
|
|
5166
|
-
join11(HOOKS_DIR, "cc-
|
|
5167
|
-
join11(HOOKS_DIR, "cc-
|
|
5168
|
-
join11(HOOKS_DIR, "cc-
|
|
5169
|
-
join11(HOOKS_DIR, "cc-
|
|
5163
|
+
join11(HOOKS_DIR, "cc-bash-judge.ts"),
|
|
5164
|
+
join11(HOOKS_DIR, "cc-bash-followup.ts"),
|
|
5165
|
+
join11(HOOKS_DIR, "cc-edit-precheck.ts"),
|
|
5166
|
+
join11(HOOKS_DIR, "cc-cwe-precheck.ts"),
|
|
5167
|
+
join11(HOOKS_DIR, "cc-cve-precheck.ts"),
|
|
5168
|
+
join11(HOOKS_DIR, "cc-plan-judge.ts"),
|
|
5169
|
+
join11(HOOKS_DIR, "cc-stop-summary.ts"),
|
|
5170
|
+
join11(HOOKS_DIR, "cc-session-start.ts")
|
|
5170
5171
|
];
|
|
5171
5172
|
if (!requiredScripts.every((p) => existsSync11(p))) return false;
|
|
5172
5173
|
if (!existsSync11(CONFIG_PATH3)) return false;
|
|
@@ -5186,6 +5187,35 @@ function isAlreadyInstalled() {
|
|
|
5186
5187
|
}
|
|
5187
5188
|
return true;
|
|
5188
5189
|
}
|
|
5190
|
+
function printChannelDiagnostics() {
|
|
5191
|
+
try {
|
|
5192
|
+
const tmuxCheck = spawnSync3("tmux", ["has-session", "-t", "synkro-local-cc"], { encoding: "utf-8" });
|
|
5193
|
+
console.warn(` tmux session: ${tmuxCheck.status === 0 ? "running" : "not running"}`);
|
|
5194
|
+
const pueueTask = findTask();
|
|
5195
|
+
console.warn(` pueue task: ${pueueTask ? `id=${pueueTask.id} status=${pueueTask.status}` : "not found"}`);
|
|
5196
|
+
const bunCheck = spawnSync3("bun", ["--version"], { encoding: "utf-8" });
|
|
5197
|
+
console.warn(` bun: ${bunCheck.status === 0 ? bunCheck.stdout.trim() : "not found"}`);
|
|
5198
|
+
const claudeCheck = spawnSync3("claude", ["--version"], { encoding: "utf-8" });
|
|
5199
|
+
console.warn(` claude: ${claudeCheck.status === 0 ? claudeCheck.stdout.trim().split("\n")[0] : "not found"}`);
|
|
5200
|
+
if (pueueTask) {
|
|
5201
|
+
const logs = tailLogs(15);
|
|
5202
|
+
if (logs && logs !== "(no output)") {
|
|
5203
|
+
console.warn(` pueue logs (last 15 lines):`);
|
|
5204
|
+
for (const line of logs.split("\n").slice(0, 15)) {
|
|
5205
|
+
console.warn(` ${line}`);
|
|
5206
|
+
}
|
|
5207
|
+
}
|
|
5208
|
+
}
|
|
5209
|
+
const logPath = join11(homedir10(), ".synkro", "cc_sessions", "run-claude.log");
|
|
5210
|
+
if (existsSync11(logPath)) {
|
|
5211
|
+
const logContent = readFileSync10(logPath, "utf-8").trim().split("\n").slice(-10);
|
|
5212
|
+
console.warn(` run-claude.log:`);
|
|
5213
|
+
for (const line of logContent) console.warn(` ${line}`);
|
|
5214
|
+
}
|
|
5215
|
+
} catch {
|
|
5216
|
+
}
|
|
5217
|
+
console.warn(` Run \`synkro local-cc status\` and \`synkro local-cc logs --tmux\` to debug.`);
|
|
5218
|
+
}
|
|
5189
5219
|
async function installCommand(opts = {}) {
|
|
5190
5220
|
const gatewayUrl = opts.gatewayUrl || sanitizeGatewayCandidate(process.env.SYNKRO_GATEWAY_URL) || "https://api.synkro.sh";
|
|
5191
5221
|
try {
|
|
@@ -5223,17 +5253,18 @@ async function installCommand(opts = {}) {
|
|
|
5223
5253
|
assertPueueInstalled();
|
|
5224
5254
|
assertTmuxInstalled();
|
|
5225
5255
|
installLocalCC();
|
|
5226
|
-
const
|
|
5227
|
-
console.log(` pueue task: id=${t.id} status=${t.status}`);
|
|
5228
|
-
console.log(" Waiting for channel...");
|
|
5229
|
-
const ready = await waitForChannelReady(CHANNEL_PORT, 6e4, CHANNEL_HOST);
|
|
5230
|
-
if (ready) console.log(` channel ready at ${CHANNEL_HOST}:${CHANNEL_PORT}`);
|
|
5231
|
-
else console.warn(" \u26A0 channel did not come up within 60s \u2014 check `synkro local-cc logs`");
|
|
5256
|
+
const t1 = ensureRunning();
|
|
5232
5257
|
const t2 = ensureRunning({ channel: CHANNEL_SECONDARY });
|
|
5233
|
-
console.log(`
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5258
|
+
console.log(` channel 1: pueue id=${t1.id} channel 2: pueue id=${t2.id}`);
|
|
5259
|
+
console.log(" Waiting for both channels...");
|
|
5260
|
+
const [ready1, ready2] = await Promise.all([
|
|
5261
|
+
waitForChannelReady(CHANNEL_PORT, 6e4, CHANNEL_HOST),
|
|
5262
|
+
waitForChannelReady(CHANNEL_2_PORT, 6e4, CHANNEL_HOST, CHANNEL_SECONDARY.tmuxSession)
|
|
5263
|
+
]);
|
|
5264
|
+
if (ready1) console.log(` channel 1 ready at ${CHANNEL_HOST}:${CHANNEL_PORT}`);
|
|
5265
|
+
else console.warn(" \u26A0 channel 1 did not come up within 60s \u2014 check `synkro local-cc logs`");
|
|
5266
|
+
if (ready2) console.log(` channel 2 ready at ${CHANNEL_HOST}:${CHANNEL_2_PORT}`);
|
|
5267
|
+
else console.warn(" \u26A0 channel 2 did not come up within 60s");
|
|
5237
5268
|
updateLocalInferenceFlag(true);
|
|
5238
5269
|
} catch (err) {
|
|
5239
5270
|
console.warn(` \u26A0 Local-CC setup skipped: ${err.message}`);
|
|
@@ -5306,7 +5337,6 @@ async function installCommand(opts = {}) {
|
|
|
5306
5337
|
console.log("Wrote hook scripts:");
|
|
5307
5338
|
console.log(` ${scripts.bashScript}`);
|
|
5308
5339
|
console.log(` ${scripts.bashFollowupScript}`);
|
|
5309
|
-
console.log(` ${scripts.editCaptureScript}`);
|
|
5310
5340
|
console.log(` ${scripts.editPrecheckScript}`);
|
|
5311
5341
|
console.log(` ${scripts.planJudgeScript}`);
|
|
5312
5342
|
console.log(` ${scripts.stopSummaryScript}`);
|
|
@@ -5341,7 +5371,6 @@ async function installCommand(opts = {}) {
|
|
|
5341
5371
|
installCCHooks(agent.settingsPath, {
|
|
5342
5372
|
bashJudgeScriptPath: scripts.bashScript,
|
|
5343
5373
|
bashFollowupScriptPath: scripts.bashFollowupScript,
|
|
5344
|
-
editCaptureScriptPath: scripts.editCaptureScript,
|
|
5345
5374
|
editPrecheckScriptPath: scripts.editPrecheckScript,
|
|
5346
5375
|
cwePrecheckScriptPath: scripts.cwePrecheckScript,
|
|
5347
5376
|
cvePrecheckScriptPath: scripts.cvePrecheckScript,
|
|
@@ -5443,72 +5472,64 @@ async function installCommand(opts = {}) {
|
|
|
5443
5472
|
console.warn(` \u26A0 Some dependencies missing \u2014 \`synkro local-cc enable\` may not work until they're installed.`);
|
|
5444
5473
|
}
|
|
5445
5474
|
console.log();
|
|
5446
|
-
|
|
5475
|
+
const priorLocalFlag = (() => {
|
|
5447
5476
|
try {
|
|
5477
|
+
const content = readFileSync10(CONFIG_PATH3, "utf-8");
|
|
5478
|
+
return content.includes("SYNKRO_LOCAL_INFERENCE='yes'");
|
|
5479
|
+
} catch {
|
|
5480
|
+
return false;
|
|
5481
|
+
}
|
|
5482
|
+
})();
|
|
5483
|
+
if (profile.localInference || priorLocalFlag && localCcDeps.length === 3) {
|
|
5484
|
+
try {
|
|
5485
|
+
stopTask();
|
|
5486
|
+
stopTask(CHANNEL_SECONDARY);
|
|
5448
5487
|
const r = installLocalCC();
|
|
5449
5488
|
console.log(`Installed local-CC channel plugin at ${r.pluginPath}`);
|
|
5450
|
-
const
|
|
5451
|
-
|
|
5452
|
-
console.log(
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
console.log(" warmup skipped (non-fatal)\n");
|
|
5462
|
-
}
|
|
5489
|
+
const t1 = startTask();
|
|
5490
|
+
const t2 = startTask({ channel: CHANNEL_SECONDARY });
|
|
5491
|
+
console.log(`Channel 1 (org rules): pueue id=${t1.id} status=${t1.status}`);
|
|
5492
|
+
console.log(`Channel 2 (CWE scan): pueue id=${t2.id} status=${t2.status}`);
|
|
5493
|
+
console.log("Waiting for both channels (up to 60s)...");
|
|
5494
|
+
const [ready1, ready2] = await Promise.all([
|
|
5495
|
+
waitForChannelReady(CHANNEL_PORT, 6e4, CHANNEL_HOST),
|
|
5496
|
+
waitForChannelReady(CHANNEL_2_PORT, 6e4, CHANNEL_HOST, CHANNEL_SECONDARY.tmuxSession)
|
|
5497
|
+
]);
|
|
5498
|
+
if (ready1) {
|
|
5499
|
+
console.log(` channel 1 ready at ${CHANNEL_HOST}:${CHANNEL_PORT}`);
|
|
5463
5500
|
} else {
|
|
5464
|
-
console.warn(` \u26A0 Channel did not come up within 60s.`);
|
|
5465
|
-
|
|
5466
|
-
const { spawnSync: sp } = await import("child_process");
|
|
5467
|
-
const tmuxCheck = sp("tmux", ["has-session", "-t", "synkro-local-cc"], { encoding: "utf-8" });
|
|
5468
|
-
console.warn(` tmux session: ${tmuxCheck.status === 0 ? "running" : "not running"}`);
|
|
5469
|
-
const pueueTask = findTask();
|
|
5470
|
-
console.warn(` pueue task: ${pueueTask ? `id=${pueueTask.id} status=${pueueTask.status}` : "not found"}`);
|
|
5471
|
-
const bunCheck = sp("bun", ["--version"], { encoding: "utf-8" });
|
|
5472
|
-
console.warn(` bun: ${bunCheck.status === 0 ? bunCheck.stdout.trim() : "not found"}`);
|
|
5473
|
-
const claudeCheck = sp("claude", ["--version"], { encoding: "utf-8" });
|
|
5474
|
-
console.warn(` claude: ${claudeCheck.status === 0 ? claudeCheck.stdout.trim().split("\n")[0] : "not found"}`);
|
|
5475
|
-
if (pueueTask) {
|
|
5476
|
-
const logs = tailLogs(15);
|
|
5477
|
-
if (logs && logs !== "(no output)") {
|
|
5478
|
-
console.warn(` pueue logs (last 15 lines):`);
|
|
5479
|
-
for (const line of logs.split("\n").slice(0, 15)) {
|
|
5480
|
-
console.warn(` ${line}`);
|
|
5481
|
-
}
|
|
5482
|
-
}
|
|
5483
|
-
}
|
|
5484
|
-
const logPath = join11(homedir10(), ".synkro", "cc_sessions", "run-claude.log");
|
|
5485
|
-
if (existsSync11(logPath)) {
|
|
5486
|
-
const logContent = readFileSync10(logPath, "utf-8").trim().split("\n").slice(-10);
|
|
5487
|
-
console.warn(` run-claude.log:`);
|
|
5488
|
-
for (const line of logContent) console.warn(` ${line}`);
|
|
5489
|
-
}
|
|
5490
|
-
} catch {
|
|
5491
|
-
}
|
|
5492
|
-
console.warn(` Run \`synkro local-cc status\` and \`synkro local-cc logs --tmux\` to debug.
|
|
5493
|
-
`);
|
|
5501
|
+
console.warn(` \u26A0 Channel 1 did not come up within 60s.`);
|
|
5502
|
+
printChannelDiagnostics();
|
|
5494
5503
|
}
|
|
5495
|
-
const t2 = ensureRunning({ channel: CHANNEL_SECONDARY });
|
|
5496
|
-
console.log(`Local-CC CWE channel: id=${t2.id} status=${t2.status}`);
|
|
5497
|
-
console.log("Waiting for CWE channel (up to 60s)...");
|
|
5498
|
-
const ready2 = await waitForChannelReady(CHANNEL_2_PORT, 6e4, CHANNEL_HOST, CHANNEL_SECONDARY.tmuxSession);
|
|
5499
5504
|
if (ready2) {
|
|
5500
|
-
console.log(`
|
|
5501
|
-
try {
|
|
5502
|
-
console.log(" warming up CWE inference...");
|
|
5503
|
-
await submitToChannel("grade-cwe", 'File: /tmp/warmup.ts\nContent (first 4000 chars):\nconsole.log("hello");\n\nCWE rules to check against:\n[]\n', { timeoutMs: 3e4, port: CHANNEL_2_PORT });
|
|
5504
|
-
console.log(" CWE inference warm\n");
|
|
5505
|
-
} catch {
|
|
5506
|
-
console.log(" CWE warmup skipped (non-fatal)\n");
|
|
5507
|
-
}
|
|
5505
|
+
console.log(` channel 2 ready at ${CHANNEL_HOST}:${CHANNEL_2_PORT}`);
|
|
5508
5506
|
} else {
|
|
5509
|
-
console.warn(` \u26A0
|
|
5510
|
-
console.warn(` Run \`synkro local-cc status\` to debug
|
|
5511
|
-
|
|
5507
|
+
console.warn(` \u26A0 Channel 2 did not come up within 60s.`);
|
|
5508
|
+
console.warn(` Run \`synkro local-cc status\` to debug.`);
|
|
5509
|
+
}
|
|
5510
|
+
if (ready1 || ready2) {
|
|
5511
|
+
console.log("Warming up inference...");
|
|
5512
|
+
const warmups = [];
|
|
5513
|
+
if (ready1) {
|
|
5514
|
+
warmups.push(
|
|
5515
|
+
submitToChannel("grade-bash", "Proposed command: echo hello\nUser intent: warmup\nRecent user messages: []\nRecent actions: []\nOrg rules: []\n", { timeoutMs: 3e4 }).then(() => {
|
|
5516
|
+
console.log(" channel 1 warm");
|
|
5517
|
+
}).catch(() => {
|
|
5518
|
+
console.log(" channel 1 warmup skipped (non-fatal)");
|
|
5519
|
+
})
|
|
5520
|
+
);
|
|
5521
|
+
}
|
|
5522
|
+
if (ready2) {
|
|
5523
|
+
warmups.push(
|
|
5524
|
+
submitToChannel("grade-cwe", 'File: /tmp/warmup.ts\nContent (first 4000 chars):\nconsole.log("hello");\n\nCWE rules to check against:\n[]\n', { timeoutMs: 3e4, port: CHANNEL_2_PORT }).then(() => {
|
|
5525
|
+
console.log(" channel 2 warm");
|
|
5526
|
+
}).catch(() => {
|
|
5527
|
+
console.log(" channel 2 warmup skipped (non-fatal)");
|
|
5528
|
+
})
|
|
5529
|
+
);
|
|
5530
|
+
}
|
|
5531
|
+
await Promise.all(warmups);
|
|
5532
|
+
console.log();
|
|
5512
5533
|
}
|
|
5513
5534
|
} catch (err) {
|
|
5514
5535
|
console.warn(` \u26A0 Local-CC setup failed: ${err.message}
|
|
@@ -7004,7 +7025,7 @@ var localCc_exports = {};
|
|
|
7004
7025
|
__export(localCc_exports, {
|
|
7005
7026
|
localCcCommand: () => localCcCommand
|
|
7006
7027
|
});
|
|
7007
|
-
import { spawnSync as
|
|
7028
|
+
import { spawnSync as spawnSync4 } from "child_process";
|
|
7008
7029
|
import { homedir as homedir14 } from "os";
|
|
7009
7030
|
import { join as join16 } from "path";
|
|
7010
7031
|
import { existsSync as existsSync16, readFileSync as readFileSync14, writeFileSync as writeFileSync9 } from "fs";
|
|
@@ -7148,7 +7169,7 @@ async function cmdStatus() {
|
|
|
7148
7169
|
}
|
|
7149
7170
|
const ch1Up = await isChannelAvailable();
|
|
7150
7171
|
console.log(`Channel 1 ${CHANNEL_HOST}:${CHANNEL_PORT}: ${ch1Up ? "reachable" : "unreachable"}`);
|
|
7151
|
-
const tmux1 =
|
|
7172
|
+
const tmux1 = spawnSync4("tmux", ["has-session", "-t", TMUX_SESSION_NAME], { encoding: "utf-8" });
|
|
7152
7173
|
console.log(`tmux '${TMUX_SESSION_NAME}': ${tmux1.status === 0 ? "live" : "absent"}`);
|
|
7153
7174
|
const t2 = findTask(CHANNEL_SECONDARY);
|
|
7154
7175
|
if (!t2) {
|
|
@@ -7158,7 +7179,7 @@ async function cmdStatus() {
|
|
|
7158
7179
|
}
|
|
7159
7180
|
const ch2Up = await isChannelAvailable(CHANNEL_2_PORT);
|
|
7160
7181
|
console.log(`Channel 2 ${CHANNEL_HOST}:${CHANNEL_2_PORT}: ${ch2Up ? "reachable" : "unreachable"}`);
|
|
7161
|
-
const tmux2 =
|
|
7182
|
+
const tmux2 = spawnSync4("tmux", ["has-session", "-t", TMUX_SESSION_NAME_2], { encoding: "utf-8" });
|
|
7162
7183
|
console.log(`tmux '${TMUX_SESSION_NAME_2}': ${tmux2.status === 0 ? "live" : "absent"}`);
|
|
7163
7184
|
}
|
|
7164
7185
|
async function cmdEnable() {
|
|
@@ -7350,7 +7371,7 @@ function cmdLogs(rest) {
|
|
|
7350
7371
|
function cmdAttach(rest) {
|
|
7351
7372
|
assertTmuxInstalled();
|
|
7352
7373
|
const readonly = rest.some((a) => a === "--readonly" || a === "-r");
|
|
7353
|
-
const has =
|
|
7374
|
+
const has = spawnSync4("tmux", ["has-session", "-t", TMUX_SESSION_NAME], { encoding: "utf-8" });
|
|
7354
7375
|
if (has.status !== 0) {
|
|
7355
7376
|
console.error(`No tmux session '${TMUX_SESSION_NAME}' running. Start it with: synkro local-cc start`);
|
|
7356
7377
|
process.exit(1);
|
|
@@ -7363,7 +7384,7 @@ function cmdAttach(rest) {
|
|
|
7363
7384
|
console.log("Detach with Ctrl-B then D. (Do not press Ctrl-C \u2014 that would interrupt claude.)");
|
|
7364
7385
|
console.log();
|
|
7365
7386
|
const args2 = readonly ? ["attach-session", "-r", "-t", TMUX_SESSION_NAME] : ["attach-session", "-t", TMUX_SESSION_NAME];
|
|
7366
|
-
const r =
|
|
7387
|
+
const r = spawnSync4("tmux", args2, { stdio: "inherit" });
|
|
7367
7388
|
process.exit(r.status ?? 0);
|
|
7368
7389
|
}
|
|
7369
7390
|
async function cmdTest() {
|