mirror of
https://github.com/gnekt/My-Brain-Is-Full-Crew.git
synced 2026-09-17 10:14:04 +00:00
Refactor install/update scripts to support agentic-platform agnosticity.
refactor(lib.sh): generalize install_claude_md → install_dispatcher New signature takes the full destination path instead of just the vault dir, allowing callers to install CLAUDE.md, AGENTS.md, or any dispatcher file to an explicit location. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(launchme): support --framework flag, build dist/ before install Add --framework and --target arg parsing. Run build.sh before installing to populate dist/<framework>/. All install_* calls now read from dist/<framework>/ instead of the raw source dirs. MCP is now handled automatically by the adapter (no interactive prompt). Replaced install_claude_md with install_dispatcher. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(updateme): support --framework flag, build dist/ before update Add --framework and --target arg parsing. Run build.sh before installing to populate dist/<framework>/. All install_* calls now read from dist/<framework>/ instead of raw source dirs. Replaced install_claude_md with install_dispatcher. Also fix set -e compatibility in lib.sh: add || true to all conditional [[ ... ]] && info "..." logging lines so they don't abort the script when VERBOSE_COPY=0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
# git pull
|
||||
# bash scripts/updateme.sh
|
||||
#
|
||||
# Options:
|
||||
# --framework <name> Framework to build for (default: claude-code)
|
||||
# --target <path> Override the vault destination path
|
||||
# =============================================================================
|
||||
|
||||
set -eo pipefail
|
||||
@@ -18,6 +21,18 @@ source "$SCRIPT_DIR/lib.sh"
|
||||
|
||||
resolve_paths "${BASH_SOURCE[0]}"
|
||||
|
||||
# ── Parse args ─────────────────────────────────────────────────────────────
|
||||
FRAMEWORK="claude-code"
|
||||
TARGET_OVERRIDE=""
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--framework) FRAMEWORK="$2"; shift 2 ;;
|
||||
--target) TARGET_OVERRIDE="$2"; shift 2 ;;
|
||||
*) die "Unknown argument: $1" ;;
|
||||
esac
|
||||
done
|
||||
[[ -n "$TARGET_OVERRIDE" ]] && VAULT_DIR="$TARGET_OVERRIDE"
|
||||
|
||||
# ── Banner ────────────────────────────────────────────────────────────────────
|
||||
print_banner "Update "
|
||||
|
||||
@@ -39,12 +54,18 @@ if [[ ! "$ANSWER" =~ ^[Cc]$ ]]; then
|
||||
fi
|
||||
echo ""
|
||||
|
||||
# ── Build the framework dist ───────────────────────────────────────────────
|
||||
info "Building $FRAMEWORK adapter..."
|
||||
bash "$SCRIPT_DIR/build.sh" --framework "$FRAMEWORK"
|
||||
DIST_DIR="$REPO_DIR/dist/$FRAMEWORK"
|
||||
[[ -d "$DIST_DIR" ]] || die "Build did not produce $DIST_DIR"
|
||||
|
||||
# ── Migrate legacy manifests (if any) ────────────────────────────────────────
|
||||
manifest_migrate
|
||||
|
||||
# ── Deprecate agents/refs removed from repo ──────────────────────────────────
|
||||
DEP_COUNT=$(deprecate_removed "agents" "$REPO_DIR/agents" "$VAULT_DIR/.claude/agents")
|
||||
DEP_COUNT=$((DEP_COUNT + $(deprecate_removed "references" "$REPO_DIR/references" "$VAULT_DIR/.claude/references")))
|
||||
DEP_COUNT=$(deprecate_removed "agents" "$DIST_DIR/.claude/agents" "$VAULT_DIR/.claude/agents")
|
||||
DEP_COUNT=$((DEP_COUNT + $(deprecate_removed "references" "$DIST_DIR/.claude/references" "$VAULT_DIR/.claude/references")))
|
||||
|
||||
# ── Ensure vault support dirs ─────────────────────────────────────────────────
|
||||
mkdir -p "$VAULT_DIR/Meta/states"
|
||||
@@ -52,17 +73,22 @@ mkdir -p "$VAULT_DIR/Meta/states"
|
||||
# ── Update components (per-file logging enabled) ─────────────────────────────
|
||||
VERBOSE_COPY=1
|
||||
|
||||
AGENT_COUNT=$(install_agents "$REPO_DIR/agents" "$VAULT_DIR/.claude/agents")
|
||||
REF_COUNT=$(install_refs "$REPO_DIR/references" "$VAULT_DIR/.claude/references")
|
||||
SKILL_COUNT=$(install_skills "$REPO_DIR/skills" "$VAULT_DIR/.claude/skills")
|
||||
HOOK_COUNT=$(install_hooks "$REPO_DIR/hooks" "$VAULT_DIR/.claude/hooks")
|
||||
AGENT_COUNT=$(install_agents "$DIST_DIR/.claude/agents" "$VAULT_DIR/.claude/agents")
|
||||
REF_COUNT=$(install_refs "$DIST_DIR/.claude/references" "$VAULT_DIR/.claude/references")
|
||||
SKILL_COUNT=$(install_skills "$DIST_DIR/.claude/skills" "$VAULT_DIR/.claude/skills")
|
||||
HOOK_COUNT=$(install_hooks "$DIST_DIR/.claude/hooks" "$VAULT_DIR/.claude/hooks")
|
||||
|
||||
install_settings "$REPO_DIR/settings.json" "$VAULT_DIR/.claude"
|
||||
install_settings "$DIST_DIR/.claude/settings.json" "$VAULT_DIR/.claude"
|
||||
SETTINGS_CHANGED=$_LAST_CHANGED
|
||||
|
||||
install_claude_md "$REPO_DIR/DISPATCHER.md" "$VAULT_DIR"
|
||||
install_dispatcher "$DIST_DIR/CLAUDE.md" "$VAULT_DIR/CLAUDE.md"
|
||||
CLAUDE_MD_CHANGED=$_LAST_CHANGED
|
||||
|
||||
# ── MCP servers ───────────────────────────────────────────────────────────────
|
||||
if [[ -f "$DIST_DIR/.mcp.json" ]]; then
|
||||
copy_if_changed "$DIST_DIR/.mcp.json" "$VAULT_DIR/.mcp.json"
|
||||
fi
|
||||
|
||||
# ── Summary ───────────────────────────────────────────────────────────────────
|
||||
echo ""
|
||||
TOTAL=$((AGENT_COUNT + REF_COUNT + SKILL_COUNT + HOOK_COUNT + SETTINGS_CHANGED + CLAUDE_MD_CHANGED))
|
||||
|
||||
Reference in New Issue
Block a user