@oisincoveney/pipeline 3.20.0 → 3.20.1
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/argo-submit.d.ts +1 -0
- package/dist/argo-submit.js +5 -2
- package/dist/planning/generate.js +2 -2
- package/dist/remote/submit/compilation.js +1 -0
- package/dist/runtime/open-pull-request/open-pull-request.js +10 -7
- package/dist/schedule/passes/open-pull-request.js +3 -3
- package/package.json +1 -1
package/dist/argo-submit.d.ts
CHANGED
|
@@ -76,6 +76,7 @@ declare const submitDynamicRunnerArgoWorkflowOptionsSchema: z.ZodObject<{
|
|
|
76
76
|
}, z.core.$strict>;
|
|
77
77
|
declare const commandScheduleOptionsSchema: z.ZodObject<{
|
|
78
78
|
command: z.ZodArray<z.ZodString>;
|
|
79
|
+
deliverPullRequest: z.ZodDefault<z.ZodBoolean>;
|
|
79
80
|
generatedAt: z.ZodDefault<z.ZodDate>;
|
|
80
81
|
scheduleId: z.ZodOptional<z.ZodString>;
|
|
81
82
|
task: z.ZodString;
|
package/dist/argo-submit.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ArgoGraphCompilerError, compileArgoExecutionGraph } from "./argo-graph.js";
|
|
2
2
|
import { dbAuthOptionSchema, mcpGatewayAuthOptionSchema } from "./remote/argo/model.js";
|
|
3
3
|
import { brokerAuthOptionSchema } from "./credentials/broker.js";
|
|
4
|
+
import { appendPullRequestDelivery } from "./schedule/passes/open-pull-request.js";
|
|
4
5
|
import { compileScheduleArtifact, parseScheduleArtifact } from "./planning/generate.js";
|
|
5
6
|
import { parseRunnerCommandPayload, runnerCommandPayloadSchema } from "./runner-command-contract.js";
|
|
6
7
|
import { buildRunnerTaskDescriptor } from "./runner-command/task-descriptor.js";
|
|
@@ -62,6 +63,7 @@ const submitDynamicRunnerArgoWorkflowOptionsSchema = z.object({
|
|
|
62
63
|
}).strict().refine(hasWorkflowName, { message: "Argo submit options must declare name or generateName" });
|
|
63
64
|
const commandScheduleOptionsSchema = z.object({
|
|
64
65
|
command: z.array(z.string().min(1)).min(1),
|
|
66
|
+
deliverPullRequest: z.boolean().default(false),
|
|
65
67
|
generatedAt: z.date().default(() => /* @__PURE__ */ new Date()),
|
|
66
68
|
scheduleId: scheduleIdSchema.optional(),
|
|
67
69
|
task: z.string().min(1)
|
|
@@ -271,7 +273,7 @@ function workflowSubmitResult(response, workflow, base) {
|
|
|
271
273
|
function buildCommandScheduleYaml(rawOptions) {
|
|
272
274
|
const options = commandScheduleOptionsSchema.parse(rawOptions);
|
|
273
275
|
const scheduleId = options.scheduleId ?? `custom-${randomBytes(8).toString("hex")}`;
|
|
274
|
-
|
|
276
|
+
const artifact = {
|
|
275
277
|
generated_at: options.generatedAt.toISOString(),
|
|
276
278
|
kind: "pipeline-schedule",
|
|
277
279
|
root_workflow: "root",
|
|
@@ -284,7 +286,8 @@ function buildCommandScheduleYaml(rawOptions) {
|
|
|
284
286
|
id: "command",
|
|
285
287
|
kind: "command"
|
|
286
288
|
}] } }
|
|
287
|
-
}
|
|
289
|
+
};
|
|
290
|
+
return stringify(appendPullRequestDelivery(options.deliverPullRequest, artifact));
|
|
288
291
|
}
|
|
289
292
|
function normalizeRunnerPayloadForSubmit(input) {
|
|
290
293
|
const repository = normalizeRunnerRepositoryForSubmit(input.payload.repository);
|
|
@@ -16,7 +16,7 @@ import { integrateParallelWriteFanout } from "../schedule/passes/drain-merge.js"
|
|
|
16
16
|
import { canonicalizeGeneratedScheduleIds } from "../schedule/passes/ids.js";
|
|
17
17
|
import { SCHEDULE_PASS_ORDER } from "../schedule/passes/index.js";
|
|
18
18
|
import { applyNodeCatalogModelFallbacks } from "../schedule/passes/models.js";
|
|
19
|
-
import { appendPullRequestDelivery } from "../schedule/passes/open-pull-request.js";
|
|
19
|
+
import { appendPullRequestDelivery, isPullRequestDeliveryEnabled } from "../schedule/passes/open-pull-request.js";
|
|
20
20
|
import { namespaceScheduleWorkflows } from "../schedule/passes/references.js";
|
|
21
21
|
import { plannerPrompt, plannerRepairPrompt } from "../schedule/prompts.js";
|
|
22
22
|
import { parseDocument, stringify } from "yaml";
|
|
@@ -131,7 +131,7 @@ async function generateScheduleArtifactInMemory(options) {
|
|
|
131
131
|
});
|
|
132
132
|
const generatedArtifact = await planScheduleArtifact(baseline, policy.planner_profile, options, planningContext);
|
|
133
133
|
assertSchedulePassOrder();
|
|
134
|
-
const artifact = hydrateScheduleTaskContexts(canonicalizeGeneratedScheduleIds(applyNodeCatalogModelFallbacks(options.config, policy.node_catalog, appendPullRequestDelivery(options.config, integrateParallelWriteFanout(options.config, addGeneratedImplementationCoverage(options.config, generatedArtifact))))), planningContext);
|
|
134
|
+
const artifact = hydrateScheduleTaskContexts(canonicalizeGeneratedScheduleIds(applyNodeCatalogModelFallbacks(options.config, policy.node_catalog, appendPullRequestDelivery(isPullRequestDeliveryEnabled(options.config), integrateParallelWriteFanout(options.config, addGeneratedImplementationCoverage(options.config, generatedArtifact))))), planningContext);
|
|
135
135
|
validateScheduleArtifact(options.config, artifact, planningContext);
|
|
136
136
|
compileScheduleArtifact(options.config, artifact, options.worktreePath);
|
|
137
137
|
return {
|
|
@@ -27,6 +27,7 @@ function compileMokaCommandSubmitPlan(options, runId) {
|
|
|
27
27
|
const task = commandTask(options);
|
|
28
28
|
const scheduleYaml = buildCommandScheduleYaml({
|
|
29
29
|
command: options.commandArgv,
|
|
30
|
+
deliverPullRequest: options.delivery.pullRequest,
|
|
30
31
|
scheduleId: runId,
|
|
31
32
|
task: taskDescription(task)
|
|
32
33
|
});
|
|
@@ -109,12 +109,17 @@ function pushHeadBranch(git, headBranch) {
|
|
|
109
109
|
function submitPullRequest(prCtx, context) {
|
|
110
110
|
if (prCtx.mode === "update-existing-pr") return handleExistingPr(prCtx.headBranch, prCtx.label, context);
|
|
111
111
|
return Effect.gen(function* () {
|
|
112
|
-
const
|
|
113
|
-
|
|
112
|
+
const executor = yield* CommandExecutor;
|
|
113
|
+
const createResult = yield* runGhPrCreate(executor, prCtx, extractPrTitle(prCtx.task), context);
|
|
114
|
+
if (createResult.exitCode === 0) return yield* labelCreatedPr(executor, prCtx, createResult, context);
|
|
114
115
|
if (isPrAlreadyExistsError(createResult.output)) return yield* handleExistingPr(prCtx.headBranch, prCtx.label, context);
|
|
115
116
|
return createResult;
|
|
116
117
|
});
|
|
117
118
|
}
|
|
119
|
+
function labelCreatedPr(executor, prCtx, createResult, context) {
|
|
120
|
+
const url = extractPrUrl(createResult.output);
|
|
121
|
+
return runGhPrEdit(executor, prCtx.headBranch, prCtx.label, context).pipe(Effect.map((editResult) => editResult.exitCode === 0 ? openPrSuccess(url, "opened") : openPrSuccess(url, "opened", [`open-pull-request: label '${prCtx.label}' not applied — ${editResult.output || `gh pr edit exited ${editResult.exitCode}`}`])));
|
|
122
|
+
}
|
|
118
123
|
function runGhPrCreate(executor, prCtx, title, context) {
|
|
119
124
|
return executor.execute(buildGhPrCreateArgs(prCtx, title), context).pipe(Effect.catch((e) => Effect.succeed(openPrFailure(errorMessage(e)))));
|
|
120
125
|
}
|
|
@@ -143,9 +148,7 @@ function buildGhPrCreateArgs(prCtx, title) {
|
|
|
143
148
|
"--title",
|
|
144
149
|
title,
|
|
145
150
|
"--body",
|
|
146
|
-
`Opened by moka run ${prCtx.runId}
|
|
147
|
-
"--label",
|
|
148
|
-
prCtx.label
|
|
151
|
+
`Opened by moka run ${prCtx.runId}`
|
|
149
152
|
];
|
|
150
153
|
}
|
|
151
154
|
function buildGhPrEditArgs(headBranch, label) {
|
|
@@ -164,9 +167,9 @@ function isPrAlreadyExistsError(output) {
|
|
|
164
167
|
function extractPrUrl(output) {
|
|
165
168
|
return output.split(NEWLINE_RE).map((l) => l.trim()).find((l) => l.startsWith("https://")) ?? output.trim();
|
|
166
169
|
}
|
|
167
|
-
function openPrSuccess(url, action) {
|
|
170
|
+
function openPrSuccess(url, action, extraEvidence = []) {
|
|
168
171
|
return {
|
|
169
|
-
evidence: [`open-pull-request: PR ${action} — ${url}
|
|
172
|
+
evidence: [`open-pull-request: PR ${action} — ${url}`, ...extraEvidence],
|
|
170
173
|
exitCode: 0,
|
|
171
174
|
output: JSON.stringify({
|
|
172
175
|
action,
|
|
@@ -25,8 +25,8 @@ function buildPrNode(terminalIds, usedIds) {
|
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
27
|
/** Append a final open-pull-request node to the root workflow when enabled. */
|
|
28
|
-
function appendPullRequestDelivery(
|
|
29
|
-
if (!
|
|
28
|
+
function appendPullRequestDelivery(enabled, artifact) {
|
|
29
|
+
if (!enabled) return artifact;
|
|
30
30
|
const rootWorkflow = artifact.workflows[artifact.root_workflow];
|
|
31
31
|
if (!rootWorkflow) return artifact;
|
|
32
32
|
const nodes = rootWorkflow.nodes;
|
|
@@ -46,4 +46,4 @@ function appendPullRequestDelivery(config, artifact) {
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
//#endregion
|
|
49
|
-
export { appendPullRequestDelivery };
|
|
49
|
+
export { appendPullRequestDelivery, isPullRequestDeliveryEnabled };
|
package/package.json
CHANGED
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"prepack": "nub run build:cli"
|
|
139
139
|
},
|
|
140
140
|
"type": "module",
|
|
141
|
-
"version": "3.20.
|
|
141
|
+
"version": "3.20.1",
|
|
142
142
|
"description": "Config-driven multi-agent pipeline runner for repository work",
|
|
143
143
|
"main": "./dist/index.js",
|
|
144
144
|
"types": "./dist/index.d.ts",
|