From e73f4acd637479eaa1e95e3dbcb173e3b2586e86 Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Thu, 28 Aug 2025 15:52:29 +0000 Subject: [PATCH] BREAKING CHANGE(daemon): Refactor daemon and service management: remove IPC auto-spawn, add TspmServiceManager, tighten IPC/client/CLI behavior and tests --- changelog.md | 17 ++ readme.md | 28 +++- readme.plan.md | 10 +- test/test.daemon.ts | 32 ++-- test/test.integration.ts | 126 +++++++------- test/test.ipcclient.ts | 56 ++++--- ts/00_commitinfo_data.ts | 2 +- ts/classes.daemon.ts | 241 +++++++++++++++------------ ts/classes.ipcclient.ts | 29 ++-- ts/classes.processmonitor.ts | 2 +- ts/classes.servicemanager.ts | 22 +-- ts/classes.tspm.ts | 6 +- ts/cli.ts | 2 +- ts/cli/commands/batch/restart-all.ts | 37 ++-- ts/cli/commands/batch/start-all.ts | 37 ++-- ts/cli/commands/batch/stop-all.ts | 37 ++-- ts/cli/commands/daemon/index.ts | 26 +-- ts/cli/commands/default.ts | 18 +- ts/cli/commands/process/delete.ts | 37 ++-- ts/cli/commands/process/describe.ts | 71 ++++---- ts/cli/commands/process/list.ts | 61 ++++--- ts/cli/commands/process/logs.ts | 138 ++++++++------- ts/cli/commands/process/restart.ts | 35 ++-- ts/cli/commands/process/start.ts | 159 ++++++++++-------- ts/cli/commands/process/stop.ts | 37 ++-- ts/cli/commands/service/disable.ts | 13 +- ts/cli/commands/service/enable.ts | 13 +- ts/cli/helpers/argv.ts | 16 +- ts/cli/helpers/errors.ts | 14 +- ts/cli/helpers/formatting.ts | 7 +- ts/cli/helpers/lifecycle.ts | 2 +- ts/cli/helpers/memory.ts | 2 +- ts/cli/index.ts | 2 +- ts/cli/registration/daemon-check.ts | 15 +- ts/cli/registration/index.ts | 25 ++- ts/cli/types.ts | 8 +- ts/cli/utils/ipc.ts | 2 +- ts/ipc.types.ts | 5 +- 38 files changed, 810 insertions(+), 580 deletions(-) diff --git a/changelog.md b/changelog.md index f95288f..345e835 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,19 @@ # Changelog +## 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 + +- Remove automatic daemon spawn from the IPC client — clients now error with guidance and require the daemon to be started manually or enabled as a system service +- Add TspmServiceManager to manage the daemon as a systemd service (enable/disable/reload/status) +- Update IPC server/client to use SmartIpc.createServer/createClient with heartbeat defaults and explicit onMessage handlers +- Daemon publishes per-process logs to topics (logs.) and re-emits ProcessMonitor logs for pub/sub +- CLI updated: add enable/disable service commands, adjust daemon start/stop/status workflows and improve user hints when daemon is not running +- Add/adjust integration and unit tests to cover daemon lifecycle, IPC client behavior, log streaming, heartbeat and resource reporting +- Documentation expanded (README, readme.plan.md, changelog) to reflect the refactor and migration notes +- Various code cleanups, formatting fixes and defensive checks across modules + ## 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 - Do not auto-spawn the daemon from the IPC client anymore — attempts to connect will now error with instructions to start the daemon manually or enable the system service (breaking change). @@ -12,6 +25,7 @@ Refactor daemon lifecycle and service management: remove IPC auto-spawn, add Tsp - Updated development plan/readme (readme.plan.md) to reflect the refactor toward proper SmartDaemon integration and migration notes. ## 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 - Upgrade @push.rocks/smartipc dependency to ^2.1.2 @@ -24,6 +38,7 @@ Add real-time log streaming and pub/sub: daemon publishes per-process logs, IPC - Standardized heartbeat and IPC timing defaults (heartbeatInterval: 5000ms, heartbeatTimeout: 20000ms, heartbeatInitialGracePeriodMs: 10000ms) ## 2025-08-25 - 1.7.0 - feat(readme) + Add comprehensive README with detailed usage, command reference, daemon management, architecture and development instructions - Expanded README from a short placeholder to a full documentation covering: Quick Start, Installation, Command Reference, Daemon Management, Monitoring & Information, Batch Operations, Architecture, Programmatic Usage, Advanced Features, Development, Debugging, Performance, and Legal information @@ -32,6 +47,7 @@ Add comprehensive README with detailed usage, command reference, daemon manageme - Improved onboarding instructions: cloning, installing, testing, building, and running the project ## 2025-08-25 - 1.6.1 - fix(daemon) + Fix smartipc integration and add daemon/ipc integration tests - Replace direct smartipc server/client construction with SmartIpc.createServer/createClient and set heartbeat: false @@ -40,6 +56,7 @@ Fix smartipc integration and add daemon/ipc integration tests - Add comprehensive tests: unit tests for TspmDaemon and TspmIpcClient and full integration tests for daemon lifecycle, process management, error handling, heartbeat and resource reporting ## 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 - Add central daemon implementation (ts/classes.daemon.ts) to manage all processes via a single background service and Unix socket. diff --git a/readme.md b/readme.md index a8770e0..b48bffd 100644 --- a/readme.md +++ b/readme.md @@ -64,9 +64,11 @@ tspm restart my-server ### Process Management #### `tspm start