From 699d07ea364ef96c513d2b52a773d617a6dfb9e6 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Sat, 30 Aug 2025 15:11:38 +0000 Subject: [PATCH] feat(cli): Preserve CLI environment when adding processes, simplify edit flow, and refresh README docs --- changelog.md | 7 + readme.md | 401 +++++++++++++++++++++++--------- ts/00_commitinfo_data.ts | 2 +- ts/cli/commands/process/add.ts | 31 ++- ts/cli/commands/process/edit.ts | 125 ++++------ 5 files changed, 368 insertions(+), 198 deletions(-) diff --git a/changelog.md b/changelog.md index 6927267..5c54011 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2025-08-30 - 5.2.0 - feat(cli) +Preserve CLI environment when adding processes, simplify edit flow, and refresh README docs + +- CLI: When adding a process, capture and persist essential environment variables from the CLI (PATH, HOME, USER, SHELL, LANG, LC_ALL, NODE_ENV, NODE_PATH, npm_config_prefix and any TSPM_* variables). Undefined values are removed before storing. +- CLI: Interactive edit flow temporarily disabled. The edit command now displays the current configuration and updates stored environment variables to match the current CLI environment. +- Docs: Major README refresh — reorganized sections, clarified add vs start semantics, expanded examples, added daemon/service usage and programmatic API examples, and improved command reference and output examples. + ## 2025-08-30 - 5.1.0 - feat(cli) Add interactive edit command and update support for process configurations diff --git a/readme.md b/readme.md index b48bffd..88e57df 100644 --- a/readme.md +++ b/readme.md @@ -2,94 +2,97 @@ **TypeScript Process Manager** - A robust, no-fuss process manager designed specifically for TypeScript and Node.js applications. Built for developers who need reliable process management without the complexity. -## 🎯 What TSPM Does +## 🎯 What is TSPM? -TSPM is your production-ready process manager that handles the hard parts of running Node.js applications: +TSPM (TypeScript Process Manager) is your production-ready process manager that handles the hard parts of running Node.js applications. It's like PM2, but built from the ground up for the modern TypeScript ecosystem with better memory management, intelligent logging, and a cleaner architecture. -- **Automatic Memory Management** - Set memory limits and let TSPM handle the rest -- **Smart Auto-Restart** - Crashed processes come back automatically (when you want them to) -- **File Watching** - Auto-restart on file changes during development -- **Process Groups** - Track parent and child processes together -- **Daemon Architecture** - Survives terminal sessions with a persistent background daemon -- **Beautiful CLI** - Clean, informative terminal output with real-time status -- **Structured Logging** - Capture and manage stdout/stderr with intelligent buffering -- **Zero Config** - Works out of the box, customize when you need to +### ✨ Key Features + +- **🧠 Smart Memory Management** - Tracks memory including child processes, enforces limits, and auto-restarts when exceeded +- **💾 Persistent Log Storage** - Keeps 10MB of logs in memory, persists to disk on restart/stop/error +- **🔄 Intelligent Auto-Restart** - Automatically restarts crashed processes with configurable policies +- **👀 File Watching** - Auto-restart on file changes for seamless development +- **🌳 Process Group Tracking** - Monitors parent and all child processes as a unit +- **🏗️ Daemon Architecture** - Survives terminal sessions with Unix socket IPC +- **📊 Beautiful CLI** - Clean, informative output with real-time status updates +- **📝 Structured Logging** - Captures stdout/stderr with timestamps and metadata +- **⚡ Zero Config** - Works out of the box, customize when needed +- **🔌 System Service** - Run as systemd service for production deployments ## 📦 Installation ```bash -# Install globally +# Install globally (recommended) npm install -g @git.zone/tspm -# Or with pnpm (recommended) +# Or with pnpm pnpm add -g @git.zone/tspm -# Or use in your project +# Or as a dev dependency npm install --save-dev @git.zone/tspm ``` ## 🚀 Quick Start ```bash -# Start the daemon (happens automatically on first use) -tspm daemon start +# Add a process (creates config without starting) +tspm add "node server.js" --name my-server --memory 1GB -# Start a process -tspm start server.js --name my-server +# Start the process +tspm start my-server -# Start with memory limit -tspm start app.js --memory 512MB --name my-app - -# Start with file watching (great for development) -tspm start dev.js --watch --name dev-server +# Or add and start in one go +tspm add "node app.js" --name my-app +tspm start my-app # List all processes tspm list -# Check process details -tspm describe my-server - # View logs -tspm logs my-server --lines 100 +tspm logs my-app # Stop a process -tspm stop my-server - -# Restart a process -tspm restart my-server +tspm stop my-app ``` -## 📋 Command Reference +## 📋 Commands ### Process Management -#### `tspm start