|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## What This Is |
| 6 | + |
| 7 | +Versioner GitHub Action - a TypeScript GitHub Action that sends build and deployment events to the Versioner API. Node.js 20, @actions/core, Axios. |
| 8 | + |
| 9 | +## Cross-Repo Context |
| 10 | + |
| 11 | +This repo is part of the Versioner ecosystem. Before starting work: |
| 12 | +- Read `/Users/phil.austin/projects/versioner-repos/versioner-dev-docs/status.md` for current status |
| 13 | +- Read relevant feature docs from `/Users/phil.austin/projects/versioner-repos/versioner-dev-docs/features/` |
| 14 | +- Update `status.md` as you complete tasks |
| 15 | + |
| 16 | +## Build & Test Commands |
| 17 | + |
| 18 | +All commands use `just` (run `just` to list all): |
| 19 | + |
| 20 | +```bash |
| 21 | +just setup_local_dev # npm install |
| 22 | +just build # ncc build to dist/index.js (self-contained bundle) |
| 23 | +just run_tests # Jest (80% coverage threshold) |
| 24 | +just test_coverage # Jest with coverage report |
| 25 | +just lint # ESLint (strict: explicit return types, no any) |
| 26 | +just format # Prettier |
| 27 | +just ci # format -> lint -> build -> test |
| 28 | +``` |
| 29 | + |
| 30 | +The `dist/` directory is committed (GitHub Actions requires it). |
| 31 | + |
| 32 | +## Architecture |
| 33 | + |
| 34 | +- `src/index.ts` - Entry point; routes to build or deployment event handling based on `event_type` input |
| 35 | +- `src/inputs.ts` - Input validation and parsing (from GitHub Actions inputs or env vars) |
| 36 | +- `src/api-client.ts` - HTTP client for Versioner API with error handling for preflight rejections (409, 423, 428) |
| 37 | +- `src/github-context.ts` - Extracts GitHub metadata (repo, SHA, branch, actor, workflow URL) and auto-captures env vars with `vi_gh_` prefix |
| 38 | +- `src/types.ts` - TypeScript interfaces for payloads and responses |
| 39 | +- `action.yml` - Action definition with inputs/outputs |
| 40 | + |
| 41 | +## Conventions |
| 42 | + |
| 43 | +- Follow existing code patterns and style |
| 44 | +- Blank lines must be completely empty (no whitespace-only lines) |
| 45 | +- Add tests for new features; ensure tests pass before committing |
| 46 | +- Prefer editing existing files over creating new ones |
0 commit comments