Skip to content

Add projects through an Add a project dialog with the native folder picker - #223

Merged
yansfil merged 6 commits into
mainfrom
feat/add-project-dialog
Sep 28, 2026
Merged

yansfil merged 6 commits into
mainfrom
feat/add-project-dialog

Conversation

@yansfil

@yansfil yansfil commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adding a local project meant typing a path into a small panel at the bottom of the sidebar, completed from a home listing hided served.
That panel is gone. Every Add project entry point now opens a centered Add a project dialog: a Host selector, and on this Mac a Browse folder row (Enter) that opens macOS's own folder picker through a new sender-checked hide:pick-folder invoke channel.
The picked folder goes out as the existing create_workspace. A refusal stays in the dialog naming the folder, and the dialog closes when the project appears.
A device keeps a ~/ path field. A plain browser tab no longer offers Add project, and hided no longer lists home folders for registration.

Add a project on this Mac: Host selector and Browse folder, which holds the keyboard

Review

  • Judge: the dialog's look (reference was another app's dialog; this one is built from hide's Dialog, Select, Kbd and tokens), and the Browse folder subtitle copy.
  • Judge: ⌘⇧N is now titled Add project in the menu and the shortcut sheet, and has no browser chord (the ⌥⇧N move is gone).
  • Files to watch:
    • desktop/src/main/host.ts - security boundary: a new IPC handler; it reuses fromShell, answers null to any other sender, and logs no path.
    • hided/src/server.rs, hided/src/boundary.rs - failure path: the local remote_file_list home listing is removed, so a local one now reaches the core and is answered as an unconfigured target; the $HOME line for create_workspace is unchanged.
    • contracts/hided-ws.schema.json - snapshot wire: remote_file_list leaves the directory_list and path_refused kind enums.
    • web/src/AddProjectDialog.tsx - the answer is read, not assumed: a registration id new to the device closes it; path_refused, the core's workspace.create* error, or the shell's own already_registered keeps it open.
  • Question: design/hide-screens.pen still draws the old panel on Screen / Dialogs and Sheets (the guide says so). Redraw it in this PR, or as a follow-up?

Evidence

  • Confirmed:
    • Desktop e2e add-project.spec.ts, with the picker stubbed in the main process: a cancel leaves the dialog unchanged; an outside-home folder shows outside_home naming it and stays open; a home folder registers and closes the dialog.
    • The same spec also covers: re-picking that folder shows already_registered; ⌘⇧N, the Overview button and × work; a device Host gets a focused ~/ field and shows the device path's refusal.
    • Real native picker opened once from the dialog in an isolated dev app: a sheet on the window with New Folder. The capture stays local because it shows the workstation's file names.
    • Web e2e moved to registering over a second socket: s2 (outside home, .., a file refused by hided; a home folder registers; the browser offers no Add project), s4, s8, sidebar-shell, plus the s2 sheet test's moved-chord count (8 to 7).
    • cargo test -p hided including the rewritten registration_refusals_are_answered_by_hided and a_remote_listing_is_forwarded_untouched (local too). Also: clippy and fmt for hided; web and desktop typecheck, lint, unit (web 438, desktop 43) and build; design contract; repository hygiene scripts.
  • Not confirmed: the Electron File menu item was traced in code (menu.ts to keyboard.ts new_workspace), not clicked in e2e. The desktop spec checks the IPC sender only through the shell page; there is no test that a browser display page is refused. Full cargo test --workspace and the full web e2e suite were left to CI.
More evidence

A folder outside home: hided's outside_home, the folder named, the dialog kept for another pick

A device Host: the ~/ field, and the device path's refusal in the dialog

AI tooling: mostly AI tools; the stubbed-picker flows, the real picker and each capture were reviewed in captures of the running isolated app.

…icker

The sidebar's new-workspace panel is replaced by a centered Add a project
dialog: a Host selector, and on this Mac a Browse folder row that opens
macOS's folder picker through a sender-checked invoke channel. A device
keeps a ~/ path field. Refusals stay inside the dialog naming the folder.
A browser tab offers no Add project. hided no longer lists home folders
for registration, since nothing asks for them now.
The dialog now answers success by a registration id its device did not
have when the folder was sent, so a project removed meanwhile cannot hold
it open. Choosing a device hands the keyboard to its path field instead of
back to the selector. The desktop spec drives the device path to its
refusal, and the design guide names the new dialog.
A desktop typecheck left desktop/tsconfig.tsbuildinfo in the previous
commit; it is removed and every tsbuildinfo is ignored.
@yansfil
yansfil merged commit 003305f into main Sep 28, 2026
7 checks passed
@yansfil
yansfil deleted the feat/add-project-dialog branch September 28, 2026 05:32
yansfil added a commit that referenced this pull request Sep 28, 2026
Related: follows #223 (Add a project dialog). Clone from URL lands
separately in the same "Other ways to add" group.

## Summary

Add a project could only register a folder that already exists.
Now, on this Mac, an "Other ways to add" group sits under Browse folder,
and `Create new project` names a folder, shows where it goes, and makes
it with its own Git repository before registering it, in one step.
hided answers a new `project_target` probe on the same `$HOME` line the
create is checked on, so a taken name, a folder outside home, or an
invalid name shows inline before anything is sent.
The core's existing creation worker makes the folder and runs `git init`
off the runtime lock; a failed create keeps its folder, and a retry
continues into it.

![Create a new project view: name field, location row with the full
path, Create
project](https://github.com/yansfil/pr-assets/blob/main/herdr-ide/create-new-project/b82120c/create-project-crop.png?raw=true)

The location row names the parent as `~` spells it; the full path under
it follows the name as it is typed (the long path here is the e2e
fixture's temporary home).

## Review

- **Judge**: a target that is an empty folder, or holds only `.git` and
`.DS_Store`, counts as a leftover of a failed create and is continued
into instead of refused as existing. This is how behavior 5 (retry
converges, nothing deleted) and "existing target refused" were
reconciled; the view says "An empty folder by this name is already
there; the project is made in it."
- **Judge**: copy - title "Create a new project", description "Name it,
and Hide makes the folder with its own Git repository and adds it.", row
detail "A new folder with its own Git repository".
- **Files to watch**:
- `hided/src/boundary.rs`, `hided/src/server.rs` - the `$HOME` boundary:
`resolve_new_project` allows home itself as the parent (the new folder
is still strictly under it) and never follows a symlink at the target.
- `herdr-core/src/live.rs` - failure path: the folder is made at the
literal checked path before `registration()` canonicalizes it (a review
finding fixed in the second commit).
- `contracts/hided-ws.schema.json` - WS contract: new `project_target`
frame, `projectTarget`/`projectTargetResult` defs, `already_exists`
reason, `new_folder` on `create_workspace`.
- `web/src/registration.tsx` - the send/answer logic Browse folder used
is extracted here and shared by both views; D3 will want it too.

## Evidence

- **Confirmed**:
- Desktop e2e `desktop/e2e/add-project.spec.ts` against an isolated
Herdr and a dev Electron app, 2/2 passing: the new test opens the view
(name focused, default `~`), picks `~/projects` through the stubbed
picker, sees `already_exists` for a folder with a file, the name problem
for `a/b`, creates `fresh` with Enter, then asserts the dialog closes,
the project row appears, `fresh/.git` is a directory, the taken folder
is untouched, a reopen defaults beside `fresh` and refuses the same name
as `already_registered`, and Back returns focus to the row.
- The existing Browse folder, cancel, `outside_home`,
`already_registered` and device-field flows still pass in the same spec.
- Core unit test: folder made as its own repository inside another
repository's tree; a retry, an empty folder and a `.DS_Store`-only
folder are continued into; a folder with contents, a file, and a symlink
at the name are refused and left untouched.
- hided test: probe answers parent label, full path, leftover and each
refusal (`already_exists`, `invalid_path`, `not_found`, `outside_home`)
and makes nothing; `new_folder` creates are forwarded as the canonical
path or refused with the path as sent.
- Core runtime test: a `new_folder` create naming an SSH device is
refused.
- `verify-cargo.sh lint`, `verify-web.sh` (web 443 tests, desktop 44,
typecheck, lint, build), `check-design-contract.mjs`: pass.
- Two native review passes; findings fixed: a symlink race at the leaf
(core canonicalized before creating) and `.DS_Store` breaking retry
convergence.
- **Not confirmed**:
- Under load (six parallel builds, load average about 10) one full
`herdr-core` run failed 3 unrelated deadline tests (`github::tests` gh
timeouts, `live::tests::a_hung_hcoord_link...`); they pass on rerun and
passed in the earlier full run.
- A real `git init` failure (git missing) was not exercised live; its
message path is covered only by reading.
- Not observed against the installed app; QA used the dev app from this
branch only.

<details><summary>More evidence</summary>

![Add a project with the Other ways to add
group](https://github.com/yansfil/pr-assets/blob/main/herdr-ide/create-new-project/b82120c/add-dialog-crop.png?raw=true)

The first view: Browse folder keeps the keyboard; Create new project
sits under "Other ways to add", on this Mac only.

</details>

**AI tooling**: mostly AI tools; the diff, the boundary checks, and the
e2e screenshots were read by hand.
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