|
| 1 | +You are an experienced, pragmatic software engineering AI agent. Do not over-engineer a solution when a simple one is possible. Keep edits minimal. If you want an exception to ANY rule, you MUST stop and get permission first. |
| 2 | + |
| 3 | +# Project Overview |
| 4 | + |
| 5 | +This repository is the **official Homebrew tap** for Coder. It contains Homebrew **formulae** (CLI tools) and **casks** (macOS packages) used by end-users via `brew install`. |
| 6 | + |
| 7 | +- **Primary tech:** Homebrew Formula/Cask DSL (Ruby). |
| 8 | +- **Other tech:** Bash helper scripts under `scripts/`. |
| 9 | +- **CI:** GitHub Actions runs `brew test-bot` (see `.github/workflows/test.yml`). |
| 10 | + |
| 11 | +Typical changes are version bumps (updating `version`, `url`, and `sha256`) and keeping tests/install stanzas aligned with Homebrew conventions. |
| 12 | + |
| 13 | +# Reference |
| 14 | + |
| 15 | +## Key directories |
| 16 | + |
| 17 | +- `Formula/`: Homebrew formulae (Ruby classes). |
| 18 | +- `Casks/`: Homebrew casks (Ruby DSL blocks). |
| 19 | +- `scripts/`: helper scripts for updating formula versions/hashes. |
| 20 | +- `.github/workflows/`: CI definition. |
| 21 | + |
| 22 | +## Key files |
| 23 | + |
| 24 | +- `Formula/coder.rb`: **Coder v2** CLI formula (macOS arm64/amd64 + Linux amd64). |
| 25 | +- `Formula/coder@1.rb`: **Coder v1** (legacy) CLI formula (`keg_only :versioned_formula`). |
| 26 | +- `Casks/coder-desktop.rb`: Coder Desktop (versioned pkg + pinned `sha256`). |
| 27 | +- `Casks/coder-desktop-preview.rb`: Deprecated preview cask (`sha256 :no_check`). |
| 28 | +- `formula_renames.json`: Maps historical formula names to current ones. |
| 29 | +- `scripts/update-v2.sh`: Updates `Formula/coder.rb` for a new v2 release. |
| 30 | +- `scripts/update-v1.sh`: Updates `Formula/coder@1.rb` for a new v1 release. |
| 31 | + |
| 32 | +# Essential commands |
| 33 | + |
| 34 | +> Prerequisite: most commands below require **Homebrew** (`brew`) to be installed. |
| 35 | +
|
| 36 | +## Build |
| 37 | + |
| 38 | +- N/A: this is a tap repository (no compilation/build step in-repo). |
| 39 | + |
| 40 | +## Format |
| 41 | + |
| 42 | +- Format/style formulae & casks (Homebrew style checks): |
| 43 | + ```sh |
| 44 | + brew style |
| 45 | + ``` |
| 46 | + |
| 47 | +## Lint |
| 48 | + |
| 49 | +- Tap syntax checks (matches CI): |
| 50 | + ```sh |
| 51 | + brew test-bot --only-tap-syntax |
| 52 | + ``` |
| 53 | + |
| 54 | +## Test |
| 55 | + |
| 56 | +- Run the same test phase CI runs for pull requests: |
| 57 | + ```sh |
| 58 | + brew test-bot --only-formulae |
| 59 | + ``` |
| 60 | + |
| 61 | +> Note: `brew test-bot` is relatively heavy but is the most reliable way to match CI behavior for this repo. |
| 62 | +
|
| 63 | +## Clean |
| 64 | + |
| 65 | +- CI cleanup phase (useful locally when iterating with `brew test-bot`): |
| 66 | + ```sh |
| 67 | + brew test-bot --only-cleanup-before |
| 68 | + ``` |
| 69 | + |
| 70 | +- CI setup phase (often needed after cleanup / on first run): |
| 71 | + ```sh |
| 72 | + brew test-bot --only-setup |
| 73 | + ``` |
| 74 | + |
| 75 | +## Development server |
| 76 | + |
| 77 | +- N/A. |
| 78 | + |
| 79 | +## Release/update helpers |
| 80 | + |
| 81 | +> Note: `scripts/update-*.sh` use GNU `sed` flags (`-z` and `-i` without a backup extension). They’re expected to run in a GNU `sed` environment (e.g., Linux). If you’re on macOS with BSD `sed`, run them in a Linux container or adjust the commands. |
| 82 | +
|
| 83 | +- Update **Coder v2** formula (`Formula/coder.rb`): |
| 84 | + ```sh |
| 85 | + ./scripts/update-v2.sh "<version>" "<darwin-arm64-sha256>" "<darwin-amd64-sha256>" "<linux-amd64-sha256>" |
| 86 | + ``` |
| 87 | + |
| 88 | +- Update **Coder v1** formula (`Formula/coder@1.rb`): |
| 89 | + ```sh |
| 90 | + ./scripts/update-v1.sh "<version>" "<darwin-amd64-sha256>" "<linux-amd64-sha256>" |
| 91 | + ``` |
| 92 | + |
| 93 | +- Computing SHA256 for downloaded artifacts: |
| 94 | + ```sh |
| 95 | + # macOS |
| 96 | + shasum -a 256 <file> |
| 97 | + |
| 98 | + # Linux |
| 99 | + sha256sum <file> |
| 100 | + ``` |
| 101 | + |
| 102 | +# Patterns |
| 103 | + |
| 104 | +## Version bumps (formulae) |
| 105 | + |
| 106 | +- Keep the `version` value and the `url` templates in sync. |
| 107 | +- For `Formula/coder.rb`, there are **three** `sha256` entries (macOS arm64, macOS amd64, Linux amd64). |
| 108 | + - The update scripts replace the **1st/2nd/3rd** `sha256` occurrence; avoid reordering or inserting extra `sha256` lines without updating `scripts/update-v2.sh`. |
| 109 | +- Prefer **deterministic** `test do` blocks (fast, no external state). If tests must fail, use `shell_output(cmd, expected_exit_code)` like `Formula/coder.rb`. |
| 110 | + |
| 111 | +## Version bumps (casks) |
| 112 | + |
| 113 | +- Use a pinned `sha256` when the URL is versioned. |
| 114 | +- Use `sha256 :no_check` only when the URL is intentionally unversioned (as in the deprecated preview cask). |
| 115 | + |
| 116 | +# Anti-patterns |
| 117 | + |
| 118 | +- Don’t reorder `sha256` lines in formulae if you still rely on `scripts/update-*.sh` (they patch by “nth match”). |
| 119 | +- Don’t add network-dependent tests or long-running integration tests to formulae; Homebrew formula tests should be quick and reproducible. |
| 120 | + |
| 121 | +# Commit and Pull Request Guidelines |
| 122 | + |
| 123 | +## Before committing |
| 124 | + |
| 125 | +- Run at least: |
| 126 | + ```sh |
| 127 | + brew test-bot --only-tap-syntax |
| 128 | + ``` |
| 129 | +- If you changed formulae, also run: |
| 130 | + ```sh |
| 131 | + brew test-bot --only-formulae |
| 132 | + ``` |
| 133 | + |
| 134 | +## Commit messages |
| 135 | + |
| 136 | +Recent history uses concise, release-oriented subjects. Prefer: |
| 137 | + |
| 138 | +- `coder <version>` for `Formula/coder.rb` bumps (example: `coder 2.30.0`). |
| 139 | +- `coder@1 <version>` or similar for v1 bumps. |
| 140 | +- `Coder Desktop v<version>` for cask releases. |
| 141 | + |
| 142 | +## Pull requests |
| 143 | + |
| 144 | +In the PR description: |
| 145 | + |
| 146 | +- State **what changed** (which formula/cask + version). |
| 147 | +- Include **where the SHA256 values came from** (e.g., the upstream release artifacts you downloaded). |
| 148 | +- Include **what you ran** locally (or say “not run” if you couldn’t). |
0 commit comments