This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
See also: ARCHITECTURE.md for project structure and data flow, CONTRIBUTING.md for development workflow and conventions.
Netlify Cache Inspector is a Nuxt 5 web app for inspecting and comparing HTTP cache headers on Netlify sites. Users submit a URL, the server fetches it with Netlify debug headers (x-nf-debug-logging: 1), and the frontend displays structured cache analysis. Multiple runs can be compared side-by-side with hover-based diffing.
| Command | Purpose |
|---|---|
pnpm run dev |
Dev server on http://localhost:3000 |
pnpm run build |
Production build |
pnpm run test |
Full suite: typecheck + lint + format + unit tests |
pnpm run test:unit |
Unit tests only (vitest) |
pnpm run typecheck |
TypeScript type checking |
pnpm run lint |
Oxlint check |
pnpm run lint:fix |
Oxlint auto-fix |
pnpm run format |
Format with oxfmt |
pnpm run format:check |
Check formatting |
pnpm run knip |
Check for unused exports/dependencies |
Run a single test file: pnpm vitest run app/utils/getCacheAnalysis.test.ts
Always run pnpm run test before submitting code.
Package manager is pnpm (pinned in packageManager field). Enable via corepack enable. Never use npm or yarn.
Nuxt 5 with future: { compatibilityVersion: 5 } — frontend code lives under app/ (not project root).
RequestForm.vueemits URL →useRunManager.tscomposable callsPOST /api/inspect-url- Server (
server/api/inspect-url.post.ts) fetches the URL with debug headers, validates it's a Netlify site (checksX-NF-Request-Id), saves to Netlify Blobs (server/db.ts), returnsApiRun useRunManagerfilters headers viagetCacheHeaders(), producing aRunwith only cache-relevant headersRunDisplay.vue→RunPanel.vue→CacheAnalysis.vuerenders structured analysisCacheAnalysis.vuecallsgetCacheAnalysis()which orchestrates:parseCacheStatus(),getServedBy(),parseCacheControl(),getTimeToLive()
ApiRun(from server):{ runId, url, status, headers, durationInMs }Run(frontend):{ runId, url, status, cacheHeaders, durationInMs }— headers filtered to cache-relevant subset
useDataHover.ts uses module-level shared state (not per-instance). When multiple runs exist, hovering a field highlights matching/differing values across panels.
Runs are persisted in Netlify Blobs. /run/[runId] page loads a run via GET /api/runs/:runId.
UnoCSS with utility classes and shortcuts defined in uno.config.ts. Dark mode uses class-based toggling (:is(.dark) selectors in scoped CSS, UnoCSS dark: prefix for utilities). The useColorMode.ts composable manages light/dark/system mode with localStorage persistence and a FOUC-prevention inline script in nuxt.config.ts.
~server resolves to ./server/ for server-side imports.
- Vitest with happy-dom environment (specified via
@vitest-environment happy-domdocblock in test files) - Vue Test Utils (
mount()) for component tests - Tests are co-located:
ComponentName.test.tsnext toComponentName.vue - Nuxt auto-imports don't work in tests — explicitly import Vue/Nuxt APIs and mock project utils
NuxtLinkis stubbed in component tests;$fetchis mocked onglobal
- Vue Composition API with
<script setup lang="ts"> - Oxlint for linting (
oxlint.config.ts), oxfmt for formatting (.oxfmtrc.json) - Conventional Commits required for all commits and PR titles (
feat:,fix:,chore:, etc.) - No
anywithout justification