npm_run_scripts/lib.rs
1//! nrs - npm Run Scripts
2//!
3//! A fast, interactive terminal user interface (TUI) for discovering
4//! and executing npm/yarn/pnpm/bun scripts defined in `package.json` files.
5//!
6//! # Features
7//!
8//! - **Fast**: Sub-50ms startup time (Rust native binary)
9//! - **Intuitive**: Number keys for quick execution, fuzzy search, visual grid
10//! - **Smart**: Auto-detect package manager, remember history, show descriptions
11//! - **Cross-platform**: Linux and macOS support
12//! - **Zero-config**: Works out of the box, optional configuration for power users
13//!
14//! # Modules
15//!
16//! - [`cli`] - Command-line interface argument parsing
17//! - [`config`] - Configuration file loading and types
18//! - [`error`] - Error types and result helpers
19//! - [`filter`] - Fuzzy filtering for scripts
20//! - [`history`] - Script execution history tracking
21//! - [`package`] - Package.json parsing and package manager detection
22//! - [`runner`] - Script execution
23//! - [`tui`] - Terminal user interface
24//! - [`utils`] - Path and terminal utilities
25//!
26//! # Example
27//!
28//! ```no_run
29//! use npm_run_scripts::package::{parse_scripts, detect_runner, Runner};
30//! use std::path::Path;
31//!
32//! // Parse scripts from a project
33//! let project_dir = Path::new("./my-project");
34//! let scripts = parse_scripts(project_dir).expect("Failed to parse scripts");
35//!
36//! // Detect the package manager
37//! let runner = detect_runner(project_dir);
38//!
39//! // Get the command for a script
40//! let cmd = runner.run_command("dev");
41//! println!("Command: {:?}", cmd);
42//! ```
43
44/// CLI argument definitions.
45pub mod cli;
46
47/// Configuration system for loading and merging settings.
48pub mod config;
49
50/// Error types and result helpers.
51pub mod error;
52
53/// Fuzzy filtering for scripts.
54pub mod filter;
55
56/// Script execution history tracking.
57pub mod history;
58
59/// Package.json parsing and package manager detection.
60pub mod package;
61
62/// Script execution.
63pub mod runner;
64
65/// Terminal user interface.
66pub mod tui;
67
68/// Path and terminal utilities.
69pub mod utils;
70
71// Re-export commonly used types
72pub use cli::Cli;
73pub use config::Config;
74pub use error::{NrsError, Result};
75pub use package::{Runner, Script, Scripts};