{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/ops-yaml/_shared/latest--rev.001.json",
  "title": "ops.yaml",
  "description": "Configuration for `ops` (rev. 001)",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/LeShaunJ/ops-schema/main/var/src/rev.001.json",
    "sourceSha256": "6f5adb00a680de01f2a2f8b585c6cb4c0005a560d9e069634f5687dc11080828"
  },
  "type": "object",
  "properties": {
    "actions": {
      "title": "ActionMap",
      "description": "A collection of commands to run via `ops`. If the first argument to `ops` is not a `builtin`, `ops` will look for an action with that name.",
      "markdownDescription": "A collection of commands to run via `ops`. If the first argument to `ops` is not a `builtin`, `ops` will look for an action with that name.\n\n_For more information, see the [Actions](https://github.com/nickthecook/ops/blob/main/docs/actions.md) documentation on [GitHub](https://github.com/nickthecook/ops)._\n",
      "type": "object",
      "minProperties": 1,
      "propertyNames": {
        "title": "<action>",
        "pattern": "^\\b[\\w-]+\\b$"
      },
      "default": {
        "<action>": {
          "command": "<command>"
        }
      },
      "patternProperties": {
        "^[\\w-]+$": {
          "title": "ActionObject",
          "description": "A command configuration.",
          "type": "object",
          "required": [
            "command"
          ],
          "default": "<command>",
          "propertyNames": {
            "enum": [
              "alias",
              "command"
            ]
          },
          "properties": {
            "alias": {
              "title": "Alias",
              "description": "A single alias for the action. If the first argument to `ops` is not a builtin or an action name, `ops` will look for an alias that matches the argument.",
              "markdownDescription": "A single alias for the action. If the first argument to `ops` is not a builtin or an action name, `ops` will look for an alias that matches the argument.",
              "type": "string",
              "pattern": "^[\\w-]+$"
            },
            "command": {
              "title": "Command",
              "description": "A command or script to execute when the action is called.",
              "type": "string",
              "default": "true",
              "allOf": [
                {
                  "$ref": "#/$defs/CommandString"
                }
              ]
            }
          }
        }
      }
    },
    "dependencies": {
      "title": "Dependencies",
      "description": "Dependencies listed in the `dependencies` section of `ops.yml` are satisfied when the `ops up` command is run. Some dependencies will be un-satisfied when you run `ops down`; e.g. services will be stopped, but packages won't be uninstalled.\n\nThis feature allows developers that are new to a project to get up and running without knowing anything about the app itself. Your `ops.yml` should allow a developer to `ops up && ops start` to run an application.\n",
      "markdownDescription": "Dependencies listed in the `dependencies` section of `ops.yml` are satisfied when the `ops up` command is run. Some dependencies will be un-satisfied when you run `ops down`; e.g. services will be stopped, but packages won't be uninstalled.\n\nThis feature allows developers that are new to a project to get up and running without knowing anything about the app itself. Your `ops.yml` should allow a developer to `ops up && ops start` to run an application.\n\n_For more information, see the [Dependencies](https://github.com/nickthecook/ops/blob/main/docs/dependencies.md) documentation on [GitHub](https://github.com/nickthecook/ops)._\n",
      "type": "object",
      "minProperties": 1,
      "propertyNames": {
        "enum": [
          "apk",
          "apt",
          "brew",
          "cask",
          "custom",
          "docker",
          "gem",
          "terraform"
        ]
      },
      "properties": {
        "apk": {
          "title": "apkPackageList",
          "description": "- Specifies that a particular package from `apk` is needed.\n- Will only run if the `apk` command is in the `$PATH` (usually only on Alpine linux).",
          "markdownDescription": "* Specifies that a particular package from `apk` is needed.\n* Will only run if the `apk` command is in the `$PATH` (usually only on Alpine linux).",
          "$ref": "#/$defs/PackageList"
        },
        "apt": {
          "title": "aptPackageList",
          "description": "- Specifies that a particular package from `apt` is needed.\n- Will only run if the `apt` executable is in the `$PATH`.\n- Can specify a version with, e.g.: `curl/7.52.1-5+deb9u7`.\n- Run `apt-cache policy curl` to get available versions.",
          "markdownDescription": "* Specifies that a particular package from `apt` is needed.\n* Will only run if the `apt` executable is in the `$PATH`.\n* Can specify a version with, e.g.: `curl/7.52.1-5+deb9u7`.\n* Run `apt-cache policy curl` to get available versions.",
          "$ref": "#/$defs/PackageList"
        },
        "brew": {
          "title": "brewPackageList",
          "description": "- Specifies that a particular `brew` package is needed.\n- Will only run if you're on a Mac.",
          "markdownDescription": "* Specifies that a particular `brew` package is needed.\n* Will only run if you're on a Mac.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/PackageBrew"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "cask": {
          "title": "caskPackageList",
          "description": "- Specifies that a particular `brew cask` package is needed.\n- Will only run if you're on a Mac.",
          "markdownDescription": "* Specifies that a particular `brew cask` package is needed.\n* Will only run if you're on a Mac.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/PackageBrew"
          },
          "minItems": 1,
          "uniqueItems": true
        },
        "custom": {
          "title": "CustomCommandList",
          "description": "- Runs the given command.\n- Can't tell if the command needs to be run or not, so always runs it on `ops up`.\n- Therefore, the command should be idempotent.\n- It's also a good idea to prevent it from printing output unless it encounters an error, to keep the ops output clean.\n",
          "markdownDescription": "* Runs the given command.\n* Can't tell if the command needs to be run or not, so always runs it on `ops up`.\n* Therefore, the command should be [**idempotent**](https://en.wikipedia.org/wiki/Idempotence).\n* It's also a good idea to prevent it from printing output unless it encounters an error, to keep the ops output clean.\n",
          "type": "array",
          "items": {
            "description": "An idempotent command or script to run as a dependency when `ops up` is executed.",
            "markdownDescription": "An idempotent command or script to run as a dependency when `ops up` is executed.",
            "type": "string",
            "allOf": [
              {
                "$ref": "#/$defs/CommandString"
              }
            ]
          },
          "minItems": 1,
          "examples": [
            [
              "bundle install --quiet"
            ]
          ]
        },
        "docker": {
          "title": "dockerRepository",
          "description": "- Specifies that this repo includes a directory with the given name (e.g. `deps/mysql`) that includes a `docker-compose.yml` file.\n- `ops` will change to the given directory and use `docker-compose` to start, stop, and check the status of this service as needed.\n",
          "markdownDescription": "* Specifies that this repo includes a directory with the given name (e.g. `deps/mysql`) that includes a `docker-compose.yml` file.\n* `ops` will change to the given directory and use `docker-compose` to start, stop, and check the status of this service as needed.\n",
          "$ref": "#/$defs/PathList"
        },
        "gem": {
          "title": "gemPackageList",
          "description": "- Installs the gem with the given name.\n- By default, runs `gem install ...`, but can be configured to use `sudo gem install` or `gem install --user-install` (see below).\n",
          "markdownDescription": "* Installs the gem with the given name.\n* By default, runs `gem install ...`, but can be configured to use `sudo gem install` or `gem install --user-install` (_see below_).\n",
          "$ref": "#/$defs/PackageList",
          "examples": [
            [
              "ejson"
            ]
          ]
        },
        "terraform": {
          "title": "terraformHandler",
          "description": "- Performs `terraform init` and `terraform apply` on `ops up`\n- Performs `terraform destroy` on `ops down`\n",
          "markdownDescription": "* Performs `terraform init` and `terraform apply` on `ops up`\n* Performs `terraform destroy` on `ops down`\n",
          "$ref": "#/$defs/PathList",
          "examples": [
            [
              "env/production",
              "env/staging",
              "env/dev"
            ]
          ]
        }
      }
    },
    "options": {
      "title": "Options",
      "description": "Options allow the user to change some aspects of `ops` behaviour.",
      "markdownDescription": "Options allow the user to change some aspects of `ops` behaviour.\n\n_For more information, see the [Options](https://github.com/nickthecook/ops/blob/main/docs/options.md) documentation on [GitHub](https://github.com/nickthecook/ops)._\n",
      "type": "object",
      "minProperties": 1,
      "propertyNames": {
        "enum": [
          "gem"
        ]
      },
      "properties": {
        "gem": {
          "title": "GemOptions",
          "description": "Affect the behaviour of `gem` dependencies.",
          "markdownDescription": "Affect the behaviour of `gem` dependencies.",
          "type": "object",
          "minProperties": 1,
          "default": {
            "user_install": true,
            "use_sudo": false
          },
          "propertyNames": {
            "enum": [
              "use_sudo",
              "user_install"
            ]
          },
          "properties": {
            "user_install": {
              "title": "UserInstall",
              "description": "If `true`, causes `ops up` to run `gem install --user-install ejson`.",
              "type": "boolean",
              "default": false
            },
            "use_sudo": {
              "$ref": "#/$defs/UseSudo/properties/use_sudo"
            }
          }
        }
      }
    }
  },
  "markdownDescription": "Configuration for [`ops`](https://github.com/nickthecook/ops).\n\n```yaml\nrevision: ...\ndependencies: ...\nactions: ...\noptions: ...\n```\n",
  "$defs": {
    "CommandString": {
      "oneOf": [
        {
          "title": "NoopPass",
          "description": "Executes a `no-op`, exiting successfully with `0`.",
          "markdownDescription": "Executes a `no-op`, exiting successfully with `0`.",
          "type": "string",
          "const": "true",
          "default": "true"
        },
        {
          "title": "NoopFail",
          "description": "Executes a `no-op`, exiting with error code `1`.",
          "markdownDescription": "Executes a `no-op`, exiting with error code `1`.",
          "type": "string",
          "const": "false",
          "default": "false"
        },
        {
          "allOf": [
            {
              "title": "CommandString",
              "default": "echo \"hello, world\"",
              "examples": [
                "terraform init",
                "docker-compose up"
              ],
              "not": {
                "enum": [
                  "true",
                  "false"
                ]
              }
            },
            {
              "$ref": "#/$defs/NonEmptyString"
            }
          ]
        }
      ]
    },
    "Deprecated": {
      "title": "Deprecated",
      "examples": [],
      "readOnly": true
    },
    "EnvList": {
      "title": "EnvironmentList",
      "type": "array",
      "items": {
        "title": "Environment",
        "description": "A list of environment names.",
        "$ref": "#/$defs/NameString"
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "FileName": {
      "title": "FileName",
      "type": "string",
      "pattern": "^(?!.{256,})(?!(aux|clock\\$|con|nul|prn|com[1-9]|lpt[1-9])(?:$|\\.))[^ ][ \\.\\w\\-$()+=\\[\\];#@~,&']+[^\\. ]$",
      "minLength": 1,
      "default": "myfile.txt"
    },
    "LoadSecrets": {
      "description": "If `true`, items in `secrets.ejson` will be loaded before execution, allowing said items to be referenced in the configuration.",
      "type": "boolean",
      "default": false
    },
    "NameString": {
      "title": "NameString",
      "type": "string",
      "pattern": "^[\\w-]+$"
    },
    "NonEmptyString": {
      "title": "NonEmptyString",
      "type": "string",
      "minLength": 1
    },
    "PackageList": {
      "title": "PackageList",
      "type": "array",
      "items": {
        "$ref": "#/$defs/PackageVersioned"
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "PackageBrew": {
      "title": "BrewPackage",
      "description": "The name of a `brew` package. If you need to specify a version, include it after the name, delimited by an `@` symbol.",
      "markdownDescription": "The name of a `brew` package. If you need to specify a version, include it after the name, delimited by an `@` symbol.",
      "type": "string",
      "pattern": "^\\b[\\w:.+-]+\\b(@\\b[0-9.]+\\b[\\w.+-]*\\b)?$",
      "examples": [
        "ruby",
        "openssl@"
      ]
    },
    "PackagePip": {
      "title": "PipPackage",
      "description": "The name of a `pip` package. If you need to specify a version, include it after the name, delimited by `==`.",
      "markdownDescription": "The name of a `pip` package. If you need to specify a version, include it after the name, delimited by `==`.",
      "type": "string",
      "pattern": "^\\b[\\w:.+-]+\\b(==\\b[0-9.]+\\b[\\w.+-]*\\b)?$",
      "examples": [
        "semver",
        "ruamel.yaml==0.17.26"
      ]
    },
    "PackageVersioned": {
      "title": "Package",
      "description": "The name of a package. If you need to specify a version, include it after the name, delimited by a space.",
      "markdownDescription": "The name of a package. If you need to specify a version, include it after the name, delimited by a space.",
      "type": "string",
      "pattern": "^\\b[\\w@:.+-]+\\b( \\b[0-9.]+\\b[\\w.+-]*\\b)?$",
      "examples": [
        "ruby",
        "openssl 0.8.0"
      ]
    },
    "Path": {
      "title": "Path",
      "type": "string",
      "format": "uri-reference"
    },
    "PathList": {
      "title": "PathList",
      "type": "array",
      "items": {
        "allOf": [
          {
            "description": "A valid filepath."
          },
          {
            "$ref": "#/$defs/Path"
          }
        ]
      },
      "minItems": 1,
      "uniqueItems": true
    },
    "SemVer": {
      "title": "SemanticVersion",
      "type": "string",
      "pattern": "^(0|[1-9]\\d*)(?:\\.(0|[1-9]\\d*)(?:\\.(0|[1-9]\\d*)(?:[.-]([0-9A-z-]+(?:\\.[0-9A-z-]+)*)|)(\\+[0-9A-z-]+|)|)|)$"
    },
    "UseSudo": {
      "properties": {
        "use_sudo": {
          "title": "UseSudo",
          "description": "If `false`, causes `ops up` to install the dependency's packages without `sudo`.",
          "type": "boolean",
          "default": true
        }
      }
    }
  },
  "propertyNames": {
    "enum": [
      "actions",
      "dependencies",
      "options",
      "revision"
    ]
  }
}
