claudemesh-cli 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/entrypoints/cli.js
CHANGED
|
@@ -88,7 +88,7 @@ __export(exports_urls, {
|
|
|
88
88
|
VERSION: () => VERSION,
|
|
89
89
|
URLS: () => URLS
|
|
90
90
|
});
|
|
91
|
-
var URLS, VERSION = "1.9.
|
|
91
|
+
var URLS, VERSION = "1.9.3", env;
|
|
92
92
|
var init_urls = __esm(() => {
|
|
93
93
|
URLS = {
|
|
94
94
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -7083,6 +7083,61 @@ var init_recall = __esm(() => {
|
|
|
7083
7083
|
init_exit_codes();
|
|
7084
7084
|
});
|
|
7085
7085
|
|
|
7086
|
+
// src/cli/validators.ts
|
|
7087
|
+
function validateMessageId(input) {
|
|
7088
|
+
if (!input) {
|
|
7089
|
+
return {
|
|
7090
|
+
ok: false,
|
|
7091
|
+
code: "missing",
|
|
7092
|
+
reason: "message id is required",
|
|
7093
|
+
expected: "32-char base62 id, or ≥8-char prefix"
|
|
7094
|
+
};
|
|
7095
|
+
}
|
|
7096
|
+
if (input.length < 8) {
|
|
7097
|
+
return {
|
|
7098
|
+
ok: false,
|
|
7099
|
+
code: "too_short",
|
|
7100
|
+
reason: `id is ${input.length} chars, needs ≥8`,
|
|
7101
|
+
expected: "8+ chars (paste from a previous send/post output)"
|
|
7102
|
+
};
|
|
7103
|
+
}
|
|
7104
|
+
if (input.length > 32) {
|
|
7105
|
+
return {
|
|
7106
|
+
ok: false,
|
|
7107
|
+
code: "too_long",
|
|
7108
|
+
reason: `id is ${input.length} chars, max 32`,
|
|
7109
|
+
expected: "trim trailing characters"
|
|
7110
|
+
};
|
|
7111
|
+
}
|
|
7112
|
+
if (!BASE62_RE.test(input)) {
|
|
7113
|
+
return {
|
|
7114
|
+
ok: false,
|
|
7115
|
+
code: "bad_charset",
|
|
7116
|
+
reason: "id contains characters outside [A-Za-z0-9]",
|
|
7117
|
+
expected: "base62 only"
|
|
7118
|
+
};
|
|
7119
|
+
}
|
|
7120
|
+
return { ok: true, value: { value: input, isPrefix: input.length < 32 } };
|
|
7121
|
+
}
|
|
7122
|
+
function renderValidationError(args, write = (s) => process.stderr.write(s)) {
|
|
7123
|
+
write(` \x1B[31m✘\x1B[0m ${args.verb} ${args.input}
|
|
7124
|
+
`);
|
|
7125
|
+
write(` ${args.result.reason}.
|
|
7126
|
+
`);
|
|
7127
|
+
if (args.result.expected) {
|
|
7128
|
+
write(` expected: ${args.result.expected}
|
|
7129
|
+
`);
|
|
7130
|
+
}
|
|
7131
|
+
if (args.nearest) {
|
|
7132
|
+
write(` did you mean: \x1B[36m${args.nearest}\x1B[0m
|
|
7133
|
+
`);
|
|
7134
|
+
}
|
|
7135
|
+
}
|
|
7136
|
+
var BASE62_RE;
|
|
7137
|
+
var init_validators = __esm(() => {
|
|
7138
|
+
BASE62_RE = /^[A-Za-z0-9]+$/;
|
|
7139
|
+
});
|
|
7140
|
+
|
|
7086
7141
|
// src/commands/broker-actions.ts
|
|
7087
7142
|
var exports_broker_actions = {};
|
|
7088
7143
|
__export(exports_broker_actions, {
|
|
@@ -7246,17 +7301,44 @@ async function runForget(id, opts) {
|
|
|
7246
7301
|
return EXIT.SUCCESS;
|
|
7247
7302
|
}
|
|
7248
7303
|
async function runMsgStatus(id, opts) {
|
|
7249
|
-
|
|
7250
|
-
|
|
7304
|
+
const v = validateMessageId(id);
|
|
7305
|
+
if (!v.ok) {
|
|
7306
|
+
if (opts.json) {
|
|
7307
|
+
console.log(JSON.stringify({
|
|
7308
|
+
ok: false,
|
|
7309
|
+
error: "invalid_argument",
|
|
7310
|
+
field: "messageId",
|
|
7311
|
+
code: v.code,
|
|
7312
|
+
reason: v.reason,
|
|
7313
|
+
expected: v.expected
|
|
7314
|
+
}));
|
|
7315
|
+
} else {
|
|
7316
|
+
renderValidationError({
|
|
7317
|
+
verb: "msg-status",
|
|
7318
|
+
input: id ?? "(missing)",
|
|
7319
|
+
result: v
|
|
7320
|
+
});
|
|
7321
|
+
}
|
|
7251
7322
|
return EXIT.INVALID_ARGS;
|
|
7252
7323
|
}
|
|
7324
|
+
const lookupId = v.value.value;
|
|
7253
7325
|
return await withMesh({ meshSlug: opts.mesh ?? null }, async (client) => {
|
|
7254
|
-
const result = await client.messageStatus(
|
|
7326
|
+
const result = await client.messageStatus(lookupId);
|
|
7255
7327
|
if (!result) {
|
|
7256
|
-
if (opts.json)
|
|
7257
|
-
console.log(JSON.stringify({
|
|
7258
|
-
|
|
7259
|
-
|
|
7328
|
+
if (opts.json) {
|
|
7329
|
+
console.log(JSON.stringify({
|
|
7330
|
+
ok: false,
|
|
7331
|
+
error: "not_found",
|
|
7332
|
+
id: lookupId,
|
|
7333
|
+
isPrefix: v.value.isPrefix
|
|
7334
|
+
}));
|
|
7335
|
+
} else {
|
|
7336
|
+
const hint = v.value.isPrefix ? ` no message id starts with ${dim('"' + lookupId + '"')} in this mesh.
|
|
7337
|
+
try: claudemesh msg-status <full-32-char-id>` : ` message ${dim(lookupId.slice(0, 12) + "…")} not in queue (already drained, expired, or never sent in this mesh).`;
|
|
7338
|
+
render.err(`message not found`);
|
|
7339
|
+
process.stderr.write(hint + `
|
|
7340
|
+
`);
|
|
7341
|
+
}
|
|
7260
7342
|
return EXIT.NOT_FOUND;
|
|
7261
7343
|
}
|
|
7262
7344
|
if (opts.json) {
|
|
@@ -7388,6 +7470,7 @@ var init_broker_actions = __esm(() => {
|
|
|
7388
7470
|
init_render();
|
|
7389
7471
|
init_styles();
|
|
7390
7472
|
init_exit_codes();
|
|
7473
|
+
init_validators();
|
|
7391
7474
|
});
|
|
7392
7475
|
|
|
7393
7476
|
// src/commands/remind.ts
|
|
@@ -13748,6 +13831,7 @@ async function gate(ctx, opts) {
|
|
|
13748
13831
|
}
|
|
13749
13832
|
|
|
13750
13833
|
// src/entrypoints/cli.ts
|
|
13834
|
+
init_styles();
|
|
13751
13835
|
installSignalHandlers();
|
|
13752
13836
|
installErrorHandlers();
|
|
13753
13837
|
var { command, positionals, flags } = parseArgv(process.argv);
|
|
@@ -13909,9 +13993,44 @@ Flags
|
|
|
13909
13993
|
-y, --yes skip confirmations (= --approval-mode yolo)
|
|
13910
13994
|
-q, --quiet suppress non-essential output
|
|
13911
13995
|
`;
|
|
13996
|
+
function colorizeHelp(raw) {
|
|
13997
|
+
const lines = raw.split(`
|
|
13998
|
+
`);
|
|
13999
|
+
const SECTION_HEADER_RE = /^([A-Z][A-Za-z0-9 /+-]*?)(\s*\(.*\))?$/;
|
|
14000
|
+
const VERB_ROW_RE = /^(\s{2})(claudemesh[^\s]*(?:\s+[^\s]+)*?)(\s{2,})(.*)$/;
|
|
14001
|
+
const ALIAS_RE = /(\(alias[^)]*\))/g;
|
|
14002
|
+
const out = [];
|
|
14003
|
+
for (const line of lines) {
|
|
14004
|
+
if (line.startsWith("claudemesh —")) {
|
|
14005
|
+
out.push(orange(line));
|
|
14006
|
+
continue;
|
|
14007
|
+
}
|
|
14008
|
+
if (line.trim() === "") {
|
|
14009
|
+
out.push(line);
|
|
14010
|
+
continue;
|
|
14011
|
+
}
|
|
14012
|
+
if (!line.startsWith(" ") && SECTION_HEADER_RE.test(line)) {
|
|
14013
|
+
const m = line.match(SECTION_HEADER_RE);
|
|
14014
|
+
const head = bold(clay(m[1]));
|
|
14015
|
+
const meta = m[2] ? dim(m[2]) : "";
|
|
14016
|
+
out.push(head + meta);
|
|
14017
|
+
continue;
|
|
14018
|
+
}
|
|
14019
|
+
const verbMatch = line.match(VERB_ROW_RE);
|
|
14020
|
+
if (verbMatch) {
|
|
14021
|
+
const [, indent, syntax, gap, rest] = verbMatch;
|
|
14022
|
+
const dimmedRest = rest.replace(ALIAS_RE, (m) => dim(m));
|
|
14023
|
+
out.push(`${indent}${cyan(syntax)}${gap}${dimmedRest}`);
|
|
14024
|
+
continue;
|
|
14025
|
+
}
|
|
14026
|
+
out.push(line);
|
|
14027
|
+
}
|
|
14028
|
+
return out.join(`
|
|
14029
|
+
`);
|
|
14030
|
+
}
|
|
13912
14031
|
async function main() {
|
|
13913
14032
|
if (flags.help || flags.h) {
|
|
13914
|
-
console.log(HELP);
|
|
14033
|
+
console.log(colorizeHelp(HELP));
|
|
13915
14034
|
process.exit(EXIT.SUCCESS);
|
|
13916
14035
|
}
|
|
13917
14036
|
if (flags.version || flags.V) {
|
|
@@ -14727,4 +14846,4 @@ main().catch((err) => {
|
|
|
14727
14846
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
14728
14847
|
});
|
|
14729
14848
|
|
|
14730
|
-
//# debugId=
|
|
14849
|
+
//# debugId=AEE2B186929FB60F64756E2164756E21
|