Skip to content

feat(cache): add cache management API#16

Merged
justinmerrell merged 4 commits into
mainfrom
feat/cache-management-api
Mar 29, 2026
Merged

feat(cache): add cache management API#16
justinmerrell merged 4 commits into
mainfrom
feat/cache-management-api

Conversation

@justinmerrell

@justinmerrell justinmerrell commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add five new methods to client.cache for granular cache management: list, has, remove, stats, and invalidate
  • Export new CacheEntry, CacheStats, and CacheManager types
  • Refactor BundleCache internals to extract readMeta helper and reduce cognitive complexity
  • Fix biome formatting in package.json (pre-existing CI failure)
  • Optimize validate.yaml workflow: skip devcontainer build (~7min) when only source code changes, using dorny/paths-filter@v3

New Cache Methods

Method Returns Purpose
list() CacheEntry[] List all cached bundles with metadata (freshness, size, TTL)
has(ns, slug, version?) { cached, fresh } Check if a bundle is cached and whether it's still fresh
remove(ns, slug, version?) number Selectively delete cached versions; returns count removed
stats() CacheStats Aggregate stats: entry/blob counts, sizes, fresh vs stale
invalidate(ns, slug, version?) number Mark stale (forces re-fetch) without deleting cached data

Test plan

  • list returns entries with correct metadata, scoped to current host
  • has detects cached/fresh/missing/stale states
  • remove deletes selectively by version or all versions (including refs)
  • stats counts entries, blobs, refs across all hosts
  • invalidate forces stale without removing data, invalidates refs
  • All 146 tests pass, lint/format/types clean
  • Validate CI workflow: devcontainer jobs should be skipped when no .devcontainer/ changes

🤖 Generated with Claude Code

justinmerrell and others added 2 commits March 29, 2026 21:36
…validation

Expose list, has, remove, stats, and invalidate methods on client.cache
so users can inspect cached bundles, selectively remove entries, check
freshness, compute disk usage, and force re-fetches without purging
the entire cache.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@justinmerrell justinmerrell force-pushed the feat/cache-management-api branch from 961b3bc to bba048b Compare March 29, 2026 21:43
@justinmerrell justinmerrell reopened this Mar 29, 2026
@justinmerrell justinmerrell force-pushed the feat/cache-management-api branch 2 times, most recently from 58ddfe2 to bba048b Compare March 29, 2026 22:01
justinmerrell and others added 2 commits March 29, 2026 22:11
Use dorny/paths-filter to detect changes in .devcontainer/ and the
workflow file itself. ShellCheck, Compose Config, and Devcontainer
Build jobs now only run when those paths are modified, saving ~7
minutes on commits that only touch source code.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@justinmerrell justinmerrell merged commit c797f30 into main Mar 29, 2026
6 checks passed
@justinmerrell justinmerrell deleted the feat/cache-management-api branch March 29, 2026 22:33
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