@brunobrise/xfeat 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve the analysis
4
+ title: "[BUG] "
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ **Describe the bug**
10
+ A clear and concise description of what the bug is.
11
+
12
+ **To Reproduce**
13
+ Steps to reproduce the behavior:
14
+
15
+ 1. Run command '...'
16
+ 2. Directory structure looks like '...'
17
+ 3. See error
18
+
19
+ **Expected behavior**
20
+ A clear and concise description of what you expected to happen in the FEATURES.md or console.
21
+
22
+ **Screenshots**
23
+ If applicable, add screenshots to help explain your problem.
24
+
25
+ **Environment (please complete the following information):**
26
+
27
+ - OS: [e.g. macOS]
28
+ - Node Version [e.g. 18.x]
29
+ - Target Language [e.g. Python, TypeScript]
30
+
31
+ **Additional context**
32
+ Add any other context about the problem here.
@@ -0,0 +1,19 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: "[FEAT] "
5
+ labels: enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ **Is your feature request related to a problem? Please describe.**
10
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11
+
12
+ **Describe the solution you'd like**
13
+ A clear and concise description of what you want to happen. Perhaps a new CLI flag or language support.
14
+
15
+ **Describe alternatives you've considered**
16
+ A clear and concise description of any alternative solutions or features you've considered.
17
+
18
+ **Additional context**
19
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,24 @@
1
+ ## Description
2
+
3
+ Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
4
+
5
+ Fixes # (issue number)
6
+
7
+ ## Type of change
8
+
9
+ Please delete options that are not relevant.
10
+
11
+ - [ ] Bug fix (non-breaking change which fixes an issue)
12
+ - [ ] New feature (non-breaking change which adds functionality)
13
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14
+ - [ ] This change requires a documentation update
15
+
16
+ ## Checklist:
17
+
18
+ - [ ] My code follows the style guidelines of this project
19
+ - [ ] I have performed a self-review of my own code
20
+ - [ ] I have commented my code, particularly in hard-to-understand areas
21
+ - [ ] I have made corresponding changes to the documentation
22
+ - [ ] My changes generate no new warnings or lints (`npm run lint`)
23
+ - [ ] I have added tests that prove my fix is effective or that my feature works
24
+ - [ ] New and existing unit tests pass locally with my changes (`npm test`)
@@ -0,0 +1,27 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ node-version: [18.x, 20.x]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Use Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+ cache: 'npm'
24
+ - run: npm ci
25
+ - run: npm run lint
26
+ - run: npm test
27
+ - run: npm audit --audit-level=critical
@@ -0,0 +1,30 @@
1
+ name: Release
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ jobs:
7
+ release:
8
+ name: Release
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: write # to be able to publish a GitHub release
12
+ issues: write # to be able to comment on released issues
13
+ pull-requests: write # to be able to comment on released pull requests
14
+ id-token: write # to enable use of OIDC for npm provenance
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0
20
+ - name: Setup Node.js
21
+ uses: actions/setup-node@v4
22
+ with:
23
+ node-version: "22"
24
+ - name: Install dependencies
25
+ run: npm ci
26
+ - name: Release
27
+ env:
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
30
+ run: npx semantic-release
@@ -0,0 +1 @@
1
+ npm run pre-commit
@@ -0,0 +1,9 @@
1
+ {
2
+ "branches": ["main"],
3
+ "plugins": [
4
+ "@semantic-release/commit-analyzer",
5
+ "@semantic-release/release-notes-generator",
6
+ "@semantic-release/npm",
7
+ "@semantic-release/github"
8
+ ]
9
+ }
@@ -0,0 +1 @@
1
+ {}
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # xfeat
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
4
+ [![Node.js](https://img.shields.io/badge/Node.js-18.x-green.svg)](https://nodejs.org/)
5
+
6
+ **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 3.7 Sonnet, this tool auto-generates comprehensive, human-readable documentation of what your code _actually_ does.
7
+
8
+ ## Key Features
9
+
10
+ - **AST-Powered Parsing:** Fast and accurate structural footprint generation (classes, functions, exports, imports) for modern ecosystem languages.
11
+ - **Agentic Source Code Reading:** Rather than guessing based off function identifiers, the AI utilizes a specialized `view_file` tool to selectively dive into the raw source code wherever AST context is insufficient.
12
+ - **Automated Mermaid Diagrams:** Visually maps out how files interact at macro and global architecture levels.
13
+ - **Structured Markdown Deliverables:** Produces a neat, hierarchical `FEATURES.md` report encompassing everything from the executive summary to granular file logic.
14
+ - **Smart Directory Traversal:** Adheres to your local `.gitignore` rules to avoid processing build artifacts and generic dependencies.
15
+
16
+ ## How It Works
17
+
18
+ The engine executes in an expanding 3-stage pipeline:
19
+
20
+ 1. **Micro Analysis (File-Level):**
21
+ - Identifies granular structural signatures across source files.
22
+ - Leverages an LLM sub-agent loop to request file contents as needed.
23
+ - Outputs 1-2 sentence overviews alongside high-level feature bullet points for each file.
24
+
25
+ 2. **Macro Analysis (Component-Level):**
26
+ - Groups files logically by their enclosing directory.
27
+ - Synthesizes isolated file summaries into a curated **Component Summary**.
28
+ - Generates localized [Mermaid.js](https://mermaid.js.org/) flow/architecture diagrams per directory.
29
+
30
+ 3. **Global Analysis (System-Level):**
31
+ - Ties localized component summaries together into a master architecture overview.
32
+ - Documents the core pillars and overarching domain of the application.
33
+ - Renders a highly-abstracted global Mermaid architecture diagram representing the entire system interaction.
34
+
35
+ ## Installation
36
+
37
+ Ensure you have [Node.js](https://nodejs.org/) installed, then clone the repository and install dependencies:
38
+
39
+ ```bash
40
+ git clone https://github.com/brunobrise/code-features-extract.git xfeat
41
+ cd xfeat
42
+ npm install
43
+ ```
44
+
45
+ ## Configuration
46
+
47
+ Create a `.env` file at the root of the project to define your API authorization:
48
+
49
+ ```env
50
+ # Required: Your Anthropic API Key
51
+ ANTHROPIC_API_KEY="sk-ant-..."
52
+
53
+ # Optional Environment Overrides
54
+ ANTHROPIC_AUTH_TOKEN=""
55
+ ANTHROPIC_BASE_URL=""
56
+ CLAUDE_CODE_SUBAGENT_MODEL="claude-sonnet-4-6"
57
+ ```
58
+
59
+ ## Usage
60
+
61
+ You can scan the immediate working directory, or pass a relative/absolute path to dynamically scan another repository on your machine.
62
+
63
+ ### Scan Current Directory
64
+
65
+ ```bash
66
+ npx xfeat
67
+ ```
68
+
69
+ ### Scan Remote Directory Path
70
+
71
+ ```bash
72
+ npx xfeat /path/to/your/custom/project
73
+ ```
74
+
75
+ ### Development Tooling
76
+
77
+ For developers contributing to this tool, standard npm scripts are available:
78
+
79
+ - `npm run dev` — Hot-reloads the analysis script using Nodemon.
80
+ - `npm run lint` — Analyzes the source using ESLint against best practices.
81
+ - `npm run format` — Standardizes code styling uniformly with Prettier.
82
+
83
+ ## Expected Output
84
+
85
+ The script concludes by generating a structured `FEATURES.md` record at your execution root. Inside, you can expect:
86
+
87
+ 1. **Global Architecture Overview** _(Executive Summary, Application Pillars, Main System Diagram)_
88
+ 2. **Component Breakdown** _(Directory-by-Directory Insights, Narrow Context Diagrams)_
89
+ 3. **File-Level Details** _(Deeply granular feature lists)_
90
+
91
+ ## Supported Languages
92
+
93
+ The foundational Tree-sitter AST parser natively understands:
94
+
95
+ - JavaScript (`.js`, `.jsx`)
96
+ - TypeScript (`.ts`, `.tsx`)
97
+ - Python (`.py`)
98
+
99
+ ## License
100
+
101
+ This tooling is open-sourced under the **MIT** License.
102
+
103
+ ---
104
+
105
+ _Built organically with the [Anthropic SDK](https://github.com/anthropics/anthropic-sdk-typescript) and [Tree-sitter](https://tree-sitter.github.io/tree-sitter/)._
@@ -0,0 +1,5 @@
1
+ module.exports = [
2
+ {
3
+ rules: {},
4
+ },
5
+ ];