feat: detect duplicate transition/animation declarations in CSS audit#70
Conversation
Add motion audit step that scans transition and animation declarations, normalizes durations to ms and easings to canonical keywords, clusters near-duplicates, and proposes semantic token scales for durations and easings. - Add MotionAudit, MotionDurationSample, MotionEasingSample types to lib/types.ts - Extend AuditReport with motion field - Extend UserDecisions with motion.durations/easings - Extend TypographyTokens with motion.durations/easings - Add STEP 5 (MOTION) to buildAuditPrompt with duration normalization, easing canonical mapping, duplicate counting, and suggested scales - Add +1 to chaos score if motion.duplicateDeclarations > 5 - Renumber steps: CHAOS SCORE→6, SUMMARY→7, BRAND→8 - Update buildResolvePrompt with motion token rules - Update defaultDecisions in CLI to pass motion from audit - Add Motion section to AuditView with duration/easing chips, suggested scale grids, and duplicate warning callout - Add realistic motion CSS to frankenstein example - Add tests for MOTION step, chaos score, and resolve prompt Closes nujovich#28
There was a problem hiding this comment.
Automated review (harness)
Thanks for this PR — adding motion detection is a great extension to the audit pipeline. The implementation is clean and the test coverage is thorough.
Before merge, please address:
-
Export-format parity:
motionwas added toDSTokensbut no export generators were updated. Please verify that all 11 export targets produce clean output whenmotiontokens are present, and add at least one test that exercises an export target with motion data. -
Optional
motionin types:AuditReport.motionis non-optional, but all call sites guard with?.. Consider making itmotion?: MotionAuditin the type to match runtime reality, or drop the optional chaining and initialize it to an empty default everywhere.
Minor: the frankenstein example CSS has Spanish comments (consistent with the file's existing voice, so not blocking). The README table and pipeline diagram should be updated to mention the new motion dimension.
See the full review draft for line-level findings.
…update - Make AuditReport.motion optional (motion?: MotionAudit) to match runtime usage with optional chaining at all call sites - Add motion token instructions to all 13 export prompt templates so LLM-generated exports include transition/easing tokens - Add test verifying export prompt includes motion data when present - Update README: audit step mentions motion detection, add Motion row to the 'What Mint sees' table
Summary
Add a motion audit step that scans
transitionandanimationdeclarations in CSS, normalizes durations to milliseconds and easings to canonical keywords, clusters near-duplicates, and proposes semantic token scales for durations and easings.Closes #28
Changes (7 files, +428 lines)
Types —
lib/types.tsMotionDurationSampleinterface (value,normalizedMs,usageCount,contexts)MotionEasingSampleinterface (value,normalizedKeyword,usageCount,contexts)MotionAuditinterface (durations: { found, suggestedScale },easings: { found, suggestedScale },duplicateDeclarations)AuditReportwithmotion: MotionAuditUserDecisionswithmotion: { durations, easings }TypographyTokenswithmotion: { durations, easings }Audit prompt —
lib/prompts.mjstransition,transition-duration,transition-timing-function,animation-duration,animation-timing-function0.2s→200ms)cubic-bezier(0.4,0,0.2,1)→ease-in-out-standard)duplicateDeclarations(functionally identical motion declarations)instant/fast/base/slow/slower/crawlstandard/emphasized/decelerate/accelerate/linear+1to chaos score ifmotion.duplicateDeclarations > 5motionfieldResolve prompt —
lib/prompts.mjsdecisions.motion.durationsanddecisions.motion.easingswith CSS validation and fallback extractionmotionfieldCLI —
bin/mint-ds.mjsdefaultDecisions()now passesmotion: { durations, easings }from auditUI —
components/AuditView.tsxduplicateDeclarations > 0handleResolvenow passesmotionin decisionsExample —
examples/frankenstein/styles.cssTests
prompts.test.mjs: Updated step count (7→8), added"motion"to JSON fields test, addedduplicateDeclarationsto chaos score test, new MOTION step test, new resolve prompt motion testplayground-cache.test.ts: UpdatedAUDIT,TOKENS,DECISIONSfixtures withmotionfieldTesting
All 98 tests pass. Typecheck and lint clean.
DeepSeek V4 Flash integration test (temporary, reverted)
Ran the full pipeline against DeepSeek V4 Flash with the frankenstein example (including the new motion CSS):
All DeepSeek provider changes were reverted after testing — nothing committed.
Checklist
npx tsc --noEmitpasses with no errorsnpm run lintpassesnpm testpasses (98/98)