qlty · diff

git:20260826.7760730 to git:20260905.91997ec

29 added, 101 removed. Audit B to B.

---
name: qlty
- description: Code quality checks, formatting, and metrics via qlty CLI. Use when asked to verify code quality, add or run verifiers, make sure code is high quality before commit or handoff, lint or auto-format a codebase, measure complexity, cohesion, or lines of code, or find code smells like duplication and deep nesting.
+ description: Code quality checks, formatting, and metrics via qlty CLI. Use when asked to verify code quality, add or run verifiers, lint or format code, measure complexity, or find code smells. Includes environment-aware setup and manual offline configuration when qlty is missing or installation is restricted.
---
- # Qlty Code Quality
-
- `qlty` is a universal code quality tool: one CLI that drives 70+ linters, auto-formatters, and security scanners across 40+ languages and technologies, plus its own static analysis for metrics and code smells.
-
- **Prefer the `qlty` CLI over ad-hoc per-tool linter invocations.** Do not reach for `eslint`, `ruff`, `rubocop`, `shellcheck`, `prettier`, `gofmt`, and friends one at a time. Run them through `qlty check` / `qlty fmt` so every language in the repository is covered by one command, with one config, one cache, and one consistent issue format. Fall back to invoking a tool directly only when the repository's own scripts require it (for example a project's `npm run check`) or when qlty has no plugin for it.
-
- ## Documentation
-
- **Reference <https://docs.qlty.sh/llms.txt> heavily.** It is the authoritative index of every qlty documentation page, each available as Markdown by appending `.md` to the page URL. Fetch the index first, then fetch the specific pages you need — command pages under `https://docs.qlty.sh/cli/commands/`, concepts under `https://docs.qlty.sh/cli/concepts/`, and language support under `https://docs.qlty.sh/languages/`.
-
- Local excerpts of the most-used pages live in [references/](references/), each attributed to its upstream URL:
-
- - [references/quickstart.md](references/quickstart.md) — install, `qlty init`, first run
- - [references/commands.md](references/commands.md) — `check`, `fmt`, `metrics`, `smells`, `init`, `plugins`
- - [references/plugins-and-extensions.md](references/plugins-and-extensions.md) — enabling plugins, linter extensions, `qlty.toml`
- - [references/coding-with-ai-agents.md](references/coding-with-ai-agents.md) — upstream's own guidance for agents
-
- The local copies are point-in-time excerpts. When they disagree with the live docs, the live docs win — fetch from `llms.txt`.
-
- ## When to Use
-
- - **Check code for linting issues before commit or handoff.** `qlty check` is the last gate before you hand work to a human or another stage.
- - **Auto-fix formatting and style issues.** `qlty fmt` rewrites files; `qlty check --fix` applies lint auto-fixes.
- - **Calculate code metrics** — complexity, lines of code, cohesion, duplication — with `qlty metrics`.
- - **Find code smells** — duplicated code, deeply nested control flow, overly complex functions — with `qlty smells`.
- - **When a user asks for "verifiers", or asks you to make sure the code is high quality, use this skill.** Those requests mean: enable the right linters for this codebase, then run the check/fmt/metrics/smells loop and fix what it reports.
-
- ## Install
-
- Skip this if `qlty --version` already works.
-
- ```bash
- # macOS & Linux
- curl https://qlty.sh | bash
- ```
-
- Upstream documents the same installer as `curl https://qlty.sh | sh`; both work, the script is POSIX `sh`.
-
- ```powershell
- # Windows
- powershell -c "iwr https://qlty.sh | iex"
- ```
-
- The binary lands in `~/.qlty/bin` and **that directory must be on `PATH`**. The installer appends an export to your shell rc file, which does not help a non-interactive or already-running shell — export it yourself when a command reports `qlty: command not found`:
-
- ```bash
- export PATH="$HOME/.qlty/bin:$PATH"
- ```
-
- Two useful installer environment variables: `QLTY_INSTALL_BIN_PATH` puts the binary somewhere already on `PATH` (for example `$HOME/.local/bin`), and `QLTY_NO_MODIFY_PATH=1` suppresses the rc-file edit. qlty supports macOS and Linux on x64 and arm64 (glibc and musl); Windows support is newer, so verify it rather than assuming.
+ # Qlty code quality
- ## Enable the right plugins for this codebase
+ Use qlty to coordinate relevant linters, formatters and built-in analysis. Repository checks in AGENTS.md, package scripts and CI remain authoritative. Prefer the project's tools and user priorities over generic language presets: a TypeScript repository using Biome does not need a competing ESLint/Prettier rollout.
- Blindly running `qlty check` in a repository with no configuration finds nothing. Tailor the plugin set to the codebase first — this is what turns qlty from a lint runner into a quality bar.
+ ## Choose useful checks
- ```bash
- qlty init # detect file types, write .qlty/qlty.toml with a baseline plugin set
- qlty plugins list # every available plugin
- qlty plugins enable eslint # enable one the baseline missed
- ```
+ Inspect the task, languages, existing config, scripts, lockfiles and baseline findings. Select reliable, low-noise checks that address the requested risks. Security plugins, linter extensions and metrics are choices, not a checklist to maximize. Record commands, scope, output and a relevant baseline; fix in-scope findings rather than reporting complexity numbers without context.
- Then review `.qlty/qlty.toml` against what the repository actually uses: a TypeScript repo usually wants `eslint` plus `prettier`, Python wants `ruff`, Go wants `staticcheck`/`gofmt`, shell wants `shellcheck`/`shfmt`, and almost every repo benefits from `trivy` or `gitleaks` for secrets and vulnerabilities. Enable security and type-checking plugins deliberately; they are the ones that catch defects rather than style.
+ ## Check environment and authorization
- Also enable **linter extensions** — the plugin ecosystem of each linter (`eslint-plugin-react`, `eslint-plugin-security`, RuboCop extensions, Ruff/Pylint/Bandit packages). In `qlty.toml`, either list them with `extra_packages` or point at the project's own dependency manifest with `package_file`:
+ 1. Look for existing `.qlty/qlty.toml`, installed `qlty --version`, cached plugins and runtimes. Preserve existing configuration; do not run init over it.
+ 2. During authorized coding, missing configuration is not a blocker: run `qlty init --no` when available, inspect its generated suggestions and tailor them. Configuration is a reviewable change. Explicit read-only tasks remain read-only, or use isolated scratch configuration.
+ 3. Prefer installed/cached tools. Install missing tools/plugins when online access and permissions permit. A known offline or restricted environment is sufficient reason not to attempt prohibited downloads; otherwise make a reasonable capability check or one bounded setup attempt. Do not repeat blocked installs or require production credentials.
+ 4. If the binary is missing or init cannot run, read [manual configuration](references/manual-configuration.md) and prepare repo-appropriate `.qlty/qlty.toml` by hand when configuration changes are in scope. This requires no network. Validate TOML and available schema support, and label configuration preparation separately from checks executed.
+ 5. Continue available repository checks when optional qlty installation or execution is unavailable. Report the constraint, attempted commands and observed output, checks actually run and coverage still missing. Optional qlty availability is not a universal completion gate and does not relax authoritative checks.
- ```toml
- [[plugin]]
- name = "eslint"
- version = "8.57.0"
- extra_packages = ["eslint-plugin-react@7.33.2", "eslint-plugin-security@3.0.1"]
- ```
+ ## Installation when permitted
- See [references/plugins-and-extensions.md](references/plugins-and-extensions.md) and <https://docs.qlty.sh/cli/linter-extensions.md>.
+ The documented macOS/Linux installer is `curl https://qlty.sh | sh`. Inspect installer and platform support before executing downloaded code. The default binary location is `~/.qlty/bin`; check that location before reinstalling and add it to this shell's PATH if appropriate. `QLTY_NO_MODIFY_PATH=1` prevents shell-profile edits; `QLTY_INSTALL_BIN_PATH` chooses another installation directory. Windows support varies by release; verify current support rather than assuming POSIX commands work there.
- `qlty init` writes `.qlty/qlty.toml` into the repository. In someone else's checkout that is a real, reviewable change — say so before running it, and do not leave it behind uncommitted in a repository you were only asked to inspect.
+ Online, start with <https://docs.qlty.sh/llms.txt> and fetch relevant command/plugin documentation. Offline, use bundled references instead of attempting the network. Never invent plugin versions or flags.
- ## Core commands
+ ## Run and report
- All of `check`, `fmt`, and `smells` must run inside a Git repository with qlty initialized, and default to **changed files only**; pass `--all` or explicit paths to widen. `check` and `fmt` install any missing plugins and language runtimes on demand, so the first run is slow and needs network access.
+ Use explicit paths or a suitable upstream base to keep checks in scope. Commands default to changed files; `--all` widens coverage. `check` and `fmt` may install plugin runtimes on first use. A cached plugin can work offline, but uncached dependencies cannot. Installed built-in `metrics` and `smells` may work offline without plugin downloads; configuration source resolution can still need locally available definitions. A missing binary runs none of these checks.
```bash
- qlty check # lint changed files
- qlty check --all # lint the whole repository
- qlty check --all --filter=eslint # one plugin only
- qlty check --fix --level=low # apply auto-fixes, surface low-severity and up
- qlty check --upstream origin/main # only what this branch changed
-
- qlty fmt # auto-format changed files
- qlty fmt --all # auto-format everything
-
- qlty metrics --all --max-depth 2 # per-directory summary
- qlty metrics --all --sort complexity --limit 10 # the 10 most complex files
- qlty metrics --functions path/to/file.ts # function-level complexity
-
- qlty smells --all # duplication, deep nesting, high complexity
- qlty smells --upstream origin/main # smells introduced by this branch
+ qlty check
+ qlty check --upstream origin/main
+ qlty metrics --functions path/to/file.ts
+ qlty smells path/to/file.ts
```
- `--level` sets what is displayed (`note`, `fmt`, `low`, `medium`, `high`); `--fail-level` sets what makes the command exit non-zero. `--sarif` emits SARIF for tooling.
-
- ## Offline use
-
- The `qlty` binary is self-contained, but its commands split on network needs:
-
- - **Offline-safe:** `qlty metrics` and `qlty smells` use qlty's own built-in static analysis — no plugin or runtime downloads, so they work with no network at all.
- - **Network on first use:** `qlty check` and `qlty fmt` install the enabled plugins and any qlty-managed language runtimes on demand, per repository, on their first run. With no network that first run fails.
-
- In a network-restricted environment (sandboxes, locked-down CI, benchmark runs), either pre-warm the cache while you still have network — run `qlty init` and one `qlty check --all` in the target repository so plugins and runtimes land in `~/.qlty` — or scope quality verification to `qlty metrics` and `qlty smells` and say so in your report rather than presenting them as full lint coverage.
+ Choose the relevant subset. For authorized formatting/fixes, use scoped `qlty fmt` or `qlty check --fix --level=low`, inspect the diff and rerun checks. Do not use `--all` formatting by habit or rewrite files during read-only review. Avoid unsafe auto-fixes and broad churn. `--level` controls displayed severity; `--fail-level` controls failure severity. Do not suppress errors to manufacture a green result.
- ## Working loop
+ Report four distinct facts: configuration prepared/changed, checks passed with command/output, failed checks, and checks not run with reasons. A parsed TOML file is not lint, security, metrics or full schema evidence. A clean run with no applicable plugins is not full quality coverage.
- Upstream's own recommendation for agents, and a good default here:
+ ## Bundled references
- 1. `qlty fmt` before committing — formatting churn should never reach a reviewer.
- 2. `qlty check --fix --level=low` before finishing, then fix by hand whatever it could not auto-fix.
- 3. For a quality-focused request, add `qlty smells --all` and `qlty metrics --all --sort complexity --limit 10`, and act on the worst offenders rather than reporting the numbers.
+ - [Manual configuration](references/manual-configuration.md): offline/missing-binary recipe and source-backed TOML.
+ - [Quickstart](references/quickstart.md): installation and initialization.
+ - [Commands](references/commands.md): exact init/check/fmt/metrics/smells/plugin flags.
+ - [Plugins and extensions](references/plugins-and-extensions.md): definitions, extra packages and package-file choices.
+ - [Upstream agent examples](references/coding-with-ai-agents.md): source excerpts, not a mandate to run every command or download in restricted environments.
- Report what you ran and what it found. A clean `qlty check` is evidence; "I made it high quality" is not.
+ These are dated source excerpts. Prefer current official documentation when reachable; preserve the environment and authorization rules above when an upstream example assumes unrestricted installation.