feat(#1161): show full bash commands in terminal as expandable details

This commit is contained in:
iris 2026-06-03 18:14:52 +02:00
commit 7767493428

View file

@ -1227,7 +1227,10 @@ window.marked = marked;
const name = c.name || '';
const input = c.input || {};
const short = name.startsWith('mcp__hyperhive__')
? name.slice('mcp__hyperhive__'.length) + '*' : name;
? name.slice('mcp__hyperhive__'.length) + '*'
: name.startsWith('mcp__bash__')
? name.slice('mcp__bash__'.length) + '*'
: name;
switch (name) {
case 'Read': return short + ' ' + (input.file_path || '');
case 'Write': return short + ' ' + (input.file_path || '');
@ -1251,6 +1254,15 @@ window.marked = marked;
case 'mcp__hyperhive__kill': return short + ' ' + (input.name || '');
case 'mcp__hyperhive__request_apply_commit':
return short + ' ' + (input.agent || '') + ' @ ' + (input.commit_ref || '').slice(0, 12);
case 'mcp__bash__bash_run': {
// Rich renderer handles the full body; this summary covers any
// fallback path and the details summary line.
const firstLine = String(input.cmd || '').split('\n')[0];
return short + ' $ ' + trim(firstLine.trim(), 72);
}
case 'mcp__bash__bash_status':
return short + ' id:' + (input.id || '?')
+ (input.wait_seconds != null ? ' · wait ' + input.wait_seconds + 's' : '');
default: return fmtArgsGeneric(short, input);
}
}
@ -1339,6 +1351,15 @@ window.marked = marked;
'answer #' + id + (lines > 1 ? ` · ${lines}L` : ''),
a);
}
// Bash task runner — show full command in an expandable pre block so
// multi-line scripts are readable. Summary uses the first line so the
// row is identifiable without expanding.
if (name === 'mcp__bash__bash_run') {
const cmd = String(input.cmd || '');
const firstLine = cmd.split('\n')[0];
const summary = 'bash_run* $ ' + trim(firstLine.trim(), 72);
return api.details('tool-use', summary, '$ ' + cmd);
}
return null;
}
// Track tool_use_id → tool name so we can decide on rendering when the