#!/usr/bin/env bash # # Claude Code SessionStart hook: tell an agent session how builds work, what the # workspace looks like right now, and anything wrong with it. Runs wherever midas is # configured (~/.config/midas/hub.env). The work is `midas hook session-start` # (src/hook.rs, its text src/session-start.md), which asks its questions at once. # FAILS OPEN: anything unexpected costs nothing but this note. [ -f "$HOME/.config/midas/hub.env" ] || exit 0 # midas and cargo are one binary. If it lives somewhere a container # recreate does not empty (MIDAS_BIN, where deploy.sh puts it), link the names. BIN=${MIDAS_BIN:-$HOME/cargo-target/midas/bin/midas} if [ -x "$BIN" ]; then mkdir -p "$HOME/.local/bin" 2>/dev/null for name in midas cargo; do [ -e "$HOME/.local/bin/$name" ] || ln -sfn "$BIN" "$HOME/.local/bin/$name" 2>/dev/null done fi M=$HOME/.local/bin/midas; [ -x "$M" ] || M=$(command -v midas) || exit 0 "$M" hook session-start 2>/dev/null exit 0