{ "$id": "https://raw.githubusercontent.com/DocSpring/cigen/main/schemas/v1/command.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "CommandDefinition", "description": "Definition of a reusable command (CircleCI style)", "type": "object", "properties": { "description": { "description": "Optional description for the command", "type": [ "string", "null" ], "default": null }, "parameters": { "description": "Parameters accepted by the command", "type": "object", "additionalProperties": { "$ref": "#/$defs/CommandParameter" }, "default": {} }, "steps": { "description": "Steps executed by the command", "type": "array", "default": [], "items": { "$ref": "#/$defs/Step" } } }, "additionalProperties": true, "$defs": { "CommandParameter": { "description": "Parameter definition inside a command", "type": "object", "properties": { "default": { "description": "Default value for the parameter", "default": null }, "description": { "description": "Description shown in CircleCI UI", "type": [ "string", "null" ], "default": null }, "type": { "description": "Declared parameter type (string, boolean, integer)", "type": [ "string", "null" ], "default": null } }, "additionalProperties": true }, "RestoreCacheDefinition": { "description": "restore_cache step options", "type": "object", "properties": { "key": { "type": [ "string", "null" ], "default": null }, "keys": { "type": "array", "default": [], "items": { "type": "string" } }, "name": { "type": [ "string", "null" ], "default": null }, "restore_keys": { "type": "array", "default": [], "items": { "type": "string" } } }, "additionalProperties": true }, "RunCommand": { "description": "The value of `run:`", "anyOf": [ { "type": "string" }, { "$ref": "#/$defs/RunStepOptions" } ] }, "RunStep": { "description": "A run step: `- name: Test` / `run: cargo test`, or `- run: { name: Test, command: cargo test }`", "type": "object", "properties": { "env": { "description": "Environment variables for this step", "type": "object", "additionalProperties": { "type": "string" } }, "if": { "description": "Conditional execution", "type": [ "string", "null" ] }, "name": { "description": "Step name (optional)", "type": [ "string", "null" ] }, "run": { "description": "The command, or a mapping with the command and its options", "$ref": "#/$defs/RunCommand" } }, "additionalProperties": true, "required": [ "run" ] }, "RunStepOptions": { "description": "Run step options (for `run: { name, command }`)", "type": "object", "properties": { "command": { "description": "Command to run", "type": "string" }, "env": { "description": "Environment variables for this step", "type": "object", "additionalProperties": { "type": "string" } }, "if": { "description": "Conditional execution", "type": [ "string", "null" ] }, "name": { "description": "Step name (optional)", "type": [ "string", "null" ] } }, "additionalProperties": true, "required": [ "command" ] }, "SaveCacheDefinition": { "description": "save_cache step options", "type": "object", "properties": { "key": { "type": [ "string", "null" ], "default": null }, "name": { "type": [ "string", "null" ], "default": null }, "paths": { "type": "array", "default": [], "items": { "type": "string" } } }, "additionalProperties": true }, "Step": { "description": "Job step. Every key a step is given is kept: keys cigen doesn't model go in `extra` and are\npassed to the provider untouched, never dropped.", "anyOf": [ { "description": "A provider's own reference, such as a GitHub action", "$ref": "#/$defs/UsesStep" }, { "description": "Runs a command: `run: ` or `run: { name, command }`, with optional keys beside it", "$ref": "#/$defs/RunStep" }, { "description": "CircleCI restore_cache step", "type": "object", "properties": { "restore_cache": { "$ref": "#/$defs/RestoreCacheDefinition" } }, "required": [ "restore_cache" ] }, { "description": "CircleCI save_cache step", "type": "object", "properties": { "save_cache": { "$ref": "#/$defs/SaveCacheDefinition" } }, "required": [ "save_cache" ] }, { "description": "Any other step type (a command, or a provider-specific step) - preserved as raw YAML value" } ] }, "UsesStep": { "description": "A provider's own reference, such as a GitHub action (`uses: actions/checkout@v7`), passed\nthrough. Modules are listed under a job's `modules:`, never here.", "type": "object", "properties": { "if": { "description": "Conditional execution", "type": [ "string", "null" ], "default": null }, "name": { "description": "Step name", "type": [ "string", "null" ] }, "uses": { "description": "The reference, with its version (`actions/setup-node@v7`)", "type": "string" }, "with": { "description": "Inputs", "type": "object", "additionalProperties": true, "default": {} } }, "additionalProperties": true, "required": [ "uses" ] } } }