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.
Files changed (52) hide show
  1. package/CHANGELOG.md +240 -0
  2. package/README.md +280 -78
  3. package/bin/claude-hooks +295 -119
  4. package/lib/config.js +164 -0
  5. package/lib/hooks/pre-commit.js +180 -67
  6. package/lib/hooks/prepare-commit-msg.js +47 -41
  7. package/lib/utils/claude-client.js +107 -16
  8. package/lib/utils/claude-diagnostics.js +266 -0
  9. package/lib/utils/file-operations.js +1 -65
  10. package/lib/utils/file-utils.js +65 -0
  11. package/lib/utils/installation-diagnostics.js +145 -0
  12. package/lib/utils/package-info.js +75 -0
  13. package/lib/utils/preset-loader.js +214 -0
  14. package/lib/utils/prompt-builder.js +83 -67
  15. package/lib/utils/resolution-prompt.js +12 -2
  16. package/package.json +49 -50
  17. package/templates/ANALYZE_DIFF.md +33 -0
  18. package/templates/COMMIT_MESSAGE.md +24 -0
  19. package/templates/CUSTOMIZATION_GUIDE.md +656 -0
  20. package/templates/SUBAGENT_INSTRUCTION.md +1 -0
  21. package/templates/config.example.json +41 -0
  22. package/templates/pre-commit +40 -2
  23. package/templates/prepare-commit-msg +40 -2
  24. package/templates/presets/ai/ANALYSIS_PROMPT.md +133 -0
  25. package/templates/presets/ai/PRE_COMMIT_GUIDELINES.md +176 -0
  26. package/templates/presets/ai/config.json +12 -0
  27. package/templates/presets/ai/preset.json +42 -0
  28. package/templates/presets/backend/ANALYSIS_PROMPT.md +85 -0
  29. package/templates/presets/backend/PRE_COMMIT_GUIDELINES.md +87 -0
  30. package/templates/presets/backend/config.json +12 -0
  31. package/templates/presets/backend/preset.json +49 -0
  32. package/templates/presets/database/ANALYSIS_PROMPT.md +114 -0
  33. package/templates/presets/database/PRE_COMMIT_GUIDELINES.md +143 -0
  34. package/templates/presets/database/config.json +12 -0
  35. package/templates/presets/database/preset.json +38 -0
  36. package/templates/presets/default/config.json +12 -0
  37. package/templates/presets/default/preset.json +53 -0
  38. package/templates/presets/frontend/ANALYSIS_PROMPT.md +99 -0
  39. package/templates/presets/frontend/PRE_COMMIT_GUIDELINES.md +95 -0
  40. package/templates/presets/frontend/config.json +12 -0
  41. package/templates/presets/frontend/preset.json +50 -0
  42. package/templates/presets/fullstack/ANALYSIS_PROMPT.md +107 -0
  43. package/templates/presets/fullstack/CONSISTENCY_CHECKS.md +147 -0
  44. package/templates/presets/fullstack/PRE_COMMIT_GUIDELINES.md +125 -0
  45. package/templates/presets/fullstack/config.json +12 -0
  46. package/templates/presets/fullstack/preset.json +55 -0
  47. package/templates/shared/ANALYSIS_PROMPT.md +103 -0
  48. package/templates/shared/ANALYZE_DIFF.md +33 -0
  49. package/templates/shared/COMMIT_MESSAGE.md +24 -0
  50. package/templates/shared/PRE_COMMIT_GUIDELINES.md +145 -0
  51. package/templates/shared/RESOLUTION_PROMPT.md +32 -0
  52. package/templates/check-version.sh +0 -266
package/package.json CHANGED
@@ -1,52 +1,51 @@
1
1
  {
2
- "name": "claude-git-hooks",
3
- "version": "2.1.0",
4
- "description": "Git hooks with Claude CLI for code analysis and automatic commit messages",
5
- "type": "module",
6
- "main": "lib/index.js",
7
- "bin": {
8
- "claude-hooks": "./bin/claude-hooks"
9
- },
10
- "scripts": {
11
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
12
- "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
13
- "test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
14
- "lint": "eslint lib/ bin/",
15
- "lint:fix": "eslint lib/ bin/ --fix",
16
- "format": "prettier --write \"lib/**/*.js\" \"bin/**\""
17
- },
18
- "keywords": [
19
- "git",
20
- "hooks",
21
- "claude",
22
- "ai",
23
- "code-review",
24
- "commit-messages",
25
- "pre-commit",
26
- "automation"
27
- ],
28
- "author": "Pablo Rovito",
29
- "license": "MIT",
30
- "repository": {
31
- "type": "git",
32
- "url": "https://github.com/pablorovito/claude-git-hooks.git"
33
- },
34
- "engines": {
35
- "node": ">=16.9.0"
36
- },
37
- "preferGlobal": true,
38
- "files": [
39
- "bin/",
40
- "lib/",
41
- "templates/",
42
- "README.md",
43
- "CHANGELOG.md",
44
- "LICENSE"
45
- ],
46
- "devDependencies": {
47
- "@types/jest": "^29.5.0",
48
- "eslint": "^8.57.0",
49
- "jest": "^29.7.0",
50
- "prettier": "^3.2.0"
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}}