feat: fork a public GitHub project when creating a project - #261
Open
divaspoudel0 wants to merge 1 commit into
Open
feat: fork a public GitHub project when creating a project#261divaspoudel0 wants to merge 1 commit into
divaspoudel0 wants to merge 1 commit into
Conversation
Add a "From GitHub" mode to the new-project dialog that forks a public GitHub repository under the authenticated account and clones the fork into the project folder. - POST /api/projects accepts forkUrl (takes precedence over cloneUrl); the handler forks via `gh repo fork`, clones the fork, and records the original as `upstream` while keeping `origin` on the fork. - local::github::fork_public_repo and canonical_repo_url support the fork flow; prepare_path keeps origin on the fork and adds upstream. - NewProjectForm gains a "From GitHub" mode with URL validation, fork destination, and gh-auth requirement; api.ts sends forkUrl. - New i18n strings added for en, zh-CN, and fa.
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
Adds a "From GitHub" mode to the new-project dialog so a project can be created by forking a public GitHub repository under the authenticated account, then cloning that fork locally.
How it works
https://github.com/owner/repo.gh repo fork owner/repo(creates the fork under your GitHub account, no local clone / remote changes), then clones the fork into the project folder:origin→ your fork (so experiment branches push to your own fork)upstream→ the original repositoryRequires
ghto be installed and authenticated (gh auth login); the form disables creation with a hint when it isn't.Changes
local/github.rs:fork_public_repo()(idempotentgh repo fork) andcanonical_repo_url().local/git.rs:set_remote_url()(add or update a remote).local/projects.rs:CreateProjectOptionsgainsupstream_url; cloning keepsoriginon the fork and records the original asupstream(previously clones always renamedorigin→upstream). New testfork_clone_keeps_origin_and_records_upstream.commands/up.rs:POST /api/projectsacceptsforkUrl(takes precedence overcloneUrl), forks, then clones the fork.NewProjectForm.tsx: new "From GitHub" mode with URL validation, fork-destination field, and gh-auth requirement.api.ts:forkUrlinNewProject.en,zh-CN, andfa.ui/distassets.Verification
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo build --lockedall passcargo test --bin orx: 671 passednode ui/scripts/check-i18n.mjs,tsc --noEmit, and UI tests (59) passvite buildreproduces the committedui/distbyte-for-byteThe one red check expected in CI is
dev-slot.test.mjs: its SQLite-backup test requires thesqlite3command-line tool, which is an environment dependency unrelated to this change.