Open source AI coding agent. Designed for large projects and real world tasks.
Go aiai-agentsai-developer-toolsai-toolsclicommand-linedeveloper-toolsgitgolanggpt-4llmopenaipolyglot-programmingterminalterminal-basedterminal-ui
fix for provider fallback on stream error. don't increment retries on claude max quota exhaustion. claude-status command. some logging cleanup in litellm_proxy. test script updates.
Dane Schneider9cd3eb4b26af
diff --git a/README.md b/README.mdindex 33216d85..6fb5888c 100644--- a/README.md+++ b/README.md@@ -157,7 +157,7 @@ curl -sL https://plandex.ai/install.sh | bash| ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- || **Plandex Cloud (Integrated Models)** | • No separate accounts or API keys.<br/>• Easy multi-device usage.<br/>• Centralized billing, budgeting, usage tracking, and cost reporting.<br/>• Quickest way to [get started.](https://app.plandex.ai/start?modelsMode=integrated) || **Plandex Cloud (BYO API Key)** | • Use Plandex Cloud with your own [OpenRouter.ai](https://openrouter.ai) key (or [other model provider](https://docs.plandex.ai/models/model-providers) accounts and API keys).<br/>• [Get started](https://app.plandex.ai/start?modelsMode=byo) |-| **Self-hosted/Local Mode** | • Run Plandex locally with Docker or host on your own server.<br/>• Use your own [OpenRouter.ai](https://openrouter.ai) key (or [other model provider](https://docs.plandex.ai/models/model-providers) accounts and API keys).<br/>• Follow the [local-mode quickstart](./hosting/self-hosting.md) to get started. |+| **Self-hosted/Local Mode** | • Run Plandex locally with Docker or host on your own server.<br/>• Use your own [OpenRouter.ai](https://openrouter.ai) key (or [other model provider](https://docs.plandex.ai/models/model-providers) accounts and API keys).<br/>• Follow the [local-mode quickstart](https://docs.plandex.ai/hosting/self-hosting/local-mode-quickstart) to get started. |## Provider keys 🔑diff --git a/app/cli/cmd/claude_max.go b/app/cli/cmd/claude_max.goindex fd330fd2..abf7f777 100644--- a/app/cli/cmd/claude_max.go+++ b/app/cli/cmd/claude_max.go@@ -1,8 +1,12 @@package cmdimport (+ "fmt"+ "plandex-cli/auth""plandex-cli/lib"+ "plandex-cli/term"+ "github.com/fatih/color""github.com/spf13/cobra")@@ -18,15 +22,54 @@ var disconnectClaudeCmd = &cobra.Command{Run: disconnectClaude,}+var claudeStatusCmd = &cobra.Command{+ Use: "claude-status",+ Short: "Check the status of your Claude Pro or Max subscription",+ Run: claudeStatus,+}+func connectClaude(cmd *cobra.Command, args []string) {+ auth.MustResolveAuthWithOrg()lib.ConnectClaudeMax()}func disconnectClaude(cmd *cobra.Command, args []string) {+ auth.MustResolveAuthWithOrg()lib.DisconnectClaudeMax()}+func claudeStatus(cmd *cobra.Command, args []string) {+ auth.MustResolveAuthWithOrg()++ creds, err := lib.GetAccountCredentials()+ if err != nil {+ term.OutputErrorAndExit("Error getting account credentials: %v", err)+ }++ orgUserConfig := lib.MustGetOrgUserConfig()++ connected := creds.ClaudeMax != nil && orgUserConfig.UseClaudeSubscription++ if connected {+ fmt.Println("✅ Claude Pro or Max subscription is connected")++ // if orgUserConfig.IsClaudeSubscriptionCooldownActive() {+ if true {+ fmt.Println()+ color.New(term.ColorHiYellow, color.Bold).Println("⏳ You've reached your Claude Pro or Max subscription quota")+ fmt.Println("The next provider with valid credentials will be used for Anthropic models until the quota resets")+ fmt.Println()+ }++ term.PrintCmds("", "disconnect-claude")+ } else {+ fmt.Println("❌ No Claude Pro or Max subscription is connected")+ term.PrintCmds("", "connect-claude")+ }+}+func init() {RootCmd.AddCommand(connectClaudeCmd)RootCmd.AddCommand(disconnectClaudeCmd)+ RootCmd.AddCommand(claudeStatusCmd)}diff --git a/app/cli/lib/claude_max.go b/app/cli/lib/claude_max.goindex 0ccd51a0..d527c556 100644--- a/app/cli/lib/claude_max.go+++ b/app/cli/lib/claude_max.go@@ -41,7 +41,7 @@ func promptClaudeMaxIfNeeded() bool {}term.StopSpinner()- fmt.Println("ℹ️ The current model pack uses Anthropic models.\nIf you have a " + color.New(color.FgHiGreen, color.Bold).Sprint("Claude Pro or Max Subscription") + ", you can connect to it.\nPlandex will then use your Claude subscription for Anthropic model calls up to your limit.\n")+ fmt.Println("ℹ️ The current model pack uses Anthropic models.\n\nIf you have a " + color.New(color.FgHiGreen, color.Bold).Sprint("Claude Pro or Max Subscription") + ", you can connect to it.\n\nPlandex will then use your Claude subscription for Anthropic model calls up to your limit.\n")res, err := term.ConfirmYesNo("Connect your Claude subscription?")if err != nil {@@ -54,7 +54,7 @@ func promptClaudeMaxIfNeeded() bool {if !res {fmt.Println()- color.New(color.FgHiBlue).Println("To connect a Claude subscription later, run:\n" + term.ShowCmd("connect-claude"))+ fmt.Println("To connect a Claude subscription later, run:\n" + term.ShowCmd("connect-claude"))fmt.Println()return false}@@ -138,7 +138,7 @@ func ConnectClaudeMax() {fmt.Println("✅ Your Claude subscription is now connected")fmt.Println()- color.New(color.FgHiBlue).Println("To disconnect, run:\n" + term.ShowCmd("disconnect-claude"))+ fmt.Println("To disconnect, run:\n" + term.ShowCmd("disconnect-claude"))fmt.Println()}@@ -165,7 +165,7 @@ func DisconnectClaudeMax() {fmt.Println("✅ Your Claude subscription has been disconnected")fmt.Println()- color.New(color.FgHiBlue).Println("To reconnect, run:\n" + term.ShowCmd("connect-claude"))+ fmt.Println("To reconnect, run:\n" + term.ShowCmd("connect-claude"))fmt.Println()}diff --git a/app/cli/lib/model_credentials.go b/app/cli/lib/model_credentials.goindex 46bd3ccf..efd566dc 100644--- a/app/cli/lib/model_credentials.go+++ b/app/cli/lib/model_credentials.go@@ -352,6 +352,7 @@ func mergeAuthVars(dest, src map[string]string) {}func showCredentialErrorMessage(res CredentialCheckResult, opts shared.ModelProviderOptions) {+ term.StopSpinner()boldRed := color.New(color.Bold, term.ColorHiRed)cyanChip := color.New(color.BgCyan, color.FgHiWhite)fmt.Println(boldRed.Sprint("🚨 Required API key(s) or model credentials are missing"))diff --git a/app/cli/term/help.go b/app/cli/term/help.goindex a2c5c684..0d9ad28a 100644--- a/app/cli/term/help.go+++ b/app/cli/term/help.go@@ -148,6 +148,7 @@ var CliCommands = []CmdConfig{{"connect-claude", "", "connect your Claude Pro or Max subscription", true},{"disconnect-claude", "", "disconnect your Claude Pro or Max subscription", true},+ {"claude-status", "", "status of your Claude Pro or Max subscription connection", true},{"usage", "", "show Plandex Cloud current balance and usage report", true},{"usage --today", "", "show Plandex Cloud usage for the day so far", true},@@ -349,7 +350,7 @@ func PrintHelpAllCommands() {fmt.Fprintln(builder)color.New(color.Bold, color.BgCyan, color.FgHiWhite).Fprintln(builder, " Integrations ")- printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiCyan}, "connect-claude", "disconnect-claude")+ printCmds(builder, " ", []color.Attribute{color.Bold, ColorHiCyan}, "connect-claude", "disconnect-claude", "claude-status")fmt.Fprintln(builder)color.New(color.Bold, color.BgCyan, color.FgHiWhite).Fprintln(builder, " Cloud ")diff --git a/app/server/handlers/plans_exec.go b/app/server/handlers/plans_exec.goindex 8f9c6fde..c3cd7833 100644--- a/app/server/handlers/plans_exec.go+++ b/app/server/handlers/plans_exec.go@@ -107,7 +107,7 @@ func TellPlanHandler(w http.ResponseWriter, r *http.Request) {if err != nil {log.Printf("Error telling plan: %v\n", err)go notify.NotifyErr(notify.SeverityError, fmt.Errorf("error telling plan: %v", err))- http.Error(w, "Error telling plan", http.StatusInternalServerError)+ http.Error(w, "Error telling plan: "+err.Error(), http.StatusInternalServerError)return}diff --git a/app/server/litellm_proxy.py b/app/server/litellm_proxy.pyindex a1f41190..178094a9 100644--- a/app/server/litellm_proxy.py+++ b/app/server/litellm_proxy.py@@ -49,9 +49,9 @@ from litellm import completion, _turn_on_debugimport jsonimport re-_turn_on_debug()+# _turn_on_debug()-LOGGING_ENABLED = True+LOGGING_ENABLED = Falseprint("Litellm proxy: starting proxy server on port 4000...")diff --git a/app/server/model/client_stream.go b/app/server/model/client_stream.goindex c6575658..6d4134eb 100644--- a/app/server/model/client_stream.go+++ b/app/server/model/client_stream.go@@ -330,9 +330,11 @@ func withStreamingRetries[T any](log.Printf("withStreamingRetries - retrying stream in %v seconds", retryDelay)time.Sleep(retryDelay)- numTotalRetry++- if isFallback && !newFallback {- numFallbackRetry+++ if modelErr != nil && modelErr.ShouldIncrementRetry() {+ numTotalRetry+++ if isFallback && !newFallback {+ numFallbackRetry+++ }}}}diff --git a/app/server/model/model_error.go b/app/server/model/model_error.goindex a3e212f3..3ad4c299 100644--- a/app/server/model/model_error.go+++ b/app/server/model/model_error.go@@ -95,13 +95,13 @@ func ClassifyModelError(code int, message string, headers http.Header, isClaudeMretryAfter := extractRetryAfter(headers, msg)if retryAfter > 0 {return shared.ModelError{- Kind: shared.ErrRateLimited,+ Kind: shared.ErrSubscriptionQuotaExhausted,Retriable: true,RetryAfterSeconds: retryAfter,}}return shared.ModelError{- Kind: shared.ErrRateLimited,+ Kind: shared.ErrSubscriptionQuotaExhausted,Retriable: false,RetryAfterSeconds: 0,}diff --git a/app/server/model/plan/tell_stream_error.go b/app/server/model/plan/tell_stream_error.goindex 9a2f8974..64e601b2 100644--- a/app/server/model/plan/tell_stream_error.go+++ b/app/server/model/plan/tell_stream_error.go@@ -54,11 +54,10 @@ func (state *activeTellStreamState) onError(params onErrorParams) onErrorResult}canRetry := params.canRetry- hasFallback := state.fallbackRes.HasErrorFallbackisFallback := state.fallbackRes.IsFallbackmaxRetries := model.MAX_RETRIES_WITHOUT_FALLBACK- if hasFallback {+ if isFallback {maxRetries = model.MAX_ADDITIONAL_RETRIES_WITH_FALLBACK}@@ -67,18 +66,20 @@ func (state *activeTellStreamState) onError(params onErrorParams) onErrorResultcompareRetries = state.numFallbackRetry}+ potentialFallback := state.modelConfig.GetFallbackForModelError(+ state.numErrorRetry,+ state.didProviderFallback,+ modelErr,+ state.authVars,+ state.settings,+ state.orgUserConfig,+ )+newFallback := falseif modelErr != nil {if !modelErr.Retriable {log.Printf("tellStream onError - operation returned non-retriable error: %v", modelErr)- if modelErr.Kind == shared.ErrContextTooLong && state.fallbackRes.ModelRoleConfig.LargeContextFallback == nil {- log.Printf("tellStream onError - non-retriable context too long error and no large context fallback is defined, no retry")- // if it's a context too long error and no large context fallback is defined, no retry- canRetry = false-- } else if modelErr.Kind != shared.ErrContextTooLong && state.fallbackRes.ModelRoleConfig.ErrorFallback == nil {- log.Printf("tellStream onError - non-retriable error and no error fallback is defined, no retry")- // if it's any other error and no error fallback is defined, no retry+ if !potentialFallback.IsFallback {canRetry = false} else {log.Printf("tellStream onError - operation returned non-retriable error, but has fallback - resetting numFallbackRetry to 0 and continuing to retry")@@ -116,19 +117,18 @@ func (state *activeTellStreamState) onError(params onErrorParams) onErrorResultretryDelay = time.Duration(1000+rand.Intn(200)) * time.Millisecond}- cacheSupportErr := false+ cacheSupportErr := modelErr != nil && modelErr.Kind == shared.ErrCacheSupport+numErrorRetry := state.numErrorRetry- if !(modelErr != nil && modelErr.Kind == shared.ErrCacheSupport) {+ if modelErr != nil && modelErr.ShouldIncrementRetry() {numErrorRetry = numErrorRetry + 1- } else {- cacheSupportErr = true}log.Printf("tellStream onError - Retry %d/%d - Retrying stream in %v", numErrorRetry, maxRetries, retryDelay)time.Sleep(retryDelay)state.numErrorRetry = numErrorRetry- if isFallback && !newFallback && !cacheSupportErr {+ if isFallback && !newFallback && modelErr != nil && modelErr.ShouldIncrementRetry() {state.numFallbackRetry = state.numFallbackRetry + 1}diff --git a/app/shared/ai_models_errors.go b/app/shared/ai_models_errors.goindex d157b0af..b866f0db 100644--- a/app/shared/ai_models_errors.go+++ b/app/shared/ai_models_errors.go@@ -10,11 +10,12 @@ import (type ModelErrKind stringconst (- ErrOverloaded ModelErrKind = "ErrOverloaded"- ErrContextTooLong ModelErrKind = "ErrContextTooLong"- ErrRateLimited ModelErrKind = "ErrRateLimited"- ErrOther ModelErrKind = "ErrOther"- ErrCacheSupport ModelErrKind = "ErrCacheSupport"+ ErrOverloaded ModelErrKind = "ErrOverloaded"+ ErrContextTooLong ModelErrKind = "ErrContextTooLong"+ ErrRateLimited ModelErrKind = "ErrRateLimited"+ ErrSubscriptionQuotaExhausted ModelErrKind = "ErrSubscriptionQuotaExhausted"+ ErrOther ModelErrKind = "ErrOther"+ ErrCacheSupport ModelErrKind = "ErrCacheSupport")type ModelError struct {@@ -23,6 +24,10 @@ type ModelError struct {RetryAfterSeconds int}+func (m ModelError) ShouldIncrementRetry() bool {+ return m.Kind != ErrSubscriptionQuotaExhausted && m.Kind != ErrCacheSupport+}+// if fallback is defined, retry with main model, then remaining tries use error fallbacktype FallbackType string@@ -33,11 +38,10 @@ const ()type FallbackResult struct {- ModelRoleConfig *ModelRoleConfig- HasErrorFallback bool- IsFallback bool- FallbackType FallbackType- BaseModelConfig *BaseModelConfig+ ModelRoleConfig *ModelRoleConfig+ IsFallback bool+ FallbackType FallbackType+ BaseModelConfig *BaseModelConfig}const MAX_RETRIES_BEFORE_FALLBACK = 1diff --git a/app/shared/ai_models_providers.go b/app/shared/ai_models_providers.goindex 6e543abb..358beee0 100644--- a/app/shared/ai_models_providers.go+++ b/app/shared/ai_models_providers.go@@ -40,7 +40,7 @@ const (ModelProviderOpenAI ModelProvider = "openai"ModelProviderAnthropic ModelProvider = "anthropic"- ModelProviderAnthropicClaudeMax ModelProvider = "anthropic-claude-max"+ ModelProviderAnthropicClaudeMax ModelProvider = "anthropic-pro"ModelProviderGoogleAIStudio ModelProvider = "google-ai-studio"ModelProviderGoogleVertex ModelProvider = "google-vertex"ModelProviderAzureOpenAI ModelProvider = "azure-openai"@@ -266,6 +266,9 @@ func GetProvidersForAuthVars(authVars map[string]string, settings *PlanSettings,checkVars = append(checkVars, extraAuthVar.Var)}}+ if providerConfig.HasClaudeMaxAuth {+ checkVars = append(checkVars, AnthropicClaudeMaxTokenEnvVar)+ }missingAny := falsefor _, checkVar := range checkVars {diff --git a/docs/docs/cli-reference.md b/docs/docs/cli-reference.mdindex cc6d8cb2..ba1bde67 100644--- a/docs/docs/cli-reference.md+++ b/docs/docs/cli-reference.md@@ -867,6 +867,14 @@ plandex disconnect-claudeDisconnect your Claude Pro or Max subscription and clear credentials from your device.+### claude-status++```bash+plandex claude-status+```++Shows whether a Claude Pro or Max subscription is connected, and whether the quota has been exceeded.+## Plandex Cloud### billingdiff --git a/docs/docs/models/claude-subscription.md b/docs/docs/models/claude-subscription.mdindex 14c680a9..f46ce896 100644--- a/docs/docs/models/claude-subscription.md+++ b/docs/docs/models/claude-subscription.md@@ -31,6 +31,17 @@ plandex disconnect-claude # CLI\disconnect-claude # REPL```+### `claude-status`++You can check whether a subscription is connected with `claude-status`++```bash+plandex claude-status # CLI+\claude-status # REPL+```++This command will also tell you if the subscription's quota has been exceeded and a backup provider is being used instead.+## Quota ExhaustionIf you're using Plandex Cloud with Integrated Models Mode, Anthropic model calls will use your Claude subscription until it runs out of quota, then switch to using Plandex credits until the quota resets.diff --git a/releases/cli/versions/2.2.1.md b/releases/cli/versions/2.2.1.mdnew file mode 100644index 00000000..0108e15a--- /dev/null+++ b/releases/cli/versions/2.2.1.md@@ -0,0 +1,11 @@+## 🖇️ Connect your Claude Pro or Max subscription++If you have a Claude Pro or Max subscription, Plandex can use it when calling Anthropic models. You can use it in either Integrated Models Mode on Plandex Cloud, or in BYO Key Mode (whether on Cloud or self-hosting).++Assuming you're using Anthropic models (which the default model pack does), you'll be asked if you want to connect your Claude subscription the first time you run Plandex. Follow the instructions to connect.++[Learn more in the docs.](https://docs.plandex.ai/models/claude-subscription)++## 🐞 Bug fixes++Fixed an [issue](https://github.com/plandex-ai/plandex/issues/291) with custom models and providers.\ No newline at end of filediff --git a/releases/server/versions/2.2.1.md b/releases/server/versions/2.2.1.mdnew file mode 100644index 00000000..39cf7900--- /dev/null+++ b/releases/server/versions/2.2.1.md@@ -0,0 +1 @@+See CLI 2.2.1 release notes.\ No newline at end of filediff --git a/test/smoke_test.sh b/test/smoke_test.shindex 48eea6a2..432ae961 100755--- a/test/smoke_test.sh+++ b/test/smoke_test.sh@@ -47,10 +47,10 @@ main() {run_plandex_cmd "new -n smoke-test-plan" "Create named plan"# Check current plan- run_plandex_cmd_output "current"+ run_plandex_cmd "current"# List plans- run_plandex_cmd_output "plans"+ run_plandex_cmd "plans"# 2. CONTEXT MANAGEMENTlog "\n=== Testing Context Management ==="@@ -65,10 +65,10 @@ main() {run_plandex_cmd "load . --tree" "Load directory tree"# List context- run_plandex_cmd_output "ls"+ run_plandex_cmd "ls"# Show specific context- run_plandex_cmd_output "show main.go"+ run_plandex_cmd "show main.go"# 3. BASIC TASK EXECUTIONlog "\n=== Testing Task Execution ==="@@ -80,7 +80,7 @@ main() {run_plandex_cmd "tell '$PROMPT_CREATE_FUNCTION'" "Execute tell command"# Check diff- run_plandex_cmd_output "diff --git"+ run_plandex_cmd "diff --git"# Apply changesrun_plandex_cmd "apply --auto-exec --debug 2 --skip-commit" "Apply changes"@@ -92,7 +92,7 @@ main() {log "\n=== Testing Chat ==="# Chat without making changes- run_plandex_cmd_output "chat '$PROMPT_CHAT_QUESTION'"+ run_plandex_cmd "chat '$PROMPT_CHAT_QUESTION'"# 5. CONTINUE AND BUILDlog "\n=== Testing Continue and Build ==="@@ -104,7 +104,7 @@ main() {run_plandex_cmd "build" "Build pending changes"# Review and apply- run_plandex_cmd_output "diff --git"+ run_plandex_cmd "diff --git"run_plandex_cmd "apply --auto-exec --debug 2 --skip-commit" "Apply test changes"# 6. BRANCHES@@ -118,7 +118,7 @@ main() {run_plandex_cmd "apply --auto-exec --debug 2 --skip-commit" "Apply on branch"# List branches- run_plandex_cmd_output "branches"+ run_plandex_cmd "branches"# Switch back to mainrun_plandex_cmd "checkout main" "Switch to main branch"@@ -127,10 +127,10 @@ main() {log "\n=== Testing Version Control ==="# View log- run_plandex_cmd_output "log"+ run_plandex_cmd "log"# View conversation- run_plandex_cmd_output "convo"+ run_plandex_cmd "convo"# Get current state for rewind testREWIND_STEPS=2@@ -143,7 +143,7 @@ main() {log "\n=== Testing Configuration ==="# View current config- run_plandex_cmd_output "config"+ run_plandex_cmd "config"# Change a settingrun_plandex_cmd "set-config auto-continue false" "Set auto-continue to false"@@ -152,10 +152,10 @@ main() {run_plandex_cmd "set-config auto-continue true" "Set auto-continue to true"# View models- run_plandex_cmd_output "models"+ run_plandex_cmd "models"# List model packs- run_plandex_cmd_output "model-packs"+ run_plandex_cmd "model-packs"# 9. CONTEXT UPDATESlog "\n=== Testing Context Updates ==="@@ -189,7 +189,7 @@ main() {run_plandex_cmd "archive smoke-test-plan" "Archive plan"# List archived plans- run_plandex_cmd_output "plans --archived"+ run_plandex_cmd "plans --archived"# Unarchiverun_plandex_cmd "unarchive smoke-test-plan" "Unarchive plan"@@ -202,7 +202,7 @@ main() {# Switch between plansrun_plandex_cmd "cd smoke-test-plan" "Switch to first plan"- run_plandex_cmd_output "current"+ run_plandex_cmd "current"log "\n=== Plandex Smoke Test Completed Successfully at $(date) ==="}diff --git a/test/test_utils.sh b/test/test_utils.shindex 75b53379..23a1b8e1 100755--- a/test/test_utils.sh+++ b/test/test_utils.sh@@ -14,11 +14,7 @@ export PLANDEX_CMD="${PLANDEX_CMD:-plandex-dev}"# Logging functionslog() {- if [ -f "$LOG_FILE" ]; then- echo -e "$1" | tee -a "$LOG_FILE"- else- echo -e "$1"- fi+ echo -e "$1"}success() {@@ -48,7 +44,7 @@ run_cmd() {set -e # Re-enable exit on error# Log the output- echo "$output" | tee -a "$LOG_FILE"+ echo "$output"if [ "$exit_code" -eq 0 ]; thensuccess "$description"@@ -73,7 +69,7 @@ check_plandex_contains() {info "Running: $PLANDEX_CMD $cmd"local output=$($PLANDEX_CMD $cmd 2>&1)- echo "$output" | tee -a "$LOG_FILE"+ echo "$output"if echo "$output" | grep -q "$expected"; thensuccess "$description"@@ -95,7 +91,7 @@ expect_failure() {local exit_code=$?set -e # Re-enable exit on error- echo "$output" | tee -a "$LOG_FILE"+ echo "$output"if [ "$exit_code" -ne 0 ]; thensuccess "$description (failed as expected with exit code $exit_code)"@@ -127,12 +123,10 @@ setup_test_dir() {local test_name="$1"TEST_DIR="/tmp/plandex-${test_name}-$$"TIMESTAMP=$(date +%Y%m%d_%H%M%S)- LOG_FILE="${TEST_DIR}/${test_name}-${TIMESTAMP}.log"info "Setting up test environment in $TEST_DIR"mkdir -p "$TEST_DIR"cd "$TEST_DIR"- touch "$LOG_FILE"success "Test environment created"}