feat: add SHA-256 cache layer and preprocessCss for audit command#20
Merged
Conversation
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.
Owner
|
@FredericJaquet great contribution! Could you please add to the readme file the new commands we talked about while discussing the approach on #20 ?
|
nujovich
requested changes
May 11, 2026
Owner
nujovich
left a comment
There was a problem hiding this comment.
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.
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
approved these changes
May 20, 2026
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
auditcommand to avoid redundant Claude API calls on unchanged CSSpreprocessCssutility and applies it tobuildAuditPromptfor cleaner prompt inputpackage-lock.jsonwith existingpackage.jsonchanges (rename tomint-ds, deps moved todevDependencies)Test plan
mint-ds auditon a CSS file — verify result is cached on second runpreprocessCssoutput is applied correctly in the audit promptnpm installproduces no lockfile changes