claude-git-hooks 2.18.1 → 2.20.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 +52 -0
- package/CLAUDE.md +85 -38
- package/README.md +52 -18
- package/bin/claude-hooks +75 -89
- package/lib/cli-metadata.js +306 -0
- package/lib/commands/analyze-diff.js +12 -10
- package/lib/commands/analyze.js +9 -5
- package/lib/commands/bump-version.js +56 -40
- package/lib/commands/create-pr.js +71 -34
- package/lib/commands/debug.js +4 -7
- package/lib/commands/diff-batch-info.js +105 -0
- package/lib/commands/generate-changelog.js +3 -2
- package/lib/commands/help.js +47 -27
- package/lib/commands/helpers.js +66 -43
- package/lib/commands/hooks.js +15 -13
- package/lib/commands/install.js +546 -49
- package/lib/commands/migrate-config.js +8 -11
- package/lib/commands/presets.js +6 -13
- package/lib/commands/setup-github.js +12 -3
- package/lib/commands/telemetry-cmd.js +8 -6
- package/lib/commands/update.js +1 -2
- package/lib/config.js +36 -52
- package/lib/hooks/pre-commit.js +70 -64
- package/lib/hooks/prepare-commit-msg.js +35 -75
- package/lib/utils/analysis-engine.js +77 -54
- package/lib/utils/changelog-generator.js +63 -37
- package/lib/utils/claude-client.js +447 -438
- package/lib/utils/claude-diagnostics.js +20 -10
- package/lib/utils/diff-analysis-orchestrator.js +332 -0
- package/lib/utils/file-operations.js +51 -79
- package/lib/utils/file-utils.js +6 -7
- package/lib/utils/git-operations.js +140 -123
- package/lib/utils/git-tag-manager.js +24 -23
- package/lib/utils/github-api.js +85 -61
- package/lib/utils/github-client.js +12 -14
- package/lib/utils/installation-diagnostics.js +4 -4
- package/lib/utils/interactive-ui.js +29 -17
- package/lib/utils/judge.js +195 -0
- package/lib/utils/logger.js +4 -1
- package/lib/utils/package-info.js +0 -11
- package/lib/utils/pr-metadata-engine.js +67 -33
- package/lib/utils/preset-loader.js +20 -62
- package/lib/utils/prompt-builder.js +57 -68
- package/lib/utils/resolution-prompt.js +34 -52
- package/lib/utils/sanitize.js +20 -19
- package/lib/utils/task-id.js +27 -40
- package/lib/utils/telemetry.js +73 -25
- package/lib/utils/version-manager.js +147 -70
- package/lib/utils/which-command.js +23 -12
- package/package.json +1 -1
- package/templates/CLAUDE_RESOLUTION_PROMPT.md +17 -9
- package/templates/DIFF_ANALYSIS_ORCHESTRATION_PROMPT.md +70 -0
- package/templates/config.advanced.example.json +15 -31
- package/templates/config.example.json +0 -11
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Diff Analysis Orchestration
|
|
2
|
+
|
|
3
|
+
You are an intelligent analysis orchestrator. Your task is to group the following changed files into semantically coherent batches for parallel code review, and assign the appropriate Claude model to each batch.
|
|
4
|
+
|
|
5
|
+
## Commit Summary
|
|
6
|
+
|
|
7
|
+
**Total files:** {{FILE_COUNT}}
|
|
8
|
+
|
|
9
|
+
## File Overview
|
|
10
|
+
|
|
11
|
+
{{FILE_OVERVIEW}}
|
|
12
|
+
|
|
13
|
+
## Detected Cross-File Dependencies
|
|
14
|
+
|
|
15
|
+
{{DETECTED_DEPS}}
|
|
16
|
+
|
|
17
|
+
## All Files
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
{{FILE_LIST}}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Instructions
|
|
26
|
+
|
|
27
|
+
Group the files above into batches. Follow these principles:
|
|
28
|
+
|
|
29
|
+
1. **Semantic grouping**: Put files that belong together in the same batch:
|
|
30
|
+
- Files in the same feature (e.g., service + controller + test)
|
|
31
|
+
- Files with detected dependencies between them
|
|
32
|
+
- Files in the same layer (e.g., all config files together)
|
|
33
|
+
|
|
34
|
+
2. **Model assignment** — assign based on risk and complexity:
|
|
35
|
+
- `haiku`: Config files, documentation, low-risk/isolated changes, simple utilities
|
|
36
|
+
- `sonnet`: Business logic, medium complexity, API layer, frontend components
|
|
37
|
+
- `opus`: Security-critical code, authentication, complex algorithms, payment/financial logic
|
|
38
|
+
|
|
39
|
+
3. **Batch size**: Aim for 1–4 files per batch. Do not create batches with 0 files.
|
|
40
|
+
|
|
41
|
+
4. **Every file must appear in exactly one batch.** Do not omit any file.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Output Format
|
|
46
|
+
|
|
47
|
+
Respond with ONLY valid JSON in this exact schema (no markdown, no explanation):
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"batches": [
|
|
52
|
+
{
|
|
53
|
+
"filePaths": ["path/to/file1.java", "path/to/file2.java"],
|
|
54
|
+
"rationale": "Core authentication logic — requires careful security review",
|
|
55
|
+
"model": "sonnet"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"filePaths": ["pom.xml"],
|
|
59
|
+
"rationale": "Dependency configuration — isolated, low-risk change",
|
|
60
|
+
"model": "haiku"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Rules:
|
|
67
|
+
- `filePaths` must use the exact paths as listed above (no modifications)
|
|
68
|
+
- `rationale` must be a single sentence explaining why these files are grouped and what risk they carry
|
|
69
|
+
- `model` must be one of: `haiku`, `sonnet`, `opus`
|
|
70
|
+
- The JSON must be valid — no trailing commas, no comments
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
"taskIdPattern": "(CUSTOM-[0-9]{4})"
|
|
22
22
|
},
|
|
23
23
|
|
|
24
|
-
"subagents": {
|
|
25
|
-
"model": "sonnet",
|
|
26
|
-
"batchSize": 2
|
|
27
|
-
},
|
|
28
|
-
|
|
29
24
|
"github": {
|
|
30
25
|
"pr": {
|
|
31
26
|
"defaultBase": "develop",
|
|
32
27
|
"reviewers": ["tech-lead"]
|
|
33
28
|
}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
"judge": {
|
|
32
|
+
"enabled": true,
|
|
33
|
+
"model": "opus"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
|
|
@@ -53,28 +53,17 @@
|
|
|
53
53
|
"use_case": "Custom task-id format (not Jira/GitHub/Linear)"
|
|
54
54
|
},
|
|
55
55
|
|
|
56
|
-
"
|
|
57
|
-
"description": "
|
|
58
|
-
"default": "
|
|
59
|
-
"
|
|
60
|
-
"trade_offs": {
|
|
61
|
-
"haiku": "Fast and cheap, good for most code",
|
|
62
|
-
"sonnet": "Balanced speed and quality",
|
|
63
|
-
"opus": "Slowest but most thorough analysis"
|
|
64
|
-
},
|
|
65
|
-
"use_case": "Trade speed/cost vs analysis quality"
|
|
56
|
+
"judge.enabled": {
|
|
57
|
+
"description": "Enable/disable auto-fix judge after analysis. When enabled, ALL issues must be resolved (fixed or false positive) for the commit to proceed. When disabled, only CRITICAL/BLOCKER issues block the commit.",
|
|
58
|
+
"default": "true",
|
|
59
|
+
"use_case": "Set to false to fall back to original quality gate (blocker/critical only)"
|
|
66
60
|
},
|
|
67
61
|
|
|
68
|
-
"
|
|
69
|
-
"description": "
|
|
70
|
-
"default": "
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"1": "Maximum parallelization, fastest but most expensive",
|
|
74
|
-
"2-4": "Balanced parallelization (preset defaults)",
|
|
75
|
-
"5+": "Less parallel, slower but cheaper"
|
|
76
|
-
},
|
|
77
|
-
"use_case": "Fine-tune cost vs speed for your project size"
|
|
62
|
+
"judge.model": {
|
|
63
|
+
"description": "Model for the judge LLM call",
|
|
64
|
+
"default": "opus",
|
|
65
|
+
"examples": ["opus", "sonnet", "haiku"],
|
|
66
|
+
"use_case": "Use a cheaper model for faster/cheaper judge passes"
|
|
78
67
|
}
|
|
79
68
|
},
|
|
80
69
|
|
|
@@ -102,12 +91,7 @@
|
|
|
102
91
|
"high_quality_analysis": {
|
|
103
92
|
"version": "2.8.0",
|
|
104
93
|
"preset": "fullstack",
|
|
105
|
-
"overrides": {
|
|
106
|
-
"subagents": {
|
|
107
|
-
"model": "sonnet",
|
|
108
|
-
"batchSize": 2
|
|
109
|
-
}
|
|
110
|
-
}
|
|
94
|
+
"overrides": {}
|
|
111
95
|
}
|
|
112
96
|
}
|
|
113
97
|
}
|
|
@@ -28,17 +28,6 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
|
|
31
|
-
"_example_custom_batch": "Customize parallel analysis batch size",
|
|
32
|
-
"_config_custom_batch": {
|
|
33
|
-
"version": "2.8.0",
|
|
34
|
-
"preset": "fullstack",
|
|
35
|
-
"overrides": {
|
|
36
|
-
"subagents": {
|
|
37
|
-
"batchSize": 2
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
|
|
42
31
|
"_available_presets": [
|
|
43
32
|
"backend - Spring Boot + SQL Server",
|
|
44
33
|
"frontend - React + TypeScript",
|