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:
nunziati
2026-04-08 14:05:12 +00:00
parent 48c75c7808
commit cf1f3dd83c
3 changed files with 94 additions and 63 deletions

View File

@@ -305,7 +305,7 @@ install_agents() {
manifest+=("$name")
copy_if_changed "$src" "$dst_dir/$name"
if [[ $_LAST_CHANGED -eq 1 ]]; then
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated agent: $name"
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated agent: $name" || true
count=$((count + 1))
fi
done
@@ -328,7 +328,7 @@ install_refs() {
copy_if_changed "$src" "$dst"
fi
if [[ $_LAST_CHANGED -eq 1 ]]; then
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated reference: $name"
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated reference: $name" || true
count=$((count + 1))
fi
done
@@ -347,7 +347,7 @@ install_skills() {
mkdir -p "$dst_dir/$name"
copy_if_changed "${skill_src}SKILL.md" "$dst_dir/$name/SKILL.md"
if [[ $_LAST_CHANGED -eq 1 ]]; then
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated skill: $name"
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated skill: $name" || true
count=$((count + 1))
fi
done
@@ -368,7 +368,7 @@ install_hooks() {
copy_if_changed "$src" "$dst"
if [[ $_LAST_CHANGED -eq 1 ]]; then
chmod +x "$dst"
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated hook: $name"
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated hook: $name" || true
count=$((count + 1))
fi
done
@@ -393,19 +393,19 @@ install_settings() {
cp "$dst" "${dst}.bak"
cp "$src" "$dst"
_LAST_CHANGED=1
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated settings.json (previous version saved as settings.json.bak)"
[[ $VERBOSE_COPY -eq 1 ]] && info "For custom hooks, use settings.local.json instead"
[[ $VERBOSE_COPY -eq 1 ]] && info "Updated settings.json (previous version saved as settings.json.bak)" || true
[[ $VERBOSE_COPY -eq 1 ]] && info "For custom hooks, use settings.local.json instead" || true
fi
}
# install_claude_md <src> <vault_dir>
# Copies DISPATCHER.md (src) to vault_dir/CLAUDE.md.
# install_dispatcher <src_file> <dst_path>
# Copies the source dispatcher file (CLAUDE.md or AGENTS.md) to the destination.
# Sets _LAST_CHANGED.
install_claude_md() {
local src="$1" vault_dir="$2"
install_dispatcher() {
local src="$1" dst="$2"
[[ -f "$src" ]] || return 0
copy_if_changed "$src" "$vault_dir/CLAUDE.md"
[[ $_LAST_CHANGED -eq 1 && $VERBOSE_COPY -eq 1 ]] && info "Updated CLAUDE.md"
copy_if_changed "$src" "$dst"
[[ $_LAST_CHANGED -eq 1 && $VERBOSE_COPY -eq 1 ]] && info "Updated $(basename "$dst")" || true
}
# ── UI helpers ────────────────────────────────────────────────────────────────