claude-git-hooks 2.10.0 → 2.12.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 +94 -7
- package/README.md +76 -1
- package/bin/claude-hooks +8 -0
- package/lib/commands/bump-version.js +452 -0
- package/lib/commands/create-pr.js +201 -1
- package/lib/commands/generate-changelog.js +154 -0
- package/lib/commands/help.js +53 -0
- package/lib/config.js +5 -0
- package/lib/utils/changelog-generator.js +382 -0
- package/lib/utils/git-operations.js +214 -1
- package/lib/utils/git-tag-manager.js +516 -0
- package/lib/utils/version-manager.js +583 -0
- package/package.json +1 -1
- package/templates/GENERATE_CHANGELOG.md +83 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,91 @@ 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.12.0] - 2026-02-03
|
|
9
|
+
|
|
10
|
+
### ✨ Added
|
|
11
|
+
|
|
12
|
+
- **Automatic version management with `bump-version` command**
|
|
13
|
+
- Detects project type (Node.js, Maven, or monorepo with both)
|
|
14
|
+
- Increments version following semantic versioning (major/minor/patch)
|
|
15
|
+
- Supports version suffixes (SNAPSHOT, RC, custom)
|
|
16
|
+
- Updates package.json and/or pom.xml automatically
|
|
17
|
+
- Generates CHANGELOG entries using Claude AI analysis of commits
|
|
18
|
+
- Creates annotated Git tags with `v` prefix (v2.7.0, v2.7.0-SNAPSHOT)
|
|
19
|
+
- Automatically pushes tags to remote
|
|
20
|
+
- CLI options: `--suffix`, `--update-changelog`, `--dry-run`, `--no-tag`, `--no-push`
|
|
21
|
+
|
|
22
|
+
- **CHANGELOG generation with Claude integration**
|
|
23
|
+
- Standalone `generate-changelog` command for independent CHANGELOG generation without version bumping
|
|
24
|
+
- Support for manual version specification in CHANGELOG generation via command argument
|
|
25
|
+
- Base branch selection for CHANGELOG comparison via `--base-branch` flag
|
|
26
|
+
- Release marking option via `--release` flag to control [Unreleased] header behavior
|
|
27
|
+
- Analyzes commits since last final version tag
|
|
28
|
+
- Categorizes changes by Conventional Commits types
|
|
29
|
+
- Generates human-readable entries in Keep a Changelog format
|
|
30
|
+
- Sections: Added, Changed, Fixed, Security, Deprecated, Removed
|
|
31
|
+
- Places entries in [Unreleased] for suffixed versions, [X.Y.Z] for final versions
|
|
32
|
+
|
|
33
|
+
- **Version alignment validation in `create-pr`** (#44)
|
|
34
|
+
- Checks consistency across package.json, pom.xml, CHANGELOG.md, and git tags
|
|
35
|
+
- Compares local version vs remote version
|
|
36
|
+
- Shows helpful prompts with fix commands if misalignment detected
|
|
37
|
+
- Allows user to continue or abort PR creation based on validation results
|
|
38
|
+
|
|
39
|
+
- **Unpushed tags detection in `create-pr`** (#44)
|
|
40
|
+
- Detects local tags not pushed to remote
|
|
41
|
+
- Prompts user to push tags before creating PR
|
|
42
|
+
- Prevents version inconsistencies between local and remote
|
|
43
|
+
|
|
44
|
+
- **New utility modules**:
|
|
45
|
+
- `lib/utils/version-manager.js` - Version detection, parsing, incrementing, validation
|
|
46
|
+
- `lib/utils/git-tag-manager.js` - Git tag operations (create, list, compare, push)
|
|
47
|
+
- `lib/utils/changelog-generator.js` - CHANGELOG generation with Claude
|
|
48
|
+
- `templates/GENERATE_CHANGELOG.md` - Claude prompt for changelog analysis
|
|
49
|
+
|
|
50
|
+
### 🔧 Changed
|
|
51
|
+
|
|
52
|
+
- Improved Windows compatibility by quoting git log format string in changelog-generator.js
|
|
53
|
+
|
|
54
|
+
### 📚 Documentation
|
|
55
|
+
|
|
56
|
+
- Updated help.js with bump-version command documentation and examples
|
|
57
|
+
- Added version workflow examples (development → RC → release)
|
|
58
|
+
- Updated CLAUDE.md with new utility modules and exports
|
|
59
|
+
|
|
60
|
+
## [2.11.0] - 2026-02-03
|
|
61
|
+
|
|
62
|
+
### ✨ Added
|
|
63
|
+
|
|
64
|
+
- **Auto-push functionality in `create-pr` command** - Automatically detects and pushes unpublished branches before creating PR (#59, #34)
|
|
65
|
+
- Handles 3 scenarios: unpublished branch, unpushed commits, up-to-date branch
|
|
66
|
+
- Interactive confirmation prompt before pushing (configurable)
|
|
67
|
+
- Commit preview showing what will be pushed
|
|
68
|
+
- Diverged branch detection with helpful error message and resolution steps
|
|
69
|
+
- Never uses `git push --force` for security
|
|
70
|
+
|
|
71
|
+
- **New configuration options** under `github.pr`:
|
|
72
|
+
- `autoPush: true` - Enable/disable auto-push (enabled by default)
|
|
73
|
+
- `pushConfirm: true` - Prompt for confirmation before push
|
|
74
|
+
- `showCommits: true` - Show commit preview before push
|
|
75
|
+
- `verifyRemote: true` - Verify remote exists before push
|
|
76
|
+
|
|
77
|
+
- **New git-operations functions**:
|
|
78
|
+
- `getRemoteName()` - Get configured remote name (usually 'origin')
|
|
79
|
+
- `verifyRemoteExists()` - Check if remote is configured
|
|
80
|
+
- `getBranchPushStatus()` - Detect branch publish status and unpushed commits
|
|
81
|
+
- `pushBranch()` - Execute git push with upstream tracking
|
|
82
|
+
|
|
83
|
+
### 🔧 Fixed
|
|
84
|
+
|
|
85
|
+
- Issue #59: `create-pr` no longer fails when branch is not published to remote
|
|
86
|
+
- Issue #34: Git push now integrated into create-pr workflow with proper error handling
|
|
87
|
+
|
|
88
|
+
### 📚 Documentation
|
|
89
|
+
|
|
90
|
+
- Updated CLAUDE.md with new git-operations functions and configuration options
|
|
91
|
+
- Added comprehensive JSDoc comments for all new functions
|
|
92
|
+
|
|
8
93
|
## [2.10.0] - 2026-02-02
|
|
9
94
|
|
|
10
95
|
### 🏗️ Architecture - Modular CLI Refactoring
|
|
@@ -43,13 +128,13 @@ This release implements a **modular, decoupled, reusable** architecture for bett
|
|
|
43
128
|
|
|
44
129
|
### 🎯 Benefits
|
|
45
130
|
|
|
46
|
-
| Aspect
|
|
47
|
-
|
|
48
|
-
| `bin/claude-hooks` size | 2,277 lines
|
|
49
|
-
| Command modules
|
|
50
|
-
| Testability
|
|
51
|
-
| Finding code
|
|
52
|
-
| Adding commands
|
|
131
|
+
| Aspect | Before | After |
|
|
132
|
+
| ----------------------- | --------------------- | ------------------------- |
|
|
133
|
+
| `bin/claude-hooks` size | 2,277 lines | 111 lines |
|
|
134
|
+
| Command modules | 1 (`setup-github.js`) | 13 files |
|
|
135
|
+
| Testability | Hard (monolithic) | Easy (modular) |
|
|
136
|
+
| Finding code | Search entire file | Match filename to command |
|
|
137
|
+
| Adding commands | Edit large file | Create new module |
|
|
53
138
|
|
|
54
139
|
### 📚 Documentation
|
|
55
140
|
|
|
@@ -61,6 +146,7 @@ This release implements a **modular, decoupled, reusable** architecture for bett
|
|
|
61
146
|
### 🔧 Technical Details
|
|
62
147
|
|
|
63
148
|
**New module structure:**
|
|
149
|
+
|
|
64
150
|
```
|
|
65
151
|
lib/commands/
|
|
66
152
|
├── helpers.js (389 lines) - Shared utilities
|
|
@@ -78,6 +164,7 @@ lib/commands/
|
|
|
78
164
|
```
|
|
79
165
|
|
|
80
166
|
**Key patterns implemented:**
|
|
167
|
+
|
|
81
168
|
- **Command Pattern**: Each CLI command is a self-contained module
|
|
82
169
|
- **Thin Controller**: `bin/claude-hooks` only routes, doesn't implement
|
|
83
170
|
- **Separation of Concerns**: UI helpers in `helpers.js`, business logic in specific modules
|
package/README.md
CHANGED
|
@@ -31,9 +31,16 @@ git commit -m "auto"
|
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
claude-hooks create-pr develop
|
|
34
|
+
# Automatically pushes branch if unpublished (with confirmation)
|
|
34
35
|
# Analyzes diff, generates title/description, creates PR on GitHub
|
|
35
36
|
```
|
|
36
37
|
|
|
38
|
+
**Auto-push feature (v2.11.0):**
|
|
39
|
+
- Detects unpublished branches or unpushed commits
|
|
40
|
+
- Shows commit preview before pushing
|
|
41
|
+
- Prompts for confirmation (configurable)
|
|
42
|
+
- Handles diverged branches gracefully
|
|
43
|
+
|
|
37
44
|
### GitHub Token Setup
|
|
38
45
|
|
|
39
46
|
```bash
|
|
@@ -60,6 +67,65 @@ claude-hooks analyze-diff develop
|
|
|
60
67
|
# Generates PR metadata without creating
|
|
61
68
|
```
|
|
62
69
|
|
|
70
|
+
### Bump Version
|
|
71
|
+
|
|
72
|
+
Automatic version management with CHANGELOG generation and Git tagging:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Bump patch version (1.0.0 → 1.0.1)
|
|
76
|
+
claude-hooks bump-version patch
|
|
77
|
+
|
|
78
|
+
# Bump with suffix
|
|
79
|
+
claude-hooks bump-version minor --suffix SNAPSHOT # → 1.1.0-SNAPSHOT
|
|
80
|
+
|
|
81
|
+
# Bump and generate CHANGELOG
|
|
82
|
+
claude-hooks bump-version major --update-changelog
|
|
83
|
+
|
|
84
|
+
# Preview without applying
|
|
85
|
+
claude-hooks bump-version patch --dry-run
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**What it does:**
|
|
89
|
+
- Detects project type (Node.js, Maven, or monorepo with both)
|
|
90
|
+
- Updates `package.json` and/or `pom.xml`
|
|
91
|
+
- Generates CHANGELOG entry with Claude (analyzes commits)
|
|
92
|
+
- Creates annotated Git tag with `v` prefix (e.g., `v2.7.0`)
|
|
93
|
+
- Pushes tag to remote automatically
|
|
94
|
+
|
|
95
|
+
**Version workflow:**
|
|
96
|
+
```
|
|
97
|
+
2.7.0 → 2.8.0-SNAPSHOT # Start development
|
|
98
|
+
2.8.0-SNAPSHOT → 2.8.0-RC # Release candidate
|
|
99
|
+
2.8.0-RC → 2.8.0 # Final release
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Integration with create-pr:**
|
|
103
|
+
- Validates version alignment (package.json, pom.xml, CHANGELOG, tags)
|
|
104
|
+
- Detects and prompts to push unpushed tags
|
|
105
|
+
- Warns if local version ≤ remote version
|
|
106
|
+
|
|
107
|
+
### Generate CHANGELOG
|
|
108
|
+
|
|
109
|
+
Standalone CHANGELOG generation (without version bump):
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Auto-detect version from package.json/pom.xml
|
|
113
|
+
claude-hooks generate-changelog
|
|
114
|
+
|
|
115
|
+
# Specific version with release marking
|
|
116
|
+
claude-hooks generate-changelog 2.7.0 --release
|
|
117
|
+
|
|
118
|
+
# Compare against different base branch
|
|
119
|
+
claude-hooks generate-changelog --base-branch develop
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**What it does:**
|
|
123
|
+
- Analyzes commits since last tag using Claude
|
|
124
|
+
- Categorizes by Conventional Commits types (feat, fix, refactor, etc.)
|
|
125
|
+
- Generates Keep a Changelog format entries
|
|
126
|
+
- Updates CHANGELOG.md automatically
|
|
127
|
+
- Useful when `bump-version --update-changelog` fails
|
|
128
|
+
|
|
63
129
|
### Disable/Enable Hooks
|
|
64
130
|
|
|
65
131
|
```bash
|
|
@@ -221,7 +287,16 @@ Preset always wins - tech-stack specific has priority over user preferences.
|
|
|
221
287
|
"version": "2.8.0",
|
|
222
288
|
"preset": "backend",
|
|
223
289
|
"overrides": {
|
|
224
|
-
"github": {
|
|
290
|
+
"github": {
|
|
291
|
+
"pr": {
|
|
292
|
+
"defaultBase": "develop",
|
|
293
|
+
"reviewers": ["user"],
|
|
294
|
+
"autoPush": true, // Auto-push unpublished branches (v2.11.0)
|
|
295
|
+
"pushConfirm": true, // Prompt before push (v2.11.0)
|
|
296
|
+
"showCommits": true, // Show commit preview (v2.11.0)
|
|
297
|
+
"verifyRemote": true // Verify remote exists (v2.11.0)
|
|
298
|
+
}
|
|
299
|
+
},
|
|
225
300
|
"subagents": { "batchSize": 2 }
|
|
226
301
|
}
|
|
227
302
|
}
|
package/bin/claude-hooks
CHANGED
|
@@ -22,6 +22,8 @@ import { runMigrateConfig } from '../lib/commands/migrate-config.js';
|
|
|
22
22
|
import { runSetDebug } from '../lib/commands/debug.js';
|
|
23
23
|
import { runShowTelemetry, runClearTelemetry } from '../lib/commands/telemetry-cmd.js';
|
|
24
24
|
import { runShowHelp, runShowVersion } from '../lib/commands/help.js';
|
|
25
|
+
import { runBumpVersion } from '../lib/commands/bump-version.js';
|
|
26
|
+
import { runGenerateChangelog } from '../lib/commands/generate-changelog.js';
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Main CLI router
|
|
@@ -75,6 +77,12 @@ async function main() {
|
|
|
75
77
|
case 'migrate-config':
|
|
76
78
|
await runMigrateConfig();
|
|
77
79
|
break;
|
|
80
|
+
case 'bump-version':
|
|
81
|
+
await runBumpVersion(args.slice(1));
|
|
82
|
+
break;
|
|
83
|
+
case 'generate-changelog':
|
|
84
|
+
await runGenerateChangelog(args.slice(1));
|
|
85
|
+
break;
|
|
78
86
|
case 'telemetry':
|
|
79
87
|
// Handle subcommands: telemetry show, telemetry clear
|
|
80
88
|
if (args[1] === 'show' || args[1] === undefined) {
|