Skip to content

fix(tui): treat absolute file paths as plain text, not commands#3554

Merged
jeremymcs merged 1 commit intogsd-build:mainfrom
Tibsfox:fix/filepath-slash-command
Apr 7, 2026
Merged

fix(tui): treat absolute file paths as plain text, not commands#3554
jeremymcs merged 1 commit intogsd-build:mainfrom
Tibsfox:fix/filepath-slash-command

Conversation

@Tibsfox
Copy link
Copy Markdown
Contributor

@Tibsfox Tibsfox commented Apr 5, 2026

TL;DR

What: Dragging a file into Pi no longer triggers "Unknown command" errors.
Why: Absolute paths like /Users/name/file.png were parsed as /Users slash command.
How: Detect file paths (contain / after position 0) and bypass slash command dispatch.

What

When a file is dragged into the Pi TUI input field, the absolute path (e.g., /Users/name/Desktop/screenshot.png) starts with / and is interpreted as a slash command. This shows Error: Unknown command: /Users/name/Desktop/screenshot.png.

The fix adds a looksLikeFilePath() heuristic before the slash command check: if the first token contains a / after position 0 (like /Users/name/...), it's a file path, not a command. Slash commands are single tokens like /help or /gsd — they never contain embedded slashes.

Why

How

  • input-controller.ts: Added looksLikeFilePath() guard before text.startsWith("/") command dispatch
  • Heuristic: first whitespace-delimited token has / at position >0 → file path, not command
  • File path text falls through to session.prompt() as normal user input

Change type

  • fix

Test plan

  • /Users/name/Desktop/screenshot.png sent as plain input (new test)
  • /home/user/documents/file.txt sent as plain input (new test)
  • /tmp/some-file.log sent as plain input (new test)
  • /settings still dispatched as slash command (existing test)
  • /gsd help still dispatched as slash command (existing test)
  • Unknown commands still show error (existing test)
  • All 10 tests pass (7 existing + 3 new)

Closes #3478

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

🟠 PR Risk Report — HIGH

Files changed 2
Systems affected 2
Overall risk 🟠 HIGH

Affected Systems

Risk System
🟠 high Modes
🟡 medium TUI Components
File Breakdown
Risk File Systems
🟠 packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts Modes, TUI Components
packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts (unclassified)

⚠️ High risk — please run full integration tests and verify tool/extension contracts.

@github-actions github-actions bot added bug Something isn't working High Priority labels Apr 5, 2026
@jeremymcs jeremymcs merged commit 8581086 into gsd-build:main Apr 7, 2026
10 checks passed
@allcounter
Copy link
Copy Markdown

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working High Priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File drag-and-drop into Pi TUI is interpreted as a slash command

3 participants