@kody-ade/kody-engine 0.4.267 → 0.4.269

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.
Files changed (2) hide show
  1. package/dist/bin/kody.js +45 -12
  2. 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.267",
18
+ version: "0.4.269",
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"], { cwd });
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", "-"], { input: stripKodyMentions(body), cwd });
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"], { cwd });
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"], { cwd });
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", "-"], { input: stripKodyMentions(body), cwd });
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)}
@@ -330,7 +348,7 @@ var init_issue = __esm({
330
348
  };
331
349
  DEFAULT_COMMENT_LIMIT = 12;
332
350
  DEFAULT_COMMENT_MAX_BYTES = 16e3;
333
- VERDICT_HEADING = /(^|\n)\s*#{1,6}\s*Verdict\s*:/i;
351
+ VERDICT_HEADING = /(^|\n)\s*#{1,6}\s*Verdict\b\s*:?/i;
334
352
  }
335
353
  });
336
354
 
@@ -9406,10 +9424,25 @@ var init_composePrompt = __esm({
9406
9424
  });
9407
9425
 
9408
9426
  // src/scripts/postReviewResult.ts
9427
+ function extractVerdictSection(body) {
9428
+ const heading = body.match(/(^|\n)\s*#{1,6}\s*Verdict\b\s*:?\s*/i);
9429
+ if (!heading || heading.index === void 0) return null;
9430
+ const start = heading.index + heading[0].length;
9431
+ const rest = body.slice(start);
9432
+ const nextHeading = rest.search(/\n\s*#{1,6}\s+\S/);
9433
+ return nextHeading >= 0 ? rest.slice(0, nextHeading) : rest;
9434
+ }
9409
9435
  function detectVerdict(body) {
9410
- const m = body.match(/##\s*Verdict\s*:\s*(PASS|CONCERNS|FAIL)\b/i);
9411
- if (!m) return "UNKNOWN";
9412
- return m[1].toUpperCase();
9436
+ const exact = body.match(/(^|\n)\s*#{1,6}\s*Verdict\s*:?\s*(PASS|CONCERNS|FAIL)\b/i);
9437
+ if (exact) return exact[2].toUpperCase();
9438
+ const section = extractVerdictSection(body);
9439
+ if (!section) return "UNKNOWN";
9440
+ const explicit = section.match(/\b(PASS|CONCERNS|FAIL)\b/i);
9441
+ if (explicit) return explicit[1].toUpperCase();
9442
+ if (/\bLGTM\b/i.test(section) || /\blooks good\b/i.test(section) || /\bno changes required\b/i.test(section)) {
9443
+ return "PASS";
9444
+ }
9445
+ return "UNKNOWN";
9413
9446
  }
9414
9447
  function reviewAction(verdict, payload) {
9415
9448
  const type = verdict === "PASS" ? "REVIEW_PASS" : verdict === "CONCERNS" ? "REVIEW_CONCERNS" : verdict === "FAIL" ? "REVIEW_FAIL" : "REVIEW_COMPLETED";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.267",
3
+ "version": "0.4.269",
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",