feat: integrate framework files into monorepo under packages/mosaic/framework/
Moves all Mosaic framework runtime files from the separate bootstrap repo into the monorepo as canonical source. The @mosaic/mosaic npm package now ships the complete framework — bin scripts, runtime configs, tools, and templates — enabling standalone installation via npm install. Structure: packages/mosaic/framework/ ├── bin/ 28 CLI scripts (mosaic, mosaic-doctor, mosaic-sync-skills, etc.) ├── runtime/ Runtime adapters (claude, codex, opencode, pi, mcp) ├── tools/ Shell tooling (git, prdy, orchestrator, quality, etc.) ├── templates/ Agent and repo templates ├── defaults/ Default identity files (AGENTS.md, STANDARDS.md, SOUL.md, etc.) ├── install.sh Legacy bash installer └── remote-install.sh One-liner remote installer Key files with Pi support and recent fixes: - bin/mosaic: launch_pi() with skills-local loop - bin/mosaic-doctor: --fix auto-wiring for all 4 harnesses - bin/mosaic-sync-skills: Pi as 4th link target, symlink-aware find - bin/mosaic-link-runtime-assets: Pi settings.json patching - bin/mosaic-migrate-local-skills: Pi skill roots, symlink find - runtime/pi/RUNTIME.md + mosaic-extension.ts Package ships 251 framework files in the npm tarball (278KB compressed).
This commit is contained in:
116
packages/mosaic/framework/bin/mosaic-upgrade-slaves
Executable file
116
packages/mosaic/framework/bin/mosaic-upgrade-slaves
Executable file
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
MOSAIC_HOME="${MOSAIC_HOME:-$HOME/.config/mosaic}"
|
||||
BOOTSTRAP_CMD="$MOSAIC_HOME/bin/mosaic-bootstrap-repo"
|
||||
|
||||
roots=("$HOME/src")
|
||||
apply=0
|
||||
|
||||
usage() {
|
||||
cat <<USAGE
|
||||
Usage: $(basename "$0") [options]
|
||||
|
||||
Upgrade all Mosaic-linked slave repositories by re-running repo bootstrap with --force.
|
||||
|
||||
Options:
|
||||
--root <path> Add a search root (repeatable). Default: $HOME/src
|
||||
--apply Execute upgrades. Without this flag, script is dry-run.
|
||||
-h, --help Show this help
|
||||
USAGE
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--root)
|
||||
[[ $# -lt 2 ]] && { echo "Missing value for --root" >&2; exit 1; }
|
||||
roots+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--apply)
|
||||
apply=1
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ ! -x "$BOOTSTRAP_CMD" ]]; then
|
||||
echo "[mosaic-upgrade] Missing bootstrap command: $BOOTSTRAP_CMD" >&2
|
||||
echo "[mosaic-upgrade] Install/refresh framework first: ~/.config/mosaic/install.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# De-duplicate roots while preserving order.
|
||||
uniq_roots=()
|
||||
for r in "${roots[@]}"; do
|
||||
skip=0
|
||||
for e in "${uniq_roots[@]}"; do
|
||||
[[ "$r" == "$e" ]] && { skip=1; break; }
|
||||
done
|
||||
[[ $skip -eq 0 ]] && uniq_roots+=("$r")
|
||||
done
|
||||
|
||||
candidates=()
|
||||
for root in "${uniq_roots[@]}"; do
|
||||
[[ -d "$root" ]] || continue
|
||||
|
||||
while IFS= read -r marker; do
|
||||
repo_dir="$(dirname "$(dirname "$marker")")"
|
||||
if [[ -d "$repo_dir/.git" ]]; then
|
||||
candidates+=("$repo_dir")
|
||||
fi
|
||||
done < <(find "$root" -type f -path '*/.mosaic/README.md' 2>/dev/null)
|
||||
done
|
||||
|
||||
# De-duplicate repos while preserving order.
|
||||
repos=()
|
||||
for repo in "${candidates[@]}"; do
|
||||
skip=0
|
||||
for existing in "${repos[@]}"; do
|
||||
[[ "$repo" == "$existing" ]] && { skip=1; break; }
|
||||
done
|
||||
[[ $skip -eq 0 ]] && repos+=("$repo")
|
||||
done
|
||||
|
||||
count_total=${#repos[@]}
|
||||
count_ok=0
|
||||
count_fail=0
|
||||
|
||||
mode="DRY-RUN"
|
||||
[[ $apply -eq 1 ]] && mode="APPLY"
|
||||
|
||||
echo "[mosaic-upgrade] Mode: $mode"
|
||||
echo "[mosaic-upgrade] Roots: ${uniq_roots[*]}"
|
||||
echo "[mosaic-upgrade] Linked repos found: $count_total"
|
||||
|
||||
if [[ $count_total -eq 0 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for repo in "${repos[@]}"; do
|
||||
if [[ $apply -eq 1 ]]; then
|
||||
if "$BOOTSTRAP_CMD" "$repo" --force >/dev/null; then
|
||||
echo "[mosaic-upgrade] upgraded: $repo"
|
||||
count_ok=$((count_ok + 1))
|
||||
else
|
||||
echo "[mosaic-upgrade] FAILED: $repo" >&2
|
||||
count_fail=$((count_fail + 1))
|
||||
fi
|
||||
else
|
||||
echo "[mosaic-upgrade] would upgrade: $repo"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $apply -eq 1 ]]; then
|
||||
echo "[mosaic-upgrade] complete: ok=$count_ok failed=$count_fail total=$count_total"
|
||||
[[ $count_fail -gt 0 ]] && exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user