poe-code 3.0.138 → 3.0.139
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 +33 -19
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13956,12 +13956,12 @@ var init_frontmatter3 = __esm({
|
|
|
13956
13956
|
// packages/github-workflows/src/discover.ts
|
|
13957
13957
|
import { readdir as readdir9, readFile as readFile8 } from "node:fs/promises";
|
|
13958
13958
|
import { join as join2 } from "node:path";
|
|
13959
|
-
async function discoverAutomations(builtInDir,
|
|
13959
|
+
async function discoverAutomations(builtInDir, ...projectDirs) {
|
|
13960
13960
|
const automationsByName = /* @__PURE__ */ new Map();
|
|
13961
13961
|
for (const automation of await readAutomationsFromDirectory(builtInDir)) {
|
|
13962
13962
|
automationsByName.set(automation.name, automation);
|
|
13963
13963
|
}
|
|
13964
|
-
|
|
13964
|
+
for (const projectDir of projectDirs) {
|
|
13965
13965
|
for (const automation of await readAutomationsFromDirectory(projectDir)) {
|
|
13966
13966
|
automationsByName.set(automation.name, automation);
|
|
13967
13967
|
}
|
|
@@ -14675,7 +14675,7 @@ function formatLabel(name) {
|
|
|
14675
14675
|
return name.split("-").map(capitalize).join(" ");
|
|
14676
14676
|
}
|
|
14677
14677
|
async function loadNamedAutomation(name, cwd) {
|
|
14678
|
-
const automation = await loadAutomation(name, [
|
|
14678
|
+
const automation = await loadAutomation(name, [...projectPromptDirs(cwd), await resolveBuiltInPromptsDir()]);
|
|
14679
14679
|
if (automation === void 0) {
|
|
14680
14680
|
throw new UserError(`Automation "${name}" was not found.`);
|
|
14681
14681
|
}
|
|
@@ -14691,15 +14691,15 @@ async function readBuiltInPromptFile(name) {
|
|
|
14691
14691
|
throw error2;
|
|
14692
14692
|
}
|
|
14693
14693
|
}
|
|
14694
|
-
async function readBuiltInWorkflowTemplate(name, variant) {
|
|
14694
|
+
async function readBuiltInWorkflowTemplate(name, variant, automationName = name, promptPath) {
|
|
14695
14695
|
const templatePath = path28.join(await resolveBuiltInWorkflowTemplatesDir(), `${name}.${variant}.yml`);
|
|
14696
14696
|
try {
|
|
14697
14697
|
const content = await readFile9(templatePath, "utf8");
|
|
14698
|
-
const header =
|
|
14699
|
-
# Edit
|
|
14698
|
+
const header = promptPath !== void 0 ? `# Auto-generated by: poe-code github-workflows install ${name}
|
|
14699
|
+
# Edit ${path28.relative(process.cwd(), promptPath)} to customize the prompt.
|
|
14700
14700
|
` : `# Auto-generated by: poe-code github-workflows install ${name}
|
|
14701
14701
|
`;
|
|
14702
|
-
const processedContent =
|
|
14702
|
+
const processedContent = content.replaceAll(` ${name}`, ` ${automationName}`).replaceAll("__UPSTREAM_REPO__", UPSTREAM_REPO);
|
|
14703
14703
|
return header + processedContent;
|
|
14704
14704
|
} catch (error2) {
|
|
14705
14705
|
if (isMissingPathError2(error2)) {
|
|
@@ -14721,8 +14721,11 @@ async function resolveBuiltInWorkflowTemplatesDir() {
|
|
|
14721
14721
|
}
|
|
14722
14722
|
return builtInWorkflowTemplatesDirCandidates[0];
|
|
14723
14723
|
}
|
|
14724
|
-
function
|
|
14725
|
-
return path28.join(cwd, ".poe-code", "github-workflows");
|
|
14724
|
+
function projectPromptDirs(cwd) {
|
|
14725
|
+
return [projectWorkflowDir(cwd), path28.join(cwd, ".poe-code", "github-workflows")];
|
|
14726
|
+
}
|
|
14727
|
+
function projectWorkflowDir(cwd) {
|
|
14728
|
+
return path28.join(cwd, ".github", "workflows");
|
|
14726
14729
|
}
|
|
14727
14730
|
async function resolveBuiltInPromptsDir() {
|
|
14728
14731
|
for (const candidate of builtInPromptsDirCandidates) {
|
|
@@ -14949,7 +14952,7 @@ var init_commands = __esm({
|
|
|
14949
14952
|
const cwd = resolveCwd(params.cwd);
|
|
14950
14953
|
const name = params.name ?? await selectAutomationName(
|
|
14951
14954
|
"Pick a workflow to run",
|
|
14952
|
-
await discoverAutomations(await resolveBuiltInPromptsDir(),
|
|
14955
|
+
await discoverAutomations(await resolveBuiltInPromptsDir(), ...projectPromptDirs(cwd))
|
|
14953
14956
|
);
|
|
14954
14957
|
const automation = await loadNamedAutomation(name, cwd);
|
|
14955
14958
|
const agent2 = automation.agent ?? params.agent ?? "codex";
|
|
@@ -15020,7 +15023,7 @@ var init_commands = __esm({
|
|
|
15020
15023
|
description: "List available automations.",
|
|
15021
15024
|
params: S2.Object({}),
|
|
15022
15025
|
scope: ["cli", "sdk"],
|
|
15023
|
-
handler: async () => discoverAutomations(await resolveBuiltInPromptsDir(),
|
|
15026
|
+
handler: async () => discoverAutomations(await resolveBuiltInPromptsDir(), ...projectPromptDirs(resolveCwd())),
|
|
15024
15027
|
render: {
|
|
15025
15028
|
rich: (automations, { logger: logger2, renderTable: renderTable2, getTheme: getTheme2 }) => {
|
|
15026
15029
|
logger2.message(
|
|
@@ -15053,35 +15056,46 @@ var init_commands = __esm({
|
|
|
15053
15056
|
const automations = await discoverAutomations(await resolveBuiltInPromptsDir());
|
|
15054
15057
|
return automations.map((a) => ({ label: a.label ?? formatLabel(a.name), value: a.name }));
|
|
15055
15058
|
}
|
|
15056
|
-
})
|
|
15059
|
+
}),
|
|
15060
|
+
eject: S2.Optional(S2.Boolean())
|
|
15057
15061
|
}),
|
|
15058
15062
|
scope: ["cli"],
|
|
15059
15063
|
handler: async ({ params }) => {
|
|
15060
15064
|
const name = params.name;
|
|
15065
|
+
const isEject = params.eject === true;
|
|
15061
15066
|
const variant = "ejected";
|
|
15067
|
+
const cwd = resolveCwd();
|
|
15068
|
+
const localAutomationName = isEject ? `poe-code-${name}` : name;
|
|
15069
|
+
const promptPath = isEject ? path28.join(projectWorkflowDir(cwd), `${localAutomationName}.md`) : void 0;
|
|
15062
15070
|
const [workflowTemplate, rawPrompt] = await Promise.all([
|
|
15063
|
-
readBuiltInWorkflowTemplate(name, variant),
|
|
15071
|
+
readBuiltInWorkflowTemplate(name, variant, localAutomationName, promptPath),
|
|
15064
15072
|
readBuiltInPromptFile(name)
|
|
15065
15073
|
]);
|
|
15066
|
-
const cwd = resolveCwd();
|
|
15067
15074
|
const workflowPath = path28.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
|
|
15068
15075
|
await mkdir10(path28.dirname(workflowPath), { recursive: true });
|
|
15069
15076
|
await writeFile6(workflowPath, workflowTemplate, "utf8");
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15077
|
+
if (promptPath !== void 0) {
|
|
15078
|
+
await mkdir10(path28.dirname(promptPath), { recursive: true });
|
|
15079
|
+
await writeFile6(promptPath, addPromptHeader(rawPrompt, name), "utf8");
|
|
15080
|
+
}
|
|
15073
15081
|
return {
|
|
15074
15082
|
name,
|
|
15075
15083
|
workflowPath,
|
|
15076
15084
|
promptPath,
|
|
15085
|
+
ejected: isEject,
|
|
15077
15086
|
promptContent: rawPrompt
|
|
15078
15087
|
};
|
|
15079
15088
|
},
|
|
15080
15089
|
render: {
|
|
15081
15090
|
rich: (result, { logger: logger2, note: note2 }) => {
|
|
15082
15091
|
logger2.success(`Installed workflow at ${result.workflowPath}`);
|
|
15083
|
-
|
|
15092
|
+
if (result.promptPath !== void 0) {
|
|
15093
|
+
logger2.message(`Prompt copied to ${result.promptPath}`);
|
|
15094
|
+
}
|
|
15084
15095
|
note2(result.promptContent, "Default prompt");
|
|
15096
|
+
if (!result.ejected) {
|
|
15097
|
+
logger2.message(`To customize the prompt, run: poe-code github-workflows install ${result.name} --eject`);
|
|
15098
|
+
}
|
|
15085
15099
|
},
|
|
15086
15100
|
json: (result) => result
|
|
15087
15101
|
}
|
|
@@ -28072,7 +28086,7 @@ var init_package = __esm({
|
|
|
28072
28086
|
"package.json"() {
|
|
28073
28087
|
package_default = {
|
|
28074
28088
|
name: "poe-code",
|
|
28075
|
-
version: "3.0.
|
|
28089
|
+
version: "3.0.139",
|
|
28076
28090
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
28077
28091
|
type: "module",
|
|
28078
28092
|
main: "./dist/index.js",
|