loadwise maint finds code that would benefit from a design review and enforces the architectural decisions a team has already made. Run it on a project folder with npx loadwise maint ., or npx loadwise maint . --json. The default --fail-on contract exits 1 only for a declared folder, data-access or query contract violation; design advisories stay visible and exit 0 on their own. A non-JavaScript file a native parser cannot read and missing required parser binaries exit 2. Contextual findings include documented independent test oracles, before/after source snapshots with a live counterpart, marked generated code, certain flat data mappings and literal message lists, and a Nest module cycle whose internal eager edges are all explicit forwardRef callbacks (not available for graph input).
What gets checked
data-access-boundary(medium): A file outside the approved paths imports a configured database driver or ORM.deep-control-flow(low): Control structures are nested four levels deep.dependency-cycle(high): An eager chain of internal imports leads back to the module it started from.deprecated-node-api(medium): A deprecated Node.js API is used: new Buffer(), url.parse() or fs.exists().double-type-assertion(low): A value is cast through unknown or any to a second type, bypassing the type checker.duplicate-implementation(medium): Substantial functions share the same implementation.explicit-any(low): An explicit any type turns off type checking for a value.file-placement(low): A file with a configured suffix sits outside its allowed folders.focused-test-committed(medium): A committed .only, only: true, fit or fdescribe can make the test runner skip other tests.folder-boundary(medium): An import crosses a folder boundary the team declared.high-branch-complexity(medium): A function reaches a branch complexity score of 15.large-class(low): A class has more than 30 methods, accessors, constructors or function-valued fields.large-module(low): A file has more than 600 lines of code.long-parameter-list(low): A function takes more than 5 positional parameters.python-interactive-debugger(medium): A Python call enters an interactive debugger in production source.query-mutates-state(medium): A method marked @maintainabilityQuery writes through this.stray-console(low): A console call in production code bypasses the logger, so its output has no level or structure.ts-suppression-without-reason(low): A @ts-ignore, @ts-expect-error or @ts-nocheck directive has no explanation.tsconfig-strict-disabled(medium): A tsconfig turns off strict type checking.unreferenced-file(low): A source file that nothing imports and that is not an entry point.unsafe-wide-type(low): A Function, Object or {} type accepts almost any value, so the compiler checks little.unused-export(low): An export that no scanned file imports.unused-import(low): An imported name is never used in the file.unused-local-function(low): A private function declaration has no references.unused-local-variable(low): A local variable is assigned but never read.
.h file uses the C grammar). Direct import extraction is provided for JS/TS: it resolves project-local modules and TypeScript paths and ignores type-only imports. Discovery uses tracked and nonignored untracked Git files where available and a directory walk elsewhere, skipping dependency directories and minified files; build, dist, coverage, target and vendor are skipped only at the scanned root or beside a project manifest such as package.json.
Project rules
Save team decisions in themaintainability section of loadwise.config.json at the project root, or pass --config path/to/policy.json.
limits sets the thresholds of large-module, large-class and long-parameter-list (positive integers; the values shown are the defaults). dataAccess restricts runtime imports of named packages, their subpaths, module aliases (#models, @/db) or project-local entry points (starting with ./, matched by resolved file) to the paths in allowIn; both lists are required and nonempty, type-only imports are not reported, and findings are contract violations. Paths are project-relative, directory boundaries match complete segments, and the longest matching filename suffix wins.
A module graph in any language
"kind": "deferred" for an edge that loads lazily. Graph mode operates entirely on the supplied inventory and edges, for a graph from a compiler, build system or dependency extractor.