poe-code 3.0.148 → 3.0.150

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
@@ -925,16 +925,16 @@ function getConfigFormat(pathOrFormat) {
925
925
  }
926
926
  return formatRegistry[formatName];
927
927
  }
928
- function detectFormat(path42) {
929
- const ext = getExtension(path42);
928
+ function detectFormat(path43) {
929
+ const ext = getExtension(path43);
930
930
  return extensionMap[ext];
931
931
  }
932
- function getExtension(path42) {
933
- const lastDot = path42.lastIndexOf(".");
932
+ function getExtension(path43) {
933
+ const lastDot = path43.lastIndexOf(".");
934
934
  if (lastDot === -1) {
935
935
  return "";
936
936
  }
937
- return path42.slice(lastDot).toLowerCase();
937
+ return path43.slice(lastDot).toLowerCase();
938
938
  }
939
939
  var formatRegistry, extensionMap;
940
940
  var init_formats = __esm({
@@ -1989,38 +1989,38 @@ import { createTwoFilesPatch } from "diff";
1989
1989
  import chalk from "chalk";
1990
1990
  function createDryRunFileSystem(base, recorder) {
1991
1991
  const proxy = {
1992
- async readFile(path42, encoding) {
1992
+ async readFile(path43, encoding) {
1993
1993
  if (encoding) {
1994
- return base.readFile(path42, encoding);
1994
+ return base.readFile(path43, encoding);
1995
1995
  }
1996
- return base.readFile(path42);
1996
+ return base.readFile(path43);
1997
1997
  },
1998
- async writeFile(path42, data, options) {
1999
- const previousContent = await tryReadText(base, path42);
1998
+ async writeFile(path43, data, options) {
1999
+ const previousContent = await tryReadText(base, path43);
2000
2000
  const nextContent = formatData(data, options?.encoding);
2001
2001
  recorder.record({
2002
2002
  type: "writeFile",
2003
- path: path42,
2003
+ path: path43,
2004
2004
  nextContent,
2005
2005
  previousContent
2006
2006
  });
2007
2007
  },
2008
- async mkdir(path42, options) {
2009
- recorder.record({ type: "mkdir", path: path42, options });
2008
+ async mkdir(path43, options) {
2009
+ recorder.record({ type: "mkdir", path: path43, options });
2010
2010
  },
2011
- async stat(path42) {
2012
- return base.stat(path42);
2011
+ async stat(path43) {
2012
+ return base.stat(path43);
2013
2013
  },
2014
- async unlink(path42) {
2015
- recorder.record({ type: "unlink", path: path42 });
2014
+ async unlink(path43) {
2015
+ recorder.record({ type: "unlink", path: path43 });
2016
2016
  },
2017
- async readdir(path42) {
2018
- return base.readdir(path42);
2017
+ async readdir(path43) {
2018
+ return base.readdir(path43);
2019
2019
  }
2020
2020
  };
2021
2021
  if (typeof base.rm === "function") {
2022
- proxy.rm = async (path42, options) => {
2023
- recorder.record({ type: "rm", path: path42, options });
2022
+ proxy.rm = async (path43, options) => {
2023
+ recorder.record({ type: "rm", path: path43, options });
2024
2024
  };
2025
2025
  }
2026
2026
  if (typeof base.copyFile === "function") {
@@ -2110,8 +2110,8 @@ function describeWriteChange(previous, next) {
2110
2110
  }
2111
2111
  return "update";
2112
2112
  }
2113
- function renderWriteCommand(path42, change) {
2114
- const command = `cat > ${path42}`;
2113
+ function renderWriteCommand(path43, change) {
2114
+ const command = `cat > ${path43}`;
2115
2115
  if (change === "create") {
2116
2116
  return renderOperationCommand(command, chalk.green, "# create");
2117
2117
  }
@@ -2273,9 +2273,9 @@ function redactTomlLine(line) {
2273
2273
  }
2274
2274
  return line;
2275
2275
  }
2276
- async function tryReadText(base, path42) {
2276
+ async function tryReadText(base, path43) {
2277
2277
  try {
2278
- return await base.readFile(path42, "utf8");
2278
+ return await base.readFile(path43, "utf8");
2279
2279
  } catch (error2) {
2280
2280
  if (isNotFound(error2)) {
2281
2281
  return null;
@@ -8088,21 +8088,21 @@ async function* adaptClaude(lines) {
8088
8088
  if (blockType !== "tool_result") continue;
8089
8089
  const kind = toolKindsById.get(item.tool_use_id);
8090
8090
  toolKindsById.delete(item.tool_use_id);
8091
- let path42;
8091
+ let path43;
8092
8092
  if (typeof item.content === "string") {
8093
- path42 = item.content;
8093
+ path43 = item.content;
8094
8094
  } else {
8095
8095
  try {
8096
- path42 = JSON.stringify(item.content);
8096
+ path43 = JSON.stringify(item.content);
8097
8097
  } catch {
8098
- path42 = String(item.content);
8098
+ path43 = String(item.content);
8099
8099
  }
8100
8100
  }
8101
8101
  yield {
8102
8102
  event: "tool_complete",
8103
8103
  id: item.tool_use_id,
8104
8104
  kind,
8105
- path: path42
8105
+ path: path43
8106
8106
  };
8107
8107
  }
8108
8108
  }
@@ -8225,10 +8225,10 @@ async function* adaptCodex(lines) {
8225
8225
  const kindFromStart = toolKindById.get(item.id);
8226
8226
  const kind = kindFromStart ?? (itemType === "command_execution" ? "exec" : itemType === "file_edit" ? "edit" : "other");
8227
8227
  const titleFromEvent = isNonEmptyString(item.path) ? item.path : itemType === "mcp_tool_call" ? `${isNonEmptyString(item.server) ? item.server : "unknown"}.${isNonEmptyString(item.tool) ? item.tool : "unknown"}` : void 0;
8228
- const path42 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
8228
+ const path43 = titleFromEvent ?? toolTitleById.get(item.id) ?? "";
8229
8229
  toolTitleById.delete(item.id);
8230
8230
  toolKindById.delete(item.id);
8231
- yield { event: "tool_complete", id: item.id, kind, path: path42 };
8231
+ yield { event: "tool_complete", id: item.id, kind, path: path43 };
8232
8232
  }
8233
8233
  }
8234
8234
  }
@@ -9236,8 +9236,8 @@ function resourceNotFound(resource) {
9236
9236
  `Resource not found: ${resource}`
9237
9237
  );
9238
9238
  }
9239
- function assertAbsolutePath(path42) {
9240
- if (!isAbsolute(path42)) {
9239
+ function assertAbsolutePath(path43) {
9240
+ if (!isAbsolute(path43)) {
9241
9241
  throw invalidParams('"path" must be an absolute path');
9242
9242
  }
9243
9243
  }
@@ -10320,7 +10320,7 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
10320
10320
  }
10321
10321
  const id = readString(event.id);
10322
10322
  const kind = readString(event.kind);
10323
- const path42 = readString(event.path);
10323
+ const path43 = readString(event.path);
10324
10324
  let toolCall = id ? toolCallsById.get(id) : void 0;
10325
10325
  if (!toolCall) {
10326
10326
  toolCall = {};
@@ -10335,8 +10335,8 @@ function updateSessionFromEvent(ctx, event, toolCallsById) {
10335
10335
  if (kind) {
10336
10336
  toolCall.kind = kind;
10337
10337
  }
10338
- if (path42) {
10339
- toolCall.path = path42;
10338
+ if (path43) {
10339
+ toolCall.path = path43;
10340
10340
  }
10341
10341
  }
10342
10342
  var sessionCapture;
@@ -10806,14 +10806,14 @@ function parseDockerLocator(input) {
10806
10806
  throw new Error(`Invalid docker workspace locator "${input}".`);
10807
10807
  }
10808
10808
  const container = input.slice(0, slashIndex);
10809
- const path42 = input.slice(slashIndex);
10810
- if (container.length === 0 || path42.length === 0) {
10809
+ const path43 = input.slice(slashIndex);
10810
+ if (container.length === 0 || path43.length === 0) {
10811
10811
  throw new Error(`Invalid docker workspace locator "${input}".`);
10812
10812
  }
10813
10813
  return {
10814
10814
  scheme: "docker",
10815
10815
  container,
10816
- path: path42
10816
+ path: path43
10817
10817
  };
10818
10818
  }
10819
10819
  function splitOnce(input, separator) {
@@ -12690,21 +12690,21 @@ function createSdkContainer(options) {
12690
12690
  });
12691
12691
  loggerFactory.setErrorLogger(errorLogger);
12692
12692
  const asyncFs = {
12693
- readFile: ((path42, encoding) => {
12693
+ readFile: ((path43, encoding) => {
12694
12694
  if (encoding) {
12695
- return fs2.readFile(path42, encoding);
12695
+ return fs2.readFile(path43, encoding);
12696
12696
  }
12697
- return fs2.readFile(path42);
12697
+ return fs2.readFile(path43);
12698
12698
  }),
12699
- writeFile: (path42, data, opts) => fs2.writeFile(path42, data, opts),
12700
- mkdir: (path42, opts) => fs2.mkdir(path42, opts).then(() => {
12699
+ writeFile: (path43, data, opts) => fs2.writeFile(path43, data, opts),
12700
+ mkdir: (path43, opts) => fs2.mkdir(path43, opts).then(() => {
12701
12701
  }),
12702
- stat: (path42) => fs2.stat(path42),
12703
- rm: (path42, opts) => fs2.rm(path42, opts),
12704
- unlink: (path42) => fs2.unlink(path42),
12705
- readdir: (path42) => fs2.readdir(path42),
12702
+ stat: (path43) => fs2.stat(path43),
12703
+ rm: (path43, opts) => fs2.rm(path43, opts),
12704
+ unlink: (path43) => fs2.unlink(path43),
12705
+ readdir: (path43) => fs2.readdir(path43),
12706
12706
  copyFile: (src, dest) => fs2.copyFile(src, dest),
12707
- chmod: (path42, mode) => fs2.chmod(path42, mode)
12707
+ chmod: (path43, mode) => fs2.chmod(path43, mode)
12708
12708
  };
12709
12709
  const contextFactory = createCommandContextFactory({ fs: asyncFs });
12710
12710
  const authFs = {
@@ -13601,7 +13601,7 @@ function interpolate(template, values) {
13601
13601
  }
13602
13602
  return output;
13603
13603
  }
13604
- async function resolveFileIncludes(template, cwd, readFile15) {
13604
+ async function resolveFileIncludes(template, cwd, readFile16) {
13605
13605
  const matches = [...template.matchAll(FILE_INCLUDE_PATTERN)];
13606
13606
  if (matches.length === 0) {
13607
13607
  return template;
@@ -13609,7 +13609,7 @@ async function resolveFileIncludes(template, cwd, readFile15) {
13609
13609
  let result = template;
13610
13610
  for (const match of matches) {
13611
13611
  const absolutePath = path16.resolve(cwd, match[1]);
13612
- const content = await readFile15(absolutePath, "utf8");
13612
+ const content = await readFile16(absolutePath, "utf8");
13613
13613
  result = result.replace(match[0], content);
13614
13614
  }
13615
13615
  return result;
@@ -13735,10 +13735,10 @@ function createDefaultFs3() {
13735
13735
  function isAbortError(error2) {
13736
13736
  return error2 instanceof Error && error2.name === "AbortError";
13737
13737
  }
13738
- async function resolveVars(vars, cwd, readFile15) {
13738
+ async function resolveVars(vars, cwd, readFile16) {
13739
13739
  const resolved = {};
13740
13740
  for (const [key, value] of Object.entries(vars)) {
13741
- resolved[key] = await resolveFileIncludes(value, cwd, readFile15);
13741
+ resolved[key] = await resolveFileIncludes(value, cwd, readFile16);
13742
13742
  }
13743
13743
  return resolved;
13744
13744
  }
@@ -16855,9 +16855,8 @@ async function runExperimentLoop(options) {
16855
16855
  const currentSpecifier = agents[(experimentIndex - 1) % agents.length];
16856
16856
  const model = currentSpecifier.model;
16857
16857
  options.onExperimentStart?.(experimentIndex, currentSpecifier.agent);
16858
- let agentResult;
16859
16858
  try {
16860
- agentResult = await runAgent({
16859
+ await runAgent({
16861
16860
  agent: currentSpecifier.agent,
16862
16861
  prompt,
16863
16862
  cwd: options.cwd,
@@ -18034,9 +18033,179 @@ var init_setup_agent = __esm({
18034
18033
  }
18035
18034
  });
18036
18035
 
18037
- // packages/github-workflows/src/commands.ts
18038
- import { access, mkdir as mkdir10, readFile as readFile9, unlink as unlink2, writeFile as writeFile6 } from "node:fs/promises";
18036
+ // packages/github-workflows/src/variables.ts
18039
18037
  import path28 from "node:path";
18038
+ import { readFile as readFile9 } from "node:fs/promises";
18039
+ import { isMap as isMap2, parseDocument as parseDocument3, stringify as stringify2 } from "yaml";
18040
+ function isRecord10(value) {
18041
+ return typeof value === "object" && value !== null && !Array.isArray(value);
18042
+ }
18043
+ function getErrorMessage(error2) {
18044
+ return error2 instanceof Error ? error2.message : String(error2);
18045
+ }
18046
+ function normalizeVariables(filePath, value) {
18047
+ if (value === null || value === void 0) {
18048
+ return {};
18049
+ }
18050
+ if (!isRecord10(value)) {
18051
+ throw new Error(`Invalid GitHub workflow variables in "${filePath}": expected a top-level object.`);
18052
+ }
18053
+ const result = {};
18054
+ for (const [key, itemValue] of Object.entries(value)) {
18055
+ if (typeof itemValue !== "string") {
18056
+ throw new Error(`Invalid GitHub workflow variables in "${filePath}": "${key}" must be a string.`);
18057
+ }
18058
+ result[key] = itemValue;
18059
+ }
18060
+ return result;
18061
+ }
18062
+ function parseVariablesDocument(filePath, content) {
18063
+ let document;
18064
+ try {
18065
+ document = parseDocument3(content, { keepSourceTokens: true });
18066
+ } catch (error2) {
18067
+ throw new Error(`Invalid GitHub workflow variables YAML in "${filePath}": ${getErrorMessage(error2)}`);
18068
+ }
18069
+ if (document.errors.length > 0) {
18070
+ const [firstError] = document.errors;
18071
+ throw new Error(
18072
+ `Invalid GitHub workflow variables YAML in "${filePath}": ${firstError?.message ?? "Unknown YAML error."}`
18073
+ );
18074
+ }
18075
+ return document;
18076
+ }
18077
+ function parseVariables(filePath, content) {
18078
+ return normalizeVariables(filePath, parseVariablesDocument(filePath, content).toJS());
18079
+ }
18080
+ function extractUserOverrideBlocks(filePath, content) {
18081
+ const document = parseVariablesDocument(filePath, content);
18082
+ const variables = normalizeVariables(filePath, document.toJS());
18083
+ if (document.contents === null) {
18084
+ return { variables, blocks: {} };
18085
+ }
18086
+ if (!isMap2(document.contents)) {
18087
+ throw new Error(`Invalid GitHub workflow variables in "${filePath}": expected a top-level object.`);
18088
+ }
18089
+ const blocks = {};
18090
+ const items = document.contents.items;
18091
+ for (const [index, item] of items.entries()) {
18092
+ const key = item.key?.toJSON();
18093
+ if (typeof key !== "string") {
18094
+ throw new Error(`Invalid GitHub workflow variables in "${filePath}": keys must be strings.`);
18095
+ }
18096
+ const start = item.key.range?.[0];
18097
+ const nextStart = items[index + 1]?.key?.range?.[0];
18098
+ if (typeof start !== "number") {
18099
+ blocks[key] = formatVariableBlock(key, variables[key]);
18100
+ continue;
18101
+ }
18102
+ const end = typeof nextStart === "number" ? nextStart : content.length;
18103
+ blocks[key] = content.slice(start, end).trimEnd();
18104
+ }
18105
+ return { variables, blocks };
18106
+ }
18107
+ async function readOptionalVariables(projectDir) {
18108
+ const filePath = path28.join(projectDir, VARIABLES_FILE_NAME);
18109
+ try {
18110
+ return parseVariables(filePath, await readFile9(filePath, "utf8"));
18111
+ } catch (error2) {
18112
+ if (error2 instanceof Error && error2.code === "ENOENT") {
18113
+ return {};
18114
+ }
18115
+ throw error2;
18116
+ }
18117
+ }
18118
+ function formatVariableBlock(name, value) {
18119
+ return stringify2({ [name]: value }).trimEnd();
18120
+ }
18121
+ function formatCommentedBlock(name, value) {
18122
+ return formatVariableBlock(name, value).split("\n").map((line) => `# ${line}`).join("\n");
18123
+ }
18124
+ async function loadVariableSources(builtInDir, projectDir) {
18125
+ const builtInPath = path28.join(builtInDir, VARIABLES_FILE_NAME);
18126
+ const builtInVariables = parseVariables(builtInPath, await readFile9(builtInPath, "utf8"));
18127
+ const projectVariables = projectDir === void 0 ? {} : await readOptionalVariables(projectDir);
18128
+ return { builtInVariables, projectVariables };
18129
+ }
18130
+ async function loadVariables(builtInDir, projectDir) {
18131
+ const { builtInVariables, projectVariables } = await loadVariableSources(builtInDir, projectDir);
18132
+ const merged = { ...builtInVariables, ...projectVariables };
18133
+ const result = {};
18134
+ for (const [key, value] of Object.entries(merged)) {
18135
+ if (value === "") {
18136
+ continue;
18137
+ }
18138
+ result[key] = value;
18139
+ }
18140
+ return result;
18141
+ }
18142
+ async function loadVariableStatuses(builtInDir, projectDir) {
18143
+ const { builtInVariables, projectVariables } = await loadVariableSources(builtInDir, projectDir);
18144
+ const orderedNames = [
18145
+ ...Object.keys(builtInVariables),
18146
+ ...Object.keys(projectVariables).filter((key) => !Object.prototype.hasOwnProperty.call(builtInVariables, key))
18147
+ ];
18148
+ const projectVariablesPath = projectDir === void 0 ? void 0 : path28.join(projectDir, VARIABLES_FILE_NAME);
18149
+ return orderedNames.map((name) => {
18150
+ if (!Object.prototype.hasOwnProperty.call(projectVariables, name)) {
18151
+ return {
18152
+ name,
18153
+ source: "built-in",
18154
+ status: "default"
18155
+ };
18156
+ }
18157
+ if (projectVariables[name] === "") {
18158
+ return {
18159
+ name,
18160
+ source: projectVariablesPath ?? "built-in",
18161
+ status: "disabled"
18162
+ };
18163
+ }
18164
+ return {
18165
+ name,
18166
+ source: projectVariablesPath ?? "built-in",
18167
+ status: Object.prototype.hasOwnProperty.call(builtInVariables, name) ? "overridden" : "custom"
18168
+ };
18169
+ });
18170
+ }
18171
+ function generateProjectVariablesFile(builtInVariables, existingProjectFileContent) {
18172
+ const userOverrides = existingProjectFileContent === void 0 ? { variables: {}, blocks: {} } : extractUserOverrideBlocks(VARIABLES_FILE_NAME, existingProjectFileContent);
18173
+ const sections = [PROJECT_VARIABLES_HEADER];
18174
+ for (const [key, value] of Object.entries(builtInVariables)) {
18175
+ if (Object.prototype.hasOwnProperty.call(userOverrides.blocks, key)) {
18176
+ sections.push(userOverrides.blocks[key]);
18177
+ continue;
18178
+ }
18179
+ sections.push(formatCommentedBlock(key, value));
18180
+ }
18181
+ for (const [key, value] of Object.entries(userOverrides.variables)) {
18182
+ if (Object.prototype.hasOwnProperty.call(builtInVariables, key)) {
18183
+ continue;
18184
+ }
18185
+ sections.push(userOverrides.blocks[key] ?? formatVariableBlock(key, value));
18186
+ }
18187
+ return `${sections.join("\n\n")}
18188
+ `;
18189
+ }
18190
+ var VARIABLES_FILE_NAME, PROJECT_VARIABLES_HEADER;
18191
+ var init_variables2 = __esm({
18192
+ "packages/github-workflows/src/variables.ts"() {
18193
+ "use strict";
18194
+ VARIABLES_FILE_NAME = "variables.yaml";
18195
+ PROJECT_VARIABLES_HEADER = [
18196
+ "# Preview rendered prompt: poe-code github-workflows prompt-preview <name>",
18197
+ "#",
18198
+ "# Built-in defaults are shown below as comments.",
18199
+ "# To override a variable, uncomment it and replace the value.",
18200
+ '# To disable a variable, uncomment it and set it to empty string: ""',
18201
+ "# Variables left commented out keep the built-in default."
18202
+ ].join("\n");
18203
+ }
18204
+ });
18205
+
18206
+ // packages/github-workflows/src/commands.ts
18207
+ import { access, mkdir as mkdir10, readFile as readFile10, unlink as unlink2, writeFile as writeFile6 } from "node:fs/promises";
18208
+ import path29 from "node:path";
18040
18209
  import { fileURLToPath as fileURLToPath4 } from "node:url";
18041
18210
  import Mustache3 from "mustache";
18042
18211
  function formatLabel(name) {
@@ -18055,7 +18224,7 @@ async function loadNamedAutomation(name, cwd) {
18055
18224
  }
18056
18225
  async function readBuiltInPromptFile(name) {
18057
18226
  try {
18058
- return await readFile9(path28.join(await resolveBuiltInPromptsDir(), `${name}.md`), "utf8");
18227
+ return await readFile10(path29.join(await resolveBuiltInPromptsDir(), `${name}.md`), "utf8");
18059
18228
  } catch (error2) {
18060
18229
  if (isMissingPathError2(error2)) {
18061
18230
  throw new UserError(`Automation "${name}" was not found.`);
@@ -18064,11 +18233,11 @@ async function readBuiltInPromptFile(name) {
18064
18233
  }
18065
18234
  }
18066
18235
  async function readBuiltInWorkflowTemplate(name, variant, automationName = name, promptPath) {
18067
- const templatePath = path28.join(await resolveBuiltInWorkflowTemplatesDir(), `${name}.${variant}.yml`);
18236
+ const templatePath = path29.join(await resolveBuiltInWorkflowTemplatesDir(), `${name}.${variant}.yml`);
18068
18237
  try {
18069
- const content = await readFile9(templatePath, "utf8");
18238
+ const content = await readFile10(templatePath, "utf8");
18070
18239
  const header = promptPath !== void 0 ? `# Auto-generated by: poe-code github-workflows install ${name}
18071
- # Edit ${path28.relative(process.cwd(), promptPath)} to customize the prompt.
18240
+ # Edit ${path29.relative(process.cwd(), promptPath)} to customize the prompt.
18072
18241
  ` : `# Auto-generated by: poe-code github-workflows install ${name}
18073
18242
  `;
18074
18243
  const processedContent = content.replaceAll(` ${name}`, ` ${automationName}`).replaceAll("__UPSTREAM_REPO__", UPSTREAM_REPO);
@@ -18094,10 +18263,13 @@ async function resolveBuiltInWorkflowTemplatesDir() {
18094
18263
  return builtInWorkflowTemplatesDirCandidates[0];
18095
18264
  }
18096
18265
  function projectPromptDirs(cwd) {
18097
- return [projectWorkflowDir(cwd), path28.join(cwd, ".poe-code", "github-workflows")];
18266
+ return [projectWorkflowDir(cwd), projectGitHubWorkflowsDir(cwd)];
18098
18267
  }
18099
18268
  function projectWorkflowDir(cwd) {
18100
- return path28.join(cwd, ".github", "workflows");
18269
+ return path29.join(cwd, ".github", "workflows");
18270
+ }
18271
+ function projectGitHubWorkflowsDir(cwd) {
18272
+ return path29.join(cwd, ".poe-code", "github-workflows");
18101
18273
  }
18102
18274
  async function resolveBuiltInPromptsDir() {
18103
18275
  for (const candidate of builtInPromptsDirCandidates) {
@@ -18112,6 +18284,9 @@ async function resolveBuiltInPromptsDir() {
18112
18284
  }
18113
18285
  return builtInPromptsDirCandidates[0];
18114
18286
  }
18287
+ async function resolveBuiltInAssetsDir() {
18288
+ return path29.dirname(await resolveBuiltInPromptsDir());
18289
+ }
18115
18290
  function resolveCwd(cwd) {
18116
18291
  return cwd ?? process.cwd();
18117
18292
  }
@@ -18198,7 +18373,7 @@ function parseSourceItems(name, stdout) {
18198
18373
  return parsed;
18199
18374
  }
18200
18375
  function buildPerItemTemplateContext(item, sharedContext) {
18201
- if (isRecord10(item)) {
18376
+ if (isRecord11(item)) {
18202
18377
  return {
18203
18378
  ...sharedContext,
18204
18379
  ...item
@@ -18253,7 +18428,7 @@ function resolveEnvInterpolation(value, env) {
18253
18428
  const key = value.slice(3, -2).trim();
18254
18429
  return env.get(key) ?? "";
18255
18430
  }
18256
- function isRecord10(value) {
18431
+ function isRecord11(value) {
18257
18432
  return typeof value === "object" && value !== null && !Array.isArray(value);
18258
18433
  }
18259
18434
  function addPromptHeader(content, name) {
@@ -18265,6 +18440,74 @@ function addPromptHeader(content, name) {
18265
18440
  }
18266
18441
  return content;
18267
18442
  }
18443
+ async function installAutomation(name, cwd, isEject) {
18444
+ const variant = isEject ? "ejected" : "caller";
18445
+ const localAutomationName = isEject ? `poe-code-${name}` : name;
18446
+ const promptPath = isEject ? path29.join(projectWorkflowDir(cwd), `${localAutomationName}.md`) : void 0;
18447
+ const [workflowTemplate, rawPrompt] = await Promise.all([
18448
+ readBuiltInWorkflowTemplate(name, variant, localAutomationName, promptPath),
18449
+ readBuiltInPromptFile(name)
18450
+ ]);
18451
+ const workflowPath = path29.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
18452
+ await mkdir10(path29.dirname(workflowPath), { recursive: true });
18453
+ await writeFile6(workflowPath, workflowTemplate, "utf8");
18454
+ if (promptPath !== void 0) {
18455
+ await mkdir10(path29.dirname(promptPath), { recursive: true });
18456
+ await writeFile6(promptPath, addPromptHeader(rawPrompt, name), "utf8");
18457
+ }
18458
+ return {
18459
+ name,
18460
+ workflowPath,
18461
+ promptPath,
18462
+ ejected: isEject,
18463
+ promptContent: rawPrompt
18464
+ };
18465
+ }
18466
+ async function ensureProjectSupportFiles(cwd, builtInVariables) {
18467
+ const projectDir = projectGitHubWorkflowsDir(cwd);
18468
+ const variablesPath = path29.join(projectDir, "variables.yaml");
18469
+ const readmePath = path29.join(projectDir, "README.md");
18470
+ await mkdir10(projectDir, { recursive: true });
18471
+ await writeFile6(
18472
+ variablesPath,
18473
+ generateProjectVariablesFile(builtInVariables, await readOptionalFile3(variablesPath)),
18474
+ "utf8"
18475
+ );
18476
+ await writeFile6(readmePath, renderProjectReadme(), "utf8");
18477
+ return { readmePath, variablesPath };
18478
+ }
18479
+ async function readOptionalFile3(filePath) {
18480
+ try {
18481
+ return await readFile10(filePath, "utf8");
18482
+ } catch (error2) {
18483
+ if (isMissingPathError2(error2)) {
18484
+ return void 0;
18485
+ }
18486
+ throw error2;
18487
+ }
18488
+ }
18489
+ function renderProjectReadme() {
18490
+ return [
18491
+ "# GitHub Workflows",
18492
+ "",
18493
+ "## Commands",
18494
+ "",
18495
+ "| Command | Description |",
18496
+ "|---------|-------------|",
18497
+ "| `poe-code github-workflows list` | List available automations |",
18498
+ "| `poe-code github-workflows install <name>` | Install a workflow (use `--eject` to customize the prompt) |",
18499
+ "| `poe-code github-workflows uninstall <name>` | Remove an installed workflow |",
18500
+ "| `poe-code github-workflows prompt-preview <name>` | Preview the rendered prompt with variables resolved |",
18501
+ "| `poe-code github-workflows run <name>` | Run an automation locally |",
18502
+ "| `poe-code github-workflows variables` | List shared prompt variables and where each value comes from |",
18503
+ "",
18504
+ "## Customization",
18505
+ "",
18506
+ "Edit `variables.yaml` to override shared prompt variables.",
18507
+ 'Uncomment a variable and change its value. Set to `""` to disable.',
18508
+ ""
18509
+ ].join("\n");
18510
+ }
18268
18511
  function isMissingPathError2(error2) {
18269
18512
  return error2 instanceof Error && "code" in error2 && error2.code === "ENOENT";
18270
18513
  }
@@ -18282,7 +18525,7 @@ async function selectAutomationName(message2, automations) {
18282
18525
  }
18283
18526
  return selected;
18284
18527
  }
18285
- var UPSTREAM_REPO, builtInPromptsDirCandidates, builtInWorkflowTemplatesDirCandidates, originalMustacheEscape, installableAutomations, runCommandDef, listCommand, installCommand, uninstallCommand, requireUserAllowCommand, requireCommentPrefixCommand, prepareCommand, promptPreviewCommand, ghGroup;
18528
+ var UPSTREAM_REPO, builtInPromptsDirCandidates, builtInWorkflowTemplatesDirCandidates, originalMustacheEscape, installableAutomations, runCommandDef, listCommand, installCommand, uninstallCommand, requireUserAllowCommand, requireCommentPrefixCommand, prepareCommand, promptPreviewCommand, variablesCommand, ghGroup;
18286
18529
  var init_commands = __esm({
18287
18530
  "packages/github-workflows/src/commands.ts"() {
18288
18531
  "use strict";
@@ -18295,6 +18538,7 @@ var init_commands = __esm({
18295
18538
  init_require_comment_prefix();
18296
18539
  init_preflight();
18297
18540
  init_setup_agent();
18541
+ init_variables2();
18298
18542
  UPSTREAM_REPO = "poe-platform/poe-code";
18299
18543
  builtInPromptsDirCandidates = [
18300
18544
  fileURLToPath4(new URL("./prompts", import.meta.url)),
@@ -18309,6 +18553,7 @@ var init_commands = __esm({
18309
18553
  "fix-vulnerabilities",
18310
18554
  "github-issue-comment-created",
18311
18555
  "github-issue-opened",
18556
+ "github-pull-request-comment-created",
18312
18557
  "github-pull-request-opened",
18313
18558
  "github-pull-request-synchronized",
18314
18559
  "update-dependencies",
@@ -18338,7 +18583,8 @@ var init_commands = __esm({
18338
18583
  );
18339
18584
  const automation = await loadNamedAutomation(name, cwd);
18340
18585
  const agent2 = automation.agent ?? params.agent ?? "codex";
18341
- const sharedTemplateContext = buildTemplateContext(env);
18586
+ const variables = await loadVariables(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd));
18587
+ const sharedTemplateContext = { ...variables, ...buildTemplateContext(env) };
18342
18588
  if (automation.source === void 0) {
18343
18589
  const prompt = renderPrompt(automation.prompt, sharedTemplateContext);
18344
18590
  return {
@@ -18429,55 +18675,59 @@ var init_commands = __esm({
18429
18675
  });
18430
18676
  installCommand = defineCommand({
18431
18677
  name: "install",
18432
- description: "Install an automation workflow into the current repo.",
18678
+ description: "Install one or all automation workflows into the current repo.",
18433
18679
  positional: ["name"],
18434
18680
  params: S.Object({
18435
- name: S.Enum(installableAutomations, {
18436
- description: "Pick a GitHub workflow to install",
18437
- loadOptions: async () => {
18438
- const automations = await discoverAutomations(await resolveBuiltInPromptsDir());
18439
- return automations.map((a) => ({ label: a.label ?? formatLabel(a.name), value: a.name }));
18440
- }
18441
- }),
18681
+ name: S.Optional(
18682
+ S.Enum(installableAutomations, {
18683
+ description: "Pick a GitHub workflow to install",
18684
+ loadOptions: async () => {
18685
+ const automations = await discoverAutomations(await resolveBuiltInPromptsDir());
18686
+ return automations.map((a) => ({ label: a.label ?? formatLabel(a.name), value: a.name }));
18687
+ }
18688
+ })
18689
+ ),
18442
18690
  eject: S.Optional(S.Boolean())
18443
18691
  }),
18444
18692
  scope: ["cli"],
18445
18693
  handler: async ({ params }) => {
18446
- const name = params.name;
18447
- const isEject = params.eject === true;
18448
- const variant = isEject ? "ejected" : "caller";
18449
18694
  const cwd = resolveCwd();
18450
- const localAutomationName = isEject ? `poe-code-${name}` : name;
18451
- const promptPath = isEject ? path28.join(projectWorkflowDir(cwd), `${localAutomationName}.md`) : void 0;
18452
- const [workflowTemplate, rawPrompt] = await Promise.all([
18453
- readBuiltInWorkflowTemplate(name, variant, localAutomationName, promptPath),
18454
- readBuiltInPromptFile(name)
18455
- ]);
18456
- const workflowPath = path28.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
18457
- await mkdir10(path28.dirname(workflowPath), { recursive: true });
18458
- await writeFile6(workflowPath, workflowTemplate, "utf8");
18459
- if (promptPath !== void 0) {
18460
- await mkdir10(path28.dirname(promptPath), { recursive: true });
18461
- await writeFile6(promptPath, addPromptHeader(rawPrompt, name), "utf8");
18695
+ const names = params.name === void 0 ? [...installableAutomations] : [params.name];
18696
+ const installations = [];
18697
+ for (const name of names) {
18698
+ installations.push(await installAutomation(name, cwd, params.eject === true));
18462
18699
  }
18700
+ const supportFiles = await ensureProjectSupportFiles(
18701
+ cwd,
18702
+ await loadVariables(await resolveBuiltInAssetsDir())
18703
+ );
18463
18704
  return {
18464
- name,
18465
- workflowPath,
18466
- promptPath,
18467
- ejected: isEject,
18468
- promptContent: rawPrompt
18705
+ installations,
18706
+ ...supportFiles
18469
18707
  };
18470
18708
  },
18471
18709
  render: {
18472
18710
  rich: (result, { logger: logger2, note: note2 }) => {
18473
- logger2.success(`Installed workflow at ${result.workflowPath}`);
18474
- if (result.promptPath !== void 0) {
18475
- logger2.message(`Prompt copied to ${result.promptPath}`);
18476
- }
18477
- note2(result.promptContent, "Default prompt");
18478
- if (!result.ejected) {
18479
- logger2.message(`To customize the prompt, run: poe-code github-workflows install ${result.name} --eject`);
18711
+ if (result.installations.length === 1) {
18712
+ const [installation] = result.installations;
18713
+ logger2.success(`Installed workflow at ${installation.workflowPath}`);
18714
+ if (installation.promptPath !== void 0) {
18715
+ logger2.message(`Prompt copied to ${installation.promptPath}`);
18716
+ }
18717
+ note2(installation.promptContent, "Default prompt");
18718
+ if (!installation.ejected) {
18719
+ logger2.message(
18720
+ `To customize the prompt, run: poe-code github-workflows install ${installation.name} --eject`
18721
+ );
18722
+ }
18723
+ } else {
18724
+ logger2.success(`Installed ${result.installations.length} workflows.`);
18725
+ for (const installation of result.installations) {
18726
+ logger2.message(installation.workflowPath);
18727
+ }
18480
18728
  }
18729
+ logger2.message(`Shared variables written to ${result.variablesPath}`);
18730
+ logger2.message(`Command reference written to ${result.readmePath}`);
18481
18731
  },
18482
18732
  json: (result) => result
18483
18733
  }
@@ -18498,7 +18748,7 @@ var init_commands = __esm({
18498
18748
  scope: ["cli"],
18499
18749
  handler: async ({ params }) => {
18500
18750
  const name = params.name;
18501
- const workflowPath = path28.join(resolveCwd(), ".github", "workflows", `poe-code-${name}.yml`);
18751
+ const workflowPath = path29.join(resolveCwd(), ".github", "workflows", `poe-code-${name}.yml`);
18502
18752
  try {
18503
18753
  await unlink2(workflowPath);
18504
18754
  } catch (error2) {
@@ -18576,10 +18826,12 @@ var init_commands = __esm({
18576
18826
  }),
18577
18827
  scope: ["cli", "sdk"],
18578
18828
  handler: async ({ params, env }) => {
18579
- const automation = await loadNamedAutomation(params.name, resolveCwd());
18829
+ const cwd = resolveCwd();
18830
+ const automation = await loadNamedAutomation(params.name, cwd);
18831
+ const variables = await loadVariables(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd));
18580
18832
  return {
18581
18833
  name: automation.name,
18582
- prompt: renderPrompt(automation.prompt, buildTemplateContext(env))
18834
+ prompt: renderPrompt(automation.prompt, { ...variables, ...buildTemplateContext(env) })
18583
18835
  };
18584
18836
  },
18585
18837
  render: {
@@ -18589,6 +18841,37 @@ var init_commands = __esm({
18589
18841
  json: (result) => result
18590
18842
  }
18591
18843
  });
18844
+ variablesCommand = defineCommand({
18845
+ name: "variables",
18846
+ description: "List shared prompt variables and where each value comes from.",
18847
+ params: S.Object({}),
18848
+ scope: ["cli", "sdk"],
18849
+ handler: async () => {
18850
+ const cwd = resolveCwd();
18851
+ return (await loadVariableStatuses(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd))).map(
18852
+ (status) => ({
18853
+ ...status,
18854
+ source: status.source === "built-in" ? status.source : path29.relative(cwd, status.source)
18855
+ })
18856
+ );
18857
+ },
18858
+ render: {
18859
+ rich: (result, { logger: logger2, renderTable: renderTable3, getTheme: getTheme2 }) => {
18860
+ logger2.message(
18861
+ renderTable3({
18862
+ theme: getTheme2(),
18863
+ columns: [
18864
+ { name: "name", title: "Name", alignment: "left", maxLen: 32 },
18865
+ { name: "status", title: "Status", alignment: "left", maxLen: 12 },
18866
+ { name: "source", title: "Source", alignment: "left", maxLen: 48 }
18867
+ ],
18868
+ rows: result
18869
+ })
18870
+ );
18871
+ },
18872
+ json: (result) => result
18873
+ }
18874
+ });
18592
18875
  ghGroup = defineGroup({
18593
18876
  name: "github-workflows",
18594
18877
  aliases: ["gh"],
@@ -18601,7 +18884,8 @@ var init_commands = __esm({
18601
18884
  listCommand,
18602
18885
  installCommand,
18603
18886
  uninstallCommand,
18604
- promptPreviewCommand
18887
+ promptPreviewCommand,
18888
+ variablesCommand
18605
18889
  ],
18606
18890
  default: runCommandDef
18607
18891
  });
@@ -18745,7 +19029,7 @@ var init_execution_context = __esm({
18745
19029
  });
18746
19030
 
18747
19031
  // src/sdk/launch.ts
18748
- import path29 from "node:path";
19032
+ import path30 from "node:path";
18749
19033
  import { spawnSync as spawnSync2 } from "node:child_process";
18750
19034
  async function startLaunch(options) {
18751
19035
  const homeDir = resolveHomeDir(options.homeDir);
@@ -18851,7 +19135,7 @@ async function runLaunchDaemon(options) {
18851
19135
  });
18852
19136
  }
18853
19137
  function resolveLaunchBaseDir(homeDir) {
18854
- return path29.join(homeDir, ".poe-code", "launch");
19138
+ return path30.join(homeDir, ".poe-code", "launch");
18855
19139
  }
18856
19140
  function resolveHomeDir(homeDir) {
18857
19141
  if (homeDir) {
@@ -18867,7 +19151,7 @@ function normalizeLaunchSpec(spec, baseDir) {
18867
19151
  if (locator.scheme !== "local") {
18868
19152
  return spec;
18869
19153
  }
18870
- const cwd = path29.isAbsolute(locator.path) ? locator.path : path29.resolve(baseDir, locator.path);
19154
+ const cwd = path30.isAbsolute(locator.path) ? locator.path : path30.resolve(baseDir, locator.path);
18871
19155
  return {
18872
19156
  ...spec,
18873
19157
  cwd
@@ -19944,7 +20228,7 @@ var init_acp_core = __esm({
19944
20228
  });
19945
20229
 
19946
20230
  // packages/poe-agent/src/plugins/plugin-args.ts
19947
- import path30 from "node:path";
20231
+ import path31 from "node:path";
19948
20232
  function isObjectRecord3(value) {
19949
20233
  return typeof value === "object" && value !== null && !Array.isArray(value);
19950
20234
  }
@@ -19975,13 +20259,13 @@ function getOptionalString(args, key) {
19975
20259
  return value;
19976
20260
  }
19977
20261
  function resolveAllowedPath(cwd, allowedPaths, inputPath) {
19978
- const resolvedPath = path30.resolve(cwd, inputPath);
20262
+ const resolvedPath = path31.resolve(cwd, inputPath);
19979
20263
  const isAllowed = allowedPaths.some((allowedPath) => {
19980
20264
  if (allowedPath === resolvedPath) {
19981
20265
  return true;
19982
20266
  }
19983
- const rel = path30.relative(allowedPath, resolvedPath);
19984
- return rel.length > 0 && !rel.startsWith("..") && !path30.isAbsolute(rel);
20267
+ const rel = path31.relative(allowedPath, resolvedPath);
20268
+ return rel.length > 0 && !rel.startsWith("..") && !path31.isAbsolute(rel);
19985
20269
  });
19986
20270
  if (!isAllowed) {
19987
20271
  throw new Error(`Path is outside allowed paths: ${inputPath}`);
@@ -19996,7 +20280,7 @@ var init_plugin_args = __esm({
19996
20280
 
19997
20281
  // packages/poe-agent/src/plugins/poe-agent-plugin-files.ts
19998
20282
  import fsPromises9 from "node:fs/promises";
19999
- import path31 from "node:path";
20283
+ import path32 from "node:path";
20000
20284
  async function fileExists(fs3, filePath) {
20001
20285
  try {
20002
20286
  await fs3.readFile(filePath, "utf8");
@@ -20020,9 +20304,9 @@ var init_poe_agent_plugin_files = __esm({
20020
20304
  "use strict";
20021
20305
  init_plugin_args();
20022
20306
  filesPlugin = (options = {}) => {
20023
- const cwd = path31.resolve(options.cwd ?? process.cwd());
20307
+ const cwd = path32.resolve(options.cwd ?? process.cwd());
20024
20308
  const allowedPaths = (options.allowedPaths ?? [cwd]).map(
20025
- (allowedPath) => path31.resolve(cwd, allowedPath)
20309
+ (allowedPath) => path32.resolve(cwd, allowedPath)
20026
20310
  );
20027
20311
  const fs3 = options.fs ?? fsPromises9;
20028
20312
  const readFileTool = {
@@ -20076,7 +20360,7 @@ var init_poe_agent_plugin_files = __esm({
20076
20360
  async call(args) {
20077
20361
  const command = getRequiredString(args, "command");
20078
20362
  const filePath = resolveAllowedPath(cwd, allowedPaths, getRequiredString(args, "path"));
20079
- const displayedPath = path31.relative(cwd, filePath) || path31.basename(filePath);
20363
+ const displayedPath = path32.relative(cwd, filePath) || path32.basename(filePath);
20080
20364
  if (command === "str_replace") {
20081
20365
  const oldStr = getRequiredString(args, "old_str", true);
20082
20366
  const newStr = getRequiredString(args, "new_str", true);
@@ -20096,7 +20380,7 @@ var init_poe_agent_plugin_files = __esm({
20096
20380
  if (await fileExists(fs3, filePath)) {
20097
20381
  throw new Error("File already exists \u2014 use str_replace to edit");
20098
20382
  }
20099
- await fs3.mkdir(path31.dirname(filePath), { recursive: true });
20383
+ await fs3.mkdir(path32.dirname(filePath), { recursive: true });
20100
20384
  await fs3.writeFile(filePath, fileText, "utf8");
20101
20385
  return `Created file: ${displayedPath}`;
20102
20386
  }
@@ -20137,7 +20421,7 @@ var init_poe_agent_plugin_files = __esm({
20137
20421
 
20138
20422
  // packages/poe-agent/src/plugins/poe-agent-plugin-shell.ts
20139
20423
  import { exec as execCallback2 } from "node:child_process";
20140
- import path32 from "node:path";
20424
+ import path33 from "node:path";
20141
20425
  import { promisify } from "node:util";
20142
20426
  async function defaultRunCommand(command, cwd) {
20143
20427
  try {
@@ -20170,9 +20454,9 @@ var init_poe_agent_plugin_shell = __esm({
20170
20454
  init_plugin_args();
20171
20455
  exec = promisify(execCallback2);
20172
20456
  shellPlugin = (options = {}) => {
20173
- const cwd = path32.resolve(options.cwd ?? process.cwd());
20457
+ const cwd = path33.resolve(options.cwd ?? process.cwd());
20174
20458
  const allowedPaths = (options.allowedPaths ?? [cwd]).map(
20175
- (allowedPath) => path32.resolve(cwd, allowedPath)
20459
+ (allowedPath) => path33.resolve(cwd, allowedPath)
20176
20460
  );
20177
20461
  const runCommand2 = options.runCommand ?? defaultRunCommand;
20178
20462
  const runCommandTool = {
@@ -20210,7 +20494,7 @@ var init_poe_agent_plugin_shell = __esm({
20210
20494
 
20211
20495
  // packages/poe-agent/src/system-prompt.ts
20212
20496
  import { readFileSync } from "node:fs";
20213
- import { readFile as readFile10 } from "node:fs/promises";
20497
+ import { readFile as readFile11 } from "node:fs/promises";
20214
20498
  import { fileURLToPath as fileURLToPath6 } from "node:url";
20215
20499
  function loadSystemPromptSync() {
20216
20500
  return readFileSync(SYSTEM_PROMPT_PATH, "utf8");
@@ -23531,15 +23815,15 @@ var init_renderer3 = __esm({
23531
23815
  });
23532
23816
 
23533
23817
  // packages/cmdkit/src/cli.ts
23534
- import { access as access2, readFile as readFile11, writeFile as writeFile7 } from "node:fs/promises";
23535
- import path34 from "node:path";
23818
+ import { access as access2, readFile as readFile12, writeFile as writeFile7 } from "node:fs/promises";
23819
+ import path35 from "node:path";
23536
23820
  import { Command as CommanderCommand, CommanderError, InvalidArgumentError, Option } from "commander";
23537
23821
  function inferProgramName(argv) {
23538
23822
  const entrypoint = argv[1];
23539
23823
  if (typeof entrypoint !== "string" || entrypoint.length === 0) {
23540
23824
  return "cmdkit";
23541
23825
  }
23542
- const parsed = path34.parse(entrypoint);
23826
+ const parsed = path35.parse(entrypoint);
23543
23827
  return parsed.name.length > 0 ? parsed.name : "cmdkit";
23544
23828
  }
23545
23829
  function normalizeRoots(roots, argv) {
@@ -23596,11 +23880,11 @@ function formatSegment(segment, casing) {
23596
23880
  const separator = casing === "snake" ? "_" : "-";
23597
23881
  return splitWords(segment).join(separator);
23598
23882
  }
23599
- function toOptionFlag(path42, casing) {
23600
- return `--${path42.map((segment) => formatSegment(segment, casing)).join(".")}`;
23883
+ function toOptionFlag(path43, casing) {
23884
+ return `--${path43.map((segment) => formatSegment(segment, casing)).join(".")}`;
23601
23885
  }
23602
- function toOptionAttribute(path42, casing) {
23603
- return path42.map((segment) => {
23886
+ function toOptionAttribute(path43, casing) {
23887
+ return path43.map((segment) => {
23604
23888
  const formatted = formatSegment(segment, casing);
23605
23889
  if (casing === "snake") {
23606
23890
  return formatted;
@@ -23611,13 +23895,13 @@ function toOptionAttribute(path42, casing) {
23611
23895
  ).join("");
23612
23896
  }).join(".");
23613
23897
  }
23614
- function toDisplayPath(path42) {
23615
- return path42.join(".");
23898
+ function toDisplayPath(path43) {
23899
+ return path43.join(".");
23616
23900
  }
23617
- function collectFields(schema, casing, path42 = [], inheritedOptional = false) {
23901
+ function collectFields(schema, casing, path43 = [], inheritedOptional = false) {
23618
23902
  const fields = [];
23619
23903
  for (const [key, rawChildSchema] of Object.entries(schema.shape)) {
23620
- const nextPath = [...path42, key];
23904
+ const nextPath = [...path43, key];
23621
23905
  const optional = inheritedOptional || rawChildSchema.kind === "optional";
23622
23906
  const childSchema = unwrapOptional(rawChildSchema);
23623
23907
  if (childSchema.kind === "object") {
@@ -23640,9 +23924,9 @@ function collectFields(schema, casing, path42 = [], inheritedOptional = false) {
23640
23924
  }
23641
23925
  return fields;
23642
23926
  }
23643
- function toCommanderOptionAttribute(path42, casing) {
23644
- const optionAttribute = toOptionAttribute(path42, casing);
23645
- const optionFlag = toOptionFlag(path42, casing);
23927
+ function toCommanderOptionAttribute(path43, casing) {
23928
+ const optionAttribute = toOptionAttribute(path43, casing);
23929
+ const optionFlag = toOptionFlag(path43, casing);
23646
23930
  if (!GLOBAL_LONG_OPTION_FLAGS.has(optionFlag)) {
23647
23931
  return optionAttribute;
23648
23932
  }
@@ -24076,10 +24360,10 @@ function addGlobalOptions(command) {
24076
24360
  throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, json.');
24077
24361
  }).option("--verbose", "Print stack traces for unexpected errors.");
24078
24362
  }
24079
- function setNestedValue(target, path42, value) {
24363
+ function setNestedValue(target, path43, value) {
24080
24364
  let cursor = target;
24081
- for (let index = 0; index < path42.length - 1; index += 1) {
24082
- const segment = path42[index] ?? "";
24365
+ for (let index = 0; index < path43.length - 1; index += 1) {
24366
+ const segment = path43[index] ?? "";
24083
24367
  const existing = cursor[segment];
24084
24368
  if (typeof existing === "object" && existing !== null) {
24085
24369
  cursor = existing;
@@ -24089,7 +24373,7 @@ function setNestedValue(target, path42, value) {
24089
24373
  cursor[segment] = next;
24090
24374
  cursor = next;
24091
24375
  }
24092
- const leaf = path42[path42.length - 1];
24376
+ const leaf = path43[path43.length - 1];
24093
24377
  if (leaf !== void 0) {
24094
24378
  cursor[leaf] = value;
24095
24379
  }
@@ -24179,13 +24463,13 @@ async function withOutputFormat2(output, fn) {
24179
24463
  }
24180
24464
  function createFs() {
24181
24465
  return {
24182
- readFile: async (path42, encoding = "utf8") => readFile11(path42, { encoding }),
24183
- writeFile: async (path42, contents) => {
24184
- await writeFile7(path42, contents);
24466
+ readFile: async (path43, encoding = "utf8") => readFile12(path43, { encoding }),
24467
+ writeFile: async (path43, contents) => {
24468
+ await writeFile7(path43, contents);
24185
24469
  },
24186
- exists: async (path42) => {
24470
+ exists: async (path43) => {
24187
24471
  try {
24188
- await access2(path42);
24472
+ await access2(path43);
24189
24473
  return true;
24190
24474
  } catch {
24191
24475
  return false;
@@ -24206,9 +24490,9 @@ function isPlainObject(value) {
24206
24490
  function hasFieldValue(value) {
24207
24491
  return value !== void 0;
24208
24492
  }
24209
- function hasNestedField(fields, path42) {
24493
+ function hasNestedField(fields, path43) {
24210
24494
  return fields.some(
24211
- (field) => path42.length < field.path.length && path42.every((segment, index) => field.path[index] === segment)
24495
+ (field) => path43.length < field.path.length && path43.every((segment, index) => field.path[index] === segment)
24212
24496
  );
24213
24497
  }
24214
24498
  function describeExpectedPresetValue(schema) {
@@ -24271,7 +24555,7 @@ function validatePresetFieldValue(value, field, presetPath) {
24271
24555
  async function loadPresetValues(fields, presetPath) {
24272
24556
  let rawPreset;
24273
24557
  try {
24274
- rawPreset = await readFile11(presetPath, {
24558
+ rawPreset = await readFile12(presetPath, {
24275
24559
  encoding: "utf8"
24276
24560
  });
24277
24561
  } catch (error2) {
@@ -24292,9 +24576,9 @@ async function loadPresetValues(fields, presetPath) {
24292
24576
  }
24293
24577
  const fieldByPath = new Map(fields.map((field) => [field.displayPath, field]));
24294
24578
  const presetValues = {};
24295
- function visitObject(current, path42) {
24579
+ function visitObject(current, path43) {
24296
24580
  for (const [key, value] of Object.entries(current)) {
24297
- const nextPath = [...path42, key];
24581
+ const nextPath = [...path43, key];
24298
24582
  const displayPath = toDisplayPath(nextPath);
24299
24583
  const field = fieldByPath.get(displayPath);
24300
24584
  if (field !== void 0) {
@@ -24492,8 +24776,8 @@ function createFixtureService(definition) {
24492
24776
  );
24493
24777
  }
24494
24778
  function resolveFixturePath(commandPath) {
24495
- const parsed = path34.parse(commandPath);
24496
- return path34.join(parsed.dir, `${parsed.name}.fixture.json`);
24779
+ const parsed = path35.parse(commandPath);
24780
+ return path35.join(parsed.dir, `${parsed.name}.fixture.json`);
24497
24781
  }
24498
24782
  function selectFixtureScenario(scenarios, selector) {
24499
24783
  if (isNumericFixtureSelector(selector)) {
@@ -24520,7 +24804,7 @@ async function loadFixtureScenario(command, selector) {
24520
24804
  const fixturePath = resolveFixturePath(commandPath);
24521
24805
  let rawFixture;
24522
24806
  try {
24523
- rawFixture = await readFile11(fixturePath, {
24807
+ rawFixture = await readFile12(fixturePath, {
24524
24808
  encoding: "utf8"
24525
24809
  });
24526
24810
  } catch {
@@ -24968,7 +25252,7 @@ var init_container2 = __esm({
24968
25252
  });
24969
25253
 
24970
25254
  // src/services/config.ts
24971
- import path35 from "node:path";
25255
+ import path36 from "node:path";
24972
25256
  async function deleteConfig(options) {
24973
25257
  const { fs: fs3, filePath } = options;
24974
25258
  try {
@@ -25049,7 +25333,7 @@ async function migrateLegacyCredentialsIfNeeded(fs3, filePath) {
25049
25333
  await migrateLegacyCredentialsFile(fs3, filePath);
25050
25334
  }
25051
25335
  async function migrateLegacyCredentialsFile(fs3, configPath) {
25052
- const legacyPath = path35.join(path35.dirname(configPath), "credentials.json");
25336
+ const legacyPath = path36.join(path36.dirname(configPath), "credentials.json");
25053
25337
  const raw = await readFileIfExists(fs3, legacyPath);
25054
25338
  if (raw === null) {
25055
25339
  return;
@@ -25083,7 +25367,7 @@ function parseLegacyConfigDocument(raw) {
25083
25367
  }
25084
25368
  }
25085
25369
  function normalizeLegacyConfigDocument(value) {
25086
- if (!isRecord11(value)) {
25370
+ if (!isRecord12(value)) {
25087
25371
  return {};
25088
25372
  }
25089
25373
  const document = {};
@@ -25097,12 +25381,12 @@ function normalizeLegacyConfigDocument(value) {
25097
25381
  return document;
25098
25382
  }
25099
25383
  function normalizeConfiguredServices(value) {
25100
- if (!isRecord11(value)) {
25384
+ if (!isRecord12(value)) {
25101
25385
  return {};
25102
25386
  }
25103
25387
  const entries = {};
25104
25388
  for (const [key, entry] of Object.entries(value)) {
25105
- if (!isRecord11(entry)) {
25389
+ if (!isRecord12(entry)) {
25106
25390
  continue;
25107
25391
  }
25108
25392
  entries[key] = normalizeConfiguredServiceMetadata({
@@ -25117,11 +25401,11 @@ async function recoverInvalidConfig(fs3, filePath, content) {
25117
25401
  await fs3.writeFile(filePath, EMPTY_DOCUMENT3, { encoding: "utf8" });
25118
25402
  }
25119
25403
  function createInvalidBackupPath2(filePath) {
25120
- const directory = path35.dirname(filePath);
25121
- const baseName = path35.basename(filePath);
25122
- return path35.join(directory, `${baseName}.invalid-${createTimestamp()}.json`);
25404
+ const directory = path36.dirname(filePath);
25405
+ const baseName = path36.basename(filePath);
25406
+ return path36.join(directory, `${baseName}.invalid-${createTimestamp()}.json`);
25123
25407
  }
25124
- function isRecord11(value) {
25408
+ function isRecord12(value) {
25125
25409
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
25126
25410
  }
25127
25411
  var coreConfigScope, ralphConfigScope, pipelineConfigScope, knownConfigScopes, CORE_SCOPE, configuredServicesScope, EMPTY_DOCUMENT3;
@@ -26571,7 +26855,7 @@ var init_media_download = __esm({
26571
26855
  });
26572
26856
 
26573
26857
  // src/cli/commands/generate.ts
26574
- import path36 from "node:path";
26858
+ import path37 from "node:path";
26575
26859
  function registerGenerateCommand(program, container) {
26576
26860
  const generate2 = program.command("generate").alias("g").description("Generate content via Poe API").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
26577
26861
  "--param <key=value>",
@@ -26844,11 +27128,11 @@ function getDefaultMimeType(type) {
26844
27128
  return defaults[type];
26845
27129
  }
26846
27130
  function resolveOutputPath(filename, cwd) {
26847
- if (path36.isAbsolute(filename)) {
27131
+ if (path37.isAbsolute(filename)) {
26848
27132
  return { path: filename, label: filename };
26849
27133
  }
26850
27134
  return {
26851
- path: path36.join(cwd, filename),
27135
+ path: path37.join(cwd, filename),
26852
27136
  label: `./${filename}`
26853
27137
  };
26854
27138
  }
@@ -26879,7 +27163,7 @@ var init_generate = __esm({
26879
27163
  });
26880
27164
 
26881
27165
  // packages/tiny-stdio-mcp-server/src/types.ts
26882
- var JSON_RPC_ERROR_CODES;
27166
+ var JSON_RPC_ERROR_CODES, ToolError;
26883
27167
  var init_types4 = __esm({
26884
27168
  "packages/tiny-stdio-mcp-server/src/types.ts"() {
26885
27169
  "use strict";
@@ -26890,6 +27174,13 @@ var init_types4 = __esm({
26890
27174
  INVALID_PARAMS: -32602,
26891
27175
  INTERNAL_ERROR: -32603
26892
27176
  };
27177
+ ToolError = class extends Error {
27178
+ constructor(code, message2) {
27179
+ super(message2);
27180
+ this.code = code;
27181
+ this.name = "ToolError";
27182
+ }
27183
+ };
26893
27184
  }
26894
27185
  });
26895
27186
 
@@ -27401,6 +27692,14 @@ function createServer(options) {
27401
27692
  const result = { content: toContentBlocks(handlerResult) };
27402
27693
  return { result };
27403
27694
  } catch (err) {
27695
+ if (err instanceof ToolError) {
27696
+ return {
27697
+ error: {
27698
+ code: err.code,
27699
+ message: err.message
27700
+ }
27701
+ };
27702
+ }
27404
27703
  const errorMessage = err instanceof Error ? err.message : String(err);
27405
27704
  const result = {
27406
27705
  content: [{ type: "text", text: `Error: ${errorMessage}` }],
@@ -28176,9 +28475,9 @@ var init_shapes = __esm({
28176
28475
  });
28177
28476
 
28178
28477
  // packages/agent-mcp-config/src/apply.ts
28179
- import path37 from "node:path";
28478
+ import path38 from "node:path";
28180
28479
  function getConfigDirectory(configPath) {
28181
- return path37.dirname(configPath);
28480
+ return path38.dirname(configPath);
28182
28481
  }
28183
28482
  function isConfigObject5(value) {
28184
28483
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -28468,7 +28767,7 @@ var init_mcp2 = __esm({
28468
28767
 
28469
28768
  // packages/agent-skill-config/src/configs.ts
28470
28769
  import os4 from "node:os";
28471
- import path38 from "node:path";
28770
+ import path39 from "node:path";
28472
28771
  function resolveAgentSupport2(input, registry = agentSkillConfigs) {
28473
28772
  const resolvedId = resolveAgentId(input);
28474
28773
  if (!resolvedId) {
@@ -28504,7 +28803,7 @@ var init_configs3 = __esm({
28504
28803
  });
28505
28804
 
28506
28805
  // packages/agent-skill-config/src/templates.ts
28507
- import { readFile as readFile12 } from "node:fs/promises";
28806
+ import { readFile as readFile13 } from "node:fs/promises";
28508
28807
  async function getTemplates() {
28509
28808
  if (templatesCache) {
28510
28809
  return templatesCache;
@@ -28512,7 +28811,7 @@ async function getTemplates() {
28512
28811
  const entries = await Promise.all(
28513
28812
  TEMPLATE_NAMES.map(async (name) => {
28514
28813
  const url = new URL(`./templates/${name}`, import.meta.url);
28515
- return [name, await readFile12(url, "utf8")];
28814
+ return [name, await readFile13(url, "utf8")];
28516
28815
  })
28517
28816
  );
28518
28817
  templatesCache = Object.fromEntries(entries);
@@ -29554,8 +29853,8 @@ var init_models2 = __esm({
29554
29853
  });
29555
29854
 
29556
29855
  // src/cli/commands/pipeline.ts
29557
- import path39 from "node:path";
29558
- import { readFile as readFile13, stat as stat11 } from "node:fs/promises";
29856
+ import path40 from "node:path";
29857
+ import { readFile as readFile14, stat as stat11 } from "node:fs/promises";
29559
29858
  import { fileURLToPath as fileURLToPath7 } from "node:url";
29560
29859
  async function resolvePipelinePlanDirectory(container) {
29561
29860
  const configDoc = await readMergedDocument(
@@ -29602,11 +29901,11 @@ function resolveMaxRuns(value) {
29602
29901
  return parsed;
29603
29902
  }
29604
29903
  function resolvePipelinePaths(scope, cwd, homeDir) {
29605
- const rootPath = scope === "global" ? path39.join(homeDir, ".poe-code", "pipeline") : path39.join(cwd, ".poe-code", "pipeline");
29904
+ const rootPath = scope === "global" ? path40.join(homeDir, ".poe-code", "pipeline") : path40.join(cwd, ".poe-code", "pipeline");
29606
29905
  const displayRoot = scope === "global" ? "~/.poe-code/pipeline" : ".poe-code/pipeline";
29607
29906
  return {
29608
- plansPath: path39.join(rootPath, "plans"),
29609
- stepsPath: path39.join(rootPath, "steps.yaml"),
29907
+ plansPath: path40.join(rootPath, "plans"),
29908
+ stepsPath: path40.join(rootPath, "steps.yaml"),
29610
29909
  displayPlansPath: `${displayRoot}/plans`,
29611
29910
  displayStepsPath: `${displayRoot}/steps.yaml`
29612
29911
  };
@@ -29617,16 +29916,16 @@ async function loadPipelineTemplates() {
29617
29916
  }
29618
29917
  const packageRoot = await findPackageRoot(fileURLToPath7(import.meta.url));
29619
29918
  const templateRoots = [
29620
- path39.join(packageRoot, "src", "templates", "pipeline"),
29621
- path39.join(packageRoot, "dist", "templates", "pipeline")
29919
+ path40.join(packageRoot, "src", "templates", "pipeline"),
29920
+ path40.join(packageRoot, "dist", "templates", "pipeline")
29622
29921
  ];
29623
29922
  for (const templateRoot of templateRoots) {
29624
29923
  if (!await pathExistsOnDisk(templateRoot)) {
29625
29924
  continue;
29626
29925
  }
29627
29926
  const [skillPlan, steps] = await Promise.all([
29628
- readFile13(path39.join(templateRoot, "SKILL_plan.md"), "utf8"),
29629
- readFile13(path39.join(templateRoot, "steps.yaml.hbs"), "utf8")
29927
+ readFile14(path40.join(templateRoot, "SKILL_plan.md"), "utf8"),
29928
+ readFile14(path40.join(templateRoot, "steps.yaml.hbs"), "utf8")
29630
29929
  ]);
29631
29930
  pipelineTemplatesCache = { skillPlan, steps };
29632
29931
  return pipelineTemplatesCache;
@@ -29645,12 +29944,12 @@ async function pathExistsOnDisk(targetPath) {
29645
29944
  }
29646
29945
  }
29647
29946
  async function findPackageRoot(entryFilePath) {
29648
- let currentPath = path39.dirname(entryFilePath);
29947
+ let currentPath = path40.dirname(entryFilePath);
29649
29948
  while (true) {
29650
- if (await pathExistsOnDisk(path39.join(currentPath, "package.json"))) {
29949
+ if (await pathExistsOnDisk(path40.join(currentPath, "package.json"))) {
29651
29950
  return currentPath;
29652
29951
  }
29653
- const parentPath = path39.dirname(currentPath);
29952
+ const parentPath = path40.dirname(currentPath);
29654
29953
  if (parentPath === currentPath) {
29655
29954
  throw new Error("Unable to locate package root for Pipeline templates.");
29656
29955
  }
@@ -29851,16 +30150,16 @@ function registerPipelineCommand(program, container) {
29851
30150
  resources.logger.success("Plan is valid.");
29852
30151
  const opts = this.opts();
29853
30152
  if (opts.preview) {
29854
- const readFile15 = container.fs.readFile.bind(container.fs);
30153
+ const readFile16 = container.fs.readFile.bind(container.fs);
29855
30154
  const resolvedVars = {};
29856
30155
  for (const [key, value] of Object.entries(plan.vars ?? {})) {
29857
- resolvedVars[key] = await resolveFileIncludes(value, container.env.cwd, readFile15);
30156
+ resolvedVars[key] = await resolveFileIncludes(value, container.env.cwd, readFile16);
29858
30157
  }
29859
30158
  const resolvedSetup = plan.setup === null ? void 0 : plan.setup ?? steps.setup;
29860
30159
  const resolvedTeardown = plan.teardown === null ? void 0 : plan.teardown ?? steps.teardown;
29861
30160
  if (resolvedSetup) {
29862
30161
  const raw = Object.keys(resolvedVars).length > 0 ? interpolate(resolvedSetup.prompt, resolvedVars) : resolvedSetup.prompt;
29863
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile15);
30162
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile16);
29864
30163
  resources.logger.resolved("setup", expanded);
29865
30164
  }
29866
30165
  for (const task of plan.tasks) {
@@ -29868,7 +30167,7 @@ function registerPipelineCommand(program, container) {
29868
30167
  const expanded = await resolveFileIncludes(
29869
30168
  buildExecutionPrompt({ selection: { kind: "run", task }, steps: steps.steps, planPath: file, vars: resolvedVars }),
29870
30169
  container.env.cwd,
29871
- readFile15
30170
+ readFile16
29872
30171
  );
29873
30172
  resources.logger.resolved(`task: ${task.id} \u2014 ${task.title}`, expanded);
29874
30173
  } else {
@@ -29876,7 +30175,7 @@ function registerPipelineCommand(program, container) {
29876
30175
  const expanded = await resolveFileIncludes(
29877
30176
  buildExecutionPrompt({ selection: { kind: "run", task, stepName }, steps: steps.steps, planPath: file, vars: resolvedVars }),
29878
30177
  container.env.cwd,
29879
- readFile15
30178
+ readFile16
29880
30179
  );
29881
30180
  resources.logger.resolved(`task: ${task.id} / ${stepName}`, expanded);
29882
30181
  }
@@ -29884,7 +30183,7 @@ function registerPipelineCommand(program, container) {
29884
30183
  }
29885
30184
  if (resolvedTeardown) {
29886
30185
  const raw = Object.keys(resolvedVars).length > 0 ? interpolate(resolvedTeardown.prompt, resolvedVars) : resolvedTeardown.prompt;
29887
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile15);
30186
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile16);
29888
30187
  resources.logger.resolved("teardown", expanded);
29889
30188
  }
29890
30189
  }
@@ -30003,7 +30302,7 @@ function registerPipelineCommand(program, container) {
30003
30302
  `Would ${stepsExists ? "overwrite" : "create"}: ${pipelinePaths.displayStepsPath}`
30004
30303
  );
30005
30304
  } else {
30006
- await container.fs.mkdir(path39.dirname(pipelinePaths.stepsPath), {
30305
+ await container.fs.mkdir(path40.dirname(pipelinePaths.stepsPath), {
30007
30306
  recursive: true
30008
30307
  });
30009
30308
  await container.fs.writeFile(pipelinePaths.stepsPath, templates.steps, {
@@ -30042,7 +30341,7 @@ var init_pipeline3 = __esm({
30042
30341
  });
30043
30342
 
30044
30343
  // src/cli/commands/ralph.ts
30045
- import path40 from "node:path";
30344
+ import path41 from "node:path";
30046
30345
  function formatDuration2(ms) {
30047
30346
  const totalSeconds = Math.round(ms / 1e3);
30048
30347
  const minutes = Math.floor(totalSeconds / 60);
@@ -30078,9 +30377,9 @@ function normalizeConfiguredIterations(value) {
30078
30377
  }
30079
30378
  function resolveAbsoluteDocPath4(container, docPath) {
30080
30379
  if (docPath.startsWith("~/")) {
30081
- return path40.join(container.env.homeDir, docPath.slice(2));
30380
+ return path41.join(container.env.homeDir, docPath.slice(2));
30082
30381
  }
30083
- return path40.isAbsolute(docPath) ? docPath : path40.resolve(container.env.cwd, docPath);
30382
+ return path41.isAbsolute(docPath) ? docPath : path41.resolve(container.env.cwd, docPath);
30084
30383
  }
30085
30384
  async function resolvePlanDirectory2(container) {
30086
30385
  const configDoc = await readMergedDocument(
@@ -30451,11 +30750,11 @@ var init_ralph3 = __esm({
30451
30750
  });
30452
30751
 
30453
30752
  // src/cli/commands/experiment.ts
30454
- import path41 from "node:path";
30455
- import { readFile as readFile14, stat as stat12 } from "node:fs/promises";
30753
+ import path42 from "node:path";
30754
+ import { readFile as readFile15, stat as stat12 } from "node:fs/promises";
30456
30755
  import { fileURLToPath as fileURLToPath8 } from "node:url";
30457
30756
  function resolveExperimentPaths(scope, cwd, homeDir) {
30458
- const rootPath = scope === "global" ? path41.join(homeDir, ".poe-code", "experiments") : path41.join(cwd, ".poe-code", "experiments");
30757
+ const rootPath = scope === "global" ? path42.join(homeDir, ".poe-code", "experiments") : path42.join(cwd, ".poe-code", "experiments");
30459
30758
  const displayRoot = scope === "global" ? "~/.poe-code/experiments" : ".poe-code/experiments";
30460
30759
  return {
30461
30760
  experimentsPath: rootPath,
@@ -30474,12 +30773,12 @@ async function pathExistsOnDisk2(targetPath) {
30474
30773
  }
30475
30774
  }
30476
30775
  async function findPackageRoot2(entryFilePath) {
30477
- let currentPath = path41.dirname(entryFilePath);
30776
+ let currentPath = path42.dirname(entryFilePath);
30478
30777
  while (true) {
30479
- if (await pathExistsOnDisk2(path41.join(currentPath, "package.json"))) {
30778
+ if (await pathExistsOnDisk2(path42.join(currentPath, "package.json"))) {
30480
30779
  return currentPath;
30481
30780
  }
30482
- const parentPath = path41.dirname(currentPath);
30781
+ const parentPath = path42.dirname(currentPath);
30483
30782
  if (parentPath === currentPath) {
30484
30783
  throw new Error("Unable to locate package root for Experiment templates.");
30485
30784
  }
@@ -30492,16 +30791,16 @@ async function loadExperimentTemplates() {
30492
30791
  }
30493
30792
  const packageRoot = await findPackageRoot2(fileURLToPath8(import.meta.url));
30494
30793
  const templateRoots = [
30495
- path41.join(packageRoot, "src", "templates", "experiment"),
30496
- path41.join(packageRoot, "dist", "templates", "experiment")
30794
+ path42.join(packageRoot, "src", "templates", "experiment"),
30795
+ path42.join(packageRoot, "dist", "templates", "experiment")
30497
30796
  ];
30498
30797
  for (const templateRoot of templateRoots) {
30499
30798
  if (!await pathExistsOnDisk2(templateRoot)) {
30500
30799
  continue;
30501
30800
  }
30502
30801
  const [skillPlan, runYaml] = await Promise.all([
30503
- readFile14(path41.join(templateRoot, "SKILL_experiment.md"), "utf8"),
30504
- readFile14(path41.join(templateRoot, "run.yaml.hbs"), "utf8")
30802
+ readFile15(path42.join(templateRoot, "SKILL_experiment.md"), "utf8"),
30803
+ readFile15(path42.join(templateRoot, "run.yaml.hbs"), "utf8")
30505
30804
  ]);
30506
30805
  experimentTemplatesCache = { skillPlan, runYaml };
30507
30806
  return experimentTemplatesCache;
@@ -30574,12 +30873,12 @@ function parseNonNegativeInt(value, fieldName) {
30574
30873
  }
30575
30874
  function resolveAbsoluteDocPath5(container, docPath) {
30576
30875
  if (docPath.startsWith("~/")) {
30577
- return path41.join(container.env.homeDir, docPath.slice(2));
30876
+ return path42.join(container.env.homeDir, docPath.slice(2));
30578
30877
  }
30579
- return path41.isAbsolute(docPath) ? docPath : path41.resolve(container.env.cwd, docPath);
30878
+ return path42.isAbsolute(docPath) ? docPath : path42.resolve(container.env.cwd, docPath);
30580
30879
  }
30581
30880
  async function discoverExperimentDocs(container) {
30582
- const directoryPath = path41.join(container.env.cwd, EXPERIMENTS_DIRECTORY);
30881
+ const directoryPath = path42.join(container.env.cwd, EXPERIMENTS_DIRECTORY);
30583
30882
  let names;
30584
30883
  try {
30585
30884
  names = await container.fs.readdir(directoryPath);
@@ -30594,8 +30893,8 @@ async function discoverExperimentDocs(container) {
30594
30893
  if (!name.endsWith(".md")) {
30595
30894
  continue;
30596
30895
  }
30597
- const relativePath = path41.join(EXPERIMENTS_DIRECTORY, name);
30598
- const absolutePath = path41.join(directoryPath, name);
30896
+ const relativePath = path42.join(EXPERIMENTS_DIRECTORY, name);
30897
+ const absolutePath = path42.join(directoryPath, name);
30599
30898
  const stat13 = await container.fs.stat(absolutePath);
30600
30899
  if (!stat13.isFile()) {
30601
30900
  continue;
@@ -31011,8 +31310,8 @@ function registerExperimentCommand(program, container) {
31011
31310
  );
31012
31311
  }
31013
31312
  }
31014
- const runYamlPath = path41.join(experimentPaths.experimentsPath, "run.yaml");
31015
- const runYamlDisplayPath = path41.join(experimentPaths.displayExperimentsPath, "run.yaml");
31313
+ const runYamlPath = path42.join(experimentPaths.experimentsPath, "run.yaml");
31314
+ const runYamlDisplayPath = path42.join(experimentPaths.displayExperimentsPath, "run.yaml");
31016
31315
  if (!await pathExists4(container.fs, runYamlPath)) {
31017
31316
  if (flags.dryRun) {
31018
31317
  resources.logger.dryRun(`Would create: ${runYamlDisplayPath}`);
@@ -31044,7 +31343,7 @@ var init_experiment2 = __esm({
31044
31343
  await init_experiment();
31045
31344
  DEFAULT_EXPERIMENT_AGENT = "claude-code";
31046
31345
  DEFAULT_EXPERIMENT_SCOPE = "local";
31047
- EXPERIMENTS_DIRECTORY = path41.join(".poe-code", "experiments");
31346
+ EXPERIMENTS_DIRECTORY = path42.join(".poe-code", "experiments");
31048
31347
  experimentTemplatesCache = null;
31049
31348
  }
31050
31349
  });
@@ -31476,7 +31775,7 @@ var init_package = __esm({
31476
31775
  "package.json"() {
31477
31776
  package_default = {
31478
31777
  name: "poe-code",
31479
- version: "3.0.148",
31778
+ version: "3.0.150",
31480
31779
  description: "CLI tool to configure Poe API for developer workflows.",
31481
31780
  type: "module",
31482
31781
  main: "./dist/index.js",
@@ -32331,7 +32630,7 @@ init_src7();
32331
32630
  init_src5();
32332
32631
  init_constants();
32333
32632
  init_errors();
32334
- import path33 from "node:path";
32633
+ import path34 from "node:path";
32335
32634
  import { Command } from "commander";
32336
32635
  function parseMcpSpawnConfig(input) {
32337
32636
  if (!input) {
@@ -32402,10 +32701,10 @@ function resolveWorkingDirectory(baseDir, candidate) {
32402
32701
  if (!candidate || candidate.trim().length === 0) {
32403
32702
  return void 0;
32404
32703
  }
32405
- if (path33.isAbsolute(candidate)) {
32704
+ if (path34.isAbsolute(candidate)) {
32406
32705
  return candidate;
32407
32706
  }
32408
- return path33.resolve(baseDir, candidate);
32707
+ return path34.resolve(baseDir, candidate);
32409
32708
  }
32410
32709
  function createPoeAgentProgram() {
32411
32710
  const program = new Command();