claude-git-hooks 2.9.1 → 2.11.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,146 @@ 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.11.0] - 2026-02-03
9
+
10
+ ### ✨ Added
11
+
12
+ - **Auto-push functionality in `create-pr` command** - Automatically detects and pushes unpublished branches before creating PR (#59, #34)
13
+ - Handles 3 scenarios: unpublished branch, unpushed commits, up-to-date branch
14
+ - Interactive confirmation prompt before pushing (configurable)
15
+ - Commit preview showing what will be pushed
16
+ - Diverged branch detection with helpful error message and resolution steps
17
+ - Never uses `git push --force` for security
18
+
19
+ - **New configuration options** under `github.pr`:
20
+ - `autoPush: true` - Enable/disable auto-push (enabled by default)
21
+ - `pushConfirm: true` - Prompt for confirmation before push
22
+ - `showCommits: true` - Show commit preview before push
23
+ - `verifyRemote: true` - Verify remote exists before push
24
+
25
+ - **New git-operations functions**:
26
+ - `getRemoteName()` - Get configured remote name (usually 'origin')
27
+ - `verifyRemoteExists()` - Check if remote is configured
28
+ - `getBranchPushStatus()` - Detect branch publish status and unpushed commits
29
+ - `pushBranch()` - Execute git push with upstream tracking
30
+
31
+ ### 🔧 Fixed
32
+
33
+ - Issue #59: `create-pr` no longer fails when branch is not published to remote
34
+ - Issue #34: Git push now integrated into create-pr workflow with proper error handling
35
+
36
+ ### 📚 Documentation
37
+
38
+ - Updated CLAUDE.md with new git-operations functions and configuration options
39
+ - Added comprehensive JSDoc comments for all new functions
40
+
41
+ ## [2.10.0] - 2026-02-02
42
+
43
+ ### 🏗️ Architecture - Modular CLI Refactoring
44
+
45
+ **Major refactoring: All CLI commands extracted to `lib/commands/` modules.**
46
+
47
+ This release implements a **modular, decoupled, reusable** architecture for better maintainability, testability, and extensibility.
48
+
49
+ ### ✨ Added
50
+
51
+ - **New `lib/commands/` directory** - One file per CLI command
52
+ - `helpers.js` - Shared CLI utilities (colors, output, platform detection, Entertainment)
53
+ - `install.js` - Installation logic (dependencies, hooks, templates, config migration)
54
+ - `hooks.js` - Hook management (enable, disable, status, uninstall)
55
+ - `analyze-diff.js` - Diff analysis (generate PR metadata from git diff)
56
+ - `create-pr.js` - PR creation (full Octokit workflow)
57
+ - `setup-github.js` - Token setup (interactive GitHub configuration)
58
+ - `presets.js` - Preset management (list, set, show current)
59
+ - `update.js` - Self-update (check and install latest version)
60
+ - `migrate-config.js` - Config migration (legacy to v2.8.0 format)
61
+ - `debug.js` - Debug toggle (enable/disable verbose logging)
62
+ - `telemetry-cmd.js` - Telemetry commands (show/clear statistics)
63
+ - `help.js` - Help display (usage information)
64
+
65
+ ### 🔄 Changed
66
+
67
+ - **`bin/claude-hooks` reduced from 2,300 to 111 lines** - Now a thin CLI router
68
+ - Only handles argument parsing and command dispatch
69
+ - All business logic moved to `lib/commands/` modules
70
+ - Imports and calls appropriate command module based on CLI argument
71
+
72
+ - **Design philosophy documented** - CLAUDE.md and README.md updated with:
73
+ - Purpose annotations for each component/layer
74
+ - Module responsibility descriptions
75
+ - Architectural decision rationale
76
+
77
+ ### 🎯 Benefits
78
+
79
+ | Aspect | Before | After |
80
+ |--------|--------|-------|
81
+ | `bin/claude-hooks` size | 2,277 lines | 111 lines |
82
+ | Command modules | 1 (`setup-github.js`) | 13 files |
83
+ | Testability | Hard (monolithic) | Easy (modular) |
84
+ | Finding code | Search entire file | Match filename to command |
85
+ | Adding commands | Edit large file | Create new module |
86
+
87
+ ### 📚 Documentation
88
+
89
+ - **README.md** - Added Command Modules table with purpose annotations
90
+ - **CLAUDE.md** - Updated directory structure with purpose for each file
91
+ - **README-NPM.md** - Added architecture section
92
+ - **CHANGELOG.md** - This entry
93
+
94
+ ### 🔧 Technical Details
95
+
96
+ **New module structure:**
97
+ ```
98
+ lib/commands/
99
+ ├── helpers.js (389 lines) - Shared utilities
100
+ ├── install.js (691 lines) - Installation
101
+ ├── hooks.js (148 lines) - Hook management
102
+ ├── analyze-diff.js (267 lines) - Diff analysis
103
+ ├── create-pr.js (374 lines) - PR creation
104
+ ├── presets.js (101 lines) - Preset commands
105
+ ├── update.js (67 lines) - Self-update
106
+ ├── migrate-config.js (103 lines) - Config migration
107
+ ├── debug.js (52 lines) - Debug mode
108
+ ├── telemetry-cmd.js (47 lines) - Telemetry
109
+ ├── help.js (147 lines) - Help display
110
+ └── setup-github.js (98 lines) - GitHub setup
111
+ ```
112
+
113
+ **Key patterns implemented:**
114
+ - **Command Pattern**: Each CLI command is a self-contained module
115
+ - **Thin Controller**: `bin/claude-hooks` only routes, doesn't implement
116
+ - **Separation of Concerns**: UI helpers in `helpers.js`, business logic in specific modules
117
+
118
+ ### 🗑️ Removed
119
+
120
+ - **Inline command implementations** from `bin/claude-hooks`:
121
+ - `install()` - moved to `lib/commands/install.js`
122
+ - `uninstall()` - moved to `lib/commands/hooks.js`
123
+ - `enable()` / `disable()` - moved to `lib/commands/hooks.js`
124
+ - `status()` - moved to `lib/commands/hooks.js`
125
+ - `analyzeDiff()` - moved to `lib/commands/analyze-diff.js`
126
+ - `createPr()` - moved to `lib/commands/create-pr.js`
127
+ - `showPresets()` / `setPreset()` / `currentPreset()` - moved to `lib/commands/presets.js`
128
+ - `update()` - moved to `lib/commands/update.js`
129
+ - `migrateConfig()` - moved to `lib/commands/migrate-config.js`
130
+ - `setDebug()` - moved to `lib/commands/debug.js`
131
+ - `showTelemetry()` / `clearTelemetry()` - moved to `lib/commands/telemetry-cmd.js`
132
+ - `showHelp()` / `showVersion()` - moved to `lib/commands/help.js`
133
+ - Helper functions (colors, log, error, success, etc.) - moved to `lib/commands/helpers.js`
134
+ - `Entertainment` class - moved to `lib/commands/helpers.js`
135
+
136
+ ### 📋 Migration
137
+
138
+ **No breaking changes.** All CLI commands work identically. This is an internal refactoring.
139
+
140
+ ```bash
141
+ # All commands work the same
142
+ claude-hooks install
143
+ claude-hooks create-pr develop
144
+ claude-hooks --set-preset backend
145
+ claude-hooks status
146
+ ```
147
+
8
148
  ## [2.9.1] - 2025-12-30
9
149
 
10
150
  ### 🐛 Fixed