@bastani/atomic-acp 0.0.14 → 0.0.15

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
@@ -382,6 +382,23 @@ function parseAtomicExtraArgs(argv, env) {
382
382
  const fromArgv = separator < 0 ? [] : argv.slice(separator + 1).map((arg) => validateAtomicArg(arg, "arguments after --"));
383
383
  return [...fromEnv, ...fromArgv];
384
384
  }
385
+ var EXCLUDE_TOOLS_FLAGS = /* @__PURE__ */ new Set(["--exclude-tools", "-xt"]);
386
+ function withExcludedTool(extraArgs, tool) {
387
+ const args = [...extraArgs];
388
+ const joined = (list) => list.split(",").includes(tool) ? list : list ? `${list},${tool}` : tool;
389
+ for (let index = args.length - 1; index >= 0; index--) {
390
+ const arg = args[index];
391
+ if (arg.startsWith("--exclude-tools=")) {
392
+ args[index] = `--exclude-tools=${joined(arg.slice("--exclude-tools=".length))}`;
393
+ return args;
394
+ }
395
+ if (EXCLUDE_TOOLS_FLAGS.has(arg) && index + 1 < args.length) {
396
+ args[index + 1] = joined(args[index + 1]);
397
+ return args;
398
+ }
399
+ }
400
+ return [...args, "--exclude-tools", tool];
401
+ }
385
402
 
386
403
  // src/atomic-rpc/adapter-extension.ts
387
404
  import { randomBytes } from "crypto";
@@ -575,7 +592,7 @@ var AtomicRpcProcess = class _AtomicRpcProcess {
575
592
  ...params.headless ? { askUserQuestionUnavailable: NO_PERSON_FOR_ASK_USER_QUESTION } : {}
576
593
  });
577
594
  if (adapterExtension) args.push("-e", adapterExtension.path);
578
- args.push(...extraArgs);
595
+ args.push(...params.headless ? withExcludedTool(extraArgs, "ask_user_question") : extraArgs);
579
596
  const start = shouldUseShellForAtomicCommand(cmd) ? crossSpawn : spawn;
580
597
  let child;
581
598
  try {