@kody-ade/kody-engine 0.4.172 → 0.4.174
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 +59 -3
- package/package.json +1 -1
package/dist/bin/kody.js
CHANGED
|
@@ -531,7 +531,22 @@ function getIssue(issueNumber, cwd) {
|
|
|
531
531
|
function stripKodyMentions(body) {
|
|
532
532
|
return body.replace(/(@)(kody)/gi, "$1\u200B$2");
|
|
533
533
|
}
|
|
534
|
+
function detectBotDispatchShape(body) {
|
|
535
|
+
const trimmed = body.replace(/^\s+/, "");
|
|
536
|
+
const m = trimmed.match(/^@kody\s+([a-z][a-z0-9-]*)\b/i);
|
|
537
|
+
return m ? m[1].toLowerCase() : null;
|
|
538
|
+
}
|
|
539
|
+
function isRunningAsBot() {
|
|
540
|
+
if (process.env.GITHUB_ACTIONS !== "true") return false;
|
|
541
|
+
const actor = (process.env.GITHUB_ACTOR ?? "").toLowerCase();
|
|
542
|
+
if (actor.endsWith("[bot]") || actor === "kody-bot" || actor === "kodyade") return true;
|
|
543
|
+
return !!process.env.KODY_APP_ID;
|
|
544
|
+
}
|
|
534
545
|
function postIssueComment(issueNumber, body, cwd) {
|
|
546
|
+
if (isRunningAsBot()) {
|
|
547
|
+
const slug = detectBotDispatchShape(body);
|
|
548
|
+
if (slug) throw new BotDispatchCommentError(slug);
|
|
549
|
+
}
|
|
535
550
|
try {
|
|
536
551
|
gh(["issue", "comment", String(issueNumber), "--body-file", "-"], { input: stripKodyMentions(body), cwd });
|
|
537
552
|
} catch (err) {
|
|
@@ -629,6 +644,10 @@ function getPrLatestReviewBody(prNumber, cwd) {
|
|
|
629
644
|
return pr.body;
|
|
630
645
|
}
|
|
631
646
|
function postPrReviewComment(prNumber, body, cwd) {
|
|
647
|
+
if (isRunningAsBot()) {
|
|
648
|
+
const slug = detectBotDispatchShape(body);
|
|
649
|
+
if (slug) throw new BotDispatchCommentError(slug);
|
|
650
|
+
}
|
|
632
651
|
try {
|
|
633
652
|
gh(["pr", "comment", String(prNumber), "--body-file", "-"], { input: stripKodyMentions(body), cwd });
|
|
634
653
|
} catch (err) {
|
|
@@ -638,11 +657,19 @@ function postPrReviewComment(prNumber, body, cwd) {
|
|
|
638
657
|
);
|
|
639
658
|
}
|
|
640
659
|
}
|
|
641
|
-
var API_TIMEOUT_MS, DEFAULT_COMMENT_LIMIT, DEFAULT_COMMENT_MAX_BYTES, VERDICT_HEADING;
|
|
660
|
+
var API_TIMEOUT_MS, BotDispatchCommentError, DEFAULT_COMMENT_LIMIT, DEFAULT_COMMENT_MAX_BYTES, VERDICT_HEADING;
|
|
642
661
|
var init_issue = __esm({
|
|
643
662
|
"src/issue.ts"() {
|
|
644
663
|
"use strict";
|
|
645
664
|
API_TIMEOUT_MS = 3e4;
|
|
665
|
+
BotDispatchCommentError = class extends Error {
|
|
666
|
+
constructor(slug) {
|
|
667
|
+
super(
|
|
668
|
+
`bot self-dispatch via @kody comments is banned. Refusing to post "@kody ${slug} \u2026" \u2014 use runExecutableChain (same-run) or dispatchExecutable (cross-run) instead. See docs/duty-dispatch.md for the contract.`
|
|
669
|
+
);
|
|
670
|
+
this.name = "BotDispatchCommentError";
|
|
671
|
+
}
|
|
672
|
+
};
|
|
646
673
|
DEFAULT_COMMENT_LIMIT = 12;
|
|
647
674
|
DEFAULT_COMMENT_MAX_BYTES = 16e3;
|
|
648
675
|
VERDICT_HEADING = /(^|\n)\s*#{1,6}\s*Verdict\s*:/i;
|
|
@@ -1061,7 +1088,7 @@ var init_loadPriorArt = __esm({
|
|
|
1061
1088
|
// package.json
|
|
1062
1089
|
var package_default = {
|
|
1063
1090
|
name: "@kody-ade/kody-engine",
|
|
1064
|
-
version: "0.4.
|
|
1091
|
+
version: "0.4.174",
|
|
1065
1092
|
description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
|
|
1066
1093
|
license: "MIT",
|
|
1067
1094
|
type: "module",
|
|
@@ -1675,7 +1702,6 @@ var BASH_WRITE_VERB = /\b(git\s+(commit|push|merge|rebase|tag|reset|cherry-pick)
|
|
|
1675
1702
|
function toolMayMutate(name, input) {
|
|
1676
1703
|
if (!name) return false;
|
|
1677
1704
|
if (MUTATING_FILE_TOOLS.has(name)) return true;
|
|
1678
|
-
if (name.startsWith("mcp__kody-submit__")) return true;
|
|
1679
1705
|
if (name === "Bash") return BASH_WRITE_VERB.test(String(input?.command ?? ""));
|
|
1680
1706
|
return false;
|
|
1681
1707
|
}
|
|
@@ -6430,6 +6456,35 @@ function filterGoalTaskPrs(prs, taskIssueNumbers) {
|
|
|
6430
6456
|
});
|
|
6431
6457
|
}
|
|
6432
6458
|
|
|
6459
|
+
// src/scripts/deriveQaScopeFromIssue.ts
|
|
6460
|
+
init_issue();
|
|
6461
|
+
var TITLE_PATTERN = /^QA(?:\s+\w+)?:\s*(.+?)(?:\s*\(#\d+\))?\s*$/i;
|
|
6462
|
+
var deriveQaScopeFromIssue = async (ctx) => {
|
|
6463
|
+
if (typeof ctx.args.scope === "string" && ctx.args.scope.trim().length > 0) {
|
|
6464
|
+
return;
|
|
6465
|
+
}
|
|
6466
|
+
const issueNumber = Number(ctx.args.issue ?? 0);
|
|
6467
|
+
if (!Number.isFinite(issueNumber) || issueNumber <= 0) return;
|
|
6468
|
+
let title = "";
|
|
6469
|
+
try {
|
|
6470
|
+
const issue = getIssue(issueNumber, ctx.cwd);
|
|
6471
|
+
title = (issue.title ?? "").trim();
|
|
6472
|
+
} catch (err) {
|
|
6473
|
+
process.stderr.write(
|
|
6474
|
+
`[kody] deriveQaScopeFromIssue: could not read #${issueNumber}: ${err instanceof Error ? err.message : String(err)}
|
|
6475
|
+
`
|
|
6476
|
+
);
|
|
6477
|
+
return;
|
|
6478
|
+
}
|
|
6479
|
+
if (!title) return;
|
|
6480
|
+
const m = title.match(TITLE_PATTERN);
|
|
6481
|
+
const scope = (m?.[1] ?? title).trim();
|
|
6482
|
+
if (!scope) return;
|
|
6483
|
+
ctx.args.scope = scope;
|
|
6484
|
+
process.stdout.write(`\u2192 qa-engineer: derived scope from tracking issue #${issueNumber} title: "${scope}"
|
|
6485
|
+
`);
|
|
6486
|
+
};
|
|
6487
|
+
|
|
6433
6488
|
// src/scripts/diagMcp.ts
|
|
6434
6489
|
import { execFileSync as execFileSync10 } from "child_process";
|
|
6435
6490
|
import * as fs25 from "fs";
|
|
@@ -13101,6 +13156,7 @@ var preflightScripts = {
|
|
|
13101
13156
|
buildSyntheticPlugin,
|
|
13102
13157
|
resolveArtifacts,
|
|
13103
13158
|
discoverQaContext,
|
|
13159
|
+
deriveQaScopeFromIssue,
|
|
13104
13160
|
resolvePreviewUrl,
|
|
13105
13161
|
resolveQaUrl,
|
|
13106
13162
|
promoteQaGoal,
|
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.174",
|
|
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",
|