@xyd-js/opencli 0.0.0-build-b7bd05c-20260701151111

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.
@@ -0,0 +1,579 @@
1
+ /**
2
+ * This file was automatically generated by json-schema-to-typescript.
3
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
4
+ * and run json-schema-to-typescript to regenerate this file.
5
+ */
6
+ /**
7
+ * The OpenCLI description
8
+ */
9
+ interface OpencliSpecJson {
10
+ /**
11
+ * The OpenCLI version number
12
+ */
13
+ opencli: string;
14
+ info: CliInfo;
15
+ conventions?: Conventions;
16
+ /**
17
+ * Root command arguments
18
+ */
19
+ arguments?: Argument[];
20
+ /**
21
+ * Root command options
22
+ */
23
+ options?: Option[];
24
+ /**
25
+ * Root command sub commands
26
+ */
27
+ commands?: Command[];
28
+ /**
29
+ * Root command exit codes
30
+ */
31
+ exitCodes?: ExitCode[];
32
+ /**
33
+ * Examples of how to use the CLI
34
+ */
35
+ examples?: string[];
36
+ /**
37
+ * Indicates whether or not the command requires interactive input
38
+ */
39
+ interactive?: boolean;
40
+ /**
41
+ * Custom metadata
42
+ */
43
+ metadata?: Metadata[];
44
+ "x-openapi"?: XOpenApiRoot;
45
+ [k: string]: unknown;
46
+ }
47
+ /**
48
+ * Information about the CLI
49
+ */
50
+ interface CliInfo {
51
+ /**
52
+ * The application title
53
+ */
54
+ title: string;
55
+ /**
56
+ * A short summary of the application
57
+ */
58
+ summary?: string;
59
+ /**
60
+ * A description of the application
61
+ */
62
+ description?: string;
63
+ contact?: Contact;
64
+ license?: License;
65
+ /**
66
+ * The application version
67
+ */
68
+ version: string;
69
+ [k: string]: unknown;
70
+ }
71
+ /**
72
+ * The contact information
73
+ */
74
+ interface Contact {
75
+ /**
76
+ * The identifying name of the contact person/organization
77
+ */
78
+ name?: string;
79
+ /**
80
+ * The URI for the contact information. This MUST be in the form of a URI.
81
+ */
82
+ url?: string;
83
+ /**
84
+ * The email address of the contact person/organization. This MUST be in the form of an email address.
85
+ */
86
+ email?: string;
87
+ [k: string]: unknown;
88
+ }
89
+ /**
90
+ * The application license
91
+ */
92
+ interface License {
93
+ /**
94
+ * The license name
95
+ */
96
+ name?: string;
97
+ /**
98
+ * The SPDX license identifier
99
+ */
100
+ identifier?: string;
101
+ /**
102
+ * The URI for the license. This MUST be in the form of a URI
103
+ */
104
+ url?: string;
105
+ [k: string]: unknown;
106
+ }
107
+ /**
108
+ * The conventions used by the CLI
109
+ */
110
+ interface Conventions {
111
+ /**
112
+ * Whether or not grouping of short options are allowed
113
+ */
114
+ groupOptions?: boolean;
115
+ /**
116
+ * The option argument separator
117
+ */
118
+ optionSeparator?: string;
119
+ [k: string]: unknown;
120
+ }
121
+ interface Argument {
122
+ /**
123
+ * The argument name
124
+ */
125
+ name: string;
126
+ /**
127
+ * Whether or not the argument is required
128
+ */
129
+ required?: boolean;
130
+ arity?: Arity;
131
+ /**
132
+ * A list of accepted values
133
+ */
134
+ acceptedValues?: string[];
135
+ /**
136
+ * The argument group
137
+ */
138
+ group?: string;
139
+ /**
140
+ * The argument description
141
+ */
142
+ description?: string;
143
+ /**
144
+ * Whether or not the argument is hidden
145
+ */
146
+ hidden?: boolean;
147
+ /**
148
+ * Custom metadata
149
+ */
150
+ metadata?: Metadata[];
151
+ [k: string]: unknown;
152
+ }
153
+ /**
154
+ * The argument arity. Arity defines the minimum and maximum number of argument values
155
+ */
156
+ interface Arity {
157
+ /**
158
+ * The minimum number of values allowed
159
+ */
160
+ minimum?: number;
161
+ /**
162
+ * The maximum number of values allowed
163
+ */
164
+ maximum?: number;
165
+ [k: string]: unknown;
166
+ }
167
+ interface Metadata {
168
+ name: string;
169
+ value?: unknown;
170
+ [k: string]: unknown;
171
+ }
172
+ interface Option {
173
+ /**
174
+ * The option name
175
+ */
176
+ name: string;
177
+ /**
178
+ * Whether or not the option is required
179
+ */
180
+ required?: boolean;
181
+ /**
182
+ * The option's aliases
183
+ */
184
+ aliases?: string[];
185
+ /**
186
+ * The option's arguments
187
+ */
188
+ arguments?: Argument[];
189
+ /**
190
+ * The option group
191
+ */
192
+ group?: string;
193
+ /**
194
+ * The option description
195
+ */
196
+ description?: string;
197
+ /**
198
+ * Specifies whether the option is accessible from the immediate parent command and, recursively, from its subcommands
199
+ */
200
+ recursive?: boolean;
201
+ /**
202
+ * Whether or not the option is hidden
203
+ */
204
+ hidden?: boolean;
205
+ /**
206
+ * Custom metadata
207
+ */
208
+ metadata?: Metadata[];
209
+ [k: string]: unknown;
210
+ }
211
+ interface Command {
212
+ /**
213
+ * The command name
214
+ */
215
+ name: string;
216
+ /**
217
+ * The command aliases
218
+ */
219
+ aliases?: string[];
220
+ /**
221
+ * The command options
222
+ */
223
+ options?: Option[];
224
+ /**
225
+ * The command arguments
226
+ */
227
+ arguments?: Argument[];
228
+ /**
229
+ * The command's sub commands
230
+ */
231
+ commands?: Command[];
232
+ /**
233
+ * The command's exit codes
234
+ */
235
+ exitCodes?: ExitCode[];
236
+ /**
237
+ * The command description
238
+ */
239
+ description?: string;
240
+ /**
241
+ * Whether or not the command is hidden
242
+ */
243
+ hidden?: boolean;
244
+ /**
245
+ * Examples of how to use the command
246
+ */
247
+ examples?: string[];
248
+ /**
249
+ * Indicate whether or not the command requires interactive input
250
+ */
251
+ interactive?: boolean;
252
+ /**
253
+ * Custom metadata
254
+ */
255
+ metadata?: Metadata[];
256
+ "x-openapi"?: XOpenApiCommand;
257
+ [k: string]: unknown;
258
+ }
259
+ interface ExitCode {
260
+ /**
261
+ * The exit code
262
+ */
263
+ code: number;
264
+ /**
265
+ * The exit code description
266
+ */
267
+ description?: string;
268
+ [k: string]: unknown;
269
+ }
270
+ /**
271
+ * xyd extension: OpenAPI/HTTP binding for this command's operation (method, path, params, body). Consumed by the opencli2* code generators to build real API requests.
272
+ */
273
+ interface XOpenApiCommand {
274
+ /**
275
+ * The source OpenAPI operationId, when present
276
+ */
277
+ operationId?: string;
278
+ /**
279
+ * HTTP method (lowercase)
280
+ */
281
+ method: string;
282
+ /**
283
+ * HTTP path template (e.g. /chat/completions/{completion_id})
284
+ */
285
+ path: string;
286
+ /**
287
+ * Override base URL for this operation, if any
288
+ */
289
+ server?: string;
290
+ /**
291
+ * Request body content type
292
+ */
293
+ contentType?: string;
294
+ /**
295
+ * Per-operation security requirements (overrides root)
296
+ */
297
+ security?: XOpenApiSecurity[];
298
+ /**
299
+ * How CLI arguments/options map to HTTP parameters
300
+ */
301
+ params?: XOpenApiParam[];
302
+ body?: XOpenApiBody;
303
+ /**
304
+ * Example responses (status/contentType/schema/example), carried so api.cli pages can render a response sample
305
+ */
306
+ responses?: XOpenApiResponse[];
307
+ [k: string]: unknown;
308
+ }
309
+ /**
310
+ * A single security scheme mapped from the OpenAPI securitySchemes.
311
+ */
312
+ interface XOpenApiSecurity {
313
+ /**
314
+ * Normalized scheme a generator branches on: bearer | apiKey-header | apiKey-query | apiKey-cookie | basic | other
315
+ */
316
+ kind?: string;
317
+ /**
318
+ * The OpenAPI security scheme type (e.g. http, apiKey, oauth2)
319
+ */
320
+ type: string;
321
+ /**
322
+ * The HTTP auth scheme (e.g. bearer, basic) when type is http
323
+ */
324
+ scheme?: string;
325
+ /**
326
+ * Location for an apiKey scheme (header, query or cookie)
327
+ */
328
+ in?: string;
329
+ /**
330
+ * Header/query/cookie name for an apiKey scheme
331
+ */
332
+ name?: string;
333
+ /**
334
+ * The bearer token format hint (e.g. JWT)
335
+ */
336
+ bearerFormat?: string;
337
+ /**
338
+ * Environment variable a generated CLI reads the credential from (e.g. OPENAI_API_KEY)
339
+ */
340
+ envVar?: string;
341
+ [k: string]: unknown;
342
+ }
343
+ /**
344
+ * Maps one CLI argument/option onto an HTTP parameter.
345
+ */
346
+ interface XOpenApiParam {
347
+ /**
348
+ * Parameter location (path, query, header or cookie)
349
+ */
350
+ in: string;
351
+ /**
352
+ * The wire name of the HTTP parameter
353
+ */
354
+ name: string;
355
+ /**
356
+ * Source CLI token: 'argument:<name>' or 'option:<name>'
357
+ */
358
+ from: string;
359
+ /**
360
+ * Whether the HTTP parameter is required
361
+ */
362
+ required?: boolean;
363
+ /**
364
+ * OpenAPI explode flag for array/object serialization
365
+ */
366
+ explode?: boolean;
367
+ /**
368
+ * OpenAPI serialization style
369
+ */
370
+ style?: string;
371
+ [k: string]: unknown;
372
+ }
373
+ /**
374
+ * How CLI options map to the request body
375
+ */
376
+ interface XOpenApiBody {
377
+ /**
378
+ * How the body is assembled: 'flatten' (per-property flags), 'json' (single JSON flag) or 'multipart'
379
+ */
380
+ style: string;
381
+ /**
382
+ * Body content type
383
+ */
384
+ contentType?: string;
385
+ /**
386
+ * Source CLI token when the whole body comes from one option (style=json)
387
+ */
388
+ from?: string;
389
+ /**
390
+ * Per-property body field mappings (style=flatten/multipart)
391
+ */
392
+ properties?: XOpenApiBodyProp[];
393
+ [k: string]: unknown;
394
+ }
395
+ /**
396
+ * Maps one CLI option onto a request body field.
397
+ */
398
+ interface XOpenApiBodyProp {
399
+ /**
400
+ * The wire name of the body field
401
+ */
402
+ name: string;
403
+ /**
404
+ * Source CLI token: 'option:<name>'
405
+ */
406
+ from: string;
407
+ /**
408
+ * Dot path of the field within the JSON body
409
+ */
410
+ jsonPath?: string;
411
+ /**
412
+ * How the CLI value is encoded into the field: 'string', 'number', 'integer', 'boolean', 'json' (parse as JSON), 'array' or 'file'
413
+ */
414
+ encoding?: string;
415
+ /**
416
+ * Whether the body field is required
417
+ */
418
+ required?: boolean;
419
+ [k: string]: unknown;
420
+ }
421
+ /**
422
+ * xyd extension: an example HTTP response for a command's operation, so api.cli pages can render a response sample (mirrors an OpenAPI response).
423
+ */
424
+ interface XOpenApiResponse {
425
+ /**
426
+ * HTTP status code (e.g. "200")
427
+ */
428
+ status?: string;
429
+ /**
430
+ * Response content type (e.g. application/json)
431
+ */
432
+ contentType?: string;
433
+ /**
434
+ * The response description
435
+ */
436
+ description?: string;
437
+ /**
438
+ * JSON Schema of the response body (for a future Response properties table)
439
+ */
440
+ schema?: {
441
+ [k: string]: unknown;
442
+ };
443
+ /**
444
+ * A representative example of the response body, rendered as the response sample
445
+ */
446
+ example?: unknown;
447
+ [k: string]: unknown;
448
+ }
449
+ /**
450
+ * xyd extension: OpenAPI/HTTP binding for the CLI as a whole (servers + security). Emitted by @xyd-js/openapi2opencli and consumed by the opencli2* code generators to build real API requests.
451
+ */
452
+ interface XOpenApiRoot {
453
+ /**
454
+ * Available API base URLs (from the OpenAPI servers list)
455
+ */
456
+ servers?: string[];
457
+ /**
458
+ * Default security requirements for the CLI
459
+ */
460
+ security?: XOpenApiSecurity[];
461
+ [k: string]: unknown;
462
+ }
463
+
464
+ interface LoadOpencliSpecOptions {
465
+ /**
466
+ * Base directory used to resolve a relative file `source`.
467
+ * Defaults to `process.cwd()`. (The remark plugin passes the markdown file's dirname.)
468
+ */
469
+ cwd?: string;
470
+ }
471
+ /**
472
+ * Load an OpenCLI spec from a file path or an HTTP(S) URL.
473
+ *
474
+ * Returns `null` (and logs) on any failure so callers can leave placeholders
475
+ * untouched rather than throwing.
476
+ */
477
+ declare function loadOpencliSpec(source: string, opts?: LoadOpencliSpecOptions): Promise<OpencliSpecJson | null>;
478
+ /**
479
+ * Find a command in the spec by path (e.g., "spice install").
480
+ * If the path is empty, returns a synthetic root command built from the spec root.
481
+ */
482
+ declare function findCommand(spec: OpencliSpecJson, commandPath: string): Command | null;
483
+
484
+ type IndentStyle = 'code' | 'list';
485
+ /**
486
+ * Generate usage line for a command (like: "shadcn init [options] [components...]")
487
+ */
488
+ declare function generateUsage(_spec: OpencliSpecJson, command: Command, commandPath: string, opts?: {
489
+ commandPlaceholder?: boolean;
490
+ }): string;
491
+ /**
492
+ * Generate description for a command
493
+ */
494
+ declare function generateDescription(command: Command): string;
495
+ /**
496
+ * Generate arguments documentation
497
+ * @param indentStyle - 'code' for tab-indented CLI style, 'list' for markdown list style
498
+ */
499
+ declare function generateArguments(command: Command, indentStyle?: IndentStyle): string;
500
+ /**
501
+ * Generate options documentation
502
+ * @param indentStyle - 'code' for tab-indented CLI style, 'list' for markdown list style
503
+ */
504
+ declare function generateOptions(command: Command, indentStyle?: IndentStyle): string;
505
+ /**
506
+ * TODO: OPTIONS DO ALMOST THE SAME
507
+ * Generate flags/options documentation
508
+ */
509
+ declare function generateFlags(command: Command): string;
510
+ /**
511
+ * Generate subcommands documentation
512
+ */
513
+ declare function generateCommands(command: Command): string;
514
+
515
+ interface OpencliRefProperty {
516
+ name: string;
517
+ type: string;
518
+ description: string;
519
+ meta?: {
520
+ name: string;
521
+ value: unknown;
522
+ }[];
523
+ }
524
+ interface OpencliRefDefinition {
525
+ title: string;
526
+ properties: OpencliRefProperty[];
527
+ }
528
+ interface OpencliRefCodeTab {
529
+ title: string;
530
+ code: string;
531
+ language: string;
532
+ }
533
+ interface OpencliRefExampleGroup {
534
+ description?: string;
535
+ examples: {
536
+ description?: string;
537
+ codeblock: {
538
+ title?: string;
539
+ tabs: OpencliRefCodeTab[];
540
+ };
541
+ }[];
542
+ }
543
+ interface OpencliReference {
544
+ title: string;
545
+ canonical: string;
546
+ description: string;
547
+ category: 'cli';
548
+ context: {
549
+ path: string;
550
+ fullPath: string;
551
+ group: string[];
552
+ };
553
+ examples: {
554
+ groups: OpencliRefExampleGroup[];
555
+ };
556
+ definitions: OpencliRefDefinition[];
557
+ }
558
+ interface OpencliToReferencesOptions {
559
+ /**
560
+ * Restrict output to specific commands. Each region is a command path,
561
+ * space-joined from the CLI root (e.g. `"install"`, `"remote add"`).
562
+ */
563
+ regions?: string[];
564
+ /**
565
+ * Render the CLI's global (root recursive) options on every command page.
566
+ * When false (the default), a single "Global options" reference is emitted
567
+ * instead — so the options appear once in the sidebar rather than repeated
568
+ * on every command.
569
+ */
570
+ globalOptionsPerCommand?: boolean;
571
+ }
572
+ /**
573
+ * Convert an OpenCLI document to uniform `Reference[]` — one Reference per
574
+ * command — so the docs engine can render CLI reference pages the same way it
575
+ * renders OpenAPI/GraphQL (`api.cli`). Mirrors `oapSchemaToReferences`.
576
+ */
577
+ declare function opencliToReferences(spec: OpencliSpecJson | null | undefined, options?: OpencliToReferencesOptions): OpencliReference[];
578
+
579
+ export { type Argument, type Arity, type CliInfo, type Command, type Contact, type Conventions, type ExitCode, type IndentStyle, type License, type LoadOpencliSpecOptions, type Metadata, type OpencliReference, type OpencliSpecJson, type OpencliToReferencesOptions, type Option, type XOpenApiBody, type XOpenApiBodyProp, type XOpenApiCommand, type XOpenApiParam, type XOpenApiResponse, type XOpenApiRoot, type XOpenApiSecurity, findCommand, generateArguments, generateCommands, generateDescription, generateFlags, generateOptions, generateUsage, loadOpencliSpec, opencliToReferences };