Scode Dist Rust Setup
Set up a Rust repository to match the release/distribution pattern used in juggler: dist-generated release workflow,
Homebrew publishing through scode/homebrew-dist-tap, Linux-focused CI, macOS release-plan gating on tags, and
git-cliff changelog governance.
Required Inputs
Collect these values before making changes:
crate_name: Required. Read from Cargo.toml ([package].name).
github_owner/repo: Derive from git remote get-url origin. Prompt only if parsing is ambiguous.
cargo_dist_version: Install/update dist first, then pin the discovered version in dist-workspace.toml.
Hard Defaults
Apply these defaults unless the user explicitly asks to diverge:
- Homebrew tap repository:
scode/homebrew-dist-tap
- Homebrew token secret:
HOMEBREW_TAP_TOKEN
- Homebrew install command namespace:
scode/dist-tap/<crate_name>
- Dist installers:
homebrew only
- Dist targets:
aarch64-apple-darwin, x86_64-apple-darwin, aarch64-unknown-linux-gnu, x86_64-unknown-linux-gnu
- Dist plan hook:
plan-jobs = ["./release-plan-tests"]
- CI platform focus: Linux for standard CI, macOS only as tag-gated release-plan test
Workflow
Phase A: Discover Project Facts
- Confirm the repository root contains
Cargo.toml.
- Extract
crate_name from Cargo.toml.
- Derive
github_owner/repo from git remote get-url origin.
- Detect existing files that may need updates instead of replacement:
dist-workspace.toml
.github/workflows/ci.yml
.github/workflows/release.yml
.github/workflows/release-plan-tests.yml
.github/workflows/conventional-commit-pr-title.yml
cliff.toml
CONTRIBUTING.md
README.md
Phase B: Install or Update cargo-dist and Capture Version
- Install or update dist using your preferred method.
- Capture the version from
dist --version.
- Pin that exact version string as
cargo-dist-version in dist-workspace.toml.
- Do not leave
cargo-dist-version unpinned.
Phase C: Configure dist-workspace.toml
- Create or update
dist-workspace.toml using references/dist-workspace-template.md.
- Keep these values exact unless the user explicitly asks otherwise:
ci = "github"
installers = ["homebrew"]
install-path = "CARGO_HOME"
install-updater = true
tap = "scode/homebrew-dist-tap"
publish-jobs = ["homebrew"]
plan-jobs = ["./release-plan-tests"]
- Use the discovered dist version from Phase B for
cargo-dist-version.
Phase D: Ensure Cargo.toml is ready for dist
- Ensure
Cargo.toml has repository = "https://github.com/<owner>/<repo>" — dist requires this for GitHub CI.
- Ensure
Cargo.toml has description and homepage — Homebrew publishing warns without them.
[profile.dist] will be added automatically by dist init --yes in Phase E.
Phase E: Generate Dist Release Workflow with dist init
dist init --yes is the primary tool for this phase. It:
- Adds
[profile.dist] to Cargo.toml if missing.
- Reformats
dist-workspace.toml with comments (preserving values).
- Generates
.github/workflows/release.yml — this file is dist-managed and must never be hand-edited.
Steps:
- Write
dist-workspace.toml first (Phase C).
- Ensure
Cargo.toml has repository, description, homepage (Phase D).
- Run
dist init --yes to generate everything. The --yes flag auto-accepts defaults (required for non-interactive).
- If
dist-workspace.toml is changed later, re-run dist init --yes.
Phase F: Install Linux/macOS CI Pattern
- Create or update
.github/workflows/ci.yml using references/ci-linux-macos-pattern.md.
- Keep standard CI Linux-focused.
- Keep a macOS job disabled in standard CI for cost control.
- Omit Windows baseline jobs unless explicitly requested.
Phase G: Add Release Plan Test Workflow
This file is NOT generated by dist init. It is a manually-maintained reusable workflow that the dist-generated
release.yml calls via plan-jobs = ["./release-plan-tests"]. Create it AFTER running dist init (Phase E) so you can
verify release.yml references it correctly.
- Create or update
.github/workflows/release-plan-tests.yml using references/release-plan-tests-template.md.
- Run Linux tests on workflow call.
- Run macOS tests only when
github.ref is a tag ref.
- Ensure
dist-workspace.toml includes plan-jobs = ["./release-plan-tests"].
- Verify the generated
release.yml contains a custom-release-plan-tests job that calls this workflow.
Phase H: Enforce Conventional Commit PR Titles
Create or update .github/workflows/conventional-commit-pr-title.yml using
references/conventional-commit-pr-title-workflow.md.
Enforce these allowed types:
feat, fix, docs, doc, perf, refactor, style, test, chore, ci, revert
Keep scope optional.
Enforce classification policy in repository docs:
- Type must reflect user-visible behavior, not implementation activity.
- CLI interface/behavior changes (commands, flags/options, arguments, output contract, exit codes, documented usage)
must be
feat, fix, or perf (use ! when breaking), not refactor.
refactor, style, test, chore, ci, docs, and doc are for non-user-visible changes only.
Update CLAUDE.md to require Conventional Commit style PR titles. Add a section like:
# PR titles
PR titles must follow [Conventional Commits](https://www.conventionalcommits.org/) style. This is enforced by CI
and used by git-cliff for changelog generation.
Allowed types: `feat`, `fix`, `docs`, `doc`, `perf`, `refactor`, `style`, `test`, `chore`, `ci`, `revert`.
Scope is optional. Examples: `feat: add user login`, `fix(parser): handle empty input`.
Type must reflect user-visible behavior, not implementation activity.
CLI interface/behavior changes must be `feat`, `fix`, or `perf` (use `!` when breaking), not `refactor`.
If CLAUDE.md already has a section about commit messages or PR titles, extend it rather than duplicating.
Phase I: Set Up git-cliff and Release Documentation
If cliff.toml is missing, initialize it with:
git cliff --init keepachangelog
If cliff.toml already exists, avoid replacing it with a hardcoded template unless the user explicitly requests that
migration.
Keep the config compatible with Conventional Commit-driven changelogs and default it to user-visible entries only.
- Include by default:
feat, fix, perf, revert.
- Skip by default:
refactor, style, test, chore, ci, docs, doc.
- Parse override tags first:
changelog: include forces inclusion, changelog: skip forces exclusion.
- If both tags are present,
changelog: skip wins.
Update CONTRIBUTING.md with:
- Conventional Commit requirements for commit messages and PR titles.
- Classification policy: type reflects user-visible behavior; CLI interface changes are never
refactor.
- Note that PR title enforcement is implemented in
.github/workflows/conventional-commit-pr-title.yml.
- Changelog generation uses git-cliff and root
CHANGELOG.md.
- Override tag behavior for
changelog: include / changelog: skip.
- An agent-centric Releasing section using the content from
references/release-checklist.md. This section is
written as instructions for an AI agent so that a user can say "cut a release" and the agent guides them through
the entire version bump, changelog, PR, merge, tag, and release watch flow.
Update CLAUDE.md with a Releasing section that tells agents to follow CONTRIBUTING.md:
# Releasing
When the user asks to "make a release" or "cut a release", follow the Releasing section of `CONTRIBUTING.md`.
If CLAUDE.md already has a releasing section, update it rather than duplicating.
Phase J: Wire Homebrew Distribution
- Ensure dist config uses
tap = "scode/homebrew-dist-tap".
- Ensure the repository has secret
HOMEBREW_TAP_TOKEN for release publishing.
- Verify generated release workflow includes
publish-homebrew-formula and checks out scode/homebrew-dist-tap.
- Document installation in
README.md as:
brew install scode/dist-tap/<crate_name>
Verification Checklist
Run these checks after setup:
rg -n 'cargo-dist-version|tap = "scode/homebrew-dist-tap"|plan-jobs' dist-workspace.toml
rg -n '^\[profile\.dist\]' Cargo.toml
rg -n 'custom-release-plan-tests|publish-homebrew-formula|HOMEBREW_TAP_TOKEN' .github/workflows/release.yml
rg -n 'test-linux|test-macos' .github/workflows/release-plan-tests.yml
rg -n 'action-semantic-pull-request|types:' .github/workflows/conventional-commit-pr-title.yml
rg -n 'Conventional Commits|PR titles|Releasing|CONTRIBUTING.md' CLAUDE.md
rg -n 'conventional_commits = true' cliff.toml
rg -n 'git-cliff --tag|CHANGELOG\.md|Conventional Commits|cut a release|bump' CONTRIBUTING.md
rg -n 'brew install scode/dist-tap/' README.md
Resources
Use these files to avoid rewriting long templates:
references/dist-workspace-template.md
references/ci-linux-macos-pattern.md
references/release-plan-tests-template.md
references/conventional-commit-pr-title-workflow.md
references/git-cliff-and-changelog-flow.md
references/release-checklist.md
1---2name: scode-dist-rust-setup3description: Set up or standardize a Rust repository with cargo-dist release automation, Linux-focused CI with macOS release-plan tag gates, git-cliff changelog generation, Conventional Commit PR title enforcement, and Homebrew publishing to scode/homebrew-dist-tap. Use when creating a new Rust release pipeline or migrating an existing repo to this exact distribution model.4---56# Scode Dist Rust Setup78Set up a Rust repository to match the release/distribution pattern used in juggler: dist-generated release workflow,9Homebrew publishing through `scode/homebrew-dist-tap`, Linux-focused CI, macOS release-plan gating on tags, and10git-cliff changelog governance.1112## Required Inputs1314Collect these values before making changes:1516- `crate_name`: Required. Read from `Cargo.toml` (`[package].name`).17- `github_owner/repo`: Derive from `git remote get-url origin`. Prompt only if parsing is ambiguous.18- `cargo_dist_version`: Install/update dist first, then pin the discovered version in `dist-workspace.toml`.1920## Hard Defaults2122Apply these defaults unless the user explicitly asks to diverge:2324- Homebrew tap repository: `scode/homebrew-dist-tap`25- Homebrew token secret: `HOMEBREW_TAP_TOKEN`26- Homebrew install command namespace: `scode/dist-tap/<crate_name>`27- Dist installers: `homebrew` only28- Dist targets: `aarch64-apple-darwin`, `x86_64-apple-darwin`, `aarch64-unknown-linux-gnu`, `x86_64-unknown-linux-gnu`29- Dist plan hook: `plan-jobs = ["./release-plan-tests"]`30- CI platform focus: Linux for standard CI, macOS only as tag-gated release-plan test3132## Workflow3334### Phase A: Discover Project Facts35361. Confirm the repository root contains `Cargo.toml`.372. Extract `crate_name` from `Cargo.toml`.383. Derive `github_owner/repo` from `git remote get-url origin`.394. Detect existing files that may need updates instead of replacement:40 - `dist-workspace.toml`41 - `.github/workflows/ci.yml`42 - `.github/workflows/release.yml`43 - `.github/workflows/release-plan-tests.yml`44 - `.github/workflows/conventional-commit-pr-title.yml`45 - `cliff.toml`46 - `CONTRIBUTING.md`47 - `README.md`4849### Phase B: Install or Update cargo-dist and Capture Version50511. Install or update dist using your preferred method.522. Capture the version from `dist --version`.533. Pin that exact version string as `cargo-dist-version` in `dist-workspace.toml`.544. Do not leave `cargo-dist-version` unpinned.5556### Phase C: Configure dist-workspace.toml57581. Create or update `dist-workspace.toml` using `references/dist-workspace-template.md`.592. Keep these values exact unless the user explicitly asks otherwise:60 - `ci = "github"`61 - `installers = ["homebrew"]`62 - `install-path = "CARGO_HOME"`63 - `install-updater = true`64 - `tap = "scode/homebrew-dist-tap"`65 - `publish-jobs = ["homebrew"]`66 - `plan-jobs = ["./release-plan-tests"]`673. Use the discovered dist version from Phase B for `cargo-dist-version`.6869### Phase D: Ensure Cargo.toml is ready for dist70711. Ensure `Cargo.toml` has `repository = "https://github.com/<owner>/<repo>"` — dist requires this for GitHub CI.722. Ensure `Cargo.toml` has `description` and `homepage` — Homebrew publishing warns without them.733. `[profile.dist]` will be added automatically by `dist init --yes` in Phase E.7475### Phase E: Generate Dist Release Workflow with `dist init`7677`dist init --yes` is the primary tool for this phase. It:7879- Adds `[profile.dist]` to `Cargo.toml` if missing.80- Reformats `dist-workspace.toml` with comments (preserving values).81- Generates `.github/workflows/release.yml` — this file is **dist-managed** and must never be hand-edited.8283Steps:84851. Write `dist-workspace.toml` first (Phase C).862. Ensure `Cargo.toml` has `repository`, `description`, `homepage` (Phase D).873. Run `dist init --yes` to generate everything. The `--yes` flag auto-accepts defaults (required for non-interactive).884. If `dist-workspace.toml` is changed later, re-run `dist init --yes`.8990### Phase F: Install Linux/macOS CI Pattern91921. Create or update `.github/workflows/ci.yml` using `references/ci-linux-macos-pattern.md`.932. Keep standard CI Linux-focused.943. Keep a macOS job disabled in standard CI for cost control.954. Omit Windows baseline jobs unless explicitly requested.9697### Phase G: Add Release Plan Test Workflow9899This file is NOT generated by `dist init`. It is a manually-maintained reusable workflow that the dist-generated100`release.yml` calls via `plan-jobs = ["./release-plan-tests"]`. Create it AFTER running `dist init` (Phase E) so you can101verify `release.yml` references it correctly.1021031. Create or update `.github/workflows/release-plan-tests.yml` using `references/release-plan-tests-template.md`.1042. Run Linux tests on workflow call.1053. Run macOS tests only when `github.ref` is a tag ref.1064. Ensure `dist-workspace.toml` includes `plan-jobs = ["./release-plan-tests"]`.1075. Verify the generated `release.yml` contains a `custom-release-plan-tests` job that calls this workflow.108109### Phase H: Enforce Conventional Commit PR Titles1101111. Create or update `.github/workflows/conventional-commit-pr-title.yml` using112 `references/conventional-commit-pr-title-workflow.md`.1132. Enforce these allowed types:114 - `feat`, `fix`, `docs`, `doc`, `perf`, `refactor`, `style`, `test`, `chore`, `ci`, `revert`1153. Keep scope optional.1164. Enforce classification policy in repository docs:117 - Type must reflect user-visible behavior, not implementation activity.118 - CLI interface/behavior changes (commands, flags/options, arguments, output contract, exit codes, documented usage)119 must be `feat`, `fix`, or `perf` (use `!` when breaking), not `refactor`.120 - `refactor`, `style`, `test`, `chore`, `ci`, `docs`, and `doc` are for non-user-visible changes only.1215. Update `CLAUDE.md` to require Conventional Commit style PR titles. Add a section like:122123 ```124 # PR titles125126 PR titles must follow [Conventional Commits](https://www.conventionalcommits.org/) style. This is enforced by CI127 and used by git-cliff for changelog generation.128129 Allowed types: `feat`, `fix`, `docs`, `doc`, `perf`, `refactor`, `style`, `test`, `chore`, `ci`, `revert`.130 Scope is optional. Examples: `feat: add user login`, `fix(parser): handle empty input`.131132 Type must reflect user-visible behavior, not implementation activity.133 CLI interface/behavior changes must be `feat`, `fix`, or `perf` (use `!` when breaking), not `refactor`.134 ```135136 If `CLAUDE.md` already has a section about commit messages or PR titles, extend it rather than duplicating.137138### Phase I: Set Up git-cliff and Release Documentation1391401. If `cliff.toml` is missing, initialize it with:141 - `git cliff --init keepachangelog`1422. If `cliff.toml` already exists, avoid replacing it with a hardcoded template unless the user explicitly requests that143 migration.1443. Keep the config compatible with Conventional Commit-driven changelogs and default it to user-visible entries only.145 - Include by default: `feat`, `fix`, `perf`, `revert`.146 - Skip by default: `refactor`, `style`, `test`, `chore`, `ci`, `docs`, `doc`.147 - Parse override tags first: `changelog: include` forces inclusion, `changelog: skip` forces exclusion.148 - If both tags are present, `changelog: skip` wins.1494. Update `CONTRIBUTING.md` with:150 - Conventional Commit requirements for commit messages and PR titles.151 - Classification policy: type reflects user-visible behavior; CLI interface changes are never `refactor`.152 - Note that PR title enforcement is implemented in `.github/workflows/conventional-commit-pr-title.yml`.153 - Changelog generation uses git-cliff and root `CHANGELOG.md`.154 - Override tag behavior for `changelog: include` / `changelog: skip`.155 - An agent-centric **Releasing** section using the content from `references/release-checklist.md`. This section is156 written as instructions for an AI agent so that a user can say "cut a release" and the agent guides them through157 the entire version bump, changelog, PR, merge, tag, and release watch flow.1585. Update `CLAUDE.md` with a Releasing section that tells agents to follow CONTRIBUTING.md:159160 ```161 # Releasing162163 When the user asks to "make a release" or "cut a release", follow the Releasing section of `CONTRIBUTING.md`.164 ```165166 If `CLAUDE.md` already has a releasing section, update it rather than duplicating.167168### Phase J: Wire Homebrew Distribution1691701. Ensure dist config uses `tap = "scode/homebrew-dist-tap"`.1712. Ensure the repository has secret `HOMEBREW_TAP_TOKEN` for release publishing.1723. Verify generated release workflow includes `publish-homebrew-formula` and checks out `scode/homebrew-dist-tap`.1734. Document installation in `README.md` as:174 - `brew install scode/dist-tap/<crate_name>`175176## Verification Checklist177178Run these checks after setup:1791801. `rg -n 'cargo-dist-version|tap = "scode/homebrew-dist-tap"|plan-jobs' dist-workspace.toml`1812. `rg -n '^\[profile\.dist\]' Cargo.toml`1823. `rg -n 'custom-release-plan-tests|publish-homebrew-formula|HOMEBREW_TAP_TOKEN' .github/workflows/release.yml`1834. `rg -n 'test-linux|test-macos' .github/workflows/release-plan-tests.yml`1845. `rg -n 'action-semantic-pull-request|types:' .github/workflows/conventional-commit-pr-title.yml`1856. `rg -n 'Conventional Commits|PR titles|Releasing|CONTRIBUTING.md' CLAUDE.md`1867. `rg -n 'conventional_commits = true' cliff.toml`1878. `rg -n 'git-cliff --tag|CHANGELOG\.md|Conventional Commits|cut a release|bump' CONTRIBUTING.md`1889. `rg -n 'brew install scode/dist-tap/' README.md`189190## Resources191192Use these files to avoid rewriting long templates:193194- `references/dist-workspace-template.md`195- `references/ci-linux-macos-pattern.md`196- `references/release-plan-tests-template.md`197- `references/conventional-commit-pr-title-workflow.md`198- `references/git-cliff-and-changelog-flow.md`199- `references/release-checklist.md`