Skip to content
SLCR

Reference

CLI

Every slcr command, its arguments and options, and its exit codes.

slcr is the reference command-line tool for SLCR. Run slcr <command> --help for the same information from the tool itself.

Global options⁠Link to this section

These options apply to every command:

OptionValue
--enable-colors <WHEN>always, never, or auto. auto colors output only on a terminal. Default: auto.
--log-level <LEVEL>trace, debug, info, warn, error, or off, case-insensitive. Also read from the LOG_LEVEL environment variable. Default: info.
-h, --helpPrint help.

Running slcr with no command prints the help and exits successfully.

Exit codes⁠Link to this section

CodeMeaning
0The command succeeded.
1The command failed: for example, vetting found an error, a requirement is unsatisfied, or a file couldn't be read.
2The command line was invalid: an unknown option, a missing or extra argument, or an argument with an invalid value.

Commands that read one specification⁠Link to this section

slcr render, slcr slice, and slcr query each read one specification file. The FILE argument is optional and defaults to SPEC.slcr.toml. The extension selects the format: .yaml, .yml, .json, or .toml. A specification that fails vetting is rejected.

slcr init⁠Link to this section

Create a specification with its root and glossary sections.

Text
slcr init [OPTIONS] [FILE]

Argument or optionValue
FILEThe file to create. It MUST NOT exist. Default: SPEC.slcr.toml.
--name <NAME>The specification's name. Default: the file name without its extension and any .slcr or .spec suffix. For SPEC.slcr.*, the name of the containing directory.
--title <TITLE>The root section's title. Default: the specification's name.

If the working directory isn't inside a project, init also creates SLCR.toml, listing the new file in specs. Inside an existing project, the manifest is left unchanged, and init warns if the manifest's specs don't match the new file. init never overwrites a file and creates either both files or neither.

slcr vet⁠Link to this section

Report the rules that specifications and validator files break, without running anything.

Text
slcr vet [OPTIONS] [FILE]...

Argument or optionValue
FILE...Specification files to vet. With none, vet the whole project: SLCR.toml, the descriptors it pins, every specification its specs match, and every validator file.
--deny-warningsFail when a file has warnings.
--format <FORMAT>human (diagnostics on stderr, then each file's status on stdout) or json (one JSON document on stdout). Default: human.

vet never uses the network. A pinned descriptor missing from the descriptor store is an error; slcr tools install fixes it.

slcr check⁠Link to this section

Run every validator and report whether the requirements are satisfied.

Text
slcr check [OPTIONS]

OptionValue
-j, --jobs <N>Run at most N validators at once. With 1, they run one at a time, in report order. Default: the number of CPUs.
--offlineNever fetch a descriptor. A descriptor missing from the store fails vetting.
--deny-warningsAlso fail on warnings: vetting warnings, unsatisfied SHOULD and SHOULD NOT requirements, and absorbed failures.
--format <FORMAT>human or json. Default: human.

check takes no file arguments: it always checks the whole project. It runs in this order:

  1. Install any pinned descriptor missing from the store, unless --offline.
  2. Vet the project. If vetting fails, nothing runs.
  3. Run every validator and report each result, in file and position order.
  4. Evaluate each specification and print a summary line.
Terminal
$ slcr check
src/.validators.slcr.toml validator 1 (shop/REQ-002, sh): green
src/mail/.validators.slcr.toml validator 1 (shop/REQ-006, sh): red (exit 1)
shop: 6 satisfied, 1 unsatisfied, 0 unknown

check fails when vetting fails, when a validator can't be run, or when an unsatisfied MUST or MUST NOT requirement isn't absorbed. Unknown requirements and unsatisfied MAY requirements never fail it. The human format prints the end of each red validator's output. The JSON format includes each validator's full output.

check runs the commands the project's descriptors declare. Run it only in repositories you trust, as you would a test suite.

slcr render⁠Link to this section

Render a specification as Markdown.

Text
slcr render [OPTIONS] [FILE]

OptionValue
-o, --output <PATH>Where to write the Markdown, or - for stdout. Default: the file name without its extension and any .slcr or .spec suffix, plus .md, in the same directory. SPEC.slcr.toml renders to SPEC.md.
--forceReplace the output even if slcr didn't render it.
--expect-no-diffWrite nothing, and fail unless the output already matches the rendering exactly. Can't be combined with --force.

Without --force, render refuses to replace a file that slcr didn't render.

slcr slice⁠Link to this section

Print the slice for one requirement to stdout, as Markdown.

Text
slcr slice [OPTIONS] <REQUIREMENT> [FILE]

ArgumentValue
REQUIREMENTA requirement ID, such as REQ-042. An ID of another kind is rejected.

slcr query⁠Link to this section

Run a read-only GQL query over a specification.

Text
slcr query [OPTIONS] <QUERY> [FILE]

Argument or optionValue
QUERYThe query, in the SLCR query profile⁠ (external site) of GQL.
-p, --param <NAME=JSON>Bind $NAME in the query to a JSON value, such as --param 'id="REQ-001"' or --param limit=5. Repeat for each parameter.
--format <FORMAT>table (aligned columns, then a row count), tsv (a header line, then tab-separated rows), or json. Default: table.

The graph has these node labels and properties:

LabelProperties
Sectionid, title, body, spec
Requirementid, title, body, modality, rationale, refinement, spec
AcceptanceCriterionid, title, body, spec
Termid, title, definition, aliases, spec

spec holds the specification's name. Optional properties are absent when the field is omitted.

And these edge labels:

LabelFrom → To
CONTAINSParent → child section or requirement, with a position property giving sibling order
HAS_CRITERIONRequirement → acceptance criterion
REFINESRequirement → requirement it refines
DEPENDS_ONRequirement → requirement or section it depends on
USES_TERMSection or requirement → term

slcr tools⁠Link to this section

Declare and inspect the tools validators run. Every tools subcommand requires a project.

CommandEffect
slcr tools add <SOURCE> [--as <NAME>]Fetch a descriptor, check it, pin it, install it, and declare it in SLCR.toml. SOURCE is an https:// URL or a path to a file inside the project. --as sets the tool name; the default is the descriptor's name.
slcr tools update <NAME>Fetch a declared tool's descriptor again from its source, check it, pin it again, and install it. Use it after editing a descriptor kept in the project.
slcr tools installInstall every pinned descriptor not yet in the store, checking each against its pin. Never changes a pin.
slcr tools remove <NAME>Remove a tool from SLCR.toml.
slcr tools list [--format human|json]List declared tools and whether each descriptor is installed.
slcr tools show <NAME> [--format human|json]Print a declared tool's installed descriptor, including the schema its validators' with must satisfy.

add, update, and remove edit SLCR.toml in place, keeping the rest of the file unchanged.

slcr version⁠Link to this section

Print the CLI's version.