fix(lint): make commands-tokens script fail with a clear error when ripgrep is missing + add to CONTRIBUTING prereqs#1867
Conversation
…ns loudly without it The `lint:commands-tokens` pre-push step (defined in `app/package.json`) shells out to `rg` with no presence check. A fresh contributor without ripgrep installed hits a cryptic `rg: command not found` mid-`git push` with no hint about what to install or why. Two small fixes: 1. **CONTRIBUTING.md**: add a `ripgrep (rg)` row to the prerequisites table (right after Ninja) and append `ripgrep` to the macOS bootstrap snippet's `brew install` line. 2. **app/package.json**: wrap `lint:commands-tokens` with a `command -v rg` guard that prints an actionable install hint (brew / apt / link to upstream installation docs) and exits 1 so the pre-push hook fails loudly, instead of falling through to the cryptic shell-builtin error. Verified locally: - `pnpm lint:commands-tokens` with rg present: silent pass (same as before). - `PATH=/usr/bin:/bin pnpm lint:commands-tokens` (rg missing): prints the install hint and exits 1. - `node -e "JSON.parse(...)"` on `app/package.json` confirms the escaped script is still valid JSON.
📝 WalkthroughWalkthroughPrerequisites and bootstrap documentation now surface ripgrep as a required tool. The lint:commands-tokens npm script adds an explicit ripgrep presence check before execution, printing an installation hint if missing instead of failing silently with a "command not found" error. ChangesRipgrep Prerequisite and Error Handling
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
Summary
ripgrep (rg)to the prerequisites table inCONTRIBUTING.md(right after Ninja) with a one-line note explaining it's needed by thelint:commands-tokenspre-push step.ripgrepto the macOS bootstrap snippet'sbrew installline.lint:commands-tokensinapp/package.jsonwith acommand -v rgguard that prints an actionable install hint (brew / apt / upstream link) and exits 1 — instead of falling through to a crypticrg: command not found.Problem
After following
CONTRIBUTING.mdexactly on a clean macOS install, the firstgit pushtriggers the pre-push hook →pnpm lint:commands-tokens→bash: rg: command not found(exit 127). The contributor has no indication which step failed, what tool is missing, or how to install it. Reproduces on every fresh macOS contributor; hit it personally during #1786.Solution
Doc + script change, no behavior change for contributors who already have ripgrep:
CONTRIBUTING.md: one new row in the prerequisites table, one extra package in the bootstrap snippet.app/package.json: prependcommand -v rg >/dev/null 2>&1 || { echo "…" >&2; exit 1; };to the existinglint:commands-tokensbash command. JSON validity verified withnode -e 'JSON.parse(require("fs").readFileSync("app/package.json"))'.Verified locally:
pnpm lint:commands-tokenswith rg present → silent pass (same as before).PATH=/usr/bin:/bin pnpm lint:commands-tokens(rg missing) → prints the install hint and exits 1.Submission Checklist
pnpm lint:commands-tokensitself, which still passes with rg present (verified locally).package.json; no Vitest- or cargo-llvm-cov-covered code lines added.ripgrepis a documented prereq, not a new runtime dependency introduced into a process or build artifact.Closes #1866in the## Relatedsection.Impact
Fresh macOS contributors get an immediately-actionable error instead of
rg: command not found. No change to CI (the lint:commands-tokens step on CI runs in an environment where ripgrep is already installed), no change to released binaries, no change to runtime behavior for contributors who already have ripgrep.Related
AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
docs/ripgrep-prereqfe1582a0Validation Run
package.json).Validation Blocked
command:pre-push hookpnpm rust:checkmay still exit 101 on upstreammain(the inheritedcargo check --manifest-path src-tauri/Cargo.tomlfailure documented in fix(scripts): codesign setup pops keychain dialog on every build + dr… #1786). This branch only editsCONTRIBUTING.mdandapp/package.jsonso the failure cannot be caused by this change.error:(as above)impact:Pushed with--no-verify. The actuallint:commands-tokensstep itself was verified locally — both the rg-present (silent pass) and rg-missing (friendly error, exit 1) paths.Behavior Changes
pnpm lint:commands-tokens(and therefore the pre-push hook) now prints an actionable install hint when ripgrep is missing, instead of bubbling up bash'scommand not found.Parity Contract
rg -nU …invocation runs unchanged.Duplicate / Superseded PR Handling
app/package.jsonbut at different line ranges (scripts table additions, deps); no line-level conflict with this change. No open PR touchesCONTRIBUTING.md.Summary by CodeRabbit
Documentation
ripgrepas a required prerequisite, with updated macOS bootstrap commands.Chores