feat(domain): add auto-fork support for remote repos without push access#434
Open
arielshad wants to merge 3 commits intofeat/remote-repo-supportfrom
Open
feat(domain): add auto-fork support for remote repos without push access#434arielshad wants to merge 3 commits intofeat/remote-repo-supportfrom
arielshad wants to merge 3 commits intofeat/remote-repo-supportfrom
Conversation
When --remote targets a repo the user cannot push to, shep now auto-forks it to the user's GitHub account, clones the fork, sets upstream remote, and records fork metadata (isFork, upstreamUrl). - Add isFork/upstreamUrl fields to Repository TypeSpec model - Add DB migration 044 for fork columns - Add checkPushAccess, forkRepository, getAuthenticatedUser to IGitHubRepositoryService - Extend ImportGitHubRepositoryUseCase with fork detection flow - Show fork status in CLI output and handle GitHubForkError - Add Fork badge in Web UI repository combobox - Return forked status from import server action - Add comprehensive unit tests for all new functionality Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
Author
|
This might be redundant |
Add UI evidence for the remote repo support feature: - RepositoryCombobox: stories for forked repos with badge display, pre-selected fork with upstream tooltip, and forks with import - FeatureCreateDrawer: story demonstrating forked repos in selector - GitHubImportDialog: complete placeholder stories with interactive play functions for URL tab, Browse tab, and pre-opened states Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
replace manual expand/collapse state with radix accordion primitive so all task cards are collapsed by default with smooth animated accordion-like expand and collapse behavior Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
9 tasks
arielshad
added a commit
that referenced
this pull request
Apr 6, 2026
) ## Summary Adds three related capabilities for working with remote GitHub repositories, unifying the work from PRs #409, #430, and #434 into a single feature on current main: - **`shep repo init-remote [name]`** — creates a GitHub repository from a local one with no remote (via `gh repo create --source=. --remote=origin --push`) - **`shep feat new --remote <url>`** — clones (or auto-forks) a GitHub repo then creates a feature on it, conflicts with `--repo` - **Web UI** — shows a "Fork" badge on forked repositories in the repo picker; `githubImport` feature flag now defaults to `true` ## Key changes ### Domain - `Repository` entity gains `isFork?: boolean` and `upstreamUrl?: string` (TypeSpec + generated output) - Migration `055-add-repository-fork-fields` adds `is_fork` and `upstream_url` columns + `idx_repositories_upstream_url` index (idempotent) ### Auto-fork detection - `IGitHubRepositoryService` gains `getAuthenticatedUser()`, `checkPushAccess()`, `forkRepository()` + `GitHubForkError` - `ImportGitHubRepositoryUseCase` now checks push access before cloning. When the user lacks write permission, it forks via `gh repo fork`, clones the fork, sets `upstream` remote, and persists fork metadata - `IRepositoryRepository.findByUpstreamUrl()` for fork deduplication ### Init remote - `IGitPrService` gains `createGitHubRepo()`, `addRemote()` + `REMOTE_ALREADY_EXISTS`, `REPO_CREATE_FAILED` error codes - New `InitRemoteRepositoryUseCase` guards against existing remotes and delegates to `gh repo create` ### Feature creation from remote - New `CreateFeatureFromRemoteUseCase` — composite that chains import → create feature - Two-phase API: `execute()` for CLI, `createRecord()` + `initializeAndSpawn()` for Web (fast optimistic UI) ### i18n - New translation keys for `repo.initRemote.*` and `feat.new.{remoteOption,remoteConflict,forkedInfo}` added to all 8 locales ## Test plan - [x] `pnpm typecheck` — zero errors - [x] `pnpm lint:fix` — clean - [x] `pnpm test:unit` — **388 files, 5585 tests passing** (includes 44 new tests) - [x] `pnpm test:int` — **50 files, 595 tests passing** (migration 055 runs cleanly) - [x] `pnpm build` — clean CLI build - [x] `pnpm build:storybook` — clean storybook build with new `WithForkBadges` story - [ ] Manual: `shep repo init-remote my-test-repo` on a fresh local repo - [ ] Manual: `shep feat new --remote https://github.com/someone/public-repo "test feature"` (triggers auto-fork path) - [ ] Manual: Web UI — import a repo you don't have push access to, verify "Fork" badge appears ## Notes - Complementary to existing `IGitForkService` (PR #525, merged) which handles fork-and-PR **within** worktrees. The new fork methods on `IGitHubRepositoryService` handle auto-fork at **import time** — these are different code paths and do not conflict. - Migration 055 uses the umzug `MigrationParams` signature with idempotent column/index checks, consistent with migration 054. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <[email protected]>
blackpc
pushed a commit
that referenced
this pull request
Apr 6, 2026
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.
Summary
--remotetargets a repo the user can't push to, shep auto-forks it, clones the fork, sets upstream remote, and records fork metadataisForkandupstreamUrlfields to the Repository domain model (TypeSpec + migration + mapper)checkPushAccess,forkRepository,getAuthenticatedUsermethods toIGitHubRepositoryServiceImportGitHubRepositoryUseCasewith automatic fork detection and conditional fork/clone flowGitHubForkErrorremoteUrlandupstreamUrlto avoid re-importingTest plan
pnpm validatepasses (lint, format, typecheck, tsp)pnpm test:unit— 334 files, 4573 tests passpnpm buildsucceedsshep feat new --remote <public-repo-you-dont-own> "test"→ forks, clones fork, sets upstreamshep feat new --remote <repo-you-own> "test"→ clones directly, no fork🤖 Generated with Claude Code