karajan-code 1.9.4 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karajan-code",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "Local multi-agent coding orchestrator with TDD, SonarQube, and code review pipeline",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0",
@@ -70,6 +70,19 @@ function createStreamJsonFilter(onOutput) {
70
70
  };
71
71
  }
72
72
 
73
+ /**
74
+ * Build a clean environment for Claude subprocess.
75
+ * Claude Code 2.x sets CLAUDECODE=1 to detect nesting. When Karajan's MCP
76
+ * server runs inside Claude Code and spawns `claude -p`, the child inherits
77
+ * this variable and refuses to start. Stripping it allows the subprocess to
78
+ * run normally — it is a separate, non-interactive invocation, not a true
79
+ * nested session.
80
+ */
81
+ function cleanEnv() {
82
+ const { CLAUDECODE, ...rest } = process.env;
83
+ return rest;
84
+ }
85
+
73
86
  export class ClaudeAgent extends BaseAgent {
74
87
  async runTask(task) {
75
88
  const role = task.role || "coder";
@@ -77,11 +90,14 @@ export class ClaudeAgent extends BaseAgent {
77
90
  const model = this.getRoleModel(role);
78
91
  if (model) args.push("--model", model);
79
92
 
93
+ const env = cleanEnv();
94
+
80
95
  // Use stream-json when onOutput is provided to get real-time feedback
81
96
  if (task.onOutput) {
82
97
  args.push("--output-format", "stream-json");
83
98
  const streamFilter = createStreamJsonFilter(task.onOutput);
84
99
  const res = await runCommand(resolveBin("claude"), args, {
100
+ env,
85
101
  onOutput: streamFilter,
86
102
  silenceTimeoutMs: task.silenceTimeoutMs,
87
103
  timeout: task.timeoutMs
@@ -90,7 +106,7 @@ export class ClaudeAgent extends BaseAgent {
90
106
  return { ok: res.exitCode === 0, output, error: res.stderr, exitCode: res.exitCode };
91
107
  }
92
108
 
93
- const res = await runCommand(resolveBin("claude"), args);
109
+ const res = await runCommand(resolveBin("claude"), args, { env });
94
110
  return { ok: res.exitCode === 0, output: res.stdout, error: res.stderr, exitCode: res.exitCode };
95
111
  }
96
112
 
@@ -99,6 +115,7 @@ export class ClaudeAgent extends BaseAgent {
99
115
  const model = this.getRoleModel(task.role || "reviewer");
100
116
  if (model) args.push("--model", model);
101
117
  const res = await runCommand(resolveBin("claude"), args, {
118
+ env: cleanEnv(),
102
119
  onOutput: task.onOutput,
103
120
  silenceTimeoutMs: task.silenceTimeoutMs,
104
121
  timeout: task.timeoutMs