claude-git-hooks 2.35.3 → 2.44.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,163 @@ 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.44.0] - 2026-05-04
9
+
10
+ ### ✨ Added
11
+ - New `HELP_NAVIGATE.md` prompt template for the first-pass catalog navigation (SUE-152)
12
+ - Auto-discovery of `.library/` catalog files (by-code, by-domain, by-task-type shelves) for AI help context
13
+
14
+ ### 🔧 Changed
15
+ - Rewrote AI help command to use a two-pass librarian approach navigating local `.library/` instead of single-pass CLAUDE.md lookup (SUE-152)
16
+ - Pass 1 sends project catalog to Claude; if deeper detail is needed, Pass 2 reads specific book files from local disk — no GitHub API calls
17
+ - Updated `HELP_QUERY.md` template to accept catalog + book content instead of flat documentation
18
+ - Replaced `NEED_MORE_CONTEXT: file1, file2` protocol with structured `ANSWER:` / `BOOKS:` response format
19
+ - Updated `report-issue` flow to use internal `_readPackageFile()` helper instead of the removed `readClaudeMd()`
20
+ - Updated unit tests to cover two-pass librarian flow, catalog mocking, and book-read scenarios
21
+
22
+ ### 🔒 Security
23
+ - Added path traversal protection when reading LLM-requested book paths — resolved paths are verified against the package root before disk access
24
+
25
+ ### 🗑️ Removed
26
+ - Removed GitHub API dependency (`fetchFileContent`, `parseGitHubRepo`) from AI help flow — all context is now read from local disk
27
+ - Removed `readClaudeMd()` single-file reader in favor of `readLibraryCatalog()` multi-file catalog builder
28
+
29
+
30
+ ## [2.43.0] - 2026-04-30
31
+
32
+ ### ✨ Added
33
+ - Headless mode for git hooks via CLAUDE_HOOKS_HEADLESS=1 environment variable, routing all LLM calls through the Anthropic SDK instead of the Claude CLI for CI/ECS environments (CT-805)
34
+ - Unit tests for pre-commit and prepare-commit-msg hooks covering headless mode propagation and error messaging (CT-805)
35
+
36
+ ### 🔧 Changed
37
+ - Hook error messages now show SDK-specific guidance ("Check that ANTHROPIC_API_KEY is set") in headless mode and CLI-specific guidance otherwise (CT-805)
38
+ - Headless flag propagated through full analysis chain: runAnalysis, orchestrateBatches, judgeAndFix, and analyzeCode all accept and forward the headless option (CT-805)
39
+
40
+ ### 🐛 Fixed
41
+ - Cross-platform path separator handling in hooks-verified marker test (#150)
42
+ - Contract documentation test updated to match current CLAUDE.md section heading (#150)
43
+
44
+
45
+ ## [2.42.0] - 2026-04-30
46
+
47
+ ### ✨ Added
48
+ - Added `Hooks-Verified: true` Git trailer to commits that pass pre-commit analysis, coordinated via a tree-SHA marker file in `.git/` (CT-802)
49
+ - Added `hooks-verified-marker.js` utility for marker file CRUD between pre-commit (writes) and prepare-commit-msg (reads/validates/consumes)
50
+ - Added `getStagedTreeSha()`, `hasHooksVerifiedTrailer()`, and `appendTrailer()` to git-operations for tree fingerprinting and canonical trailer formatting via `git interpret-trailers`
51
+ - Added hooks-verified marker writing to the `analyze` command when staged-scope analysis completes without critical/blocker issues (CT-802)
52
+
53
+ ### 🔧 Changed
54
+ - Reorganized CLAUDE.md project documentation into `.library/` structure with indexed books, shelves, and domain reading lists (#149)
55
+ - Updated commit-workflow domain reading list and hook books to document the new Hooks-Verified trailer pipeline
56
+
57
+ ### 🐛 Fixed
58
+ - Deferred trailer append in prepare-commit-msg until the final message is written, preventing the auto-generated message flow from overwriting the `Hooks-Verified` trailer (CT-802)
59
+
60
+
61
+ ## [2.41.1] - 2026-04-30
62
+
63
+ ### ✨ Added
64
+ - Added headless mode and JSON output support for `analyze`, `create-pr`, and `lint` commands (#148, CT-799)
65
+
66
+ ### 🔧 Changed
67
+ - Redistributed CLAUDE.md content into `.library/` — new `conventions.md` coding standards reference, enriched book indexes with key exports, and expanded domain quick-reference tables
68
+
69
+
70
+ ## [2.41.0] - 2026-04-30
71
+
72
+ ### ✨ Added
73
+ - Added `--headless` flag to `analyze`, `create-pr`, and `lint` commands for non-interactive CI execution (CT-799)
74
+ - Added `--format json` output mode that emits a single structured JSON line to stdout, routing all other output to stderr (CT-799)
75
+ - Added `CostTracker` integration in headless mode for `analyze` and `create-pr` to report Claude API costs in JSON output (CT-799)
76
+ - Added exit code 2 for usage errors (e.g., `--format json` without `--headless`) across `analyze`, `create-pr`, and `lint` (CT-799)
77
+ - Added early fatal guard for detached HEAD state in `create-pr` with actionable fix instructions (CT-804, #147)
78
+
79
+ ### 🔧 Changed
80
+ - Updated `interactive-ui.js` display helpers (`showSuccess`, `showError`, `showWarning`, `showInfo`) to delegate to `logger.js`, enabling JSON mode output routing to stderr
81
+ - Updated `displayLintResults` to accept a `{ silent }` option that suppresses decorative output in JSON mode
82
+ - Updated `create-pr` headless mode to resolve all 11 interactive decision points with documented defaults (auto-push, squash for unknown strategy, skip tag prompts)
83
+
84
+
85
+ ## [2.40.0] - 2026-04-30
86
+
87
+ ### ✨ Added
88
+ - Added early detached HEAD detection in `create-pr` command with actionable error message and remediation steps (CT-804)
89
+ - Added Operational Contract documentation in CLAUDE.md defining runtime environment requirements for CI/container orchestrators
90
+ - Added CWD & Branch Contract reference book (`.library/books/cwd-contract.md`) with command-level HEAD tolerance matrix
91
+ - Added smoke tests to prevent accidental deletion of contract documentation
92
+
93
+ ### 🔧 Changed
94
+ - Moved branch detection earlier in `create-pr` flow (before interactive prompts) to fail fast on detached HEAD
95
+ - Replaced `error()` + `return` with `fatal()` for detached HEAD guard in `create-pr`, ensuring consistent process termination
96
+
97
+
98
+ ## [2.39.0] - 2026-04-29
99
+
100
+ ### ✨ Added
101
+ - Added `--headless` flag to `install` command for CI/container environments — skips all side effects: dependency checks, git config, `.gitignore` updates, shell completions, linter availability check, and GitHub token setup (CT-803)
102
+ - Added `--verify-sdk` flag to `install` command — opt-in 1-token SDK ping (haiku, 10s timeout) to validate `ANTHROPIC_API_KEY` after installation; exits 1 in headless mode on failure, warns in interactive mode (CT-803)
103
+ - Added `verifySDKConnection()` to `claude-client.js` — minimal SDK connectivity check that delegates to `_executeSDK('ping')` and never throws (CT-803)
104
+ - Added `--headless` bypass for authorization guard in CLI router — CI runners skip RBAC checks entirely; governance enforced at branch-protection level (CT-803)
105
+
106
+ ### 🔧 Changed
107
+ - Install orchestration expanded from 20 to 21 steps to accommodate the new SDK verification step
108
+
109
+ ### ⚠️ Deprecated
110
+ - Deprecated `--skip-auth` flag on `install` command — use `--headless` instead for full CI/container mode; logs a deprecation warning when used
111
+
112
+
113
+ ## [2.38.0] - 2026-04-29
114
+
115
+ ### ✨ Added
116
+ - Added headless mode (`--headless`) for `analyze-pr` command — skips all interactive prompts for CI/automation pipelines
117
+ - Added JSON output mode (`--format json`) for `analyze-pr` — emits a single structured JSON document to stdout with verdict, severity counts, comments, and cost data (requires `--headless`)
118
+ - Added cost tracking for headless `analyze-pr` runs via `CostTracker` integration (#144)
119
+ - Added Langfuse trace flushing after headless SDK calls for observability (#144)
120
+ - Added `fatal()` function to helpers.js for process-terminating errors, separating logging from exit behavior
121
+ - Added JSON mode to logger (`setJSONMode`) — routes `info`/`success`/`warning`/`debug` to stderr, reserving stdout for structured output
122
+
123
+ ### 🔧 Changed
124
+ - Changed `error()` in helpers.js to log-only (no longer calls `process.exit`) — callers needing termination should use `fatal()` instead
125
+ - Changed `bin/claude-hooks` to use `fatal()` for unknown command errors
126
+ - Changed `helpers.info()`, `helpers.success()`, and `helpers.warning()` to delegate to logger equivalents, respecting JSON mode routing
127
+
128
+
129
+ ## [2.37.0] - 2026-04-29
130
+
131
+ ### ✨ Added
132
+ - Added cost tracking for headless SDK calls — per-call USD cost calculation with cache token multipliers, hardcoded Anthropic pricing table, and CloudWatch-friendly structured JSON logs (`cost-tracker.js`)
133
+ - Added optional Langfuse tracing integration for headless SDK calls — records LLM generations (model, tokens, cost, prompt/response) as traces; disabled by default, activated via `LANGFUSE_ENABLED` env var (`langfuse-tracer.js`)
134
+ - Added `costTracker` option to `analyzeCode()`, `executeClaudeWithRetry()`, and `executeClaude()` for external cost accumulation across multiple calls
135
+ - Added `._costs` field to `analyzeCode()` results in headless mode — contains per-call token usage and USD cost snapshot
136
+
137
+ ### 🔧 Changed
138
+ - Changed `_executeSDK()` return type from plain text string to `{ text, usage, model }` — callers now receive normalized token usage and resolved model ID
139
+ - Normalized SDK usage fields with defaults (0 for missing cache token counts) to ensure consistent downstream processing
140
+ - Updated library documentation with new books for `cost-tracker.js` and `langfuse-tracer.js`, updated `claude-client.js` book with observability details
141
+
142
+
143
+ ## [2.36.0] - 2026-04-28
144
+
145
+ ### ✨ Added
146
+ - Added SDK adapter for headless mode in claude-client — dual execution backend: CLI spawn for local/interactive use, or Anthropic SDK direct calls for headless/ECS environments (#141)
147
+ - Added `_executeSDK()` function for direct Anthropic SDK calls with lazy-loaded `@anthropic-ai/sdk` dependency
148
+ - Added `resolveModelAlias()` and `MODEL_ALIASES` constant with environment variable overrides (`CLAUDE_MODEL_SONNET`, `CLAUDE_MODEL_OPUS`, `CLAUDE_MODEL_HAIKU`)
149
+ - Added `headless` option to `analyzeCode()`, `executeClaudeWithRetry()`, and `executeClaude()` for SDK-based execution
150
+ - Added `claude.defaultModel` to hardcoded config as fallback model for SDK headless mode
151
+
152
+ ### 🔧 Changed
153
+ - Changed `analyzeCode()` to return parsed JSON object instead of raw response text
154
+ - Changed `executeClaude()` to branch between SDK path (when `headless: true`) and CLI spawn path
155
+ - SDK errors marked with `fromSDK: true` are no longer retried by `withRetry` — the Anthropic SDK already retries internally (2 attempts for rate limits, timeouts, and 5xx)
156
+ - Updated claude-client library book to document dual-backend architecture, SDK gotchas, and new exports
157
+
158
+ ### 🐛 Fixed
159
+ - Fixed Spotless timeouts and cmd.exe per-file mode (#141)
160
+
161
+ ### 🗑️ Removed
162
+ - Removed `.library/CATEGORY_COMPLETENESS_REPORT.md` and `.library/CLASSIFICATION_REPORT.md` reports
163
+
164
+
8
165
  ## [2.35.3] - 2026-04-22
9
166
 
10
167
  ### ✨ Added