mirror of
https://github.com/gnekt/My-Brain-Is-Full-Crew.git
synced 2026-08-26 02:04:43 +00:00
* Fix istall/update scripts * test: capture pre-refactor install snapshot for regression Adds take-snapshot.sh script and the resulting snapshot/ directory, capturing the exact vault state produced by launchme.sh before the framework-agnosticity refactor begins. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Summary: Refactor agents/skills/hooks/mcp in agentic-platform-agnostic templates. refactor: rename source CLAUDE.md → DISPATCHER.md (framework-neutral) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> refactor: convert agent frontmatter from tools: to neutral capabilities: Replace Claude Code-specific `tools:` frontmatter with framework-agnostic `mode: subagent` and `capabilities: [...]` in all 8 agent files. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> refactor: add neutral hook trigger manifests (.hook.yaml) refactor: hooks read neutral JSON schema (args.* instead of tool_input.*) refactor: convert .mcp.json to neutral mcp/servers.yaml Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Implement agentic-platform adapters skeleton. build: add adapters/lib.sh skeleton with vocabulary constants test: bash test runner for adapter helpers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): parse_frontmatter helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): parse_capabilities helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): should_include helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): parse_hook_yaml helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): agent_body helper with tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(adapters): enumerate_agents and enumerate_hooks helpers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Implement agentic-platform adapter for Claude Code. build(adapters): claude-code adapter skeleton with capability/event tables build(claude-code): adapter_translate_dispatcher with test build(claude-code): adapter_translate_references with test build(claude-code): adapter_translate_skills with tests build(claude-code): adapter_translate_agents with capability→tools mapping build(claude-code): hook wrapper template (CC native → neutral schema) build(claude-code): adapter_translate_hooks with wrapper generation build(claude-code): adapter_translate_mcp with hand-rolled YAML parser build(claude-code): adapter_finalize and complete adapter_build wiring build: scripts/build.sh dispatches to per-framework adapter Also fix adapter_translate_hooks and adapter_translate_agents to use while-read loops (avoiding word-splitting on paths with spaces) and guard grep calls with || true to survive set -eo pipefail when hooks have no match-tool field. Remove scripts/build.sh from .gitignore. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * 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> * test: regression runner diffs dist/claude-code against pre-refactor snapshot - Add tests/regression/run.sh that builds dist/claude-code and compares against snapshot, excluding runtime-only artifacts (.mbifc-manifest, .mcp.json, .claude-plugin/plugin.json) - Fix adapters/lib.sh agent_body: preserve '---' section dividers in body (awk now only skips '---' while still inside frontmatter, fm < 2) - Fix adapters/claude-code/adapter.sh: change 'read' capability to expand to only 'Read', appending 'Glob, Grep' at end of tools list to match snapshot ordering - Update snapshot to reflect intentional refactor changes: hook JSON schema (.args.* instead of .tool_input.*), wrapper scripts, settings.json with wrapper paths, and consistent tool ordering for postman/sorter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Implement opencode adapter. Co-Authored-By: win0na <winnie@winneon.moe> feat(lib.sh): add install_plugins helper for opencode JS plugins build(adapters): opencode adapter skeleton with capability/event tables build(opencode): adapter_translate_dispatcher (DISPATCHER.md → AGENTS.md) build(opencode): adapter_translate_references and adapter_translate_skills Implements Task 4 and Task 5: - adapter_translate_references: Copies reference markdown files to .opencode/references/ - adapter_translate_skills: Copies skill SKILL.md files to .opencode/skills/<name>/ with exclude filtering Both functions respect framework filtering via should_include(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(opencode): adapter_translate_agents with capability→permission mapping Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(opencode): bash-executor template for spawning hook scripts build(opencode): plugin-stub template for mbifc-hooks.js build(opencode): adapter_translate_hooks with JS plugin generation Implements _oc_hook_registry_json and adapter_translate_hooks in the opencode adapter. Copies hook scripts to .opencode/hooks/, generates a single .opencode/plugins/mbifc-hooks.js by inlining bash-executor.js and synthesising a hook registry from *.hook.yaml files. Uses python3 for template substitution to safely handle multi-line JS content. Adds 3 unit tests (copies scripts, registry entries, noop when no hooks dir). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(opencode): adapter_translate_mcp with local/remote handling build(opencode): adapter_finalize and complete adapter_build wiring Add adapter_finalize placeholder and wire adapter_translate_mcp into adapter_build; add end-to-end integration test (14/14 pass). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(launchme): branch on --framework for opencode install layout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(updateme): branch on --framework for opencode install layout Mirror the same case "$FRAMEWORK" block from launchme.sh: framework-specific DIST_COMPONENTS_DIR, VAULT_COMPONENTS_DIR, DISPATCHER_SRC/DST, MCP_SRC/DST, HAS_PLUGINS; conditional install_plugins; conditional install_settings; framework-aware vault-setup check; framework-neutral summary messages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix adapters to follow the same template. fix: restore adapter_build() contract, revert function renames Both adapters now export adapter_build() and adapter_translate_*() as the uniform public contract. scripts/build.sh sources one adapter and calls adapter_build uniformly. Private helpers (_oc_*) and vocabulary tables (cc_capability_to_tools, oc_capability_to_permission, etc.) retain their prefixes. CC regression and OC unit tests all pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> fix(tests): restore test_oc_ prefix on adapter_build end-to-end test * Fix agent format in opencode adapter * refactor: rename --framework to --platform across all scripts and tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Modify generic name for model tiers Co-Authored-By: win0na <winnie@winneon.moe> refactor: neutral model vocabulary (low/mid/high) in source agents feat(claude-code): cc_model_to_native() maps low/mid/high to haiku/sonnet/opus Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(opencode): update oc_model_to_provider() for low/mid/high vocabulary Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add gemini-cli adapter Co-Authored-By: win0na <winnie@winneon.moe> build(gemini-cli): adapter skeleton with capability/event/model tables build(gemini-cli): adapter_translate_dispatcher (DISPATCHER.md → GEMINI.md) build(gemini-cli): adapter_translate_references and adapter_translate_skills Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(gemini-cli): adapter_translate_agents with capability→tools mapping Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(gemini-cli): adapter_translate_hooks with wrapper scripts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> feat(install): add gemini-cli platform to launchme.sh and updateme.sh Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Implement preserving config merge for opencode. Co-Authored-By: win0na <winnie@winneon.moe> feat(opencode): config-merge.sh with formatting-preserving JSON merge Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> build(opencode): source config-merge.sh from adapter Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> feat(install): use oc_config_merge for opencode.json instead of overwrite Source config-merge.sh from install scripts for opencode platform so user keys in opencode.json are preserved on reinstall and update. Fix in-place merge by writing to a temp file before moving to output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add mcp files to gitignore. * Fix claude-specific references in agents, skills and references * Fix: remove claude-specific reference from hooks. build: add platform_dir and dispatcher_name to all hook wrapper/plugin templates feat(hooks): platform-aware path checks using platform_dir and dispatcher_name from JSON input test: update regression snapshot for platform-aware hook wrappers and scripts * Added interactive platform choice in launchme, and platform auto-detection in updateme. * Fix: remove claude-specific references from documentation * Update documentation to reflect the new platform-agnostic architecture * fix: address Copilot review feedback on PR #32 - tests/run.sh: check source return code, report failures - tests/regression/run.sh: use mktemp + trap cleanup instead of fixed /tmp paths - tests/regression/run.sh: include .mcp.json in regression comparison - tests/regression/take-snapshot.sh: use --platform flag instead of stale scripted input - adapters/opencode/templates/plugin-stub.js.tmpl: include stdout in hook block error message * fix: address Copilot review round 2 - config-merge.sh: reword comment to only promise indentation preservation (not full formatting) - take-snapshot.sh: copy required artifacts explicitly, optional ones with existence check - adapters/lib.sh: document parse_hook_yaml single-trigger limitation * fix: address Copilot review round 3 - adapters/opencode/adapter.sh: replace python3 template substitution with pure bash (while-read loop with case matching), removing python3 dependency - adapters/lib.sh: should_include now falls back to plain YAML key read for files without frontmatter delimiters (fixes hook .yaml exclude: support) * fix: address Copilot review round 4 - scripts/launchme.sh: fix double-dot in FW_DIR_NAME display (basename already includes the dot, e.g. ".claude") - scripts/launchme.sh: replace undefined MCP_ANSWER with check on MCP_DST existence for summary banner --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
305 lines
13 KiB
Bash
Executable File
305 lines
13 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# =============================================================================
|
|
# My Brain Is Full - Crew :: Installer
|
|
# =============================================================================
|
|
# Run this from inside the cloned repo, which should be inside your vault:
|
|
#
|
|
# cd /path/to/your-vault/My-Brain-Is-Full-Crew
|
|
# bash scripts/launchme.sh
|
|
#
|
|
# It builds and copies agents, skills, references, hooks, and settings into
|
|
# the vault's platform directory.
|
|
#
|
|
# Options:
|
|
# --platform <name> Platform to build for (interactive selection if omitted)
|
|
# --target <path> Override the vault destination path
|
|
# =============================================================================
|
|
|
|
set -eo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck source=scripts/lib.sh
|
|
source "$SCRIPT_DIR/lib.sh"
|
|
|
|
resolve_paths "${BASH_SOURCE[0]}"
|
|
|
|
# ── Parse args ─────────────────────────────────────────────────────────────
|
|
PLATFORM=""
|
|
TARGET_OVERRIDE=""
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--platform) PLATFORM="$2"; shift 2 ;;
|
|
--target) TARGET_OVERRIDE="$2"; shift 2 ;;
|
|
*) die "Unknown argument: $1 (use --platform <name> or --target <path>)" ;;
|
|
esac
|
|
done
|
|
[[ -n "$TARGET_OVERRIDE" ]] && VAULT_DIR="$TARGET_OVERRIDE"
|
|
|
|
# ── Platform selection (interactive if not specified) ──────────────────────
|
|
if [[ -z "$PLATFORM" ]]; then
|
|
# Discover available platforms from adapters/ directories
|
|
AVAILABLE=()
|
|
for d in "$REPO_DIR/adapters/"*/; do
|
|
[[ -f "${d}adapter.sh" ]] || continue
|
|
AVAILABLE+=("$(basename "$d")")
|
|
done
|
|
if [[ ${#AVAILABLE[@]} -eq 0 ]]; then
|
|
die "No adapters found in adapters/"
|
|
fi
|
|
echo ""
|
|
echo -e " ${BOLD}Select your agent platform:${NC}"
|
|
echo ""
|
|
for i in "${!AVAILABLE[@]}"; do
|
|
echo -e " ${BOLD}$((i+1)))${NC} ${AVAILABLE[$i]}"
|
|
done
|
|
echo ""
|
|
if ! read -r -p " > " PLATFORM_CHOICE 2>/dev/null; then PLATFORM_CHOICE=""; fi
|
|
# Accept either number or name
|
|
if [[ "$PLATFORM_CHOICE" =~ ^[0-9]+$ ]] && (( PLATFORM_CHOICE >= 1 && PLATFORM_CHOICE <= ${#AVAILABLE[@]} )); then
|
|
PLATFORM="${AVAILABLE[$((PLATFORM_CHOICE-1))]}"
|
|
else
|
|
# Try matching by name
|
|
for p in "${AVAILABLE[@]}"; do
|
|
if [[ "$p" == "$PLATFORM_CHOICE" ]]; then
|
|
PLATFORM="$p"
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
[[ -n "$PLATFORM" ]] || die "Invalid selection: $PLATFORM_CHOICE"
|
|
echo ""
|
|
info "Selected platform: $PLATFORM"
|
|
fi
|
|
|
|
# ── Banner ────────────────────────────────────────────────────────────────────
|
|
print_banner "Setup "
|
|
echo -e " Repo: ${BOLD}${REPO_DIR}${NC}"
|
|
echo -e " Vault: ${BOLD}${VAULT_DIR}${NC}"
|
|
echo ""
|
|
|
|
# ── Confirm vault location ────────────────────────────────────────────────────
|
|
if [[ -z "$TARGET_OVERRIDE" ]]; then
|
|
echo -e "${BOLD}Is this your Obsidian vault folder?${NC}"
|
|
echo -e " ${DIM}${VAULT_DIR}${NC}"
|
|
echo ""
|
|
echo -e " ${BOLD}y)${NC} Yes, install here"
|
|
echo -e " ${BOLD}n)${NC} No, let me type the correct path"
|
|
if ! read -r -p " > " CONFIRM 2>/dev/null; then CONFIRM=""; fi
|
|
|
|
if [[ "$CONFIRM" =~ ^[Nn]$ ]]; then
|
|
echo ""
|
|
echo -e "${BOLD}Enter the full path to your Obsidian vault:${NC}"
|
|
if ! read -r -p " > " VAULT_DIR 2>/dev/null; then
|
|
die "Cannot read input — are you running in a non-interactive shell?"
|
|
fi
|
|
VAULT_DIR="${VAULT_DIR/#\~/$HOME}"
|
|
[[ -d "$VAULT_DIR" ]] || die "Directory not found: $VAULT_DIR"
|
|
fi
|
|
fi
|
|
|
|
# ── Check for existing installation ──────────────────────────────────────────
|
|
EXISTING=0
|
|
[[ -d "$VAULT_DIR/.claude" ]] && EXISTING=1
|
|
[[ -d "$VAULT_DIR/.opencode" ]] && EXISTING=1
|
|
[[ -d "$VAULT_DIR/.gemini" ]] && EXISTING=1
|
|
[[ -f "$VAULT_DIR/CLAUDE.md" ]] && EXISTING=1
|
|
[[ -f "$VAULT_DIR/AGENTS.md" ]] && EXISTING=1
|
|
[[ -f "$VAULT_DIR/GEMINI.md" ]] && EXISTING=1
|
|
|
|
if [[ $EXISTING -eq 1 ]]; then
|
|
warn "An existing installation was detected:"
|
|
[[ -d "$VAULT_DIR/.claude" ]] && warn " .claude/ directory exists"
|
|
[[ -d "$VAULT_DIR/.opencode" ]] && warn " .opencode/ directory exists"
|
|
[[ -d "$VAULT_DIR/.gemini" ]] && warn " .gemini/ directory exists"
|
|
[[ -f "$VAULT_DIR/CLAUDE.md" ]] && warn " CLAUDE.md exists"
|
|
[[ -f "$VAULT_DIR/AGENTS.md" ]] && warn " AGENTS.md exists"
|
|
[[ -f "$VAULT_DIR/GEMINI.md" ]] && warn " GEMINI.md exists"
|
|
echo ""
|
|
echo -e " ${BOLD}The installer will overwrite core files. Custom agents are never deleted.${NC}"
|
|
echo -e " ${DIM}Your vault notes are never touched.${NC}"
|
|
echo ""
|
|
echo -e " ${BOLD}c)${NC} Continue"
|
|
echo -e " ${BOLD}q)${NC} Quit"
|
|
if ! read -r -p " > " ANSWER 2>/dev/null; then ANSWER=""; fi
|
|
if [[ ! "$ANSWER" =~ ^[Cc]$ ]]; then
|
|
echo ""; info "Installation cancelled."; echo ""; exit 0
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
|
|
# ── 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"
|
|
|
|
# ── Platform-specific install layout ────────────────────────────────────────
|
|
case "$PLATFORM" in
|
|
claude-code)
|
|
DIST_COMPONENTS_DIR="$DIST_DIR/.claude"
|
|
VAULT_COMPONENTS_DIR="$VAULT_DIR/.claude"
|
|
DISPATCHER_SRC="$DIST_DIR/CLAUDE.md"
|
|
DISPATCHER_DST="$VAULT_DIR/CLAUDE.md"
|
|
MCP_SRC="$DIST_DIR/.mcp.json"
|
|
MCP_DST="$VAULT_DIR/.mcp.json"
|
|
HAS_PLUGINS=0
|
|
;;
|
|
opencode)
|
|
DIST_COMPONENTS_DIR="$DIST_DIR/.opencode"
|
|
VAULT_COMPONENTS_DIR="$VAULT_DIR/.opencode"
|
|
DISPATCHER_SRC="$DIST_DIR/AGENTS.md"
|
|
DISPATCHER_DST="$VAULT_DIR/AGENTS.md"
|
|
MCP_SRC="$DIST_DIR/opencode.json"
|
|
MCP_DST="$VAULT_DIR/opencode.json"
|
|
HAS_PLUGINS=1
|
|
;;
|
|
gemini-cli)
|
|
DIST_COMPONENTS_DIR="$DIST_DIR/.gemini"
|
|
VAULT_COMPONENTS_DIR="$VAULT_DIR/.gemini"
|
|
DISPATCHER_SRC="$DIST_DIR/GEMINI.md"
|
|
DISPATCHER_DST="$VAULT_DIR/GEMINI.md"
|
|
MCP_SRC=""
|
|
MCP_DST=""
|
|
HAS_PLUGINS=0
|
|
;;
|
|
*)
|
|
die "Unknown platform: $PLATFORM (install layout not defined)"
|
|
;;
|
|
esac
|
|
PLATFORM_VAULT_DIR="$VAULT_COMPONENTS_DIR"
|
|
|
|
# Load opencode-specific helpers when building for opencode
|
|
if [[ "$PLATFORM" == "opencode" ]]; then
|
|
# shellcheck source=adapters/opencode/config-merge.sh
|
|
source "$REPO_DIR/adapters/opencode/config-merge.sh"
|
|
fi
|
|
|
|
# ── Migrate legacy manifests (if any) ────────────────────────────────────────
|
|
manifest_migrate
|
|
|
|
# ── Deprecate agents/refs removed from repo (reinstall only) ─────────────────
|
|
DEP_COUNT=0
|
|
if [[ $EXISTING -eq 1 ]]; then
|
|
DEP_COUNT=$(deprecate_removed "agents" "$DIST_COMPONENTS_DIR/agents" "$VAULT_COMPONENTS_DIR/agents")
|
|
DEP_COUNT=$((DEP_COUNT + $(deprecate_removed "references" "$DIST_COMPONENTS_DIR/references" "$VAULT_COMPONENTS_DIR/references")))
|
|
fi
|
|
|
|
# ── Ensure vault support dirs ─────────────────────────────────────────────────
|
|
mkdir -p "$VAULT_DIR/Meta/states"
|
|
|
|
# ── Install components ────────────────────────────────────────────────────────
|
|
info "Installing agents..."
|
|
AGENT_COUNT=$(install_agents "$DIST_COMPONENTS_DIR/agents" "$VAULT_COMPONENTS_DIR/agents")
|
|
success "Agents: $AGENT_COUNT installed/updated"
|
|
|
|
info "Installing references..."
|
|
REF_COUNT=$(install_refs "$DIST_COMPONENTS_DIR/references" "$VAULT_COMPONENTS_DIR/references")
|
|
success "References: $REF_COUNT installed/updated"
|
|
|
|
info "Installing skills..."
|
|
SKILL_COUNT=$(install_skills "$DIST_COMPONENTS_DIR/skills" "$VAULT_COMPONENTS_DIR/skills")
|
|
success "Skills: $SKILL_COUNT installed/updated"
|
|
|
|
info "Installing hooks..."
|
|
HOOK_COUNT=$(install_hooks "$DIST_COMPONENTS_DIR/hooks" "$VAULT_COMPONENTS_DIR/hooks")
|
|
success "Hooks: $HOOK_COUNT installed/updated"
|
|
|
|
# ── Deprecate stale orchestra scripts on reinstall ──────────────────────────
|
|
OLD_ORCH_MANIFEST="$VAULT_DIR/Meta/scripts/.core-manifest"
|
|
if [[ $EXISTING -eq 1 && -f "$OLD_ORCH_MANIFEST" ]]; then
|
|
while IFS= read -r old_script; do
|
|
[[ -z "$old_script" ]] && continue
|
|
[[ -f "$REPO_DIR/orchestra/$old_script" ]] && continue
|
|
vault_script="$VAULT_DIR/Meta/scripts/$old_script"
|
|
[[ -f "$vault_script" ]] || continue
|
|
rm "$vault_script"
|
|
warn "Removed stale script: $old_script"
|
|
done < "$OLD_ORCH_MANIFEST"
|
|
fi
|
|
|
|
# ── Copy orchestra scripts ──────────────────────────────────────────────────
|
|
ORCH_COUNT=0
|
|
if [[ -d "$REPO_DIR/orchestra" ]]; then
|
|
mkdir -p "$VAULT_DIR/Meta/scripts"
|
|
: > "$VAULT_DIR/Meta/scripts/.core-manifest"
|
|
for script in "$REPO_DIR/orchestra/"*; do
|
|
[[ -f "$script" ]] || continue
|
|
bname="$(basename "$script")"
|
|
[[ "$bname" == "README.md" ]] && continue
|
|
cp "$script" "$VAULT_DIR/Meta/scripts/"
|
|
chmod +x "$VAULT_DIR/Meta/scripts/$bname"
|
|
echo "$bname" >> "$VAULT_DIR/Meta/scripts/.core-manifest"
|
|
ORCH_COUNT=$((ORCH_COUNT + 1))
|
|
done
|
|
success "Copied $ORCH_COUNT orchestra scripts to Meta/scripts/"
|
|
fi
|
|
|
|
PLUGIN_COUNT=0
|
|
if [[ $HAS_PLUGINS -eq 1 && -d "$DIST_COMPONENTS_DIR/plugins" ]]; then
|
|
info "Installing plugins..."
|
|
PLUGIN_COUNT=$(install_plugins "$DIST_COMPONENTS_DIR/plugins" "$VAULT_COMPONENTS_DIR/plugins")
|
|
success "Plugins: $PLUGIN_COUNT installed/updated"
|
|
fi
|
|
|
|
# settings.json only exists for claude-code (hook config lives in the JS plugin on opencode)
|
|
if [[ -f "$DIST_COMPONENTS_DIR/settings.json" ]]; then
|
|
install_settings "$DIST_COMPONENTS_DIR/settings.json" "$VAULT_COMPONENTS_DIR"
|
|
fi
|
|
|
|
install_dispatcher "$DISPATCHER_SRC" "$DISPATCHER_DST"
|
|
|
|
# ── MCP / opencode.json ───────────────────────────────────────────────────────
|
|
if [[ -f "$MCP_SRC" ]]; then
|
|
if [[ "$PLATFORM" == "opencode" && -f "$MCP_DST" ]]; then
|
|
oc_config_merge "$MCP_SRC" "$MCP_DST" "$MCP_DST"
|
|
info "Merged opencode.json (user config preserved)"
|
|
else
|
|
copy_if_changed "$MCP_SRC" "$MCP_DST"
|
|
fi
|
|
fi
|
|
|
|
# ── Done ──────────────────────────────────────────────────────────────────────
|
|
echo ""
|
|
echo -e "${GREEN}${BOLD} Setup complete!${NC}"
|
|
echo ""
|
|
echo -e " ${VAULT_DIR}/"
|
|
FW_DIR_NAME="$(basename "$VAULT_COMPONENTS_DIR")"
|
|
DISPATCHER_NAME="$(basename "$DISPATCHER_DST")"
|
|
echo -e " ├── ${FW_DIR_NAME}/"
|
|
echo -e " │ ├── agents/ ${DIM}← agents${NC}"
|
|
echo -e " │ ├── skills/ ${DIM}← skills${NC}"
|
|
echo -e " │ ├── hooks/ ${DIM}← hooks${NC}"
|
|
if [[ $HAS_PLUGINS -eq 1 ]]; then
|
|
echo -e " │ ├── plugins/ ${DIM}← hook plugins${NC}"
|
|
else
|
|
echo -e " │ ├── settings.json ${DIM}← hooks configuration${NC}"
|
|
fi
|
|
echo -e " │ └── references/ ${DIM}← shared docs${NC}"
|
|
echo -e " ├── Meta/"
|
|
echo -e " │ └── scripts/ ${DIM}← ${ORCH_COUNT:-0} orchestra scripts${NC}"
|
|
if [[ -n "$MCP_SRC" && -f "$MCP_DST" ]]; then
|
|
echo -e " ├── ${DISPATCHER_NAME} ${DIM}← project instructions${NC}"
|
|
echo -e " └── $(basename "$MCP_DST") ${DIM}← MCP servers${NC}"
|
|
else
|
|
echo -e " └── ${DISPATCHER_NAME} ${DIM}← project instructions${NC}"
|
|
fi
|
|
|
|
if [[ $DEP_COUNT -gt 0 ]]; then
|
|
echo ""
|
|
warn "$DEP_COUNT file(s) were deprecated (moved to ${FW_DIR_NAME}/deprecated/)"
|
|
fi
|
|
echo ""
|
|
echo -e " ${BOLD}Next steps:${NC}"
|
|
case "$PLATFORM" in
|
|
claude-code) echo -e " 1. Open Claude Code in your vault folder" ;;
|
|
opencode) echo -e " 1. Open OpenCode in your vault folder" ;;
|
|
gemini-cli) echo -e " 1. Open Gemini CLI in your vault folder" ;;
|
|
*) echo -e " 1. Open your agent platform in your vault folder" ;;
|
|
esac
|
|
echo -e " 2. Say: ${BOLD}\"Initialize my vault\"${NC}"
|
|
echo -e " 3. The Architect will guide you through setup"
|
|
echo ""
|
|
echo -e " ${DIM}To update after a git pull: bash scripts/updateme.sh${NC}"
|
|
echo ""
|