@kody-ade/kody-engine 0.2.39 → 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 -134
- 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,138 +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
|
-
const reviewBody = ctx.data.feedback ?? "";
|
|
3746
|
-
const refs = extractReviewFileRefs(reviewBody);
|
|
3747
|
-
const changedFiles = (ctx.data.changedFiles ?? []).map((f) => f.trim()).filter(Boolean);
|
|
3748
|
-
ctx.data.reviewFileRefs = refs;
|
|
3749
|
-
if (refs.length > 0 && committed) {
|
|
3750
|
-
const declined = declinedFileRefs(feedbackActions, refs);
|
|
3751
|
-
const missing = refs.filter((r) => !declined.has(r) && !changedFiles.some((f) => filesMatch(f, r)));
|
|
3752
|
-
if (missing.length > 0) {
|
|
3753
|
-
return failOnce(
|
|
3754
|
-
ctx,
|
|
3755
|
-
"FIX_FAILED",
|
|
3756
|
-
`fix did not touch review-named file(s): ${missing.join(", ")} \u2014 address them or mark declined with a reason`,
|
|
3757
|
-
summary,
|
|
3758
|
-
{ missingFiles: missing, declinedFiles: Array.from(declined), changedFiles }
|
|
3759
|
-
);
|
|
3760
|
-
}
|
|
3761
|
-
}
|
|
3762
|
-
if (summary.fixedItems === 0 && summary.declinedItems > 0 && !committed) {
|
|
3763
|
-
ctx.data.action = makeAction2("FIX_DECLINED", {
|
|
3764
|
-
feedbackActionsSummary: summary,
|
|
3765
|
-
note: "agent declined all feedback items; no commit made"
|
|
3766
|
-
});
|
|
3767
|
-
}
|
|
3768
|
-
};
|
|
3769
|
-
function failOnce(ctx, type, reason, summary, extra) {
|
|
3770
|
-
ctx.output.exitCode = 1;
|
|
3771
|
-
ctx.output.reason = reason;
|
|
3772
|
-
ctx.data.agentDone = false;
|
|
3773
|
-
ctx.data.action = makeAction2(type, {
|
|
3774
|
-
reason,
|
|
3775
|
-
feedbackActionsSummary: summary,
|
|
3776
|
-
...extra ?? {}
|
|
3777
|
-
});
|
|
3778
|
-
}
|
|
3779
|
-
function filesMatch(changedPath, reviewRef) {
|
|
3780
|
-
if (changedPath === reviewRef) return true;
|
|
3781
|
-
if (changedPath.endsWith("/" + reviewRef)) return true;
|
|
3782
|
-
if (reviewRef.endsWith("/" + changedPath)) return true;
|
|
3783
|
-
const a = changedPath.split("/");
|
|
3784
|
-
const b = reviewRef.split("/");
|
|
3785
|
-
if (a[a.length - 1] !== b[b.length - 1]) return false;
|
|
3786
|
-
return a.length >= 2 && b.length >= 2 && a[a.length - 2] === b[b.length - 2];
|
|
3787
|
-
}
|
|
3788
|
-
|
|
3789
3657
|
// src/scripts/watchStalePrsFlow.ts
|
|
3790
3658
|
function readWatchConfig(ctx) {
|
|
3791
3659
|
const cfg = ctx.config.watch;
|
|
@@ -3915,7 +3783,6 @@ var postflightScripts = {
|
|
|
3915
3783
|
postPlanComment,
|
|
3916
3784
|
postReviewResult,
|
|
3917
3785
|
persistArtifacts,
|
|
3918
|
-
verifyFixAlignment,
|
|
3919
3786
|
writeRunSummary,
|
|
3920
3787
|
saveTaskState
|
|
3921
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",
|