ai-first-cli 1.1.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.
- package/.netlify/netlify.toml +25 -0
- package/.netlify/state.json +3 -0
- package/CHANGELOG.md +192 -0
- package/CONTRIBUTING.md +89 -0
- package/FLOW.md +129 -0
- package/README.es.md +350 -0
- package/README.md +439 -0
- package/ai/ai_context.md +123 -0
- package/ai/ai_rules.md +52 -0
- package/ai/architecture.md +100 -0
- package/ai/cache.json +301 -0
- package/ai/context/analyzers.Symbol.json +19 -0
- package/ai/context/analyzers.extractSymbols.json +19 -0
- package/ai/conventions.md +52 -0
- package/ai/dependencies.json +1282 -0
- package/ai/embeddings.json +23828 -0
- package/ai/entrypoints.md +32 -0
- package/ai/files.json +1061 -0
- package/ai/graph/module-graph.json +115 -0
- package/ai/graph/symbol-graph.json +50310 -0
- package/ai/graph/symbol-references.json +1723 -0
- package/ai/hierarchy.json +28 -0
- package/ai/index-state.json +276 -0
- package/ai/index.db +0 -0
- package/ai/modules.json +69 -0
- package/ai/repo-map.json +769 -0
- package/ai/repo_map.json +769 -0
- package/ai/repo_map.md +197 -0
- package/ai/summary.md +23 -0
- package/ai/symbols.json +20287 -0
- package/ai/tech_stack.md +39 -0
- package/dist/analyzers/aiRules.d.ts +15 -0
- package/dist/analyzers/aiRules.d.ts.map +1 -0
- package/dist/analyzers/aiRules.js +123 -0
- package/dist/analyzers/aiRules.js.map +1 -0
- package/dist/analyzers/architecture.d.ts +22 -0
- package/dist/analyzers/architecture.d.ts.map +1 -0
- package/dist/analyzers/architecture.js +239 -0
- package/dist/analyzers/architecture.js.map +1 -0
- package/dist/analyzers/conventions.d.ts +46 -0
- package/dist/analyzers/conventions.d.ts.map +1 -0
- package/dist/analyzers/conventions.js +159 -0
- package/dist/analyzers/conventions.js.map +1 -0
- package/dist/analyzers/dependencies.d.ts +21 -0
- package/dist/analyzers/dependencies.d.ts.map +1 -0
- package/dist/analyzers/dependencies.js +255 -0
- package/dist/analyzers/dependencies.js.map +1 -0
- package/dist/analyzers/entrypoints.d.ts +11 -0
- package/dist/analyzers/entrypoints.d.ts.map +1 -0
- package/dist/analyzers/entrypoints.js +81 -0
- package/dist/analyzers/entrypoints.js.map +1 -0
- package/dist/analyzers/symbols.d.ts +29 -0
- package/dist/analyzers/symbols.d.ts.map +1 -0
- package/dist/analyzers/symbols.js +333 -0
- package/dist/analyzers/symbols.js.map +1 -0
- package/dist/analyzers/techStack.d.ts +21 -0
- package/dist/analyzers/techStack.d.ts.map +1 -0
- package/dist/analyzers/techStack.js +302 -0
- package/dist/analyzers/techStack.js.map +1 -0
- package/dist/commands/ai-first.d.ts +16 -0
- package/dist/commands/ai-first.d.ts.map +1 -0
- package/dist/commands/ai-first.js +988 -0
- package/dist/commands/ai-first.js.map +1 -0
- package/dist/commands/doctor.d.ts +13 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +60 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/explore.d.ts +9 -0
- package/dist/commands/explore.d.ts.map +1 -0
- package/dist/commands/explore.js +69 -0
- package/dist/commands/explore.js.map +1 -0
- package/dist/core/aiContextGenerator.d.ts +20 -0
- package/dist/core/aiContextGenerator.d.ts.map +1 -0
- package/dist/core/aiContextGenerator.js +829 -0
- package/dist/core/aiContextGenerator.js.map +1 -0
- package/dist/core/chunker.d.ts +23 -0
- package/dist/core/chunker.d.ts.map +1 -0
- package/dist/core/chunker.js +291 -0
- package/dist/core/chunker.js.map +1 -0
- package/dist/core/contextGenerator.d.ts +12 -0
- package/dist/core/contextGenerator.d.ts.map +1 -0
- package/dist/core/contextGenerator.js +257 -0
- package/dist/core/contextGenerator.js.map +1 -0
- package/dist/core/contextPacket.d.ts +63 -0
- package/dist/core/contextPacket.d.ts.map +1 -0
- package/dist/core/contextPacket.js +350 -0
- package/dist/core/contextPacket.js.map +1 -0
- package/dist/core/embeddings.d.ts +50 -0
- package/dist/core/embeddings.d.ts.map +1 -0
- package/dist/core/embeddings.js +119 -0
- package/dist/core/embeddings.js.map +1 -0
- package/dist/core/hierarchyGenerator.d.ts +22 -0
- package/dist/core/hierarchyGenerator.d.ts.map +1 -0
- package/dist/core/hierarchyGenerator.js +327 -0
- package/dist/core/hierarchyGenerator.js.map +1 -0
- package/dist/core/indexState.d.ts +47 -0
- package/dist/core/indexState.d.ts.map +1 -0
- package/dist/core/indexState.js +158 -0
- package/dist/core/indexState.js.map +1 -0
- package/dist/core/indexer.d.ts +105 -0
- package/dist/core/indexer.d.ts.map +1 -0
- package/dist/core/indexer.js +642 -0
- package/dist/core/indexer.js.map +1 -0
- package/dist/core/moduleGraph.d.ts +24 -0
- package/dist/core/moduleGraph.d.ts.map +1 -0
- package/dist/core/moduleGraph.js +156 -0
- package/dist/core/moduleGraph.js.map +1 -0
- package/dist/core/repoMapper.d.ts +19 -0
- package/dist/core/repoMapper.d.ts.map +1 -0
- package/dist/core/repoMapper.js +125 -0
- package/dist/core/repoMapper.js.map +1 -0
- package/dist/core/repoScanner.d.ts +25 -0
- package/dist/core/repoScanner.d.ts.map +1 -0
- package/dist/core/repoScanner.js +72 -0
- package/dist/core/repoScanner.js.map +1 -0
- package/dist/core/symbolGraph.d.ts +58 -0
- package/dist/core/symbolGraph.d.ts.map +1 -0
- package/dist/core/symbolGraph.js +503 -0
- package/dist/core/symbolGraph.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/fileUtils.d.ts +33 -0
- package/dist/utils/fileUtils.d.ts.map +1 -0
- package/dist/utils/fileUtils.js +120 -0
- package/dist/utils/fileUtils.js.map +1 -0
- package/docs/.vitepress/config.ts +125 -0
- package/docs/.vitepress/theme/custom.css +189 -0
- package/docs/.vitepress/theme/index.ts +9 -0
- package/docs/es/guide/getting-started.md +26 -0
- package/docs/es/index.md +128 -0
- package/docs/examples/express-api.md +133 -0
- package/docs/examples/index.md +26 -0
- package/docs/examples/python-django.md +105 -0
- package/docs/examples/react-app.md +116 -0
- package/docs/guide/architecture.md +212 -0
- package/docs/guide/getting-started.md +82 -0
- package/docs/guide/installation.md +98 -0
- package/docs/guide/quick-start.md +91 -0
- package/docs/index.md +139 -0
- package/docs/reference/commands.md +203 -0
- package/examples/01-express-api.md +133 -0
- package/examples/02-react-app.md +137 -0
- package/examples/03-python-django.md +136 -0
- package/examples/README.md +62 -0
- package/package.json +58 -0
- package/src/analyzers/aiRules.ts +156 -0
- package/src/analyzers/architecture.ts +302 -0
- package/src/analyzers/conventions.ts +181 -0
- package/src/analyzers/dependencies.ts +307 -0
- package/src/analyzers/entrypoints.ts +102 -0
- package/src/analyzers/symbols.ts +379 -0
- package/src/analyzers/techStack.ts +351 -0
- package/src/commands/ai-first.ts +1094 -0
- package/src/commands/doctor.ts +68 -0
- package/src/commands/explore.ts +50 -0
- package/src/core/aiContextGenerator.ts +982 -0
- package/src/core/chunker.ts +351 -0
- package/src/core/contextGenerator.ts +294 -0
- package/src/core/contextPacket.ts +517 -0
- package/src/core/embeddings.ts +175 -0
- package/src/core/hierarchyGenerator.ts +385 -0
- package/src/core/indexState.ts +197 -0
- package/src/core/indexer.ts +700 -0
- package/src/core/moduleGraph.ts +195 -0
- package/src/core/repoMapper.ts +172 -0
- package/src/core/repoScanner.ts +103 -0
- package/src/core/symbolGraph.ts +650 -0
- package/src/index.ts +7 -0
- package/src/types/sql.js.d.ts +19 -0
- package/src/utils/fileUtils.ts +134 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
plugins = []
|
|
2
|
+
headers = []
|
|
3
|
+
redirects = []
|
|
4
|
+
|
|
5
|
+
[functions]
|
|
6
|
+
|
|
7
|
+
[functions."*"]
|
|
8
|
+
|
|
9
|
+
[build]
|
|
10
|
+
publish = "/mnt/m2/Código/opencode-ai-first"
|
|
11
|
+
publishOrigin = "default"
|
|
12
|
+
|
|
13
|
+
[build.environment]
|
|
14
|
+
|
|
15
|
+
[build.processing]
|
|
16
|
+
|
|
17
|
+
[build.processing.css]
|
|
18
|
+
|
|
19
|
+
[build.processing.html]
|
|
20
|
+
|
|
21
|
+
[build.processing.images]
|
|
22
|
+
|
|
23
|
+
[build.processing.js]
|
|
24
|
+
|
|
25
|
+
[build.services]
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Changelog & Roadmap
|
|
2
|
+
|
|
3
|
+
All notable changes to `ai-first` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Enhanced symbol indexing with `filePath#symbolName` IDs
|
|
11
|
+
- Extended symbol graph relationships: calls, called_by, imports, references, instantiates, extends, implements, exports
|
|
12
|
+
- Reverse symbol references (`ai/graph/symbol-references.json`)
|
|
13
|
+
- File index with symbol mappings (`ai/files.json`)
|
|
14
|
+
- Code Context Packets (CCP) with depth, ranking, and multiple formats
|
|
15
|
+
- Context CLI flags: `--depth`, `--max-symbols`, `--format`, `--save`
|
|
16
|
+
- Incremental indexing with file hash cache (`ai/cache.json`)
|
|
17
|
+
- Context ranking system based on graph distance and relationships
|
|
18
|
+
- Documentation: Architecture guide and Commands reference updated
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## [1.1.0] - 2026-03-09
|
|
23
|
+
|
|
24
|
+
All notable changes to `ai-first` will be documented in this file.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## [Unreleased]
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- `ai-first context <symbol>` - Generate context packet for specific symbol
|
|
32
|
+
- `ai/graph/symbol-graph.json` - Symbol-level dependency graph with bidirectional relationships
|
|
33
|
+
- `ai/context/<symbol>.json` - Code Context Packets (CCP) for AI agents
|
|
34
|
+
- Unique symbol IDs (format: `module.symbolName`)
|
|
35
|
+
- Symbol relationships: calls, called_by, imports, references
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## [1.1.0] - 2026-03-09
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- `ai-first doctor` - Health check command for repository readiness
|
|
43
|
+
- `ai-first explore <module>` - Navigate module dependencies
|
|
44
|
+
- `ai-first map` - Generate repository architecture map
|
|
45
|
+
- `ai-first index --semantic` - Semantic indexing with embeddings
|
|
46
|
+
- `index-state.json` - Track file changes for incremental indexing
|
|
47
|
+
- `files.json` - List of all indexed files with metadata
|
|
48
|
+
- `modules.json` - Detected modules and their structure
|
|
49
|
+
- `module-graph.json` - Module dependency graph
|
|
50
|
+
- `embeddings.json` - Semantic embeddings for code search
|
|
51
|
+
- SQLite index with adaptive sizing for large repos
|
|
52
|
+
|
|
53
|
+
### New Generated Files
|
|
54
|
+
- `ai/files.json` - File inventory with hash, size, line count
|
|
55
|
+
- `ai/modules.json` - Module detection and hierarchy
|
|
56
|
+
- `ai/module-graph.json` - Import-based dependency graph
|
|
57
|
+
- `ai/embeddings.json` - Vector embeddings for semantic search
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## [1.0.0] - 2026-03-08
|
|
62
|
+
|
|
63
|
+
### Added
|
|
64
|
+
- feat: Add VitePress documentation site with SEO optimization (e0b3e35)
|
|
65
|
+
- fix: Add permissions and GITHUB_TOKEN to changelog workflow (062d952)
|
|
66
|
+
- chore: Update CHANGELOG with all new features (8c1f6d9)
|
|
67
|
+
- fix: Update roadmap to match planned features from CHANGELOG (7eca761)
|
|
68
|
+
- fix: Remove hash ID markers from README (d05db53)
|
|
69
|
+
- feat: Add incremental indexing and semantic search pipeline (e294a2c)
|
|
70
|
+
- feat: Add improved indexing with adaptive sizing, map command, incremental state (d0a172b)
|
|
71
|
+
- feat: Add doctor, explore commands and semantic indexing (50011da)
|
|
72
|
+
- fix: Correct YAML syntax in changelog workflow (5a1c819)
|
|
73
|
+
- Improve documentation with Quick Start, Why AI-First, Architecture diagram, Languages (7cc8f44)
|
|
74
|
+
|
|
75
|
+
# Changelog & Roadmap
|
|
76
|
+
|
|
77
|
+
All notable changes to `ai-first` will be documented in this file.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## [Unreleased]
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
- `ai-first doctor` - Health check command for repository readiness
|
|
85
|
+
- `ai-first explore <module>` - Navigate module dependencies
|
|
86
|
+
- `ai-first map` - Generate repository architecture map
|
|
87
|
+
- `ai-first index --semantic` - Semantic indexing with embeddings
|
|
88
|
+
- `index-state.json` - Track file changes for incremental indexing
|
|
89
|
+
- `files.json` - List of all indexed files with metadata
|
|
90
|
+
- `modules.json` - Detected modules and their structure
|
|
91
|
+
- `module-graph.json` - Module dependency graph
|
|
92
|
+
- `embeddings.json` - Semantic embeddings for code search
|
|
93
|
+
- SQLite index with adaptive sizing for large repos
|
|
94
|
+
|
|
95
|
+
### New Generated Files
|
|
96
|
+
- `ai/files.json` - File inventory with hash, size, line count
|
|
97
|
+
- `ai/modules.json` - Module detection and hierarchy
|
|
98
|
+
- `ai/module-graph.json` - Import-based dependency graph
|
|
99
|
+
- `ai/embeddings.json` - Vector embeddings for semantic search
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## [1.0.0] - 2026-03-08
|
|
104
|
+
|
|
105
|
+
### Added
|
|
106
|
+
- Initial release
|
|
107
|
+
- Core analyzers:
|
|
108
|
+
- `repo_map.md` - Repository structure tree view
|
|
109
|
+
- `summary.md` - Files by extension and directory
|
|
110
|
+
- `architecture.md` - Pattern detection (MVC, Clean Architecture, etc.)
|
|
111
|
+
- `tech_stack.md` - Languages, frameworks, libraries
|
|
112
|
+
- `entrypoints.md` - CLI, API, server entry points
|
|
113
|
+
- `conventions.md` - Naming, testing, linting conventions
|
|
114
|
+
- `ai_context.md` - Unified AI context
|
|
115
|
+
- `symbols.json` - Extracts functions, classes, interfaces from code
|
|
116
|
+
- `dependencies.json` - Analyzes import/require dependencies between files
|
|
117
|
+
- `ai_rules.md` - Generates guidelines for AI assistants
|
|
118
|
+
- `repo_map.json` - Machine-readable repository structure
|
|
119
|
+
- `index.db` - SQLite database for fast queries (`ai-first index`)
|
|
120
|
+
|
|
121
|
+
### Features
|
|
122
|
+
- Multi-language support (TypeScript, Python, Go, Rust, Java, C#, etc.)
|
|
123
|
+
- Deterministic analysis (no AI/LLM required)
|
|
124
|
+
- Works offline
|
|
125
|
+
- CLI interface with `--root` and `--output` options
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 📋 Roadmap
|
|
129
|
+
|
|
130
|
+
See [CHANGELOG.md](./CHANGELOG.md) for the complete roadmap:
|
|
131
|
+
- **Unreleased** section shows what's being worked on
|
|
132
|
+
- Version sections show completed features
|
|
133
|
+
- Future planned features are listed under each phase
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## How to Update
|
|
138
|
+
|
|
139
|
+
After each feature release:
|
|
140
|
+
1. Update this changelog with new changes
|
|
141
|
+
2. Update version in `package.json` (semver)
|
|
142
|
+
3. Commit and push
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
git add CHANGELOG.md package.json
|
|
146
|
+
git commit -m "Release v1.x.x"
|
|
147
|
+
git push
|
|
148
|
+
```
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Roadmap
|
|
152
|
+
|
|
153
|
+
### Phase 1 (Done ✅)
|
|
154
|
+
- [x] Core CLI structure
|
|
155
|
+
- [x] Basic analyzers (architecture, tech stack, entrypoints, conventions)
|
|
156
|
+
- [x] Unified context generation
|
|
157
|
+
|
|
158
|
+
### Phase 2 (Done ✅)
|
|
159
|
+
- [x] Symbol extraction (functions, classes, interfaces)
|
|
160
|
+
- [x] Dependency analysis
|
|
161
|
+
- [x] AI rules generation
|
|
162
|
+
- [x] Machine-readable outputs (JSON)
|
|
163
|
+
|
|
164
|
+
### Phase 3 (In Progress)
|
|
165
|
+
- [x] Health check command (`ai-first doctor`)
|
|
166
|
+
- [x] Module exploration (`ai-first explore`)
|
|
167
|
+
- [x] Repository mapping (`ai-first map`)
|
|
168
|
+
- [x] Semantic indexing with embeddings
|
|
169
|
+
- [x] Incremental indexing (track file changes)
|
|
170
|
+
- [ ] Configuration file support (`ai-first.config.json`)
|
|
171
|
+
- [ ] Custom rules/plugins system
|
|
172
|
+
|
|
173
|
+
### Phase 4 (Future)
|
|
174
|
+
- [ ] Git integration (analyze recent changes)
|
|
175
|
+
- [ ] Diff-aware context (what changed since last run)
|
|
176
|
+
- [ ] Interactive mode
|
|
177
|
+
- [ ] VS Code extension
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## How to Update
|
|
182
|
+
|
|
183
|
+
After each push to GitHub:
|
|
184
|
+
1. Update this changelog with new changes
|
|
185
|
+
2. Update version if needed (semver)
|
|
186
|
+
3. Push changes
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
git add CHANGELOG.md
|
|
190
|
+
git commit -m "Update changelog"
|
|
191
|
+
git push
|
|
192
|
+
```
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Contributing to ai-first
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing!
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Clone the repository
|
|
9
|
+
git clone https://github.com/julianperezpesce/ai-first.git
|
|
10
|
+
cd ai-first
|
|
11
|
+
|
|
12
|
+
# Install dependencies
|
|
13
|
+
npm install
|
|
14
|
+
|
|
15
|
+
# Build
|
|
16
|
+
npm run build
|
|
17
|
+
|
|
18
|
+
# Run
|
|
19
|
+
npm run run
|
|
20
|
+
# or
|
|
21
|
+
node dist/commands/ai-first.js
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Project Structure
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
ai-first/
|
|
28
|
+
├── src/
|
|
29
|
+
│ ├── analyzers/ # Analysis modules
|
|
30
|
+
│ │ ├── architecture.ts
|
|
31
|
+
│ │ ├── conventions.ts
|
|
32
|
+
│ │ ├── entrypoints.ts
|
|
33
|
+
│ │ └── techStack.ts
|
|
34
|
+
│ ├── commands/ # CLI commands
|
|
35
|
+
│ │ └── ai-first.ts
|
|
36
|
+
│ ├── core/ # Core functionality
|
|
37
|
+
│ │ ├── repoMapper.ts
|
|
38
|
+
│ │ └── repoScanner.ts
|
|
39
|
+
│ └── utils/ # Utilities
|
|
40
|
+
│ └── fileUtils.ts
|
|
41
|
+
├── dist/ # Compiled JavaScript
|
|
42
|
+
├── package.json
|
|
43
|
+
└── tsconfig.json
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Adding New Analyzers
|
|
47
|
+
|
|
48
|
+
To add a new analyzer:
|
|
49
|
+
|
|
50
|
+
1. Create a new file in `src/analyzers/`
|
|
51
|
+
2. Export functions for detection and file generation
|
|
52
|
+
3. Import and use in `src/commands/ai-first.ts`
|
|
53
|
+
|
|
54
|
+
Example:
|
|
55
|
+
```typescript
|
|
56
|
+
// src/analyzers/myAnalyzer.ts
|
|
57
|
+
import { FileInfo } from "../core/repoScanner.js";
|
|
58
|
+
|
|
59
|
+
export interface MyAnalysis {
|
|
60
|
+
// Define your output type
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function analyzeMyFeature(files: FileInfo[]): MyAnalysis {
|
|
64
|
+
// Your analysis logic
|
|
65
|
+
return { /* ... */ };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function generateMyFeatureFile(analysis: MyAnalysis): string {
|
|
69
|
+
return "# My Analysis\n" + /* ... */;
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Running Tests
|
|
74
|
+
|
|
75
|
+
Currently there are no tests. Contributions with tests are welcome!
|
|
76
|
+
|
|
77
|
+
## Publishing to npm
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Update version in package.json
|
|
81
|
+
npm version patch
|
|
82
|
+
|
|
83
|
+
# Publish
|
|
84
|
+
npm publish
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT
|
package/FLOW.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Flow Diagram
|
|
2
|
+
|
|
3
|
+
```
|
|
4
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
5
|
+
│ ai-first CLI │
|
|
6
|
+
└─────────────────────────────────────────────────────────────┘
|
|
7
|
+
│
|
|
8
|
+
▼
|
|
9
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
10
|
+
│ 1. scanRepo(rootDir) │
|
|
11
|
+
│ - Recursively scan directory │
|
|
12
|
+
│ - Filter by includeExtensions │
|
|
13
|
+
│ - Return: FileInfo[] │
|
|
14
|
+
└─────────────────────────────────────────────────────────────┘
|
|
15
|
+
│
|
|
16
|
+
▼
|
|
17
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
18
|
+
│ 2. Create output directory (default: ./ai) │
|
|
19
|
+
└─────────────────────────────────────────────────────────────┘
|
|
20
|
+
│
|
|
21
|
+
┌───────────────┼───────────────┐
|
|
22
|
+
▼ ▼ ▼
|
|
23
|
+
┌─────────────────┐ ┌───────────┐ ┌─────────────┐
|
|
24
|
+
│ 3a. repoMapper │ │3b. techStack│ │3c. architecture│
|
|
25
|
+
│ - repo_map.md │ │ - tech_stack│ │ - architecture│
|
|
26
|
+
│ - repo_map.json │ │ .md │ │ .md │
|
|
27
|
+
│ - summary.md │ │ │ │ │
|
|
28
|
+
└─────────────────┘ └─────────────┘ └─────────────┘
|
|
29
|
+
│ │ │
|
|
30
|
+
└───────────────┼───────────────┘
|
|
31
|
+
▼
|
|
32
|
+
┌─────────────────────────────────────────────────────────┐
|
|
33
|
+
│ 4. Analyzers Pipeline │
|
|
34
|
+
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
|
|
35
|
+
│ │entrypoints │ │conventions │ │symbols (NEW) │ │
|
|
36
|
+
│ │.md │ │.md │ │.json (NEW) │ │
|
|
37
|
+
└──────────────┘ └──────────────┘ └──────────────────┘ │
|
|
38
|
+
┌──────────────────┐ ┌──────────────┐ │
|
|
39
|
+
│dependencies (NEW)│ │ai_rules (NEW)│ │
|
|
40
|
+
│.json │ │.md │ │
|
|
41
|
+
└──────────────────┘ └──────────────┘ │
|
|
42
|
+
│
|
|
43
|
+
▼
|
|
44
|
+
┌─────────────────────────────────────────────────────────┐
|
|
45
|
+
│ 5. generateUnifiedContext() │
|
|
46
|
+
│ - Combines all analysis into ai_context.md │
|
|
47
|
+
└─────────────────────────────────────────────────────────┘
|
|
48
|
+
│
|
|
49
|
+
▼
|
|
50
|
+
┌─────────────────────────────────────────────────────────┐
|
|
51
|
+
│ 6. Output Files │
|
|
52
|
+
│ ai/ │
|
|
53
|
+
│ ├── ai_context.md ← UNIFIED (most important!) │
|
|
54
|
+
│ ├── repo_map.md │
|
|
55
|
+
│ ├── repo_map.json ← NEW │
|
|
56
|
+
│ ├── summary.md │
|
|
57
|
+
│ ├── architecture.md │
|
|
58
|
+
│ ├── tech_stack.md │
|
|
59
|
+
│ ├── entrypoints.md │
|
|
60
|
+
│ ├── conventions.md │
|
|
61
|
+
│ ├── symbols.json ← NEW │
|
|
62
|
+
│ ├── dependencies.json ← NEW │
|
|
63
|
+
│ └── ai_rules.md ← NEW │
|
|
64
|
+
└─────────────────────────────────────────────────────────┘
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Execution Flow
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
User runs: ai-first init
|
|
73
|
+
|
|
74
|
+
│
|
|
75
|
+
▼
|
|
76
|
+
┌────────────────────────────────────┐
|
|
77
|
+
│ CLI Entry Point │
|
|
78
|
+
│ - Parse args (--root, --output) │
|
|
79
|
+
│ - Handle 'init' command │
|
|
80
|
+
└────────────────────────────────────┘
|
|
81
|
+
│
|
|
82
|
+
▼
|
|
83
|
+
┌────────────────────────────────────┐
|
|
84
|
+
│ runAIFirst(options) │
|
|
85
|
+
│ - rootDir: process.cwd() │
|
|
86
|
+
│ - outputDir: ./ai │
|
|
87
|
+
└────────────────────────────────────┘
|
|
88
|
+
│
|
|
89
|
+
▼
|
|
90
|
+
┌────────────────────────────────────┐
|
|
91
|
+
│ scanRepo(rootDir) │
|
|
92
|
+
│ Returns: { files: FileInfo[] } │
|
|
93
|
+
└────────────────────────────────────┘
|
|
94
|
+
│
|
|
95
|
+
▼
|
|
96
|
+
┌────────────────────────────────────┐
|
|
97
|
+
│ For each analyzer: │
|
|
98
|
+
│ 1. analyze(files, rootDir) │
|
|
99
|
+
│ 2. generateXxxFile(result) │
|
|
100
|
+
│ 3. writeFile(outputPath, content) │
|
|
101
|
+
└────────────────────────────────────┘
|
|
102
|
+
│
|
|
103
|
+
▼
|
|
104
|
+
┌────────────────────────────────────┐
|
|
105
|
+
│ generateUnifiedContext() │
|
|
106
|
+
│ - Combines all results │
|
|
107
|
+
│ - Creates ai_context.md │
|
|
108
|
+
└────────────────────────────────────┘
|
|
109
|
+
│
|
|
110
|
+
▼
|
|
111
|
+
┌────────────────────────────────────┐
|
|
112
|
+
│ Return: { success, filesCreated } │
|
|
113
|
+
└────────────────────────────────────┘
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Analyzer Details
|
|
119
|
+
|
|
120
|
+
| Analyzer | Output | Description |
|
|
121
|
+
|----------|--------|-------------|
|
|
122
|
+
| `repoMapper` | repo_map.md, repo_map.json, summary.md | Directory tree & file stats |
|
|
123
|
+
| `techStack` | tech_stack.md | Languages, frameworks, package managers |
|
|
124
|
+
| `architecture` | architecture.md | MVC, Clean Architecture, Hexagonal, etc. |
|
|
125
|
+
| `entrypoints` | entrypoints.md | CLI, API, server entry points |
|
|
126
|
+
| `conventions` | conventions.md | Naming, testing, linting conventions |
|
|
127
|
+
| `symbols` | symbols.json | Functions, classes, interfaces (NEW) |
|
|
128
|
+
| `dependencies` | dependencies.json | Import graph (NEW) |
|
|
129
|
+
| `aiRules` | ai_rules.md | Guidelines for AI (NEW) |
|