This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix pty ls to work again

Nathan Herald (Apr 3, 2026, 10:46 AM +0200) 7d41f52f 0dae02be

+39 -8
+4 -1
src/cli.ts
··· 541 541 const code = meta?.exitCode ?? "?"; 542 542 const ago = meta?.exitedAt ? timeAgo(new Date(meta.exitedAt)) : "unknown"; 543 543 const cwd = meta?.cwd ? shortPath(meta.cwd) : ""; 544 - console.log(` ${session.name} (exited with code ${code}, ${ago}) — ${cwd}`); 544 + const cmd = meta 545 + ? [meta.displayCommand, ...meta.args].join(" ") 546 + : ""; 547 + console.log(` ${session.name} (exited with code ${code}, ${ago}) — ${cwd} — ${cmd}`); 545 548 } 546 549 } 547 550 }
+31 -5
src/tui/interactive.ts
··· 112 112 const cwdResult = fuzzyMatch(filter, cwd); 113 113 const cmdResult = fuzzyMatch(filter, cmd); 114 114 if (!nameResult.match && !cwdResult.match && !cmdResult.match) continue; 115 - // Name matches get a large bonus so they always rank above cwd/cmd matches 116 - const score = Math.max( 115 + // Name matches get a large bonus so they always rank above cwd/cmd matches. 116 + // Running sessions get an extra bonus so they always rank above exited ones. 117 + const runningBonus = s.status === "running" ? 100000 : 0; 118 + const score = runningBonus + Math.max( 117 119 nameResult.match ? nameResult.score + 10000 : 0, 118 120 cwdResult.match ? cwdResult.score : 0, 119 121 cmdResult.match ? cmdResult.score : 0, ··· 141 143 const cmd = s.metadata 142 144 ? [s.metadata.displayCommand, ...s.metadata.args].join(" ") 143 145 : ""; 146 + const cwdStr = s.metadata?.cwd ? shortPath(s.metadata.cwd) : ""; 147 + const exitStr = s.metadata?.exitedAt ? `(exited ${timeAgo(new Date(s.metadata.exitedAt))})` : ""; 144 148 const pathStr = s.status === "running" 145 - ? (s.metadata?.cwd ? shortPath(s.metadata.cwd) : "") 146 - : (s.metadata?.exitedAt ? `(exited ${timeAgo(new Date(s.metadata.exitedAt))})` : ""); 149 + ? cwdStr 150 + : [cwdStr, exitStr].filter(Boolean).join(" "); 147 151 148 152 const line = `${sel}${icon} ${s.name} ${pathStr} ${cmd}`; 149 153 return [text(line, selected ? "accent" : "primary", { bold: selected, truncate: true })]; ··· 202 206 return true; 203 207 } 204 208 if (item.session) { 205 - doAttach(item.session.name); 209 + if (item.session.status === "exited") { 210 + doRestart(item.session); 211 + } else { 212 + doAttach(item.session.name); 213 + } 206 214 return true; 207 215 } 208 216 } ··· 489 497 // ============================================================ 490 498 491 499 let myApp: ReturnType<typeof app> | null = null; 500 + 501 + async function doRestart(session: SessionInfo): Promise<void> { 502 + const meta = session.metadata; 503 + if (!meta) { 504 + cleanupAll(session.name); 505 + return; 506 + } 507 + cleanupAll(session.name); 508 + try { 509 + await spawnDaemon(session.name, meta.command, meta.args, meta.displayCommand, meta.cwd); 510 + } catch { 511 + // Refresh list to show updated state 512 + const updated = await listSessions(); 513 + sessions.set(updated); 514 + return; 515 + } 516 + doAttach(session.name); 517 + } 492 518 493 519 function doAttach(name: string): void { 494 520 myApp?.pause();
+4 -2
src/tui/screen-list.ts
··· 244 244 pathCol = pad(truncate(cwd, pathWidth), pathWidth); 245 245 cmdCol = truncate(cmd, cmdWidth); 246 246 } else { 247 - const ago = s.metadata?.exitedAt ? timeAgo(new Date(s.metadata.exitedAt)) : ""; 248 - pathCol = pad(truncate(`(exited ${ago})`, pathWidth), pathWidth); 247 + const cwd = s.metadata?.cwd ? shortPath(s.metadata.cwd) : ""; 248 + const ago = s.metadata?.exitedAt ? `(exited ${timeAgo(new Date(s.metadata.exitedAt))})` : "(exited)"; 249 + const exitPath = cwd ? `${cwd} ${ago}` : ago; 250 + pathCol = pad(truncate(exitPath, pathWidth), pathWidth); 249 251 cmdCol = truncate(cmd, cmdWidth); 250 252 } 251 253