poe-code 3.0.138 → 3.0.140
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 +36 -20
- package/dist/index.js.map +2 -2
- package/dist/prompts/github-issue-opened.md +12 -1
- 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) {
|
|
@@ -14749,6 +14752,7 @@ function buildCommandEnv(env, secrets) {
|
|
|
14749
14752
|
"GITHUB_REPOSITORY",
|
|
14750
14753
|
"ISSUE_NUMBER",
|
|
14751
14754
|
"ISSUE_TITLE",
|
|
14755
|
+
"ISSUE_BODY",
|
|
14752
14756
|
"COMMENT_AUTHOR",
|
|
14753
14757
|
"COMMENT_BODY",
|
|
14754
14758
|
"PR_NUMBER",
|
|
@@ -14771,7 +14775,8 @@ function buildTemplateContext(env) {
|
|
|
14771
14775
|
...buildUrl(repo, issueNumber, prNumber) === void 0 ? {} : { url: buildUrl(repo, issueNumber, prNumber) },
|
|
14772
14776
|
issue: pruneUndefined({
|
|
14773
14777
|
number: issueNumber,
|
|
14774
|
-
title: env.get("ISSUE_TITLE")
|
|
14778
|
+
title: env.get("ISSUE_TITLE"),
|
|
14779
|
+
body: env.get("ISSUE_BODY")
|
|
14775
14780
|
}),
|
|
14776
14781
|
comment: pruneUndefined({
|
|
14777
14782
|
author: env.get("COMMENT_AUTHOR"),
|
|
@@ -14949,7 +14954,7 @@ var init_commands = __esm({
|
|
|
14949
14954
|
const cwd = resolveCwd(params.cwd);
|
|
14950
14955
|
const name = params.name ?? await selectAutomationName(
|
|
14951
14956
|
"Pick a workflow to run",
|
|
14952
|
-
await discoverAutomations(await resolveBuiltInPromptsDir(),
|
|
14957
|
+
await discoverAutomations(await resolveBuiltInPromptsDir(), ...projectPromptDirs(cwd))
|
|
14953
14958
|
);
|
|
14954
14959
|
const automation = await loadNamedAutomation(name, cwd);
|
|
14955
14960
|
const agent2 = automation.agent ?? params.agent ?? "codex";
|
|
@@ -15020,7 +15025,7 @@ var init_commands = __esm({
|
|
|
15020
15025
|
description: "List available automations.",
|
|
15021
15026
|
params: S2.Object({}),
|
|
15022
15027
|
scope: ["cli", "sdk"],
|
|
15023
|
-
handler: async () => discoverAutomations(await resolveBuiltInPromptsDir(),
|
|
15028
|
+
handler: async () => discoverAutomations(await resolveBuiltInPromptsDir(), ...projectPromptDirs(resolveCwd())),
|
|
15024
15029
|
render: {
|
|
15025
15030
|
rich: (automations, { logger: logger2, renderTable: renderTable2, getTheme: getTheme2 }) => {
|
|
15026
15031
|
logger2.message(
|
|
@@ -15053,35 +15058,46 @@ var init_commands = __esm({
|
|
|
15053
15058
|
const automations = await discoverAutomations(await resolveBuiltInPromptsDir());
|
|
15054
15059
|
return automations.map((a) => ({ label: a.label ?? formatLabel(a.name), value: a.name }));
|
|
15055
15060
|
}
|
|
15056
|
-
})
|
|
15061
|
+
}),
|
|
15062
|
+
eject: S2.Optional(S2.Boolean())
|
|
15057
15063
|
}),
|
|
15058
15064
|
scope: ["cli"],
|
|
15059
15065
|
handler: async ({ params }) => {
|
|
15060
15066
|
const name = params.name;
|
|
15067
|
+
const isEject = params.eject === true;
|
|
15061
15068
|
const variant = "ejected";
|
|
15069
|
+
const cwd = resolveCwd();
|
|
15070
|
+
const localAutomationName = isEject ? `poe-code-${name}` : name;
|
|
15071
|
+
const promptPath = isEject ? path28.join(projectWorkflowDir(cwd), `${localAutomationName}.md`) : void 0;
|
|
15062
15072
|
const [workflowTemplate, rawPrompt] = await Promise.all([
|
|
15063
|
-
readBuiltInWorkflowTemplate(name, variant),
|
|
15073
|
+
readBuiltInWorkflowTemplate(name, variant, localAutomationName, promptPath),
|
|
15064
15074
|
readBuiltInPromptFile(name)
|
|
15065
15075
|
]);
|
|
15066
|
-
const cwd = resolveCwd();
|
|
15067
15076
|
const workflowPath = path28.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
|
|
15068
15077
|
await mkdir10(path28.dirname(workflowPath), { recursive: true });
|
|
15069
15078
|
await writeFile6(workflowPath, workflowTemplate, "utf8");
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15079
|
+
if (promptPath !== void 0) {
|
|
15080
|
+
await mkdir10(path28.dirname(promptPath), { recursive: true });
|
|
15081
|
+
await writeFile6(promptPath, addPromptHeader(rawPrompt, name), "utf8");
|
|
15082
|
+
}
|
|
15073
15083
|
return {
|
|
15074
15084
|
name,
|
|
15075
15085
|
workflowPath,
|
|
15076
15086
|
promptPath,
|
|
15087
|
+
ejected: isEject,
|
|
15077
15088
|
promptContent: rawPrompt
|
|
15078
15089
|
};
|
|
15079
15090
|
},
|
|
15080
15091
|
render: {
|
|
15081
15092
|
rich: (result, { logger: logger2, note: note2 }) => {
|
|
15082
15093
|
logger2.success(`Installed workflow at ${result.workflowPath}`);
|
|
15083
|
-
|
|
15094
|
+
if (result.promptPath !== void 0) {
|
|
15095
|
+
logger2.message(`Prompt copied to ${result.promptPath}`);
|
|
15096
|
+
}
|
|
15084
15097
|
note2(result.promptContent, "Default prompt");
|
|
15098
|
+
if (!result.ejected) {
|
|
15099
|
+
logger2.message(`To customize the prompt, run: poe-code github-workflows install ${result.name} --eject`);
|
|
15100
|
+
}
|
|
15085
15101
|
},
|
|
15086
15102
|
json: (result) => result
|
|
15087
15103
|
}
|
|
@@ -28072,7 +28088,7 @@ var init_package = __esm({
|
|
|
28072
28088
|
"package.json"() {
|
|
28073
28089
|
package_default = {
|
|
28074
28090
|
name: "poe-code",
|
|
28075
|
-
version: "3.0.
|
|
28091
|
+
version: "3.0.140",
|
|
28076
28092
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
28077
28093
|
type: "module",
|
|
28078
28094
|
main: "./dist/index.js",
|