poe-code 3.0.135 → 3.0.137
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 +69 -5
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14620,6 +14620,48 @@ var init_require_comment_prefix = __esm({
|
|
|
14620
14620
|
}
|
|
14621
14621
|
});
|
|
14622
14622
|
|
|
14623
|
+
// packages/github-workflows/src/setup-agent.ts
|
|
14624
|
+
function formatCommand2(command, args) {
|
|
14625
|
+
return [command, ...args].join(" ");
|
|
14626
|
+
}
|
|
14627
|
+
function trimOutput(value) {
|
|
14628
|
+
return value.trim();
|
|
14629
|
+
}
|
|
14630
|
+
function resolveWorkflowAgent(automation) {
|
|
14631
|
+
const configured = automation.agent?.trim();
|
|
14632
|
+
return configured && configured.length > 0 ? configured : "codex";
|
|
14633
|
+
}
|
|
14634
|
+
function formatCommandFailure(command, args, result) {
|
|
14635
|
+
const stderr = trimOutput(result.stderr);
|
|
14636
|
+
const stdout = trimOutput(result.stdout);
|
|
14637
|
+
return [
|
|
14638
|
+
`Command failed with exit code ${result.exitCode}: ${formatCommand2(command, args)}`,
|
|
14639
|
+
stderr.length > 0 ? `stderr:
|
|
14640
|
+
${stderr}` : null,
|
|
14641
|
+
stdout.length > 0 ? `stdout:
|
|
14642
|
+
${stdout}` : null
|
|
14643
|
+
].filter((value) => value !== null).join("\n");
|
|
14644
|
+
}
|
|
14645
|
+
async function runPoeCodeCommand(args, cwd, runner) {
|
|
14646
|
+
const result = await runner("poe-code", args, { cwd });
|
|
14647
|
+
if (result.exitCode !== 0) {
|
|
14648
|
+
throw new UserError(formatCommandFailure("poe-code", args, result));
|
|
14649
|
+
}
|
|
14650
|
+
}
|
|
14651
|
+
async function setupWorkflowAgent(automation, cwd, runner = runCommand) {
|
|
14652
|
+
const agent2 = resolveWorkflowAgent(automation);
|
|
14653
|
+
await runPoeCodeCommand(["install", agent2, "--yes", "--verbose"], cwd, runner);
|
|
14654
|
+
await runPoeCodeCommand(["configure", agent2, "--yes", "--verbose"], cwd, runner);
|
|
14655
|
+
return agent2;
|
|
14656
|
+
}
|
|
14657
|
+
var init_setup_agent = __esm({
|
|
14658
|
+
"packages/github-workflows/src/setup-agent.ts"() {
|
|
14659
|
+
"use strict";
|
|
14660
|
+
init_src7();
|
|
14661
|
+
init_src16();
|
|
14662
|
+
}
|
|
14663
|
+
});
|
|
14664
|
+
|
|
14623
14665
|
// packages/github-workflows/src/commands.ts
|
|
14624
14666
|
import { access, mkdir as mkdir10, readFile as readFile9, unlink as unlink2, writeFile as writeFile6 } from "node:fs/promises";
|
|
14625
14667
|
import path28 from "node:path";
|
|
@@ -14856,7 +14898,7 @@ async function selectAutomationName(message2, automations) {
|
|
|
14856
14898
|
}
|
|
14857
14899
|
return selected;
|
|
14858
14900
|
}
|
|
14859
|
-
var UPSTREAM_REPO, builtInPromptsDirCandidates, builtInWorkflowTemplatesDirCandidates, originalMustacheEscape, installableAutomations, runCommandDef, listCommand, installCommand, uninstallCommand, checkUserAllowCommand, requireCommentPrefixCommand, promptPreviewCommand, execGroup, ghGroup;
|
|
14901
|
+
var UPSTREAM_REPO, builtInPromptsDirCandidates, builtInWorkflowTemplatesDirCandidates, originalMustacheEscape, installableAutomations, runCommandDef, listCommand, installCommand, uninstallCommand, checkUserAllowCommand, requireCommentPrefixCommand, setupAgentCommand, promptPreviewCommand, execGroup, ghGroup;
|
|
14860
14902
|
var init_commands = __esm({
|
|
14861
14903
|
"packages/github-workflows/src/commands.ts"() {
|
|
14862
14904
|
"use strict";
|
|
@@ -14867,6 +14909,7 @@ var init_commands = __esm({
|
|
|
14867
14909
|
init_discover();
|
|
14868
14910
|
init_check_user_allow();
|
|
14869
14911
|
init_require_comment_prefix();
|
|
14912
|
+
init_setup_agent();
|
|
14870
14913
|
UPSTREAM_REPO = "poe-platform/poe-code";
|
|
14871
14914
|
builtInPromptsDirCandidates = [
|
|
14872
14915
|
fileURLToPath4(new URL("./prompts", import.meta.url)),
|
|
@@ -15117,6 +15160,27 @@ var init_commands = __esm({
|
|
|
15117
15160
|
return null;
|
|
15118
15161
|
}
|
|
15119
15162
|
});
|
|
15163
|
+
setupAgentCommand = defineCommand({
|
|
15164
|
+
name: "setup-agent",
|
|
15165
|
+
description: "Install and configure the agent required by a workflow automation.",
|
|
15166
|
+
positional: ["name"],
|
|
15167
|
+
params: S2.Object({
|
|
15168
|
+
name: S2.String()
|
|
15169
|
+
}),
|
|
15170
|
+
scope: ["cli"],
|
|
15171
|
+
handler: async ({ params }) => {
|
|
15172
|
+
const cwd = resolveCwd();
|
|
15173
|
+
const automation = await loadNamedAutomation(params.name, cwd);
|
|
15174
|
+
const agent2 = await setupWorkflowAgent(automation, cwd);
|
|
15175
|
+
return { agent: agent2, automation: automation.name };
|
|
15176
|
+
},
|
|
15177
|
+
render: {
|
|
15178
|
+
rich: (result, { logger: logger2 }) => {
|
|
15179
|
+
logger2.success(`Prepared agent "${result.agent}" for automation "${result.automation}".`);
|
|
15180
|
+
},
|
|
15181
|
+
json: (result) => result
|
|
15182
|
+
}
|
|
15183
|
+
});
|
|
15120
15184
|
promptPreviewCommand = defineCommand({
|
|
15121
15185
|
name: "prompt-preview",
|
|
15122
15186
|
description: "Preview the resolved prompt for an automation.",
|
|
@@ -15140,7 +15204,7 @@ var init_commands = __esm({
|
|
|
15140
15204
|
name: "exec",
|
|
15141
15205
|
description: "Workflow step helpers.",
|
|
15142
15206
|
scope: ["cli"],
|
|
15143
|
-
children: [checkUserAllowCommand, requireCommentPrefixCommand]
|
|
15207
|
+
children: [checkUserAllowCommand, requireCommentPrefixCommand, setupAgentCommand]
|
|
15144
15208
|
});
|
|
15145
15209
|
ghGroup = defineGroup({
|
|
15146
15210
|
name: "github-workflows",
|
|
@@ -15512,9 +15576,9 @@ async function runServiceInstall(definition, context) {
|
|
|
15512
15576
|
return true;
|
|
15513
15577
|
}
|
|
15514
15578
|
function describeInstallCommand(step) {
|
|
15515
|
-
return `[${step.id}] ${
|
|
15579
|
+
return `[${step.id}] ${formatCommand3(step.command, step.args)}`;
|
|
15516
15580
|
}
|
|
15517
|
-
function
|
|
15581
|
+
function formatCommand3(command, args) {
|
|
15518
15582
|
return [command, ...args.map(quoteIfNeeded)].join(" ");
|
|
15519
15583
|
}
|
|
15520
15584
|
function quoteIfNeeded(value) {
|
|
@@ -28016,7 +28080,7 @@ var init_package = __esm({
|
|
|
28016
28080
|
"package.json"() {
|
|
28017
28081
|
package_default = {
|
|
28018
28082
|
name: "poe-code",
|
|
28019
|
-
version: "3.0.
|
|
28083
|
+
version: "3.0.137",
|
|
28020
28084
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
28021
28085
|
type: "module",
|
|
28022
28086
|
main: "./dist/index.js",
|