@kody-ade/kody-engine 0.3.53 → 0.3.55
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 +64 -9
- 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.3.
|
|
6
|
+
version: "0.3.55",
|
|
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",
|
|
@@ -807,9 +807,16 @@ function autoDispatch(opts) {
|
|
|
807
807
|
const aliased = firstToken ? aliases[firstToken] ?? firstToken : null;
|
|
808
808
|
let executable = null;
|
|
809
809
|
let consumedFirstToken = false;
|
|
810
|
-
if (aliased
|
|
811
|
-
|
|
812
|
-
|
|
810
|
+
if (aliased) {
|
|
811
|
+
if (getProfileInputs(aliased) !== null) {
|
|
812
|
+
executable = aliased;
|
|
813
|
+
consumedFirstToken = true;
|
|
814
|
+
} else if (firstToken && aliases[firstToken] && aliases[firstToken] === aliased) {
|
|
815
|
+
process.stderr.write(
|
|
816
|
+
`[kody] dispatch: alias '${firstToken}' \u2192 '${aliased}' has no matching executable; falling back to default
|
|
817
|
+
`
|
|
818
|
+
);
|
|
819
|
+
}
|
|
813
820
|
}
|
|
814
821
|
if (!executable) {
|
|
815
822
|
executable = isPr ? opts?.config?.defaultPrExecutable ?? "fix" : opts?.config?.defaultExecutable ?? null;
|
|
@@ -1473,10 +1480,23 @@ function commitAndPush(branch, agentMessage, cwd) {
|
|
|
1473
1480
|
const sha = git(["rev-parse", "HEAD"], cwd).slice(0, 7);
|
|
1474
1481
|
try {
|
|
1475
1482
|
git(["push", "-u", "origin", branch], cwd);
|
|
1476
|
-
|
|
1477
|
-
|
|
1483
|
+
return { committed: true, pushed: true, sha, message };
|
|
1484
|
+
} catch (firstErr) {
|
|
1485
|
+
try {
|
|
1486
|
+
git(["push", "--force-with-lease", "-u", "origin", branch], cwd);
|
|
1487
|
+
return { committed: true, pushed: true, sha, message };
|
|
1488
|
+
} catch (secondErr) {
|
|
1489
|
+
const tail = (secondErr instanceof Error ? secondErr.message : String(secondErr)).slice(-400);
|
|
1490
|
+
const initial = firstErr instanceof Error ? firstErr.message : String(firstErr);
|
|
1491
|
+
return {
|
|
1492
|
+
committed: true,
|
|
1493
|
+
pushed: false,
|
|
1494
|
+
sha,
|
|
1495
|
+
message,
|
|
1496
|
+
pushError: `push failed: ${initial.slice(-200)} | force-with-lease failed: ${tail}`
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1478
1499
|
}
|
|
1479
|
-
return { committed: true, pushed: true, sha, message };
|
|
1480
1500
|
}
|
|
1481
1501
|
function hasCommitsAhead(branch, defaultBranch, cwd) {
|
|
1482
1502
|
try {
|
|
@@ -2100,6 +2120,16 @@ var commitAndPush2 = async (ctx) => {
|
|
|
2100
2120
|
ctx.data.commitResult = result;
|
|
2101
2121
|
const postCommitFiles = result.committed ? listFilesInCommit("HEAD", ctx.cwd) : listChangedFiles(ctx.cwd);
|
|
2102
2122
|
ctx.data.changedFiles = postCommitFiles.filter((f) => !isForbiddenPath(f));
|
|
2123
|
+
if (result.committed && !result.pushed) {
|
|
2124
|
+
const reason = result.pushError ?? "push failed (no error detail)";
|
|
2125
|
+
ctx.data.commitCrash = reason;
|
|
2126
|
+
if (ctx.output.exitCode === void 0 || ctx.output.exitCode === 0) {
|
|
2127
|
+
ctx.output.exitCode = 4;
|
|
2128
|
+
}
|
|
2129
|
+
if (!ctx.output.reason) ctx.output.reason = reason;
|
|
2130
|
+
process.stderr.write(`[kody commitAndPush] ${reason}
|
|
2131
|
+
`);
|
|
2132
|
+
}
|
|
2103
2133
|
} catch (err) {
|
|
2104
2134
|
const reason = err instanceof Error ? err.message : String(err);
|
|
2105
2135
|
ctx.data.commitCrash = reason;
|
|
@@ -3309,6 +3339,9 @@ var ensurePr2 = async (ctx) => {
|
|
|
3309
3339
|
if (!commitResult?.committed && !hasCommits) {
|
|
3310
3340
|
return;
|
|
3311
3341
|
}
|
|
3342
|
+
if (commitResult?.committed && commitResult.pushed === false) {
|
|
3343
|
+
return;
|
|
3344
|
+
}
|
|
3312
3345
|
const branch = ctx.data.branch;
|
|
3313
3346
|
if (!branch) return;
|
|
3314
3347
|
const failureReason = computeFailureReason(ctx);
|
|
@@ -3340,8 +3373,8 @@ var ensurePr2 = async (ctx) => {
|
|
|
3340
3373
|
}
|
|
3341
3374
|
};
|
|
3342
3375
|
function computeFailureReason(ctx) {
|
|
3343
|
-
const
|
|
3344
|
-
if (
|
|
3376
|
+
const expectedTests = collectExpectedTests(ctx.data.coverageMisses);
|
|
3377
|
+
if (expectedTests.length > 0) return `missing tests: ${expectedTests.join(", ")}`;
|
|
3345
3378
|
const agentDone = Boolean(ctx.data.agentDone);
|
|
3346
3379
|
if (!agentDone) {
|
|
3347
3380
|
return ctx.data.agentFailureReason || ctx.data.agentError || ctx.data.commitCrash || "agent did not emit DONE";
|
|
@@ -3349,6 +3382,28 @@ function computeFailureReason(ctx) {
|
|
|
3349
3382
|
if (ctx.data.verifyOk === false) return ctx.data.verifyReason || "verify failed";
|
|
3350
3383
|
return "";
|
|
3351
3384
|
}
|
|
3385
|
+
function collectExpectedTests(raw) {
|
|
3386
|
+
if (!Array.isArray(raw) || raw.length === 0) return [];
|
|
3387
|
+
const out = [];
|
|
3388
|
+
let unparseable = 0;
|
|
3389
|
+
for (const item of raw) {
|
|
3390
|
+
if (!item || typeof item !== "object") {
|
|
3391
|
+
unparseable++;
|
|
3392
|
+
continue;
|
|
3393
|
+
}
|
|
3394
|
+
const r = item;
|
|
3395
|
+
const candidate = r.expectedTest ?? r.expected ?? r.file;
|
|
3396
|
+
if (typeof candidate === "string" && candidate.length > 0) out.push(candidate);
|
|
3397
|
+
else unparseable++;
|
|
3398
|
+
}
|
|
3399
|
+
if (unparseable > 0) {
|
|
3400
|
+
process.stderr.write(
|
|
3401
|
+
`[kody] ensurePr: ${unparseable} coverageMisses entry/entries had no recognizable test path \u2014 shape may have drifted
|
|
3402
|
+
`
|
|
3403
|
+
);
|
|
3404
|
+
}
|
|
3405
|
+
return out;
|
|
3406
|
+
}
|
|
3352
3407
|
|
|
3353
3408
|
// src/scripts/finishFlow.ts
|
|
3354
3409
|
import { execFileSync as execFileSync10 } from "child_process";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kody-ade/kody-engine",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.55",
|
|
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",
|