@kody-ade/kody-engine 0.3.7 → 0.3.8
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 +21 -5
- 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.8",
|
|
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",
|
|
@@ -2810,20 +2810,36 @@ function firstLine(s) {
|
|
|
2810
2810
|
}
|
|
2811
2811
|
function findExistingPr(branch, cwd) {
|
|
2812
2812
|
try {
|
|
2813
|
-
const output = gh2(["pr", "view", branch, "--json", "number,url"], { cwd });
|
|
2813
|
+
const output = gh2(["pr", "view", branch, "--json", "number,url,body"], { cwd });
|
|
2814
2814
|
const parsed = JSON.parse(output);
|
|
2815
2815
|
if (typeof parsed?.number === "number" && typeof parsed?.url === "string") {
|
|
2816
|
-
|
|
2816
|
+
const body = typeof parsed.body === "string" ? parsed.body : "";
|
|
2817
|
+
return { number: parsed.number, url: parsed.url, body };
|
|
2817
2818
|
}
|
|
2818
2819
|
return null;
|
|
2819
2820
|
} catch {
|
|
2820
2821
|
return null;
|
|
2821
2822
|
}
|
|
2822
2823
|
}
|
|
2824
|
+
function recoverSourceIssueNumber(existingBody, branch, prNumber) {
|
|
2825
|
+
const bodyMatch = existingBody.match(/\bCloses #(\d+)\b/i);
|
|
2826
|
+
if (bodyMatch) {
|
|
2827
|
+
const n = parseInt(bodyMatch[1], 10);
|
|
2828
|
+
if (n > 0 && n !== prNumber) return n;
|
|
2829
|
+
}
|
|
2830
|
+
const branchMatch = branch.match(/^(\d+)-/);
|
|
2831
|
+
if (branchMatch) {
|
|
2832
|
+
const n = parseInt(branchMatch[1], 10);
|
|
2833
|
+
if (n > 0 && n !== prNumber) return n;
|
|
2834
|
+
}
|
|
2835
|
+
return null;
|
|
2836
|
+
}
|
|
2823
2837
|
function ensurePr(opts) {
|
|
2824
|
-
const title = buildPrTitle(opts.issueNumber, opts.issueTitle, opts.draft);
|
|
2825
|
-
const body = buildPrBody(opts);
|
|
2826
2838
|
const existing = findExistingPr(opts.branch, opts.cwd);
|
|
2839
|
+
const effectiveIssueNumber = existing ? recoverSourceIssueNumber(existing.body, opts.branch, existing.number) ?? opts.issueNumber : opts.issueNumber;
|
|
2840
|
+
const effectiveOpts = { ...opts, issueNumber: effectiveIssueNumber };
|
|
2841
|
+
const title = buildPrTitle(effectiveOpts.issueNumber, effectiveOpts.issueTitle, effectiveOpts.draft);
|
|
2842
|
+
const body = buildPrBody(effectiveOpts);
|
|
2827
2843
|
if (existing) {
|
|
2828
2844
|
try {
|
|
2829
2845
|
gh2(["pr", "edit", String(existing.number), "--body-file", "-"], { input: body, cwd: opts.cwd });
|
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.8",
|
|
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",
|