diff --git a/changelog.md b/changelog.md index 345e835..f7577ae 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,13 @@ # Changelog +## 2025-08-28 - 3.0.2 - fix(daemon) +Ensure TSPM runtime dir exists and improve daemon startup/debug output + +- Create ~/.tspm directory before starting the daemon to avoid missing-directory errors +- Start daemon child process with stdio inherited when TSPM_DEBUG=true to surface startup errors during debugging +- Add warning and troubleshooting guidance when daemon process starts but does not respond (suggest checking socket file and using TSPM_DEBUG) +- Bump package version to 3.0.1 + ## 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 diff --git a/package.json b/package.json index b69dd90..a741dc8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@git.zone/tspm", - "version": "3.0.0", + "version": "3.0.1", "private": false, "description": "a no fuzz process manager", "main": "dist_ts/index.js", diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index dcaa09c..b6faf89 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tspm', - version: '3.0.0', + version: '3.0.2', description: 'a no fuzz process manager' } diff --git a/ts/classes.daemon.ts b/ts/classes.daemon.ts index eec8be2..3402fcd 100644 --- a/ts/classes.daemon.ts +++ b/ts/classes.daemon.ts @@ -34,6 +34,10 @@ export class TspmDaemon { public async start(): Promise { console.log('Starting TSPM daemon...'); + // Ensure the TSPM directory exists + const fs = await import('fs/promises'); + await fs.mkdir(paths.tspmDir, { recursive: true }); + // Check if another daemon is already running if (await this.isDaemonRunning()) { throw new Error('Another TSPM daemon instance is already running'); diff --git a/ts/cli/commands/daemon/index.ts b/ts/cli/commands/daemon/index.ts index 9966488..7766ef2 100644 --- a/ts/cli/commands/daemon/index.ts +++ b/ts/cli/commands/daemon/index.ts @@ -37,9 +37,10 @@ export function registerDaemonCommand(smartcli: plugins.smartcli.Smartcli) { ); // Start daemon as a detached background process + // Use 'inherit' for stdio to see any startup errors when debugging const daemonProcess = spawn(process.execPath, [daemonScript], { detached: true, - stdio: 'ignore', + stdio: process.env.TSPM_DEBUG === 'true' ? 'inherit' : 'ignore', env: { ...process.env, TSPM_DAEMON_MODE: 'true', @@ -62,6 +63,13 @@ export function registerDaemonCommand(smartcli: plugins.smartcli.Smartcli) { '\nNote: This daemon will run until you stop it or logout.', ); console.log('For automatic startup, use "tspm enable" instead.'); + } else { + console.warn('\n⚠️ Warning: Daemon process started but is not responding.'); + console.log('The daemon may have crashed on startup.'); + console.log('\nTo debug, try:'); + console.log(' TSPM_DEBUG=true tspm daemon start'); + console.log('\nOr check if the socket file exists:'); + console.log(` ls -la ~/.tspm/tspm.sock`); } // Disconnect from the daemon after starting