claude-git-hooks 2.4.0 → 2.5.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/CHANGELOG.md +262 -135
- package/README.md +158 -67
- package/bin/claude-hooks +452 -10
- package/lib/config.js +29 -0
- package/lib/hooks/pre-commit.js +2 -6
- package/lib/hooks/prepare-commit-msg.js +27 -4
- package/lib/utils/claude-client.js +148 -16
- package/lib/utils/file-operations.js +0 -102
- package/lib/utils/github-api.js +641 -0
- package/lib/utils/github-client.js +770 -0
- package/lib/utils/interactive-ui.js +314 -0
- package/lib/utils/mcp-setup.js +342 -0
- package/lib/utils/sanitize.js +180 -0
- package/lib/utils/task-id.js +425 -0
- package/package.json +4 -1
- package/templates/CREATE_GITHUB_PR.md +32 -0
- package/templates/config.example.json +41 -41
- package/templates/config.github.example.json +51 -0
- package/templates/presets/ai/PRE_COMMIT_GUIDELINES.md +18 -1
- package/templates/presets/ai/config.json +12 -12
- package/templates/presets/ai/preset.json +37 -42
- package/templates/presets/backend/ANALYSIS_PROMPT.md +23 -28
- package/templates/presets/backend/PRE_COMMIT_GUIDELINES.md +41 -3
- package/templates/presets/backend/config.json +12 -12
- package/templates/presets/database/config.json +12 -12
- package/templates/presets/default/config.json +12 -12
- package/templates/presets/frontend/config.json +12 -12
- package/templates/presets/fullstack/config.json +12 -12
- package/templates/settings.local.example.json +4 -0
package/README.md
CHANGED
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
## 🎯 Características principales
|
|
16
16
|
|
|
17
17
|
- 🔍 **Análisis de código pre-commit**: Detecta issues críticos antes de que lleguen al repo
|
|
18
|
-
- 💬 **Mensajes de commit automáticos**: Escribe "auto" y Claude genera el mensaje
|
|
19
|
-
- 📋 **Generación de PRs**:
|
|
18
|
+
- 💬 **Mensajes de commit automáticos**: Escribe "auto" y Claude genera el mensaje con task-id (Jira, GitHub, Linear)
|
|
19
|
+
- 📋 **Generación de PRs**: Análisis de diff y metadata automática con un comando
|
|
20
|
+
- 🔗 **Creación de PRs en GitHub**: Claude genera metadata, Octokit crea el PR (determinista) - v2.5.0+
|
|
20
21
|
- 🎯 **Presets por tech-stack**: 6 configuraciones optimizadas (backend, frontend, fullstack, database, ai, default) - v2.3.0+
|
|
21
|
-
- ⚠️ **Skip inteligente** (EXPERIMENTAL/BROKEN): Exclusión de código con comentarios SKIP_ANALYSIS - no funciona correctamente con git diff
|
|
22
22
|
- 🚀 **Parallel Analysis**: Multiple Claude CLI processes analyzing file batches simultaneously (v2.2.0+)
|
|
23
23
|
- 🔄 **Auto-actualización**: Se mantiene actualizado automáticamente
|
|
24
24
|
- 🌍 **Cross-platform**: Windows, WSL, macOS, Linux sin configuración especial
|
|
@@ -37,6 +37,12 @@ claude-hooks analyze-diff
|
|
|
37
37
|
# Analizar diferencias para PR (comparar con origin/develop)
|
|
38
38
|
claude-hooks analyze-diff develop
|
|
39
39
|
|
|
40
|
+
# Crear PR en GitHub con metadata automática (v2.5.0+)
|
|
41
|
+
claude-hooks create-pr develop
|
|
42
|
+
|
|
43
|
+
# Configurar token de GitHub para PRs (v2.5.0+)
|
|
44
|
+
claude-hooks setup-github
|
|
45
|
+
|
|
40
46
|
# Reinstalar durante desarrollo (después de npm link)
|
|
41
47
|
claude-hooks install --force --skip-auth
|
|
42
48
|
|
|
@@ -92,8 +98,14 @@ claude-hooks enable
|
|
|
92
98
|
# Commit con análisis de código
|
|
93
99
|
git commit -m "feat: nueva funcionalidad"
|
|
94
100
|
|
|
95
|
-
# Generar mensaje
|
|
101
|
+
# Generar mensaje automático con task-id (v2.5.0+)
|
|
102
|
+
# Branch: feature/IX-123-add-auth → detecta IX-123
|
|
103
|
+
git commit -m "auto"
|
|
104
|
+
# Resultado: [IX-123] feat: add user authentication
|
|
105
|
+
|
|
106
|
+
# Branch: feature/471459f-test → NO detecta (hash, no task-id)
|
|
96
107
|
git commit -m "auto"
|
|
108
|
+
# Resultado: feat: add test feature (sin task-id)
|
|
97
109
|
|
|
98
110
|
# Saltar análisis (emergencias)
|
|
99
111
|
git commit --no-verify -m "hotfix: corrección urgente"
|
|
@@ -102,23 +114,93 @@ git commit --no-verify -m "hotfix: corrección urgente"
|
|
|
102
114
|
git commit --amend
|
|
103
115
|
```
|
|
104
116
|
|
|
105
|
-
|
|
117
|
+
## 🚀 Quick Setup: GitHub PR Creation
|
|
118
|
+
|
|
119
|
+
Para usar `create-pr` necesitas configurar autenticación con GitHub:
|
|
120
|
+
|
|
121
|
+
### 1. Ejecuta el setup wizard
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
claude-hooks setup-github
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
El comando verificará tu token o te guiará a configurarlo.
|
|
106
128
|
|
|
107
|
-
|
|
108
|
-
// NOTA: Este feature NO funciona correctamente
|
|
109
|
-
// Los marcadores no son detectados si fueron agregados en commits anteriores
|
|
129
|
+
### 2. Opciones de configuración del token
|
|
110
130
|
|
|
111
|
-
|
|
112
|
-
private String legacyCode = "no analizar siguiente línea";
|
|
131
|
+
**Opción A - Settings local (recomendado):**
|
|
113
132
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
133
|
+
```bash
|
|
134
|
+
# Crear .claude/settings.local.json
|
|
135
|
+
cat > .claude/settings.local.json << 'EOF'
|
|
136
|
+
{
|
|
137
|
+
"githubToken": "ghp_tu_token_aqui"
|
|
118
138
|
}
|
|
119
|
-
|
|
139
|
+
EOF
|
|
120
140
|
```
|
|
121
141
|
|
|
142
|
+
**Opción B - Variable de entorno:**
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
export GITHUB_TOKEN="ghp_tu_token_aqui"
|
|
146
|
+
# o
|
|
147
|
+
export GITHUB_PERSONAL_ACCESS_TOKEN="ghp_tu_token_aqui"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Opción C - Claude Desktop config** (auto-detectado si existe)
|
|
151
|
+
|
|
152
|
+
### 3. Crear GitHub token
|
|
153
|
+
|
|
154
|
+
1. Ir a https://github.com/settings/tokens
|
|
155
|
+
2. "Generate new token (classic)"
|
|
156
|
+
3. Scopes requeridos: **repo** (all) + **read:org**
|
|
157
|
+
4. Copiar token (empieza con `ghp_`)
|
|
158
|
+
|
|
159
|
+
### 4. Configurar reviewers y labels (opcional)
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Ver templates/config.github.example.json para formato completo
|
|
163
|
+
cat > .claude/config.json << 'EOF'
|
|
164
|
+
{
|
|
165
|
+
"github": {
|
|
166
|
+
"pr": {
|
|
167
|
+
"defaultBase": "develop",
|
|
168
|
+
"reviewers": ["tu-usuario-github", "teammate"],
|
|
169
|
+
"labelRules": {
|
|
170
|
+
"backend": ["backend", "java"],
|
|
171
|
+
"frontend": ["frontend", "react"]
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
EOF
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
**Nota:** Los reviewers también se detectan automáticamente desde CODEOWNERS si existe.
|
|
180
|
+
|
|
181
|
+
### 5. Crear tu primer PR
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git checkout -b feature/mi-feature
|
|
185
|
+
# ... hacer cambios ...
|
|
186
|
+
git add .
|
|
187
|
+
git commit -m "feat: nueva funcionalidad"
|
|
188
|
+
git push -u origin feature/mi-feature
|
|
189
|
+
|
|
190
|
+
# Crear PR
|
|
191
|
+
claude-hooks create-pr develop
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Arquitectura:** Claude analiza el diff y genera metadata (título, descripción, reviewers, labels) → Octokit crea el PR de forma determinista.
|
|
195
|
+
|
|
196
|
+
Ver `templates/config.github.example.json` para configuración avanzada (reviewer rules por path, custom labels, etc.).
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## 📆 Próximos Desarrollos
|
|
201
|
+
|
|
202
|
+
Toda idea es bienvenida, aunque parezca espantosa. Si hay bugs, incluirlos también. Dónde? en https://github.com/mscope-S-L/git-hooks/issues/new.
|
|
203
|
+
|
|
122
204
|
### 🔧 Configuración Avanzada (v2.2.0+)
|
|
123
205
|
|
|
124
206
|
```bash
|
|
@@ -139,7 +221,8 @@ cat > .claude/config.json << 'EOF'
|
|
|
139
221
|
},
|
|
140
222
|
"commitMessage": {
|
|
141
223
|
"autoKeyword": "auto",
|
|
142
|
-
"timeout": 180000
|
|
224
|
+
"timeout": 180000,
|
|
225
|
+
"taskIdPattern": "([A-Z]{1,3}[-\\s]\\d{3,5})"
|
|
143
226
|
},
|
|
144
227
|
"subagents": {
|
|
145
228
|
"enabled": true,
|
|
@@ -151,18 +234,23 @@ cat > .claude/config.json << 'EOF'
|
|
|
151
234
|
}
|
|
152
235
|
}
|
|
153
236
|
EOF
|
|
237
|
+
|
|
238
|
+
# Personalizar patrón de task-id
|
|
239
|
+
# Default: 1-3 letras + separador + 3-5 dígitos
|
|
240
|
+
# Ejemplos válidos: ABC-12345, IX-123, DE 4567
|
|
241
|
+
# No detecta: 471459f (hash), ABCD-123 (4 letras), IX-12 (2 dígitos)
|
|
154
242
|
```
|
|
155
243
|
|
|
156
244
|
#### 🎯 Presets Disponibles
|
|
157
245
|
|
|
158
|
-
| Preset | Extensiones de Archivo | Caso de Uso
|
|
159
|
-
| ------------- | -------------------------------------------------------------------------- |
|
|
160
|
-
| **backend** | `.java`, `.xml`, `.yml`, `.yaml` | APIs Spring Boot
|
|
161
|
-
| **frontend** | `.js`, `.jsx`, `.ts`, `.tsx`, `.css`, `.scss`, `.html` | Apps React
|
|
162
|
-
| **fullstack** | Todos backend + frontend | Apps full-stack
|
|
163
|
-
| **database** | `.sql` | Scripts de BD
|
|
164
|
-
| **ai** | `.js`, `.json`, `.md`, `.sh` | Herramientas CLI
|
|
165
|
-
| **default** | `.js`, `.sh`, `.py`, `.rb`, `.pl`, `.sql`, `.yaml`, `.json`, `.xml`, `.md` | Propósito general| Lenguajes mixtos |
|
|
246
|
+
| Preset | Extensiones de Archivo | Caso de Uso | Tech Stack |
|
|
247
|
+
| ------------- | -------------------------------------------------------------------------- | ----------------- | ---------------------------- |
|
|
248
|
+
| **backend** | `.java`, `.xml`, `.yml`, `.yaml` | APIs Spring Boot | Spring Boot, JPA, SQL Server |
|
|
249
|
+
| **frontend** | `.js`, `.jsx`, `.ts`, `.tsx`, `.css`, `.scss`, `.html` | Apps React | React, Redux, Material-UI |
|
|
250
|
+
| **fullstack** | Todos backend + frontend | Apps full-stack | Spring Boot + React |
|
|
251
|
+
| **database** | `.sql` | Scripts de BD | SQL Server, T-SQL |
|
|
252
|
+
| **ai** | `.js`, `.json`, `.md`, `.sh` | Herramientas CLI | Node.js, Claude API |
|
|
253
|
+
| **default** | `.js`, `.sh`, `.py`, `.rb`, `.pl`, `.sql`, `.yaml`, `.json`, `.xml`, `.md` | Propósito general | Lenguajes mixtos |
|
|
166
254
|
|
|
167
255
|
---
|
|
168
256
|
|
|
@@ -263,12 +351,13 @@ git commit -m "fix: resolver issues"
|
|
|
263
351
|
|
|
264
352
|
### ⚡ Tips y Trucos
|
|
265
353
|
|
|
266
|
-
1. **Mensaje automático**: Usa `"auto"` como mensaje para que Claude lo genere
|
|
267
|
-
2. **
|
|
268
|
-
3. **
|
|
269
|
-
4. **
|
|
270
|
-
5. **
|
|
271
|
-
6. **
|
|
354
|
+
1. **Mensaje automático**: Usa `"auto"` como mensaje para que Claude lo genere con task-id automático
|
|
355
|
+
2. **Task-ID pattern**: Default 1-3 letras + separador + 3-5 dígitos (ABC-12345, IX-123). Configurable en `.claude/config.json` → `commitMessage.taskIdPattern`
|
|
356
|
+
3. **Skip auth**: Usa `--skip-auth` en CI/CD o desarrollo local
|
|
357
|
+
4. **Force install**: Usa `--force` para reinstalar sin confirmación
|
|
358
|
+
5. **Debug**: Activa con `claude-hooks --debug true` o en `.claude/config.json`: `{"system": {"debug": true}}`
|
|
359
|
+
6. **Archivos grandes**: Se omiten automáticamente archivos > 1MB
|
|
360
|
+
7. **Límite de archivos**: Máximo 30 archivos por commit (configurable)
|
|
272
361
|
|
|
273
362
|
### 🚀 Parallel Analysis (v2.2.0+)
|
|
274
363
|
|
|
@@ -421,9 +510,6 @@ Durante la instalación, Claude Hooks actualiza automáticamente tu `.gitignore`
|
|
|
421
510
|
```gitignore
|
|
422
511
|
# Claude Git Hooks
|
|
423
512
|
.claude/
|
|
424
|
-
debug-claude-response.json
|
|
425
|
-
claude_resolution_prompt.md
|
|
426
|
-
.claude-pr-analysis.json
|
|
427
513
|
```
|
|
428
514
|
|
|
429
515
|
Esto asegura que:
|
|
@@ -487,25 +573,12 @@ Si no existe un `.gitignore`, se creará uno nuevo. Si ya existe, las entradas s
|
|
|
487
573
|
- ⚠️ Indicador de breaking changes
|
|
488
574
|
- 🧪 Notas de testing recomendado
|
|
489
575
|
- 📝 Archivo `.claude-pr-analysis.json`
|
|
576
|
+
- **Creación de PRs en GitHub (v2.5.0+)**: `claude-hooks create-pr [branch]` crea pull requests directamente en GitHub vía MCP. Extrae task-id de branch, genera metadata con Claude, detecta reviewers desde CODEOWNERS o config, aplica labels por preset, y muestra preview interactivo antes de crear
|
|
490
577
|
- **Auto-actualización**: Verificación automática de versiones antes de cada commit con prompt interactivo para actualizar
|
|
491
578
|
- **Comando update**: `claude-hooks update` para actualizar manualmente a la última versión
|
|
492
579
|
- **Modo debug**: `claude-hooks --debug true` activa logging detallado para troubleshooting
|
|
493
580
|
- **Análisis de PR**: Nuevo comando `analyze-diff` para generar información de Pull Requests
|
|
494
581
|
- **Validación de dependencias**: Verifica que Claude CLI esté autenticado antes de ejecutar
|
|
495
|
-
- **⚠️ Exclusión de código del análisis (EXPERIMENTAL/BROKEN)**: Los marcadores `// SKIP_ANALYSIS_LINE` y `// SKIP_ANALYSIS_BLOCK` no funcionan correctamente. El hook analiza git diff en lugar del archivo completo, por lo que marcadores agregados en commits anteriores no son detectados en cambios subsecuentes.
|
|
496
|
-
|
|
497
|
-
```java
|
|
498
|
-
// NOTA: Este feature actualmente NO funciona de forma confiable
|
|
499
|
-
// SKIP_ANALYSIS_LINE
|
|
500
|
-
@Autowired private LegacyService legacyService;
|
|
501
|
-
|
|
502
|
-
// SKIP_ANALYSIS_BLOCK
|
|
503
|
-
@Deprecated
|
|
504
|
-
public void methodWithKnownIssues() {
|
|
505
|
-
System.out.println("Legacy code");
|
|
506
|
-
}
|
|
507
|
-
// SKIP_ANALYSIS_BLOCK
|
|
508
|
-
```
|
|
509
582
|
|
|
510
583
|
### Desactivar/Activar hooks
|
|
511
584
|
|
|
@@ -587,14 +660,23 @@ claude-git-hooks/
|
|
|
587
660
|
│ ├── resolution-prompt.js # Generador de resolution prompts
|
|
588
661
|
│ ├── preset-loader.js # Cargador de presets
|
|
589
662
|
│ ├── installation-diagnostics.js # Diagnósticos de instalación
|
|
590
|
-
│
|
|
663
|
+
│ ├── claude-diagnostics.js # Diagnósticos de errores Claude CLI
|
|
664
|
+
│ ├── github-api.js # 🆕 Integración Octokit (determinista)
|
|
665
|
+
│ ├── github-client.js # Cliente GitHub (CODEOWNERS, reviewers)
|
|
666
|
+
│ ├── task-id.js # Extracción task-id (Jira, GitHub, Linear)
|
|
667
|
+
│ ├── interactive-ui.js # UI interactiva CLI (preview, prompts)
|
|
668
|
+
│ └── mcp-setup.js # Setup y detección MCP
|
|
591
669
|
├── templates/
|
|
592
670
|
│ ├── pre-commit # Bash wrapper (llama a lib/hooks/pre-commit.js)
|
|
593
671
|
│ ├── prepare-commit-msg # Bash wrapper (llama a lib/hooks/prepare-commit-msg.js)
|
|
594
672
|
│ ├── check-version.sh # Script de verificación de versión
|
|
595
673
|
│ ├── CLAUDE_PRE_COMMIT_SONAR.md # Pautas SonarQube
|
|
596
674
|
│ ├── CLAUDE_ANALYSIS_PROMPT_SONAR.md # Template de prompt para análisis
|
|
597
|
-
│
|
|
675
|
+
│ ├── CLAUDE_RESOLUTION_PROMPT.md # Template para resolución de issues
|
|
676
|
+
│ ├── ANALYZE_DIFF.md # Template para análisis de diff (PR metadata)
|
|
677
|
+
│ ├── CREATE_GITHUB_PR.md # Template para creación de PR
|
|
678
|
+
│ ├── config.github.example.json # 🆕 Ejemplo configuración GitHub
|
|
679
|
+
│ └── settings.local.example.json # 🆕 Ejemplo token local (gitignored)
|
|
598
680
|
├── test/ # 🆕 Tests unitarios con Jest
|
|
599
681
|
│ └── unit/
|
|
600
682
|
│ └── logger.test.js # Tests del logger
|
|
@@ -616,34 +698,41 @@ claude-git-hooks/
|
|
|
616
698
|
|
|
617
699
|
#### Core Utilities
|
|
618
700
|
|
|
619
|
-
| Module
|
|
620
|
-
|
|
621
|
-
| **`config.js`**
|
|
622
|
-
| **`logger.js`**
|
|
623
|
-
| **`git-operations.js`**
|
|
624
|
-
| **`file-utils.js`**
|
|
625
|
-
| **`claude-client.js`**
|
|
626
|
-
| **`prompt-builder.js`**
|
|
627
|
-
| **`preset-loader.js`**
|
|
628
|
-
| **`resolution-prompt.js`**
|
|
629
|
-
| **`installation-diagnostics.js`** | Installation error diagnostics
|
|
630
|
-
| **`claude-diagnostics.js`**
|
|
701
|
+
| Module | Purpose | Key Exports | Usage Context |
|
|
702
|
+
| --------------------------------- | ------------------------------------- | ------------------------------------------------- | ---------------------------------------------- |
|
|
703
|
+
| **`config.js`** | Centralized configuration management | `getConfig()`, `defaults` | Priority merging: defaults < user < preset |
|
|
704
|
+
| **`logger.js`** | Structured logging with debug support | `info()`, `warning()`, `error()`, `debug()` | Console output with context tracking |
|
|
705
|
+
| **`git-operations.js`** | Git command abstractions | `getRepoRoot()`, `getStagedFiles()`, `getDiff()` | Safe git operations with error handling |
|
|
706
|
+
| **`file-utils.js`** | File system operations | `ensureDir()`, `writeFile()` | Repo-root-relative path handling |
|
|
707
|
+
| **`claude-client.js`** | Claude CLI integration | `analyzeCode()`, `analyzeCodeParallel()` | Prompt execution with timeout/retry |
|
|
708
|
+
| **`prompt-builder.js`** | Template-based prompts | `buildAnalysisPrompt()`, `loadTemplate()` | Dynamic prompt construction from .md files |
|
|
709
|
+
| **`preset-loader.js`** | Preset system | `loadPreset()`, `listPresets()`, `loadTemplate()` | Metadata, config, template loading |
|
|
710
|
+
| **`resolution-prompt.js`** | Issue resolution prompts | `generateResolutionPrompt()` | AI-friendly error remediation prompts |
|
|
711
|
+
| **`installation-diagnostics.js`** | Installation error diagnostics | `formatError()`, `getInstallationDiagnostics()` | Installation error formatting with remediation |
|
|
712
|
+
| **`claude-diagnostics.js`** | Claude CLI error diagnostics | `detectClaudeError()`, `formatClaudeError()` | Rate limit, auth, network error detection |
|
|
713
|
+
| **`github-api.js`** | Octokit GitHub integration | `createPullRequest()`, `readCodeowners()` | Deterministic PR creation, token resolution |
|
|
714
|
+
| **`github-client.js`** | GitHub operations | `getReviewersForFiles()`, `parseGitHubRepo()` | CODEOWNERS parsing, reviewer detection |
|
|
715
|
+
| **`task-id.js`** | Task ID extraction | `getOrPromptTaskId()`, `formatWithTaskId()` | Jira, GitHub, Linear task-id extraction |
|
|
716
|
+
| **`interactive-ui.js`** | Interactive CLI components | `showPRPreview()`, `promptConfirmation()` | Terminal UI helpers (spinners, menus) |
|
|
717
|
+
| **`mcp-setup.js`** | MCP detection and setup | `findGitHubTokenInDesktopConfig()` | Claude Desktop config token resolution |
|
|
631
718
|
|
|
632
719
|
#### Using Utilities in Other Claude Instances
|
|
633
720
|
|
|
634
721
|
**Example: Check installation health**
|
|
722
|
+
|
|
635
723
|
```javascript
|
|
636
724
|
import { formatError } from './lib/utils/installation-diagnostics.js';
|
|
637
725
|
|
|
638
726
|
try {
|
|
639
|
-
|
|
727
|
+
// ... operation that may fail
|
|
640
728
|
} catch (error) {
|
|
641
|
-
|
|
642
|
-
|
|
729
|
+
console.error(formatError('Operation failed', ['Additional context line']));
|
|
730
|
+
process.exit(1);
|
|
643
731
|
}
|
|
644
732
|
```
|
|
645
733
|
|
|
646
734
|
**Example: Load configuration**
|
|
735
|
+
|
|
647
736
|
```javascript
|
|
648
737
|
import { getConfig } from './lib/config.js';
|
|
649
738
|
|
|
@@ -652,6 +741,7 @@ const maxFiles = config.analysis.maxFiles;
|
|
|
652
741
|
```
|
|
653
742
|
|
|
654
743
|
**Example: Execute git operations**
|
|
744
|
+
|
|
655
745
|
```javascript
|
|
656
746
|
import { getRepoRoot, getStagedFiles } from './lib/utils/git-operations.js';
|
|
657
747
|
|
|
@@ -660,13 +750,14 @@ const files = getStagedFiles({ extensions: ['.js', '.ts'] });
|
|
|
660
750
|
```
|
|
661
751
|
|
|
662
752
|
**Example: Build custom prompts**
|
|
753
|
+
|
|
663
754
|
```javascript
|
|
664
755
|
import { buildAnalysisPrompt } from './lib/utils/prompt-builder.js';
|
|
665
756
|
|
|
666
757
|
const prompt = await buildAnalysisPrompt({
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
758
|
+
templateName: 'CUSTOM_PROMPT.md',
|
|
759
|
+
files: filesData,
|
|
760
|
+
metadata: { REPO_NAME: 'my-repo' }
|
|
670
761
|
});
|
|
671
762
|
```
|
|
672
763
|
|