|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Guidelines |
| 6 | + |
| 7 | +- Do not commit changes automatically. Wait for explicit user request to commit. |
| 8 | + |
| 9 | +## Project Overview |
| 10 | + |
| 11 | +GitHub Action to set up [Vite+](https://github.com/voidzero-dev/vite-plus) (`@voidzero-dev/global`) with dependency caching support. This action installs Vite+ globally and optionally caches project dependencies based on lock file detection. |
| 12 | + |
| 13 | +## Commands |
| 14 | + |
| 15 | +```bash |
| 16 | +# Build (required before committing - outputs to dist/) |
| 17 | +vite run build |
| 18 | + |
| 19 | +# Type check |
| 20 | +vite run typecheck |
| 21 | + |
| 22 | +# Run tests |
| 23 | +vite run test |
| 24 | + |
| 25 | +# Run tests in watch mode |
| 26 | +vite run test:watch |
| 27 | + |
| 28 | +# Lint |
| 29 | +vite run lint |
| 30 | +vite run lint:fix |
| 31 | + |
| 32 | +# Format |
| 33 | +vite run fmt |
| 34 | +vite run fmt:check |
| 35 | +``` |
| 36 | + |
| 37 | +**Important:** Always run `vite run build` after code changes - the `dist/index.mjs` must be committed. |
| 38 | + |
| 39 | +## Architecture |
| 40 | + |
| 41 | +This is a GitHub Action with main and post execution phases (defined in `action.yml`): |
| 42 | + |
| 43 | +- **Main phase** (`src/index.ts` → `runMain`): |
| 44 | + 1. Install `@voidzero-dev/global` globally via npm |
| 45 | + 2. Restore dependency cache if enabled |
| 46 | + 3. Run `vite install` if requested |
| 47 | + |
| 48 | +- **Post phase** (`src/index.ts` → `runPost`): |
| 49 | + 1. Save dependency cache if enabled |
| 50 | + |
| 51 | +### Key Modules |
| 52 | + |
| 53 | +- `src/inputs.ts` - Parse and validate action inputs using Zod schemas |
| 54 | +- `src/install-viteplus.ts` - Install vite-plus globally, handles GitHub Package Registry auth |
| 55 | +- `src/cache-restore.ts` / `src/cache-save.ts` - Dependency caching via `@actions/cache` |
| 56 | +- `src/run-install.ts` - Execute `vite install` with optional cwd/args |
| 57 | +- `src/types.ts` - Shared types, enums, and Zod schemas |
| 58 | +- `src/utils.ts` - Lock file detection, package manager cache path resolution |
| 59 | + |
| 60 | +### Lock File Detection |
| 61 | + |
| 62 | +Auto-detects package manager from lock files: `pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `bun.lockb` |
| 63 | + |
| 64 | +## Testing |
| 65 | + |
| 66 | +Tests are colocated with source files (e.g., `src/inputs.test.ts`). Run with `npm run test`. |
0 commit comments