poe-code 3.0.137 → 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 +38 -32
- package/dist/index.js.map +2 -2
- package/dist/prompts/github-issue-opened.md +1 -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
|
}
|
|
@@ -14650,8 +14650,8 @@ async function runPoeCodeCommand(args, cwd, runner) {
|
|
|
14650
14650
|
}
|
|
14651
14651
|
async function setupWorkflowAgent(automation, cwd, runner = runCommand) {
|
|
14652
14652
|
const agent2 = resolveWorkflowAgent(automation);
|
|
14653
|
-
await runPoeCodeCommand(["install", agent2, "--yes"
|
|
14654
|
-
await runPoeCodeCommand(["configure", agent2, "--yes"
|
|
14653
|
+
await runPoeCodeCommand(["install", agent2, "--yes"], cwd, runner);
|
|
14654
|
+
await runPoeCodeCommand(["configure", agent2, "--yes"], cwd, runner);
|
|
14655
14655
|
return agent2;
|
|
14656
14656
|
}
|
|
14657
14657
|
var init_setup_agent = __esm({
|
|
@@ -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) {
|
|
@@ -14898,7 +14901,7 @@ async function selectAutomationName(message2, automations) {
|
|
|
14898
14901
|
}
|
|
14899
14902
|
return selected;
|
|
14900
14903
|
}
|
|
14901
|
-
var UPSTREAM_REPO, builtInPromptsDirCandidates, builtInWorkflowTemplatesDirCandidates, originalMustacheEscape, installableAutomations, runCommandDef, listCommand, installCommand, uninstallCommand,
|
|
14904
|
+
var UPSTREAM_REPO, builtInPromptsDirCandidates, builtInWorkflowTemplatesDirCandidates, originalMustacheEscape, installableAutomations, runCommandDef, listCommand, installCommand, uninstallCommand, requireUserAllowCommand, requireCommentPrefixCommand, prepareCommand, promptPreviewCommand, ghGroup;
|
|
14902
14905
|
var init_commands = __esm({
|
|
14903
14906
|
"packages/github-workflows/src/commands.ts"() {
|
|
14904
14907
|
"use strict";
|
|
@@ -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(
|
|
@@ -15060,18 +15063,18 @@ var init_commands = __esm({
|
|
|
15060
15063
|
handler: async ({ params }) => {
|
|
15061
15064
|
const name = params.name;
|
|
15062
15065
|
const isEject = params.eject === true;
|
|
15063
|
-
const variant =
|
|
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;
|
|
15064
15070
|
const [workflowTemplate, rawPrompt] = await Promise.all([
|
|
15065
|
-
readBuiltInWorkflowTemplate(name, variant),
|
|
15071
|
+
readBuiltInWorkflowTemplate(name, variant, localAutomationName, promptPath),
|
|
15066
15072
|
readBuiltInPromptFile(name)
|
|
15067
15073
|
]);
|
|
15068
|
-
const cwd = resolveCwd();
|
|
15069
15074
|
const workflowPath = path28.join(cwd, ".github", "workflows", `poe-code-${name}.yml`);
|
|
15070
15075
|
await mkdir10(path28.dirname(workflowPath), { recursive: true });
|
|
15071
15076
|
await writeFile6(workflowPath, workflowTemplate, "utf8");
|
|
15072
|
-
|
|
15073
|
-
if (isEject) {
|
|
15074
|
-
promptPath = path28.join(projectPromptsDir(cwd), `poe-code-${name}.md`);
|
|
15077
|
+
if (promptPath !== void 0) {
|
|
15075
15078
|
await mkdir10(path28.dirname(promptPath), { recursive: true });
|
|
15076
15079
|
await writeFile6(promptPath, addPromptHeader(rawPrompt, name), "utf8");
|
|
15077
15080
|
}
|
|
@@ -15132,8 +15135,8 @@ var init_commands = __esm({
|
|
|
15132
15135
|
json: (result) => result
|
|
15133
15136
|
}
|
|
15134
15137
|
});
|
|
15135
|
-
|
|
15136
|
-
name: "
|
|
15138
|
+
requireUserAllowCommand = defineCommand({
|
|
15139
|
+
name: "require-user-allow",
|
|
15137
15140
|
description: "Fail when COMMENT_AUTHOR_ASSOCIATION is not allowed by the automation frontmatter.",
|
|
15138
15141
|
positional: ["name"],
|
|
15139
15142
|
params: S2.Object({
|
|
@@ -15160,8 +15163,8 @@ var init_commands = __esm({
|
|
|
15160
15163
|
return null;
|
|
15161
15164
|
}
|
|
15162
15165
|
});
|
|
15163
|
-
|
|
15164
|
-
name: "
|
|
15166
|
+
prepareCommand = defineCommand({
|
|
15167
|
+
name: "prepare",
|
|
15165
15168
|
description: "Install and configure the agent required by a workflow automation.",
|
|
15166
15169
|
positional: ["name"],
|
|
15167
15170
|
params: S2.Object({
|
|
@@ -15200,17 +15203,20 @@ var init_commands = __esm({
|
|
|
15200
15203
|
json: (result) => result
|
|
15201
15204
|
}
|
|
15202
15205
|
});
|
|
15203
|
-
execGroup = defineGroup({
|
|
15204
|
-
name: "exec",
|
|
15205
|
-
description: "Workflow step helpers.",
|
|
15206
|
-
scope: ["cli"],
|
|
15207
|
-
children: [checkUserAllowCommand, requireCommentPrefixCommand, setupAgentCommand]
|
|
15208
|
-
});
|
|
15209
15206
|
ghGroup = defineGroup({
|
|
15210
15207
|
name: "github-workflows",
|
|
15211
15208
|
aliases: ["gh"],
|
|
15212
15209
|
description: "GitHub workflow automations.",
|
|
15213
|
-
children: [
|
|
15210
|
+
children: [
|
|
15211
|
+
runCommandDef,
|
|
15212
|
+
prepareCommand,
|
|
15213
|
+
requireUserAllowCommand,
|
|
15214
|
+
requireCommentPrefixCommand,
|
|
15215
|
+
listCommand,
|
|
15216
|
+
installCommand,
|
|
15217
|
+
uninstallCommand,
|
|
15218
|
+
promptPreviewCommand
|
|
15219
|
+
],
|
|
15214
15220
|
default: runCommandDef
|
|
15215
15221
|
});
|
|
15216
15222
|
}
|
|
@@ -28080,7 +28086,7 @@ var init_package = __esm({
|
|
|
28080
28086
|
"package.json"() {
|
|
28081
28087
|
package_default = {
|
|
28082
28088
|
name: "poe-code",
|
|
28083
|
-
version: "3.0.
|
|
28089
|
+
version: "3.0.139",
|
|
28084
28090
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
28085
28091
|
type: "module",
|
|
28086
28092
|
main: "./dist/index.js",
|