Skip to content

assay init [--preset <preset>]

Sets the project up: writes the include: that adopts a preset into the project’s root analysis_options.yaml, and creates the file where there is none. Getting started walks through it, and Presets says what each preset holds.

assay init [--preset core|recommended|strict] [--color auto|always|never]

Run it in the package root. In a directory with no pubspec.yaml it is a usage error.

init edits an existing options file in place: every comment, every other key and the order of everything stay as they are.

  • The files the options file includes already stay included, and the preset is included after them, so that what it sets is in effect. An include: of one address becomes a list where the preset joins it.
  • Another preset of assay gives its place to the one adopted.
  • It never writes a plugins: entry or an agent hook, never touches the pubspec, and installs nothing.
  • A second run changes nothing.
Option Effect
--preset <preset> The preset the project adopts: core, recommended or strict. Without it, init keeps the preset of assay the options file already includes, and adopts recommended where it includes none. With it, init adopts that preset and says which one it replaced.
--color auto|always|never The form of the output, as for every command.

The command takes no argument.

Terminal window
assay init # adopt recommended, or keep the preset adopted
assay init --preset strict # adopt strict instead

Three boxes, and a line below them:

  1. The head box, with the name of the command.
  2. The box Files: the options file with what became of it, over a row for each thing init says of it.
  3. A last box that counts the files changed, or says Nothing to change.
  4. Below the boxes, that the agent plugin, which holds an AI coding agent to the gate, is installed apart (The gate and agent setup).

In a project that has no analysis_options.yaml:

╭──────────────────────────────────────────────────────────────────────────────╮
│ assay init │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Files ───────────────────────────────────────────────────────────── 1 file ─╮
│ analysis_options.yaml created │
│ + Its `include:` names `package:assay_lints/recommended.yaml`: the project │
│ adopts the preset recommended. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────────────────────╮
│ ✓ 1 file changed. │
╰──────────────────────────────────────────────────────────────────────────────╯
To judge an AI agent's changes at the end of each turn, install the agent plugin
of assay: it is separate from this program.

What became of the file is one of:

It says When
created The project had no options file. It now has one, whose include: names the preset.
changed The preset was written into the file’s include:. The row names the preset it replaced, where it replaced one. Moving from one preset to the next shows such a run.
no change The file includes the preset already.
not changed The file is left exactly as it is, and the row gives the reason: the file is not YAML, or is not written as a block of top-level keys; its include: is neither one address nor a list of addresses; it has a plugins.assay entry of its own; or it cannot be read or written.

Where the project does not have the package assay_lints yet, a row says that the preset cannot be read until it does, and gives the command that adds it (Getting started).

Code When
0 Everything it was asked for was written, or was there already.
2 It refused something: the options file was left as it is. Or a usage error: an argument, a --preset that is not one of the three, or no pubspec.yaml in the directory.
3 A file was written while standard output was closed, so nobody was told. Standard error names the file.