ai-first-cli 1.3.6 ā 1.3.8
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/CHANGELOG.md +123 -0
- package/README.es.md +14 -1
- package/README.md +14 -1
- package/ai/graph/knowledge-graph.json +1 -1
- package/ai-context/index-state.json +86 -2
- package/dist/analyzers/techStack.d.ts.map +1 -1
- package/dist/analyzers/techStack.js +43 -0
- package/dist/analyzers/techStack.js.map +1 -1
- package/dist/commands/ai-first.d.ts.map +1 -1
- package/dist/commands/ai-first.js +78 -4
- package/dist/commands/ai-first.js.map +1 -1
- package/dist/config/configLoader.d.ts +6 -0
- package/dist/config/configLoader.d.ts.map +1 -0
- package/dist/config/configLoader.js +232 -0
- package/dist/config/configLoader.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +101 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/core/content/contentProcessor.d.ts +4 -0
- package/dist/core/content/contentProcessor.d.ts.map +1 -0
- package/dist/core/content/contentProcessor.js +235 -0
- package/dist/core/content/contentProcessor.js.map +1 -0
- package/dist/core/content/index.d.ts +3 -0
- package/dist/core/content/index.d.ts.map +1 -0
- package/dist/core/content/index.js +2 -0
- package/dist/core/content/index.js.map +1 -0
- package/dist/core/content/types.d.ts +32 -0
- package/dist/core/content/types.d.ts.map +1 -0
- package/dist/core/content/types.js +2 -0
- package/dist/core/content/types.js.map +1 -0
- package/dist/core/gitAnalyzer.d.ts +14 -0
- package/dist/core/gitAnalyzer.d.ts.map +1 -1
- package/dist/core/gitAnalyzer.js +98 -0
- package/dist/core/gitAnalyzer.js.map +1 -1
- package/dist/core/multiRepo/index.d.ts +3 -0
- package/dist/core/multiRepo/index.d.ts.map +1 -0
- package/dist/core/multiRepo/index.js +2 -0
- package/dist/core/multiRepo/index.js.map +1 -0
- package/dist/core/multiRepo/multiRepoScanner.d.ts +18 -0
- package/dist/core/multiRepo/multiRepoScanner.d.ts.map +1 -0
- package/dist/core/multiRepo/multiRepoScanner.js +131 -0
- package/dist/core/multiRepo/multiRepoScanner.js.map +1 -0
- package/dist/core/rag/index.d.ts +3 -0
- package/dist/core/rag/index.d.ts.map +1 -0
- package/dist/core/rag/index.js +2 -0
- package/dist/core/rag/index.js.map +1 -0
- package/dist/core/rag/vectorIndex.d.ts +28 -0
- package/dist/core/rag/vectorIndex.d.ts.map +1 -0
- package/dist/core/rag/vectorIndex.js +71 -0
- package/dist/core/rag/vectorIndex.js.map +1 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +2 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +154 -0
- package/dist/mcp/server.js.map +1 -0
- package/docs/planning/evaluator-v1.0.0/README.md +112 -0
- package/docs/planning/evaluator-v1.0.0/improvements_plan_2026-03-28.md +237 -0
- package/package.json +13 -3
- package/src/analyzers/techStack.ts +47 -1
- package/src/commands/ai-first.ts +83 -4
- package/src/config/configLoader.ts +274 -0
- package/src/config/index.ts +27 -0
- package/src/config/types.ts +117 -0
- package/src/core/content/contentProcessor.ts +292 -0
- package/src/core/content/index.ts +9 -0
- package/src/core/content/types.ts +35 -0
- package/src/core/gitAnalyzer.ts +130 -0
- package/src/core/multiRepo/index.ts +2 -0
- package/src/core/multiRepo/multiRepoScanner.ts +177 -0
- package/src/core/rag/index.ts +2 -0
- package/src/core/rag/vectorIndex.ts +105 -0
- package/src/mcp/index.ts +1 -0
- package/src/mcp/server.ts +179 -0
- package/tests/v1.3.8-integration.test.ts +361 -0
- package/ai-context-evaluation-report-1774223059505.md +0 -206
- package/scripts/ai-context-evaluator.ts +0 -440
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# AI-First Evaluator - Plan de Mejoras
|
|
2
|
+
|
|
3
|
+
**Template Version:** 1.0
|
|
4
|
+
**Evaluator Version:** 1.0.0
|
|
5
|
+
**Evaluation Date:** 2026-03-28
|
|
6
|
+
**Project:** express-api
|
|
7
|
+
**Current Score:** 3.88/5.0
|
|
8
|
+
**Status:** PASS
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Instrucciones de Uso
|
|
13
|
+
|
|
14
|
+
Este documento es un TEMPLATE para registrar resultados de evaluación y planificar mejoras.
|
|
15
|
+
|
|
16
|
+
### Para nuevas evaluaciones:
|
|
17
|
+
1. Copiar este archivo como improvements_plan_YYYY-MM-DD.md
|
|
18
|
+
2. Actualizar los campos marcados con [ACTUALIZAR]
|
|
19
|
+
3. Documentar hallazgos especĆficos del proyecto
|
|
20
|
+
4. Crear issues/tickets para acciones identificadas
|
|
21
|
+
|
|
22
|
+
### Estructura del documento:
|
|
23
|
+
- Resumen: MƩtricas principales y estado general
|
|
24
|
+
- Hallazgos: Fortalezas y Ɣreas de mejora
|
|
25
|
+
- Plan de Acción: Tareas priorizadas con owners y deadlines
|
|
26
|
+
- Seguimiento: Checklist de implementación
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Resumen Ejecutivo
|
|
31
|
+
|
|
32
|
+
### MƩtricas Principales [ACTUALIZAR]
|
|
33
|
+
|
|
34
|
+
- Score Total: 3.88/5.0
|
|
35
|
+
- Umbral MĆnimo: 3.5
|
|
36
|
+
- Ahorro de Costos AI: 100%
|
|
37
|
+
- Duración: 3ms
|
|
38
|
+
- Estado: PASS
|
|
39
|
+
|
|
40
|
+
### Distribución de Puntos
|
|
41
|
+
|
|
42
|
+
| Perspectiva | Peso | Score | Estado |
|
|
43
|
+
|-------------|------|-------|--------|
|
|
44
|
+
| Local Structure | 40 pts | 40/40 | Pass |
|
|
45
|
+
| Content Quality | 80 pts | 62/80 | Warning |
|
|
46
|
+
| AI Assessment | 10 pts | N/A | Skipped |
|
|
47
|
+
| Total | 130 pts | 102/130 | 78% |
|
|
48
|
+
|
|
49
|
+
### AnĆ”lisis por CategorĆa
|
|
50
|
+
|
|
51
|
+
- IMPLEMENTED: 0 issues
|
|
52
|
+
- USER_ACTION: 1 issue
|
|
53
|
+
- KNOWN_LIMITATION: 0 issues
|
|
54
|
+
- IMPROVEMENT: 4 issues
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Fortalezas (Mantener)
|
|
59
|
+
|
|
60
|
+
1. Estructura Local Completa
|
|
61
|
+
- Archivos requeridos presentes
|
|
62
|
+
- JSON vƔlidos
|
|
63
|
+
- Formato markdown consistente
|
|
64
|
+
|
|
65
|
+
2. Features Opcionales Utilizadas
|
|
66
|
+
- API Contracts generados
|
|
67
|
+
- Framework Instructions presentes
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Ćreas de Mejora (Priorizadas)
|
|
72
|
+
|
|
73
|
+
### Alta Prioridad
|
|
74
|
+
|
|
75
|
+
#### 1. Documentation Completeness
|
|
76
|
+
Issue: Faltan secciones requeridas en summary.md
|
|
77
|
+
CategorĆa: IMPROVEMENT
|
|
78
|
+
Severidad: HIGH
|
|
79
|
+
Impacto: +8 pts
|
|
80
|
+
|
|
81
|
+
Checklist:
|
|
82
|
+
- [ ] Agregar sección Overview
|
|
83
|
+
- [ ] Agregar sección Purpose
|
|
84
|
+
- [ ] Agregar sección Features
|
|
85
|
+
|
|
86
|
+
Template para fix:
|
|
87
|
+
```
|
|
88
|
+
## Overview
|
|
89
|
+
[Breve descripción del proyecto]
|
|
90
|
+
|
|
91
|
+
## Purpose
|
|
92
|
+
[Propósito principal]
|
|
93
|
+
|
|
94
|
+
## Features
|
|
95
|
+
- Feature 1: [descripción]
|
|
96
|
+
- Feature 2: [descripción]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Owner: [ASIGNAR]
|
|
100
|
+
Deadline: [FECHA]
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
#### 2. Entry Point Documentation
|
|
105
|
+
Issue: Entry points sin descripciones detalladas
|
|
106
|
+
CategorĆa: IMPROVEMENT
|
|
107
|
+
Severidad: MEDIUM
|
|
108
|
+
Impacto: +10 pts
|
|
109
|
+
|
|
110
|
+
Checklist:
|
|
111
|
+
- [ ] Usar headers para cada entry point
|
|
112
|
+
- [ ] Agregar descripción de propósito
|
|
113
|
+
- [ ] Documentar parƔmetros
|
|
114
|
+
- [ ] Listar dependencias
|
|
115
|
+
|
|
116
|
+
Template para fix:
|
|
117
|
+
```
|
|
118
|
+
### server.js
|
|
119
|
+
Purpose: Punto de entrada principal
|
|
120
|
+
Parameters: PORT, NODE_ENV
|
|
121
|
+
Dependencies: express, cors
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Owner: [ASIGNAR]
|
|
125
|
+
Deadline: [FECHA]
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### Media Prioridad
|
|
130
|
+
|
|
131
|
+
#### 3. Generic Phrases
|
|
132
|
+
Issue: Descripciones contienen frases genƩricas
|
|
133
|
+
CategorĆa: IMPROVEMENT
|
|
134
|
+
Severidad: MEDIUM
|
|
135
|
+
Impacto: +5 pts
|
|
136
|
+
|
|
137
|
+
Ejemplos a corregir:
|
|
138
|
+
- Antes: This project contains API endpoints
|
|
139
|
+
- DespuƩs: REST API providing user authentication
|
|
140
|
+
|
|
141
|
+
Owner: [ASIGNAR]
|
|
142
|
+
Deadline: [FECHA]
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### Baja Prioridad
|
|
147
|
+
|
|
148
|
+
#### 4. Freshness Tracking
|
|
149
|
+
Issue: No hay tracking de freshness
|
|
150
|
+
CategorĆa: USER_ACTION
|
|
151
|
+
Severidad: LOW
|
|
152
|
+
Impacto: Mejor mantenibilidad
|
|
153
|
+
|
|
154
|
+
Acción:
|
|
155
|
+
```
|
|
156
|
+
af init # Re-generar contexto periódicamente
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Frecuencia recomendada: Semanal o al inicio de cada sprint
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Plan de Acción
|
|
164
|
+
|
|
165
|
+
### Inmediato (Esta semana)
|
|
166
|
+
|
|
167
|
+
| # | Tarea | Impacto | Owner | Deadline | Status |
|
|
168
|
+
|---|-------|---------|-------|----------|--------|
|
|
169
|
+
| 1 | Completar summary.md | +8 pts | TBD | TBD | Pending |
|
|
170
|
+
| 2 | Mejorar entrypoints.md | +10 pts | TBD | TBD | Pending |
|
|
171
|
+
|
|
172
|
+
### Corto Plazo (Próximo sprint)
|
|
173
|
+
|
|
174
|
+
| # | Tarea | Impacto | Owner | Deadline | Status |
|
|
175
|
+
|---|-------|---------|-------|----------|--------|
|
|
176
|
+
| 3 | Revisar frases genƩricas | +5 pts | TBD | TBD | Pending |
|
|
177
|
+
| 4 | Habilitar freshness tracking | N/A | TBD | TBD | Pending |
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Proyección de Mejora
|
|
182
|
+
|
|
183
|
+
### Escenarios
|
|
184
|
+
|
|
185
|
+
| Escenario | Score Actual | Score Proyectado | Cambio |
|
|
186
|
+
|-----------|--------------|------------------|--------|
|
|
187
|
+
| Conservador | 3.88 | 4.05 | +0.17 |
|
|
188
|
+
| Completo | 3.88 | 4.20 | +0.32 |
|
|
189
|
+
|
|
190
|
+
### ROI Esperado
|
|
191
|
+
|
|
192
|
+
- Tiempo estimado: 2-3 horas
|
|
193
|
+
- Mejora en score: +0.32 puntos
|
|
194
|
+
- Impacto en calidad de AI: Mayor comprensión
|
|
195
|
+
- Ahorro continuo: Mantiene 100% ahorro
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Checklist de Seguimiento
|
|
200
|
+
|
|
201
|
+
### Implementación
|
|
202
|
+
- [ ] Mejora #1 implementada
|
|
203
|
+
- [ ] Mejora #2 implementada
|
|
204
|
+
- [ ] Mejora #3 implementada (opcional)
|
|
205
|
+
- [ ] Mejora #4 implementada (opcional)
|
|
206
|
+
|
|
207
|
+
### Verificación
|
|
208
|
+
- [ ] Re-ejecutar evaluator
|
|
209
|
+
- [ ] Validar nuevo score >= 4.0
|
|
210
|
+
- [ ] Confirmar que no hay regresiones
|
|
211
|
+
- [ ] Actualizar este documento
|
|
212
|
+
|
|
213
|
+
### Documentación
|
|
214
|
+
- [ ] Actualizar CHANGELOG
|
|
215
|
+
- [ ] Crear PR con cambios
|
|
216
|
+
- [ ] Revisión de código
|
|
217
|
+
- [ ] Merge a main
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Notas Adicionales
|
|
222
|
+
|
|
223
|
+
### Lecciones Aprendidas
|
|
224
|
+
[ESPACIO PARA NOTAS]
|
|
225
|
+
|
|
226
|
+
### Bloqueos Identificados
|
|
227
|
+
[DOCUMENTAR SI HAY BLOQUEOS]
|
|
228
|
+
|
|
229
|
+
### Recursos Ćtiles
|
|
230
|
+
- GuĆa de escritura: [LINK]
|
|
231
|
+
- Template summary.md: [LINK]
|
|
232
|
+
- Ejemplos entry points: [LINK]
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
Documento generado por: AI-First Evaluator v1.0.0
|
|
237
|
+
Ćltima actualización: 2026-03-28
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-first-cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "CLI tool that prepares any repository to be used effectively by AI coding agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,11 @@
|
|
|
16
16
|
"docs:dev": "vitepress dev docs",
|
|
17
17
|
"docs:build": "vitepress build docs",
|
|
18
18
|
"docs:preview": "vitepress preview docs",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"postinstall": "if [ -d node_modules/ai-first-evaluator ]; then cd node_modules/ai-first-evaluator && npm install && npm run build 2>/dev/null || true; fi",
|
|
21
|
+
"evaluate": "node node_modules/ai-first-evaluator/dist/core/evaluation/run-evaluation.js --config evaluator.config.json 2>/dev/null || echo 'Evaluator not installed'",
|
|
22
|
+
"evaluate:ci": "node node_modules/ai-first-evaluator/dist/core/evaluation/run-evaluation.js --config evaluator.config.json --compare-baseline --save-baseline 2>/dev/null || echo 'Evaluator not installed'",
|
|
23
|
+
"evaluate:quick": "node node_modules/ai-first-evaluator/dist/core/evaluation/run-evaluation.js --config evaluator.config.json --skip-ai 2>/dev/null || echo 'Evaluator not installed'"
|
|
20
24
|
},
|
|
21
25
|
"keywords": [
|
|
22
26
|
"ai",
|
|
@@ -27,7 +31,9 @@
|
|
|
27
31
|
"development",
|
|
28
32
|
"tool",
|
|
29
33
|
"code-analysis",
|
|
30
|
-
"indexing"
|
|
34
|
+
"indexing",
|
|
35
|
+
"mcp",
|
|
36
|
+
"model-context-protocol"
|
|
31
37
|
],
|
|
32
38
|
"author": "Julian Perez Pesce <julian@example.com> (https://github.com/julianperezpesce)",
|
|
33
39
|
"license": "MIT",
|
|
@@ -47,7 +53,11 @@
|
|
|
47
53
|
"vitest": "^4.1.0",
|
|
48
54
|
"vue": "^3.5.30"
|
|
49
55
|
},
|
|
56
|
+
"optionalDependencies": {
|
|
57
|
+
"ai-first-evaluator": "git+https://github.com/julianperezpesce/ai-first-evaluator.git"
|
|
58
|
+
},
|
|
50
59
|
"dependencies": {
|
|
60
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
51
61
|
"chokidar": "^5.0.0",
|
|
52
62
|
"ora": "^9.3.0",
|
|
53
63
|
"sql.js": "^1.10.0"
|
|
@@ -208,7 +208,53 @@ function detectFrameworks(files: FileInfo[], fileNames: Set<string>, rootDir: st
|
|
|
208
208
|
frameworks.push("Spring Boot");
|
|
209
209
|
}
|
|
210
210
|
} catch {}
|
|
211
|
-
|
|
211
|
+
|
|
212
|
+
// Detect Python frameworks from requirements.txt, Pipfile, pyproject.toml
|
|
213
|
+
try {
|
|
214
|
+
const pythonFrameworkMap: Record<string, string[]> = {
|
|
215
|
+
"django": ["Django"],
|
|
216
|
+
"flask": ["Flask"],
|
|
217
|
+
"fastapi": ["FastAPI"],
|
|
218
|
+
"tornado": ["Tornado"],
|
|
219
|
+
"pyramid": ["Pyramid"],
|
|
220
|
+
"bottle": ["Bottle"],
|
|
221
|
+
"cherrypy": ["CherryPy"],
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// Check requirements.txt
|
|
225
|
+
const reqPath = path.join(rootDir, "requirements.txt");
|
|
226
|
+
if (fs.existsSync(reqPath)) {
|
|
227
|
+
const reqContent = readFile(reqPath);
|
|
228
|
+
for (const [dep, names] of Object.entries(pythonFrameworkMap)) {
|
|
229
|
+
if (reqContent.toLowerCase().includes(dep.toLowerCase()) && !frameworks.some(f => names.includes(f))) {
|
|
230
|
+
frameworks.push(...names);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Check Pipfile
|
|
236
|
+
const pipfilePath = path.join(rootDir, "Pipfile");
|
|
237
|
+
if (fs.existsSync(pipfilePath)) {
|
|
238
|
+
const pipfileContent = readFile(pipfilePath);
|
|
239
|
+
for (const [dep, names] of Object.entries(pythonFrameworkMap)) {
|
|
240
|
+
if (pipfileContent.toLowerCase().includes(dep.toLowerCase()) && !frameworks.some(f => names.includes(f))) {
|
|
241
|
+
frameworks.push(...names);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Check pyproject.toml
|
|
247
|
+
const pyprojectPath = path.join(rootDir, "pyproject.toml");
|
|
248
|
+
if (fs.existsSync(pyprojectPath)) {
|
|
249
|
+
const pyprojectContent = readFile(pyprojectPath);
|
|
250
|
+
for (const [dep, names] of Object.entries(pythonFrameworkMap)) {
|
|
251
|
+
if (pyprojectContent.toLowerCase().includes(dep.toLowerCase()) && !frameworks.some(f => names.includes(f))) {
|
|
252
|
+
frameworks.push(...names);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
} catch {}
|
|
257
|
+
|
|
212
258
|
// Detect SwiftUI from Swift files
|
|
213
259
|
const swiftFiles = files.filter(f => f.extension === "swift");
|
|
214
260
|
for (const swiftFile of swiftFiles) {
|
package/src/commands/ai-first.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { runIncrementalUpdate, detectChangedFiles } from "../core/incrementalAna
|
|
|
31
31
|
import { generateAllSchema } from "../core/schema.js";
|
|
32
32
|
import { Database } from "sql.js";
|
|
33
33
|
import ora from "ora";
|
|
34
|
+
import { startMCP } from "../mcp/index.js";
|
|
34
35
|
import process from "process";
|
|
35
36
|
|
|
36
37
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -1077,6 +1078,8 @@ Options:
|
|
|
1077
1078
|
} else if (command === 'init' || !command) {
|
|
1078
1079
|
// Init command - generate all context files
|
|
1079
1080
|
if (command === 'init') args.shift();
|
|
1081
|
+
|
|
1082
|
+
let preset: string | undefined;
|
|
1080
1083
|
|
|
1081
1084
|
for (let i = 0; i < args.length; i++) {
|
|
1082
1085
|
const arg = args[i];
|
|
@@ -1089,6 +1092,10 @@ Options:
|
|
|
1089
1092
|
case "-o":
|
|
1090
1093
|
options.outputDir = args[++i];
|
|
1091
1094
|
break;
|
|
1095
|
+
case "--preset":
|
|
1096
|
+
case "-p":
|
|
1097
|
+
preset = args[++i];
|
|
1098
|
+
break;
|
|
1092
1099
|
case "--help":
|
|
1093
1100
|
case "-h":
|
|
1094
1101
|
console.log(`
|
|
@@ -1106,18 +1113,45 @@ Commands:
|
|
|
1106
1113
|
doctor Check repository health and AI readiness
|
|
1107
1114
|
explore <module> Explore module dependencies
|
|
1108
1115
|
map Generate repository map (files, modules, graph)
|
|
1109
|
-
adapters
|
|
1110
|
-
|
|
1111
|
-
|
|
1116
|
+
adapters List available adapters
|
|
1117
|
+
git Show git activity and recent changes
|
|
1118
|
+
graph Build knowledge graph
|
|
1119
|
+
update Update context incrementally
|
|
1120
|
+
mcp Start MCP server for AI agents
|
|
1112
1121
|
|
|
1113
1122
|
Options:
|
|
1114
1123
|
-r, --root <dir> Root directory to scan (default: current directory)
|
|
1115
1124
|
-o, --output <dir> Output directory (default: ./ai-context)
|
|
1125
|
+
-p, --preset <name> Use preset (full, quick, api, docs)
|
|
1116
1126
|
-h, --help Show help message
|
|
1127
|
+
|
|
1128
|
+
Presets:
|
|
1129
|
+
full Complete analysis with all features
|
|
1130
|
+
quick Fast analysis for development iterations
|
|
1131
|
+
api Focus on API endpoints and services
|
|
1132
|
+
docs Documentation files only
|
|
1117
1133
|
`);
|
|
1118
1134
|
process.exit(0);
|
|
1119
1135
|
}
|
|
1120
1136
|
}
|
|
1137
|
+
|
|
1138
|
+
const rootDir = options.rootDir || process.cwd();
|
|
1139
|
+
const configPath = path.join(rootDir, 'ai-first.config.json');
|
|
1140
|
+
if (fs.existsSync(configPath)) {
|
|
1141
|
+
try {
|
|
1142
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
1143
|
+
if (config.output?.directory && !options.outputDir) {
|
|
1144
|
+
options.outputDir = path.join(rootDir, config.output.directory);
|
|
1145
|
+
}
|
|
1146
|
+
if (config.preset && !preset) {
|
|
1147
|
+
preset = config.preset;
|
|
1148
|
+
}
|
|
1149
|
+
} catch {}
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
if (preset) {
|
|
1153
|
+
console.log(`\nšļø Using preset: ${preset}\n`);
|
|
1154
|
+
}
|
|
1121
1155
|
|
|
1122
1156
|
runAIFirst(options).then((result) => {
|
|
1123
1157
|
process.exit(result.success ? 0 : 1);
|
|
@@ -1491,7 +1525,52 @@ Examples:
|
|
|
1491
1525
|
}
|
|
1492
1526
|
|
|
1493
1527
|
process.exit(0);
|
|
1494
|
-
|
|
1528
|
+
} else if (command === 'mcp') {
|
|
1529
|
+
// MCP command - start Model Context Protocol server
|
|
1530
|
+
args.shift();
|
|
1531
|
+
|
|
1532
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
1533
|
+
console.log(`
|
|
1534
|
+
ai-first mcp - Start Model Context Protocol server
|
|
1535
|
+
|
|
1536
|
+
Usage: ai-first mcp [options]
|
|
1537
|
+
|
|
1538
|
+
Options:
|
|
1539
|
+
-r, --root <dir> Root directory to scan (default: current directory)
|
|
1540
|
+
-h, --help Show help message
|
|
1541
|
+
|
|
1542
|
+
Description:
|
|
1543
|
+
Starts an MCP server that allows AI agents (Claude Desktop, etc.) to
|
|
1544
|
+
query repository context using the Model Context Protocol.
|
|
1545
|
+
|
|
1546
|
+
The server provides these tools:
|
|
1547
|
+
- generate_context: Generate AI context for the repository
|
|
1548
|
+
- index_repo: Create SQLite index for fast queries
|
|
1549
|
+
- query_symbol: Look up symbols by name
|
|
1550
|
+
- get_architecture: Get architecture analysis
|
|
1551
|
+
- get_tech_stack: Get technology stack information
|
|
1552
|
+
|
|
1553
|
+
Examples:
|
|
1554
|
+
ai-first mcp # Start MCP server in current directory
|
|
1555
|
+
ai-first mcp --root ./my-project # Start with specific root directory
|
|
1556
|
+
`);
|
|
1557
|
+
process.exit(0);
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
let rootDir = process.cwd();
|
|
1561
|
+
|
|
1562
|
+
for (let i = 0; i < args.length; i++) {
|
|
1563
|
+
const arg = args[i];
|
|
1564
|
+
if (arg === "--root" || arg === "-r") rootDir = args[++i];
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
console.log("\nš Starting MCP server...\n");
|
|
1568
|
+
console.log(` Root directory: ${rootDir}`);
|
|
1569
|
+
console.log(" Protocol: stdio");
|
|
1570
|
+
console.log("\n The server is now running and ready to accept MCP requests.");
|
|
1571
|
+
console.log(" Use Ctrl+C to stop.\n");
|
|
1572
|
+
|
|
1573
|
+
startMCP({ rootDir });
|
|
1495
1574
|
} else {
|
|
1496
1575
|
console.log(`Unknown command: ${command}`);
|
|
1497
1576
|
console.log(`Use 'ai-first --help' for usage information`);
|