Skip to content

feat: add SHA-256 cache layer and preprocessCss for audit command#20

Merged
nujovich merged 7 commits into
nujovich:mainfrom
FredericJaquet:feat/cache-layer
May 20, 2026
Merged

feat: add SHA-256 cache layer and preprocessCss for audit command#20
nujovich merged 7 commits into
nujovich:mainfrom
FredericJaquet:feat/cache-layer

Conversation

@FredericJaquet
Copy link
Copy Markdown

Summary

  • Adds a SHA-256 cache layer for the audit command to avoid redundant Claude API calls on unchanged CSS
  • Adds preprocessCss utility and applies it to buildAuditPrompt for cleaner prompt input
  • Syncs package-lock.json with existing package.json changes (rename to mint-ds, deps moved to devDependencies)

Test plan

  • Run mint-ds audit on a CSS file — verify result is cached on second run
  • Modify the CSS file — verify cache is invalidated and a fresh audit runs
  • Confirm preprocessCss output is applied correctly in the audit prompt
  • npm install produces no lockfile changes

Frederic Jaquet added 2 commits May 4, 2026 20:00
- SHA-256 hash of preprocessed CSS is the cache key in mint-ds.cache.json
- Cache hit skips both Claude API calls and writes tokens directly
- --no-cache flag bypasses lookup and overwrites the cache entry
- `mint cache --clear` deletes the cache file; bare `mint cache` lists entries
- mint-ds.cache.json added to .gitignore
Regenerated lockfile reflects existing package.json changes: project
renamed to mint-ds, next/react moved to devDependencies.
@nujovich
Copy link
Copy Markdown
Owner

nujovich commented May 7, 2026

@FredericJaquet great contribution! Could you please add to the readme file the new commands we talked about while discussing the approach on #20 ?

  • mint audit --no-cache — skips the cache for that specific run, but keeps the existing cache intact for other files. Useful for a one-off forced re-audit.
  • mint cache --clear — wipes the cache entirely. More appropriate after a Mint update that changes how tokens are evaluated, as you mentioned.

@nujovich nujovich self-requested a review May 7, 2026 14:22
Copy link
Copy Markdown
Owner

@nujovich nujovich left a comment

Choose a reason for hiding this comment

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

Could you please add to the readme file the new commands we talked about while discussing the approach on #20 ?

mint audit --no-cache — skips the cache for that specific run, but keeps the existing cache intact for other files. Useful for a one-off forced re-audit.
mint cache --clear — wipes the cache entirely. More appropriate after a Mint update that changes how tokens are evaluated, as you mentioned.

nujovich and others added 5 commits May 21, 2026 01:01
Pulls preprocessCss, hashContent, readAuditCache, writeAuditCache,
readResolveCache, writeResolveCache, and clearPlaygroundCache out of
app/page.tsx into a dedicated, testable module. Falls back to
node:crypto.webcrypto when the browser global is unavailable so the
module works in both the browser and the Vitest node environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e imports

Removes preprocessCssClient and hashContent helpers and replaces all
inline localStorage reads/writes in handleAudit, handleResolve, and
clearHistory with calls to the new lib/playground-cache module.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18 tests covering preprocessCss, hashContent, readAuditCache,
writeAuditCache, readResolveCache, writeResolveCache, and
clearPlaygroundCache using a simple in-memory localStorage mock via
vi.stubGlobal (no jsdom required).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nujovich nujovich merged commit f348f59 into nujovich:main May 20, 2026
1 check 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