@acid-cat/cli 0.2.0 → 0.3.1

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.
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "acidcat": "0.1",
3
3
  "title": "AcidCat conformance fixture",
4
+ "description": "One capability for each behavior that acid-cat conform tests.",
4
5
  "targets": {
5
6
  "api": {
6
7
  "bindings": [
@@ -66,6 +67,72 @@
66
67
  },
67
68
  "readOnly": true
68
69
  },
70
+ "fixture.flags": {
71
+ "description": "Return the input. The input has one property for each kind of command-line flag.",
72
+ "audience": [
73
+ "cli"
74
+ ],
75
+ "input": {
76
+ "properties": {
77
+ "count": {
78
+ "type": "integer"
79
+ },
80
+ "extra": {
81
+ "type": "object"
82
+ },
83
+ "label": {
84
+ "type": "string"
85
+ },
86
+ "mode": {
87
+ "enum": [
88
+ "fast",
89
+ "slow"
90
+ ],
91
+ "type": "string"
92
+ },
93
+ "ratio": {
94
+ "type": "number"
95
+ },
96
+ "verbose": {
97
+ "type": "boolean"
98
+ }
99
+ },
100
+ "required": [
101
+ "mode"
102
+ ],
103
+ "type": "object"
104
+ },
105
+ "output": {
106
+ "properties": {
107
+ "count": {
108
+ "type": "integer"
109
+ },
110
+ "extra": {
111
+ "type": "object"
112
+ },
113
+ "label": {
114
+ "type": "string"
115
+ },
116
+ "mode": {
117
+ "enum": [
118
+ "fast",
119
+ "slow"
120
+ ],
121
+ "type": "string"
122
+ },
123
+ "ratio": {
124
+ "type": "number"
125
+ },
126
+ "verbose": {
127
+ "type": "boolean"
128
+ }
129
+ },
130
+ "required": [
131
+ "mode"
132
+ ],
133
+ "type": "object"
134
+ }
135
+ },
69
136
  "fixture.hidden": {
70
137
  "description": "Only the app target can use this capability.",
71
138
  "audience": [
@@ -146,7 +213,11 @@
146
213
  "mcp",
147
214
  "cli",
148
215
  "api"
149
- ]
216
+ ],
217
+ "input": {
218
+ "properties": {},
219
+ "type": "object"
220
+ }
150
221
  }
151
222
  }
152
223
  }
@@ -3,6 +3,16 @@ import { spawn } from "node:child_process";
3
3
  //#region src/conform/cli.ts
4
4
  /** Conformance checks for the CLI binding (spec/bindings/cli.md). Each check runs the command line as a process. */
5
5
  const RULE = "spec/bindings/cli.md";
6
+ /** The `usage` of each capability in the view of the fixture, after the name of the program. */
7
+ const USAGES = {
8
+ "fixture.crash": "fixture crash",
9
+ "fixture.echo": "fixture echo --text <string>",
10
+ "fixture.flags": "fixture flags --mode <fast|slow> [--count <integer>] [--extra <json>] [--label <string>] [--ratio <number>] [--verbose]",
11
+ "fixture.refuse": "fixture refuse",
12
+ "fixture.slow": "fixture slow --milliseconds <number>",
13
+ "fixture.switch.set": "fixture switch set --on",
14
+ "fixture.toggle": "fixture toggle"
15
+ };
6
16
  /** The time that a command line has to start before the interrupt, in milliseconds. */
7
17
  const INTERRUPT_AFTER = 2e3;
8
18
  /** Run the command line. If `interruptAfter` is given, send `SIGINT` after that many milliseconds. */
@@ -106,6 +116,15 @@ async function checkCli(command) {
106
116
  const result = await cli("list");
107
117
  expectEqual(sorted(JSON.parse(result.stdout).map((entry) => entry.id)), idsOf("cli"), "ids");
108
118
  });
119
+ await checks.run("list gives the usage of each capability, with its flags", `${RULE}#commands`, async () => {
120
+ const entries = JSON.parse((await cli("list")).stdout);
121
+ for (const { id, usage } of entries) {
122
+ expect(typeof usage === "string", `${id} must have a usage`);
123
+ const [program, ...rest] = usage.split(" ");
124
+ expect(program !== "" && rest.length > 0, `the usage of ${id} must start with the name of the program, got ${JSON.stringify(usage)}`);
125
+ expectEqual(rest.join(" "), USAGES[id], `usage of ${id} after the name of the program`);
126
+ }
127
+ });
109
128
  return checks;
110
129
  }
111
130
  //#endregion
@@ -1,4 +1,4 @@
1
- import { Checks, FORBIDDEN_ORIGIN, expect, expectEqual, idsOf, sorted } from "./check.js";
1
+ import { Checks, FORBIDDEN_ORIGIN, expect, expectEqual, fixture, idsOf, sorted } from "./check.js";
2
2
  import { Client, StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
3
3
  //#region src/conform/mcp.ts
4
4
  /**
@@ -28,6 +28,9 @@ async function checkMcp(url, options) {
28
28
  name,
29
29
  arguments: args
30
30
  });
31
+ await checks.run("server/discover gives the description of the catalog as instructions", `${RULE}#server`, () => {
32
+ expectEqual(mcp.getInstructions(), fixture.description, "instructions");
33
+ });
31
34
  await checks.run("tools/list gives each available capability of the view", `${RULE}#tools`, async () => {
32
35
  const { tools } = await mcp.listTools();
33
36
  expectEqual(sorted(tools.map((tool) => tool.name)), idsOf("mcp"), "tools");
@@ -2,6 +2,7 @@
2
2
  var fixture_acidcat_default = {
3
3
  acidcat: "0.1",
4
4
  title: "AcidCat conformance fixture",
5
+ description: "One capability for each behavior that acid-cat conform tests.",
5
6
  targets: {
6
7
  "api": { "bindings": ["http"] },
7
8
  "app": { "bindings": ["typescript", "webmcp"] },
@@ -38,6 +39,40 @@ var fixture_acidcat_default = {
38
39
  },
39
40
  "readOnly": true
40
41
  },
42
+ "fixture.flags": {
43
+ "description": "Return the input. The input has one property for each kind of command-line flag.",
44
+ "audience": ["cli"],
45
+ "input": {
46
+ "properties": {
47
+ "count": { "type": "integer" },
48
+ "extra": { "type": "object" },
49
+ "label": { "type": "string" },
50
+ "mode": {
51
+ "enum": ["fast", "slow"],
52
+ "type": "string"
53
+ },
54
+ "ratio": { "type": "number" },
55
+ "verbose": { "type": "boolean" }
56
+ },
57
+ "required": ["mode"],
58
+ "type": "object"
59
+ },
60
+ "output": {
61
+ "properties": {
62
+ "count": { "type": "integer" },
63
+ "extra": { "type": "object" },
64
+ "label": { "type": "string" },
65
+ "mode": {
66
+ "enum": ["fast", "slow"],
67
+ "type": "string"
68
+ },
69
+ "ratio": { "type": "number" },
70
+ "verbose": { "type": "boolean" }
71
+ },
72
+ "required": ["mode"],
73
+ "type": "object"
74
+ }
75
+ },
41
76
  "fixture.hidden": {
42
77
  "description": "Only the app target can use this capability.",
43
78
  "audience": ["app"]
@@ -97,7 +132,11 @@ var fixture_acidcat_default = {
97
132
  "mcp",
98
133
  "cli",
99
134
  "api"
100
- ]
135
+ ],
136
+ "input": {
137
+ "properties": {},
138
+ "type": "object"
139
+ }
101
140
  }
102
141
  }
103
142
  };
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.2.0";
2
+ var version = "0.3.1";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acid-cat/cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
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.2.0",
41
- "@acid-cat/spec-ts": "0.2.0",
40
+ "@acid-cat/catalog": "0.3.1",
41
+ "@acid-cat/spec-ts": "0.3.1",
42
42
  "@effect/platform-node": "4.0.4",
43
43
  "@effect/platform-node-shared": "4.0.4",
44
44
  "@modelcontextprotocol/client": "2.3.1",