claude-git-hooks 2.16.0 → 2.17.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 CHANGED
@@ -5,6 +5,20 @@ Todos los cambios notables en este proyecto se documentarán en este archivo.
5
5
  El formato está basado en [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.17.0] - 2026-02-16
9
+
10
+ ### ✨ Added
11
+ - Automatic GitHub token setup now runs after installation
12
+
13
+ ### 🔧 Changed
14
+ - Simplified CLI help output to show concise command reference instead of verbose documentation
15
+ - Commands in help output are now listed in alphabetical order for easier navigation
16
+ - Installation success message now shows single help reference instead of detailed usage examples
17
+
18
+ ### 🗑️ Removed
19
+ - Removed extensive inline documentation from help output (use README for detailed docs)
20
+
21
+
8
22
  ## [2.16.0] - 2026-02-15
9
23
 
10
24
  ### ✨ Added
package/README.md CHANGED
@@ -243,8 +243,11 @@ claude-hooks --help # Full command reference
243
243
  | `helpers.js` | **Shared CLI utilities** - colors, output, platform detection | `colors`, `error()`, `success()`, `info()`, `checkGitRepo()`, `Entertainment` |
244
244
  | `install.js` | **Installation logic** - dependencies, hooks, templates | `runInstall()`, `extractLegacySettings()` |
245
245
  | `hooks.js` | **Hook management** - enable, disable, status, uninstall | `runEnable()`, `runDisable()`, `runStatus()`, `runUninstall()` |
246
+ | `analyze.js` | **Interactive code analysis** - analyze before committing | `runAnalyze()` |
246
247
  | `analyze-diff.js` | **Diff analysis** - generate PR metadata from git diff | `runAnalyzeDiff()` |
247
248
  | `create-pr.js` | **PR creation** - full workflow via Octokit | `runCreatePr()` |
249
+ | `bump-version.js` | **Version management** - bump with CHANGELOG and Git tag | `runBumpVersion()` |
250
+ | `generate-changelog.js` | **CHANGELOG generation** - standalone command | `runGenerateChangelog()` |
248
251
  | `setup-github.js` | **Token setup** - interactive GitHub configuration | `runSetupGitHub()` |
249
252
  | `presets.js` | **Preset management** - list, set, show current | `runShowPresets()`, `runSetPreset()`, `runCurrentPreset()` |
250
253
  | `update.js` | **Self-update** - check and install latest version | `runUpdate()` |
@@ -24,176 +24,40 @@ Claude Git Hooks - Code analysis and automatic messages with Claude CLI
24
24
  Usage: claude-hooks <command> [options]
25
25
 
26
26
  Commands:
27
- install [options] Install hooks in the current repository
28
- --force Reinstall even if they already exist
29
- --skip-auth Skip Claude authentication verification
30
- update Update to the latest available version
31
- uninstall Uninstall hooks from the repository
32
- enable [hook] Enable hooks (all or one specific)
33
- disable [hook] Disable hooks (all or one specific)
34
- status Show the status of hooks
35
- analyze-diff [base] Analyze differences between branches and generate PR info
36
- create-pr [base] Create pull request with auto-generated metadata and reviewers
37
- bump-version <type> Bump version with automatic CHANGELOG and Git tag
38
- major Bump major version (1.0.0 → 2.0.0)
39
- minor Bump minor version (1.0.0 → 1.1.0)
40
- patch Bump patch version (1.0.0 1.0.1)
41
- --suffix <value> Add version suffix (e.g., SNAPSHOT, RC)
42
- --update-changelog [branch] Generate CHANGELOG entry (default: main)
43
- --dry-run Preview changes without applying
44
- --no-tag Skip Git tag creation
45
- --no-push Create tag but don't push to remote
46
- generate-changelog [version] Generate CHANGELOG entry independently
47
- --base-branch <branch> Compare against branch (default: main)
48
- --release Mark as released (no [Unreleased] header)
49
- setup-github Setup GitHub login (required for create-pr)
50
- presets List all available presets
51
- --set-preset <name> Set the active preset
52
- preset current Show the current active preset
53
- telemetry [action] Telemetry management (show or clear)
54
- --debug <value> Set debug mode (true, false, or status)
55
- --version, -v Show the current version
56
- help Show this help
57
-
58
- Available hooks:
59
- pre-commit Code analysis before commit
60
- prepare-commit-msg Automatic message generation
61
-
62
- Examples:
63
- claude-hooks install # Install all hooks
64
- claude-hooks install --skip-auth # Install without verifying authentication
65
- claude-hooks update # Update to the latest version
66
- claude-hooks disable pre-commit # Disable only pre-commit
67
- claude-hooks enable # Enable all hooks
68
- claude-hooks status # View current status
69
- claude-hooks analyze-diff main # Analyze differences with main
70
- claude-hooks setup-github # Configure GitHub token for PR creation
71
- claude-hooks create-pr develop # Create PR targeting develop branch
72
- claude-hooks bump-version minor # Bump minor version with tag
73
- claude-hooks bump-version patch --suffix SNAPSHOT # Add SNAPSHOT version
74
- claude-hooks bump-version major --update-changelog # Bump and update CHANGELOG
75
- claude-hooks generate-changelog # Generate CHANGELOG for current version
76
- claude-hooks generate-changelog 2.7.0 --release # Generate for specific release
77
- claude-hooks presets # List available presets
78
- claude-hooks --set-preset backend # Set backend preset
79
- claude-hooks preset current # Show current preset
80
- claude-hooks telemetry show # Show telemetry statistics
81
- claude-hooks telemetry clear # Clear telemetry data
82
- claude-hooks --debug true # Enable debug mode
83
- claude-hooks --debug status # Check debug status
84
-
85
- Commit use cases:
86
- git commit -m "message" # Manual message + blocking analysis
87
- git commit -m "auto" # Automatic message + blocking analysis
88
- git commit --no-verify -m "auto" # Automatic message without analysis
89
- git commit --no-verify -m "msg" # Manual message without analysis
90
-
91
- Analyze-diff use case:
92
- claude-hooks analyze-diff main # Analyze changes vs main and generate:
93
- → PR Title: "feat: add user authentication module"
94
- → PR Description: "## Summary\n- Added JWT authentication..."
95
- → Suggested branch: "feature/user-authentication"
96
-
97
- Create-pr use case (v2.5.0+):
98
- claude-hooks create-pr develop # Create PR targeting develop:
99
- → Validates GitHub token
100
- → Extracts task-id from branch (IX-123, #456, LIN-123)
101
- → Checks version alignment (package.json, pom.xml, CHANGELOG, tags)
102
- → Detects and prompts to push unpushed tags
103
- → Analyzes diff and generates PR metadata with Claude
104
- → Creates PR directly via GitHub API (Octokit)
105
- → Adds labels based on preset
106
- → Returns PR URL
107
-
108
- Token configuration:
109
- → .claude/settings.local.json (recommended, gitignored)
110
- → GITHUB_TOKEN environment variable
111
- → Claude Desktop config (auto-detected)
112
-
113
- Bump-version use case (v2.12.0+):
114
- claude-hooks bump-version patch --update-changelog
115
- → Validates prerequisites (clean working dir, valid branch, remote)
116
- → Detects project type (Node.js, Maven, or both)
117
- → Increments version (major/minor/patch)
118
- → Updates package.json and/or pom.xml
119
- → Generates CHANGELOG entry with Claude (if --update-changelog)
120
- → Creates annotated Git tag (v2.7.0)
121
- → Pushes tag to remote
122
-
123
- Version workflow examples:
124
- 2.7.0 → 2.8.0-SNAPSHOT # Start development
125
- 2.8.0-SNAPSHOT → 2.8.0-RC # Release candidate
126
- 2.8.0-RC → 2.8.0 # Final release
127
-
128
- Integration with create-pr:
129
- → Automatically detects version misalignment
130
- → Prompts to push unpushed tags before PR creation
131
- → Warns if local version <= remote version
132
-
133
- Generate-changelog use case (v2.12.0+):
134
- claude-hooks generate-changelog [version]
135
- → Standalone CHANGELOG generation (no version bump)
136
- → Auto-detects version from package.json or pom.xml
137
- → Analyzes commits since last tag using Claude
138
- → Updates CHANGELOG.md with categorized entries
139
- → Useful when bump-version CHANGELOG step fails
140
- → Can mark as released or unreleased
141
-
142
- Examples:
143
- claude-hooks generate-changelog # Use current version
144
- claude-hooks generate-changelog 2.7.0 --release # Specific release
145
- claude-hooks generate-changelog --base-branch develop # Compare vs develop
146
-
147
- Presets (v2.3.0+):
148
- Built-in tech-stack specific configurations:
149
- - backend: Spring Boot + SQL Server (.java, .xml, .yml)
150
- - frontend: React + Material-UI (.js, .jsx, .ts, .tsx, .css)
151
- - fullstack: Backend + Frontend with API consistency checks
152
- - database: SQL Server migrations and procedures (.sql)
153
- - ai: Node.js + Claude CLI integration (.js, .json, .md)
154
- - default: General-purpose mixed languages
155
-
156
- Configuration (v2.2.0+):
157
- Create .claude/config.json in your project to customize:
158
- - Preset selection
159
- - Analysis settings (maxFileSize, maxFiles, timeout)
160
- - Commit message generation (autoKeyword, timeout)
161
- - Parallel execution (enabled, model, batchSize)
162
- - Template paths and output files
163
- - Debug mode
164
-
165
- Example: .claude/config.json
166
- {
167
- "preset": "backend",
168
- "analysis": { "maxFiles": 30, "timeout": 180000 },
169
- "subagents": {
170
- "enabled": true, // Enable parallel execution
171
- "model": "haiku", // haiku (fast) | sonnet | opus
172
- "batchSize": 2 // Files per batch (1=fastest)
173
- },
174
- "system": { "debug": true }
175
- }
176
-
177
- Parallel Analysis (v2.2.0+):
178
- When analyzing 3+ files, parallel execution runs multiple Claude CLI
179
- processes simultaneously for faster analysis:
180
- - batchSize: 1 → Maximum speed (1 file per process)
181
- - batchSize: 2 → Balanced (2 files per process)
182
- - batchSize: 4+ → Fewer API calls but slower
183
- - Speed improvement: up to 4x faster with batchSize: 1
184
-
185
- Debug Mode:
186
- Enable detailed logging for troubleshooting:
187
- - CLI: claude-hooks --debug true
188
- - Config: "system": { "debug": true } in .claude/config.json
189
- - Check status: claude-hooks --debug status
190
-
191
- Customization:
192
- Override prompts by copying to .claude/:
193
- cp templates/COMMIT_MESSAGE.md .claude/
194
- cp templates/ANALYZE_DIFF.md .claude/
195
- cp templates/CLAUDE_PRE_COMMIT.md .claude/
196
- # Edit as needed - system uses .claude/ version if exists
27
+ analyze [--unstaged | --all] Analyze code interactively before committing
28
+ analyze-diff [base] Analyze diff and generate PR metadata
29
+ bump-version [type] [options] Bump version with CHANGELOG and Git tag
30
+ <type>: major | minor | patch (optional for suffix-only operations)
31
+ --dry-run Preview changes without applying
32
+ --interactive Force file selection menu
33
+ --no-commit Skip automatic commit
34
+ --no-tag Skip Git tag creation
35
+ --push Push tag to remote
36
+ --remove-suffix Remove version suffix (no type required)
37
+ --set-suffix <value> Set/replace version suffix (no type required)
38
+ --suffix <value> Add version suffix (e.g., SNAPSHOT)
39
+ --update-changelog [branch] Generate CHANGELOG entry
40
+ create-pr [base] Create PR with auto-generated metadata
41
+ --debug <true | false | status> Toggle debug mode
42
+ disable [hook] Disable hooks (all or specific)
43
+ enable [hook] Enable hooks (all or specific)
44
+ generate-changelog [version] Generate CHANGELOG entry independently
45
+ --base-branch <branch> Compare against branch (default: main)
46
+ --release Mark as released
47
+ help, --help, -h Show this help
48
+ install [options] Install hooks in current repository
49
+ --force Reinstall even if already exist
50
+ --skip-auth Skip Claude authentication check
51
+ migrate-config Migrate legacy config to v2.8.0 format
52
+ preset current Show current active preset
53
+ presets List all available presets
54
+ --set-preset <name> Set the active preset
55
+ setup-github Configure GitHub token for PR creation
56
+ status Show hook status
57
+ telemetry [show | clear] View or clear telemetry data
58
+ uninstall Remove hooks from repository
59
+ update Update to latest version
60
+ --version, -v Show current version
197
61
 
198
62
  More information: https://github.com/pablorovito/claude-git-hooks
199
63
  `);
@@ -29,6 +29,7 @@ import {
29
29
  getLatestVersion,
30
30
  Entertainment
31
31
  } from './helpers.js';
32
+ import { runSetupGitHub } from './setup-github.js';
32
33
 
33
34
  /**
34
35
  * Function to check version (used by hooks)
@@ -654,34 +655,9 @@ export async function runInstall(args) {
654
655
  updateGitignore();
655
656
 
656
657
  success('Claude Git Hooks installed successfully! 🎉');
657
- console.log('\nUsage:');
658
- console.log(' git commit -m "auto" # Generate message automatically');
659
- console.log(' git commit -m "message" # Analyze code before commit');
660
- console.log(' git commit --no-verify # Skip analysis completely');
661
- console.log('\n💡 Configuration (v2.8.0):');
662
- console.log(' 📁 All templates installed in .claude/');
663
- console.log(' 📝 Edit .claude/config.json (minimal by default)');
664
- console.log(' 📂 Examples: .claude/config_example/');
665
- console.log(' 📦 Backups: .claude/config_old/');
666
- console.log(' 🎯 Presets: backend, frontend, fullstack, database, ai, default');
667
- console.log(' 🚀 Parallel analysis enabled by default (hardcoded)');
668
- console.log(' 🐛 Debug mode: claude-hooks --debug true');
669
- console.log('\n🔗 GitHub PR Creation (v2.5.0+):');
670
- console.log(' claude-hooks setup-github # Configure GitHub token');
671
- console.log(' claude-hooks create-pr main # Create PR with auto-metadata');
672
- console.log('\n📖 Minimal config.json (v2.8.0):');
673
- console.log(' {');
674
- console.log(' "version": "2.8.0",');
675
- console.log(' "preset": "backend"');
676
- console.log(' }');
677
- console.log('\n📖 With GitHub customization:');
678
- console.log(' {');
679
- console.log(' "version": "2.8.0",');
680
- console.log(' "preset": "backend",');
681
- console.log(' "overrides": {');
682
- console.log(' "github": { "pr": { "reviewers": ["your-username"] } }');
683
- console.log(' }');
684
- console.log(' }');
685
- console.log('\n🔧 Advanced: see .claude/config_example/config.advanced.example.json');
686
- console.log('\nFor more options: claude-hooks --help');
658
+ console.log('\nRun claude-hooks --help to see all available commands.');
659
+
660
+ // Run GitHub token setup
661
+ console.log('');
662
+ await runSetupGitHub();
687
663
  }
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
- {
2
- "name": "claude-git-hooks",
3
- "version": "2.16.0",
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": "npm run test:all",
11
- "test:all": "npm run lint && npm run test:smoke && npm run test:unit && npm run test:integration",
12
- "test:smoke": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/smoke --maxWorkers=1",
13
- "test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --forceExit",
14
- "test:integration": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/integration --maxWorkers=1 --testTimeout=30000 --forceExit",
15
- "test:integration:ci": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/integration/ci-safe.test.js --maxWorkers=1 --testTimeout=30000 --forceExit",
16
- "test:changed": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --changedSince=main --forceExit",
17
- "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
18
- "test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
19
- "lint": "eslint lib/ bin/claude-hooks",
20
- "lint:fix": "eslint lib/ bin/claude-hooks --fix",
21
- "format": "prettier --write \"lib/**/*.js\" \"bin/**\" \"test/**/*.js\"",
22
- "precommit": "npm run lint && npm run test:smoke",
23
- "prepublishOnly": "npm run test:all"
24
- },
25
- "keywords": [
26
- "git",
27
- "hooks",
28
- "claude",
29
- "ai",
30
- "code-review",
31
- "commit-messages",
32
- "pre-commit",
33
- "automation"
34
- ],
35
- "author": "Pablo Rovito",
36
- "license": "MIT",
37
- "repository": {
38
- "type": "git",
39
- "url": "https://github.com/pablorovito/claude-git-hooks.git"
40
- },
41
- "engines": {
42
- "node": ">=16.9.0"
43
- },
44
- "engineStrict": false,
45
- "os": [
46
- "darwin",
47
- "linux",
48
- "win32"
49
- ],
50
- "preferGlobal": true,
51
- "files": [
52
- "bin/",
53
- "lib/",
54
- "templates/",
55
- "README.md",
56
- "CHANGELOG.md",
57
- "LICENSE"
58
- ],
59
- "dependencies": {
60
- "@octokit/rest": "^21.0.0"
61
- },
62
- "devDependencies": {
63
- "@types/jest": "^29.5.0",
64
- "eslint": "^8.57.0",
65
- "jest": "^29.7.0",
66
- "prettier": "^3.2.0"
67
- }
68
- }
1
+ {
2
+ "name": "claude-git-hooks",
3
+ "version": "2.17.0",
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": "npm run test:all",
11
+ "test:all": "npm run lint && npm run test:smoke && npm run test:unit && npm run test:integration",
12
+ "test:smoke": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/smoke --maxWorkers=1",
13
+ "test:unit": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --forceExit",
14
+ "test:integration": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/integration --maxWorkers=1 --testTimeout=30000 --forceExit",
15
+ "test:integration:ci": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/integration/ci-safe.test.js --maxWorkers=1 --testTimeout=30000 --forceExit",
16
+ "test:changed": "node --experimental-vm-modules node_modules/jest/bin/jest.js test/unit --changedSince=main --forceExit",
17
+ "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
18
+ "test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
19
+ "lint": "eslint lib/ bin/claude-hooks",
20
+ "lint:fix": "eslint lib/ bin/claude-hooks --fix",
21
+ "format": "prettier --write \"lib/**/*.js\" \"bin/**\" \"test/**/*.js\"",
22
+ "precommit": "npm run lint && npm run test:smoke",
23
+ "prepublishOnly": "npm run test:all"
24
+ },
25
+ "keywords": [
26
+ "git",
27
+ "hooks",
28
+ "claude",
29
+ "ai",
30
+ "code-review",
31
+ "commit-messages",
32
+ "pre-commit",
33
+ "automation"
34
+ ],
35
+ "author": "Pablo Rovito",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/pablorovito/claude-git-hooks.git"
40
+ },
41
+ "engines": {
42
+ "node": ">=16.9.0"
43
+ },
44
+ "engineStrict": false,
45
+ "os": [
46
+ "darwin",
47
+ "linux",
48
+ "win32"
49
+ ],
50
+ "preferGlobal": true,
51
+ "files": [
52
+ "bin/",
53
+ "lib/",
54
+ "templates/",
55
+ "README.md",
56
+ "CHANGELOG.md",
57
+ "LICENSE"
58
+ ],
59
+ "dependencies": {
60
+ "@octokit/rest": "^21.0.0"
61
+ },
62
+ "devDependencies": {
63
+ "@types/jest": "^29.5.0",
64
+ "eslint": "^8.57.0",
65
+ "jest": "^29.7.0",
66
+ "prettier": "^3.2.0"
67
+ }
68
+ }