Skip to content

feat(tools): add native binary tool management (npx alternative) #44

@CalvinAllen

Description

@CalvinAllen

Summary

Add the ability for rnr to download and manage native CLI tools from GitHub releases, providing an npx-like experience without requiring Node.js.

Motivation

Many projects use npx to run tools like commitlint, prettier, etc. This requires Node.js to be installed. With the growing ecosystem of native CLI tools (Rust, Go, etc.), rnr could provide a way to download and run these tools without any runtime dependencies.

Example use case: Replace husky + commitlint with a native alternative:

# Before (requires Node.js)
npx --no -- commitlint --edit $1

# After (no Node.js needed)
./rnr lint-commit "$1"

Proposed Design

rnr.yaml tools section

# Define tool dependencies
tools:
  cog: cocogitto/cocogitto@6.1.0
  dprint: dprint/dprint@0.45.0

# Tasks can reference tools
lint-commit:
  description: Validate commit message
  cmd: ${tools.cog} check --edit ${1}

format:
  cmd: ${tools.dprint} fmt

New commands

rnr tools install          # Download all tools to .rnr/tools/
rnr tools install cog      # Download specific tool
rnr tools update           # Update tools to latest versions
rnr tools list             # Show installed tools

rnr hooks install          # Set up git hooks that call rnr tasks
rnr hooks remove           # Remove git hooks

Tool resolution

  1. Parse owner/repo@version format
  2. Fetch release from GitHub API
  3. Download appropriate binary for current platform
  4. Cache in .rnr/tools/ (gitignored) or .rnr/bin/ (committed)
  5. Make executable

Git hooks integration

rnr hooks install would create hooks in .git/hooks/ that delegate to rnr:

#!/bin/sh
# .git/hooks/commit-msg
./rnr lint-commit "$1"

Native alternatives to common npx tools

npx tool Native alternative Language
commitlint cocogitto Rust
prettier dprint Rust
eslint oxlint Rust
typescript swc Rust
husky (git hooks directly) -

Open questions

  • Should tools be committed (like binaries) or downloaded on first use?
  • How to handle tool versioning and updates?
  • Should there be a central registry or just GitHub releases?
  • How to handle tools that aren't on GitHub?

Priority

Low - nice to have for future enhancement.

Metadata

Metadata

Assignees

Labels

futureFuture feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions