Files
gitea/skills/repo-sync/SKILL.md
T

2.5 KiB

name, description
name description
repo-sync Batch-sync all readable repos of a chosen Gitea owner into the working directory. List owners, let the user pick, then clone or update each repo through tools/repo-sync.sh; a repo reported dirty goes to jsc-git:pr against the base branch that same script reports. Use for workspace bootstrap or bulk refresh; not for a single repo.

repo-sync — batch-sync repositories

Steps

  1. Before calling tools/gitea.sh, resolve GITEA_HOST and GITEA_TOKEN from the current shell environment (also check tea login list for a usable login token when GITEA_TOKEN is unset). If GITEA_HOST is unresolvable, or GITEA_TOKEN is unset and no tea login token exists either, ask the user for the missing value per the jsc-ask:ask rules before proceeding to any tools/gitea.sh call. Done when GITEA_HOST holds a value and either GITEA_TOKEN or a tea login token is available.
  2. Run tools/gitea.sh owners to list every {owner} the user can read. Done when the command has printed at least one {owner}.
  3. Ask the user which {owner} to sync, per the jsc-ask:ask rules. Every option states the owner's repo count and impact scope. Done when the user has named exactly one {owner} from that list.
  4. Run tools/gitea.sh repos {owner} to list every readable {repo} under that owner. Done when the command has printed the full {owner}/{repo} list for the chosen owner.
  5. Sync each {repo} one by one. This step MUST run as a sub agent (one sub agent per repo):
    1. Run tools/repo-sync.sh {owner}/{repo}. The script owns the clone-versus-pull decision and the base-branch precedence, so run no git clone, git checkout or git pull by hand, and derive no branch name yourself. Route on its single line of output: cloned or updated → this repo is done; dirty {branch} → go to substep 2; failed {reason} → record that reason and stop this repo. Done when exactly one of those four outcomes is recorded for this repo.
    2. dirty {branch} → call jsc-git:pr with {branch} from that same output line as the base, passed through verbatim. It commits, branches, pushes and opens the PR itself, so add none of those steps. Done when jsc-git:pr returns the PR URL and reports it with the table format in jsc-meta/references/pr-report.md.
  6. Report the sync result for every repo: cloned, updated, PR table row, or the failure reason. Done when every {repo} from step 4 carries one of those four results, and all PR rows share one table when more than one PR exists.