proc_cli/lib.rs
1#![warn(missing_docs)]
2//! # proc - Semantic Process Management CLI
3//!
4//! Semantic CLI tool for process management. Target by port, PID, name or path.
5//!
6//! ## Features
7//!
8//! - **Unified Targets**: `:port`, `PID`, and `name` work the same everywhere
9//! - **Multi-Target**: `proc kill :3000,:8080,node` - comma-separated targets
10//! - **Query Language**: `proc by node --in .` - composable filters
11//! - **Working Directory**: See which project folder a process is running from
12//! - **Terminal-Adaptive Tables**: Tables adjust to terminal width automatically
13//! - **Consistent Filters**: `--in`, `--by`, `--min-uptime`, `--parent`, `--range`, `--sort`, `--limit`
14//! - **JSON Output**: `--json` on every command with consistent `{action, success, ...}` envelopes
15//! - **Custom Signals**: `proc stop nginx --signal HUP` - send any signal via `--signal`
16//! - **Real-Time Monitoring**: `proc watch` / `proc top` - live process table (interactive, TTY only)
17//! - **Process Waiting**: `proc wait node` - block until process(es) exit (pipe-friendly)
18//! - **Freeze/Thaw**: `proc freeze` / `proc thaw` - pause and resume by port, PID, or name
19//! - **Port Freeing**: `proc free :3000` - kill and verify port is available
20//! - **Ancestry Tracing**: `proc why :3000` - trace why a port is busy
21//! - **Orphan Detection**: `proc orphans` - find abandoned child processes
22//! - **File Lookup**: `proc for ./script.py` - find by file path
23//! - **Cross-Platform**: macOS, Linux, and Windows
24//! - **Shell Completions**: bash, zsh, fish via `proc completions`
25//! - **Man Pages**: `proc manpage` generates documentation
26//!
27//! ## Quick Start
28//!
29//! ```bash
30//! # What's on port 3000?
31//! proc on :3000
32//!
33//! # What's running this file?
34//! proc for ./script.py
35//!
36//! # Kill multiple targets
37//! proc kill :3000,:8080,node
38//!
39//! # Node processes in current directory
40//! proc by node --in .
41//!
42//! # Preview before killing
43//! proc kill node --dry-run
44//!
45//! # Kill only node processes in current directory
46//! proc kill node --in .
47//!
48//! # Watch processes in real-time
49//! proc watch node --in .
50//!
51//! # Wait for a process to finish
52//! proc wait node --timeout 3600
53//!
54//! # Free a port (kill + verify available)
55//! proc free :3000
56//!
57//! # Why is this port busy?
58//! proc why :3000
59//!
60//! # Pause and resume
61//! proc freeze node && proc thaw node
62//!
63//! # Send custom signal
64//! proc stop nginx --signal HUP
65//!
66//! # JSON output for scripting/LLMs
67//! proc by node --json
68//!
69//! # Generate shell completions
70//! proc completions zsh > ~/.zsh/completions/_proc
71//! ```
72//!
73//! ## Commands
74//!
75//! **Discovery**: `on`, `for`, `by`, `in`, `list`, `info`, `ports`, `tree`, `stuck`, `why`, `orphans`
76//!
77//! **Lifecycle**: `kill`, `stop`, `unstick`, `freeze`, `thaw`, `free`
78//!
79//! **Monitoring**: `watch` (interactive TUI), `wait` (blocking, pipe-friendly)
80//!
81//! **Tooling**: `completions`, `manpage`
82
83pub mod commands;
84pub mod core;
85pub mod error;
86pub mod ui;
87
88pub use error::{ProcError, Result};
89
90/// Library version
91pub const VERSION: &str = env!("CARGO_PKG_VERSION");