-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcliffy_schema.json
More file actions
459 lines (459 loc) · 18.8 KB
/
Copy pathcliffy_schema.json
File metadata and controls
459 lines (459 loc) · 18.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
{
"$defs": {
"Command": {
"description": "Defines a single command within the CLI. It specifies the command's execution logic,\nparameters, and configuration.",
"properties": {
"run": {
"anyOf": [
{
"$ref": "#/$defs/RunBlock"
},
{
"$ref": "#/$defs/RunBlockList"
}
],
"default": "",
"title": "Run"
},
"help": {
"default": "",
"description": "A description of the command, displayed in the help output.",
"title": "Help",
"type": "string"
},
"params": {
"default": [],
"description": "A list of parameters for the command.\nThere are three ways to define a param: \n(generic) 1. A string as param definition. Gets appended to the command params signature.\n(implicit) 2. A mapping with the param name as the key and the type as the value. Custom types are accepted here. Same as the implicit v1 params syntax. \n(explicit) 3. A mapping with the following keys: `name` (required), `type` (required), `default` (None by default), `help` (Optional), `short` (Optional), `required` (False by default).",
"items": {
"anyOf": [
{
"$ref": "#/$defs/CommandParam"
},
{
"$ref": "#/$defs/SimpleCommandParam"
},
{
"$ref": "#/$defs/GenericCommandParam"
}
]
},
"title": "Params",
"type": "array"
},
"template": {
"default": "",
"description": "A reference to a command template defined in the `command_templates` section of the manifest. This allows for reusable command definitions.",
"title": "Template",
"type": "string"
},
"pre_run": {
"$ref": "#/$defs/PreRunBlock",
"default": "",
"description": "Script to run before the command's run block. This can be used for setup tasks or preconditions."
},
"post_run": {
"$ref": "#/$defs/PostRunBlock",
"default": "",
"description": "Script to run after the command's run block. This can be used for cleanup tasks or post-processing."
},
"aliases": {
"default": [],
"description": "A list of aliases for the command. These aliases can be used to invoke the command with a different name.",
"items": {
"type": "string"
},
"title": "Aliases",
"type": "array"
},
"name": {
"default": "",
"description": "The name of the command. This is generally derived from the key in the `commands` section of the manifest, but can be explicitly set here.",
"title": "Name",
"type": "string"
},
"config": {
"anyOf": [
{
"$ref": "#/$defs/CommandConfig"
},
{
"type": "null"
}
],
"default": null,
"description": "An optional `CommandConfig` object that provides additional configuration options for the command, such as context settings, help text customization, and visibility."
}
},
"title": "Command",
"type": "object"
},
"CommandConfig": {
"description": "Configuration options for a Cliffy command.",
"properties": {
"context_settings": {
"default": {},
"description": "Arbitrary settings passed to Click's context. Useful for things\n like overriding the default `max_content_width`.\n See Click's documentation for more details:\n https://click.palletsprojects.com/en/8.1.x/advanced/#context-settings",
"title": "Context Settings",
"type": "object"
},
"epilog": {
"default": "",
"description": "Text displayed after the help message.",
"title": "Epilog",
"type": "string"
},
"short_help": {
"default": "",
"description": "Short one-line help message displayed in help overviews.",
"title": "Short Help",
"type": "string"
},
"options_metavar": {
"default": "[OPTIONS]",
"description": "Placeholder text displayed for options in help messages.",
"title": "Options Metavar",
"type": "string"
},
"add_help_option": {
"default": true,
"description": "Whether to add the `--help` option automatically.",
"title": "Add Help Option",
"type": "boolean"
},
"no_args_is_help": {
"default": false,
"description": "If True, invoking the command without any arguments displays the help message.",
"title": "No Args Is Help",
"type": "boolean"
},
"hidden": {
"default": false,
"description": "If True, the command is hidden from help messages and command lists.",
"title": "Hidden",
"type": "boolean"
},
"deprecated": {
"default": false,
"description": "If True, the command is marked as deprecated in help messages.",
"title": "Deprecated",
"type": "boolean"
},
"rich_help_panel": {
"default": "",
"description": "Name of a Rich help panel to display after the default help. This is useful for\n displaying more complex help information, such as tables or formatted text.\n The content of the panel is defined using the `@rich_help` decorator.",
"title": "Rich Help Panel",
"type": "string"
}
},
"title": "CommandConfig",
"type": "object"
},
"CommandParam": {
"description": "Defines the structure of a command parameter. It is used\nwithin the `params` field of a `Command` object.\n\nBy default, parameters are treated as positional arguments. To specify an option, prefix the name with `--` to indicate flag.",
"properties": {
"name": {
"description": "Parameter name. Prefix with `--` to indicate an option.",
"title": "Name",
"type": "string"
},
"type": {
"description": "Parameter type (e.g., 'str', 'int', 'bool', or a custom type defined in the manifest's 'types' section).",
"title": "Type",
"type": "string"
},
"default": {
"default": null,
"description": "Default parameter value.",
"title": "Default"
},
"help": {
"default": "",
"description": "Parameter description.",
"title": "Help",
"type": "string"
},
"short": {
"default": "",
"description": "Short option alias. i.e. '-v' for verbose.",
"title": "Short",
"type": "string"
},
"required": {
"default": false,
"description": "Whether the parameter is required.",
"title": "Required",
"type": "boolean"
}
},
"required": [
"name",
"type"
],
"title": "CommandParam",
"type": "object"
},
"CommandTemplate": {
"description": "Defines a reusable template for command definitions. Templates allow you to define\ncommon parameters, pre-run/post-run scripts, and configuration options that can be\napplied to multiple commands.",
"properties": {
"params": {
"default": [],
"description": "A list of parameters for the command template. These parameters will be applied to any command that uses this template.",
"items": {
"anyOf": [
{
"$ref": "#/$defs/CommandParam"
},
{
"$ref": "#/$defs/SimpleCommandParam"
},
{
"$ref": "#/$defs/GenericCommandParam"
}
]
},
"title": "Params",
"type": "array"
},
"pre_run": {
"$ref": "#/$defs/PreRunBlock",
"default": "",
"description": "Script to run before the command's run and pre-run block. This script will be applied to any command that uses this template."
},
"post_run": {
"$ref": "#/$defs/PostRunBlock",
"default": "",
"description": "Script to run after the command's run and post-run block. This script will be applied to any command that uses this template."
},
"config": {
"anyOf": [
{
"$ref": "#/$defs/CommandConfig"
},
{
"type": "null"
}
],
"default": null,
"description": "Additional configuration options for commands using this template. This allows customization of help text, context settings, and other Typer command parameters."
}
},
"title": "CommandTemplate",
"type": "object"
},
"GenericCommandParam": {
"title": "Generic Command Param\nGets appended to the command params signature.",
"type": "string"
},
"PostRunBlock": {
"title": "Post-run Block",
"type": "string"
},
"PreRunBlock": {
"title": "Pre-run Block",
"type": "string"
},
"RunBlock": {
"description": "Command execution logic. Lines prefixed with '$' are treated as shell commands.",
"title": "Command Run Block",
"type": "string"
},
"RunBlockList": {
"items": {
"$ref": "#/$defs/RunBlock"
},
"title": "Run Block List\nList of Run Blocks executed in order.",
"type": "array"
},
"SimpleCommandParam": {
"additionalProperties": {
"type": "string"
},
"maxProperties": 1,
"minProperties": 1,
"title": "Simple Command Param\nBuild params with key as the param name and value as the type and default vals, i.e. `verbose: bool = typer.Option(...)`",
"type": "object"
}
},
"additionalProperties": true,
"properties": {
"manifestVersion": {
"default": "v3",
"title": "Manifestversion",
"type": "string"
},
"name": {
"description": "The name of the CLI, used when invoking from command line.",
"title": "Name",
"type": "string"
},
"version": {
"description": "CLI version",
"title": "Version",
"type": "string"
},
"help": {
"default": "",
"description": "Brief description of the CLI",
"title": "Help",
"type": "string"
},
"use_click": {
"default": false,
"description": "Generate CLI to Click instead of Typer",
"title": "Use Click",
"type": "boolean"
},
"requires": {
"default": [],
"description": "List of Python package dependencies for the CLI.Supports requirements specifier syntax.",
"items": {
"type": "string"
},
"title": "Requires",
"type": "array"
},
"includes": {
"default": [],
"description": "List of external CLI manifests to include.Performs a deep merge of manifests sequentially in the order given to assemble a merged manifest. and finally, deep merges the merged manifest with this manifest.",
"items": {
"type": "string"
},
"title": "Includes",
"type": "array"
},
"vars": {
"additionalProperties": {
"anyOf": [
{
"type": "string"
},
{
"additionalProperties": {
"type": "null"
},
"type": "object"
}
]
},
"description": "Mapping defining manifest variables that can be referenced in any other blocks. Environments variables can be used in this section with ${some_env_var} for dynamic parsing. Supports jinja2 formatted expressions as values. Interpolate defined vars in other blocks jinja2-styled {{ var_name }}.",
"title": "Vars",
"type": "object"
},
"imports": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"default": [],
"description": "String block or list of strings containing any module imports. These can be used to import any python modules that the CLI depends on.",
"title": "Imports"
},
"functions": {
"anyOf": [
{
"type": "string"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"default": [],
"description": "String block or list of helper function definitions. These functions should be defined as strings that can be executed by the Python interpreter.",
"title": "Functions"
},
"types": {
"additionalProperties": {
"type": "string"
},
"description": "A mapping containing any shared type definitions. These types can be referenced by name in the params section to provide type annotations for args and options defined in the params section.",
"title": "Types",
"type": "object"
},
"global_params": {
"default": [],
"description": "Parameters applied to all commands",
"items": {
"anyOf": [
{
"$ref": "#/$defs/CommandParam"
},
{
"$ref": "#/$defs/SimpleCommandParam"
},
{
"$ref": "#/$defs/GenericCommandParam"
}
]
},
"title": "Global Params",
"type": "array"
},
"command_templates": {
"additionalProperties": {
"$ref": "#/$defs/CommandTemplate"
},
"description": "Reusable command templates",
"title": "Command Templates",
"type": "object"
},
"commands": {
"additionalProperties": {
"anyOf": [
{
"$ref": "#/$defs/Command"
},
{
"$ref": "#/$defs/RunBlock"
},
{
"$ref": "#/$defs/RunBlockList"
}
]
},
"description": "A mapping containing the command definitions for the CLI. Each command should have a unique key- which can be either a group command or nested subcommands. Nested subcommands are joined by '.' in between each level. Aliases for commands can be separated in the key by '|'. A special '(*)' wildcard can be used to spread the subcommand to all group-level commands",
"title": "Commands",
"type": "object"
},
"cli_options": {
"description": "Additional CLI configuration options",
"title": "Cli Options",
"type": "object"
},
"tests": {
"default": [],
"description": "Test cases for commands",
"items": {
"anyOf": [
{
"type": "string"
},
{
"additionalProperties": {
"type": "string"
},
"type": "object"
}
]
},
"title": "Tests",
"type": "array"
}
},
"required": [
"name",
"version",
"commands"
],
"title": "CLIManifest",
"type": "object"
}