.agents/skills/mirror-netdata-repos/SKILL.md
A local mirror of every active Netdata-org source repository, synced by a vendored bash script. Built for AI assistants (and humans) that need cross-repo grep, code review, and pattern lookup without paying GitHub API costs.
Netdata maintains ~150 active source repos across the
netdata GitHub org (the agent monorepo, cloud-* services,
ai-agent, charts, helmchart, blogs, dashboards, ...). Routine
work (cross-repo grep, "how does service X handle this?",
pattern lookup, build) needs all of them locally.
Without a local mirror:
With a local mirror at ${NETDATA_REPOS_DIR}, all of that is
fast local I/O.
This is a netdata repos mirror, independent from any other repo mirrors this workstation may have. It exists for this project's cross-repo work; it is not a generic research mirror.
The vendored script scripts/sync-netdata-repos.sh does two
phases:
For each .git-bearing subdirectory under ${NETDATA_REPOS_DIR},
sorted by recent activity (cached in .repo-activity-cache):
git pull, and git submodule update --init --force --recursive.Runs only when:
--repo flag was given (full sync), ANDgh is available AND authenticated.Lists gh repo list netdata --source --no-archived and clones
any that are not yet in the mirror. The --source --no-archived
filter excludes forks and dead repos -- they add no value for
cross-repo grep.
If gh is missing or not authenticated, Phase 2 is skipped
with a clear warning. Phase 1 still runs (it uses local git
only, no GitHub API).
Sub-repos in a mirror tend to drift onto stale feature
branches that no one remembers. A repo whose HEAD is on
fix/something-from-six-months-ago is a black hole for
cross-repo reasoning -- the assistant grepping it sees
out-of-date code and reasons wrong.
The only viable fix: always reset to the default branch when it's safe to do so. The script's safety conditions:
So the rule is: if you have working changes you want to keep, commit them or stash them before running this. Anything else the script handles correctly.
There's no automation here; the script is interactive (colored output, end-of-run summary). Run it on demand.
NETDATA_REPOS_DIR in <repo>/.env:
NETDATA_REPOS_DIR="/path/to/your/mirror"
mkdir -p "$NETDATA_REPOS_DIR".git and jq. Install via your package
manager.gh (the GitHub CLI)
and run gh auth login. SSH clone access to GitHub for the
netdata organization must work for clones.# Source the env, run the script.
source <(grep -E '^NETDATA_REPOS_DIR=' <repo>/.env)
.agents/skills/mirror-netdata-repos/scripts/sync-netdata-repos.sh
Or with the variable inline:
NETDATA_REPOS_DIR="/path/to/mirror" \
.agents/skills/mirror-netdata-repos/scripts/sync-netdata-repos.sh
The first run clones every netdata-org source repo. Expect it to take several minutes; subsequent runs are fast (only fetch+pull on each repo).
.agents/skills/mirror-netdata-repos/scripts/sync-netdata-repos.sh
.agents/skills/mirror-netdata-repos/scripts/sync-netdata-repos.sh \
--repo netdata \
--repo cloud-frontend
--repo is repeatable. When any --repo is given, Phase 2
(discovery) is skipped -- you asked for specific repos, the
script does not go looking for new ones.
.agents/skills/mirror-netdata-repos/scripts/sync-netdata-repos.sh --help
Works without NETDATA_REPOS_DIR set.
The script prints colored per-repo progress and ends with a summary covering:
Nothing to do in this skill or its script. Phase 2's
gh repo list netdata --source --no-archived discovers any
new netdata-org repo on the next full sync run. The repo
must be:
netdata org (not a fork).Otherwise it's skipped intentionally.
If you want to mirror a fork or an archived repo (rare),
clone it manually into ${NETDATA_REPOS_DIR}/<name> and the
next run's Phase 1 will start syncing it.
The script refuses to run unsafely. Hard errors (exit 2):
NETDATA_REPOS_DIR not set.NETDATA_REPOS_DIR set but the directory doesn't exist.git not in PATH.jq not in PATH.Soft warnings (Phase 2 skipped, Phase 1 still runs):
gh not installed.gh installed but not authenticated.netdata). This skill is
netdata-org-specific.--source --no-archived). To
mirror forks or archived repos, clone them manually -- the
script will then sync them in Phase 1.gh rate limit: Phase 2 calls gh repo list netdata --limit 1000 once per run. On a properly-authed gh this
is well within the limit.--force --recursive: intentional. Cross-repo
review and most build steps depend on accurate, up-to-date
submodule state. Local submodule modifications are
overwritten -- if you have work-in-progress inside a
submodule, commit it before running.This skill follows
<repo>/.agents/sensitive-data-discipline.md:
${NETDATA_REPOS_DIR} (the env key from .env).<repo>/.agents/skills/mirror-netdata-repos/scripts/sync-netdata-repos.sh
-- the vendored script.<repo>/.agents/skills/mirror-netdata-repos/how-tos/INDEX.md
-- live catalog of how-tos.<repo>/.env -- where NETDATA_REPOS_DIR lives.