Files
msd-core/scripts/install-golem15.sh
Jakub Zych a9a7a328e6 refactor: hard-fork GSD -> MSD (Make Software Done)
Mechanical rename produced by scripts/msd-rename.cjs: gsd/Gsd/GSD -> msd/Msd/MSD
across contents and paths, upstream package/repo coordinates -> @golem15/msd-core
and golem15com/msd-core. Deep links into upstream history, sibling upstream
packages, the GSD-2 import feature, CHANGELOG.md and .changeset/ are kept as-is.

Hand edits on top: MSD block-letter banner and logos, LICENSE copyright line,
package/plugin identity, regenerated lockfile, install-tree fixtures, derived
registries and benchmark baseline; migration checksum baseline re-locked
(MSD keeps its own install state, so no install had applied the old sums);
sort-order and regex-escaped expectations in tests adjusted.
2026-10-06 01:47:40 +02:00

143 lines
4.0 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'EOF'
Install the private golem15 MSD build for Claude Code and Codex.
Grok Build consumes the shared Codex skills or Claude compatibility surface.
Usage:
scripts/install-golem15.sh [--update] [--skip-deps] [--profile PROFILE]
Options:
--update Pull origin/next with --ff-only before installing.
--skip-deps Do not run npm ci.
--profile PROFILE MSD profile: core, standard, or full (default: full).
-h, --help Show this help.
EOF
}
update=false
install_deps=true
profile="${MSD_PROFILE:-full}"
while (($#)); do
case "$1" in
--update) update=true ;;
--skip-deps) install_deps=false ;;
--profile)
shift
if (($# == 0)); then
echo "ERROR: --profile requires a value." >&2
exit 2
fi
profile="$1"
;;
-h|--help)
usage
exit 0
;;
*)
echo "ERROR: unknown argument: $1" >&2
usage >&2
exit 2
;;
esac
shift
done
case "$profile" in
core|standard|full) ;;
*)
echo "ERROR: profile must be core, standard, or full; got: $profile" >&2
exit 2
;;
esac
script_dir=$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
repo_root=$(CDPATH='' cd -- "$script_dir/.." && pwd)
cd "$repo_root"
node_version=$(node --version 2>/dev/null || true)
node_major=${node_version#v}
node_major=${node_major%%.*}
if [[ ! "$node_major" =~ ^[0-9]+$ ]] || ((node_major < 24)); then
cat >&2 <<EOF
ERROR: this MSD checkout requires Node.js 24 or newer.
Active Node: ${node_version:-not found}
Install/activate Node 24, then rerun this script.
EOF
exit 1
fi
if [[ "$update" == true ]]; then
echo "==> Updating private mirror from origin/next"
git pull --ff-only origin next
fi
if [[ "$install_deps" == true ]]; then
echo "==> Installing locked dependencies"
npm ci
fi
echo "==> Building runtime hooks from the private checkout"
npm run build:hooks
echo "==> Installing MSD for Claude Code (profile: $profile)"
node bin/install.js --claude --global "--profile=$profile"
echo "==> Installing MSD for Codex (profile: $profile)"
node bin/install.js --codex --global "--profile=$profile"
claude_root=${CLAUDE_CONFIG_DIR:-"$HOME/.claude"}
codex_root=${CODEX_HOME:-"$HOME/.codex"}
agents_root=${GROK_AGENTS_HOME:-"$HOME/.agents"}
recovery_rel=msd-core/workflows/plan-phase/steps/agent-recovery-and-timing.md
for install_root in "$claude_root" "$codex_root"; do
if [[ ! -f "$install_root/$recovery_rel" ]]; then
echo "ERROR: patched recovery workflow missing after install: $install_root/$recovery_rel" >&2
exit 1
fi
done
active_codex=$(command -v codex 2>/dev/null || true)
bun_codex="$HOME/.bun/bin/codex"
if [[ -x "$bun_codex" && "$active_codex" != "$bun_codex" ]]; then
active_version=$(${active_codex:-false} --version 2>/dev/null || echo unknown)
bun_version=$($bun_codex --version 2>/dev/null || echo unknown)
cat >&2 <<EOF
WARNING: PATH selects ${active_codex:-no Codex binary} (${active_version}),
but the newer Bun installation is $bun_codex (${bun_version}).
Put $HOME/.bun/bin before /usr/bin in PATH before starting Codex.
EOF
fi
if command -v grok >/dev/null 2>&1; then
grok_report=$(mktemp)
trap 'rm -f "$grok_report"' EXIT
shared_skill="$agents_root/skills/msd-plan-phase/SKILL.md"
claude_skill="$claude_root/skills/msd-plan-phase/SKILL.md"
if grok inspect --json >"$grok_report" 2>/dev/null \
&& { grep -Fq "$shared_skill" "$grok_report" || grep -Fq "$claude_skill" "$grok_report"; }; then
echo "==> Grok verified: msd-plan-phase skill discovered"
else
echo "WARNING: Grok did not report a compatible msd-plan-phase skill; restart Grok and run 'grok inspect'." >&2
fi
fi
cat <<EOF
Private MSD installation complete.
Source: $repo_root
Claude: $claude_root
Codex: $codex_root
Grok: $agents_root/skills (shared Codex surface, with Claude compatibility fallback)
Profile: $profile
Restart Claude Code, Codex, and Grok Build before using the updated skills.
For future updates run:
$repo_root/scripts/install-golem15.sh --update
EOF