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.
Files changed (173) hide show
  1. package/.netlify/netlify.toml +25 -0
  2. package/.netlify/state.json +3 -0
  3. package/CHANGELOG.md +192 -0
  4. package/CONTRIBUTING.md +89 -0
  5. package/FLOW.md +129 -0
  6. package/README.es.md +350 -0
  7. package/README.md +439 -0
  8. package/ai/ai_context.md +123 -0
  9. package/ai/ai_rules.md +52 -0
  10. package/ai/architecture.md +100 -0
  11. package/ai/cache.json +301 -0
  12. package/ai/context/analyzers.Symbol.json +19 -0
  13. package/ai/context/analyzers.extractSymbols.json +19 -0
  14. package/ai/conventions.md +52 -0
  15. package/ai/dependencies.json +1282 -0
  16. package/ai/embeddings.json +23828 -0
  17. package/ai/entrypoints.md +32 -0
  18. package/ai/files.json +1061 -0
  19. package/ai/graph/module-graph.json +115 -0
  20. package/ai/graph/symbol-graph.json +50310 -0
  21. package/ai/graph/symbol-references.json +1723 -0
  22. package/ai/hierarchy.json +28 -0
  23. package/ai/index-state.json +276 -0
  24. package/ai/index.db +0 -0
  25. package/ai/modules.json +69 -0
  26. package/ai/repo-map.json +769 -0
  27. package/ai/repo_map.json +769 -0
  28. package/ai/repo_map.md +197 -0
  29. package/ai/summary.md +23 -0
  30. package/ai/symbols.json +20287 -0
  31. package/ai/tech_stack.md +39 -0
  32. package/dist/analyzers/aiRules.d.ts +15 -0
  33. package/dist/analyzers/aiRules.d.ts.map +1 -0
  34. package/dist/analyzers/aiRules.js +123 -0
  35. package/dist/analyzers/aiRules.js.map +1 -0
  36. package/dist/analyzers/architecture.d.ts +22 -0
  37. package/dist/analyzers/architecture.d.ts.map +1 -0
  38. package/dist/analyzers/architecture.js +239 -0
  39. package/dist/analyzers/architecture.js.map +1 -0
  40. package/dist/analyzers/conventions.d.ts +46 -0
  41. package/dist/analyzers/conventions.d.ts.map +1 -0
  42. package/dist/analyzers/conventions.js +159 -0
  43. package/dist/analyzers/conventions.js.map +1 -0
  44. package/dist/analyzers/dependencies.d.ts +21 -0
  45. package/dist/analyzers/dependencies.d.ts.map +1 -0
  46. package/dist/analyzers/dependencies.js +255 -0
  47. package/dist/analyzers/dependencies.js.map +1 -0
  48. package/dist/analyzers/entrypoints.d.ts +11 -0
  49. package/dist/analyzers/entrypoints.d.ts.map +1 -0
  50. package/dist/analyzers/entrypoints.js +81 -0
  51. package/dist/analyzers/entrypoints.js.map +1 -0
  52. package/dist/analyzers/symbols.d.ts +29 -0
  53. package/dist/analyzers/symbols.d.ts.map +1 -0
  54. package/dist/analyzers/symbols.js +333 -0
  55. package/dist/analyzers/symbols.js.map +1 -0
  56. package/dist/analyzers/techStack.d.ts +21 -0
  57. package/dist/analyzers/techStack.d.ts.map +1 -0
  58. package/dist/analyzers/techStack.js +302 -0
  59. package/dist/analyzers/techStack.js.map +1 -0
  60. package/dist/commands/ai-first.d.ts +16 -0
  61. package/dist/commands/ai-first.d.ts.map +1 -0
  62. package/dist/commands/ai-first.js +988 -0
  63. package/dist/commands/ai-first.js.map +1 -0
  64. package/dist/commands/doctor.d.ts +13 -0
  65. package/dist/commands/doctor.d.ts.map +1 -0
  66. package/dist/commands/doctor.js +60 -0
  67. package/dist/commands/doctor.js.map +1 -0
  68. package/dist/commands/explore.d.ts +9 -0
  69. package/dist/commands/explore.d.ts.map +1 -0
  70. package/dist/commands/explore.js +69 -0
  71. package/dist/commands/explore.js.map +1 -0
  72. package/dist/core/aiContextGenerator.d.ts +20 -0
  73. package/dist/core/aiContextGenerator.d.ts.map +1 -0
  74. package/dist/core/aiContextGenerator.js +829 -0
  75. package/dist/core/aiContextGenerator.js.map +1 -0
  76. package/dist/core/chunker.d.ts +23 -0
  77. package/dist/core/chunker.d.ts.map +1 -0
  78. package/dist/core/chunker.js +291 -0
  79. package/dist/core/chunker.js.map +1 -0
  80. package/dist/core/contextGenerator.d.ts +12 -0
  81. package/dist/core/contextGenerator.d.ts.map +1 -0
  82. package/dist/core/contextGenerator.js +257 -0
  83. package/dist/core/contextGenerator.js.map +1 -0
  84. package/dist/core/contextPacket.d.ts +63 -0
  85. package/dist/core/contextPacket.d.ts.map +1 -0
  86. package/dist/core/contextPacket.js +350 -0
  87. package/dist/core/contextPacket.js.map +1 -0
  88. package/dist/core/embeddings.d.ts +50 -0
  89. package/dist/core/embeddings.d.ts.map +1 -0
  90. package/dist/core/embeddings.js +119 -0
  91. package/dist/core/embeddings.js.map +1 -0
  92. package/dist/core/hierarchyGenerator.d.ts +22 -0
  93. package/dist/core/hierarchyGenerator.d.ts.map +1 -0
  94. package/dist/core/hierarchyGenerator.js +327 -0
  95. package/dist/core/hierarchyGenerator.js.map +1 -0
  96. package/dist/core/indexState.d.ts +47 -0
  97. package/dist/core/indexState.d.ts.map +1 -0
  98. package/dist/core/indexState.js +158 -0
  99. package/dist/core/indexState.js.map +1 -0
  100. package/dist/core/indexer.d.ts +105 -0
  101. package/dist/core/indexer.d.ts.map +1 -0
  102. package/dist/core/indexer.js +642 -0
  103. package/dist/core/indexer.js.map +1 -0
  104. package/dist/core/moduleGraph.d.ts +24 -0
  105. package/dist/core/moduleGraph.d.ts.map +1 -0
  106. package/dist/core/moduleGraph.js +156 -0
  107. package/dist/core/moduleGraph.js.map +1 -0
  108. package/dist/core/repoMapper.d.ts +19 -0
  109. package/dist/core/repoMapper.d.ts.map +1 -0
  110. package/dist/core/repoMapper.js +125 -0
  111. package/dist/core/repoMapper.js.map +1 -0
  112. package/dist/core/repoScanner.d.ts +25 -0
  113. package/dist/core/repoScanner.d.ts.map +1 -0
  114. package/dist/core/repoScanner.js +72 -0
  115. package/dist/core/repoScanner.js.map +1 -0
  116. package/dist/core/symbolGraph.d.ts +58 -0
  117. package/dist/core/symbolGraph.d.ts.map +1 -0
  118. package/dist/core/symbolGraph.js +503 -0
  119. package/dist/core/symbolGraph.js.map +1 -0
  120. package/dist/index.d.ts +8 -0
  121. package/dist/index.d.ts.map +1 -0
  122. package/dist/index.js +8 -0
  123. package/dist/index.js.map +1 -0
  124. package/dist/utils/fileUtils.d.ts +33 -0
  125. package/dist/utils/fileUtils.d.ts.map +1 -0
  126. package/dist/utils/fileUtils.js +120 -0
  127. package/dist/utils/fileUtils.js.map +1 -0
  128. package/docs/.vitepress/config.ts +125 -0
  129. package/docs/.vitepress/theme/custom.css +189 -0
  130. package/docs/.vitepress/theme/index.ts +9 -0
  131. package/docs/es/guide/getting-started.md +26 -0
  132. package/docs/es/index.md +128 -0
  133. package/docs/examples/express-api.md +133 -0
  134. package/docs/examples/index.md +26 -0
  135. package/docs/examples/python-django.md +105 -0
  136. package/docs/examples/react-app.md +116 -0
  137. package/docs/guide/architecture.md +212 -0
  138. package/docs/guide/getting-started.md +82 -0
  139. package/docs/guide/installation.md +98 -0
  140. package/docs/guide/quick-start.md +91 -0
  141. package/docs/index.md +139 -0
  142. package/docs/reference/commands.md +203 -0
  143. package/examples/01-express-api.md +133 -0
  144. package/examples/02-react-app.md +137 -0
  145. package/examples/03-python-django.md +136 -0
  146. package/examples/README.md +62 -0
  147. package/package.json +58 -0
  148. package/src/analyzers/aiRules.ts +156 -0
  149. package/src/analyzers/architecture.ts +302 -0
  150. package/src/analyzers/conventions.ts +181 -0
  151. package/src/analyzers/dependencies.ts +307 -0
  152. package/src/analyzers/entrypoints.ts +102 -0
  153. package/src/analyzers/symbols.ts +379 -0
  154. package/src/analyzers/techStack.ts +351 -0
  155. package/src/commands/ai-first.ts +1094 -0
  156. package/src/commands/doctor.ts +68 -0
  157. package/src/commands/explore.ts +50 -0
  158. package/src/core/aiContextGenerator.ts +982 -0
  159. package/src/core/chunker.ts +351 -0
  160. package/src/core/contextGenerator.ts +294 -0
  161. package/src/core/contextPacket.ts +517 -0
  162. package/src/core/embeddings.ts +175 -0
  163. package/src/core/hierarchyGenerator.ts +385 -0
  164. package/src/core/indexState.ts +197 -0
  165. package/src/core/indexer.ts +700 -0
  166. package/src/core/moduleGraph.ts +195 -0
  167. package/src/core/repoMapper.ts +172 -0
  168. package/src/core/repoScanner.ts +103 -0
  169. package/src/core/symbolGraph.ts +650 -0
  170. package/src/index.ts +7 -0
  171. package/src/types/sql.js.d.ts +19 -0
  172. package/src/utils/fileUtils.ts +134 -0
  173. 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]
@@ -0,0 +1,3 @@
1
+ {
2
+ "siteId": "61bf2f52-7f91-4732-92d1-7e1942542f8a"
3
+ }
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
+ ```
@@ -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) |