feat(gitea-to-github): add migration skill, session trigger, and contract tests
- Add skills/gitea-to-github/SKILL.md (42 lines) and references (remote-and-mirror, ci-and-contracts, entity-migration) - Update profile/AGENTS.md with Gitea pull mirroring wording and zero-network session-start check (forge: gitea / git config gitea.sovereign opt-out) - Reference /gitea-to-github from projects, planning-contract.md, and gt-usage; register in install.sh (16 active skills) - Add single-behavior behavioral contract tests in tests/fixtures/test_skills_behavioral_contracts.py (37/37 regression checks passing)
This commit is contained in:
1 parent
f2494c5b91
commit
5881541a82
10 files changed
+244
-8
No files matched your search
+1
-1
@@ -33,7 +33,7 @@ while [[ $# -gt 0 ]]; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Active skills to install
|
# Active skills to install
|
||||||
ACTIVE_PORTABLE_SKILLS=(build-skill code-review derive-skill diagnose document git-manager gt-usage implement inspect-flake-update nix-devshell practice projects reconcile-docs tdd verify)
|
ACTIVE_PORTABLE_SKILLS=(build-skill code-review derive-skill diagnose document git-manager gitea-to-github gt-usage implement inspect-flake-update nix-devshell practice projects reconcile-docs tdd verify)
|
||||||
ACTIVE_EXTENSION_SKILLS=()
|
ACTIVE_EXTENSION_SKILLS=()
|
||||||
|
|
||||||
# Legacy / deprecated skills to clean up or back up if found in target
|
# Legacy / deprecated skills to clean up or back up if found in target
|
||||||
|
|||||||
+5
-1
@@ -71,11 +71,15 @@ whether I really understood something), don't make it for me:
|
|||||||
- `~/Projects/active/canopy/` Operational single source of truth for the Homelab appliance (`server-local`, `nixos-core`, and `canopy-workloads`; replaces deprecated `~/Homelab/`)
|
- `~/Projects/active/canopy/` Operational single source of truth for the Homelab appliance (`server-local`, `nixos-core`, and `canopy-workloads`; replaces deprecated `~/Homelab/`)
|
||||||
- `~/Config/` (system and NixOS configuration)
|
- `~/Config/` (system and NixOS configuration)
|
||||||
- When resolving a project from task context, search these workspace roots before asking the user.
|
- When resolving a project from task context, search these workspace roots before asking the user.
|
||||||
- To create new projects or repositories, always use `new-repo` (source: `~/Projects/active/new-repo`). It supports organization targeting (`-o`), GitHub push mirroring, licenses, and templates.
|
- To create new projects or repositories, always use `new-repo` (source: `~/Projects/active/new-repo`). It supports organization targeting (`-o`), Gitea pull mirroring (`--gitea-mirror`), `--empty`, licenses, and templates.
|
||||||
|
|
||||||
## Homelab and connectivity
|
## Homelab and connectivity
|
||||||
|
|
||||||
- Sovereign Gitea origin lives at `gitea.roadtotech.me` (hosted on `server-local` at `192.168.1.36`).
|
- Sovereign Gitea origin lives at `gitea.roadtotech.me` (hosted on `server-local` at `192.168.1.36`).
|
||||||
|
- **Session-start Gitea-origin check (zero-network, local only):** Inspect `git remote get-url origin` (or `git remote -v`). If `origin` points to `gitea.roadtotech.me`:
|
||||||
|
- Skip if repo `AGENTS.md` declares `forge: gitea` or `git config --bool gitea.sovereign` is `true`.
|
||||||
|
- If repo `AGENTS.md` already contains `project_number:`, warn that local `origin` still points to Gitea and advise flipping `origin` to GitHub via `git-manager`.
|
||||||
|
- Otherwise, inform the user that the repository uses Gitea as `origin` and suggest running `/gitea-to-github`.
|
||||||
- For `gt` (Gitea CLI) repository discovery against sovereign SSH remote on port 2223:
|
- For `gt` (Gitea CLI) repository discovery against sovereign SSH remote on port 2223:
|
||||||
- Run `gt config set ssh_host gitea.roadtotech.me:2223 --host https://gitea.roadtotech.me` so `gt` maps SSH remotes like `ssh://git@gitea.roadtotech.me:2223/...` to `https://gitea.roadtotech.me`.
|
- Run `gt config set ssh_host gitea.roadtotech.me:2223 --host https://gitea.roadtotech.me` so `gt` maps SSH remotes like `ssh://git@gitea.roadtotech.me:2223/...` to `https://gitea.roadtotech.me`.
|
||||||
- If `gitea.roadtotech.me` or `roadtotech.me` times out with `dial tcp ...:443: i/o timeout`:
|
- If `gitea.roadtotech.me` or `roadtotech.me` times out with `dial tcp ...:443: i/o timeout`:
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
name: gitea-to-github
|
||||||
|
description: >-
|
||||||
|
Migrates standalone repositories or Gitea organizations from self-hosted Gitea
|
||||||
|
to GitHub, converting each Gitea repo into a pull mirror. Use when migrating
|
||||||
|
a Gitea repo or org, translating .gitea/workflows/ CI to GitHub Actions, or
|
||||||
|
updating legacy Gitea AGENTS.md contracts to GitHub Projects v2.
|
||||||
|
disable-model-invocation: true
|
||||||
|
---
|
||||||
|
|
||||||
|
# Gitea to GitHub
|
||||||
|
|
||||||
|
## Use when
|
||||||
|
- Migrating a standalone Gitea repository or `--org <gitea-org>` to GitHub primary with a Gitea pull mirror.
|
||||||
|
- Translating `.gitea/workflows/` to `.github/workflows/` and legacy `AGENTS.md` contracts to `project_number: <int>`.
|
||||||
|
- Not for ad-hoc Gitea operations outside migration: use `gt-usage`.
|
||||||
|
- Not for ongoing GitHub planning or slice execution: use `projects` or `implement`.
|
||||||
|
|
||||||
|
## Steps
|
||||||
|
1. **Preflight and dry-run plan.** Read [references/remote-and-mirror.md](references/remote-and-mirror.md) and [references/entity-migration.md](references/entity-migration.md). Run read-only discovery first (dry-run is default; `--dry-run` optional). Verify `gt`/`gh` auth, `new-repo --empty --no-mirror --no-clone`, live `mirror: true` skip, `git lfs ls-files` fail-fast, `empty`/`archived` state, and dirty `AGENTS.md`/`.gitea/workflows/` paths. Halt after printing the segmented inventory/plan unless `--execute` or explicit approval is given (`interactive-gated` repos still pause per item).
|
||||||
|
2. **Snapshot and resolve open PRs.** Export Gitea JSON metadata (issues, PRs, milestones, releases, webhooks) to `$XDG_STATE_HOME/gitea-to-github-backup/<repo>/` under `umask 077`. Require an explicit per-PR choice (`merge`, `push branch + recreate PR`, `close`, or `abort`) for every open Gitea PR.
|
||||||
|
3. **Provision GitHub and push refs.** Invoke `new-repo <target> --empty --no-mirror --no-clone` from a fresh `mktemp -d` non-git directory (skip if target GitHub repo exists). Push explicit `refs/heads/*:refs/heads/*` and `refs/tags/*:refs/tags/*` refspecs from a temp bare clone after verifying branch ancestry on resume.
|
||||||
|
4. **Conditional Projects v2 onboarding.** Only if a legacy Gitea board or contract exists (or user opts in during dry-run), create or link the 5-column Projects v2 board via `../projects/references/github-projects-v2.md`.
|
||||||
|
5. **Translate CI and `AGENTS.md` in `/tmp/`.** Read [references/ci-and-contracts.md](references/ci-and-contracts.md). Skip if planned updates already exist on GitHub; otherwise translate `.gitea/workflows/` to `.github/workflows/`, rewrite `README.md` badges, warn on non-`GITEA_TOKEN` secrets, and rewrite legacy `AGENTS.md` to `project_number: <int>` in an ephemeral `/tmp/` clone and push.
|
||||||
|
6. **Migrate milestones and open issues.** Sync open milestones and curated open issues idempotently using `<!-- gitea-origin: <gitea-host>/<owner>/<repo>#<number> -->` markers.
|
||||||
|
7. **Flip local `origin`, archive, and mirror.** If a local checkout exists, delegate `origin` flip and `git pull` to `git-manager`. Rename Gitea repo to `<repo>-archive-YYYYMMDDHHMMSS` (`<= 77`-char base), attach pull mirror via `new-repo --gitea-mirror`, verify SHA parity within `60s`, and delete the archive only after explicit confirmation.
|
||||||
|
|
||||||
|
## Your call
|
||||||
|
- Dry-run approval, `--org` selection/overrides, and any `archived: true` unarchive decision.
|
||||||
|
- Per-PR resolution for open Gitea PRs and per-issue curation.
|
||||||
|
- Opt-in to `self-hosted` runners (`private` repos only) or conditional Projects v2 board creation.
|
||||||
|
- Explicit confirmation before deleting `<repo>-archive-YYYYMMDDHHMMSS`.
|
||||||
|
|
||||||
|
## Done when
|
||||||
|
- GitHub has all refs, planned `.github/workflows/` and `AGENTS.md` updates, and curated issues/milestones, and Gitea pull-mirror SHA parity is verified.
|
||||||
|
|
||||||
|
## Hands off to
|
||||||
|
- `git-manager`: local `origin` remote flip, dirty working-tree resolution, and `git pull`.
|
||||||
|
- `projects`: new Projects v2 board setup or roadmap decomposition after migration.
|
||||||
|
- `diagnose`: mid-flight API or network failures before resuming idempotently.
|
||||||
|
- `gt-usage`: standalone Gitea queries outside migration.
|
||||||
|
- Standalone turns end with `Suggested Next Step: /projects` (if planning work) or `Suggested Next Step: /implement` (suppressed when delegated).
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# CI Workflow & Planning Contract Migration
|
||||||
|
|
||||||
|
Detailed procedure for Step 5 of `gitea-to-github`. All edits run inside an ephemeral `/tmp/` clone of the newly pushed GitHub repository before Gitea pull-mirror attachment.
|
||||||
|
|
||||||
|
## 1. Resume Guard
|
||||||
|
|
||||||
|
Before modifying files in `/tmp/`, inspect the GitHub default branch:
|
||||||
|
- If all planned `.github/workflows/` files and `AGENTS.md` (`project_number: <int>` when applicable) are already present, skip Step 5 without creating duplicate commits.
|
||||||
|
|
||||||
|
## 2. `.gitea/workflows/` to `.github/workflows/` Translation
|
||||||
|
|
||||||
|
1. **Move Workflows:** Move `.gitea/workflows/*.yml` and `.gitea/workflows/*.yaml` to `.github/workflows/` (removing `.gitea/workflows/` once migrated).
|
||||||
|
2. **Context & Secret Translation:**
|
||||||
|
- Replace `${{ gitea.* }}` expressions with `${{ github.* }}`.
|
||||||
|
- Replace `secrets.GITEA_TOKEN` / `GITEA_TOKEN` with `secrets.GITHUB_TOKEN` / `GITHUB_TOKEN`.
|
||||||
|
- Extract all non-`GITEA_TOKEN` `${{ secrets.<NAME> }}` references and warn the user during dry-run and Step 5 so those secrets can be provisioned on GitHub.
|
||||||
|
3. **Runner Label Mapping & Security Boundary:**
|
||||||
|
- Default `runs-on:` to GitHub-hosted `ubuntu-latest` for both `public` and `private` repositories.
|
||||||
|
- Allow `self-hosted` only when the user explicitly opts in during dry-run review AND the target GitHub visibility is `private`. **Block `self-hosted` opt-in on `public` repositories** to prevent PR supply-chain RCE against homelab runners.
|
||||||
|
4. **Badges & External Action URLs:**
|
||||||
|
- Automatically rewrite standard Gitea workflow status badge URLs in `README.md` to GitHub Actions badge URLs (`https://github.com/<owner>/<repo>/actions/workflows/<file>/badge.svg`) when the corresponding workflow is migrated.
|
||||||
|
- Flag non-standard Gitea-hosted action URLs (`https://<gitea-host>/...`) or custom badge URLs for explicit user review/replacement.
|
||||||
|
|
||||||
|
## 3. Legacy `AGENTS.md` Planning Contract Rewrite
|
||||||
|
|
||||||
|
1. **Detect Legacy Contracts:** Inspect repo `AGENTS.md` for legacy `gitea-plan` fields (Gitea `project_id`, `{Backlog..Completed -> column_id}` maps, hex colors, or `gitea-plan` sync rules).
|
||||||
|
2. **Rewrite to State-Free Schema:** Propose rewriting legacy planning sections to the state-free `project_number: <int>` contract defined in `../../projects/references/planning-contract.md` (when a Projects v2 board was created/linked in Step 4, or remove stale Gitea board IDs for `Small`-tier boardless repos).
|
||||||
|
3. **Commit & Push:** Commit translated `.github/workflows/`, updated `README.md` badges, and rewritten `AGENTS.md` in the `/tmp/` clone and push to GitHub before Step 7 creates the Gitea pull mirror.
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Org Inventory, Issues, Milestones & Conditional Projects v2
|
||||||
|
|
||||||
|
Detailed procedure for Steps 1, 4, and 6 of `gitea-to-github`.
|
||||||
|
|
||||||
|
## 1. Segmented `--org` Dry-Run Inventory
|
||||||
|
|
||||||
|
1. **Paginated Gitea Discovery:** Query all org repositories, open PRs, and open issues using paginated Gitea API calls (`page=1..N`).
|
||||||
|
2. **Classification Taxonomy:** Classify each repository into one or more states:
|
||||||
|
- `migratable` (clean-slate)
|
||||||
|
- `already-pull-mirror` (`mirror: true`)
|
||||||
|
- `sovereign-opt-out` (`forge: gitea` in `AGENTS.md`)
|
||||||
|
- `has-lfs-blocked`
|
||||||
|
- `has-open-prs`
|
||||||
|
- `has-open-issues`
|
||||||
|
- `empty` (0 commits)
|
||||||
|
- `archived` (`archived: true`)
|
||||||
|
3. **Segmentation:** Present a single dry-run inventory table segmented into:
|
||||||
|
- **Clean-slate:** Zero open PRs and no per-item curation needed; execute sequentially from one approval (applying any user-stated overrides such as visibility or target org).
|
||||||
|
- **Interactive-gated:** Has open PRs (`has-open-prs`) or open issues needing curation (`has-open-issues`); prompt per repository before mutation.
|
||||||
|
|
||||||
|
## 2. Milestones & Idempotent Issue Migration
|
||||||
|
|
||||||
|
1. **Paginated GitHub Queries:** Fetch existing GitHub milestones and issues to guarantee idempotent `/diagnose` resume:
|
||||||
|
```bash
|
||||||
|
gh api --paginate repos/{owner}/{repo}/milestones?state=all
|
||||||
|
gh api --paginate repos/{owner}/{repo}/issues?state=all --jq '.[] | select(.pull_request == null)'
|
||||||
|
```
|
||||||
|
2. **Milestones:** Match Gitea open milestones by `title`. Create missing milestones on GitHub with `title`, `description`, and `due_on` (omitting `due_on` whenever the Gitea timestamp is null or zero).
|
||||||
|
3. **Labels & Attachments:**
|
||||||
|
- Pre-create any missing Gitea issue labels on GitHub before creating issues (`gh label create` with color/description).
|
||||||
|
- Scan curated open Gitea issue bodies for `/attachments/<uuid>` URLs; warn the user before archive deletion that those links will break once `<repo>-archive-YYYYMMDDHHMMSS` is removed.
|
||||||
|
4. **Immutable Deduplication Marker:** Append the following marker to the bottom of every migrated GitHub issue body (with `<gitea-host>` normalized to lowercase hostname without scheme or port):
|
||||||
|
```markdown
|
||||||
|
<!-- gitea-origin: <gitea-host>/<owner>/<repo>#<number> -->
|
||||||
|
```
|
||||||
|
Skip any Gitea issue whose origin marker already appears in the paginated GitHub issues list.
|
||||||
|
|
||||||
|
## 3. Conditional Projects v2 Onboarding
|
||||||
|
|
||||||
|
1. **Trigger Condition:** Create or link a 5-column Projects v2 board (`Backlog`, `Ready`, `Work in Progress`, `Review`, `Completed`) **only** when the source repo has a legacy Gitea board/contract or when the user explicitly opts in during dry-run. Leave new board creation for boardless repos to `projects` (respecting its tiered `Project Board Policy`).
|
||||||
|
2. **GraphQL Delegation:** Delegate all Projects v2 GraphQL mutations strictly to `../../projects/references/github-projects-v2.md`.
|
||||||
|
3. **Column Mapping:** Map legacy Gitea board columns case-insensitively onto the 5 canonical GitHub columns:
|
||||||
|
- `To Do`, `Open`, `Backlog` -> `Backlog`
|
||||||
|
- `Ready` -> `Ready`
|
||||||
|
- `In Progress`, `Doing`, `Work in Progress` -> `Work in Progress`
|
||||||
|
- `Review`, `In Review` -> `Review`
|
||||||
|
- `Done`, `Closed`, `Completed` -> `Completed`
|
||||||
|
- Unmatched column names -> fallback to `Backlog`.
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# Remote, Git Push, and Mirror Swap
|
||||||
|
|
||||||
|
Detailed procedure for Steps 1, 2, 3, and 7 of `gitea-to-github`.
|
||||||
|
|
||||||
|
## 1. Preflight Checks
|
||||||
|
|
||||||
|
1. **Tool & Auth Verification:** Verify `gt auth status` (or active Gitea token), `gh auth status`, and `command -v new-repo`.
|
||||||
|
2. **Host Discovery (No Hardcoded Domains):** Derive `<gitea-host>` dynamically from the repository's `origin` remote URL or the active `gt` CLI host configuration, normalized to lowercase hostname without scheme or port.
|
||||||
|
3. **Live Mirror & Sovereign Checks:** Query Gitea repo metadata (`GET /api/v1/repos/{owner}/{repo}`):
|
||||||
|
- If `mirror: true`, skip migration (already a pull mirror).
|
||||||
|
- If `archived: true`, classify as `archived`; Gitea blocks renames and visibility updates on archived repos, so unarchive only with explicit user approval.
|
||||||
|
- If `empty: true` (0 commits), classify as `empty` and skip git ref pushes and `/tmp/` clone commits.
|
||||||
|
4. **Git LFS Fail-Fast:** Check `git lfs ls-files` (or `.gitattributes` `filter=lfs`). If LFS objects exist, fail fast and skip migration.
|
||||||
|
5. **Dirty Local Path Check:** If a local checkout exists, run `git status --porcelain -- AGENTS.md .gitea/workflows/`. If uncommitted edits exist on those paths, prompt the user to commit or stash them via `git-manager` first, or continue via the `/tmp/` clone and skip the post-swap local `git pull`.
|
||||||
|
6. **Visibility Mapping:** Map Gitea `public` -> GitHub `public`, `private` -> GitHub `private`, and `internal` -> GitHub `private` (emitting an explicit warning). If the target GitHub repo already exists as `private`, update the Gitea repo to `private` before mirroring.
|
||||||
|
|
||||||
|
## 2. Pre-Migration Backup & Open PR Gate
|
||||||
|
|
||||||
|
1. **Secure JSON Snapshot:** Create `$XDG_STATE_HOME/gitea-to-github-backup/<repo>/` (falling back to `~/.local/state/gitea-to-github-backup/<repo>/`) with `umask 077` (`0700` dir, `0600` files). Export paginated Gitea JSON snapshots for open/closed issues, PRs, milestones, releases, and webhooks.
|
||||||
|
2. **Open PR Gate:** Never auto-merge conflicting or unreviewed Gitea PRs. List every open PR with draft, mergeable, and CI status and require an explicit per-PR choice before proceeding:
|
||||||
|
- `merge`: merge on Gitea before cloning refs.
|
||||||
|
- `push branch + recreate PR`: push head/base branches to GitHub and recreate the PR on GitHub.
|
||||||
|
- `close`: close on Gitea (preserved in JSON snapshot).
|
||||||
|
- `abort`: halt migration for this repository.
|
||||||
|
|
||||||
|
## 3. Empty GitHub Provisioning & Idempotent Ref Push
|
||||||
|
|
||||||
|
1. **Check Existing GitHub Repo (Resume Guard):** Run `gh repo view <gh-owner>/<repo> --json name,defaultBranchRef`. If it already exists, skip `new-repo` creation.
|
||||||
|
2. **Non-Git Temp Directory Creation:** Otherwise, **always invoke `new-repo` from a fresh non-git temporary directory (`mktemp -d`)** so `new_repo.py`'s `determine_target()` never sees `.git` and never triggers `link_and_push_existing()` to overwrite local `origin`:
|
||||||
|
```bash
|
||||||
|
(cd "$(mktemp -d)" && new-repo <target> --empty --no-mirror --no-clone [-o <gh-org>] [-p])
|
||||||
|
```
|
||||||
|
3. **Explicit Refspec Push & Ancestry Guard:** Clone Gitea into a temp bare directory (`git clone --bare <gitea-url> <tmp-bare>`). Before pushing, if the target GitHub repo already has branches (e.g., on `/diagnose` resume), verify whether each Gitea branch tip is already an ancestor of the corresponding GitHub branch; never force-push over Step 5 `/tmp/` commits. Push explicit refspecs only (avoiding Gitea internal refs such as `refs/pull/*`):
|
||||||
|
```bash
|
||||||
|
git push <github-url> 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*'
|
||||||
|
```
|
||||||
|
Set GitHub's default branch to match Gitea's and verify `HEAD`, branch list, and tag list align.
|
||||||
|
|
||||||
|
## 4. Ephemeral `/tmp/` Commit, Archive Rename & Pull Mirror Swap
|
||||||
|
|
||||||
|
1. **Ephemeral `/tmp/` Clone:** Apply planned `.github/workflows/`, `README.md` badge updates, and `AGENTS.md` rewrites inside a fresh `/tmp/` clone of `<github-url>`, commit, and push to GitHub before touching Gitea. On resume, skip if the planned updates are already present on GitHub.
|
||||||
|
2. **Local Checkout Update:** If a local checkout exists, delegate flipping `origin` to `<github-url>`, resolving any dirty working-tree state, and pulling the migration commit (unless skipped due to colliding local edits) to `git-manager`.
|
||||||
|
3. **Archive Rename (100-Char Limit):** Compute UTC timestamp `YYYYMMDDHHMMSS` (`-archive-YYYYMMDDHHMMSS` is 23 chars). Truncate the `<repo>` base name to `<= 77` chars if needed so `<base>-archive-YYYYMMDDHHMMSS` stays within Gitea's 100-char limit, then rename via `PATCH /api/v1/repos/{owner}/{repo}`.
|
||||||
|
4. **Pull Mirror Attachment & Sync Verification:** Attach the Gitea pull mirror (passing private-repo credentials per `new-repo`'s mirror auth contract):
|
||||||
|
```bash
|
||||||
|
(cd "$(mktemp -d)" && new-repo --gitea-mirror <github-url> [-p] [--gitea-org <gitea-org>])
|
||||||
|
```
|
||||||
|
Trigger `POST /api/v1/repos/{owner}/{repo}/mirror-sync`, then poll `GET /api/v1/repos/{owner}/{repo}` and compare Gitea's default-branch commit SHA against GitHub's default-branch SHA every `3s` up to a `60s` timeout.
|
||||||
|
5. **Destructive Archive Deletion Gate:** Only after SHA parity is confirmed, ask for explicit user confirmation before deleting `<base>-archive-YYYYMMDDHHMMSS`.
|
||||||
@@ -41,5 +41,6 @@ description: >-
|
|||||||
- Target Gitea entity is created, queried, or updated with confirmed server JSON output.
|
- Target Gitea entity is created, queried, or updated with confirmed server JSON output.
|
||||||
|
|
||||||
## Hands off to
|
## Hands off to
|
||||||
|
- `gitea-to-github`: when migrating a Gitea repository or org to GitHub primary with a Gitea pull mirror.
|
||||||
- `git-manager`: for local branch, commit, or remote configuration work.
|
- `git-manager`: for local branch, commit, or remote configuration work.
|
||||||
- `projects`: when planning active delivery workflows on GitHub instead of ad-hoc Gitea usage.
|
- `projects`: when planning active delivery workflows on GitHub instead of ad-hoc Gitea usage.
|
||||||
@@ -23,7 +23,7 @@ description: >-
|
|||||||
`AGENTS.md`, read [references/planning-contract.md](references/planning-contract.md).
|
`AGENTS.md`, read [references/planning-contract.md](references/planning-contract.md).
|
||||||
Run `gh repo view --json url` to confirm a GitHub repository. If it fails or
|
Run `gh repo view --json url` to confirm a GitHub repository. If it fails or
|
||||||
`AGENTS.md` holds a legacy Gitea planning contract, halt and advise migrating
|
`AGENTS.md` holds a legacy Gitea planning contract, halt and advise migrating
|
||||||
to GitHub or using standalone `gt-usage`.
|
to GitHub via `/gitea-to-github` or using standalone `gt-usage`.
|
||||||
2. **Reconcile specs and GitHub state.** Compare `ARCHITECTURE.md`, `ROADMAP.md`,
|
2. **Reconcile specs and GitHub state.** Compare `ARCHITECTURE.md`, `ROADMAP.md`,
|
||||||
`docs/designs/*.md`, GitHub Issues, Milestones, and Projects v2 cards for
|
`docs/designs/*.md`, GitHub Issues, Milestones, and Projects v2 cards for
|
||||||
contradictions (zombie in-progress, premature completed, review orphan,
|
contradictions (zombie in-progress, premature completed, review orphan,
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ gh repo view --json url
|
|||||||
the repository's `AGENTS.md` contains a legacy Gitea planning contract (such
|
the repository's `AGENTS.md` contains a legacy Gitea planning contract (such
|
||||||
as Gitea `project_id`, `{Backlog..Completed -> column_id}` maps, or
|
as Gitea `project_id`, `{Backlog..Completed -> column_id}` maps, or
|
||||||
`gitea-plan` sync rules), fail fast and advise the user to either migrate the
|
`gitea-plan` sync rules), fail fast and advise the user to either migrate the
|
||||||
repository to GitHub or use standalone `gt-usage` outside the core delivery
|
repository to GitHub via `/gitea-to-github` or use standalone `gt-usage`
|
||||||
loop.
|
outside the core delivery loop.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+67
-3
@@ -34,6 +34,7 @@ EXPECTED_SKILLS = [
|
|||||||
"diagnose",
|
"diagnose",
|
||||||
"document",
|
"document",
|
||||||
"git-manager",
|
"git-manager",
|
||||||
|
"gitea-to-github",
|
||||||
"gt-usage",
|
"gt-usage",
|
||||||
"implement",
|
"implement",
|
||||||
"inspect-flake-update",
|
"inspect-flake-update",
|
||||||
@@ -256,9 +257,9 @@ class TestSkillsBehavioralContracts(unittest.TestCase):
|
|||||||
self.assertIn("Suppress any standalone `Suggested Next Step:` footer", impl_roles)
|
self.assertIn("Suppress any standalone `Suggested Next Step:` footer", impl_roles)
|
||||||
|
|
||||||
def test_chained_skills_include_suggested_next_step_routing(self):
|
def test_chained_skills_include_suggested_next_step_routing(self):
|
||||||
"""Proves all 6 chained skills include Suggested Next Step routing and valid relative markdown links."""
|
"""Proves all 7 chained skills include Suggested Next Step routing and valid relative markdown links."""
|
||||||
link_re = re.compile(r"\]\(([^)#]+\.md)(?:#[^)]+)?\)")
|
link_re = re.compile(r"\]\(([^)#]+\.md)(?:#[^)]+)?\)")
|
||||||
for skill_name in ("projects", "implement", "tdd", "code-review", "verify", "reconcile-docs"):
|
for skill_name in ("projects", "implement", "tdd", "code-review", "verify", "reconcile-docs", "gitea-to-github"):
|
||||||
skill_path = REPO_ROOT / "skills" / skill_name / "SKILL.md"
|
skill_path = REPO_ROOT / "skills" / skill_name / "SKILL.md"
|
||||||
text = skill_path.read_text()
|
text = skill_path.read_text()
|
||||||
self.assertIn("Suggested Next Step:", text, f"{skill_name} missing Suggested Next Step routing")
|
self.assertIn("Suggested Next Step:", text, f"{skill_name} missing Suggested Next Step routing")
|
||||||
@@ -451,7 +452,7 @@ class TestSkillsBehavioralContracts(unittest.TestCase):
|
|||||||
self.assertEqual(res_post.returncode, 0, res_post.stdout + res_post.stderr)
|
self.assertEqual(res_post.returncode, 0, res_post.stdout + res_post.stderr)
|
||||||
|
|
||||||
def test_skill_inventory_and_skeletons(self):
|
def test_skill_inventory_and_skeletons(self):
|
||||||
"""Proves all 15 active skills meet line count (<= 80), em-dash, and path portability rules, and legacy skills are retired."""
|
"""Proves all 16 active skills meet line count (<= 80), em-dash, and path portability rules, and legacy skills are retired."""
|
||||||
install_sh = (REPO_ROOT / "install.sh").read_text()
|
install_sh = (REPO_ROOT / "install.sh").read_text()
|
||||||
|
|
||||||
# Verify ACTIVE_PORTABLE_SKILLS matches EXPECTED_SKILLS exactly
|
# Verify ACTIVE_PORTABLE_SKILLS matches EXPECTED_SKILLS exactly
|
||||||
@@ -493,6 +494,69 @@ class TestSkillsBehavioralContracts(unittest.TestCase):
|
|||||||
self.assertIn("name:", content)
|
self.assertIn("name:", content)
|
||||||
self.assertIn("description:", content)
|
self.assertIn("description:", content)
|
||||||
|
|
||||||
|
def test_gitea_to_github_portability_hygiene(self):
|
||||||
|
"""Proves gitea-to-github files contain zero em-dashes, /home/ paths, or private domains."""
|
||||||
|
skill_dir = REPO_ROOT / "skills" / "gitea-to-github"
|
||||||
|
for path in [skill_dir / "SKILL.md", *sorted((skill_dir / "references").glob("*.md"))]:
|
||||||
|
text = path.read_text()
|
||||||
|
self.assertNotIn("—", text, f"{path.name} contains em-dash")
|
||||||
|
self.assertNotIn("/home/", text, f"{path.name} contains /home/ path")
|
||||||
|
self.assertNotIn("roadtotech", text, f"{path.name} contains private domain")
|
||||||
|
|
||||||
|
def test_gitea_to_github_safety_flags(self):
|
||||||
|
"""Proves gitea-to-github enforces dry-run flags, LFS fail-fast, and non-git mktemp provisioning."""
|
||||||
|
skill_dir = REPO_ROOT / "skills" / "gitea-to-github"
|
||||||
|
skill_md = (skill_dir / "SKILL.md").read_text()
|
||||||
|
remote_md = (skill_dir / "references" / "remote-and-mirror.md").read_text()
|
||||||
|
|
||||||
|
self.assertIn("--dry-run", skill_md)
|
||||||
|
self.assertIn("--execute", skill_md)
|
||||||
|
self.assertIn("git lfs ls-files", remote_md)
|
||||||
|
self.assertIn("mktemp -d", remote_md)
|
||||||
|
self.assertIn("--empty --no-mirror --no-clone", remote_md)
|
||||||
|
|
||||||
|
def test_gitea_to_github_archive_precedes_mirror_sync(self):
|
||||||
|
"""Proves gitea-to-github renames the archive before attaching the mirror and verifying sync."""
|
||||||
|
remote_md = (REPO_ROOT / "skills" / "gitea-to-github" / "references" / "remote-and-mirror.md").read_text()
|
||||||
|
archive_idx = remote_md.index("-archive-YYYYMMDDHHMMSS")
|
||||||
|
mirror_idx = remote_md.index("--gitea-mirror")
|
||||||
|
sync_idx = remote_md.index("mirror-sync")
|
||||||
|
self.assertLess(archive_idx, mirror_idx, "Archive rename must precede --gitea-mirror attachment")
|
||||||
|
self.assertLess(mirror_idx, sync_idx, "Mirror attachment must precede mirror-sync verification")
|
||||||
|
|
||||||
|
def test_gitea_to_github_ci_workflow_migration(self):
|
||||||
|
"""Proves ci-and-contracts.md covers .gitea -> .github workflow translation and public self-hosted guard."""
|
||||||
|
ci_md = (REPO_ROOT / "skills" / "gitea-to-github" / "references" / "ci-and-contracts.md").read_text()
|
||||||
|
self.assertIn(".gitea/workflows/", ci_md)
|
||||||
|
self.assertIn(".github/workflows/", ci_md)
|
||||||
|
self.assertIn("self-hosted", ci_md)
|
||||||
|
self.assertIn("ubuntu-latest", ci_md)
|
||||||
|
self.assertIn("`public`", ci_md)
|
||||||
|
|
||||||
|
def test_gitea_to_github_entity_idempotency_marker(self):
|
||||||
|
"""Proves entity-migration.md embeds the immutable gitea-origin deduplication marker."""
|
||||||
|
entity_md = (REPO_ROOT / "skills" / "gitea-to-github" / "references" / "entity-migration.md").read_text()
|
||||||
|
self.assertIn("<!-- gitea-origin: <gitea-host>/<owner>/<repo>#<number> -->", entity_md)
|
||||||
|
|
||||||
|
def test_gitea_to_github_sibling_skill_handoffs(self):
|
||||||
|
"""Proves projects and gt-usage reference gitea-to-github for legacy Gitea migration."""
|
||||||
|
projects_skill = (REPO_ROOT / "skills" / "projects" / "SKILL.md").read_text()
|
||||||
|
projects_contract = (REPO_ROOT / "skills" / "projects" / "references" / "planning-contract.md").read_text()
|
||||||
|
gt_usage_skill = (REPO_ROOT / "skills" / "gt-usage" / "SKILL.md").read_text()
|
||||||
|
|
||||||
|
self.assertIn("/gitea-to-github", projects_skill)
|
||||||
|
self.assertIn("/gitea-to-github", projects_contract)
|
||||||
|
self.assertIn("gitea-to-github", gt_usage_skill)
|
||||||
|
|
||||||
|
def test_profile_agents_gitea_origin_session_check(self):
|
||||||
|
"""Proves profile/AGENTS.md documents Gitea pull mirroring and local session-start check with sovereign opt-out."""
|
||||||
|
profile_agents = (REPO_ROOT / "profile" / "AGENTS.md").read_text()
|
||||||
|
self.assertIn("Gitea pull mirroring", profile_agents)
|
||||||
|
self.assertIn("/gitea-to-github", profile_agents)
|
||||||
|
self.assertIn("forge: gitea", profile_agents)
|
||||||
|
self.assertIn("git config --bool gitea.sovereign", profile_agents)
|
||||||
|
self.assertIn("project_number:", profile_agents)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
Reference in new issue
Block a user