krenk 0.1.17 → 0.1.18

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/dist/index.js CHANGED
@@ -156,6 +156,7 @@ ${content}
156
156
  };
157
157
 
158
158
  // src/agents/spawner.ts
159
+ import crossSpawn from "cross-spawn";
159
160
  import { spawn } from "child_process";
160
161
  import { EventEmitter } from "events";
161
162
  var isWindows = process.platform === "win32";
@@ -225,7 +226,9 @@ function spawnClaudeAgent(opts) {
225
226
 
226
227
  Your current task:
227
228
  ${opts.prompt}` : opts.prompt;
228
- const flagArgs = [
229
+ const args = [
230
+ "-p",
231
+ fullPrompt,
229
232
  "--output-format",
230
233
  "stream-json",
231
234
  "--max-turns",
@@ -234,32 +237,25 @@ ${opts.prompt}` : opts.prompt;
234
237
  "--dangerously-skip-permissions"
235
238
  ];
236
239
  if (opts.model) {
237
- flagArgs.push("--model", opts.model);
240
+ args.push("--model", opts.model);
238
241
  }
239
242
  if (opts.systemPrompt) {
240
- flagArgs.push("--system-prompt", opts.systemPrompt);
243
+ args.push("--system-prompt", opts.systemPrompt);
241
244
  }
242
245
  if (opts.allowedTools?.length) {
243
- flagArgs.push("--allowedTools", ...opts.allowedTools);
246
+ args.push("--allowedTools", ...opts.allowedTools);
244
247
  }
245
248
  if (opts.disallowedTools?.length) {
246
- flagArgs.push("--disallowedTools", ...opts.disallowedTools);
249
+ args.push("--disallowedTools", ...opts.disallowedTools);
247
250
  }
248
251
  const startTime = Date.now();
249
- const child = isWindows ? spawn(process.env.ComSpec || "cmd.exe", ["/c", "claude", "-p", ...flagArgs], {
250
- env,
251
- cwd: opts.cwd,
252
- stdio: ["pipe", "pipe", "pipe"]
253
- }) : spawn("claude", ["-p", fullPrompt, ...flagArgs], {
252
+ const child = crossSpawn("claude", args, {
254
253
  env,
255
254
  cwd: opts.cwd,
256
255
  stdio: ["ignore", "pipe", "pipe"],
257
- detached: true
256
+ // Unix: detached for process group kills
257
+ ...isWindows ? {} : { detached: true }
258
258
  });
259
- if (isWindows && child.stdin) {
260
- child.stdin.write(fullPrompt);
261
- child.stdin.end();
262
- }
263
259
  emitter.child = child;
264
260
  activeChildren.add(child);
265
261
  let stdout = "";
@@ -3609,6 +3605,7 @@ import chalk11 from "chalk";
3609
3605
 
3610
3606
  // src/ui/interactive.ts
3611
3607
  import * as readline from "readline";
3608
+ import crossSpawn2 from "cross-spawn";
3612
3609
  import { spawn as spawnProcess2 } from "child_process";
3613
3610
  import chalk10 from "chalk";
3614
3611
  import gradient2 from "gradient-string";
@@ -3909,27 +3906,20 @@ Rules:
3909
3906
  spinner.text = phases[phaseIdx];
3910
3907
  }
3911
3908
  }, 3e3);
3912
- const flagArgs = [
3909
+ const child = crossSpawn2("claude", [
3910
+ "-p",
3911
+ refinementPrompt,
3913
3912
  "--output-format",
3914
3913
  "stream-json",
3915
3914
  "--verbose",
3916
3915
  "--max-turns",
3917
3916
  "1",
3918
3917
  "--dangerously-skip-permissions"
3919
- ];
3920
- const child = isWindows3 ? spawnProcess2(process.env.ComSpec || "cmd.exe", ["/c", "claude", "-p", ...flagArgs], {
3921
- env,
3922
- cwd: process.cwd(),
3923
- stdio: ["pipe", "pipe", "pipe"]
3924
- }) : spawnProcess2("claude", ["-p", refinementPrompt, ...flagArgs], {
3918
+ ], {
3925
3919
  env,
3926
3920
  cwd: process.cwd(),
3927
3921
  stdio: ["ignore", "pipe", "pipe"]
3928
3922
  });
3929
- if (isWindows3 && child.stdin) {
3930
- child.stdin.write(refinementPrompt);
3931
- child.stdin.end();
3932
- }
3933
3923
  let stdout = "";
3934
3924
  let stderr = "";
3935
3925
  let lineBuffer = "";