|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Critical Rules |
| 6 | + |
| 7 | +**These rules override all other instructions:** |
| 8 | + |
| 9 | +1. **NEVER commit directly to main** - Always create a feature branch and submit a pull request |
| 10 | +2. **Conventional commits** - Format: `type(scope): description` |
| 11 | +3. **GitHub Issues for TODOs** - Use `gh` CLI to manage issues, no local TODO files. Use conventional commit format for issue titles |
| 12 | +4. **Pull Request titles** - Use conventional commit format (same as commits) |
| 13 | +5. **Branch naming** - Use format: `type/short-description` (e.g., `feat/settings-dialog`) |
| 14 | +6. **Working an issue** - Always create a new branch from an updated main branch |
| 15 | +7. **Check branch status before pushing** - Verify the remote tracking branch still exists. If a PR was merged/deleted, create a new branch from main instead |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +### GitHub CLI Commands |
| 20 | + |
| 21 | +```bash |
| 22 | +gh issue list # List open issues |
| 23 | +gh issue view <number> # View details |
| 24 | +gh issue create --title "type(scope): description" --body "..." |
| 25 | +gh issue close <number> |
| 26 | +``` |
| 27 | + |
| 28 | +### Conventional Commit Types |
| 29 | + |
| 30 | +| Type | Description | |
| 31 | +|------|-------------| |
| 32 | +| `feat` | New feature | |
| 33 | +| `fix` | Bug fix | |
| 34 | +| `docs` | Documentation only | |
| 35 | +| `refactor` | Code change that neither fixes a bug nor adds a feature | |
| 36 | +| `test` | Adding or updating tests | |
| 37 | +| `chore` | Maintenance tasks | |
| 38 | +| `perf` | Performance improvement | |
| 39 | +| `ci` | CI/CD changes | |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## Project Overview |
| 44 | + |
| 45 | +This is a GitHub Action (`CodingWithCalvin/GHA-VSVsixVersioner`) that versions Visual Studio extensions (.vsix) using a date-based versioning scheme: `YYYY.M.D.BuildNumber`. It updates both the XML manifest (`source.extension.vsixmanifest`) and the C# code-behind file (`source.extension.cs`) that are synchronized via VSIX Synchronizer. |
| 46 | + |
| 47 | +**Important**: This action only runs on Windows-based GitHub runners. |
| 48 | + |
| 49 | +## Commands |
| 50 | + |
| 51 | +```bash |
| 52 | +# Install dependencies |
| 53 | +npm ci |
| 54 | + |
| 55 | +# Run tests |
| 56 | +npm test |
| 57 | + |
| 58 | +# Run a single test file |
| 59 | +npx jest __tests__/main.test.ts |
| 60 | + |
| 61 | +# Run tests with pattern matching |
| 62 | +npx jest -t "test name pattern" |
| 63 | + |
| 64 | +# Lint |
| 65 | +npm run lint |
| 66 | + |
| 67 | +# Format code |
| 68 | +npm run format:write |
| 69 | + |
| 70 | +# Check formatting without changes |
| 71 | +npm run format:check |
| 72 | + |
| 73 | +# Build/package the action |
| 74 | +npm run package |
| 75 | + |
| 76 | +# Full build (format, lint, test, coverage, package) |
| 77 | +npm run all |
| 78 | +``` |
| 79 | + |
| 80 | +## Architecture |
| 81 | + |
| 82 | +Single-file TypeScript GitHub Action (`src/index.ts`) bundled with `@vercel/ncc` to `dist/index.js`. |
| 83 | + |
| 84 | +**Flow:** |
| 85 | +1. Reads `extension-manifest-file` and `extension-source-file` inputs (required) |
| 86 | +2. Generates version string: `YYYY.M.D.{build-number}` (build-number defaults to `github.context.runNumber`) |
| 87 | +3. Parses XML manifest with `fast-xml-parser`, updates `PackageManifest.Metadata.Identity[@Version]` |
| 88 | +4. Updates C# source file by replacing `Version = "x.x.x.x";` pattern via regex |
| 89 | +5. Outputs the generated `version` for downstream steps |
| 90 | + |
| 91 | +**Key dependencies:** |
| 92 | +- `@actions/core` - GitHub Action I/O and failure handling |
| 93 | +- `@actions/github` - GitHub context (run number) |
| 94 | +- `fast-xml-parser` - XML parsing/building for vsixmanifest |
| 95 | + |
| 96 | +## Configuration |
| 97 | + |
| 98 | +- ESLint config: `.github/linters/.eslintrc.yml` |
| 99 | +- Jest config: embedded in `package.json` |
| 100 | +- TypeScript: `tsconfig.json` (ES2022, NodeNext modules, strict mode) |
| 101 | +- Node version: specified in `.node-version` file (requires Node >= 21) |
0 commit comments