@kody-ade/kody-engine 0.2.38 → 0.2.40
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/kody2.js +1 -142
- package/dist/executables/fix/profile.json +0 -3
- package/package.json +1 -1
package/dist/bin/kody2.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.2.
|
|
6
|
+
version: "0.2.40",
|
|
7
7
|
description: "kody2 \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
|
|
8
8
|
license: "MIT",
|
|
9
9
|
type: "module",
|
|
@@ -3654,146 +3654,6 @@ var verify = async (ctx) => {
|
|
|
3654
3654
|
}
|
|
3655
3655
|
};
|
|
3656
3656
|
|
|
3657
|
-
// src/scripts/verifyFixAlignment.ts
|
|
3658
|
-
function summarizeFeedbackActions(block) {
|
|
3659
|
-
const summary = { totalItems: 0, fixedItems: 0, declinedItems: 0, unparsedLines: 0 };
|
|
3660
|
-
if (!block.trim()) return summary;
|
|
3661
|
-
for (const raw of block.split("\n")) {
|
|
3662
|
-
if (!/^\s*[-*]\s+/.test(raw)) continue;
|
|
3663
|
-
const line = raw.replace(/^\s*[-*]\s*/, "").trim();
|
|
3664
|
-
summary.totalItems++;
|
|
3665
|
-
if (/\bfixed\s*:/i.test(line)) summary.fixedItems++;
|
|
3666
|
-
else if (/\bdeclined\s*:/i.test(line)) summary.declinedItems++;
|
|
3667
|
-
else summary.unparsedLines++;
|
|
3668
|
-
}
|
|
3669
|
-
return summary;
|
|
3670
|
-
}
|
|
3671
|
-
var ACTIONABLE_HEADING = /^#{1,6}\s+(Concerns|Suggestions|Bugs)\b/i;
|
|
3672
|
-
var ANY_HEADING = /^#{1,6}\s+/;
|
|
3673
|
-
function actionableSections(reviewBody) {
|
|
3674
|
-
const lines = reviewBody.split("\n");
|
|
3675
|
-
const kept = [];
|
|
3676
|
-
let inside = false;
|
|
3677
|
-
for (const raw of lines) {
|
|
3678
|
-
if (ACTIONABLE_HEADING.test(raw)) {
|
|
3679
|
-
inside = true;
|
|
3680
|
-
kept.push(raw);
|
|
3681
|
-
continue;
|
|
3682
|
-
}
|
|
3683
|
-
if (inside && ANY_HEADING.test(raw)) {
|
|
3684
|
-
inside = false;
|
|
3685
|
-
continue;
|
|
3686
|
-
}
|
|
3687
|
-
if (inside) kept.push(raw);
|
|
3688
|
-
}
|
|
3689
|
-
return kept.join("\n");
|
|
3690
|
-
}
|
|
3691
|
-
function extractReviewFileRefs(reviewBody) {
|
|
3692
|
-
if (!reviewBody) return [];
|
|
3693
|
-
const scoped = actionableSections(reviewBody);
|
|
3694
|
-
if (!scoped.trim()) return [];
|
|
3695
|
-
const found = /* @__PURE__ */ new Set();
|
|
3696
|
-
const backtick = /`([^`\s]+\.[a-zA-Z]{1,5})(?::\d+(?:-\d+)?)?`/g;
|
|
3697
|
-
let m;
|
|
3698
|
-
while ((m = backtick.exec(scoped)) !== null) {
|
|
3699
|
-
const raw = m[1];
|
|
3700
|
-
if (isPlausibleSourcePath(raw)) found.add(raw);
|
|
3701
|
-
}
|
|
3702
|
-
const bare = /(?<![A-Za-z0-9/_.-])((?:[A-Za-z0-9_./-]+\/)+[A-Za-z0-9_.-]+\.[a-zA-Z]{1,5})(?::\d+(?:-\d+)?)?/g;
|
|
3703
|
-
while ((m = bare.exec(scoped)) !== null) {
|
|
3704
|
-
const raw = m[1];
|
|
3705
|
-
if (isPlausibleSourcePath(raw)) found.add(raw);
|
|
3706
|
-
}
|
|
3707
|
-
return Array.from(found);
|
|
3708
|
-
}
|
|
3709
|
-
function isPlausibleSourcePath(p) {
|
|
3710
|
-
if (p.startsWith("http://") || p.startsWith("https://")) return false;
|
|
3711
|
-
if (p.startsWith("//")) return false;
|
|
3712
|
-
if (p.startsWith("/")) return false;
|
|
3713
|
-
if (!p.includes("/")) return false;
|
|
3714
|
-
if (/\.(md|rst|txt|png|jpg|jpeg|gif|svg|pdf)$/i.test(p)) return false;
|
|
3715
|
-
const firstSeg = p.slice(0, p.indexOf("/"));
|
|
3716
|
-
if (firstSeg.includes(".")) return false;
|
|
3717
|
-
return true;
|
|
3718
|
-
}
|
|
3719
|
-
function declinedFileRefs(feedbackActions, refs) {
|
|
3720
|
-
if (!feedbackActions.trim() || refs.length === 0) return /* @__PURE__ */ new Set();
|
|
3721
|
-
const declined = /* @__PURE__ */ new Set();
|
|
3722
|
-
for (const raw of feedbackActions.split("\n")) {
|
|
3723
|
-
if (!/^\s*[-*]\s+/.test(raw)) continue;
|
|
3724
|
-
if (!/\bdeclined\s*:/i.test(raw)) continue;
|
|
3725
|
-
for (const ref of refs) {
|
|
3726
|
-
if (raw.includes(ref)) declined.add(ref);
|
|
3727
|
-
}
|
|
3728
|
-
}
|
|
3729
|
-
return declined;
|
|
3730
|
-
}
|
|
3731
|
-
function makeAction2(type, payload) {
|
|
3732
|
-
return { type, payload, timestamp: (/* @__PURE__ */ new Date()).toISOString() };
|
|
3733
|
-
}
|
|
3734
|
-
var verifyFixAlignment = async (ctx, profile) => {
|
|
3735
|
-
if (profile.name !== "fix") return;
|
|
3736
|
-
if (ctx.skipAgent) return;
|
|
3737
|
-
if (!ctx.data.agentDone) return;
|
|
3738
|
-
const feedbackActions = ctx.data.feedbackActions ?? "";
|
|
3739
|
-
const summary = summarizeFeedbackActions(feedbackActions);
|
|
3740
|
-
ctx.data.feedbackActionsSummary = summary;
|
|
3741
|
-
const committed = Boolean(ctx.data.commitResult?.committed);
|
|
3742
|
-
if (summary.totalItems === 0) {
|
|
3743
|
-
return failOnce(ctx, "FIX_FAILED", "fix produced no FEEDBACK_ACTIONS items", summary);
|
|
3744
|
-
}
|
|
3745
|
-
if (summary.fixedItems > 0 && !committed) {
|
|
3746
|
-
return failOnce(
|
|
3747
|
-
ctx,
|
|
3748
|
-
"FIX_FAILED",
|
|
3749
|
-
`fix claimed ${summary.fixedItems} fixed item(s) but produced no commit`,
|
|
3750
|
-
summary
|
|
3751
|
-
);
|
|
3752
|
-
}
|
|
3753
|
-
const reviewBody = ctx.data.feedback ?? "";
|
|
3754
|
-
const refs = extractReviewFileRefs(reviewBody);
|
|
3755
|
-
const changedFiles = (ctx.data.changedFiles ?? []).map((f) => f.trim()).filter(Boolean);
|
|
3756
|
-
ctx.data.reviewFileRefs = refs;
|
|
3757
|
-
if (refs.length > 0 && committed) {
|
|
3758
|
-
const declined = declinedFileRefs(feedbackActions, refs);
|
|
3759
|
-
const missing = refs.filter((r) => !declined.has(r) && !changedFiles.some((f) => filesMatch(f, r)));
|
|
3760
|
-
if (missing.length > 0) {
|
|
3761
|
-
return failOnce(
|
|
3762
|
-
ctx,
|
|
3763
|
-
"FIX_FAILED",
|
|
3764
|
-
`fix did not touch review-named file(s): ${missing.join(", ")} \u2014 address them or mark declined with a reason`,
|
|
3765
|
-
summary,
|
|
3766
|
-
{ missingFiles: missing, declinedFiles: Array.from(declined), changedFiles }
|
|
3767
|
-
);
|
|
3768
|
-
}
|
|
3769
|
-
}
|
|
3770
|
-
if (summary.fixedItems === 0 && summary.declinedItems > 0 && !committed) {
|
|
3771
|
-
ctx.data.action = makeAction2("FIX_DECLINED", {
|
|
3772
|
-
feedbackActionsSummary: summary,
|
|
3773
|
-
note: "agent declined all feedback items; no commit made"
|
|
3774
|
-
});
|
|
3775
|
-
}
|
|
3776
|
-
};
|
|
3777
|
-
function failOnce(ctx, type, reason, summary, extra) {
|
|
3778
|
-
ctx.output.exitCode = 1;
|
|
3779
|
-
ctx.output.reason = reason;
|
|
3780
|
-
ctx.data.agentDone = false;
|
|
3781
|
-
ctx.data.action = makeAction2(type, {
|
|
3782
|
-
reason,
|
|
3783
|
-
feedbackActionsSummary: summary,
|
|
3784
|
-
...extra ?? {}
|
|
3785
|
-
});
|
|
3786
|
-
}
|
|
3787
|
-
function filesMatch(changedPath, reviewRef) {
|
|
3788
|
-
if (changedPath === reviewRef) return true;
|
|
3789
|
-
if (changedPath.endsWith("/" + reviewRef)) return true;
|
|
3790
|
-
if (reviewRef.endsWith("/" + changedPath)) return true;
|
|
3791
|
-
const a = changedPath.split("/");
|
|
3792
|
-
const b = reviewRef.split("/");
|
|
3793
|
-
if (a[a.length - 1] !== b[b.length - 1]) return false;
|
|
3794
|
-
return a.length >= 2 && b.length >= 2 && a[a.length - 2] === b[b.length - 2];
|
|
3795
|
-
}
|
|
3796
|
-
|
|
3797
3657
|
// src/scripts/watchStalePrsFlow.ts
|
|
3798
3658
|
function readWatchConfig(ctx) {
|
|
3799
3659
|
const cfg = ctx.config.watch;
|
|
@@ -3923,7 +3783,6 @@ var postflightScripts = {
|
|
|
3923
3783
|
postPlanComment,
|
|
3924
3784
|
postReviewResult,
|
|
3925
3785
|
persistArtifacts,
|
|
3926
|
-
verifyFixAlignment,
|
|
3927
3786
|
writeRunSummary,
|
|
3928
3787
|
saveTaskState
|
|
3929
3788
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kody-ade/kody-engine",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.40",
|
|
4
4
|
"description": "kody2 — autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|