Skip to main content
Use loadwise check --review to save a local report and print a handoff you can share with a coding agent. See Using Loadwise with an active coding agent. For crash reporting, use the global option npx loadwise --report-crashes check. See the security and data handling policy and the reporting details below. Use loadwise explain --list to browse rule IDs and impacts. Add --checker rel or --search PostgreSQL to narrow the list. Run loadwise editor doctor --json for an offline setup diagnostic. Add --workspace <name> to focus on a package or --editor codium to compare the installed extension version. Run loadwise check --help for scan options and loadwise fix --help for edit options. Bare loadwise runs the configured checks in the current directory. Use --skip maint to run every checker except maintainability. Both --only and --skip on check accept short and full checker names, such as --only perf,security. check accepts these flags and passes them to every selected checker:
  • --json prints one object with a key per selected checker, { "performance": report, "reliability": report, "maintainability": report, "security": report, "accessibility": report }. A checker with no usable report has null. The optional _coverage object marks checks that failed or produced partial results as incomplete with their exit code. It marks accessibility as not-applicable with reason no-frontend-sources when there are no frontend sources. A bare null still counts as unavailable in agent verify.
  • --format text|json|sarif|github picks the output; --json is --format json. sarif prints SARIF 2.1.0 with one run per checker for GitHub code scanning, and github prints ::warning/::error/::notice workflow annotations. The checker commands accept it too. Exit codes do not depend on the format.
  • --include-contextual also shows lower-priority findings (one-off blocking calls in CLI startup, test and seed sources and similar), each with its reason. JSON counts the hidden ones in contextualFindingCount; in the expanded view they appear in findings with a contextualReason.
  • --uncommitted checks all local changes since HEAD, including staged and unstaged lines and untracked files. It requires an initial commit. Choose one change filter per run. --staged or --changed-since <git-ref> reports only findings on changed lines (see Changed lines).
  • --fail-on contract|all sets the exit threshold. By default, performance, reliability, security and accessibility fail on displayed findings, and a full maintainability scan fails on contract violations. Changed-line maintainability scans fail on any displayed finding. Configured rule levels can change these defaults.
  • --min-impact <low|medium|high|critical> reports only findings at that level or above (see Impact levels).
  • --config <file>, --ignore <rule-id> and --workspace <name|path> are described under Configuration; --online adds the dependency checks.
  • --write-baseline [file] records the current findings and --baseline [file] reports only findings not recorded. The default file is loadwise-baseline.json in the checked directory, with one section per checker; the checker commands take the same flags and read or write only their own section. Entries match on rule, file and flagged code, with a count per entry so N recorded copies allow N findings. Refreshed JavaScript and TypeScript baselines also match after spacing changes and removal of optional statement-ending semicolons. Text output ends with N baseline findings hidden. and --json adds baselineHidden. A full comparison reports unmatched entries in baselineStale; a partial one, such as a changed-line or single-file scan, reports null. Refresh the baseline using its original scope and settings. Not combinable with --fix, and --write-baseline not with --staged or --changed-since. loadwise rel migrations keeps its own baseline.
Exit codes: 0 passed, 1 a checker met its exit threshold, 2 invalid input or configuration in any checker, a checker that produced no result, or a scan that skipped a file. A JavaScript or TypeScript file that does not parse, or whose analysis fails, is skipped while every other file is still reported; it is named on stderr and in a skippedFiles array of { file, reason } in --json output (also with --fix and --write-baseline). check keeps that checker’s findings, marks its SARIF run as not successful and emits a GitHub warning for each skipped file. A file that exists but cannot be read (the schema snapshot, package.json, a review directive) prints a note on stderr; an absent file stays silent. Projects and workspaces. The source checkers use the directory’s tsconfig.json or jsconfig.json. Without one, check looks for workspace packages (package.json workspaces, pnpm-workspace.yaml or lerna.json) and checks each one’s config in one report, grouped per package. When the root has a config that leaves some workspace packages out, such as a root jsconfig.json excluding packages, those packages are checked beside it the same way. A root config that lists every package or uses project references is checked on its own, and so is any root config under --watch. A package with a package.json and no config has its JavaScript and TypeScript sources inferred from the project inventory and checked with ES2022 and NodeNext defaults; a package split into admin/ and server/ folders with their own configs is checked through those configs, and any other package whose TypeScript sits under a sub-folder’s own tsconfig.json still needs a config at its root. When performance and reliability are selected together, they share a type-check unless a baseline is being written. A complete text scan with automatic fixes prints a scoped loadwise fix preview command when the fix command supports the scan filters. For specialized filters, review the individual findings and their checker-specific fix commands. Terminal watch. Run loadwise check --watch with the same checker, configuration and workspace options as an ordinary check. It groups rapid changes and runs one refresh at a time. Each result replaces the earlier snapshot, including findings removed by a file deletion. JSON writes one report per line, including _coverage when a checker is incomplete or inapplicable. Direct redirection to a regular file does not trigger a refresh. If another process writes the watch output, place its output file outside the watched directory. A failed refresh with no report writes a watchError object and waits for the next change. Use Ctrl+C to stop. The exit code reflects the latest refresh, or is 2 if a pending refresh was canceled. Watch supports text and JSON output. Git change filters, --review and --write-baseline are unavailable in watch mode. If watch cannot confirm that a checker tree stopped, it reports an error and exits 2. On Windows, forced tree cleanup requires a running worker and a successful operating-system tree stop. Cache. loadwise check reuses the previous result for an unchanged Git project from the loadwise folder of the OS cache directory. Any edit to a tracked or untracked (not ignored) file, a package install that rewrites node_modules, a different flag or a new Loadwise version runs a fresh scan; LOADWISE_NO_CACHE=1 always scans afresh. Fixes, --staged, --changed-since, --online and --write-baseline runs are never cached.
  • LOADWISE_SCAN_CACHE_DEBUG=1 reports a hit, miss or bypass per checker on stderr, with the active cache directory. Normal output and exit codes stay the same.
  • LOADWISE_SCAN_CACHE_ROOT accepts an absolute directory and stores scan reports in its scan-results subdirectory. Use separate roots to isolate project caches. Relative or unset values use the OS default. Keep the root under your control. Loadwise bypasses linked directories and checks ownership and permissions on platforms that expose them. On Windows, Loadwise relies on directory ACLs for access control without checking their permissions. Grant access only to accounts you trust to read or modify scan results. When the cache directory or a folder above it, such as a group-writable ~/.cache, is owned by another user or writable by group or others, the cache stays off and loadwise check prints one note on stderr naming that folder. Remove that write access or set LOADWISE_SCAN_CACHE_ROOT to a private folder. Editor scans skip the note.
  • LOADWISE_SCAN_CACHE_MAX_ENTRIES sets the number of reports retained per root. The default is 20. Positive integers are capped at 1,000. A successful cache write prunes Loadwise cache records by least recent use. Git-tracked files and files without the current cache marker stay in place. Older bare reports are left for the owner to clean up. The current cache format uses different keys so those files do not block new records.

CI and shareable check reports

  • loadwise check --format gitlab produces Code Quality JSON for GitLab’s artifacts:reports:codequality. It includes findings with repository-relative locations. Read stderr for coverage diagnostics. GitLab Code Quality
  • loadwise check --format junit produces JUnit XML for artifacts:reports:junit and other JUnit readers. Findings appear as failures and coverage gaps as skipped entries. Loadwise keeps the scan’s original exit policy. GitLab unit test reports
  • loadwise check --format checkstyle produces Checkstyle XML for consumers configured to import that report type. Review stderr for coverage gaps without a file location. Checkstyle result reports
  • Use --format markdown for a portable table or --format html for a standalone, offline report. Both include selected checker coverage, findings, and counts.
Crash reporting. Loadwise sends no crash reports by default. To opt in, put --report-crashes before a direct command, as in npx loadwise --report-crashes perf, or with check, as in npx loadwise check --report-crashes. You can also set LOADWISE_CRASH_REPORTS=1 (or true), which also applies to child checkers spawned by check. Setting LOADWISE_SENTRY_DSN also opts in and sends reports to that Sentry DSN instead; a malformed DSN sends nothing. Loadwise excludes errors it recognizes as normal usage or configuration failures (though some command-specific argument errors can still be reported). The report holds the Loadwise version, the command name, the Node.js version and platform, whether it ran in CI, the error type and stack frames inside the Loadwise package; it leaves out the error message. Without opt-in, an unexpected error prints how to enable reporting. Either way, the command exits 2. Memory. On large projects the checkers run with a larger Node memory limit, 60% of the machine’s memory, at least 4096 MB and at most 16384 MB (never below Node’s own default). A --max-old-space-size you set in NODE_OPTIONS is never overridden. Direct runs of loadwise perf, loadwise rel, loadwise maint, loadwise sec and loadwise a11y re-launch once when needed to apply the limit. If a checker still runs out of memory, check names it and the limit it had, tells you to raise it with NODE_OPTIONS=--max-old-space-size=<megabytes>, and exits 2. The native engine (--engine native) uses much less memory on most projects. A single config whose root files hold more than about 24 MB of source is analysed in several batches, grouped by package directory, instead of one program. A one-line note names the config and the batch count, --json output lists it in batchedConfigs ({ config, batches }) and SARIF carries a note-level notification. Cross-file findings between batches may be missing; the exit code is not affected, and project-wide schema-tooling advisories stay at their normal level for that config. Set LOADWISE_MAINT_WORKERS to a positive integer to limit maintainability analysis on a memory-constrained runner. Set it to 1 to scan in the main thread. When the variable is unset or empty, the scan permits up to eight workers, subject to available parallelism.

Node.js API

The loadwise package exports a typed scan() function for read-only checks from Node.js code:
scan() runs loadwise check --json from the same package in a child process, using the current Node.js executable. It accepts these options, all optional:
  • directory: the project to scan. Defaults to the caller’s working directory.
  • checkers: checker names or their short aliases, such as performance or perf. Passed as --only.
  • config: a configuration file, resolved relative to directory.
  • workspace: a list of workspace selectors, each passed as --workspace.
  • One Git scope: staged, uncommitted (booleans), or changedSince (a ref). Combining them returns invalid-input, as the CLI rejects the combination.
The function has no options for fixes, baselines or reviews. report holds the checker results and _coverage in the same format as loadwise check --json, and notes holds the CLI’s stderr. Check status before relying on the findings:
  • complete: every selected checker returned a report, or _coverage marks it not-applicable. exitCode is 0, or 1 when a checker met its exit threshold.
  • incomplete: the CLI exited with code 2, or a selected checker has no report and is not marked not-applicable. For example, a source checker with no project configuration can leave its report null while exitCode is 0. The result keeps the exit code, any report the CLI printed and the notes. When the CLI printed no JSON or unreadable JSON, report is null and exitCode is 2.
  • invalid-input: the options have the wrong types, directory is not an existing directory, or the CLI printed no report and rejects the arguments or configuration. exitCode is 2 and notes explains the problem.

Shell completion

Generate a script for Bash or PowerShell 7, then load it into the current session. The completions are registered for the loadwise command when it is available on your PATH.
Use Tab after a command or option. For example, loadwise check --cha suggests --changed-since and loadwise fix --only re suggests rel and reliability. File and directory suggestions use the shell’s local path completion. Generate the script again after upgrading Loadwise to pick up changes to commands and options.

Fixes

A preview prints the diff and a matching apply command when automatic edits are available. The existing --yes spelling also applies automatic fixes. Add --dry-run to preview an explicit write mode such as --all or --id. Run loadwise fix --interactive in a terminal to preview all hunks for each finding. Enter y to approve, n to skip, or a to approve the remaining automatic edits. Review-marked edits each need their own y. Enter q or end input to stop prompting and apply the approved edits. Scope, source and type checks still apply before writing. Use loadwise fix --patch > preview.diff to export the preview as a Git patch. Redirect stdout to a file or pipe when using --patch. Use --all for edits eligible for bulk application or --id for a specific finding. From the checked directory, verify it with git apply --check preview.diff. On the same source revision, applying the patch yields the same file bytes as a fix with the same selection and comment options and --no-format. For example, compare loadwise fix --only perf --patch > preview.diff with loadwise fix --only perf --apply --no-format. Patch export skips project formatting, and any diagnostics go to stderr. Add --record-reversal to an applied fix to save the exact evidence needed for reversal. This opt-in records the original text from the first edit through the last edit in each updated file before publishing any edits. The saved text can include unchanged content between edits. The completed fix prints a run ID. Run loadwise fix --reverse <run-id> [directory] to preview the inverse and add --apply to confirm. Each target must match its recorded postimage. A modified target, missing file, or incomplete receipt blocks the entire operation. Generated files are removed only when their contents still match. If a recorded apply or reversal is interrupted, or fails with files it could not restore, run loadwise agent history from the project directory to find its run ID and state, then preview the same reversal command. History lists --record-reversal runs even when it reports enabled: false. While the receipt state is applying, history lists the intended edits under planned. Recovery skips files already in their exact original state and refuses files that match neither recorded state. A successful reversal marks the receipt complete. The Python debugger pilot accepts loadwise fix --polyglot-preview <sha256> --id <finding-id>. Save the SHA-256 of the exact UTF-8 file bytes alongside the ID from a maintainability check. The command can preview replacing a lone breakpoint() with pass in a small module containing just one zero-argument function. It honors workspace and changed-line selections and checks the file and replacement with the same optional ast-grep parser. The pilot only previews the edit. Review whether the debugger or a custom breakpoint hook is intentional before editing. Use the same directory, project configuration, workspace, and changed-line selection when going from a scan to a fix:
--config <file> selects the project configuration. Repeat --workspace <name-or-path> to select packages. Use --uncommitted, --staged, or --changed-since <ref> to limit edits to changed lines. A generated edit that needs lines outside that scope is skipped as a whole. With --staged, a file that also contains unstaged edits is deferred because its working-tree line numbers can differ from the index. Fixes edit the working tree and leave staging to you. Prefix a directory that shares a checker name with ./, as in loadwise fix ./perf --dry-run. On combined commands, --only selects checkers. On fix, --id selects individual findings and --rule filters by rule. Repeat --id or pass comma-separated IDs to select several. Selecting a review-marked edit by ID authorizes that edit. Preview it with --dry-run. If any requested ID is missing, ambiguous, or cannot be applied, the selection exits with code 2 before writing edits. The direct checker spelling, such as loadwise perf --fix --only <id>, also works. Separate checker names (performance, reliability, maintainability, security, accessibility) with spaces. If you omit them, Loadwise uses the project’s configured checkers. fix lists manual changes and findings that need individual review by location and ID. An edit that touches lines reserved for review also needs individual review. Loadwise checks the remaining edits together before writing, and performance and security share a type check when both are selected. Exit code 0 means the fix run completed. Manual findings, review-marked edits, and refused bulk fixes can remain. Bulk fixes can defer overlapping edits and apply other eligible edits. If source text has changed before the first batch can be staged, the command exits with code 2 before writing that batch. A checker failure or a refused edit in an all-or-nothing apply, such as --id or --record-reversal, also exits with code 2. With --all, inspect the diff and run your tests, especially for schema changes and edits that alter behavior. fix --json includes dryRun, changedFiles, proposed or applied edits in applied, outstanding manual and review findings, refused fixes in notApplied, and follow-up instructions. In a preview, changedFiles counts files the edits would change. Bare loadwise fix and --dry-run show the generated edits before project formatting. Each applied JavaScript or TypeScript fix adds a // Loadwise <rule-id>: <why> comment above the fixed statement. By default Loadwise uses project-local Prettier with its configuration and .prettierignore. To allow a trusted project’s local Biome installation, set LOADWISE_ALLOW_BIOME=1 in the environment of the fix command. This permits Biome to run with your account permissions while Loadwise prepares edits, including the probe that determines whether a file is excluded. Loadwise requires the Biome launcher and its packaged platform binary to resolve inside the formatting root. Biome and Prettier each get a separate two-minute budget. Loadwise runs the platform binary directly and skips Biome when a custom BIOME_BINARY override is set. A later refusal can still leave the edits unapplied. Loadwise looks for Biome and its config between the file and the formatting root, prefers Prettier when both tools are installed in the same package, and keeps the unformatted fix if Biome would change unrelated lines. Use --no-format to skip all project formatters, including probes. --no-comments and --no-format disable comments and formatting for both fix and per-checker --fix. fix also takes repeatable --rule <rule-id> filtering and --no-verify-types (skip the post-edit TypeScript check). Maintainability --fix limits edits to the checked project. Performance, reliability, security, and accessibility --fix use the containing Git repositories of the checked projects or explicitly named source files, so fixes can include shared files such as a schema at a monorepo root. Outside a Git repository, they use the project root. Per-checker fixes refuse hard-linked files and symbolic links that are dangling or resolve outside those limits. Existing files keep their permissions when replaced. Some transformations always need individual review: making a locally used constant private can affect consumers outside the scan; sharing a private helper between sibling TypeScript modules changes the files included in the build; narrowing a whole-table Drizzle update to rows with differing values can affect locking, triggers and affected-row counts; an upload size limit (the 10 MiB default, or the rule’s configured maxBytes, can reject valid uploads, so check existing gateway or Multer limits); and the Mongoose .lean() rewrite, because a lean result skips schema defaults, getters and virtuals. For private TypeScript applications that control their consumers, npx loadwise fix --all --recipe verified-private-types also makes locally used type declarations private, after checking the edits with the bundled TypeScript compiler; omit it when other repositories import your types. A local CommonJS recipe encodes your own policy for a manual finding, run alongside the built-in fixes with npx loadwise fix --all reliability --recipe ./loadwise-fixes.cjs:
Keys are perf, rel, maint, sec or a11y followed by / and the rule ID. A handler receives the finding and the source file text and returns exact, whole-line replacements in that file, or null to leave the site manual. Recipes run only where there is no built-in fix, and their edits are validated together before writing. Explicitly supplied recipe files execute as local JavaScript during both preview and apply. Use only trusted recipes and keep handlers free of side effects.

Per-checker fixes and dismissals

The source-check commands (perf, rel, maint, sec and a11y on a project or files, not subcommands such as perf traces, rel migrations or sec deps) take --fix (asks yes, no, all remaining or quit for each fix; needs a terminal), --fix --yes (applies eligible fixes without asking) and --fix --only <id>[,<id>...] (applies exactly those fixes, no prompt or terminal needed). With --json, --only prints { applied, alreadyApplied, failed }: an id whose change an earlier id already made, such as a shared Set, is in alreadyApplied; an unknown id, a finding without a fix or a stale fix is in failed and the exit code is 2. --fix cannot be combined with --watch or --graph, or with --json except with --only, and --yes is valid only with --fix. A fix applies only where the original lines still exist and never overwrites an existing file. With --json, a fix is fix = { changes: [{ file, line, before, after, create? }], note? }, where create holds a whole new file such as a migration; findings also carry fixable. The id hashes the rule, the file and the flagged line’s text, so it survives edits above the finding. If identical findings occur in differently named JavaScript or TypeScript declarations, the ids also hash those names. Remaining collisions receive numbered suffixes. To keep an intentional site, put a comment on its own line immediately before the diagnostic line (line 1 for a whole-file finding such as large-module), naming one exact rule and a reason. The comment makes every eligible finding of that rule on the diagnostic line contextual, including findings introduced by later edits to that line. Use --include-contextual to see those findings. Declared contracts (CI contract rules, file-placement, folder-boundary, data-access-boundary, query-mutates-state, configured row scopes) and Prisma transaction-client escapes and read-modify-write findings cannot be lowered this way.

Changed lines

These report only findings on changed lines, each with its id, the exact --fix --only <id> command when an automatic fix exists, and the loadwise-reviewed comment that dismisses it. --json keeps the usual shape, filtered, and the exit code is 1 when findings remain. With no changed supported source files the command exits 0 before TypeScript loads. Only the changed files are analysed as roots while imports still resolve through the project; untracked files count as fully changed with --changed-since, and a file with unstaged edits can report lines that differ from the staged version. schema.prisma findings are not part of this mode. The direct perf, rel, sec and a11y source commands accept these Git filters when scanning a project. Use the unified fix command to keep the same filter when applying an edit, for example loadwise fix --staged --only perf --id FINDING_ID. Maintainability also supports loadwise maint --staged --fix --only FINDING_ID and the equivalent --changed-since form. For maintainability, a JS/TS function-level finding (high-branch-complexity, deep-control-flow) is kept when a changed line falls anywhere inside its function, and --fail-on defaults to all. When at least 600 files changed, the full scan runs and is filtered to the changed lines; otherwise duplicate-implementation is skipped and dependency-cycle only sees cycles made of the changed files’ imports.