#!/usr/bin/env bash # install.sh — wire Steev profile distribution into Hermes. # Idempotent. Does NOT set secrets and does NOT enable cron. # # ./install.sh [--copy] [--dry-run] # # Default = SYMLINK mode: the repo is canonical, ~/.hermes/steev → this repo. # --copy = copy files into ~/.hermes/steev instead. set -euo pipefail REPO="$(cd "$(dirname "$0")" && pwd)" HERMES_HOME="${HERMES_HOME:-$HOME/.hermes}" MODE=symlink; DRY=0 while [ $# -gt 0 ]; do case "$1" in --copy) MODE=copy ;; --dry-run) DRY=1 ;; *) echo "unknown arg: $1"; exit 2 ;; esac; shift; done CFG="$HERMES_HOME/profiles/steev/config.yaml" run() { if [ "$DRY" = 1 ]; then echo "DRY: $*"; else eval "$*"; fi; } echo "== preflight ==" for c in python3 sqlite3; do command -v "$c" >/dev/null || { echo "MISSING: $c"; exit 1; }; done echo "== link/copy repo → \$HERMES_HOME/steev ($MODE) ==" if [ "$MODE" = symlink ]; then if [ -e "$HERMES_HOME/steev" ] && [ ! -L "$HERMES_HOME/steev" ]; then echo "EXISTS (not a symlink): $HERMES_HOME/steev — remove it and re-run"; exit 1 fi run "ln -sfn '$REPO' '$HERMES_HOME/steev'" else run "mkdir -p '$HERMES_HOME/steev'" run "cp -r '$REPO'/skills '$REPO'/schema.sql '$HERMES_HOME/steev/'" fi echo "== register skills in steev profile config ==" SKILL_DIR="$REPO/skills" if [ "$DRY" = 0 ]; then python3 - "$CFG" "$SKILL_DIR" <<'PY' import sys, os, yaml cfg, sk = sys.argv[1], sys.argv[2] d = yaml.safe_load(open(cfg).read()) if os.path.exists(cfg) else {} d = d or {} d.setdefault('skills', {}).setdefault('external_dirs', []) if sk not in d['skills']['external_dirs']: d['skills']['external_dirs'].append(sk) open(cfg, 'w').write(yaml.dump(d, sort_keys=False, allow_unicode=True)) print(" +", sk) else: print(" already registered:", sk) PY else echo "DRY: register $SKILL_DIR in $CFG" fi echo "== steev.db ==" run "sqlite3 '$HERMES_HOME/steev/steev.db' < '$REPO/schema.sql'" echo "== done. verify: hermes -p steev skills list | grep steev-agent =="