claudemesh-cli 1.34.11 → 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.
@@ -104,7 +104,7 @@ __export(exports_urls, {
104
104
  VERSION: () => VERSION,
105
105
  URLS: () => URLS
106
106
  });
107
- var URLS, VERSION = "1.34.11", env;
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",
@@ -12416,6 +12414,7 @@ function installDarwin(args) {
12416
12414
  `<string>${escapeXml(args.binaryPath)}</string>`,
12417
12415
  "<string>daemon</string>",
12418
12416
  "<string>up</string>",
12417
+ "<string>--foreground</string>",
12419
12418
  ...args.meshSlug ? ["<string>--mesh</string>", `<string>${escapeXml(args.meshSlug)}</string>`] : [],
12420
12419
  ...args.displayName ? ["<string>--name</string>", `<string>${escapeXml(args.displayName)}</string>`] : []
12421
12420
  ].join(`
@@ -12482,6 +12481,7 @@ function installLinux(args) {
12482
12481
  const execArgs = [
12483
12482
  "daemon",
12484
12483
  "up",
12484
+ "--foreground",
12485
12485
  ...args.meshSlug ? ["--mesh", args.meshSlug] : [],
12486
12486
  ...args.displayName ? ["--name", args.displayName] : []
12487
12487
  ].map(shellQuote).join(" ");
@@ -12554,6 +12554,9 @@ var exports_daemon = {};
12554
12554
  __export(exports_daemon, {
12555
12555
  runDaemonCommand: () => runDaemonCommand
12556
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";
12557
12560
  async function runDaemonCommand(sub, opts, rest = []) {
12558
12561
  switch (sub) {
12559
12562
  case undefined:
@@ -12568,6 +12571,9 @@ async function runDaemonCommand(sub, opts, rest = []) {
12568
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}.
12569
12572
  `);
12570
12573
  }
12574
+ if (!opts.foreground) {
12575
+ return spawnDetachedDaemon(opts);
12576
+ }
12571
12577
  return runDaemon({
12572
12578
  tcpEnabled: !opts.noTcp,
12573
12579
  publicHealthCheck: opts.publicHealth
@@ -12606,7 +12612,7 @@ USAGE
12606
12612
  claudemesh daemon <command> [options]
12607
12613
 
12608
12614
  COMMANDS
12609
- up | start start the daemon in the foreground
12615
+ up | start start the daemon (detached by default)
12610
12616
  status show running pid + IPC health
12611
12617
  version ipc + schema version of the running daemon
12612
12618
  down | stop stop the running daemon (SIGTERM, then wait)
@@ -12617,7 +12623,7 @@ COMMANDS
12617
12623
  uninstall-service remove the platform service unit
12618
12624
 
12619
12625
  OPTIONS
12620
- --name <displayName> override CLAUDEMESH_DISPLAY_NAME
12626
+ --foreground keep daemon attached to terminal, JSON logs to stdout (1.34.12+)
12621
12627
  --no-tcp disable the loopback TCP listener (UDS only)
12622
12628
  --public-health expose /v1/health unauthenticated on TCP
12623
12629
  --json machine-readable output where supported
@@ -12871,6 +12877,55 @@ async function runStop(opts) {
12871
12877
  `);
12872
12878
  return 1;
12873
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
+ }
12874
12929
  var init_daemon = __esm(() => {
12875
12930
  init_run();
12876
12931
  init_client3();
@@ -12887,17 +12942,17 @@ __export(exports_install, {
12887
12942
  import {
12888
12943
  chmodSync as chmodSync4,
12889
12944
  copyFileSync,
12890
- existsSync as existsSync13,
12891
- mkdirSync as mkdirSync8,
12945
+ existsSync as existsSync14,
12946
+ mkdirSync as mkdirSync9,
12892
12947
  readFileSync as readFileSync12,
12893
12948
  writeFileSync as writeFileSync12
12894
12949
  } from "node:fs";
12895
12950
  import { homedir as homedir8, platform as platform5 } from "node:os";
12896
- import { dirname as dirname6, join as join9, resolve } from "node:path";
12951
+ import { dirname as dirname6, join as join10, resolve } from "node:path";
12897
12952
  import { fileURLToPath } from "node:url";
12898
12953
  import { spawnSync as spawnSync3 } from "node:child_process";
12899
12954
  function readClaudeConfig() {
12900
- if (!existsSync13(CLAUDE_CONFIG))
12955
+ if (!existsSync14(CLAUDE_CONFIG))
12901
12956
  return {};
12902
12957
  const text = readFileSync12(CLAUDE_CONFIG, "utf-8").trim();
12903
12958
  if (!text)
@@ -12909,12 +12964,12 @@ function readClaudeConfig() {
12909
12964
  }
12910
12965
  }
12911
12966
  function backupClaudeConfig() {
12912
- if (!existsSync13(CLAUDE_CONFIG))
12967
+ if (!existsSync14(CLAUDE_CONFIG))
12913
12968
  return;
12914
- const backupDir = join9(dirname6(CLAUDE_CONFIG), ".claude", "backups");
12915
- mkdirSync8(backupDir, { recursive: true });
12969
+ const backupDir = join10(dirname6(CLAUDE_CONFIG), ".claude", "backups");
12970
+ mkdirSync9(backupDir, { recursive: true });
12916
12971
  const ts = Date.now();
12917
- const dest = join9(backupDir, `.claude.json.pre-claudemesh.${ts}`);
12972
+ const dest = join10(backupDir, `.claude.json.pre-claudemesh.${ts}`);
12918
12973
  copyFileSync(CLAUDE_CONFIG, dest);
12919
12974
  }
12920
12975
  function patchMcpServer(entry) {
@@ -12938,7 +12993,7 @@ function patchMcpServer(entry) {
12938
12993
  return action;
12939
12994
  }
12940
12995
  function removeMcpServer() {
12941
- if (!existsSync13(CLAUDE_CONFIG))
12996
+ if (!existsSync14(CLAUDE_CONFIG))
12942
12997
  return false;
12943
12998
  backupClaudeConfig();
12944
12999
  const cfg = readClaudeConfig();
@@ -12951,7 +13006,7 @@ function removeMcpServer() {
12951
13006
  return true;
12952
13007
  }
12953
13008
  function flushClaudeConfig(obj) {
12954
- mkdirSync8(dirname6(CLAUDE_CONFIG), { recursive: true });
13009
+ mkdirSync9(dirname6(CLAUDE_CONFIG), { recursive: true });
12955
13010
  writeFileSync12(CLAUDE_CONFIG, JSON.stringify(obj, null, 2) + `
12956
13011
  `, "utf-8");
12957
13012
  try {
@@ -12974,8 +13029,8 @@ function resolveEntry() {
12974
13029
  function resolveBundledSkillsDir() {
12975
13030
  const here = fileURLToPath(import.meta.url);
12976
13031
  const pkgRoot = resolve(dirname6(here), "..", "..");
12977
- const skillsDir = join9(pkgRoot, "skills");
12978
- if (existsSync13(skillsDir))
13032
+ const skillsDir = join10(pkgRoot, "skills");
13033
+ if (existsSync14(skillsDir))
12979
13034
  return skillsDir;
12980
13035
  return null;
12981
13036
  }
@@ -12988,13 +13043,13 @@ function installSkills() {
12988
13043
  for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
12989
13044
  if (!entry.isDirectory())
12990
13045
  continue;
12991
- const srcDir = join9(src, entry.name);
12992
- const dstDir = join9(CLAUDE_SKILLS_ROOT, entry.name);
12993
- mkdirSync8(dstDir, { recursive: true });
13046
+ const srcDir = join10(src, entry.name);
13047
+ const dstDir = join10(CLAUDE_SKILLS_ROOT, entry.name);
13048
+ mkdirSync9(dstDir, { recursive: true });
12994
13049
  for (const file of fs.readdirSync(srcDir, { withFileTypes: true })) {
12995
13050
  if (!file.isFile())
12996
13051
  continue;
12997
- copyFileSync(join9(srcDir, file.name), join9(dstDir, file.name));
13052
+ copyFileSync(join10(srcDir, file.name), join10(dstDir, file.name));
12998
13053
  }
12999
13054
  installed.push(entry.name);
13000
13055
  }
@@ -13009,8 +13064,8 @@ function uninstallSkills() {
13009
13064
  for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
13010
13065
  if (!entry.isDirectory())
13011
13066
  continue;
13012
- const dstDir = join9(CLAUDE_SKILLS_ROOT, entry.name);
13013
- if (existsSync13(dstDir)) {
13067
+ const dstDir = join10(CLAUDE_SKILLS_ROOT, entry.name);
13068
+ if (existsSync14(dstDir)) {
13014
13069
  try {
13015
13070
  fs.rmSync(dstDir, { recursive: true, force: true });
13016
13071
  removed.push(entry.name);
@@ -13035,7 +13090,7 @@ function entriesEqual(a, b) {
13035
13090
  return a.command === b.command && JSON.stringify(a.args ?? []) === JSON.stringify(b.args ?? []);
13036
13091
  }
13037
13092
  function readClaudeSettings() {
13038
- if (!existsSync13(CLAUDE_SETTINGS))
13093
+ if (!existsSync14(CLAUDE_SETTINGS))
13039
13094
  return {};
13040
13095
  const text = readFileSync12(CLAUDE_SETTINGS, "utf-8").trim();
13041
13096
  if (!text)
@@ -13047,7 +13102,7 @@ function readClaudeSettings() {
13047
13102
  }
13048
13103
  }
13049
13104
  function writeClaudeSettings(obj) {
13050
- mkdirSync8(dirname6(CLAUDE_SETTINGS), { recursive: true });
13105
+ mkdirSync9(dirname6(CLAUDE_SETTINGS), { recursive: true });
13051
13106
  writeFileSync12(CLAUDE_SETTINGS, JSON.stringify(obj, null, 2) + `
13052
13107
  `, "utf-8");
13053
13108
  }
@@ -13062,7 +13117,7 @@ function installAllowedTools() {
13062
13117
  return { added: toAdd, unchanged: CLAUDEMESH_TOOLS.length - toAdd.length };
13063
13118
  }
13064
13119
  function uninstallAllowedTools() {
13065
- if (!existsSync13(CLAUDE_SETTINGS))
13120
+ if (!existsSync14(CLAUDE_SETTINGS))
13066
13121
  return 0;
13067
13122
  const settings = readClaudeSettings();
13068
13123
  const existing = settings.allowedTools ?? [];
@@ -13097,7 +13152,7 @@ function installHooks() {
13097
13152
  return { added, unchanged };
13098
13153
  }
13099
13154
  function uninstallHooks() {
13100
- if (!existsSync13(CLAUDE_SETTINGS))
13155
+ if (!existsSync14(CLAUDE_SETTINGS))
13101
13156
  return 0;
13102
13157
  const settings = readClaudeSettings();
13103
13158
  const hooks2 = settings.hooks;
@@ -13147,7 +13202,7 @@ async function runInstall(args = []) {
13147
13202
  render.err("`bun` is not on PATH.", "Install Bun first: https://bun.com");
13148
13203
  process.exit(1);
13149
13204
  }
13150
- if (!existsSync13(entry)) {
13205
+ if (!existsSync14(entry)) {
13151
13206
  render.err(`MCP entry not found at ${entry}`);
13152
13207
  process.exit(1);
13153
13208
  }
@@ -13198,7 +13253,7 @@ async function runInstall(args = []) {
13198
13253
  const installed = installSkills();
13199
13254
  if (installed.length > 0) {
13200
13255
  render.ok(`Claude skill${installed.length === 1 ? "" : "s"} installed`, installed.join(", "));
13201
- render.info(dim(` ${join9(CLAUDE_SKILLS_ROOT, installed[0])}/SKILL.md`));
13256
+ render.info(dim(` ${join10(CLAUDE_SKILLS_ROOT, installed[0])}/SKILL.md`));
13202
13257
  }
13203
13258
  } catch (e) {
13204
13259
  render.warn(`skill install failed: ${e instanceof Error ? e.message : String(e)}`);
@@ -13361,9 +13416,9 @@ var init_install = __esm(() => {
13361
13416
  init_facade();
13362
13417
  init_render();
13363
13418
  init_styles();
13364
- CLAUDE_CONFIG = join9(homedir8(), ".claude.json");
13365
- CLAUDE_SETTINGS = join9(homedir8(), ".claude", "settings.json");
13366
- CLAUDE_SKILLS_ROOT = join9(homedir8(), ".claude", "skills");
13419
+ CLAUDE_CONFIG = join10(homedir8(), ".claude.json");
13420
+ CLAUDE_SETTINGS = join10(homedir8(), ".claude", "settings.json");
13421
+ CLAUDE_SKILLS_ROOT = join10(homedir8(), ".claude", "skills");
13367
13422
  CLAUDEMESH_TOOLS = [
13368
13423
  "mcp__claudemesh__cancel_scheduled",
13369
13424
  "mcp__claudemesh__check_messages",
@@ -13418,19 +13473,19 @@ var exports_uninstall = {};
13418
13473
  __export(exports_uninstall, {
13419
13474
  uninstall: () => uninstall
13420
13475
  });
13421
- import { readFileSync as readFileSync13, writeFileSync as writeFileSync13, existsSync as existsSync14, rmSync as rmSync2, readdirSync as readdirSync2 } from "node:fs";
13422
- import { join as join10, dirname as dirname7 } from "node:path";
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";
13423
13478
  import { homedir as homedir9 } from "node:os";
13424
13479
  import { fileURLToPath as fileURLToPath2 } from "node:url";
13425
13480
  function bundledSkillsDir() {
13426
13481
  const here = fileURLToPath2(import.meta.url);
13427
- const pkgRoot = join10(dirname7(here), "..", "..");
13428
- const skillsDir = join10(pkgRoot, "skills");
13429
- return existsSync14(skillsDir) ? skillsDir : null;
13482
+ const pkgRoot = join11(dirname7(here), "..", "..");
13483
+ const skillsDir = join11(pkgRoot, "skills");
13484
+ return existsSync15(skillsDir) ? skillsDir : null;
13430
13485
  }
13431
13486
  async function uninstall() {
13432
13487
  let removed = 0;
13433
- if (existsSync14(PATHS.CLAUDE_JSON)) {
13488
+ if (existsSync15(PATHS.CLAUDE_JSON)) {
13434
13489
  try {
13435
13490
  const raw = readFileSync13(PATHS.CLAUDE_JSON, "utf-8");
13436
13491
  const config = JSON.parse(raw);
@@ -13444,7 +13499,7 @@ async function uninstall() {
13444
13499
  }
13445
13500
  } catch {}
13446
13501
  }
13447
- if (existsSync14(PATHS.CLAUDE_SETTINGS)) {
13502
+ if (existsSync15(PATHS.CLAUDE_SETTINGS)) {
13448
13503
  try {
13449
13504
  const raw = readFileSync13(PATHS.CLAUDE_SETTINGS, "utf-8");
13450
13505
  const config = JSON.parse(raw);
@@ -13482,8 +13537,8 @@ async function uninstall() {
13482
13537
  for (const entry of readdirSync2(src, { withFileTypes: true })) {
13483
13538
  if (!entry.isDirectory())
13484
13539
  continue;
13485
- const dst = join10(CLAUDE_SKILLS_ROOT2, entry.name);
13486
- if (existsSync14(dst)) {
13540
+ const dst = join11(CLAUDE_SKILLS_ROOT2, entry.name);
13541
+ if (existsSync15(dst)) {
13487
13542
  try {
13488
13543
  rmSync2(dst, { recursive: true, force: true });
13489
13544
  removedSkills.push(entry.name);
@@ -13507,7 +13562,7 @@ var init_uninstall = __esm(() => {
13507
13562
  init_render();
13508
13563
  init_styles();
13509
13564
  init_exit_codes();
13510
- CLAUDE_SKILLS_ROOT2 = join10(homedir9(), ".claude", "skills");
13565
+ CLAUDE_SKILLS_ROOT2 = join11(homedir9(), ".claude", "skills");
13511
13566
  });
13512
13567
 
13513
13568
  // src/commands/doctor.ts
@@ -13515,9 +13570,9 @@ var exports_doctor = {};
13515
13570
  __export(exports_doctor, {
13516
13571
  runDoctor: () => runDoctor
13517
13572
  });
13518
- import { existsSync as existsSync15, readFileSync as readFileSync14, statSync as statSync3 } from "node:fs";
13573
+ import { existsSync as existsSync16, readFileSync as readFileSync14, statSync as statSync3 } from "node:fs";
13519
13574
  import { homedir as homedir10, platform as platform6 } from "node:os";
13520
- import { join as join11 } from "node:path";
13575
+ import { join as join12 } from "node:path";
13521
13576
  import { spawnSync as spawnSync4 } from "node:child_process";
13522
13577
  function checkNode() {
13523
13578
  const major = Number(process.versions.node.split(".")[0]);
@@ -13541,8 +13596,8 @@ function checkClaudeOnPath() {
13541
13596
  };
13542
13597
  }
13543
13598
  function checkMcpRegistered() {
13544
- const claudeConfig = join11(homedir10(), ".claude.json");
13545
- if (!existsSync15(claudeConfig)) {
13599
+ const claudeConfig = join12(homedir10(), ".claude.json");
13600
+ if (!existsSync16(claudeConfig)) {
13546
13601
  return {
13547
13602
  name: "claudemesh MCP registered in ~/.claude.json",
13548
13603
  pass: false,
@@ -13567,8 +13622,8 @@ function checkMcpRegistered() {
13567
13622
  }
13568
13623
  }
13569
13624
  function checkHooksRegistered() {
13570
- const settings = join11(homedir10(), ".claude", "settings.json");
13571
- if (!existsSync15(settings)) {
13625
+ const settings = join12(homedir10(), ".claude", "settings.json");
13626
+ if (!existsSync16(settings)) {
13572
13627
  return {
13573
13628
  name: "Status hooks registered in ~/.claude/settings.json",
13574
13629
  pass: false,
@@ -13593,7 +13648,7 @@ function checkHooksRegistered() {
13593
13648
  }
13594
13649
  function checkConfigFile() {
13595
13650
  const path2 = getConfigPath();
13596
- if (!existsSync15(path2)) {
13651
+ if (!existsSync16(path2)) {
13597
13652
  return {
13598
13653
  name: "~/.claudemesh/config.json exists and parses",
13599
13654
  pass: true,
@@ -13776,7 +13831,7 @@ var exports_status = {};
13776
13831
  __export(exports_status, {
13777
13832
  runStatus: () => runStatus2
13778
13833
  });
13779
- import { statSync as statSync4, existsSync as existsSync16 } from "node:fs";
13834
+ import { statSync as statSync4, existsSync as existsSync17 } from "node:fs";
13780
13835
  import WebSocket3 from "ws";
13781
13836
  async function probeBroker(url, timeoutMs = 4000) {
13782
13837
  return new Promise((resolve2) => {
@@ -13806,7 +13861,7 @@ async function runStatus2() {
13806
13861
  render.section(`status (v${VERSION})`);
13807
13862
  const configPath = getConfigPath();
13808
13863
  let configPermsNote = "missing";
13809
- if (existsSync16(configPath)) {
13864
+ if (existsSync17(configPath)) {
13810
13865
  const mode = (statSync4(configPath).mode & 511).toString(8).padStart(4, "0");
13811
13866
  configPermsNote = mode === "0600" ? `${mode}` : `${mode} — expected 0600`;
13812
13867
  }
@@ -13952,10 +14007,10 @@ var init_check_claude_binary = __esm(() => {
13952
14007
  });
13953
14008
 
13954
14009
  // src/services/health/check-mcp-registered.ts
13955
- import { existsSync as existsSync17, readFileSync as readFileSync15 } from "node:fs";
14010
+ import { existsSync as existsSync18, readFileSync as readFileSync15 } from "node:fs";
13956
14011
  function checkMcpRegistered2() {
13957
14012
  try {
13958
- if (!existsSync17(PATHS.CLAUDE_JSON)) {
14013
+ if (!existsSync18(PATHS.CLAUDE_JSON)) {
13959
14014
  return { name: "mcp-registered", ok: false, message: "~/.claude.json not found" };
13960
14015
  }
13961
14016
  const raw = readFileSync15(PATHS.CLAUDE_JSON, "utf-8");
@@ -13973,10 +14028,10 @@ var init_check_mcp_registered = __esm(() => {
13973
14028
  });
13974
14029
 
13975
14030
  // src/services/health/check-hooks-registered.ts
13976
- import { existsSync as existsSync18, readFileSync as readFileSync16 } from "node:fs";
14031
+ import { existsSync as existsSync19, readFileSync as readFileSync16 } from "node:fs";
13977
14032
  function checkHooksRegistered2() {
13978
14033
  try {
13979
- if (!existsSync18(PATHS.CLAUDE_SETTINGS)) {
14034
+ if (!existsSync19(PATHS.CLAUDE_SETTINGS)) {
13980
14035
  return { name: "hooks-registered", ok: false, message: "~/.claude/settings.json not found" };
13981
14036
  }
13982
14037
  const raw = readFileSync16(PATHS.CLAUDE_SETTINGS, "utf-8");
@@ -13994,10 +14049,10 @@ var init_check_hooks_registered = __esm(() => {
13994
14049
  });
13995
14050
 
13996
14051
  // src/services/health/check-config-perms.ts
13997
- import { existsSync as existsSync19, statSync as statSync5 } from "node:fs";
14052
+ import { existsSync as existsSync20, statSync as statSync5 } from "node:fs";
13998
14053
  function checkConfigPerms() {
13999
14054
  const configFile = PATHS.CONFIG_FILE;
14000
- if (!existsSync19(configFile)) {
14055
+ if (!existsSync20(configFile)) {
14001
14056
  return { name: "config-perms", ok: true, message: "No config file yet (first run)" };
14002
14057
  }
14003
14058
  try {
@@ -14015,9 +14070,9 @@ var init_check_config_perms = __esm(() => {
14015
14070
  });
14016
14071
 
14017
14072
  // src/services/health/check-keypairs-valid.ts
14018
- import { existsSync as existsSync20, readFileSync as readFileSync17 } from "node:fs";
14073
+ import { existsSync as existsSync21, readFileSync as readFileSync17 } from "node:fs";
14019
14074
  function checkKeypairsValid() {
14020
- if (!existsSync20(PATHS.CONFIG_FILE)) {
14075
+ if (!existsSync21(PATHS.CONFIG_FILE)) {
14021
14076
  return { name: "keypairs-valid", ok: true, message: "No config (first run)" };
14022
14077
  }
14023
14078
  try {
@@ -14502,18 +14557,18 @@ __export(exports_url_handler, {
14502
14557
  runUrlHandler: () => runUrlHandler
14503
14558
  });
14504
14559
  import { platform as platform7, homedir as homedir11 } from "node:os";
14505
- import { existsSync as existsSync21, mkdirSync as mkdirSync9, writeFileSync as writeFileSync14, rmSync as rmSync3, chmodSync as chmodSync5 } from "node:fs";
14506
- import { join as join12 } from "node:path";
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";
14507
14562
  import { spawnSync as spawnSync5 } from "node:child_process";
14508
14563
  function resolveClaudemeshBin() {
14509
14564
  return process.argv[1] ?? "claudemesh";
14510
14565
  }
14511
14566
  function installDarwin2() {
14512
14567
  const binPath = resolveClaudemeshBin();
14513
- const appDir = join12(homedir11(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
14514
- const contents = join12(appDir, "Contents");
14515
- const macOS = join12(contents, "MacOS");
14516
- mkdirSync9(macOS, { recursive: true });
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 });
14517
14572
  const plist = `<?xml version="1.0" encoding="UTF-8"?>
14518
14573
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
14519
14574
  <plist version="1.0">
@@ -14536,7 +14591,7 @@ function installDarwin2() {
14536
14591
  </array>
14537
14592
  </dict>
14538
14593
  </plist>`;
14539
- writeFileSync14(join12(contents, "Info.plist"), plist);
14594
+ writeFileSync14(join13(contents, "Info.plist"), plist);
14540
14595
  const shim = `#!/bin/sh
14541
14596
  URL="$1"
14542
14597
  CODE=\${URL#claudemesh://}
@@ -14550,7 +14605,7 @@ tell application "Terminal"
14550
14605
  end tell
14551
14606
  EOF
14552
14607
  `;
14553
- const shimPath = join12(macOS, "open-url");
14608
+ const shimPath = join13(macOS, "open-url");
14554
14609
  writeFileSync14(shimPath, shim);
14555
14610
  chmodSync5(shimPath, 493);
14556
14611
  const lsreg = spawnSync5("/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister", ["-f", appDir], { encoding: "utf-8" });
@@ -14562,8 +14617,8 @@ EOF
14562
14617
  }
14563
14618
  function installLinux2() {
14564
14619
  const binPath = resolveClaudemeshBin();
14565
- const appsDir = join12(homedir11(), ".local", "share", "applications");
14566
- mkdirSync9(appsDir, { recursive: true });
14620
+ const appsDir = join13(homedir11(), ".local", "share", "applications");
14621
+ mkdirSync10(appsDir, { recursive: true });
14567
14622
  const desktop = `[Desktop Entry]
14568
14623
  Type=Application
14569
14624
  Name=Claudemesh
@@ -14574,7 +14629,7 @@ Terminal=true
14574
14629
  MimeType=x-scheme-handler/claudemesh;
14575
14630
  NoDisplay=true
14576
14631
  `;
14577
- const desktopPath = join12(appsDir, "claudemesh.desktop");
14632
+ const desktopPath = join13(appsDir, "claudemesh.desktop");
14578
14633
  writeFileSync14(desktopPath, desktop);
14579
14634
  const xdg1 = spawnSync5("xdg-mime", ["default", "claudemesh.desktop", "x-scheme-handler/claudemesh"], { encoding: "utf-8" });
14580
14635
  if (xdg1.status !== 0) {
@@ -14597,7 +14652,7 @@ function installWindows() {
14597
14652
  `[HKEY_CURRENT_USER\\Software\\Classes\\claudemesh\\shell\\open\\command]`,
14598
14653
  `@="\\"${binPath.replace(/\\/g, "\\\\")}\\" \\"%1\\""`
14599
14654
  ];
14600
- const regPath = join12(homedir11(), "claudemesh-handler.reg");
14655
+ const regPath = join13(homedir11(), "claudemesh-handler.reg");
14601
14656
  writeFileSync14(regPath, lines.join(`\r
14602
14657
  `));
14603
14658
  const res = spawnSync5("reg.exe", ["import", regPath], { encoding: "utf-8" });
@@ -14609,15 +14664,15 @@ function installWindows() {
14609
14664
  return EXIT.SUCCESS;
14610
14665
  }
14611
14666
  function uninstallDarwin() {
14612
- const appDir = join12(homedir11(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
14613
- if (existsSync21(appDir))
14667
+ const appDir = join13(homedir11(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
14668
+ if (existsSync22(appDir))
14614
14669
  rmSync3(appDir, { recursive: true, force: true });
14615
14670
  render.ok("removed claudemesh:// handler on macOS");
14616
14671
  return EXIT.SUCCESS;
14617
14672
  }
14618
14673
  function uninstallLinux() {
14619
- const desktopPath = join12(homedir11(), ".local", "share", "applications", "claudemesh.desktop");
14620
- if (existsSync21(desktopPath))
14674
+ const desktopPath = join13(homedir11(), ".local", "share", "applications", "claudemesh.desktop");
14675
+ if (existsSync22(desktopPath))
14621
14676
  rmSync3(desktopPath, { force: true });
14622
14677
  render.ok("removed claudemesh:// handler on Linux");
14623
14678
  return EXIT.SUCCESS;
@@ -14662,8 +14717,8 @@ var exports_status_line = {};
14662
14717
  __export(exports_status_line, {
14663
14718
  runStatusLine: () => runStatusLine
14664
14719
  });
14665
- import { existsSync as existsSync22, readFileSync as readFileSync18 } from "node:fs";
14666
- import { join as join13 } from "node:path";
14720
+ import { existsSync as existsSync23, readFileSync as readFileSync18 } from "node:fs";
14721
+ import { join as join14 } from "node:path";
14667
14722
  import { homedir as homedir12 } from "node:os";
14668
14723
  async function runStatusLine() {
14669
14724
  try {
@@ -14672,9 +14727,9 @@ async function runStatusLine() {
14672
14727
  process.stdout.write("◇ claudemesh (not joined)");
14673
14728
  return EXIT.SUCCESS;
14674
14729
  }
14675
- const cachePath = join13(homedir12(), ".claudemesh", "peer-cache.json");
14730
+ const cachePath = join14(homedir12(), ".claudemesh", "peer-cache.json");
14676
14731
  let cache = {};
14677
- if (existsSync22(cachePath)) {
14732
+ if (existsSync23(cachePath)) {
14678
14733
  try {
14679
14734
  cache = JSON.parse(readFileSync18(cachePath, "utf-8"));
14680
14735
  } catch {}
@@ -14707,7 +14762,7 @@ __export(exports_backup, {
14707
14762
  runRestore: () => runRestore,
14708
14763
  runBackup: () => runBackup
14709
14764
  });
14710
- import { readFileSync as readFileSync19, writeFileSync as writeFileSync15, existsSync as existsSync23 } from "node:fs";
14765
+ import { readFileSync as readFileSync19, writeFileSync as writeFileSync15, existsSync as existsSync24 } from "node:fs";
14711
14766
  import { createInterface as createInterface11 } from "node:readline";
14712
14767
  function readHidden(prompt5) {
14713
14768
  return new Promise((resolve2) => {
@@ -14749,7 +14804,7 @@ async function deriveKey(pass, salt, s) {
14749
14804
  }
14750
14805
  async function runBackup(outPath) {
14751
14806
  const configPath = getConfigPath();
14752
- if (!existsSync23(configPath)) {
14807
+ if (!existsSync24(configPath)) {
14753
14808
  console.error(" No config found — nothing to back up. Join a mesh first.");
14754
14809
  return EXIT.NOT_FOUND;
14755
14810
  }
@@ -14783,7 +14838,7 @@ async function runRestore(inPath) {
14783
14838
  console.error(" Usage: claudemesh restore <backup-file>");
14784
14839
  return EXIT.INVALID_ARGS;
14785
14840
  }
14786
- if (!existsSync23(inPath)) {
14841
+ if (!existsSync24(inPath)) {
14787
14842
  console.error(` ✗ File not found: ${inPath}`);
14788
14843
  return EXIT.NOT_FOUND;
14789
14844
  }
@@ -14806,7 +14861,7 @@ async function runRestore(inPath) {
14806
14861
  return EXIT.INTERNAL_ERROR;
14807
14862
  }
14808
14863
  const configPath = getConfigPath();
14809
- if (existsSync23(configPath)) {
14864
+ if (existsSync24(configPath)) {
14810
14865
  const backupOld = `${configPath}.before-restore.${Date.now()}`;
14811
14866
  writeFileSync15(backupOld, readFileSync19(configPath), { mode: 384 });
14812
14867
  console.log(` ↻ Existing config saved to ${backupOld}`);
@@ -14831,8 +14886,8 @@ __export(exports_upgrade, {
14831
14886
  runUpgrade: () => runUpgrade
14832
14887
  });
14833
14888
  import { spawnSync as spawnSync6 } from "node:child_process";
14834
- import { existsSync as existsSync24 } from "node:fs";
14835
- import { dirname as dirname8, join as join14, resolve as resolve2 } from "node:path";
14889
+ import { existsSync as existsSync25 } from "node:fs";
14890
+ import { dirname as dirname8, join as join15, resolve as resolve2 } from "node:path";
14836
14891
  async function latestVersion() {
14837
14892
  try {
14838
14893
  const res = await fetch(URLS.NPM_REGISTRY, { signal: AbortSignal.timeout(8000) });
@@ -14845,15 +14900,15 @@ async function latestVersion() {
14845
14900
  }
14846
14901
  }
14847
14902
  function findNpm() {
14848
- const portable = join14(process.env.HOME ?? "", ".claudemesh", "node", "bin", "npm");
14849
- if (existsSync24(portable)) {
14850
- return { npm: portable, prefix: join14(process.env.HOME ?? "", ".claudemesh") };
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") };
14851
14906
  }
14852
14907
  let cur = resolve2(process.argv[1] ?? ".");
14853
14908
  for (let i = 0;i < 6; i++) {
14854
14909
  cur = dirname8(cur);
14855
- const candidate = join14(cur, "bin", "npm");
14856
- if (existsSync24(candidate))
14910
+ const candidate = join15(cur, "bin", "npm");
14911
+ if (existsSync25(candidate))
14857
14912
  return { npm: candidate };
14858
14913
  }
14859
14914
  return { npm: "npm" };
@@ -14915,9 +14970,9 @@ __export(exports_grants, {
14915
14970
  runBlock: () => runBlock,
14916
14971
  isAllowed: () => isAllowed
14917
14972
  });
14918
- import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync20, writeFileSync as writeFileSync16 } from "node:fs";
14973
+ import { existsSync as existsSync26, mkdirSync as mkdirSync11, readFileSync as readFileSync20, writeFileSync as writeFileSync16 } from "node:fs";
14919
14974
  import { homedir as homedir13 } from "node:os";
14920
- import { join as join15 } from "node:path";
14975
+ import { join as join16 } from "node:path";
14921
14976
  async function syncToBroker(meshSlug, grants) {
14922
14977
  const auth = getStoredToken();
14923
14978
  if (!auth)
@@ -14935,7 +14990,7 @@ async function syncToBroker(meshSlug, grants) {
14935
14990
  }
14936
14991
  }
14937
14992
  function readGrants() {
14938
- if (!existsSync25(GRANT_FILE))
14993
+ if (!existsSync26(GRANT_FILE))
14939
14994
  return {};
14940
14995
  try {
14941
14996
  return JSON.parse(readFileSync20(GRANT_FILE, "utf-8"));
@@ -14944,9 +14999,9 @@ function readGrants() {
14944
14999
  }
14945
15000
  }
14946
15001
  function writeGrants(g) {
14947
- const dir = join15(homedir13(), ".claudemesh");
14948
- if (!existsSync25(dir))
14949
- mkdirSync10(dir, { recursive: true });
15002
+ const dir = join16(homedir13(), ".claudemesh");
15003
+ if (!existsSync26(dir))
15004
+ mkdirSync11(dir, { recursive: true });
14950
15005
  writeFileSync16(GRANT_FILE, JSON.stringify(g, null, 2), { mode: 384 });
14951
15006
  }
14952
15007
  function resolveCaps(input) {
@@ -15103,7 +15158,7 @@ var init_grants = __esm(() => {
15103
15158
  BROKER_HTTP7 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
15104
15159
  ALL_CAPS = ["read", "dm", "broadcast", "state-read", "state-write", "file-read"];
15105
15160
  DEFAULT_CAPS = ["read", "dm", "broadcast", "state-read"];
15106
- GRANT_FILE = join15(homedir13(), ".claudemesh", "grants.json");
15161
+ GRANT_FILE = join16(homedir13(), ".claudemesh", "grants.json");
15107
15162
  });
15108
15163
 
15109
15164
  // src/commands/profile.ts
@@ -16824,7 +16879,7 @@ __export(exports_file, {
16824
16879
  });
16825
16880
  import { hostname as osHostname2 } from "node:os";
16826
16881
  import { resolve as resolvePath, basename, dirname as dirname9 } from "node:path";
16827
- import { statSync as statSync7, existsSync as existsSync26, writeFileSync as writeFileSync17, mkdirSync as mkdirSync11 } from "node:fs";
16882
+ import { statSync as statSync7, existsSync as existsSync27, writeFileSync as writeFileSync17, mkdirSync as mkdirSync12 } from "node:fs";
16828
16883
  function emitJson2(data) {
16829
16884
  console.log(JSON.stringify(data, null, 2));
16830
16885
  }
@@ -16841,7 +16896,7 @@ async function runFileShare(filePath, opts) {
16841
16896
  return EXIT.INVALID_ARGS;
16842
16897
  }
16843
16898
  const absPath = resolvePath(filePath);
16844
- if (!existsSync26(absPath)) {
16899
+ if (!existsSync27(absPath)) {
16845
16900
  render.err(`File not found: ${absPath}`);
16846
16901
  return EXIT.INVALID_ARGS;
16847
16902
  }
@@ -16920,7 +16975,7 @@ async function runFileGet(fileId, opts) {
16920
16975
  }
16921
16976
  const buf = Buffer.from(await res.arrayBuffer());
16922
16977
  const outPath = opts.out ? resolvePath(opts.out) : resolvePath(process.cwd(), meta.name);
16923
- mkdirSync11(dirname9(outPath), { recursive: true });
16978
+ mkdirSync12(dirname9(outPath), { recursive: true });
16924
16979
  writeFileSync17(outPath, buf);
16925
16980
  if (opts.json) {
16926
16981
  emitJson2({ fileId, name: meta.name, savedTo: outPath, sizeBytes: buf.length });
@@ -17531,7 +17586,7 @@ __export(exports_bridge, {
17531
17586
  runBridge: () => runBridge,
17532
17587
  bridgeConfigTemplate: () => bridgeConfigTemplate
17533
17588
  });
17534
- import { readFileSync as readFileSync21, existsSync as existsSync27 } from "node:fs";
17589
+ import { readFileSync as readFileSync21, existsSync as existsSync28 } from "node:fs";
17535
17590
  function parseConfig(text) {
17536
17591
  const trimmed = text.trim();
17537
17592
  if (trimmed.startsWith("{"))
@@ -17575,7 +17630,7 @@ async function runBridge(configPath) {
17575
17630
  render.err("Usage: claudemesh bridge run <config.yaml>");
17576
17631
  return EXIT.INVALID_ARGS;
17577
17632
  }
17578
- if (!existsSync27(configPath)) {
17633
+ if (!existsSync28(configPath)) {
17579
17634
  render.err(`config file not found: ${configPath}`);
17580
17635
  return EXIT.NOT_FOUND;
17581
17636
  }
@@ -18555,12 +18610,12 @@ import {
18555
18610
  ListResourcesRequestSchema,
18556
18611
  ReadResourceRequestSchema
18557
18612
  } from "@modelcontextprotocol/sdk/types.js";
18558
- import { existsSync as existsSync28, appendFileSync as appendFileSync2 } from "node:fs";
18613
+ import { existsSync as existsSync29, appendFileSync as appendFileSync2 } from "node:fs";
18559
18614
  import { request as httpRequest2 } from "node:http";
18560
- import { join as join16 } from "node:path";
18615
+ import { join as join17 } from "node:path";
18561
18616
  async function daemonReady() {
18562
18617
  for (let i = 0;i < DAEMON_BOOT_RETRIES; i++) {
18563
- if (existsSync28(DAEMON_PATHS.SOCK_FILE))
18618
+ if (existsSync29(DAEMON_PATHS.SOCK_FILE))
18564
18619
  return true;
18565
18620
  await new Promise((r) => setTimeout(r, DAEMON_BOOT_RETRY_MS));
18566
18621
  }
@@ -18831,7 +18886,7 @@ ${mf.allowed_tools.map((t) => ` - ${t}`).join(`
18831
18886
  return { contents: [{ uri, mimeType: "text/markdown", text: fm.join(`
18832
18887
  `) + skill.instructions }] };
18833
18888
  });
18834
- const mcpLogPath = join16(DAEMON_PATHS.DAEMON_DIR, `mcp-${process.pid}.log`);
18889
+ const mcpLogPath = join17(DAEMON_PATHS.DAEMON_DIR, `mcp-${process.pid}.log`);
18835
18890
  const mcpLog = (msg, meta) => {
18836
18891
  const line = JSON.stringify({ ts: new Date().toISOString(), pid: process.pid, msg, ...meta }) + `
18837
18892
  `;
@@ -19328,7 +19383,10 @@ var BOOLEAN_FLAGS = new Set([
19328
19383
  "dry-run",
19329
19384
  "verbose",
19330
19385
  "skip-service",
19331
- "unread"
19386
+ "unread",
19387
+ "foreground",
19388
+ "no-tcp",
19389
+ "public-health"
19332
19390
  ]);
19333
19391
  function parseArgv(argv) {
19334
19392
  const args = argv.slice(2);
@@ -20447,6 +20505,7 @@ async function main() {
20447
20505
  publicHealth: !!flags["public-health"],
20448
20506
  mesh: flags.mesh,
20449
20507
  displayName: flags.name,
20508
+ foreground: !!flags.foreground,
20450
20509
  outboxStatus,
20451
20510
  newClientId: flags["new-client-id"]
20452
20511
  }, rest);
@@ -21154,4 +21213,4 @@ main().catch((err) => {
21154
21213
  process.exit(EXIT.INTERNAL_ERROR);
21155
21214
  });
21156
21215
 
21157
- //# debugId=3D8CCE13DCC94B5264756E2164756E21
21216
+ //# debugId=B3ABB74B4F12DA0564756E2164756E21