2022-10-29 14:43:47 +00:00
{
"$schema" : "http://json-schema.org/draft-07/schema" ,
2022-10-29 14:45:32 +00:00
"title" : "Taskfile YAML Schema" ,
"description" : "Schema for Taskfile files." ,
2022-10-29 14:43:47 +00:00
"definitions" : {
"3" : {
"env" : {
"$ref" : "#/definitions/3/vars"
} ,
"tasks" : {
"type" : "object" ,
"patternProperties" : {
"^.*$" : {
"anyOf" : [
{
"type" : "string"
} ,
{
"type" : "array" ,
"items" : {
"oneOf" : [
{
"type" : "string"
} ,
{
"$ref" : "#/definitions/3/task_call"
}
]
}
} ,
{
"$ref" : "#/definitions/3/task"
}
]
}
}
} ,
"task" : {
"type" : "object" ,
"additionalProperties" : false ,
"properties" : {
"cmds" : {
2022-10-29 14:45:32 +00:00
"description" : "A list of commands to be executed." ,
2022-10-29 14:43:47 +00:00
"$ref" : "#/definitions/3/cmds"
} ,
2023-06-11 03:08:28 +02:00
"cmd" : {
"description" : "The command to be executed." ,
"$ref" : "#/definitions/3/cmd"
} ,
2022-10-29 14:43:47 +00:00
"deps" : {
2022-10-29 14:45:32 +00:00
"description" : "A list of dependencies of this task. Tasks defined here will run in parallel before this task." ,
2022-10-29 14:43:47 +00:00
"type" : "array" ,
"items" : {
"oneOf" : [
{
"type" : "string"
} ,
{
"$ref" : "#/definitions/3/task_call"
}
]
}
} ,
2022-10-29 14:45:32 +00:00
"label" : {
"description" : "Overrides the name of the task in the output when a task is run. Supports variables." ,
"type" : "string"
} ,
"desc" : {
"description" : "A short description of the task. This is displayed when calling `task --list`." ,
"type" : "string"
} ,
2023-06-04 02:33:00 +01:00
"prompt" : {
"description" : "A prompt that will be presented before a task is run. Declining will cancel running the current and any subsequent tasks." ,
"type" : "string"
} ,
2022-10-29 14:45:32 +00:00
"summary" : {
"description" : "A longer description of the task. This is displayed when calling `task --summary [task]`." ,
"type" : "string"
} ,
"aliases" : {
"description" : "A list of alternative names by which the task can be called." ,
"type" : "array" ,
"items" : {
"type" : "string"
}
} ,
2022-10-29 14:43:47 +00:00
"sources" : {
2022-10-29 14:45:32 +00:00
"description" : "A list of sources to check before running this task. Relevant for `checksum` and `timestamp` methods. Can be file paths or star globs." ,
2022-10-29 14:43:47 +00:00
"type" : "array" ,
"items" : {
"type" : "string"
}
} ,
"generates" : {
2022-10-29 14:45:32 +00:00
"description" : "A list of files meant to be generated by this task. Relevant for `timestamp` method. Can be file paths or star globs." ,
2022-10-29 14:43:47 +00:00
"type" : "array" ,
"items" : {
"type" : "string"
}
} ,
"status" : {
2022-10-29 14:45:32 +00:00
"description" : "A list of commands to check if this task should run. The task is skipped otherwise. This overrides `method`, `sources` and `generates`." ,
2022-10-29 14:43:47 +00:00
"type" : "array" ,
"items" : {
"type" : "string"
}
} ,
2022-10-29 14:45:32 +00:00
"preconditions" : {
"description" : "A list of commands to check if this task should run. If a condition is not met, the task will error." ,
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/3/precondition"
}
2022-10-29 14:43:47 +00:00
} ,
2022-10-29 14:45:32 +00:00
"dir" : {
"description" : "The directory in which this task should run. Defaults to the current working directory." ,
"type" : "string"
} ,
2023-01-14 13:41:56 -06:00
"set" : {
"description" : "Enables POSIX shell options for all of a task's commands. See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html" ,
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/3/set"
}
} ,
"shopt" : {
"description" : "Enables Bash shell options for all of a task's commands. See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html" ,
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/3/shopt"
}
} ,
2022-10-29 14:45:32 +00:00
"vars" : {
"description" : "A set of variables that can be used in the task." ,
"$ref" : "#/definitions/3/vars"
} ,
"env" : {
"description" : "A set of environment variables that will be made available to shell commands." ,
"$ref" : "#/definitions/3/env"
2022-10-29 14:43:47 +00:00
} ,
2022-12-06 00:25:16 +00:00
"dotenv" : {
"description" : "A list of `.env` file paths to be parsed." ,
"type" : "array" ,
"items" : {
"type" : "string"
}
} ,
2022-10-29 14:43:47 +00:00
"silent" : {
2022-10-29 14:45:32 +00:00
"description" : "Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`. When combined with the `--list` flag, task descriptions will be hidden." ,
"type" : "boolean" ,
"default" : false
2022-10-29 14:43:47 +00:00
} ,
2022-10-29 14:45:32 +00:00
"interactive" : {
"description" : "Tells task that the command is interactive." ,
"type" : "boolean" ,
"default" : false
} ,
"internal" : {
"description" : "Stops a task from being callable on the command line. It will also be omitted from the output when used with `--list`." ,
"type" : "boolean" ,
"default" : false
} ,
"method" : {
"description" : "Defines which method is used to check the task is up-to-date. `timestamp` will compare the timestamp of the sources and generates files. `checksum` will check the checksum (You probably want to ignore the .task folder in your .gitignore file). `none` skips any validation and always run the task." ,
"type" : "string" ,
"enum" : [ "none" , "checksum" , "timestamp" ] ,
"default" : "none"
2022-10-29 14:43:47 +00:00
} ,
"prefix" : {
2022-10-29 14:45:32 +00:00
"description" : "Defines a string to prefix the output of tasks running in parallel. Only used when the output mode is `prefixed`." ,
2022-10-29 14:43:47 +00:00
"type" : "string"
} ,
2022-10-29 14:45:32 +00:00
"ignore_error" : {
"description" : "Continue execution if errors happen while executing commands." ,
2022-10-29 14:43:47 +00:00
"type" : "boolean"
2022-10-29 14:45:32 +00:00
} ,
"run" : {
"description" : "Specifies whether the task should run again or not if called more than once. Available options: `always`, `once` and `when_changed`." ,
"$ref" : "#/definitions/3/run"
2023-01-07 11:38:35 +11:00
} ,
"platforms" : {
"description" : "Specifies which platforms the task should be run on." ,
"type" : "array" ,
"items" : {
"type" : "string"
}
2023-06-30 02:13:41 +01:00
} ,
"requires" : {
"description" : "A list of variables which should be set if this task is to run, if any of these variables are unset the task will error and not run" ,
"$ref" : "#/definitions/3/requires_obj"
2022-10-29 14:43:47 +00:00
}
}
} ,
"cmds" : {
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/3/cmd"
}
} ,
"cmd" : {
"anyOf" : [
{
"type" : "string"
} ,
{
"$ref" : "#/definitions/3/cmd_call"
} ,
{
"$ref" : "#/definitions/3/task_call"
2023-06-15 15:04:03 +00:00
} ,
2023-07-30 20:51:26 -07:00
{
"$ref" : "#/definitions/3/defer_call"
} ,
2023-06-15 15:04:03 +00:00
{
"$ref" : "#/definitions/3/for_call"
2022-10-29 14:43:47 +00:00
}
]
} ,
2023-01-14 13:41:56 -06:00
"set" : {
"type" : "string" ,
2023-06-30 02:13:41 +01:00
"enum" : [
"allexport" ,
"a" ,
"errexit" ,
"e" ,
"noexec" ,
"n" ,
"noglob" ,
"f" ,
"nounset" ,
"u" ,
"xtrace" ,
"x" ,
"pipefail"
]
2023-01-14 13:41:56 -06:00
} ,
"shopt" : {
"type" : "string" ,
"enum" : [ "expand_aliases" , "globstar" , "nullglob" ]
} ,
2022-10-29 14:43:47 +00:00
"vars" : {
"type" : "object" ,
"patternProperties" : {
"^.*$" : {
"anyOf" : [
{
"type" : [ "boolean" , "integer" , "null" , "number" , "string" ]
} ,
{
"$ref" : "#/definitions/3/dynamic_var"
}
]
}
}
} ,
"dynamic_var" : {
"type" : "object" ,
"properties" : {
"sh" : {
"type" : "string" ,
"description" : "The value will be treated as a command and the output assigned"
} ,
"additionalProperties" : false
}
} ,
"task_call" : {
"type" : "object" ,
"properties" : {
"task" : {
"description" : "Name of the task to run" ,
"type" : "string"
} ,
"vars" : {
"description" : "Values passed to the task called" ,
"$ref" : "#/definitions/3/vars"
2023-04-30 13:26:27 +02:00
} ,
"silent" : {
"description" : "Hides task name and command from output. The command's output will still be redirected to `STDOUT` and `STDERR`." ,
"type" : "boolean"
2022-10-29 14:43:47 +00:00
}
2023-06-15 15:04:03 +00:00
} ,
"additionalProperties" : false ,
"required" : [ "task" ]
2022-10-29 14:43:47 +00:00
} ,
"cmd_call" : {
"type" : "object" ,
"properties" : {
"cmd" : {
"description" : "Command to run" ,
"type" : "string"
} ,
"silent" : {
"description" : "Silent mode disables echoing of command before Task runs it" ,
"type" : "boolean"
} ,
2023-01-14 13:41:56 -06:00
"set" : {
"description" : "Enables POSIX shell options for this command. See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html" ,
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/3/set"
}
} ,
"shopt" : {
"description" : "Enables Bash shell options for this command. See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html" ,
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/3/shopt"
}
} ,
2022-10-29 14:43:47 +00:00
"ignore_error" : {
"description" : "Prevent command from aborting the execution of task even after receiving a status code of 1" ,
"type" : "boolean"
2022-10-29 14:45:32 +00:00
} ,
2023-01-07 11:38:35 +11:00
"platforms" : {
"description" : "Specifies which platforms the command should be run on." ,
"type" : "array" ,
"items" : {
"type" : "string"
}
2022-10-29 14:43:47 +00:00
}
} ,
"additionalProperties" : false ,
"required" : [ "cmd" ]
} ,
2023-07-30 20:51:26 -07:00
"defer_call" : {
"type" : "object" ,
"properties" : {
"defer" : {
"description" : "Run a command when the task completes. This command will run even when the task fails" ,
"anyOf" : [
"string" ,
{
"type" : "object" ,
"properties" : {
"task" : {
"description" : "Name of the task to defer" ,
"type" : "string"
}
} ,
"additionalProperties" : false
}
]
}
} ,
"additionalProperties" : false ,
"required" : [ "defer" ]
} ,
2023-06-15 15:04:03 +00:00
"for_call" : {
"type" : "object" ,
"properties" : {
"for" : {
"anyOf" : [
{
"$ref" : "#/definitions/3/for_list"
} ,
{
2023-06-27 14:14:29 +00:00
"$ref" : "#/definitions/3/for_attribute"
2023-06-15 15:04:03 +00:00
} ,
{
"$ref" : "#/definitions/3/for_var"
}
]
} ,
"cmd" : {
"description" : "Command to run" ,
"type" : "string"
} ,
"task" : {
"description" : "Task to run" ,
"type" : "string"
} ,
"vars" : {
"description" : "Values passed to the task called" ,
"$ref" : "#/definitions/3/vars"
}
} ,
"oneOf" : [
{ "required" : [ "cmd" ] } ,
{ "required" : [ "task" ] }
] ,
"additionalProperties" : false ,
"required" : [ "for" ]
} ,
"for_list" : {
2023-06-27 14:14:29 +00:00
"description" : "A list of values to iterate over" ,
2023-06-15 15:04:03 +00:00
"type" : "array" ,
"items" : {
"type" : "string"
}
} ,
2023-06-27 14:14:29 +00:00
"for_attribute" : {
"description" : "The task attribute to iterate over" ,
2023-06-15 15:04:03 +00:00
"type" : "string" ,
2023-06-27 14:14:29 +00:00
"enum" : [ "sources" ]
2023-06-15 15:04:03 +00:00
} ,
"for_var" : {
2023-06-27 14:14:29 +00:00
"description" : "Which variables to iterate over. The variable will be split using any whitespace character by default. This can be changed by using the `split` attribute." ,
2023-06-15 15:04:03 +00:00
"type" : "object" ,
"properties" : {
"var" : {
"description" : "Name of the variable to iterate over" ,
"type" : "string"
} ,
"split" : {
"description" : "String to split the variable on" ,
"type" : "string"
} ,
"as" : {
"description" : "What the loop variable should be named" ,
"default" : "ITEM" ,
"type" : "string"
}
} ,
"additionalProperties" : false ,
"required" : [ "var" ]
} ,
2022-10-29 14:43:47 +00:00
"precondition" : {
"anyOf" : [
{
"type" : "string"
} ,
{
"$ref" : "#/definitions/3/precondition_obj"
}
]
} ,
"precondition_obj" : {
"type" : "object" ,
"properties" : {
"sh" : {
"description" : "Command to run. If that command returns 1, the condition will fail" ,
"type" : "string"
} ,
"msg" : {
"description" : "Failure message to display when the condition fails" ,
"type" : "string"
}
}
} ,
"run" : {
"type" : "string" ,
"enum" : [ "always" , "once" , "when_changed" ]
2023-02-28 11:50:26 +01:00
} ,
"outputString" : {
"type" : "string" ,
2023-03-02 14:42:11 +01:00
"enum" : [ "interleaved" , "prefixed" , "group" ] ,
2023-02-28 11:50:26 +01:00
"default" : "interleaved"
} ,
"outputObject" : {
"type" : "object" ,
"properties" : {
"group" : {
"type" : "object" ,
"properties" : {
"begin" : {
"type" : "string"
} ,
"end" : {
"type" : "string"
2023-03-09 02:34:52 +01:00
} ,
"error_only" : {
"description" : "Swallows command output on zero exit code" ,
"type" : "boolean" ,
"default" : false
2023-02-28 11:50:26 +01:00
}
}
}
}
2023-06-30 02:13:41 +01:00
} ,
"requires_obj" : {
"type" : "object" ,
"properties" : {
"vars" : {
"description" : "List of variables that must be defined for the task to run" ,
"type" : "array" ,
"items" : {
"type" : "string"
}
}
}
2022-10-29 14:43:47 +00:00
}
}
} ,
2022-11-17 16:13:48 -08:00
"allOf" : [
2022-10-29 14:43:47 +00:00
{
"type" : "object" ,
"properties" : {
"version" : {
"description" : "Specify the Taskfile format that this file conforms to." ,
"anyOf" : [
{
"type" : "number" ,
"enum" : [ 3 ]
} ,
{
"type" : "string" ,
"enum" : [ "3" ]
}
]
} ,
2022-10-29 14:45:32 +00:00
"output" : {
"description" : " D e f i n e s h o w t h e S T D O U T a n d S T D E R R a r e p r i n t e d w h e n r u n n i n g t a s k s i n p a r a l l e l . T h e i n t e r l e a v e d o u t p u t p r i n t s l i n e s i n r e a l t i m e ( d e f a u l t ) . T h e g r o u p o u t p u t w i l l p r i n t t h e e n t i r e o u t p u t o f a c o m m a n d o n c e , a f t e r i t f i n i s h e s , s o y o u w o n ' t h a v e l i v e f e e d b a c k f o r c o m m a n d s t h a t t a k e a l o n g t i m e t o r u n . T h e p r e f i x o u t p u t w i l l p r e f i x e v e r y l i n e p r i n t e d b y a c o m m a n d w i t h [ t a s k - n a m e ] a s t h e p r e f i x , b u t y o u c a n c u s t o m i z e t h e p r e f i x f o r a c o m m a n d w i t h t h e p r e f i x : a t t r i b u t e . " ,
2023-02-28 11:50:26 +01:00
"anyOf" : [
2023-06-30 02:13:41 +01:00
{ "$ref" : "#/definitions/3/outputString" } ,
{ "$ref" : "#/definitions/3/outputObject" }
2023-02-28 11:50:26 +01:00
]
2022-10-29 14:43:47 +00:00
} ,
2022-10-29 14:45:32 +00:00
"method" : {
"description" : "Defines which method is used to check the task is up-to-date. (default: checksum)" ,
"type" : "string" ,
"enum" : [ "none" , "checksum" , "timestamp" ] ,
"default" : "checksum"
2022-10-29 14:43:47 +00:00
} ,
"includes" : {
2022-10-29 14:45:32 +00:00
"description" : "Imports tasks from the specified taskfiles. The tasks described in the given Taskfiles will be available with the informed namespace." ,
2022-10-29 14:43:47 +00:00
"type" : "object" ,
"patternProperties" : {
"^.*$" : {
"anyOf" : [
{
"type" : "string"
} ,
{
"type" : "object" ,
"properties" : {
"taskfile" : {
2022-10-29 14:45:32 +00:00
"description" : "The path for the Taskfile or directory to be included. If a directory, Task will look for files named `Taskfile.yml` or `Taskfile.yaml` inside that directory. If a relative path, resolved relative to the directory containing the including Taskfile." ,
2022-10-29 14:43:47 +00:00
"type" : "string"
} ,
"dir" : {
2022-10-29 14:45:32 +00:00
"description" : "The working directory of the included tasks when run." ,
2022-10-29 14:43:47 +00:00
"type" : "string"
2022-10-29 14:45:32 +00:00
} ,
"optional" : {
"description" : "If `true`, no errors will be thrown if the specified file does not exist." ,
"type" : "boolean"
} ,
"internal" : {
"description" : "Stops any task in the included Taskfile from being callable on the command line. These commands will also be omitted from the output when used with `--list`." ,
"type" : "boolean"
} ,
"aliases" : {
"description" : "Alternative names for the namespace of the included Taskfile." ,
"type" : "array" ,
"items" : {
"type" : "string"
}
} ,
"vars" : {
"description" : "A set of variables to apply to the included Taskfile." ,
"$ref" : "#/definitions/3/vars"
2022-10-29 14:43:47 +00:00
}
}
}
]
}
}
} ,
"vars" : {
2022-10-29 14:45:32 +00:00
"description" : "A set of global variables." ,
2022-10-29 14:43:47 +00:00
"$ref" : "#/definitions/3/vars"
} ,
2022-10-29 14:45:32 +00:00
"env" : {
"description" : "A set of global environment variables." ,
"$ref" : "#/definitions/3/env"
} ,
2022-10-29 14:43:47 +00:00
"tasks" : {
2022-10-29 14:45:32 +00:00
"description" : "A set of task definitions." ,
2022-10-29 14:43:47 +00:00
"$ref" : "#/definitions/3/tasks"
} ,
2022-10-29 14:45:32 +00:00
"silent" : {
"description" : "Default 'silent' options for this Taskfile. If `false`, can be overidden with `true` in a task by task basis." ,
"type" : "boolean"
} ,
2023-01-14 13:41:56 -06:00
"set" : {
"description" : "Enables POSIX shell options for all commands in the Taskfile. See https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html" ,
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/3/set"
}
} ,
"shopt" : {
"description" : "Enables Bash shell options for all commands in the Taskfile. See https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html" ,
"type" : "array" ,
"items" : {
"$ref" : "#/definitions/3/shopt"
}
} ,
2022-10-29 14:45:32 +00:00
"dotenv" : {
"type" : "array" ,
"description" : "A list of `.env` file paths to be parsed." ,
"items" : {
"type" : "string"
}
} ,
2022-10-29 14:43:47 +00:00
"run" : {
2022-10-29 14:45:32 +00:00
"description" : "Default 'run' option for this Taskfile. Available options: `always`, `once` and `when_changed`." ,
"$ref" : "#/definitions/3/run"
} ,
"interval" : {
"description" : "Sets a different watch interval when using `--watch`, the default being 5 seconds. This string should be a valid Go duration: https://pkg.go.dev/time#ParseDuration." ,
2022-12-23 00:34:08 +00:00
"type" : "string" ,
"pattern" : "^[0-9]+(?:m|s|ms)$"
2022-10-29 14:43:47 +00:00
}
} ,
"additionalProperties" : false ,
"required" : [ "version" ] ,
"anyOf" : [
{
"required" : [ "includes" ]
} ,
{
"required" : [ "tasks" ]
} ,
{
"required" : [ "includes" , "tasks" ]
}
]
}
2022-10-29 14:45:32 +00:00
]
2022-10-29 14:43:47 +00:00
}