Skip to content

Doctor, lint and info

Check the machine with `nestrs doctor`, the code's names with `nestrs lint`, and the CLI itself with `version`, `about`, `info` and `update`.

Three commands look rather than write: nestrs doctor checks the machine, nestrs lint checks the names in the code, and version, about, info and update report on the CLI and the project in front of you.

Terminal window
nestrs doctor

Checks:

  • rustc ≥ 1.100 and cargo on PATH
  • whether the current directory sits inside a nestrs workspace
  • optional env vars (<PREFIX>_SEAORM__URL, <PREFIX>_REDIS__URL, …), read as an app started in the same shell and directory would read them — the real environment over the .env cascade, inline or through <NAME>_FILE. A value the app would refuse at boot — a _FILE naming a file it cannot read, a variable given both ways — is a blocking issue, and a _FILE naming a file that holds nothing is not set.

nestrs doctor -p apps/<app> reads one app as nestrs run starts it: from the workspace’s root, its own apps/<app>/.env* over the root’s files under the development and test profiles (an app’s own files).

Use it after install and before running DB- or Redis-backed apps.

Terminal window
nestrs lint

Doctor asks whether the machine is right; lint asks whether the code is. It runs the one naming rule of your project’s AGENTS.md that a path cannot derive: a file’s stem against the types it declares.

One shape is refused, and only one — a stem that reaches nothing the file declares:

nestrs lint
crates/features/src/principal.rs
`principal` reaches none of `DeskOperator`
name the file from the type, or split it — a stem that reaches nothing
is a slot, and a slot fills

That file was named for a slot — “who acts”, “what we pass around” — rather than for a subject. A slot has no admission test, so the next type about that slot lands there too; it is a shared/ folder at the scale of a file. And it is invisible from outside, because both names read perfectly well alone and only the pair is wrong.

Everything short of that passes. The word may come from the folder rather than the file — throttler/store.rs holding RedisThrottler — or from the folder’s singular, read the way nestrs g reads it: cities/subject.rs holding City. An inflection is the same word (scope.rs holding Scoped), and so is an abbreviation (context.rs holding Ctx). And a file whose principal export is a function is a namespace that owes no pairing at all: queue/consume.rs exporting consume::attempt. Files a table already names — service.rs, controller.rs, registry.rs — are named by that table and are not this rule’s business.

It exits non-zero on a finding, and on a file it cannot parse, named by its line and column — a file left unparsed is one left unjudged — so it belongs in CI: the scaffolded lint recipe already runs it, and nestrs run lint is the front door.

The demo holds itself to it through the same code: its lint recipe runs the tree’s nestrs lint in CI.

Terminal window
nestrs version
# → NestRS x.y.z
nestrs about
# → version, tagline, docs, repository, license, author
nestrs info
# → layout, name, root, framework pin, apps, features, env prefix, toolchain
nestrs update
# → checks crates.io; skips when already on the latest version
nestrs update --force
# → cargo install --force --locked nest-rs-cli (reinstall even at the same version)

about is the framework — the same lines on every machine. info is the tree in front of you: which layout you are standing in, the apps and features it holds, the nest-rs version its manifests pin, and which app a generator would wire into. It reports the root relative to where you ran it, and outside a project it says so rather than failing.

Contributors inside the monorepo clone install the tree’s CLI directly:

Terminal window
cargo install --locked --path crates/nest-rs-cli --force
  • CLI — install, scaffold a workspace, run its tasks.
  • Architecture and naming — the naming rules nestrs lint holds one of.
  • Configuration — the variables nestrs doctor reads, and the .env cascade it reads them through.