poe-code 3.0.153 → 3.0.155

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.
Files changed (50) hide show
  1. package/dist/cli/commands/auth.js +7 -2
  2. package/dist/cli/commands/auth.js.map +1 -1
  3. package/dist/cli/commands/configure.js +3 -2
  4. package/dist/cli/commands/configure.js.map +1 -1
  5. package/dist/cli/commands/experiment.js +2 -1
  6. package/dist/cli/commands/experiment.js.map +1 -1
  7. package/dist/cli/commands/generate.js +3 -3
  8. package/dist/cli/commands/generate.js.map +1 -1
  9. package/dist/cli/commands/install.js +3 -4
  10. package/dist/cli/commands/install.js.map +1 -1
  11. package/dist/cli/commands/launch.js +15 -7
  12. package/dist/cli/commands/launch.js.map +1 -1
  13. package/dist/cli/commands/logout.js +1 -1
  14. package/dist/cli/commands/logout.js.map +1 -1
  15. package/dist/cli/commands/mcp.js +11 -11
  16. package/dist/cli/commands/mcp.js.map +1 -1
  17. package/dist/cli/commands/pipeline.js +3 -2
  18. package/dist/cli/commands/pipeline.js.map +1 -1
  19. package/dist/cli/commands/ralph.js +2 -1
  20. package/dist/cli/commands/ralph.js.map +1 -1
  21. package/dist/cli/commands/shared.d.ts +4 -0
  22. package/dist/cli/commands/shared.js +19 -3
  23. package/dist/cli/commands/shared.js.map +1 -1
  24. package/dist/cli/commands/skill.js +10 -18
  25. package/dist/cli/commands/skill.js.map +1 -1
  26. package/dist/cli/commands/spawn.js +24 -7
  27. package/dist/cli/commands/spawn.js.map +1 -1
  28. package/dist/cli/commands/test.js +3 -4
  29. package/dist/cli/commands/test.js.map +1 -1
  30. package/dist/cli/commands/unconfigure.js +2 -2
  31. package/dist/cli/commands/unconfigure.js.map +1 -1
  32. package/dist/cli/commands/usage.js +1 -1
  33. package/dist/cli/commands/usage.js.map +1 -1
  34. package/dist/cli/commands/utils.js +2 -1
  35. package/dist/cli/commands/utils.js.map +1 -1
  36. package/dist/cli/program.js +136 -188
  37. package/dist/cli/program.js.map +1 -1
  38. package/dist/index.js +305 -274
  39. package/dist/index.js.map +3 -3
  40. package/dist/providers/claude-code.js +1 -1
  41. package/dist/providers/claude-code.js.map +2 -2
  42. package/dist/providers/codex.js +1 -1
  43. package/dist/providers/codex.js.map +2 -2
  44. package/dist/providers/kimi.js +1 -1
  45. package/dist/providers/kimi.js.map +2 -2
  46. package/dist/providers/opencode.js +1 -1
  47. package/dist/providers/opencode.js.map +2 -2
  48. package/dist/providers/poe-agent.js +18 -9
  49. package/dist/providers/poe-agent.js.map +2 -2
  50. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2756,7 +2756,7 @@ function toTomlInlineTable(values) {
2756
2756
  return `{${parts.join(", ")}}`;
2757
2757
  }
2758
2758
  function serializeJsonMcpArgs(servers) {
2759
- return ["--mcp-servers", JSON.stringify({ mcpServers: toJsonMcpServers(servers) })];
2759
+ return ["--mcp-config", JSON.stringify({ mcpServers: toJsonMcpServers(servers) })];
2760
2760
  }
2761
2761
  function serializeOpenCodeMcpEnv(servers) {
2762
2762
  const mcp = {};
@@ -7362,6 +7362,7 @@ function renderUsage(tokens) {
7362
7362
  );
7363
7363
  return;
7364
7364
  }
7365
+ process.stdout.write("\n");
7365
7366
  writeLine(chalk8.green(`\u2713 tokens: ${tokens.input} in${cached2} \u2192 ${tokens.output} out${cost}`));
7366
7367
  }
7367
7368
  function renderError(message2) {
@@ -9132,6 +9133,10 @@ var init_acp_transport = __esm({
9132
9133
  this.child.stderr.on("data", (chunk) => {
9133
9134
  this.stderrChunks.push(String(chunk));
9134
9135
  });
9136
+ this.child.stdin.on("error", (error2) => {
9137
+ const reason = error2 instanceof Error ? error2 : new Error(String(error2));
9138
+ this.close(reason, this.child.exitCode ?? null, this.child.signalCode ?? null);
9139
+ });
9135
9140
  this.layer = new JsonRpcMessageLayer({
9136
9141
  input: this.child.stdout,
9137
9142
  output: this.child.stdin,
@@ -9370,19 +9375,24 @@ var init_acp_client = __esm({
9370
9375
  this.permissionHandler = options.handlers?.permission ?? options.permissionHandler;
9371
9376
  this.fsHandler = options.handlers?.fs ?? options.fsHandler;
9372
9377
  this.terminalHandler = options.handlers?.terminal ?? options.terminalHandler;
9378
+ const autoApprove = options.autoApprove === true && !this.permissionHandler;
9373
9379
  this.transport.onRequest(
9374
9380
  "session/request_permission",
9375
9381
  async (params) => {
9376
- if (!this.permissionHandler) {
9377
- return {
9378
- outcome: { outcome: "cancelled" }
9379
- };
9382
+ if (this.permissionHandler) {
9383
+ const outcome = await this.permissionHandler({
9384
+ toolCall: params.toolCall,
9385
+ options: params.options
9386
+ });
9387
+ return { outcome };
9380
9388
  }
9381
- const outcome = await this.permissionHandler({
9382
- toolCall: params.toolCall,
9383
- options: params.options
9384
- });
9385
- return { outcome };
9389
+ if (autoApprove) {
9390
+ const allow = params.options.find((o) => o.kind === "allow_always") ?? params.options.find((o) => o.kind === "allow_once");
9391
+ if (allow) {
9392
+ return { outcome: { outcome: "selected", optionId: allow.optionId } };
9393
+ }
9394
+ }
9395
+ return { outcome: { outcome: "cancelled" } };
9386
9396
  }
9387
9397
  );
9388
9398
  this.registerCapabilityHandlers(this.clientCapabilities);
@@ -10002,13 +10012,19 @@ function toToolTitle(title, locations) {
10002
10012
  }
10003
10013
  function toToolOutput(value) {
10004
10014
  if (typeof value === "string") return value;
10005
- if (value === void 0) return "";
10015
+ if (value === void 0 || value === null) return "";
10006
10016
  try {
10007
10017
  return JSON.stringify(value);
10008
10018
  } catch {
10009
10019
  return String(value);
10010
10020
  }
10011
10021
  }
10022
+ function extractToolOutputText(update) {
10023
+ const raw = toToolOutput(update.rawOutput);
10024
+ if (raw) return raw;
10025
+ if (!update.content) return "";
10026
+ return update.content.filter((c) => c.type === "text" && c.text).map((c) => c.text).join("");
10027
+ }
10012
10028
  function toEventsFromSessionUpdate(notification, state) {
10013
10029
  const update = notification.params.update;
10014
10030
  if (update.sessionUpdate === "agent_message_chunk" && update.content.type === "text") {
@@ -10081,7 +10097,7 @@ function toEventsFromSessionUpdate(notification, state) {
10081
10097
  events.push({
10082
10098
  event: "tool_complete",
10083
10099
  kind: renderKind,
10084
- path: toToolOutput(update.rawOutput),
10100
+ path: extractToolOutputText(update),
10085
10101
  id: update.toolCallId
10086
10102
  });
10087
10103
  }
@@ -10089,6 +10105,15 @@ function toEventsFromSessionUpdate(notification, state) {
10089
10105
  }
10090
10106
  return [];
10091
10107
  }
10108
+ function toAcpMcpServers(servers) {
10109
+ if (!servers) return [];
10110
+ return Object.entries(servers).map(([name, server]) => ({
10111
+ name,
10112
+ command: server.command,
10113
+ args: server.args ?? [],
10114
+ env: server.env ? Object.entries(server.env).map(([k2, v]) => ({ name: k2, value: v })) : []
10115
+ }));
10116
+ }
10092
10117
  function createAbortError3() {
10093
10118
  const error2 = new Error("Agent spawn aborted");
10094
10119
  error2.name = "AbortError";
@@ -10119,7 +10144,8 @@ function spawnAcp(options) {
10119
10144
  cwd: options.cwd ?? process.cwd(),
10120
10145
  env,
10121
10146
  requestTimeoutMs: 3e5,
10122
- skipAuth: acpConfig.skipAuth ?? false
10147
+ skipAuth: acpConfig.skipAuth ?? false,
10148
+ autoApprove: (options.mode ?? "yolo") === "yolo"
10123
10149
  });
10124
10150
  let aborted = false;
10125
10151
  const onAbort = () => {
@@ -10134,6 +10160,7 @@ function spawnAcp(options) {
10134
10160
  };
10135
10161
  let sessionId = "";
10136
10162
  let assistantText = "";
10163
+ let lastToolOutput = "";
10137
10164
  const eventQueue = [];
10138
10165
  const waiters = [];
10139
10166
  let eventsDone = false;
@@ -10176,7 +10203,7 @@ function spawnAcp(options) {
10176
10203
  if (initResult.authMethods && initResult.authMethods.length > 0 && client.state !== "ready") {
10177
10204
  await client.authenticate(initResult.authMethods[0].id);
10178
10205
  }
10179
- const session = await client.newSession(options.cwd ?? process.cwd(), []);
10206
+ const session = await client.newSession(options.cwd ?? process.cwd(), toAcpMcpServers(options.mcpServers));
10180
10207
  sessionId = session.sessionId;
10181
10208
  pushEvent({ event: "session_start", threadId: sessionId });
10182
10209
  const turn = client.prompt(sessionId, [{ type: "text", text: options.prompt }]);
@@ -10187,6 +10214,12 @@ function spawnAcp(options) {
10187
10214
  assistantText += update.content.text;
10188
10215
  }
10189
10216
  for (const event of toEventsFromSessionUpdate(notification, toolState)) {
10217
+ if (event.event === "tool_complete") {
10218
+ const output = event.path;
10219
+ if (output) {
10220
+ lastToolOutput = output;
10221
+ }
10222
+ }
10190
10223
  pushEvent(event);
10191
10224
  }
10192
10225
  }
@@ -10194,8 +10227,9 @@ function spawnAcp(options) {
10194
10227
  const stopReason = promptResponse.stopReason;
10195
10228
  const meta = promptResponse._meta ?? {};
10196
10229
  const metaUsage = meta.usage;
10230
+ const responseText = assistantText || lastToolOutput;
10197
10231
  return {
10198
- stdout: assistantText.length > 0 ? `${assistantText}
10232
+ stdout: responseText.length > 0 ? `${responseText}
10199
10233
  ` : "",
10200
10234
  stderr: "",
10201
10235
  exitCode: stopReason === "completed" || stopReason === "end_turn" ? 0 : 1,
@@ -10611,7 +10645,26 @@ function createCheckRunner(resources) {
10611
10645
  };
10612
10646
  }
10613
10647
  function listIsolatedServiceIds(container) {
10614
- return container.registry.list().filter((provider2) => Boolean(provider2.isolatedEnv)).map((provider2) => provider2.name);
10648
+ return listServiceNames(
10649
+ container.registry.list().filter((provider2) => Boolean(provider2.isolatedEnv))
10650
+ );
10651
+ }
10652
+ function listServiceNames(services) {
10653
+ const names = [];
10654
+ const add = (value) => {
10655
+ const normalized = value?.trim();
10656
+ if (!normalized || names.includes(normalized)) {
10657
+ return;
10658
+ }
10659
+ names.push(normalized);
10660
+ };
10661
+ for (const service of services) {
10662
+ add(service.name);
10663
+ for (const alias of service.aliases ?? []) {
10664
+ add(alias);
10665
+ }
10666
+ }
10667
+ return names;
10615
10668
  }
10616
10669
  function resolveServiceAdapter(container, service) {
10617
10670
  const adapter = container.registry.get(service);
@@ -18564,11 +18617,11 @@ var init_commands = __esm({
18564
18617
  description: "Run a GitHub automation.",
18565
18618
  positional: ["name"],
18566
18619
  params: S.Object({
18567
- name: S.Optional(S.String()),
18568
- agent: S.Optional(S.String()),
18569
- model: S.Optional(S.String()),
18570
- mode: S.Optional(S.Enum(["yolo", "edit", "read"])),
18571
- cwd: S.Optional(S.String())
18620
+ name: S.Optional(S.String({ description: "Automation name to run" })),
18621
+ agent: S.Optional(S.String({ description: "Agent to run the automation with" })),
18622
+ model: S.Optional(S.String({ description: "Model override for the agent" })),
18623
+ mode: S.Optional(S.Enum(["yolo", "edit", "read"], { description: "Permission mode (yolo | edit | read)" })),
18624
+ cwd: S.Optional(S.String({ description: "Working directory for the automation" }))
18572
18625
  }),
18573
18626
  secrets: {
18574
18627
  poeApiKey: { env: "POE_API_KEY" },
@@ -24117,8 +24170,8 @@ function findVisibleChild(group, token, scope) {
24117
24170
  (child) => child.name === token || child.aliases.includes(token)
24118
24171
  );
24119
24172
  }
24120
- function resolveHelpTarget(root, argv, scope) {
24121
- const breadcrumb = [root.name];
24173
+ function resolveHelpTarget(root, argv, scope, rootDisplayName) {
24174
+ const breadcrumb = [rootDisplayName ?? root.name];
24122
24175
  let current = root;
24123
24176
  for (const token of argv.slice(2)) {
24124
24177
  if (token.startsWith("-") || token === "help") {
@@ -24209,7 +24262,7 @@ function formatCommandRows(group, scope) {
24209
24262
  function formatGlobalOptionRows(showVersion) {
24210
24263
  const rows = [
24211
24264
  {
24212
- flags: "--preset",
24265
+ flags: "--preset <path>",
24213
24266
  description: "Load parameter defaults from a JSON file"
24214
24267
  },
24215
24268
  {
@@ -24217,11 +24270,11 @@ function formatGlobalOptionRows(showVersion) {
24217
24270
  description: "Accept defaults, skip prompts"
24218
24271
  },
24219
24272
  {
24220
- flags: "--output",
24273
+ flags: "--output <format>",
24221
24274
  description: "Output format (rich, md, json)"
24222
24275
  },
24223
24276
  {
24224
- flags: "--help",
24277
+ flags: "-h, --help",
24225
24278
  description: "Show help"
24226
24279
  }
24227
24280
  ];
@@ -24236,7 +24289,14 @@ function formatGlobalOptionRows(showVersion) {
24236
24289
  function renderHelpSections(sections) {
24237
24290
  return sections.filter((section) => section.length > 0).join("\n\n");
24238
24291
  }
24239
- function renderGroupHelp(group, breadcrumb, scope, showVersion) {
24292
+ function buildUsageLine(breadcrumb, rootUsageName, suffix) {
24293
+ if (rootUsageName === void 0) {
24294
+ return void 0;
24295
+ }
24296
+ const subPath = breadcrumb.slice(1).join(" ");
24297
+ return subPath ? `${rootUsageName} ${subPath} ${suffix}` : `${rootUsageName} ${suffix}`;
24298
+ }
24299
+ function renderGroupHelp(group, breadcrumb, scope, showVersion, rootUsageName) {
24240
24300
  const sections = [];
24241
24301
  const commandRows = formatCommandRows(group, scope);
24242
24302
  if (commandRows.length > 0) {
@@ -24247,12 +24307,13 @@ ${formatCommandList(commandRows)}`);
24247
24307
  ${formatOptionList(formatGlobalOptionRows(showVersion))}`);
24248
24308
  return renderHelpDocument({
24249
24309
  breadcrumb,
24310
+ usageLine: buildUsageLine(breadcrumb, rootUsageName, "[options] [command]"),
24250
24311
  description: group.description,
24251
24312
  requiresAuth: group.requires?.auth === true,
24252
24313
  sections
24253
24314
  });
24254
24315
  }
24255
- function renderLeafHelp(command, breadcrumb, casing) {
24316
+ function renderLeafHelp(command, breadcrumb, casing, rootUsageName) {
24256
24317
  const sections = [];
24257
24318
  const fields = assignPositionals(collectFields(command.params, casing), command.positional);
24258
24319
  const optionRows = fields.map((field) => ({
@@ -24270,8 +24331,11 @@ ${formatOptionList(formatGlobalOptionRows(false))}`);
24270
24331
  sections.push(`${text.section("Secrets (via environment):")}
24271
24332
  ${formatOptionList(secretRows)}`);
24272
24333
  }
24334
+ const positionalFields = fields.filter((f) => f.positionalIndex !== void 0);
24335
+ const usageSuffix = positionalFields.length > 0 ? `[options] ${positionalFields.map(formatPositionalToken).join(" ")}` : "[options]";
24273
24336
  return renderHelpDocument({
24274
24337
  breadcrumb,
24338
+ usageLine: buildUsageLine(breadcrumb, rootUsageName, usageSuffix),
24275
24339
  description: command.description,
24276
24340
  requiresAuth: command.requires?.auth === true,
24277
24341
  sections
@@ -24279,11 +24343,14 @@ ${formatOptionList(secretRows)}`);
24279
24343
  }
24280
24344
  function renderHelpDocument(input) {
24281
24345
  const lines = [text.heading(input.breadcrumb.join(" ")), ""];
24346
+ if (input.usageLine !== void 0) {
24347
+ lines.push(`${text.section("Usage:")} ${text.usageCommand(input.usageLine)}`, "");
24348
+ }
24282
24349
  if (input.description !== void 0) {
24283
- lines.push(` ${input.description}`);
24350
+ lines.push(input.description);
24284
24351
  }
24285
24352
  if (input.requiresAuth) {
24286
- lines.push(" Requires: authentication");
24353
+ lines.push("Requires: authentication");
24287
24354
  }
24288
24355
  if (input.description !== void 0 || input.requiresAuth) {
24289
24356
  lines.push("");
@@ -24293,11 +24360,11 @@ function renderHelpDocument(input) {
24293
24360
  `;
24294
24361
  }
24295
24362
  async function renderGeneratedHelp(root, argv, options) {
24296
- const target = resolveHelpTarget(root, argv, "cli");
24363
+ const target = resolveHelpTarget(root, argv, "cli", options.rootDisplayName);
24297
24364
  const output = resolveHelpOutput(argv);
24298
24365
  const casing = options.casing ?? "kebab";
24299
24366
  await withOutputFormat2(output, async () => {
24300
- const rendered = target.node.kind === "group" ? renderGroupHelp(target.node, target.breadcrumb, "cli", options.version !== void 0) : renderLeafHelp(target.node, target.breadcrumb, casing);
24367
+ const rendered = target.node.kind === "group" ? renderGroupHelp(target.node, target.breadcrumb, "cli", options.version !== void 0, options.rootUsageName) : renderLeafHelp(target.node, target.breadcrumb, casing, options.rootUsageName);
24301
24368
  process.stdout.write(rendered);
24302
24369
  });
24303
24370
  }
@@ -25462,9 +25529,9 @@ var init_config3 = __esm({
25462
25529
 
25463
25530
  // src/cli/commands/configure.ts
25464
25531
  function registerConfigureCommand(program, container) {
25465
- const serviceNames = container.registry.list().map((service) => service.name);
25532
+ const serviceNames = listServiceNames(container.registry.list());
25466
25533
  const serviceDescription = `Agent to configure${formatServiceList(serviceNames)}`;
25467
- const configureCommand = program.command("configure").alias("c").description("Configure developer tooling for Poe API.").argument("[agent]", serviceDescription).option("--api-key <key>", "Poe API key").option("--model <model>", "Model identifier").option("--reasoning-effort <level>", "Reasoning effort level").action(async (service, options) => {
25534
+ const configureCommand = program.command("configure").alias("c").description("Configure developer tooling for Poe API.").argument("[agent]", serviceDescription).option("-y, --yes", "Accept defaults, skip prompts").option("--api-key <key>", "Poe API key").option("--model <model>", "Model identifier").option("--reasoning-effort <level>", "Reasoning effort level").action(async (service, options) => {
25468
25535
  const resolved = await resolveServiceArgument(program, container, service, {
25469
25536
  action: "configure"
25470
25537
  });
@@ -25689,12 +25756,13 @@ var init_agent2 = __esm({
25689
25756
  });
25690
25757
 
25691
25758
  // src/cli/commands/spawn.ts
25759
+ import { Option as Option2 } from "commander";
25692
25760
  function registerSpawnCommand(program, container, options = {}) {
25693
- const spawnServices = container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name)).map((service) => service.name);
25761
+ const spawnServices = container.registry.list().filter((service) => typeof service.spawn === "function" || getSpawnConfig(service.name));
25694
25762
  const extraServices = options.extraServices ?? [];
25695
- const serviceList = [...spawnServices, ...extraServices];
25763
+ const serviceList = listSpawnServiceNames(spawnServices, extraServices);
25696
25764
  const serviceDescription = `Agent to spawn${formatServiceList(serviceList)}`;
25697
- program.command("spawn").alias("s").description("Run a single prompt through a configured agent CLI.").option("--model <model>", "Model identifier override passed to the agent CLI").option("-C, --cwd <path>", "Working directory or workspace locator for the agent CLI").option("--stdin", "Read the prompt from stdin").option("-i, --interactive", "Launch the agent in interactive TUI mode").option("--mode <mode>", "Permission mode: yolo | edit | read (default: yolo)").option("--mcp-servers <json>", "MCP server config JSON: {name: {command, args?, env?}}").option("--mcp-config <json>", "[deprecated: use --mcp-servers]").option("--log-dir <path>", "Directory override for ACP JSONL spawn logs").option(
25765
+ program.command("spawn").alias("s").description("Run a single prompt through a configured agent CLI.").option("--model <model>", "Model identifier override passed to the agent CLI").option("-C, --cwd <path>", "Working directory or workspace locator for the agent CLI").option("--stdin", "Read the prompt from stdin").option("-i, --interactive", "Launch the agent in interactive TUI mode").option("--mode <mode>", "Permission mode: yolo | edit | read (default: yolo)").option("--mcp-servers <json>", "MCP server config JSON: {name: {command, args?, env?}}").addOption(new Option2("--mcp-config <json>", "[deprecated: use --mcp-servers]").hideHelp()).option("--log-dir <path>", "Directory override for ACP JSONL spawn logs").option(
25698
25766
  "--activity-timeout-ms <ms>",
25699
25767
  "Kill the agent after N ms of inactivity",
25700
25768
  (value) => parsePositiveInt(value, "--activity-timeout-ms")
@@ -25887,8 +25955,6 @@ function registerSpawnCommand(program, container, options = {}) {
25887
25955
  const trimmedStderr = final.stderr.trim();
25888
25956
  if (trimmedStderr) {
25889
25957
  resources.logger.info(renderMarkdown(trimmedStderr).trimEnd());
25890
- } else {
25891
- resources.logger.info(`${adapter.label} spawn completed.`);
25892
25958
  }
25893
25959
  }
25894
25960
  }
@@ -25913,6 +25979,26 @@ Resume: ${resumeCommand}`));
25913
25979
  }
25914
25980
  });
25915
25981
  }
25982
+ function listSpawnServiceNames(services, extraServices) {
25983
+ const names = [];
25984
+ const add = (value) => {
25985
+ const normalized = value?.trim();
25986
+ if (!normalized || names.includes(normalized)) {
25987
+ return;
25988
+ }
25989
+ names.push(normalized);
25990
+ };
25991
+ for (const service of services) {
25992
+ add(service.name);
25993
+ for (const alias of service.aliases ?? []) {
25994
+ add(alias);
25995
+ }
25996
+ }
25997
+ for (const service of extraServices) {
25998
+ add(service);
25999
+ }
26000
+ return names;
26001
+ }
25916
26002
  async function confirmUnconfiguredService(container, service, label, flags) {
25917
26003
  const configuredServices = await loadConfiguredServices({
25918
26004
  fs: container.fs,
@@ -26283,7 +26369,7 @@ var init_login = __esm({
26283
26369
 
26284
26370
  // src/cli/commands/unconfigure.ts
26285
26371
  function registerUnconfigureCommand(program, container) {
26286
- const serviceNames = container.registry.list().map((service) => service.name);
26372
+ const serviceNames = listServiceNames(container.registry.list());
26287
26373
  const serviceDescription = `Agent to unconfigure${formatServiceList(serviceNames)}`;
26288
26374
  return program.command("unconfigure").alias("uc").description("Remove existing Poe API tooling configuration.").argument("<agent>", serviceDescription).action(async (service, options) => {
26289
26375
  await executeUnconfigure(program, container, service, options);
@@ -26400,7 +26486,7 @@ var init_unconfigure = __esm({
26400
26486
 
26401
26487
  // src/cli/commands/logout.ts
26402
26488
  function registerLogoutCommand(program, container) {
26403
- program.command("logout").description("Remove all Poe API configuration.").action(async () => {
26489
+ program.command("logout").description("Remove all configuration and credentials.").action(async () => {
26404
26490
  await executeLogout(program, container);
26405
26491
  });
26406
26492
  }
@@ -26456,10 +26542,13 @@ function registerAuthCommand(program, container) {
26456
26542
  auth.command("status").description("Show login status.").action(async () => {
26457
26543
  await executeStatus(program, container);
26458
26544
  });
26459
- auth.command("api_key").description("Display stored API key.").action(async () => {
26545
+ auth.command("api-key").description("Display stored API key.").action(async () => {
26460
26546
  await executeApiKey(program, container);
26461
26547
  });
26462
- auth.command("login").description("Store a Poe API key.").option("--api-key <key>", "Poe API key").action(async (options) => {
26548
+ auth.command("api_key", { hidden: true }).action(async () => {
26549
+ await executeApiKey(program, container);
26550
+ });
26551
+ auth.command("login").description("Store a Poe API key for reuse across commands.").option("--api-key <key>", "Poe API key").action(async (options) => {
26463
26552
  await executeLogin(program, container, options);
26464
26553
  });
26465
26554
  auth.command("logout").description("Remove all configuration and credentials.").action(async () => {
@@ -26657,7 +26746,7 @@ var init_config4 = __esm({
26657
26746
 
26658
26747
  // src/cli/commands/utils.ts
26659
26748
  function registerUtilsCommand(program, container) {
26660
- const utils = program.command("utils").description("Utility commands for inspecting and managing poe-code.");
26749
+ const utils = program.command("utils").description("Utility commands for inspecting and managing poe-code.").addHelpCommand(false);
26661
26750
  registerConfigCommand(utils, container);
26662
26751
  }
26663
26752
  var init_utils3 = __esm({
@@ -26669,8 +26758,8 @@ var init_utils3 = __esm({
26669
26758
 
26670
26759
  // src/cli/commands/install.ts
26671
26760
  function registerInstallCommand(program, container) {
26672
- const serviceNames = container.registry.list().filter((service) => typeof service.install === "function").map((service) => service.name);
26673
- const serviceDescription = `Agent to install${formatServiceList(serviceNames)}`;
26761
+ const serviceNames = container.registry.list().filter((service) => typeof service.install === "function");
26762
+ const serviceDescription = `Agent to install${formatServiceList(listServiceNames(serviceNames))}`;
26674
26763
  return program.command("install").alias("i").description("Install agent binary for a configured agent.").argument(
26675
26764
  "[agent]",
26676
26765
  serviceDescription
@@ -26722,8 +26811,8 @@ var init_install = __esm({
26722
26811
 
26723
26812
  // src/cli/commands/test.ts
26724
26813
  function registerTestCommand(program, container) {
26725
- const serviceNames = container.registry.list().filter((service) => typeof service.test === "function").map((service) => service.name);
26726
- const serviceDescription = `Agent to test${formatServiceList(serviceNames)}`;
26814
+ const serviceNames = container.registry.list().filter((service) => typeof service.test === "function");
26815
+ const serviceDescription = `Agent to test${formatServiceList(listServiceNames(serviceNames))}`;
26727
26816
  return program.command("test").description("Run agent health checks.").argument(
26728
26817
  "[agent]",
26729
26818
  serviceDescription
@@ -26865,7 +26954,7 @@ var init_media_download = __esm({
26865
26954
  // src/cli/commands/generate.ts
26866
26955
  import path37 from "node:path";
26867
26956
  function registerGenerateCommand(program, container) {
26868
- const generate2 = program.command("generate").alias("g").description("Generate content via Poe API").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
26957
+ const generate2 = program.command("generate").alias("g").description("Generate content via Poe API.").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
26869
26958
  "--param <key=value>",
26870
26959
  "Additional parameters (repeatable)",
26871
26960
  collectParam,
@@ -26896,7 +26985,7 @@ function registerGenerateCommand(program, container) {
26896
26985
  }
26897
26986
  outro("");
26898
26987
  });
26899
- generate2.command("text").description(`Generate text (default model: ${DEFAULT_TEXT_MODEL})`).option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
26988
+ generate2.command("text").description("Generate text content.").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
26900
26989
  "--param <key=value>",
26901
26990
  "Additional parameters (repeatable)",
26902
26991
  collectParam,
@@ -26933,7 +27022,7 @@ function registerGenerateCommand(program, container) {
26933
27022
  }
26934
27023
  function registerMediaSubcommand(generate2, program, container, type) {
26935
27024
  const defaultModel = DEFAULT_MODELS2[type];
26936
- generate2.command(type).description(`Generate ${type} (default model: ${defaultModel})`).option("--model <model>", `Model identifier (default: ${defaultModel})`).option(
27025
+ generate2.command(type).description(`Generate ${type} content.`).option("--model <model>", `Model identifier (default: ${defaultModel})`).option(
26937
27026
  "--param <key=value>",
26938
27027
  "Additional parameters (repeatable)",
26939
27028
  collectParam,
@@ -28617,14 +28706,12 @@ function buildHelpText() {
28617
28706
  const lines = [
28618
28707
  "",
28619
28708
  "Configuration:",
28620
- JSON.stringify({ [server.name]: server.config }, null, 2),
28621
- "",
28622
- formatMcpToolsDocs()
28709
+ JSON.stringify({ [server.name]: server.config }, null, 2)
28623
28710
  ];
28624
28711
  return lines.join("\n");
28625
28712
  }
28626
28713
  function registerMcpCommand(program, container) {
28627
- const mcp = program.command("mcp").description("MCP server commands").addHelpText("after", buildHelpText()).allowExcessArguments().action(function() {
28714
+ const mcp = program.command("mcp").description("MCP server commands.").addHelpText("after", buildHelpText()).allowExcessArguments().action(function() {
28628
28715
  if (this.args.length > 0) {
28629
28716
  throwCommandNotFound({
28630
28717
  container,
@@ -28636,13 +28723,15 @@ function registerMcpCommand(program, container) {
28636
28723
  }
28637
28724
  this.help();
28638
28725
  });
28639
- mcp.command("serve").description("Run MCP server on stdin/stdout").option(
28726
+ mcp.command("serve").description("Run MCP server on stdin/stdout.").option(
28640
28727
  "--output-format <format>",
28641
28728
  'Preferred MCP media output format(s): "url", "base64", "markdown", or comma-separated list (default: "url"). Note: "markdown" cannot be combined with other formats.'
28642
- ).addHelpText("after", buildHelpText()).action(async (options) => {
28729
+ ).addHelpText("after", `${buildHelpText()}
28730
+
28731
+ ${formatMcpToolsDocs()}`).action(async (options) => {
28643
28732
  await runMcpServer(container, { outputFormat: options.outputFormat });
28644
28733
  });
28645
- mcp.command("configure [agent]").description("Configure MCP client to use poe-code").option("-y, --yes", "Skip prompt, use claude-code").action(async (agentArg, options) => {
28734
+ mcp.command("configure").description("Configure MCP client to use poe-code.").argument("[agent]", `Agent to configure (${supportedAgents.join(" | ")})`).option("-y, --yes", "Accept defaults, skip prompts").action(async (agentArg, options) => {
28646
28735
  const flags = resolveCommandFlags(program);
28647
28736
  const resources = createExecutionResources(container, flags, "mcp");
28648
28737
  const existingKey = await container.readApiKey();
@@ -28702,7 +28791,7 @@ function registerMcpCommand(program, container) {
28702
28791
  });
28703
28792
  resources.context.finalize();
28704
28793
  });
28705
- mcp.command("unconfigure <agent>").description("Remove poe-code from MCP client").action(async (agent2) => {
28794
+ mcp.command("unconfigure").description("Remove poe-code from MCP client.").argument("<agent>", `Agent to unconfigure (${supportedAgents.join(" | ")})`).action(async (agent2) => {
28706
28795
  const flags = resolveCommandFlags(program);
28707
28796
  const resources = createExecutionResources(container, flags, "mcp");
28708
28797
  resources.logger.intro(`mcp unconfigure ${agent2}`);
@@ -28976,16 +29065,8 @@ var init_src22 = __esm({
28976
29065
  });
28977
29066
 
28978
29067
  // src/cli/commands/skill.ts
28979
- function buildHelpText2() {
28980
- return [
28981
- "",
28982
- "Skill directories:",
28983
- "- poe-code skill configure installs skill directories for supported agents.",
28984
- "- poe-code skill unconfigure removes skill directories."
28985
- ].join("\n");
28986
- }
28987
29068
  function registerSkillCommand(program, container) {
28988
- const skill = program.command("skill").description("Skill directory commands").addHelpText("after", buildHelpText2()).allowExcessArguments().action(function() {
29069
+ const skill = program.command("skill").description("Skill directory commands.").allowExcessArguments().action(function() {
28989
29070
  if (this.args.length > 0) {
28990
29071
  throwCommandNotFound({
28991
29072
  container,
@@ -28997,14 +29078,14 @@ function registerSkillCommand(program, container) {
28997
29078
  }
28998
29079
  this.help();
28999
29080
  });
29000
- skill.command("configure [agent]").description("Install skill directories for an agent").option("--agent <name>", "Agent to configure skills for").option("--local", "Use local scope (in the current project)").option("--global", "Use global scope (in the user home directory)").action(async (agentArg, options) => {
29081
+ skill.command("configure").description("Install skill directories for an agent.").argument("[agent]", `Agent to configure skills for (${supportedAgents2.join(" | ")})`).option("-y, --yes", "Accept defaults, skip prompts").option("--local", "Use local scope (in the current project)").option("--global", "Use global scope (in the user home directory)").action(async (agentArg, options) => {
29001
29082
  const flags = resolveCommandFlags(program);
29002
29083
  const resources = createExecutionResources(container, flags, "skill");
29003
29084
  if (options.local && options.global) {
29004
29085
  resources.logger.error("Use either --local or --global, not both.");
29005
29086
  return;
29006
29087
  }
29007
- let agent2 = options.agent ?? agentArg;
29088
+ let agent2 = agentArg;
29008
29089
  if (!agent2) {
29009
29090
  if (flags.assumeYes) {
29010
29091
  agent2 = DEFAULT_SKILL_AGENT;
@@ -29079,14 +29160,14 @@ function registerSkillCommand(program, container) {
29079
29160
  });
29080
29161
  resources.context.finalize();
29081
29162
  });
29082
- skill.command("unconfigure [agent]").description("Remove skill directories for an agent").option("--agent <name>", "Agent to unconfigure skills for").option("--local", "Use local scope (in the current project)").option("--global", "Use global scope (in the user home directory)").option("--force", "Remove directory even if it contains files").action(async (agentArg, options) => {
29163
+ skill.command("unconfigure").description("Remove skill directories for an agent.").argument("[agent]", `Agent to unconfigure skills for (${supportedAgents2.join(" | ")})`).option("--local", "Use local scope (in the current project)").option("--global", "Use global scope (in the user home directory)").option("--force", "Remove directory even if it contains files").action(async (agentArg, options) => {
29083
29164
  const flags = resolveCommandFlags(program);
29084
29165
  const resources = createExecutionResources(container, flags, "skill");
29085
29166
  if (options.local && options.global) {
29086
29167
  resources.logger.error("Use either --local or --global, not both.");
29087
29168
  return;
29088
29169
  }
29089
- let agent2 = options.agent ?? agentArg;
29170
+ let agent2 = agentArg;
29090
29171
  if (!agent2) {
29091
29172
  const selected = await select2({
29092
29173
  message: "Select agent to unconfigure:",
@@ -29375,7 +29456,7 @@ function registerUsageCommand(program, container) {
29375
29456
  const usage = program.command("usage").alias("u").description("Check Poe API usage information.").action(async () => {
29376
29457
  await executeBalance(program, container);
29377
29458
  });
29378
- usage.command("balance").description("Display current point balance.").action(async () => {
29459
+ usage.command("balance", { hidden: true }).description("Display current point balance.").action(async () => {
29379
29460
  await executeBalance(program, container);
29380
29461
  });
29381
29462
  usage.command("list").description("Display usage history.").option("--filter <model>", "Filter results by model name").option("--pages <count>", "Number of pages to load automatically", parseInt).action(async function() {
@@ -29976,8 +30057,8 @@ async function pathExists3(fs3, targetPath) {
29976
30057
  }
29977
30058
  }
29978
30059
  function registerPipelineCommand(program, container) {
29979
- const pipeline = program.command("pipeline").description("Run a fixed-step task pipeline plan.");
29980
- pipeline.command("run").description("Run the selected pipeline plan until completion, failure, cancellation, or cap.").option("--agent <name>", "Agent to run each pipeline step with").option("--model <model>", "Model override passed to the agent").option("--task <id>", "Run only the specified task").option("--plan <path>", "Path to the pipeline plan file").option("--max-runs <n>", "Maximum number of agent executions to perform").action(async function() {
30060
+ const pipeline = program.command("pipeline").description("Run a fixed-step task pipeline plan.").addHelpCommand(false);
30061
+ pipeline.command("run").description("Run the selected pipeline plan until completion, failure, cancellation, or max runs.").option("--agent <name>", "Agent to run each pipeline step with").option("--model <model>", "Model override passed to the agent").option("--task <id>", "Run only the specified task").option("--plan <path>", "Path to the pipeline plan file").option("--max-runs <n>", "Maximum number of agent executions to perform").action(async function() {
29981
30062
  const flags = resolveCommandFlags(program);
29982
30063
  const resources = createExecutionResources(
29983
30064
  container,
@@ -30607,7 +30688,7 @@ function expandAgentList(agent2, iterations) {
30607
30688
  return Array.from({ length: count }, (_2, index) => agent2[index % agent2.length]);
30608
30689
  }
30609
30690
  function registerRalphCommand(program, container) {
30610
- const ralph = program.command("ralph").description("Run a simple iterative markdown loop.");
30691
+ const ralph = program.command("ralph").description("Run a simple iterative markdown loop.").addHelpCommand(false);
30611
30692
  ralph.command("init").description("Write Ralph config into an existing markdown doc frontmatter.").argument("[doc]", "Markdown doc path").option("--agent <name>", "Agent to write into frontmatter").option("--iterations <n>", "Number of iterations to write into frontmatter").action(async function(docArg) {
30612
30693
  const flags = resolveCommandFlags(program);
30613
30694
  const resources = createExecutionResources(container, flags, "ralph:init");
@@ -31029,7 +31110,7 @@ function formatJournalOutput(output) {
31029
31110
  return trimmed.split("\n").join(" \u21B5 ");
31030
31111
  }
31031
31112
  function registerExperimentCommand(program, container) {
31032
- const experiment = program.command("experiment").description("Run autonomous experiment loop workflows.");
31113
+ const experiment = program.command("experiment").description("Run autonomous experiment loop workflows.").addHelpCommand(false);
31033
31114
  experiment.command("run").description("Run an experiment doc through the autonomous experiment loop.").argument("[doc]", "Experiment doc path").option("--agent <agent>", "Override the agent from frontmatter").option("--max-experiments <n>", "Limit the number of experiments to run").action(async function(docArg) {
31034
31115
  const flags = resolveCommandFlags(program);
31035
31116
  const resources = createExecutionResources(container, flags, "experiment:run");
@@ -31395,10 +31476,10 @@ var init_experiment2 = __esm({
31395
31476
  });
31396
31477
 
31397
31478
  // src/cli/commands/launch.ts
31398
- import { Option as Option2 } from "commander";
31479
+ import { Option as Option3 } from "commander";
31399
31480
  function registerLaunchCommand(program, container) {
31400
- const launch = program.command("launch").description("Manage long-running host and Docker processes.");
31401
- launch.command("start [id] [commandArgs...]").usage("<id> -- <command> [args...]").description("Start and supervise a managed process.").addOption(createChoiceOption("--restart <policy>", "Restart policy", ["never", "on-failure", "always"], "on-failure")).option("--max-restarts <n>", "Max consecutive restarts", "5").option("--ready-pattern <string>", "Log substring to wait for before reporting running").option("--ready-port <port>", "TCP port to probe for readiness").option("--cwd <dir>", "Working directory for the managed process").option("--env <entry>", "Environment variable (KEY=VALUE)", collectValues, []).option("--image <image>", "Docker image").option("--mount <src:target[:ro]>", "Docker bind mount", collectValues, []).option("--port <host:container>", "Docker port mapping", collectValues, []).option("--network <name>", "Docker network").addOption(createChoiceOption("--engine <engine>", "Container engine", ["docker", "podman"])).action(async function(id, commandArgs) {
31481
+ const launch = program.command("launch").description("Manage long-running host and Docker processes.").addHelpCommand(false);
31482
+ launch.command("start").usage("<id> -- <command> [args...]").description("Start and supervise a managed process.").argument("[id]", "Managed process identifier").argument("[command...]", "Command and arguments to run after --").addOption(createChoiceOption("--restart <policy>", "Restart policy", ["never", "on-failure", "always"], "on-failure")).option("--max-restarts <n>", "Max consecutive restarts", "5").option("--ready-pattern <string>", "Log substring to wait for before reporting running").option("--ready-port <port>", "TCP port to probe for readiness").option("--cwd <dir>", "Working directory for the managed process").option("--env <entry>", "Environment variable (KEY=VALUE)", collectValues, []).option("--image <image>", "Docker image").option("--mount <src:target[:ro]>", "Docker bind mount", collectValues, []).option("--port <host:container>", "Docker port mapping", collectValues, []).option("--network <name>", "Docker network").addOption(createChoiceOption("--engine <engine>", "Container engine", ["docker", "podman"])).action(async function(id, commandArgs) {
31402
31483
  const spec = await resolveStartSpec({
31403
31484
  commandArgs,
31404
31485
  id,
@@ -31414,7 +31495,7 @@ function registerLaunchCommand(program, container) {
31414
31495
  spec
31415
31496
  });
31416
31497
  });
31417
- launch.command("stop <id>").description("Stop a managed process.").option("--force", "Stop immediately with SIGKILL / docker kill").action(async function(id) {
31498
+ launch.command("stop").description("Stop a managed process.").argument("<id>", "Managed process identifier").option("--force", "Stop immediately with SIGKILL / docker kill").action(async function(id) {
31418
31499
  const result = await stopLaunch({
31419
31500
  force: Boolean(this.opts().force),
31420
31501
  homeDir: container.env.homeDir,
@@ -31424,7 +31505,7 @@ function registerLaunchCommand(program, container) {
31424
31505
  throw new ValidationError(`Managed process not found: ${id}`);
31425
31506
  }
31426
31507
  });
31427
- launch.command("restart <id>").description("Restart a managed process.").action(async function(id) {
31508
+ launch.command("restart").description("Restart a managed process.").argument("<id>", "Managed process identifier").action(async function(id) {
31428
31509
  await restartLaunch({ homeDir: container.env.homeDir, id });
31429
31510
  });
31430
31511
  launch.command("status").description("List managed processes.").action(async function() {
@@ -31449,7 +31530,7 @@ function registerLaunchCommand(program, container) {
31449
31530
  theme: getTheme()
31450
31531
  }));
31451
31532
  });
31452
- launch.command("logs <id>").description("Show managed process logs.").option("--follow", "Follow log output").option("--lines <n>", "Number of lines to show", "50").option("--stderr", "Show stderr instead of stdout").action(async function(id) {
31533
+ launch.command("logs").description("Show managed process logs.").argument("<id>", "Managed process identifier").option("--follow", "Follow log output").option("--lines <n>", "Number of lines to show", "50").option("--stderr", "Show stderr instead of stdout").action(async function(id) {
31453
31534
  const options = this.opts();
31454
31535
  const lines = parseNonNegativeInt2(options.lines, "lines") ?? 50;
31455
31536
  const stream = options.stderr ? "stderr" : "stdout";
@@ -31488,10 +31569,10 @@ function registerLaunchCommand(program, container) {
31488
31569
  process.removeListener("SIGTERM", stop);
31489
31570
  }
31490
31571
  });
31491
- launch.command("rm <id>").description("Remove managed process state and logs.").action(async function(id) {
31572
+ launch.command("rm").description("Remove managed process state and logs.").argument("<id>", "Managed process identifier").action(async function(id) {
31492
31573
  await removeLaunch({ homeDir: container.env.homeDir, id });
31493
31574
  });
31494
- launch.command("__run <id>", { hidden: true }).action(async function(id) {
31575
+ launch.command("__run", { hidden: true }).argument("<id>", "Managed process identifier").action(async function(id) {
31495
31576
  await runLaunchDaemon({ homeDir: container.env.homeDir, id });
31496
31577
  });
31497
31578
  return launch;
@@ -31769,7 +31850,7 @@ function formatUptime(state) {
31769
31850
  return `${seconds}s`;
31770
31851
  }
31771
31852
  function createChoiceOption(flags, description, choices, defaultValue) {
31772
- const option = new Option2(flags, description).choices(choices);
31853
+ const option = new Option3(flags, description).choices(choices);
31773
31854
  if (defaultValue !== void 0) {
31774
31855
  option.default(defaultValue);
31775
31856
  }
@@ -31821,7 +31902,7 @@ var init_package = __esm({
31821
31902
  "package.json"() {
31822
31903
  package_default = {
31823
31904
  name: "poe-code",
31824
- version: "3.0.153",
31905
+ version: "3.0.155",
31825
31906
  description: "CLI tool to configure Poe API for developer workflows.",
31826
31907
  type: "module",
31827
31908
  main: "./dist/index.js",
@@ -31836,7 +31917,7 @@ var init_package = __esm({
31836
31917
  "codegen:check:python-types": "tsx scripts/generate-agent-spawn-py-types.ts --check",
31837
31918
  "install:py-poe-spawn": "pip install -e packages/py-poe-spawn",
31838
31919
  predev: "turbo run build --output-logs=none --log-prefix=none --verbosity=0 > /dev/null 2>&1",
31839
- dev: "tsx src/index.ts",
31920
+ dev: "tsx --import ./scripts/register-hbs-loader.mjs src/index.ts",
31840
31921
  start: "node dist/bin.cjs",
31841
31922
  "dev:bundle": "npm run build && node dist/bin.cjs",
31842
31923
  test: "turbo run test:unit",
@@ -31996,181 +32077,106 @@ function formatCommandHeader(cmd) {
31996
32077
  }
31997
32078
  return `Poe - ${parts.reverse().join(" ")}`;
31998
32079
  }
31999
- function formatHelpText(input) {
32000
- const commandRows = [
32001
- {
32002
- name: "install",
32003
- aliases: ["i"],
32004
- args: "[agent]",
32005
- description: "Install agent binary for a configured agent"
32006
- },
32007
- {
32008
- name: "configure",
32009
- aliases: ["c"],
32010
- args: "[agent]",
32011
- description: "Configure a coding agent"
32012
- },
32013
- {
32014
- name: "unconfigure",
32015
- aliases: ["uc"],
32016
- args: "<agent>",
32017
- description: "Remove a previously applied configuration"
32018
- },
32019
- {
32020
- name: "login",
32021
- aliases: [],
32022
- args: "",
32023
- description: "Store a Poe API key"
32024
- },
32025
- {
32026
- name: "logout",
32027
- aliases: [],
32028
- args: "",
32029
- description: "Remove all configuration"
32030
- },
32031
- {
32032
- name: "auth status",
32033
- aliases: [],
32034
- args: "",
32035
- description: "Show login status"
32036
- },
32037
- {
32038
- name: "agent",
32039
- aliases: [],
32040
- args: "<prompt>",
32041
- description: "Run a one-shot Poe agent prompt"
32042
- },
32043
- {
32044
- name: "spawn",
32045
- aliases: ["s"],
32046
- args: "<agent> [prompt]",
32047
- description: "Launch a coding agent"
32048
- },
32049
- {
32050
- name: "wrap",
32051
- aliases: ["w"],
32052
- args: "<agent> [agentArgs...]",
32053
- description: "Run an agent with Poe isolated configuration"
32054
- },
32055
- {
32056
- name: "generate",
32057
- aliases: ["g"],
32058
- args: "[type]",
32059
- description: "Call Poe models via CLI (text/image/video/audio)"
32060
- },
32061
- {
32062
- name: "models",
32063
- aliases: ["m"],
32064
- args: "",
32065
- description: "List available Poe API models"
32066
- },
32067
- {
32068
- name: "mcp configure",
32069
- aliases: [],
32070
- args: "[agent]",
32071
- description: "Configure Poe MCP for your coding agent"
32072
- },
32073
- {
32074
- name: "mcp unconfigure",
32075
- aliases: [],
32076
- args: "<agent>",
32077
- description: "Remove Poe MCP configuration from your agent"
32078
- },
32079
- {
32080
- name: "experiment install",
32081
- aliases: [],
32082
- args: "[agent]",
32083
- description: "Install the experiment skill into agent configuration"
32084
- },
32085
- {
32086
- name: "skill configure",
32087
- aliases: [],
32088
- args: "[agent]",
32089
- description: "Configure agent skills to call Poe models"
32090
- },
32091
- {
32092
- name: "skill unconfigure",
32093
- aliases: [],
32094
- args: "[agent]",
32095
- description: "Remove agent skills configuration"
32096
- },
32097
- {
32098
- name: "pipeline install",
32099
- aliases: [],
32100
- args: "[agent]",
32101
- description: "Install pipeline skill into agent configuration"
32102
- },
32103
- {
32104
- name: "pipeline run",
32105
- aliases: [],
32106
- args: "",
32107
- description: "Run a fixed-step task pipeline plan"
32108
- },
32109
- {
32110
- name: "ralph init",
32111
- aliases: [],
32112
- args: "[doc]",
32113
- description: "Write Ralph config into a markdown doc frontmatter"
32114
- },
32115
- {
32116
- name: "ralph run",
32117
- aliases: [],
32118
- args: "[doc]",
32119
- description: "Run a markdown doc through repeated agent iterations"
32120
- },
32121
- {
32122
- name: "experiment run",
32123
- aliases: [],
32124
- args: "[doc]",
32125
- description: "Run an experiment doc through the autonomous experiment loop"
32126
- },
32127
- {
32128
- name: "experiment journal",
32129
- aliases: [],
32130
- args: "[doc]",
32131
- description: "Display an experiment journal as a formatted table"
32132
- },
32133
- {
32134
- name: "launch",
32135
- aliases: [],
32136
- args: "",
32137
- description: "Manage long-running host and Docker processes"
32138
- },
32139
- {
32140
- name: "github-workflows",
32141
- aliases: ["gh"],
32142
- args: "[automation]",
32143
- description: "GitHub workflow automations"
32144
- },
32145
- {
32146
- name: "usage",
32147
- aliases: ["u"],
32148
- args: "",
32149
- description: "Display current Poe compute points balance"
32150
- },
32151
- {
32152
- name: "usage list",
32153
- aliases: [],
32154
- args: "",
32155
- description: "Display usage history"
32156
- },
32157
- {
32158
- name: "utils config",
32159
- aliases: [],
32160
- args: "",
32161
- description: "Show config file paths and usage hints"
32080
+ function findCommandByPath(root, path43) {
32081
+ let current = root;
32082
+ for (const segment of path43) {
32083
+ const next = current.commands.find(
32084
+ (command) => Reflect.get(command, "_hidden") !== true && command.name() === segment
32085
+ );
32086
+ if (!next) {
32087
+ throw new Error(`Root help command is missing: ${path43.join(" ")}`);
32162
32088
  }
32163
- ];
32089
+ current = next;
32090
+ }
32091
+ return current;
32092
+ }
32093
+ function formatRootHelpCommandName(path43, command) {
32094
+ const leaf = [command.name(), ...command.aliases()].join(", ");
32095
+ return path43.length > 1 ? [...path43.slice(0, -1), leaf].join(" ") : leaf;
32096
+ }
32097
+ function splitUsageParts(usage) {
32098
+ return usage.split(" ").map((part) => part.trim()).filter((part) => part.length > 0);
32099
+ }
32100
+ function formatUsage2(usage, excludedParts) {
32101
+ return splitUsageParts(usage).filter((part) => !excludedParts.includes(part)).join(" ");
32102
+ }
32103
+ function formatRootHelpCommandArgs(command) {
32104
+ return formatUsage2(command.usage(), ["[options]", "[command]"]);
32105
+ }
32106
+ function buildRootHelpRows(root) {
32107
+ return ROOT_HELP_COMMAND_SPECS.map((spec) => {
32108
+ const command = findCommandByPath(root, spec.path);
32109
+ return {
32110
+ name: formatRootHelpCommandName(spec.path, command),
32111
+ args: spec.args ?? formatRootHelpCommandArgs(command),
32112
+ description: command.description()
32113
+ };
32114
+ });
32115
+ }
32116
+ function formatCanonicalCommandPath(cmd) {
32117
+ const parts = [];
32118
+ let current = cmd;
32119
+ while (current) {
32120
+ const name = current.name();
32121
+ if (name.length > 0) {
32122
+ parts.push(name);
32123
+ }
32124
+ if (name === "poe-code") {
32125
+ break;
32126
+ }
32127
+ current = current.parent ?? null;
32128
+ }
32129
+ return parts.reverse().join(" ");
32130
+ }
32131
+ function formatCanonicalCommandUsage(cmd) {
32132
+ const usage = formatUsage2(cmd.usage(), ["[command]"]);
32133
+ const commandPath = formatCanonicalCommandPath(cmd);
32134
+ return usage.length > 0 ? `${commandPath} ${usage}` : commandPath;
32135
+ }
32136
+ function formatHelpItem(input) {
32137
+ const itemIndent = 2;
32138
+ const spacerWidth = 2;
32139
+ const indent = " ".repeat(itemIndent);
32140
+ if (!input.description) {
32141
+ return `${indent}${input.term}`;
32142
+ }
32143
+ const paddedTerm = input.term.padEnd(
32144
+ input.termWidth + input.term.length - input.helper.displayWidth(input.term)
32145
+ );
32146
+ const remainingWidth = (input.helper.helpWidth ?? 80) - input.termWidth - spacerWidth - itemIndent;
32147
+ const descriptionIndent = `${indent}${" ".repeat(spacerWidth)}`;
32148
+ if (remainingWidth < input.helper.minWidthToWrap) {
32149
+ const descriptionWidth = Math.max(1, (input.helper.helpWidth ?? 80) - itemIndent - spacerWidth);
32150
+ const formattedDescription2 = input.helper.preformatted(input.description) ? input.description : input.helper.boxWrap(input.description, descriptionWidth);
32151
+ return `${indent}${input.term}
32152
+ ${descriptionIndent}${formattedDescription2.replace(/\n/g, `
32153
+ ${descriptionIndent}`)}`;
32154
+ }
32155
+ let formattedDescription = input.description;
32156
+ if (!input.helper.preformatted(input.description)) {
32157
+ formattedDescription = input.helper.boxWrap(input.description, remainingWidth).replace(/\n/g, `
32158
+ ${" ".repeat(input.termWidth + spacerWidth)}`);
32159
+ }
32160
+ return `${indent}${paddedTerm}${" ".repeat(spacerWidth)}${formattedDescription.replace(/\n/g, `
32161
+ ${indent}`)}`;
32162
+ }
32163
+ function formatHelpText(input) {
32164
+ const commandRows = buildRootHelpRows(input.command);
32164
32165
  const nameWidth = Math.max(
32165
32166
  0,
32166
- ...commandRows.map((row) => [row.name, ...row.aliases].join(", ").length)
32167
+ ...commandRows.map((row) => row.name.length)
32167
32168
  );
32168
32169
  const argsWidth = Math.max(0, ...commandRows.map((row) => row.args.length));
32170
+ const termWidth = nameWidth + 1 + argsWidth;
32169
32171
  const cmd = (row) => {
32170
- const displayName = [row.name, ...row.aliases].join(", ");
32171
- const name = text.command(displayName.padEnd(nameWidth));
32172
+ const name = text.command(row.name.padEnd(nameWidth));
32172
32173
  const args = row.args.length > 0 ? text.argument(row.args.padEnd(argsWidth)) : " ".repeat(argsWidth);
32173
- return ` ${name} ${args} ${row.description}`;
32174
+ return formatHelpItem({
32175
+ term: `${name} ${args}`,
32176
+ termWidth,
32177
+ description: row.description,
32178
+ helper: input.helper
32179
+ });
32174
32180
  };
32175
32181
  return [
32176
32182
  text.heading(input.heading),
@@ -32190,23 +32196,16 @@ function formatHelpText(input) {
32190
32196
  }
32191
32197
  function formatSubcommandHelp(cmd, helper) {
32192
32198
  const termWidth = helper.padWidth(cmd, helper);
32193
- const itemIndentWidth = 2;
32194
- const itemSeparatorWidth = 2;
32195
- const padWidth = termWidth + itemSeparatorWidth;
32196
- const indent = " ".repeat(itemIndentWidth);
32197
- const formatItem = (term, description, style) => {
32198
- const padding = " ".repeat(Math.max(0, padWidth - term.length));
32199
- const styledTerm = `${style(term)}${padding}`;
32200
- if (!description) {
32201
- return style(term);
32202
- }
32203
- return `${styledTerm}${description}`;
32204
- };
32205
- const indentBlock = (value) => value.split("\n").map((line) => `${indent}${line}`).join("\n");
32206
- const formatList = (items) => items.map(indentBlock).join("\n");
32199
+ const formatItem = (term, description, style) => formatHelpItem({
32200
+ term: style(term),
32201
+ termWidth,
32202
+ description,
32203
+ helper
32204
+ });
32205
+ const formatList = (items) => items.join("\n");
32207
32206
  const output = [];
32208
32207
  output.push(text.heading(formatCommandHeader(cmd)), "");
32209
- output.push(`${text.section("Usage:")} ${text.usageCommand(helper.commandUsage(cmd))}`, "");
32208
+ output.push(`${text.section("Usage:")} ${text.usageCommand(formatCanonicalCommandUsage(cmd))}`, "");
32210
32209
  const commandDescription = helper.commandDescription(cmd);
32211
32210
  if (commandDescription.length > 0) {
32212
32211
  output.push(commandDescription, "");
@@ -32289,7 +32288,7 @@ function bootstrapProgram(container) {
32289
32288
  program.name("poe-code").description("Configure Poe API integrations for local developer tooling.").option("-y, --yes", "Accept defaults without prompting.").option("--dry-run", "Simulate commands without writing changes.").option("--verbose", "Show verbose logs.").helpOption("-h, --help", "Display help for command").showHelpAfterError(false).showSuggestionAfterError(true).configureHelp({
32290
32289
  formatHelp: (cmd, helper) => {
32291
32290
  if (cmd.name() === "poe-code") {
32292
- return formatHelpText({ heading, usageCommand, helpCommand });
32291
+ return formatHelpText({ command: cmd, heading, usageCommand, helpCommand, helper });
32293
32292
  }
32294
32293
  return formatSubcommandHelp(cmd, helper);
32295
32294
  }
@@ -32317,7 +32316,7 @@ function bootstrapProgram(container) {
32317
32316
  const originalArgv = [...process.argv];
32318
32317
  process.argv = buildCmdkitArgv(originalArgv, ghGroup);
32319
32318
  try {
32320
- await runCLI(ghGroup);
32319
+ await runCLI(ghGroup, { rootDisplayName: `Poe - ${ghGroup.name}`, rootUsageName: `${usageCommand} ${ghGroup.name}` });
32321
32320
  } finally {
32322
32321
  process.argv = originalArgv;
32323
32322
  }
@@ -32356,7 +32355,7 @@ function suppressCommanderOutput(command) {
32356
32355
  suppressCommanderOutput(child);
32357
32356
  }
32358
32357
  }
32359
- var FORWARDABLE_CMDKIT_FLAGS;
32358
+ var ROOT_HELP_COMMAND_SPECS, FORWARDABLE_CMDKIT_FLAGS;
32360
32359
  var init_program = __esm({
32361
32360
  async "src/cli/program.ts"() {
32362
32361
  "use strict";
@@ -32388,6 +32387,38 @@ var init_program = __esm({
32388
32387
  init_package();
32389
32388
  init_command_not_found();
32390
32389
  init_execution_context();
32390
+ ROOT_HELP_COMMAND_SPECS = [
32391
+ { path: ["install"] },
32392
+ { path: ["configure"] },
32393
+ { path: ["unconfigure"] },
32394
+ { path: ["login"] },
32395
+ { path: ["logout"] },
32396
+ { path: ["auth"] },
32397
+ { path: ["agent"] },
32398
+ { path: ["spawn"] },
32399
+ { path: ["wrap"] },
32400
+ { path: ["test"] },
32401
+ { path: ["generate"] },
32402
+ { path: ["models"] },
32403
+ { path: ["mcp", "configure"] },
32404
+ { path: ["mcp", "unconfigure"] },
32405
+ { path: ["skill", "configure"] },
32406
+ { path: ["skill", "unconfigure"] },
32407
+ { path: ["pipeline", "install"] },
32408
+ { path: ["pipeline", "run"] },
32409
+ { path: ["pipeline", "validate"] },
32410
+ { path: ["experiment", "install"] },
32411
+ { path: ["experiment", "run"] },
32412
+ { path: ["experiment", "journal"] },
32413
+ { path: ["experiment", "validate"] },
32414
+ { path: ["ralph", "init"] },
32415
+ { path: ["ralph", "run"] },
32416
+ { path: ["launch"] },
32417
+ { path: ["github-workflows"], args: "[automation]" },
32418
+ { path: ["usage"] },
32419
+ { path: ["usage", "list"] },
32420
+ { path: ["utils", "config"] }
32421
+ ];
32391
32422
  FORWARDABLE_CMDKIT_FLAGS = /* @__PURE__ */ new Set(["-y", "--yes", "--verbose"]);
32392
32423
  }
32393
32424
  });