Skip to content

auto-formatter multiple improvements#18

Merged
orioltf merged 22 commits intomainfrom
develop
May 4, 2026
Merged

auto-formatter multiple improvements#18
orioltf merged 22 commits intomainfrom
develop

Conversation

@orioltf
Copy link
Copy Markdown
Member

@orioltf orioltf commented May 4, 2026

No description provided.

orioltf and others added 16 commits May 4, 2026 00:44
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>
…released]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FormatterDescriptor typedef and a shared runFormatter() runner helper with unit tests.
  • Extract DEFAULTS and loadConfig() into scripts/lib/config.mjs with unit tests.
  • Wire format-hook.mjs to 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.

Comment thread apps/claude-code/auto-format/scripts/lib/runners.mjs Outdated
Comment thread apps/claude-code/auto-format/CHANGELOG.md
orioltf and others added 6 commits May 4, 2026 10:26
…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>
@orioltf orioltf merged commit ed17dbd into main May 4, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants