poe-code 4.0.28 → 4.0.29

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": "poe-code",
3
- "version": "4.0.28",
3
+ "version": "4.0.29",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -136,7 +136,9 @@ export async function exchangeOAuthCode(options) {
136
136
  if (apiKey === undefined || apiKey.length === 0) {
137
137
  throw new Error("Token response missing api_key field");
138
138
  }
139
- if (apiKeyExpiresIn !== undefined && !isValidExpiresIn(apiKeyExpiresIn)) {
139
+ if (apiKeyExpiresIn !== undefined &&
140
+ apiKeyExpiresIn !== null &&
141
+ !isValidExpiresIn(apiKeyExpiresIn)) {
140
142
  throw new Error("Token response invalid api_key_expires_in field");
141
143
  }
142
144
  return {
@@ -6314,10 +6314,14 @@ function validateOutputFormats(formats) {
6314
6314
  );
6315
6315
  }
6316
6316
  if (BUILT_IN_OUTPUT_FORMATS.includes(name)) {
6317
- throw new ToolcraftBugError(`Custom output format "${name}" conflicts with a built-in format.`);
6317
+ throw new ToolcraftBugError(
6318
+ `Custom output format "${name}" conflicts with a built-in format.`
6319
+ );
6318
6320
  }
6319
6321
  if (typeof renderer !== "function") {
6320
- throw new ToolcraftBugError(`Custom output format "${name}" must define a renderer function.`);
6322
+ throw new ToolcraftBugError(
6323
+ `Custom output format "${name}" must define a renderer function.`
6324
+ );
6321
6325
  }
6322
6326
  }
6323
6327
  }
@@ -7149,10 +7153,8 @@ ${formatHelpOptionList(optionRows)}`);
7149
7153
  }
7150
7154
  const secretRows = formatSecretRows(command.secrets);
7151
7155
  if (secretRows.length > 0) {
7152
- sections.push(
7153
- `${text.section("Secrets (environment):")}
7154
- ${formatHelpOptionList(secretRows)}`
7155
- );
7156
+ sections.push(`${text.section("Secrets (environment):")}
7157
+ ${formatHelpOptionList(secretRows)}`);
7156
7158
  }
7157
7159
  if (command.examples.length > 0) {
7158
7160
  sections.push(
@@ -8232,8 +8234,7 @@ function renderCliErrorPattern(pattern, outputEmitter) {
8232
8234
  if (pattern.kind === "definition") {
8233
8235
  logger2.error(
8234
8236
  `Command definition error: ${pattern.error.message}
8235
- This is a bug in the generated command definition, not in your command arguments.
8236
- Run with --debug for a stack trace.`
8237
+ This is a bug in the generated command definition, not in your command arguments.` + (pattern.debugControlEnabled ? "\nRun with --debug for a stack trace." : "")
8237
8238
  );
8238
8239
  if (pattern.debugStackMode !== void 0 && pattern.error.stack) {
8239
8240
  process.stderr.write(`${formatDebugStack(pattern.error.stack, pattern.debugStackMode)}
@@ -8245,7 +8246,7 @@ Run with --debug for a stack trace.`
8245
8246
  if (pattern.kind === "toolcraft-bug") {
8246
8247
  logger2.error(
8247
8248
  `toolcraft hit an internal invariant: ${pattern.error.message}
8248
- This is a bug in toolcraft or in the command definition; it cannot be worked around by changing argv. Re-run with --debug for a stack trace and file an issue.`
8249
+ This is a bug in toolcraft or in the command definition; it cannot be worked around by changing argv.` + (pattern.debugControlEnabled ? ` Re-run with --debug for a stack trace and file an issue.` : " File an issue.")
8249
8250
  );
8250
8251
  if (pattern.debugStackMode !== void 0 && pattern.error.stack) {
8251
8252
  process.stderr.write(`${formatDebugStack(pattern.error.stack, pattern.debugStackMode)}
@@ -8255,7 +8256,7 @@ This is a bug in toolcraft or in the command definition; it cannot be worked aro
8255
8256
  return;
8256
8257
  }
8257
8258
  logger2.error(
8258
- pattern.debugStackMode !== void 0 ? pattern.message : `${pattern.message} Use --debug for a stack trace.`
8259
+ pattern.debugStackMode !== void 0 || !pattern.debugControlEnabled ? pattern.message : `${pattern.message} Use --debug for a stack trace.`
8259
8260
  );
8260
8261
  if (pattern.debugStackMode !== void 0 && pattern.stack !== void 0) {
8261
8262
  process.stderr.write(`${formatDebugStack(pattern.stack, pattern.debugStackMode)}
@@ -9344,6 +9345,7 @@ async function handleRunError(error3, options) {
9344
9345
  options.userErrorPattern === "definition" ? {
9345
9346
  kind: "definition",
9346
9347
  error: error3,
9348
+ debugControlEnabled: options.debugControlEnabled,
9347
9349
  debugStackMode: options.debugStackMode
9348
9350
  } : options.userErrorPattern === "usage" ? {
9349
9351
  kind: "usage",
@@ -9363,6 +9365,7 @@ async function handleRunError(error3, options) {
9363
9365
  {
9364
9366
  kind: "toolcraft-bug",
9365
9367
  error: error3,
9368
+ debugControlEnabled: options.debugControlEnabled,
9366
9369
  debugStackMode: options.debugStackMode
9367
9370
  },
9368
9371
  options.outputEmitter
@@ -9415,6 +9418,7 @@ async function handleRunError(error3, options) {
9415
9418
  kind: "unexpected",
9416
9419
  message: message2,
9417
9420
  stack: error3 instanceof Error ? error3.stack : void 0,
9421
+ debugControlEnabled: options.debugControlEnabled,
9418
9422
  debugStackMode: options.debugStackMode
9419
9423
  },
9420
9424
  options.outputEmitter
@@ -9811,7 +9815,8 @@ async function runCLI(roots, options = {}) {
9811
9815
  `);
9812
9816
  }
9813
9817
  await handleRunError(error3, {
9814
- debugStackMode: resolvedFlags !== void 0 ? resolveDebugStackMode(resolvedFlags.debug) : getDebugStackModeFromArgv(argv),
9818
+ debugControlEnabled: controls.debug,
9819
+ debugStackMode: controls.debug ? resolvedFlags !== void 0 ? resolveDebugStackMode(resolvedFlags.debug) : getDebugStackModeFromArgv(argv) : void 0,
9815
9820
  output: resolvedFlags !== void 0 ? resolveOutput(resolvedFlags) : resolveOutputFromArgv(argv, controls.outputFormats),
9816
9821
  verbose: resolvedFlags ? Boolean(resolvedFlags.verbose) : argv.includes("--verbose"),
9817
9822
  program,