Skip to content

feat: Rust layer — AGENTS.md.rust + rustfmt/clippy/renovate + renri hook + ci.yml.template - #2

Merged
yukimemi merged 2 commits into
mainfrom
feat-agents-md-rust-and-templates
May 5, 2026
Merged

yukimemi merged 2 commits into
mainfrom
feat-agents-md-rust-and-templates

Conversation

@yukimemi

@yukimemi yukimemi commented May 5, 2026

Copy link
Copy Markdown
Owner

Summary

Build out the Rust language layer so pj-rust composes cleanly with the new pj-base layer. Five new templates plus one rename.

What's in this PR

File Mode Notes
`.github/workflows/ci.yml` → `.github/workflows/ci.yml.template` (rename) overwrite, when=always dst spelled out as `.github/workflows/ci.yml`. The `.template` suffix keeps GitHub Actions from auto-running pj-rust's own source as a workflow (no Cargo.toml here → every job would fail).
`AGENTS.md.rust` merge-section, when=always Marker `kata:agents:rust:*`. Rust-specific guidance: cargo make targets, toolchain pin, fmt/clippy policy, kata-managed bytes warning for rustfmt.toml / clippy.toml / ci.yml.
`rustfmt.toml` overwrite, when=always Single setting today (`edition = "2024"`) but centralised so the policy is uniform across yukimemi/* Rust crates.
`clippy.toml` overwrite, when=always Pins `msrv = "1.85"`. Bump in lockstep with `package.rust-version`.
`renovate.json` overwrite, when=always Two halves in one file — (a) `customManagers` regex picks up `uses: …@…` inside `.github/workflows/*.template` so pj-rust's own Renovate keeps the source action versions current, (b) `packageRules` opts each consumer PJ out of touching `.github/workflows/{ci,release}.yml` directly so bumps happen centrally and propagate via `kata apply`.
`renri.toml.rust` → `renri.toml` overwrite, when=always Replaces pj-base's apm-install-only hook with `cargo make on-add`, the yukimemi/* Rust convention chain (apm-install + vcs-fetch).

Bumped template version to `0.2.0`.

Test plan

  • `kata init` against pj-base + this branch lands all 13 files cleanly.
  • AGENTS.md ends up with both `kata:agents:base:` and `kata:agents:rust:` blocks; pj-rust-cli's block can land below them later without conflict.
  • `renri.toml` ends up holding the pj-rust `cargo make on-add` hook (compose order pj-base → pj-rust, last-wins).
  • Idempotency: a follow-up `kata apply` reports `unchanged` for everything except `renri.toml` — that one reports `wrote` twice on every apply because both layers target it with `overwrite always`. Final bytes are deterministic, so this is noise rather than a correctness issue. Worth a Phase 4 "compose-then-apply" pass on the kata side, tracked separately.

Follow-ups (this branch is the second of four)

  • Close the existing Renovate onboarding PR (`Configure Renovate #1`) — its config doesn't include the customManagers / packageRules from this PR, so the new `renovate.json` supersedes it.
  • pj-rust-cli PR: `release.yml.template` + `AGENTS.md.rust-cli`.
  • kata dogfood PR: `kata apply --yes` to land the new bytes against kata itself.

🤖 Generated with Claude Code

… + ci.yml.template

Build out the Rust language layer so pj-rust composes cleanly with
the new pj-base layer. Five new templates plus one rename:

- ci.yml -> ci.yml.template (rename). The `.template` suffix
  keeps GitHub Actions from auto-running this repo's source as a
  workflow (it has no Cargo.toml, so every job would fail).
  template.toml carries an explicit
  `dst = ".github/workflows/ci.yml"` so consuming PJs still
  receive the workflow at the canonical path.
- AGENTS.md.rust (merge-section, marker `kata:agents:rust:*`).
  Rust-specific guidance: cargo make targets, toolchain pin,
  fmt/clippy policy, and the kata-managed bytes warning for
  rustfmt.toml / clippy.toml / ci.yml.
- rustfmt.toml (overwrite always). Single setting today —
  `edition = "2024"` — but centralised so the policy is uniform.
- clippy.toml (overwrite always). Pins `msrv = "1.85"` to match
  the Rust crate side; bumped together with `package.rust-version`.
- renovate.json (overwrite always). Two halves wrapped in one
  file so the same json works in both directions:
  - `customManagers` (regex) picks up `uses: …@…` references
    inside `.github/workflows/*.template` so this repo's own
    Renovate keeps the source action versions current.
  - `packageRules` opts every consuming PJ out of touching
    `.github/workflows/{ci,release}.yml` directly — bumps happen
    centrally here and propagate via `kata apply`.
- renri.toml.rust -> renri.toml (overwrite always). Replaces
  pj-base's apm-install-only hook with `cargo make on-add`, the
  yukimemi/* Rust convention chain (apm-install + vcs-fetch).

Bumped template version to 0.2.0.

Smoke-tested locally: composing pj-base + this branch via
`kata init` lands all 13 files cleanly (apart from a known
non-issue: `renri.toml` reports `wrote` on every apply because
both layers target it with `overwrite always` — final bytes are
idempotent under pj-rust's `cargo make on-add`).

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 5, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@yukimemi has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 2 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 76da94fe-38af-4b96-8cab-d5df48efa5a7

📥 Commits

Reviewing files that changed from the base of the PR and between eedac55 and 2e2cec8.

📒 Files selected for processing (8)
  • .github/workflows/ci.yml.template
  • AGENTS.md.rust
  • Makefile.toml
  • clippy.toml
  • renovate.json
  • renri.toml.rust
  • rustfmt.toml
  • template.toml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-agents-md-rust-and-templates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yukimemi yukimemi mentioned this pull request May 5, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the pj-rust template to version 0.2.0, introducing centralized configuration for clippy, rustfmt, and renovate, and adding AGENTS.md.rust for Rust-specific workflow guidance. The template.toml is updated to manage these new files, including a transition to a .template suffix for the CI workflow, and includes a new post_create hook in renri.toml. Feedback indicates that the on-add task referenced in the hook is missing from the Makefile.toml, and the documentation for cargo make check should be updated to include the lock-check task for better clarity.

Comment thread renri.toml.rust

[[hooks.post_create]]
type = "command"
run = "cargo make on-add"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The post_create hook is configured to run cargo make on-add, but the on-add task is not defined in the Makefile.toml provided in this template. Based on the PR description, this task is intended to be a chain of apm-install and vcs-fetch. You should add the missing task definition to Makefile.toml to ensure the hook functions correctly.

Comment thread AGENTS.md.rust Outdated
### Build / lint / test

```sh
cargo make check # fmt --check + clippy + test (the pre-push gate)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The description for cargo make check omits lock-check, which is included in the task's dependencies in Makefile.toml. Updating this to be inclusive of all checks provides better clarity for contributors.

cargo make check                    # fmt --check + clippy + test + lock-check (the pre-push gate)

- Makefile.toml — add `[tasks.on-add]` and `[tasks.vcs-fetch]`. The
  renri.toml.rust hook calls `cargo make on-add`, but the `on-add`
  task wasn't actually defined in pj-rust's Makefile.toml (rvpm
  had it, kata had it, pj-rust didn't). Without these, every fresh
  worktree's post_create hook would fail with "no such task". The
  definitions mirror rvpm's: `on-add` chains `apm-install-update`
  + `vcs-fetch`, and `vcs-fetch` prefers `jj git fetch` (works in
  both pure-jj and colocated repos) and falls back to `git fetch`
  in pure-git worktrees. `ignore_errors = true` keeps a transient
  network failure from breaking `renri add`.
- AGENTS.md.rust — add `lock-check` to the `cargo make check`
  one-line summary so it matches the actual `[tasks.check]`
  dependency list.

Co-Authored-By: Claude <noreply@anthropic.com>
@yukimemi

yukimemi commented May 5, 2026

Copy link
Copy Markdown
Owner Author

@gemini-code-assist both points addressed in 2e2cec8.

  • renri.toml.rust:8 (high) — agreed and good catch. The hook fired cargo make on-add but [tasks.on-add] wasn't defined in pj-rust's Makefile.toml (rvpm had it, kata had it, pj-rust didn't). Added the missing pair: [tasks.on-add] chains apm-install-update + vcs-fetch, and [tasks.vcs-fetch] prefers jj git fetch (works in pure-jj and colocated repos) with a git fetch fallback for pure-git worktrees. ignore_errors = true so a transient network failure during renri add doesn't break the worktree.
  • AGENTS.md.rust:10 (medium) — agreed, the one-line summary said "fmt --check + clippy + test" while the actual [tasks.check] dependencies are ["fmt-check", "clippy", "test", "lock-check"]. Updated the docstring to include lock-check.

@gemini-code-assist

Copy link
Copy Markdown

Thanks for the update, @yukimemi. The addition of the [tasks.on-add] chain and the updated AGENTS.md.rust documentation look correct and address the concerns raised. The use of ignore_errors = true in vcs-fetch is a sensible approach to ensure the hook remains robust against transient network issues.

@yukimemi
yukimemi merged commit 4602248 into main May 5, 2026
1 check passed
@yukimemi
yukimemi deleted the feat-agents-md-rust-and-templates branch May 5, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant