claudemesh-cli 1.34.13 → 1.34.16
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/entrypoints/cli.js +162 -92
- package/dist/entrypoints/cli.js.map +7 -7
- package/dist/entrypoints/mcp.js +37 -10
- package/dist/entrypoints/mcp.js.map +3 -3
- package/package.json +1 -1
package/dist/entrypoints/cli.js
CHANGED
|
@@ -104,7 +104,7 @@ __export(exports_urls, {
|
|
|
104
104
|
VERSION: () => VERSION,
|
|
105
105
|
URLS: () => URLS
|
|
106
106
|
});
|
|
107
|
-
var URLS, VERSION = "1.34.
|
|
107
|
+
var URLS, VERSION = "1.34.16", env;
|
|
108
108
|
var init_urls = __esm(() => {
|
|
109
109
|
URLS = {
|
|
110
110
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -178,13 +178,40 @@ var init_policy = __esm(() => {
|
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
// src/constants/paths.ts
|
|
181
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
181
182
|
import { homedir as homedir2 } from "node:os";
|
|
182
183
|
import { join as join2 } from "node:path";
|
|
183
|
-
|
|
184
|
+
function resolveConfigDir() {
|
|
185
|
+
if (_resolvedConfigDir !== null)
|
|
186
|
+
return _resolvedConfigDir;
|
|
187
|
+
const envDir = process.env.CLAUDEMESH_CONFIG_DIR;
|
|
188
|
+
if (!envDir) {
|
|
189
|
+
_resolvedConfigDir = DEFAULT_CONFIG_DIR;
|
|
190
|
+
return DEFAULT_CONFIG_DIR;
|
|
191
|
+
}
|
|
192
|
+
if (existsSync2(envDir)) {
|
|
193
|
+
_resolvedConfigDir = envDir;
|
|
194
|
+
return envDir;
|
|
195
|
+
}
|
|
196
|
+
if (!_warnedStaleEnv && process.stderr.isTTY) {
|
|
197
|
+
_warnedStaleEnv = true;
|
|
198
|
+
const unsetHint = process.env.SHELL?.endsWith("fish") ? "set -e CLAUDEMESH_CONFIG_DIR CLAUDEMESH_IPC_TOKEN_FILE" : "unset CLAUDEMESH_CONFIG_DIR CLAUDEMESH_IPC_TOKEN_FILE";
|
|
199
|
+
process.stderr.write(`claudemesh: ignoring stale CLAUDEMESH_CONFIG_DIR=${envDir} (no config.json there); using ${DEFAULT_CONFIG_DIR}.
|
|
200
|
+
` + ` Hint: this is usually a leftover env from a previous \`claudemesh launch\`. Clean it with:
|
|
201
|
+
` + ` ${unsetHint}
|
|
202
|
+
`);
|
|
203
|
+
}
|
|
204
|
+
_resolvedConfigDir = DEFAULT_CONFIG_DIR;
|
|
205
|
+
return DEFAULT_CONFIG_DIR;
|
|
206
|
+
}
|
|
207
|
+
var home, DEFAULT_CONFIG_DIR, _resolvedConfigDir = null, _warnedStaleEnv = false, PATHS;
|
|
184
208
|
var init_paths = __esm(() => {
|
|
185
209
|
home = homedir2();
|
|
210
|
+
DEFAULT_CONFIG_DIR = join2(home, ".claudemesh");
|
|
186
211
|
PATHS = {
|
|
187
|
-
CONFIG_DIR
|
|
212
|
+
get CONFIG_DIR() {
|
|
213
|
+
return resolveConfigDir();
|
|
214
|
+
},
|
|
188
215
|
get CONFIG_FILE() {
|
|
189
216
|
return join2(this.CONFIG_DIR, "config.json");
|
|
190
217
|
},
|
|
@@ -208,9 +235,9 @@ function emptyConfig() {
|
|
|
208
235
|
}
|
|
209
236
|
|
|
210
237
|
// src/services/config/read.ts
|
|
211
|
-
import { readFileSync as readFileSync2, existsSync as
|
|
238
|
+
import { readFileSync as readFileSync2, existsSync as existsSync3 } from "node:fs";
|
|
212
239
|
function readConfig() {
|
|
213
|
-
if (!
|
|
240
|
+
if (!existsSync3(PATHS.CONFIG_FILE))
|
|
214
241
|
return emptyConfig();
|
|
215
242
|
try {
|
|
216
243
|
const raw = readFileSync2(PATHS.CONFIG_FILE, "utf-8");
|
|
@@ -542,7 +569,7 @@ var init_facade4 = __esm(() => {
|
|
|
542
569
|
|
|
543
570
|
// src/services/spawn/claude.ts
|
|
544
571
|
import { spawnSync } from "node:child_process";
|
|
545
|
-
import { existsSync as
|
|
572
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
546
573
|
function findClaudeBinary() {
|
|
547
574
|
const candidates = [
|
|
548
575
|
process.env.CLAUDE_BIN,
|
|
@@ -551,7 +578,7 @@ function findClaudeBinary() {
|
|
|
551
578
|
`${process.env.HOME}/.npm/bin/claude`
|
|
552
579
|
].filter(Boolean);
|
|
553
580
|
for (const bin of candidates) {
|
|
554
|
-
if (
|
|
581
|
+
if (existsSync4(bin))
|
|
555
582
|
return bin;
|
|
556
583
|
}
|
|
557
584
|
const which = spawnSync("which", ["claude"], { encoding: "utf-8" });
|
|
@@ -612,9 +639,9 @@ var init_facade5 = __esm(() => {
|
|
|
612
639
|
});
|
|
613
640
|
|
|
614
641
|
// src/services/auth/token-store.ts
|
|
615
|
-
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, unlinkSync, existsSync as
|
|
642
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, unlinkSync, existsSync as existsSync5, openSync as openSync2, closeSync as closeSync2 } from "node:fs";
|
|
616
643
|
function getStoredToken() {
|
|
617
|
-
if (!
|
|
644
|
+
if (!existsSync5(PATHS.AUTH_FILE))
|
|
618
645
|
return null;
|
|
619
646
|
try {
|
|
620
647
|
const raw = readFileSync3(PATHS.AUTH_FILE, "utf-8");
|
|
@@ -3678,7 +3705,7 @@ __export(exports_token, {
|
|
|
3678
3705
|
TOKEN_FILE_ENV: () => TOKEN_FILE_ENV
|
|
3679
3706
|
});
|
|
3680
3707
|
import { randomBytes as randomBytes5 } from "node:crypto";
|
|
3681
|
-
import { existsSync as
|
|
3708
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5, writeFileSync as writeFileSync5 } from "node:fs";
|
|
3682
3709
|
function mintSessionToken(dir, fileName = "session-token") {
|
|
3683
3710
|
const token = randomBytes5(32).toString("hex");
|
|
3684
3711
|
const filePath = `${dir}/${fileName}`;
|
|
@@ -3693,7 +3720,7 @@ function readSessionTokenFromEnv(env2 = process.env) {
|
|
|
3693
3720
|
if (!path)
|
|
3694
3721
|
return null;
|
|
3695
3722
|
try {
|
|
3696
|
-
if (!
|
|
3723
|
+
if (!existsSync6(path))
|
|
3697
3724
|
return null;
|
|
3698
3725
|
const raw = readFileSync5(path, "utf8").trim();
|
|
3699
3726
|
if (/^[0-9a-f]{64}$/i.test(raw))
|
|
@@ -3780,7 +3807,7 @@ __export(exports_lifecycle, {
|
|
|
3780
3807
|
ensureDaemonReady: () => ensureDaemonReady,
|
|
3781
3808
|
_resetDaemonReadyCache: () => _resetDaemonReadyCache
|
|
3782
3809
|
});
|
|
3783
|
-
import { existsSync as
|
|
3810
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6, statSync, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
3784
3811
|
import { homedir as homedir4 } from "node:os";
|
|
3785
3812
|
import { join as join4 } from "node:path";
|
|
3786
3813
|
async function ensureDaemonReady(opts = {}) {
|
|
@@ -3836,15 +3863,15 @@ async function runEnsureDaemon(opts) {
|
|
|
3836
3863
|
}
|
|
3837
3864
|
function isServiceManaged() {
|
|
3838
3865
|
if (process.platform === "darwin") {
|
|
3839
|
-
return
|
|
3866
|
+
return existsSync7(join4(homedir4(), "Library", "LaunchAgents", `${SERVICE_LABEL}.plist`));
|
|
3840
3867
|
}
|
|
3841
3868
|
if (process.platform === "linux") {
|
|
3842
|
-
return
|
|
3869
|
+
return existsSync7(join4(homedir4(), ".config", "systemd", "user", SYSTEMD_UNIT));
|
|
3843
3870
|
}
|
|
3844
3871
|
return false;
|
|
3845
3872
|
}
|
|
3846
3873
|
async function probeDaemon() {
|
|
3847
|
-
if (!
|
|
3874
|
+
if (!existsSync7(DAEMON_PATHS.SOCK_FILE))
|
|
3848
3875
|
return "absent";
|
|
3849
3876
|
try {
|
|
3850
3877
|
const res = await ipc({ path: "/v1/version", timeoutMs: PROBE_TIMEOUT_MS });
|
|
@@ -3912,7 +3939,7 @@ async function spawnDaemon(opts) {
|
|
|
3912
3939
|
}
|
|
3913
3940
|
async function acquireOrShareLock(_opts) {
|
|
3914
3941
|
const lockPath = SPAWN_LOCK_FILE();
|
|
3915
|
-
if (
|
|
3942
|
+
if (existsSync7(lockPath)) {
|
|
3916
3943
|
try {
|
|
3917
3944
|
const pidStr = readFileSync6(lockPath, "utf8").trim();
|
|
3918
3945
|
const pid = Number.parseInt(pidStr, 10);
|
|
@@ -3937,7 +3964,7 @@ function releaseLock() {
|
|
|
3937
3964
|
async function pollForSocket(budgetMs) {
|
|
3938
3965
|
const start = Date.now();
|
|
3939
3966
|
while (Date.now() - start < budgetMs) {
|
|
3940
|
-
if (
|
|
3967
|
+
if (existsSync7(DAEMON_PATHS.SOCK_FILE)) {
|
|
3941
3968
|
const probe = await probeDaemon();
|
|
3942
3969
|
if (probe === "up")
|
|
3943
3970
|
return { ok: true };
|
|
@@ -4317,7 +4344,7 @@ __export(exports_launch, {
|
|
|
4317
4344
|
});
|
|
4318
4345
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
4319
4346
|
import { randomUUID } from "node:crypto";
|
|
4320
|
-
import { mkdtempSync, writeFileSync as writeFileSync7, rmSync, readdirSync, statSync as statSync2, existsSync as
|
|
4347
|
+
import { mkdtempSync, writeFileSync as writeFileSync7, rmSync, readdirSync, statSync as statSync2, existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
4321
4348
|
import { tmpdir, hostname as hostname2, homedir as homedir5 } from "node:os";
|
|
4322
4349
|
import { join as join5 } from "node:path";
|
|
4323
4350
|
import { createInterface as createInterface4 } from "node:readline";
|
|
@@ -4513,7 +4540,7 @@ async function printBrokerWelcome(meshSlug) {
|
|
|
4513
4540
|
let peerCount = -1;
|
|
4514
4541
|
try {
|
|
4515
4542
|
const { tryListPeersViaDaemon: tryListPeersViaDaemon2 } = await Promise.resolve().then(() => (init_daemon_route(), exports_daemon_route));
|
|
4516
|
-
const peers = await tryListPeersViaDaemon2() ?? [];
|
|
4543
|
+
const peers = await tryListPeersViaDaemon2(meshSlug) ?? [];
|
|
4517
4544
|
peerCount = peers.filter((p) => p.channel !== "claudemesh-daemon").length;
|
|
4518
4545
|
} catch {}
|
|
4519
4546
|
let unread = -1;
|
|
@@ -4725,7 +4752,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
4725
4752
|
await ensureDaemonRunning(mesh.slug, args.quiet);
|
|
4726
4753
|
try {
|
|
4727
4754
|
const claudeConfigPath = join5(homedir5(), ".claude.json");
|
|
4728
|
-
if (
|
|
4755
|
+
if (existsSync8(claudeConfigPath)) {
|
|
4729
4756
|
const claudeConfig = JSON.parse(readFileSync7(claudeConfigPath, "utf-8"));
|
|
4730
4757
|
const mcpServers = claudeConfig.mcpServers ?? {};
|
|
4731
4758
|
let cleaned = 0;
|
|
@@ -4901,7 +4928,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
4901
4928
|
join5(homedir5(), ".claude", "bin", "claude")
|
|
4902
4929
|
];
|
|
4903
4930
|
for (const c of candidates) {
|
|
4904
|
-
if (
|
|
4931
|
+
if (existsSync8(c)) {
|
|
4905
4932
|
claudeBin = c;
|
|
4906
4933
|
break;
|
|
4907
4934
|
}
|
|
@@ -7849,11 +7876,17 @@ async function runKick(target, opts = {}) {
|
|
|
7849
7876
|
return await withMesh({ meshSlug }, async (client) => {
|
|
7850
7877
|
const result = await client.sendAndWait(built);
|
|
7851
7878
|
const peers = result?.affected ?? result?.kicked ?? [];
|
|
7852
|
-
|
|
7879
|
+
const skipped = result?.skipped_control_plane ?? [];
|
|
7880
|
+
if (peers.length === 0 && skipped.length === 0) {
|
|
7853
7881
|
render.info("No peers matched.");
|
|
7854
|
-
else {
|
|
7882
|
+
} else if (peers.length === 0 && skipped.length > 0) {
|
|
7883
|
+
render.warn(`${skipped.length} match(es) refused: ${skipped.join(", ")} — control-plane connections (daemon / dashboard) auto-reconnect, so kick is a no-op.`, "To take a daemon offline locally, run `claudemesh daemon down` on that machine. To remove a member from the mesh, use `claudemesh ban <peer>`.");
|
|
7884
|
+
} else {
|
|
7855
7885
|
render.ok(`Kicked ${peers.length} peer(s): ${peers.join(", ")}`);
|
|
7856
7886
|
render.hint("Their Claude Code session ended. They can rejoin anytime by running `claudemesh`.");
|
|
7887
|
+
if (skipped.length > 0) {
|
|
7888
|
+
render.warn(`(also refused ${skipped.length} control-plane connection(s): ${skipped.join(", ")})`, "Daemon / dashboard connections auto-reconnect; kick is a no-op against them. Use `claudemesh ban <peer>` to remove a member entirely.");
|
|
7889
|
+
}
|
|
7857
7890
|
}
|
|
7858
7891
|
return EXIT.SUCCESS;
|
|
7859
7892
|
});
|
|
@@ -8014,7 +8047,7 @@ async function listPeersForMesh(slug) {
|
|
|
8014
8047
|
} catch {}
|
|
8015
8048
|
try {
|
|
8016
8049
|
const { tryListPeersViaDaemon: tryListPeersViaDaemon2 } = await Promise.resolve().then(() => (init_daemon_route(), exports_daemon_route));
|
|
8017
|
-
const dr = await tryListPeersViaDaemon2();
|
|
8050
|
+
const dr = await tryListPeersViaDaemon2(slug);
|
|
8018
8051
|
if (dr !== null) {
|
|
8019
8052
|
return dr.map((p) => annotateSelf(p, selfMemberPubkey, selfSessionPubkey));
|
|
8020
8053
|
}
|
|
@@ -9239,11 +9272,11 @@ var init_whoami = __esm(() => {
|
|
|
9239
9272
|
});
|
|
9240
9273
|
|
|
9241
9274
|
// src/daemon/lock.ts
|
|
9242
|
-
import { existsSync as
|
|
9275
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as readFileSync8, unlinkSync as unlinkSync3, writeFileSync as writeFileSync9 } from "node:fs";
|
|
9243
9276
|
import { dirname as dirname4 } from "node:path";
|
|
9244
9277
|
function acquireSingletonLock() {
|
|
9245
9278
|
mkdirSync5(dirname4(DAEMON_PATHS.PID_FILE), { recursive: true, mode: 448 });
|
|
9246
|
-
if (
|
|
9279
|
+
if (existsSync9(DAEMON_PATHS.PID_FILE)) {
|
|
9247
9280
|
const raw = readFileSync8(DAEMON_PATHS.PID_FILE, "utf8").trim();
|
|
9248
9281
|
const oldPid = Number.parseInt(raw, 10);
|
|
9249
9282
|
if (Number.isFinite(oldPid) && oldPid > 0 && isProcessAlive(oldPid)) {
|
|
@@ -9957,7 +9990,7 @@ var init_session_registry = __esm(() => {
|
|
|
9957
9990
|
|
|
9958
9991
|
// src/daemon/ipc/server.ts
|
|
9959
9992
|
import { createServer as createServer2 } from "node:http";
|
|
9960
|
-
import { chmodSync as chmodSync3, existsSync as
|
|
9993
|
+
import { chmodSync as chmodSync3, existsSync as existsSync10, unlinkSync as unlinkSync4 } from "node:fs";
|
|
9961
9994
|
import { timingSafeEqual } from "node:crypto";
|
|
9962
9995
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
9963
9996
|
function startIpcServer(opts) {
|
|
@@ -9973,7 +10006,7 @@ function startIpcServer(opts) {
|
|
|
9973
10006
|
meshConfigs: opts.meshConfigs,
|
|
9974
10007
|
onPendingInserted: opts.onPendingInserted
|
|
9975
10008
|
});
|
|
9976
|
-
if (
|
|
10009
|
+
if (existsSync10(DAEMON_PATHS.SOCK_FILE)) {
|
|
9977
10010
|
try {
|
|
9978
10011
|
unlinkSync4(DAEMON_PATHS.SOCK_FILE);
|
|
9979
10012
|
} catch {}
|
|
@@ -10866,6 +10899,10 @@ function connectWsWithBackoff(opts) {
|
|
|
10866
10899
|
status = s;
|
|
10867
10900
|
opts.onStatusChange?.(s);
|
|
10868
10901
|
};
|
|
10902
|
+
const PING_INTERVAL_MS = 30000;
|
|
10903
|
+
const STALE_THRESHOLD_MS = 75000;
|
|
10904
|
+
let lastActivity = Date.now();
|
|
10905
|
+
let watchdogTimer = null;
|
|
10869
10906
|
const openOnce = () => {
|
|
10870
10907
|
if (closed)
|
|
10871
10908
|
return Promise.reject(new Error("client_closed"));
|
|
@@ -10873,6 +10910,7 @@ function connectWsWithBackoff(opts) {
|
|
|
10873
10910
|
log2("info", "ws_open_attempt", { url: opts.url });
|
|
10874
10911
|
const sock = new WebSocket2(opts.url);
|
|
10875
10912
|
ws = sock;
|
|
10913
|
+
lastActivity = Date.now();
|
|
10876
10914
|
return new Promise((resolve, reject) => {
|
|
10877
10915
|
sock.on("open", () => {
|
|
10878
10916
|
log2("info", "ws_open_ok", { url: opts.url });
|
|
@@ -10895,6 +10933,7 @@ function connectWsWithBackoff(opts) {
|
|
|
10895
10933
|
})();
|
|
10896
10934
|
});
|
|
10897
10935
|
sock.on("message", (raw) => {
|
|
10936
|
+
lastActivity = Date.now();
|
|
10898
10937
|
let msg;
|
|
10899
10938
|
try {
|
|
10900
10939
|
msg = JSON.parse(raw.toString());
|
|
@@ -10909,16 +10948,43 @@ function connectWsWithBackoff(opts) {
|
|
|
10909
10948
|
setStatus("open");
|
|
10910
10949
|
reconnectAttempt = 0;
|
|
10911
10950
|
log2("info", "ws_hello_acked", { url: opts.url });
|
|
10951
|
+
if (watchdogTimer)
|
|
10952
|
+
clearInterval(watchdogTimer);
|
|
10953
|
+
watchdogTimer = setInterval(() => {
|
|
10954
|
+
if (sock.readyState !== sock.OPEN)
|
|
10955
|
+
return;
|
|
10956
|
+
const idle = Date.now() - lastActivity;
|
|
10957
|
+
if (idle > STALE_THRESHOLD_MS) {
|
|
10958
|
+
log2("warn", "ws_stale_terminate", { url: opts.url, idle_ms: idle });
|
|
10959
|
+
try {
|
|
10960
|
+
sock.terminate();
|
|
10961
|
+
} catch {}
|
|
10962
|
+
return;
|
|
10963
|
+
}
|
|
10964
|
+
try {
|
|
10965
|
+
sock.ping();
|
|
10966
|
+
} catch {}
|
|
10967
|
+
}, PING_INTERVAL_MS);
|
|
10912
10968
|
resolve();
|
|
10913
10969
|
return;
|
|
10914
10970
|
}
|
|
10915
10971
|
opts.onMessage(msg);
|
|
10916
10972
|
});
|
|
10973
|
+
sock.on("ping", () => {
|
|
10974
|
+
lastActivity = Date.now();
|
|
10975
|
+
});
|
|
10976
|
+
sock.on("pong", () => {
|
|
10977
|
+
lastActivity = Date.now();
|
|
10978
|
+
});
|
|
10917
10979
|
sock.on("close", (code, reason) => {
|
|
10918
10980
|
if (helloTimer) {
|
|
10919
10981
|
clearTimeout(helloTimer);
|
|
10920
10982
|
helloTimer = null;
|
|
10921
10983
|
}
|
|
10984
|
+
if (watchdogTimer) {
|
|
10985
|
+
clearInterval(watchdogTimer);
|
|
10986
|
+
watchdogTimer = null;
|
|
10987
|
+
}
|
|
10922
10988
|
const reasonStr = reason.toString("utf8");
|
|
10923
10989
|
log2("warn", "ws_closed", { url: opts.url, code, reason: reasonStr, status });
|
|
10924
10990
|
opts.onBeforeReconnect?.(code, reasonStr);
|
|
@@ -10962,6 +11028,10 @@ function connectWsWithBackoff(opts) {
|
|
|
10962
11028
|
clearTimeout(helloTimer);
|
|
10963
11029
|
helloTimer = null;
|
|
10964
11030
|
}
|
|
11031
|
+
if (watchdogTimer) {
|
|
11032
|
+
clearInterval(watchdogTimer);
|
|
11033
|
+
watchdogTimer = null;
|
|
11034
|
+
}
|
|
10965
11035
|
try {
|
|
10966
11036
|
ws?.close();
|
|
10967
11037
|
} catch {}
|
|
@@ -11965,7 +12035,7 @@ __export(exports_identity, {
|
|
|
11965
12035
|
checkFingerprint: () => checkFingerprint,
|
|
11966
12036
|
acceptCurrentHost: () => acceptCurrentHost
|
|
11967
12037
|
});
|
|
11968
|
-
import { existsSync as
|
|
12038
|
+
import { existsSync as existsSync11, readFileSync as readFileSync9, writeFileSync as writeFileSync10 } from "node:fs";
|
|
11969
12039
|
import { join as join7 } from "node:path";
|
|
11970
12040
|
import { createHash as createHash2 } from "node:crypto";
|
|
11971
12041
|
import { networkInterfaces } from "node:os";
|
|
@@ -11986,7 +12056,7 @@ function computeCurrentFingerprint() {
|
|
|
11986
12056
|
}
|
|
11987
12057
|
function checkFingerprint() {
|
|
11988
12058
|
const current = computeCurrentFingerprint();
|
|
11989
|
-
if (!
|
|
12059
|
+
if (!existsSync11(path())) {
|
|
11990
12060
|
writeFileSync10(path(), JSON.stringify(current, null, 2), { mode: 384 });
|
|
11991
12061
|
return { result: "first_run", current };
|
|
11992
12062
|
}
|
|
@@ -12054,14 +12124,14 @@ var init_identity = __esm(() => {
|
|
|
12054
12124
|
});
|
|
12055
12125
|
|
|
12056
12126
|
// src/daemon/run.ts
|
|
12057
|
-
import { existsSync as
|
|
12127
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync6, readFileSync as readFileSync10 } from "node:fs";
|
|
12058
12128
|
function detectContainer() {
|
|
12059
12129
|
if (process.env.KUBERNETES_SERVICE_HOST)
|
|
12060
12130
|
return true;
|
|
12061
12131
|
if (process.env.CONTAINER === "1")
|
|
12062
12132
|
return true;
|
|
12063
12133
|
try {
|
|
12064
|
-
if (
|
|
12134
|
+
if (existsSync12("/.dockerenv"))
|
|
12065
12135
|
return true;
|
|
12066
12136
|
const cg = readFileSync10("/proc/1/cgroup", "utf8");
|
|
12067
12137
|
if (/(docker|kubepods|containerd)/.test(cg))
|
|
@@ -12349,7 +12419,7 @@ __export(exports_service_install, {
|
|
|
12349
12419
|
installService: () => installService,
|
|
12350
12420
|
detectPlatform: () => detectPlatform
|
|
12351
12421
|
});
|
|
12352
|
-
import { existsSync as
|
|
12422
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync7, writeFileSync as writeFileSync11, unlinkSync as unlinkSync5, readFileSync as readFileSync11 } from "node:fs";
|
|
12353
12423
|
import { execSync as execSync2 } from "node:child_process";
|
|
12354
12424
|
import { homedir as homedir7 } from "node:os";
|
|
12355
12425
|
import { join as join8, dirname as dirname5 } from "node:path";
|
|
@@ -12370,7 +12440,7 @@ function installService(args) {
|
|
|
12370
12440
|
if (isCi() && !args.allowCi) {
|
|
12371
12441
|
throw new Error("Refusing to install persistent service in CI; pass --allow-ci-persistent to override.");
|
|
12372
12442
|
}
|
|
12373
|
-
if (!
|
|
12443
|
+
if (!existsSync13(args.binaryPath)) {
|
|
12374
12444
|
throw new Error(`binary not found at ${args.binaryPath}`);
|
|
12375
12445
|
}
|
|
12376
12446
|
mkdirSync7(DAEMON_PATHS.DAEMON_DIR, { recursive: true, mode: 448 });
|
|
@@ -12386,7 +12456,7 @@ function uninstallService() {
|
|
|
12386
12456
|
try {
|
|
12387
12457
|
execSync2(`launchctl bootout gui/$(id -u)/${SERVICE_LABEL2}`, { stdio: "ignore" });
|
|
12388
12458
|
} catch {}
|
|
12389
|
-
if (
|
|
12459
|
+
if (existsSync13(p)) {
|
|
12390
12460
|
unlinkSync5(p);
|
|
12391
12461
|
removed.push(p);
|
|
12392
12462
|
}
|
|
@@ -12395,7 +12465,7 @@ function uninstallService() {
|
|
|
12395
12465
|
try {
|
|
12396
12466
|
execSync2(`systemctl --user disable --now ${SYSTEMD_UNIT2}`, { stdio: "ignore" });
|
|
12397
12467
|
} catch {}
|
|
12398
|
-
if (
|
|
12468
|
+
if (existsSync13(p)) {
|
|
12399
12469
|
unlinkSync5(p);
|
|
12400
12470
|
removed.push(p);
|
|
12401
12471
|
}
|
|
@@ -12456,7 +12526,7 @@ function installDarwin(args) {
|
|
|
12456
12526
|
} catch {}
|
|
12457
12527
|
try {
|
|
12458
12528
|
const pidPath = DAEMON_PATHS.PID_FILE;
|
|
12459
|
-
if (
|
|
12529
|
+
if (existsSync13(pidPath)) {
|
|
12460
12530
|
const pid = parseInt(readFileSync11(pidPath, "utf8").trim(), 10);
|
|
12461
12531
|
if (Number.isFinite(pid) && pid > 0) {
|
|
12462
12532
|
try {
|
|
@@ -12508,7 +12578,7 @@ WantedBy=default.target
|
|
|
12508
12578
|
} catch {}
|
|
12509
12579
|
try {
|
|
12510
12580
|
const pidPath = DAEMON_PATHS.PID_FILE;
|
|
12511
|
-
if (
|
|
12581
|
+
if (existsSync13(pidPath)) {
|
|
12512
12582
|
const pid = parseInt(readFileSync11(pidPath, "utf8").trim(), 10);
|
|
12513
12583
|
if (Number.isFinite(pid) && pid > 0) {
|
|
12514
12584
|
try {
|
|
@@ -12536,7 +12606,7 @@ function readInstalledUnit() {
|
|
|
12536
12606
|
if (!platform5)
|
|
12537
12607
|
return { platform: null, path: null, content: null };
|
|
12538
12608
|
const path2 = platform5 === "darwin" ? darwinPlistPath() : linuxUnitPath();
|
|
12539
|
-
if (!
|
|
12609
|
+
if (!existsSync13(path2))
|
|
12540
12610
|
return { platform: platform5, path: null, content: null };
|
|
12541
12611
|
try {
|
|
12542
12612
|
return { platform: platform5, path: path2, content: readFileSync11(path2, "utf8") };
|
|
@@ -12555,7 +12625,7 @@ __export(exports_daemon, {
|
|
|
12555
12625
|
runDaemonCommand: () => runDaemonCommand
|
|
12556
12626
|
});
|
|
12557
12627
|
import { spawn } from "node:child_process";
|
|
12558
|
-
import { existsSync as
|
|
12628
|
+
import { existsSync as existsSync14, openSync as openSync3, mkdirSync as mkdirSync8 } from "node:fs";
|
|
12559
12629
|
import { join as join9 } from "node:path";
|
|
12560
12630
|
async function runDaemonCommand(sub, opts, rest = []) {
|
|
12561
12631
|
switch (sub) {
|
|
@@ -12897,7 +12967,7 @@ async function spawnDetachedDaemon(opts) {
|
|
|
12897
12967
|
const sockPath = DAEMON_PATHS.SOCK_FILE;
|
|
12898
12968
|
const startedAt = Date.now();
|
|
12899
12969
|
while (Date.now() - startedAt < 3000) {
|
|
12900
|
-
if (
|
|
12970
|
+
if (existsSync14(sockPath)) {
|
|
12901
12971
|
if (opts.json) {
|
|
12902
12972
|
process.stdout.write(JSON.stringify({ ok: true, detached: true, pid: child.pid, log: logPath }) + `
|
|
12903
12973
|
`);
|
|
@@ -12942,7 +13012,7 @@ __export(exports_install, {
|
|
|
12942
13012
|
import {
|
|
12943
13013
|
chmodSync as chmodSync4,
|
|
12944
13014
|
copyFileSync,
|
|
12945
|
-
existsSync as
|
|
13015
|
+
existsSync as existsSync15,
|
|
12946
13016
|
mkdirSync as mkdirSync9,
|
|
12947
13017
|
readFileSync as readFileSync12,
|
|
12948
13018
|
writeFileSync as writeFileSync12
|
|
@@ -12952,7 +13022,7 @@ import { dirname as dirname6, join as join10, resolve } from "node:path";
|
|
|
12952
13022
|
import { fileURLToPath } from "node:url";
|
|
12953
13023
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
12954
13024
|
function readClaudeConfig() {
|
|
12955
|
-
if (!
|
|
13025
|
+
if (!existsSync15(CLAUDE_CONFIG))
|
|
12956
13026
|
return {};
|
|
12957
13027
|
const text = readFileSync12(CLAUDE_CONFIG, "utf-8").trim();
|
|
12958
13028
|
if (!text)
|
|
@@ -12964,7 +13034,7 @@ function readClaudeConfig() {
|
|
|
12964
13034
|
}
|
|
12965
13035
|
}
|
|
12966
13036
|
function backupClaudeConfig() {
|
|
12967
|
-
if (!
|
|
13037
|
+
if (!existsSync15(CLAUDE_CONFIG))
|
|
12968
13038
|
return;
|
|
12969
13039
|
const backupDir = join10(dirname6(CLAUDE_CONFIG), ".claude", "backups");
|
|
12970
13040
|
mkdirSync9(backupDir, { recursive: true });
|
|
@@ -12993,7 +13063,7 @@ function patchMcpServer(entry) {
|
|
|
12993
13063
|
return action;
|
|
12994
13064
|
}
|
|
12995
13065
|
function removeMcpServer() {
|
|
12996
|
-
if (!
|
|
13066
|
+
if (!existsSync15(CLAUDE_CONFIG))
|
|
12997
13067
|
return false;
|
|
12998
13068
|
backupClaudeConfig();
|
|
12999
13069
|
const cfg = readClaudeConfig();
|
|
@@ -13030,7 +13100,7 @@ function resolveBundledSkillsDir() {
|
|
|
13030
13100
|
const here = fileURLToPath(import.meta.url);
|
|
13031
13101
|
const pkgRoot = resolve(dirname6(here), "..", "..");
|
|
13032
13102
|
const skillsDir = join10(pkgRoot, "skills");
|
|
13033
|
-
if (
|
|
13103
|
+
if (existsSync15(skillsDir))
|
|
13034
13104
|
return skillsDir;
|
|
13035
13105
|
return null;
|
|
13036
13106
|
}
|
|
@@ -13065,7 +13135,7 @@ function uninstallSkills() {
|
|
|
13065
13135
|
if (!entry.isDirectory())
|
|
13066
13136
|
continue;
|
|
13067
13137
|
const dstDir = join10(CLAUDE_SKILLS_ROOT, entry.name);
|
|
13068
|
-
if (
|
|
13138
|
+
if (existsSync15(dstDir)) {
|
|
13069
13139
|
try {
|
|
13070
13140
|
fs.rmSync(dstDir, { recursive: true, force: true });
|
|
13071
13141
|
removed.push(entry.name);
|
|
@@ -13090,7 +13160,7 @@ function entriesEqual(a, b) {
|
|
|
13090
13160
|
return a.command === b.command && JSON.stringify(a.args ?? []) === JSON.stringify(b.args ?? []);
|
|
13091
13161
|
}
|
|
13092
13162
|
function readClaudeSettings() {
|
|
13093
|
-
if (!
|
|
13163
|
+
if (!existsSync15(CLAUDE_SETTINGS))
|
|
13094
13164
|
return {};
|
|
13095
13165
|
const text = readFileSync12(CLAUDE_SETTINGS, "utf-8").trim();
|
|
13096
13166
|
if (!text)
|
|
@@ -13117,7 +13187,7 @@ function installAllowedTools() {
|
|
|
13117
13187
|
return { added: toAdd, unchanged: CLAUDEMESH_TOOLS.length - toAdd.length };
|
|
13118
13188
|
}
|
|
13119
13189
|
function uninstallAllowedTools() {
|
|
13120
|
-
if (!
|
|
13190
|
+
if (!existsSync15(CLAUDE_SETTINGS))
|
|
13121
13191
|
return 0;
|
|
13122
13192
|
const settings = readClaudeSettings();
|
|
13123
13193
|
const existing = settings.allowedTools ?? [];
|
|
@@ -13152,7 +13222,7 @@ function installHooks() {
|
|
|
13152
13222
|
return { added, unchanged };
|
|
13153
13223
|
}
|
|
13154
13224
|
function uninstallHooks() {
|
|
13155
|
-
if (!
|
|
13225
|
+
if (!existsSync15(CLAUDE_SETTINGS))
|
|
13156
13226
|
return 0;
|
|
13157
13227
|
const settings = readClaudeSettings();
|
|
13158
13228
|
const hooks2 = settings.hooks;
|
|
@@ -13202,7 +13272,7 @@ async function runInstall(args = []) {
|
|
|
13202
13272
|
render.err("`bun` is not on PATH.", "Install Bun first: https://bun.com");
|
|
13203
13273
|
process.exit(1);
|
|
13204
13274
|
}
|
|
13205
|
-
if (!
|
|
13275
|
+
if (!existsSync15(entry)) {
|
|
13206
13276
|
render.err(`MCP entry not found at ${entry}`);
|
|
13207
13277
|
process.exit(1);
|
|
13208
13278
|
}
|
|
@@ -13473,7 +13543,7 @@ var exports_uninstall = {};
|
|
|
13473
13543
|
__export(exports_uninstall, {
|
|
13474
13544
|
uninstall: () => uninstall
|
|
13475
13545
|
});
|
|
13476
|
-
import { readFileSync as readFileSync13, writeFileSync as writeFileSync13, existsSync as
|
|
13546
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync13, existsSync as existsSync16, rmSync as rmSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
13477
13547
|
import { join as join11, dirname as dirname7 } from "node:path";
|
|
13478
13548
|
import { homedir as homedir9 } from "node:os";
|
|
13479
13549
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
@@ -13481,11 +13551,11 @@ function bundledSkillsDir() {
|
|
|
13481
13551
|
const here = fileURLToPath2(import.meta.url);
|
|
13482
13552
|
const pkgRoot = join11(dirname7(here), "..", "..");
|
|
13483
13553
|
const skillsDir = join11(pkgRoot, "skills");
|
|
13484
|
-
return
|
|
13554
|
+
return existsSync16(skillsDir) ? skillsDir : null;
|
|
13485
13555
|
}
|
|
13486
13556
|
async function uninstall() {
|
|
13487
13557
|
let removed = 0;
|
|
13488
|
-
if (
|
|
13558
|
+
if (existsSync16(PATHS.CLAUDE_JSON)) {
|
|
13489
13559
|
try {
|
|
13490
13560
|
const raw = readFileSync13(PATHS.CLAUDE_JSON, "utf-8");
|
|
13491
13561
|
const config = JSON.parse(raw);
|
|
@@ -13499,7 +13569,7 @@ async function uninstall() {
|
|
|
13499
13569
|
}
|
|
13500
13570
|
} catch {}
|
|
13501
13571
|
}
|
|
13502
|
-
if (
|
|
13572
|
+
if (existsSync16(PATHS.CLAUDE_SETTINGS)) {
|
|
13503
13573
|
try {
|
|
13504
13574
|
const raw = readFileSync13(PATHS.CLAUDE_SETTINGS, "utf-8");
|
|
13505
13575
|
const config = JSON.parse(raw);
|
|
@@ -13538,7 +13608,7 @@ async function uninstall() {
|
|
|
13538
13608
|
if (!entry.isDirectory())
|
|
13539
13609
|
continue;
|
|
13540
13610
|
const dst = join11(CLAUDE_SKILLS_ROOT2, entry.name);
|
|
13541
|
-
if (
|
|
13611
|
+
if (existsSync16(dst)) {
|
|
13542
13612
|
try {
|
|
13543
13613
|
rmSync2(dst, { recursive: true, force: true });
|
|
13544
13614
|
removedSkills.push(entry.name);
|
|
@@ -13570,7 +13640,7 @@ var exports_doctor = {};
|
|
|
13570
13640
|
__export(exports_doctor, {
|
|
13571
13641
|
runDoctor: () => runDoctor
|
|
13572
13642
|
});
|
|
13573
|
-
import { existsSync as
|
|
13643
|
+
import { existsSync as existsSync17, readFileSync as readFileSync14, statSync as statSync3 } from "node:fs";
|
|
13574
13644
|
import { homedir as homedir10, platform as platform6 } from "node:os";
|
|
13575
13645
|
import { join as join12 } from "node:path";
|
|
13576
13646
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
@@ -13597,7 +13667,7 @@ function checkClaudeOnPath() {
|
|
|
13597
13667
|
}
|
|
13598
13668
|
function checkMcpRegistered() {
|
|
13599
13669
|
const claudeConfig = join12(homedir10(), ".claude.json");
|
|
13600
|
-
if (!
|
|
13670
|
+
if (!existsSync17(claudeConfig)) {
|
|
13601
13671
|
return {
|
|
13602
13672
|
name: "claudemesh MCP registered in ~/.claude.json",
|
|
13603
13673
|
pass: false,
|
|
@@ -13623,7 +13693,7 @@ function checkMcpRegistered() {
|
|
|
13623
13693
|
}
|
|
13624
13694
|
function checkHooksRegistered() {
|
|
13625
13695
|
const settings = join12(homedir10(), ".claude", "settings.json");
|
|
13626
|
-
if (!
|
|
13696
|
+
if (!existsSync17(settings)) {
|
|
13627
13697
|
return {
|
|
13628
13698
|
name: "Status hooks registered in ~/.claude/settings.json",
|
|
13629
13699
|
pass: false,
|
|
@@ -13648,7 +13718,7 @@ function checkHooksRegistered() {
|
|
|
13648
13718
|
}
|
|
13649
13719
|
function checkConfigFile() {
|
|
13650
13720
|
const path2 = getConfigPath();
|
|
13651
|
-
if (!
|
|
13721
|
+
if (!existsSync17(path2)) {
|
|
13652
13722
|
return {
|
|
13653
13723
|
name: "~/.claudemesh/config.json exists and parses",
|
|
13654
13724
|
pass: true,
|
|
@@ -13831,7 +13901,7 @@ var exports_status = {};
|
|
|
13831
13901
|
__export(exports_status, {
|
|
13832
13902
|
runStatus: () => runStatus2
|
|
13833
13903
|
});
|
|
13834
|
-
import { statSync as statSync4, existsSync as
|
|
13904
|
+
import { statSync as statSync4, existsSync as existsSync18 } from "node:fs";
|
|
13835
13905
|
import WebSocket3 from "ws";
|
|
13836
13906
|
async function probeBroker(url, timeoutMs = 4000) {
|
|
13837
13907
|
return new Promise((resolve2) => {
|
|
@@ -13861,7 +13931,7 @@ async function runStatus2() {
|
|
|
13861
13931
|
render.section(`status (v${VERSION})`);
|
|
13862
13932
|
const configPath = getConfigPath();
|
|
13863
13933
|
let configPermsNote = "missing";
|
|
13864
|
-
if (
|
|
13934
|
+
if (existsSync18(configPath)) {
|
|
13865
13935
|
const mode = (statSync4(configPath).mode & 511).toString(8).padStart(4, "0");
|
|
13866
13936
|
configPermsNote = mode === "0600" ? `${mode}` : `${mode} — expected 0600`;
|
|
13867
13937
|
}
|
|
@@ -14007,10 +14077,10 @@ var init_check_claude_binary = __esm(() => {
|
|
|
14007
14077
|
});
|
|
14008
14078
|
|
|
14009
14079
|
// src/services/health/check-mcp-registered.ts
|
|
14010
|
-
import { existsSync as
|
|
14080
|
+
import { existsSync as existsSync19, readFileSync as readFileSync15 } from "node:fs";
|
|
14011
14081
|
function checkMcpRegistered2() {
|
|
14012
14082
|
try {
|
|
14013
|
-
if (!
|
|
14083
|
+
if (!existsSync19(PATHS.CLAUDE_JSON)) {
|
|
14014
14084
|
return { name: "mcp-registered", ok: false, message: "~/.claude.json not found" };
|
|
14015
14085
|
}
|
|
14016
14086
|
const raw = readFileSync15(PATHS.CLAUDE_JSON, "utf-8");
|
|
@@ -14028,10 +14098,10 @@ var init_check_mcp_registered = __esm(() => {
|
|
|
14028
14098
|
});
|
|
14029
14099
|
|
|
14030
14100
|
// src/services/health/check-hooks-registered.ts
|
|
14031
|
-
import { existsSync as
|
|
14101
|
+
import { existsSync as existsSync20, readFileSync as readFileSync16 } from "node:fs";
|
|
14032
14102
|
function checkHooksRegistered2() {
|
|
14033
14103
|
try {
|
|
14034
|
-
if (!
|
|
14104
|
+
if (!existsSync20(PATHS.CLAUDE_SETTINGS)) {
|
|
14035
14105
|
return { name: "hooks-registered", ok: false, message: "~/.claude/settings.json not found" };
|
|
14036
14106
|
}
|
|
14037
14107
|
const raw = readFileSync16(PATHS.CLAUDE_SETTINGS, "utf-8");
|
|
@@ -14049,10 +14119,10 @@ var init_check_hooks_registered = __esm(() => {
|
|
|
14049
14119
|
});
|
|
14050
14120
|
|
|
14051
14121
|
// src/services/health/check-config-perms.ts
|
|
14052
|
-
import { existsSync as
|
|
14122
|
+
import { existsSync as existsSync21, statSync as statSync5 } from "node:fs";
|
|
14053
14123
|
function checkConfigPerms() {
|
|
14054
14124
|
const configFile = PATHS.CONFIG_FILE;
|
|
14055
|
-
if (!
|
|
14125
|
+
if (!existsSync21(configFile)) {
|
|
14056
14126
|
return { name: "config-perms", ok: true, message: "No config file yet (first run)" };
|
|
14057
14127
|
}
|
|
14058
14128
|
try {
|
|
@@ -14070,9 +14140,9 @@ var init_check_config_perms = __esm(() => {
|
|
|
14070
14140
|
});
|
|
14071
14141
|
|
|
14072
14142
|
// src/services/health/check-keypairs-valid.ts
|
|
14073
|
-
import { existsSync as
|
|
14143
|
+
import { existsSync as existsSync22, readFileSync as readFileSync17 } from "node:fs";
|
|
14074
14144
|
function checkKeypairsValid() {
|
|
14075
|
-
if (!
|
|
14145
|
+
if (!existsSync22(PATHS.CONFIG_FILE)) {
|
|
14076
14146
|
return { name: "keypairs-valid", ok: true, message: "No config (first run)" };
|
|
14077
14147
|
}
|
|
14078
14148
|
try {
|
|
@@ -14557,7 +14627,7 @@ __export(exports_url_handler, {
|
|
|
14557
14627
|
runUrlHandler: () => runUrlHandler
|
|
14558
14628
|
});
|
|
14559
14629
|
import { platform as platform7, homedir as homedir11 } from "node:os";
|
|
14560
|
-
import { existsSync as
|
|
14630
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync10, writeFileSync as writeFileSync14, rmSync as rmSync3, chmodSync as chmodSync5 } from "node:fs";
|
|
14561
14631
|
import { join as join13 } from "node:path";
|
|
14562
14632
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
14563
14633
|
function resolveClaudemeshBin() {
|
|
@@ -14665,14 +14735,14 @@ function installWindows() {
|
|
|
14665
14735
|
}
|
|
14666
14736
|
function uninstallDarwin() {
|
|
14667
14737
|
const appDir = join13(homedir11(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
|
|
14668
|
-
if (
|
|
14738
|
+
if (existsSync23(appDir))
|
|
14669
14739
|
rmSync3(appDir, { recursive: true, force: true });
|
|
14670
14740
|
render.ok("removed claudemesh:// handler on macOS");
|
|
14671
14741
|
return EXIT.SUCCESS;
|
|
14672
14742
|
}
|
|
14673
14743
|
function uninstallLinux() {
|
|
14674
14744
|
const desktopPath = join13(homedir11(), ".local", "share", "applications", "claudemesh.desktop");
|
|
14675
|
-
if (
|
|
14745
|
+
if (existsSync23(desktopPath))
|
|
14676
14746
|
rmSync3(desktopPath, { force: true });
|
|
14677
14747
|
render.ok("removed claudemesh:// handler on Linux");
|
|
14678
14748
|
return EXIT.SUCCESS;
|
|
@@ -14717,7 +14787,7 @@ var exports_status_line = {};
|
|
|
14717
14787
|
__export(exports_status_line, {
|
|
14718
14788
|
runStatusLine: () => runStatusLine
|
|
14719
14789
|
});
|
|
14720
|
-
import { existsSync as
|
|
14790
|
+
import { existsSync as existsSync24, readFileSync as readFileSync18 } from "node:fs";
|
|
14721
14791
|
import { join as join14 } from "node:path";
|
|
14722
14792
|
import { homedir as homedir12 } from "node:os";
|
|
14723
14793
|
async function runStatusLine() {
|
|
@@ -14729,7 +14799,7 @@ async function runStatusLine() {
|
|
|
14729
14799
|
}
|
|
14730
14800
|
const cachePath = join14(homedir12(), ".claudemesh", "peer-cache.json");
|
|
14731
14801
|
let cache = {};
|
|
14732
|
-
if (
|
|
14802
|
+
if (existsSync24(cachePath)) {
|
|
14733
14803
|
try {
|
|
14734
14804
|
cache = JSON.parse(readFileSync18(cachePath, "utf-8"));
|
|
14735
14805
|
} catch {}
|
|
@@ -14762,7 +14832,7 @@ __export(exports_backup, {
|
|
|
14762
14832
|
runRestore: () => runRestore,
|
|
14763
14833
|
runBackup: () => runBackup
|
|
14764
14834
|
});
|
|
14765
|
-
import { readFileSync as readFileSync19, writeFileSync as writeFileSync15, existsSync as
|
|
14835
|
+
import { readFileSync as readFileSync19, writeFileSync as writeFileSync15, existsSync as existsSync25 } from "node:fs";
|
|
14766
14836
|
import { createInterface as createInterface11 } from "node:readline";
|
|
14767
14837
|
function readHidden(prompt5) {
|
|
14768
14838
|
return new Promise((resolve2) => {
|
|
@@ -14804,7 +14874,7 @@ async function deriveKey(pass, salt, s) {
|
|
|
14804
14874
|
}
|
|
14805
14875
|
async function runBackup(outPath) {
|
|
14806
14876
|
const configPath = getConfigPath();
|
|
14807
|
-
if (!
|
|
14877
|
+
if (!existsSync25(configPath)) {
|
|
14808
14878
|
console.error(" No config found — nothing to back up. Join a mesh first.");
|
|
14809
14879
|
return EXIT.NOT_FOUND;
|
|
14810
14880
|
}
|
|
@@ -14838,7 +14908,7 @@ async function runRestore(inPath) {
|
|
|
14838
14908
|
console.error(" Usage: claudemesh restore <backup-file>");
|
|
14839
14909
|
return EXIT.INVALID_ARGS;
|
|
14840
14910
|
}
|
|
14841
|
-
if (!
|
|
14911
|
+
if (!existsSync25(inPath)) {
|
|
14842
14912
|
console.error(` ✗ File not found: ${inPath}`);
|
|
14843
14913
|
return EXIT.NOT_FOUND;
|
|
14844
14914
|
}
|
|
@@ -14861,7 +14931,7 @@ async function runRestore(inPath) {
|
|
|
14861
14931
|
return EXIT.INTERNAL_ERROR;
|
|
14862
14932
|
}
|
|
14863
14933
|
const configPath = getConfigPath();
|
|
14864
|
-
if (
|
|
14934
|
+
if (existsSync25(configPath)) {
|
|
14865
14935
|
const backupOld = `${configPath}.before-restore.${Date.now()}`;
|
|
14866
14936
|
writeFileSync15(backupOld, readFileSync19(configPath), { mode: 384 });
|
|
14867
14937
|
console.log(` ↻ Existing config saved to ${backupOld}`);
|
|
@@ -14886,7 +14956,7 @@ __export(exports_upgrade, {
|
|
|
14886
14956
|
runUpgrade: () => runUpgrade
|
|
14887
14957
|
});
|
|
14888
14958
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
14889
|
-
import { existsSync as
|
|
14959
|
+
import { existsSync as existsSync26 } from "node:fs";
|
|
14890
14960
|
import { dirname as dirname8, join as join15, resolve as resolve2 } from "node:path";
|
|
14891
14961
|
async function latestVersion() {
|
|
14892
14962
|
try {
|
|
@@ -14901,14 +14971,14 @@ async function latestVersion() {
|
|
|
14901
14971
|
}
|
|
14902
14972
|
function findNpm() {
|
|
14903
14973
|
const portable = join15(process.env.HOME ?? "", ".claudemesh", "node", "bin", "npm");
|
|
14904
|
-
if (
|
|
14974
|
+
if (existsSync26(portable)) {
|
|
14905
14975
|
return { npm: portable, prefix: join15(process.env.HOME ?? "", ".claudemesh") };
|
|
14906
14976
|
}
|
|
14907
14977
|
let cur = resolve2(process.argv[1] ?? ".");
|
|
14908
14978
|
for (let i = 0;i < 6; i++) {
|
|
14909
14979
|
cur = dirname8(cur);
|
|
14910
14980
|
const candidate = join15(cur, "bin", "npm");
|
|
14911
|
-
if (
|
|
14981
|
+
if (existsSync26(candidate))
|
|
14912
14982
|
return { npm: candidate };
|
|
14913
14983
|
}
|
|
14914
14984
|
return { npm: "npm" };
|
|
@@ -14970,7 +15040,7 @@ __export(exports_grants, {
|
|
|
14970
15040
|
runBlock: () => runBlock,
|
|
14971
15041
|
isAllowed: () => isAllowed
|
|
14972
15042
|
});
|
|
14973
|
-
import { existsSync as
|
|
15043
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync16 } from "node:fs";
|
|
14974
15044
|
import { homedir as homedir13 } from "node:os";
|
|
14975
15045
|
import { join as join16 } from "node:path";
|
|
14976
15046
|
async function syncToBroker(meshSlug, grants) {
|
|
@@ -14990,7 +15060,7 @@ async function syncToBroker(meshSlug, grants) {
|
|
|
14990
15060
|
}
|
|
14991
15061
|
}
|
|
14992
15062
|
function readGrants() {
|
|
14993
|
-
if (!
|
|
15063
|
+
if (!existsSync27(GRANT_FILE))
|
|
14994
15064
|
return {};
|
|
14995
15065
|
try {
|
|
14996
15066
|
return JSON.parse(readFileSync20(GRANT_FILE, "utf-8"));
|
|
@@ -15000,7 +15070,7 @@ function readGrants() {
|
|
|
15000
15070
|
}
|
|
15001
15071
|
function writeGrants(g) {
|
|
15002
15072
|
const dir = join16(homedir13(), ".claudemesh");
|
|
15003
|
-
if (!
|
|
15073
|
+
if (!existsSync27(dir))
|
|
15004
15074
|
mkdirSync11(dir, { recursive: true });
|
|
15005
15075
|
writeFileSync16(GRANT_FILE, JSON.stringify(g, null, 2), { mode: 384 });
|
|
15006
15076
|
}
|
|
@@ -16879,7 +16949,7 @@ __export(exports_file, {
|
|
|
16879
16949
|
});
|
|
16880
16950
|
import { hostname as osHostname2 } from "node:os";
|
|
16881
16951
|
import { resolve as resolvePath, basename, dirname as dirname9 } from "node:path";
|
|
16882
|
-
import { statSync as statSync7, existsSync as
|
|
16952
|
+
import { statSync as statSync7, existsSync as existsSync28, writeFileSync as writeFileSync17, mkdirSync as mkdirSync12 } from "node:fs";
|
|
16883
16953
|
function emitJson2(data) {
|
|
16884
16954
|
console.log(JSON.stringify(data, null, 2));
|
|
16885
16955
|
}
|
|
@@ -16896,7 +16966,7 @@ async function runFileShare(filePath, opts) {
|
|
|
16896
16966
|
return EXIT.INVALID_ARGS;
|
|
16897
16967
|
}
|
|
16898
16968
|
const absPath = resolvePath(filePath);
|
|
16899
|
-
if (!
|
|
16969
|
+
if (!existsSync28(absPath)) {
|
|
16900
16970
|
render.err(`File not found: ${absPath}`);
|
|
16901
16971
|
return EXIT.INVALID_ARGS;
|
|
16902
16972
|
}
|
|
@@ -17586,7 +17656,7 @@ __export(exports_bridge, {
|
|
|
17586
17656
|
runBridge: () => runBridge,
|
|
17587
17657
|
bridgeConfigTemplate: () => bridgeConfigTemplate
|
|
17588
17658
|
});
|
|
17589
|
-
import { readFileSync as readFileSync21, existsSync as
|
|
17659
|
+
import { readFileSync as readFileSync21, existsSync as existsSync29 } from "node:fs";
|
|
17590
17660
|
function parseConfig(text) {
|
|
17591
17661
|
const trimmed = text.trim();
|
|
17592
17662
|
if (trimmed.startsWith("{"))
|
|
@@ -17630,7 +17700,7 @@ async function runBridge(configPath) {
|
|
|
17630
17700
|
render.err("Usage: claudemesh bridge run <config.yaml>");
|
|
17631
17701
|
return EXIT.INVALID_ARGS;
|
|
17632
17702
|
}
|
|
17633
|
-
if (!
|
|
17703
|
+
if (!existsSync29(configPath)) {
|
|
17634
17704
|
render.err(`config file not found: ${configPath}`);
|
|
17635
17705
|
return EXIT.NOT_FOUND;
|
|
17636
17706
|
}
|
|
@@ -18610,12 +18680,12 @@ import {
|
|
|
18610
18680
|
ListResourcesRequestSchema,
|
|
18611
18681
|
ReadResourceRequestSchema
|
|
18612
18682
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
18613
|
-
import { existsSync as
|
|
18683
|
+
import { existsSync as existsSync30, appendFileSync as appendFileSync2 } from "node:fs";
|
|
18614
18684
|
import { request as httpRequest2 } from "node:http";
|
|
18615
18685
|
import { join as join17 } from "node:path";
|
|
18616
18686
|
async function daemonReady() {
|
|
18617
18687
|
for (let i = 0;i < DAEMON_BOOT_RETRIES; i++) {
|
|
18618
|
-
if (
|
|
18688
|
+
if (existsSync30(DAEMON_PATHS.SOCK_FILE))
|
|
18619
18689
|
return true;
|
|
18620
18690
|
await new Promise((r) => setTimeout(r, DAEMON_BOOT_RETRY_MS));
|
|
18621
18691
|
}
|
|
@@ -21216,4 +21286,4 @@ main().catch((err) => {
|
|
|
21216
21286
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
21217
21287
|
});
|
|
21218
21288
|
|
|
21219
|
-
//# debugId=
|
|
21289
|
+
//# debugId=8D95F82FF933574E64756E2164756E21
|