poe-code 4.0.14 → 4.0.16

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
@@ -76143,19 +76143,6 @@ function buildPlanExplorerConfig(options) {
76143
76143
  }
76144
76144
  }
76145
76145
  ];
76146
- if (options.onCreatePlan !== void 0) {
76147
- actions.push({
76148
- id: "new",
76149
- key: "n",
76150
- primary: true,
76151
- label: "New plan",
76152
- predicate: () => options.onCreatePlan != null,
76153
- handler: async (ctx) => {
76154
- await ctx.suspendAnd(() => options.onCreatePlan());
76155
- await ctx.refresh();
76156
- }
76157
- });
76158
- }
76159
76146
  return {
76160
76147
  title: "Plans",
76161
76148
  rows: async () => rows,
@@ -76288,8 +76275,7 @@ async function runPlanBrowser(options) {
76288
76275
  plans,
76289
76276
  fs: options.fs,
76290
76277
  variables: options.variables ?? process.env,
76291
- onRefresh: discover,
76292
- onCreatePlan: options.onCreatePlan
76278
+ onRefresh: discover
76293
76279
  });
76294
76280
  await (options.runExplorerImpl ?? runExplorer)(config2);
76295
76281
  }
@@ -76993,20 +76979,6 @@ var init_SKILL_plan = __esm({
76993
76979
  // src/cli/commands/plan.ts
76994
76980
  import path93 from "node:path";
76995
76981
  import { stringify as stringifyYaml2 } from "yaml";
76996
- function buildPlanPrompt(options) {
76997
- const trimmedQuestion = options.question.trim();
76998
- const userSection = trimmedQuestion.length > 0 ? `User request: ${trimmedQuestion}` : `The user has not yet stated what they want to plan. Follow the skill's "If The Request Is Empty" instruction and ask: What do you want to plan?`;
76999
- return [
77000
- "Follow the skill below to draft a feature plan.",
77001
- "",
77002
- options.skillContent,
77003
- "",
77004
- "---",
77005
- "",
77006
- `Plan directory: ${options.planDirectory}`,
77007
- userSection
77008
- ].join("\n");
77009
- }
77010
76982
  function resolvePlanCommandOptions(command) {
77011
76983
  const localOptions = command.opts();
77012
76984
  const parentOptions = command.parent?.opts() ?? {};
@@ -77042,16 +77014,15 @@ function resolveKind(value) {
77042
77014
  }
77043
77015
  throw new ValidationError(`Invalid --kind value "${value}". Expected ${VALID_KINDS.join(", ")}.`);
77044
77016
  }
77045
- function createPlanBrowserOptions(container, options) {
77017
+ function createPlanBrowserOptions(container, kind) {
77046
77018
  return {
77047
77019
  cwd: container.env.cwd,
77048
77020
  homeDir: container.env.homeDir,
77049
77021
  configPath: container.env.configPath,
77050
77022
  projectConfigPath: container.env.projectConfigPath,
77051
77023
  fs: container.fs,
77052
- kind: options.kind,
77053
- variables: container.env.variables,
77054
- ...options.onCreatePlan ? { onCreatePlan: options.onCreatePlan } : {}
77024
+ kind,
77025
+ variables: container.env.variables
77055
77026
  };
77056
77027
  }
77057
77028
  function formatDate(timestamp) {
@@ -77258,11 +77229,7 @@ async function renderPlanList(container, options) {
77258
77229
  }
77259
77230
  if (plans.length === 0) {
77260
77231
  const scope = kind === void 0 ? "" : `${kind} `;
77261
- const kindFlag = kind === void 0 ? "" : ` --kind ${kind}`;
77262
- writeOutput(
77263
- format,
77264
- `No ${scope}plans found. Create one with poe-code plan${kindFlag} "<description>".`
77265
- );
77232
+ writeOutput(format, `No ${scope}plans found.`);
77266
77233
  return;
77267
77234
  }
77268
77235
  const table = withOutputFormat(
@@ -77371,71 +77338,30 @@ async function executePlanAction(options) {
77371
77338
  );
77372
77339
  }
77373
77340
  function registerPlanCommand(program, container) {
77374
- const plan = program.command("plan").description(
77375
- "Browse plans in an interactive explorer, or draft a new plan when given a question."
77376
- ).argument("[question]", "What you want to plan").option("--agent <name>", "Agent to run the plan session with").option(
77341
+ const plan = program.command("plan").alias("plans").description("Browse and manage plans.").usage("[options] [command]").allowExcessArguments().option(
77377
77342
  "--kind <kind>",
77378
77343
  "Filter by plan kind: plan, pipeline, experiment, ralph, superintendent, or superintendent-base"
77379
- ).action(async function(questionArg) {
77380
- const opts = this.opts();
77381
- const flags = resolveCommandFlags(program);
77382
- const kind = resolveKind(opts.kind);
77383
- const question = questionArg?.trim() ?? "";
77384
- if (question.length > 0) {
77344
+ ).action(async function() {
77345
+ if (this.args.length > 0) {
77385
77346
  const candidates = plan.commands.flatMap((command) => [
77386
77347
  command.name(),
77387
77348
  ...command.aliases()
77388
77349
  ]);
77389
- const suggestions = suggest2(question, candidates);
77390
- if (suggestions.length > 0) {
77391
- throwCommandNotFound({
77392
- container,
77393
- scope: "cli",
77394
- unknownCommand: question,
77395
- helpArgs: ["plan", "--help"],
77396
- candidates,
77397
- moduleUrl: import.meta.url
77398
- });
77399
- }
77400
- const agent3 = await resolvePlanSessionAgent(
77401
- container,
77402
- opts.agent,
77403
- flags,
77404
- container.loggerFactory.create({ dryRun: flags.dryRun, verbose: flags.verbose, scope: "plan" })
77405
- );
77406
- if (agent3 === null) {
77407
- return;
77408
- }
77409
- await runPlanSession({
77350
+ throwCommandNotFound({
77410
77351
  container,
77411
- agent: agent3,
77412
- question,
77413
- dryRun: flags.dryRun
77352
+ scope: "cli",
77353
+ unknownCommand: this.args.at(0) ?? "",
77354
+ helpArgs: ["plan", "--help"],
77355
+ candidates,
77356
+ moduleUrl: import.meta.url
77414
77357
  });
77415
- return;
77416
- }
77417
- if (flags.assumeYes) {
77418
- throw new ValidationError(
77419
- "A question is required for `poe-code plan`. Pass it as the first argument."
77420
- );
77421
77358
  }
77359
+ const opts = this.opts();
77360
+ const flags = resolveCommandFlags(program);
77361
+ const kind = resolveKind(opts.kind);
77422
77362
  await requirePlanBrowsingPrompt({ container, kind, assumeYes: flags.assumeYes });
77423
77363
  intro("plan");
77424
- await runPlanBrowser(
77425
- createPlanBrowserOptions(container, {
77426
- kind,
77427
- onCreatePlan: () => runPlanSessionWithPrompt(
77428
- container,
77429
- opts.agent,
77430
- flags,
77431
- container.loggerFactory.create({
77432
- dryRun: flags.dryRun,
77433
- verbose: flags.verbose,
77434
- scope: "plan"
77435
- })
77436
- )
77437
- })
77438
- );
77364
+ await runPlanBrowser(createPlanBrowserOptions(container, kind));
77439
77365
  });
77440
77366
  plan.command("browse").description("Browse plans in the interactive explorer, or render one plan when given a path.").argument("[path]", "Plan path to render instead of opening the explorer").option(
77441
77367
  "--kind <kind>",
@@ -77459,7 +77385,7 @@ function registerPlanCommand(program, container) {
77459
77385
  }
77460
77386
  await requirePlanBrowsingPrompt({ container, kind, assumeYes: flags.assumeYes });
77461
77387
  intro("plan browser");
77462
- await runPlanBrowser(createPlanBrowserOptions(container, { kind }));
77388
+ await runPlanBrowser(createPlanBrowserOptions(container, kind));
77463
77389
  });
77464
77390
  plan.command("list").description("List plans across all plan systems.").option(
77465
77391
  "--kind <kind>",
@@ -77597,13 +77523,7 @@ function registerPlanCommand(program, container) {
77597
77523
  });
77598
77524
  plan.command("install").description("Install the /plan five-levels skill.").option("--agent <name>", "Agent to install the plan skill for").option("--local", "Install project-local skill").option("--global", "Install user-global skill").action(async function() {
77599
77525
  const flags = resolveCommandFlags(program);
77600
- const localOptions = this.opts();
77601
- const parentOptions = this.parent?.opts() ?? {};
77602
- const options = {
77603
- agent: localOptions.agent ?? parentOptions.agent,
77604
- local: localOptions.local,
77605
- global: localOptions.global
77606
- };
77526
+ const options = this.opts();
77607
77527
  if (options.local && options.global) {
77608
77528
  throw new ValidationError("Use either --local or --global, not both.");
77609
77529
  }
@@ -77652,78 +77572,13 @@ function registerPlanCommand(program, container) {
77652
77572
  setHelpGuidance(plan, {
77653
77573
  examples: [
77654
77574
  "poe-code plan",
77655
- 'poe-code plan "add retries to the spawn runtime"',
77575
+ "poe-code plans",
77656
77576
  "poe-code plan --kind pipeline",
77657
77577
  "poe-code plan list --kind experiment",
77658
77578
  "poe-code plan view docs/plans/my-plan.md",
77659
77579
  "poe-code plan install --local"
77660
77580
  ],
77661
- notes: [
77662
- "Interactive explorer keys: e edit, a archive, d delete, n new."
77663
- ]
77664
- });
77665
- }
77666
- async function resolvePlanQuestion(value, assumeYes) {
77667
- const trimmed = value?.trim() ?? "";
77668
- if (trimmed.length > 0) {
77669
- return trimmed;
77670
- }
77671
- if (assumeYes) {
77672
- throw new ValidationError(
77673
- "A question is required for `poe-code plan`. Pass it as the first argument."
77674
- );
77675
- }
77676
- requireInteractiveStdin(
77677
- "Plan question prompt requires a question when running without an interactive TTY."
77678
- );
77679
- const entered = await text2({
77680
- message: "What do you want to plan?"
77681
- });
77682
- if (isCancel(entered)) {
77683
- cancel("Plan session cancelled.");
77684
- return null;
77685
- }
77686
- const question = typeof entered === "string" ? entered.trim() : "";
77687
- if (question.length === 0) {
77688
- throw new ValidationError("A question is required for `poe-code plan`.");
77689
- }
77690
- return question;
77691
- }
77692
- async function resolvePlanSessionAgent(container, value, flags, logger2) {
77693
- const trimmed = value?.trim() ?? "";
77694
- if (trimmed.length > 0) {
77695
- return trimmed;
77696
- }
77697
- if (flags.assumeYes) {
77698
- return await resolveAssumedDefaultAgent({ container, logger: logger2, readOnly: flags.dryRun });
77699
- }
77700
- requireInteractiveStdin(
77701
- "Plan session agent selection requires --agent or --yes when running without an interactive TTY."
77702
- );
77703
- const selected = await select({
77704
- message: "Select agent to draft the plan with:",
77705
- options: supportedAgents2.map((name) => ({ value: name, label: name }))
77706
- });
77707
- if (isCancel(selected)) {
77708
- cancel("Plan session cancelled.");
77709
- return null;
77710
- }
77711
- return selected;
77712
- }
77713
- async function runPlanSessionWithPrompt(container, agentValue, flags, logger2) {
77714
- const question = await resolvePlanQuestion(void 0, flags.assumeYes);
77715
- if (question === null) {
77716
- return;
77717
- }
77718
- const agent3 = await resolvePlanSessionAgent(container, agentValue, flags, logger2);
77719
- if (agent3 === null) {
77720
- return;
77721
- }
77722
- await runPlanSession({
77723
- container,
77724
- agent: agent3,
77725
- question,
77726
- dryRun: flags.dryRun
77581
+ notes: ["Interactive explorer keys: e edit, a archive, d delete."]
77727
77582
  });
77728
77583
  }
77729
77584
  async function resolvePlanDirectory4(container, options = {}) {
@@ -77740,36 +77595,6 @@ async function resolvePlanDirectory4(container, options = {}) {
77740
77595
  );
77741
77596
  return config2.plan_directory;
77742
77597
  }
77743
- async function runPlanSession(options) {
77744
- const planDirectory = await resolvePlanDirectory4(options.container, { readOnly: options.dryRun });
77745
- const prompt = buildPlanPrompt({
77746
- question: options.question,
77747
- planDirectory,
77748
- skillContent: SKILL_plan_default
77749
- });
77750
- if (options.dryRun) {
77751
- const resources = createExecutionResources(
77752
- options.container,
77753
- { assumeYes: true, dryRun: true, verbose: false },
77754
- "plan"
77755
- );
77756
- resources.logger.dryRun(
77757
- `Dry run: would run plan session with ${options.agent} for ${options.question}.`
77758
- );
77759
- return;
77760
- }
77761
- requireInteractiveStdin(
77762
- "A plan session runs the agent interactively and requires an interactive TTY. Use `poe-code spawn` to draft a plan non-interactively."
77763
- );
77764
- const { result } = spawn9(options.agent, prompt, {
77765
- interactive: true,
77766
- cwd: options.container.env.cwd
77767
- });
77768
- const final = await result;
77769
- if (final.exitCode !== 0) {
77770
- process.exitCode = final.exitCode;
77771
- }
77772
- }
77773
77598
  async function resolvePlanAgent(container, value, flags, logger2) {
77774
77599
  const trimmed = value?.trim() ?? "";
77775
77600
  if (trimmed.length > 0) {
@@ -77820,7 +77645,7 @@ async function resolvePlanScope(options, assumeYes, logger2) {
77820
77645
  }
77821
77646
  var DEFAULT_PLAN_SCOPE, VALID_KINDS;
77822
77647
  var init_plan = __esm({
77823
- async "src/cli/commands/plan.ts"() {
77648
+ "src/cli/commands/plan.ts"() {
77824
77649
  "use strict";
77825
77650
  init_src2();
77826
77651
  init_src34();
@@ -77834,7 +77659,6 @@ var init_plan = __esm({
77834
77659
  init_errors2();
77835
77660
  init_config5();
77836
77661
  init_shared();
77837
- await init_spawn4();
77838
77662
  init_SKILL_plan();
77839
77663
  DEFAULT_PLAN_SCOPE = "local";
77840
77664
  VALID_KINDS = [
@@ -78001,10 +77825,10 @@ function isMissingDirectory(error3) {
78001
77825
  return hasOwnErrorCode21(error3, "ENOENT") || hasOwnErrorCode21(error3, "ENOTDIR");
78002
77826
  }
78003
77827
  var init_pipeline_init = __esm({
78004
- async "src/cli/commands/pipeline-init.ts"() {
77828
+ "src/cli/commands/pipeline-init.ts"() {
78005
77829
  "use strict";
78006
77830
  init_src12();
78007
- await init_plan();
77831
+ init_plan();
78008
77832
  init_error_codes18();
78009
77833
  }
78010
77834
  });
@@ -78222,7 +78046,7 @@ var init_pipeline3 = __esm({
78222
78046
  async "src/sdk/pipeline.ts"() {
78223
78047
  "use strict";
78224
78048
  init_src31();
78225
- await init_pipeline_init();
78049
+ init_pipeline_init();
78226
78050
  init_SKILL_plan2();
78227
78051
  await init_spawn4();
78228
78052
  init_worktree();
@@ -107493,7 +107317,7 @@ var init_pipeline5 = __esm({
107493
107317
  init_errors2();
107494
107318
  init_subcommand_required();
107495
107319
  init_error_codes18();
107496
- await init_pipeline_init();
107320
+ init_pipeline_init();
107497
107321
  init_shared();
107498
107322
  init_help_guidance();
107499
107323
  init_pipeline_loop_agent();
@@ -110181,7 +110005,7 @@ function parseLimit2(value) {
110181
110005
  return limit;
110182
110006
  }
110183
110007
  function registerTracesCommand(program, container) {
110184
- program.command("traces").description(
110008
+ program.command("traces").alias("trace").description(
110185
110009
  "Browse claude, codex, pi and poe-code agent traces with context usage and breakdown."
110186
110010
  ).argument("[path]", "Path to a trace file").option("--source <sources...>", "Trace sources: claude, codex, pi, poe-code").option("--all-workspaces", "Read traces from every workspace, not just cwd").option("--since <duration>", "Only include recently updated traces").option("--limit <n>", "Maximum traces listed").option("--json", jsonOptionDescription).option("--full-titles", "Print untruncated trace titles, which may contain prompt content").option("--open", "Generate HTML for a trace path and open it in the browser").option("--html-out <file>", "Write HTML for a trace path without opening").action(async function(pathArg) {
110187
110011
  const options = this.opts();
@@ -151235,7 +151059,7 @@ var init_gaslight2 = __esm({
151235
151059
  init_src2();
151236
151060
  init_gaslight();
151237
151061
  await init_spawn4();
151238
- await init_plan();
151062
+ init_plan();
151239
151063
  init_shared();
151240
151064
  init_configure();
151241
151065
  init_errors2();
@@ -151341,7 +151165,7 @@ var init_package2 = __esm({
151341
151165
  "package.json"() {
151342
151166
  package_default2 = {
151343
151167
  name: "poe-code",
151344
- version: "4.0.14",
151168
+ version: "4.0.16",
151345
151169
  description: "CLI tool to configure Poe API for developer workflows.",
151346
151170
  license: "MIT",
151347
151171
  type: "module",
@@ -151717,8 +151541,12 @@ function formatCanonicalCommandPath(cmd) {
151717
151541
  return parts.reverse().join(" ");
151718
151542
  }
151719
151543
  function formatCanonicalCommandUsage(cmd) {
151544
+ const hasExplicitUsage = typeof Reflect.get(cmd, "_usage") === "string";
151720
151545
  const usageParts = splitUsageParts(cmd.usage()).flatMap((part) => {
151721
151546
  if (part === "[command]") {
151547
+ if (hasExplicitUsage) {
151548
+ return [part];
151549
+ }
151722
151550
  return cmd.registeredArguments.length === 0 ? ["<command>"] : [];
151723
151551
  }
151724
151552
  if (part === "[options]" && cmd.options.length === 0) {
@@ -152422,7 +152250,7 @@ var init_program = __esm({
152422
152250
  init_usage();
152423
152251
  init_models2();
152424
152252
  await init_pipeline5();
152425
- await init_plan();
152253
+ init_plan();
152426
152254
  init_traces();
152427
152255
  await init_ralph4();
152428
152256
  await init_experiment3();