Skip to content

feat(ui): add /cwd path tab-completion with async directory picker#922

Merged
esengine merged 1 commit into
esengine:mainfrom
douglarek:feat/cwd-path-completion
May 15, 2026
Merged

feat(ui): add /cwd path tab-completion with async directory picker#922
esengine merged 1 commit into
esengine:mainfrom
douglarek:feat/cwd-path-completion

Conversation

@douglarek
Copy link
Copy Markdown
Contributor

The /cwd slash command now exposes `argCompleter: "path"`, a new completer type that async-lists the filesystem via `listDirectory()`. Tab drills into directories (trailing '/'), Enter commits. Matches are capped at SEARCH_RESULT_CAP (200) to match @-mention search.

  • types.ts: add "path" to argCompleter union
  • commands.ts: wire /cwd to argCompleter: "path"
  • useCompletionPickers.ts: new usePathCandidates hook; update pickSlashArg for dir drill-down; expose slashArgPathCandidates
  • App.tsx: Tab handler checks candidate.isDir for drill vs. commit
  • SlashArgPicker.tsx: optional pathCandidates prop, renders trailing / on directory rows

What

2026-05-15.17.15.17.mov

Why

How to verify

Checklist

  • npm run verify passes locally (lint + typecheck + tests + comment-policy gate)
  • No Co-Authored-By: Claude trailer in commits
  • Comments follow CONTRIBUTING.md (no module-essay headers, no incident history)
  • No edits to CHANGELOG.md — release notes are maintainer-written at release time

@douglarek douglarek force-pushed the feat/cwd-path-completion branch from 733d670 to 8e316a8 Compare May 15, 2026 09:31
@esengine
Copy link
Copy Markdown
Owner

Nice extension of the argCompleter abstraction — drill-on-/ vs commit-on-space is the right shape, and capping at SEARCH_RESULT_CAP keeps it consistent with @-mention.

Two things before merge:

  1. Windows absolute paths are missed. Detection at usePathCandidates uses partial.startsWith("/"), which is POSIX-only. C:\Users\bob or C:/Users/bob skips the absolute branch, gets resolved against rootDir, then immediately falls through the ..-escape path and tries to list from / — wrong twice (root / isn't a real path on Windows, and the canonical separator is \). Use node:path.isAbsolute for detection and path.parse(p).root for the listing root. Windows is the project's primary platform; worth handling properly.

  2. /cwd lists files too. The completer offers everything from listDirectory. A user tabbing a .ts row gets it committed with trailing space; Enter then sends /cwd path/to/file.ts which /cwd rejects — the picker shouldn't be offering invalid options in the first place. Easiest fix: filter to isDir only inside the "path" branch (single consumer today, safe). If we later need a file-completer for some other command, introduce argCompleterMode: "dirs" | "files" | "any" then.

A couple of unit tests around drill-down and the escape-to-absolute branch would be nice but not blocking — happy to merge once the two above are in.

The /cwd slash command now exposes \`argCompleter: "path"\`, a new
completer type that async-lists the filesystem via \`listDirectory()\`.
Tab drills into directories (trailing '/'), Enter commits. Matches
are capped at SEARCH_RESULT_CAP (200) to match @-mention search.

- types.ts: add "path" to argCompleter union
- commands.ts: wire /cwd to argCompleter: "path"
- useCompletionPickers.ts: new usePathCandidates hook; update pickSlashArg
  for dir drill-down; expose slashArgPathCandidates
- App.tsx: Tab handler checks candidate.isDir for drill vs. commit
- SlashArgPicker.tsx: optional pathCandidates prop, renders trailing /
  on directory rows
@douglarek douglarek force-pushed the feat/cwd-path-completion branch from 8e316a8 to a174dae Compare May 15, 2026 10:00
esengine added a commit that referenced this pull request May 15, 2026
Recent PRs hit Windows-specific bugs that Ubuntu CI couldn't catch —
literal forward-slash separators in path comparisons (#911) and
`partial.startsWith("/")` as an "is absolute path" heuristic (#922) both
sailed through `ubuntu-latest` while shipping broken on the platform
that most of the user base actually runs.

Add `windows-latest` to the existing matrix so every PR exercises the
Windows code paths (taskkill tree-kill, MS Store node-shim detection,
path separator handling, etc.) before review. Job name now includes the
OS so the two runs are distinguishable in branch protection.

Also swap the hardcoded `/tmp/tau-dry.json` in the τ-bench dry-run for
`${{ runner.temp }}` — RUNNER_TEMP is set on every GitHub Actions runner
including Windows, where `/tmp` isn't a path.

Co-authored-by: reasonix <reasonix@deepseek.com>
@esengine
Copy link
Copy Markdown
Owner

Both addressed cleanly — isAbsolute(partial) + parse(partial).root is exactly the shape I wanted, and the backslash→forward-slash normalization keeps parseAtQuery happy on Windows. Dir-only filter on the listDirectory result is the right place to do it.

Heads-up: the matrix CI change landed in #926 about an hour ago, so on your next contribution the build job will run on windows-latest too — the path-handling code in this PR would have been verified end-to-end there. This one's already CI-green on Linux; merging.

@esengine esengine merged commit 86088fd into esengine:main May 15, 2026
3 checks passed
@douglarek douglarek deleted the feat/cwd-path-completion branch May 15, 2026 10:08
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.

2 participants