rqm init

rqm init sets a project up. It writes rqm.yaml, the configuration file, and it keeps rqm’s local files out of git. You run it once, in the root directory of your repository.

rqm init --default-kind <kind> [--force] [--no-gitignore]

--default-kind is required. The kind is the sort of requirement that rqm create writes when you do not say otherwise, for example functional. It is declared in the new file, with no extra fields, and you can add more kinds and fields later.

What it does

init looks at the directory first. If there is a Cargo.toml next to where it writes, the project is a cargo project and the configuration declares a suite that runs cargo nextest. Without one, the project is generic and the configuration declares a placeholder suite that you must replace with your own test command. The suite is only declared. Nothing runs tests yet.

Then it writes rqm.yaml (see The configuration file for what is in it), and, if the working directory is in a git repository, it adds .rqm/ to the .gitignore there. .rqm/ is where rqm keeps files that belong to one machine, and they should not be committed. The two writes are one unit: if the second fails, the first is undone. Finally it prints what to do next.

$ rqm init --default-kind functional
created rqm.yaml (cargo project)
created .gitignore with .rqm/
next:
  - cargo add --dev rqm-attr
  - add to .config/nextest.toml, so that nextest writes the report rqm reads:
    [profile.ci.junit]
    path = "junit.xml"
  - rqm create --title "..." to write the first requirement
  - rqm check

Outside a git repository there is no .gitignore to edit, and init tells you so. --no-gitignore skips the edit even inside one.

Running it again

init never replaces a project by accident. If an rqm.yaml exists in the working directory or above it, the search of every other command would find it, so init refuses:

$ rqm init --default-kind functional
error[E-INIT-EXISTS]: A project already exists: rqm.yaml is in the working directory
[exit 2]
$ rqm init --default-kind constraint --force
replaced rqm.yaml (cargo project)
.gitignore already ignores .rqm
next:
  - cargo add --dev rqm-attr
  - add to .config/nextest.toml, so that nextest writes the report rqm reads:
    [profile.ci.junit]
    path = "junit.xml"
  - rqm create --title "..." to write the first requirement
  - rqm check

--force replaces the nearest rqm.yaml, which is the one the other commands would use. That file can be in a parent directory, so look at the name of the file it says it replaced. Your requirement files are not touched, but the new configuration does not know about any kinds and fields you had declared.

Options

$ rqm init --help
Create rqm.yaml in the working directory

Usage: rqm init [OPTIONS] --default-kind <KIND>

Options:
      --default-kind <KIND>  The kind that new requirements have unless `--kind` says otherwise. It is declared in the new `rqm.yaml`, with no fields
      --format <FORMAT>      Output format. JSON is the stable contract [default: human] [possible values: human, json]
      --force                Replace the nearest rqm.yaml, which is looked for the way every command looks for it
      --strict               Treat warnings as errors for the exit code. The output itself does not change
      --no-gitignore         Do not touch .gitignore
  -h, --help                 Print help

The data of --format json is described in The JSON output.