feat(app): directory autocomplete for new session path picker#1077
feat(app): directory autocomplete for new session path picker#1077chphch wants to merge 2 commits into
Conversation
d436bd1 to
52fd08f
Compare
Proof — directory autocomplete drills correctlyCaptured locally via standalone
The GIF cycles three states:
Mock filesystem (substitutes for real {
'/home/user/': ['projects', 'project-alpha', 'project-beta', 'photos', 'docs'],
'/home/user/projects/': ['happy', 'happy-cli', 'happy-server', 'web-app', 'mobile-app'],
}Production behaviour matches: with a real machine connected, Capture details
|
0f1bee5 to
e194376
Compare
e194376 to
764c9c7
Compare
When a user types a project path in the new session screen, the path picker now shows filesystem directory suggestions fetched from the selected machine via `machineBash`. Suggestions are debounced (250ms), cached per (machineId, parentDir) pair for 10s, and filtered by the current typed prefix. Tapping a suggestion appends `/` so the user can keep drilling down. New hook: `useDirSuggestions(machineId, pathText)` Closes: slopus#44 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
764c9c7 to
6fe4fc0
Compare
useDirSuggestions previously shipped the user's typed parent directory
straight into `ls -1ap "${dir}"`. When the path picker is on its default
state (paths formatted relative to home, e.g. `~/proj`), the parent
ends up as `~/` and bash will not expand `~` inside double quotes — so
the ls silently produces no output and the suggestions list is always
empty, even though `Recent` continues to work.
Resolve the parent against the selected machine's `homeDir` before
calling `machineBash`. The user-typed parent is preserved in the
returned `fullPath` so drill-down still reads as `~/projects/happy/`
rather than the absolute form.
The pure split/resolve helper is extracted into
`useDirSuggestions.utils.ts` so the regression case can be covered by
plain vitest without dragging React + sync-ops into the test env.
11 unit tests added (tilde, absolute, relative, missing-homeDir,
Windows separator).
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Follow-up fix —
|

Closes #44.
What this adds: Live subdirectory autocomplete in the new-session "Project path" picker. As soon as the user types a path (e.g.
/home/user/proj) the picker fetches matching subdirs from the selected machine viamachineBash(ls -1ap) and shows them above the existing "Recent" list; tapping a suggestion appends/so the user can keep drilling down. Debounced 250ms, per-machine cache (10s TTL), no network or disk hit when no machine is selected or the field is empty.Proof
Screencast of typing a partial path → suggestions appear → tap → drill down: video pending — will attach before requesting human review per CONTRIBUTING.md.
How it works
Scope