### Install and start with npm/npx Source: https://github.com/ascorbic/bgproc/blob/main/README.md Install bgproc globally with npm, then start a process using npx. The npx command shows an example of starting a process named myserver with the command npm run dev. ```bash npm install -g bgproc # or using npx npx bgproc start -n myserver -- npm run dev ``` -------------------------------- ### bgproc start command examples Source: https://github.com/ascorbic/bgproc/blob/main/SKILL.md Shows various ways to start a background process with bgproc, including setting a name, command, timeout, waiting for port, and force restarting. Use -w to wait for port detection before returning, -t to auto-kill after a timeout (e.g., 300 seconds = 5 minutes), and -f to force restart if a process with the same name is already running. ```bash # Start a process bgproc start -n -- bgproc start -n devserver -- npm run dev bgproc start -n devserver -t 300 -- npm run dev # auto-kill after 5 min # Start and wait for port (recommended for dev servers) bgproc start -n devserver -w -- npm run dev # wait for port, then exit bgproc start -n devserver -w 30 -- npm run dev # wait up to 30s for port # Force restart (kill existing process first) bgproc start -n devserver -f -w -- npm run dev ``` -------------------------------- ### bgproc command-line usage examples Source: https://github.com/ascorbic/bgproc/blob/main/README.md Core bgproc commands for starting, restarting, viewing status, logs, listing, stopping, and cleaning processes. Covers options like -w (wait for port), -f (force restart), --tail, --follow, --errors, --cwd, --force, and dual forms (name argument or -n) for status and stop. ```bash # Start a process bgproc start -n myserver -- npm run dev # Start and wait for port to be detected (great for dev servers) bgproc start -n myserver -w -- npm run dev # Streams logs to stderr, prints JSON with port to stdout when ready # Force restart (kills existing process with same name) bgproc start -n myserver -f -w -- npm run dev # Restart with same command and cwd bgproc restart myserver bgproc restart myserver -w # wait for port # Check status (returns JSON with port detection) bgproc status myserver # {"name":"myserver","pid":12345,"running":true,"port":3000,...} # View logs bgproc logs myserver bgproc logs myserver --tail 50 bgproc logs myserver --follow bgproc logs myserver --errors # stderr only # List all processes bgproc list bgproc list --cwd # filter to current directory bgproc list --cwd /path/to/dir # filter to specific directory # Stop a process bgproc stop myserver bgproc stop myserver --force # SIGKILL # Clean up dead processes bgproc clean myserver bgproc clean --all ``` -------------------------------- ### bgproc restart command examples Source: https://github.com/ascorbic/bgproc/blob/main/SKILL.md Shows how to restart a background process with the same command and working directory. The restart command kills the process first if it is still running. Use -w to wait for port detection after restart. ```bash # Restart with same command and cwd (kills if running) bgproc restart bgproc restart -w # wait for port after restart ``` -------------------------------- ### AGENTS.md / CLAUDE.md workflow snippet Source: https://github.com/ascorbic/bgproc/blob/main/README.md Markdown snippet to add to AGENTS.md or CLAUDE.md project instructions. It outlines a bgproc workflow: start, status, restart, logs, stop. Use it for consistent agent behavior. ```markdown ## Background Processes Use `bgproc` to manage dev servers and background processes. All commands output JSON. Workflow: 1. `bgproc start -n devserver -- npm run dev` - Start a process 2. `bgproc status devserver` - Check if running, get port 3. `bgproc restart devserver` - Restart with same command 4. `bgproc logs devserver` - View output if something's wrong 5. `bgproc stop devserver` - Stop when done ``` -------------------------------- ### Build and Development Commands Source: https://github.com/ascorbic/bgproc/blob/main/CLAUDE.md Commands for building, testing, linting, and formatting the project. Tests require a build first since they run against dist/cli.mjs. ```bash pnpm build # Build with tsdown (outputs to dist/) pnpm dev # Build in watch mode pnpm test # Run tests in watch mode pnpm test run # Run tests once pnpm lint # Run oxlint pnpm lint:fix # Run oxlint with auto-fix pnpm format # Format with oxfmt ``` -------------------------------- ### bgproc status, logs, list, stop, and clean commands Source: https://github.com/ascorbic/bgproc/blob/main/SKILL.md Shows commands for checking process status, viewing logs, listing processes, stopping processes, and cleaning up dead processes. Status returns JSON with pid, running state, and port. Logs can be tailed or filtered to stderr only. Stop with --force uses SIGKILL. Clean removes dead processes. ```bash # Check status (returns JSON with pid, running state, port) bgproc status # View logs bgproc logs bgproc logs --tail 50 bgproc logs --errors # stderr only # List all processes bgproc list bgproc list --cwd # filter to current directory # Stop a process bgproc stop bgproc stop --force # SIGKILL # Clean up dead processes bgproc clean bgproc clean --all ``` -------------------------------- ### Prompt for AI agent usage Source: https://github.com/ascorbic/bgproc/blob/main/README.md A simple instruction to give an AI agent, telling it to use bgproc for managing the dev server and to run bgproc --help for command details. ```plaintext Use bgproc to start and manage the dev server. Run bgproc --help to see available commands. ``` -------------------------------- ### Add bgproc skill via npx Source: https://github.com/ascorbic/bgproc/blob/main/README.md Adds the bgproc skill to an AI coding assistant (works with Claude Code, Cursor, Codex, and other AI coding tools) for richer context. ```bash npx skills add ascorbic/bgproc ``` -------------------------------- ### status command: positional and -n forms Source: https://github.com/ascorbic/bgproc/blob/main/README.md Shows that status (and also stop, logs, clean) accept the process name either as a positional argument or via the -n flag, which are equivalent. ```bash bgproc status myserver bgproc status -n myserver # equivalent ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.