import * as plugins from '../../plugins.js'; import { tspmIpcClient } from '../../../client/tspm.ipcclient.js'; import type { CliArguments } from '../../types.js'; import { registerIpcCommand } from '../../registration/index.js'; export function registerStopCommand(smartcli: plugins.smartcli.Smartcli) { registerIpcCommand( smartcli, 'stop', async (argvArg: CliArguments) => { const target = argvArg._[1]; if (!target) { console.error('Error: Please provide a process target'); console.log('Usage: tspm stop '); return; } console.log(`Stopping process: ${target}`); const resolved = await tspmIpcClient.request('resolveTarget', { target: String(target) }); const response = await tspmIpcClient.request('stop', { id: resolved.id }); if (response.success) { console.log(`✓ ${response.message}`); } else { console.error(`✗ Failed to stop process: ${response.message}`); } }, { actionLabel: 'stop process' }, ); }