Workspace Repos
Manage the repositories defined in config.yaml. The repos/ directory should always reflect what config.yaml defines.
Config Format
Repositories are defined in config.yaml at the workspace root:
yaml
repos:
- name: frontend
url: git@github.com:org/frontend.git
branch: main
- name: backend-api
url: git@github.com:org/backend-api.git
branch: main
Each repo entry requires name and url. The branch field defaults to main if omitted.
Commands
Refresh
The primary command. When the user asks to refresh, sync, clone, update, or setup repos:
- •Read
config.yamlfrom the workspace root - •Create
repos/directory if it does not exist - •For each repo in config:
- •Not cloned:
git clone --branch {branch} {url} repos/{name} - •Cloned, correct branch:
git fetch --all --prune, stash if dirty,git pull origin {branch}, report if stash was needed - •Cloned, wrong branch: stash if dirty,
git checkout {branch},git pull origin {branch}, report branch switch
- •Not cloned:
- •For each directory in
repos/that is NOT in config:- •Remove it with
rm -rf repos/{name} - •Report the removal
- •Remove it with
- •Report summary: cloned, updated, switched, removed, failures
This is a destructive sync — repos/ is made to match config.yaml exactly.
Status
When the user asks for repo status:
- •Read
config.yaml - •For each repo in config:
- •Not cloned: report as "missing"
- •Cloned: report current branch, clean/dirty, ahead/behind remote
- •For each directory in
repos/not in config: report as "orphaned" - •Show a summary table
Add a Repo
When the user asks to add a repo:
- •Ask for name, url, and branch (default main)
- •Append the entry to
config.yamlunder therepos:key - •Clone the repo into
repos/{name}
Remove a Repo
When the user asks to remove a repo:
- •Remove the entry from
config.yaml - •Remove
repos/{name}directory - •Report the removal
Rules
- •Always read
config.yamlfresh before any operation - •Refresh is the default action — if the user just says "repos" or "setup repos", run refresh
- •On dirty working directory: always stash before any pull or checkout, never lose work
- •If a clone or update fails, continue with remaining repos and report failures at the end
- •Never force-push or rewrite history
- •Orphaned repos (in repos/ but not in config) are removed during refresh without confirmation — config.yaml is the source of truth