BREAKING CHANGE: ~/.config/mosaic/bin/ is removed entirely. The mosaic npm CLI is now the only executable. ## What changed - **bin/ → deleted**: All scripts moved to tools/_scripts/ (internal) - **mosaic-launch → deleted**: Launcher logic is native TypeScript in packages/cli/src/commands/launch.ts - **mosaic.ps1 → deleted**: PowerShell launcher removed - **Framework install.sh**: Complete rewrite with migration system - **Version tracking**: .framework-version file (schema v2) - **Migration v1→v2**: Auto-removes bin/, cleans old PATH entries from shell profiles ## Native TypeScript launcher (commands/launch.ts) All runtime launch logic ported from bash: - Runtime prompt builder (AGENTS.md + RUNTIME.md + USER.md + TOOLS.md) - Mission context injection (reads .mosaic/orchestrator/mission.json) - PRD status injection (scans docs/PRD.md) - Pre-flight checks (MOSAIC_HOME, AGENTS.md, SOUL.md, runtime binary) - Session lock management with signal cleanup - Per-runtime launch: Claude, Codex, OpenCode, Pi - Yolo mode flags per runtime - Pi skill discovery + extension loading - Framework management (init, doctor, sync, bootstrap) delegates to tools/_scripts/ bash implementations ## Installer - tools/install.sh: detects framework by .framework-version or AGENTS.md - Framework install.sh: migration system with schema versioning - Forward-compatible: add migrations as numbered blocks - No PATH manipulation for framework (npm bin is the only PATH entry)
137 lines
3.6 KiB
Bash
Executable File
137 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
MOSAIC_HOME="${MOSAIC_HOME:-$HOME/.config/mosaic}"
|
|
backup_stamp="$(date +%Y%m%d%H%M%S)"
|
|
|
|
copy_file_managed() {
|
|
local src="$1"
|
|
local dst="$2"
|
|
|
|
mkdir -p "$(dirname "$dst")"
|
|
|
|
if [[ -L "$dst" ]]; then
|
|
rm -f "$dst"
|
|
fi
|
|
|
|
if [[ -f "$dst" ]]; then
|
|
if cmp -s "$src" "$dst"; then
|
|
return
|
|
fi
|
|
mv "$dst" "${dst}.mosaic-bak-${backup_stamp}"
|
|
fi
|
|
|
|
cp "$src" "$dst"
|
|
}
|
|
|
|
remove_legacy_path() {
|
|
local p="$1"
|
|
|
|
if [[ -L "$p" ]]; then
|
|
rm -f "$p"
|
|
return
|
|
fi
|
|
|
|
if [[ -d "$p" ]]; then
|
|
find "$p" -depth -type l -delete 2>/dev/null || true
|
|
find "$p" -depth -type d -empty -delete 2>/dev/null || true
|
|
return
|
|
fi
|
|
|
|
# Remove stale symlinked files if present.
|
|
if [[ -e "$p" && -L "$p" ]]; then
|
|
rm -f "$p"
|
|
fi
|
|
}
|
|
|
|
# Remove compatibility symlink surfaces for migrated content.
|
|
legacy_paths=(
|
|
"$HOME/.claude/agent-guides"
|
|
"$HOME/.claude/scripts/git"
|
|
"$HOME/.claude/scripts/codex"
|
|
"$HOME/.claude/scripts/bootstrap"
|
|
"$HOME/.claude/scripts/cicd"
|
|
"$HOME/.claude/scripts/portainer"
|
|
"$HOME/.claude/scripts/debug-hook.sh"
|
|
"$HOME/.claude/scripts/qa-hook-handler.sh"
|
|
"$HOME/.claude/scripts/qa-hook-stdin.sh"
|
|
"$HOME/.claude/scripts/qa-hook-wrapper.sh"
|
|
"$HOME/.claude/scripts/qa-queue-monitor.sh"
|
|
"$HOME/.claude/scripts/remediation-hook-handler.sh"
|
|
"$HOME/.claude/templates"
|
|
"$HOME/.claude/presets/domains"
|
|
"$HOME/.claude/presets/tech-stacks"
|
|
"$HOME/.claude/presets/workflows"
|
|
"$HOME/.claude/presets/jarvis-loop.json"
|
|
)
|
|
|
|
for p in "${legacy_paths[@]}"; do
|
|
remove_legacy_path "$p"
|
|
done
|
|
|
|
# Claude-specific runtime files (settings, hooks — NOT CLAUDE.md which is now a thin pointer)
|
|
for runtime_file in \
|
|
CLAUDE.md \
|
|
settings.json \
|
|
hooks-config.json \
|
|
context7-integration.md; do
|
|
src="$MOSAIC_HOME/runtime/claude/$runtime_file"
|
|
[[ -f "$src" ]] || continue
|
|
copy_file_managed "$src" "$HOME/.claude/$runtime_file"
|
|
done
|
|
|
|
# OpenCode runtime adapter (thin pointer to AGENTS.md)
|
|
opencode_adapter="$MOSAIC_HOME/runtime/opencode/AGENTS.md"
|
|
if [[ -f "$opencode_adapter" ]]; then
|
|
copy_file_managed "$opencode_adapter" "$HOME/.config/opencode/AGENTS.md"
|
|
fi
|
|
|
|
# Codex runtime adapter (thin pointer to AGENTS.md)
|
|
codex_adapter="$MOSAIC_HOME/runtime/codex/instructions.md"
|
|
if [[ -f "$codex_adapter" ]]; then
|
|
mkdir -p "$HOME/.codex"
|
|
copy_file_managed "$codex_adapter" "$HOME/.codex/instructions.md"
|
|
fi
|
|
|
|
# Pi runtime settings (MCP + skills paths)
|
|
pi_settings_dir="$HOME/.pi/agent"
|
|
pi_settings_file="$pi_settings_dir/settings.json"
|
|
mkdir -p "$pi_settings_dir"
|
|
|
|
if [[ ! -f "$pi_settings_file" ]]; then
|
|
echo '{}' > "$pi_settings_file"
|
|
fi
|
|
|
|
# Ensure Pi settings.json has Mosaic skills paths
|
|
mosaic_skills_path="$MOSAIC_HOME/skills"
|
|
mosaic_local_path="$MOSAIC_HOME/skills-local"
|
|
if ! grep -q "$mosaic_skills_path" "$pi_settings_file" 2>/dev/null; then
|
|
if command -v python3 >/dev/null 2>&1; then
|
|
python3 -c "
|
|
import json
|
|
with open('$pi_settings_file', 'r') as f:
|
|
data = json.load(f)
|
|
skills = data.get('skills', [])
|
|
if not isinstance(skills, list):
|
|
skills = []
|
|
for p in ['$mosaic_skills_path', '$mosaic_local_path']:
|
|
if p not in skills:
|
|
skills.append(p)
|
|
data['skills'] = skills
|
|
with open('$pi_settings_file', 'w') as f:
|
|
json.dump(data, f, indent=2)
|
|
f.write('\\n')
|
|
" 2>/dev/null
|
|
fi
|
|
fi
|
|
|
|
# Pi extension is loaded via --extension flag in the mosaic launcher.
|
|
# Do NOT copy into ~/.pi/agent/extensions/ — that causes duplicate loading.
|
|
|
|
if [[ -x "$MOSAIC_HOME/tools/_scripts/mosaic-ensure-sequential-thinking" ]]; then
|
|
"$MOSAIC_HOME/tools/_scripts/mosaic-ensure-sequential-thinking"
|
|
fi
|
|
|
|
echo "[mosaic-link] Runtime assets synced (non-symlink mode)"
|
|
echo "[mosaic-link] Canonical source: $MOSAIC_HOME"
|