Replaces .gitmodules + git-submodule-based init/update/sync targets with
a manifest-driven sibling-clone model. No nested submodule checkouts
inside universe; each ecosystem repo lives at ~/work/lux/<name> as a
free-standing clone pinned to a semver tag (no main/latest/dev floating
tags in production).
- REPOS.yaml: source-of-truth manifest. 11 live repos pinned, 1
(graph-node) still on main with TODO marker. 6 dead refs removed
(explorer-lux, explorer-zoo, explore-lux, graph-node-lux, v2-subgraph,
v3-subgraph — all 404 on github.com/luxfi; the explorer trio is
folded into luxfi/explore which ships unified Next.js SPA + Go
indexer).
- scripts/repos.sh {init|update|list}: reads REPOS.yaml via yq. init
shallow-clones missing repos at the pinned tag. update fetches +
checks out the pinned tag (optionally for a single repo via
name=<repo>).
- Makefile: drops CORE/APP/DATA_SUBMODULES + ALL_SUBMODULES static
lists. init/update/sync/list delegate to scripts/repos.sh. Section
retitled 'Sibling Repos (REPOS.yaml — no submodules)'.
- .gitmodules: deleted (was empty 0-entry leftover).
To bump a pin: edit REPOS.yaml → make update name=<repo> → verify →
commit.
76 lines
2.4 KiB
Bash
Executable File
76 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Sibling-clone helper. Reads REPOS.yaml and ensures each repo is cloned
|
|
# at ~/work/lux/<name> checked out at the pinned semver tag.
|
|
#
|
|
# Replaces `git submodule init/update/sync`. No nested checkouts inside
|
|
# the universe repo — each ecosystem repo is a free-standing sibling.
|
|
#
|
|
# Usage:
|
|
# scripts/repos.sh init # clone missing repos at pinned tag
|
|
# scripts/repos.sh update # fetch + check out pinned tag for every repo
|
|
# scripts/repos.sh update node # update just one repo
|
|
# scripts/repos.sh list # print name → tag table
|
|
#
|
|
# Requires: yq (https://github.com/mikefarah/yq), git, optional gh for auth.
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
SIBLINGS_DIR="${SIBLINGS_DIR:-$HOME/work/lux}"
|
|
MANIFEST="$ROOT_DIR/REPOS.yaml"
|
|
|
|
if ! command -v yq >/dev/null 2>&1; then
|
|
echo "error: yq is required (brew install yq)" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cmd="${1:-list}"; shift || true
|
|
|
|
each_repo() {
|
|
yq -r '.repos | to_entries[] | [.key, .value.repo, .value.tag, .value.group] | @tsv' "$MANIFEST"
|
|
}
|
|
|
|
filter_name="${1:-}"
|
|
matches() { [ -z "$filter_name" ] || [ "$1" = "$filter_name" ]; }
|
|
|
|
list_cmd() {
|
|
printf "%-15s %-30s %-15s %s\n" NAME REPO TAG GROUP
|
|
while IFS=$'\t' read -r name repo tag group; do
|
|
printf "%-15s %-30s %-15s %s\n" "$name" "$repo" "$tag" "$group"
|
|
done < <(each_repo)
|
|
}
|
|
|
|
init_cmd() {
|
|
while IFS=$'\t' read -r name repo tag group; do
|
|
matches "$name" || continue
|
|
target="$SIBLINGS_DIR/$name"
|
|
if [ -d "$target/.git" ]; then
|
|
echo " ✓ $name already cloned at $target"
|
|
continue
|
|
fi
|
|
echo " ↻ clone $repo @ $tag → $target"
|
|
git clone --depth=1 --branch "$tag" "https://github.com/$repo.git" "$target" 2>&1 |
|
|
sed 's/^/ /'
|
|
done < <(each_repo)
|
|
}
|
|
|
|
update_cmd() {
|
|
while IFS=$'\t' read -r name repo tag group; do
|
|
matches "$name" || continue
|
|
target="$SIBLINGS_DIR/$name"
|
|
if [ ! -d "$target/.git" ]; then
|
|
echo " ⚠ $name not cloned yet — run: scripts/repos.sh init $name" >&2
|
|
continue
|
|
fi
|
|
echo " ↻ $name → $tag"
|
|
git -C "$target" fetch --tags origin 2>&1 | sed 's/^/ /' || true
|
|
git -C "$target" checkout "$tag" 2>&1 | sed 's/^/ /'
|
|
done < <(each_repo)
|
|
}
|
|
|
|
case "$cmd" in
|
|
list) list_cmd ;;
|
|
init) init_cmd ;;
|
|
update) update_cmd ;;
|
|
*) echo "usage: $0 {list|init|update} [name]" >&2; exit 1 ;;
|
|
esac
|