@acid-cat/cli 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +55 -2
- package/conformance/fixture.acidcat.json +152 -0
- package/dist/catalog.d.ts +11 -0
- package/dist/chunks/chunk-VZ6KDZEL.js +1018 -0
- package/dist/conform/check.d.ts +28 -0
- package/dist/conform/cli.d.ts +2 -0
- package/dist/conform/http.d.ts +5 -0
- package/dist/conform/index.d.ts +29 -0
- package/dist/conform/mcp.d.ts +11 -0
- package/dist/conform/properties.d.ts +14 -0
- package/dist/conform/serve.d.ts +10 -0
- package/dist/conform/webmcp.d.ts +51 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +16 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +191 -0
- package/package.json +57 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hebilicious
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @acid-cat/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The AcidCat command line. npm package: `@acid-cat/cli`. It gives the `acid-cat` command. Use it at build time, in CI or by hand, to check catalogs and to test implementations. Do not use it in an application at run time.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
acid-cat check [--strict] <catalog.json ...> # check catalogs
|
|
7
|
+
acid-cat format [--write] <catalog.json ...> # write catalogs in canonical form
|
|
8
|
+
acid-cat view <catalog.json> <target> # write the view of one target
|
|
9
|
+
acid-cat conform --mcp <url> --http <url> --cli "<command>" --webmcp <url> # test an implementation
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Install it as a development dependency, and run it with `pnpm exec acid-cat …`:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pnpm add -D @acid-cat/cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
It needs Node.js 24 or later. `acid-cat conform --webmcp <url>` also needs [Playwright](https://playwright.dev) and Chromium.
|
|
19
|
+
|
|
20
|
+
## check
|
|
21
|
+
|
|
22
|
+
`check` tests a catalog against [`schemas/catalog.schema.json`](../../schemas/catalog.schema.json) and against the [catalog rules](../../spec/conformance.md#catalog) that the schema cannot express.
|
|
23
|
+
|
|
24
|
+
- An **error** is a broken rule. Example: an audience that names an unknown target.
|
|
25
|
+
- 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.
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
## format
|
|
30
|
+
|
|
31
|
+
`format` writes a catalog in canonical form. Use it for catalogs that a catalog library did not write: Pkl output, generated files, or files that you edit by hand.
|
|
32
|
+
|
|
33
|
+
## conform
|
|
34
|
+
|
|
35
|
+
`conform` tests a running implementation of the [conformance fixture](conformance/fixture.pkl) through its bindings (see [Conformance](../../spec/conformance.md#acid-cat-conform)):
|
|
36
|
+
|
|
37
|
+
- **MCP:** the official MCP client, with revision `2026-07-28`, for tools and outcomes; raw requests for rejections.
|
|
38
|
+
- **HTTP** and **CLI:** each outcome, each kind of call failure, availability, and rejections. For the CLI, an interrupt (`SIGINT`) during a call gives exit code 130.
|
|
39
|
+
- **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.
|
|
40
|
+
- **Properties:** with fast-check, through each remote binding: concurrent calls each get exactly their own outcome, and a cancellation changes only its own call.
|
|
41
|
+
|
|
42
|
+
The exit code is 1 if a check fails. Both AcidCat cores run `conform` in their tests. In code, use `conform()` and `serve()` from `@acid-cat/cli`. `createTestHost()` gives the WebMCP host of the checks.
|
|
43
|
+
|
|
44
|
+
## Implementation
|
|
45
|
+
|
|
46
|
+
The command line is an [Effect](https://effect.website) program that uses `effect/cli`. It validates catalogs with Effect Schema. It imports `schemas/catalog.schema.json` and each schema in the catalog as Effect schemas.
|
|
47
|
+
|
|
48
|
+
| File | Contents |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `src/catalog.ts` | The catalog rules, views and bundling |
|
|
51
|
+
| `src/main.ts` | The commands |
|
|
52
|
+
| `src/conform/` | The conformance checks, and `serve`, which serves web handlers on a local port |
|
|
53
|
+
| `conformance/` | The conformance fixture, in Pkl and in JSON |
|
|
54
|
+
| `test/` | Tests. Run them with `moon run cli:test` |
|
|
55
|
+
|
|
56
|
+
The canonical writer comes from [`@acid-cat/catalog`](../catalog/typescript).
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"acidcat": "0.1",
|
|
3
|
+
"title": "AcidCat conformance fixture",
|
|
4
|
+
"targets": {
|
|
5
|
+
"api": {
|
|
6
|
+
"bindings": [
|
|
7
|
+
"http"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"app": {
|
|
11
|
+
"bindings": [
|
|
12
|
+
"typescript",
|
|
13
|
+
"webmcp"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"cli": {
|
|
17
|
+
"bindings": [
|
|
18
|
+
"cli"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"mcp": {
|
|
22
|
+
"bindings": [
|
|
23
|
+
"mcp"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"capabilities": {
|
|
28
|
+
"fixture.crash": {
|
|
29
|
+
"description": "Always fail with a defect.",
|
|
30
|
+
"audience": [
|
|
31
|
+
"app",
|
|
32
|
+
"mcp",
|
|
33
|
+
"cli",
|
|
34
|
+
"api"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"fixture.echo": {
|
|
38
|
+
"description": "Return the input text.",
|
|
39
|
+
"audience": [
|
|
40
|
+
"app",
|
|
41
|
+
"mcp",
|
|
42
|
+
"cli",
|
|
43
|
+
"api"
|
|
44
|
+
],
|
|
45
|
+
"input": {
|
|
46
|
+
"properties": {
|
|
47
|
+
"text": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"required": [
|
|
52
|
+
"text"
|
|
53
|
+
],
|
|
54
|
+
"type": "object"
|
|
55
|
+
},
|
|
56
|
+
"output": {
|
|
57
|
+
"properties": {
|
|
58
|
+
"text": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"required": [
|
|
63
|
+
"text"
|
|
64
|
+
],
|
|
65
|
+
"type": "object"
|
|
66
|
+
},
|
|
67
|
+
"readOnly": true
|
|
68
|
+
},
|
|
69
|
+
"fixture.hidden": {
|
|
70
|
+
"description": "Only the app target can use this capability.",
|
|
71
|
+
"audience": [
|
|
72
|
+
"app"
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"fixture.refuse": {
|
|
76
|
+
"description": "Always return the failure Refused.",
|
|
77
|
+
"audience": [
|
|
78
|
+
"app",
|
|
79
|
+
"mcp",
|
|
80
|
+
"cli",
|
|
81
|
+
"api"
|
|
82
|
+
],
|
|
83
|
+
"failures": {
|
|
84
|
+
"Refused": {
|
|
85
|
+
"properties": {
|
|
86
|
+
"_tag": {
|
|
87
|
+
"const": "Refused",
|
|
88
|
+
"type": "string"
|
|
89
|
+
},
|
|
90
|
+
"reason": {
|
|
91
|
+
"type": "string"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"required": [
|
|
95
|
+
"_tag",
|
|
96
|
+
"reason"
|
|
97
|
+
],
|
|
98
|
+
"type": "object"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"fixture.slow": {
|
|
103
|
+
"description": "Wait for some milliseconds, then return null.",
|
|
104
|
+
"audience": [
|
|
105
|
+
"app",
|
|
106
|
+
"mcp",
|
|
107
|
+
"cli",
|
|
108
|
+
"api"
|
|
109
|
+
],
|
|
110
|
+
"input": {
|
|
111
|
+
"properties": {
|
|
112
|
+
"milliseconds": {
|
|
113
|
+
"type": "number"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"required": [
|
|
117
|
+
"milliseconds"
|
|
118
|
+
],
|
|
119
|
+
"type": "object"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"fixture.switch.set": {
|
|
123
|
+
"description": "Turn the switch on or off. The switch controls the availability of fixture.toggle.",
|
|
124
|
+
"audience": [
|
|
125
|
+
"app",
|
|
126
|
+
"mcp",
|
|
127
|
+
"cli",
|
|
128
|
+
"api"
|
|
129
|
+
],
|
|
130
|
+
"input": {
|
|
131
|
+
"properties": {
|
|
132
|
+
"on": {
|
|
133
|
+
"type": "boolean"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"required": [
|
|
137
|
+
"on"
|
|
138
|
+
],
|
|
139
|
+
"type": "object"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"fixture.toggle": {
|
|
143
|
+
"description": "Available only while the switch is on.",
|
|
144
|
+
"audience": [
|
|
145
|
+
"app",
|
|
146
|
+
"mcp",
|
|
147
|
+
"cli",
|
|
148
|
+
"api"
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { bundle, viewOf } from "@acid-cat/spec-ts";
|
|
2
|
+
import type { CatalogDocument as Catalog } from "@acid-cat/spec-ts";
|
|
3
|
+
export { bundle, viewOf };
|
|
4
|
+
export type { Catalog };
|
|
5
|
+
/** The result of a check. An error breaks a rule. A warning breaks a recommendation. */
|
|
6
|
+
export interface Report {
|
|
7
|
+
readonly errors: readonly string[];
|
|
8
|
+
readonly warnings: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/** Check a catalog. When `text` is given, the file must also be in canonical form. */
|
|
11
|
+
export declare function check(document: unknown, text?: string): Report;
|