feat(cli): Add interactive edit flow to CLI and improve UX

This commit is contained in:
2025-08-31 16:36:06 +00:00
parent 6e39b1db8f
commit a0e7408c1a
9 changed files with 198 additions and 56 deletions

View File

@@ -20,6 +20,7 @@ export function registerAddCommand(smartcli: plugins.smartcli.Smartcli) {
console.log(' --watch Watch for file changes');
console.log(' --watch-paths <paths> Comma-separated paths');
console.log(' --autorestart Auto-restart on crash (default true)');
console.log(' -i, --interactive Enter interactive edit mode after adding');
return;
}
@@ -29,6 +30,9 @@ export function registerAddCommand(smartcli: plugins.smartcli.Smartcli) {
? parseMemoryString(argvArg.memory)
: 512 * 1024 * 1024;
// Check for interactive flag
const isInteractive = argvArg.i || argvArg.interactive;
// Resolve .ts single-file execution via tsx if needed
const parts = script.split(' ');
const first = parts[0];
@@ -112,6 +116,12 @@ export function registerAddCommand(smartcli: plugins.smartcli.Smartcli) {
console.log('✓ Added');
console.log(` Assigned ID: ${response.id}`);
// If interactive flag is set, enter edit mode
if (isInteractive) {
const { interactiveEditProcess } = await import('../../helpers/interactive-edit.js');
await interactiveEditProcess(response.id);
}
},
{ actionLabel: 'add process config' },
);