forked from kevinchannon/tasktree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasktree-schema.json
More file actions
387 lines (387 loc) · 14.7 KB
/
Copy pathtasktree-schema.json
File metadata and controls
387 lines (387 loc) · 14.7 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
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/kevinchannon/tasktree/schema/tasktree-schema.json",
"title": "Task Tree Recipe Schema",
"description": "Schema for Task Tree (tt) recipe files (tasktree.yaml or tt.yaml)",
"type": "object",
"properties": {
"imports": {
"description": "Import task definitions from other files",
"type": "array",
"items": {
"type": "object",
"properties": {
"file": {
"type": "string",
"description": "Path to the YAML file to import (relative to current file)"
},
"as": {
"type": "string",
"description": "Namespace to use for imported tasks",
"pattern": "^[a-zA-Z][a-zA-Z0-9_-]*$"
}
},
"required": ["file", "as"],
"additionalProperties": false
}
},
"environments": {
"description": "Shell execution environment configurations",
"type": "object",
"properties": {
"default": {
"type": "string",
"description": "Name of the default environment to use"
}
},
"patternProperties": {
"^[a-zA-Z][a-zA-Z0-9_-]*$": {
"type": "object",
"properties": {
"shell": {
"type": "string",
"description": "Path to the shell executable (e.g., /bin/bash, python3, pwsh). Required for shell environments, optional for Docker environments (defaults to 'sh' inside container)."
},
"args": {
"description": "Arguments to pass to the shell (for shell environments) or Docker build arguments (for Docker environments)",
"oneOf": [
{
"type": "array",
"items": {
"type": "string"
},
"description": "Shell arguments (e.g., ['-c'] for bash)"
},
{
"type": "object",
"additionalProperties": {
"type": "string"
},
"description": "Docker build arguments (e.g., {BUILD_TAG: 'latest'})"
},
{
"type": "string",
"description": "Single shell argument"
}
]
},
"preamble": {
"type": "string",
"description": "Code to execute before the command (e.g., imports, setup)"
},
"dockerfile": {
"type": "string",
"description": "Path to Dockerfile (relative to recipe file). When present, indicates a Docker environment."
},
"context": {
"type": "string",
"description": "Path to Docker build context directory (relative to recipe file). Required if dockerfile is specified."
},
"volumes": {
"description": "Volume mounts for Docker container (format: 'host_path:container_path')",
"type": "array",
"items": {
"type": "string"
}
},
"ports": {
"description": "Port mappings for Docker container (format: 'host_port:container_port')",
"type": "array",
"items": {
"type": "string"
}
},
"env_vars": {
"description": "Environment variables to set inside the Docker container",
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"working_dir": {
"type": "string",
"description": "Working directory inside the container (for Docker environments) or on the host (for shell environments)"
},
"extra_args": {
"description": "Additional arguments to pass to docker run",
"type": "array",
"items": {
"type": "string"
}
},
"run_as_root": {
"type": "boolean",
"description": "If true, run as root inside Docker container (skip user mapping). Default: false",
"default": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"variables": {
"description": "Variable definitions that can be referenced in tasks using {{ var.name }} syntax",
"type": "object",
"patternProperties": {
"^[a-zA-Z][a-zA-Z0-9_-]*$": {
"oneOf": [
{
"type": "string",
"description": "Simple string value"
},
{
"type": "integer",
"description": "Integer value"
},
{
"type": "number",
"description": "Floating-point number value"
},
{
"type": "boolean",
"description": "Boolean value (true/false)"
},
{
"type": "object",
"description": "Environment variable reference",
"properties": {
"env": {
"type": "string",
"description": "Name of environment variable to read",
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
},
"default": {
"oneOf": [
{"type": "string"},
{"type": "number"},
{"type": "boolean"}
],
"description": "Value to use if the environment variable is not defined"
}
},
"required": ["env"],
"additionalProperties": false
},
{
"type": "object",
"description": "File read reference",
"properties": {
"read": {
"type": "string",
"description": "Path to file to read (relative to recipe file, or absolute)"
}
},
"required": ["read"],
"additionalProperties": false
},
{
"type": "object",
"description": "Eval command reference (executes shell command and captures output)",
"properties": {
"eval": {
"type": "string",
"description": "Shell command to execute (stdout becomes variable value)"
}
},
"required": ["eval"],
"additionalProperties": false
}
]
}
},
"additionalProperties": false
},
"tasks": {
"description": "Task definitions",
"type": "object",
"patternProperties": {
"^[a-zA-Z][a-zA-Z0-9_-]*$": {
"type": "object",
"properties": {
"desc": {
"type": "string",
"description": "Human-readable description of the task"
},
"deps": {
"description": "Task dependencies (must run before this task). Can be simple task names or parameterized invocations.",
"oneOf": [
{
"type": "array",
"items": {
"oneOf": [
{
"type": "string",
"description": "Simple dependency (task name)"
},
{
"type": "object",
"description": "Parameterized dependency (task with arguments)",
"minProperties": 1,
"maxProperties": 1,
"additionalProperties": {
"oneOf": [
{
"type": "array",
"description": "Positional arguments",
"items": {}
},
{
"type": "object",
"description": "Named arguments",
"additionalProperties": {}
}
]
}
}
]
}
},
{
"type": "string",
"description": "Single dependency (task name)"
}
]
},
"inputs": {
"description": "Input file patterns (glob supported). Supports anonymous inputs (strings) and named inputs (objects). Named inputs can be referenced in the same task using {{ self.inputs.name }}. Task re-runs if inputs change.",
"oneOf": [
{
"type": "array",
"items": {
"oneOf": [
{
"type": "string",
"description": "Anonymous input file pattern"
},
{
"type": "object",
"description": "Named input (format: { name: 'path/to/file' })",
"minProperties": 1,
"maxProperties": 1,
"additionalProperties": {
"type": "string"
}
}
]
}
},
{
"type": "string",
"description": "Single anonymous input file pattern"
}
]
},
"outputs": {
"description": "Output file patterns (glob supported). Supports anonymous outputs (strings) and named outputs (objects). Named outputs can be referenced by dependent tasks using {{ dep.task.outputs.name }} or in the same task using {{ self.outputs.name }}. Task re-runs if outputs missing.",
"oneOf": [
{
"type": "array",
"items": {
"oneOf": [
{
"type": "string",
"description": "Anonymous output file pattern"
},
{
"type": "object",
"description": "Named output (format: { name: 'path/to/file' })",
"minProperties": 1,
"maxProperties": 1,
"additionalProperties": {
"type": "string"
}
}
]
}
},
{
"type": "string",
"description": "Single anonymous output file pattern"
}
]
},
"working_dir": {
"type": "string",
"description": "Directory to execute the command in (relative to recipe file)"
},
"args": {
"description": "Parameterized arguments for the task. Each argument can be a simple name (string) or an object with a single key (argument name) mapping to a configuration object.",
"type": "array",
"items": {
"oneOf": [
{
"type": "string",
"description": "Simple argument name (e.g., 'port') or exported argument (e.g., '$SERVER'). Exported arguments (prefixed with $) become environment variables."
},
{
"type": "object",
"description": "Argument with configuration (single key: argument name, value: config object)",
"minProperties": 1,
"maxProperties": 1,
"additionalProperties": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["int", "float", "bool", "str", "path", "datetime", "ip", "ipv4", "ipv6", "email", "hostname"],
"description": "Type of the argument. Can be inferred from default/min/max/choices if not specified."
},
"default": {
"description": "Default value for the argument (any type: string, number, or boolean)",
"oneOf": [
{"type": "string"},
{"type": "number"},
{"type": "boolean"}
]
},
"min": {
"type": "number",
"description": "Minimum value for numeric arguments (mutually exclusive with choices)"
},
"max": {
"type": "number",
"description": "Maximum value for numeric arguments (mutually exclusive with choices)"
},
"choices": {
"type": "array",
"description": "List of valid values for the argument (mutually exclusive with min/max)",
"minItems": 1,
"items": {}
}
},
"additionalProperties": false
}
}
]
}
},
"env": {
"type": "string",
"description": "Environment to use for this task (overrides default)"
},
"private": {
"type": "boolean",
"description": "If true, task is hidden from --list output but can still be run directly",
"default": false
},
"cmd": {
"type": "string",
"description": "Shell command to execute. Supports template substitution: {{ arg.name }} for arguments, {{ var.name }} for variables, {{ env.NAME }} for environment variables, {{ dep.task.outputs.name }} for dependency outputs, {{ self.inputs.name }} and {{ self.outputs.name }} for own inputs/outputs, {{ tt.* }} for built-in variables."
}
},
"required": ["cmd"],
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"anyOf": [
{ "required": ["tasks"] },
{ "required": ["imports"] },
{ "required": ["environments"] },
{ "required": ["variables"] }
]
}