init: detect Ruby and runtime version pinning files
Closes #94.
What this changes
Two surgical edits to src/templates/init_rule.md — the Goose recipe template that ai-rules init uses to scan a repo and draft its first rule file.
-
Step 2 (manifests): add
Gemfile, gems.rbto the list and instruct the recipe to read theruby ""directive. -
Step 3 (new): "Detect runtime version pinning" — finds
.ruby-version,.nvmrc,.node-version,.python-version,.tool-versions,rust-toolchain.toml,mise.toml; cross-references with manifest declarations; and — if present — requires the generated rule file to include a "Runtime / Toolchain" section with the exact activation command. -
Adds "Runtime / Toolchain" to the recommended-sections list, with rationale: agents that skip this default to
/usr/bin/rubyand hit syntax / gem-resolution errors against modern Ruby code.
Renumbers the existing Steps 4–7 to keep the sequence contiguous.
Why
The current template lists package.json, Cargo.toml, go.mod, pyproject.toml, Makefile, ... but never mentions Ruby. Every Ruby service that runs ai-rules init produces an example.md with no Ruby-version guidance, so agents default to system Ruby (often macOS 2.6.x) and fail on modern syntax.
The same gap exists for any repo pinning Node/Python/Rust via a side-channel pinning file when the manifest itself doesn't carry the version.
Default version managers recommended
Picked to match the most common Block/macOS dev-environment setups:
| Pinning file | Default | Fallbacks |
|---|---|---|
.ruby-version |
rvm | rbenv, chruby, asdf, mise |
.nvmrc / .node-version |
nvm | fnm, volta, asdf, mise |
.python-version |
pyenv | asdf, mise |
.tool-versions |
asdf or mise | — |
rust-toolchain.toml |
rustup (auto) | — |
Recipe is instructed to detect what the user actually has on $PATH via command -v and prefer that.
Test plan
- [ ] Run
ai-rules initon a Ruby repo with.ruby-version→ generated file includes a "Runtime / Toolchain" section withrvm use $(cat .ruby-version). - [ ] Run on a Node repo with
.nvmrc→ section recommendsnvm use. - [ ] Run on a repo with no pinning file → section is omitted (no false positives).
- [ ] Run on a mixed repo (
.tool-versions+Gemfile) → section prefers asdf/mise and mentions both languages.
Filing as draft for maintainer review of the template wording before promoting.