From 9a93cd4aa594fbd5a00df5e5ff9bb675b053012e Mon Sep 17 00:00:00 2001 From: nunziati Date: Fri, 10 Apr 2026 11:50:55 +0000 Subject: [PATCH] refactor: rename --framework to --platform across all scripts and tests Co-Authored-By: Claude Sonnet 4.6 --- adapters/claude-code/adapter.sh | 10 +++++----- adapters/opencode/adapter.sh | 12 ++++++------ scripts/build.sh | 22 +++++++++++----------- scripts/launchme.sh | 26 +++++++++++++------------- scripts/lib.sh | 16 ++++++++-------- scripts/updateme.sh | 30 +++++++++++++++--------------- tests/regression/run.sh | 2 +- 7 files changed, 59 insertions(+), 59 deletions(-) diff --git a/adapters/claude-code/adapter.sh b/adapters/claude-code/adapter.sh index 3a67e23..91140fe 100755 --- a/adapters/claude-code/adapter.sh +++ b/adapters/claude-code/adapter.sh @@ -7,7 +7,7 @@ # Claude Code expects in the user's vault. # ============================================================================= -CC_FRAMEWORK="claude-code" +CC_PLATFORM="claude-code" # Capability → CC tools mapping. Each capability expands into one or more # Claude Code tool names. The expansion is order-preserving. @@ -146,7 +146,7 @@ adapter_translate_hooks() { while IFS= read -r yaml; do [[ -z "$yaml" ]] && continue - should_include "$yaml" "$CC_FRAMEWORK" || continue + should_include "$yaml" "$CC_PLATFORM" || continue local meta; meta="$(parse_hook_yaml "$yaml")" local name; name="$(echo "$meta" | grep '^name=' | head -1 | cut -d= -f2- || true)" local script; script="$(echo "$meta" | grep '^script=' | head -1 | cut -d= -f2- || true)" @@ -205,7 +205,7 @@ adapter_translate_agents() { while IFS= read -r agent; do [[ -z "$agent" ]] && continue - should_include "$agent" "$CC_FRAMEWORK" || continue + should_include "$agent" "$CC_PLATFORM" || continue local name; name="$(parse_frontmatter "$agent" name)" local model; model="$(parse_frontmatter "$agent" model)" local caps; caps="$(parse_capabilities "$agent")" @@ -250,7 +250,7 @@ adapter_translate_skills() { [[ -d "$src" ]] || return 0 for skill_dir in "$src"/*/; do [[ -f "${skill_dir}SKILL.md" ]] || continue - should_include "${skill_dir}SKILL.md" "$CC_FRAMEWORK" || continue + should_include "${skill_dir}SKILL.md" "$CC_PLATFORM" || continue local name; name="$(basename "$skill_dir")" local out="$dst/.claude/skills/$name" mkdir -p "$out" @@ -267,7 +267,7 @@ adapter_translate_references() { mkdir -p "$out" for f in "$src"/*.md; do [[ -f "$f" ]] || continue - should_include "$f" "$CC_FRAMEWORK" || continue + should_include "$f" "$CC_PLATFORM" || continue cp "$f" "$out/" done } diff --git a/adapters/opencode/adapter.sh b/adapters/opencode/adapter.sh index 8ae77db..9b34e1f 100755 --- a/adapters/opencode/adapter.sh +++ b/adapters/opencode/adapter.sh @@ -7,7 +7,7 @@ # opencode expects in the user's vault. # ============================================================================= -OC_FRAMEWORK="opencode" +OC_PLATFORM="opencode" OC_FW_DIR="opencode" OC_DISPATCHER="AGENTS.md" @@ -88,7 +88,7 @@ adapter_translate_references() { mkdir -p "$out" for f in "$src"/*.md; do [[ -f "$f" ]] || continue - should_include "$f" "$OC_FRAMEWORK" || continue + should_include "$f" "$OC_PLATFORM" || continue cp "$f" "$out/" rewrite_framework_paths "$out/$(basename "$f")" "$OC_FW_DIR" "$OC_DISPATCHER" done @@ -102,7 +102,7 @@ adapter_translate_skills() { [[ -d "$src" ]] || return 0 for skill_dir in "$src"/*/; do [[ -f "${skill_dir}SKILL.md" ]] || continue - should_include "${skill_dir}SKILL.md" "$OC_FRAMEWORK" || continue + should_include "${skill_dir}SKILL.md" "$OC_PLATFORM" || continue local name; name="$(basename "$skill_dir")" local out="$dst/.opencode/skills/$name" mkdir -p "$out" @@ -123,7 +123,7 @@ adapter_translate_agents() { while IFS= read -r agent; do [[ -f "$agent" ]] || continue - should_include "$agent" "$OC_FRAMEWORK" || continue + should_include "$agent" "$OC_PLATFORM" || continue local model_raw; model_raw="$(parse_frontmatter "$agent" model)" local mode_raw; mode_raw="$(parse_frontmatter "$agent" mode)" @@ -178,7 +178,7 @@ _oc_hook_registry_json() { local entries='[]' while IFS= read -r yaml; do [[ -f "$yaml" ]] || continue - should_include "$yaml" "$OC_FRAMEWORK" || continue + should_include "$yaml" "$OC_PLATFORM" || continue local meta; meta="$(parse_hook_yaml "$yaml")" local name; name="$(echo "$meta" | grep '^name=' | head -1 | cut -d= -f2-)" local script; script="$(echo "$meta" | grep '^script=' | head -1 | cut -d= -f2-)" @@ -222,7 +222,7 @@ adapter_translate_hooks() { local have_any=0 while IFS= read -r yaml; do [[ -f "$yaml" ]] || continue - should_include "$yaml" "$OC_FRAMEWORK" || continue + should_include "$yaml" "$OC_PLATFORM" || continue local meta; meta="$(parse_hook_yaml "$yaml")" local script; script="$(echo "$meta" | grep '^script=' | head -1 | cut -d= -f2-)" [[ -f "$src/$script" ]] || continue diff --git a/scripts/build.sh b/scripts/build.sh index 59294e2..3b63217 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,9 +1,9 @@ #!/usr/bin/env bash # ============================================================================= -# scripts/build.sh — Run the framework adapter to populate dist// +# scripts/build.sh — Run the platform adapter to populate dist// # ============================================================================= -# Usage: bash scripts/build.sh --framework -# Discovers available frameworks by listing adapters/ subdirectories. +# Usage: bash scripts/build.sh --platform +# Discovers available platforms by listing adapters/ subdirectories. # ============================================================================= set -eo pipefail @@ -13,18 +13,18 @@ REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" source "$SCRIPT_DIR/lib.sh" # ── Parse args ───────────────────────────────────────────────────────────── -FRAMEWORK="claude-code" +PLATFORM="claude-code" while [[ $# -gt 0 ]]; do case "$1" in - --framework) FRAMEWORK="$2"; shift 2 ;; + --platform) PLATFORM="$2"; shift 2 ;; *) die "Unknown argument: $1" ;; esac done -# ── Validate framework ───────────────────────────────────────────────────── -if [[ ! -d "$REPO_ROOT/adapters/$FRAMEWORK" ]]; then +# ── Validate platform ───────────────────────────────────────────────────── +if [[ ! -d "$REPO_ROOT/adapters/$PLATFORM" ]]; then AVAILABLE="$(ls "$REPO_ROOT/adapters/" 2>/dev/null | grep -v '^lib.sh$' | tr '\n' ' ')" - die "Unknown framework: $FRAMEWORK. Available: $AVAILABLE" + die "Unknown platform: $PLATFORM. Available: $AVAILABLE" fi # ── Check dependencies ───────────────────────────────────────────────────── @@ -34,10 +34,10 @@ command -v jq >/dev/null 2>&1 || die "jq is required for the build (install via # shellcheck source=adapters/lib.sh source "$REPO_ROOT/adapters/lib.sh" # shellcheck source=/dev/null -source "$REPO_ROOT/adapters/$FRAMEWORK/adapter.sh" +source "$REPO_ROOT/adapters/$PLATFORM/adapter.sh" # ── Run the build ────────────────────────────────────────────────────────── -DIST_DIR="$REPO_ROOT/dist/$FRAMEWORK" -info "Building $FRAMEWORK → $DIST_DIR" +DIST_DIR="$REPO_ROOT/dist/$PLATFORM" +info "Building $PLATFORM → $DIST_DIR" adapter_build "$REPO_ROOT" "$DIST_DIR" success "Build complete" diff --git a/scripts/launchme.sh b/scripts/launchme.sh index 1c97a94..f292e31 100755 --- a/scripts/launchme.sh +++ b/scripts/launchme.sh @@ -11,7 +11,7 @@ # .claude/ directory. # # Options: -# --framework Framework to build for (default: claude-code) +# --platform Platform to build for (default: claude-code) # --target Override the vault destination path # ============================================================================= @@ -24,13 +24,13 @@ source "$SCRIPT_DIR/lib.sh" resolve_paths "${BASH_SOURCE[0]}" # ── Parse args ───────────────────────────────────────────────────────────── -FRAMEWORK="claude-code" +PLATFORM="claude-code" TARGET_OVERRIDE="" while [[ $# -gt 0 ]]; do case "$1" in - --framework) FRAMEWORK="$2"; shift 2 ;; + --platform) PLATFORM="$2"; shift 2 ;; --target) TARGET_OVERRIDE="$2"; shift 2 ;; - *) die "Unknown argument: $1 (use --framework or --target )" ;; + *) die "Unknown argument: $1 (use --platform or --target )" ;; esac done [[ -n "$TARGET_OVERRIDE" ]] && VAULT_DIR="$TARGET_OVERRIDE" @@ -88,14 +88,14 @@ fi echo "" -# ── Build the framework dist ─────────────────────────────────────────────── -info "Building $FRAMEWORK adapter..." -bash "$SCRIPT_DIR/build.sh" --framework "$FRAMEWORK" -DIST_DIR="$REPO_DIR/dist/$FRAMEWORK" +# ── Build the platform dist ─────────────────────────────────────────────── +info "Building $PLATFORM adapter..." +bash "$SCRIPT_DIR/build.sh" --platform "$PLATFORM" +DIST_DIR="$REPO_DIR/dist/$PLATFORM" [[ -d "$DIST_DIR" ]] || die "Build did not produce $DIST_DIR" -# ── Framework-specific install layout ──────────────────────────────────────── -case "$FRAMEWORK" in +# ── Platform-specific install layout ──────────────────────────────────────── +case "$PLATFORM" in claude-code) DIST_COMPONENTS_DIR="$DIST_DIR/.claude" VAULT_COMPONENTS_DIR="$VAULT_DIR/.claude" @@ -115,10 +115,10 @@ case "$FRAMEWORK" in HAS_PLUGINS=1 ;; *) - die "Unknown framework: $FRAMEWORK (install layout not defined)" + die "Unknown platform: $PLATFORM (install layout not defined)" ;; esac -FRAMEWORK_VAULT_DIR="$VAULT_COMPONENTS_DIR" +PLATFORM_VAULT_DIR="$VAULT_COMPONENTS_DIR" # ── Migrate legacy manifests (if any) ──────────────────────────────────────── manifest_migrate @@ -237,7 +237,7 @@ if [[ $DEP_COUNT -gt 0 ]]; then fi echo "" echo -e " ${BOLD}Next steps:${NC}" -if [[ "$FRAMEWORK" == "opencode" ]]; then +if [[ "$PLATFORM" == "opencode" ]]; then echo -e " 1. Open opencode in your vault folder" else echo -e " 1. Open Claude Code in your vault folder" diff --git a/scripts/lib.sh b/scripts/lib.sh index a3dc2da..5c85fc3 100755 --- a/scripts/lib.sh +++ b/scripts/lib.sh @@ -161,13 +161,13 @@ merge_marked_file() { # Single unified manifest at $VAULT_DIR/.{framework}/.mbifc-manifest # Format: INI-style with [section] headers, one entry per line. # -# FRAMEWORK_VAULT_DIR must be set before calling these functions (e.g. +# PLATFORM_VAULT_DIR must be set before calling these functions (e.g. # $VAULT_DIR/.claude for claude-code, $VAULT_DIR/.opencode for opencode). # Defaults to $VAULT_DIR/.claude for backwards compatibility. manifest_read() { local section="$1" - local file="${FRAMEWORK_VAULT_DIR:-$VAULT_DIR/.claude}/.mbifc-manifest" + local file="${PLATFORM_VAULT_DIR:-$VAULT_DIR/.claude}/.mbifc-manifest" [[ -f "$file" ]] || return 0 awk -v sec="[$section]" ' $0 == sec { found=1; next } @@ -179,7 +179,7 @@ manifest_read() { manifest_write() { local section="$1"; shift local entries=("$@") - local file="${FRAMEWORK_VAULT_DIR:-$VAULT_DIR/.claude}/.mbifc-manifest" + local file="${PLATFORM_VAULT_DIR:-$VAULT_DIR/.claude}/.mbifc-manifest" mkdir -p "$(dirname "$file")" local tmpfile; tmpfile="$(mktemp)" local in_section=0 section_written=0 @@ -215,7 +215,7 @@ manifest_write() { manifest_remove() { local section="$1" name="$2" - local file="${FRAMEWORK_VAULT_DIR:-$VAULT_DIR/.claude}/.mbifc-manifest" + local file="${PLATFORM_VAULT_DIR:-$VAULT_DIR/.claude}/.mbifc-manifest" [[ -f "$file" ]] || return 0 local tmpfile; tmpfile="$(mktemp)" local in_section=0 @@ -231,7 +231,7 @@ manifest_remove() { # Converts legacy per-directory .core-manifest files to the unified format. # Runs only when legacy files are present; idempotent thereafter. manifest_migrate() { - local _fw_dir="${FRAMEWORK_VAULT_DIR:-$VAULT_DIR/.claude}" + local _fw_dir="${PLATFORM_VAULT_DIR:-$VAULT_DIR/.claude}" local agents_mf="$_fw_dir/agents/.core-manifest" local refs_mf="$_fw_dir/references/.core-manifest" [[ -f "$agents_mf" ]] || [[ -f "$refs_mf" ]] || return 0 @@ -259,7 +259,7 @@ manifest_migrate() { # deprecate_removed
# Moves files listed in the manifest for
that no longer exist in -# to $FRAMEWORK_VAULT_DIR/deprecated/, prepending a DEPRECATED header. +# to $PLATFORM_VAULT_DIR/deprecated/, prepending a DEPRECATED header. # Prints the count of deprecated files to stdout. deprecate_removed() { local section="$1" src_dir="$2" dst_dir="$3" @@ -273,7 +273,7 @@ deprecate_removed() { [[ "$name" == *"-DEPRECATED"* ]] && continue # already deprecated local dep_name="${name%.md}-DEPRECATED.md" - local dep_dir="${FRAMEWORK_VAULT_DIR:-$VAULT_DIR/.claude}/deprecated" + local dep_dir="${PLATFORM_VAULT_DIR:-$VAULT_DIR/.claude}/deprecated" mkdir -p "$dep_dir" [[ -f "$dep_dir/$dep_name" ]] && continue # already done in a prior run @@ -284,7 +284,7 @@ deprecate_removed() { mv "$dep_dir/$dep_name.tmp" "$dep_dir/$dep_name" manifest_remove "$section" "$name" - warn "Deprecated: $name → $(basename "${FRAMEWORK_VAULT_DIR:-$VAULT_DIR/.claude}")/deprecated/$dep_name" + warn "Deprecated: $name → $(basename "${PLATFORM_VAULT_DIR:-$VAULT_DIR/.claude}")/deprecated/$dep_name" count=$((count + 1)) done < <(manifest_read "$section") diff --git a/scripts/updateme.sh b/scripts/updateme.sh index 498dcb0..02f0113 100755 --- a/scripts/updateme.sh +++ b/scripts/updateme.sh @@ -9,7 +9,7 @@ # bash scripts/updateme.sh # # Options: -# --framework Framework to build for (default: claude-code) +# --platform Platform to build for (default: claude-code) # --target Override the vault destination path # ============================================================================= @@ -22,11 +22,11 @@ source "$SCRIPT_DIR/lib.sh" resolve_paths "${BASH_SOURCE[0]}" # ── Parse args ───────────────────────────────────────────────────────────── -FRAMEWORK="claude-code" +PLATFORM="claude-code" TARGET_OVERRIDE="" while [[ $# -gt 0 ]]; do case "$1" in - --framework) FRAMEWORK="$2"; shift 2 ;; + --platform) PLATFORM="$2"; shift 2 ;; --target) TARGET_OVERRIDE="$2"; shift 2 ;; *) die "Unknown argument: $1" ;; esac @@ -37,16 +37,16 @@ done print_banner "Update " # ── Check vault has been set up ─────────────────────────────────────────────── -case "$FRAMEWORK" in +case "$PLATFORM" in claude-code) _SETUP_CHECK="$VAULT_DIR/.claude/agents" ;; opencode) _SETUP_CHECK="$VAULT_DIR/.opencode/agents" ;; *) _SETUP_CHECK="$VAULT_DIR/.claude/agents" ;; esac [[ -d "$_SETUP_CHECK" ]] \ - || die "No agents/ found in $VAULT_DIR for framework '$FRAMEWORK' — run launchme.sh first" + || die "No agents/ found in $VAULT_DIR for platform '$PLATFORM' — run launchme.sh first" # ── Confirm ─────────────────────────────────────────────────────────────────── -case "$FRAMEWORK" in +case "$PLATFORM" in opencode) _DISP_NAME="AGENTS.md"; _FW_DIR_NAME="opencode" ;; *) _DISP_NAME="CLAUDE.md"; _FW_DIR_NAME="claude" ;; esac @@ -63,14 +63,14 @@ 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" +# ── Build the platform dist ─────────────────────────────────────────────── +info "Building $PLATFORM adapter..." +bash "$SCRIPT_DIR/build.sh" --platform "$PLATFORM" +DIST_DIR="$REPO_DIR/dist/$PLATFORM" [[ -d "$DIST_DIR" ]] || die "Build did not produce $DIST_DIR" -# ── Framework-specific install layout ──────────────────────────────────────── -case "$FRAMEWORK" in +# ── Platform-specific install layout ──────────────────────────────────────── +case "$PLATFORM" in claude-code) DIST_COMPONENTS_DIR="$DIST_DIR/.claude" VAULT_COMPONENTS_DIR="$VAULT_DIR/.claude" @@ -90,10 +90,10 @@ case "$FRAMEWORK" in HAS_PLUGINS=1 ;; *) - die "Unknown framework: $FRAMEWORK (install layout not defined)" + die "Unknown platform: $PLATFORM (install layout not defined)" ;; esac -FRAMEWORK_VAULT_DIR="$VAULT_COMPONENTS_DIR" +PLATFORM_VAULT_DIR="$VAULT_COMPONENTS_DIR" # ── Migrate legacy manifests (if any) ──────────────────────────────────────── manifest_migrate @@ -146,5 +146,5 @@ else [[ $DEP_COUNT -gt 0 ]] && warn "$DEP_COUNT file(s) deprecated (moved to deprecated/)" fi echo "" -echo -e " ${DIM}Restart $FRAMEWORK to pick up the changes.${NC}" +echo -e " ${DIM}Restart $PLATFORM to pick up the changes.${NC}" echo "" diff --git a/tests/regression/run.sh b/tests/regression/run.sh index 076eaf9..4784f63 100755 --- a/tests/regression/run.sh +++ b/tests/regression/run.sh @@ -10,7 +10,7 @@ SNAPSHOT_DIR="$SCRIPT_DIR/snapshot" [[ -d "$SNAPSHOT_DIR" ]] || { echo "no snapshot at $SNAPSHOT_DIR — run take-snapshot.sh before refactoring"; exit 1; } # Build claude-code -bash "$REPO_DIR/scripts/build.sh" --framework claude-code +bash "$REPO_DIR/scripts/build.sh" --platform claude-code DIST_DIR="$REPO_DIR/dist/claude-code" [[ -d "$DIST_DIR" ]] || { echo "build did not produce $DIST_DIR"; exit 1; }