skalpel 2.0.19 → 2.0.20

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/cli/index.js CHANGED
@@ -1721,6 +1721,7 @@ function unconfigureAgent(agent) {
1721
1721
  import fs10 from "fs";
1722
1722
  import path11 from "path";
1723
1723
  import os8 from "os";
1724
+ import crypto from "crypto";
1724
1725
  var BEGIN_MARKER = "# BEGIN SKALPEL PROXY - do not edit manually";
1725
1726
  var END_MARKER = "# END SKALPEL PROXY";
1726
1727
  var PS_BEGIN_MARKER = "# BEGIN SKALPEL PROXY - do not edit manually";
@@ -1745,11 +1746,18 @@ function getPowerShellProfilePath() {
1745
1746
  if (fs10.existsSync(wpProfile)) return wpProfile;
1746
1747
  return psProfile;
1747
1748
  }
1749
+ function randomPlaceholder() {
1750
+ return `sk-codex-skalpel-${crypto.randomBytes(8).toString("hex")}`;
1751
+ }
1748
1752
  function generateUnixBlock(proxyConfig) {
1749
1753
  return [
1750
1754
  BEGIN_MARKER,
1751
1755
  `export ANTHROPIC_BASE_URL="http://localhost:${proxyConfig.anthropicPort}"`,
1752
1756
  `export OPENAI_BASE_URL="http://localhost:${proxyConfig.openaiPort}"`,
1757
+ // `:-` only evaluates the default when OPENAI_API_KEY is unset or empty,
1758
+ // so a user-provided key always wins. Bash, zsh, and POSIX sh all
1759
+ // support this syntax.
1760
+ `export OPENAI_API_KEY="\${OPENAI_API_KEY:-${randomPlaceholder()}}"`,
1753
1761
  END_MARKER
1754
1762
  ].join("\n");
1755
1763
  }
@@ -1758,6 +1766,9 @@ function generatePowerShellBlock(proxyConfig) {
1758
1766
  PS_BEGIN_MARKER,
1759
1767
  `$env:ANTHROPIC_BASE_URL = "http://localhost:${proxyConfig.anthropicPort}"`,
1760
1768
  `$env:OPENAI_BASE_URL = "http://localhost:${proxyConfig.openaiPort}"`,
1769
+ // Conditional assignment — only set when the user hasn't already
1770
+ // exported OPENAI_API_KEY in their session or parent profile.
1771
+ `if (-not $env:OPENAI_API_KEY) { $env:OPENAI_API_KEY = "${randomPlaceholder()}" }`,
1761
1772
  PS_END_MARKER
1762
1773
  ].join("\n");
1763
1774
  }
@@ -2326,12 +2337,10 @@ async function runWizard(options) {
2326
2337
  print11("");
2327
2338
  const codexConfigured = agentsToConfigure.some((a) => a.name === "codex");
2328
2339
  if (codexConfigured) {
2329
- print11(" [!] Codex auth: recommended -> run 'codex login' first to enable ChatGPT plan billing.");
2330
- print11(" The OPENAI_API_KEY env var (placeholder OK) is still required for Codex startup");
2331
- print11(" but is ignored by Skalpel when OAuth is present.");
2332
- if (!process.env.OPENAI_API_KEY) {
2333
- print11(" example: export OPENAI_API_KEY=sk-codex-placeholder-skalpel");
2334
- }
2340
+ print11(" [!] Codex auth: recommended -> run 'codex login' to enable ChatGPT plan billing.");
2341
+ print11(" Without OAuth, Skalpel uses the OPENAI_API_KEY env var; if not already set,");
2342
+ print11(" Skalpel exports a placeholder so Codex starts. A real sk-... key is only");
2343
+ print11(" needed if you have no ChatGPT plan and want pay-as-you-go API billing.");
2335
2344
  print11("");
2336
2345
  }
2337
2346
  }