@kody-ade/kody-engine 0.4.52 → 0.4.54
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/bin/kody.js +42 -13
- package/package.json +1 -1
package/dist/bin/kody.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@kody-ade/kody-engine",
|
|
6
|
-
version: "0.4.
|
|
6
|
+
version: "0.4.54",
|
|
7
7
|
description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
|
|
8
8
|
license: "MIT",
|
|
9
9
|
type: "module",
|
|
@@ -3821,6 +3821,14 @@ function mergePrSquash(prNumber, cwd) {
|
|
|
3821
3821
|
return fail(err);
|
|
3822
3822
|
}
|
|
3823
3823
|
}
|
|
3824
|
+
function editPrBase(prNumber, baseBranch, cwd) {
|
|
3825
|
+
try {
|
|
3826
|
+
gh(["pr", "edit", String(prNumber), "--base", baseBranch], { cwd });
|
|
3827
|
+
return { ok: true };
|
|
3828
|
+
} catch (err) {
|
|
3829
|
+
return fail(err);
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3824
3832
|
function markPrReady(prNumber, cwd) {
|
|
3825
3833
|
try {
|
|
3826
3834
|
gh(["pr", "ready", String(prNumber)], { cwd });
|
|
@@ -5413,32 +5421,53 @@ var finalizeGoal = async (ctx) => {
|
|
|
5413
5421
|
if (!goal) return;
|
|
5414
5422
|
process.stdout.write(`[goal-tick] all task(s) done \u2014 finalising goal ${goal.id}
|
|
5415
5423
|
`);
|
|
5416
|
-
const
|
|
5417
|
-
if (
|
|
5418
|
-
|
|
5419
|
-
process.stdout.write(`[goal-tick] promoting draft leaf PR #${leaf.number} \u2192 ready
|
|
5424
|
+
const taskPrs = goal.openTaskPrs ?? [];
|
|
5425
|
+
if (taskPrs.length === 0) {
|
|
5426
|
+
process.stdout.write(`[goal-tick] no open task PRs \u2014 marking goal done without merge
|
|
5420
5427
|
`);
|
|
5421
|
-
|
|
5428
|
+
goal.state = "done";
|
|
5429
|
+
return;
|
|
5430
|
+
}
|
|
5431
|
+
const ordered = [...taskPrs].sort((a, b) => extractIssueNumber(a) - extractIssueNumber(b));
|
|
5432
|
+
for (const pr of ordered) {
|
|
5433
|
+
if (pr.isDraft) {
|
|
5434
|
+
process.stdout.write(`[goal-tick] promoting draft PR #${pr.number} \u2192 ready
|
|
5435
|
+
`);
|
|
5436
|
+
const ready = markPrReady(pr.number, ctx.cwd);
|
|
5422
5437
|
if (!ready.ok) {
|
|
5423
|
-
process.stderr.write(`[goal-tick] finalizeGoal: markPrReady failed: ${ready.error}
|
|
5438
|
+
process.stderr.write(`[goal-tick] finalizeGoal: markPrReady #${pr.number} failed: ${ready.error}
|
|
5424
5439
|
`);
|
|
5425
5440
|
return;
|
|
5426
5441
|
}
|
|
5427
5442
|
}
|
|
5428
|
-
|
|
5443
|
+
if (pr.baseRefName !== goal.defaultBranch) {
|
|
5444
|
+
process.stdout.write(
|
|
5445
|
+
`[goal-tick] retargeting PR #${pr.number} base ${pr.baseRefName} \u2192 ${goal.defaultBranch}
|
|
5446
|
+
`
|
|
5447
|
+
);
|
|
5448
|
+
const retarget = editPrBase(pr.number, goal.defaultBranch, ctx.cwd);
|
|
5449
|
+
if (!retarget.ok) {
|
|
5450
|
+
process.stderr.write(`[goal-tick] finalizeGoal: editPrBase #${pr.number} failed: ${retarget.error}
|
|
5429
5451
|
`);
|
|
5430
|
-
|
|
5452
|
+
return;
|
|
5453
|
+
}
|
|
5454
|
+
}
|
|
5455
|
+
process.stdout.write(`[goal-tick] squash-merging PR #${pr.number} \u2192 ${goal.defaultBranch} (head=${pr.headRefName})
|
|
5456
|
+
`);
|
|
5457
|
+
const merged = mergePrSquash(pr.number, ctx.cwd);
|
|
5431
5458
|
if (!merged.ok) {
|
|
5432
|
-
process.stderr.write(`[goal-tick] finalizeGoal: mergePrSquash failed: ${merged.error}
|
|
5459
|
+
process.stderr.write(`[goal-tick] finalizeGoal: mergePrSquash #${pr.number} failed: ${merged.error}
|
|
5433
5460
|
`);
|
|
5434
5461
|
return;
|
|
5435
5462
|
}
|
|
5436
|
-
} else {
|
|
5437
|
-
process.stdout.write(`[goal-tick] no leaf PR \u2014 marking goal done without merge
|
|
5438
|
-
`);
|
|
5439
5463
|
}
|
|
5440
5464
|
goal.state = "done";
|
|
5441
5465
|
};
|
|
5466
|
+
function extractIssueNumber(pr) {
|
|
5467
|
+
const m = pr.headRefName.match(/^(\d+)-/);
|
|
5468
|
+
if (m?.[1]) return Number.parseInt(m[1], 10);
|
|
5469
|
+
return pr.number;
|
|
5470
|
+
}
|
|
5442
5471
|
|
|
5443
5472
|
// src/scripts/finishFlow.ts
|
|
5444
5473
|
import { execFileSync as execFileSync14 } from "child_process";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kody-ade/kody-engine",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.54",
|
|
4
4
|
"description": "kody — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|