48 lines
1.7 KiB
Markdown
48 lines
1.7 KiB
Markdown
# 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
|
|
- [x] Add enableService() method
|
|
- [x] Add disableService() method
|
|
- [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
|
|
- [x] Add 'daemon start-service' internal command for systemd
|
|
- [x] Update all commands to handle missing daemon gracefully
|
|
- [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
|
|
- [x] Test error handling when daemon not running
|
|
- [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 |