claudemesh-cli 1.2.0 → 1.3.0

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.
@@ -88,7 +88,7 @@ __export(exports_urls, {
88
88
  VERSION: () => VERSION,
89
89
  URLS: () => URLS
90
90
  });
91
- var URLS, VERSION = "1.2.0", env;
91
+ var URLS, VERSION = "1.3.0", env;
92
92
  var init_urls = __esm(() => {
93
93
  URLS = {
94
94
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -7570,16 +7570,65 @@ function bunAvailable() {
7570
7570
  const res = platform5() === "win32" ? spawnSync3("where", ["bun"]) : spawnSync3("sh", ["-c", "command -v bun"]);
7571
7571
  return res.status === 0;
7572
7572
  }
7573
+ function isBundledFile(p) {
7574
+ return /[/\\]dist[/\\]/.test(p);
7575
+ }
7573
7576
  function resolveEntry() {
7574
7577
  const here = fileURLToPath(import.meta.url);
7575
- if (here.endsWith("/dist/index.js") || here.endsWith("\\dist\\index.js")) {
7578
+ if (isBundledFile(here))
7576
7579
  return here;
7577
- }
7578
7580
  return resolve(dirname2(here), "..", "index.ts");
7579
7581
  }
7582
+ function resolveBundledSkillsDir() {
7583
+ const here = fileURLToPath(import.meta.url);
7584
+ const pkgRoot = resolve(dirname2(here), "..", "..");
7585
+ const skillsDir = join5(pkgRoot, "skills");
7586
+ if (existsSync6(skillsDir))
7587
+ return skillsDir;
7588
+ return null;
7589
+ }
7590
+ function installSkills() {
7591
+ const src = resolveBundledSkillsDir();
7592
+ if (!src)
7593
+ return [];
7594
+ const fs = __require("node:fs");
7595
+ const installed = [];
7596
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
7597
+ if (!entry.isDirectory())
7598
+ continue;
7599
+ const srcDir = join5(src, entry.name);
7600
+ const dstDir = join5(CLAUDE_SKILLS_ROOT, entry.name);
7601
+ mkdirSync3(dstDir, { recursive: true });
7602
+ for (const file of fs.readdirSync(srcDir, { withFileTypes: true })) {
7603
+ if (!file.isFile())
7604
+ continue;
7605
+ copyFileSync(join5(srcDir, file.name), join5(dstDir, file.name));
7606
+ }
7607
+ installed.push(entry.name);
7608
+ }
7609
+ return installed;
7610
+ }
7611
+ function uninstallSkills() {
7612
+ const src = resolveBundledSkillsDir();
7613
+ if (!src)
7614
+ return [];
7615
+ const fs = __require("node:fs");
7616
+ const removed = [];
7617
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
7618
+ if (!entry.isDirectory())
7619
+ continue;
7620
+ const dstDir = join5(CLAUDE_SKILLS_ROOT, entry.name);
7621
+ if (existsSync6(dstDir)) {
7622
+ try {
7623
+ fs.rmSync(dstDir, { recursive: true, force: true });
7624
+ removed.push(entry.name);
7625
+ } catch {}
7626
+ }
7627
+ }
7628
+ return removed;
7629
+ }
7580
7630
  function buildMcpEntry(entryPath) {
7581
- const isBundled = entryPath.endsWith("/dist/index.js") || entryPath.endsWith("\\dist\\index.js");
7582
- if (isBundled) {
7631
+ if (isBundledFile(entryPath)) {
7583
7632
  return {
7584
7633
  command: "claudemesh",
7585
7634
  args: ["mcp"]
@@ -7696,11 +7745,12 @@ function installStatusLine() {
7696
7745
  }
7697
7746
  function runInstall(args = []) {
7698
7747
  const skipHooks = args.includes("--no-hooks");
7748
+ const skipSkill = args.includes("--no-skill");
7699
7749
  const wantStatusLine = args.includes("--status-line");
7700
7750
  render.section("claudemesh install");
7701
7751
  const entry = resolveEntry();
7702
- const isBundled = entry.endsWith("/dist/index.js") || entry.endsWith("\\dist\\index.js");
7703
- if (!isBundled && !bunAvailable()) {
7752
+ const bundled = isBundledFile(entry);
7753
+ if (!bundled && !bunAvailable()) {
7704
7754
  render.err("`bun` is not on PATH.", "Install Bun first: https://bun.com");
7705
7755
  process.exit(1);
7706
7756
  }
@@ -7750,6 +7800,19 @@ function runInstall(args = []) {
7750
7800
  } else {
7751
7801
  render.info(dim("· Hooks skipped (--no-hooks)"));
7752
7802
  }
7803
+ if (!skipSkill) {
7804
+ try {
7805
+ const installed = installSkills();
7806
+ if (installed.length > 0) {
7807
+ render.ok(`Claude skill${installed.length === 1 ? "" : "s"} installed`, installed.join(", "));
7808
+ render.info(dim(` ${join5(CLAUDE_SKILLS_ROOT, installed[0])}/SKILL.md`));
7809
+ }
7810
+ } catch (e) {
7811
+ render.warn(`skill install failed: ${e instanceof Error ? e.message : String(e)}`);
7812
+ }
7813
+ } else {
7814
+ render.info(dim("· Skill install skipped (--no-skill)"));
7815
+ }
7753
7816
  if (wantStatusLine) {
7754
7817
  try {
7755
7818
  const { installed } = installStatusLine();
@@ -7812,16 +7875,27 @@ function runUninstall() {
7812
7875
  } catch (e) {
7813
7876
  render.warn(`hook removal failed: ${e instanceof Error ? e.message : String(e)}`);
7814
7877
  }
7878
+ try {
7879
+ const removed = uninstallSkills();
7880
+ if (removed.length > 0) {
7881
+ render.ok(`Skill${removed.length === 1 ? "" : "s"} removed`, removed.join(", "));
7882
+ } else {
7883
+ render.info(dim("· No claudemesh skills to remove"));
7884
+ }
7885
+ } catch (e) {
7886
+ render.warn(`skill removal failed: ${e instanceof Error ? e.message : String(e)}`);
7887
+ }
7815
7888
  render.blank();
7816
7889
  render.info("Restart Claude Code to drop the MCP connection + hooks.");
7817
7890
  }
7818
- var MCP_NAME = "claudemesh", CLAUDE_CONFIG, CLAUDE_SETTINGS, HOOK_COMMAND_STOP = "claudemesh hook idle", HOOK_COMMAND_USER_PROMPT = "claudemesh hook working", HOOK_MARKER = "claudemesh hook ", CLAUDEMESH_TOOLS;
7891
+ var MCP_NAME = "claudemesh", CLAUDE_CONFIG, CLAUDE_SETTINGS, HOOK_COMMAND_STOP = "claudemesh hook idle", HOOK_COMMAND_USER_PROMPT = "claudemesh hook working", HOOK_MARKER = "claudemesh hook ", CLAUDE_SKILLS_ROOT, CLAUDEMESH_TOOLS;
7819
7892
  var init_install = __esm(() => {
7820
7893
  init_facade();
7821
7894
  init_render();
7822
7895
  init_styles();
7823
7896
  CLAUDE_CONFIG = join5(homedir5(), ".claude.json");
7824
7897
  CLAUDE_SETTINGS = join5(homedir5(), ".claude", "settings.json");
7898
+ CLAUDE_SKILLS_ROOT = join5(homedir5(), ".claude", "skills");
7825
7899
  CLAUDEMESH_TOOLS = [
7826
7900
  "mcp__claudemesh__cancel_scheduled",
7827
7901
  "mcp__claudemesh__check_messages",
@@ -7876,7 +7950,16 @@ var exports_uninstall = {};
7876
7950
  __export(exports_uninstall, {
7877
7951
  uninstall: () => uninstall
7878
7952
  });
7879
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync6, existsSync as existsSync7 } from "node:fs";
7953
+ import { readFileSync as readFileSync5, writeFileSync as writeFileSync6, existsSync as existsSync7, rmSync as rmSync2, readdirSync as readdirSync2 } from "node:fs";
7954
+ import { join as join6, dirname as dirname3 } from "node:path";
7955
+ import { homedir as homedir6 } from "node:os";
7956
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
7957
+ function bundledSkillsDir() {
7958
+ const here = fileURLToPath2(import.meta.url);
7959
+ const pkgRoot = join6(dirname3(here), "..", "..");
7960
+ const skillsDir = join6(pkgRoot, "skills");
7961
+ return existsSync7(skillsDir) ? skillsDir : null;
7962
+ }
7880
7963
  async function uninstall() {
7881
7964
  let removed = 0;
7882
7965
  if (existsSync7(PATHS.CLAUDE_JSON)) {
@@ -7924,16 +8007,39 @@ async function uninstall() {
7924
8007
  }
7925
8008
  } catch {}
7926
8009
  }
8010
+ const src = bundledSkillsDir();
8011
+ if (src) {
8012
+ const removedSkills = [];
8013
+ try {
8014
+ for (const entry of readdirSync2(src, { withFileTypes: true })) {
8015
+ if (!entry.isDirectory())
8016
+ continue;
8017
+ const dst = join6(CLAUDE_SKILLS_ROOT2, entry.name);
8018
+ if (existsSync7(dst)) {
8019
+ try {
8020
+ rmSync2(dst, { recursive: true, force: true });
8021
+ removedSkills.push(entry.name);
8022
+ } catch {}
8023
+ }
8024
+ }
8025
+ if (removedSkills.length > 0) {
8026
+ render.ok(`removed Claude skill${removedSkills.length === 1 ? "" : "s"}`, removedSkills.join(", "));
8027
+ removed++;
8028
+ }
8029
+ } catch {}
8030
+ }
7927
8031
  if (removed === 0) {
7928
8032
  render.info(dim("Nothing to remove — claudemesh was not installed."));
7929
8033
  }
7930
8034
  return EXIT.SUCCESS;
7931
8035
  }
8036
+ var CLAUDE_SKILLS_ROOT2;
7932
8037
  var init_uninstall = __esm(() => {
7933
8038
  init_paths();
7934
8039
  init_render();
7935
8040
  init_styles();
7936
8041
  init_exit_codes();
8042
+ CLAUDE_SKILLS_ROOT2 = join6(homedir6(), ".claude", "skills");
7937
8043
  });
7938
8044
 
7939
8045
  // src/commands/doctor.ts
@@ -7942,8 +8048,8 @@ __export(exports_doctor, {
7942
8048
  runDoctor: () => runDoctor
7943
8049
  });
7944
8050
  import { existsSync as existsSync8, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
7945
- import { homedir as homedir6, platform as platform6 } from "node:os";
7946
- import { join as join6 } from "node:path";
8051
+ import { homedir as homedir7, platform as platform6 } from "node:os";
8052
+ import { join as join7 } from "node:path";
7947
8053
  import { spawnSync as spawnSync4 } from "node:child_process";
7948
8054
  function checkNode() {
7949
8055
  const major = Number(process.versions.node.split(".")[0]);
@@ -7967,7 +8073,7 @@ function checkClaudeOnPath() {
7967
8073
  };
7968
8074
  }
7969
8075
  function checkMcpRegistered() {
7970
- const claudeConfig = join6(homedir6(), ".claude.json");
8076
+ const claudeConfig = join7(homedir7(), ".claude.json");
7971
8077
  if (!existsSync8(claudeConfig)) {
7972
8078
  return {
7973
8079
  name: "claudemesh MCP registered in ~/.claude.json",
@@ -7993,7 +8099,7 @@ function checkMcpRegistered() {
7993
8099
  }
7994
8100
  }
7995
8101
  function checkHooksRegistered() {
7996
- const settings = join6(homedir6(), ".claude", "settings.json");
8102
+ const settings = join7(homedir7(), ".claude", "settings.json");
7997
8103
  if (!existsSync8(settings)) {
7998
8104
  return {
7999
8105
  name: "Status hooks registered in ~/.claude/settings.json",
@@ -8927,18 +9033,18 @@ var exports_url_handler = {};
8927
9033
  __export(exports_url_handler, {
8928
9034
  runUrlHandler: () => runUrlHandler
8929
9035
  });
8930
- import { platform as platform7, homedir as homedir7 } from "node:os";
8931
- import { existsSync as existsSync14, mkdirSync as mkdirSync4, writeFileSync as writeFileSync7, rmSync as rmSync2, chmodSync as chmodSync4 } from "node:fs";
8932
- import { join as join7 } from "node:path";
9036
+ import { platform as platform7, homedir as homedir8 } from "node:os";
9037
+ import { existsSync as existsSync14, mkdirSync as mkdirSync4, writeFileSync as writeFileSync7, rmSync as rmSync3, chmodSync as chmodSync4 } from "node:fs";
9038
+ import { join as join8 } from "node:path";
8933
9039
  import { spawnSync as spawnSync5 } from "node:child_process";
8934
9040
  function resolveClaudemeshBin() {
8935
9041
  return process.argv[1] ?? "claudemesh";
8936
9042
  }
8937
9043
  function installDarwin() {
8938
9044
  const binPath = resolveClaudemeshBin();
8939
- const appDir = join7(homedir7(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
8940
- const contents = join7(appDir, "Contents");
8941
- const macOS = join7(contents, "MacOS");
9045
+ const appDir = join8(homedir8(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
9046
+ const contents = join8(appDir, "Contents");
9047
+ const macOS = join8(contents, "MacOS");
8942
9048
  mkdirSync4(macOS, { recursive: true });
8943
9049
  const plist = `<?xml version="1.0" encoding="UTF-8"?>
8944
9050
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -8962,7 +9068,7 @@ function installDarwin() {
8962
9068
  </array>
8963
9069
  </dict>
8964
9070
  </plist>`;
8965
- writeFileSync7(join7(contents, "Info.plist"), plist);
9071
+ writeFileSync7(join8(contents, "Info.plist"), plist);
8966
9072
  const shim = `#!/bin/sh
8967
9073
  URL="$1"
8968
9074
  CODE=\${URL#claudemesh://}
@@ -8976,7 +9082,7 @@ tell application "Terminal"
8976
9082
  end tell
8977
9083
  EOF
8978
9084
  `;
8979
- const shimPath = join7(macOS, "open-url");
9085
+ const shimPath = join8(macOS, "open-url");
8980
9086
  writeFileSync7(shimPath, shim);
8981
9087
  chmodSync4(shimPath, 493);
8982
9088
  const lsreg = spawnSync5("/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister", ["-f", appDir], { encoding: "utf-8" });
@@ -8988,7 +9094,7 @@ EOF
8988
9094
  }
8989
9095
  function installLinux() {
8990
9096
  const binPath = resolveClaudemeshBin();
8991
- const appsDir = join7(homedir7(), ".local", "share", "applications");
9097
+ const appsDir = join8(homedir8(), ".local", "share", "applications");
8992
9098
  mkdirSync4(appsDir, { recursive: true });
8993
9099
  const desktop = `[Desktop Entry]
8994
9100
  Type=Application
@@ -9000,7 +9106,7 @@ Terminal=true
9000
9106
  MimeType=x-scheme-handler/claudemesh;
9001
9107
  NoDisplay=true
9002
9108
  `;
9003
- const desktopPath = join7(appsDir, "claudemesh.desktop");
9109
+ const desktopPath = join8(appsDir, "claudemesh.desktop");
9004
9110
  writeFileSync7(desktopPath, desktop);
9005
9111
  const xdg1 = spawnSync5("xdg-mime", ["default", "claudemesh.desktop", "x-scheme-handler/claudemesh"], { encoding: "utf-8" });
9006
9112
  if (xdg1.status !== 0) {
@@ -9023,7 +9129,7 @@ function installWindows() {
9023
9129
  `[HKEY_CURRENT_USER\\Software\\Classes\\claudemesh\\shell\\open\\command]`,
9024
9130
  `@="\\"${binPath.replace(/\\/g, "\\\\")}\\" \\"%1\\""`
9025
9131
  ];
9026
- const regPath = join7(homedir7(), "claudemesh-handler.reg");
9132
+ const regPath = join8(homedir8(), "claudemesh-handler.reg");
9027
9133
  writeFileSync7(regPath, lines.join(`\r
9028
9134
  `));
9029
9135
  const res = spawnSync5("reg.exe", ["import", regPath], { encoding: "utf-8" });
@@ -9035,16 +9141,16 @@ function installWindows() {
9035
9141
  return EXIT.SUCCESS;
9036
9142
  }
9037
9143
  function uninstallDarwin() {
9038
- const appDir = join7(homedir7(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
9144
+ const appDir = join8(homedir8(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
9039
9145
  if (existsSync14(appDir))
9040
- rmSync2(appDir, { recursive: true, force: true });
9146
+ rmSync3(appDir, { recursive: true, force: true });
9041
9147
  render.ok("removed claudemesh:// handler on macOS");
9042
9148
  return EXIT.SUCCESS;
9043
9149
  }
9044
9150
  function uninstallLinux() {
9045
- const desktopPath = join7(homedir7(), ".local", "share", "applications", "claudemesh.desktop");
9151
+ const desktopPath = join8(homedir8(), ".local", "share", "applications", "claudemesh.desktop");
9046
9152
  if (existsSync14(desktopPath))
9047
- rmSync2(desktopPath, { force: true });
9153
+ rmSync3(desktopPath, { force: true });
9048
9154
  render.ok("removed claudemesh:// handler on Linux");
9049
9155
  return EXIT.SUCCESS;
9050
9156
  }
@@ -9089,8 +9195,8 @@ __export(exports_status_line, {
9089
9195
  runStatusLine: () => runStatusLine
9090
9196
  });
9091
9197
  import { existsSync as existsSync15, readFileSync as readFileSync10 } from "node:fs";
9092
- import { join as join8 } from "node:path";
9093
- import { homedir as homedir8 } from "node:os";
9198
+ import { join as join9 } from "node:path";
9199
+ import { homedir as homedir9 } from "node:os";
9094
9200
  async function runStatusLine() {
9095
9201
  try {
9096
9202
  const config = readConfig();
@@ -9098,7 +9204,7 @@ async function runStatusLine() {
9098
9204
  process.stdout.write("◇ claudemesh (not joined)");
9099
9205
  return EXIT.SUCCESS;
9100
9206
  }
9101
- const cachePath = join8(homedir8(), ".claudemesh", "peer-cache.json");
9207
+ const cachePath = join9(homedir9(), ".claudemesh", "peer-cache.json");
9102
9208
  let cache = {};
9103
9209
  if (existsSync15(cachePath)) {
9104
9210
  try {
@@ -9258,7 +9364,7 @@ __export(exports_upgrade, {
9258
9364
  });
9259
9365
  import { spawnSync as spawnSync6 } from "node:child_process";
9260
9366
  import { existsSync as existsSync17 } from "node:fs";
9261
- import { dirname as dirname3, join as join9, resolve as resolve2 } from "node:path";
9367
+ import { dirname as dirname4, join as join10, resolve as resolve2 } from "node:path";
9262
9368
  async function latestVersion() {
9263
9369
  try {
9264
9370
  const res = await fetch(URLS.NPM_REGISTRY, { signal: AbortSignal.timeout(8000) });
@@ -9271,14 +9377,14 @@ async function latestVersion() {
9271
9377
  }
9272
9378
  }
9273
9379
  function findNpm() {
9274
- const portable = join9(process.env.HOME ?? "", ".claudemesh", "node", "bin", "npm");
9380
+ const portable = join10(process.env.HOME ?? "", ".claudemesh", "node", "bin", "npm");
9275
9381
  if (existsSync17(portable)) {
9276
- return { npm: portable, prefix: join9(process.env.HOME ?? "", ".claudemesh") };
9382
+ return { npm: portable, prefix: join10(process.env.HOME ?? "", ".claudemesh") };
9277
9383
  }
9278
9384
  let cur = resolve2(process.argv[1] ?? ".");
9279
9385
  for (let i = 0;i < 6; i++) {
9280
- cur = dirname3(cur);
9281
- const candidate = join9(cur, "bin", "npm");
9386
+ cur = dirname4(cur);
9387
+ const candidate = join10(cur, "bin", "npm");
9282
9388
  if (existsSync17(candidate))
9283
9389
  return { npm: candidate };
9284
9390
  }
@@ -9342,8 +9448,8 @@ __export(exports_grants, {
9342
9448
  isAllowed: () => isAllowed
9343
9449
  });
9344
9450
  import { existsSync as existsSync18, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync9 } from "node:fs";
9345
- import { homedir as homedir9 } from "node:os";
9346
- import { join as join10 } from "node:path";
9451
+ import { homedir as homedir10 } from "node:os";
9452
+ import { join as join11 } from "node:path";
9347
9453
  async function syncToBroker(meshSlug, grants) {
9348
9454
  const auth = getStoredToken();
9349
9455
  if (!auth)
@@ -9370,7 +9476,7 @@ function readGrants() {
9370
9476
  }
9371
9477
  }
9372
9478
  function writeGrants(g) {
9373
- const dir = join10(homedir9(), ".claudemesh");
9479
+ const dir = join11(homedir10(), ".claudemesh");
9374
9480
  if (!existsSync18(dir))
9375
9481
  mkdirSync5(dir, { recursive: true });
9376
9482
  writeFileSync9(GRANT_FILE, JSON.stringify(g, null, 2), { mode: 384 });
@@ -9457,79 +9563,839 @@ async function runRevoke(peer, caps, opts = {}) {
9457
9563
  render.kv([["now", after.length ? after.join(", ") : "(none)"]]);
9458
9564
  return EXIT.SUCCESS;
9459
9565
  }
9460
- async function runBlock(peer, opts = {}) {
9461
- if (!peer) {
9462
- render.err("Usage: claudemesh block <peer>");
9566
+ async function runBlock(peer, opts = {}) {
9567
+ if (!peer) {
9568
+ render.err("Usage: claudemesh block <peer>");
9569
+ return EXIT.INVALID_ARGS;
9570
+ }
9571
+ const mesh = pickMesh2(opts.mesh);
9572
+ if (!mesh) {
9573
+ render.err("No matching mesh.");
9574
+ return EXIT.NOT_FOUND;
9575
+ }
9576
+ const resolved = await resolvePeer(mesh, peer);
9577
+ if (!resolved) {
9578
+ render.err(`Peer "${peer}" not found on ${mesh}.`);
9579
+ return EXIT.NOT_FOUND;
9580
+ }
9581
+ const store = readGrants();
9582
+ const meshGrants = store[mesh] ?? {};
9583
+ meshGrants[resolved.pubkey] = [];
9584
+ store[mesh] = meshGrants;
9585
+ writeGrants(store);
9586
+ await syncToBroker(mesh, { [resolved.pubkey]: [] });
9587
+ render.ok(`Blocked ${resolved.displayName} on ${mesh} (all capabilities revoked).`);
9588
+ render.hint(`Undo with: claudemesh grant ${resolved.displayName} all --mesh ${mesh}`);
9589
+ return EXIT.SUCCESS;
9590
+ }
9591
+ async function runGrants(opts = {}) {
9592
+ const mesh = pickMesh2(opts.mesh);
9593
+ if (!mesh) {
9594
+ render.err("No matching mesh.");
9595
+ return EXIT.NOT_FOUND;
9596
+ }
9597
+ const store = readGrants();
9598
+ const meshGrants = store[mesh] ?? {};
9599
+ if (opts.json) {
9600
+ console.log(JSON.stringify({ schema_version: "1.0", mesh, grants: meshGrants }, null, 2));
9601
+ return EXIT.SUCCESS;
9602
+ }
9603
+ render.section(`grants on ${mesh}`);
9604
+ const peerPubkeys = Object.keys(meshGrants);
9605
+ if (peerPubkeys.length === 0) {
9606
+ render.info("(no overrides — all peers use default caps: " + DEFAULT_CAPS.join(", ") + ")");
9607
+ return EXIT.SUCCESS;
9608
+ }
9609
+ await withMesh({ meshSlug: mesh }, async (client) => {
9610
+ const peers = await client.listPeers();
9611
+ const byPk = new Map(peers.map((p) => [p.pubkey, p.displayName]));
9612
+ for (const [pk, caps] of Object.entries(meshGrants)) {
9613
+ const name = byPk.get(pk) ?? `${pk.slice(0, 10)}…`;
9614
+ render.kv([[name, caps.length ? caps.join(", ") : "(blocked)"]]);
9615
+ }
9616
+ });
9617
+ return EXIT.SUCCESS;
9618
+ }
9619
+ function isAllowed(meshSlug, peerPubkey, cap) {
9620
+ const store = readGrants();
9621
+ const entry = store[meshSlug]?.[peerPubkey];
9622
+ if (entry === undefined)
9623
+ return DEFAULT_CAPS.includes(cap);
9624
+ return entry.includes(cap);
9625
+ }
9626
+ var BROKER_HTTP7, ALL_CAPS, DEFAULT_CAPS, GRANT_FILE;
9627
+ var init_grants = __esm(() => {
9628
+ init_facade();
9629
+ init_connect();
9630
+ init_render();
9631
+ init_exit_codes();
9632
+ init_facade6();
9633
+ init_facade3();
9634
+ init_urls();
9635
+ BROKER_HTTP7 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
9636
+ ALL_CAPS = ["read", "dm", "broadcast", "state-read", "state-write", "file-read"];
9637
+ DEFAULT_CAPS = ["read", "dm", "broadcast", "state-read"];
9638
+ GRANT_FILE = join11(homedir10(), ".claudemesh", "grants.json");
9639
+ });
9640
+
9641
+ // src/commands/platform-actions.ts
9642
+ var exports_platform_actions = {};
9643
+ __export(exports_platform_actions, {
9644
+ runWebhookList: () => runWebhookList,
9645
+ runWebhookDelete: () => runWebhookDelete,
9646
+ runWatchList: () => runWatchList,
9647
+ runVectorStore: () => runVectorStore,
9648
+ runVectorSearch: () => runVectorSearch,
9649
+ runVectorDelete: () => runVectorDelete,
9650
+ runVectorCollections: () => runVectorCollections,
9651
+ runVaultList: () => runVaultList,
9652
+ runVaultDelete: () => runVaultDelete,
9653
+ runUnwatch: () => runUnwatch,
9654
+ runTaskList: () => runTaskList,
9655
+ runTaskCreate: () => runTaskCreate,
9656
+ runStreamPublish: () => runStreamPublish,
9657
+ runStreamList: () => runStreamList,
9658
+ runStreamCreate: () => runStreamCreate,
9659
+ runSqlSchema: () => runSqlSchema,
9660
+ runSqlQuery: () => runSqlQuery,
9661
+ runSqlExecute: () => runSqlExecute,
9662
+ runSkillRemove: () => runSkillRemove,
9663
+ runSkillList: () => runSkillList,
9664
+ runSkillGet: () => runSkillGet,
9665
+ runMeshMcpList: () => runMeshMcpList,
9666
+ runMeshMcpCatalog: () => runMeshMcpCatalog,
9667
+ runMeshMcpCall: () => runMeshMcpCall,
9668
+ runGraphQuery: () => runGraphQuery,
9669
+ runGraphExecute: () => runGraphExecute,
9670
+ runFileStatus: () => runFileStatus,
9671
+ runFileList: () => runFileList,
9672
+ runFileDelete: () => runFileDelete,
9673
+ runContextShare: () => runContextShare,
9674
+ runContextList: () => runContextList,
9675
+ runContextGet: () => runContextGet,
9676
+ runClockSet: () => runClockSet,
9677
+ runClockResume: () => runClockResume,
9678
+ runClockPause: () => runClockPause
9679
+ });
9680
+ function emitJson(data) {
9681
+ console.log(JSON.stringify(data, null, 2));
9682
+ }
9683
+ async function runVectorStore(collection, text, opts) {
9684
+ if (!collection || !text) {
9685
+ render.err("Usage: claudemesh vector store <collection> <text> [--metadata <json>]");
9686
+ return EXIT.INVALID_ARGS;
9687
+ }
9688
+ let metadata;
9689
+ if (opts.metadata) {
9690
+ try {
9691
+ metadata = JSON.parse(opts.metadata);
9692
+ } catch {
9693
+ render.err("--metadata must be JSON");
9694
+ return EXIT.INVALID_ARGS;
9695
+ }
9696
+ }
9697
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9698
+ const id = await client.vectorStore(collection, text, metadata);
9699
+ if (!id) {
9700
+ render.err("store failed");
9701
+ return EXIT.INTERNAL_ERROR;
9702
+ }
9703
+ if (opts.json)
9704
+ emitJson({ id, collection });
9705
+ else
9706
+ render.ok(`stored in ${clay(collection)}`, dim(id));
9707
+ return EXIT.SUCCESS;
9708
+ });
9709
+ }
9710
+ async function runVectorSearch(collection, query, opts) {
9711
+ if (!collection || !query) {
9712
+ render.err("Usage: claudemesh vector search <collection> <query> [--limit N]");
9713
+ return EXIT.INVALID_ARGS;
9714
+ }
9715
+ const limit = opts.limit ? parseInt(opts.limit, 10) : undefined;
9716
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9717
+ const hits = await client.vectorSearch(collection, query, limit);
9718
+ if (opts.json) {
9719
+ emitJson(hits);
9720
+ return EXIT.SUCCESS;
9721
+ }
9722
+ if (hits.length === 0) {
9723
+ render.info(dim("(no matches)"));
9724
+ return EXIT.SUCCESS;
9725
+ }
9726
+ render.section(`${hits.length} match${hits.length === 1 ? "" : "es"} in ${clay(collection)}`);
9727
+ for (const h of hits) {
9728
+ process.stdout.write(` ${bold(h.score.toFixed(3))} ${dim(h.id.slice(0, 8))} ${h.text}
9729
+ `);
9730
+ }
9731
+ return EXIT.SUCCESS;
9732
+ });
9733
+ }
9734
+ async function runVectorDelete(collection, id, opts) {
9735
+ if (!collection || !id) {
9736
+ render.err("Usage: claudemesh vector delete <collection> <id>");
9737
+ return EXIT.INVALID_ARGS;
9738
+ }
9739
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9740
+ await client.vectorDelete(collection, id);
9741
+ if (opts.json)
9742
+ emitJson({ id, deleted: true });
9743
+ else
9744
+ render.ok(`deleted ${dim(id.slice(0, 8))}`);
9745
+ return EXIT.SUCCESS;
9746
+ });
9747
+ }
9748
+ async function runVectorCollections(opts) {
9749
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9750
+ const cols = await client.listCollections();
9751
+ if (opts.json) {
9752
+ emitJson(cols);
9753
+ return EXIT.SUCCESS;
9754
+ }
9755
+ if (cols.length === 0) {
9756
+ render.info(dim("(no collections)"));
9757
+ return EXIT.SUCCESS;
9758
+ }
9759
+ render.section(`vector collections (${cols.length})`);
9760
+ for (const c of cols)
9761
+ process.stdout.write(` ${clay(c)}
9762
+ `);
9763
+ return EXIT.SUCCESS;
9764
+ });
9765
+ }
9766
+ async function runGraphQuery(cypher, opts) {
9767
+ if (!cypher) {
9768
+ render.err('Usage: claudemesh graph query "<cypher>"');
9769
+ return EXIT.INVALID_ARGS;
9770
+ }
9771
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9772
+ const rows = await client.graphQuery(cypher);
9773
+ if (opts.json) {
9774
+ emitJson(rows);
9775
+ return EXIT.SUCCESS;
9776
+ }
9777
+ if (rows.length === 0) {
9778
+ render.info(dim("(no rows)"));
9779
+ return EXIT.SUCCESS;
9780
+ }
9781
+ render.section(`${rows.length} row${rows.length === 1 ? "" : "s"}`);
9782
+ for (const r of rows)
9783
+ process.stdout.write(` ${JSON.stringify(r)}
9784
+ `);
9785
+ return EXIT.SUCCESS;
9786
+ });
9787
+ }
9788
+ async function runGraphExecute(cypher, opts) {
9789
+ if (!cypher) {
9790
+ render.err('Usage: claudemesh graph execute "<cypher>"');
9791
+ return EXIT.INVALID_ARGS;
9792
+ }
9793
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9794
+ const rows = await client.graphExecute(cypher);
9795
+ if (opts.json) {
9796
+ emitJson(rows);
9797
+ return EXIT.SUCCESS;
9798
+ }
9799
+ render.ok("executed", `${rows.length} row${rows.length === 1 ? "" : "s"} affected`);
9800
+ return EXIT.SUCCESS;
9801
+ });
9802
+ }
9803
+ async function runContextShare(summary, opts) {
9804
+ if (!summary) {
9805
+ render.err('Usage: claudemesh context share "<summary>" [--files a,b] [--findings x,y] [--tags t1,t2]');
9806
+ return EXIT.INVALID_ARGS;
9807
+ }
9808
+ const files = opts.files?.split(",").map((s) => s.trim()).filter(Boolean);
9809
+ const findings = opts.findings?.split(",").map((s) => s.trim()).filter(Boolean);
9810
+ const tags = opts.tags?.split(",").map((s) => s.trim()).filter(Boolean);
9811
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9812
+ await client.shareContext(summary, files, findings, tags);
9813
+ if (opts.json)
9814
+ emitJson({ shared: true, summary });
9815
+ else
9816
+ render.ok("context shared");
9817
+ return EXIT.SUCCESS;
9818
+ });
9819
+ }
9820
+ async function runContextGet(query, opts) {
9821
+ if (!query) {
9822
+ render.err('Usage: claudemesh context get "<query>"');
9823
+ return EXIT.INVALID_ARGS;
9824
+ }
9825
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9826
+ const ctxs = await client.getContext(query);
9827
+ if (opts.json) {
9828
+ emitJson(ctxs);
9829
+ return EXIT.SUCCESS;
9830
+ }
9831
+ if (ctxs.length === 0) {
9832
+ render.info(dim("(no matches)"));
9833
+ return EXIT.SUCCESS;
9834
+ }
9835
+ render.section(`${ctxs.length} context${ctxs.length === 1 ? "" : "s"}`);
9836
+ for (const c of ctxs) {
9837
+ process.stdout.write(` ${bold(c.peerName)} ${dim("·")} ${c.updatedAt}
9838
+ `);
9839
+ process.stdout.write(` ${c.summary}
9840
+ `);
9841
+ if (c.tags.length)
9842
+ process.stdout.write(` ${dim("tags: " + c.tags.join(", "))}
9843
+ `);
9844
+ }
9845
+ return EXIT.SUCCESS;
9846
+ });
9847
+ }
9848
+ async function runContextList(opts) {
9849
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9850
+ const ctxs = await client.listContexts();
9851
+ if (opts.json) {
9852
+ emitJson(ctxs);
9853
+ return EXIT.SUCCESS;
9854
+ }
9855
+ if (ctxs.length === 0) {
9856
+ render.info(dim("(no contexts)"));
9857
+ return EXIT.SUCCESS;
9858
+ }
9859
+ render.section(`shared contexts (${ctxs.length})`);
9860
+ for (const c of ctxs) {
9861
+ process.stdout.write(` ${bold(c.peerName)} ${dim("·")} ${c.updatedAt}
9862
+ `);
9863
+ process.stdout.write(` ${c.summary}
9864
+ `);
9865
+ }
9866
+ return EXIT.SUCCESS;
9867
+ });
9868
+ }
9869
+ async function runStreamCreate(name, opts) {
9870
+ if (!name) {
9871
+ render.err("Usage: claudemesh stream create <name>");
9872
+ return EXIT.INVALID_ARGS;
9873
+ }
9874
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9875
+ const id = await client.createStream(name);
9876
+ if (!id) {
9877
+ render.err("create failed");
9878
+ return EXIT.INTERNAL_ERROR;
9879
+ }
9880
+ if (opts.json)
9881
+ emitJson({ id, name });
9882
+ else
9883
+ render.ok(`created ${clay(name)}`, dim(id));
9884
+ return EXIT.SUCCESS;
9885
+ });
9886
+ }
9887
+ async function runStreamPublish(name, dataRaw, opts) {
9888
+ if (!name || dataRaw === undefined) {
9889
+ render.err("Usage: claudemesh stream publish <name> <json-or-text>");
9890
+ return EXIT.INVALID_ARGS;
9891
+ }
9892
+ let data;
9893
+ try {
9894
+ data = JSON.parse(dataRaw);
9895
+ } catch {
9896
+ data = dataRaw;
9897
+ }
9898
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9899
+ await client.publish(name, data);
9900
+ if (opts.json)
9901
+ emitJson({ published: true, name });
9902
+ else
9903
+ render.ok(`published to ${clay(name)}`);
9904
+ return EXIT.SUCCESS;
9905
+ });
9906
+ }
9907
+ async function runStreamList(opts) {
9908
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9909
+ const streams = await client.listStreams();
9910
+ if (opts.json) {
9911
+ emitJson(streams);
9912
+ return EXIT.SUCCESS;
9913
+ }
9914
+ if (streams.length === 0) {
9915
+ render.info(dim("(no streams)"));
9916
+ return EXIT.SUCCESS;
9917
+ }
9918
+ render.section(`streams (${streams.length})`);
9919
+ for (const s of streams) {
9920
+ process.stdout.write(` ${clay(s.name)} ${dim(`· ${s.subscriberCount} subscriber${s.subscriberCount === 1 ? "" : "s"} · by ${s.createdBy}`)}
9921
+ `);
9922
+ }
9923
+ return EXIT.SUCCESS;
9924
+ });
9925
+ }
9926
+ async function runSqlQuery(sql, opts) {
9927
+ if (!sql) {
9928
+ render.err('Usage: claudemesh sql query "<select>"');
9929
+ return EXIT.INVALID_ARGS;
9930
+ }
9931
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9932
+ const result = await client.meshQuery(sql);
9933
+ if (!result) {
9934
+ render.err("query timed out");
9935
+ return EXIT.INTERNAL_ERROR;
9936
+ }
9937
+ if (opts.json) {
9938
+ emitJson(result);
9939
+ return EXIT.SUCCESS;
9940
+ }
9941
+ render.section(`${result.rowCount} row${result.rowCount === 1 ? "" : "s"}`);
9942
+ if (result.columns.length > 0) {
9943
+ process.stdout.write(` ${dim(result.columns.join(" "))}
9944
+ `);
9945
+ for (const row of result.rows) {
9946
+ process.stdout.write(` ${result.columns.map((c) => String(row[c] ?? "")).join(" ")}
9947
+ `);
9948
+ }
9949
+ }
9950
+ return EXIT.SUCCESS;
9951
+ });
9952
+ }
9953
+ async function runSqlExecute(sql, opts) {
9954
+ if (!sql) {
9955
+ render.err('Usage: claudemesh sql execute "<statement>"');
9956
+ return EXIT.INVALID_ARGS;
9957
+ }
9958
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9959
+ await client.meshExecute(sql);
9960
+ if (opts.json)
9961
+ emitJson({ executed: true });
9962
+ else
9963
+ render.ok("executed");
9964
+ return EXIT.SUCCESS;
9965
+ });
9966
+ }
9967
+ async function runSqlSchema(opts) {
9968
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9969
+ const tables = await client.meshSchema();
9970
+ if (opts.json) {
9971
+ emitJson(tables);
9972
+ return EXIT.SUCCESS;
9973
+ }
9974
+ if (tables.length === 0) {
9975
+ render.info(dim("(no tables)"));
9976
+ return EXIT.SUCCESS;
9977
+ }
9978
+ render.section(`mesh tables (${tables.length})`);
9979
+ for (const t of tables) {
9980
+ process.stdout.write(` ${bold(t.name)}
9981
+ `);
9982
+ for (const c of t.columns) {
9983
+ const nullable = c.nullable ? "" : " not null";
9984
+ process.stdout.write(` ${c.name} ${dim(c.type + nullable)}
9985
+ `);
9986
+ }
9987
+ }
9988
+ return EXIT.SUCCESS;
9989
+ });
9990
+ }
9991
+ async function runSkillList(opts) {
9992
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
9993
+ const skills = await client.listSkills(opts.query);
9994
+ if (opts.json) {
9995
+ emitJson(skills);
9996
+ return EXIT.SUCCESS;
9997
+ }
9998
+ if (skills.length === 0) {
9999
+ render.info(dim("(no skills)"));
10000
+ return EXIT.SUCCESS;
10001
+ }
10002
+ render.section(`mesh skills (${skills.length})`);
10003
+ for (const s of skills) {
10004
+ process.stdout.write(` ${bold(s.name)} ${dim("· by " + s.author)}
10005
+ `);
10006
+ process.stdout.write(` ${s.description}
10007
+ `);
10008
+ if (s.tags.length)
10009
+ process.stdout.write(` ${dim("tags: " + s.tags.join(", "))}
10010
+ `);
10011
+ }
10012
+ return EXIT.SUCCESS;
10013
+ });
10014
+ }
10015
+ async function runSkillGet(name, opts) {
10016
+ if (!name) {
10017
+ render.err("Usage: claudemesh skill get <name>");
10018
+ return EXIT.INVALID_ARGS;
10019
+ }
10020
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10021
+ const skill = await client.getSkill(name);
10022
+ if (!skill) {
10023
+ render.err(`skill "${name}" not found`);
10024
+ return EXIT.NOT_FOUND;
10025
+ }
10026
+ if (opts.json) {
10027
+ emitJson(skill);
10028
+ return EXIT.SUCCESS;
10029
+ }
10030
+ render.section(skill.name);
10031
+ render.kv([
10032
+ ["author", skill.author],
10033
+ ["created", skill.createdAt],
10034
+ ["tags", skill.tags.join(", ") || dim("(none)")]
10035
+ ]);
10036
+ render.blank();
10037
+ render.info(skill.description);
10038
+ render.blank();
10039
+ process.stdout.write(skill.instructions + `
10040
+ `);
10041
+ return EXIT.SUCCESS;
10042
+ });
10043
+ }
10044
+ async function runSkillRemove(name, opts) {
10045
+ if (!name) {
10046
+ render.err("Usage: claudemesh skill remove <name>");
10047
+ return EXIT.INVALID_ARGS;
10048
+ }
10049
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10050
+ const removed = await client.removeSkill(name);
10051
+ if (opts.json)
10052
+ emitJson({ name, removed });
10053
+ else if (removed)
10054
+ render.ok(`removed ${bold(name)}`);
10055
+ else
10056
+ render.err(`skill "${name}" not found`);
10057
+ return removed ? EXIT.SUCCESS : EXIT.NOT_FOUND;
10058
+ });
10059
+ }
10060
+ async function runVaultList(opts) {
10061
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10062
+ const entries = await client.vaultList();
10063
+ if (opts.json) {
10064
+ emitJson(entries);
10065
+ return EXIT.SUCCESS;
10066
+ }
10067
+ if (!entries || entries.length === 0) {
10068
+ render.info(dim("(vault empty)"));
10069
+ return EXIT.SUCCESS;
10070
+ }
10071
+ render.section(`vault (${entries.length})`);
10072
+ for (const e of entries) {
10073
+ const k = String(e?.key ?? "?");
10074
+ const t = String(e?.entry_type ?? "");
10075
+ process.stdout.write(` ${bold(k)} ${dim(t)}
10076
+ `);
10077
+ }
10078
+ return EXIT.SUCCESS;
10079
+ });
10080
+ }
10081
+ async function runVaultDelete(key, opts) {
10082
+ if (!key) {
10083
+ render.err("Usage: claudemesh vault delete <key>");
10084
+ return EXIT.INVALID_ARGS;
10085
+ }
10086
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10087
+ const ok = await client.vaultDelete(key);
10088
+ if (opts.json)
10089
+ emitJson({ key, deleted: ok });
10090
+ else if (ok)
10091
+ render.ok(`deleted ${bold(key)}`);
10092
+ else
10093
+ render.err(`vault key "${key}" not found`);
10094
+ return ok ? EXIT.SUCCESS : EXIT.NOT_FOUND;
10095
+ });
10096
+ }
10097
+ async function runWatchList(opts) {
10098
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10099
+ const watches = await client.watchList();
10100
+ if (opts.json) {
10101
+ emitJson(watches);
10102
+ return EXIT.SUCCESS;
10103
+ }
10104
+ if (!watches || watches.length === 0) {
10105
+ render.info(dim("(no watches)"));
10106
+ return EXIT.SUCCESS;
10107
+ }
10108
+ render.section(`url watches (${watches.length})`);
10109
+ for (const w of watches) {
10110
+ const id = String(w.id ?? "?");
10111
+ const url = String(w.url ?? "");
10112
+ const label = w.label ? ` ${dim("(" + w.label + ")")}` : "";
10113
+ process.stdout.write(` ${dim(id.slice(0, 8))} ${clay(url)}${label}
10114
+ `);
10115
+ }
10116
+ return EXIT.SUCCESS;
10117
+ });
10118
+ }
10119
+ async function runUnwatch(id, opts) {
10120
+ if (!id) {
10121
+ render.err("Usage: claudemesh watch remove <id>");
10122
+ return EXIT.INVALID_ARGS;
10123
+ }
10124
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10125
+ const ok = await client.unwatch(id);
10126
+ if (opts.json)
10127
+ emitJson({ id, removed: ok });
10128
+ else if (ok)
10129
+ render.ok(`unwatched ${dim(id.slice(0, 8))}`);
10130
+ else
10131
+ render.err(`watch "${id}" not found`);
10132
+ return ok ? EXIT.SUCCESS : EXIT.NOT_FOUND;
10133
+ });
10134
+ }
10135
+ async function runWebhookList(opts) {
10136
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10137
+ const hooks = await client.listWebhooks();
10138
+ if (opts.json) {
10139
+ emitJson(hooks);
10140
+ return EXIT.SUCCESS;
10141
+ }
10142
+ if (hooks.length === 0) {
10143
+ render.info(dim("(no webhooks)"));
10144
+ return EXIT.SUCCESS;
10145
+ }
10146
+ render.section(`webhooks (${hooks.length})`);
10147
+ for (const h of hooks) {
10148
+ const dot = h.active ? "●" : dim("○");
10149
+ process.stdout.write(` ${dot} ${bold(h.name)} ${dim("· " + h.url)}
10150
+ `);
10151
+ }
10152
+ return EXIT.SUCCESS;
10153
+ });
10154
+ }
10155
+ async function runWebhookDelete(name, opts) {
10156
+ if (!name) {
10157
+ render.err("Usage: claudemesh webhook delete <name>");
10158
+ return EXIT.INVALID_ARGS;
10159
+ }
10160
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10161
+ const ok = await client.deleteWebhook(name);
10162
+ if (opts.json)
10163
+ emitJson({ name, deleted: ok });
10164
+ else if (ok)
10165
+ render.ok(`deleted ${bold(name)}`);
10166
+ else
10167
+ render.err(`webhook "${name}" not found`);
10168
+ return ok ? EXIT.SUCCESS : EXIT.NOT_FOUND;
10169
+ });
10170
+ }
10171
+ async function runTaskList(opts) {
10172
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10173
+ const tasks = await client.listTasks(opts.status, opts.assignee);
10174
+ if (opts.json) {
10175
+ emitJson(tasks);
10176
+ return EXIT.SUCCESS;
10177
+ }
10178
+ if (tasks.length === 0) {
10179
+ render.info(dim("(no tasks)"));
10180
+ return EXIT.SUCCESS;
10181
+ }
10182
+ render.section(`tasks (${tasks.length})`);
10183
+ for (const t of tasks) {
10184
+ const dot = t.status === "done" ? "●" : t.status === "claimed" ? clay("●") : dim("○");
10185
+ const assignee = t.assignee ? dim(` → ${t.assignee}`) : "";
10186
+ process.stdout.write(` ${dot} ${dim(t.id.slice(0, 8))} ${bold(t.title)}${assignee}
10187
+ `);
10188
+ }
10189
+ return EXIT.SUCCESS;
10190
+ });
10191
+ }
10192
+ async function runTaskCreate(title, opts) {
10193
+ if (!title) {
10194
+ render.err("Usage: claudemesh task create <title> [--assignee X] [--priority P]");
9463
10195
  return EXIT.INVALID_ARGS;
9464
10196
  }
9465
- const mesh = pickMesh2(opts.mesh);
9466
- if (!mesh) {
9467
- render.err("No matching mesh.");
9468
- return EXIT.NOT_FOUND;
9469
- }
9470
- const resolved = await resolvePeer(mesh, peer);
9471
- if (!resolved) {
9472
- render.err(`Peer "${peer}" not found on ${mesh}.`);
9473
- return EXIT.NOT_FOUND;
9474
- }
9475
- const store = readGrants();
9476
- const meshGrants = store[mesh] ?? {};
9477
- meshGrants[resolved.pubkey] = [];
9478
- store[mesh] = meshGrants;
9479
- writeGrants(store);
9480
- await syncToBroker(mesh, { [resolved.pubkey]: [] });
9481
- render.ok(`Blocked ${resolved.displayName} on ${mesh} (all capabilities revoked).`);
9482
- render.hint(`Undo with: claudemesh grant ${resolved.displayName} all --mesh ${mesh}`);
9483
- return EXIT.SUCCESS;
10197
+ const tags = opts.tags?.split(",").map((s) => s.trim()).filter(Boolean);
10198
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10199
+ const id = await client.createTask(title, opts.assignee, opts.priority, tags);
10200
+ if (!id) {
10201
+ render.err("create failed");
10202
+ return EXIT.INTERNAL_ERROR;
10203
+ }
10204
+ if (opts.json)
10205
+ emitJson({ id, title });
10206
+ else
10207
+ render.ok(`created ${dim(id.slice(0, 8))}`, title);
10208
+ return EXIT.SUCCESS;
10209
+ });
9484
10210
  }
9485
- async function runGrants(opts = {}) {
9486
- const mesh = pickMesh2(opts.mesh);
9487
- if (!mesh) {
9488
- render.err("No matching mesh.");
9489
- return EXIT.NOT_FOUND;
10211
+ async function runClockSet(speed, opts) {
10212
+ const s = parseFloat(speed);
10213
+ if (!Number.isFinite(s) || s < 0) {
10214
+ render.err("Usage: claudemesh clock set <speed>", "speed is a non-negative number, e.g. 1.0 = realtime, 0 = paused, 60 = 60× faster");
10215
+ return EXIT.INVALID_ARGS;
9490
10216
  }
9491
- const store = readGrants();
9492
- const meshGrants = store[mesh] ?? {};
9493
- if (opts.json) {
9494
- console.log(JSON.stringify({ schema_version: "1.0", mesh, grants: meshGrants }, null, 2));
10217
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10218
+ const r = await client.setClock(s);
10219
+ if (!r) {
10220
+ render.err("clock set failed");
10221
+ return EXIT.INTERNAL_ERROR;
10222
+ }
10223
+ if (opts.json)
10224
+ emitJson(r);
10225
+ else
10226
+ render.ok(`clock set to ${bold("x" + r.speed)}`);
10227
+ return EXIT.SUCCESS;
10228
+ });
10229
+ }
10230
+ async function runClockPause(opts) {
10231
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10232
+ const r = await client.pauseClock();
10233
+ if (!r) {
10234
+ render.err("pause failed");
10235
+ return EXIT.INTERNAL_ERROR;
10236
+ }
10237
+ if (opts.json)
10238
+ emitJson(r);
10239
+ else
10240
+ render.ok("clock paused");
10241
+ return EXIT.SUCCESS;
10242
+ });
10243
+ }
10244
+ async function runClockResume(opts) {
10245
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10246
+ const r = await client.resumeClock();
10247
+ if (!r) {
10248
+ render.err("resume failed");
10249
+ return EXIT.INTERNAL_ERROR;
10250
+ }
10251
+ if (opts.json)
10252
+ emitJson(r);
10253
+ else
10254
+ render.ok("clock resumed");
10255
+ return EXIT.SUCCESS;
10256
+ });
10257
+ }
10258
+ async function runMeshMcpList(opts) {
10259
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10260
+ const servers = await client.mcpList();
10261
+ if (opts.json) {
10262
+ emitJson(servers);
10263
+ return EXIT.SUCCESS;
10264
+ }
10265
+ if (servers.length === 0) {
10266
+ render.info(dim("(no mesh-MCP servers)"));
10267
+ return EXIT.SUCCESS;
10268
+ }
10269
+ render.section(`mesh-MCP servers (${servers.length})`);
10270
+ for (const s of servers) {
10271
+ process.stdout.write(` ${bold(s.name)} ${dim("· hosted by " + s.hostedBy)}
10272
+ `);
10273
+ process.stdout.write(` ${s.description}
10274
+ `);
10275
+ if (s.tools.length)
10276
+ process.stdout.write(` ${dim("tools: " + s.tools.map((t) => t.name).join(", "))}
10277
+ `);
10278
+ }
9495
10279
  return EXIT.SUCCESS;
10280
+ });
10281
+ }
10282
+ async function runMeshMcpCall(serverName, toolName, argsRaw, opts) {
10283
+ if (!serverName || !toolName) {
10284
+ render.err("Usage: claudemesh mesh-mcp call <server> <tool> [json-args]");
10285
+ return EXIT.INVALID_ARGS;
9496
10286
  }
9497
- render.section(`grants on ${mesh}`);
9498
- const peerPubkeys = Object.keys(meshGrants);
9499
- if (peerPubkeys.length === 0) {
9500
- render.info("(no overrides — all peers use default caps: " + DEFAULT_CAPS.join(", ") + ")");
10287
+ let args = {};
10288
+ if (argsRaw) {
10289
+ try {
10290
+ args = JSON.parse(argsRaw);
10291
+ } catch {
10292
+ render.err("args must be JSON");
10293
+ return EXIT.INVALID_ARGS;
10294
+ }
10295
+ }
10296
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10297
+ const r = await client.mcpCall(serverName, toolName, args);
10298
+ if (r.error) {
10299
+ if (opts.json)
10300
+ emitJson({ ok: false, error: r.error });
10301
+ else
10302
+ render.err(r.error);
10303
+ return EXIT.INTERNAL_ERROR;
10304
+ }
10305
+ if (opts.json)
10306
+ emitJson({ ok: true, result: r.result });
10307
+ else
10308
+ process.stdout.write(JSON.stringify(r.result, null, 2) + `
10309
+ `);
10310
+ return EXIT.SUCCESS;
10311
+ });
10312
+ }
10313
+ async function runMeshMcpCatalog(opts) {
10314
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10315
+ const cat = await client.mcpCatalog();
10316
+ if (opts.json) {
10317
+ emitJson(cat);
10318
+ return EXIT.SUCCESS;
10319
+ }
10320
+ if (!cat || cat.length === 0) {
10321
+ render.info(dim("(catalog empty)"));
10322
+ return EXIT.SUCCESS;
10323
+ }
10324
+ render.section(`mesh-MCP catalog (${cat.length})`);
10325
+ for (const c of cat) {
10326
+ process.stdout.write(` ${bold(String(c.name ?? "?"))} ${dim(String(c.status ?? ""))}
10327
+ `);
10328
+ if (c.description)
10329
+ process.stdout.write(` ${String(c.description)}
10330
+ `);
10331
+ }
10332
+ return EXIT.SUCCESS;
10333
+ });
10334
+ }
10335
+ async function runFileList(opts) {
10336
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10337
+ const files = await client.listFiles(opts.query);
10338
+ if (opts.json) {
10339
+ emitJson(files);
10340
+ return EXIT.SUCCESS;
10341
+ }
10342
+ if (files.length === 0) {
10343
+ render.info(dim("(no files)"));
10344
+ return EXIT.SUCCESS;
10345
+ }
10346
+ render.section(`mesh files (${files.length})`);
10347
+ for (const f of files) {
10348
+ const sizeKb = (f.size / 1024).toFixed(1);
10349
+ process.stdout.write(` ${bold(f.name)} ${dim(`· ${sizeKb} KB · by ${f.uploadedBy}`)}
10350
+ `);
10351
+ if (f.tags.length)
10352
+ process.stdout.write(` ${dim("tags: " + f.tags.join(", "))}
10353
+ `);
10354
+ }
9501
10355
  return EXIT.SUCCESS;
10356
+ });
10357
+ }
10358
+ async function runFileStatus(id, opts) {
10359
+ if (!id) {
10360
+ render.err("Usage: claudemesh file status <file-id>");
10361
+ return EXIT.INVALID_ARGS;
9502
10362
  }
9503
- await withMesh({ meshSlug: mesh }, async (client) => {
9504
- const peers = await client.listPeers();
9505
- const byPk = new Map(peers.map((p) => [p.pubkey, p.displayName]));
9506
- for (const [pk, caps] of Object.entries(meshGrants)) {
9507
- const name = byPk.get(pk) ?? `${pk.slice(0, 10)}…`;
9508
- render.kv([[name, caps.length ? caps.join(", ") : "(blocked)"]]);
10363
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10364
+ const accessors = await client.fileStatus(id);
10365
+ if (opts.json) {
10366
+ emitJson(accessors);
10367
+ return EXIT.SUCCESS;
10368
+ }
10369
+ if (accessors.length === 0) {
10370
+ render.info(dim("(no accesses recorded)"));
10371
+ return EXIT.SUCCESS;
9509
10372
  }
10373
+ render.section(`accesses for ${id.slice(0, 8)}`);
10374
+ for (const a of accessors)
10375
+ process.stdout.write(` ${bold(a.peerName)} ${dim("· " + a.accessedAt)}
10376
+ `);
10377
+ return EXIT.SUCCESS;
9510
10378
  });
9511
- return EXIT.SUCCESS;
9512
10379
  }
9513
- function isAllowed(meshSlug, peerPubkey, cap) {
9514
- const store = readGrants();
9515
- const entry = store[meshSlug]?.[peerPubkey];
9516
- if (entry === undefined)
9517
- return DEFAULT_CAPS.includes(cap);
9518
- return entry.includes(cap);
10380
+ async function runFileDelete(id, opts) {
10381
+ if (!id) {
10382
+ render.err("Usage: claudemesh file delete <file-id>");
10383
+ return EXIT.INVALID_ARGS;
10384
+ }
10385
+ return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
10386
+ await client.deleteFile(id);
10387
+ if (opts.json)
10388
+ emitJson({ id, deleted: true });
10389
+ else
10390
+ render.ok(`deleted ${dim(id.slice(0, 8))}`);
10391
+ return EXIT.SUCCESS;
10392
+ });
9519
10393
  }
9520
- var BROKER_HTTP7, ALL_CAPS, DEFAULT_CAPS, GRANT_FILE;
9521
- var init_grants = __esm(() => {
9522
- init_facade();
10394
+ var init_platform_actions = __esm(() => {
9523
10395
  init_connect();
9524
10396
  init_render();
10397
+ init_styles();
9525
10398
  init_exit_codes();
9526
- init_facade6();
9527
- init_facade3();
9528
- init_urls();
9529
- BROKER_HTTP7 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
9530
- ALL_CAPS = ["read", "dm", "broadcast", "state-read", "state-write", "file-read"];
9531
- DEFAULT_CAPS = ["read", "dm", "broadcast", "state-read"];
9532
- GRANT_FILE = join10(homedir9(), ".claudemesh", "grants.json");
9533
10399
  });
9534
10400
 
9535
10401
  // src/mcp/tools/definitions.ts
@@ -11181,8 +12047,8 @@ ${peerLines.join(`
11181
12047
  try {
11182
12048
  const { writeFileSync: writeFileSync10, mkdirSync: mkdirSync7, existsSync: existsSync20 } = await import("node:fs");
11183
12049
  const { join: joinPath } = await import("node:path");
11184
- const { homedir: homedir10 } = await import("node:os");
11185
- const dir = joinPath(homedir10(), ".claudemesh");
12050
+ const { homedir: homedir11 } = await import("node:os");
12051
+ const dir = joinPath(homedir11(), ".claudemesh");
11186
12052
  if (!existsSync20(dir))
11187
12053
  mkdirSync7(dir, { recursive: true });
11188
12054
  writeFileSync10(joinPath(dir, "peer-cache.json"), JSON.stringify(statusCache));
@@ -11437,7 +12303,7 @@ ${lines.join(`
11437
12303
  const { encryptFile: encryptFile2, sealKeyForPeer: sealKeyForPeer2 } = await Promise.resolve().then(() => (init_file_crypto(), exports_file_crypto));
11438
12304
  const { readFileSync: readFileSync13, writeFileSync: writeFileSync10, mkdtempSync: mkdtempSync2, unlinkSync: unlinkSync3, rmdirSync } = await import("node:fs");
11439
12305
  const { tmpdir: tmpdir2 } = await import("node:os");
11440
- const { join: join11, basename } = await import("node:path");
12306
+ const { join: join12, basename } = await import("node:path");
11441
12307
  const peers = await client.listPeers();
11442
12308
  const targetPeer = peers.find((p) => p.pubkey === fileTo || p.displayName === fileTo);
11443
12309
  if (!targetPeer) {
@@ -11460,8 +12326,8 @@ ${lines.join(`
11460
12326
  combined.set(ciphertext, nonceBytes.length);
11461
12327
  const rawName = fileName ?? basename(filePath);
11462
12328
  const baseName = basename(rawName).replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 255);
11463
- const tmpDir = mkdtempSync2(join11(tmpdir2(), "cm-"));
11464
- const tmpPath = join11(tmpDir, baseName);
12329
+ const tmpDir = mkdtempSync2(join12(tmpdir2(), "cm-"));
12330
+ const tmpPath = join12(tmpDir, baseName);
11465
12331
  writeFileSync10(tmpPath, combined);
11466
12332
  try {
11467
12333
  const fileId = await client.uploadFile(tmpPath, client.meshId, client.meshSlug, {
@@ -11538,8 +12404,8 @@ ${lines.join(`
11538
12404
  if (!plaintext)
11539
12405
  return text(genericErr, true);
11540
12406
  const { writeFileSync: writeFileSync11, mkdirSync: mkdirSync8 } = await import("node:fs");
11541
- const { dirname: dirname5 } = await import("node:path");
11542
- mkdirSync8(dirname5(save_to), { recursive: true });
12407
+ const { dirname: dirname6 } = await import("node:path");
12408
+ mkdirSync8(dirname6(save_to), { recursive: true });
11543
12409
  writeFileSync11(save_to, plaintext);
11544
12410
  return text(`Downloaded and decrypted: ${result.name} → ${save_to}`);
11545
12411
  }
@@ -11551,8 +12417,8 @@ ${lines.join(`
11551
12417
  if (!res.ok)
11552
12418
  return text(`get_file: download failed (${res.status})`, true);
11553
12419
  const { writeFileSync: writeFileSync10, mkdirSync: mkdirSync7 } = await import("node:fs");
11554
- const { dirname: dirname4 } = await import("node:path");
11555
- mkdirSync7(dirname4(save_to), { recursive: true });
12420
+ const { dirname: dirname5 } = await import("node:path");
12421
+ mkdirSync7(dirname5(save_to), { recursive: true });
11556
12422
  writeFileSync10(save_to, Buffer.from(await res.arrayBuffer()));
11557
12423
  return text(`Downloaded: ${result.name} → ${save_to}`);
11558
12424
  }
@@ -13225,9 +14091,25 @@ Identity / presence
13225
14091
  claudemesh group leave @<name> leave a group
13226
14092
 
13227
14093
  Tasks
14094
+ claudemesh task create <title> create a new task [--assignee --priority --tags]
14095
+ claudemesh task list list tasks [--status --assignee]
13228
14096
  claudemesh task claim <id> claim an unclaimed task
13229
14097
  claudemesh task complete <id> mark task done [result]
13230
14098
 
14099
+ Platform
14100
+ claudemesh vector store|search|delete|collections embedding store
14101
+ claudemesh graph query|execute "<cypher>" graph operations
14102
+ claudemesh context share|get|list work-context summaries
14103
+ claudemesh stream create|publish|list pub/sub event bus
14104
+ claudemesh sql query|execute|schema per-mesh SQL
14105
+ claudemesh skill list|get|remove mesh-published skills
14106
+ claudemesh vault list|delete encrypted secrets
14107
+ claudemesh watch list|remove URL change watchers
14108
+ claudemesh webhook list|delete outbound HTTP triggers
14109
+ claudemesh file list|status|delete shared mesh files
14110
+ claudemesh mesh-mcp list|call|catalog deployed mesh-MCP servers
14111
+ claudemesh clock set|pause|resume mesh logical clock
14112
+
13231
14113
  Auth
13232
14114
  claudemesh login sign in (browser or paste token)
13233
14115
  claudemesh register create account + sign in
@@ -13467,11 +14349,6 @@ async function main() {
13467
14349
  process.exit(await runMsgStatus2(positionals[0], { mesh: flags.mesh, json: !!flags.json }));
13468
14350
  break;
13469
14351
  }
13470
- case "clock": {
13471
- const { runClock: runClock2 } = await Promise.resolve().then(() => (init_broker_actions(), exports_broker_actions));
13472
- process.exit(await runClock2({ mesh: flags.mesh, json: !!flags.json }));
13473
- break;
13474
- }
13475
14352
  case "stats": {
13476
14353
  const { runStats: runStats2 } = await Promise.resolve().then(() => (init_broker_actions(), exports_broker_actions));
13477
14354
  process.exit(await runStats2({ mesh: flags.mesh, json: !!flags.json }));
@@ -13482,20 +14359,6 @@ async function main() {
13482
14359
  process.exit(await runPing2({ mesh: flags.mesh, json: !!flags.json }));
13483
14360
  break;
13484
14361
  }
13485
- case "task": {
13486
- const sub = positionals[0];
13487
- if (sub === "claim") {
13488
- const { runTaskClaim: runTaskClaim2 } = await Promise.resolve().then(() => (init_broker_actions(), exports_broker_actions));
13489
- process.exit(await runTaskClaim2(positionals[1], { mesh: flags.mesh, json: !!flags.json }));
13490
- } else if (sub === "complete") {
13491
- const { runTaskComplete: runTaskComplete2 } = await Promise.resolve().then(() => (init_broker_actions(), exports_broker_actions));
13492
- process.exit(await runTaskComplete2(positionals[1], positionals.slice(2).join(" ") || undefined, { mesh: flags.mesh, json: !!flags.json }));
13493
- } else {
13494
- console.error("Usage: claudemesh task <claim|complete> <id> [result]");
13495
- process.exit(EXIT.INVALID_ARGS);
13496
- }
13497
- break;
13498
- }
13499
14362
  case "login": {
13500
14363
  const { login: login2 } = await Promise.resolve().then(() => (init_login(), exports_login));
13501
14364
  process.exit(await login2());
@@ -13607,6 +14470,234 @@ async function main() {
13607
14470
  process.exit(await runGrants2({ mesh: flags.mesh, json: !!flags.json }));
13608
14471
  break;
13609
14472
  }
14473
+ case "vector": {
14474
+ const sub = positionals[0];
14475
+ const f = { mesh: flags.mesh, json: !!flags.json };
14476
+ if (sub === "store") {
14477
+ const { runVectorStore: runVectorStore2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14478
+ process.exit(await runVectorStore2(positionals[1] ?? "", positionals.slice(2).join(" "), { ...f, metadata: flags.metadata }));
14479
+ } else if (sub === "search") {
14480
+ const { runVectorSearch: runVectorSearch2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14481
+ process.exit(await runVectorSearch2(positionals[1] ?? "", positionals.slice(2).join(" "), { ...f, limit: flags.limit }));
14482
+ } else if (sub === "delete") {
14483
+ const { runVectorDelete: runVectorDelete2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14484
+ process.exit(await runVectorDelete2(positionals[1] ?? "", positionals[2] ?? "", f));
14485
+ } else if (sub === "collections") {
14486
+ const { runVectorCollections: runVectorCollections2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14487
+ process.exit(await runVectorCollections2(f));
14488
+ } else {
14489
+ console.error("Usage: claudemesh vector <store|search|delete|collections>");
14490
+ process.exit(EXIT.INVALID_ARGS);
14491
+ }
14492
+ break;
14493
+ }
14494
+ case "graph": {
14495
+ const sub = positionals[0];
14496
+ const f = { mesh: flags.mesh, json: !!flags.json };
14497
+ if (sub === "query") {
14498
+ const { runGraphQuery: runGraphQuery2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14499
+ process.exit(await runGraphQuery2(positionals.slice(1).join(" "), f));
14500
+ } else if (sub === "execute") {
14501
+ const { runGraphExecute: runGraphExecute2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14502
+ process.exit(await runGraphExecute2(positionals.slice(1).join(" "), f));
14503
+ } else {
14504
+ console.error('Usage: claudemesh graph <query|execute> "<cypher>"');
14505
+ process.exit(EXIT.INVALID_ARGS);
14506
+ }
14507
+ break;
14508
+ }
14509
+ case "context": {
14510
+ const sub = positionals[0];
14511
+ const f = { mesh: flags.mesh, json: !!flags.json };
14512
+ if (sub === "share") {
14513
+ const { runContextShare: runContextShare2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14514
+ process.exit(await runContextShare2(positionals.slice(1).join(" "), { ...f, files: flags.files, findings: flags.findings, tags: flags.tags }));
14515
+ } else if (sub === "get") {
14516
+ const { runContextGet: runContextGet2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14517
+ process.exit(await runContextGet2(positionals.slice(1).join(" "), f));
14518
+ } else if (sub === "list") {
14519
+ const { runContextList: runContextList2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14520
+ process.exit(await runContextList2(f));
14521
+ } else {
14522
+ console.error("Usage: claudemesh context <share|get|list>");
14523
+ process.exit(EXIT.INVALID_ARGS);
14524
+ }
14525
+ break;
14526
+ }
14527
+ case "stream": {
14528
+ const sub = positionals[0];
14529
+ const f = { mesh: flags.mesh, json: !!flags.json };
14530
+ if (sub === "create") {
14531
+ const { runStreamCreate: runStreamCreate2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14532
+ process.exit(await runStreamCreate2(positionals[1] ?? "", f));
14533
+ } else if (sub === "publish") {
14534
+ const { runStreamPublish: runStreamPublish2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14535
+ process.exit(await runStreamPublish2(positionals[1] ?? "", positionals.slice(2).join(" "), f));
14536
+ } else if (sub === "list") {
14537
+ const { runStreamList: runStreamList2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14538
+ process.exit(await runStreamList2(f));
14539
+ } else {
14540
+ console.error("Usage: claudemesh stream <create|publish|list>");
14541
+ process.exit(EXIT.INVALID_ARGS);
14542
+ }
14543
+ break;
14544
+ }
14545
+ case "sql": {
14546
+ const sub = positionals[0];
14547
+ const f = { mesh: flags.mesh, json: !!flags.json };
14548
+ if (sub === "query") {
14549
+ const { runSqlQuery: runSqlQuery2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14550
+ process.exit(await runSqlQuery2(positionals.slice(1).join(" "), f));
14551
+ } else if (sub === "execute") {
14552
+ const { runSqlExecute: runSqlExecute2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14553
+ process.exit(await runSqlExecute2(positionals.slice(1).join(" "), f));
14554
+ } else if (sub === "schema") {
14555
+ const { runSqlSchema: runSqlSchema2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14556
+ process.exit(await runSqlSchema2(f));
14557
+ } else {
14558
+ console.error("Usage: claudemesh sql <query|execute|schema>");
14559
+ process.exit(EXIT.INVALID_ARGS);
14560
+ }
14561
+ break;
14562
+ }
14563
+ case "skill": {
14564
+ const sub = positionals[0];
14565
+ const f = { mesh: flags.mesh, json: !!flags.json };
14566
+ if (sub === "list") {
14567
+ const { runSkillList: runSkillList2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14568
+ process.exit(await runSkillList2({ ...f, query: positionals[1] }));
14569
+ } else if (sub === "get") {
14570
+ const { runSkillGet: runSkillGet2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14571
+ process.exit(await runSkillGet2(positionals[1] ?? "", f));
14572
+ } else if (sub === "remove") {
14573
+ const { runSkillRemove: runSkillRemove2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14574
+ process.exit(await runSkillRemove2(positionals[1] ?? "", f));
14575
+ } else {
14576
+ console.error("Usage: claudemesh skill <list|get|remove>");
14577
+ process.exit(EXIT.INVALID_ARGS);
14578
+ }
14579
+ break;
14580
+ }
14581
+ case "vault": {
14582
+ const sub = positionals[0];
14583
+ const f = { mesh: flags.mesh, json: !!flags.json };
14584
+ if (sub === "list") {
14585
+ const { runVaultList: runVaultList2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14586
+ process.exit(await runVaultList2(f));
14587
+ } else if (sub === "delete") {
14588
+ const { runVaultDelete: runVaultDelete2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14589
+ process.exit(await runVaultDelete2(positionals[1] ?? "", f));
14590
+ } else {
14591
+ console.error("Usage: claudemesh vault <list|delete> (set/get currently via MCP — needs crypto)");
14592
+ process.exit(EXIT.INVALID_ARGS);
14593
+ }
14594
+ break;
14595
+ }
14596
+ case "watch": {
14597
+ const sub = positionals[0];
14598
+ const f = { mesh: flags.mesh, json: !!flags.json };
14599
+ if (sub === "list") {
14600
+ const { runWatchList: runWatchList2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14601
+ process.exit(await runWatchList2(f));
14602
+ } else if (sub === "remove") {
14603
+ const { runUnwatch: runUnwatch2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14604
+ process.exit(await runUnwatch2(positionals[1] ?? "", f));
14605
+ } else {
14606
+ console.error("Usage: claudemesh watch <list|remove>");
14607
+ process.exit(EXIT.INVALID_ARGS);
14608
+ }
14609
+ break;
14610
+ }
14611
+ case "webhook": {
14612
+ const sub = positionals[0];
14613
+ const f = { mesh: flags.mesh, json: !!flags.json };
14614
+ if (sub === "list") {
14615
+ const { runWebhookList: runWebhookList2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14616
+ process.exit(await runWebhookList2(f));
14617
+ } else if (sub === "delete") {
14618
+ const { runWebhookDelete: runWebhookDelete2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14619
+ process.exit(await runWebhookDelete2(positionals[1] ?? "", f));
14620
+ } else {
14621
+ console.error("Usage: claudemesh webhook <list|delete>");
14622
+ process.exit(EXIT.INVALID_ARGS);
14623
+ }
14624
+ break;
14625
+ }
14626
+ case "file": {
14627
+ const sub = positionals[0];
14628
+ const f = { mesh: flags.mesh, json: !!flags.json };
14629
+ if (sub === "list") {
14630
+ const { runFileList: runFileList2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14631
+ process.exit(await runFileList2({ ...f, query: positionals[1] }));
14632
+ } else if (sub === "status") {
14633
+ const { runFileStatus: runFileStatus2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14634
+ process.exit(await runFileStatus2(positionals[1] ?? "", f));
14635
+ } else if (sub === "delete") {
14636
+ const { runFileDelete: runFileDelete2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14637
+ process.exit(await runFileDelete2(positionals[1] ?? "", f));
14638
+ } else {
14639
+ console.error("Usage: claudemesh file <list|status|delete>");
14640
+ process.exit(EXIT.INVALID_ARGS);
14641
+ }
14642
+ break;
14643
+ }
14644
+ case "mesh-mcp": {
14645
+ const sub = positionals[0];
14646
+ const f = { mesh: flags.mesh, json: !!flags.json };
14647
+ if (sub === "list") {
14648
+ const { runMeshMcpList: runMeshMcpList2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14649
+ process.exit(await runMeshMcpList2(f));
14650
+ } else if (sub === "call") {
14651
+ const { runMeshMcpCall: runMeshMcpCall2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14652
+ process.exit(await runMeshMcpCall2(positionals[1] ?? "", positionals[2] ?? "", positionals.slice(3).join(" "), f));
14653
+ } else if (sub === "catalog") {
14654
+ const { runMeshMcpCatalog: runMeshMcpCatalog2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14655
+ process.exit(await runMeshMcpCatalog2(f));
14656
+ } else {
14657
+ console.error("Usage: claudemesh mesh-mcp <list|call|catalog>");
14658
+ process.exit(EXIT.INVALID_ARGS);
14659
+ }
14660
+ break;
14661
+ }
14662
+ case "clock": {
14663
+ const sub = positionals[0];
14664
+ const f = { mesh: flags.mesh, json: !!flags.json };
14665
+ if (sub === "set") {
14666
+ const { runClockSet: runClockSet2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14667
+ process.exit(await runClockSet2(positionals[1] ?? "", f));
14668
+ } else if (sub === "pause") {
14669
+ const { runClockPause: runClockPause2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14670
+ process.exit(await runClockPause2(f));
14671
+ } else if (sub === "resume") {
14672
+ const { runClockResume: runClockResume2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14673
+ process.exit(await runClockResume2(f));
14674
+ } else {
14675
+ const { runClock: runClock2 } = await Promise.resolve().then(() => (init_broker_actions(), exports_broker_actions));
14676
+ process.exit(await runClock2(f));
14677
+ }
14678
+ break;
14679
+ }
14680
+ case "task": {
14681
+ const sub = positionals[0];
14682
+ const f = { mesh: flags.mesh, json: !!flags.json };
14683
+ if (sub === "claim") {
14684
+ const { runTaskClaim: runTaskClaim2 } = await Promise.resolve().then(() => (init_broker_actions(), exports_broker_actions));
14685
+ process.exit(await runTaskClaim2(positionals[1], f));
14686
+ } else if (sub === "complete") {
14687
+ const { runTaskComplete: runTaskComplete2 } = await Promise.resolve().then(() => (init_broker_actions(), exports_broker_actions));
14688
+ process.exit(await runTaskComplete2(positionals[1], positionals.slice(2).join(" ") || undefined, f));
14689
+ } else if (sub === "list") {
14690
+ const { runTaskList: runTaskList2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14691
+ process.exit(await runTaskList2({ ...f, status: flags.status, assignee: flags.assignee }));
14692
+ } else if (sub === "create") {
14693
+ const { runTaskCreate: runTaskCreate2 } = await Promise.resolve().then(() => (init_platform_actions(), exports_platform_actions));
14694
+ process.exit(await runTaskCreate2(positionals.slice(1).join(" "), { ...f, assignee: flags.assignee, priority: flags.priority, tags: flags.tags }));
14695
+ } else {
14696
+ console.error("Usage: claudemesh task <create|list|claim|complete>");
14697
+ process.exit(EXIT.INVALID_ARGS);
14698
+ }
14699
+ break;
14700
+ }
13610
14701
  case "mcp": {
13611
14702
  const { runMcp: runMcp2 } = await Promise.resolve().then(() => (init_mcp(), exports_mcp));
13612
14703
  await runMcp2();
@@ -13634,4 +14725,4 @@ main().catch((err) => {
13634
14725
  process.exit(EXIT.INTERNAL_ERROR);
13635
14726
  });
13636
14727
 
13637
- //# debugId=25926A42D1A4B83764756E2164756E21
14728
+ //# debugId=B4AA59318D3B1FB264756E2164756E21