@kody-ade/kody-engine 0.4.266 → 0.4.268
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 +36 -12
- package/package.json +1 -1
package/dist/bin/kody.js
CHANGED
|
@@ -15,7 +15,7 @@ var init_package = __esm({
|
|
|
15
15
|
"package.json"() {
|
|
16
16
|
package_default = {
|
|
17
17
|
name: "@kody-ade/kody-engine",
|
|
18
|
-
version: "0.4.
|
|
18
|
+
version: "0.4.268",
|
|
19
19
|
description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
|
|
20
20
|
license: "MIT",
|
|
21
21
|
type: "module",
|
|
@@ -166,7 +166,10 @@ function gh(args, options) {
|
|
|
166
166
|
}).trim();
|
|
167
167
|
}
|
|
168
168
|
function getIssue(issueNumber, cwd) {
|
|
169
|
-
const output = gh(["issue", "view", String(issueNumber), "--json", "number,title,body,comments,labels,url"], {
|
|
169
|
+
const output = gh(["issue", "view", String(issueNumber), "--json", "number,title,body,comments,labels,url"], {
|
|
170
|
+
cwd,
|
|
171
|
+
preferRepoToken: true
|
|
172
|
+
});
|
|
170
173
|
const parsed = JSON.parse(output);
|
|
171
174
|
if (typeof parsed?.title !== "string") {
|
|
172
175
|
throw new Error(`Issue #${issueNumber}: unexpected response shape`);
|
|
@@ -206,7 +209,11 @@ function postIssueComment(issueNumber, body, cwd) {
|
|
|
206
209
|
if (slug2) throw new BotDispatchCommentError(slug2);
|
|
207
210
|
}
|
|
208
211
|
try {
|
|
209
|
-
gh(["issue", "comment", String(issueNumber), "--body-file", "-"], {
|
|
212
|
+
gh(["issue", "comment", String(issueNumber), "--body-file", "-"], {
|
|
213
|
+
input: stripKodyMentions(body),
|
|
214
|
+
cwd,
|
|
215
|
+
preferRepoToken: true
|
|
216
|
+
});
|
|
210
217
|
} catch (err) {
|
|
211
218
|
process.stderr.write(
|
|
212
219
|
`[kody] failed to post comment on #${issueNumber}: ${err instanceof Error ? err.message : String(err)}
|
|
@@ -233,7 +240,8 @@ function parsePrNumber(url) {
|
|
|
233
240
|
}
|
|
234
241
|
function getPr(prNumber, cwd) {
|
|
235
242
|
const output = gh(["pr", "view", String(prNumber), "--json", "number,title,body,headRefName,baseRefName,state"], {
|
|
236
|
-
cwd
|
|
243
|
+
cwd,
|
|
244
|
+
preferRepoToken: true
|
|
237
245
|
});
|
|
238
246
|
const parsed = JSON.parse(output);
|
|
239
247
|
if (typeof parsed?.title !== "string") {
|
|
@@ -250,7 +258,7 @@ function getPr(prNumber, cwd) {
|
|
|
250
258
|
}
|
|
251
259
|
function getPrDiff(prNumber, cwd) {
|
|
252
260
|
try {
|
|
253
|
-
return gh(["pr", "diff", String(prNumber)], { cwd });
|
|
261
|
+
return gh(["pr", "diff", String(prNumber)], { cwd, preferRepoToken: true });
|
|
254
262
|
} catch (err) {
|
|
255
263
|
process.stderr.write(
|
|
256
264
|
`[kody] failed to fetch diff for PR #${prNumber}: ${err instanceof Error ? err.message : String(err)}
|
|
@@ -261,7 +269,10 @@ function getPrDiff(prNumber, cwd) {
|
|
|
261
269
|
}
|
|
262
270
|
function getPrReviews(prNumber, cwd) {
|
|
263
271
|
try {
|
|
264
|
-
const output = gh(["pr", "view", String(prNumber), "--json", "reviews"], {
|
|
272
|
+
const output = gh(["pr", "view", String(prNumber), "--json", "reviews"], {
|
|
273
|
+
cwd,
|
|
274
|
+
preferRepoToken: true
|
|
275
|
+
});
|
|
265
276
|
const parsed = JSON.parse(output);
|
|
266
277
|
if (!Array.isArray(parsed?.reviews)) return [];
|
|
267
278
|
return parsed.reviews.map(
|
|
@@ -278,7 +289,10 @@ function getPrReviews(prNumber, cwd) {
|
|
|
278
289
|
}
|
|
279
290
|
function getPrComments(prNumber, cwd) {
|
|
280
291
|
try {
|
|
281
|
-
const output = gh(["pr", "view", String(prNumber), "--json", "comments"], {
|
|
292
|
+
const output = gh(["pr", "view", String(prNumber), "--json", "comments"], {
|
|
293
|
+
cwd,
|
|
294
|
+
preferRepoToken: true
|
|
295
|
+
});
|
|
282
296
|
const parsed = JSON.parse(output);
|
|
283
297
|
if (!Array.isArray(parsed?.comments)) return [];
|
|
284
298
|
return parsed.comments.map((c) => ({
|
|
@@ -307,7 +321,11 @@ function postPrReviewComment(prNumber, body, cwd) {
|
|
|
307
321
|
if (slug2) throw new BotDispatchCommentError(slug2);
|
|
308
322
|
}
|
|
309
323
|
try {
|
|
310
|
-
gh(["pr", "comment", String(prNumber), "--body-file", "-"], {
|
|
324
|
+
gh(["pr", "comment", String(prNumber), "--body-file", "-"], {
|
|
325
|
+
input: stripKodyMentions(body),
|
|
326
|
+
cwd,
|
|
327
|
+
preferRepoToken: true
|
|
328
|
+
});
|
|
311
329
|
} catch (err) {
|
|
312
330
|
process.stderr.write(
|
|
313
331
|
`[kody] failed to post review comment on PR #${prNumber}: ${err instanceof Error ? err.message : String(err)}
|
|
@@ -10651,7 +10669,10 @@ var init_dispatchNextTaskJob = __esm({
|
|
|
10651
10669
|
import { execFileSync as execFileSync11 } from "child_process";
|
|
10652
10670
|
function prMergeStatus(prNumber, cwd) {
|
|
10653
10671
|
try {
|
|
10654
|
-
const out = gh(["pr", "view", String(prNumber), "--json", "mergeable,mergeStateStatus"], {
|
|
10672
|
+
const out = gh(["pr", "view", String(prNumber), "--json", "mergeable,mergeStateStatus"], {
|
|
10673
|
+
cwd,
|
|
10674
|
+
preferRepoToken: true
|
|
10675
|
+
});
|
|
10655
10676
|
const parsed = JSON.parse(out);
|
|
10656
10677
|
const mergeable = parsed.mergeable ?? "UNKNOWN";
|
|
10657
10678
|
const mergeStateStatus = parsed.mergeStateStatus ?? "UNKNOWN";
|
|
@@ -10738,7 +10759,7 @@ function findExistingPr(branch, cwd) {
|
|
|
10738
10759
|
try {
|
|
10739
10760
|
const output = gh(
|
|
10740
10761
|
["pr", "list", "--head", branch, "--state", "open", "--json", "number,url,body", "--limit", "1"],
|
|
10741
|
-
{ cwd }
|
|
10762
|
+
{ cwd, preferRepoToken: true }
|
|
10742
10763
|
);
|
|
10743
10764
|
const arr = JSON.parse(output);
|
|
10744
10765
|
const first = Array.isArray(arr) ? arr[0] : null;
|
|
@@ -10781,7 +10802,10 @@ function updateExistingPr(existing, body, draft, cwd) {
|
|
|
10781
10802
|
const stripped = existing.url.replace(/^https:\/\/github\.com\//, "");
|
|
10782
10803
|
const [owner, repo] = stripped.split("/");
|
|
10783
10804
|
try {
|
|
10784
|
-
gh(["api", "--method", "PATCH", `repos/${owner}/${repo}/pulls/${existing.number}`, "-f", `body=${body}`], {
|
|
10805
|
+
gh(["api", "--method", "PATCH", `repos/${owner}/${repo}/pulls/${existing.number}`, "-f", `body=${body}`], {
|
|
10806
|
+
cwd,
|
|
10807
|
+
preferRepoToken: true
|
|
10808
|
+
});
|
|
10785
10809
|
} catch (err) {
|
|
10786
10810
|
throw new Error(`gh api PATCH #${existing.number} failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
10787
10811
|
}
|
|
@@ -10790,7 +10814,7 @@ function updateExistingPr(existing, body, draft, cwd) {
|
|
|
10790
10814
|
function createPr(branch, base, title, body, draft, cwd) {
|
|
10791
10815
|
const args = ["pr", "create", "--head", branch, "--base", base, "--title", title, "--body-file", "-"];
|
|
10792
10816
|
if (draft) args.push("--draft");
|
|
10793
|
-
const url = gh(args, { input: body, cwd }).trim();
|
|
10817
|
+
const url = gh(args, { input: body, cwd, preferRepoToken: true }).trim();
|
|
10794
10818
|
const match = url.match(/\/pull\/(\d+)$/);
|
|
10795
10819
|
const number = match ? parseInt(match[1], 10) : 0;
|
|
10796
10820
|
return { url, number, draft, action: "created" };
|
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.268",
|
|
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",
|