@git.zone/tspm

no fuzz process manager.

readme.md for @git.zone/tspm

TypeScript Process Manager — A robust, no-fuss process manager built for the modern TypeScript and Node.js ecosystem. Production-ready process management without the bloat.

Issue Reporting and Security

For reporting bugs, issues, or security vulnerabilities, please visit community.foss.global/. This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a code.foss.global/ account to submit Pull Requests directly.

🎯 What is TSPM?

TSPM is your production-ready process manager that handles the hard parts of running Node.js applications. Think PM2, but built from scratch for the TypeScript-first ecosystem with better memory management, intelligent logging, a clean daemon architecture, and native ESM support.

✨ Key Features

📦 Installation

# Global install (recommended)
pnpm add -g @git.zone/tspm

# Or with npm
npm install -g @git.zone/tspm

# Or as a project dependency
pnpm add --save-dev @git.zone/tspm

🚀 Quick Start

# Start the daemon
tspm daemon start

# Add a process
tspm add "node server.js" --name my-server --memory 1GB

# Start it
tspm start name:my-server

# See what's running
tspm list

# View logs
tspm logs name:my-server

# Stop it
tspm stop name:my-server

📋 CLI Reference

Targeting Processes

Most commands accept flexible process targeting:

Format Example Description
Numeric ID tspm start 1 Direct ID reference
id:N tspm start id:1 Explicit ID prefix
name:LABEL tspm start name:api Target by name

Use tspm search <query> to find processes by name or ID substring.

Process Management

tspm add <command> [options]

Register a new process configuration (without starting it).

Option Description Default
--name <name> Process name command string
--memory <size> Memory limit (e.g. 512MB, 2GB) 512MB
--cwd <path> Working directory current directory
--watch Enable file watching false
--watch-paths <paths> Comma-separated watch paths
--autorestart Auto-restart on crash true
-i, --interactive Enter interactive edit after adding
# Simple Node.js app
tspm add "node server.js" --name api-server

# TypeScript with 2GB memory limit
tspm add "tsx src/index.ts" --name production-api --memory 2GB

# Dev mode with file watching
tspm add "tsx watch src/index.ts" --name dev-server --watch --watch-paths "src,config"

# One-shot worker (no auto-restart)
tspm add "node worker.js" --name batch-job --autorestart false

# Add + interactive edit
tspm add "node server.js" --name api -i

tspm start <target>

Start a registered process.

tspm start name:my-server
tspm start id:1
tspm start 1          # bare numeric id also works

tspm stop <target>

Gracefully stop a process (SIGTERM → 5s grace → SIGKILL).

tspm stop name:my-server

tspm restart <target>

Stop and restart a process, preserving its configuration.

tspm restart name:my-server

tspm delete <target>

Stop, remove from management, and delete persisted logs.

tspm delete name:old-server

tspm edit <target>

Interactively modify a process configuration (name, command, memory, etc.).

tspm edit name:my-server

tspm search <query>

Search processes by name or ID substring.

tspm search api
# Matches for "api":
#   id:3    name:api-server

Monitoring

tspm list

Display all managed processes in a table.

┌─────┬─────────────┬──────────┬───────┬──────────┬──────────┐
│ ID  │ Name        │ Status   │ PID   │ Memory   │ Restarts │
├─────┼─────────────┼──────────┼───────┼──────────┼──────────┤
│ 1   │ my-app      │ online   │ 45123 │ 245.3 MB │ 0        │
│ 2   │ worker      │ online   │ 45456 │ 128.7 MB │ 2        │
│ 3   │ api-server  │ stopped  │ -     │ 0 B      │ 5        │
└─────┴─────────────┴──────────┴───────┴──────────┴──────────┘

tspm describe <target>

Detailed information about a specific process.

tspm describe name:my-server

# Process Details: my-server
# ────────────────────────────────────────
# Status:       online
# PID:          45123
# Memory:       245.3 MB
# Uptime:       3600s
# Restarts:     0
#
# Configuration:
# ────────────────────────────────────────
# Command:      node server.js
# Directory:    /home/user/project
# Memory Limit: 2 GB
# Auto-restart: true
# Watch:        disabled

tspm logs <target> [options]

View and stream process logs.

Option Description Default
--lines <n> Number of lines 50
--since <dur> Time filter (10m, 2h, 1d)
--stderr-only Only stderr
--stdout-only Only stdout
--ndjson Output as newline-delimited JSON
--follow Real-time streaming (like tail -f)
# View last 50 lines
tspm logs name:my-server

# Last 100 lines of stderr only
tspm logs name:my-server --lines 100 --stderr-only

# Stream logs in real time
tspm logs name:my-server --follow

# NDJSON output since 10 minutes ago
tspm logs name:my-server --since 10m --ndjson

Batch Operations

tspm start-all      # Start all saved processes
tspm stop-all       # Stop all running processes
tspm restart-all    # Restart all running processes
tspm reset          # ⚠️ Stop all + clear all configs (prompts for confirmation)

Daemon Management

The daemon is a persistent background service that manages all processes. It starts automatically when needed.

tspm daemon start     # Start the daemon
tspm daemon stop      # Stop daemon + all managed processes
tspm daemon restart   # Restart daemon (preserves processes)
tspm daemon status    # Check daemon health + stats

System Service (systemd)

sudo tspm enable      # Install + enable as systemd service (auto-start on boot)
sudo tspm disable     # Remove systemd service

Version Check

tspm -v
# tspm CLI: 5.x.y
# Daemon: running v5.x.z (pid 1234)
# Version mismatch detected → optionally refresh the systemd service

🏗️ Architecture

TSPM uses a clean three-tier architecture:

┌─────────────────────────────────────────┐
│            CLI Interface                │
│         (tspm commands)                 │
└────────────────┬────────────────────────┘
                 │ Unix Socket IPC
┌────────────────▼────────────────────────┐
│          TSPM Daemon                    │
│     (Background Service)                │
│  ┌──────────────────────────────────┐  │
│  │     ProcessManager               │  │
│  │  - Configuration persistence     │  │
│  │  - Process lifecycle             │  │
│  │  - Desired state management      │  │
│  └────────────┬─────────────────────┘  │
│               │                         │
│  ┌────────────▼─────────────────────┐  │
│  │     ProcessMonitor                │  │
│  │  - Memory tracking & limits      │  │
│  │  - Auto-restart logic            │  │
│  │  - Log persistence (10MB)        │  │
│  │  - File watching                 │  │
│  └────────────┬─────────────────────┘  │
│               │                         │
│  ┌────────────▼─────────────────────┐  │
│  │     ProcessWrapper                │  │
│  │  - Process spawning              │  │
│  │  - Stream handling               │  │
│  │  - Signal management             │  │
│  └──────────────────────────────────┘  │
│                                         │
│  ┌──────────────────────────────────┐  │
│  │     CrashLogManager              │  │
│  │  - Crash report generation       │  │
│  │  - Log rotation (max 100)        │  │
│  └──────────────────────────────────┘  │
└─────────────────────────────────────────┘

Key Components

Component Role
CLI Lightweight client that sends commands to daemon via IPC
Daemon Persistent background service managing all processes
ProcessManager High-level orchestration, config persistence, state management
ProcessMonitor Memory limits, auto-restart with backoff, log persistence, file watching
ProcessWrapper Low-level process lifecycle, stream handling, signal management
CrashLogManager Detailed crash reports with metadata and log history

🎮 Programmatic API

TSPM exposes a typed IPC client for programmatic use:

import { TspmIpcClient } from '@git.zone/tspm/client';

const client = new TspmIpcClient();
await client.connect();

// Add a process configuration
const { id } = await client.request('add', {
  config: {
    command: 'node worker.js',
    name: 'background-worker',
    projectDir: process.cwd(),
    memoryLimitBytes: 512 * 1024 * 1024,
    autorestart: true,
  },
});

// Start it
await client.request('startById', { id });

// Get process info
const { processInfo } = await client.request('describe', { id });
console.log(`Status: ${processInfo.status}, Memory: ${processInfo.memory} bytes`);

// Get logs
const { logs } = await client.request('getLogs', { id, limit: 100 });
logs.forEach(log => console.log(`[${log.timestamp}] [${log.type}] ${log.message}`));

// Stop and remove
await client.request('stop', { id });
await client.request('delete', { id });
await client.disconnect();

Module Exports

Export Path Purpose
@git.zone/tspm Main entry point (re-exports client + daemon)
@git.zone/tspm/client IPC client (TspmIpcClient, TspmServiceManager)
@git.zone/tspm/daemon Daemon entry point (startDaemon)
@git.zone/tspm/protocol IPC type definitions

🔧 Advanced Features

Restart Backoff & Failure Handling

TSPM handles crashed processes with intelligent backoff:

Memory Management

Full process tree memory tracking:

Log Persistence

Smart in-memory log management:

Graceful Shutdown

Multi-stage shutdown for reliability:

  1. Send SIGTERM for graceful shutdown
  2. Wait 5 seconds for process cleanup
  3. Send SIGKILL if still alive
  4. Clean up all child processes in the tree

File Watching

Development-friendly auto-restart:

🐛 Debugging

# Check daemon status
tspm daemon status

# View process logs
tspm logs name:my-app --lines 200

# Check daemon stderr
tail -f /tmp/daemon-stderr.log

# Force daemon restart
tspm daemon restart

Common issues:

Problem Solution
"Daemon not running" tspm daemon start or sudo tspm enable
"Permission denied" Check socket permissions in ~/.tspm/
Process won't start Check logs with tspm logs <target>
Memory limit exceeded Increase with tspm edit <target>

🤝 Why TSPM?

Feature TSPM PM2
TypeScript Native ✅ Built in TypeScript ❌ JavaScript
Memory Tracking ✅ Full process tree ⚠️ Main process only
Log Management ✅ Smart 10MB buffer ⚠️ Can grow unbounded
Architecture ✅ Clean 3-tier daemon ❌ Monolithic
Dependencies ✅ Minimal ❌ Heavy
ESM Support ✅ Native ⚠️ Partial
Crash Reports ✅ Detailed with metadata ❌ Basic

Perfect For

This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the LICENSE file.

Please note: The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.

Trademarks

This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.

Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.

Company Information

Task Venture Capital GmbH Registered at District Court Bremen HRB 35230 HB, Germany

By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

changelog.md for @git.zone/tspm

2026-03-24 - 5.10.4 - fix(crash-logging)

migrate filesystem persistence to smartfs and stabilize crash log tests

2026-03-24 - 5.10.3 - fix(config)

replace npmextra with smartconfig for daemon key-value storage and release settings

2025-09-03 - 5.10.2 - fix(processmonitor)

Bump smartdaemon and stop aggressive pidusage cache clearing in ProcessMonitor

2025-09-03 - 5.10.1 - fix(processmonitor)

Skip null pidusage entries when aggregating process-group memory/CPU to avoid errors

2025-09-01 - 5.10.0 - feat(daemon)

Add crash log manager with rotation and integrate crash logging; improve IPC & process listener cleanup

2025-08-31 - 5.9.0 - feat(cli)

Add interactive edit flow to CLI and improve UX

2025-08-31 - 5.8.0 - feat(core)

Add core TypeScript TSPM implementation: CLI, daemon, client, process management and tests

2025-08-31 - 5.7.0 - feat(cli)

Add 'stats' CLI command and daemon stats aggregation; fix process manager & wrapper state handling

2025-08-31 - 5.6.2 - fix(processmanager)

Improve process lifecycle handling and cleanup in daemon, monitors and wrappers

2025-08-31 - 5.6.1 - fix(daemon)

Ensure robust process shutdown and improve logs/subscriber diagnostics

2025-08-30 - 5.6.0 - feat(processmonitor)

Add CPU monitoring and display CPU in process list

2025-08-30 - 5.5.0 - feat(logs)

Improve logs streaming and backlog delivery; add CLI filters and ndjson output

2025-08-30 - 5.4.2 - fix(cli/process/logs)

Reset log sequence on process restart to avoid false log gap warnings

2025-08-30 - 5.4.1 - fix(processmonitor)

Bump tsbuild devDependency and relax ps-tree callback typing in ProcessMonitor

2025-08-30 - 5.4.0 - feat(daemon)

Add CLI systemd service refresh on version mismatch and fix daemon memory leak; update dependencies

2025-08-30 - 5.3.2 - fix(daemon)

Improve daemon log delivery and process monitor memory accounting; gate debug output and update tests to numeric ProcessId

2025-08-30 - 5.3.1 - fix(client(tspmIpcClient))

Use bare topic names for IPC client subscribe/unsubscribe to fix log subscription issues

2025-08-30 - 5.3.0 - feat(cli/daemon/processmonitor)

Add flexible target resolution and search command; improve restart/backoff and error handling

2025-08-30 - 5.2.0 - feat(cli)

Preserve CLI environment when adding processes, simplify edit flow, and refresh README docs

2025-08-30 - 5.1.0 - feat(cli)

Add interactive edit command and update support for process configurations

2025-08-30 - 5.0.0 - BREAKING CHANGE(daemon)

Introduce persistent log storage, numeric ProcessId type, and improved process monitoring / IPC handling

2025-08-29 - 4.4.2 - fix(daemon)

Fix daemon IPC id handling, reload configs on demand and correct CLI daemon start path

2025-08-29 - 4.4.1 - fix(cli)

Use server-side start-by-id flow for starting processes

2025-08-29 - 4.4.0 - feat(daemon)

Persist desired process states and add daemon restart command

2025-08-29 - 4.3.1 - fix(daemon)

Fix daemon describe handler to return correct process info and config; bump @push.rocks/smartipc to ^2.2.2

2025-08-29 - 4.3.0 - feat(cli)

Correct CLI plugin imports and add reset command/IPC to stop processes and clear persisted configs

2025-08-29 - 4.2.0 - feat(cli)

Add 'reset' CLI command to stop all processes and clear saved configurations; integrate interactive confirmation and client plugin updates

2025-08-29 - 4.1.1 - fix(daemon)

Bump @push.rocks/smartdaemon to ^2.0.9

2025-08-29 - 4.1.0 - feat(cli)

Add support for restarting all processes from CLI; improve usage message and reporting

2025-08-29 - 4.0.0 - BREAKING CHANGE(cli)

Add persistent process registration (tspm add), alias remove, and change start to use saved process IDs (breaking CLI behavior)

2025-08-29 - 3.1.3 - fix(client)

Improve IPC client robustness and daemon debug logging; update tests and package metadata

2025-08-28 - 3.1.2 - fix(daemon)

Reorganize project into daemon/client/shared layout, update imports and protocol, rename Tspm → ProcessManager, and bump smartipc to ^2.1.3

2025-08-28 - 3.1.1 - fix(cli)

Fix internal imports, centralize IPC types and improve daemon entry/start behavior

2025-08-28 - 3.1.0 - feat(daemon)

Reorganize and refactor core into client/daemon/shared modules; add IPC protocol and tests

2025-08-28 - 3.0.2 - fix(daemon)

Ensure TSPM runtime dir exists and improve daemon startup/debug output

2025-08-28 - 3.0.0 - BREAKING CHANGE(daemon)

Refactor daemon and service management: remove IPC auto-spawn, add TspmServiceManager, tighten IPC/client/CLI behavior and tests

2025-08-28 - 2.0.0 - BREAKING CHANGE(daemon)

Refactor daemon lifecycle and service management: remove IPC auto-spawn, add TspmServiceManager and CLI enable/disable

2025-08-26 - 1.8.0 - feat(daemon)

Add real-time log streaming and pub/sub: daemon publishes per-process logs, IPC client subscribe/unsubscribe, CLI --follow streaming, and sequencing for logs

2025-08-25 - 1.7.0 - feat(readme)

Add comprehensive README with detailed usage, command reference, daemon management, architecture and development instructions

2025-08-25 - 1.6.1 - fix(daemon)

Fix smartipc integration and add daemon/ipc integration tests

2025-08-25 - 1.6.0 - feat(daemon)

Add central TSPM daemon and IPC client; refactor CLI to use daemon and improve monitoring/error handling

2025-03-10 - 1.5.1 - fix(core)

Improve error handling, logging, and test suite; update dependency versions

2025-03-04 - 1.5.0 - feat(cli)

Enhance CLI with new process management commands

2025-03-03 - 1.4.0 - feat(core)

Introduced process management features using ProcessWrapper and enhanced configuration.

2025-03-01 - 1.3.1 - fix(test)

Update test script to fix type references and remove private method call

2025-03-01 - 1.3.0 - feat(cli)

Add CLI support with command parsing and version display

2025-03-01 - 1.2.0 - feat(core)

Introduce ProcessMonitor with memory management and spawning features

2025-03-01 - 1.1.1 - fix(package)

Update dependencies and pnpm configuration

2025-03-01 - 1.1.0 - feat(core)

Introduce ProcessMonitor class and integrate native and external plugins

2025-02-24 - 1.0.3 - fix(core)

Corrected description in package.json and readme.md from 'task manager' to 'process manager'.

2025-02-24 - 1.0.2 - fix(core)

Internal changes with no functional impact.

2025-02-24 - 1.0.1 - initial release

Initial release with baseline functionality.