diff --git a/bin/claude-haha b/bin/claude-haha index 2e254c4a..920fb89b 100755 --- a/bin/claude-haha +++ b/bin/claude-haha @@ -2,6 +2,9 @@ set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +#Get your current working directory and export it as an environment variable. +export CALLER_DIR="$(pwd -W 2>/dev/null || pwd)" + cd "$ROOT_DIR" # Force recovery CLI (simple readline REPL, no Ink TUI) diff --git a/preload.ts b/preload.ts index 956c7248..a1fd6767 100644 --- a/preload.ts +++ b/preload.ts @@ -15,3 +15,7 @@ Object.assign(globalThis, { ISSUES_EXPLAINER: '', }, }); +// Switch to the current workspace +if (process.env.CALLER_DIR) { + process.chdir(process.env.CALLER_DIR); +} \ No newline at end of file