#!/usr/bin/env bash
# Mnemon — post-commit hook
# Logs commit information to the Mnemon memory system

set -euo pipefail

# Check if mnemon is available
if ! command -v mnemon &>/dev/null; then
    echo "[mnemon] Warning: mnemon command not found. Commit not logged." >&2
    exit 0
fi

# Log the commit, but don't fail the commit if mnemon fails
if mnemon log-commit 2>&1; then
    echo "[mnemon] Commit logged successfully."
else
    echo "[mnemon] Warning: Failed to log commit. Continuing anyway." >&2
    # Don't exit with error - this would abort the git operation
    exit 0
fi
