fix: collapse newlines in permission prompt titles and render bash partial output via setExtra#271
Conversation
…rtial output via setExtra
Kimchi Code Review
Summary📊 Review Score: 92/100 (overall code quality — 0 lowest, 100 highest) 🧪 Tests: yes — New test file No significant issues found. LGTM! 🎉 What to expectKimchi will analyze the changes in this pull request and post:
The review typically completes within a few minutes. This comment will be updated once the review is ready. Interact with Kimchi
ConfigurationReviews are configured by your organization admin. Powered by Kimchi — AI-powered code review by CAST AI |
There was a problem hiding this comment.
📊 Review Score: 92/100 (overall code quality — 0 lowest, 100 highest)
⏱️ Estimated effort to review: 2/5 (1 = trivial, 5 = very complex)
🧪 Tests: yes — New test file src/extensions/permissions/prompts.test.ts covers the truncate boundary logic and verifies newline sanitization for both bash and read-tool prompts. Tests are clear and directly exercise the changed behavior.
No significant issues found. LGTM! 🎉
Kimchi Summary
What changed
Fixes two TUI rendering bugs: partial bash tool output is now visible during streaming, and permission prompts no longer break layout when tool commands contain newlines.
Why
Partial bash results were being appended as children to a
ContainerthatToolBlockViewdid not render, leaving the output invisible. Separately, raw newlines in bash commands and file paths were passed unmodified toctx.ui.select, causingpi-tuito expand prompt rows and overlap surrounding UI elements.Key changes
src/extensions/bash-collapse.ts: InrenderResult(), replaced invisibleContainerchild-addition withview.setExtra(...)on aToolBlockView, rendering the last five lines of partial output while preserving the existing header.src/extensions/permissions/prompts.ts: AddedcollapseNewlines()to replace line breaks with⏎and applied it indescribeCall()toinput.command,input.path, andJSON.stringify(input)before display.src/extensions/permissions/prompts.ts: Exportedtruncate()for direct unit testing.src/extensions/permissions/prompts.test.ts: Added tests fortruncate()and for newline sanitization inpromptForApprovaltitles passed toui.select.