apcore-cli 0.8.0 → 0.8.1

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
@@ -543,6 +543,10 @@ var init_auth = __esm({
543
543
  });
544
544
 
545
545
  // src/security/sandbox.ts
546
+ import { spawn } from "child_process";
547
+ import { mkdtempSync, rmSync } from "fs";
548
+ import { tmpdir } from "os";
549
+ import { join as join4, resolve as resolvePath } from "path";
546
550
  function buildSandboxEnv(tmpDir) {
547
551
  const env = {};
548
552
  for (const key of SANDBOX_ALLOW_KEYS) {
@@ -612,13 +616,8 @@ var init_sandbox = __esm({
612
616
  return this._sandboxedExecute(moduleId, inputData);
613
617
  }
614
618
  async _sandboxedExecute(moduleId, inputData) {
615
- const { spawn } = await import("child_process");
616
- const { tmpdir } = await import("os");
617
- const { join: join4 } = await import("path");
618
- const { mkdtempSync, rmSync } = await import("fs");
619
619
  const tmpDir = mkdtempSync(join4(tmpdir(), "apcore_sandbox_"));
620
620
  const env = buildSandboxEnv(tmpDir);
621
- const { resolve: resolvePath } = await import("path");
622
621
  if (this.extensionsRoot !== null) {
623
622
  env.APCORE_EXTENSIONS_ROOT = resolvePath(this.extensionsRoot);
624
623
  } else if (env.APCORE_EXTENSIONS_ROOT) {
@@ -4030,7 +4029,15 @@ function buildModuleCommand(moduleDef, executor, helpTextMaxLength = 1e3, cmdNam
4030
4029
  cmd.addHelpText("after", "\n" + footerParts.join("\n") + "\n");
4031
4030
  }
4032
4031
  for (const opt of schemaOptions) {
4033
- if (opt.parseArg) {
4032
+ if (opt.isBooleanFlag) {
4033
+ const flagBase = opt.name.replace(/_/g, "-");
4034
+ cmd.addOption(
4035
+ new Option4(`--${flagBase}`, opt.description).default(
4036
+ opt.defaultValue
4037
+ )
4038
+ );
4039
+ cmd.addOption(new Option4(`--no-${flagBase}`).hideHelp());
4040
+ } else if (opt.parseArg) {
4034
4041
  cmd.option(opt.flags, opt.description, opt.parseArg, opt.defaultValue);
4035
4042
  } else {
4036
4043
  cmd.option(opt.flags, opt.description, opt.defaultValue);
@@ -4054,24 +4061,12 @@ function buildModuleCommand(moduleDef, executor, helpTextMaxLength = 1e3, cmdNam
4054
4061
  );
4055
4062
  const approvalToken = options.approvalToken;
4056
4063
  const schemaKwargs = {};
4057
- const builtinKeys = /* @__PURE__ */ new Set([
4058
- "input",
4059
- "yes",
4060
- "largeInput",
4061
- "format",
4062
- "fields",
4063
- "sandbox",
4064
- "verbose",
4065
- "dryRun",
4066
- "trace",
4067
- "stream",
4068
- "strategy",
4069
- "approvalTimeout",
4070
- "approvalToken"
4071
- ]);
4072
- for (const [k, v] of Object.entries(options)) {
4073
- if (!builtinKeys.has(k)) {
4074
- schemaKwargs[k] = v;
4064
+ for (const opt of schemaOptions) {
4065
+ const commanderKey = opt.name.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
4066
+ if (commanderKey in options) {
4067
+ schemaKwargs[opt.name] = options[commanderKey];
4068
+ } else if (opt.name in options) {
4069
+ schemaKwargs[opt.name] = options[opt.name];
4075
4070
  }
4076
4071
  }
4077
4072
  let merged = {};