poe-code 3.0.340 → 3.0.341

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
@@ -71012,8 +71012,13 @@ function resolveAbsoluteDirectory4(dir, cwd, homeDir) {
71012
71012
  }
71013
71013
  return path89.isAbsolute(dir) ? dir : path89.resolve(cwd, dir);
71014
71014
  }
71015
- function isMarkdownFile2(name) {
71016
- return name.toLowerCase().endsWith(".md");
71015
+ function isSupportedPlanFile(name) {
71016
+ const lowerName = name.toLowerCase();
71017
+ return lowerName.endsWith(".md") || lowerName.endsWith(".yaml") || lowerName.endsWith(".yml");
71018
+ }
71019
+ function isYamlPlanFile(name) {
71020
+ const lowerName = name.toLowerCase();
71021
+ return lowerName.endsWith(".yaml") || lowerName.endsWith(".yml");
71017
71022
  }
71018
71023
  function getPlanTypeLabel(kind) {
71019
71024
  switch (kind) {
@@ -71061,6 +71066,10 @@ function toPlanKind(value, filePath) {
71061
71066
  throw new Error(`${filePath}: unsupported frontmatter kind ${JSON.stringify(value)}`);
71062
71067
  }
71063
71068
  function classifyPlanKind(content, filePath) {
71069
+ if (isYamlPlanFile(filePath)) {
71070
+ parsePlan(content);
71071
+ return "pipeline";
71072
+ }
71064
71073
  const { data } = splitFrontmatter2(content, filePath);
71065
71074
  if (data === void 0) {
71066
71075
  return "plan";
@@ -71096,15 +71105,31 @@ async function discoverSharedPlans(options) {
71096
71105
  }
71097
71106
  const plans = [];
71098
71107
  for (const name of entries) {
71099
- if (!isMarkdownFile2(name)) {
71108
+ if (!isSupportedPlanFile(name)) {
71100
71109
  continue;
71101
71110
  }
71102
71111
  const absolutePath = path89.join(absoluteDir, name);
71103
- const canonicalPath = await options.fs.realpath(absolutePath);
71112
+ const canonicalPath = await options.fs.realpath(absolutePath).catch((error3) => {
71113
+ if (isNotFound3(error3)) {
71114
+ return void 0;
71115
+ }
71116
+ throw error3;
71117
+ });
71118
+ if (canonicalPath === void 0) {
71119
+ continue;
71120
+ }
71104
71121
  if (canonicalPath !== path89.resolve(absolutePath)) {
71105
71122
  throw new Error(`Plan file must not be a symbolic link: ${path89.join(displayDir, name)}`);
71106
71123
  }
71107
- const stat33 = await options.fs.stat(absolutePath);
71124
+ const stat33 = await options.fs.stat(absolutePath).catch((error3) => {
71125
+ if (isNotFound3(error3)) {
71126
+ return void 0;
71127
+ }
71128
+ throw error3;
71129
+ });
71130
+ if (stat33 === void 0) {
71131
+ continue;
71132
+ }
71108
71133
  if (!stat33.isFile()) {
71109
71134
  continue;
71110
71135
  }
@@ -71148,6 +71173,7 @@ async function discoverAllPlans(options) {
71148
71173
  var init_discovery4 = __esm({
71149
71174
  "packages/plan-browser/src/discovery.ts"() {
71150
71175
  "use strict";
71176
+ init_src31();
71151
71177
  init_src9();
71152
71178
  init_error_codes15();
71153
71179
  init_format();
@@ -71158,7 +71184,7 @@ var init_discovery4 = __esm({
71158
71184
  import path90 from "node:path";
71159
71185
  import { spawnSync as nodeSpawnSync2 } from "node:child_process";
71160
71186
  function resolveEditor2(env = process.env) {
71161
- const editor = getOwnEnvValue2(env, "EDITOR")?.trim() || getOwnEnvValue2(env, "VISUAL")?.trim() || "vi";
71187
+ const editor = getOwnEnvValue2(env, "VISUAL")?.trim() || getOwnEnvValue2(env, "EDITOR")?.trim() || "vi";
71162
71188
  return editor.length > 0 ? editor : "vi";
71163
71189
  }
71164
71190
  function editFile(absolutePath, options = {}) {
@@ -71217,12 +71243,59 @@ function getOwnEnvValue2(env, key2) {
71217
71243
  function hasErrorCode3(error3, code) {
71218
71244
  return hasOwnErrorCode19(error3, code);
71219
71245
  }
71246
+ function isCommandWhitespace(character) {
71247
+ return character === " " || character === " " || character === "\n" || character === "\r";
71248
+ }
71220
71249
  function parseEditorCommand(command) {
71221
- const parts = command.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g) ?? [];
71222
- return parts.map((part) => {
71223
- const quote = part[0];
71224
- return (quote === '"' || quote === "'") && part.at(-1) === quote ? part.slice(1, -1) : part;
71225
- });
71250
+ const parts = [];
71251
+ let current = "";
71252
+ let quote;
71253
+ let escaping = false;
71254
+ let hasToken = false;
71255
+ for (const character of command) {
71256
+ if (escaping) {
71257
+ current += character;
71258
+ escaping = false;
71259
+ hasToken = true;
71260
+ continue;
71261
+ }
71262
+ if (character === "\\") {
71263
+ escaping = true;
71264
+ hasToken = true;
71265
+ continue;
71266
+ }
71267
+ if (quote !== void 0) {
71268
+ if (character === quote) {
71269
+ quote = void 0;
71270
+ } else {
71271
+ current += character;
71272
+ hasToken = true;
71273
+ }
71274
+ continue;
71275
+ }
71276
+ if (character === "'" || character === '"') {
71277
+ quote = character;
71278
+ hasToken = true;
71279
+ continue;
71280
+ }
71281
+ if (isCommandWhitespace(character)) {
71282
+ if (hasToken) {
71283
+ parts.push(current);
71284
+ current = "";
71285
+ hasToken = false;
71286
+ }
71287
+ continue;
71288
+ }
71289
+ current += character;
71290
+ hasToken = true;
71291
+ }
71292
+ if (escaping) {
71293
+ current += "\\";
71294
+ }
71295
+ if (hasToken) {
71296
+ parts.push(current);
71297
+ }
71298
+ return parts;
71226
71299
  }
71227
71300
  async function deletePlan(entry, fs29) {
71228
71301
  await fs29.unlink(entry.absolutePath);
@@ -138215,7 +138288,7 @@ var init_package2 = __esm({
138215
138288
  "package.json"() {
138216
138289
  package_default2 = {
138217
138290
  name: "poe-code",
138218
- version: "3.0.340",
138291
+ version: "3.0.341",
138219
138292
  description: "CLI tool to configure Poe API for developer workflows.",
138220
138293
  type: "module",
138221
138294
  main: "./dist/index.js",