block / block/ai-rules

init recipe doesn't detect Ruby (or other runtime version pinning)

Open
#94 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
131
Forks
25
PR merge metrics
No merged PRs in 30d

Description

## Problem

The init Goose recipe at `src/templates/init_rule.md` enumerates manifest files to scan (`package.json, Cargo.toml, go.mod, pyproject.toml, Makefile, Justfile, Taskfile, build.gradle, pom.xml, composer.json, mix.exs`) but omits Ruby entirely — no `Gemfile`, no `gems.rb`.

It also has no general step for detecting runtime version pinning files (`.ruby-version`, `.nvmrc`, `.python-version`, `.tool-versions`, etc.).

The result: when `ai-rules init` runs in a Ruby repo, the generated `example.md` never tells the agent which Ruby to use. Coding agents default to whatever `/usr/bin/ruby` resolves to (often macOS system Ruby 2.6.x), which:

- fails to parse modern Ruby syntax (e.g. comments between fluent dots, added in Ruby 2.7)
- can't resolve gems pinned to a newer ABI
- skips pre-commit/pre-push hooks that depend on a project-pinned Ruby

This affects every Ruby service that has run \`ai-rules init\`. The same gap exists for any repo pinning Node/Python/etc. via \`.nvmrc\` / \`.python-version\` if the surrounding manifest doesn't carry version info.

## Proposed fix

Two surgical edits to \`src/templates/init_rule.md\`:

1. Add \`Gemfile, gems.rb\` to the manifest list in Step 2, and instruct the recipe to read the \`ruby ""\` directive.

2. Add a new **Step 3: "Detect runtime version pinning"** that finds \`.ruby-version\`, \`.nvmrc\`, \`.node-version\`, \`.python-version\`, \`.tool-versions\`, \`rust-toolchain.toml\`, \`mise.toml\`, cross-references them against manifest declarations, and — if found — requires the generated rule file to include a **"Runtime / Toolchain"** section with the exact activation command (e.g. \`rvm use \$(cat .ruby-version)\`).

The new section maps each pinning file to its common version managers, defaulting to whichever the user has on \`\$PATH\` (rvm for Ruby, nvm for Node, pyenv for Python).

Draft PR to follow.

Contributor guide

Open the contributing guide

Research direction

Start with src/templates/init_rule.md, especially the manifest enumeration in Step 2. Add the Ruby manifests and runtime-version detection described in the issue, then verify that generated example.md includes a Runtime / Toolchain section with the appropriate activation command when pinning files are present.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, python, ruby, rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.