@cairn-tool/cli-schema 1.0.0 → 1.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/dist/cli-schema.json +282 -53
- package/dist/generated/types.d.ts +118 -0
- package/dist/generated/types.js +2 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/types.d.ts +20 -102
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/cli-schema.json
CHANGED
|
@@ -6,56 +6,98 @@
|
|
|
6
6
|
"type": "object",
|
|
7
7
|
"required": ["schemaVersion", "tool", "formatShorthands", "schemas", "commands"],
|
|
8
8
|
"properties": {
|
|
9
|
-
"schemaVersion": {
|
|
9
|
+
"schemaVersion": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
10
12
|
"tool": {
|
|
13
|
+
"title": "ToolInfo",
|
|
11
14
|
"type": "object",
|
|
12
15
|
"required": ["name", "version"],
|
|
13
16
|
"properties": {
|
|
14
|
-
"name": {
|
|
15
|
-
|
|
17
|
+
"name": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"version": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
16
23
|
}
|
|
17
24
|
},
|
|
18
25
|
"formatShorthands": {
|
|
19
26
|
"type": "object",
|
|
20
|
-
"additionalProperties": {
|
|
27
|
+
"additionalProperties": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
21
30
|
"description": "argv token to the --format value it expands to before parsing."
|
|
22
31
|
},
|
|
23
32
|
"advisoryOutput": {
|
|
33
|
+
"title": "AdvisoryOutput",
|
|
24
34
|
"type": "object",
|
|
25
35
|
"description": "Machine-stream guarantees for an advisory notice. Omitted when the tool has none.",
|
|
26
36
|
"required": ["description", "stream", "suppressedWhen", "optOutEnv"],
|
|
27
37
|
"properties": {
|
|
28
|
-
"description": {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
38
|
+
"description": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"stream": {
|
|
42
|
+
"enum": ["stdout", "stderr"]
|
|
43
|
+
},
|
|
44
|
+
"suppressedWhen": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "string"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"optOutEnv": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
}
|
|
32
53
|
}
|
|
33
54
|
},
|
|
34
55
|
"schemas": {
|
|
35
56
|
"type": "array",
|
|
36
57
|
"items": {
|
|
58
|
+
"title": "SchemaRef",
|
|
37
59
|
"type": "object",
|
|
38
60
|
"required": ["id", "uri", "title", "commands"],
|
|
39
61
|
"properties": {
|
|
40
|
-
"id": {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
62
|
+
"id": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"uri": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
},
|
|
68
|
+
"title": {
|
|
69
|
+
"type": "string"
|
|
70
|
+
},
|
|
71
|
+
"commands": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"items": {
|
|
74
|
+
"type": "string"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
44
77
|
}
|
|
45
78
|
}
|
|
46
79
|
},
|
|
47
80
|
"commands": {
|
|
48
81
|
"type": "array",
|
|
49
|
-
"items": {
|
|
82
|
+
"items": {
|
|
83
|
+
"$ref": "#/$defs/command"
|
|
84
|
+
}
|
|
50
85
|
}
|
|
51
86
|
},
|
|
52
87
|
"$defs": {
|
|
53
88
|
"arity": {
|
|
89
|
+
"title": "Arity",
|
|
54
90
|
"type": "object",
|
|
55
91
|
"required": ["min", "max"],
|
|
56
92
|
"properties": {
|
|
57
|
-
"min": {
|
|
58
|
-
|
|
93
|
+
"min": {
|
|
94
|
+
"type": "integer",
|
|
95
|
+
"minimum": 0
|
|
96
|
+
},
|
|
97
|
+
"max": {
|
|
98
|
+
"type": ["integer", "null"],
|
|
99
|
+
"minimum": 0
|
|
100
|
+
}
|
|
59
101
|
}
|
|
60
102
|
},
|
|
61
103
|
"valueType": {
|
|
@@ -63,6 +105,7 @@
|
|
|
63
105
|
"enum": ["boolean", "string", "integer", "number", null]
|
|
64
106
|
},
|
|
65
107
|
"command": {
|
|
108
|
+
"title": "DescribedCommand",
|
|
66
109
|
"type": "object",
|
|
67
110
|
"required": [
|
|
68
111
|
"id",
|
|
@@ -86,73 +129,236 @@
|
|
|
86
129
|
"type": "string",
|
|
87
130
|
"description": "Space-joined command path, e.g. 'md graph'."
|
|
88
131
|
},
|
|
89
|
-
"path": {
|
|
90
|
-
|
|
91
|
-
|
|
132
|
+
"path": {
|
|
133
|
+
"type": "array",
|
|
134
|
+
"items": {
|
|
135
|
+
"type": "string"
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"description": {
|
|
139
|
+
"type": "string"
|
|
140
|
+
},
|
|
141
|
+
"usage": {
|
|
142
|
+
"type": "string"
|
|
143
|
+
},
|
|
92
144
|
"arguments": {
|
|
93
145
|
"type": "array",
|
|
94
|
-
"items": {
|
|
146
|
+
"items": {
|
|
147
|
+
"$ref": "#/$defs/argument"
|
|
148
|
+
}
|
|
95
149
|
},
|
|
96
150
|
"options": {
|
|
97
151
|
"type": "array",
|
|
98
|
-
"items": {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
152
|
+
"items": {
|
|
153
|
+
"$ref": "#/$defs/option"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"subcommands": {
|
|
157
|
+
"type": "array",
|
|
158
|
+
"items": {
|
|
159
|
+
"type": "string"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"formats": {
|
|
163
|
+
"type": ["array", "null"],
|
|
164
|
+
"items": {
|
|
165
|
+
"type": "string"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"defaultFormat": {
|
|
169
|
+
"type": ["string", "null"]
|
|
170
|
+
},
|
|
171
|
+
"formatConfigurable": {
|
|
172
|
+
"type": "boolean"
|
|
173
|
+
},
|
|
174
|
+
"outputSchema": {
|
|
175
|
+
"type": ["string", "null"]
|
|
176
|
+
},
|
|
177
|
+
"jsonlSchema": {
|
|
178
|
+
"type": ["string", "null"]
|
|
179
|
+
},
|
|
180
|
+
"sarifSchema": {
|
|
181
|
+
"type": ["string", "null"]
|
|
182
|
+
},
|
|
107
183
|
"exitCodes": {
|
|
108
184
|
"type": "array",
|
|
109
185
|
"items": {
|
|
186
|
+
"title": "ExitCodeMeaning",
|
|
110
187
|
"type": "object",
|
|
111
188
|
"required": ["code", "meaning"],
|
|
112
189
|
"properties": {
|
|
113
|
-
"code": {
|
|
114
|
-
|
|
190
|
+
"code": {
|
|
191
|
+
"type": "integer"
|
|
192
|
+
},
|
|
193
|
+
"meaning": {
|
|
194
|
+
"type": "string"
|
|
195
|
+
}
|
|
115
196
|
}
|
|
116
197
|
}
|
|
117
198
|
},
|
|
118
199
|
"exitCodePassthrough": {
|
|
200
|
+
"title": "ExitCodePassthrough",
|
|
119
201
|
"type": "object",
|
|
120
202
|
"description": "Present only when the command forwards a child process's exit status verbatim.",
|
|
121
203
|
"required": ["min", "max", "description"],
|
|
122
204
|
"properties": {
|
|
123
|
-
"min": {
|
|
124
|
-
|
|
125
|
-
|
|
205
|
+
"min": {
|
|
206
|
+
"type": "integer"
|
|
207
|
+
},
|
|
208
|
+
"max": {
|
|
209
|
+
"type": "integer"
|
|
210
|
+
},
|
|
211
|
+
"description": {
|
|
212
|
+
"type": "string"
|
|
213
|
+
}
|
|
126
214
|
}
|
|
127
215
|
},
|
|
128
216
|
"stream": {
|
|
217
|
+
"title": "CommandStream",
|
|
129
218
|
"type": ["object", "null"],
|
|
219
|
+
"required": ["success"],
|
|
130
220
|
"properties": {
|
|
131
|
-
"success": {
|
|
132
|
-
|
|
221
|
+
"success": {
|
|
222
|
+
"enum": ["stdout", "stderr"]
|
|
223
|
+
},
|
|
224
|
+
"findings": {
|
|
225
|
+
"enum": ["stdout", "stderr"]
|
|
226
|
+
}
|
|
133
227
|
}
|
|
134
228
|
},
|
|
135
|
-
"writes": {
|
|
136
|
-
|
|
137
|
-
|
|
229
|
+
"writes": {
|
|
230
|
+
"type": ["boolean", "null"]
|
|
231
|
+
},
|
|
232
|
+
"stability": {
|
|
233
|
+
"enum": ["stable", "experimental", "undeclared"]
|
|
234
|
+
},
|
|
235
|
+
"notes": {
|
|
236
|
+
"type": "string"
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"commandContract": {
|
|
241
|
+
"title": "CommandContract",
|
|
242
|
+
"type": "object",
|
|
243
|
+
"description": "What a host declares about one command: the facts a CLI framework cannot know. A framework supplies the command tree, the options and their arity; everything here has to be stated. An emitter merges this with what it walked to produce a `command`. A command with no contract is emitted with `stability: \"undeclared\"` rather than rejected, so a missing row is a visible gap and not a crash.",
|
|
244
|
+
"required": [
|
|
245
|
+
"formats",
|
|
246
|
+
"defaultFormat",
|
|
247
|
+
"formatConfigurable",
|
|
248
|
+
"outputSchema",
|
|
249
|
+
"exitCodes",
|
|
250
|
+
"stream",
|
|
251
|
+
"writes",
|
|
252
|
+
"stability"
|
|
253
|
+
],
|
|
254
|
+
"properties": {
|
|
255
|
+
"formats": {
|
|
256
|
+
"type": ["array", "null"],
|
|
257
|
+
"items": {
|
|
258
|
+
"type": "string"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
"defaultFormat": {
|
|
262
|
+
"type": ["string", "null"]
|
|
263
|
+
},
|
|
264
|
+
"formatConfigurable": {
|
|
265
|
+
"type": "boolean"
|
|
266
|
+
},
|
|
267
|
+
"outputSchema": {
|
|
268
|
+
"type": ["string", "null"]
|
|
269
|
+
},
|
|
270
|
+
"jsonlSchema": {
|
|
271
|
+
"type": ["string", "null"]
|
|
272
|
+
},
|
|
273
|
+
"sarifSchema": {
|
|
274
|
+
"type": ["string", "null"]
|
|
275
|
+
},
|
|
276
|
+
"exitCodes": {
|
|
277
|
+
"type": "array",
|
|
278
|
+
"items": {
|
|
279
|
+
"title": "ExitCodeMeaning",
|
|
280
|
+
"type": "object",
|
|
281
|
+
"required": ["code", "meaning"],
|
|
282
|
+
"properties": {
|
|
283
|
+
"code": {
|
|
284
|
+
"type": "integer"
|
|
285
|
+
},
|
|
286
|
+
"meaning": {
|
|
287
|
+
"type": "string"
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
"exitCodePassthrough": {
|
|
293
|
+
"title": "ExitCodePassthrough",
|
|
294
|
+
"type": "object",
|
|
295
|
+
"description": "Present only when the command forwards a child process's exit status verbatim.",
|
|
296
|
+
"required": ["min", "max", "description"],
|
|
297
|
+
"properties": {
|
|
298
|
+
"min": {
|
|
299
|
+
"type": "integer"
|
|
300
|
+
},
|
|
301
|
+
"max": {
|
|
302
|
+
"type": "integer"
|
|
303
|
+
},
|
|
304
|
+
"description": {
|
|
305
|
+
"type": "string"
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
"stream": {
|
|
310
|
+
"title": "CommandStream",
|
|
311
|
+
"type": ["object", "null"],
|
|
312
|
+
"required": ["success"],
|
|
313
|
+
"properties": {
|
|
314
|
+
"success": {
|
|
315
|
+
"enum": ["stdout", "stderr"]
|
|
316
|
+
},
|
|
317
|
+
"findings": {
|
|
318
|
+
"enum": ["stdout", "stderr"]
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"writes": {
|
|
323
|
+
"type": ["boolean", "null"]
|
|
324
|
+
},
|
|
325
|
+
"stability": {
|
|
326
|
+
"enum": ["stable", "experimental"],
|
|
327
|
+
"description": "Deliberately narrower than a command's. `undeclared` is what an emitter assigns to a command with no contract, so it is never a value a host declares."
|
|
328
|
+
},
|
|
329
|
+
"notes": {
|
|
330
|
+
"type": "string"
|
|
331
|
+
}
|
|
138
332
|
}
|
|
139
333
|
},
|
|
140
334
|
"argument": {
|
|
335
|
+
"title": "DescribedArgument",
|
|
141
336
|
"type": "object",
|
|
142
337
|
"required": ["name", "description", "arity", "valueType", "allowedValues"],
|
|
143
338
|
"properties": {
|
|
144
|
-
"name": {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"
|
|
339
|
+
"name": {
|
|
340
|
+
"type": "string"
|
|
341
|
+
},
|
|
342
|
+
"description": {
|
|
343
|
+
"type": "string"
|
|
344
|
+
},
|
|
345
|
+
"arity": {
|
|
346
|
+
"$ref": "#/$defs/arity"
|
|
347
|
+
},
|
|
348
|
+
"valueType": {
|
|
349
|
+
"$ref": "#/$defs/valueType"
|
|
350
|
+
},
|
|
148
351
|
"allowedValues": {
|
|
149
352
|
"type": ["array", "null"],
|
|
150
|
-
"items": {
|
|
353
|
+
"items": {
|
|
354
|
+
"type": "string"
|
|
355
|
+
}
|
|
151
356
|
},
|
|
152
357
|
"default": true
|
|
153
358
|
}
|
|
154
359
|
},
|
|
155
360
|
"option": {
|
|
361
|
+
"title": "DescribedOption",
|
|
156
362
|
"type": "object",
|
|
157
363
|
"required": [
|
|
158
364
|
"name",
|
|
@@ -167,19 +373,42 @@
|
|
|
167
373
|
"recursive"
|
|
168
374
|
],
|
|
169
375
|
"properties": {
|
|
170
|
-
"name": {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
376
|
+
"name": {
|
|
377
|
+
"type": "string"
|
|
378
|
+
},
|
|
379
|
+
"aliases": {
|
|
380
|
+
"type": "array",
|
|
381
|
+
"items": {
|
|
382
|
+
"type": "string"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
"description": {
|
|
386
|
+
"type": "string"
|
|
387
|
+
},
|
|
388
|
+
"valueName": {
|
|
389
|
+
"type": ["string", "null"]
|
|
390
|
+
},
|
|
391
|
+
"arity": {
|
|
392
|
+
"$ref": "#/$defs/arity"
|
|
393
|
+
},
|
|
394
|
+
"required": {
|
|
395
|
+
"type": "boolean"
|
|
396
|
+
},
|
|
397
|
+
"negatable": {
|
|
398
|
+
"type": "boolean"
|
|
399
|
+
},
|
|
400
|
+
"valueType": {
|
|
401
|
+
"$ref": "#/$defs/valueType"
|
|
402
|
+
},
|
|
178
403
|
"allowedValues": {
|
|
179
404
|
"type": ["array", "null"],
|
|
180
|
-
"items": {
|
|
405
|
+
"items": {
|
|
406
|
+
"type": "string"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"recursive": {
|
|
410
|
+
"type": "boolean"
|
|
181
411
|
},
|
|
182
|
-
"recursive": { "type": "boolean" },
|
|
183
412
|
"default": true
|
|
184
413
|
}
|
|
185
414
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export type ValueType = "boolean" | "string" | "integer" | "number" | null;
|
|
2
|
+
export type CommandStream = {
|
|
3
|
+
success: "stdout" | "stderr";
|
|
4
|
+
findings?: "stdout" | "stderr";
|
|
5
|
+
} | null;
|
|
6
|
+
/**
|
|
7
|
+
* The static contract of a command-line interface. Project configuration is not applied. Consumers must ignore properties they do not recognize.
|
|
8
|
+
*/
|
|
9
|
+
export interface DescribeResult {
|
|
10
|
+
schemaVersion: string;
|
|
11
|
+
tool: ToolInfo;
|
|
12
|
+
/**
|
|
13
|
+
* argv token to the --format value it expands to before parsing.
|
|
14
|
+
*/
|
|
15
|
+
formatShorthands: {
|
|
16
|
+
[k: string]: string;
|
|
17
|
+
};
|
|
18
|
+
advisoryOutput?: AdvisoryOutput;
|
|
19
|
+
schemas: SchemaRef[];
|
|
20
|
+
commands: DescribedCommand[];
|
|
21
|
+
}
|
|
22
|
+
export interface ToolInfo {
|
|
23
|
+
name: string;
|
|
24
|
+
version: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Machine-stream guarantees for an advisory notice. Omitted when the tool has none.
|
|
28
|
+
*/
|
|
29
|
+
export interface AdvisoryOutput {
|
|
30
|
+
description: string;
|
|
31
|
+
stream: "stdout" | "stderr";
|
|
32
|
+
suppressedWhen: string[];
|
|
33
|
+
optOutEnv: string;
|
|
34
|
+
}
|
|
35
|
+
export interface SchemaRef {
|
|
36
|
+
id: string;
|
|
37
|
+
uri: string;
|
|
38
|
+
title: string;
|
|
39
|
+
commands: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface DescribedCommand {
|
|
42
|
+
/**
|
|
43
|
+
* Space-joined command path, e.g. 'md graph'.
|
|
44
|
+
*/
|
|
45
|
+
id: string;
|
|
46
|
+
path: string[];
|
|
47
|
+
description: string;
|
|
48
|
+
usage: string;
|
|
49
|
+
arguments: DescribedArgument[];
|
|
50
|
+
options: DescribedOption[];
|
|
51
|
+
subcommands: string[];
|
|
52
|
+
formats: string[] | null;
|
|
53
|
+
defaultFormat: string | null;
|
|
54
|
+
formatConfigurable: boolean;
|
|
55
|
+
outputSchema: string | null;
|
|
56
|
+
jsonlSchema?: string | null;
|
|
57
|
+
sarifSchema?: string | null;
|
|
58
|
+
exitCodes: ExitCodeMeaning[];
|
|
59
|
+
exitCodePassthrough?: ExitCodePassthrough;
|
|
60
|
+
stream: CommandStream;
|
|
61
|
+
writes: boolean | null;
|
|
62
|
+
stability: "stable" | "experimental" | "undeclared";
|
|
63
|
+
notes?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface DescribedArgument {
|
|
66
|
+
name: string;
|
|
67
|
+
description: string;
|
|
68
|
+
arity: Arity;
|
|
69
|
+
valueType: ValueType;
|
|
70
|
+
allowedValues: string[] | null;
|
|
71
|
+
default?: unknown;
|
|
72
|
+
}
|
|
73
|
+
export interface Arity {
|
|
74
|
+
min: number;
|
|
75
|
+
max: number | null;
|
|
76
|
+
}
|
|
77
|
+
export interface DescribedOption {
|
|
78
|
+
name: string;
|
|
79
|
+
aliases: string[];
|
|
80
|
+
description: string;
|
|
81
|
+
valueName: string | null;
|
|
82
|
+
arity: Arity;
|
|
83
|
+
required: boolean;
|
|
84
|
+
negatable: boolean;
|
|
85
|
+
valueType: ValueType;
|
|
86
|
+
allowedValues: string[] | null;
|
|
87
|
+
recursive: boolean;
|
|
88
|
+
default?: unknown;
|
|
89
|
+
}
|
|
90
|
+
export interface ExitCodeMeaning {
|
|
91
|
+
code: number;
|
|
92
|
+
meaning: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Present only when the command forwards a child process's exit status verbatim.
|
|
96
|
+
*/
|
|
97
|
+
export interface ExitCodePassthrough {
|
|
98
|
+
min: number;
|
|
99
|
+
max: number;
|
|
100
|
+
description: string;
|
|
101
|
+
}
|
|
102
|
+
export interface CommandContract {
|
|
103
|
+
formats: string[] | null;
|
|
104
|
+
defaultFormat: string | null;
|
|
105
|
+
formatConfigurable: boolean;
|
|
106
|
+
outputSchema: string | null;
|
|
107
|
+
jsonlSchema?: string | null;
|
|
108
|
+
sarifSchema?: string | null;
|
|
109
|
+
exitCodes: ExitCodeMeaning[];
|
|
110
|
+
exitCodePassthrough?: ExitCodePassthrough;
|
|
111
|
+
stream: CommandStream;
|
|
112
|
+
writes: boolean | null;
|
|
113
|
+
/**
|
|
114
|
+
* Deliberately narrower than a command's. `undeclared` is what an emitter assigns to a command with no contract, so it is never a value a host declares.
|
|
115
|
+
*/
|
|
116
|
+
stability: "stable" | "experimental";
|
|
117
|
+
notes?: string;
|
|
118
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/generated/types.ts"],"names":[],"mappings":""}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,109 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The public model surface.
|
|
3
|
+
*
|
|
4
|
+
* Every shape is generated from `spec/v1/cli-schema.json` and re-exported here. What stays
|
|
5
|
+
* hand-written is what the spec does not describe as a shape: the contract version, the three
|
|
6
|
+
* string-union aliases the payload uses at its leaves, the registry map a host builds, and two
|
|
7
|
+
* predicates over arity.
|
|
8
|
+
*/
|
|
9
|
+
export type { Arity, AdvisoryOutput, CommandContract, CommandStream, DescribeResult, DescribedArgument, DescribedCommand, DescribedOption, ExitCodeMeaning, ExitCodePassthrough, SchemaRef, ToolInfo, } from "./generated/types.js";
|
|
10
|
+
import type { Arity, CommandContract } from "./generated/types.js";
|
|
11
|
+
/** Hand-owned, and independent of the npm and NuGet package versions. */
|
|
1
12
|
export declare const CONTRACT_VERSION = "1";
|
|
13
|
+
/**
|
|
14
|
+
* The three leaf unions.
|
|
15
|
+
*
|
|
16
|
+
* Kept by hand rather than taken from the generated file because the generated `ValueType` folds
|
|
17
|
+
* `null` into the union, where the published one has always been the non-null set with nullability
|
|
18
|
+
* expressed at each use site. Changing that would be a breaking change to a published package for
|
|
19
|
+
* no gain.
|
|
20
|
+
*/
|
|
2
21
|
export type ContractStream = "stdout" | "stderr";
|
|
3
22
|
export type ValueType = "boolean" | "string" | "integer" | "number";
|
|
4
23
|
export type Stability = "stable" | "experimental" | "undeclared";
|
|
5
|
-
|
|
6
|
-
min: number;
|
|
7
|
-
/** `null` is unbounded. */
|
|
8
|
-
max: number | null;
|
|
9
|
-
}
|
|
10
|
-
export interface ExitCodeMeaning {
|
|
11
|
-
code: number;
|
|
12
|
-
meaning: string;
|
|
13
|
-
}
|
|
14
|
-
export interface AdvisoryOutput {
|
|
15
|
-
description: string;
|
|
16
|
-
stream: ContractStream;
|
|
17
|
-
suppressedWhen: string[];
|
|
18
|
-
optOutEnv: string;
|
|
19
|
-
}
|
|
20
|
-
export interface SchemaRef {
|
|
21
|
-
id: string;
|
|
22
|
-
uri: string;
|
|
23
|
-
title: string;
|
|
24
|
-
commands: string[];
|
|
25
|
-
}
|
|
26
|
-
export interface CommandContract {
|
|
27
|
-
formats: readonly string[] | null;
|
|
28
|
-
defaultFormat: string | null;
|
|
29
|
-
formatConfigurable: boolean;
|
|
30
|
-
outputSchema: string | null;
|
|
31
|
-
jsonlSchema?: string | null;
|
|
32
|
-
sarifSchema?: string | null;
|
|
33
|
-
exitCodes: ExitCodeMeaning[];
|
|
34
|
-
exitCodePassthrough?: {
|
|
35
|
-
min: number;
|
|
36
|
-
max: number;
|
|
37
|
-
description: string;
|
|
38
|
-
};
|
|
39
|
-
stream: {
|
|
40
|
-
success: ContractStream;
|
|
41
|
-
findings?: ContractStream;
|
|
42
|
-
} | null;
|
|
43
|
-
writes: boolean | null;
|
|
44
|
-
stability: "stable" | "experimental";
|
|
45
|
-
notes?: string;
|
|
46
|
-
}
|
|
24
|
+
/** What a host hands an emitter, keyed by space-joined command id, e.g. `"md graph"`. */
|
|
47
25
|
export type CommandContractRegistry = Record<string, CommandContract>;
|
|
48
|
-
export interface DescribedArgument {
|
|
49
|
-
name: string;
|
|
50
|
-
description: string;
|
|
51
|
-
arity: Arity;
|
|
52
|
-
valueType: ValueType | null;
|
|
53
|
-
allowedValues: string[] | null;
|
|
54
|
-
default?: unknown;
|
|
55
|
-
}
|
|
56
|
-
export interface DescribedOption {
|
|
57
|
-
name: string;
|
|
58
|
-
aliases: string[];
|
|
59
|
-
description: string;
|
|
60
|
-
valueName: string | null;
|
|
61
|
-
arity: Arity;
|
|
62
|
-
required: boolean;
|
|
63
|
-
negatable: boolean;
|
|
64
|
-
valueType: ValueType | null;
|
|
65
|
-
allowedValues: string[] | null;
|
|
66
|
-
recursive: boolean;
|
|
67
|
-
default?: unknown;
|
|
68
|
-
}
|
|
69
|
-
export interface DescribedCommand {
|
|
70
|
-
id: string;
|
|
71
|
-
path: string[];
|
|
72
|
-
description: string;
|
|
73
|
-
usage: string;
|
|
74
|
-
arguments: DescribedArgument[];
|
|
75
|
-
options: DescribedOption[];
|
|
76
|
-
subcommands: string[];
|
|
77
|
-
formats: string[] | null;
|
|
78
|
-
defaultFormat: string | null;
|
|
79
|
-
formatConfigurable: boolean;
|
|
80
|
-
outputSchema: string | null;
|
|
81
|
-
jsonlSchema?: string | null;
|
|
82
|
-
sarifSchema?: string | null;
|
|
83
|
-
exitCodes: ExitCodeMeaning[];
|
|
84
|
-
exitCodePassthrough?: {
|
|
85
|
-
min: number;
|
|
86
|
-
max: number;
|
|
87
|
-
description: string;
|
|
88
|
-
};
|
|
89
|
-
stream: {
|
|
90
|
-
success: ContractStream;
|
|
91
|
-
findings?: ContractStream;
|
|
92
|
-
} | null;
|
|
93
|
-
writes: boolean | null;
|
|
94
|
-
stability: Stability;
|
|
95
|
-
notes?: string;
|
|
96
|
-
}
|
|
97
|
-
export interface DescribeResult {
|
|
98
|
-
schemaVersion: string;
|
|
99
|
-
tool: {
|
|
100
|
-
name: string;
|
|
101
|
-
version: string;
|
|
102
|
-
};
|
|
103
|
-
formatShorthands: Record<string, string>;
|
|
104
|
-
advisoryOutput?: AdvisoryOutput;
|
|
105
|
-
schemas: SchemaRef[];
|
|
106
|
-
commands: DescribedCommand[];
|
|
107
|
-
}
|
|
108
26
|
export declare function isRequired(arity: Arity): boolean;
|
|
109
27
|
export declare function isVariadic(arity: Arity): boolean;
|
package/dist/types.js
CHANGED
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAyBA,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAiBpC,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,OAAO,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,OAAO,KAAK,CAAC,GAAG,KAAK,IAAI,IAAI,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;AAC7C,CAAC"}
|