#!/usr/bin/env bash
# note-skill-use.sh  -  PostToolUse / PostToolUseFailure hook on the Skill tool.
#
# Appends the skill's name, the outcome, the time, the host and the repo folder
# name to the local skill-usage log. The logic is in note-skill-use.mjs; this
# wrapper exists because every hook the pipeline registers is a
# `bash "$HOME/.<host>/scripts/<name>"` command.
#
# Exits 0 on every path with no output: bookkeeping never holds a tool call.

set -u

HERE="$(cd "$(dirname "$0")" 2>/dev/null && pwd || true)"
CORE="$HERE/note-skill-use.mjs"
[ -f "$CORE" ] || exit 0
command -v node >/dev/null 2>&1 || exit 0

node "$CORE" >/dev/null 2>&1 || true
exit 0
