Files
headquarter/openspec/changes/archive/2026-05-22-git-repo-working-clones/design.md
T
Fusion 063a839790 feat: implement repository clone mode with SSH key support
- Add clone_mode and branch fields to tool_instances
- Add ssh_key_id to git_repositories for per-repo SSH key assignment
- Implement host-side git cloning with branch selection (default: main)
- Mount SSH keys into containers for git operations in clone mode
- Add dirty state check on clone-mode instance deletion with confirmation
- Update SessionsPage with mount/clone selector, branch input, SSH key display
- Add SSH key selector to repository creation form
- Add dirty delete confirmation modal with changed files list
- Update API schemas and endpoints for new fields
- Sync delta specs to main specs (git-repo, tool-instances, repo-clone-mode)
- Archive completed OpenSpec change: repo-clone-mode-with-ssh
- Document git requirement for custom tool types

Quality gates: Frontend typecheck and build passed
OpenSpec: repo-clone-mode-with-ssh archived with all tasks complete
2026-05-22 22:56:35 +02:00

1.4 KiB

Context

Repository creation currently produces mirrored bare repos for any remote clone and bare repos for blank creations. The workspace, file browser, commit editor, and git toolbar are built around a working-tree repository model, so users can hit 400s when they try to sync or when the repo has no usable branch state.

Goals

  • Create working clones for remote repositories
  • Create working repos with an initial branch for blank repositories
  • Preserve the existing repository create endpoint and shared UI flow
  • Keep fetch/pull/push aligned with a normal local clone

Decisions

  1. Clone mode
  • Use git clone without --mirror
  • Keep the existing remote URL preflight and URL parsing behavior
  1. Blank repositories
  • Initialize with git init -b main when supported
  • Fall back to git init plus git symbolic-ref HEAD refs/heads/main if needed
  1. Branch state
  • Treat main as the initial branch name for blank repos
  • Make branch listing and current-branch helpers tolerate unborn HEAD
  1. Pull behavior
  • Prefer the current branch when no explicit branch is supplied
  • Do not force origin <branch> if the branch is unborn or already tracked by the current checkout

Risks

  • Some older git versions may not support git init -b; the backend should fall back cleanly
  • Existing blank repos created under the old bare model may still require migration or cleanup outside this change