Fix Windows terminal background rendering and add /debug command

- Strip carriage return characters from bash tool output to fix background padding on Windows
- Add hidden /debug command to write rendered lines to debug log for TUI debugging
- Document /debug command in README.md development section
This commit is contained in:
badlogic 2025-12-02 13:22:41 +01:00
parent 4432fc9b72
commit 7b1f975ca1
3 changed files with 63 additions and 3 deletions

View file

@ -1156,6 +1156,19 @@ import { getPackageDir, getThemeDir, getPackageJsonPath, getReadmePath, getChang
**Never use `__dirname` directly** for resolving package assets. The `paths.ts` module handles the differences between execution modes automatically.
### Debug Command
The `/debug` command is a hidden development feature (not shown in autocomplete) that writes all currently rendered lines with their visible widths and ANSI escape sequences to `~/.pi/agent/pi-debug.log`. This is useful for debugging TUI rendering issues, especially when lines don't extend to the terminal edge or contain unexpected invisible characters.
```
/debug
```
The debug log includes:
- Terminal width at time of capture
- Total number of rendered lines
- Each line with its index, visible width, and JSON-escaped content showing all ANSI codes
## License
MIT