@acid-cat/cli 0.13.0 → 0.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.
- package/README.md +6 -1
- package/conformance/fixture.acidcat.json +30 -2
- package/dist/catalog.js +4 -1
- package/dist/conform/cli.js +129 -6
- package/dist/conform/mcp.js +8 -0
- package/dist/json/catalog.schema.json.js +4 -2
- package/dist/json/fixture.acidcat.json.js +20 -2
- package/dist/json/package.json.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -35,6 +35,10 @@ The JSON document comes only when the options are correct. With options that are
|
|
|
35
35
|
- An **error** is a broken rule. Examples: an audience that names an unknown target, an event payload that is not an object, or an id that is both a capability and an event.
|
|
36
36
|
- A **warning** is a broken recommendation. Examples: a file that is not in [canonical form](../../spec/catalog.md#canonical-form), or a member with no `x-` prefix.
|
|
37
37
|
|
|
38
|
+
A capability can have the hints `readOnly`, `destructive` and `idempotent`. Each hint is a boolean. `check` gives an error for a hint that is not a boolean, and `format` writes the hints in this order.
|
|
39
|
+
|
|
40
|
+
Each [alias](../../spec/bindings/cli.md#aliases) in `options.cli` is checked too. A command alias has one word, or two words with one space between them, such as `inbox all`. The first word of a two-word alias follows the rules of the name of a one-word alias. A one-word alias and two-word aliases can have the same first word. The name of a command alias can be a shared prefix of commands, such as `inbox` for `inbox.adopt` and `inbox.list`, but not the path of a command, such as `inbox adopt`.
|
|
41
|
+
|
|
38
42
|
The exit code is 0 if there are no errors. It is 1 if there are errors. With `--strict`, warnings also give the exit code 1.
|
|
39
43
|
|
|
40
44
|
## format
|
|
@@ -51,7 +55,7 @@ The exit code is 0 if there are no errors. It is 1 if there are errors. With `--
|
|
|
51
55
|
|
|
52
56
|
- **MCP through HTTP:** `--mcp <url>`. The official MCP client, with revision `2026-07-28`, for tools and outcomes; raw requests for rejections. With `--mcp-handshake`, or `mcpHandshake: true` in code, the checks also test the [`initialize` handshake of earlier revisions](../../spec/bindings/mcp.md#earlier-revisions-through-http): the client of revision `2025-11-25` tests the tools and outcomes again, and raw requests test `initialize` with no session and a notification.
|
|
53
57
|
- **MCP through stdio:** `--mcp-stdio "<command>"`, or `mcpStdio` in code. The checks start the server as a process. The official MCP client tests the tools and outcomes two times: with revision `2026-07-28`, and with the `initialize` handshake of revision `2025-11-25`. It also tests `notifications/tools/list_changed` and `notifications/cancelled`. Raw lines test the version negotiation, a line that is not JSON, a standard output with only JSON-RPC messages, and the end of standard input.
|
|
54
|
-
- **HTTP** and **CLI:** each outcome, each kind of call failure, availability, and rejections. For the CLI, also each kind of flag, including a repeated flag that gives one item of an array for each occurrence, or the whole array as JSON text, and the usage line of each command and of each event, with `[--cursor <string>] [--max-age-ms <integer>]`. An interrupt (`SIGINT`) during a call that holds gives exit code 130, and the call must end and delete its marker file. `watch --cursor` starts after the cursor, and a `--max-age-ms` that is not an integer gives exit code 3.
|
|
58
|
+
- **HTTP** and **CLI:** each outcome, each kind of call failure, availability, and rejections. For the CLI, also each kind of flag, including a repeated flag that gives one item of an array for each occurrence, or the whole array as JSON text, and the usage line of each command and of each event, with `[--cursor <string>] [--max-age-ms <integer>]`. The help of a command, an alias and an event must be `Usage: ` and the usage, an empty line, and the description. The help of a shared prefix must be its command list on standard output, and a shared prefix alone or with a flag that is not `--help` must write the same list to standard error, with exit code 2. An interrupt (`SIGINT`) during a call that holds gives exit code 130, and the call must end and delete its marker file. `watch --cursor` starts after the cursor, and a `--max-age-ms` that is not an integer gives exit code 3.
|
|
55
59
|
- **WebMCP:** the checks act as the WebMCP host. `--webmcp <url>` opens a page that serves the `app` target in Chromium, through [Playwright](https://playwright.dev), with a test `modelContext`. Install Playwright to use it: `pnpm add -D playwright`, then `pnpm exec playwright install chromium`. In code, `webmcp` can also be a function that installs the implementation on a host in the same process.
|
|
56
60
|
- **Events:** through HTTP, MCP with each transport, and the CLI. The checks examine the list of the events of the view, the call failures before the first occurrence (an event outside the view, and invalid input), each occurrence against `schemas/occurrence.schema.json` and the payload schema, the order of the occurrences, an occurrence with `truncated: true` (`fixture.ticks` with `gap`: `truncated` in the occurrence through HTTP and the CLI, `notifications/events/active` with `truncated: true` and the cursor before the event through MCP push, and a result with `truncated: true` through MCP poll), the cursor, each end of a subscription (complete and `internal`), and cancellation. Through MCP, they also examine `server/discover`, `events/list` with the delivery modes of the server, `notifications/events/active`, and the subscription id of each message. With `--mcp-handshake`, `initialize` must not declare the events extension. Through WebMCP, no event is a tool.
|
|
57
61
|
- **Poll delivery:** through MCP with each transport, when `events/list` gives `poll`. If not, the checks give a warning, and `events/poll` must answer `Unsupported`. The checks test each row of the table of [Poll](../../spec/bindings/mcp.md#poll): no cursor with no lease and with a lease, a cursor of the lease, a cursor of another lease with and without a lease of the key, a cursor of push delivery, and a cursor of another lease that has a cursor of the provider, which resumes after it. They also test the form of each result, `maxEvents` and `hasMore`, a `maxEvents` that is not valid, the failures before the first occurrence, which start no lease, and the error `-32603` after a defect. With `--poll-buffer <n>`, or `poll.bufferLimit` in code, they test a cursor older than the buffer: `n` is the buffer size of the deployment, from 1 to 97. With `--poll-lease-ms <ms>`, or `poll.leaseMs`, they test that a lease with no poll ends, and cancels its subscription. The lease time must be shorter than the deadline. A check makes other requests between two polls of a lease, so give a lease time of some seconds, for example 5 seconds. A shorter lease can end between two polls on a busy computer, and the check then fails. Each check uses a new key in its input, so the leases of an earlier run do not change the result.
|
|
@@ -59,6 +63,7 @@ The exit code is 0 if there are no errors. It is 1 if there are errors. With `--
|
|
|
59
63
|
- `--webhook-min-ttl-ms <ms>` and `--webhook-max-ttl-ms <ms>`, or `webhook.minTtlMs` and `webhook.maxTtlMs`, give the lifetimes of the deployment. The defaults are those of the specification: 60 000 and 3 600 000. With `--webhook-min-ttl-ms`, which must be shorter than the deadline, the checks also test that a subscription with no renewal ends at the end of its lifetime, and gets no more deliveries.
|
|
60
64
|
- `--webhook-max-subscriptions <n>`, or `webhook.maxSubscriptions`, gives the limit of subscriptions of one principal. With it, the checks subscribe until the server answers `ResourceExhausted` (`-32025`, with `data: { limit: "subscriptions", max }`), then renew one subscription.
|
|
61
65
|
- `--webhook-other-principal <name>`, or `webhook.otherPrincipal`, gives a second principal, for `Authorization: Bearer <name>`. With it, the check of the limit fills the subscriptions of this principal, which no other check uses, so it expects exactly `n` subscriptions, and then tests that the first principal can still subscribe. Without it, the check uses the first principal, which can still have subscriptions of other checks. The retry check waits for the first retry of the deployment, so the deadline must be longer than that wait. Without these options, a server that does not list `webhook` must answer `events/subscribe` and `events/unsubscribe` with `Unsupported`. Through stdio, it must always do so.
|
|
66
|
+
- **Hints:** through MCP with each transport, each tool has `readOnlyHint`, `destructiveHint` and `idempotentHint` as the `readOnly`, `destructive` and `idempotent` of its capability. When a capability has no hint, the tool has no annotation or the MCP default.
|
|
62
67
|
- **Properties:** with fast-check, through MCP with each transport and through HTTP: concurrent calls each get exactly their own outcome, and a cancellation changes only its own call.
|
|
63
68
|
|
|
64
69
|
The checks wait for states that they can observe, not for times. Before a check cancels a call to `fixture.hold`, it waits until `fixture.held` gives the key of the call, or, for the CLI, until the marker file of the call exists. In the same way, before a check signals or cancels a subscription to `fixture.watch`, it waits until `fixture.watching` gives its key, or until its marker file exists. After it cancels the subscription, it waits until the key leaves `fixture.watching`. Through the CLI, after the process exits, it waits until the marker file of the call or the subscription is deleted. A core can exit with 130 when a call does not stop, so the exit code alone does not show that the call ended. Each check has one deadline: `--deadline`, or `deadline` in code, in milliseconds. The default is 30 000. A check that does not settle before its deadline fails with "did not settle", and the check stops what it started. This cleanup has a deadline of the same length, so `conform` always returns. The deadline never makes a check pass.
|
|
@@ -39,9 +39,27 @@
|
|
|
39
39
|
"text": "fixed"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
+
"fixture": {
|
|
43
|
+
"capability": "fixture.flags",
|
|
44
|
+
"input": {
|
|
45
|
+
"mode": "slow"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
42
48
|
"held-keys": {
|
|
43
49
|
"capability": "fixture.held"
|
|
44
50
|
},
|
|
51
|
+
"notes": {
|
|
52
|
+
"capability": "fixture.raw"
|
|
53
|
+
},
|
|
54
|
+
"notes add": {
|
|
55
|
+
"capability": "fixture.note"
|
|
56
|
+
},
|
|
57
|
+
"notes loud": {
|
|
58
|
+
"capability": "fixture.note",
|
|
59
|
+
"input": {
|
|
60
|
+
"loud": true
|
|
61
|
+
}
|
|
62
|
+
},
|
|
45
63
|
"quick": {
|
|
46
64
|
"capability": "fixture.flags",
|
|
47
65
|
"input": {
|
|
@@ -54,6 +72,12 @@
|
|
|
54
72
|
"say": {
|
|
55
73
|
"capability": "fixture.echo"
|
|
56
74
|
},
|
|
75
|
+
"shout hello": {
|
|
76
|
+
"capability": "fixture.echo",
|
|
77
|
+
"input": {
|
|
78
|
+
"text": "HELLO"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
57
81
|
"ticks": {
|
|
58
82
|
"event": "fixture.ticks",
|
|
59
83
|
"input": {
|
|
@@ -388,7 +412,9 @@
|
|
|
388
412
|
"delivered"
|
|
389
413
|
],
|
|
390
414
|
"type": "object"
|
|
391
|
-
}
|
|
415
|
+
},
|
|
416
|
+
"destructive": false,
|
|
417
|
+
"idempotent": false
|
|
392
418
|
},
|
|
393
419
|
"fixture.switch.set": {
|
|
394
420
|
"description": "Turn the switch on or off. The switch controls the availability of fixture.toggle.",
|
|
@@ -408,7 +434,9 @@
|
|
|
408
434
|
"on"
|
|
409
435
|
],
|
|
410
436
|
"type": "object"
|
|
411
|
-
}
|
|
437
|
+
},
|
|
438
|
+
"destructive": true,
|
|
439
|
+
"idempotent": true
|
|
412
440
|
},
|
|
413
441
|
"fixture.toggle": {
|
|
414
442
|
"description": "Available only while the switch is on.",
|
package/dist/catalog.js
CHANGED
|
@@ -26,6 +26,8 @@ const KNOWN_MEMBERS = {
|
|
|
26
26
|
"output",
|
|
27
27
|
"failures",
|
|
28
28
|
"readOnly",
|
|
29
|
+
"destructive",
|
|
30
|
+
"idempotent",
|
|
29
31
|
"state"
|
|
30
32
|
],
|
|
31
33
|
event: [
|
|
@@ -38,8 +40,9 @@ const KNOWN_MEMBERS = {
|
|
|
38
40
|
};
|
|
39
41
|
const optional = (object, key, isMember) => !Object.hasOwn(object, key) || isMember(object[key]);
|
|
40
42
|
const isString = (value) => typeof value === "string";
|
|
43
|
+
const isBoolean = (value) => typeof value === "boolean";
|
|
41
44
|
const isTarget = (value) => isObject(value) && isStringArray(value.bindings);
|
|
42
|
-
const isCapability = (value) => isObject(value) && typeof value.description === "string" && optional(value, "audience", isStringArray) && optional(value, "input", isObject) && optional(value, "output", isObject) && optional(value, "state", isObject) && optional(value, "failures", (failures) => isRecordOf(failures, isObject)) && optional(value, "readOnly",
|
|
45
|
+
const isCapability = (value) => isObject(value) && typeof value.description === "string" && optional(value, "audience", isStringArray) && optional(value, "input", isObject) && optional(value, "output", isObject) && optional(value, "state", isObject) && optional(value, "failures", (failures) => isRecordOf(failures, isObject)) && optional(value, "readOnly", isBoolean) && optional(value, "destructive", isBoolean) && optional(value, "idempotent", isBoolean);
|
|
43
46
|
const isEvent = (value) => isObject(value) && typeof value.description === "string" && optional(value, "audience", isStringArray) && optional(value, "input", isObject) && optional(value, "payload", isObject);
|
|
44
47
|
const isCatalog = (value) => isObject(value) && typeof value.acidcat === "string" && optional(value, "title", isString) && optional(value, "description", isString) && isRecordOf(value.targets, isTarget) && optional(value, "$defs", (types) => isRecordOf(types, isObject)) && isRecordOf(value.capabilities, isCapability) && optional(value, "events", (events) => isRecordOf(events, isEvent));
|
|
45
48
|
const decodeCatalog = (() => {
|
package/dist/conform/cli.js
CHANGED
|
@@ -30,11 +30,19 @@ const EVENT_USAGES = {
|
|
|
30
30
|
"fixture.watch": "watch fixture.watch --key <string> [--marker <string>] [--cursor <string>] [--max-age-ms <integer>]"
|
|
31
31
|
};
|
|
32
32
|
const ALIAS_USAGES = {
|
|
33
|
-
"fixture.echo": [
|
|
34
|
-
|
|
33
|
+
"fixture.echo": [
|
|
34
|
+
"--hello",
|
|
35
|
+
"say --text <string>",
|
|
36
|
+
"shout hello"
|
|
37
|
+
],
|
|
38
|
+
"fixture.flags": ["fixture [--count <integer>] [--extra <json>] [--label <string>] [--ratio <number>] [--steps <integer>...] [--tags <string>...] [--verbose]", "quick [--count <integer>] [--extra <json>] [--label <string>] [--ratio <number>] [--steps <integer>...] [--tags <string>...] [--verbose]"],
|
|
35
39
|
"fixture.held": ["held-keys"],
|
|
36
|
-
"fixture.note": [
|
|
37
|
-
|
|
40
|
+
"fixture.note": [
|
|
41
|
+
"fixed-note [--loud]",
|
|
42
|
+
"notes add --text <string> [--loud]",
|
|
43
|
+
"notes loud --text <string>"
|
|
44
|
+
],
|
|
45
|
+
"fixture.raw": ["notes '<json>'", "raw '<json>'"]
|
|
38
46
|
};
|
|
39
47
|
const EVENT_ALIAS_USAGES = {
|
|
40
48
|
"fixture.broken": ["broken-ticks [--cursor <string>] [--max-age-ms <integer>]"],
|
|
@@ -112,12 +120,32 @@ async function checkCli(command, options) {
|
|
|
112
120
|
for (const [name, args, code] of [
|
|
113
121
|
[
|
|
114
122
|
"an unknown command has exit code 2",
|
|
115
|
-
["
|
|
123
|
+
["nothing"],
|
|
116
124
|
2
|
|
117
125
|
],
|
|
118
126
|
[
|
|
119
127
|
"a shared prefix alone has exit code 2",
|
|
120
|
-
["fixture"],
|
|
128
|
+
["fixture", "switch"],
|
|
129
|
+
2
|
|
130
|
+
],
|
|
131
|
+
[
|
|
132
|
+
"an unknown word after an alias that is the default of a shared prefix has exit code 2",
|
|
133
|
+
["fixture", "nope"],
|
|
134
|
+
2
|
|
135
|
+
],
|
|
136
|
+
[
|
|
137
|
+
"the first word of two-word aliases alone, with no one-word alias, has exit code 2",
|
|
138
|
+
["shout"],
|
|
139
|
+
2
|
|
140
|
+
],
|
|
141
|
+
[
|
|
142
|
+
"an unknown second word after the first word of two-word aliases has exit code 2",
|
|
143
|
+
["shout", "nope"],
|
|
144
|
+
2
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
"an unknown second word after a one-word alias with two-word aliases has exit code 2",
|
|
148
|
+
["notes", "nope"],
|
|
121
149
|
2
|
|
122
150
|
],
|
|
123
151
|
[
|
|
@@ -292,10 +320,76 @@ async function checkCli(command, options) {
|
|
|
292
320
|
expectEqual(rest.join(" "), kind === "event" ? EVENT_USAGES[id] : USAGES[id], `usage of ${id} after the name of the program`);
|
|
293
321
|
}
|
|
294
322
|
});
|
|
323
|
+
await checkHelp(checks, command);
|
|
295
324
|
await checkAliases(checks, command);
|
|
296
325
|
await checkWatch(checks, command);
|
|
297
326
|
return checks;
|
|
298
327
|
}
|
|
328
|
+
async function checkHelp(checks, command) {
|
|
329
|
+
const run = (signal, ...args) => start(command, args, signal).run;
|
|
330
|
+
const listed = async (signal) => entriesOf((await run(signal, "list")).stdout);
|
|
331
|
+
const entry = (entries, id) => {
|
|
332
|
+
const found = entries.find((each) => each.id === id);
|
|
333
|
+
if (found === void 0 || typeof found.usage !== "string" || typeof found.description !== "string") throw new Error(`list must give ${id} with its usage and its description`);
|
|
334
|
+
return {
|
|
335
|
+
usage: found.usage,
|
|
336
|
+
description: found.description,
|
|
337
|
+
aliases: isArrayOf(found.aliases, (alias) => typeof alias === "string") ? found.aliases : []
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
const expectHelp = (result, usage, description) => {
|
|
341
|
+
expectEqual(result.code, 0, `exit code, with standard error ${JSON.stringify(result.stderr)}`);
|
|
342
|
+
expectEqual(result.stdout, `Usage: ${usage}\n\n${description}\n`, "standard output");
|
|
343
|
+
expectEqual(result.stderr, "", "standard error");
|
|
344
|
+
};
|
|
345
|
+
const commandList = (entries, prefix) => [
|
|
346
|
+
"Commands:",
|
|
347
|
+
...entries.filter((each) => each.kind === "capability" && each.id.startsWith(`${prefix}.`)).map((each) => ` ${String(each.usage)}`),
|
|
348
|
+
""
|
|
349
|
+
].join("\n");
|
|
350
|
+
await checks.run("--help after the path of a command writes the help of the capability", `${RULE}#commands`, async (signal) => {
|
|
351
|
+
const entries = await listed(signal);
|
|
352
|
+
for (const id of [
|
|
353
|
+
"fixture.echo",
|
|
354
|
+
"fixture.raw",
|
|
355
|
+
"fixture.switch.set"
|
|
356
|
+
]) {
|
|
357
|
+
const { usage, description } = entry(entries, id);
|
|
358
|
+
expectHelp(await run(signal, ...id.split("."), "--help"), usage, description);
|
|
359
|
+
}
|
|
360
|
+
const { usage, description } = entry(entries, "fixture.echo");
|
|
361
|
+
expectHelp(await run(signal, "fixture", "echo", "--text", "hello", "--help"), usage, description);
|
|
362
|
+
});
|
|
363
|
+
await checks.run("--help after the name of an alias writes the help of the alias", ALIASES, async (signal) => {
|
|
364
|
+
const entries = await listed(signal);
|
|
365
|
+
for (const [name, id] of [["say", "fixture.echo"], ["ticks", "fixture.ticks"]]) {
|
|
366
|
+
const { aliases, description } = entry(entries, id);
|
|
367
|
+
const usage = aliases.find((each) => each.split(" ")[1] === name);
|
|
368
|
+
expect(usage !== void 0, `list must give the usage of the alias ${name} of ${id}`);
|
|
369
|
+
expectHelp(await run(signal, name, "--help"), usage ?? "", description);
|
|
370
|
+
}
|
|
371
|
+
});
|
|
372
|
+
await checks.run("--help after watch and the id of an event writes the help of the event", `${RULE}#events`, async (signal) => {
|
|
373
|
+
const { usage, description } = entry(await listed(signal), "fixture.ticks");
|
|
374
|
+
expectHelp(await run(signal, "watch", "fixture.ticks", "--help"), usage, description);
|
|
375
|
+
});
|
|
376
|
+
await checks.run("--help after a shared prefix writes its command list to standard output", `${RULE}#commands`, async (signal) => {
|
|
377
|
+
const entries = await listed(signal);
|
|
378
|
+
const result = await run(signal, "fixture", "switch", "--help");
|
|
379
|
+
expectEqual(result.code, 0, `exit code, with standard error ${JSON.stringify(result.stderr)}`);
|
|
380
|
+
expectEqual(result.stdout, commandList(entries, "fixture.switch"), "standard output of fixture switch --help");
|
|
381
|
+
expectEqual(result.stderr, "", "standard error");
|
|
382
|
+
});
|
|
383
|
+
const expectUnknown = async (signal, ...args) => {
|
|
384
|
+
const entries = await listed(signal);
|
|
385
|
+
const result = await run(signal, ...args);
|
|
386
|
+
expectEqual(result.code, 2, "exit code");
|
|
387
|
+
expectEqual(result.stdout, "", "standard output");
|
|
388
|
+
expectEqual(result.stderr, commandList(entries, "fixture.switch"), "standard error");
|
|
389
|
+
};
|
|
390
|
+
await checks.run("a shared prefix alone writes its command list to standard error with exit code 2", `${RULE}#commands`, (signal) => expectUnknown(signal, "fixture", "switch"));
|
|
391
|
+
await checks.run("a shared prefix and a flag that is not --help write its command list to standard error with exit code 2", `${RULE}#commands`, (signal) => expectUnknown(signal, "fixture", "switch", "--on"));
|
|
392
|
+
}
|
|
299
393
|
async function checkAliases(checks, command) {
|
|
300
394
|
const run = (signal, ...args) => start(command, args, signal).run;
|
|
301
395
|
const expectOutput = (result, expected) => {
|
|
@@ -332,6 +426,35 @@ async function checkAliases(checks, command) {
|
|
|
332
426
|
expectEqual(result.code, 0, `exit code, with standard error ${JSON.stringify(result.stderr)}`);
|
|
333
427
|
expect(isArrayOf(memberOf(parseJson(result.stdout), "keys"), (key) => typeof key === "string"), `standard output must have the keys, got ${result.stdout}`);
|
|
334
428
|
});
|
|
429
|
+
await checks.run("a two-word alias calls its capability with the flags", ALIASES, async (signal) => {
|
|
430
|
+
expectOutput(await run(signal, "notes", "add", "--text", "hi"), { text: "hi" });
|
|
431
|
+
});
|
|
432
|
+
await checks.run("the input of a two-word alias is its fixed input with the properties of the flags", ALIASES, async (signal) => {
|
|
433
|
+
expectOutput(await run(signal, "notes", "loud", "--text", "hi"), {
|
|
434
|
+
text: "hi",
|
|
435
|
+
loud: true
|
|
436
|
+
});
|
|
437
|
+
expectOutput(await run(signal, "shout", "hello"), { text: "HELLO" });
|
|
438
|
+
});
|
|
439
|
+
await checks.run("a one-word alias runs when the second argument is not the second word of a two-word alias", ALIASES, async (signal) => {
|
|
440
|
+
expectOutput(await run(signal, "notes"), {});
|
|
441
|
+
expectOutput(await run(signal, "notes", "{\"a\":1}"), { a: 1 });
|
|
442
|
+
});
|
|
443
|
+
await checks.run("an alias that is the default of a shared prefix runs with the prefix alone, and with flags", ALIASES, async (signal) => {
|
|
444
|
+
expectOutput(await run(signal, "fixture"), { mode: "slow" });
|
|
445
|
+
expectOutput(await run(signal, "fixture", "--count", "2"), {
|
|
446
|
+
mode: "slow",
|
|
447
|
+
count: 2
|
|
448
|
+
});
|
|
449
|
+
});
|
|
450
|
+
await checks.run("a command under a shared prefix with a default alias keeps its path", ALIASES, async (signal) => {
|
|
451
|
+
expectOutput(await run(signal, "fixture", "echo", "--text", "hi"), { text: "hi" });
|
|
452
|
+
});
|
|
453
|
+
await checks.run("a two-word alias with --help writes its usage", ALIASES, async (signal) => {
|
|
454
|
+
const result = await run(signal, "notes", "add", "--help");
|
|
455
|
+
expectEqual(result.code, 0, "exit code");
|
|
456
|
+
expect(result.stdout.includes("notes add --text <string> [--loud]"), `standard output must have the usage of the alias, got ${JSON.stringify(result.stdout)}`);
|
|
457
|
+
});
|
|
335
458
|
const ticks = async (signal, ...args) => {
|
|
336
459
|
const result = await run(signal, "ticks", ...args);
|
|
337
460
|
expectEqual(result.code, 0, `exit code, with standard error ${JSON.stringify(result.stderr)}`);
|
package/dist/conform/mcp.js
CHANGED
|
@@ -148,8 +148,16 @@ async function checkTools(checks, mcp) {
|
|
|
148
148
|
const { tools } = await mcp.listTools(void 0, { signal });
|
|
149
149
|
const echo = tools.find((tool) => tool.name === "fixture.echo");
|
|
150
150
|
const refuse = tools.find((tool) => tool.name === "fixture.refuse");
|
|
151
|
+
const switchSet = tools.find((tool) => tool.name === "fixture.switch.set");
|
|
151
152
|
expect(echo?.annotations?.readOnlyHint === true, "fixture.echo must have readOnlyHint: true");
|
|
152
153
|
expect(refuse?.annotations?.readOnlyHint !== true, "fixture.refuse must not have readOnlyHint: true");
|
|
154
|
+
const signalTool = tools.find((tool) => tool.name === "fixture.signal");
|
|
155
|
+
expect(switchSet?.annotations?.destructiveHint === true, "fixture.switch.set must have destructiveHint: true");
|
|
156
|
+
expect(switchSet?.annotations?.idempotentHint === true, "fixture.switch.set must have idempotentHint: true");
|
|
157
|
+
expect(signalTool?.annotations?.destructiveHint === false, "fixture.signal must have destructiveHint: false");
|
|
158
|
+
expect(signalTool?.annotations?.idempotentHint === false, "fixture.signal must have idempotentHint: false");
|
|
159
|
+
expect(refuse?.annotations?.destructiveHint !== false, "fixture.refuse has no destructive member, so it must have no destructiveHint or the MCP default true");
|
|
160
|
+
expect(refuse?.annotations?.idempotentHint !== true, "fixture.refuse has no idempotent member, so it must have no idempotentHint or the MCP default false");
|
|
153
161
|
expect(echo?.outputSchema?.type === "object", "fixture.echo must have an object outputSchema");
|
|
154
162
|
expect(refuse?.outputSchema === void 0, "fixture.refuse has no object output, so it must have no outputSchema");
|
|
155
163
|
expect(echo?.inputSchema.type === "object", "an inputSchema must be an object");
|
|
@@ -83,13 +83,13 @@ var catalog_schema_default = {
|
|
|
83
83
|
"properties": {
|
|
84
84
|
"aliases": {
|
|
85
85
|
"type": "object",
|
|
86
|
-
"propertyNames": { "pattern": "^(--)
|
|
86
|
+
"propertyNames": { "pattern": "^(--[a-z][a-z0-9]*(-[a-z0-9]+)*|[a-z][a-z0-9]*(-[a-z0-9]+)*( [a-z][a-z0-9]*(-[a-z0-9]+)*)?)$" },
|
|
87
87
|
"additionalProperties": { "$ref": "#/$defs/cliAlias" }
|
|
88
88
|
},
|
|
89
89
|
"default": {
|
|
90
90
|
"description": "The name of the default alias: a command alias that runs when the command line gets no command.",
|
|
91
91
|
"type": "string",
|
|
92
|
-
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)
|
|
92
|
+
"pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*( [a-z][a-z0-9]*(-[a-z0-9]+)*)?$"
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
},
|
|
@@ -142,6 +142,8 @@ var catalog_schema_default = {
|
|
|
142
142
|
"additionalProperties": { "$ref": "#/$defs/schema" }
|
|
143
143
|
},
|
|
144
144
|
"readOnly": { "type": "boolean" },
|
|
145
|
+
"destructive": { "type": "boolean" },
|
|
146
|
+
"idempotent": { "type": "boolean" },
|
|
145
147
|
"state": { "$ref": "#/$defs/schema" }
|
|
146
148
|
}
|
|
147
149
|
},
|
|
@@ -20,13 +20,27 @@ var fixture_acidcat_default = {
|
|
|
20
20
|
"capability": "fixture.note",
|
|
21
21
|
"input": { "text": "fixed" }
|
|
22
22
|
},
|
|
23
|
+
"fixture": {
|
|
24
|
+
"capability": "fixture.flags",
|
|
25
|
+
"input": { "mode": "slow" }
|
|
26
|
+
},
|
|
23
27
|
"held-keys": { "capability": "fixture.held" },
|
|
28
|
+
"notes": { "capability": "fixture.raw" },
|
|
29
|
+
"notes add": { "capability": "fixture.note" },
|
|
30
|
+
"notes loud": {
|
|
31
|
+
"capability": "fixture.note",
|
|
32
|
+
"input": { "loud": true }
|
|
33
|
+
},
|
|
24
34
|
"quick": {
|
|
25
35
|
"capability": "fixture.flags",
|
|
26
36
|
"input": { "mode": "fast" }
|
|
27
37
|
},
|
|
28
38
|
"raw": { "capability": "fixture.raw" },
|
|
29
39
|
"say": { "capability": "fixture.echo" },
|
|
40
|
+
"shout hello": {
|
|
41
|
+
"capability": "fixture.echo",
|
|
42
|
+
"input": { "text": "HELLO" }
|
|
43
|
+
},
|
|
30
44
|
"ticks": {
|
|
31
45
|
"event": "fixture.ticks",
|
|
32
46
|
"input": { "count": 2 }
|
|
@@ -238,7 +252,9 @@ var fixture_acidcat_default = {
|
|
|
238
252
|
"properties": { "delivered": { "type": "integer" } },
|
|
239
253
|
"required": ["delivered"],
|
|
240
254
|
"type": "object"
|
|
241
|
-
}
|
|
255
|
+
},
|
|
256
|
+
"destructive": false,
|
|
257
|
+
"idempotent": false
|
|
242
258
|
},
|
|
243
259
|
"fixture.switch.set": {
|
|
244
260
|
"description": "Turn the switch on or off. The switch controls the availability of fixture.toggle.",
|
|
@@ -252,7 +268,9 @@ var fixture_acidcat_default = {
|
|
|
252
268
|
"properties": { "on": { "type": "boolean" } },
|
|
253
269
|
"required": ["on"],
|
|
254
270
|
"type": "object"
|
|
255
|
-
}
|
|
271
|
+
},
|
|
272
|
+
"destructive": true,
|
|
273
|
+
"idempotent": true
|
|
256
274
|
},
|
|
257
275
|
"fixture.toggle": {
|
|
258
276
|
"description": "Available only while the switch is on.",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acid-cat/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "The AcidCat command line: check, format and view catalogs, and test implementations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"acidcat",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@acid-cat/catalog": "0.
|
|
41
|
-
"@acid-cat/spec-ts": "0.
|
|
40
|
+
"@acid-cat/catalog": "0.14.0",
|
|
41
|
+
"@acid-cat/spec-ts": "0.14.0",
|
|
42
42
|
"@effect/platform-node": "^4.1.3",
|
|
43
43
|
"@effect/platform-node-shared": "^4.1.3",
|
|
44
44
|
"@modelcontextprotocol/client": "2.4.0",
|