Environment:A5c ai Babysitter GitHub CLI
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Release_Management |
| Last Updated | 2026-10-23 00:00 GMT |
Overview
GitHub CLI (gh) environment for repository creation and synchronization during atlas plugin publishing.
Description
This environment provides the GitHub CLI (`gh`) required by the atlas plugin repo sync to create GitHub repositories when they don't exist and to manage repository access for plugin distribution. The sync pipeline uses `gh repo view` to check for existing repos and `gh repo create` to provision new ones. This CLI is only needed when the `--push` flag is used; the default dry-run mode requires no GitHub CLI.
Usage
Use this environment for the atlas plugin repository synchronization workflow when running with `--push` mode in CI. It is the mandatory prerequisite for the `atlas_repo_sync` implementation when pushing to external GitHub repositories.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / macOS | CI runners |
| Hardware | 1 CPU core, 1GB RAM | Sufficient for gh operations |
| Disk | 2GB SSD | For repository clones |
| Network | GitHub API access | Required for repo creation and clone |
Dependencies
System Packages
- `gh` >= 2.0.0 (GitHub CLI)
- `git` >= 2.30.0 (used alongside gh for clone/push)
Credentials
- `GITHUB_TOKEN`: GitHub authentication token with repo creation and push permissions
- `GH_TOKEN`: Alternative environment variable for gh CLI authentication
- Token must have `repo` scope for private repositories or `public_repo` for public
Quick Install
# Install GitHub CLI
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update && sudo apt install gh
# Authenticate
gh auth login --with-token <<< "$GITHUB_TOKEN"
# Verify installation
gh --version
Code Evidence
Atlas sync push mode from `scripts/sync-atlas-plugin-repos.mjs:11-13`:
// DEFAULT = DRY-RUN: no gh repo create, no clone, no network, no push. Each repo dir
// is git init + git remote add origin only. With --push (CI only): gh repo view/create
// if missing, git clone, checkout -B branch, commit, push.
Branch detection from environment from `scripts/sync-atlas-plugin-repos.mjs:27`:
const branch = getArg('--branch', process.env.GITHUB_REF_NAME || currentBranch() || 'develop');
Hard-coded atlas repo suffixes from `scripts/sync-atlas-plugin-repos.mjs:36-48`:
const ATLAS_REPO_SUFFIXES = new Map([
['claude-code', 'claude'],
['codex', 'codex'],
['cursor', 'cursor'],
['gemini', 'gemini'],
['github-copilot', 'github-copilot'],
['pi', 'pi'],
['opencode', 'opencode'],
['genty', 'genty'],
]);
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `gh: command not found` | GitHub CLI not installed | Install gh CLI; only needed with `--push` flag |
| `HTTP 403: Forbidden` | Token lacks repo creation permissions | Ensure GITHUB_TOKEN has `repo` scope |
| `Repository already exists` | Attempting to create an existing repo | The sync checks with `gh repo view` first; ensure consistent naming |
Compatibility Notes
- Dry-run mode: The atlas sync defaults to dry-run and does NOT require gh CLI. Only `--push` mode requires it.
- GitHub Enterprise: Supported via `GH_HOST` environment variable for enterprise instances.
- Repository naming: Atlas repos follow `a5c-ai/atlas-<suffix>` naming convention with hard-coded suffix mapping.