poe-code 3.0.340 → 3.0.342
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 +143 -22
- package/dist/index.js.map +3 -3
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/maestro-tui/dist/actions.js +20 -4
- package/packages/maestro-tui/dist/explorer-config.js +40 -3
- package/packages/plan-browser/dist/actions.js +54 -8
- package/packages/plan-browser/dist/discovery.js +31 -5
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
|
|
71016
|
-
|
|
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 (!
|
|
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, "
|
|
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 =
|
|
71222
|
-
|
|
71223
|
-
|
|
71224
|
-
|
|
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);
|
|
@@ -91822,11 +91895,16 @@ function buildOpenSourceAction(options) {
|
|
|
91822
91895
|
id: "open-source",
|
|
91823
91896
|
key: "o",
|
|
91824
91897
|
label: "Open in $EDITOR",
|
|
91825
|
-
predicate: (ctx) => getTask(options.taskByRowId(), ctx.row.id)
|
|
91898
|
+
predicate: (ctx) => getSourcePath(getTask(options.taskByRowId(), ctx.row.id)) !== null,
|
|
91826
91899
|
handler: async (ctx) => {
|
|
91827
91900
|
const task = getTask(options.taskByRowId(), ctx.row.id);
|
|
91901
|
+
const sourcePath = getSourcePath(task);
|
|
91902
|
+
if (sourcePath === null) {
|
|
91903
|
+
ctx.toast("No source file available.", "info");
|
|
91904
|
+
return;
|
|
91905
|
+
}
|
|
91828
91906
|
await ctx.suspendAnd(async () => {
|
|
91829
|
-
editFile(
|
|
91907
|
+
editFile(sourcePath, { env: options.variables });
|
|
91830
91908
|
});
|
|
91831
91909
|
await ctx.refresh();
|
|
91832
91910
|
ctx.toast(`Edited ${task.qualifiedId}`, "info");
|
|
@@ -91858,13 +91936,24 @@ function getIssueUrl(task) {
|
|
|
91858
91936
|
if (typeof url !== "string") {
|
|
91859
91937
|
return null;
|
|
91860
91938
|
}
|
|
91939
|
+
const trimmedUrl = url.trim();
|
|
91940
|
+
if (trimmedUrl.length === 0) {
|
|
91941
|
+
return null;
|
|
91942
|
+
}
|
|
91861
91943
|
try {
|
|
91862
|
-
const parsedUrl = new URL(
|
|
91863
|
-
return parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:" ?
|
|
91944
|
+
const parsedUrl = new URL(trimmedUrl);
|
|
91945
|
+
return parsedUrl.protocol === "http:" || parsedUrl.protocol === "https:" ? trimmedUrl : null;
|
|
91864
91946
|
} catch {
|
|
91865
91947
|
return null;
|
|
91866
91948
|
}
|
|
91867
91949
|
}
|
|
91950
|
+
function getSourcePath(task) {
|
|
91951
|
+
const sourcePath = task.sourcePath;
|
|
91952
|
+
if (typeof sourcePath !== "string" || sourcePath.trim().length === 0) {
|
|
91953
|
+
return null;
|
|
91954
|
+
}
|
|
91955
|
+
return sourcePath;
|
|
91956
|
+
}
|
|
91868
91957
|
function getTask(taskByRowId, rowId) {
|
|
91869
91958
|
const task = taskByRowId.get(rowId);
|
|
91870
91959
|
if (task === void 0) {
|
|
@@ -91960,6 +92049,7 @@ async function renderTaskDetailMarkdown(task, taskList) {
|
|
|
91960
92049
|
const eventsMarkdown = await renderEventsMarkdown(task, taskList);
|
|
91961
92050
|
const description = task.description.length > 0 ? task.description : "_No description._";
|
|
91962
92051
|
const metadata = stringify7(task.metadata).trimEnd();
|
|
92052
|
+
const metadataFence = buildBacktickFence(metadata);
|
|
91963
92053
|
return [
|
|
91964
92054
|
`# ${task.name}`,
|
|
91965
92055
|
"",
|
|
@@ -91969,9 +92059,9 @@ async function renderTaskDetailMarkdown(task, taskList) {
|
|
|
91969
92059
|
"",
|
|
91970
92060
|
"## Metadata",
|
|
91971
92061
|
"",
|
|
91972
|
-
|
|
92062
|
+
`${metadataFence}yaml`,
|
|
91973
92063
|
metadata,
|
|
91974
|
-
|
|
92064
|
+
metadataFence,
|
|
91975
92065
|
"",
|
|
91976
92066
|
"## Next",
|
|
91977
92067
|
"",
|
|
@@ -91986,9 +92076,42 @@ async function renderEventsMarkdown(task, taskList) {
|
|
|
91986
92076
|
}
|
|
91987
92077
|
return events.map((event) => `- ${event}`).join("\n");
|
|
91988
92078
|
} catch (err) {
|
|
91989
|
-
return `_Could not load events: ${err
|
|
92079
|
+
return `_Could not load events: ${formatThrownValue(err)}_`;
|
|
91990
92080
|
}
|
|
91991
92081
|
}
|
|
92082
|
+
function buildBacktickFence(content) {
|
|
92083
|
+
return "`".repeat(Math.max(3, longestCharacterRun(content, "`") + 1));
|
|
92084
|
+
}
|
|
92085
|
+
function longestCharacterRun(content, expected) {
|
|
92086
|
+
let longest = 0;
|
|
92087
|
+
let current = 0;
|
|
92088
|
+
for (const character of content) {
|
|
92089
|
+
if (character === expected) {
|
|
92090
|
+
current += 1;
|
|
92091
|
+
longest = Math.max(longest, current);
|
|
92092
|
+
} else {
|
|
92093
|
+
current = 0;
|
|
92094
|
+
}
|
|
92095
|
+
}
|
|
92096
|
+
return longest;
|
|
92097
|
+
}
|
|
92098
|
+
function formatThrownValue(value) {
|
|
92099
|
+
if (value instanceof Error && value.message.length > 0) {
|
|
92100
|
+
return value.message;
|
|
92101
|
+
}
|
|
92102
|
+
if (typeof value === "string" && value.length > 0) {
|
|
92103
|
+
return value;
|
|
92104
|
+
}
|
|
92105
|
+
try {
|
|
92106
|
+
const json = JSON.stringify(value);
|
|
92107
|
+
if (json !== void 0 && json.length > 0) {
|
|
92108
|
+
return json;
|
|
92109
|
+
}
|
|
92110
|
+
} catch {
|
|
92111
|
+
}
|
|
92112
|
+
const text5 = String(value);
|
|
92113
|
+
return text5.length > 0 ? text5 : "unknown error";
|
|
92114
|
+
}
|
|
91992
92115
|
function toTaskMap(tasks) {
|
|
91993
92116
|
const taskByRowId = /* @__PURE__ */ new Map();
|
|
91994
92117
|
for (const task of tasks) {
|
|
@@ -92038,9 +92161,7 @@ var init_explorer_config2 = __esm({
|
|
|
92038
92161
|
STATE_ORDER_INDEX = new Map(
|
|
92039
92162
|
STATE_ORDER.map((state, index) => [state, index])
|
|
92040
92163
|
);
|
|
92041
|
-
STATE_TONES = new Map(
|
|
92042
|
-
KNOWN_STATES.map(({ state, tone }) => [state, tone])
|
|
92043
|
-
);
|
|
92164
|
+
STATE_TONES = new Map(KNOWN_STATES.map(({ state, tone }) => [state, tone]));
|
|
92044
92165
|
}
|
|
92045
92166
|
});
|
|
92046
92167
|
|
|
@@ -138215,7 +138336,7 @@ var init_package2 = __esm({
|
|
|
138215
138336
|
"package.json"() {
|
|
138216
138337
|
package_default2 = {
|
|
138217
138338
|
name: "poe-code",
|
|
138218
|
-
version: "3.0.
|
|
138339
|
+
version: "3.0.342",
|
|
138219
138340
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
138220
138341
|
type: "module",
|
|
138221
138342
|
main: "./dist/index.js",
|