- Document architecture, CUJs, safety invariants, and phased implementation plan for skills/gitea-to-github/ - Specify zero-network session-start Gitea-origin trigger with sovereign opt-out in profile/AGENTS.md - Incorporate EGM Stages 5-9 review resolutions (non-git new-repo CWD, mirror-sync polling, CI security, and entity migration)
40 KiB
gitea-to-github Migration Skill Design
- Author: kiskaadee
- Status: Draft
- Date: 2026-11-26
Overview
gitea-to-github is an on-demand portable skill in kiskaadee/skills (skills/gitea-to-github/SKILL.md, <= 80 lines) that migrates standalone repositories or Gitea organizations from self-hosted Gitea (gt) to GitHub (gh + new-repo, the user's repo-provisioning CLI), reconfiguring each migrated Gitea repository as an out-of-band pull mirror of GitHub. It handles full git history transfer, in-flight Gitea PR resolution, interactive curation of open issues and milestones, GitHub Projects v2 board onboarding, .gitea/workflows/ CI pipeline migration to .github/workflows/, and AGENTS.md planning contract updates to project_number: <int>. In parallel, profile/AGENTS.md (the user-global session-start instruction file, distinct from per-repo AGENTS.md) adds a session-start check that detects Gitea origin remotes (when not explicitly marked sovereign/Gitea-only) and suggests running /gitea-to-github.
The Problem
Following the migration of the core delivery loop (projects, implement, code-review, verify) and reconcile-docs to GitHub-native workflows, existing repositories hosted on self-hosted Gitea still face four migration barriers:
- Manual multi-step repo and mirror inversion is error-prone: Migrating a Gitea repository to GitHub primary + Gitea pull mirror requires creating an empty GitHub repository (
new-repo --empty --no-mirror --no-clone), pushing branches and tags without Gitea's internalrefs/pull/*refs, flipping localorigin, archiving/replacing the source Gitea repository vianew-repo --gitea-mirror, and aligning visibility (internal->private). Deleting Gitea prematurely risks losing closed PRs, closed issues, releases, and webhooks if mirror creation fails. - CI pipelines target Gitea runners and context: Existing
.gitea/workflows/files reference${{ gitea.* }},GITEA_TOKEN, Gitea action URLs, and Gitea runner labels, so they fail or remain inactive on GitHub Actions unless translated to.github/workflows/. - Open issues, milestones, boards, and legacy
AGENTS.mdcontracts lag behind: Repositories retain legacygitea-planAGENTS.mdcontracts (hardcoded Gitea board/column IDs and hex colors), open Gitea issues, and classic Gitea boards. Resuming an interrupted migration without an immutable provenance key risks duplicating GitHub issues. - Unmigrated repositories lack proactive discovery: Agents starting work in an unmigrated Gitea repository only discover the forge mismatch after running a GitHub delivery skill (
projects,implement,verify), rather than receiving a targeted migration suggestion at session start (while intentionally Gitea-only repositories need a way to opt out).
Goals
- Safe, non-destructive repo and mirror inversion: Create empty GitHub targets via
new-repo --empty --no-mirror --no-clone, fail fast on Git LFS (git lfs ls-files), export a local Gitea API JSON snapshot before any destructive action, push all branches and tags cleanly, rename the Gitea source repo to<repo>-archive-<timestamp>, attach the Gitea pull mirror vianew-repo --gitea-mirror, verify mirror sync, and delete the archive only upon explicit confirmation. - Dry-run default and multi-repo organization migration: Default to a read-only dry-run inventory table across standalone repos and Gitea organizations, segmenting clean-slate repos (sequential execution from one approval) from interactive-gated repos (open PRs or uncurated issues) before mutating either forge.
- CI pipeline migration: Detect
.gitea/workflows/and Gitea-targeting CI references, translate them to.github/workflows/(${{ gitea.* }}->${{ github.* }},GITEA_TOKEN->GITHUB_TOKEN, GitHub-hostedubuntu-latestdefault, orself-hostedopted in forprivaterepos only), warn on unmigrated secrets, and commit them alongside any updatedAGENTS.mdin an ephemeral/tmp/clone before creating the Gitea pull mirror. - Idempotent issue, milestone, and conditional board migration: Stamp
<!-- gitea-origin: <gitea-host>/<owner>/<repo>#<number> -->(with<gitea-host>derived fromoriginor activegthost config, normalized to lowercase hostname without scheme or port) in migrated GitHub issue bodies, paginate existing GitHub issues and milestones fordiagnose-pause resumability, conditionally onboard issues to a 5-column Projects v2 board (only when a legacy Gitea board/contract exists or when explicitly opted in during dry-run, leaving new boards for boardless repos to/projects), and propose rewriting legacyAGENTS.mdcontracts toproject_number: <int>. - Zero-network session-start nudge with sovereign opt-out: Update
profile/AGENTS.md(user-global session-start instructions) to detect Giteaoriginremotes via local git/file checks only and suggest/gitea-to-github(or flipping localoriginviagit-managerwhenproject_number:is already present), skipping repositories that declare sovereign opt-out (forge: giteain repoAGENTS.mdorgit config --bool gitea.sovereign true), and deferring live Giteamirror: trueverification to/gitea-to-githubpreflight. - Repository compliance: Keep
skills/gitea-to-github/SKILL.md<= 80lines followingskills/build-skill/references/skeleton.md, with zero/home/<user>paths, zero secrets, zero hardcoded instance URLs, and full coverage ininstall.shandtests/fixtures/test_skills_behavioral_contracts.py.
Non-Goals
- Migrating closed Gitea issues, closed PR review threads, wikis, webhooks, or Git LFS objects: LFS fails fast; closed Gitea metadata (including closed issues, PRs, releases, and webhooks) is preserved in the local pre-archive JSON snapshot rather than replayed into GitHub. Because closed issues are skipped, open issues are re-numbered sequentially on GitHub (breaking
#Ncross-references). - Auto-merging conflicting or unreviewed Gitea PRs: Open PRs are surfaced in dry-run and require an explicit per-PR decision (
merge,push branch + recreate PR on GitHub,close, orabort). - Duplicating sibling skill rules:
gt-usagecontinues to owngtCLI conventions,projectscontinues to own Projects v2 /AGENTS.mdschemas, andgit-managercontinues to own branch/commit hygiene.
Open Questions
- None. All architectural decisions and upstream
new-repo --emptyprerequisites are resolved in this document.
Critical User Journeys (CUJs)
CUJ 1: Standalone Repository Migration (With Open Issues, CI Workflows & Legacy AGENTS.md)
- Given: A local checkout of a Gitea-hosted repository with open Gitea issues, a milestone,
.gitea/workflows/ci.yml, and a legacygitea-plancontract inAGENTS.md. - When: The user runs
/gitea-to-github(dry-run default), reviews the plan, resolves any open Gitea PRs, curates which open issues to carry over, and approves execution. - Then:
gitea-to-githubexports a local Gitea JSON snapshot to$XDG_STATE_HOME/gitea-to-github-backup/<repo>/(0700/0600permissions), creates the empty GitHub repo vianew-repo --empty --no-mirror --no-clone(matching visibility), and pushes explicitrefs/heads/*:refs/heads/*andrefs/tags/*:refs/tags/*refspecs.- In an ephemeral
/tmp/clone, it translates.gitea/workflows/ci.ymlto.github/workflows/ci.yml, creates/links the 5-column Projects v2 board (triggered by the legacygitea-plancontract), rewritesAGENTS.mdtoproject_number: <int>(upon user approval), commits and pushes those changes to GitHub, and migrates selected open issues/milestones with<!-- gitea-origin: <gitea-host>/<owner>/<repo>#<number> -->markers. - If a local checkout exists, it delegates flipping local
originto GitHub and dirty-tree resolution togit-manager; it renames the Gitea repo to<repo>-archive-<timestamp>, attaches the Gitea pull mirror vianew-repo --gitea-mirror, verifies sync, and deletes the archive only if the user explicitly confirms.
CUJ 2: Organization Migration & Mid-Flight diagnose Resume
- Given: A Gitea organization containing multiple repositories (some active, some intentionally sovereign or already pull mirrors).
- When: The user runs
/gitea-to-github --org <gitea-org>, reviews the dry-run inventory table (segmented into clean-slate vs. interactive-gated repos), approves execution, and hits an unexpected API/network error mid-migration. - Then:
gitea-to-githubpauses and hands off to/diagnose; once resolved, re-running/gitea-to-githubinspects existing GitHub repos, issues (<!-- gitea-origin: ... -->markers), and milestones to resume sequentially without duplicating repositories, issues, or milestones.
CUJ 3: Session-Start Nudge & Sovereign Opt-Out
- Given: A developer opens an agent session inside a repository whose
originremote points to Gitea. - When: The repository is a normal unmigrated Gitea repo vs. an intentionally sovereign repo (
forge: giteainAGENTS.mdorgit config --bool gitea.sovereign true) vs. a stale local clone already carryingproject_number:inAGENTS.md. - Then:
profile/AGENTS.mdperforms a zero-network local check, suggests/gitea-to-githubat session start for unmigrated repos, advises flipping localoriginto GitHub viagit-managerwhenproject_number:is already present, and stays silent for sovereign repos (while/gitea-to-githubpreflight handles livemirror: truedetection).
Technical Plan (Architecture)
System Topology & Migration Flow
gitea-to-github acts as an on-demand orchestrator over existing CLI/skill boundaries (gt-usage for Gitea queries, new-repo for GitHub empty creation and Gitea pull-mirror attachment, git-manager for local remote/commit hygiene, projects for Projects v2 / AGENTS.md schemas, and diagnose for mid-flight error recovery).
flowchart LR
P["1. Preflight & Dry-Run\n(gt/gh auth, LFS check,\nOpen PRs, CI, Issues, AGENTS.md)"] --> G{"Explicit\nApproval / --execute"}
G -- "No" --> STOP["Exit Cleanly\n(Preview Inventory Only)"]
G -- "Yes" --> B["2. Snapshot & PRs\n(Gitea JSON snapshot;\nResolve Open Gitea PRs)"]
B --> GH["3. GitHub Repo & Push\n(new-repo --empty --no-mirror --no-clone;\nPush heads + tags, verify refs)"]
GH --> CI["4. CI, Conditional Board & AGENTS.md\n(/tmp clone: .gitea -> .github/workflows;\nProjects v2 if legacy board/contract or opted-in)"]
CI --> ISS["5. Idempotent Issues\n(Milestones + Open Issues\nwith gitea-origin marker)"]
ISS --> MIR["6. Archive & Pull Mirror\n(Flip origin -> GitHub; Rename Gitea archive;\nnew-repo --gitea-mirror; Optional archive delete)"]
B -. "Error" .-> D["/diagnose -> Resume"]
GH -. "Error" .-> D
CI -. "Error" .-> D
ISS -. "Error" .-> D
MIR -. "Error" .-> D
Execution Modes & Dry-Run Default
- Default Dry-Run Mode: Invoking
/gitea-to-github(standalone or--org <gitea-org>, with--dry-runaccepted as an optional explicit flag) always runs a read-only discovery pass first and halts before any mutation unless--executeor explicit approval is given. Passing--executeskips the initial confirmation gate only forclean-slaterepos;interactive-gatedrepos still pause for per-PR and issue-curation prompts. - Segmented Org Selection & Sequential Execution: When targeting a Gitea organization, the dry-run discovery pass paginates Gitea org/repo/issue/PR API queries, classifies every repository (
migratable,already-pull-mirror,sovereign-opt-out,has-lfs-blocked,has-open-prs,has-open-issues,empty,archived) into a single inventory table, and segments selected repositories into:- Clean-slate: Repositories with zero open PRs and no per-item curation required; executed sequentially from one approval (applying any user-stated overrides such as visibility or target org).
- Interactive-gated: Repositories with open PRs or open issues needing curation; handled per-repo with explicit interactive prompts before mutation.
Git, new-repo --empty, & Safe Mirror Swap
- Visibility, Mirror, Dirty-Path, State & LFS Pre-Checks: Check live Gitea mirror status (skipping already-mirrored repos) and Git LFS usage (failing fast if LFS objects exist). Unarchive
archived: trueGitea repos only on explicit approval if they are selected for migration, and handleempty(0-commit) repos without running git branch pushes or/tmp/commits. If a local checkout exists, check working-tree status specifically forAGENTS.mdand.gitea/workflows/: if uncommitted edits exist on those paths, prompt the user to commit or stash them viagit-managerfirst, or continue via/tmp/and skip the post-swap localgit pull. Map Giteapublic-> GitHubpublic,private-> GitHubprivate, andinternal-> GitHubprivate(with an explicit warning). If the target GitHub repo already exists and isprivate, update the Gitea repo toprivatebefore mirroring. - Pre-Migration Snapshot & Open PR Gate: Export a local Gitea API JSON snapshot (open/closed issues, PRs, milestones, releases, and webhooks) under
$XDG_STATE_HOME/gitea-to-github-backup/<repo>/(falling back to~/.local/state/gitea-to-github-backup/<repo>/) withumask 077(0700/0600permissions). Never auto-merge conflicting or unreviewed Gitea PRs; dry-run lists every open PR with draft/mergeable/CI status and requires a per-PR choice (mergeon Gitea,push branch + recreate PR on GitHub,close, orabort) before cloning/pushing. - Empty GitHub Creation & Idempotent Ref Push: Create the empty GitHub target via
new-repo --empty --no-mirror --no-clone(skipping creation if the target GitHub repo already exists on resume). Clone Gitea into a temp bare repo and push explicitrefs/heads/*:refs/heads/*andrefs/tags/*:refs/tags/*refspecs (avoiding Gitea internal refs such asrefs/pull/*). On resume, verify whether Gitea branch tips are already ancestors of GitHub's branches before pushing (never force-pushing over Step 4 commits). Set GitHub's default branch to match Gitea's and verifyHEAD, branch list, and tag list align. - Ephemeral
/tmp/Clone Commit & Non-Destructive Archive Swap:- Check whether the planned CI and/or contract updates for that repository are already present on GitHub before re-running Step 4; if missing, apply
.github/workflows/andAGENTS.mdupdates inside an ephemeral/tmp/clone of the newly pushed GitHub repository and push to GitHub before creating the Gitea pull mirror, decoupling remote migration from local working-tree state. - Only after GitHub refs, CI workflows,
AGENTS.md, and open issues are verified on GitHub:- If a local checkout exists, delegate flipping local
originto GitHub, dirty-tree resolution, and pulling the migration commit (unless skipped due to colliding local edits) togit-manager. - Rename the source Gitea repository to
<repo>-archive-<timestamp>(truncating the base name if needed to stay within Gitea's 100-character repository name limit). - Attach the Gitea pull mirror via
new-repo --gitea-mirror <github-url> [-p] [--gitea-org <gitea-org>](passing private-repo credentials pernew-repo's mirror auth contract) and poll Gitea's mirror status endpoint until the first sync succeeds or times out. - Ask for explicit user confirmation under the skill's destructive-action gate (aligned with
profile/AGENTS.md) before deleting<repo>-archive-<timestamp>.
- If a local checkout exists, delegate flipping local
- Check whether the planned CI and/or contract updates for that repository are already present on GitHub before re-running Step 4; if missing, apply
CI Pipeline Migration (.gitea/workflows/ -> .github/workflows/)
Before creating the Gitea pull mirror, gitea-to-github inspects .gitea/workflows/*.yml|yaml (and Gitea CI badges/URLs in README.md):
- Moves workflow files from
.gitea/workflows/to.github/workflows/inside the ephemeral/tmp/clone. - Translates Gitea-specific expressions and secrets:
${{ gitea.* }}->${{ github.* }},secrets.GITEA_TOKEN/GITEA_TOKEN->secrets.GITHUB_TOKEN/GITHUB_TOKEN. Extracts any non-GITEA_TOKEN${{ secrets.* }}references and warns the user during dry-run / Step 4 so those secrets can be provisioned on GitHub. - Maps
runs-on:labels: defaults to GitHub-hostedubuntu-latestfor both public and private repos, and maps toself-hostedonly on explicit user opt-in during dry-run review when target GitHub visibility isprivate(blockingself-hostedonpublicrepos to prevent PR supply-chain exposure). - Flags third-party or Gitea-hosted action URLs (
https://<gitea-host>/...) for user review/replacement and commits/pushes the migrated.github/workflows/from the/tmp/clone before mirror creation.
Idempotent Issue, Milestone, Conditional Projects v2 & AGENTS.md Migration
- Milestones & Issues: Query existing GitHub milestones and issues using paginated GitHub milestones and issues endpoints (filtering out pull requests), alongside paginated Gitea issue/milestone queries. Match milestones by
title(creating missing ones withdescriptionand omitting null/zerodue_ontimestamps). Pre-create missing GitHub labels before creating issues, and warn if curated Gitea issue bodies contain/attachments/<uuid>URLs that would break once<repo>-archive-<timestamp>is deleted. Embed<!-- gitea-origin: <gitea-host>/<owner>/<repo>#<number> -->(with<gitea-host>derived fromoriginor activegthost config, normalized to lowercase hostname without scheme or port) at the bottom of each migrated GitHub issue body and skip any issue whose origin marker already exists on GitHub. - Conditional Projects v2 Onboarding: Only create or link a 5-column GitHub Projects v2 board (
Backlog,Ready,Work in Progress,Review,Completed) when the source repo has a legacy Gitea board/contract or when the user explicitly opts in during dry-run; otherwise leave new board setup to/projects(respecting its tieredProject Board Policy, which marks boardsOmittedforSmall-tier work andRecommended/RequiredforMedium/Largetiers). Delegate all Projects v2 GraphQL mutations strictly toskills/projects/references/github-projects-v2.md, placing migrated issues inBacklog(or their mapped legacy Gitea column). AGENTS.mdRewrite: Detect legacygitea-plancontracts in repoAGENTS.md(Giteaproject_id,{column -> id}maps, hex colors) and propose rewriting them to the state-freeproject_number: <int>schema fromskills/projects/references/planning-contract.md. Commit and pushAGENTS.md+.github/workflows/in the/tmp/clone before creating the Gitea pull mirror so both forges stay in sync.
Global Session-Start Trigger (profile/AGENTS.md)
profile/AGENTS.md adds a strictly local, zero-network session-start check:
- Inspect local
originremote to check if it points to the configured Gitea host. - Skip immediately if
originis already GitHub, if repoAGENTS.mddeclares sovereign opt-out (forge: gitea), or ifgit config --bool gitea.sovereignistrue. - Otherwise, if
project_number:is already present in repoAGENTS.md, warn that localoriginstill points to Gitea and advise flippingoriginto GitHub viagit-manager; ifproject_number:is absent, inform the user that the repository uses Gitea asoriginand suggest running/gitea-to-github(leaving live Gitea APImirror: trueverification to/gitea-to-githubpreflight).
Component Architecture & <= 80-Line Partitioning
skills/gitea-to-github/SKILL.md(<= 80lines): Followsskills/build-skill/references/skeleton.md(Use when,Steps,Your call,Done when,Hands off to), acting as a phase router withSuggested Next Step:emission (the standard handoff line printed at skill completion, suppressed when invoked by another skill) and explicit triggers toreferences/and sibling skills (gt-usage,projects,git-manager,diagnose).skills/gitea-to-github/references/remote-and-mirror.md:new-repo --emptyinvocation, explicitrefs/heads/*+refs/tags/*refspec push, resume ancestry/phase guards, visibility mapping (internal->private),$XDG_STATE_HOME/gitea-to-github-backup/<repo>/Gitea JSON snapshot (umask 077), preflight dirty-path check (AGENTS.md,.gitea/workflows/), ephemeral/tmp/clone commits,git-managerdelegation for local remote flip, truncated<repo>-archive-<timestamp>rename,new-repo --gitea-mirror+ polling/timeout verification, and explicit-confirmation archive deletion.skills/gitea-to-github/references/ci-and-contracts.md:.gitea/workflows/->.github/workflows/translation rules (gitea.*->github.*,GITEA_TOKEN->GITHUB_TOKEN, non-GITEA_TOKENsecret extraction warnings,runs-on:defaults withpublic-repoself-hostedblock) and legacyAGENTS.md->project_number: <int>rewrite rules.skills/gitea-to-github/references/entity-migration.md: Segmented dry-run inventory table (clean-slatevs.interactive-gated, includingemptyandarchivedstates), open PR resolution rules,<!-- gitea-origin: ... -->dedup algorithm (gh api --paginate, normalized<gitea-host>), label pre-creation,/attachments/warnings, nulldue_onomission, milestone & conditional Projects v2 delegation (skills/projects/references/github-projects-v2.md), anddiagnosepause/resume state recovery.
Non-Functional Requirements
- Sequential Safety & Resumability: Org migrations execute sequentially per-repo using
ghandgtCLI defaults, and any mid-flight error pauses for/diagnose; re-running/gitea-to-githubuses phase-detection guards, branch ancestry checks, and<!-- gitea-origin: ... -->markers to resume idempotently without duplicating entities. - Portability & Hygiene: Zero
/home/<user>paths, zero hardcoded instance URLs (gitea.roadtotech.mestays solely inprofile/AGENTS.md), zero em-dashes, andSKILL.md <= 80lines (enforced bytests/fixtures/test_skills_behavioral_contracts.py).
Risks & Mitigations
| Risk | Impact | Mitigation |
|---|---|---|
| Data loss if Gitea repo is deleted before pull mirror syncs | Permanent loss of closed PRs/issues/releases/webhooks | Export local Gitea JSON snapshot (including releases/webhooks), rename Gitea repo to <repo>-archive-<timestamp>, verify new-repo --gitea-mirror sync first, and require explicit confirmation before deleting archive. |
Security: private metadata exposure in backups or self-hosted runner RCE |
Local secret/data leak or homelab runner compromise | Store JSON snapshots under $XDG_STATE_HOME with umask 077 (0700/0600); block self-hosted runners on public repos and warn on unmigrated ${{ secrets.* }} and Gitea-hosted action URLs. |
| Scalability: large org/repo pagination & secondary GitHub rate limits | Silent item truncation or mid-batch 403/429 failures |
Use gh api --paginate and paginated Gitea queries; execute org batches sequentially with idempotent <!-- gitea-origin: ... --> resume on /diagnose retry. |
| Auto-merging conflicting/unreviewed Gitea PRs | Broken main pushed to GitHub |
Never auto-merge; dry-run lists open PRs and requires explicit per-PR choice (merge, recreate on GitHub, close, or abort). |
| Resume overwriting Step 4 commits or failing on existing GitHub repo | Non-fast-forward rejection or aborted /diagnose retry |
Skip new-repo --empty if GitHub repo exists; verify branch ancestry before pushing; skip Step 4 if the planned CI and/or contract updates for that repository are already present on GitHub. |
| Uncommitted local changes blocking CI/contract commit | Dirty working tree or mixed commits | Check AGENTS.md and .gitea/workflows/ dirty paths in preflight; commit changes in an ephemeral /tmp/ clone and delegate local remote/pull handling to git-manager. |
Broken /attachments/ URLs or #N re-numbering after closed-issue skip |
Dead attachment links or shifted issue cross-references | Warn on /attachments/<uuid> URLs in curated issues before archive deletion; document #N re-numbering as a Non-Goal trade-off. |
Prompting intentionally sovereign Gitea repos or missing stale origin |
Developer friction or accidental push to read-only Gitea mirror | Zero-network local check in profile/AGENTS.md (forge: gitea / git config gitea.sovereign opt-out; still warn to flip origin via git-manager when project_number: is present). |
Alternatives Considered
Alternative 1: Use gh repo create Directly Instead of new-repo --empty
- Summary: Leave
new-repounchanged (where--no-clonestill passesauto_init=Truewhen no local.gitexists) and invokegh repo createdirectly fromgitea-to-githubto provision empty GitHub target repositories. - Pros: Avoids any upstream change to
new-repoand eliminates an external prerequisite for standalone skill execution. - Cons: Splits repository provisioning across two tools (
new-repofor normal creation and rawgh repo createinsidegitea-to-github), losingnew-repo's centralized org targeting, visibility validation, and consistent Gitea mirror orchestration. - Reason for Rejection: Keeping
new-repoas the single repo-provisioning entry point preserves consistent behavior across standalone and mirrored repo creation;--empty(auto_init=False) is a minimal, reusable upstream addition innew-repo(6f9f07b).
Alternative 2: Single-Repo Scope with Separate /projects Handoff
- Summary: Limit
gitea-to-githubto single-repository git/issue migration and delegate organization batching to a wrapper script while handing off Projects v2 onboarding andAGENTS.mdupdates to a separate/projectsinvocation. - Pros: Smaller initial
gitea-to-githubskill surface and strict separation between git forge migration and project-board setup. - Cons: Forces N sequential manual prompts across multi-repo organizations and leaves migrated repos without a working
project_numberor Projects v2 board until a second skill is run manually, breaking the pre-mirror commit guarantee (requiring extra post-mirror commits). - Reason for Rejection: Supporting segmented org dry-run selection plus conditional Projects v2 +
AGENTS.mdproject_numberupdates (when legacy boards/contracts exist or when opted in) ensures both GitHub and the new Gitea mirror inherit the complete contract in one pass without forcing boards onto repos that do not need them.
Alternative 3: Omit Session-Start Gitea-Origin Trigger from profile/AGENTS.md
- Summary: Rely exclusively on users remembering to invoke
/gitea-to-githubmanually rather than adding a session-start check inprofile/AGENTS.md. - Pros: Zero startup check overhead and zero risk of prompting on intentionally Gitea-hosted repositories.
- Cons: Legacy Gitea repositories and outdated
AGENTS.mdcontracts go unnoticed during normal engineering sessions, stalling adoption of the GitHub-centered delivery workflow. - Reason for Rejection: A strictly local, zero-network session-start check in
profile/AGENTS.mdsurfaces legacy Gitea repos (and staleoriginremotes on migrated repos) proactively without homelab coupling, while explicit opt-outs (forge: giteainAGENTS.md,git config --bool gitea.sovereign true) prevent prompting intentionally sovereign repos.
Alternative 4: In-Place Gitea DELETE Before --gitea-mirror and Title-Only Issue Deduplication
- Summary: Delete the original Gitea repository immediately after pushing git refs to GitHub so
new-repo --gitea-mirrorcan recreate it at the same slug, and deduplicate migrated issues by matching issue titles on GitHub. - Pros: Slightly fewer API calls during swap and no temporary
<repo>-archive-<timestamp>repository to clean up. - Cons: Immediate
DELETEcreates an irreversible data-loss window if mirror creation or network calls fail mid-flight; title-only issue matching silently collides or skips distinct Gitea issues that share a title. - Reason for Rejection: Exporting a local Gitea JSON snapshot, renaming to
<repo>-archive-<timestamp>until explicit deletion confirmation, and embedding an immutable<!-- gitea-origin: <gitea-host>/<owner>/<repo>#<number> -->marker prevent premature-deletion data loss and title-based issue collisions.
Future Improvements
- Git LFS Object Migration: Support optional
git lfs fetch --allandgit lfs push --allfor repositories that store large binary assets, rather than failing fast in preflight. - Closed History & Webhook Migration: Optional flag to import closed Gitea issues, PR review threads, wikis, or Gitea-to-GitHub webhook equivalents beyond the local JSON snapshot.
- Automated Multi-Workflow Matrix Validation: Run
actionlintor dry-run workflow syntax validation against translated.github/workflows/*.ymlfiles when available in the environment.
Detailed Implementation Plan
Upstream Prerequisite Status:
new-repo --empty --no-mirror --no-clone(empty GitHub repo creation withauto_init=False) and the GitHub-primary + Gitea pull-mirror inversion (--gitea-mirror <github-url>,--gitea-org <gitea-org>) are already implemented and verified in~/Projects/active/new-repo(6f9f07b, 48/48 tests passing). All remaining changes below live inkiskaadee/skills.
File Changes Overview
| Component / File | Type / Scope | Summary |
|---|---|---|
skills/gitea-to-github/SKILL.md |
Create (<= 80 lines) |
Phase-router skill entrypoint following skeleton.md. |
skills/gitea-to-github/references/remote-and-mirror.md |
Create | Preflight, JSON backup, git ref push, /tmp/ commit, archive rename, and pull mirror swap. |
skills/gitea-to-github/references/ci-and-contracts.md |
Create | .gitea/workflows/ to .github/workflows/ CI and AGENTS.md contract migration rules. |
skills/gitea-to-github/references/entity-migration.md |
Create | Segmented --org dry-run inventory, milestone/issue dedup, and conditional Projects v2 rules. |
profile/AGENTS.md |
Modify | Update new-repo mirror wording and add local session-start Gitea-origin check. |
skills/projects/SKILL.md |
Modify | Reference /gitea-to-github in Step 1 legacy Gitea fallback. |
skills/projects/references/planning-contract.md |
Modify | Reference /gitea-to-github in Section 3 legacy Gitea contract detection. |
skills/gt-usage/SKILL.md |
Modify | Add gitea-to-github under ## Hands off to. |
install.sh |
Modify | Add gitea-to-github to ACTIVE_PORTABLE_SKILLS in sorted order. |
tests/fixtures/test_skills_behavioral_contracts.py |
Modify | Register gitea-to-github in EXPECTED_SKILLS and add behavioral contract tests. |
Phased Execution & Gate Checks
Phase 1: Create skills/gitea-to-github/
skills/gitea-to-github/SKILL.md(<= 80lines): Followskills/build-skill/references/skeleton.md(name: gitea-to-github,## Use when,## Stepsin order:Preflight & Dry-Run Plan -> Resolve PRs -> Push Git & Provision GitHub -> Projects v2 (if applicable) -> Translate CI & AGENTS.md (in /tmp/ clone) -> Migrate Issues -> Archive Rename & Pull Mirror -> Optional Archive Delete,## Your call,## Done when,## Hands off tolinkingprojects,implement,gt-usage,diagnose). IncludeSuggested Next Step:routing and zero/home/<user>paths, em-dashes, or hardcoded private domains.skills/gitea-to-github/references/remote-and-mirror.md:- Preflight: verify
gt,gh,new-repo --empty --no-mirror --no-clone, live Giteamirror: truestatus,git lfs ls-filesfail-fast,empty/archivedrepo classification, and dirty-path checks onAGENTS.mdand.gitea/workflows/. - Backup & PR gate: export Gitea JSON snapshot (issues, PRs, milestones, releases, webhooks) to
$XDG_STATE_HOME/gitea-to-github-backup/<repo>/(fallback~/.local/state/gitea-to-github-backup/<repo>/) underumask 077(0700/0600); require per-PR choice (merge,push branch + recreate PR,close,abort). - GitHub provisioning & push: must invoke
new-repo <target> --empty --no-mirror --no-clone [-o <gh-org>] [-p]from a fresh non-git temporary directory (mktemp -d) sonew_repo.py'sdetermine_target()never sees.gitand never triggerslink_and_push_existing()to prematurely overwrite localorigin. Push explicitrefs/heads/*:refs/heads/*andrefs/tags/*:refs/tags/*refspecs from a temp bare clone; on resume, skipnew-repo --empty --no-mirror --no-cloneif the GitHub repo exists and check branch ancestry before pushing. - Local checkout & archive swap: apply CI/
AGENTS.mdcommits in an ephemeral/tmp/clone (skipping if planned updates are already present on GitHub); delegate localoriginflip andgit pulltogit-manager. Rename Gitea repo to<repo>-archive-YYYYMMDDHHMMSS(UTCYYYYMMDDHHMMSS;-archive-YYYYMMDDHHMMSSis 23 chars, so truncate<repo>base name to<= 77chars to respect Gitea's 100-char limit). Attach pull mirror vianew-repo --gitea-mirror <github-url> [-p] [--gitea-org <gitea-org>], triggerPOST /api/v1/repos/{owner}/{repo}/mirror-sync, and pollGET /api/v1/repos/{owner}/{repo}plus default-branch commit SHA parity against GitHub every3sup to a60stimeout. Delete<repo>-archive-YYYYMMDDHHMMSSonly on explicit confirmation.
- Preflight: verify
skills/gitea-to-github/references/ci-and-contracts.md:- Translate
.gitea/workflows/to.github/workflows/(${{ gitea.* }}->${{ github.* }},GITEA_TOKEN->GITHUB_TOKEN, defaultruns-on: ubuntu-latest, allowself-hostedonly on explicit opt-in forprivaterepos and block onpublicrepos). Extract non-GITEA_TOKEN${{ secrets.* }}references and warn the user. - Automatically rewrite standard Gitea workflow badge URLs in
README.mdto GitHub Actions badge URLs when the corresponding workflow is migrated; flag non-standard Gitea-hosted action or badge URLs for user review. - Rewrite legacy
AGENTS.mdplanning contracts (project_id, column maps,gitea-plan) toproject_number: <int>inside the/tmp/clone before mirror attachment.
- Translate
skills/gitea-to-github/references/entity-migration.md:- Emit segmented
--orgdry-run inventory table (clean-slatevs.interactive-gated, includingemptyandarchived, using paginated Gitea queries). - Migrate open milestones via
gh api --paginate repos/{owner}/{repo}/milestones?state=all(matching by title, omitting null/zerodue_on). Pre-create missing GitHub labels, warn on/attachments/<uuid>URLs, and deduplicate open issues viagh api --paginate repos/{owner}/{repo}/issues?state=all(filteringselect(.pull_request == null)) using<!-- gitea-origin: <gitea-host>/<owner>/<repo>#<number> -->(<gitea-host>derived fromoriginor activegthost config, normalized lowercase hostname). - Conditionally create/link a 5-column Projects v2 board (
Backlog,Ready,Work in Progress,Review,Completed) viaskills/projects/references/github-projects-v2.mdonly when a legacy Gitea board/contract exists or when explicitly opted in. Map legacy Gitea board columns case-insensitively (To Do/Open->Backlog,Ready->Ready,In Progress/Doing->Work in Progress,Review->Review,Done/Closed->Completed; fallbackBacklog).
- Emit segmented
- Phase 1 Gate: Verify
wc -l skills/gitea-to-github/SKILL.md <= 80and confirm all four files exist with zero/home/<user>paths or private domains.
Phase 2: Update profile/AGENTS.md and Sibling Skills
profile/AGENTS.md: Update L74"GitHub push mirroring"wording fornew-repoto"Gitea pull mirroring". Under## Homelab and connectivity(L76), add a strictly local, zero-network session-start Gitea-origin check (git remote -v/get-url origin) that suggests/gitea-to-github(or flipping localoriginviagit-managerwhenproject_number:is already present), skipping repos withforge: giteain repoAGENTS.mdorgit config --bool gitea.sovereign true.skills/projects/SKILL.md(Step 1) &skills/projects/references/planning-contract.md(Section 3): Explicitly reference/gitea-to-githubalongside standalonegt-usagein legacy Gitea fallback guidance.skills/gt-usage/SKILL.md(## Hands off to): Addgitea-to-githubfor repositories ready to migrate from Gitea to GitHub.- Phase 2 Gate: Review
git diffacrossprofile/AGENTS.md,skills/projects/, andskills/gt-usage/for consistency and zero broken relative links.
Phase 3: Register Installer & Behavioral Contract Tests
install.sh: Insertgitea-to-githubin alphabetical order betweengit-managerandgt-usageinACTIVE_PORTABLE_SKILLS.tests/fixtures/test_skills_behavioral_contracts.py: Add"gitea-to-github"in sorted order toEXPECTED_SKILLS, updatetest_skill_inventory_and_skeletons(L454) docstring from15to16active skills, and add"gitea-to-github"totest_chained_skills_include_suggested_next_step_routing(L261) (or validate itsSuggested Next Step:and relative links in the new test). Add behavioral contract assertions verifying dry-run default, LFS fail-fast,new-repo --empty --no-mirror --no-clonefrom a non-git dir, archive-before-mirror rename,<!-- gitea-origin: ... -->idempotency,.gitea/workflows/->.github/workflows/CI migration, andprofile/AGENTS.mdsovereign opt-out (forge: gitea/git configgitea.sovereign).- Phase 3 Gate: Run
./install.sh checkand./tests/fixtures/run_regression.shand confirm all checks pass with exit code0.
Verification Plan
- Installation & Parity Checks:
- Run
./install.sh check(and./install.shto sync local agent symlinks/copies) and confirm zero missing or stale skill registrations.
- Run
- Automated Behavioral Contract Suite:
- Run
./tests/fixtures/run_regression.shand confirm all unit and regression checks pass with exit code0(covering<= 80lines, zero em-dashes, zero/home/paths, relative links, andgitea-to-github/profile/AGENTS.mdbehavioral contracts).
- Run
- Portability Hygiene Check (Beyond Automated Suite):
- Verify zero hardcoded private domains (such as
gitea.roadtotech.me) appear anywhere insideskills/gitea-to-github/.
- Verify zero hardcoded private domains (such as
- Manual Dry-Run & End-to-End Smoke Verification (Post-Implementation):
- Run
/gitea-to-githubin default dry-run mode against a test Gitea repository with.gitea/workflows/, a legacyAGENTS.md, an open issue, and a milestone; confirm the emitted plan accurately previews changes without mutating Gitea or GitHub. - Run
/gitea-to-github --org <gitea-org>in dry-run mode and confirm the inventory table accurately segmentsclean-slatevs.interactive-gated(plusempty/archived/sovereign-opt-out) repositories (CUJ 2). - Test
profile/AGENTS.mdsession-start behavior on an unmigrated Gitea repo vs. sovereign opt-out (forge: giteaandgit config --bool gitea.sovereign true) vs. staleproject_number:repo (CUJ 3). - Execute an end-to-end test migration on a disposable test repository and confirm: GitHub repo creation via
new-repo --empty --no-mirror --no-clonefrommktemp -d,.github/workflows/andAGENTS.md(project_number: <int>) committed in/tmp/prior to mirror swap,<repo>-archive-YYYYMMDDHHMMSScreated, Gitea pull mirror attached and SHA-synced within60s, and re-running issue migration creates zero duplicate issues.
- Run