diff --git a/plugin/hooks/scribe_session_context.sh b/plugin/hooks/scribe_session_context.sh index 9cfec0c..4c6b52c 100755 --- a/plugin/hooks/scribe_session_context.sh +++ b/plugin/hooks/scribe_session_context.sh @@ -41,6 +41,11 @@ set -uo pipefail command -v jq >/dev/null 2>&1 || exit 0 # needed to emit the JSON envelope safely +# `CDPATH= cd` is deliberate, not a typo'd assignment: it runs this one `cd` +# with CDPATH empty, so an operator whose CDPATH happens to contain a matching +# directory name can't send us somewhere else — and `cd` won't echo the resolved +# path into our output. shellcheck can't tell that idiom from `CDPATH=cd`. +# shellcheck disable=SC1007 here=$(CDPATH= cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) || exit 0 # SessionStart delivers a JSON event on stdin; `source` is startup|resume|compact|clear.