poe-code 3.0.221 → 3.0.222

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
@@ -56999,31 +56999,16 @@ function formatCommandRows(group, scope, casing, globalLongOptionFlags) {
56999
56999
  description: child.description ?? ""
57000
57000
  }));
57001
57001
  }
57002
- function formatGlobalOptionRows(ctx) {
57003
- const rows = [];
57002
+ function formatGlobalOptionsLine(ctx) {
57003
+ const flags = [];
57004
57004
  if (ctx.presetsEnabled) {
57005
- rows.push({
57006
- flags: "--preset <path>",
57007
- description: "Load parameter defaults from a JSON file"
57008
- });
57005
+ flags.push("--preset <path>");
57009
57006
  }
57010
- rows.push(
57011
- {
57012
- flags: "--yes",
57013
- description: "Accept defaults, skip prompts"
57014
- },
57015
- {
57016
- flags: "--output <format>",
57017
- description: "Output format: rich, md, json."
57018
- }
57019
- );
57007
+ flags.push("--yes", "--output <format>");
57020
57008
  if (ctx.showVersion) {
57021
- rows.push({
57022
- flags: "--version",
57023
- description: "Show version"
57024
- });
57009
+ flags.push("--version");
57025
57010
  }
57026
- return rows;
57011
+ return `${text.section("Options:")} ${flags.join(" ")}`;
57027
57012
  }
57028
57013
  function collectSchemaGlobalFieldRows(group, scope, casing, globalLongOptionFlags) {
57029
57014
  const seen = /* @__PURE__ */ new Map();
@@ -57080,12 +57065,22 @@ function renderGroupHelp(group, breadcrumb, scope, casing, globalOptions, rootUs
57080
57065
  ${formatHelpCommandList(commandRows)}`);
57081
57066
  }
57082
57067
  if (isRoot) {
57083
- const globalRows = [
57084
- ...formatGlobalOptionRows(globalOptions),
57085
- ...collectSchemaGlobalFieldRows(group, scope, casing, globalLongOptionFlags)
57086
- ];
57087
- sections.push(`${text.sectionHeader("Options")}
57088
- ${formatHelpOptionList(globalRows)}`);
57068
+ const schemaGlobalRows = collectSchemaGlobalFieldRows(
57069
+ group,
57070
+ scope,
57071
+ casing,
57072
+ globalLongOptionFlags
57073
+ );
57074
+ const builtInLine = formatGlobalOptionsLine(globalOptions);
57075
+ if (schemaGlobalRows.length > 0) {
57076
+ sections.push(
57077
+ `${text.sectionHeader("Options")}
57078
+ ${formatHelpOptionList(schemaGlobalRows)}
57079
+ ${builtInLine}`
57080
+ );
57081
+ } else {
57082
+ sections.push(builtInLine);
57083
+ }
57089
57084
  }
57090
57085
  return renderHelpDocument({
57091
57086
  breadcrumb,
@@ -57252,25 +57247,35 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute2, preset
57252
57247
  return group;
57253
57248
  }
57254
57249
  function addGlobalOptions(command, presetsEnabled) {
57250
+ const options = [];
57255
57251
  if (presetsEnabled) {
57256
- command.option("--preset <path>", "Load parameter defaults from a JSON file.");
57252
+ options.push(new Option("--preset <path>", "Load parameter defaults from a JSON file."));
57257
57253
  }
57258
- command.option("--yes", "Accept defaults and skip prompts.").option("--output <format>", "Output format.", (value) => {
57259
- if (value === "rich" || value === "md" || value === "json") {
57260
- return value;
57261
- }
57262
- if (value === "markdown") {
57263
- return "md";
57264
- }
57265
- throw new InvalidArgumentError(
57266
- formatInvalidEnumMessage("--output", value, ["rich", "md", "markdown", "json"], {
57267
- candidates: ["rich", "markdown", "json"],
57268
- threshold: 3
57269
- })
57270
- );
57271
- }).addOption(
57254
+ options.push(new Option("--yes", "Accept defaults and skip prompts."));
57255
+ options.push(
57256
+ new Option("--output <format>", "Output format.").argParser((value) => {
57257
+ if (value === "rich" || value === "md" || value === "json") {
57258
+ return value;
57259
+ }
57260
+ if (value === "markdown") {
57261
+ return "md";
57262
+ }
57263
+ throw new InvalidArgumentError(
57264
+ formatInvalidEnumMessage("--output", value, ["rich", "md", "markdown", "json"], {
57265
+ candidates: ["rich", "markdown", "json"],
57266
+ threshold: 3
57267
+ })
57268
+ );
57269
+ })
57270
+ );
57271
+ options.push(
57272
57272
  new Option("--debug [mode]", "Print stack traces for unexpected errors.").preset("trim").argParser(parseDebugStackMode)
57273
- ).option("--verbose", "Print detailed runtime diagnostics.");
57273
+ );
57274
+ options.push(new Option("--verbose", "Print detailed runtime diagnostics."));
57275
+ for (const option of options) {
57276
+ option.hideHelp(true);
57277
+ command.addOption(option);
57278
+ }
57274
57279
  }
57275
57280
  function parseDebugStackMode(value) {
57276
57281
  if (value === true || value === "trim") {
@@ -57310,6 +57315,9 @@ function formatResolvedValue(value) {
57310
57315
  }
57311
57316
  return JSON.stringify(value);
57312
57317
  }
57318
+ function fieldPromptLabel(field) {
57319
+ return field.positionalIndex === void 0 ? field.optionFlag : `<${field.displayPath}>`;
57320
+ }
57313
57321
  async function promptForField(field) {
57314
57322
  const schema2 = field.schema;
57315
57323
  if (schema2.kind === "enum") {
@@ -57318,7 +57326,7 @@ async function promptForField(field) {
57318
57326
  value
57319
57327
  }));
57320
57328
  const selected = await select2({
57321
- message: field.description ?? field.displayPath,
57329
+ message: field.description ?? fieldPromptLabel(field),
57322
57330
  options,
57323
57331
  initialValue: field.hasDefault ? field.defaultValue : void 0
57324
57332
  });
@@ -57330,7 +57338,7 @@ async function promptForField(field) {
57330
57338
  }
57331
57339
  if (field.schema.kind === "boolean") {
57332
57340
  const selected = await confirm2({
57333
- message: field.displayPath,
57341
+ message: fieldPromptLabel(field),
57334
57342
  initialValue: field.hasDefault ? Boolean(field.defaultValue) : void 0
57335
57343
  });
57336
57344
  if (isCancel(selected)) {
@@ -57340,7 +57348,7 @@ async function promptForField(field) {
57340
57348
  return selected;
57341
57349
  }
57342
57350
  const entered = await text3({
57343
- message: field.displayPath,
57351
+ message: fieldPromptLabel(field),
57344
57352
  initialValue: field.hasDefault && field.defaultValue !== void 0 ? formatResolvedValue(field.defaultValue) : void 0
57345
57353
  });
57346
57354
  if (isCancel(entered)) {
@@ -87415,7 +87423,7 @@ var init_package2 = __esm({
87415
87423
  "package.json"() {
87416
87424
  package_default2 = {
87417
87425
  name: "poe-code",
87418
- version: "3.0.221",
87426
+ version: "3.0.222",
87419
87427
  description: "CLI tool to configure Poe API for developer workflows.",
87420
87428
  type: "module",
87421
87429
  main: "./dist/index.js",