fix(cli): Use server-side start-by-id flow for starting processes
This commit is contained in:
@@ -17,14 +17,8 @@ export function registerStartCommand(smartcli: plugins.smartcli.Smartcli) {
|
||||
return;
|
||||
}
|
||||
|
||||
const desc = await tspmIpcClient.request('describe', { id }).catch(() => null);
|
||||
if (!desc) {
|
||||
console.error(`Process with id '${id}' not found. Use 'tspm add' first.`);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Starting process id ${id} (${desc.config.name || id})...`);
|
||||
const response = await tspmIpcClient.request('start', { config: desc.config });
|
||||
console.log(`Starting process id ${id}...`);
|
||||
const response = await tspmIpcClient.request('startById', { id });
|
||||
console.log('✓ Process started');
|
||||
console.log(` ID: ${response.processId}`);
|
||||
console.log(` PID: ${response.pid || 'N/A'}`);
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import * as plugins from './plugins.js';
|
||||
import { tspmIpcClient } from '../client/tspm.ipcclient.js';
|
||||
import * as paths from '../paths.js';
|
||||
import { Logger, LogLevel } from '../shared/common/utils.errorhandler.js';
|
||||
|
||||
@@ -38,6 +39,22 @@ export const run = async (): Promise<void> => {
|
||||
}
|
||||
|
||||
const smartcliInstance = new plugins.smartcli.Smartcli();
|
||||
// Intercept -v/--version to show CLI and daemon versions
|
||||
const args = process.argv.slice(2);
|
||||
if (args.includes('-v') || args.includes('--version')) {
|
||||
const cliVersion = tspmProjectinfo.npm.version;
|
||||
console.log(`tspm CLI: ${cliVersion}`);
|
||||
const status = await tspmIpcClient.getDaemonStatus();
|
||||
if (status) {
|
||||
console.log(
|
||||
`Daemon: running v${status.version || 'unknown'} (pid ${status.pid})`,
|
||||
);
|
||||
} else {
|
||||
console.log('Daemon: not running');
|
||||
}
|
||||
return; // do not start parser
|
||||
}
|
||||
// Keep Smartcli version info for help output but not used for -v now
|
||||
smartcliInstance.addVersion(tspmProjectinfo.npm.version);
|
||||
|
||||
// Register all commands
|
||||
|
Reference in New Issue
Block a user