Skip to content

feat: fork a public GitHub project when creating a project - #261

Open
divaspoudel0 wants to merge 1 commit into
alphaXiv:mainfrom
divaspoudel0:feat/fork-github-project-on-create
Open

feat: fork a public GitHub project when creating a project#261
divaspoudel0 wants to merge 1 commit into
alphaXiv:mainfrom
divaspoudel0:feat/fork-github-project-on-create

Conversation

@divaspoudel0

Copy link
Copy Markdown

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

  1. In the New Project dialog you now pick From GitHub (next to Blank project / Existing folder / From a paper).
  2. Enter a public repo URL like https://github.com/owner/repo.
  3. On create, the CLI runs 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 repository

Requires gh to be installed and authenticated (gh auth login); the form disables creation with a hint when it isn't.

Changes

  • Backend
    • local/github.rs: fork_public_repo() (idempotent gh repo fork) and canonical_repo_url().
    • local/git.rs: set_remote_url() (add or update a remote).
    • local/projects.rs: CreateProjectOptions gains upstream_url; cloning keeps origin on the fork and records the original as upstream (previously clones always renamed originupstream). New test fork_clone_keeps_origin_and_records_upstream.
    • commands/up.rs: POST /api/projects accepts forkUrl (takes precedence over cloneUrl), forks, then clones the fork.
  • Frontend
    • NewProjectForm.tsx: new "From GitHub" mode with URL validation, fork-destination field, and gh-auth requirement.
    • api.ts: forkUrl in NewProject.
    • i18n strings added for en, zh-CN, and fa.
  • Build: regenerated committed ui/dist assets.

Verification

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo build --locked all pass
  • cargo test --bin orx: 671 passed
  • node ui/scripts/check-i18n.mjs, tsc --noEmit, and UI tests (59) pass
  • Fresh vite build reproduces the committed ui/dist byte-for-byte

The one red check expected in CI is dev-slot.test.mjs: its SQLite-backup test requires the sqlite3 command-line tool, which is an environment dependency unrelated to this change.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant