{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "JSON Schema for Brix, a CLI tool for scaffolding your codebase",
"description": "Brix is a CLI tool written in Rust for scaffolding and code generation.",
"additionalProperties": false,
"required": ["commands"],
"properties": {
"context": {
"type": "object",
"description": "Additional context information to be used within the file"
},
"commands": {
"type": "array",
"description": "The list of commands that will be executed in order by Brix",
"items": {
"type": "object",
"properties": {
"copy": {
"$ref": "#/$defs/copy"
},
"exec": {
"$ref": "#/$defs/exec"
},
"mkdir": {
"$ref": "#/$defs/mkdir"
},
"search_replace": {
"$ref": "#/$defs/search_replace"
},
"template": {
"$ref": "#/$defs/template"
}
}
}
}
},
"$defs": {
"copy": {
"description": "The copy command copies a file from the source file to the destination file",
"type": "object",
"required": ["source", "destination"],
"properties": {
"source": {
"type": "string",
"description": "The path to the source file to copy"
},
"destination": {
"type": "string",
"description": "The path to the destination file to copy to"
},
"overwrite": {
"type": "boolean",
"description": "Whether or not to overwrite the destination file if it already exists"
}
}
},
"exec": {
"description": "The exec command executes commands in a shell",
"type": "object",
"required": ["commands"],
"properties": {
"commands": {
"type": "array",
"description": "The list of commands to execute in order",
"items": {
"type": "string"
}
},
"stdout": {
"type": "boolean",
"description": "Whether or not to print the stdout of the command"
}
}
},
"mkdir": {
"description": "The mkdir command recursively creates a directory",
"type": "object",
"required": ["destination"],
"properties": {
"destination": {
"type": "string",
"description": "The path of the directory to create"
}
}
},
"search_replace": {
"description": "The search_replace command uses searches for an expression within a file and replaces it with new content",
"type": "object",
"required": ["destination", "search", "replace"],
"properties": {
"destination": {
"type": "string",
"description": "The path of the file to search and replace"
},
"search": {
"type": "string",
"description": "The expression to search for (supports Perl-like regular expressions with https://crates.io/crates/fancy_regex/)"
},
"replace": {
"type": "string",
"description": "The expression to replace the search with"
}
}
},
"template": {
"description": "The template command uses a template to generate a file",
"type": "object",
"required": ["source", "destination"],
"properties": {
"source": {
"type": "string",
"description": "The path to the template file"
},
"destination": {
"type": "string",
"description": "The destination file to output"
},
"overwrite": {
"type": "boolean",
"description": "Whether or not to overwrite the destination file if it already exists"
},
"context": {
"type": "object",
"description": "The context to use when rendering the template"
}
}
}
}
}