Skip to content

Add customizable local repo creation flow - #845

Closed
sebastianbreguel wants to merge 1 commit into
stablyai:mainfrom
sebastianbreguel:feat/customizable-local-repo-flow
Closed

sebastianbreguel wants to merge 1 commit into
stablyai:mainfrom
sebastianbreguel:feat/customizable-local-repo-flow

Conversation

@sebastianbreguel

@sebastianbreguel sebastianbreguel commented Apr 19, 2026 •

Copy link
Copy Markdown

Summary

Adds a "Create local repo or folder" flow to the Add Repo dialog, so users can spin up a new project directly from Orca instead of creating the folder elsewhere and re-importing it.

What's new

  • IPC handler repos:createLocal in src/main/ipc/repos.ts:
    • Validates parent path + name (rejects /, \, ., .. to prevent escaping the parent).
    • mkdir { recursive: false } so collisions surface as EEXIST with a clear error.
    • git init when kind === 'git'; on failure, rolls back the folder (rm -rf) so state stays atomic.
    • Explicit errno handling: EEXIST, ENOENT, EACCES/EPERM.
    • Deduplicates against existing repos by absolute path.
  • UI: new CreateLocalStep in AddRepoSteps.tsx with kind toggle (Git repo / Folder only), name input, parent-path picker.
  • Shortcut: Shift+Cmd/Ctrl+N opens Add Repo — chosen over bare Cmd+N (already owned by new-workspace composer). Wired via shared window-shortcut-policy + main-process forwarding (ui:openAddRepo).
  • Preload bindings for createLocal + openAddRepo event.

Design notes

  • Safety-first: non-recursive mkdir + atomic rollback on git init failure, so the filesystem never ends up half-created.
  • isEditableTarget guard at App.tsx:504 already short-circuits shortcuts when typing in inputs — no regression.
  • Comments document the why per the repo's CLAUDE.md convention (recursive:false, rollback rationale, shortcut collision).

Test plan

Automated

  • oxlint on 17 PR files → 0 warnings, 0 errors
  • Unit tests (46/46 pass) across:
    • src/main/ipc/repos-create-local.test.ts (new — 162 lines)
    • src/shared/window-shortcut-policy.test.ts
    • src/main/window/createMainWindow.test.ts
    • src/main/browser/browser-manager.test.ts
    • src/renderer/src/hooks/useIpcEvents.test.ts

Manual

  • Open Add Repo → Create → pick parent folder, type name, select Git repo → verify .git/ exists and repo appears in sidebar
  • Same flow with Folder only → no .git/, repo still appears
  • Collision: try creating a name that already exists → error surfaces, no partial state
  • Permission denied: pick a read-only parent → clear error, no partial state
  • Shortcut: Shift+Cmd/Ctrl+N opens Add Repo from the main window and while a browser tab has focus
  • Shortcut safety: Shift+N while typing in an input → does NOT open the dialog

@sebastianbreguel

Copy link
Copy Markdown
Author

Local verification

Lint (oxlint on 17 PR files):

Found 0 warnings and 0 errors.
Finished in 18ms on 17 files with 131 rules.

Tests (PR-scoped suites):

  • src/main/ipc/repos-create-local.test.ts
  • src/shared/window-shortcut-policy.test.ts
  • src/main/window/createMainWindow.test.ts
  • src/main/browser/browser-manager.test.ts
  • src/renderer/src/hooks/useIpcEvents.test.ts
PASS (46) FAIL (0)

Full-suite run surfaced 1 flaky timeout in src/relay/git-handler.test.ts > detects untracked files — pre-existing, not touched by this PR (last modified in #590 cc66e12).

Self-review summary

  • Safety-first: mkdir { recursive: false } to surface collisions, atomic rollback via rm if git init fails, name validation rejects path separators (/, \, ., ..).
  • Scope tight: one IPC handler (repos:createLocal), one UI step, one shortcut (Shift+Cmd/Ctrl+N).
  • Shortcut guard: isEditableTarget(e.target) check at App.tsx:504 already short-circuits all shortcuts below it, so Shift+N is safe inside inputs.
  • Comments explain the why per the repo's CLAUDE.md convention (recursive:false choice, rollback rationale, shortcut collision rationale).
  • Test ratio: 162 lines of test for 107 lines of new handler code in repos.ts.

Ready for review.

@AmethystLiang
AmethystLiang requested review from Jinwoo-H and brennanb2025 and removed request for Jinwoo-H April 20, 2026 06:01
@AmethystLiang

Copy link
Copy Markdown
Contributor

Thx for the PR! @brennanb2025 will review it

@brennanb2025 brennanb2025 self-assigned this Apr 24, 2026
@nwparker nwparker added the size/l Large PR (≤2500 added lines, ≤50 files) label Apr 26, 2026
@brennanb2025

Copy link
Copy Markdown
Contributor

Hi @sebastianbreguel, apologies about the delay responding here, this feature was added recently. Appreciate the PR though!
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l Large PR (≤2500 added lines, ≤50 files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants