Skip to content

refactor(hooks): one format-on-edit dispatcher in code-tools; releases for all four plugins - #20

Merged
chrispezza merged 5 commits into
mainfrom
refactor/format-hook-dispatcher
Sep 23, 2026
Merged

chrispezza merged 5 commits into
mainfrom
refactor/format-hook-dispatcher

Conversation

@chrispezza

Copy link
Copy Markdown
Contributor

What

The three identical-shaped format-file.sh hooks (astro-tools, go-tools, rust-tools) each registered PostToolUse on Edit|Write, so every edit in every repo spawned three processes, most of them silent no-ops (~4.8k edits in the audited window). They are collapsed into a single dispatcher in clownware-code-tools, routed by extension:

Extension Formatter
ts/tsx/js/jsx/mjs/cjs/json/jsonc/css/astro Biome, still gated on a biome.json at or above the file
go goimports, else gofmt
templ templ fmt
rs rustfmt, edition from the nearest Cargo.toml (default 2021)

Per-route logic is copied unchanged from the three originals.

Commits (one release = one plugin = one commit)

  • refactor(code-tools): the dispatcher + removal of the three hooks
  • feat(astro-tools) v0.6.0, feat(go-tools) v0.4.0, feat(rust-tools) v0.2.0: hook removed; descriptions, marketplace entry and README synced
  • feat(code-tools) v0.16.0: dispatcher registered; descriptions, marketplace entry and README synced

Merge with rebase, not squash, so the per-plugin release commits survive (this repo's history is linear).

Tradeoff

The stack plugins no longer format on their own; clownware-code-tools must be installed alongside them. The README says so under each plugin.

Verification

  • python3 scripts/validate_plugins.py: 5 in-repo plugins valid
  • python3 -m unittest discover -s scripts -p 'test_*.py': 8 tests OK
  • Behavioural fixtures: .go reformatted by goimports; .rs by rustfmt (edition 2021 from Cargo.toml); .ts under astro-performance-starter reformatted by Biome; .ts with no biome.json untouched; .md, empty payload and garbage payload exit 0 silently
  • shellcheck is not installed locally; CI runs it

Installers pick this up on the next marketplace refresh / /plugin update.

🤖 Generated with Claude Code

chrispezza and others added 5 commits September 19, 2026 02:03
…e dispatcher

astro-tools, go-tools and rust-tools each registered a PostToolUse Edit|Write
hook, so every edit in every repo spawned three processes, two or three of
which were silent no-ops. code-tools now ships a single format-file.sh that
routes by extension to Biome (still gated on a biome.json), goimports/gofmt,
templ fmt or rustfmt (edition-detected). Per-route behaviour is unchanged.

The stack plugins no longer format on their own; code-tools must be installed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…de-tools dispatcher; v0.6.0

- hooks/format-file.sh and hooks/hooks.json removed; the Biome route now lives in
  clownware-code-tools' single format-file.sh dispatcher
- description, marketplace entry and README synced

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… the code-tools dispatcher; v0.4.0

- hooks/format-file.sh and hooks/hooks.json removed; the .go and .templ routes now
  live in clownware-code-tools' single format-file.sh dispatcher
- description, marketplace entry and README synced

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ode-tools dispatcher; v0.2.0

- hooks/format-file.sh and hooks/hooks.json removed; the .rs route (edition-detected)
  now lives in clownware-code-tools' single format-file.sh dispatcher
- description, marketplace entry and README synced

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ck; v0.16.0

- hooks/format-file.sh added and registered as PostToolUse Edit|Write; replaces the
  three per-stack format hooks (three processes per edit down to one)
- description, marketplace entry and README synced

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chrispezza
chrispezza merged commit ca895d1 into main Sep 23, 2026
2 checks passed
@chrispezza
chrispezza deleted the refactor/format-hook-dispatcher branch September 23, 2026 14:53
@chrispezza chrispezza mentioned this pull request Sep 23, 2026
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.

1 participant