Skip to main content

CLI Commands

setup / init

Launches the interactive wizard. init is an alias for setup.

npx @rtorcato/js-tooling setup # current directory
npx @rtorcato/js-tooling setup -d ./my-app # specific directory
npx @rtorcato/js-tooling setup --skip-install # skip npm/pnpm install

copy <name>

Copies a standalone config file into the current directory without running the full wizard.

npx @rtorcato/js-tooling copy biome # → biome.json
npx @rtorcato/js-tooling copy tsconfig # → tsconfig.json

Why only two? Biome doesn't support configuration extension, so the only way to customise it is to own the file. TypeScript configs also benefit from being local so editors resolve them without hunting up the tree. All other configs (ESLint, Prettier, Vitest, etc.) can be imported or extended directly — see the Configuration Reference for usage.

list / ls

Prints all available tooling configurations.

npx @rtorcato/js-tooling list

doctor

Audits an existing project against the presets and reports drift.

npx @rtorcato/js-tooling doctor # current dir
npx @rtorcato/js-tooling doctor -d ./app # specific dir
npx @rtorcato/js-tooling doctor --json # machine-readable output

Each row reports one of:

StatusMeaning
okConfig matches the preset (or required file present)
driftConfig exists but has diverged from the preset
missingConfig required but not found
not configuredOptional tool not present in the project

What gets checked

GroupChecks
EnvironmentNode version (vs. minimum + LTS patch level), engines.node field
Repo baselinepackage.json, .editorconfig, .nvmrc / .node-version
Tooling presetsTypeScript, Biome, ESLint, Prettier, Vitest, Commitlint
AutomationHusky, lint-staged, semantic-release, knip
CI / supply chainGitHub Actions, Dependabot, CodeQL, GitLab CI

After the per-row results, doctor prints a Next steps: footer listing the exact fix command to run for each non-ok item:

Next steps:
- Run `npx @rtorcato/js-tooling fix engines` to align engines.node
- Run `npx @rtorcato/js-tooling fix editorconfig` to scaffold EditorConfig
- Run `npx @rtorcato/js-tooling fix dependabot` to scaffold Dependabot
- Run `npx @rtorcato/js-tooling fix` to walk all findings interactively

Exits non-zero on drift or missing — useful as a CI gate.

fix [target]

Applies scaffolders for items doctor flagged. Without a target it walks every non-ok result, prompting per item; with a target it applies just that one.

npx @rtorcato/js-tooling fix # walk all findings interactively
npx @rtorcato/js-tooling fix dependabot # scaffold just .github/dependabot.yml
npx @rtorcato/js-tooling fix --yes # apply every recommended fix without prompts
npx @rtorcato/js-tooling fix biome --dry-run # print what would change, write nothing
npx @rtorcato/js-tooling fix biome --diff # show the exact diff before confirming

Flags

FlagBehaviour
-d, --directory <path>Target directory (defaults to cwd)
--yesAssume yes to every prompt, including drift overwrites
--dry-runPrint the files each fixer would write, without writing
--diffPrint a unified diff of each change before the confirm prompt

Drift policy

When a file exists but doesn't extend the preset, fix defaults the confirm prompt to No — your customisations are preserved unless you explicitly say yes (or pass --yes). The prompt always tells you which file is about to be overwritten.

Diff preview (--diff)

When you want to see exactly what would change before saying yes, pass --diff. For each output the fixer would touch, you'll see:

  • a create <path> header if the file is new (no diff body to show), or
  • a modify <path> header followed by a unified diff comparing the current file to what the fixer would write.
$ npx @rtorcato/js-tooling fix biome --diff
🔧 biome — Biome is drift

modify biome.json
--- biome.json
+++ biome.json
@@ -1,3 +1,12 @@
-{
- "rules": { "noConsole": "error" }
-}
+{
+ "$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
+ "extends": ["@rtorcato/js-tooling/biome"],
+ …
+}
? ⚠️ Scaffold biome.json … — overwrite existing file? user customizations will be lost (y/N)

The diff:

  • is suppressed in --json mode (the structured output stream stays clean),
  • is suppressed for safe-add fixers (those never overwrite existing files),
  • honours NO_COLOR and the standard terminal-colour detection chalk uses,
  • works in both targeted (fix biome --diff) and walk-all (fix --diff) modes.

Implementation note: the preview is computed by shadow-running the fixer in a temp copy of your project directory — your real files are never touched until you confirm.

Available targets

TargetDoctor check it coversOutputs
package-jsonpackage.jsonadds @rtorcato/js-tooling to devDependencies
enginesengines.nodesets engines.node (never overwrites)
editorconfigEditorConfig.editorconfig
nvmrcNode version pin.nvmrc
tsconfigTypeScripttsconfig.json
biomeBiomebiome.json
eslintESLinteslint.config.mjs
prettierPrettierprettier.config.mjs
vitestVitestvitest.config.ts (preserves existing vitest.setup.ts)
commitlintCommitlintcommitlint.config.mjs
huskyHusky + lint-staged.husky/pre-commit, package.json lint-staged field (deep-merges)
semantic-releasesemantic-releaserelease.config.mjs (skipped on private packages)
knipknipknip.json
github-actionsGitHub Actions.github/workflows/ci.yml
dependabotDependabot.github/dependabot.yml
codeqlCodeQL.github/workflows/codeql.yml

Typical workflow

npx @rtorcato/js-tooling doctor # see what's missing
npx @rtorcato/js-tooling fix # walk the list, accept defaults
npx @rtorcato/js-tooling doctor # confirm everything is now ok