@brunobrise/xfeat is an automated, AI-driven CLI engine that deeply analyzes your codebase to extract product-level features, component architectures, and global system scopes. By combining precise AST-based structural parsing (via web-tree-sitter) with the reasoning capabilities of Anthropic's Claude Sonnet 4.6, this tool auto-generates comprehensive, human-readable documentation of what your code actually does.
- AST-Powered Parsing: Fast and accurate structural footprint generation (classes, functions, exports, imports) for modern ecosystem languages.
- Agentic Source Code Reading: Rather than guessing based off function identifiers, the AI utilizes a specialized
view_filetool to selectively dive into the raw source code wherever AST context is insufficient. - Automated Mermaid Diagrams: Visually maps out how files interact at macro and global architecture levels.
- Structured Markdown Deliverables: Produces a neat, hierarchical
FEATURES.mdreport encompassing everything from the executive summary to granular file logic. - Smart Directory Traversal: Adheres to your local
.gitignoreand optional custom.xfeatignorerules to avoid processing build artifacts and generic dependencies.
The engine executes in an expanding 4-stage pipeline:
-
AI Pre-filtering (Stage 0):
- Interactively requests permission to AI-filter the target files.
- Cleans the file list by intelligently removing trivial boilerplate, config files, and UI assets dynamically, saving time and tokens.
-
Micro Analysis (File-Level):
- Identifies granular structural signatures across source files.
- Leverages an LLM sub-agent loop to request file contents as needed.
- Outputs 1-2 sentence overviews alongside high-level feature bullet points for each file.
-
Macro Analysis (Component-Level):
- Groups files logically by their enclosing directory.
- Synthesizes isolated file summaries into a curated Component Summary.
- Generates localized Mermaid.js flow/architecture diagrams per directory.
-
Global Analysis (System-Level):
- Ties localized component summaries together into a master architecture overview.
- Documents the core pillars and overarching domain of the application.
- Renders a highly-abstracted global Mermaid architecture diagram representing the entire system interaction.
You can run @brunobrise/xfeat directly via npx without installing it globally:
npx @brunobrise/xfeatCreate a .env file at the root of the project to define your API authorization:
# Required: Your Anthropic API Key
ANTHROPIC_API_KEY="sk-ant-..."
# Optional Environment Overrides
ANTHROPIC_AUTH_TOKEN=""
ANTHROPIC_BASE_URL=""
CLAUDE_CODE_SUBAGENT_MODEL="claude-sonnet-4-6"You can scan the immediate working directory, or pass a relative/absolute path to dynamically scan another repository on your machine.
npx @brunobrise/xfeatnpx @brunobrise/xfeat /path/to/your/custom/projectFor developers contributing to this tool, standard npm scripts are available:
npm run dev— Hot-reloads the analysis script using Nodemon.npm run lint— Analyzes the source using ESLint against best practices.npm run format— Standardizes code styling uniformly with Prettier.
The script concludes by generating a structured FEATURES.md record at your execution root. Inside, you can expect:
- Global Architecture Overview (Executive Summary, Application Pillars, Main System Diagram)
- Component Breakdown (Directory-by-Directory Insights, Narrow Context Diagrams)
- File-Level Details (Deeply granular feature lists)
The foundational Tree-sitter AST parser natively understands:
- JavaScript (
.js,.jsx) - TypeScript (
.ts,.tsx) - Python (
.py) - Rust (
.rs) - Go (
.go) - Java (
.java) - PHP (
.php)
This tooling is open-sourced under the MIT License.
Built organically with the Anthropic SDK and Tree-sitter.