claude-git-hooks 2.51.2 → 2.61.2

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,31 +5,237 @@ 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.61.2] - 2026-06-01
9
+
10
+ ### 🐛 Fixed
11
+ - Fixed incorrect import path for gotcha solicitation in PR pipeline
12
+
13
+
14
+ ## [2.61.1] - 2026-06-01
15
+
16
+ ### ✨ Added
17
+ - Auto-regeneration of stale Library books during `create-release` — stale books are now regenerated before the release is tagged, keeping the tag accurate (#178, AUT-3738)
18
+
19
+ ### 🔧 Changed
20
+ - Staleness warning templates are now context-aware: `CONSOLE_WARNING_TEMPLATE` and `PR_BODY_SECTION_TEMPLATE` accept an `autoRegen` option to tailor messaging per consumer (`will-run` for create-release, `deferred` for bump-version, `completed`/`failed` in PR body)
21
+ - PR body staleness section now reflects the actual auto-regeneration outcome instead of always listing remediation scripts
22
+ - Console staleness warning in `bump-version` now tells the user that Library will be auto-regenerated when they run `create-pr`
23
+
24
+ ### 🗑️ Removed
25
+ - Removed static recommended-scripts list from console staleness warnings (replaced by context-aware auto-regeneration messages)
26
+
27
+
28
+ ## [2.61.0] - 2026-06-01
29
+
30
+ ### ✨ Added
31
+ - Added canonical staleness-warning templates (`CONSOLE_WARNING_TEMPLATE`, `PR_BODY_SECTION_TEMPLATE`, `PR_TAG_VALUE`) for consistent Library staleness messaging across all consumer commands (AUT-3738)
32
+ - Added non-blocking Library staleness verification gate to the `create-release` workflow — warns operators when Library books are out of date without blocking the release (AUT-3738)
33
+ - Added automatic release PR creation step in `create-release` with idempotency check, staleness section in PR body wrapped in marker comments, and `library-stale` label when applicable (AUT-3738)
34
+ - Added `LIBRARY_VERIFY_SKIPPED_WARNING_RELEASE` constant for release-specific Library verification skip messaging (AUT-3738)
35
+
36
+ ### 🔧 Changed
37
+ - Refactored `bump-version` Library warning to use the canonical `CONSOLE_WARNING_TEMPLATE` instead of inline formatting (AUT-3738)
38
+ - Changed `create-release` Library staleness gate from blocking (exit on stale) to non-blocking (warn and continue), using the librarian `verify()` API instead of raw staleness tools (AUT-3738)
39
+ - Refactored `library-warnings.js` to re-export canonical wording from the librarian messages module instead of defining constants inline (AUT-3738)
40
+ - Updated Library books for `create-release`, `bump-version`, and `library-warnings` to reflect new dependencies and exports (AUT-3738)
41
+
42
+ ### 🗑️ Removed
43
+ - Removed blocking Library staleness check from `create-release` that imported `.library/tools/staleness.js` directly and aborted on drift (AUT-3738)
44
+ - Removed `LIBRARY_STALE_WARNING` constant from `library-warnings.js`, replaced by canonical `CONSOLE_WARNING_TEMPLATE` (AUT-3738)
45
+
46
+
47
+ ## [2.61.0] - 2026-05-29
48
+
49
+ ### ✨ Added
50
+
51
+ - Added gotcha solicitation orchestrator for the Library system, enabling interactive developer prompts to capture known gotchas per book during the create-pr pipeline (AUT-3735)
52
+ - Added end-to-end cross-cutting tests for the gotcha solicitation flow covering manual-additions preservation and API-down graceful degradation (AUT-3735)
53
+ - Added Library verification gate for the bump-version workflow with warning constants in `library-warnings.js` (#176, AUT-3737)
54
+
55
+ ### 🔧 Changed
56
+
57
+ - Updated bump-version book to reference the new `library-warnings.js` dependency (AUT-3737)
58
+
59
+ ## [2.60.0] - 2026-06-01
60
+
61
+ ### ✨ Added
62
+
63
+ - Added canonical staleness-warning templates (`CONSOLE_WARNING_TEMPLATE`, `PR_BODY_SECTION_TEMPLATE`, `PR_TAG_VALUE`) for consistent Library staleness messaging across all consumer commands (AUT-3738)
64
+ - Added non-blocking Library staleness verification gate to the `create-release` workflow — warns operators when Library books are out of date without blocking the release (AUT-3738)
65
+ - Added staleness section to release PR body when Library is stale, wrapped in marker comments for downstream tooling (AUT-3738)
66
+
67
+ ### 🔧 Changed
68
+
69
+ - Refactored `bump-version` Library warning to use the canonical `CONSOLE_WARNING_TEMPLATE` instead of inline formatting (AUT-3738)
70
+ - Updated Library books for `create-release`, `bump-version`, and `library-warnings` to reflect new dependencies and exports (AUT-3738)
71
+
72
+ ### 🗑️ Removed
73
+
74
+ - Removed gotcha solicitation orchestrator (`gotcha-solicitation.js`) from the Library system (AUT-3738)
75
+
76
+ ## [2.59.0] - 2026-05-29
77
+
78
+ ### ✨ Added
79
+
80
+ - Library verification gate in `bump-version` command — warns about stale or missing Library books before proceeding with version bump (AUT-3737)
81
+ - Read-only `verify()` staleness check to librarian module with never-throws guarantee (AUT-3737)
82
+ - Warning wording constants for Library verification gates in `lib/messages/library-warnings.js` (AUT-3737)
83
+ - `updatePullRequestBody()` method to GitHub API utility (#175)
84
+
85
+ ### 🔧 Changed
86
+
87
+ - Back-merge co-change pipeline "skipped" message now uses `logger.warning` instead of raw stderr write (#175)
88
+ - Library books synced for back-merge and github-api modules (#175)
89
+
90
+ ## [2.58.0] - 2026-05-29
91
+
92
+ ### ✨ Added
93
+
94
+ - Integrated co-change correlation pipeline into back-merge workflow — runs 6-step detection, mode resolution, sidecar write, injection, and report generation after merge commit (AUT-3777)
95
+ - Added `updatePullRequestBody()` to GitHub API module for updating PR body content
96
+ - Auto-attach co-change analysis report to back-merge PR body with idempotent marker comments for safe re-runs (AUT-3777)
97
+ - Added comprehensive smoke tests for back-merge co-change pipeline glue
98
+
99
+ ### 🔧 Changed
100
+
101
+ - Back-merge co-change step now uses `coChangePipeline()` orchestrator instead of the standalone `inject-co-change.js` tool — stages and commits Library changes as a separate `chore(library)` commit
102
+ - Updated Library README with full `coChangePipeline()` documentation including sequence diagram, consumer contract, mode reference, and limitations
103
+
104
+ ### 🐛 Fixed
105
+
106
+ - Fixed false-positive linter warnings (#174)
107
+
108
+ ### 🗑️ Removed
109
+
110
+ - Removed legacy `inject-co-change.js` tool invocation from back-merge post-push step, replaced by integrated pipeline
111
+
112
+ ## [2.57.1] - 2026-05-29
113
+
114
+ ### 🐛 Fixed
115
+
116
+ - Filtered ESLint meta-warnings for ignored files that produced false-positive linter output
117
+ - Fixed co-change pipeline injection result not being captured when running in inject mode
118
+
119
+ ### 🗑️ Removed
120
+
121
+ - Removed `createPrPipeline()` Library maintenance orchestrator and associated M6 documentation
122
+
123
+ ## [2.57.0] - 2026-05-28
124
+
125
+ ### ✨ Added
126
+
127
+ - Added `createPrPipeline()` 5-step Library maintenance orchestrator for the `create-pr` command — runs staleness detection, auto-section regeneration, book add/remove/rename, frontmatter sync, and gotcha solicitation sequentially (AUT-3736)
128
+ - Added comprehensive pipeline documentation to Library README including sequence diagram, consumer contract, and return shape
129
+
130
+ ### 🔧 Changed
131
+
132
+ - Integrated Library maintenance pipeline into `create-pr` command — now triggers full book sync instead of only reporting staleness (AUT-3736)
133
+ - Updated Library milestone status: M5 (core hypothesis validation) marked as shipped, M6 (lifecycle automation) added as in-progress
134
+ - Removed unused variables in `co-change-pipeline.js` (`injectionResult`), `cross-ref-injector.js` (`fileContents`), and renamed unused parameter in `gotcha-persistence.js` (`opts` → `_opts`)
135
+ - Replaced string concatenation with template literals in `gotcha-persistence.js`
136
+
137
+ ## [2.56.0] - 2026-05-28
138
+
139
+ ### ✨ Added
140
+
141
+ - Added candidate gotcha text generator for librarian books — calls Claude API to propose non-obvious tribal knowledge from PR descriptions, commit messages, and source comments (AUT-3735)
142
+ - Added gotcha persistence module for appending accepted gotchas below the manual-additions separator in book files, with idempotency and frontmatter flagging when the API is unreachable (AUT-3735)
143
+ - Added co-change analysis pipeline (#170)
144
+
145
+ ## [2.55.0] - 2026-05-27
146
+
147
+ ### ✨ Added
148
+
149
+ - Added co-change detector that parses git history within a configurable window, computes co-occurrence weighted edges between file pairs, and filters by confidence thresholds (AUT-3740)
150
+ - Added cross-reference injector that updates book frontmatter with co-change cross-references, supporting bidirectional refs for regular books and directional used_by refs for utility books (AUT-3740)
151
+ - Added co-change pipeline orchestrator that runs the full 5-step sequence: detection, mode resolution, sidecar write, optional injection, and markdown analysis report generation (AUT-3740)
152
+ - Added comprehensive unit and idempotency tests for co-change pipeline and cross-ref injector (AUT-3740)
153
+
154
+ ### 🔧 Changed
155
+
156
+ - Replaced string concatenation with template literal in co-change-mode sidecar writer (lint fix)
157
+
158
+ ## [2.54.1] - 2026-05-27
159
+
160
+ ### ✨ Added
161
+
162
+ - Added comprehensive test suite for librarian console API covering isTTY, selectOne, selectMany, confirm, and freeText functions (AUT-3756)
163
+ - Added gotcha solicitation usage example demonstrating the console API interactive workflow (AUT-3756)
164
+
165
+ ## [2.54.0] - 2026-05-27
166
+
167
+ ### ✨ Added
168
+
169
+ - Co-change mode dispatcher for the back-merge pipeline with two modes: `collect-only` (edge accumulation) and `inject` (cross-reference writing), with automatic transition after a configurable threshold of 5 back-merges (AUT-3772)
170
+ - Sidecar state file (`.library/maps/co-change-state.json`) for persisting co-change edges, back-merge counts, and transition configuration across pipeline runs
171
+ - CLI override support (`--co-change-mode=collect-only|inject`) for per-invocation mode control without mutating sidecar state
172
+ - Schema validation, append-only edge merging, and alphabetical edge normalization for deterministic sidecar diffs
173
+ - Comprehensive unit tests for co-change mode dispatcher covering constants, validation, I/O, edge operations, mode resolution, and cold-start behavior
174
+
175
+ ### 🔧 Changed
176
+
177
+ - Updated back-merge documentation to reflect co-change edge collection and conditional injection via mode dispatcher (#167)
178
+
179
+ ## [2.53.0] - 2026-05-27
180
+
181
+ ### ✨ Added
182
+
183
+ - Added post-regen review pass that uses Claude CLI to suggest manual-section improvements based on auto-section changes (#166)
184
+ - Added `--no-review` flag to `regenerate` and `report` commands to skip the Claude review step
185
+ - Added `line-diff.js` — pure-function line-based diff utility for LLM consumption (no shell dependencies)
186
+ - Added `llm.js` — thin Claude CLI wrapper with availability check and graceful degradation
187
+ - Added `review-pass.js` — interactive review workflow: Accept / Edit / Skip / Skip-all per suggestion
188
+
189
+ ### 🔧 Changed
190
+
191
+ - Enriched `regenerate()` output with `diff_context` (old/new auto-section, manual section, source file) for changed books
192
+ - Updated `report` command to include the review pass as Step 2b in the full maintenance cycle
193
+ - Renumbered execution prompt steps (overflow check → Step 4, gotcha solicitation → Step 5, report → Step 6) to accommodate the new review step
194
+
195
+ ## [2.52.0] - 2026-05-27
196
+
197
+ ### ✨ Added
198
+
199
+ - Interactive console primitive for the librarian, enabling programmatic library access (AUT-3734)
200
+ - Comprehensive I/O documentation, execution flows, cross-references, and gotchas for library books: analysis-engine, analyze-diff, analyze-pr, authorization, bump-version (AUT-3734)
201
+
202
+ ### 🔧 Changed
203
+
204
+ - ESLint configuration now includes `.library/librarian/**` in linting scope
205
+
206
+ ### 🐛 Fixed
207
+
208
+ - Fixed bump-version issue (#165)
209
+ - Fixed inaccuracies in library book documentation (AUT-3734)
210
+
8
211
  ## [2.51.2] - 2026-05-26
9
212
 
10
213
  ### 🔧 Changed
214
+
11
215
  - Made library integration visible in CLI (#164)
12
216
 
13
217
  ### 🐛 Fixed
14
- - Fixed partial file selection during version bump — `updateVersionFiles` no longer silently skips unselected files; callers now filter before calling, ensuring only user-selected files are bumped (AUT-3733)
15
218
 
219
+ - Fixed partial file selection during version bump — `updateVersionFiles` no longer silently skips unselected files; callers now filter before calling, ensuring only user-selected files are bumped (AUT-3733)
16
220
 
17
221
  ## [2.51.1] - 2026-05-25
18
222
 
19
223
  ### ✨ Added
224
+
20
225
  - Specification guide (SPEC_GUIDE.md) — a practitioner's guide to building a Code Knowledge Library, covering setup, schema, taxonomy, maintenance, and worked examples (AUT-3722)
21
226
  - Overlap-check tool for detecting book content overlap, closing Library milestone M4 (AUT-3722, #162)
22
227
  - Maps/ artifacts (dependency graph, co-change seeds) surfaced via librarian module for programmatic access (AUT-3722)
23
228
 
24
229
  ### 🔧 Changed
230
+
25
231
  - Rewrote Library README as a specification-oriented guide with clearer structure, worked examples, milestone status tracking, and getting-started table (AUT-3722)
26
232
  - Rewrote CLAUDE.md Library section to align with specification guide format and reference SPEC_GUIDE.md (AUT-3722)
27
233
  - Made Library integration visible in CLI output so users can discover library-powered features (#163)
28
234
 
29
-
30
235
  ## [2.51.0] - 2026-05-25
31
236
 
32
237
  ### ✨ Added
238
+
33
239
  - Added unified Library CLI at `.library/bin/library` with commands: check, regenerate, extract, tokens, graph, inject, validate, report (AUT-3272)
34
240
  - Added centralized path resolution module (`.library/paths.js`) with resolver.yaml parser for repository-agnostic Library adoption
35
241
  - Added Library CLI command registry (`.library/cli.js`) following the same pattern as `lib/cli-metadata.js`
@@ -44,6 +250,7 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
44
250
  - Added co-change references to books via PR #161 (AUT-3315)
45
251
 
46
252
  ### 🔧 Changed
253
+
47
254
  - Refactored all Library tools (`staleness.js`, `generate-graph.js`, `inject-co-change.js`, `measure-tokens.js`, `extract.js`, `librarian/index.js`) to use centralized `paths.js` instead of per-tool `__dirname` arithmetic (AUT-3272)
48
255
  - Rewrote `.library/README.md` with adoption guide, command reference, book schema documentation, and automated maintenance via git hooks section
49
256
  - Replaced legacy npm scripts (`library:tokens`, `library:graph`, `library:extract-poc`, `library:inject-co-change`) with unified CLI-routed equivalents
@@ -53,112 +260,122 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
53
260
  - Rewrote CLAUDE.md Library section to reference the Specification Guide instead of duplicating Library documentation (AUT-3722)
54
261
  - Closed M4 milestone — resolved OPEN items 1–5 in SPEC_GUIDE § 13 with evidence and deferral justifications (AUT-3722)
55
262
 
56
-
57
263
  ## [2.50.0] - 2026-05-20
58
264
 
59
265
  ### ✨ Added
266
+
60
267
  - Added co-change reference tracking to library books — frontmatter now includes `co_change_references` with commit counts, confidence scores, and trigger descriptions for files that historically change together (AUT-3315)
61
268
  - Added `CO_CHANGE_SEEDS.md` co-change seed patterns document with 4 architectural coupling patterns mined from 6 months of git history (AUT-3315)
62
269
  - Added `inject-co-change.js` CLI tool to inject co-change references from seed patterns into book frontmatter, with `--dry-run`, `--json`, and `--seeds` options (AUT-3315)
63
270
  - Added librarian module for automated library maintenance pipeline (#160)
64
271
 
65
272
  ### 🔧 Changed
273
+
66
274
  - Moved staleness detection scripts from `.library/maintenance/` to `.library/tools/` directory (AUT-3315)
67
275
  - Updated `.library/maps/` directory scope to include co-change seeds and token reports (AUT-3315)
68
276
  - Updated `.library/tools/` directory scope to cover all standalone CLI utilities — staleness, graph, tokens, and co-change injection (AUT-3315)
69
277
 
70
-
71
278
  ## [2.49.0] - 2026-05-19
72
279
 
73
280
  ### ✨ Added
281
+
74
282
  - Librarian module for Library maintenance pipeline with five core functions: fetch, regenerate, checkOverflow, solicitGotchas, and buildReport (AUT-3309)
75
283
  - Execution prompt for running full regeneration cycles via Sonnet sessions (AUT-3309)
76
284
  - Report template for structured maintenance cycle output (AUT-3309)
77
285
  - Staleness detector for tracking book drift via AST hash comparison (#159, AUT-3307)
78
286
 
79
287
  ### 🔧 Changed
288
+
80
289
  - Renamed librarian `fetch` export to `fetchLibraryContent` for clarity (AUT-3309)
81
290
  - Updated Library README with comprehensive documentation covering auto-generation, staleness detection, librarian module, and maintenance workflow
82
291
  - Book schema `generated_from` field now supports AST hash format (`ast:sha256:<hex>`) for staleness tracking
83
292
  - Library book count updated from 26 to 70 reflecting auto-generated coverage
84
293
 
85
-
86
294
  ## [2.48.0] - 2026-05-19
87
295
 
88
296
  ### ✨ Added
297
+
89
298
  - Added staleness detector for library books to identify outdated documentation (AUT-3307)
90
299
 
91
300
  ### 🗑️ Removed
92
- - Removed extractor evaluation artifacts (PARSER_DECISION.md, QUALITY_GAP.md) after library auto-update evaluation completed (#158, AUT-3305)
93
301
 
302
+ - Removed extractor evaluation artifacts (PARSER_DECISION.md, QUALITY_GAP.md) after library auto-update evaluation completed (#158, AUT-3305)
94
303
 
95
304
  ## [2.47.1] - 2026-05-19
96
305
 
97
306
  ### 🐛 Fixed
307
+
98
308
  - Fixed path normalization in AST extractor for Windows compatibility by using `fileURLToPath()` instead of raw URL pathname and normalizing backslashes in relative paths (AUT-3305)
99
309
  - Fixed cross-platform book file detection in help catalog by using regex path separator matching instead of literal forward slash
100
310
 
101
-
102
311
  ## [2.47.0] - 2026-05-19
103
312
 
104
313
  ### ✨ Added
314
+
105
315
  - Quality gap report and batch runner for the AST documentation extractor (AUT-3305)
106
316
  - "preserve-if-filled" strategy for the AST extractor to retain manually-written book sections during regeneration (AUT-3305)
107
317
 
108
318
  ### 🔧 Changed
109
- - Regenerated all library book documentation from AST extractor output, replacing manually-maintained books with accurate cross-references and call signatures (AUT-3305, PR #157)
110
319
 
320
+ - Regenerated all library book documentation from AST extractor output, replacing manually-maintained books with accurate cross-references and call signatures (AUT-3305, PR #157)
111
321
 
112
322
  ## [2.46.0] - 2026-05-18
113
323
 
114
324
  ### ✨ Added
325
+
115
326
  - Added AST extractor POC with JavaScript and Python language adapters (AUT-3273)
116
327
  - Added source-to-book auto-section generator for automated library documentation (AUT-3273)
117
328
  - Generated book stubs for 40 source modules in `.library/books/` (AUT-3273)
118
329
  - Added centralized configuration registry (`config-registry.js` + `defaults.json`) with remote override support (#156, ISSUE-138)
119
330
 
120
331
  ### 🔧 Changed
332
+
121
333
  - Configuration merge priority expanded from 4 to 5 layers, adding remote `settings.json` team-policy overrides (#156)
122
334
  - Orchestrator model, threshold, and timeout are now configurable via remote `settings.json` instead of hardcoded values (#156)
123
335
  - Judge timeout now configurable via remote `settings.json` (#156)
124
336
  - Updated library README and shelf indexes to reflect new book count (AUT-3273)
125
337
  - ESLint config updated to include `.library/extractor/` files (AUT-3273)
126
338
 
127
-
128
339
  ## [2.45.0] - 2026-05-13
129
340
 
130
341
  ### ✨ Added
342
+
131
343
  - Added centralized config-registry module with local defaults and remote override support (SUE-138)
132
344
  - Added lib/defaults.json as the single source of truth for all package default values (SUE-138)
133
345
 
134
346
  ### 🔧 Changed
347
+
135
348
  - Replaced inline hardcoded constants across modules with config-registry lookups — judge, orchestrator, Linear connector, model aliases, linter tools, and PR analysis categories now read from defaults.json with remote override capability (SUE-138)
136
349
  - Updated config merge priority to HARDCODED < remote settings.json < defaults < preset < user overrides (SUE-138)
137
350
  - Added config-registry mocks to unit tests for modules consuming centralized defaults (SUE-138)
138
351
 
139
352
  ### 🐛 Fixed
140
- - Fixed Linear ticket fetch issue (#155)
141
353
 
354
+ - Fixed Linear ticket fetch issue (#155)
142
355
 
143
356
  ## [2.44.1] - 2026-05-13
144
357
 
145
358
  ### ✨ Added
359
+
146
360
  - Added unit tests for linear-connector module covering ticket extraction, parsing, token loading, connection testing, and ticket fetching (SUE-154)
147
361
 
148
362
  ### 🐛 Fixed
363
+
149
364
  - Fixed help command to cap book reads at 5 in Pass 2, preventing oversized prompts when the LLM requests too many library books (SUE-154)
150
365
 
151
366
  ### 🗑️ Removed
152
- - Removed CLAUDE-MIGRATION.md — migration map no longer needed after library stabilization
153
367
 
368
+ - Removed CLAUDE-MIGRATION.md — migration map no longer needed after library stabilization
154
369
 
155
370
  ## [2.44.0] - 2026-05-04
156
371
 
157
372
  ### ✨ Added
373
+
158
374
  - New `HELP_NAVIGATE.md` prompt template for the first-pass catalog navigation (SUE-152)
159
375
  - Auto-discovery of `.library/` catalog files (by-code, by-domain, by-task-type shelves) for AI help context
160
376
 
161
377
  ### 🔧 Changed
378
+
162
379
  - Rewrote AI help command to use a two-pass librarian approach navigating local `.library/` instead of single-pass CLAUDE.md lookup (SUE-152)
163
380
  - 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
164
381
  - Updated `HELP_QUERY.md` template to accept catalog + book content instead of flat documentation
@@ -167,56 +384,63 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
167
384
  - Updated unit tests to cover two-pass librarian flow, catalog mocking, and book-read scenarios
168
385
 
169
386
  ### 🔒 Security
387
+
170
388
  - Added path traversal protection when reading LLM-requested book paths — resolved paths are verified against the package root before disk access
171
389
 
172
390
  ### 🗑️ Removed
391
+
173
392
  - Removed GitHub API dependency (`fetchFileContent`, `parseGitHubRepo`) from AI help flow — all context is now read from local disk
174
393
  - Removed `readClaudeMd()` single-file reader in favor of `readLibraryCatalog()` multi-file catalog builder
175
394
 
176
-
177
395
  ## [2.43.0] - 2026-04-30
178
396
 
179
397
  ### ✨ Added
398
+
180
399
  - 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)
181
400
  - Unit tests for pre-commit and prepare-commit-msg hooks covering headless mode propagation and error messaging (CT-805)
182
401
 
183
402
  ### 🔧 Changed
403
+
184
404
  - 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)
185
405
  - Headless flag propagated through full analysis chain: runAnalysis, orchestrateBatches, judgeAndFix, and analyzeCode all accept and forward the headless option (CT-805)
186
406
 
187
407
  ### 🐛 Fixed
408
+
188
409
  - Cross-platform path separator handling in hooks-verified marker test (#150)
189
410
  - Contract documentation test updated to match current CLAUDE.md section heading (#150)
190
411
 
191
-
192
412
  ## [2.42.0] - 2026-04-30
193
413
 
194
414
  ### ✨ Added
415
+
195
416
  - Added `Hooks-Verified: true` Git trailer to commits that pass pre-commit analysis, coordinated via a tree-SHA marker file in `.git/` (CT-802)
196
417
  - Added `hooks-verified-marker.js` utility for marker file CRUD between pre-commit (writes) and prepare-commit-msg (reads/validates/consumes)
197
418
  - Added `getStagedTreeSha()`, `hasHooksVerifiedTrailer()`, and `appendTrailer()` to git-operations for tree fingerprinting and canonical trailer formatting via `git interpret-trailers`
198
419
  - Added hooks-verified marker writing to the `analyze` command when staged-scope analysis completes without critical/blocker issues (CT-802)
199
420
 
200
421
  ### 🔧 Changed
422
+
201
423
  - Reorganized CLAUDE.md project documentation into `.library/` structure with indexed books, shelves, and domain reading lists (#149)
202
424
  - Updated commit-workflow domain reading list and hook books to document the new Hooks-Verified trailer pipeline
203
425
 
204
426
  ### 🐛 Fixed
205
- - 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)
206
427
 
428
+ - 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)
207
429
 
208
430
  ## [2.41.1] - 2026-04-30
209
431
 
210
432
  ### ✨ Added
433
+
211
434
  - Added headless mode and JSON output support for `analyze`, `create-pr`, and `lint` commands (#148, CT-799)
212
435
 
213
436
  ### 🔧 Changed
214
- - Redistributed CLAUDE.md content into `.library/` — new `conventions.md` coding standards reference, enriched book indexes with key exports, and expanded domain quick-reference tables
215
437
 
438
+ - Redistributed CLAUDE.md content into `.library/` — new `conventions.md` coding standards reference, enriched book indexes with key exports, and expanded domain quick-reference tables
216
439
 
217
440
  ## [2.41.0] - 2026-04-30
218
441
 
219
442
  ### ✨ Added
443
+
220
444
  - Added `--headless` flag to `analyze`, `create-pr`, and `lint` commands for non-interactive CI execution (CT-799)
221
445
  - Added `--format json` output mode that emits a single structured JSON line to stdout, routing all other output to stderr (CT-799)
222
446
  - Added `CostTracker` integration in headless mode for `analyze` and `create-pr` to report Claude API costs in JSON output (CT-799)
@@ -224,42 +448,46 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
224
448
  - Added early fatal guard for detached HEAD state in `create-pr` with actionable fix instructions (CT-804, #147)
225
449
 
226
450
  ### 🔧 Changed
451
+
227
452
  - Updated `interactive-ui.js` display helpers (`showSuccess`, `showError`, `showWarning`, `showInfo`) to delegate to `logger.js`, enabling JSON mode output routing to stderr
228
453
  - Updated `displayLintResults` to accept a `{ silent }` option that suppresses decorative output in JSON mode
229
454
  - Updated `create-pr` headless mode to resolve all 11 interactive decision points with documented defaults (auto-push, squash for unknown strategy, skip tag prompts)
230
455
 
231
-
232
456
  ## [2.40.0] - 2026-04-30
233
457
 
234
458
  ### ✨ Added
459
+
235
460
  - Added early detached HEAD detection in `create-pr` command with actionable error message and remediation steps (CT-804)
236
461
  - Added Operational Contract documentation in CLAUDE.md defining runtime environment requirements for CI/container orchestrators
237
462
  - Added CWD & Branch Contract reference book (`.library/books/cwd-contract.md`) with command-level HEAD tolerance matrix
238
463
  - Added smoke tests to prevent accidental deletion of contract documentation
239
464
 
240
465
  ### 🔧 Changed
466
+
241
467
  - Moved branch detection earlier in `create-pr` flow (before interactive prompts) to fail fast on detached HEAD
242
468
  - Replaced `error()` + `return` with `fatal()` for detached HEAD guard in `create-pr`, ensuring consistent process termination
243
469
 
244
-
245
470
  ## [2.39.0] - 2026-04-29
246
471
 
247
472
  ### ✨ Added
473
+
248
474
  - 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)
249
475
  - 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)
250
476
  - Added `verifySDKConnection()` to `claude-client.js` — minimal SDK connectivity check that delegates to `_executeSDK('ping')` and never throws (CT-803)
251
477
  - Added `--headless` bypass for authorization guard in CLI router — CI runners skip RBAC checks entirely; governance enforced at branch-protection level (CT-803)
252
478
 
253
479
  ### 🔧 Changed
480
+
254
481
  - Install orchestration expanded from 20 to 21 steps to accommodate the new SDK verification step
255
482
 
256
483
  ### ⚠️ Deprecated
257
- - Deprecated `--skip-auth` flag on `install` command — use `--headless` instead for full CI/container mode; logs a deprecation warning when used
258
484
 
485
+ - Deprecated `--skip-auth` flag on `install` command — use `--headless` instead for full CI/container mode; logs a deprecation warning when used
259
486
 
260
487
  ## [2.38.0] - 2026-04-29
261
488
 
262
489
  ### ✨ Added
490
+
263
491
  - Added headless mode (`--headless`) for `analyze-pr` command — skips all interactive prompts for CI/automation pipelines
264
492
  - 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`)
265
493
  - Added cost tracking for headless `analyze-pr` runs via `CostTracker` integration (#144)
@@ -268,28 +496,30 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
268
496
  - Added JSON mode to logger (`setJSONMode`) — routes `info`/`success`/`warning`/`debug` to stderr, reserving stdout for structured output
269
497
 
270
498
  ### 🔧 Changed
499
+
271
500
  - Changed `error()` in helpers.js to log-only (no longer calls `process.exit`) — callers needing termination should use `fatal()` instead
272
501
  - Changed `bin/claude-hooks` to use `fatal()` for unknown command errors
273
502
  - Changed `helpers.info()`, `helpers.success()`, and `helpers.warning()` to delegate to logger equivalents, respecting JSON mode routing
274
503
 
275
-
276
504
  ## [2.37.0] - 2026-04-29
277
505
 
278
506
  ### ✨ Added
507
+
279
508
  - 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`)
280
509
  - 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`)
281
510
  - Added `costTracker` option to `analyzeCode()`, `executeClaudeWithRetry()`, and `executeClaude()` for external cost accumulation across multiple calls
282
511
  - Added `._costs` field to `analyzeCode()` results in headless mode — contains per-call token usage and USD cost snapshot
283
512
 
284
513
  ### 🔧 Changed
514
+
285
515
  - Changed `_executeSDK()` return type from plain text string to `{ text, usage, model }` — callers now receive normalized token usage and resolved model ID
286
516
  - Normalized SDK usage fields with defaults (0 for missing cache token counts) to ensure consistent downstream processing
287
517
  - Updated library documentation with new books for `cost-tracker.js` and `langfuse-tracer.js`, updated `claude-client.js` book with observability details
288
518
 
289
-
290
519
  ## [2.36.0] - 2026-04-28
291
520
 
292
521
  ### ✨ Added
522
+
293
523
  - 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)
294
524
  - Added `_executeSDK()` function for direct Anthropic SDK calls with lazy-loaded `@anthropic-ai/sdk` dependency
295
525
  - Added `resolveModelAlias()` and `MODEL_ALIASES` constant with environment variable overrides (`CLAUDE_MODEL_SONNET`, `CLAUDE_MODEL_OPUS`, `CLAUDE_MODEL_HAIKU`)
@@ -297,21 +527,24 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
297
527
  - Added `claude.defaultModel` to hardcoded config as fallback model for SDK headless mode
298
528
 
299
529
  ### 🔧 Changed
530
+
300
531
  - Changed `analyzeCode()` to return parsed JSON object instead of raw response text
301
532
  - Changed `executeClaude()` to branch between SDK path (when `headless: true`) and CLI spawn path
302
533
  - 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)
303
534
  - Updated claude-client library book to document dual-backend architecture, SDK gotchas, and new exports
304
535
 
305
536
  ### 🐛 Fixed
537
+
306
538
  - Fixed Spotless timeouts and cmd.exe per-file mode (#141)
307
539
 
308
540
  ### 🗑️ Removed
309
- - Removed `.library/CATEGORY_COMPLETENESS_REPORT.md` and `.library/CLASSIFICATION_REPORT.md` reports
310
541
 
542
+ - Removed `.library/CATEGORY_COMPLETENESS_REPORT.md` and `.library/CLASSIFICATION_REPORT.md` reports
311
543
 
312
544
  ## [2.35.3] - 2026-04-22
313
545
 
314
546
  ### ✨ Added
547
+
315
548
  - Code Knowledge Library (`.library/`) with 25 reference books covering source modules — structured documentation with call signatures, I/O behavior, cross-references, and gotchas per module (#125-#131)
316
549
  - By-code index for navigating from source file paths to their reference books (`by-code/utils.md`, `by-code/commands.md`, `by-code/hooks.md`)
317
550
  - By-domain index with curated reading lists for four business workflows: commit pipeline, release management, PR analysis, and GitHub integration (`by-domain/`)
@@ -321,24 +554,26 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
321
554
  - Classification report and category completeness report validating all 66 source modules against the 8-category taxonomy
322
555
 
323
556
  ### 🐛 Fixed
324
- - Spotless linting timeouts and cmd.exe per-file mode on Windows — resolves batch-mode failures when Spotless wrapper is a `.cmd`/`.bat` file (#124, #125)
325
557
 
558
+ - Spotless linting timeouts and cmd.exe per-file mode on Windows — resolves batch-mode failures when Spotless wrapper is a `.cmd`/`.bat` file (#124, #125)
326
559
 
327
560
  ## [2.35.2] - 2026-04-13
328
561
 
329
562
  ### ✨ Added
563
+
330
564
  - Added Maven Wrapper (mvnw/mvnw.cmd) auto-detection for Spotless — bypasses cmd.exe metacharacter issues on Windows/WSL2
331
565
  - Added per-file execution mode for Spotless to avoid pipe (`|`) metacharacter in regex arguments on Windows
332
566
  - Added `env` option to `runTool`, `runToolFix`, and `runToolWithAutoFix` for passing extra environment variables to tool invocations
333
567
  - Added `configDir` to `_detectInProjectFiles` return value for downstream Maven Wrapper resolution
334
568
 
335
569
  ### 🐛 Fixed
336
- - Fixed Spotless linter failing on Windows/WSL2 when multiple Java files are staged — `|` (pipe) in the `DspotlessFiles` regex was interpreted as a shell pipe by cmd.exe during batch script expansion
337
570
 
571
+ - Fixed Spotless linter failing on Windows/WSL2 when multiple Java files are staged — `|` (pipe) in the `DspotlessFiles` regex was interpreted as a shell pipe by cmd.exe during batch script expansion
338
572
 
339
573
  ## [2.35.1] - 2026-04-08
340
574
 
341
575
  ### ✨ Added
576
+
342
577
  - Local binary resolution for linter tools — walks up from config directory to repo root, preferring project-installed binaries over npx to prevent version mismatches (#123)
343
578
  - Array-form `detectInProjectFile` for tool detection — Prettier and ESLint now recognized via config files (.prettierrc, .eslintrc.json, eslint.config.js, etc.) in addition to package.json dependencies
344
579
  - WSL2/Windows interop support for .cmd/.bat tool binaries, with proper cmd.exe metacharacter escaping
@@ -346,39 +581,43 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
346
581
  - New `localBin` and `toolCwd` options for `runTool`/`runToolFix`/`runToolWithAutoFix` enabling direct binary execution and correct plugin resolution in monorepos
347
582
 
348
583
  ### 🔧 Changed
584
+
349
585
  - Replaced `execSync` with `execFileSync` in tool-runner — args passed directly to process, preventing shell interpretation of regex metacharacters (e.g., `|` in Spotless patterns) and file path injection
350
586
  - Tool detection now requires project-level configuration when `detectInProjectFile` is defined — PATH-only presence no longer sufficient, preventing false positives (e.g., mvn in PATH treated as Spotless available)
351
587
  - Project file scanning starts from repo root instead of cwd, fixing detection when git hooks run from subdirectories
352
588
  - Increased judge timeout from 120s to 180s
353
589
 
354
590
  ### 🐛 Fixed
591
+
355
592
  - Fixed tool auto-fix being attempted after execution failures (ENOENT, EACCES) by tracking `executionFailed` flag and skipping fix step
356
593
  - Fixed ENOENT handling in `runToolFix` — missing command binary now returns gracefully instead of being misinterpreted as a partial fix
357
594
  - Fixed `git add` in restage step to use `execFileSync` with proper argument array instead of shell string interpolation
358
595
 
359
596
  ### 🔒 Security
597
+
360
598
  - Eliminated shell injection risk in tool execution by switching from `execSync` (shell-based) to `execFileSync` (direct process spawn)
361
599
  - Added `_escapeCmdMeta()` and `_prepareExec()` for safe cmd.exe argument passing when executing .cmd/.bat files on Windows/WSL
362
600
 
363
-
364
601
  ## [2.35.0] - 2026-03-27
365
602
 
366
603
  ### ✨ Added
604
+
367
605
  - Prettier formatting support — auto-formats JS/TS/CSS/HTML/JSON/YAML/MD files before linting (format first, then lint)
368
606
  - Remote formatter configuration — preset-to-tools mapping fetched from centralized git-hooks-config repo, allowing team-wide control without releasing new versions
369
607
  - New `parsePrettierOutput()` function for parsing Prettier --check output into structured issues
370
608
 
371
609
  ### 🔧 Changed
610
+
372
611
  - Linting pipeline now runs formatters (Prettier) before linters (ESLint) for consistent code style
373
612
  - Updated preset-to-tools mapping: frontend, fullstack, ai, and default presets now include Prettier
374
613
  - `getLinterToolsForPreset()` now fetches remote config with local fallback instead of using hardcoded mapping only
375
614
  - `runLinters()` and `checkLinterAvailability()` converted to async functions to support remote config fetching
376
615
  - Unfixable linting issues are now forwarded to the Claude judge for semantic resolution instead of blocking directly
377
616
 
378
-
379
617
  ## [2.34.0] - 2026-03-27
380
618
 
381
619
  ### ✨ Added
620
+
382
621
  - Pre-commit linting with ESLint, Spotless, and sqlfluff - runs before Claude analysis with auto-fix and re-stage
383
622
  - `lint` command - run linters on staged files, directories, or specific files (`claude-hooks lint [paths...]`)
384
623
  - Linter availability check during installation - verifies linter presence per preset and shows install instructions
@@ -387,30 +626,33 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
387
626
  - Maven availability check during installation with install instructions for backend/fullstack presets
388
627
 
389
628
  ### 🔧 Changed
629
+
390
630
  - Pre-commit flow now runs linting before Claude analysis - fast, deterministic checks first
391
631
  - Unfixable lint issues are forwarded to the judge for semantic resolution
392
632
  - Updated documentation to reflect new linting workflow and command usage
393
633
 
394
634
  ### 🐛 Fixed
395
- - WSL Claude CLI detection in non-default distros (#120, #121)
396
635
 
636
+ - WSL Claude CLI detection in non-default distros (#120, #121)
397
637
 
398
638
  ## [2.33.1] - 2026-03-26
399
639
 
400
640
  ### 🔧 Changed
641
+
401
642
  - Improved WSL Claude CLI detection to resolve Claude's path via login shell when installed via nvm or user-scoped npm prefix
402
643
  - Added support for detecting Claude CLI in non-default WSL distros when the default distro is docker-desktop or similar
403
644
  - Switched to execFileSync for WSL distro listing to avoid cmd.exe quote mangling issues
404
645
  - Updated README-NPM with release workflow commands documentation and WSL troubleshooting guide
405
646
 
406
647
  ### 🐛 Fixed
648
+
407
649
  - Fixed Claude CLI not being detected on Windows when running from Git Bash with Claude installed inside WSL via nvm (#120)
408
650
  - Fixed WSL distro detection failing due to UTF-16LE encoding from wsl.exe output
409
651
 
410
-
411
652
  ## [2.33.0] - 2026-03-20
412
653
 
413
654
  ### ✨ Added
655
+
414
656
  - Always-on metrics system for code quality observability (#41) - collects structured JSONL events locally with 90-day retention for trend analysis
415
657
  - Team-based reviewer selection via GitHub Teams API (#115, #36) - automatically resolves team members and excludes PR author when selecting reviewers
416
658
  - New metrics module (`lib/utils/metrics.js`) with fire-and-forget event recording that never blocks callers
@@ -418,19 +660,21 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
418
660
  - Documented proven implementation patterns in CLAUDE.md covering testability, git operations, and architecture best practices
419
661
 
420
662
  ### 🔧 Changed
663
+
421
664
  - Telemetry system now always enabled - removed opt-out toggle for consistent observability
422
665
  - Existing telemetry events dual-write to unified metrics system for consolidated analysis
423
666
  - PR statistics module now records to both legacy JSONL and new metrics system
424
667
  - Judge module switched from telemetry to metrics recording with richer event data including false positives and unresolved issues
425
668
 
426
669
  ### 🗑️ Removed
670
+
427
671
  - Removed `system.telemetry` configuration option - metrics are now always collected locally
428
672
  - Removed telemetry disabled warnings from `batch-info` and `telemetry-cmd` commands
429
673
 
430
-
431
674
  ## [2.32.0] - 2026-03-19
432
675
 
433
676
  ### ✨ Added
677
+
434
678
  - Team-based reviewer selection using GitHub Teams API for Pull Requests (#36)
435
679
  - New `reviewer-selector.js` module for intelligent team member resolution with PR author exclusion
436
680
  - Support for `teamSlug` configuration in `config.github.pr` (defaults to 'automation')
@@ -438,6 +682,7 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
438
682
  - New GitHub API methods: `listRepoTeams()` and `listTeamMembers()` for team resolution
439
683
 
440
684
  ### 🔧 Changed
685
+
441
686
  - PR reviewer selection now prioritizes GitHub Teams API over CODEOWNERS file
442
687
  - Updated `createPullRequest()` to accept `teamReviewers` parameter for team-based review requests
443
688
  - Refactored `github-client.js` to focus on config-based fallback reviewers only
@@ -445,18 +690,18 @@ y este proyecto adhiere a [Semantic Versioning](https://semver.org/spec/v2.0.0.h
445
690
  - Updated documentation to reflect team-based reviewer workflow in CLAUDE.md and README files
446
691
 
447
692
  ### 🗑️ Removed
693
+
448
694
  - CODEOWNERS file parsing and resolution logic from reviewer selection workflow
449
695
  - Methods `readCodeowners()` and `parseCodeownersReviewers()` from `github-client.js`
450
696
 
451
-
452
697
  ## [2.31.1] - 2026-03-19
453
698
 
454
699
  ### 🔧 Changed
700
+
455
701
  - Migrated authorization config repository from `claude-hooks-config` to `git-hooks-config` as the definitive source for permissions and labels
456
702
  - Centralized existing permissions and labels configuration in the definitive repository
457
703
  - Updated documentation in CLAUDE.md to reference the new `git-hooks-config` repository and document team-wide remote config pattern
458
704
 
459
-
460
705
  ## [2.31.0] - 2026-03-19
461
706
 
462
707
  ### ✨ Added