Files
ai-artifacts/projects/dotfiles/070-pi-ui-flex-spacer-pi-patch-task.md

3.4 KiB

status, parent, blocked-by, claimed-by, claimed-at, resolved-at, tags
status parent blocked-by claimed-by claimed-at resolved-at tags
resolved 063-pi-ui-customization-spec-task
073-pi-ui-community-pi-packaging-research
019fbf7c-142c-7ccf-8a15-47774af57943 2026-08-01T18:40:19-04:00 2026-08-01T18:47:52-04:00
ticket/implementation

Patch Pi prompt-area layout

Question

Make the ordinary flake-managed pi command use the accepted flex-spacer prompt-area layout and harden local tool lookup for NixOS.

What to build

Add a small local Pi package patch through the dotfiles flake so Pi's interactive layout renders flow content separately from the pinned prompt-area content. When the rendered TUI is shorter than the terminal, insert flexible blank rows between the flow content and the prompt-area group. When the rendered TUI is long enough to fill the terminal, preserve stock scrolling behavior with no inserted spacer.

Also harden Pi tool lookup so unusable downloaded local binaries in ~/.pi/agent/bin do not mask working Nix-provided fd and rg binaries on PATH. A local tool should count as available only when <tool> --version exits successfully.

Acceptance criteria

  • The ordinary flake-managed pi command uses the patched layout after rebuild.
  • Short conversations leave spare vertical space above the status/editor area, not below the editor.
  • Long conversations preserve stock Pi scrolling behavior.
  • Terminal resize recomputes spacer rows without accumulating stale blank lines.
  • / autocomplete still works.
  • @ autocomplete still works even when ~/.pi/agent/bin/fd is an unusable generic Linux binary.
  • Closing autocomplete leaves the editor visually bottom-aligned.
  • The patch is delivered through dotfiles, not by an unmanaged copy under ~/.local/share.

Implementation Notes

Use 072-pi-ui-patched-pi-packaging-research for the packaging plan. Patch pkgs.pi-coding-agent at the TypeScript source level with overrideAttrs, assign the result to programs.pi-coding-agent.package, and keep the ordinary pi command managed by Home Manager.

The prototype at /home/alexion/.local/share/pi-flex-spacer-prototype/pi-monorepo added FlexSpacerBottomLayout in Pi's dist/modes/interactive/interactive-mode.js and patched tool lookup in dist/utils/tools-manager.js. Use it as behavior reference, but implement through the flake-managed Pi package path.

Resolved in commit 5fd8de0 on branch pi-ui-customization. The Pi module now overrides pkgs.pi-coding-agent with modules/agents/pi/patches/pi-flex-spacer.patch and modules/agents/pi/patches/pi-tool-lookup-validation.patch, assigning the patched package to programs.pi-coding-agent.package. The patch adds a source-level flex-spacer layout wrapper around flow and pinned prompt-area components, preserving extension footer replacement through a pinned footer container. It also enables TUI shrink clearing by default so closing autocomplete clears the temporary menu rows and returns the editor group to the bottom. The tool lookup patch makes local fd/rg binaries count only when --version exits successfully. Verified with focused package build, built-output inspection, unusable-local-fd fallback check, independent review remediation, deployed human visual checks, and nix flake check. Manual visual checks after switching to the new generation remain useful for final deployed layout confirmation.