refactor(worker): switch MCP config to env-var token expansion
BuildMcpConfigJson drops the token argument; the literal
\${CLAUDEDO_PLANNING_TOKEN} placeholder is written to mcp.json so
claude expands it from the spawned process environment at load time.
Also declares SettingsLocalJson constant for use in later tasks.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -86,7 +86,7 @@ public sealed class PlanningSessionManager
|
|||||||
Path.Combine(sessionDir, "system-prompt.md"),
|
Path.Combine(sessionDir, "system-prompt.md"),
|
||||||
Path.Combine(sessionDir, "initial-prompt.txt"));
|
Path.Combine(sessionDir, "initial-prompt.txt"));
|
||||||
|
|
||||||
await File.WriteAllTextAsync(files.McpConfigPath, BuildMcpConfigJson(token), ct);
|
await File.WriteAllTextAsync(files.McpConfigPath, BuildMcpConfigJson(), ct);
|
||||||
await File.WriteAllTextAsync(files.SystemPromptPath, BuildSystemPrompt(), ct);
|
await File.WriteAllTextAsync(files.SystemPromptPath, BuildSystemPrompt(), ct);
|
||||||
await File.WriteAllTextAsync(files.InitialPromptPath, BuildInitialPrompt(task), ct);
|
await File.WriteAllTextAsync(files.InitialPromptPath, BuildInitialPrompt(task), ct);
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ public sealed class PlanningSessionManager
|
|||||||
.TrimEnd('=');
|
.TrimEnd('=');
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string BuildMcpConfigJson(string token)
|
private static string BuildMcpConfigJson()
|
||||||
{
|
{
|
||||||
var payload = new
|
var payload = new
|
||||||
{
|
{
|
||||||
@@ -169,7 +169,7 @@ public sealed class PlanningSessionManager
|
|||||||
url = McpServerUrl,
|
url = McpServerUrl,
|
||||||
headers = new Dictionary<string, string>
|
headers = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
["Authorization"] = $"Bearer {token}"
|
["Authorization"] = "Bearer ${CLAUDEDO_PLANNING_TOKEN}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,6 +177,12 @@ public sealed class PlanningSessionManager
|
|||||||
return JsonSerializer.Serialize(payload, new JsonSerializerOptions { WriteIndented = true });
|
return JsonSerializer.Serialize(payload, new JsonSerializerOptions { WriteIndented = true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const string SettingsLocalJson = """
|
||||||
|
{
|
||||||
|
"enableAllProjectMcpServers": true
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
|
||||||
private static string BuildSystemPrompt() =>
|
private static string BuildSystemPrompt() =>
|
||||||
"""
|
"""
|
||||||
You are a planning assistant for ClaudeDo.
|
You are a planning assistant for ClaudeDo.
|
||||||
|
|||||||
Reference in New Issue
Block a user