@seamnet/client 0.17.1 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/seam.js +27 -1
- package/package.json +1 -1
package/bin/seam.js
CHANGED
|
@@ -61,6 +61,7 @@ function printHelp() {
|
|
|
61
61
|
' seam cc read --session <name> [--lines N]',
|
|
62
62
|
' seam cc send --session <name> --text <msg>',
|
|
63
63
|
' seam cc start --dir <path> [--session <name>]',
|
|
64
|
+
' seam cc restart --session <name> [--no-continue] 重启某个 CC 实例',
|
|
64
65
|
'',
|
|
65
66
|
'输出:JSON { ok: true, data } 或 { ok: false, error }。',
|
|
66
67
|
].join('\n');
|
|
@@ -471,7 +472,32 @@ async function cmdCc(subAction, restArgs) {
|
|
|
471
472
|
return;
|
|
472
473
|
}
|
|
473
474
|
|
|
474
|
-
|
|
475
|
+
if (subAction === 'restart') {
|
|
476
|
+
const { values } = parseArgs({
|
|
477
|
+
args: restArgs,
|
|
478
|
+
options: {
|
|
479
|
+
session: { type: 'string' },
|
|
480
|
+
continue: { type: 'boolean' },
|
|
481
|
+
'no-continue': { type: 'boolean' },
|
|
482
|
+
},
|
|
483
|
+
strict: false,
|
|
484
|
+
});
|
|
485
|
+
if (!values.session) output(false, '--session required');
|
|
486
|
+
const continueSession = values['no-continue'] ? false : true;
|
|
487
|
+
try {
|
|
488
|
+
const ok = await tmuxUtils.restartCC(values.session, { continueSession });
|
|
489
|
+
if (ok) {
|
|
490
|
+
output(true, { session: values.session, restarted: true });
|
|
491
|
+
} else {
|
|
492
|
+
output(false, 'restart failed: CC 未在超时内退出或重启');
|
|
493
|
+
}
|
|
494
|
+
} catch (e) {
|
|
495
|
+
output(false, e.message);
|
|
496
|
+
}
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
output(false, `Unknown cc action: ${subAction}. Try: list, read, send, start, restart`);
|
|
475
501
|
}
|
|
476
502
|
|
|
477
503
|
function parseDuration(str) {
|