@kody-ade/kody-engine 0.4.32 → 0.4.33
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 +68 -3
- 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.33",
|
|
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",
|
|
@@ -5169,6 +5169,30 @@ var ensureLifecycleLabels = async (ctx) => {
|
|
|
5169
5169
|
};
|
|
5170
5170
|
|
|
5171
5171
|
// src/pr.ts
|
|
5172
|
+
function prMergeStatus(prNumber, cwd) {
|
|
5173
|
+
try {
|
|
5174
|
+
const out = gh(
|
|
5175
|
+
["pr", "view", String(prNumber), "--json", "mergeable,mergeStateStatus"],
|
|
5176
|
+
{ cwd }
|
|
5177
|
+
);
|
|
5178
|
+
const parsed = JSON.parse(out);
|
|
5179
|
+
const mergeable = parsed.mergeable ?? "UNKNOWN";
|
|
5180
|
+
const mergeStateStatus = parsed.mergeStateStatus ?? "UNKNOWN";
|
|
5181
|
+
return { status: classifyMergeStatus(mergeable, mergeStateStatus), mergeable, mergeStateStatus };
|
|
5182
|
+
} catch {
|
|
5183
|
+
return { status: "ERROR", mergeable: "", mergeStateStatus: "" };
|
|
5184
|
+
}
|
|
5185
|
+
}
|
|
5186
|
+
function classifyMergeStatus(mergeable, mergeStateStatus) {
|
|
5187
|
+
if (mergeable === "CONFLICTING") return "CONFLICTING";
|
|
5188
|
+
if (mergeable === "UNKNOWN") return "UNKNOWN";
|
|
5189
|
+
if (mergeable === "MERGEABLE") {
|
|
5190
|
+
if (mergeStateStatus === "CLEAN") return "MERGEABLE";
|
|
5191
|
+
if (mergeStateStatus === "DIRTY") return "CONFLICTING";
|
|
5192
|
+
return "BLOCKED";
|
|
5193
|
+
}
|
|
5194
|
+
return "UNKNOWN";
|
|
5195
|
+
}
|
|
5172
5196
|
var TITLE_MAX = 72;
|
|
5173
5197
|
function stripTitlePrefixes(raw) {
|
|
5174
5198
|
let s = raw.trim();
|
|
@@ -7621,12 +7645,35 @@ var resolveFlow = async (ctx) => {
|
|
|
7621
7645
|
ctx.data.pr = pr;
|
|
7622
7646
|
ctx.data.commentTargetType = "pr";
|
|
7623
7647
|
ctx.data.commentTargetNumber = prNumber;
|
|
7624
|
-
checkoutPrBranch(prNumber, ctx.cwd);
|
|
7625
|
-
ctx.data.branch = getCurrentBranch(ctx.cwd);
|
|
7626
7648
|
const baseBranch = pr.baseRefName || ctx.config.git.defaultBranch;
|
|
7627
7649
|
ctx.data.baseBranch = baseBranch;
|
|
7650
|
+
const ghStatus = prMergeStatus(prNumber, ctx.cwd);
|
|
7651
|
+
if (ghStatus.status === "MERGEABLE") {
|
|
7652
|
+
ctx.output.exitCode = 0;
|
|
7653
|
+
ctx.output.reason = `PR #${prNumber} is mergeable (no conflicts) \u2014 nothing to resolve`;
|
|
7654
|
+
ctx.skipAgent = true;
|
|
7655
|
+
tryPostPr3(prNumber, `\u2139\uFE0F kody resolve: ${ctx.output.reason}`, ctx.cwd);
|
|
7656
|
+
return;
|
|
7657
|
+
}
|
|
7658
|
+
if (ghStatus.status === "BLOCKED") {
|
|
7659
|
+
ctx.output.exitCode = 0;
|
|
7660
|
+
ctx.output.reason = `PR #${prNumber} is mergeable but blocked by checks/reviews (mergeStateStatus=${ghStatus.mergeStateStatus}) \u2014 nothing for resolve to do`;
|
|
7661
|
+
ctx.skipAgent = true;
|
|
7662
|
+
tryPostPr3(prNumber, `\u2139\uFE0F kody resolve: ${ctx.output.reason}`, ctx.cwd);
|
|
7663
|
+
return;
|
|
7664
|
+
}
|
|
7665
|
+
checkoutPrBranch(prNumber, ctx.cwd);
|
|
7666
|
+
ctx.data.branch = getCurrentBranch(ctx.cwd);
|
|
7628
7667
|
const mergeStatus = mergeBase(baseBranch, ctx.cwd);
|
|
7629
7668
|
if (mergeStatus === "clean") {
|
|
7669
|
+
if (ghStatus.status === "CONFLICTING") {
|
|
7670
|
+
const pushed = pushEmptyCommit(ctx.data.branch, ctx.cwd);
|
|
7671
|
+
ctx.output.exitCode = 0;
|
|
7672
|
+
ctx.output.reason = pushed ? `local merge clean despite GitHub reporting CONFLICTING \u2014 pushed empty commit to force re-evaluation` : `local merge clean despite GitHub reporting CONFLICTING \u2014 couldn't refresh GitHub cache (push failed)`;
|
|
7673
|
+
ctx.skipAgent = true;
|
|
7674
|
+
tryPostPr3(prNumber, `\u2139\uFE0F kody resolve: ${ctx.output.reason}`, ctx.cwd);
|
|
7675
|
+
return;
|
|
7676
|
+
}
|
|
7630
7677
|
ctx.output.exitCode = 0;
|
|
7631
7678
|
ctx.output.reason = `already up to date with origin/${baseBranch} \u2014 nothing to resolve`;
|
|
7632
7679
|
ctx.skipAgent = true;
|
|
@@ -7713,6 +7760,24 @@ function tryPostPr3(prNumber, body, cwd) {
|
|
|
7713
7760
|
} catch {
|
|
7714
7761
|
}
|
|
7715
7762
|
}
|
|
7763
|
+
function pushEmptyCommit(branch, cwd) {
|
|
7764
|
+
const env = { ...process.env, HUSKY: "0", SKIP_HOOKS: "1" };
|
|
7765
|
+
try {
|
|
7766
|
+
execFileSync22(
|
|
7767
|
+
"git",
|
|
7768
|
+
["commit", "--allow-empty", "-m", "chore: kody resolve refresh \u2014 empty commit to recompute mergeable status"],
|
|
7769
|
+
{ cwd, env, stdio: ["ignore", "pipe", "pipe"] }
|
|
7770
|
+
);
|
|
7771
|
+
execFileSync22("git", ["push", "-u", "origin", branch], {
|
|
7772
|
+
cwd,
|
|
7773
|
+
env,
|
|
7774
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7775
|
+
});
|
|
7776
|
+
return true;
|
|
7777
|
+
} catch {
|
|
7778
|
+
return false;
|
|
7779
|
+
}
|
|
7780
|
+
}
|
|
7716
7781
|
|
|
7717
7782
|
// src/deployments.ts
|
|
7718
7783
|
function findPreviewDeploymentUrl(prNumber, cwd) {
|
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.33",
|
|
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",
|