improve empty repository onboarding#2250
Conversation
|
can u test it out @whoisasx on mac? |
|
Tested on mac LGTM |
| } | ||
|
|
||
| if _, err := gitOutput(ctx, path, "-c", "user.name=Agent Orchestrator", "-c", "user.email=ao@example.com", "commit", "--allow-empty", "-m", "initial commit"); err != nil { | ||
| return InitializeRepositoryResult{}, apierr.Invalid("INITIAL_COMMIT_FAILED", "Could not create the initial commit.", map[string]any{"error": err.Error()}) |
There was a problem hiding this comment.
if there's an error in any of these steps what are we showing the user? can we show the steps that they can follow manually?
illegalcall
left a comment
There was a problem hiding this comment.
Review notes on the Git initialization recovery path.
| return InitializeRepositoryResult{}, apierr.Conflict("PROJECT_ALREADY_INITIALIZED", "This repository already has commits.", map[string]any{"path": path}) | ||
| } | ||
|
|
||
| if _, err := gitOutput(ctx, path, "-c", "user.name=Agent Orchestrator", "-c", "user.email=ao@example.com", "commit", "--allow-empty", "-m", "initial commit"); err != nil { |
There was a problem hiding this comment.
This creates a valid HEAD, so git worktree add can succeed, but it does not stage any of the user's existing files. AO worktrees are checked out from the committed tree, so a selected folder with source files can register and spawn while the agent's worktree contains none of those files. Is the empty commit intentional? If not, this recovery should probably git add -A before the initial commit, and the test should assert that an existing file like notes.txt is present in HEAD after recovery.
| m.addMu.Lock() | ||
| defer m.addMu.Unlock() | ||
|
|
||
| if !isGitRepo(path) { |
There was a problem hiding this comment.
!isGitRepo(path) is broader than "plain folder". It also includes subdirectories inside an existing repository and bare/unsupported Git layouts. Running git init here can create a nested repo under a selected subdirectory, or mutate a bare repo into a different shape. Since this endpoint mutates the user's filesystem, can we classify the path before init: real plain folder => initialize; subdirectory of an existing repo => ask the user to select the repo root; bare/unsupported repo => reject clearly; normal unborn repo => create the first commit only?
|
Tested this branch on macOS with the Electron app. The non-git project recovery flow is working fine on Mac: selecting a non-git folder opens the Project agents dialog and correctly shows the “Set up Git to continue” recovery panel.
I noticed two UI alignment issues:
@somewherelostt we had discussed this first problem before as well. Can you please fix it in this PR? Likely place to check:
The
So the open animation should not cause the whole modal box to render off-center before settling.
Line to check:
Current span: <span className="grid size-4 shrink-0 place-items-center rounded-full bg-background text-[10px] text-passive">@somewherelostt can you please fix this alignment issue too? |
|
@whoisasx will do it maybe tomorrow. |
whoisasx
left a comment
There was a problem hiding this comment.
Tested this branch on macOS with the Electron app. The non-git project recovery flow works: selecting a non-git folder opens the Project agents dialog and shows the "Set up Git to continue" recovery panel.
Requesting changes for two UI alignment issues before this merges: the whole Project agents modal initially appears slightly up-left before snapping to center, and the 1/2/3 recovery step badges are not visually centered.
| <Dialog.Portal> | ||
| <Dialog.Overlay className="fixed inset-0 z-50 bg-black/55 data-[state=open]:animate-overlay-in" /> | ||
| <Dialog.Content className="fixed left-1/2 top-1/2 z-50 w-[min(420px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-border bg-popover p-0 text-popover-foreground shadow-xl data-[state=open]:animate-modal-in"> | ||
| <Dialog.Content className="fixed left-1/2 top-1/2 z-50 w-[min(460px,calc(100vw-32px))] -translate-x-1/2 -translate-y-1/2 rounded-lg border border-border bg-popover p-0 text-popover-foreground shadow-xl data-[state=open]:animate-modal-in"> |
There was a problem hiding this comment.
The entire Project agents modal initially appears slightly up-left from center, then snaps into the center after the opening animation finishes. We had discussed this problem before as well.
This line applies data-[state=open]:animate-modal-in while the content is already centered with left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2. Please adjust the modal animation so it does not re-apply or override the centering transform; the modal should be centered from the first frame. The likely root is frontend/src/renderer/styles.css:363, where modal-in sets transform: translate(-50%, -50%) scale(...).
| <div className="grid gap-1.5 text-[11px] text-muted-foreground"> | ||
| {recovery.steps.map((step, index) => ( | ||
| <div key={step} className="flex items-center gap-2"> | ||
| <span className="grid size-4 shrink-0 place-items-center rounded-full bg-background text-[10px] text-passive"> |
There was a problem hiding this comment.
The 1, 2, 3 step numbers in the recovery panel are not visually centered inside these circular badges. Please fix the badge alignment here as well; adding an explicit line-height such as leading-none / leading-[1] should center the numbers better.


Summary
Fixes #2182 .
This turns the empty-folder / unborn Git repository case into an onboarding flow instead of a generic validation failure.
Changes
NOT_A_GIT_REPOandPROJECT_UNBORNwith a clear setup card.Validation
go test ./internal/service/project ./internal/httpd/controllers ./internal/httpd/apispecnpm test -- Sidebar.test.tsxnpm run typechecklight theme

