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

This commit is contained in:
2025-08-28 15:52:29 +00:00
parent 8e3cfb624b
commit e73f4acd63
38 changed files with 810 additions and 580 deletions

View File

@@ -1,20 +1,24 @@
# TSPM SmartDaemon Service Management Refactor
## Problem
Currently TSPM auto-spawns the daemon as a detached child process, which is improper daemon management. It should use smartdaemon for all lifecycle management and never spawn processes directly.
## Solution
Refactor to use SmartDaemon for proper systemd service integration.
## Implementation Tasks
### Phase 1: Remove Auto-Spawn Behavior
- [x] Remove spawn import from ts/classes.ipcclient.ts
- [x] Delete startDaemon() method from IpcClient
- [x] Update connect() to throw error when daemon not running
- [x] Remove auto-reconnect logic from request() method
### Phase 2: Create Service Manager
- [x] Create new file ts/classes.servicemanager.ts
- [x] Implement TspmServiceManager class
- [x] Add getOrCreateService() method
@@ -23,6 +27,7 @@ Refactor to use SmartDaemon for proper systemd service integration.
- [x] Add getServiceStatus() method
### Phase 3: Update CLI Commands
- [x] Add 'enable' command to CLI
- [x] Add 'disable' command to CLI
- [x] Update 'daemon start' to work without systemd
@@ -31,11 +36,13 @@ Refactor to use SmartDaemon for proper systemd service integration.
- [x] Add proper error messages with hints
### Phase 4: Update Documentation
- [x] Update help text in CLI
- [ ] Update command descriptions
- [x] Add service management section
### Phase 5: Testing
- [x] Test enable command
- [x] Test disable command
- [x] Test daemon commands
@@ -43,6 +50,7 @@ Refactor to use SmartDaemon for proper systemd service integration.
- [x] Build and verify TypeScript compilation
## Migration Notes
- Users will need to run `tspm enable` once after update
- Existing daemon instances will stop working
- Documentation needs updating to explain new behavior
- Documentation needs updating to explain new behavior