nrs - npm Run Scripts
A fast, interactive TUI for running npm scripts.
Note: This project was created using Claude Code and AI tools. I am not a Rust expert, and most of the code was generated by AI. Bugs, errors, and unexpected behavior are likely. Contributions, bug reports, and PRs are welcome! If you are sensitive to AI-generated code, please use with caution.
Features
- Fast - Sub-50ms startup time (native Rust binary)
- Interactive - Beautiful TUI with fuzzy search and keyboard navigation
- Smart - Auto-detects your package manager (npm, yarn, pnpm, bun)
- Powerful - Multi-select, history tracking, script descriptions
- Zero-config - Works out of the box, optional config for power users
Quick Start
# Run in any Node.js project
Use arrow keys to navigate, Enter to run, or press 1-9 for quick selection.
Installation
Homebrew (macOS & Linux) - Recommended
Cargo (Windows & all platforms)
From Source
Shell Completions
Generate shell completions for your shell:
# Bash
# Zsh
# Fish
Usage
Basic Commands
# Launch interactive TUI
# Launch TUI for specific project
# List scripts without TUI
# Run a specific script directly
# Rerun last executed script
# Run script with arguments
# Dry run (show command without executing)
Options
nrs [OPTIONS] [PATH]
ARGUMENTS:
[PATH] Path to project directory (default: current directory)
OPTIONS:
-h, --help Show help message
-V, --version Show version
-L, --last Rerun last executed script
-l, --list List scripts non-interactively
-n, --script <NAME> Run script directly without TUI
-a, --args <ARGS> Arguments to pass to the script
-e, --exclude <PATTERN> Exclude scripts matching pattern (repeatable)
-s, --sort <MODE> Sort mode: recent, alpha, category
-r, --runner <RUNNER> Override package manager: npm, yarn, pnpm, bun
-d, --dry-run Show command without executing
-c, --config <PATH> Path to config file
--no-config Ignore config files
--debug Enable debug output
--completions <SHELL> Generate shell completions
Keyboard Shortcuts
Navigation
| Key | Action |
|---|---|
↑ / k |
Move up |
↓ / j |
Move down |
← / h |
Move left |
→ / l |
Move right |
g / Home |
Go to first |
G / End |
Go to last |
Actions
| Key | Action |
|---|---|
Enter |
Run selected script |
1-9 |
Quick run numbered script |
a |
Add arguments |
m |
Toggle multi-select |
Space |
Toggle selection (multi-select) |
Filtering & Sorting
| Key | Action |
|---|---|
/ or type |
Enter filter mode |
Escape |
Clear filter |
s |
Cycle sort mode |
General
| Key | Action |
|---|---|
q / Ctrl+C |
Quit |
? |
Show help |
Configuration
nrs works without configuration, but you can customize it with a config file.
Config File Locations
.nrsrc.tomlin project directory~/.config/nrs/config.toml(global)
Example Configuration
# ~/.config/nrs/config.toml
[]
# Default package manager (overrides auto-detection)
= "pnpm"
# Default sort mode: "recent", "alpha", "category"
= "recent"
# Show command preview in description panel
= true
[]
# Show icons
= true
# Show help footer
= true
# Compact mode (less padding)
= false
[]
# Search in descriptions too
= true
# Enable fuzzy matching
= true
[]
# Enable history tracking
= true
# Max projects to remember
= 100
# Max scripts per project
= 50
[]
# Global patterns to exclude
= [
"pre*",
"post*",
]
[]
# Custom descriptions (override package.json)
[]
= "Start development server"
= "Build for production"
# Script aliases
[]
= "dev"
= "build"
= "test"
Project-Level Config
Create .nrsrc.toml in your project root:
[]
= "yarn"
[]
= ["internal:*"]
Package Manager Detection
nrs automatically detects your package manager:
--runnerCLI flag (highest priority)runnerin config filepackageManagerfield inpackage.json- Lock file detection:
bun.lockb→ bunpnpm-lock.yaml→ pnpmyarn.lock→ yarnpackage-lock.json→ npm
- Fallback: npm
Script Descriptions
nrs reads script descriptions from multiple sources:
scripts-info (recommended)
ntl.descriptions
Comment format
Comparison with ntl
| Feature | nrs | ntl |
|---|---|---|
| Language | Rust | Node.js |
| Startup time | ~30ms | ~300ms |
| Binary | Yes | No (requires Node) |
| Fuzzy search | Yes | Yes |
| Multi-select | Yes | Yes |
| History | Yes | Yes |
| Configuration | Full TOML | Limited |
| Package managers | npm, yarn, pnpm, bun | npm, yarn, pnpm |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | No package.json found |
| 3 | No scripts defined |
| 4 | Script execution failed |
| 5 | Invalid configuration |
| 130 | Interrupted (Ctrl+C) |
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Development
# Clone the repository
# Run tests
# Run with debug output
# Build release
License
MIT License - see LICENSE for details.