Skip to content

[Feature]: Browse host directories to add new projects from mobile New Workspace flow #28638

Done

Description

@zhangxaochen

Problem or use case

In the Orca Mobile app (iOS / Android), tapping the floating + button (NewWorkspaceFab) opens NewWorktreeModal, which only lets users create a worktree inside repositories that have already been imported on the connected desktop/relay host (repo.list).

If a user connects to their host from mobile and wants to start working on a repository or folder that exists on the host's filesystem but has not yet been added to Orca's project list (or when the host currently has zero imported projects and shows "No projects found"), there is no way to browse the host's directories and register a new project from the mobile client.

Proposed solution

Add a host directory browser (HostDirectoryBrowserDrawer) to the mobile NewWorktreeModal flow, reusing the existing workspace-scoped host RPCs (files.browseServerDir and repo.add):

  1. Entry points in NewWorktreeModal:
    • Add a + Add project footer action inside the Project picker (PickerListDrawer).
    • Show an Add project action button directly in NewWorktreeFormSheet when the connected host has no imported projects (!hasRepos), or allow opening the project picker / directory browser.
  2. Cross-platform host directory browsing (files.browseServerDir):
    • Open at the host user's home directory (~).
    • Support navigating into subdirectories, going up to the parent directory (..), jumping back to ~, and typing/filtering paths directly.
    • Respect the pathFlavor: 'win32' | 'posix' field returned by files.browseServerDir using pure string path utilities (mobile/src/components/host-directory-browser-paths.ts — no node:path dependency in the React Native bundle). On Windows hosts (win32), navigating up from a drive root (C:\) requests '/', which triggers the host's listWindowsDrives() so users can switch between mounted drives (C:\, D:\, etc.).
  3. Registering and selecting the project (repo.add):
    • Allow choosing project kind (git repository or plain folder workspace, defaulting to git).
    • Call repo.add({ path: resolvedPath, kind }), upsert the returned MobileWorkspaceRepo into the mobile repository state + cache, auto-select it, and return to the New Workspace form sheet.

Alternatives or additional context

  • Existing host capability: Both files.browseServerDir (src/main/runtime/rpc/methods/files.ts) and repo.add (src/main/runtime/rpc/methods/repo.ts) already exist on the host with permission: 'workspace', which paired mobile clients already hold, and already support Windows drive enumeration (listWindowsDrives) as well as POSIX paths on macOS/Linux/SSH relays. No backend RPC or wire breaking changes are needed.
  • Alternative considered: Requiring users to type a raw absolute host path in a text box without directory browsing. Rejected because typing full host paths on a phone keyboard is error-prone and requires knowing the exact directory layout across Windows/macOS/Linux hosts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions