claude-git-hooks 2.1.0 → 2.3.1
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 +240 -0
- package/README.md +280 -78
- package/bin/claude-hooks +295 -119
- package/lib/config.js +164 -0
- package/lib/hooks/pre-commit.js +180 -67
- package/lib/hooks/prepare-commit-msg.js +47 -41
- package/lib/utils/claude-client.js +107 -16
- package/lib/utils/claude-diagnostics.js +266 -0
- package/lib/utils/file-operations.js +1 -65
- package/lib/utils/file-utils.js +65 -0
- package/lib/utils/installation-diagnostics.js +145 -0
- package/lib/utils/package-info.js +75 -0
- package/lib/utils/preset-loader.js +214 -0
- package/lib/utils/prompt-builder.js +83 -67
- package/lib/utils/resolution-prompt.js +12 -2
- package/package.json +49 -50
- package/templates/ANALYZE_DIFF.md +33 -0
- package/templates/COMMIT_MESSAGE.md +24 -0
- package/templates/CUSTOMIZATION_GUIDE.md +656 -0
- package/templates/SUBAGENT_INSTRUCTION.md +1 -0
- package/templates/config.example.json +41 -0
- package/templates/pre-commit +40 -2
- package/templates/prepare-commit-msg +40 -2
- package/templates/presets/ai/ANALYSIS_PROMPT.md +133 -0
- package/templates/presets/ai/PRE_COMMIT_GUIDELINES.md +176 -0
- package/templates/presets/ai/config.json +12 -0
- package/templates/presets/ai/preset.json +42 -0
- package/templates/presets/backend/ANALYSIS_PROMPT.md +85 -0
- package/templates/presets/backend/PRE_COMMIT_GUIDELINES.md +87 -0
- package/templates/presets/backend/config.json +12 -0
- package/templates/presets/backend/preset.json +49 -0
- package/templates/presets/database/ANALYSIS_PROMPT.md +114 -0
- package/templates/presets/database/PRE_COMMIT_GUIDELINES.md +143 -0
- package/templates/presets/database/config.json +12 -0
- package/templates/presets/database/preset.json +38 -0
- package/templates/presets/default/config.json +12 -0
- package/templates/presets/default/preset.json +53 -0
- package/templates/presets/frontend/ANALYSIS_PROMPT.md +99 -0
- package/templates/presets/frontend/PRE_COMMIT_GUIDELINES.md +95 -0
- package/templates/presets/frontend/config.json +12 -0
- package/templates/presets/frontend/preset.json +50 -0
- package/templates/presets/fullstack/ANALYSIS_PROMPT.md +107 -0
- package/templates/presets/fullstack/CONSISTENCY_CHECKS.md +147 -0
- package/templates/presets/fullstack/PRE_COMMIT_GUIDELINES.md +125 -0
- package/templates/presets/fullstack/config.json +12 -0
- package/templates/presets/fullstack/preset.json +55 -0
- package/templates/shared/ANALYSIS_PROMPT.md +103 -0
- package/templates/shared/ANALYZE_DIFF.md +33 -0
- package/templates/shared/COMMIT_MESSAGE.md +24 -0
- package/templates/shared/PRE_COMMIT_GUIDELINES.md +145 -0
- package/templates/shared/RESOLUTION_PROMPT.md +32 -0
- package/templates/check-version.sh +0 -266
package/package.json
CHANGED
|
@@ -1,52 +1,51 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
2
|
+
"name": "claude-git-hooks",
|
|
3
|
+
"version": "2.3.1",
|
|
4
|
+
"description": "Git hooks with Claude CLI for code analysis and automatic commit messages",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"claude-hooks": "./bin/claude-hooks"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
11
|
+
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
|
|
12
|
+
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
|
|
13
|
+
"lint": "eslint lib/ bin/",
|
|
14
|
+
"lint:fix": "eslint lib/ bin/ --fix",
|
|
15
|
+
"format": "prettier --write \"lib/**/*.js\" \"bin/**\""
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"git",
|
|
19
|
+
"hooks",
|
|
20
|
+
"claude",
|
|
21
|
+
"ai",
|
|
22
|
+
"code-review",
|
|
23
|
+
"commit-messages",
|
|
24
|
+
"pre-commit",
|
|
25
|
+
"automation"
|
|
26
|
+
],
|
|
27
|
+
"author": "Pablo Rovito",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/pablorovito/claude-git-hooks.git"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=16.9.0"
|
|
35
|
+
},
|
|
36
|
+
"preferGlobal": true,
|
|
37
|
+
"files": [
|
|
38
|
+
"bin/",
|
|
39
|
+
"lib/",
|
|
40
|
+
"templates/",
|
|
41
|
+
"README.md",
|
|
42
|
+
"CHANGELOG.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/jest": "^29.5.0",
|
|
47
|
+
"eslint": "^8.57.0",
|
|
48
|
+
"jest": "^29.7.0",
|
|
49
|
+
"prettier": "^3.2.0"
|
|
50
|
+
}
|
|
52
51
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Analyze the following changes. CONTEXT: {{CONTEXT_DESCRIPTION}}
|
|
2
|
+
{{SUBAGENT_INSTRUCTION}}
|
|
3
|
+
Please generate:
|
|
4
|
+
1. A concise and descriptive PR title (maximum 72 characters)
|
|
5
|
+
2. A detailed PR description that includes:
|
|
6
|
+
- Summary of changes
|
|
7
|
+
- Motivation/context
|
|
8
|
+
- Type of change (feature/fix/refactor/docs/etc)
|
|
9
|
+
- Recommended testing
|
|
10
|
+
3. A suggested branch name following the format: type/short-description (example: feature/add-user-auth, fix/memory-leak)
|
|
11
|
+
|
|
12
|
+
IMPORTANT: If these are local changes without push, the suggested branch name should be for creating a new branch from the current one.
|
|
13
|
+
|
|
14
|
+
Respond EXCLUSIVELY with a valid JSON with this structure:
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"prTitle": "Interesting PR title",
|
|
18
|
+
"prDescription": "detailed PR description with markdown",
|
|
19
|
+
"suggestedBranchName": "type/suggested-branch-name",
|
|
20
|
+
"changeType": "feature|fix|refactor|docs|test|chore",
|
|
21
|
+
"breakingChanges": false,
|
|
22
|
+
"testingNotes": "notes on necessary testing or 'None'"
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## COMMITS
|
|
27
|
+
{{COMMITS}}
|
|
28
|
+
|
|
29
|
+
## CHANGED FILES
|
|
30
|
+
{{DIFF_FILES}}
|
|
31
|
+
|
|
32
|
+
## FULL DIFF
|
|
33
|
+
{{FULL_DIFF}}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Analyze the following changes and generate a commit message following the Conventional Commits format.
|
|
2
|
+
|
|
3
|
+
Respond ONLY with a valid JSON:
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{
|
|
7
|
+
"type": "feat|fix|docs|style|refactor|test|chore|ci|perf",
|
|
8
|
+
"scope": "optional scope (e.g.: api, frontend, db)",
|
|
9
|
+
"title": "short description in present tense (max 50 chars)",
|
|
10
|
+
"body": "optional detailed description"
|
|
11
|
+
}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## CHANGES TO ANALYZE
|
|
15
|
+
|
|
16
|
+
### Modified files:
|
|
17
|
+
{{FILE_LIST}}
|
|
18
|
+
|
|
19
|
+
### Summary of changes:
|
|
20
|
+
Files changed: {{FILE_COUNT}}
|
|
21
|
+
Insertions: {{INSERTIONS}}, Deletions: {{DELETIONS}}
|
|
22
|
+
|
|
23
|
+
### Detailed diffs:
|
|
24
|
+
{{FILE_DIFFS}}
|