--- name: repo-sync description: 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; local changes become a branch, commit, push, and PR to develop or master. 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. 2. Run `tools/gitea.sh owners` to list every `{owner}` the user can read. 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. 4. Run `tools/gitea.sh repos {owner}` to list every readable `{repo}` under that owner. 5. Sync each `{repo}` one by one. This step **MUST run as a sub agent** (one sub agent per repo): 1. Missing locally → `git clone` into the working directory (clone URL from `tools/gitea.sh clone-url`). 2. Present locally → switch to `develop`, else `master` (or the result of `tools/gitea.sh default-branch`), then `git pull`. 3. Local file changes → create a branch from develop or master, commit via `jsc-git:commit`, push, then open a PR back to develop or master via `jsc-git:pr`. 6. Report the sync result for every repo: cloned, updated, PR created, or the failure reason.