@fmatar/archlens-skill

中文文档
1.1.3发布于 2026/11/15Apache-2.0ES Module零依赖近 30 天下载 2386

Cross-platform CLI and installer for Archlens Clean Architecture governance policies and AI assistant skills

原始使用文档
文档目录14 节
  1. ⚡ Quickstart
  2. Option A: Zero-Touch Autonomous AI Setup ( --mcp — Recommen…
  3. Option B: Install AI Assistant Skills Directly via npx skil…
  4. Option C: Run Interactive Policy Scaffolder via NPX
  5. Option D: Install Globally via NPM
  6. Option E: Run from Local Repository Clone
  7. 🚀 Key Features
  8. 🛠️ Usage & CLI Reference
  9. Common Workflows
  10. Command-Line Options
  11. 📁 Artifacts Generated
  12. Visualizing in Archlens Workbench
  13. 🧪 Testing
  14. 📄 License

@fmatar/archlens-skill

npm version License Node

Zero-dependency CLI, policy scaffolder, and multi-agent skill installer for the Archlens Dynamic Clean Architecture Workbench.

Analyzes any project repository, detects programming languages and package hierarchies, classifies packages into concentric Clean Architecture tiers, scaffolds .archlens/policy.json, and equips AI coding assistants (Claude Code, Gemini CLI, Google Antigravity) with mailbox refactoring protocols.


⚡ Quickstart

Equip Google Antigravity, Claude Code, Claude Desktop, Cursor, Windsurf, and Gemini CLI in one command. Choose the portable NPX stdio bridge (with 4-tier offline AST fallback) or an ephemeral Docker mcp-stdio container:

# Portable / shared-repo setup (.archlens/policy.json + AGENTS.md + skills + NPX MCP bridge):
npx @fmatar/archlens-skill --yes --skills --mcp

# Personal workstation setup (ephemeral docker run -i --rm -e QUARKUS_PROFILE=mcp-stdio container):
npx @fmatar/archlens-skill --yes --skills --mcp --docker

# Equip global skills AND global MCP manifests across all detected coding agents:
npx @fmatar/archlens-skill global
npx @fmatar/archlens-skill global --docker

Option B: Install AI Assistant Skills Directly via npx skills

Using the open Vercel Labs Skills standard, you can add Archlens capabilities across 15+ AI coding assistants (Claude Code, Cursor, Antigravity, Copilot, Codex, Windsurf, Zed):

# Add all 3 Archlens skills to detected AI assistants in project or globally:
npx skills add fmatar/archlens --all -y

# Or add to a specific assistant:
npx skills add fmatar/archlens --all --agent claude-code -y

Option C: Run Interactive Policy Scaffolder via NPX

# Production Stable (recommended)
npx @fmatar/archlens-skill

# Canary / Development Preview (tracks latest develop branch)
npx @fmatar/archlens-skill@dev

# Direct GitHub Execution (zero registry dependencies)
npx github:fmatar/archlens

Option D: Install Globally via NPM

npm install -g @fmatar/archlens-skill
archlens-skill

Option E: Run from Local Repository Clone

# Install globally from the local repository:
npm install -g ./cli
archlens-skill

# Or execute directly with Node:
node ./cli/bin/index.js

🚀 Key Features

  • Zero External Dependencies: Engineered with pure Node.js standard libraries (node:fs, node:path, node:readline, node:test, node:os). Executes immediately via npx without latency.
  • Interactive Terminal UI: Displays styled ANSI diagnostics, ASCII branding banner, and interactive guided choices when run in a terminal.
  • Polyglot Codebase Analyzer: Auto-detects project language and layout across Java, Kotlin, TypeScript, JavaScript, Python, Rust, Go, and Clojure.
  • Concentric Tier Classification: Maps packages automatically to Clean Architecture layers:
    • Level 0 (Domain Core): domain, model, entities, core, types
    • Level 1 (Application): usecase, application, service, port, interactor
    • Level 2 (Adapters): adapter, controller, gateway, presenter, repository, dto, api
    • Level 3 (Infrastructure): infrastructure, config, db, web, server, client
  • Multi-Agent Skill Deployment: Installs the archlens-install-policy skill globally into Claude Code (~/.claude/skills/), Gemini CLI / Antigravity (~/.gemini/config/skills/), and custom agent workspaces.
  • Safe Incremental Updates: Re-scans codebases for newly introduced packages, updating order and levels while preserving user custom rules and configurations.
  • Seamless Upgrade Migration: Automatically migrates legacy .uml-viewer/ folders and companion files to modern .archlens/ via archlens-skill upgrade.
  • Model Context Protocol (MCP) Client Auto-Configuration: Detects and configures host AI client manifests (Claude Desktop, Google Antigravity, Claude Code, Cursor, VS Code) in a single command (--mcp).
  • On-Demand Container Orchestration & Stdio Bridge: Automatically spins up the Archlens container when needed, bridges MCP over stdio (mcp command), and provides an instant offline AST fallback if Docker is unavailable.
  • Mailbox Protocol Integration: Injects the Clean Architecture Companion Protocol into CLAUDE.md and AGENTS.md for seamless asynchronous mailbox refactoring (to-agent.json, to-viewer.json).

🛠️ Usage & CLI Reference

Common Workflows

1. Interactive Setup Wizard

Guides you through repository inspection and option selection:

npx @fmatar/archlens-skill

2. Headless Local Initialization

Initializes Clean Architecture governance in the current repository with default settings:

npx @fmatar/archlens-skill --yes

Target a specific repository directory:

npx @fmatar/archlens-skill --path /path/to/project --yes

3. Global AI Agent Skill & MCP Installation

Deploys skills and global MCP manifests so Claude Code, Gemini CLI, and Antigravity are equipped across all workspaces (pass --docker for ephemeral container mode or --no-mcp to skip MCP setup):

npx @fmatar/archlens-skill global
npx @fmatar/archlens-skill global --docker

4. Synchronize Existing Policy

Re-scans code after adding new modules or packages to incorporate them into .archlens/policy.json:

npx @fmatar/archlens-skill update

5. Upgrade Legacy Configuration

Migrates older .uml-viewer/ directories and companions to the standard .archlens/ layout:

npx @fmatar/archlens-skill upgrade

6. Export LLM Refactoring Prompt Dossier

Generates copy-ready architectural diagnostics and concrete Dependency Inversion Principle (DIP) instructions for Claude Code, Gemini, ChatGPT, or Antigravity:

# Print dossier to stdout
npx @fmatar/archlens-skill prompt

# Or copy directly to system clipboard
npx @fmatar/archlens-skill prompt --copy

7. Model Context Protocol (MCP) Setup & Stdio Bridge

Configures detected AI client manifests or launches an interactive stdio bridge:

# Auto-configure Claude Desktop, Google Antigravity, Claude Code, Cursor, and VS Code
npx @fmatar/archlens-skill --mcp

# Auto-configure pure ephemeral Docker MCP container (docker run -i --rm -e QUARKUS_PROFILE=mcp-stdio)
npx @fmatar/archlens-skill --mcp --docker

# Launch MCP stdio transport bridge (spins up Docker container automatically when needed)
npx @fmatar/archlens-skill mcp

8. Start Workbench Container & Auto-Resurrection

Starts the Archlens container, mounts the workspace, verifies readiness, and optionally opens your browser. If the container is killed or stopped, running start (or calling an MCP tool) automatically starts it again:

# Start container and automatically open workbench in browser:
npx @fmatar/archlens-skill start --open

# Start container in background on default port 8088:
npx @fmatar/archlens-skill start

# Specify a custom port or target workspace directory:
npx @fmatar/archlens-skill start --path /path/to/project --port 8088 --open

Command-Line Options

Flag / CommandShorthandDescriptionDefault
check--checkRun headless Clean Architecture CI quality gate
startStart Archlens Workbench (Native Binary / JAR / Docker fallback)
prompt--promptExport LLM Refactoring Prompt Dossier
mcpRun MCP stdio server bridge (online + offline static fallback)
update--update, -uRe-scan code and update existing .archlens/policy.jsonfalse
upgrade--upgradeMigrate legacy .uml-viewer to .archlensfalse
global--global, -gInstall skills into global agent directoriesfalse
--max-violations <N>Maximum allowed outward layer violations in check0
--detect-cyclesFail check if package dependency cycles (ADP) are detectedfalse
--screaming-threshold <N>Minimum Screaming Architecture Score (0.0–1.0)
--suggest-featuresSuggest Screaming Architecture feature slice clusters in checkfalse
--fitness-threshold <N>Minimum Composite Architecture Fitness Index (0.0–1.0)
--format <FMT>Output format for check (text, json, sarif)text
--output <FILE>-OWrite check output report (e.g. SARIF) to file
--nativeForce native JVM runner mode on startfalse
--dockerForce Docker container mode on start or configure ephemeral mcp-stdio manifests with --mcpfalse
--jar <PATH>Custom path to quarkus-run.jar for native modeAuto-detected
--open-oOpen visual workbench in default browser upon startupfalse
--port <PORT>Workbench HTTP port8088
--path <DIR>-pTarget repository directory. (current directory)
--title <NAME>-tProject title in visual workbenchFormatted folder name
--prefix <PKG>Common package prefix (e.g. com.example.service)Auto-detected
--server-url <URL>Visual Workbench server endpointhttp://localhost:8088
--mcp-mAuto-configure MCP client manifests (Claude, Antigravity, Cursor, Gemini, Grok, Windsurf, VS Code)false
--copy-cCopy LLM prompt output directly to system clipboardfalse
--force-fOverwrite existing configuration filesfalse
--dry-runSimulate execution without writing filesfalse
--yes-yAccept defaults automatically (non-interactive)false
--version-vDisplay package version
--help-hDisplay help reference

📁 Artifacts Generated

Running the installer creates the following governance structure:

my-project/
├── .archlens/
│   ├── policy.json             # Clean Architecture concentric tiers & rules
│   └── workbench.config.json   # Workbench endpoint and mailbox IPC configuration
├── CLAUDE.md                   # Clean Architecture Mailbox companion protocol
└── AGENTS.md                   # Agent instructions for DIP refactoring & AST reload

Visualizing in Archlens Workbench

Once configured, launch the Archlens workbench and open your project:

http://localhost:8088/?projectRoot=/absolute/path/to/my-project

Or open the visual workbench and press ⌘O / Ctrl+O to browse and select your project root.


🧪 Testing

Execute the test suite with Node's native test runner:

npm test

📄 License

Apache-2.0 © Fady Matar

版本与发布记录

@fmatar/archlens-skill 共发布 25 个版本,首次发布于 2026/09/26;过去 12 个月发布了 25 个版本。

版本发布日期距今
1.1.3latest2026/11/151 天前
1.1.3-dev.66dev2026/11/151 天前
1.1.2-dev.652026/11/141 天前
1.1.22026/11/141 天前
1.1.2-dev.642026/11/141 天前
1.1.1-dev.632026/11/141 天前

关于 @fmatar/archlens-skill 的常见问题

@fmatar/archlens-skill 是什么?

Cross-platform CLI and installer for Archlens Clean Architecture governance policies and AI assistant skills

如何安装 @fmatar/archlens-skill?

在项目目录运行 npm install @fmatar/archlens-skill,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 archlens-init、archlens-skill,可以用 npx archlens-init 直接运行。

@fmatar/archlens-skill 支持 TypeScript 吗?

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

@fmatar/archlens-skill 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@fmatar/archlens-skill 需要什么版本的 Node.js?

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

@fmatar/archlens-skill 可以商用吗?

@fmatar/archlens-skill 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@fmatar/archlens-skill 的下载量有多少?

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

@fmatar/archlens-skill 还在维护吗?

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