feat(audit): htmx-residue rule (W13-C)#131
Merged
Merged
Conversation
Eighth post-migration cleanup rule. Detect-only — flags any leftover
`hx-*` attribute in `src/**/*.{ts,tsx}` (excluding test files), one
warning per file with a category breakdown reusing the W13-A
analyzer's classifier (event-handler / form-swap / click-swap /
auto-fetch / oob-swap / boost / unmatched).
`--strict` exits 2 on any finding — wires into CI as the
"rewrite-complete" gate for migrated sites. The fix string points
at `references/htmx-rewrite.md` (W13-B). No `applyFix` — htmx
rewrites are non-mechanical (state machine vs. sub-route vs.
mutation choices vary per call site).
- 7 new tests cover aggregation, severity, test-file exclusion,
scope (`src/` only), zero-finding gate, line-number reporting,
and `supportsAutoFix: false`. 60/60 in the post-cleanup suite,
310/310 across deco-start.
- Smoke-tested on casaevideo-storefront (0 findings, expected) and
a synthetic fixture (2 findings, correct categorisation,
`--strict` exits 2).
- Skill doc § 7 added; CLI help text updated.
- Closes Wave 13 in the migration tooling plan.
Co-authored-by: Cursor <cursoragent@cursor.com>
|
🎉 This PR is included in version 2.21.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Summary
Closes the W13-C item in the migration tooling plan: an eighth
post-migration cleanup rule that flags any leftover
hx-*attribute in a migrated site's
src/.The rule reuses the W13-A analyzer's classifier (
analyzeFilefromscripts/migrate/analyzers/htmx-analyze.ts) so categorisationstays consistent with the standalone
deco-htmx-analyzeCLI. Eachfinding is a per-file warning with a category breakdown — e.g.
--strictexits 2 on any finding; this is the "rewrite-complete"CI gate for any site that came off Fresh+HTMX. Detect-only —
htmx rewrites are non-mechanical (state machine vs. sub-route vs.
mutation choices vary per call site), so adding
applyFixwouldbe misleading; the W13-B
references/htmx-rewrite.mdskill is theplaybook.
Why detect-only?
D2 forbids any htmx runtime in
@decocms/start. This rule is theenforcement side of D2: the framework gives a migrated site no
htmx runtime to import; the audit catches every leftover
hx-*in code review. Together: a migrated site cannot accidentally
rely on htmx without it being visible.
Tests + smoke
npx vitest run scripts/migrate/post-cleanup/runner.test.ts—60/60 pass, 7 new test cases for the rule covering
aggregation, severity, test-file exclusion (
*.test.tsx,*.spec.ts,__tests__/), scope (src/only — files in/scripts/,/docs/ignored), zero-finding gate (clean tree),first-occurrence line-number reporting, and
supportsAutoFix: false.npx vitest run— full deco-start suite 310/310 pass.npm run typecheck— clean.casaevideo-storefront(no htmx) — 0 findings,rule registered at position [8].
categorisation,
--strictexits 2.Scope
ruleHtmxResidueinscripts/migrate/post-cleanup/rules.ts.ALL_RULESand_internals.rulesfor direct testaccess.
post-migration-cleanup.md) added.scripts/migrate-post-cleanup.tsupdated tolist
obsolete-vite-plugins(was already auto-fix in 2.19) andcall out
htmx-residueas detect-only.MIGRATION_TOOLING_PLAN.mdmarks Wave 13 complete (Wave 13-A,-B, -C all shipped) and adds a Wave 13 discoveries section.
Test plan
npx vitest run— 310/310 passnpm run typecheck— cleannpx tsx scripts/migrate-post-cleanup.tsagainstcasaevideo-storefront — 0 findings (expected)
categorised,
--strict→ exit 2Made with Cursor
Summary by cubic
Adds a detect-only
htmx-residueaudit rule that flags leftoverhx-*attributes undersrc/with a per-file category breakdown. Reuses the Wave 13 analyzer and makes--stricta "rewrite-complete" CI gate; docs and CLI help updated (completes Wave 13 / W13-C).New Features
src/**/*.{ts,tsx}forhx-*; excludes*.test.tsx,*.spec.ts, and__tests__/, and ignores files outsidesrc/.--strictexits 2. Fix hint points to.agents/skills/deco-to-tanstack-migration/references/htmx-rewrite.md. No auto-fix.Migration
scripts/migrate-post-cleanup.ts --strictin CI to block regressions.deco-htmx-analyzefor detailed per-category inventories when triaging larger codebases.Written for commit 208eb25. Summary will update on new commits.