poe-code 3.0.148 → 3.0.149

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)),
@@ -18338,7 +18582,8 @@ var init_commands = __esm({
18338
18582
  );
18339
18583
  const automation = await loadNamedAutomation(name, cwd);
18340
18584
  const agent2 = automation.agent ?? params.agent ?? "codex";
18341
- const sharedTemplateContext = buildTemplateContext(env);
18585
+ const variables = await loadVariables(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd));
18586
+ const sharedTemplateContext = { ...variables, ...buildTemplateContext(env) };
18342
18587
  if (automation.source === void 0) {
18343
18588
  const prompt = renderPrompt(automation.prompt, sharedTemplateContext);
18344
18589
  return {
@@ -18429,55 +18674,59 @@ var init_commands = __esm({
18429
18674
  });
18430
18675
  installCommand = defineCommand({
18431
18676
  name: "install",
18432
- description: "Install an automation workflow into the current repo.",
18677
+ description: "Install one or all automation workflows into the current repo.",
18433
18678
  positional: ["name"],
18434
18679
  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
- }),
18680
+ name: S.Optional(
18681
+ S.Enum(installableAutomations, {
18682
+ description: "Pick a GitHub workflow to install",
18683
+ loadOptions: async () => {
18684
+ const automations = await discoverAutomations(await resolveBuiltInPromptsDir());
18685
+ return automations.map((a) => ({ label: a.label ?? formatLabel(a.name), value: a.name }));
18686
+ }
18687
+ })
18688
+ ),
18442
18689
  eject: S.Optional(S.Boolean())
18443
18690
  }),
18444
18691
  scope: ["cli"],
18445
18692
  handler: async ({ params }) => {
18446
- const name = params.name;
18447
- const isEject = params.eject === true;
18448
- const variant = isEject ? "ejected" : "caller";
18449
18693
  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");
18694
+ const names = params.name === void 0 ? [...installableAutomations] : [params.name];
18695
+ const installations = [];
18696
+ for (const name of names) {
18697
+ installations.push(await installAutomation(name, cwd, params.eject === true));
18462
18698
  }
18699
+ const supportFiles = await ensureProjectSupportFiles(
18700
+ cwd,
18701
+ await loadVariables(await resolveBuiltInAssetsDir())
18702
+ );
18463
18703
  return {
18464
- name,
18465
- workflowPath,
18466
- promptPath,
18467
- ejected: isEject,
18468
- promptContent: rawPrompt
18704
+ installations,
18705
+ ...supportFiles
18469
18706
  };
18470
18707
  },
18471
18708
  render: {
18472
18709
  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`);
18710
+ if (result.installations.length === 1) {
18711
+ const [installation] = result.installations;
18712
+ logger2.success(`Installed workflow at ${installation.workflowPath}`);
18713
+ if (installation.promptPath !== void 0) {
18714
+ logger2.message(`Prompt copied to ${installation.promptPath}`);
18715
+ }
18716
+ note2(installation.promptContent, "Default prompt");
18717
+ if (!installation.ejected) {
18718
+ logger2.message(
18719
+ `To customize the prompt, run: poe-code github-workflows install ${installation.name} --eject`
18720
+ );
18721
+ }
18722
+ } else {
18723
+ logger2.success(`Installed ${result.installations.length} workflows.`);
18724
+ for (const installation of result.installations) {
18725
+ logger2.message(installation.workflowPath);
18726
+ }
18480
18727
  }
18728
+ logger2.message(`Shared variables written to ${result.variablesPath}`);
18729
+ logger2.message(`Command reference written to ${result.readmePath}`);
18481
18730
  },
18482
18731
  json: (result) => result
18483
18732
  }
@@ -18498,7 +18747,7 @@ var init_commands = __esm({
18498
18747
  scope: ["cli"],
18499
18748
  handler: async ({ params }) => {
18500
18749
  const name = params.name;
18501
- const workflowPath = path28.join(resolveCwd(), ".github", "workflows", `poe-code-${name}.yml`);
18750
+ const workflowPath = path29.join(resolveCwd(), ".github", "workflows", `poe-code-${name}.yml`);
18502
18751
  try {
18503
18752
  await unlink2(workflowPath);
18504
18753
  } catch (error2) {
@@ -18576,10 +18825,12 @@ var init_commands = __esm({
18576
18825
  }),
18577
18826
  scope: ["cli", "sdk"],
18578
18827
  handler: async ({ params, env }) => {
18579
- const automation = await loadNamedAutomation(params.name, resolveCwd());
18828
+ const cwd = resolveCwd();
18829
+ const automation = await loadNamedAutomation(params.name, cwd);
18830
+ const variables = await loadVariables(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd));
18580
18831
  return {
18581
18832
  name: automation.name,
18582
- prompt: renderPrompt(automation.prompt, buildTemplateContext(env))
18833
+ prompt: renderPrompt(automation.prompt, { ...variables, ...buildTemplateContext(env) })
18583
18834
  };
18584
18835
  },
18585
18836
  render: {
@@ -18589,6 +18840,37 @@ var init_commands = __esm({
18589
18840
  json: (result) => result
18590
18841
  }
18591
18842
  });
18843
+ variablesCommand = defineCommand({
18844
+ name: "variables",
18845
+ description: "List shared prompt variables and where each value comes from.",
18846
+ params: S.Object({}),
18847
+ scope: ["cli", "sdk"],
18848
+ handler: async () => {
18849
+ const cwd = resolveCwd();
18850
+ return (await loadVariableStatuses(await resolveBuiltInAssetsDir(), projectGitHubWorkflowsDir(cwd))).map(
18851
+ (status) => ({
18852
+ ...status,
18853
+ source: status.source === "built-in" ? status.source : path29.relative(cwd, status.source)
18854
+ })
18855
+ );
18856
+ },
18857
+ render: {
18858
+ rich: (result, { logger: logger2, renderTable: renderTable3, getTheme: getTheme2 }) => {
18859
+ logger2.message(
18860
+ renderTable3({
18861
+ theme: getTheme2(),
18862
+ columns: [
18863
+ { name: "name", title: "Name", alignment: "left", maxLen: 32 },
18864
+ { name: "status", title: "Status", alignment: "left", maxLen: 12 },
18865
+ { name: "source", title: "Source", alignment: "left", maxLen: 48 }
18866
+ ],
18867
+ rows: result
18868
+ })
18869
+ );
18870
+ },
18871
+ json: (result) => result
18872
+ }
18873
+ });
18592
18874
  ghGroup = defineGroup({
18593
18875
  name: "github-workflows",
18594
18876
  aliases: ["gh"],
@@ -18601,7 +18883,8 @@ var init_commands = __esm({
18601
18883
  listCommand,
18602
18884
  installCommand,
18603
18885
  uninstallCommand,
18604
- promptPreviewCommand
18886
+ promptPreviewCommand,
18887
+ variablesCommand
18605
18888
  ],
18606
18889
  default: runCommandDef
18607
18890
  });
@@ -18745,7 +19028,7 @@ var init_execution_context = __esm({
18745
19028
  });
18746
19029
 
18747
19030
  // src/sdk/launch.ts
18748
- import path29 from "node:path";
19031
+ import path30 from "node:path";
18749
19032
  import { spawnSync as spawnSync2 } from "node:child_process";
18750
19033
  async function startLaunch(options) {
18751
19034
  const homeDir = resolveHomeDir(options.homeDir);
@@ -18851,7 +19134,7 @@ async function runLaunchDaemon(options) {
18851
19134
  });
18852
19135
  }
18853
19136
  function resolveLaunchBaseDir(homeDir) {
18854
- return path29.join(homeDir, ".poe-code", "launch");
19137
+ return path30.join(homeDir, ".poe-code", "launch");
18855
19138
  }
18856
19139
  function resolveHomeDir(homeDir) {
18857
19140
  if (homeDir) {
@@ -18867,7 +19150,7 @@ function normalizeLaunchSpec(spec, baseDir) {
18867
19150
  if (locator.scheme !== "local") {
18868
19151
  return spec;
18869
19152
  }
18870
- const cwd = path29.isAbsolute(locator.path) ? locator.path : path29.resolve(baseDir, locator.path);
19153
+ const cwd = path30.isAbsolute(locator.path) ? locator.path : path30.resolve(baseDir, locator.path);
18871
19154
  return {
18872
19155
  ...spec,
18873
19156
  cwd
@@ -19944,7 +20227,7 @@ var init_acp_core = __esm({
19944
20227
  });
19945
20228
 
19946
20229
  // packages/poe-agent/src/plugins/plugin-args.ts
19947
- import path30 from "node:path";
20230
+ import path31 from "node:path";
19948
20231
  function isObjectRecord3(value) {
19949
20232
  return typeof value === "object" && value !== null && !Array.isArray(value);
19950
20233
  }
@@ -19975,13 +20258,13 @@ function getOptionalString(args, key) {
19975
20258
  return value;
19976
20259
  }
19977
20260
  function resolveAllowedPath(cwd, allowedPaths, inputPath) {
19978
- const resolvedPath = path30.resolve(cwd, inputPath);
20261
+ const resolvedPath = path31.resolve(cwd, inputPath);
19979
20262
  const isAllowed = allowedPaths.some((allowedPath) => {
19980
20263
  if (allowedPath === resolvedPath) {
19981
20264
  return true;
19982
20265
  }
19983
- const rel = path30.relative(allowedPath, resolvedPath);
19984
- return rel.length > 0 && !rel.startsWith("..") && !path30.isAbsolute(rel);
20266
+ const rel = path31.relative(allowedPath, resolvedPath);
20267
+ return rel.length > 0 && !rel.startsWith("..") && !path31.isAbsolute(rel);
19985
20268
  });
19986
20269
  if (!isAllowed) {
19987
20270
  throw new Error(`Path is outside allowed paths: ${inputPath}`);
@@ -19996,7 +20279,7 @@ var init_plugin_args = __esm({
19996
20279
 
19997
20280
  // packages/poe-agent/src/plugins/poe-agent-plugin-files.ts
19998
20281
  import fsPromises9 from "node:fs/promises";
19999
- import path31 from "node:path";
20282
+ import path32 from "node:path";
20000
20283
  async function fileExists(fs3, filePath) {
20001
20284
  try {
20002
20285
  await fs3.readFile(filePath, "utf8");
@@ -20020,9 +20303,9 @@ var init_poe_agent_plugin_files = __esm({
20020
20303
  "use strict";
20021
20304
  init_plugin_args();
20022
20305
  filesPlugin = (options = {}) => {
20023
- const cwd = path31.resolve(options.cwd ?? process.cwd());
20306
+ const cwd = path32.resolve(options.cwd ?? process.cwd());
20024
20307
  const allowedPaths = (options.allowedPaths ?? [cwd]).map(
20025
- (allowedPath) => path31.resolve(cwd, allowedPath)
20308
+ (allowedPath) => path32.resolve(cwd, allowedPath)
20026
20309
  );
20027
20310
  const fs3 = options.fs ?? fsPromises9;
20028
20311
  const readFileTool = {
@@ -20076,7 +20359,7 @@ var init_poe_agent_plugin_files = __esm({
20076
20359
  async call(args) {
20077
20360
  const command = getRequiredString(args, "command");
20078
20361
  const filePath = resolveAllowedPath(cwd, allowedPaths, getRequiredString(args, "path"));
20079
- const displayedPath = path31.relative(cwd, filePath) || path31.basename(filePath);
20362
+ const displayedPath = path32.relative(cwd, filePath) || path32.basename(filePath);
20080
20363
  if (command === "str_replace") {
20081
20364
  const oldStr = getRequiredString(args, "old_str", true);
20082
20365
  const newStr = getRequiredString(args, "new_str", true);
@@ -20096,7 +20379,7 @@ var init_poe_agent_plugin_files = __esm({
20096
20379
  if (await fileExists(fs3, filePath)) {
20097
20380
  throw new Error("File already exists \u2014 use str_replace to edit");
20098
20381
  }
20099
- await fs3.mkdir(path31.dirname(filePath), { recursive: true });
20382
+ await fs3.mkdir(path32.dirname(filePath), { recursive: true });
20100
20383
  await fs3.writeFile(filePath, fileText, "utf8");
20101
20384
  return `Created file: ${displayedPath}`;
20102
20385
  }
@@ -20137,7 +20420,7 @@ var init_poe_agent_plugin_files = __esm({
20137
20420
 
20138
20421
  // packages/poe-agent/src/plugins/poe-agent-plugin-shell.ts
20139
20422
  import { exec as execCallback2 } from "node:child_process";
20140
- import path32 from "node:path";
20423
+ import path33 from "node:path";
20141
20424
  import { promisify } from "node:util";
20142
20425
  async function defaultRunCommand(command, cwd) {
20143
20426
  try {
@@ -20170,9 +20453,9 @@ var init_poe_agent_plugin_shell = __esm({
20170
20453
  init_plugin_args();
20171
20454
  exec = promisify(execCallback2);
20172
20455
  shellPlugin = (options = {}) => {
20173
- const cwd = path32.resolve(options.cwd ?? process.cwd());
20456
+ const cwd = path33.resolve(options.cwd ?? process.cwd());
20174
20457
  const allowedPaths = (options.allowedPaths ?? [cwd]).map(
20175
- (allowedPath) => path32.resolve(cwd, allowedPath)
20458
+ (allowedPath) => path33.resolve(cwd, allowedPath)
20176
20459
  );
20177
20460
  const runCommand2 = options.runCommand ?? defaultRunCommand;
20178
20461
  const runCommandTool = {
@@ -20210,7 +20493,7 @@ var init_poe_agent_plugin_shell = __esm({
20210
20493
 
20211
20494
  // packages/poe-agent/src/system-prompt.ts
20212
20495
  import { readFileSync } from "node:fs";
20213
- import { readFile as readFile10 } from "node:fs/promises";
20496
+ import { readFile as readFile11 } from "node:fs/promises";
20214
20497
  import { fileURLToPath as fileURLToPath6 } from "node:url";
20215
20498
  function loadSystemPromptSync() {
20216
20499
  return readFileSync(SYSTEM_PROMPT_PATH, "utf8");
@@ -23531,15 +23814,15 @@ var init_renderer3 = __esm({
23531
23814
  });
23532
23815
 
23533
23816
  // 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";
23817
+ import { access as access2, readFile as readFile12, writeFile as writeFile7 } from "node:fs/promises";
23818
+ import path35 from "node:path";
23536
23819
  import { Command as CommanderCommand, CommanderError, InvalidArgumentError, Option } from "commander";
23537
23820
  function inferProgramName(argv) {
23538
23821
  const entrypoint = argv[1];
23539
23822
  if (typeof entrypoint !== "string" || entrypoint.length === 0) {
23540
23823
  return "cmdkit";
23541
23824
  }
23542
- const parsed = path34.parse(entrypoint);
23825
+ const parsed = path35.parse(entrypoint);
23543
23826
  return parsed.name.length > 0 ? parsed.name : "cmdkit";
23544
23827
  }
23545
23828
  function normalizeRoots(roots, argv) {
@@ -23596,11 +23879,11 @@ function formatSegment(segment, casing) {
23596
23879
  const separator = casing === "snake" ? "_" : "-";
23597
23880
  return splitWords(segment).join(separator);
23598
23881
  }
23599
- function toOptionFlag(path42, casing) {
23600
- return `--${path42.map((segment) => formatSegment(segment, casing)).join(".")}`;
23882
+ function toOptionFlag(path43, casing) {
23883
+ return `--${path43.map((segment) => formatSegment(segment, casing)).join(".")}`;
23601
23884
  }
23602
- function toOptionAttribute(path42, casing) {
23603
- return path42.map((segment) => {
23885
+ function toOptionAttribute(path43, casing) {
23886
+ return path43.map((segment) => {
23604
23887
  const formatted = formatSegment(segment, casing);
23605
23888
  if (casing === "snake") {
23606
23889
  return formatted;
@@ -23611,13 +23894,13 @@ function toOptionAttribute(path42, casing) {
23611
23894
  ).join("");
23612
23895
  }).join(".");
23613
23896
  }
23614
- function toDisplayPath(path42) {
23615
- return path42.join(".");
23897
+ function toDisplayPath(path43) {
23898
+ return path43.join(".");
23616
23899
  }
23617
- function collectFields(schema, casing, path42 = [], inheritedOptional = false) {
23900
+ function collectFields(schema, casing, path43 = [], inheritedOptional = false) {
23618
23901
  const fields = [];
23619
23902
  for (const [key, rawChildSchema] of Object.entries(schema.shape)) {
23620
- const nextPath = [...path42, key];
23903
+ const nextPath = [...path43, key];
23621
23904
  const optional = inheritedOptional || rawChildSchema.kind === "optional";
23622
23905
  const childSchema = unwrapOptional(rawChildSchema);
23623
23906
  if (childSchema.kind === "object") {
@@ -23640,9 +23923,9 @@ function collectFields(schema, casing, path42 = [], inheritedOptional = false) {
23640
23923
  }
23641
23924
  return fields;
23642
23925
  }
23643
- function toCommanderOptionAttribute(path42, casing) {
23644
- const optionAttribute = toOptionAttribute(path42, casing);
23645
- const optionFlag = toOptionFlag(path42, casing);
23926
+ function toCommanderOptionAttribute(path43, casing) {
23927
+ const optionAttribute = toOptionAttribute(path43, casing);
23928
+ const optionFlag = toOptionFlag(path43, casing);
23646
23929
  if (!GLOBAL_LONG_OPTION_FLAGS.has(optionFlag)) {
23647
23930
  return optionAttribute;
23648
23931
  }
@@ -24076,10 +24359,10 @@ function addGlobalOptions(command) {
24076
24359
  throw new InvalidArgumentError('Invalid value for "--output". Expected one of: rich, md, json.');
24077
24360
  }).option("--verbose", "Print stack traces for unexpected errors.");
24078
24361
  }
24079
- function setNestedValue(target, path42, value) {
24362
+ function setNestedValue(target, path43, value) {
24080
24363
  let cursor = target;
24081
- for (let index = 0; index < path42.length - 1; index += 1) {
24082
- const segment = path42[index] ?? "";
24364
+ for (let index = 0; index < path43.length - 1; index += 1) {
24365
+ const segment = path43[index] ?? "";
24083
24366
  const existing = cursor[segment];
24084
24367
  if (typeof existing === "object" && existing !== null) {
24085
24368
  cursor = existing;
@@ -24089,7 +24372,7 @@ function setNestedValue(target, path42, value) {
24089
24372
  cursor[segment] = next;
24090
24373
  cursor = next;
24091
24374
  }
24092
- const leaf = path42[path42.length - 1];
24375
+ const leaf = path43[path43.length - 1];
24093
24376
  if (leaf !== void 0) {
24094
24377
  cursor[leaf] = value;
24095
24378
  }
@@ -24179,13 +24462,13 @@ async function withOutputFormat2(output, fn) {
24179
24462
  }
24180
24463
  function createFs() {
24181
24464
  return {
24182
- readFile: async (path42, encoding = "utf8") => readFile11(path42, { encoding }),
24183
- writeFile: async (path42, contents) => {
24184
- await writeFile7(path42, contents);
24465
+ readFile: async (path43, encoding = "utf8") => readFile12(path43, { encoding }),
24466
+ writeFile: async (path43, contents) => {
24467
+ await writeFile7(path43, contents);
24185
24468
  },
24186
- exists: async (path42) => {
24469
+ exists: async (path43) => {
24187
24470
  try {
24188
- await access2(path42);
24471
+ await access2(path43);
24189
24472
  return true;
24190
24473
  } catch {
24191
24474
  return false;
@@ -24206,9 +24489,9 @@ function isPlainObject(value) {
24206
24489
  function hasFieldValue(value) {
24207
24490
  return value !== void 0;
24208
24491
  }
24209
- function hasNestedField(fields, path42) {
24492
+ function hasNestedField(fields, path43) {
24210
24493
  return fields.some(
24211
- (field) => path42.length < field.path.length && path42.every((segment, index) => field.path[index] === segment)
24494
+ (field) => path43.length < field.path.length && path43.every((segment, index) => field.path[index] === segment)
24212
24495
  );
24213
24496
  }
24214
24497
  function describeExpectedPresetValue(schema) {
@@ -24271,7 +24554,7 @@ function validatePresetFieldValue(value, field, presetPath) {
24271
24554
  async function loadPresetValues(fields, presetPath) {
24272
24555
  let rawPreset;
24273
24556
  try {
24274
- rawPreset = await readFile11(presetPath, {
24557
+ rawPreset = await readFile12(presetPath, {
24275
24558
  encoding: "utf8"
24276
24559
  });
24277
24560
  } catch (error2) {
@@ -24292,9 +24575,9 @@ async function loadPresetValues(fields, presetPath) {
24292
24575
  }
24293
24576
  const fieldByPath = new Map(fields.map((field) => [field.displayPath, field]));
24294
24577
  const presetValues = {};
24295
- function visitObject(current, path42) {
24578
+ function visitObject(current, path43) {
24296
24579
  for (const [key, value] of Object.entries(current)) {
24297
- const nextPath = [...path42, key];
24580
+ const nextPath = [...path43, key];
24298
24581
  const displayPath = toDisplayPath(nextPath);
24299
24582
  const field = fieldByPath.get(displayPath);
24300
24583
  if (field !== void 0) {
@@ -24492,8 +24775,8 @@ function createFixtureService(definition) {
24492
24775
  );
24493
24776
  }
24494
24777
  function resolveFixturePath(commandPath) {
24495
- const parsed = path34.parse(commandPath);
24496
- return path34.join(parsed.dir, `${parsed.name}.fixture.json`);
24778
+ const parsed = path35.parse(commandPath);
24779
+ return path35.join(parsed.dir, `${parsed.name}.fixture.json`);
24497
24780
  }
24498
24781
  function selectFixtureScenario(scenarios, selector) {
24499
24782
  if (isNumericFixtureSelector(selector)) {
@@ -24520,7 +24803,7 @@ async function loadFixtureScenario(command, selector) {
24520
24803
  const fixturePath = resolveFixturePath(commandPath);
24521
24804
  let rawFixture;
24522
24805
  try {
24523
- rawFixture = await readFile11(fixturePath, {
24806
+ rawFixture = await readFile12(fixturePath, {
24524
24807
  encoding: "utf8"
24525
24808
  });
24526
24809
  } catch {
@@ -24968,7 +25251,7 @@ var init_container2 = __esm({
24968
25251
  });
24969
25252
 
24970
25253
  // src/services/config.ts
24971
- import path35 from "node:path";
25254
+ import path36 from "node:path";
24972
25255
  async function deleteConfig(options) {
24973
25256
  const { fs: fs3, filePath } = options;
24974
25257
  try {
@@ -25049,7 +25332,7 @@ async function migrateLegacyCredentialsIfNeeded(fs3, filePath) {
25049
25332
  await migrateLegacyCredentialsFile(fs3, filePath);
25050
25333
  }
25051
25334
  async function migrateLegacyCredentialsFile(fs3, configPath) {
25052
- const legacyPath = path35.join(path35.dirname(configPath), "credentials.json");
25335
+ const legacyPath = path36.join(path36.dirname(configPath), "credentials.json");
25053
25336
  const raw = await readFileIfExists(fs3, legacyPath);
25054
25337
  if (raw === null) {
25055
25338
  return;
@@ -25083,7 +25366,7 @@ function parseLegacyConfigDocument(raw) {
25083
25366
  }
25084
25367
  }
25085
25368
  function normalizeLegacyConfigDocument(value) {
25086
- if (!isRecord11(value)) {
25369
+ if (!isRecord12(value)) {
25087
25370
  return {};
25088
25371
  }
25089
25372
  const document = {};
@@ -25097,12 +25380,12 @@ function normalizeLegacyConfigDocument(value) {
25097
25380
  return document;
25098
25381
  }
25099
25382
  function normalizeConfiguredServices(value) {
25100
- if (!isRecord11(value)) {
25383
+ if (!isRecord12(value)) {
25101
25384
  return {};
25102
25385
  }
25103
25386
  const entries = {};
25104
25387
  for (const [key, entry] of Object.entries(value)) {
25105
- if (!isRecord11(entry)) {
25388
+ if (!isRecord12(entry)) {
25106
25389
  continue;
25107
25390
  }
25108
25391
  entries[key] = normalizeConfiguredServiceMetadata({
@@ -25117,11 +25400,11 @@ async function recoverInvalidConfig(fs3, filePath, content) {
25117
25400
  await fs3.writeFile(filePath, EMPTY_DOCUMENT3, { encoding: "utf8" });
25118
25401
  }
25119
25402
  function createInvalidBackupPath2(filePath) {
25120
- const directory = path35.dirname(filePath);
25121
- const baseName = path35.basename(filePath);
25122
- return path35.join(directory, `${baseName}.invalid-${createTimestamp()}.json`);
25403
+ const directory = path36.dirname(filePath);
25404
+ const baseName = path36.basename(filePath);
25405
+ return path36.join(directory, `${baseName}.invalid-${createTimestamp()}.json`);
25123
25406
  }
25124
- function isRecord11(value) {
25407
+ function isRecord12(value) {
25125
25408
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
25126
25409
  }
25127
25410
  var coreConfigScope, ralphConfigScope, pipelineConfigScope, knownConfigScopes, CORE_SCOPE, configuredServicesScope, EMPTY_DOCUMENT3;
@@ -26571,7 +26854,7 @@ var init_media_download = __esm({
26571
26854
  });
26572
26855
 
26573
26856
  // src/cli/commands/generate.ts
26574
- import path36 from "node:path";
26857
+ import path37 from "node:path";
26575
26858
  function registerGenerateCommand(program, container) {
26576
26859
  const generate2 = program.command("generate").alias("g").description("Generate content via Poe API").option("--model <model>", `Model identifier (default: ${DEFAULT_TEXT_MODEL})`).option(
26577
26860
  "--param <key=value>",
@@ -26844,11 +27127,11 @@ function getDefaultMimeType(type) {
26844
27127
  return defaults[type];
26845
27128
  }
26846
27129
  function resolveOutputPath(filename, cwd) {
26847
- if (path36.isAbsolute(filename)) {
27130
+ if (path37.isAbsolute(filename)) {
26848
27131
  return { path: filename, label: filename };
26849
27132
  }
26850
27133
  return {
26851
- path: path36.join(cwd, filename),
27134
+ path: path37.join(cwd, filename),
26852
27135
  label: `./${filename}`
26853
27136
  };
26854
27137
  }
@@ -26879,7 +27162,7 @@ var init_generate = __esm({
26879
27162
  });
26880
27163
 
26881
27164
  // packages/tiny-stdio-mcp-server/src/types.ts
26882
- var JSON_RPC_ERROR_CODES;
27165
+ var JSON_RPC_ERROR_CODES, ToolError;
26883
27166
  var init_types4 = __esm({
26884
27167
  "packages/tiny-stdio-mcp-server/src/types.ts"() {
26885
27168
  "use strict";
@@ -26890,6 +27173,13 @@ var init_types4 = __esm({
26890
27173
  INVALID_PARAMS: -32602,
26891
27174
  INTERNAL_ERROR: -32603
26892
27175
  };
27176
+ ToolError = class extends Error {
27177
+ constructor(code, message2) {
27178
+ super(message2);
27179
+ this.code = code;
27180
+ this.name = "ToolError";
27181
+ }
27182
+ };
26893
27183
  }
26894
27184
  });
26895
27185
 
@@ -27401,6 +27691,14 @@ function createServer(options) {
27401
27691
  const result = { content: toContentBlocks(handlerResult) };
27402
27692
  return { result };
27403
27693
  } catch (err) {
27694
+ if (err instanceof ToolError) {
27695
+ return {
27696
+ error: {
27697
+ code: err.code,
27698
+ message: err.message
27699
+ }
27700
+ };
27701
+ }
27404
27702
  const errorMessage = err instanceof Error ? err.message : String(err);
27405
27703
  const result = {
27406
27704
  content: [{ type: "text", text: `Error: ${errorMessage}` }],
@@ -28176,9 +28474,9 @@ var init_shapes = __esm({
28176
28474
  });
28177
28475
 
28178
28476
  // packages/agent-mcp-config/src/apply.ts
28179
- import path37 from "node:path";
28477
+ import path38 from "node:path";
28180
28478
  function getConfigDirectory(configPath) {
28181
- return path37.dirname(configPath);
28479
+ return path38.dirname(configPath);
28182
28480
  }
28183
28481
  function isConfigObject5(value) {
28184
28482
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -28468,7 +28766,7 @@ var init_mcp2 = __esm({
28468
28766
 
28469
28767
  // packages/agent-skill-config/src/configs.ts
28470
28768
  import os4 from "node:os";
28471
- import path38 from "node:path";
28769
+ import path39 from "node:path";
28472
28770
  function resolveAgentSupport2(input, registry = agentSkillConfigs) {
28473
28771
  const resolvedId = resolveAgentId(input);
28474
28772
  if (!resolvedId) {
@@ -28504,7 +28802,7 @@ var init_configs3 = __esm({
28504
28802
  });
28505
28803
 
28506
28804
  // packages/agent-skill-config/src/templates.ts
28507
- import { readFile as readFile12 } from "node:fs/promises";
28805
+ import { readFile as readFile13 } from "node:fs/promises";
28508
28806
  async function getTemplates() {
28509
28807
  if (templatesCache) {
28510
28808
  return templatesCache;
@@ -28512,7 +28810,7 @@ async function getTemplates() {
28512
28810
  const entries = await Promise.all(
28513
28811
  TEMPLATE_NAMES.map(async (name) => {
28514
28812
  const url = new URL(`./templates/${name}`, import.meta.url);
28515
- return [name, await readFile12(url, "utf8")];
28813
+ return [name, await readFile13(url, "utf8")];
28516
28814
  })
28517
28815
  );
28518
28816
  templatesCache = Object.fromEntries(entries);
@@ -29554,8 +29852,8 @@ var init_models2 = __esm({
29554
29852
  });
29555
29853
 
29556
29854
  // src/cli/commands/pipeline.ts
29557
- import path39 from "node:path";
29558
- import { readFile as readFile13, stat as stat11 } from "node:fs/promises";
29855
+ import path40 from "node:path";
29856
+ import { readFile as readFile14, stat as stat11 } from "node:fs/promises";
29559
29857
  import { fileURLToPath as fileURLToPath7 } from "node:url";
29560
29858
  async function resolvePipelinePlanDirectory(container) {
29561
29859
  const configDoc = await readMergedDocument(
@@ -29602,11 +29900,11 @@ function resolveMaxRuns(value) {
29602
29900
  return parsed;
29603
29901
  }
29604
29902
  function resolvePipelinePaths(scope, cwd, homeDir) {
29605
- const rootPath = scope === "global" ? path39.join(homeDir, ".poe-code", "pipeline") : path39.join(cwd, ".poe-code", "pipeline");
29903
+ const rootPath = scope === "global" ? path40.join(homeDir, ".poe-code", "pipeline") : path40.join(cwd, ".poe-code", "pipeline");
29606
29904
  const displayRoot = scope === "global" ? "~/.poe-code/pipeline" : ".poe-code/pipeline";
29607
29905
  return {
29608
- plansPath: path39.join(rootPath, "plans"),
29609
- stepsPath: path39.join(rootPath, "steps.yaml"),
29906
+ plansPath: path40.join(rootPath, "plans"),
29907
+ stepsPath: path40.join(rootPath, "steps.yaml"),
29610
29908
  displayPlansPath: `${displayRoot}/plans`,
29611
29909
  displayStepsPath: `${displayRoot}/steps.yaml`
29612
29910
  };
@@ -29617,16 +29915,16 @@ async function loadPipelineTemplates() {
29617
29915
  }
29618
29916
  const packageRoot = await findPackageRoot(fileURLToPath7(import.meta.url));
29619
29917
  const templateRoots = [
29620
- path39.join(packageRoot, "src", "templates", "pipeline"),
29621
- path39.join(packageRoot, "dist", "templates", "pipeline")
29918
+ path40.join(packageRoot, "src", "templates", "pipeline"),
29919
+ path40.join(packageRoot, "dist", "templates", "pipeline")
29622
29920
  ];
29623
29921
  for (const templateRoot of templateRoots) {
29624
29922
  if (!await pathExistsOnDisk(templateRoot)) {
29625
29923
  continue;
29626
29924
  }
29627
29925
  const [skillPlan, steps] = await Promise.all([
29628
- readFile13(path39.join(templateRoot, "SKILL_plan.md"), "utf8"),
29629
- readFile13(path39.join(templateRoot, "steps.yaml.hbs"), "utf8")
29926
+ readFile14(path40.join(templateRoot, "SKILL_plan.md"), "utf8"),
29927
+ readFile14(path40.join(templateRoot, "steps.yaml.hbs"), "utf8")
29630
29928
  ]);
29631
29929
  pipelineTemplatesCache = { skillPlan, steps };
29632
29930
  return pipelineTemplatesCache;
@@ -29645,12 +29943,12 @@ async function pathExistsOnDisk(targetPath) {
29645
29943
  }
29646
29944
  }
29647
29945
  async function findPackageRoot(entryFilePath) {
29648
- let currentPath = path39.dirname(entryFilePath);
29946
+ let currentPath = path40.dirname(entryFilePath);
29649
29947
  while (true) {
29650
- if (await pathExistsOnDisk(path39.join(currentPath, "package.json"))) {
29948
+ if (await pathExistsOnDisk(path40.join(currentPath, "package.json"))) {
29651
29949
  return currentPath;
29652
29950
  }
29653
- const parentPath = path39.dirname(currentPath);
29951
+ const parentPath = path40.dirname(currentPath);
29654
29952
  if (parentPath === currentPath) {
29655
29953
  throw new Error("Unable to locate package root for Pipeline templates.");
29656
29954
  }
@@ -29851,16 +30149,16 @@ function registerPipelineCommand(program, container) {
29851
30149
  resources.logger.success("Plan is valid.");
29852
30150
  const opts = this.opts();
29853
30151
  if (opts.preview) {
29854
- const readFile15 = container.fs.readFile.bind(container.fs);
30152
+ const readFile16 = container.fs.readFile.bind(container.fs);
29855
30153
  const resolvedVars = {};
29856
30154
  for (const [key, value] of Object.entries(plan.vars ?? {})) {
29857
- resolvedVars[key] = await resolveFileIncludes(value, container.env.cwd, readFile15);
30155
+ resolvedVars[key] = await resolveFileIncludes(value, container.env.cwd, readFile16);
29858
30156
  }
29859
30157
  const resolvedSetup = plan.setup === null ? void 0 : plan.setup ?? steps.setup;
29860
30158
  const resolvedTeardown = plan.teardown === null ? void 0 : plan.teardown ?? steps.teardown;
29861
30159
  if (resolvedSetup) {
29862
30160
  const raw = Object.keys(resolvedVars).length > 0 ? interpolate(resolvedSetup.prompt, resolvedVars) : resolvedSetup.prompt;
29863
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile15);
30161
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile16);
29864
30162
  resources.logger.resolved("setup", expanded);
29865
30163
  }
29866
30164
  for (const task of plan.tasks) {
@@ -29868,7 +30166,7 @@ function registerPipelineCommand(program, container) {
29868
30166
  const expanded = await resolveFileIncludes(
29869
30167
  buildExecutionPrompt({ selection: { kind: "run", task }, steps: steps.steps, planPath: file, vars: resolvedVars }),
29870
30168
  container.env.cwd,
29871
- readFile15
30169
+ readFile16
29872
30170
  );
29873
30171
  resources.logger.resolved(`task: ${task.id} \u2014 ${task.title}`, expanded);
29874
30172
  } else {
@@ -29876,7 +30174,7 @@ function registerPipelineCommand(program, container) {
29876
30174
  const expanded = await resolveFileIncludes(
29877
30175
  buildExecutionPrompt({ selection: { kind: "run", task, stepName }, steps: steps.steps, planPath: file, vars: resolvedVars }),
29878
30176
  container.env.cwd,
29879
- readFile15
30177
+ readFile16
29880
30178
  );
29881
30179
  resources.logger.resolved(`task: ${task.id} / ${stepName}`, expanded);
29882
30180
  }
@@ -29884,7 +30182,7 @@ function registerPipelineCommand(program, container) {
29884
30182
  }
29885
30183
  if (resolvedTeardown) {
29886
30184
  const raw = Object.keys(resolvedVars).length > 0 ? interpolate(resolvedTeardown.prompt, resolvedVars) : resolvedTeardown.prompt;
29887
- const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile15);
30185
+ const expanded = await resolveFileIncludes(raw, container.env.cwd, readFile16);
29888
30186
  resources.logger.resolved("teardown", expanded);
29889
30187
  }
29890
30188
  }
@@ -30003,7 +30301,7 @@ function registerPipelineCommand(program, container) {
30003
30301
  `Would ${stepsExists ? "overwrite" : "create"}: ${pipelinePaths.displayStepsPath}`
30004
30302
  );
30005
30303
  } else {
30006
- await container.fs.mkdir(path39.dirname(pipelinePaths.stepsPath), {
30304
+ await container.fs.mkdir(path40.dirname(pipelinePaths.stepsPath), {
30007
30305
  recursive: true
30008
30306
  });
30009
30307
  await container.fs.writeFile(pipelinePaths.stepsPath, templates.steps, {
@@ -30042,7 +30340,7 @@ var init_pipeline3 = __esm({
30042
30340
  });
30043
30341
 
30044
30342
  // src/cli/commands/ralph.ts
30045
- import path40 from "node:path";
30343
+ import path41 from "node:path";
30046
30344
  function formatDuration2(ms) {
30047
30345
  const totalSeconds = Math.round(ms / 1e3);
30048
30346
  const minutes = Math.floor(totalSeconds / 60);
@@ -30078,9 +30376,9 @@ function normalizeConfiguredIterations(value) {
30078
30376
  }
30079
30377
  function resolveAbsoluteDocPath4(container, docPath) {
30080
30378
  if (docPath.startsWith("~/")) {
30081
- return path40.join(container.env.homeDir, docPath.slice(2));
30379
+ return path41.join(container.env.homeDir, docPath.slice(2));
30082
30380
  }
30083
- return path40.isAbsolute(docPath) ? docPath : path40.resolve(container.env.cwd, docPath);
30381
+ return path41.isAbsolute(docPath) ? docPath : path41.resolve(container.env.cwd, docPath);
30084
30382
  }
30085
30383
  async function resolvePlanDirectory2(container) {
30086
30384
  const configDoc = await readMergedDocument(
@@ -30451,11 +30749,11 @@ var init_ralph3 = __esm({
30451
30749
  });
30452
30750
 
30453
30751
  // src/cli/commands/experiment.ts
30454
- import path41 from "node:path";
30455
- import { readFile as readFile14, stat as stat12 } from "node:fs/promises";
30752
+ import path42 from "node:path";
30753
+ import { readFile as readFile15, stat as stat12 } from "node:fs/promises";
30456
30754
  import { fileURLToPath as fileURLToPath8 } from "node:url";
30457
30755
  function resolveExperimentPaths(scope, cwd, homeDir) {
30458
- const rootPath = scope === "global" ? path41.join(homeDir, ".poe-code", "experiments") : path41.join(cwd, ".poe-code", "experiments");
30756
+ const rootPath = scope === "global" ? path42.join(homeDir, ".poe-code", "experiments") : path42.join(cwd, ".poe-code", "experiments");
30459
30757
  const displayRoot = scope === "global" ? "~/.poe-code/experiments" : ".poe-code/experiments";
30460
30758
  return {
30461
30759
  experimentsPath: rootPath,
@@ -30474,12 +30772,12 @@ async function pathExistsOnDisk2(targetPath) {
30474
30772
  }
30475
30773
  }
30476
30774
  async function findPackageRoot2(entryFilePath) {
30477
- let currentPath = path41.dirname(entryFilePath);
30775
+ let currentPath = path42.dirname(entryFilePath);
30478
30776
  while (true) {
30479
- if (await pathExistsOnDisk2(path41.join(currentPath, "package.json"))) {
30777
+ if (await pathExistsOnDisk2(path42.join(currentPath, "package.json"))) {
30480
30778
  return currentPath;
30481
30779
  }
30482
- const parentPath = path41.dirname(currentPath);
30780
+ const parentPath = path42.dirname(currentPath);
30483
30781
  if (parentPath === currentPath) {
30484
30782
  throw new Error("Unable to locate package root for Experiment templates.");
30485
30783
  }
@@ -30492,16 +30790,16 @@ async function loadExperimentTemplates() {
30492
30790
  }
30493
30791
  const packageRoot = await findPackageRoot2(fileURLToPath8(import.meta.url));
30494
30792
  const templateRoots = [
30495
- path41.join(packageRoot, "src", "templates", "experiment"),
30496
- path41.join(packageRoot, "dist", "templates", "experiment")
30793
+ path42.join(packageRoot, "src", "templates", "experiment"),
30794
+ path42.join(packageRoot, "dist", "templates", "experiment")
30497
30795
  ];
30498
30796
  for (const templateRoot of templateRoots) {
30499
30797
  if (!await pathExistsOnDisk2(templateRoot)) {
30500
30798
  continue;
30501
30799
  }
30502
30800
  const [skillPlan, runYaml] = await Promise.all([
30503
- readFile14(path41.join(templateRoot, "SKILL_experiment.md"), "utf8"),
30504
- readFile14(path41.join(templateRoot, "run.yaml.hbs"), "utf8")
30801
+ readFile15(path42.join(templateRoot, "SKILL_experiment.md"), "utf8"),
30802
+ readFile15(path42.join(templateRoot, "run.yaml.hbs"), "utf8")
30505
30803
  ]);
30506
30804
  experimentTemplatesCache = { skillPlan, runYaml };
30507
30805
  return experimentTemplatesCache;
@@ -30574,12 +30872,12 @@ function parseNonNegativeInt(value, fieldName) {
30574
30872
  }
30575
30873
  function resolveAbsoluteDocPath5(container, docPath) {
30576
30874
  if (docPath.startsWith("~/")) {
30577
- return path41.join(container.env.homeDir, docPath.slice(2));
30875
+ return path42.join(container.env.homeDir, docPath.slice(2));
30578
30876
  }
30579
- return path41.isAbsolute(docPath) ? docPath : path41.resolve(container.env.cwd, docPath);
30877
+ return path42.isAbsolute(docPath) ? docPath : path42.resolve(container.env.cwd, docPath);
30580
30878
  }
30581
30879
  async function discoverExperimentDocs(container) {
30582
- const directoryPath = path41.join(container.env.cwd, EXPERIMENTS_DIRECTORY);
30880
+ const directoryPath = path42.join(container.env.cwd, EXPERIMENTS_DIRECTORY);
30583
30881
  let names;
30584
30882
  try {
30585
30883
  names = await container.fs.readdir(directoryPath);
@@ -30594,8 +30892,8 @@ async function discoverExperimentDocs(container) {
30594
30892
  if (!name.endsWith(".md")) {
30595
30893
  continue;
30596
30894
  }
30597
- const relativePath = path41.join(EXPERIMENTS_DIRECTORY, name);
30598
- const absolutePath = path41.join(directoryPath, name);
30895
+ const relativePath = path42.join(EXPERIMENTS_DIRECTORY, name);
30896
+ const absolutePath = path42.join(directoryPath, name);
30599
30897
  const stat13 = await container.fs.stat(absolutePath);
30600
30898
  if (!stat13.isFile()) {
30601
30899
  continue;
@@ -31011,8 +31309,8 @@ function registerExperimentCommand(program, container) {
31011
31309
  );
31012
31310
  }
31013
31311
  }
31014
- const runYamlPath = path41.join(experimentPaths.experimentsPath, "run.yaml");
31015
- const runYamlDisplayPath = path41.join(experimentPaths.displayExperimentsPath, "run.yaml");
31312
+ const runYamlPath = path42.join(experimentPaths.experimentsPath, "run.yaml");
31313
+ const runYamlDisplayPath = path42.join(experimentPaths.displayExperimentsPath, "run.yaml");
31016
31314
  if (!await pathExists4(container.fs, runYamlPath)) {
31017
31315
  if (flags.dryRun) {
31018
31316
  resources.logger.dryRun(`Would create: ${runYamlDisplayPath}`);
@@ -31044,7 +31342,7 @@ var init_experiment2 = __esm({
31044
31342
  await init_experiment();
31045
31343
  DEFAULT_EXPERIMENT_AGENT = "claude-code";
31046
31344
  DEFAULT_EXPERIMENT_SCOPE = "local";
31047
- EXPERIMENTS_DIRECTORY = path41.join(".poe-code", "experiments");
31345
+ EXPERIMENTS_DIRECTORY = path42.join(".poe-code", "experiments");
31048
31346
  experimentTemplatesCache = null;
31049
31347
  }
31050
31348
  });
@@ -31476,7 +31774,7 @@ var init_package = __esm({
31476
31774
  "package.json"() {
31477
31775
  package_default = {
31478
31776
  name: "poe-code",
31479
- version: "3.0.148",
31777
+ version: "3.0.149",
31480
31778
  description: "CLI tool to configure Poe API for developer workflows.",
31481
31779
  type: "module",
31482
31780
  main: "./dist/index.js",
@@ -32331,7 +32629,7 @@ init_src7();
32331
32629
  init_src5();
32332
32630
  init_constants();
32333
32631
  init_errors();
32334
- import path33 from "node:path";
32632
+ import path34 from "node:path";
32335
32633
  import { Command } from "commander";
32336
32634
  function parseMcpSpawnConfig(input) {
32337
32635
  if (!input) {
@@ -32402,10 +32700,10 @@ function resolveWorkingDirectory(baseDir, candidate) {
32402
32700
  if (!candidate || candidate.trim().length === 0) {
32403
32701
  return void 0;
32404
32702
  }
32405
- if (path33.isAbsolute(candidate)) {
32703
+ if (path34.isAbsolute(candidate)) {
32406
32704
  return candidate;
32407
32705
  }
32408
- return path33.resolve(baseDir, candidate);
32706
+ return path34.resolve(baseDir, candidate);
32409
32707
  }
32410
32708
  function createPoeAgentProgram() {
32411
32709
  const program = new Command();