GH Repo Cartographer
Quick Start
Use the bundled script for deterministic inventory work. From this skill or repository directory:
python scripts\gh_repo_cartographer.py --include-pages --include-releases --output github-repo-map.md --json-output github-repo-map.json
For a fast inventory from a saved repository address cache, use:
python scripts\gh_repo_cartographer.py --repo-address-file data\github-repo-addresses-harzva-just-agent.txt --no-fetch --output github-repo-map.md --json-output github-repo-map.json
To refresh that cache with matched local folders:
python scripts\gh_repo_cartographer.py --repo-address-file data\github-repo-addresses-harzva-just-agent.txt --no-fetch --scan-root D:\study\code --repo-address-output data\github-repo-addresses-harzva-just-agent.txt
The script:
- Reads managed account aliases from
gh-account-routerwhen available. - Resolves each alias to its canonical GitHub login with
gh api user. - Lists repositories owned by each resolved login, with a REST API fallback when
gh repo listGraphQL calls time out. - Reads repository URLs from
--repo-address-filetext caches; when used without--account, this skips live repository enumeration and uses the file as the remote source. - Resolves router URL aliases such as
https://github.com/just-agent, saihaoto the canonical GitHub login. - Optionally fetches GitHub Pages status/URL and latest release metadata for every repository.
- Scans local Git repositories under configured roots.
- Matches local remotes to
github.com/owner/repo. - Fetches remotes by default, then compares
HEADwith@{u}to reportsynced,behind,ahead,diverged,no-upstream, orno-local-copy.
Common Options
- Add scan roots with repeated
--scan-root <path>. If omitted, the script usesGH_REPO_CARTOGRAPHER_ROOTSwhen set, otherwise the current directory. - Add account aliases with repeated
--account <alias>. If omitted, aliases are discovered fromgh-account-router. - Add repository address caches with repeated
--repo-address-file <txt>. The checked-in local cache for Harzva and Just-Agent isdata\github-repo-addresses-harzva-just-agent.txt. - Set
GH_REPO_CARTOGRAPHER_REPO_ADDRESS_FILEto one or moreos.pathsep-separated txt files when a workflow should default to saved repository URLs. - Set
GH_ACCOUNT_ROUTERwhengh-account-routeris installed somewhere other than~/.codex/skills/gh-account-router/scripts/gh_account_router.py. - Use
--no-fetchonly when the user explicitly wants a faster offline check; mark results as based on stale local remote refs. - Use
--include-pageswhen building a Pages matrix or homepage preview index. - Use
--include-releaseswhen building a release hub or project matrix with release badges. - Use
--max-depth <n>to widen or narrow local scanning. - Use
--output <file>for a Markdown report and--json-output <file>for downstream README automation. - Use
--repo-address-output <file>to write a URL cache that includes matched local folder paths aslocal=<path>on each repository line.
Reporting Guidance
Summarize the Markdown report in the final answer:
- Number of remote repositories found.
- Number of repositories with GitHub Pages.
- Number of repositories with releases.
- Number matched to local folders.
- Repositories that are
behind,ahead,diverged, dirty, or missing local copies. - Local repositories with GitHub remotes outside the managed accounts.
- The report paths created.
Never print raw tokens or access-file contents. If authentication fails, report the account alias/login and the GitHub error after token redaction.
README Optimization Workflow
After generating the map, use it to prioritize README work:
- Start with repositories that have local matches and are
synced. - For
behindordivergedrepos, ask before editing README content unless the user clearly asked to update local branches. - For
no-local-copyrepos, recommend cloning before README optimization. - Use the JSON report when batching README audits or generating dashboards.