Repository navigation
Create a new project from the Add a project dialog - #229
Merged
Merged
Conversation
The dialog gains an Other ways to add group under Browse folder; Create new project names a folder, shows where it goes, and makes it with its own Git repository before registering it. hided judges the parent on the $HOME line and answers a project_target probe so problems show before anything is sent; the core's creation worker makes the folder and runs git init off the lock. A leftover empty folder from a failed attempt is continued into, never deleted.
The creation worker canonicalized the path before making the folder, so a symlink planted at the name after hided's check would have been followed. The folder is now made at the literal path first. A Finder .DS_Store no longer turns a leftover folder into one a retry refuses.
yansfil
added a commit
that referenced
this pull request
Sep 28, 2026
## Summary Add a project could only register a folder that already exists. Under `Browse folder` there is now an "Other ways to add" group with `Clone from URL`: paste a Git URL, pick a parent folder under home, and the repository is cloned in the background with visible progress and a Cancel, then registered through the existing `create_workspace` path; the dialog closes when the project appears. The clone is one core job (`repository_clone` snapshot slot) run by a worker off the lock; `hide_host::clone` runs `git clone` in its own process group with no prompts, into a hidden staging folder renamed into place only on success, so a cancel, a stall (120 s with no output) or a failure leaves nothing under the target's name. Local host only; a device's Host shows no such option.  ## Review - **Judge**: the look of the sub-view and the "Other ways to add" row (built from hide's Dialog, Input, Button, Status and tokens after the reference); the copy of the failure lines, for example "Authentication failed: this repository needs credentials Git could not find...". - **Judge**: `file://` is accepted as a clone source next to https and ssh. The e2e and tests need it, and it only reads what the operator's account can already read; say if it should be test-only. - **Judge**: closing the dialog leaves a running clone running (it registers when done); reopening Add a project shows it. The alternative is to cancel on close. - **Files to watch**: - `hide-host/src/clone.rs` - failure path and process ownership: process group kill on every exit, staging cleanup, `RENAME_EXCL` move, stderr classification, credential redaction. - `herdr-core/src/runtime/clone.rs` - runtime mutex: the worker locks only to write progress and the result; one slot, a repeated request joins the running clone. - `hided/src/boundary.rs`, `hided/src/server.rs` - the `$HOME` line for `clone_repository` (a taken name is `already_exists`, the code Create new project uses, but a clone accepts no leftover folder) and a `clone_target` probe answered beside #229's `project_target`. - `contracts/hided-ws.schema.json`, `herdr-core/src/model.rs` - snapshot wire: new `clone_target` frame, `repository_clone` rest field. - `web/src/AddProjectDialog.tsx`, `web/src/CloneFromUrl.tsx` - merged with #229: Clone from URL is a second row of its `OTHER_WAYS` list, and the registration a finished clone makes is read through its `useRegistration`. ## Evidence - **Confirmed**: - Live, in a dev app I launched against an isolated Herdr and HOME: cloning `microsoft/TypeScript` showed Receiving objects with percent, and Cancel left the parent folder empty. A missing `github.com` repository failed with the authentication line, leaving nothing on disk. `octocat/Hello-World` cloned, registered, and closed the dialog. - `hide-host` clone tests (5, real `git`): a `file://` bare repository clones with progress; a cancel partway leaves no folder; a server that accepts and never answers ends as stalled after the limit, leaving nothing; a taken name is refused before Git runs; a missing repository reads as not found. Plus 6 unit tests for URL parsing, progress lines, failure classification and redaction. - Core (4): a finished clone reaches `create_workspace`; the same clone sent twice runs once with one registration and another clone is refused as busy; a cancel leaves no folder and registers nothing; a mismatched name or an `ext::` URL is refused before anything runs. - hided (2): the `$HOME` line accepts `~` and folders under it, refuses taken names (dangling symlinks too), `..`, outside home and missing parents; `clone_target` is answered without reaching the core. - Desktop e2e `add-project.spec.ts` (new case): invalid URL inline, `target_exists` inline, picker-chosen parent, clone and registration, parent defaulting beside the new project, Back. The whole desktop e2e suite passed locally (18 passed, 1 skipped as on main). - `cargo test --workspace` 1394 passed, clippy and fmt clean, web typecheck/lint/444 unit tests, desktop typecheck/lint, structural checks, design contract. - Two review passes (code, security and fidelity). Fixed: a registration failure after a finished clone now shows the reason and the folder on disk instead of waiting forever; `::` transport-helper URLs are refused by both parsers; a panicking clone worker still settles the slot. - After merging main (#229): `cargo test --workspace` 1397 passed, clippy and fmt clean, web 452 unit tests, and all three `add-project.spec.ts` cases (Browse folder, Create new project, Clone from URL) passed locally. - **Not confirmed**: - An ssh (`git@host:path`) clone was not run live; its flags are covered only by code reading. - A GUI credential helper configured by the operator could still show its own window; the stall limit bounds the wait. - A daemon killed mid-clone leaves its hidden `.<name>.hide-clone-<pid>` staging folder behind (documented). - The parent is checked by path in hided and used by path in the core, like `create_workspace` today; a process that can already write inside home could swap an ancestor between the check and the clone (follow-up: pin the parent by handle). - `design/hide-screens.pen` does not draw the sub-view yet. <details><summary>More evidence</summary> Add a project on this Mac with the new "Other ways to add" group.  A repository that needs sign-in (or does not exist), with no prompt and nothing kept.  </details> **AI tooling**: mostly AI tools; I read the process, cleanup and boundary code paths and watched the live clone, cancel and failure in the dev app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 projectnames 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_targetprobe on the same$HOMEline 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 initoff the runtime lock; a failed create keeps its folder, and a retry continues into it.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
.gitand.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."hided/src/boundary.rs,hided/src/server.rs- the$HOMEboundary:resolve_new_projectallows 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 beforeregistration()canonicalizes it (a review finding fixed in the second commit).contracts/hided-ws.schema.json- WS contract: newproject_targetframe,projectTarget/projectTargetResultdefs,already_existsreason,new_folderoncreate_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
desktop/e2e/add-project.spec.tsagainst an isolated Herdr and a dev Electron app, 2/2 passing: the new test opens the view (name focused, default~), picks~/projectsthrough the stubbed picker, seesalready_existsfor a folder with a file, the name problem fora/b, createsfreshwith Enter, then asserts the dialog closes, the project row appears,fresh/.gitis a directory, the taken folder is untouched, a reopen defaults besidefreshand refuses the same name asalready_registered, and Back returns focus to the row.outside_home,already_registeredand device-field flows still pass in the same spec..DS_Store-only folder are continued into; a folder with contents, a file, and a symlink at the name are refused and left untouched.already_exists,invalid_path,not_found,outside_home) and makes nothing;new_foldercreates are forwarded as the canonical path or refused with the path as sent.new_foldercreate 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..DS_Storebreaking retry convergence.herdr-corerun failed 3 unrelated deadline tests (github::testsgh timeouts,live::tests::a_hung_hcoord_link...); they pass on rerun and passed in the earlier full run.git initfailure (git missing) was not exercised live; its message path is covered only by reading.More evidence
The first view: Browse folder keeps the keyboard; Create new project sits under "Other ways to add", on this Mac only.
AI tooling: mostly AI tools; the diff, the boundary checks, and the e2e screenshots were read by hand.