From cf51a3afc223fee1c5a81aa8a1f00df9b45bd380 Mon Sep 17 00:00:00 2001 From: Serhiiiiko <2021elit0049@ms.sumdu.edu.ua> Date: Fri, 6 Mar 2026 14:57:44 +0200 Subject: [PATCH] Add `CLAUDECODE` handling in environment variable parsing and bump version to 1.0.2 --- ClaudeCodeSharpSDK/Execution/ClaudeExec.cs | 5 ++++- Directory.Build.props | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ClaudeCodeSharpSDK/Execution/ClaudeExec.cs b/ClaudeCodeSharpSDK/Execution/ClaudeExec.cs index 38d202b..a37e0ff 100644 --- a/ClaudeCodeSharpSDK/Execution/ClaudeExec.cs +++ b/ClaudeCodeSharpSDK/Execution/ClaudeExec.cs @@ -57,6 +57,7 @@ public sealed class ClaudeExec private const string AnthropicApiKeyEnv = "ANTHROPIC_API_KEY"; private const string AnthropicBaseUrlEnv = "ANTHROPIC_BASE_URL"; + private const string ClaudeCodeNestingEnv = "CLAUDECODE"; private const string ContinueAndResumeConflictMessage = "ContinueMostRecent and ResumeSessionId cannot both be set."; private const string FlagAssignmentSeparator = "="; private const string ReplayUserMessagesUnsupportedMessage = @@ -303,7 +304,9 @@ internal IReadOnlyDictionary BuildEnvironment(string? baseUrl, s foreach (DictionaryEntry variable in Environment.GetEnvironmentVariables()) { - if (variable.Key is string key && variable.Value is string value) + if (variable.Key is string key + && variable.Value is string value + && !string.Equals(key, ClaudeCodeNestingEnv, StringComparison.OrdinalIgnoreCase)) { environment[key] = value; } diff --git a/Directory.Build.props b/Directory.Build.props index 85ab563..be4ba23 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -13,7 +13,7 @@ true latest-recommended true - 1.0.1 + 1.0.2 $(Version)