stratum
agent
Uyari
Health Uyari
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 6 GitHub stars
Code Uyari
- fs module — File system access in .github/workflows/bench.yml
- process.env — Environment variable access in ci/github/action.yml
- network request — Outbound network request in ci/github/action.yml
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
Architecture linter for AI coding agents and CI. Any architecture via config.
README.md
Stratum
A universal architecture linter for TypeScript, JavaScript and Vue.
Fast enough to run on every edit, written for AI coding agents and CI.
Why Stratum
- Any architecture. Layers, slices, segments and private zones come from your config or a preset (
stratum:recommended,stratum:fsd). No folder name is wired in. - 24 rules out of the box. Cross-layer imports, cycles, public API bypass, sibling coupling, import policies, restricted calls, folder structure, unused exports and unreachable modules. Custom rules in Rhai, no rebuild.
- Every finding says what to do. Each one carries a
fix, so an agent repairs it without asking. - Fast. Rust, a graph cache and a git-aware scope: about 0.15 s for the changed files of a 4,000-module project. Works offline.
- Adopt on a legacy codebase.
baselineaccepts what exists today in a one-line-per-entry file; later runs report only new violations, anddiff --base mainshows what a merge request changes. - See it.
stratum-lint visualizeopens the dependency graph, the layer matrix and the C4 architecture in the browser.
Quick start
npm install -g @petukhovart/stratum-lint
stratum-lint init # write a config inferred from your folders
stratum-lint --changed --format agent # check what you changed
stratum: 9 errors, 2 warnings, 27 info, 0.08s
error stratum/public-api (1) - stratum-lint explain stratum/public-api
src/features/checkout/model/discount.ts:1 -> src/features/add-to-cart/model/use-add-to-cart.ts Import of `src/features/add-to-cart/model/use-add-to-cart.ts` reaches inside `src/features/add-to-cart`
fix: Import from `src/features/add-to-cart` through its entry `src/features/add-to-cart/index.ts`, exporting the name there if it is missing.
warning stratum/no-cross-layer-import (1) - stratum-lint explain stratum/no-cross-layer-import
src/shared/lib/analytics.ts:1 -> src/entities/user/index.ts Module imports from layer 'entities' which 'shared' does not depend on
fix: Move the imported symbol into a layer 'shared' may reach, or add 'entities' to 'shared'.depends_on if the dependency is legitimate.
Integrations
Stratum is a standalone CLI and LSP server; every integration below is optional.
| Where | How |
|---|---|
| Claude Code | the stratum plugin; optional warm diagnostics through stratum-lsp |
| Codex, Cursor, other agents | paste docs/agents-snippet.md into AGENTS.md |
| GitLab, GitHub CI | native report formats and a baseline check: docs/ci.md |
| Any tool | the JSONL contract and exit codes: docs/harness.md |
| jig | runs Stratum after each edit and blocks the end of a turn while new errors remain |
- npm, all platforms:
npm install -g @petukhovart/stratum-lint(shipsstratum-lintandstratum-lsp) - Windows (x64, arm64):
scoop bucket add stratum https://github.com/PetukhovArt/scoop-stratum-bucket, thenscoop install stratum-lint - macOS, Linux (x64, arm64):
brew tap petukhovart/stratum, thenbrew install stratum-lint - From source:
cargo install --path crates/stratum-lintandcargo install --path crates/stratum-lsp
Source files: .ts .tsx .mts .cts .js .jsx .mjs .cjs .vue (Vue: <script> and <script setup>).
stratum-lint rules lists the active ones; stratum-lint explain <slug> prints what, why, fix and options.
| Rule | Reports |
|---|---|
stratum/no-cross-layer-import |
An import from a layer outside the importer's own layer and its depends_on. |
stratum/no-circular-deps |
Every import cycle, one violation per cycle. |
stratum/purity |
A module importing a less pure one (// @stratum-purity N, 1 pure to 4 side effects, default 2). |
stratum/visibility-scope |
An import into a private-zone folder from outside that folder's parent. |
stratum/public-api |
An import from outside a slice, sub-unit or nested container that bypasses its entry file. |
stratum/sibling-isolation |
An import between two slices or sub-units that share a parent container. |
stratum/import-policy |
Imports denied by from / deny / allow / slice globs declared in config. |
stratum/reachability-policy |
A module matching deny that a from file reaches through a chain of imports, with the chain. |
stratum/co-change |
On a diff (--changed, diff --base): a changed file matching when without any changed file matching require, in the same slice directory when the policy sets one. |
stratum/restricted-calls |
A call to a listed function outside the files its policy allows. |
stratum/stage-mixing |
A container holding segment folders next to sub-unit folders or other plain domain folders. |
stratum/container-breadth |
A folder holding too much directly inside it: more than max_kinds kinds in a container, more than max_items items in a segment, collection or sliced layer root, more than max_root_files files at a composer's root. |
stratum/zone-breadth |
A private zone with more than max_kinds kinds of children. |
stratum/missing-entry |
A folder with segment or private-zone children but no entry file. |
stratum/unclaimed-folder |
A folder directly in a layer listed in layers that no declared layer, private zone, segment or allow glob claims, so it silently gets that layer's depends_on. |
stratum/no-barrel |
An entry file that only re-exports (barrel) inside a segment folder, or at the root of a layer listed in layers. |
stratum/composer-scope |
A stage-4 composer whose private zone has no file matching scope_file. |
stratum/naming |
A folder name outside folder_case, listed in reserved, or a duplicate or plural slice name. |
stratum/module-docs |
A navigation doc (nav_file) missing, misplaced, or contradicting the folder's imports. |
stratum/unused-exports |
An export that no module reachable from project.entry_points imports. |
stratum/unreachable-modules |
A module that no file in project.entry_points reaches. |
stratum/unused-dependencies |
A package.json dependency nothing imports, or an imported package package.json does not declare. |
stratum/suppression |
A stratum-ignore directive without a reason or with an unknown slug, or one that suppresses nothing; with forbid, a foreign directive such as eslint-disable or @ts-ignore. |
stratum/slice-fan-in |
A slice imported by more than max_fan_in other slices. |
stratum/miller-limit |
A module with more than max_children importers from outside its slice (else its layer) whose layers may import it. |
stratum/promotion-pressure |
A module with at least threshold importers from outside its slice (else its layer) whose layers do not declare its layer: a candidate for a lower layer. |
stratum/deep-module |
A module exporting more than max_exports names. |
stratum/depth-ratio |
A module whose ratio of modules in its slice (else its layer) to its exports is below min_ratio. |
Docs
Configuration · Rules and options · Visualizer · Agent contract · CI · Glossary · Changelog
MIT © Artem Petukhov
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi




