@jmoak/vibrissa 0.1.0 → 2.0.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.
package/dist/cli.d.ts CHANGED
@@ -1 +1,58 @@
1
1
  #!/usr/bin/env node
2
+ /**
3
+ * Human output for the CLI: colors (only on a TTY, honoring NO_COLOR / FORCE_COLOR),
4
+ * aligned tables, schema summaries, and help pages. `--json` output never goes through
5
+ * this module.
6
+ */
7
+
8
+ interface FlagHelp {
9
+ flag: string;
10
+ text: string;
11
+ }
12
+ interface CommandHelp {
13
+ name: string;
14
+ group: string;
15
+ summary: string;
16
+ usage: string[];
17
+ description?: string;
18
+ flags?: FlagHelp[];
19
+ /** Include the shared connection flags section (--config, --server, ...). */
20
+ common?: boolean;
21
+ examples?: string[];
22
+ /** Accepted flags beyond `flags` / common ones (for unknown-flag checks). */
23
+ extraFlags?: string[];
24
+ }
25
+
26
+ interface CommandSpec extends CommandHelp {
27
+ run: (argv: string[]) => Promise<number>;
28
+ /** stdout carries a protocol stream: never print errors/JSON there. */
29
+ protocolStdout?: boolean;
30
+ }
31
+ declare const COMMANDS: Record<string, CommandSpec>;
32
+ /** `vib help cases`: everything needed to write a case, in about 2 KB. */
33
+ declare const CASES_CHEATSHEET = "Vibrissa case files \u2014 cheat sheet (full reference: docs/CASES.md, docs/MATCHERS.md)\n\nOne JSON file = one case. One operation:\n \"tool\": \"echo\" | \"resource\": \"file:///x\" | \"resourceTemplate\": \"users://{id}\" | \"prompt\": \"greet\"\n \"args\": { ... } tool args, template variables, or prompt args\n \"expect\": <expectation> the normalized result; plain JSON = exact deep equality\n \"expectError\": { \"code\": \"InvalidParams\", \"message\": { \"$regex\": \"must be\" } } (a tool isError counts)\nAlso: name, tags, server, skip, flaky, timeoutMs, budgetMs, validateOutput, normalize\n\nMatchers (anywhere inside expect):\n {\"$partial\": true, ...} extra keys / trailing items allowed below\n {\"$regex\": \"^ok\", \"flags\": \"i\"} {\"$wildcard\": \"req_*\"} strings\n {\"$type\": \"string\"} {\"$any\": true} (present) {\"$ignore\": true} (may be missing)\n {\"$number\": {\"gte\": 0, \"lt\": 10}} {\"$length\": {\"min\": 1}}\n {\"$contains\": {...}, \"count\": 1} {\"$unordered\": true, \"value\": [...]} arrays\n {\"$oneOf\": [a, b]} {\"$schema\": {...JSON Schema...}} {\"$ref\": \"./shared/x.json\"} {\"$literal\": {...}}\n Timestamps: {\"$schema\": {\"type\": \"string\", \"format\": \"date-time\"}}\n\nFlows: \"steps\": [ step, ... ], plus \"setup\" / \"teardown\" (teardown runs on failure; \"ignoreErrors\": true)\n \"capture\": { \"sid\": \"structuredContent.sessionId\" } then \"{{sid}}\" in later args / expect\n \"{{env.NAME}}\" reads an environment variable\nInput requests (MRTR):\n \"respond\": { \"elicitation/create\": { \"action\": \"accept\", \"content\": { \"confirm\": true } } }\n \"expectInputRequired\": { \"elicitation/create\": { \"$partial\": true, \"message\": \"Proceed?\" } }\nTasks: \"await\": true or { \"pollMs\": 500, \"timeoutMs\": 30000 }; \"expectTask\": { \"$partial\": true, ... }\n\nExamples:\n {\"tool\": \"echo\", \"args\": {\"text\": \"hi\"}, \"expect\": {\"content\": [{\"type\": \"text\", \"text\": \"hi\"}]}}\n {\"tool\": \"echo\", \"args\": {}, \"expectError\": {\"code\": \"InvalidParams\"}}\n {\"steps\": [\n {\"tool\": \"session.create\", \"args\": {\"user\": \"jo\"}, \"capture\": {\"sid\": \"structuredContent.id\"}},\n {\"tool\": \"session.get\", \"args\": {\"id\": \"{{sid}}\"},\n \"expect\": {\"$partial\": true, \"structuredContent\": {\"user\": \"jo\"}}}]}\n\nWrite cases: vib record <tool> --arg k=v \u00B7 review: vib explain <file> \u00B7 run: vib run";
34
+ declare function formatGlobalHelp(): string;
35
+ interface ErrorEnvelope {
36
+ ok: false;
37
+ error: {
38
+ type: string;
39
+ code: string;
40
+ message: string;
41
+ hint: string;
42
+ };
43
+ next?: string[];
44
+ }
45
+ /** Map anything thrown by a command to exit code + the `--json` envelope + human text. */
46
+ declare function describeError(err: unknown, command: string): {
47
+ exit: number;
48
+ envelope: ErrorEnvelope;
49
+ human: string;
50
+ };
51
+ /** Close a message as a sentence (`..., ` / `...:` → `....`) so a hint can follow it. */
52
+ declare function endSentence(text: string): string;
53
+ /** Run the CLI with `argv` (without node/script). Returns the exit code. */
54
+ declare function main(rawArgv: string[]): Promise<number>;
55
+ /** Run `main` and exit with its code once pending I/O has drained. */
56
+ declare function runCli(argv?: string[]): Promise<void>;
57
+
58
+ export { CASES_CHEATSHEET, COMMANDS, type CommandSpec, type ErrorEnvelope, describeError, endSentence, formatGlobalHelp, main, runCli };