claude-git-hooks 2.9.1 → 2.10.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,113 @@ 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.10.0] - 2026-02-02
9
+
10
+ ### 🏗️ Architecture - Modular CLI Refactoring
11
+
12
+ **Major refactoring: All CLI commands extracted to `lib/commands/` modules.**
13
+
14
+ This release implements a **modular, decoupled, reusable** architecture for better maintainability, testability, and extensibility.
15
+
16
+ ### ✨ Added
17
+
18
+ - **New `lib/commands/` directory** - One file per CLI command
19
+ - `helpers.js` - Shared CLI utilities (colors, output, platform detection, Entertainment)
20
+ - `install.js` - Installation logic (dependencies, hooks, templates, config migration)
21
+ - `hooks.js` - Hook management (enable, disable, status, uninstall)
22
+ - `analyze-diff.js` - Diff analysis (generate PR metadata from git diff)
23
+ - `create-pr.js` - PR creation (full Octokit workflow)
24
+ - `setup-github.js` - Token setup (interactive GitHub configuration)
25
+ - `presets.js` - Preset management (list, set, show current)
26
+ - `update.js` - Self-update (check and install latest version)
27
+ - `migrate-config.js` - Config migration (legacy to v2.8.0 format)
28
+ - `debug.js` - Debug toggle (enable/disable verbose logging)
29
+ - `telemetry-cmd.js` - Telemetry commands (show/clear statistics)
30
+ - `help.js` - Help display (usage information)
31
+
32
+ ### 🔄 Changed
33
+
34
+ - **`bin/claude-hooks` reduced from 2,300 to 111 lines** - Now a thin CLI router
35
+ - Only handles argument parsing and command dispatch
36
+ - All business logic moved to `lib/commands/` modules
37
+ - Imports and calls appropriate command module based on CLI argument
38
+
39
+ - **Design philosophy documented** - CLAUDE.md and README.md updated with:
40
+ - Purpose annotations for each component/layer
41
+ - Module responsibility descriptions
42
+ - Architectural decision rationale
43
+
44
+ ### 🎯 Benefits
45
+
46
+ | Aspect | Before | After |
47
+ |--------|--------|-------|
48
+ | `bin/claude-hooks` size | 2,277 lines | 111 lines |
49
+ | Command modules | 1 (`setup-github.js`) | 13 files |
50
+ | Testability | Hard (monolithic) | Easy (modular) |
51
+ | Finding code | Search entire file | Match filename to command |
52
+ | Adding commands | Edit large file | Create new module |
53
+
54
+ ### 📚 Documentation
55
+
56
+ - **README.md** - Added Command Modules table with purpose annotations
57
+ - **CLAUDE.md** - Updated directory structure with purpose for each file
58
+ - **README-NPM.md** - Added architecture section
59
+ - **CHANGELOG.md** - This entry
60
+
61
+ ### 🔧 Technical Details
62
+
63
+ **New module structure:**
64
+ ```
65
+ lib/commands/
66
+ ├── helpers.js (389 lines) - Shared utilities
67
+ ├── install.js (691 lines) - Installation
68
+ ├── hooks.js (148 lines) - Hook management
69
+ ├── analyze-diff.js (267 lines) - Diff analysis
70
+ ├── create-pr.js (374 lines) - PR creation
71
+ ├── presets.js (101 lines) - Preset commands
72
+ ├── update.js (67 lines) - Self-update
73
+ ├── migrate-config.js (103 lines) - Config migration
74
+ ├── debug.js (52 lines) - Debug mode
75
+ ├── telemetry-cmd.js (47 lines) - Telemetry
76
+ ├── help.js (147 lines) - Help display
77
+ └── setup-github.js (98 lines) - GitHub setup
78
+ ```
79
+
80
+ **Key patterns implemented:**
81
+ - **Command Pattern**: Each CLI command is a self-contained module
82
+ - **Thin Controller**: `bin/claude-hooks` only routes, doesn't implement
83
+ - **Separation of Concerns**: UI helpers in `helpers.js`, business logic in specific modules
84
+
85
+ ### 🗑️ Removed
86
+
87
+ - **Inline command implementations** from `bin/claude-hooks`:
88
+ - `install()` - moved to `lib/commands/install.js`
89
+ - `uninstall()` - moved to `lib/commands/hooks.js`
90
+ - `enable()` / `disable()` - moved to `lib/commands/hooks.js`
91
+ - `status()` - moved to `lib/commands/hooks.js`
92
+ - `analyzeDiff()` - moved to `lib/commands/analyze-diff.js`
93
+ - `createPr()` - moved to `lib/commands/create-pr.js`
94
+ - `showPresets()` / `setPreset()` / `currentPreset()` - moved to `lib/commands/presets.js`
95
+ - `update()` - moved to `lib/commands/update.js`
96
+ - `migrateConfig()` - moved to `lib/commands/migrate-config.js`
97
+ - `setDebug()` - moved to `lib/commands/debug.js`
98
+ - `showTelemetry()` / `clearTelemetry()` - moved to `lib/commands/telemetry-cmd.js`
99
+ - `showHelp()` / `showVersion()` - moved to `lib/commands/help.js`
100
+ - Helper functions (colors, log, error, success, etc.) - moved to `lib/commands/helpers.js`
101
+ - `Entertainment` class - moved to `lib/commands/helpers.js`
102
+
103
+ ### 📋 Migration
104
+
105
+ **No breaking changes.** All CLI commands work identically. This is an internal refactoring.
106
+
107
+ ```bash
108
+ # All commands work the same
109
+ claude-hooks install
110
+ claude-hooks create-pr develop
111
+ claude-hooks --set-preset backend
112
+ claude-hooks status
113
+ ```
114
+
8
115
  ## [2.9.1] - 2025-12-30
9
116
 
10
117
  ### 🐛 Fixed