Files
yuqei 124a18a4ec
Deploy VitePress Docs / build (push) Has been cancelled
Deploy VitePress Docs / deploy (push) Has been cancelled
Initialize cc-haha project mirror.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 13:41:51 +08:00

31 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
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="${CALLER_DIR:-$(pwd -W 2>/dev/null || pwd)}"
cd "$ROOT_DIR"
# When spawned by the desktop/web server as a child CLI process,
# skip .env loading — the server has already set the correct env
# via cc-haha/settings.json. Loading .env would re-inject stale
# provider keys (e.g., a MiniMax key as ANTHROPIC_API_KEY) that
# override the active provider config.
if [[ "${CC_HAHA_SKIP_DOTENV:-0}" == "1" ]]; then
# Bun auto-loads .env by default; explicitly point to /dev/null to suppress.
ENV_FILE_FLAG="--env-file=/dev/null"
elif [[ -f .env ]]; then
ENV_FILE_FLAG="--env-file=.env"
else
ENV_FILE_FLAG=""
fi
# Force recovery CLI (simple readline REPL, no Ink TUI)
if [[ "${CLAUDE_CODE_FORCE_RECOVERY_CLI:-0}" == "1" ]]; then
exec bun $ENV_FILE_FLAG ./src/localRecoveryCli.ts "$@"
fi
# Default: full CLI with Ink TUI
exec bun $ENV_FILE_FLAG ./src/entrypoints/cli.tsx "$@"