mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-30 16:39:33 +01:00
feat(tui): attach by session name, codeman tui <name>
codeman tui <session> takes a list number or a session name. Digits only stay a number; anything else matches the session name exactly (case-sensitive, never a prefix, folder or prompt). Names are not unique, so two live matches refuse and print their numbers; a name only a RECENT row carries says the session has finished. The target is resolved before the TTY check, so scripts get these answers without a terminal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e99b42c387
commit
a36b875363
7 files changed
+228
-48
No files matched your search
+11
-1
@@ -927,7 +927,7 @@ program
|
||||
|
||||
program
|
||||
.command('tui')
|
||||
.argument('[n]', 'attach straight to the nth session of `codeman tui --list`')
|
||||
.argument('[session]', 'attach straight to a session: its number in `codeman tui --list`, or its exact session name')
|
||||
.description('Terminal dashboard for your sessions (the web UI remains the primary surface)')
|
||||
.option('-l, --list', 'Print the numbered session list and exit, instead of opening the dashboard')
|
||||
.action(async (position: string | undefined, options: { list?: boolean }) => {
|
||||
@@ -940,6 +940,16 @@ program
|
||||
return;
|
||||
}
|
||||
if (position !== undefined) {
|
||||
// Digits only is a list number, as it always was; anything else is a session name.
|
||||
if (!/^\d+$/.test(position)) {
|
||||
if (position.trim() === '') {
|
||||
console.error(palette.err('An empty session name matches nothing.'));
|
||||
process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
process.exitCode = await runTuiAttach(position);
|
||||
return;
|
||||
}
|
||||
const n = Number.parseInt(position, 10);
|
||||
if (!Number.isSafeInteger(n) || n < 1) {
|
||||
console.error(palette.err(`"${position}" is not a session number.`));
|
||||
|
||||
Reference in new issue
Block a user