Conversation
Pre-bump commit so pnpm bump can run on a clean tree.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…NGELOG.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…stants in format-hook.mjs
…tants in format-hook.mjs (v0.5.11)
…released] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tion refactor (v0.5.14)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the auto-format Claude Code hook by extracting configuration parsing and formatter execution into dedicated helper modules, adding unit tests, and bumping the plugin/package version.
Changes:
- Add a
FormatterDescriptortypedef and a sharedrunFormatter()runner helper with unit tests. - Extract
DEFAULTSandloadConfig()intoscripts/lib/config.mjswith unit tests. - Wire
format-hook.mjsto the extracted modules and bump version metadata / changelog entries.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/claude-code/auto-format/scripts/lib/types.mjs | Adds FormatterDescriptor JSDoc typedef used by the hook and runner. |
| apps/claude-code/auto-format/scripts/lib/runners.mjs | New shared subprocess runner (runFormatter). |
| apps/claude-code/auto-format/scripts/lib/runners.test.mjs | New unit tests for runner behavior (missing bin, timeout, tolerated exit codes, args pass-through). |
| apps/claude-code/auto-format/scripts/lib/config.mjs | New config loader module with defaults and merge/clamp behavior. |
| apps/claude-code/auto-format/scripts/lib/config.test.mjs | New unit tests for config merge strategy and validation/clamping. |
| apps/claude-code/auto-format/scripts/format-hook.mjs | Refactors hook to use loadConfig() + runFormatter() and formatter descriptors. |
| apps/claude-code/auto-format/package.json | Bumps version and expands pnpm test to include new unit test files. |
| apps/claude-code/auto-format/CHANGELOG.md | Adds changelog entries for multiple versions up through 0.5.14. |
| apps/claude-code/auto-format/.claude-plugin/plugin.json | Bumps plugin version to 0.5.14. |
| apps/claude-code/auto-format/.claude-plugin/marketplace.json | Bumps marketplace version to 0.5.14. |
| apps/claude-code/auto-format/docs/plans/25-formatter-descriptor-type.md | Marks plan item as done. |
| apps/claude-code/auto-format/docs/plans/26-runner-module.md | Marks plan item as done. |
| apps/claude-code/auto-format/docs/plans/27-replace-runner-functions.md | Marks plan item as done. |
| apps/claude-code/auto-format/docs/plans/28-version-bump.md | Marks plan item as done. |
| apps/claude-code/auto-format/docs/plans/29-config-module.md | Marks plan item as done. |
| apps/claude-code/auto-format/docs/plans/30-wire-up-config-module.md | Marks plan item as done. |
| apps/claude-code/auto-format/docs/plans/31-version-bump.md | Marks plan item as done. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…in runFormatter Replace the broad `r.signal === 'SIGTERM' || r.status === null` guard with precise branches: ETIMEDOUT for actual timeouts, r.signal for signal-kill, and r.error for spawn failures. Wrap descriptor.args() in try/catch to uphold the never-throws contract documented in the JSDoc. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
….5.11 entry The 0.5.11 changelog entry only described the refactor but omitted that Prettier failure messages now include the exit code, aligning them with the ESLint and Biome format. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dling (v0.5.15) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The bump script writes [Unreleased] without blank lines after ### headings; Prettier requires them. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
….code and status null Cast r.error to NodeJS.ErrnoException for .code access; guard r.status for null before passing to Array.includes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tch block Replace JSDoc-cast `.message` access with `err instanceof Error ? err.message : String(err)` to match the pattern used in runners.mjs and avoid logging 'undefined' for non-Error throws. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.