From c81decb9b9957c449f2c238ce56f79720e68c006 Mon Sep 17 00:00:00 2001 From: haoshuoyang Date: Sat, 4 Apr 2026 16:11:03 +0800 Subject: [PATCH] fix: an issue where the @ command could not be used correctly in other workspaces and ensured cross-platform compatibility. --- bin/claude-haha | 3 +++ preload.ts | 4 ++++ 2 files changed, 7 insertions(+) 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