import * as plugins from '../../plugins.js'; import { tspmIpcClient } from '../../../client/tspm.ipcclient.js'; import type { IProcessConfig } from '../../../shared/protocol/ipc.types.js'; import type { CliArguments } from '../../types.js'; import { parseMemoryString, formatMemory } from '../../helpers/memory.js'; import { registerIpcCommand } from '../../registration/index.js'; export function registerStartCommand(smartcli: plugins.smartcli.Smartcli) { registerIpcCommand( smartcli, 'start', async (argvArg: CliArguments) => { const target = argvArg._[1]; if (!target) { console.error('Error: Please provide a process target to start'); console.log('Usage: tspm start '); return; } console.log(`Starting process: ${target}...`); const resolved = await tspmIpcClient.request('resolveTarget', { target: String(target) }); const response = await tspmIpcClient.request('startById', { id: resolved.id }); console.log('✓ Process started'); console.log(` ID: ${response.processId}${resolved.name ? ` (name: ${resolved.name})` : ''}`); console.log(` PID: ${response.pid || 'N/A'}`); console.log(` Status: ${response.status}`); }, { actionLabel: 'start process' }, ); }