Skip to content

Add inline @ file-path completion - #4

Merged
tdwd merged 1 commit into
mainfrom
feat/at-file-completion
Aug 3, 2026
Merged

Add inline @ file-path completion#4
tdwd merged 1 commit into
mainfrom
feat/at-file-completion

Conversation

@tdwd

@tdwd tdwd commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Adds a Claude-Code-style inline @ file picker to the prompt.

What

  • Type @ at a word boundary → a live-filtering file menu floats just above the prompt. ↑/↓ move, tab/↵ insert, esc dismisses (and stays dismissed until you leave the token). Enter accepts the completion instead of submitting the turn.
  • Inserts @path (keeping the leading @) — see verification below.
  • Git-aware file source (git ls-files --cached --others --exclude-standard, respects .gitignore; directory-walk fallback outside a repo). Reuses the picker's fuzzy scorer.

Verified: @ is real mention support

Probed the claude subprocess over the exact headless stream-json input path cathode uses (credentials scrubbed). Sending a turn containing @go.mod returned the correct content with no Read tool_use in the stream; a control probe with an unguessable marker in a temp file came back verbatim, again with zero tool calls. So the CLI expands @relative/path into file contents in headless mode too — which is why the completion keeps the @.

How it fits

  • Non-modal: keystrokes fall through to the textarea; update.go's tail calls syncCompletion, which re-derives the @-token under the cursor (atToken). keys.go only intercepts navigation while the menu is open.
  • Renders via a new anchored placeOverlayAt (sibling of the centered placeOverlay).

Files

New: complete.go, repofiles.go, complete_test.go. Modified: keys.go, update.go, view.go, overlay.go, model.go, commands.go, CLAUDE.md.

Tests

7 new tests incl. an end-to-end UpdateView render assertion (menu sits above the prompt, frame height preserved). Full go test ./..., make build, gofmt, go vet all clean.

Type @ at a word boundary to open a live-filtering file menu that floats
just above the prompt: ↑/↓ to move, tab/↵ to insert, esc to dismiss. The
chosen "@path" is inserted with its leading @ on purpose — the claude
subprocess expands @relative/path into the file's contents even over the
headless stream-json input path (verified by probing: no Read tool_use,
content injected), so this is real mention support, not just path-typing.

The menu is non-modal (keystrokes fall through to the textarea; a tail
syncCompletion re-derives the @-token under the cursor), git-aware
(git ls-files, respecting .gitignore, with a directory-walk fallback),
and reuses the picker's fuzzy scorer. Rendered via a new anchored
placeOverlayAt sibling of the centered placeOverlay.

New: complete.go, repofiles.go, complete_test.go. Docs: CLAUDE.md
architecture note.
@tdwd
tdwd merged commit 1c4d901 into main Aug 3, 2026
1 check passed
@tdwd
tdwd deleted the feat/at-file-completion branch August 3, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant