Skip to content

Command-line reference

Applies to version 0.1

The output of slay400 --help and slay400 help <command>, for every command.

Usage: slay400 <command> [options]
       slay400 gateway <arguments>
       slay400 --version | version
       slay400 --help | help [<command>]

Commands:
  init       Write gateway.yaml and a first api.yaml for every PCML file that has none
  annotate   Ask which way each inputoutput parameter goes and write the answers into api.yaml
  validate   Load the repository, validate it and report
  generate   Run the emitters named in gateway.yaml and write their files
  bundle     Pack the descriptor, the OpenAPI documents and the sources into one bundle file
  diff       Compare the repository with a released bundle
  gateway    Run slay400-gateway, found on PATH, with the given arguments

Options for every command:
  --repo <dir>              Repository root, the folder with gateway.yaml and apis/ (default: the working directory)
  --format text|json|sarif  Report format (default: text)
  --report <file>           Write the report to this file instead of standard output
  --fail-on error|warning   Lowest severity that makes the command fail (default: error)
  --stacktrace              Print the stack trace of an unexpected failure
  --help                    Show this help

Exit codes:
  0  completed, nothing at or above --fail-on
  1  diagnostics at or above --fail-on
  2  usage error
  3  unexpected failure
  4  (gateway only) slay400-gateway was not found on PATH

The report goes to standard output or to --report; everything else goes to standard error.
Run 'slay400 help <command>' or 'slay400 <command> --help' for the options of a command.
Usage: slay400 init [--dry-run] [options]

Writes gateway.yaml, if there is none, and an api.yaml in every folder directly under apis/ that holds exactly one
PCML file and no api.yaml or api.yml. Nothing that exists is overwritten or deleted: what is there is listed as kept.
A folder with no PCML file, or more than one, is skipped (CLI004). The repository does not have to be valid.
Every file is written to a temporary file and moved into place.

The overlay has one operation per program, POST /<program>, and one line per parameter. A parameter that is
inputoutput has no direction yet: run annotate, or add one by hand. gateway.yaml sets defaults.inputoutput to fail,
so the repository does not validate until every such parameter has one.

Options:
  --dry-run                 Write nothing; say what would be created

Options for every command:
  --repo <dir>              Repository root, the folder with gateway.yaml and apis/ (default: the working directory)
  --format text|json|sarif  Report format (default: text)
  --report <file>           Write the report to this file instead of standard output
  --fail-on error|warning   Lowest severity that makes the command fail (default: error)
  --stacktrace              Print the stack trace of an unexpected failure
  --help                    Show this help

Exit codes:
  0  completed, nothing at or above --fail-on
  1  diagnostics at or above --fail-on
  2  usage error
  3  unexpected failure
  4  (gateway only) slay400-gateway was not found on PATH
Usage: slay400 annotate [--api <folder>] [--dry-run] [options]

For every top-level parameter whose PCML usage is inputoutput and that has no direction in api.yaml, asks which way
it goes, and writes the answers into api.yaml. Only the parameter entries are changed: comments, blank lines, key
order, quoting, indentation and line endings are kept. An entry written in a way that cannot be edited safely is
left alone and reported (SCF001); a file whose edited text does not pass the check is not written (SCF002).

The questions go to standard error and the answers are read from standard input, one line each:
  direction  request, response, both or internal; Enter skips the parameter
  type       one of the types the wire type can carry; Enter keeps the default (not asked for a struct or internal)
  name       the name in the API; Enter keeps the default (not asked for internal)
An answer may be in any case and shortened to the beginning of one choice. The end of the input ends the
questions; what was answered is kept.

It stops before the first question, with the report, if the repository has an error other than OVL001. At the end
the repository is loaded and validated again, so the command succeeds only when the repository validates.

Options:
  --api <folder>            Only the API in this folder under apis/
  --dry-run                 Write nothing

Options for every command:
  --repo <dir>              Repository root, the folder with gateway.yaml and apis/ (default: the working directory)
  --format text|json|sarif  Report format (default: text)
  --report <file>           Write the report to this file instead of standard output
  --fail-on error|warning   Lowest severity that makes the command fail (default: error)
  --stacktrace              Print the stack trace of an unexpected failure
  --help                    Show this help

Exit codes:
  0  completed, nothing at or above --fail-on
  1  diagnostics at or above --fail-on
  2  usage error
  3  unexpected failure
  4  (gateway only) slay400-gateway was not found on PATH
Usage: slay400 validate [options]

Loads the repository and validates it. Writes nothing but the report.

Options for every command:
  --repo <dir>              Repository root, the folder with gateway.yaml and apis/ (default: the working directory)
  --format text|json|sarif  Report format (default: text)
  --report <file>           Write the report to this file instead of standard output
  --fail-on error|warning   Lowest severity that makes the command fail (default: error)
  --stacktrace              Print the stack trace of an unexpected failure
  --help                    Show this help

Exit codes:
  0  completed, nothing at or above --fail-on
  1  diagnostics at or above --fail-on
  2  usage error
  3  unexpected failure
  4  (gateway only) slay400-gateway was not found on PATH
Usage: slay400 generate --out <dir> [options]

Runs the emitters named by 'emitters' in gateway.yaml (default: descriptor, openapi and mock) and writes their files
under <dir>. Nothing is written if there is an error. Existing files are overwritten; nothing is deleted.

Options:
  --out <dir>               Output folder; not the repository root and not inside apis/

Options for every command:
  --repo <dir>              Repository root, the folder with gateway.yaml and apis/ (default: the working directory)
  --format text|json|sarif  Report format (default: text)
  --report <file>           Write the report to this file instead of standard output
  --fail-on error|warning   Lowest severity that makes the command fail (default: error)
  --stacktrace              Print the stack trace of an unexpected failure
  --help                    Show this help

Exit codes:
  0  completed, nothing at or above --fail-on
  1  diagnostics at or above --fail-on
  2  usage error
  3  unexpected failure
  4  (gateway only) slay400-gateway was not found on PATH
Usage: slay400 bundle --name <name> --version <version> --out <file> [options]

Runs the descriptor and OpenAPI emitters, and the mock emitter if gateway.yaml names it (it does by default), and packs
their files with the PCML and overlay files, and the mock files, into one bundle.
The file is written to a temporary file and moved into place, so a failed run leaves no partial bundle.

Options:
  --name <name>                  Bundle name: lower-case letters, digits, '.', '_' and '-'
  --version <version>            Bundle version label: no white space, at most 64 characters
  --out <file>                   Bundle file to write
  --source-repository <text>     Where the repository comes from (optional, written to the manifest)
  --source-revision <text>       The revision of the repository (optional, written to the manifest)

Options for every command:
  --repo <dir>              Repository root, the folder with gateway.yaml and apis/ (default: the working directory)
  --format text|json|sarif  Report format (default: text)
  --report <file>           Write the report to this file instead of standard output
  --fail-on error|warning   Lowest severity that makes the command fail (default: error)
  --stacktrace              Print the stack trace of an unexpected failure
  --help                    Show this help

Exit codes:
  0  completed, nothing at or above --fail-on
  1  diagnostics at or above --fail-on
  2  usage error
  3  unexpected failure
  4  (gateway only) slay400-gateway was not found on PATH
Usage: slay400 diff --against <bundle file> [options]

Compares the repository with a released bundle and reports what changed for the consumers of each API, and whether
the version was raised enough. Writes nothing but the report.

Options:
  --against <bundle file>   The released bundle

Options for every command:
  --repo <dir>              Repository root, the folder with gateway.yaml and apis/ (default: the working directory)
  --format text|json|sarif  Report format (default: text)
  --report <file>           Write the report to this file instead of standard output
  --fail-on error|warning   Lowest severity that makes the command fail (default: error)
  --stacktrace              Print the stack trace of an unexpected failure
  --help                    Show this help

Exit codes:
  0  completed, nothing at or above --fail-on
  1  diagnostics at or above --fail-on
  2  usage error
  3  unexpected failure
  4  (gateway only) slay400-gateway was not found on PATH
Usage: slay400 gateway <arguments>

Runs slay400-gateway, found on PATH, with these arguments, and returns its exit status. The generator does not
install the gateway or depend on it. If slay400-gateway is not found, says so and exits 4.

See https://github.com/generativearchitects-ai/slay400 for the gateway's own documentation.