fix: expose codex cli to local agent launchd

This commit is contained in:
AI Bot
2026-06-05 15:14:43 +08:00
parent e4e6f6597a
commit 684b98c5c1
2 changed files with 23 additions and 0 deletions

View File

@@ -5,6 +5,24 @@ ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
CONFIG_PATH="${1:-$ROOT_DIR/local-agent/config.example.json}"
NODE_BIN="${BOSS_NODE_BIN:-}"
append_path_if_dir() {
local candidate="$1"
if [[ -d "$candidate" && ":$PATH:" != *":$candidate:"* ]]; then
PATH="$candidate:$PATH"
fi
}
# launchd starts with a very small PATH. Keep CLI runtimes discoverable for
# Master Codex Node tasks that spawn `codex`, `node`, or Homebrew tools.
append_path_if_dir "/Applications/Codex.app/Contents/Resources"
append_path_if_dir "$HOME/Applications/Codex.app/Contents/Resources"
append_path_if_dir "/opt/homebrew/bin"
append_path_if_dir "/opt/homebrew/sbin"
append_path_if_dir "/usr/local/bin"
append_path_if_dir "$HOME/.local/bin"
append_path_if_dir "$HOME/.bun/bin"
export PATH
if [[ -z "$NODE_BIN" ]]; then
NODE_BIN="$(command -v node 2>/dev/null || true)"
fi