Description
When running /extensions and pressing c to configure extensions for pi-subagents, the configuration panel displays visual artifacts:
- Tool description text ("EXECUTION (use exactly ON...") appears on separate lines
- List items appear duplicated multiple times
Root Cause
In src/utils/fs.ts, the readSummary() function extracts tool descriptions using regex:
const descriptionPatterns = [
/registerCommand\(\s*["'`][^"'`]+["'`]\s*,\s*\{[\s\S]*?description\s*:\s*["'`]([^"'`]+)["'`]/m,
/registerTool\(\s*\{[\s\S]*?description\s*:\s*["'`]([^"'`]+)["'`]/m,
/description\s*:\s*["'`]([^"'`]+)["'`]/m,
];
The character class [^"']` matches any character except quotes, including newlines. For extensions with multi-line template literal descriptions (like pi-subagents):
description: `Delegate to subagents or manage agent definitions.
EXECUTION (use exactly ONE mode):
• SINGLE: { agent, task } - one task
...`
The extracted summary becomes:
"Delegate to subagents or manage agent definitions.\n\nEXECUTION (use exactly ON..."
The truncate() function only checks text.length, preserving embedded newlines. When rendered in the SettingsList label, the \n\n causes text to break across multiple lines, corrupting the TUI layout.
Steps to Reproduce
- Install
pi-subagents package
- Run
/extensions
- Navigate to
pi-subagents and press c to configure
- Visual artifacts appear in the configuration panel
Suggested Fix
Normalize extracted text in readSummary() before truncating:
function normalizeSummary(text: string): string {
return text.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
}
// Then use:
if (value) return truncate(normalizeSummary(value), 80);
Description
When running
/extensionsand pressingcto configure extensions forpi-subagents, the configuration panel displays visual artifacts:Root Cause
In
src/utils/fs.ts, thereadSummary()function extracts tool descriptions using regex:The character class
[^"']` matches any character except quotes, including newlines. For extensions with multi-line template literal descriptions (like pi-subagents):The extracted summary becomes:
The
truncate()function only checkstext.length, preserving embedded newlines. When rendered in the SettingsList label, the\n\ncauses text to break across multiple lines, corrupting the TUI layout.Steps to Reproduce
pi-subagentspackage/extensionspi-subagentsand presscto configureSuggested Fix
Normalize extracted text in
readSummary()before truncating: