@archlinter/cli

中文文档
0.17.1发布于 2026/08/11MIT零依赖构建来源已验证近 30 天下载 4.4万

Fast architecture smell detector for TypeScript/JavaScript

原始使用文档
文档目录21 节
  1. Why archlint?
  2. Features
  3. 30+ Architectural Smell Detectors
  4. Framework Intelligence
  5. Output Formats
  6. Developer Experience
  7. Installation
  8. Using npm (Recommended)
  9. From source
  10. Quick Start
  11. Basic scan
  12. With configuration
  13. Watch mode for development
  14. Export report
  15. Filter by severity
  16. Run specific detectors
  17. Exclude detectors
  18. Configuration
  19. Available Detectors
  20. License
  21. Credits

archlint logo

archlint

Fast, AST-based architecture smell detector for TypeScript/JavaScript projects

License: MIT Rust

A powerful CLI tool for detecting 30+ types of architectural smells in TypeScript/JavaScript codebases. Built with Rust and oxc parser for maximum performance.

Why archlint?

Modern codebases grow complex fast. archlint helps you:

  • 🔍 Detect architectural problems early before they become technical debt
  • 🎯 Framework-aware analysis with presets for NestJS, Next.js, React, oclif
  • ⚡ Blazingly fast - analyzes 200+ files in under 5 seconds
  • 📊 Actionable insights - clear explanations, severity scores, and refactoring recommendations
  • 🔄 Watch mode for real-time feedback during development
  • 🧠 Smart caching for instant re-runs

Features

30+ Architectural Smell Detectors

Dependency & Structure Issues:

  • Cyclic dependencies (file-level and type-level)
  • Hub modules (too many connections)
  • God modules (doing too much)
  • Dead code (unused exports)
  • Orphan types (disconnected from codebase)

Design Quality Issues:

  • Low cohesion (LCOM metric)
  • High coupling
  • Layer violations (domain/application/infrastructure)
  • SDP violations (Stable Dependencies Principle)
  • Feature envy, shotgun surgery

Code Organization Issues:

  • Barrel file abuse
  • Scattered modules/configs
  • Primitive obsession
  • Long parameter lists
  • Deep nesting

Framework-Specific Issues:

  • Test leakage (test code in production)
  • Side-effect imports
  • Vendor coupling
  • Unstable interfaces
  • Shared mutable state

Framework Intelligence

Built-in presets that understand framework patterns:

  • NestJS: Knows controllers are entry points, modules can have high coupling
  • Next.js: Understands pages/API routes, relaxes barrel file rules
  • React: Aware of component patterns, skips irrelevant checks
  • oclif: Recognizes CLI commands and hooks

Output Formats

  • Table (default) - clean terminal output with colors
  • Markdown - detailed reports with Mermaid dependency graphs
  • JSON - machine-readable for CI/CD integration

Developer Experience

  • Watch mode with debouncing for live feedback
  • Smart caching using content hashes
  • Severity filtering (low/medium/high/critical)
  • Selective detector runs (include/exclude specific checks)
  • Git integration for churn analysis
  • CI-friendly quiet mode

Installation

npm install -g @archlinter/cli
# or use without installation
npx @archlinter/cli scan

From source

git clone https://github.com/superprotocol/archlint.git
cd archlint
cargo build --release
cargo install --path crates/archlint

Quick Start

Basic scan

archlint scan ./my-project

With configuration

archlint scan ./my-project --config .archlint.yaml

Watch mode for development

archlint watch --debounce 500 --clear

Export report

# Markdown with diagrams
archlint scan ./my-project --format markdown --report architecture-report.md

# JSON for CI/CD
archlint scan ./my-project --format json --report report.json
# Or use the shorter --json flag
archlint scan ./my-project --json --report report.json

Filter by severity

archlint scan --min-severity high

Run specific detectors

archlint scan --detectors cycles,god_module,dead_code

Exclude detectors

archlint scan --exclude-detectors barrel_file,lcom

Configuration

Create .archlint.yaml in your project root:

# Files/directories to ignore
ignore:
  - '**/node_modules/**'
  - '**/dist/**'

# Path aliases (from tsconfig.json)
aliases:
  '@/*': 'src/*'

# Entry points (won't be marked as dead code)
entry_points:
  - 'src/main.ts'

# Rule-specific configuration
rules:
  cycles: high

  god_module:
    severity: high
    fan_in: 15
    fan_out: 15
    churn: 20

  layer_violation:
    severity: high
    layers:
      - name: domain
        path: '**/domain/**'
        allowed_imports: []
      - name: application
        path: '**/application/**'
        allowed_imports: ['domain']

  complexity:
    max_complexity: 15

# Rule overrides for specific paths
overrides:
  - files: ['**/tests/**']
    rules:
      complexity: off
      god_module: off

# Scoring and grading settings
scoring:
  minimum: medium
  weights:
    critical: 100
    high: 50
    medium: 20
    low: 5

# Framework preset
extends: nestjs

Available Detectors

Run archlint detectors list to see all detectors with descriptions.

IDNameDefault Enabled
cyclesCircular Dependencies✅
god_moduleGod Module✅
dead_codeDead Code✅
layer_violationLayer Violation⚠️
complexityHigh Complexity✅
.........

→ See full list of detectors

License

MIT License - see LICENSE for details.

Credits

版本与发布记录

@archlinter/cli 共发布 43 个版本,首次发布于 2026/01/02;过去 12 个月发布了 43 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.17.1latest2026/08/112 个月前
0.16.02026/01/179 个月前
0.15.1-canary.1canary2026/01/179 个月前
0.15.0-canary.12026/01/169 个月前
0.15.12026/01/169 个月前
0.15.02026/01/169 个月前

其他发布通道:alpha → 0.6.0-alpha.1,canary → 0.15.1-canary.1。

关于 @archlinter/cli 的常见问题

@archlinter/cli 是什么?

Fast architecture smell detector for TypeScript/JavaScript

如何安装 @archlinter/cli?

在项目目录运行 npm install @archlinter/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 archlint,可以用 npx archlint 直接运行。

@archlinter/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/archlinter__cli 是否存在。

@archlinter/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@archlinter/cli 可以商用吗?

@archlinter/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@archlinter/cli 的下载量有多少?

根据 npm 官方下载统计,@archlinter/cli 在 2026/10/07 – 2026/11/05 这 30 天内被下载 43,802 次,日均约 1,460 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@archlinter/cli 还在维护吗?

最新版本 0.17.1 发布于 2026/08/11(2 个月前);至今共发布 43 个版本,其中过去 12 个月发布了 43 个;首次发布于 2026/01/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。