Skip to content

feat(tui): add semantic file path truncation#36352

Merged
kitlangton merged 6 commits into
v2from
file-path-display
Jul 11, 2026
Merged

feat(tui): add semantic file path truncation#36352
kitlangton merged 6 commits into
v2from
file-path-display

Conversation

@kitlangton

@kitlangton kitlangton commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a reusable FilePath TUI component backed by a pure terminal-column truncation function
  • preserve the filename, nearest complete parent segments, separator style, absolute roots, grapheme boundaries, and filename extensions
  • migrate Modified Files, workspace file-change confirmation, reverted-file rows, the home footer, and block tool file titles
  • derive path budgets from the available terminal/session width after fixed labels, counters, MCP status, and version text
  • retain OpenTUI native truncation as a final guard when Yoga allocates less width than the caller budget

Examples

packages/tui/src/ui/dialog-select.tsx
…/src/ui/dialog-select.tsx
…/ui/dialog-select.tsx
…/dialog-select.tsx
…/dialog-se….tsx

Verification

  • bun run test test/ui/file-path.test.ts: 8 passed
  • bun run test: 235 passed, 1 skipped
  • bun typecheck: passed
  • repository push hook: 31 package typechecks passed
  • git diff --check: passed

Visual verification

Responsive screenshots

Home footer at 64 columns

file-path-home-64

Pending patch with spinner

file-path-patching-150

Completed patch at 100 columns

file-path-after-tool-100

Session with the fixed 38-column sidebar footer and no inline session ID

file-path-after-tool-150

Reverted file at 72 columns

file-path-after-undo-72

A deterministic Drive script now creates a real Git baseline using anomalyco/opencode-drive#7, invokes OpenCode’s production patch tool, and runs /undo through Snapshot.Service and SessionRevert.

The final recording verifies:

  • the home footer remains one line at 86 and 64 columns
  • the patch title remains one line at 100 columns
  • the reverted-file row uses the available width and shows the complete fixture path at 100 columns
  • narrower paths preserve the basename and nearest complete parent segments

The script remains outside this branch at /tmp/opencode-drive-git-project-proof.ts; no fixture or media artifacts are committed.

The real Modified Files sidebar remains blocked independently by #36351 because V2 does not currently populate session_diff.

File tool presentation

The final recording also verifies that block file-tool headers align with shell-card content, use spinner + Patching while pending, switch to ← Patched <path> when complete, and visibly compact the same long path across 150, 100, and 72-column viewports.

Sidebar footer

The fixed 38-column sidebar footer now renders its project directory as one compacted line while retaining the existing muted-parent and bright-basename treatment. Home-relative paths retain ~/ when they fit and use the normal ellipsis compaction when they do not.

@kitlangton kitlangton merged commit e3f7637 into v2 Jul 11, 2026
10 checks passed
@kitlangton kitlangton deleted the file-path-display branch July 11, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant