Skip to content

fix(lint): make commands-tokens script fail with a clear error when ripgrep is missing + add to CONTRIBUTING prereqs#1867

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
aregmii:docs/ripgrep-prereq
May 16, 2026
Merged

fix(lint): make commands-tokens script fail with a clear error when ripgrep is missing + add to CONTRIBUTING prereqs#1867
senamakel merged 1 commit into
tinyhumansai:mainfrom
aregmii:docs/ripgrep-prereq

Conversation

@aregmii
Copy link
Copy Markdown
Contributor

@aregmii aregmii commented May 15, 2026

Summary

  • Adds ripgrep (rg) to the prerequisites table in CONTRIBUTING.md (right after Ninja) with a one-line note explaining it's needed by the lint:commands-tokens pre-push step.
  • Appends ripgrep to the macOS bootstrap snippet's brew install line.
  • Wraps lint:commands-tokens in app/package.json with a command -v rg guard that prints an actionable install hint (brew / apt / upstream link) and exits 1 — instead of falling through to a cryptic rg: command not found.

Problem

After following CONTRIBUTING.md exactly on a clean macOS install, the first git push triggers the pre-push hook → pnpm lint:commands-tokensbash: 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: prepend command -v rg >/dev/null 2>&1 || { echo "…" >&2; exit 1; }; to the existing lint:commands-tokens bash command. JSON validity verified with node -e 'JSON.parse(require("fs").readFileSync("app/package.json"))'.

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.

Submission Checklist

  • N/A — script-prefix change; the existing happy-path test is pnpm lint:commands-tokens itself, which still passes with rg present (verified locally).
  • N/A — script string change in package.json; no Vitest- or cargo-llvm-cov-covered code lines added.
  • N/A — no feature rows affected.
  • N/A — no feature IDs touched.
  • N/A — ripgrep is a documented prereq, not a new runtime dependency introduced into a process or build artifact.
  • N/A — no release-cut surfaces touched (release builds don't run pre-push hooks).
  • Linked issue closed via Closes #1866 in the ## Related section.

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)

N/A — Human-authored fix. AI-assisted drafting; not a Codex/Linear autonomous PR.

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: docs/ripgrep-prereq
  • Commit SHA: fe1582a0

Validation Run

  • N/A — no JS/TS source files changed (only the script-string in package.json).
  • N/A — no TS types changed.
  • N/A — no TS to compile (only the script value changed; tsc doesn't read scripts).
  • N/A — no Rust changed.
  • N/A — no Tauri code changed.

Validation Blocked

  • command: pre-push hook pnpm rust:check may still exit 101 on upstream main (the inherited cargo check --manifest-path src-tauri/Cargo.toml failure documented in fix(scripts): codesign setup pops keychain dialog on every build + dr… #1786). This branch only edits CONTRIBUTING.md and app/package.json so the failure cannot be caused by this change.
  • error: (as above)
  • impact: Pushed with --no-verify. The actual lint:commands-tokens step itself was verified locally — both the rg-present (silent pass) and rg-missing (friendly error, exit 1) paths.

Behavior Changes

  • Intended behavior change: 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's command not found.
  • User-visible effect: fresh macOS contributors no longer have to grep the pre-push hook source to figure out why their first push failed.

Parity Contract

  • Legacy behavior preserved: Yes — for contributors who already have ripgrep, the guard short-circuits in microseconds and the existing rg -nU … invocation runs unchanged.
  • Guard/fallback/dispatch parity checks: N/A — no dispatch path touched.

Duplicate / Superseded PR Handling

Summary by CodeRabbit

  • Documentation

    • Updated development setup instructions to include ripgrep as a required prerequisite, with updated macOS bootstrap commands.
  • Chores

    • Enhanced linting script validation to verify required tooling is installed and provide clearer error guidance when dependencies are missing.

Review Change Stack

…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.
@aregmii aregmii requested a review from a team May 15, 2026 22:25
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

📝 Walkthrough

Walkthrough

Prerequisites 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.

Changes

Ripgrep Prerequisite and Error Handling

Layer / File(s) Summary
Ripgrep documentation and error check
CONTRIBUTING.md, app/package.json
Prerequisites table and macOS bootstrap command add ripgrep to the documented setup steps. The lint:commands-tokens script checks for ripgrep availability and displays an actionable error message if the tool is unavailable, replacing a bare shell command failure.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐰 A tool was missing, a developer's plight,
rg wasn't found on a fresh setup night.
Now docs point the way, with clear signs ahead,
And scripts show their hearts when ripgrep has fled.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed All coding requirements from issue #1866 are met: ripgrep documented in CONTRIBUTING.md, added to macOS bootstrap, and lint:commands-tokens includes a presence check that prints actionable install hints and exits 1.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the objectives in issue #1866: documenting ripgrep and guarding the lint:commands-tokens script without removing dependencies or adding platform-specific install flows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately summarizes the main changes: adding ripgrep to CONTRIBUTING prerequisites and making the lint:commands-tokens script fail clearly when ripgrep is missing.

✏️ 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.

❤️ Share

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

@aregmii aregmii changed the title docs(CONTRIBUTING): document ripgrep prereq + fail lint:commands-tokens loudly without it fix(lint): make commands-tokens script fail with a clear error when ripgrep is missing + add to CONTRIBUTING prereqs May 15, 2026
@senamakel senamakel merged commit c9bb60f into tinyhumansai:main May 16, 2026
24 of 26 checks passed
@aregmii aregmii deleted the docs/ripgrep-prereq branch May 16, 2026 03:46
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.

fix(lint): commands-tokens script fails without ripgrep; add to prereqs

2 participants