fix: use buildRetryCommand in spawn list footer to avoid truncated prompts (#819)

The "Rerun last" hint in `spawn list` was truncating prompts at 30
characters and appending "...", producing broken copy-paste commands.
Now delegates to the existing buildRetryCommand helper which properly
handles long prompts by suggesting --prompt-file instead of truncating.

Agent: ux-engineer

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
A 2026-02-12 23:52:08 -08:00 committed by GitHub
parent 3f28d5f29f
commit 5169350feb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 42 deletions

View file

@ -941,14 +941,7 @@ async function showEmptyListMessage(agentFilter?: string, cloudFilter?: string):
function showListFooter(records: SpawnRecord[], agentFilter?: string, cloudFilter?: string): void {
const latest = records[0];
if (latest.prompt) {
const shortPrompt = latest.prompt.length > 30 ? latest.prompt.slice(0, 30) + "..." : latest.prompt;
// Escape double quotes so the suggested command is valid shell
const safePrompt = shortPrompt.replace(/"/g, '\\"');
console.log(`Rerun last: ${pc.cyan(`spawn ${latest.agent} ${latest.cloud} --prompt "${safePrompt}"`)}`);
} else {
console.log(`Rerun last: ${pc.cyan(`spawn ${latest.agent} ${latest.cloud}`)}`);
}
console.log(`Rerun last: ${pc.cyan(buildRetryCommand(latest.agent, latest.cloud, latest.prompt))}`);
if (agentFilter || cloudFilter) {
const totalRecords = filterHistory();