#!/usr/bin/env bash
# Plugin SessionEnd hook: Clean up symlink in target repo if in dogfood mode.
# The symlink redirects .codeflash/ to the agent repo — remove it when done
# so the target repo stays clean.

cd "$CLAUDE_PROJECT_DIR" 2>/dev/null || exit 0

# Only clean up if .codeflash is a symlink (dogfood mode created it)
if [ -L "$CLAUDE_PROJECT_DIR/.codeflash" ]; then
    rm "$CLAUDE_PROJECT_DIR/.codeflash"
fi

exit 0
