claudemesh-cli 1.13.0 → 1.14.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.13.0", env;
91
+ var URLS, VERSION = "1.14.0", env;
92
92
  var init_urls = __esm(() => {
93
93
  URLS = {
94
94
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -12288,6 +12288,7 @@ var init_notification = __esm(() => {
12288
12288
  var exports_me = {};
12289
12289
  __export(exports_me, {
12290
12290
  runMeTopics: () => runMeTopics,
12291
+ runMeSearch: () => runMeSearch,
12291
12292
  runMeNotifications: () => runMeNotifications,
12292
12293
  runMeActivity: () => runMeActivity,
12293
12294
  runMe: () => runMe
@@ -12446,6 +12447,76 @@ async function runMeActivity(flags) {
12446
12447
  return EXIT.SUCCESS;
12447
12448
  });
12448
12449
  }
12450
+ async function runMeSearch(flags) {
12451
+ if (!flags.query || flags.query.length < 2) {
12452
+ process.stderr.write(`Usage: claudemesh me search <query> (min 2 chars)
12453
+ `);
12454
+ return EXIT.INVALID_ARGS;
12455
+ }
12456
+ return withRestKey({
12457
+ meshSlug: flags.mesh ?? null,
12458
+ purpose: "workspace-search",
12459
+ capabilities: ["read"]
12460
+ }, async ({ secret }) => {
12461
+ const params = new URLSearchParams({ q: flags.query });
12462
+ const ws = await request({
12463
+ path: `/api/v1/me/search?${params.toString()}`,
12464
+ token: secret
12465
+ });
12466
+ if (flags.json) {
12467
+ console.log(JSON.stringify(ws, null, 2));
12468
+ return EXIT.SUCCESS;
12469
+ }
12470
+ render.section(`${clay("search")} — "${flags.query}" ${dim(`${ws.totals.topics} topic${ws.totals.topics === 1 ? "" : "s"}, ` + `${ws.totals.messages} message${ws.totals.messages === 1 ? "" : "s"}`)}`);
12471
+ if (ws.topics.length === 0 && ws.messages.length === 0) {
12472
+ process.stdout.write(dim(` no matches
12473
+ `));
12474
+ return EXIT.SUCCESS;
12475
+ }
12476
+ if (ws.topics.length > 0) {
12477
+ process.stdout.write(dim(`
12478
+ topics
12479
+ `));
12480
+ const slugWidth = Math.max(...ws.topics.map((t) => t.meshSlug.length), 6);
12481
+ for (const t of ws.topics) {
12482
+ const slug = dim(t.meshSlug.padEnd(slugWidth));
12483
+ const name = cyan(`#${t.name}`);
12484
+ const desc = t.description ? dim(` — ${t.description}`) : "";
12485
+ process.stdout.write(` ${slug} ${name}${desc}
12486
+ `);
12487
+ }
12488
+ }
12489
+ if (ws.messages.length > 0) {
12490
+ process.stdout.write(dim(`
12491
+ messages
12492
+ `));
12493
+ const slugWidth = Math.max(...ws.messages.map((m) => m.meshSlug.length), 6);
12494
+ for (const m of ws.messages) {
12495
+ const slug = dim(m.meshSlug.padEnd(slugWidth));
12496
+ const topic = cyan(`#${m.topicName}`);
12497
+ const sender = m.senderName;
12498
+ const ago = formatRelativeTime(m.createdAt);
12499
+ const snippet = m.snippet ?? (m.bodyVersion === 2 ? dim("[encrypted — open the topic to decrypt]") : dim("[empty]"));
12500
+ const highlighted = m.snippet ? highlightMatch(snippet, flags.query) : snippet;
12501
+ process.stdout.write(` ${slug} ${topic} ${dim(sender + " ·")} ${dim(ago)}
12502
+ ` + ` ${highlighted}
12503
+ `);
12504
+ }
12505
+ }
12506
+ return EXIT.SUCCESS;
12507
+ });
12508
+ }
12509
+ function highlightMatch(text, query) {
12510
+ if (!query)
12511
+ return text;
12512
+ const idx = text.toLowerCase().indexOf(query.toLowerCase());
12513
+ if (idx === -1)
12514
+ return text;
12515
+ const before = text.slice(0, idx);
12516
+ const match = text.slice(idx, idx + query.length);
12517
+ const after = text.slice(idx + query.length);
12518
+ return `${before}${yellow(match)}${after}`;
12519
+ }
12449
12520
  function formatRelativeTime(iso) {
12450
12521
  const then = new Date(iso).getTime();
12451
12522
  const now = Date.now();
@@ -14113,6 +14184,7 @@ Topic (conversation scope, v0.2.0)
14113
14184
  claudemesh me topics cross-mesh topic list [--unread]
14114
14185
  claudemesh me notifications cross-mesh @-mentions [--all] [--since=ISO]
14115
14186
  claudemesh me activity cross-mesh recent messages [--since=ISO]
14187
+ claudemesh me search <q> cross-mesh search (topics + messages)
14116
14188
  claudemesh member list mesh roster with online state [--online]
14117
14189
  claudemesh notification list recent @-mentions of you [--since <ISO>]
14118
14190
 
@@ -14995,6 +15067,10 @@ async function main() {
14995
15067
  ...f,
14996
15068
  since: flags.since
14997
15069
  }));
15070
+ } else if (sub === "search") {
15071
+ const { runMeSearch: runMeSearch2 } = await Promise.resolve().then(() => (init_me(), exports_me));
15072
+ const query = positionals.slice(1).join(" ").trim();
15073
+ process.exit(await runMeSearch2({ ...f, query }));
14998
15074
  } else {
14999
15075
  console.error(`Usage: claudemesh me (cross-mesh overview)
15000
15076
  claudemesh me topics (cross-mesh topic list)
@@ -15003,7 +15079,8 @@ async function main() {
15003
15079
  claudemesh me notifications --all (include already-read)
15004
15080
  claudemesh me notifications --since=ISO (custom window)
15005
15081
  claudemesh me activity (recent messages, last 24h)
15006
- claudemesh me activity --since=ISO (custom window)`);
15082
+ claudemesh me activity --since=ISO (custom window)
15083
+ claudemesh me search <query> (cross-mesh search)`);
15007
15084
  process.exit(EXIT.INVALID_ARGS);
15008
15085
  }
15009
15086
  break;
@@ -15073,4 +15150,4 @@ main().catch((err) => {
15073
15150
  process.exit(EXIT.INTERNAL_ERROR);
15074
15151
  });
15075
15152
 
15076
- //# debugId=E4399AFE3999F90D64756E2164756E21
15153
+ //# debugId=70FF6020E5175BED64756E2164756E21