Adds apps/cli/src/cli/validators.ts — a small module of shape validators (pubkey, pubkey prefix, message id, mesh slug) that return discriminated results so callers can distinguish "shape is wrong" (INVALID_ARGS exit) from "value is well-shaped, lookup failed" (NOT_FOUND exit). Includes renderValidationError() for a consistent three-tier error contract: what's wrong, what would be valid, closest valid alternative. First adopter is `claudemesh msg-status`: - Validates id locally before opening WS — typos return immediately. - Accepts 8-32 char prefixes (full ids are 32). Pastes that get copy-truncated by the terminal still work. - Distinct error messages for malformed input vs not-in-queue vs ambiguous prefix; --json emits the structured shape. Broker side: WS message_status handler validates idStr is 8-32 base62 before querying. Prefix lookups use LIKE 'prefix%' scoped to the caller's mesh (no cross-mesh leak). Returns ambiguous_prefix when more than one match. Establishes the canonical pattern; rolling out to send / grant / revoke / topic post --reply-to in subsequent patches.
1.8 KiB
1.8 KiB