poe-code 3.0.407 → 3.0.408

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
@@ -66414,7 +66414,7 @@ async function assertSafeConfigDeletion(fs30, filePath) {
66414
66414
  }
66415
66415
  }
66416
66416
  }
66417
- var coreConfigScope, ralphConfigScope, pipelineConfigScope, experimentConfigScope, planConfigScope2, agentConfigScope, knownConfigScopes, CORE_SCOPE2;
66417
+ var coreConfigScope, ralphConfigScope, pipelineConfigScope, gaslightConfigScope, experimentConfigScope, planConfigScope2, agentConfigScope, knownConfigScopes, CORE_SCOPE2;
66418
66418
  var init_config5 = __esm({
66419
66419
  "src/services/config.ts"() {
66420
66420
  "use strict";
@@ -66444,6 +66444,12 @@ var init_config5 = __esm({
66444
66444
  }
66445
66445
  });
66446
66446
  ralphConfigScope = defineScope("ralph", {
66447
+ archive: {
66448
+ type: "boolean",
66449
+ default: true,
66450
+ env: "POE_RALPH_ARCHIVE",
66451
+ doc: "Archive Ralph docs after successful completion"
66452
+ },
66447
66453
  tui: {
66448
66454
  type: "boolean",
66449
66455
  default: false,
@@ -66452,6 +66458,12 @@ var init_config5 = __esm({
66452
66458
  }
66453
66459
  });
66454
66460
  pipelineConfigScope = defineScope("pipeline", {
66461
+ archive: {
66462
+ type: "boolean",
66463
+ default: true,
66464
+ env: "POE_PIPELINE_ARCHIVE",
66465
+ doc: "Archive pipeline plans after successful completion"
66466
+ },
66455
66467
  plan_directory: {
66456
66468
  type: "string",
66457
66469
  default: ".poe-code/pipeline/plans",
@@ -66465,6 +66477,14 @@ var init_config5 = __esm({
66465
66477
  doc: "Enable the Pipeline dashboard by default for terminal TTY runs"
66466
66478
  }
66467
66479
  });
66480
+ gaslightConfigScope = defineScope("gaslight", {
66481
+ archive: {
66482
+ type: "boolean",
66483
+ default: false,
66484
+ env: "POE_GASLIGHT_ARCHIVE",
66485
+ doc: "Archive Gaslight plans after all follow-up rounds succeed"
66486
+ }
66487
+ });
66468
66488
  experimentConfigScope = defineScope("experiment", {
66469
66489
  tui: {
66470
66490
  type: "boolean",
@@ -66491,6 +66511,7 @@ var init_config5 = __esm({
66491
66511
  coreConfigScope,
66492
66512
  ralphConfigScope,
66493
66513
  pipelineConfigScope,
66514
+ gaslightConfigScope,
66494
66515
  experimentConfigScope,
66495
66516
  planConfigScope2,
66496
66517
  agentConfigScope,
@@ -72214,14 +72235,16 @@ async function runPipeline(options) {
72214
72235
  };
72215
72236
  }
72216
72237
  }
72217
- const id = planIdFromArchivePath(absolutePlanPath);
72218
- await archivePlan({
72219
- cwd,
72220
- homeDir,
72221
- planDirectory: configuredPlanDirectory ?? "docs/plans",
72222
- id,
72223
- fs: fs30
72224
- });
72238
+ if (options.archive !== false) {
72239
+ const id = planIdFromArchivePath(absolutePlanPath);
72240
+ await archivePlan({
72241
+ cwd,
72242
+ homeDir,
72243
+ planDirectory: configuredPlanDirectory ?? "docs/plans",
72244
+ id,
72245
+ fs: fs30
72246
+ });
72247
+ }
72225
72248
  }
72226
72249
  return {
72227
72250
  stopReason: runsCompleted === 0 ? "nothing_to_run" : "completed",
@@ -74047,15 +74070,17 @@ async function runRalph(options) {
74047
74070
  }
74048
74071
  if (stopReason === "max_iterations" && !archived && iterationsCompleted > 0) {
74049
74072
  await updateFrontmatter2(fs30, absoluteDocPath, "completed", iterationsCompleted);
74050
- const id = path88.basename(absoluteDocPath, ".md").replace(/^\d+-/, "");
74051
- await archivePlan({
74052
- cwd: options.cwd,
74053
- homeDir: options.homeDir,
74054
- planDirectory,
74055
- id,
74056
- fs: fs30
74057
- });
74058
- archived = true;
74073
+ if (options.archive !== false) {
74074
+ const id = path88.basename(absoluteDocPath, ".md").replace(/^\d+-/, "");
74075
+ await archivePlan({
74076
+ cwd: options.cwd,
74077
+ homeDir: options.homeDir,
74078
+ planDirectory,
74079
+ id,
74080
+ fs: fs30
74081
+ });
74082
+ archived = true;
74083
+ }
74059
74084
  } else if (stopReason === "cancelled" && !archived) {
74060
74085
  await updateFrontmatter2(fs30, absoluteDocPath, "open", iterationsCompleted);
74061
74086
  }
@@ -81843,7 +81868,9 @@ function validateConfig(value, configPath, options) {
81843
81868
  }
81844
81869
  const config2 = value;
81845
81870
  if (options.rejectExtraKeys) {
81846
- const extraKey = objectKeys(config2).find((key2) => key2 !== "prompt" && key2 !== "followups");
81871
+ const extraKey = objectKeys(config2).find(
81872
+ (key2) => key2 !== "prompt" && key2 !== "followups" && key2 !== "archive"
81873
+ );
81847
81874
  if (extraKey) {
81848
81875
  throw new Error(`Invalid gaslight config at ${configPath}: unexpected key "${extraKey}".`);
81849
81876
  }
@@ -81858,9 +81885,13 @@ function validateConfig(value, configPath, options) {
81858
81885
  `Invalid gaslight config at ${configPath}: followups must be a non-empty array of non-empty strings.`
81859
81886
  );
81860
81887
  }
81888
+ if (config2.archive !== void 0 && typeof config2.archive !== "boolean") {
81889
+ throw new Error(`Invalid gaslight config at ${configPath}: archive must be a boolean.`);
81890
+ }
81861
81891
  return {
81862
81892
  prompt: config2.prompt.trim(),
81863
- followups: config2.followups.map((followup) => followup.trim())
81893
+ followups: config2.followups.map((followup) => followup.trim()),
81894
+ ...config2.archive !== void 0 ? { archive: config2.archive } : {}
81864
81895
  };
81865
81896
  }
81866
81897
  async function loadGaslightConfig(cwd, homeDir, fs30 = nodeFs12, configPath) {
@@ -81902,6 +81933,7 @@ var init_config6 = __esm({
81902
81933
  "use strict";
81903
81934
  GASLIGHT_CONFIG_EXAMPLE = [
81904
81935
  "prompt: Implement",
81936
+ "archive: false",
81905
81937
  "followups:",
81906
81938
  " - Is this best you can do?",
81907
81939
  " - Did you test it well? Like real end to end test?",
@@ -83074,6 +83106,20 @@ function resolvePlanPath2(cwd, homeDir, planPath) {
83074
83106
  }
83075
83107
  return path117.resolve(cwd, planPath);
83076
83108
  }
83109
+ function planIdFromPath(planPath) {
83110
+ const stem = path117.basename(planPath, ".md");
83111
+ let index = 0;
83112
+ while (index < stem.length && stem.charCodeAt(index) >= 48 && stem.charCodeAt(index) <= 57) {
83113
+ index += 1;
83114
+ }
83115
+ if (index > 0 && stem[index] === "-" && index < stem.length - 1) {
83116
+ return stem.slice(index + 1);
83117
+ }
83118
+ return stem;
83119
+ }
83120
+ function archivedPlanPath(planPath) {
83121
+ return path117.join(path117.dirname(planPath), "archive", `${planIdFromPath(planPath)}.md`);
83122
+ }
83077
83123
  function validateInlineConfig(prompt, followups) {
83078
83124
  if (prompt === void 0 !== (followups === void 0)) {
83079
83125
  throw new Error("prompt and followups must be provided together.");
@@ -83136,6 +83182,7 @@ async function runGaslight(options) {
83136
83182
  await requirePlan(fs30, resolvePlanPath2(cwd, homeDir, planPath), planPath);
83137
83183
  }
83138
83184
  const config2 = options.prompt !== void 0 && options.followups !== void 0 ? { prompt: options.prompt.trim(), followups: options.followups.map((value) => value.trim()) } : await loadGaslightConfig(cwd, homeDir, fs30, options.configPath);
83185
+ const shouldArchive = options.archive ?? config2.archive ?? false;
83139
83186
  const rounds = [];
83140
83187
  const plans = [];
83141
83188
  let usage;
@@ -83197,8 +83244,21 @@ async function runGaslight(options) {
83197
83244
  resumeThreadId = result.threadId;
83198
83245
  }
83199
83246
  }
83247
+ let archivedPath;
83248
+ if (shouldArchive) {
83249
+ const id = planIdFromPath(planPath);
83250
+ await archivePlan({
83251
+ cwd,
83252
+ homeDir,
83253
+ planDirectory: path117.dirname(planPath),
83254
+ id,
83255
+ fs: fs30
83256
+ });
83257
+ archivedPath = archivedPlanPath(planPath);
83258
+ }
83200
83259
  plans.push({
83201
83260
  planPath,
83261
+ ...archivedPath ? { archivedPath } : {},
83202
83262
  rounds: planRounds,
83203
83263
  ...planUsage ? { usage: planUsage } : {}
83204
83264
  });
@@ -83209,6 +83269,7 @@ var init_run3 = __esm({
83209
83269
  "packages/agent-gaslight/src/run.ts"() {
83210
83270
  "use strict";
83211
83271
  init_src17();
83272
+ init_src12();
83212
83273
  init_config6();
83213
83274
  }
83214
83275
  });
@@ -101219,6 +101280,7 @@ async function resolvePipelineCommandConfig(container, options = {}) {
101219
101280
  return {
101220
101281
  configDoc,
101221
101282
  planDirectory,
101283
+ archive: pipelineConfig.archive === true,
101222
101284
  tui: pipelineConfig.tui === true
101223
101285
  };
101224
101286
  }
@@ -101360,7 +101422,7 @@ async function dryRunPipelinePlans(options) {
101360
101422
  options.resources.logger.dryRun(
101361
101423
  `Tasks: ${summary.done} done, ${summary.failed} failed, ${summary.open} open`
101362
101424
  );
101363
- if (summary.open === 0 && summary.failed === 0 && summary.total > 0) {
101425
+ if (summary.open === 0 && summary.failed === 0 && summary.total > 0 && options.archive) {
101364
101426
  options.resources.logger.dryRun(`Would archive after completion: ${planPath}`);
101365
101427
  }
101366
101428
  }
@@ -101781,7 +101843,7 @@ function registerPipelineCommand(program, container) {
101781
101843
  const pipeline = program.command("pipeline").description("Run a fixed-step task pipeline plan.").addHelpCommand(false);
101782
101844
  addWorktreeOptions(pipeline.command("run").description(
101783
101845
  "Run the selected pipeline plan until completion, failure, cancellation, or max runs."
101784
- ).option("--agent <name>", "Agent to run each pipeline step with").option("--model <model>", "Model override passed to the agent").option("--tui", "Show a live dashboard while the pipeline is running").option("--no-tui", "Disable the live dashboard for this pipeline run").option("--task <id>", "Run only the specified task").option("--plan <path>", "Path to the pipeline plan file").option("--plans <paths...>", "Paths to pipeline plan files to run sequentially").option("--max-runs <n>", "Maximum number of agent executions to perform")).action(async function() {
101846
+ ).option("--agent <name>", "Agent to run each pipeline step with").option("--model <model>", "Model override passed to the agent").option("--tui", "Show a live dashboard while the pipeline is running").option("--no-tui", "Disable the live dashboard for this pipeline run").option("--archive", "Archive each plan after successful completion").option("--no-archive", "Leave completed plans in place").option("--task <id>", "Run only the specified task").option("--plan <path>", "Path to the pipeline plan file").option("--plans <paths...>", "Paths to pipeline plan files to run sequentially").option("--max-runs <n>", "Maximum number of agent executions to perform")).action(async function() {
101785
101847
  const flags = resolveCommandFlags(program);
101786
101848
  const resources = createExecutionResources(container, flags, "pipeline:run");
101787
101849
  const options = this.opts();
@@ -101811,6 +101873,7 @@ function registerPipelineCommand(program, container) {
101811
101873
  container,
101812
101874
  resources,
101813
101875
  planPaths: planPaths2,
101876
+ archive: options.archive ?? commandConfig2.archive,
101814
101877
  ...maxRuns !== void 0 ? { maxRuns } : {},
101815
101878
  ...options.task ? { task: options.task } : {}
101816
101879
  });
@@ -101878,6 +101941,7 @@ function registerPipelineCommand(program, container) {
101878
101941
  ...options.model ? { model: options.model } : {},
101879
101942
  ...options.task ? { task: options.task } : {},
101880
101943
  plan: runPlanPath,
101944
+ archive: options.archive ?? commandConfig.archive,
101881
101945
  ...maxRuns != null ? { maxRuns } : {},
101882
101946
  assumeYes: flags.assumeYes
101883
101947
  };
@@ -102598,6 +102662,7 @@ async function resolveRalphCommandConfig(container, options = {}) {
102598
102662
  container.env.variables
102599
102663
  );
102600
102664
  return {
102665
+ archive: ralphConfig.archive === true,
102601
102666
  planDirectory: planConfig.plan_directory,
102602
102667
  tui: ralphConfig.tui === true
102603
102668
  };
@@ -102915,7 +102980,7 @@ function registerRalphCommand(program, container) {
102915
102980
  resources.context.finalize();
102916
102981
  }
102917
102982
  });
102918
- const run2 = ralph.command("run").description("Run the selected markdown doc through repeated agent iterations.").argument("[doc]", "Markdown doc path").option("--agent <name>", "Override the agent from frontmatter").option("--iterations <n>", "Override iterations from frontmatter").option("-C, --cwd <path>", "Working directory for the Ralph agent loop").option("--tui", "Show a live dashboard while Ralph is running").option("--no-tui", "Disable the live dashboard for this Ralph run");
102983
+ const run2 = ralph.command("run").description("Run the selected markdown doc through repeated agent iterations.").argument("[doc]", "Markdown doc path").option("--agent <name>", "Override the agent from frontmatter").option("--iterations <n>", "Override iterations from frontmatter").option("-C, --cwd <path>", "Working directory for the Ralph agent loop").option("--archive", "Archive the doc after successful completion").option("--no-archive", "Leave the completed doc in place").option("--tui", "Show a live dashboard while Ralph is running").option("--no-tui", "Disable the live dashboard for this Ralph run");
102919
102984
  addRuntimeOptions(addWorktreeOptions(run2)).action(async function(docArg) {
102920
102985
  const flags = resolveCommandFlags(program);
102921
102986
  const resources = createExecutionResources(container, flags, "ralph:run");
@@ -102958,6 +103023,7 @@ function registerRalphCommand(program, container) {
102958
103023
  homeDir: container.env.homeDir,
102959
103024
  docPath,
102960
103025
  maxIterations: maxIterations2,
103026
+ archive: options.archive ?? commandConfig.archive,
102961
103027
  runtimeConfigCwd: container.env.cwd,
102962
103028
  worktree: pickWorktreeOptions2(options),
102963
103029
  ...runtimeOptions
@@ -141735,6 +141801,21 @@ var init_tasks2 = __esm({
141735
141801
  // src/cli/commands/gaslight.ts
141736
141802
  import path179 from "node:path";
141737
141803
  import { Option as Option9 } from "commander";
141804
+ async function resolveGaslightCommandConfig(container) {
141805
+ const configDoc = await readMergedDocumentReadonly(
141806
+ container.fs,
141807
+ container.env.configPath,
141808
+ container.env.projectConfigPath
141809
+ );
141810
+ const rawGaslightConfig = configDoc[gaslightConfigScope.scope];
141811
+ const hasArchiveConfig = typeof rawGaslightConfig === "object" && rawGaslightConfig !== null && "archive" in rawGaslightConfig || container.env.variables.POE_GASLIGHT_ARCHIVE !== void 0;
141812
+ const gaslightConfig = resolveScope(
141813
+ gaslightConfigScope.schema,
141814
+ rawGaslightConfig,
141815
+ container.env.variables
141816
+ );
141817
+ return hasArchiveConfig ? { archive: gaslightConfig.archive === true } : {};
141818
+ }
141738
141819
  function resolveConfiguredPath(cwd, homeDir, value) {
141739
141820
  if (value.startsWith("~/")) {
141740
141821
  return path179.join(homeDir, value.slice(2));
@@ -141928,7 +142009,7 @@ async function scaffoldConfig(container, scope, force, dryRun) {
141928
142009
  return { path: configPath, changed: true };
141929
142010
  }
141930
142011
  function registerGaslightCommand(program, container) {
141931
- const gaslight = addWorktreeOptions(program.command("gaslight").description("Run a plan through a resumable sequence of agent follow-ups.").argument("[plan-path]", "Markdown plan to implement").option("--agent <agent>", "Agent to run").option("--config <path>", "gaslight.yaml variant to use").option("--model <model>", "Model to run").option("--plans <paths...>", "Markdown plans to run sequentially").addOption(
142012
+ const gaslight = addWorktreeOptions(program.command("gaslight").description("Run a plan through a resumable sequence of agent follow-ups.").argument("[plan-path]", "Markdown plan to implement").option("--agent <agent>", "Agent to run").option("--archive", "Archive each plan after all gaslight rounds succeed").option("--no-archive", "Leave plans in place after gaslight rounds succeed").option("--config <path>", "gaslight.yaml variant to use").option("--model <model>", "Model to run").option("--plans <paths...>", "Markdown plans to run sequentially").addOption(
141932
142013
  new Option9("--mode <mode>", "Spawn mode").choices(["read", "edit", "yolo", "auto"]).default("auto")
141933
142014
  )).action(async function(providedPlanPath) {
141934
142015
  const flags = resolveCommandFlags(program);
@@ -141939,6 +142020,7 @@ function registerGaslightCommand(program, container) {
141939
142020
  positionalPlanPath: providedPlanPath,
141940
142021
  optionPlanPaths: options.plans
141941
142022
  });
142023
+ const commandConfig = await resolveGaslightCommandConfig(container);
141942
142024
  const { agent: agent3, model } = await resolveAgentAndModel(program, container, options);
141943
142025
  const logger2 = container.loggerFactory.create();
141944
142026
  intro("gaslight");
@@ -141947,6 +142029,7 @@ function registerGaslightCommand(program, container) {
141947
142029
  agent: agent3,
141948
142030
  ...model ? { model } : {},
141949
142031
  ...options.config ? { configPath: options.config } : {},
142032
+ archive: options.archive ?? commandConfig.archive,
141950
142033
  mode: options.mode ?? "auto",
141951
142034
  cwd: container.env.cwd,
141952
142035
  homeDir: container.env.homeDir,
@@ -142038,6 +142121,7 @@ var init_gaslight2 = __esm({
142038
142121
  "use strict";
142039
142122
  init_src7();
142040
142123
  init_src17();
142124
+ init_src9();
142041
142125
  init_src2();
142042
142126
  init_gaslight();
142043
142127
  await init_spawn5();
@@ -142047,6 +142131,7 @@ var init_gaslight2 = __esm({
142047
142131
  init_errors();
142048
142132
  init_error_codes18();
142049
142133
  init_worktree_options();
142134
+ init_config5();
142050
142135
  DEFAULT_AGENT = "claude-code";
142051
142136
  DEFAULT_SCOPE = "local";
142052
142137
  }
@@ -142122,7 +142207,7 @@ var init_package2 = __esm({
142122
142207
  "package.json"() {
142123
142208
  package_default2 = {
142124
142209
  name: "poe-code",
142125
- version: "3.0.407",
142210
+ version: "3.0.408",
142126
142211
  description: "CLI tool to configure Poe API for developer workflows.",
142127
142212
  type: "module",
142128
142213
  main: "./dist/index.js",