claudemesh-cli 1.34.10 → 1.34.12
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 +199 -115
- package/dist/entrypoints/cli.js.map +10 -10
- package/dist/entrypoints/mcp.js +2 -2
- package/dist/entrypoints/mcp.js.map +1 -1
- 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.12", env;
|
|
108
108
|
var init_urls = __esm(() => {
|
|
109
109
|
URLS = {
|
|
110
110
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -3893,9 +3893,7 @@ async function spawnDaemon(opts) {
|
|
|
3893
3893
|
try {
|
|
3894
3894
|
const { spawn } = await import("node:child_process");
|
|
3895
3895
|
const binary = await resolveCliBinary();
|
|
3896
|
-
const args = ["daemon", "up"];
|
|
3897
|
-
if (opts.mesh)
|
|
3898
|
-
args.push("--mesh", opts.mesh);
|
|
3896
|
+
const args = ["daemon", "up", "--foreground"];
|
|
3899
3897
|
const child = spawn(binary, args, {
|
|
3900
3898
|
detached: true,
|
|
3901
3899
|
stdio: "ignore",
|
|
@@ -9615,6 +9613,11 @@ function migrateInbox(db) {
|
|
|
9615
9613
|
db.exec(`ALTER TABLE inbox ADD COLUMN seen_at INTEGER`);
|
|
9616
9614
|
db.exec(`CREATE INDEX IF NOT EXISTS inbox_seen_at ON inbox(seen_at)`);
|
|
9617
9615
|
}
|
|
9616
|
+
if (!cols.some((c) => c.name === "recipient_pubkey")) {
|
|
9617
|
+
db.exec(`ALTER TABLE inbox ADD COLUMN recipient_pubkey TEXT`);
|
|
9618
|
+
db.exec(`ALTER TABLE inbox ADD COLUMN recipient_kind TEXT`);
|
|
9619
|
+
db.exec(`CREATE INDEX IF NOT EXISTS inbox_recipient ON inbox(recipient_pubkey)`);
|
|
9620
|
+
}
|
|
9618
9621
|
}
|
|
9619
9622
|
function insertIfNew(db, row) {
|
|
9620
9623
|
const before = db.prepare(`SELECT id FROM inbox WHERE client_message_id = ?`).get(row.client_message_id);
|
|
@@ -9623,10 +9626,11 @@ function insertIfNew(db, row) {
|
|
|
9623
9626
|
db.prepare(`
|
|
9624
9627
|
INSERT INTO inbox (
|
|
9625
9628
|
id, client_message_id, broker_message_id, mesh, topic,
|
|
9626
|
-
sender_pubkey, sender_name, body, meta, received_at, reply_to_id
|
|
9627
|
-
|
|
9629
|
+
sender_pubkey, sender_name, body, meta, received_at, reply_to_id,
|
|
9630
|
+
recipient_pubkey, recipient_kind
|
|
9631
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
9628
9632
|
ON CONFLICT(client_message_id) DO NOTHING
|
|
9629
|
-
`).run(row.id, row.client_message_id, row.broker_message_id, row.mesh, row.topic, row.sender_pubkey, row.sender_name, row.body, row.meta, row.received_at, row.reply_to_id);
|
|
9633
|
+
`).run(row.id, row.client_message_id, row.broker_message_id, row.mesh, row.topic, row.sender_pubkey, row.sender_name, row.body, row.meta, row.received_at, row.reply_to_id, row.recipient_pubkey, row.recipient_kind);
|
|
9630
9634
|
const after = db.prepare(`SELECT id FROM inbox WHERE client_message_id = ?`).get(row.client_message_id);
|
|
9631
9635
|
return after?.id === row.id ? row.id : null;
|
|
9632
9636
|
}
|
|
@@ -9652,9 +9656,19 @@ function listInbox(db, p) {
|
|
|
9652
9656
|
if (p.unreadOnly === true) {
|
|
9653
9657
|
where.push("seen_at IS NULL");
|
|
9654
9658
|
}
|
|
9659
|
+
if (p.recipientPubkey) {
|
|
9660
|
+
const ors = ["recipient_pubkey IS NULL", "recipient_pubkey = ?"];
|
|
9661
|
+
args.push(p.recipientPubkey);
|
|
9662
|
+
if (p.recipientMemberPubkey) {
|
|
9663
|
+
ors.push("recipient_pubkey = ?");
|
|
9664
|
+
args.push(p.recipientMemberPubkey);
|
|
9665
|
+
}
|
|
9666
|
+
where.push(`(${ors.join(" OR ")})`);
|
|
9667
|
+
}
|
|
9655
9668
|
const sql = `
|
|
9656
9669
|
SELECT id, client_message_id, broker_message_id, mesh, topic,
|
|
9657
|
-
sender_pubkey, sender_name, body, meta, received_at, reply_to_id, seen_at
|
|
9670
|
+
sender_pubkey, sender_name, body, meta, received_at, reply_to_id, seen_at,
|
|
9671
|
+
recipient_pubkey, recipient_kind
|
|
9658
9672
|
FROM inbox
|
|
9659
9673
|
${where.length ? "WHERE " + where.join(" AND ") : ""}
|
|
9660
9674
|
ORDER BY received_at DESC
|
|
@@ -10471,12 +10485,17 @@ function makeHandler(opts) {
|
|
|
10471
10485
|
const meshFilter = meshFromCtx(url.searchParams.get("mesh")) ?? undefined;
|
|
10472
10486
|
const unreadOnly = url.searchParams.get("unread_only") === "true";
|
|
10473
10487
|
const markSeen = url.searchParams.get("mark_seen") !== "false";
|
|
10488
|
+
const recipientPubkey = session?.presence?.sessionPubkey;
|
|
10489
|
+
const meshCfgForRecipient = session?.mesh ? opts.meshConfigs?.get(session.mesh) : undefined;
|
|
10490
|
+
const recipientMemberPubkey = meshCfgForRecipient?.pubkey;
|
|
10474
10491
|
const rows = listInbox(opts.inboxDb, {
|
|
10475
10492
|
since: Number.isFinite(since) ? since : undefined,
|
|
10476
10493
|
topic,
|
|
10477
10494
|
fromPubkey,
|
|
10478
10495
|
...meshFilter ? { mesh: meshFilter } : {},
|
|
10479
10496
|
unreadOnly,
|
|
10497
|
+
...recipientPubkey ? { recipientPubkey } : {},
|
|
10498
|
+
...recipientMemberPubkey ? { recipientMemberPubkey } : {},
|
|
10480
10499
|
limit: Number.isFinite(limit ?? NaN) ? limit : undefined
|
|
10481
10500
|
});
|
|
10482
10501
|
let flippedCount = 0;
|
|
@@ -10498,7 +10517,9 @@ function makeHandler(opts) {
|
|
|
10498
10517
|
body: r.body,
|
|
10499
10518
|
received_at: new Date(r.received_at).toISOString(),
|
|
10500
10519
|
reply_to_id: r.reply_to_id,
|
|
10501
|
-
seen_at: r.seen_at ? new Date(r.seen_at).toISOString() : null
|
|
10520
|
+
seen_at: r.seen_at ? new Date(r.seen_at).toISOString() : null,
|
|
10521
|
+
recipient_pubkey: r.recipient_pubkey,
|
|
10522
|
+
recipient_kind: r.recipient_kind
|
|
10502
10523
|
})),
|
|
10503
10524
|
marked_seen: flippedCount
|
|
10504
10525
|
});
|
|
@@ -11874,7 +11895,9 @@ async function handleBrokerPush(msg, ctx) {
|
|
|
11874
11895
|
body,
|
|
11875
11896
|
meta: createdAt ? JSON.stringify({ created_at: createdAt }) : null,
|
|
11876
11897
|
received_at: Date.now(),
|
|
11877
|
-
reply_to_id: replyToId
|
|
11898
|
+
reply_to_id: replyToId,
|
|
11899
|
+
recipient_pubkey: ctx.recipientPubkey ?? null,
|
|
11900
|
+
recipient_kind: ctx.recipientKind ?? null
|
|
11878
11901
|
});
|
|
11879
11902
|
ctx.ackClientMessage?.(clientMessageId, brokerMessageId);
|
|
11880
11903
|
if (!inserted)
|
|
@@ -12391,6 +12414,7 @@ function installDarwin(args) {
|
|
|
12391
12414
|
`<string>${escapeXml(args.binaryPath)}</string>`,
|
|
12392
12415
|
"<string>daemon</string>",
|
|
12393
12416
|
"<string>up</string>",
|
|
12417
|
+
"<string>--foreground</string>",
|
|
12394
12418
|
...args.meshSlug ? ["<string>--mesh</string>", `<string>${escapeXml(args.meshSlug)}</string>`] : [],
|
|
12395
12419
|
...args.displayName ? ["<string>--name</string>", `<string>${escapeXml(args.displayName)}</string>`] : []
|
|
12396
12420
|
].join(`
|
|
@@ -12457,6 +12481,7 @@ function installLinux(args) {
|
|
|
12457
12481
|
const execArgs = [
|
|
12458
12482
|
"daemon",
|
|
12459
12483
|
"up",
|
|
12484
|
+
"--foreground",
|
|
12460
12485
|
...args.meshSlug ? ["--mesh", args.meshSlug] : [],
|
|
12461
12486
|
...args.displayName ? ["--name", args.displayName] : []
|
|
12462
12487
|
].map(shellQuote).join(" ");
|
|
@@ -12529,6 +12554,9 @@ var exports_daemon = {};
|
|
|
12529
12554
|
__export(exports_daemon, {
|
|
12530
12555
|
runDaemonCommand: () => runDaemonCommand
|
|
12531
12556
|
});
|
|
12557
|
+
import { spawn } from "node:child_process";
|
|
12558
|
+
import { existsSync as existsSync13, openSync as openSync3, mkdirSync as mkdirSync8 } from "node:fs";
|
|
12559
|
+
import { join as join9 } from "node:path";
|
|
12532
12560
|
async function runDaemonCommand(sub, opts, rest = []) {
|
|
12533
12561
|
switch (sub) {
|
|
12534
12562
|
case undefined:
|
|
@@ -12543,6 +12571,9 @@ async function runDaemonCommand(sub, opts, rest = []) {
|
|
|
12543
12571
|
process.stderr.write(`[claudemesh] --name on \`daemon up\` is deprecated; per-mesh display names live in config.json (set at join time), ` + `and session display names come from \`claudemesh launch --name\`. Ignoring --name ${opts.displayName}.
|
|
12544
12572
|
`);
|
|
12545
12573
|
}
|
|
12574
|
+
if (!opts.foreground) {
|
|
12575
|
+
return spawnDetachedDaemon(opts);
|
|
12576
|
+
}
|
|
12546
12577
|
return runDaemon({
|
|
12547
12578
|
tcpEnabled: !opts.noTcp,
|
|
12548
12579
|
publicHealthCheck: opts.publicHealth
|
|
@@ -12581,7 +12612,7 @@ USAGE
|
|
|
12581
12612
|
claudemesh daemon <command> [options]
|
|
12582
12613
|
|
|
12583
12614
|
COMMANDS
|
|
12584
|
-
up | start start the daemon
|
|
12615
|
+
up | start start the daemon (detached by default)
|
|
12585
12616
|
status show running pid + IPC health
|
|
12586
12617
|
version ipc + schema version of the running daemon
|
|
12587
12618
|
down | stop stop the running daemon (SIGTERM, then wait)
|
|
@@ -12592,7 +12623,7 @@ COMMANDS
|
|
|
12592
12623
|
uninstall-service remove the platform service unit
|
|
12593
12624
|
|
|
12594
12625
|
OPTIONS
|
|
12595
|
-
--
|
|
12626
|
+
--foreground keep daemon attached to terminal, JSON logs to stdout (1.34.12+)
|
|
12596
12627
|
--no-tcp disable the loopback TCP listener (UDS only)
|
|
12597
12628
|
--public-health expose /v1/health unauthenticated on TCP
|
|
12598
12629
|
--json machine-readable output where supported
|
|
@@ -12846,6 +12877,55 @@ async function runStop(opts) {
|
|
|
12846
12877
|
`);
|
|
12847
12878
|
return 1;
|
|
12848
12879
|
}
|
|
12880
|
+
async function spawnDetachedDaemon(opts) {
|
|
12881
|
+
mkdirSync8(DAEMON_PATHS.DAEMON_DIR, { recursive: true, mode: 448 });
|
|
12882
|
+
const logPath = join9(DAEMON_PATHS.DAEMON_DIR, "daemon.log");
|
|
12883
|
+
const binary = process.argv[1] ?? "claudemesh";
|
|
12884
|
+
const args = ["daemon", "up", "--foreground"];
|
|
12885
|
+
if (opts.noTcp)
|
|
12886
|
+
args.push("--no-tcp");
|
|
12887
|
+
if (opts.publicHealth)
|
|
12888
|
+
args.push("--public-health");
|
|
12889
|
+
const out = openSync3(logPath, "a");
|
|
12890
|
+
const err = openSync3(logPath, "a");
|
|
12891
|
+
const child = spawn(process.execPath, [binary, ...args], {
|
|
12892
|
+
detached: true,
|
|
12893
|
+
stdio: ["ignore", out, err],
|
|
12894
|
+
env: process.env
|
|
12895
|
+
});
|
|
12896
|
+
child.unref();
|
|
12897
|
+
const sockPath = DAEMON_PATHS.SOCK_FILE;
|
|
12898
|
+
const startedAt = Date.now();
|
|
12899
|
+
while (Date.now() - startedAt < 3000) {
|
|
12900
|
+
if (existsSync13(sockPath)) {
|
|
12901
|
+
if (opts.json) {
|
|
12902
|
+
process.stdout.write(JSON.stringify({ ok: true, detached: true, pid: child.pid, log: logPath }) + `
|
|
12903
|
+
`);
|
|
12904
|
+
} else {
|
|
12905
|
+
process.stdout.write(` ✔ daemon started (pid ${child.pid})
|
|
12906
|
+
`);
|
|
12907
|
+
process.stdout.write(` → log: ${logPath}
|
|
12908
|
+
`);
|
|
12909
|
+
process.stdout.write(` → stop: claudemesh daemon down
|
|
12910
|
+
`);
|
|
12911
|
+
}
|
|
12912
|
+
return 0;
|
|
12913
|
+
}
|
|
12914
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
12915
|
+
}
|
|
12916
|
+
if (opts.json) {
|
|
12917
|
+
process.stdout.write(JSON.stringify({ ok: false, detached: true, pid: child.pid, reason: "socket_not_appeared", log: logPath }) + `
|
|
12918
|
+
`);
|
|
12919
|
+
} else {
|
|
12920
|
+
process.stderr.write(` ✘ daemon spawn timeout: socket did not appear within 3s
|
|
12921
|
+
`);
|
|
12922
|
+
process.stderr.write(` → check log: ${logPath}
|
|
12923
|
+
`);
|
|
12924
|
+
process.stderr.write(` → run foreground for live output: claudemesh daemon up --foreground
|
|
12925
|
+
`);
|
|
12926
|
+
}
|
|
12927
|
+
return 1;
|
|
12928
|
+
}
|
|
12849
12929
|
var init_daemon = __esm(() => {
|
|
12850
12930
|
init_run();
|
|
12851
12931
|
init_client3();
|
|
@@ -12862,17 +12942,17 @@ __export(exports_install, {
|
|
|
12862
12942
|
import {
|
|
12863
12943
|
chmodSync as chmodSync4,
|
|
12864
12944
|
copyFileSync,
|
|
12865
|
-
existsSync as
|
|
12866
|
-
mkdirSync as
|
|
12945
|
+
existsSync as existsSync14,
|
|
12946
|
+
mkdirSync as mkdirSync9,
|
|
12867
12947
|
readFileSync as readFileSync12,
|
|
12868
12948
|
writeFileSync as writeFileSync12
|
|
12869
12949
|
} from "node:fs";
|
|
12870
12950
|
import { homedir as homedir8, platform as platform5 } from "node:os";
|
|
12871
|
-
import { dirname as dirname6, join as
|
|
12951
|
+
import { dirname as dirname6, join as join10, resolve } from "node:path";
|
|
12872
12952
|
import { fileURLToPath } from "node:url";
|
|
12873
12953
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
12874
12954
|
function readClaudeConfig() {
|
|
12875
|
-
if (!
|
|
12955
|
+
if (!existsSync14(CLAUDE_CONFIG))
|
|
12876
12956
|
return {};
|
|
12877
12957
|
const text = readFileSync12(CLAUDE_CONFIG, "utf-8").trim();
|
|
12878
12958
|
if (!text)
|
|
@@ -12884,12 +12964,12 @@ function readClaudeConfig() {
|
|
|
12884
12964
|
}
|
|
12885
12965
|
}
|
|
12886
12966
|
function backupClaudeConfig() {
|
|
12887
|
-
if (!
|
|
12967
|
+
if (!existsSync14(CLAUDE_CONFIG))
|
|
12888
12968
|
return;
|
|
12889
|
-
const backupDir =
|
|
12890
|
-
|
|
12969
|
+
const backupDir = join10(dirname6(CLAUDE_CONFIG), ".claude", "backups");
|
|
12970
|
+
mkdirSync9(backupDir, { recursive: true });
|
|
12891
12971
|
const ts = Date.now();
|
|
12892
|
-
const dest =
|
|
12972
|
+
const dest = join10(backupDir, `.claude.json.pre-claudemesh.${ts}`);
|
|
12893
12973
|
copyFileSync(CLAUDE_CONFIG, dest);
|
|
12894
12974
|
}
|
|
12895
12975
|
function patchMcpServer(entry) {
|
|
@@ -12913,7 +12993,7 @@ function patchMcpServer(entry) {
|
|
|
12913
12993
|
return action;
|
|
12914
12994
|
}
|
|
12915
12995
|
function removeMcpServer() {
|
|
12916
|
-
if (!
|
|
12996
|
+
if (!existsSync14(CLAUDE_CONFIG))
|
|
12917
12997
|
return false;
|
|
12918
12998
|
backupClaudeConfig();
|
|
12919
12999
|
const cfg = readClaudeConfig();
|
|
@@ -12926,7 +13006,7 @@ function removeMcpServer() {
|
|
|
12926
13006
|
return true;
|
|
12927
13007
|
}
|
|
12928
13008
|
function flushClaudeConfig(obj) {
|
|
12929
|
-
|
|
13009
|
+
mkdirSync9(dirname6(CLAUDE_CONFIG), { recursive: true });
|
|
12930
13010
|
writeFileSync12(CLAUDE_CONFIG, JSON.stringify(obj, null, 2) + `
|
|
12931
13011
|
`, "utf-8");
|
|
12932
13012
|
try {
|
|
@@ -12949,8 +13029,8 @@ function resolveEntry() {
|
|
|
12949
13029
|
function resolveBundledSkillsDir() {
|
|
12950
13030
|
const here = fileURLToPath(import.meta.url);
|
|
12951
13031
|
const pkgRoot = resolve(dirname6(here), "..", "..");
|
|
12952
|
-
const skillsDir =
|
|
12953
|
-
if (
|
|
13032
|
+
const skillsDir = join10(pkgRoot, "skills");
|
|
13033
|
+
if (existsSync14(skillsDir))
|
|
12954
13034
|
return skillsDir;
|
|
12955
13035
|
return null;
|
|
12956
13036
|
}
|
|
@@ -12963,13 +13043,13 @@ function installSkills() {
|
|
|
12963
13043
|
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
12964
13044
|
if (!entry.isDirectory())
|
|
12965
13045
|
continue;
|
|
12966
|
-
const srcDir =
|
|
12967
|
-
const dstDir =
|
|
12968
|
-
|
|
13046
|
+
const srcDir = join10(src, entry.name);
|
|
13047
|
+
const dstDir = join10(CLAUDE_SKILLS_ROOT, entry.name);
|
|
13048
|
+
mkdirSync9(dstDir, { recursive: true });
|
|
12969
13049
|
for (const file of fs.readdirSync(srcDir, { withFileTypes: true })) {
|
|
12970
13050
|
if (!file.isFile())
|
|
12971
13051
|
continue;
|
|
12972
|
-
copyFileSync(
|
|
13052
|
+
copyFileSync(join10(srcDir, file.name), join10(dstDir, file.name));
|
|
12973
13053
|
}
|
|
12974
13054
|
installed.push(entry.name);
|
|
12975
13055
|
}
|
|
@@ -12984,8 +13064,8 @@ function uninstallSkills() {
|
|
|
12984
13064
|
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
12985
13065
|
if (!entry.isDirectory())
|
|
12986
13066
|
continue;
|
|
12987
|
-
const dstDir =
|
|
12988
|
-
if (
|
|
13067
|
+
const dstDir = join10(CLAUDE_SKILLS_ROOT, entry.name);
|
|
13068
|
+
if (existsSync14(dstDir)) {
|
|
12989
13069
|
try {
|
|
12990
13070
|
fs.rmSync(dstDir, { recursive: true, force: true });
|
|
12991
13071
|
removed.push(entry.name);
|
|
@@ -13010,7 +13090,7 @@ function entriesEqual(a, b) {
|
|
|
13010
13090
|
return a.command === b.command && JSON.stringify(a.args ?? []) === JSON.stringify(b.args ?? []);
|
|
13011
13091
|
}
|
|
13012
13092
|
function readClaudeSettings() {
|
|
13013
|
-
if (!
|
|
13093
|
+
if (!existsSync14(CLAUDE_SETTINGS))
|
|
13014
13094
|
return {};
|
|
13015
13095
|
const text = readFileSync12(CLAUDE_SETTINGS, "utf-8").trim();
|
|
13016
13096
|
if (!text)
|
|
@@ -13022,7 +13102,7 @@ function readClaudeSettings() {
|
|
|
13022
13102
|
}
|
|
13023
13103
|
}
|
|
13024
13104
|
function writeClaudeSettings(obj) {
|
|
13025
|
-
|
|
13105
|
+
mkdirSync9(dirname6(CLAUDE_SETTINGS), { recursive: true });
|
|
13026
13106
|
writeFileSync12(CLAUDE_SETTINGS, JSON.stringify(obj, null, 2) + `
|
|
13027
13107
|
`, "utf-8");
|
|
13028
13108
|
}
|
|
@@ -13037,7 +13117,7 @@ function installAllowedTools() {
|
|
|
13037
13117
|
return { added: toAdd, unchanged: CLAUDEMESH_TOOLS.length - toAdd.length };
|
|
13038
13118
|
}
|
|
13039
13119
|
function uninstallAllowedTools() {
|
|
13040
|
-
if (!
|
|
13120
|
+
if (!existsSync14(CLAUDE_SETTINGS))
|
|
13041
13121
|
return 0;
|
|
13042
13122
|
const settings = readClaudeSettings();
|
|
13043
13123
|
const existing = settings.allowedTools ?? [];
|
|
@@ -13072,7 +13152,7 @@ function installHooks() {
|
|
|
13072
13152
|
return { added, unchanged };
|
|
13073
13153
|
}
|
|
13074
13154
|
function uninstallHooks() {
|
|
13075
|
-
if (!
|
|
13155
|
+
if (!existsSync14(CLAUDE_SETTINGS))
|
|
13076
13156
|
return 0;
|
|
13077
13157
|
const settings = readClaudeSettings();
|
|
13078
13158
|
const hooks2 = settings.hooks;
|
|
@@ -13122,7 +13202,7 @@ async function runInstall(args = []) {
|
|
|
13122
13202
|
render.err("`bun` is not on PATH.", "Install Bun first: https://bun.com");
|
|
13123
13203
|
process.exit(1);
|
|
13124
13204
|
}
|
|
13125
|
-
if (!
|
|
13205
|
+
if (!existsSync14(entry)) {
|
|
13126
13206
|
render.err(`MCP entry not found at ${entry}`);
|
|
13127
13207
|
process.exit(1);
|
|
13128
13208
|
}
|
|
@@ -13173,7 +13253,7 @@ async function runInstall(args = []) {
|
|
|
13173
13253
|
const installed = installSkills();
|
|
13174
13254
|
if (installed.length > 0) {
|
|
13175
13255
|
render.ok(`Claude skill${installed.length === 1 ? "" : "s"} installed`, installed.join(", "));
|
|
13176
|
-
render.info(dim(` ${
|
|
13256
|
+
render.info(dim(` ${join10(CLAUDE_SKILLS_ROOT, installed[0])}/SKILL.md`));
|
|
13177
13257
|
}
|
|
13178
13258
|
} catch (e) {
|
|
13179
13259
|
render.warn(`skill install failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -13336,9 +13416,9 @@ var init_install = __esm(() => {
|
|
|
13336
13416
|
init_facade();
|
|
13337
13417
|
init_render();
|
|
13338
13418
|
init_styles();
|
|
13339
|
-
CLAUDE_CONFIG =
|
|
13340
|
-
CLAUDE_SETTINGS =
|
|
13341
|
-
CLAUDE_SKILLS_ROOT =
|
|
13419
|
+
CLAUDE_CONFIG = join10(homedir8(), ".claude.json");
|
|
13420
|
+
CLAUDE_SETTINGS = join10(homedir8(), ".claude", "settings.json");
|
|
13421
|
+
CLAUDE_SKILLS_ROOT = join10(homedir8(), ".claude", "skills");
|
|
13342
13422
|
CLAUDEMESH_TOOLS = [
|
|
13343
13423
|
"mcp__claudemesh__cancel_scheduled",
|
|
13344
13424
|
"mcp__claudemesh__check_messages",
|
|
@@ -13393,19 +13473,19 @@ var exports_uninstall = {};
|
|
|
13393
13473
|
__export(exports_uninstall, {
|
|
13394
13474
|
uninstall: () => uninstall
|
|
13395
13475
|
});
|
|
13396
|
-
import { readFileSync as readFileSync13, writeFileSync as writeFileSync13, existsSync as
|
|
13397
|
-
import { join as
|
|
13476
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync13, existsSync as existsSync15, rmSync as rmSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
13477
|
+
import { join as join11, dirname as dirname7 } from "node:path";
|
|
13398
13478
|
import { homedir as homedir9 } from "node:os";
|
|
13399
13479
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
13400
13480
|
function bundledSkillsDir() {
|
|
13401
13481
|
const here = fileURLToPath2(import.meta.url);
|
|
13402
|
-
const pkgRoot =
|
|
13403
|
-
const skillsDir =
|
|
13404
|
-
return
|
|
13482
|
+
const pkgRoot = join11(dirname7(here), "..", "..");
|
|
13483
|
+
const skillsDir = join11(pkgRoot, "skills");
|
|
13484
|
+
return existsSync15(skillsDir) ? skillsDir : null;
|
|
13405
13485
|
}
|
|
13406
13486
|
async function uninstall() {
|
|
13407
13487
|
let removed = 0;
|
|
13408
|
-
if (
|
|
13488
|
+
if (existsSync15(PATHS.CLAUDE_JSON)) {
|
|
13409
13489
|
try {
|
|
13410
13490
|
const raw = readFileSync13(PATHS.CLAUDE_JSON, "utf-8");
|
|
13411
13491
|
const config = JSON.parse(raw);
|
|
@@ -13419,7 +13499,7 @@ async function uninstall() {
|
|
|
13419
13499
|
}
|
|
13420
13500
|
} catch {}
|
|
13421
13501
|
}
|
|
13422
|
-
if (
|
|
13502
|
+
if (existsSync15(PATHS.CLAUDE_SETTINGS)) {
|
|
13423
13503
|
try {
|
|
13424
13504
|
const raw = readFileSync13(PATHS.CLAUDE_SETTINGS, "utf-8");
|
|
13425
13505
|
const config = JSON.parse(raw);
|
|
@@ -13457,8 +13537,8 @@ async function uninstall() {
|
|
|
13457
13537
|
for (const entry of readdirSync2(src, { withFileTypes: true })) {
|
|
13458
13538
|
if (!entry.isDirectory())
|
|
13459
13539
|
continue;
|
|
13460
|
-
const dst =
|
|
13461
|
-
if (
|
|
13540
|
+
const dst = join11(CLAUDE_SKILLS_ROOT2, entry.name);
|
|
13541
|
+
if (existsSync15(dst)) {
|
|
13462
13542
|
try {
|
|
13463
13543
|
rmSync2(dst, { recursive: true, force: true });
|
|
13464
13544
|
removedSkills.push(entry.name);
|
|
@@ -13482,7 +13562,7 @@ var init_uninstall = __esm(() => {
|
|
|
13482
13562
|
init_render();
|
|
13483
13563
|
init_styles();
|
|
13484
13564
|
init_exit_codes();
|
|
13485
|
-
CLAUDE_SKILLS_ROOT2 =
|
|
13565
|
+
CLAUDE_SKILLS_ROOT2 = join11(homedir9(), ".claude", "skills");
|
|
13486
13566
|
});
|
|
13487
13567
|
|
|
13488
13568
|
// src/commands/doctor.ts
|
|
@@ -13490,9 +13570,9 @@ var exports_doctor = {};
|
|
|
13490
13570
|
__export(exports_doctor, {
|
|
13491
13571
|
runDoctor: () => runDoctor
|
|
13492
13572
|
});
|
|
13493
|
-
import { existsSync as
|
|
13573
|
+
import { existsSync as existsSync16, readFileSync as readFileSync14, statSync as statSync3 } from "node:fs";
|
|
13494
13574
|
import { homedir as homedir10, platform as platform6 } from "node:os";
|
|
13495
|
-
import { join as
|
|
13575
|
+
import { join as join12 } from "node:path";
|
|
13496
13576
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
13497
13577
|
function checkNode() {
|
|
13498
13578
|
const major = Number(process.versions.node.split(".")[0]);
|
|
@@ -13516,8 +13596,8 @@ function checkClaudeOnPath() {
|
|
|
13516
13596
|
};
|
|
13517
13597
|
}
|
|
13518
13598
|
function checkMcpRegistered() {
|
|
13519
|
-
const claudeConfig =
|
|
13520
|
-
if (!
|
|
13599
|
+
const claudeConfig = join12(homedir10(), ".claude.json");
|
|
13600
|
+
if (!existsSync16(claudeConfig)) {
|
|
13521
13601
|
return {
|
|
13522
13602
|
name: "claudemesh MCP registered in ~/.claude.json",
|
|
13523
13603
|
pass: false,
|
|
@@ -13542,8 +13622,8 @@ function checkMcpRegistered() {
|
|
|
13542
13622
|
}
|
|
13543
13623
|
}
|
|
13544
13624
|
function checkHooksRegistered() {
|
|
13545
|
-
const settings =
|
|
13546
|
-
if (!
|
|
13625
|
+
const settings = join12(homedir10(), ".claude", "settings.json");
|
|
13626
|
+
if (!existsSync16(settings)) {
|
|
13547
13627
|
return {
|
|
13548
13628
|
name: "Status hooks registered in ~/.claude/settings.json",
|
|
13549
13629
|
pass: false,
|
|
@@ -13568,7 +13648,7 @@ function checkHooksRegistered() {
|
|
|
13568
13648
|
}
|
|
13569
13649
|
function checkConfigFile() {
|
|
13570
13650
|
const path2 = getConfigPath();
|
|
13571
|
-
if (!
|
|
13651
|
+
if (!existsSync16(path2)) {
|
|
13572
13652
|
return {
|
|
13573
13653
|
name: "~/.claudemesh/config.json exists and parses",
|
|
13574
13654
|
pass: true,
|
|
@@ -13751,7 +13831,7 @@ var exports_status = {};
|
|
|
13751
13831
|
__export(exports_status, {
|
|
13752
13832
|
runStatus: () => runStatus2
|
|
13753
13833
|
});
|
|
13754
|
-
import { statSync as statSync4, existsSync as
|
|
13834
|
+
import { statSync as statSync4, existsSync as existsSync17 } from "node:fs";
|
|
13755
13835
|
import WebSocket3 from "ws";
|
|
13756
13836
|
async function probeBroker(url, timeoutMs = 4000) {
|
|
13757
13837
|
return new Promise((resolve2) => {
|
|
@@ -13781,7 +13861,7 @@ async function runStatus2() {
|
|
|
13781
13861
|
render.section(`status (v${VERSION})`);
|
|
13782
13862
|
const configPath = getConfigPath();
|
|
13783
13863
|
let configPermsNote = "missing";
|
|
13784
|
-
if (
|
|
13864
|
+
if (existsSync17(configPath)) {
|
|
13785
13865
|
const mode = (statSync4(configPath).mode & 511).toString(8).padStart(4, "0");
|
|
13786
13866
|
configPermsNote = mode === "0600" ? `${mode}` : `${mode} — expected 0600`;
|
|
13787
13867
|
}
|
|
@@ -13927,10 +14007,10 @@ var init_check_claude_binary = __esm(() => {
|
|
|
13927
14007
|
});
|
|
13928
14008
|
|
|
13929
14009
|
// src/services/health/check-mcp-registered.ts
|
|
13930
|
-
import { existsSync as
|
|
14010
|
+
import { existsSync as existsSync18, readFileSync as readFileSync15 } from "node:fs";
|
|
13931
14011
|
function checkMcpRegistered2() {
|
|
13932
14012
|
try {
|
|
13933
|
-
if (!
|
|
14013
|
+
if (!existsSync18(PATHS.CLAUDE_JSON)) {
|
|
13934
14014
|
return { name: "mcp-registered", ok: false, message: "~/.claude.json not found" };
|
|
13935
14015
|
}
|
|
13936
14016
|
const raw = readFileSync15(PATHS.CLAUDE_JSON, "utf-8");
|
|
@@ -13948,10 +14028,10 @@ var init_check_mcp_registered = __esm(() => {
|
|
|
13948
14028
|
});
|
|
13949
14029
|
|
|
13950
14030
|
// src/services/health/check-hooks-registered.ts
|
|
13951
|
-
import { existsSync as
|
|
14031
|
+
import { existsSync as existsSync19, readFileSync as readFileSync16 } from "node:fs";
|
|
13952
14032
|
function checkHooksRegistered2() {
|
|
13953
14033
|
try {
|
|
13954
|
-
if (!
|
|
14034
|
+
if (!existsSync19(PATHS.CLAUDE_SETTINGS)) {
|
|
13955
14035
|
return { name: "hooks-registered", ok: false, message: "~/.claude/settings.json not found" };
|
|
13956
14036
|
}
|
|
13957
14037
|
const raw = readFileSync16(PATHS.CLAUDE_SETTINGS, "utf-8");
|
|
@@ -13969,10 +14049,10 @@ var init_check_hooks_registered = __esm(() => {
|
|
|
13969
14049
|
});
|
|
13970
14050
|
|
|
13971
14051
|
// src/services/health/check-config-perms.ts
|
|
13972
|
-
import { existsSync as
|
|
14052
|
+
import { existsSync as existsSync20, statSync as statSync5 } from "node:fs";
|
|
13973
14053
|
function checkConfigPerms() {
|
|
13974
14054
|
const configFile = PATHS.CONFIG_FILE;
|
|
13975
|
-
if (!
|
|
14055
|
+
if (!existsSync20(configFile)) {
|
|
13976
14056
|
return { name: "config-perms", ok: true, message: "No config file yet (first run)" };
|
|
13977
14057
|
}
|
|
13978
14058
|
try {
|
|
@@ -13990,9 +14070,9 @@ var init_check_config_perms = __esm(() => {
|
|
|
13990
14070
|
});
|
|
13991
14071
|
|
|
13992
14072
|
// src/services/health/check-keypairs-valid.ts
|
|
13993
|
-
import { existsSync as
|
|
14073
|
+
import { existsSync as existsSync21, readFileSync as readFileSync17 } from "node:fs";
|
|
13994
14074
|
function checkKeypairsValid() {
|
|
13995
|
-
if (!
|
|
14075
|
+
if (!existsSync21(PATHS.CONFIG_FILE)) {
|
|
13996
14076
|
return { name: "keypairs-valid", ok: true, message: "No config (first run)" };
|
|
13997
14077
|
}
|
|
13998
14078
|
try {
|
|
@@ -14477,18 +14557,18 @@ __export(exports_url_handler, {
|
|
|
14477
14557
|
runUrlHandler: () => runUrlHandler
|
|
14478
14558
|
});
|
|
14479
14559
|
import { platform as platform7, homedir as homedir11 } from "node:os";
|
|
14480
|
-
import { existsSync as
|
|
14481
|
-
import { join as
|
|
14560
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync10, writeFileSync as writeFileSync14, rmSync as rmSync3, chmodSync as chmodSync5 } from "node:fs";
|
|
14561
|
+
import { join as join13 } from "node:path";
|
|
14482
14562
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
14483
14563
|
function resolveClaudemeshBin() {
|
|
14484
14564
|
return process.argv[1] ?? "claudemesh";
|
|
14485
14565
|
}
|
|
14486
14566
|
function installDarwin2() {
|
|
14487
14567
|
const binPath = resolveClaudemeshBin();
|
|
14488
|
-
const appDir =
|
|
14489
|
-
const contents =
|
|
14490
|
-
const macOS =
|
|
14491
|
-
|
|
14568
|
+
const appDir = join13(homedir11(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
|
|
14569
|
+
const contents = join13(appDir, "Contents");
|
|
14570
|
+
const macOS = join13(contents, "MacOS");
|
|
14571
|
+
mkdirSync10(macOS, { recursive: true });
|
|
14492
14572
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
14493
14573
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
14494
14574
|
<plist version="1.0">
|
|
@@ -14511,7 +14591,7 @@ function installDarwin2() {
|
|
|
14511
14591
|
</array>
|
|
14512
14592
|
</dict>
|
|
14513
14593
|
</plist>`;
|
|
14514
|
-
writeFileSync14(
|
|
14594
|
+
writeFileSync14(join13(contents, "Info.plist"), plist);
|
|
14515
14595
|
const shim = `#!/bin/sh
|
|
14516
14596
|
URL="$1"
|
|
14517
14597
|
CODE=\${URL#claudemesh://}
|
|
@@ -14525,7 +14605,7 @@ tell application "Terminal"
|
|
|
14525
14605
|
end tell
|
|
14526
14606
|
EOF
|
|
14527
14607
|
`;
|
|
14528
|
-
const shimPath =
|
|
14608
|
+
const shimPath = join13(macOS, "open-url");
|
|
14529
14609
|
writeFileSync14(shimPath, shim);
|
|
14530
14610
|
chmodSync5(shimPath, 493);
|
|
14531
14611
|
const lsreg = spawnSync5("/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister", ["-f", appDir], { encoding: "utf-8" });
|
|
@@ -14537,8 +14617,8 @@ EOF
|
|
|
14537
14617
|
}
|
|
14538
14618
|
function installLinux2() {
|
|
14539
14619
|
const binPath = resolveClaudemeshBin();
|
|
14540
|
-
const appsDir =
|
|
14541
|
-
|
|
14620
|
+
const appsDir = join13(homedir11(), ".local", "share", "applications");
|
|
14621
|
+
mkdirSync10(appsDir, { recursive: true });
|
|
14542
14622
|
const desktop = `[Desktop Entry]
|
|
14543
14623
|
Type=Application
|
|
14544
14624
|
Name=Claudemesh
|
|
@@ -14549,7 +14629,7 @@ Terminal=true
|
|
|
14549
14629
|
MimeType=x-scheme-handler/claudemesh;
|
|
14550
14630
|
NoDisplay=true
|
|
14551
14631
|
`;
|
|
14552
|
-
const desktopPath =
|
|
14632
|
+
const desktopPath = join13(appsDir, "claudemesh.desktop");
|
|
14553
14633
|
writeFileSync14(desktopPath, desktop);
|
|
14554
14634
|
const xdg1 = spawnSync5("xdg-mime", ["default", "claudemesh.desktop", "x-scheme-handler/claudemesh"], { encoding: "utf-8" });
|
|
14555
14635
|
if (xdg1.status !== 0) {
|
|
@@ -14572,7 +14652,7 @@ function installWindows() {
|
|
|
14572
14652
|
`[HKEY_CURRENT_USER\\Software\\Classes\\claudemesh\\shell\\open\\command]`,
|
|
14573
14653
|
`@="\\"${binPath.replace(/\\/g, "\\\\")}\\" \\"%1\\""`
|
|
14574
14654
|
];
|
|
14575
|
-
const regPath =
|
|
14655
|
+
const regPath = join13(homedir11(), "claudemesh-handler.reg");
|
|
14576
14656
|
writeFileSync14(regPath, lines.join(`\r
|
|
14577
14657
|
`));
|
|
14578
14658
|
const res = spawnSync5("reg.exe", ["import", regPath], { encoding: "utf-8" });
|
|
@@ -14584,15 +14664,15 @@ function installWindows() {
|
|
|
14584
14664
|
return EXIT.SUCCESS;
|
|
14585
14665
|
}
|
|
14586
14666
|
function uninstallDarwin() {
|
|
14587
|
-
const appDir =
|
|
14588
|
-
if (
|
|
14667
|
+
const appDir = join13(homedir11(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
|
|
14668
|
+
if (existsSync22(appDir))
|
|
14589
14669
|
rmSync3(appDir, { recursive: true, force: true });
|
|
14590
14670
|
render.ok("removed claudemesh:// handler on macOS");
|
|
14591
14671
|
return EXIT.SUCCESS;
|
|
14592
14672
|
}
|
|
14593
14673
|
function uninstallLinux() {
|
|
14594
|
-
const desktopPath =
|
|
14595
|
-
if (
|
|
14674
|
+
const desktopPath = join13(homedir11(), ".local", "share", "applications", "claudemesh.desktop");
|
|
14675
|
+
if (existsSync22(desktopPath))
|
|
14596
14676
|
rmSync3(desktopPath, { force: true });
|
|
14597
14677
|
render.ok("removed claudemesh:// handler on Linux");
|
|
14598
14678
|
return EXIT.SUCCESS;
|
|
@@ -14637,8 +14717,8 @@ var exports_status_line = {};
|
|
|
14637
14717
|
__export(exports_status_line, {
|
|
14638
14718
|
runStatusLine: () => runStatusLine
|
|
14639
14719
|
});
|
|
14640
|
-
import { existsSync as
|
|
14641
|
-
import { join as
|
|
14720
|
+
import { existsSync as existsSync23, readFileSync as readFileSync18 } from "node:fs";
|
|
14721
|
+
import { join as join14 } from "node:path";
|
|
14642
14722
|
import { homedir as homedir12 } from "node:os";
|
|
14643
14723
|
async function runStatusLine() {
|
|
14644
14724
|
try {
|
|
@@ -14647,9 +14727,9 @@ async function runStatusLine() {
|
|
|
14647
14727
|
process.stdout.write("◇ claudemesh (not joined)");
|
|
14648
14728
|
return EXIT.SUCCESS;
|
|
14649
14729
|
}
|
|
14650
|
-
const cachePath =
|
|
14730
|
+
const cachePath = join14(homedir12(), ".claudemesh", "peer-cache.json");
|
|
14651
14731
|
let cache = {};
|
|
14652
|
-
if (
|
|
14732
|
+
if (existsSync23(cachePath)) {
|
|
14653
14733
|
try {
|
|
14654
14734
|
cache = JSON.parse(readFileSync18(cachePath, "utf-8"));
|
|
14655
14735
|
} catch {}
|
|
@@ -14682,7 +14762,7 @@ __export(exports_backup, {
|
|
|
14682
14762
|
runRestore: () => runRestore,
|
|
14683
14763
|
runBackup: () => runBackup
|
|
14684
14764
|
});
|
|
14685
|
-
import { readFileSync as readFileSync19, writeFileSync as writeFileSync15, existsSync as
|
|
14765
|
+
import { readFileSync as readFileSync19, writeFileSync as writeFileSync15, existsSync as existsSync24 } from "node:fs";
|
|
14686
14766
|
import { createInterface as createInterface11 } from "node:readline";
|
|
14687
14767
|
function readHidden(prompt5) {
|
|
14688
14768
|
return new Promise((resolve2) => {
|
|
@@ -14724,7 +14804,7 @@ async function deriveKey(pass, salt, s) {
|
|
|
14724
14804
|
}
|
|
14725
14805
|
async function runBackup(outPath) {
|
|
14726
14806
|
const configPath = getConfigPath();
|
|
14727
|
-
if (!
|
|
14807
|
+
if (!existsSync24(configPath)) {
|
|
14728
14808
|
console.error(" No config found — nothing to back up. Join a mesh first.");
|
|
14729
14809
|
return EXIT.NOT_FOUND;
|
|
14730
14810
|
}
|
|
@@ -14758,7 +14838,7 @@ async function runRestore(inPath) {
|
|
|
14758
14838
|
console.error(" Usage: claudemesh restore <backup-file>");
|
|
14759
14839
|
return EXIT.INVALID_ARGS;
|
|
14760
14840
|
}
|
|
14761
|
-
if (!
|
|
14841
|
+
if (!existsSync24(inPath)) {
|
|
14762
14842
|
console.error(` ✗ File not found: ${inPath}`);
|
|
14763
14843
|
return EXIT.NOT_FOUND;
|
|
14764
14844
|
}
|
|
@@ -14781,7 +14861,7 @@ async function runRestore(inPath) {
|
|
|
14781
14861
|
return EXIT.INTERNAL_ERROR;
|
|
14782
14862
|
}
|
|
14783
14863
|
const configPath = getConfigPath();
|
|
14784
|
-
if (
|
|
14864
|
+
if (existsSync24(configPath)) {
|
|
14785
14865
|
const backupOld = `${configPath}.before-restore.${Date.now()}`;
|
|
14786
14866
|
writeFileSync15(backupOld, readFileSync19(configPath), { mode: 384 });
|
|
14787
14867
|
console.log(` ↻ Existing config saved to ${backupOld}`);
|
|
@@ -14806,8 +14886,8 @@ __export(exports_upgrade, {
|
|
|
14806
14886
|
runUpgrade: () => runUpgrade
|
|
14807
14887
|
});
|
|
14808
14888
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
14809
|
-
import { existsSync as
|
|
14810
|
-
import { dirname as dirname8, join as
|
|
14889
|
+
import { existsSync as existsSync25 } from "node:fs";
|
|
14890
|
+
import { dirname as dirname8, join as join15, resolve as resolve2 } from "node:path";
|
|
14811
14891
|
async function latestVersion() {
|
|
14812
14892
|
try {
|
|
14813
14893
|
const res = await fetch(URLS.NPM_REGISTRY, { signal: AbortSignal.timeout(8000) });
|
|
@@ -14820,15 +14900,15 @@ async function latestVersion() {
|
|
|
14820
14900
|
}
|
|
14821
14901
|
}
|
|
14822
14902
|
function findNpm() {
|
|
14823
|
-
const portable =
|
|
14824
|
-
if (
|
|
14825
|
-
return { npm: portable, prefix:
|
|
14903
|
+
const portable = join15(process.env.HOME ?? "", ".claudemesh", "node", "bin", "npm");
|
|
14904
|
+
if (existsSync25(portable)) {
|
|
14905
|
+
return { npm: portable, prefix: join15(process.env.HOME ?? "", ".claudemesh") };
|
|
14826
14906
|
}
|
|
14827
14907
|
let cur = resolve2(process.argv[1] ?? ".");
|
|
14828
14908
|
for (let i = 0;i < 6; i++) {
|
|
14829
14909
|
cur = dirname8(cur);
|
|
14830
|
-
const candidate =
|
|
14831
|
-
if (
|
|
14910
|
+
const candidate = join15(cur, "bin", "npm");
|
|
14911
|
+
if (existsSync25(candidate))
|
|
14832
14912
|
return { npm: candidate };
|
|
14833
14913
|
}
|
|
14834
14914
|
return { npm: "npm" };
|
|
@@ -14890,9 +14970,9 @@ __export(exports_grants, {
|
|
|
14890
14970
|
runBlock: () => runBlock,
|
|
14891
14971
|
isAllowed: () => isAllowed
|
|
14892
14972
|
});
|
|
14893
|
-
import { existsSync as
|
|
14973
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync16 } from "node:fs";
|
|
14894
14974
|
import { homedir as homedir13 } from "node:os";
|
|
14895
|
-
import { join as
|
|
14975
|
+
import { join as join16 } from "node:path";
|
|
14896
14976
|
async function syncToBroker(meshSlug, grants) {
|
|
14897
14977
|
const auth = getStoredToken();
|
|
14898
14978
|
if (!auth)
|
|
@@ -14910,7 +14990,7 @@ async function syncToBroker(meshSlug, grants) {
|
|
|
14910
14990
|
}
|
|
14911
14991
|
}
|
|
14912
14992
|
function readGrants() {
|
|
14913
|
-
if (!
|
|
14993
|
+
if (!existsSync26(GRANT_FILE))
|
|
14914
14994
|
return {};
|
|
14915
14995
|
try {
|
|
14916
14996
|
return JSON.parse(readFileSync20(GRANT_FILE, "utf-8"));
|
|
@@ -14919,9 +14999,9 @@ function readGrants() {
|
|
|
14919
14999
|
}
|
|
14920
15000
|
}
|
|
14921
15001
|
function writeGrants(g) {
|
|
14922
|
-
const dir =
|
|
14923
|
-
if (!
|
|
14924
|
-
|
|
15002
|
+
const dir = join16(homedir13(), ".claudemesh");
|
|
15003
|
+
if (!existsSync26(dir))
|
|
15004
|
+
mkdirSync11(dir, { recursive: true });
|
|
14925
15005
|
writeFileSync16(GRANT_FILE, JSON.stringify(g, null, 2), { mode: 384 });
|
|
14926
15006
|
}
|
|
14927
15007
|
function resolveCaps(input) {
|
|
@@ -15078,7 +15158,7 @@ var init_grants = __esm(() => {
|
|
|
15078
15158
|
BROKER_HTTP7 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
|
|
15079
15159
|
ALL_CAPS = ["read", "dm", "broadcast", "state-read", "state-write", "file-read"];
|
|
15080
15160
|
DEFAULT_CAPS = ["read", "dm", "broadcast", "state-read"];
|
|
15081
|
-
GRANT_FILE =
|
|
15161
|
+
GRANT_FILE = join16(homedir13(), ".claudemesh", "grants.json");
|
|
15082
15162
|
});
|
|
15083
15163
|
|
|
15084
15164
|
// src/commands/profile.ts
|
|
@@ -16799,7 +16879,7 @@ __export(exports_file, {
|
|
|
16799
16879
|
});
|
|
16800
16880
|
import { hostname as osHostname2 } from "node:os";
|
|
16801
16881
|
import { resolve as resolvePath, basename, dirname as dirname9 } from "node:path";
|
|
16802
|
-
import { statSync as statSync7, existsSync as
|
|
16882
|
+
import { statSync as statSync7, existsSync as existsSync27, writeFileSync as writeFileSync17, mkdirSync as mkdirSync12 } from "node:fs";
|
|
16803
16883
|
function emitJson2(data) {
|
|
16804
16884
|
console.log(JSON.stringify(data, null, 2));
|
|
16805
16885
|
}
|
|
@@ -16816,7 +16896,7 @@ async function runFileShare(filePath, opts) {
|
|
|
16816
16896
|
return EXIT.INVALID_ARGS;
|
|
16817
16897
|
}
|
|
16818
16898
|
const absPath = resolvePath(filePath);
|
|
16819
|
-
if (!
|
|
16899
|
+
if (!existsSync27(absPath)) {
|
|
16820
16900
|
render.err(`File not found: ${absPath}`);
|
|
16821
16901
|
return EXIT.INVALID_ARGS;
|
|
16822
16902
|
}
|
|
@@ -16895,7 +16975,7 @@ async function runFileGet(fileId, opts) {
|
|
|
16895
16975
|
}
|
|
16896
16976
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
16897
16977
|
const outPath = opts.out ? resolvePath(opts.out) : resolvePath(process.cwd(), meta.name);
|
|
16898
|
-
|
|
16978
|
+
mkdirSync12(dirname9(outPath), { recursive: true });
|
|
16899
16979
|
writeFileSync17(outPath, buf);
|
|
16900
16980
|
if (opts.json) {
|
|
16901
16981
|
emitJson2({ fileId, name: meta.name, savedTo: outPath, sizeBytes: buf.length });
|
|
@@ -17506,7 +17586,7 @@ __export(exports_bridge, {
|
|
|
17506
17586
|
runBridge: () => runBridge,
|
|
17507
17587
|
bridgeConfigTemplate: () => bridgeConfigTemplate
|
|
17508
17588
|
});
|
|
17509
|
-
import { readFileSync as readFileSync21, existsSync as
|
|
17589
|
+
import { readFileSync as readFileSync21, existsSync as existsSync28 } from "node:fs";
|
|
17510
17590
|
function parseConfig(text) {
|
|
17511
17591
|
const trimmed = text.trim();
|
|
17512
17592
|
if (trimmed.startsWith("{"))
|
|
@@ -17550,7 +17630,7 @@ async function runBridge(configPath) {
|
|
|
17550
17630
|
render.err("Usage: claudemesh bridge run <config.yaml>");
|
|
17551
17631
|
return EXIT.INVALID_ARGS;
|
|
17552
17632
|
}
|
|
17553
|
-
if (!
|
|
17633
|
+
if (!existsSync28(configPath)) {
|
|
17554
17634
|
render.err(`config file not found: ${configPath}`);
|
|
17555
17635
|
return EXIT.NOT_FOUND;
|
|
17556
17636
|
}
|
|
@@ -18530,12 +18610,12 @@ import {
|
|
|
18530
18610
|
ListResourcesRequestSchema,
|
|
18531
18611
|
ReadResourceRequestSchema
|
|
18532
18612
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
18533
|
-
import { existsSync as
|
|
18613
|
+
import { existsSync as existsSync29, appendFileSync as appendFileSync2 } from "node:fs";
|
|
18534
18614
|
import { request as httpRequest2 } from "node:http";
|
|
18535
|
-
import { join as
|
|
18615
|
+
import { join as join17 } from "node:path";
|
|
18536
18616
|
async function daemonReady() {
|
|
18537
18617
|
for (let i = 0;i < DAEMON_BOOT_RETRIES; i++) {
|
|
18538
|
-
if (
|
|
18618
|
+
if (existsSync29(DAEMON_PATHS.SOCK_FILE))
|
|
18539
18619
|
return true;
|
|
18540
18620
|
await new Promise((r) => setTimeout(r, DAEMON_BOOT_RETRY_MS));
|
|
18541
18621
|
}
|
|
@@ -18806,7 +18886,7 @@ ${mf.allowed_tools.map((t) => ` - ${t}`).join(`
|
|
|
18806
18886
|
return { contents: [{ uri, mimeType: "text/markdown", text: fm.join(`
|
|
18807
18887
|
`) + skill.instructions }] };
|
|
18808
18888
|
});
|
|
18809
|
-
const mcpLogPath =
|
|
18889
|
+
const mcpLogPath = join17(DAEMON_PATHS.DAEMON_DIR, `mcp-${process.pid}.log`);
|
|
18810
18890
|
const mcpLog = (msg, meta) => {
|
|
18811
18891
|
const line = JSON.stringify({ ts: new Date().toISOString(), pid: process.pid, msg, ...meta }) + `
|
|
18812
18892
|
`;
|
|
@@ -19303,7 +19383,10 @@ var BOOLEAN_FLAGS = new Set([
|
|
|
19303
19383
|
"dry-run",
|
|
19304
19384
|
"verbose",
|
|
19305
19385
|
"skip-service",
|
|
19306
|
-
"unread"
|
|
19386
|
+
"unread",
|
|
19387
|
+
"foreground",
|
|
19388
|
+
"no-tcp",
|
|
19389
|
+
"public-health"
|
|
19307
19390
|
]);
|
|
19308
19391
|
function parseArgv(argv) {
|
|
19309
19392
|
const args = argv.slice(2);
|
|
@@ -20422,6 +20505,7 @@ async function main() {
|
|
|
20422
20505
|
publicHealth: !!flags["public-health"],
|
|
20423
20506
|
mesh: flags.mesh,
|
|
20424
20507
|
displayName: flags.name,
|
|
20508
|
+
foreground: !!flags.foreground,
|
|
20425
20509
|
outboxStatus,
|
|
20426
20510
|
newClientId: flags["new-client-id"]
|
|
20427
20511
|
}, rest);
|
|
@@ -21129,4 +21213,4 @@ main().catch((err) => {
|
|
|
21129
21213
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
21130
21214
|
});
|
|
21131
21215
|
|
|
21132
|
-
//# debugId=
|
|
21216
|
+
//# debugId=B3ABB74B4F12DA0564756E2164756E21
|