@kody-ade/kody-engine 0.4.313 → 0.4.315
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 +85 -8
- 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.315",
|
|
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",
|
|
@@ -2154,7 +2154,7 @@ var init_companyStore = __esm({
|
|
|
2154
2154
|
"src/companyStore.ts"() {
|
|
2155
2155
|
"use strict";
|
|
2156
2156
|
DEFAULT_COMPANY_STORE = "aharonyaircohen/kody-company-store";
|
|
2157
|
-
DEFAULT_COMPANY_STORE_REF = "
|
|
2157
|
+
DEFAULT_COMPANY_STORE_REF = "main";
|
|
2158
2158
|
STORE_ENV = "KODY_COMPANY_STORE";
|
|
2159
2159
|
REF_ENV = "KODY_COMPANY_STORE_REF";
|
|
2160
2160
|
CACHE_ENV = "KODY_COMPANY_STORE_CACHE";
|
|
@@ -2633,13 +2633,82 @@ function readCheckRuns(repoSlug, ref, ignoreNames) {
|
|
|
2633
2633
|
const state = failing.length > 0 ? "RED" : pending.length > 0 ? "PENDING" : "GREEN";
|
|
2634
2634
|
return { sha, state, failing, pending };
|
|
2635
2635
|
}
|
|
2636
|
-
function
|
|
2636
|
+
function cleanLogins(values) {
|
|
2637
|
+
return [
|
|
2638
|
+
...new Set(
|
|
2639
|
+
(values ?? []).map((value) => value.trim().replace(/^@/, "")).filter(Boolean)
|
|
2640
|
+
)
|
|
2641
|
+
];
|
|
2642
|
+
}
|
|
2643
|
+
function cleanLabels(values) {
|
|
2644
|
+
return [
|
|
2645
|
+
...new Set(
|
|
2646
|
+
(values ?? []).map((value) => value.trim()).filter(Boolean)
|
|
2647
|
+
)
|
|
2648
|
+
];
|
|
2649
|
+
}
|
|
2650
|
+
function ensureKodyLabel(repoSlug, label) {
|
|
2651
|
+
if (!label.toLowerCase().startsWith("kody:")) return;
|
|
2652
|
+
gh([
|
|
2653
|
+
"label",
|
|
2654
|
+
"create",
|
|
2655
|
+
label,
|
|
2656
|
+
"-R",
|
|
2657
|
+
repoSlug,
|
|
2658
|
+
"--color",
|
|
2659
|
+
"8b5cf6",
|
|
2660
|
+
"--description",
|
|
2661
|
+
"Kody-owned tracking issue",
|
|
2662
|
+
"--force"
|
|
2663
|
+
]);
|
|
2664
|
+
}
|
|
2665
|
+
function applyIssueUpdates(repoSlug, number, opts) {
|
|
2666
|
+
const labels = cleanLabels(opts?.labels);
|
|
2667
|
+
const assignees = cleanLogins(opts?.assignees);
|
|
2668
|
+
if (labels.length === 0 && assignees.length === 0) return null;
|
|
2669
|
+
const labelsApplied = [];
|
|
2670
|
+
const assigneesApplied = [];
|
|
2671
|
+
const warnings = [];
|
|
2672
|
+
for (const label of labels) {
|
|
2673
|
+
try {
|
|
2674
|
+
gh(["issue", "edit", String(number), "-R", repoSlug, "--add-label", label]);
|
|
2675
|
+
labelsApplied.push(label);
|
|
2676
|
+
} catch (firstErr) {
|
|
2677
|
+
try {
|
|
2678
|
+
ensureKodyLabel(repoSlug, label);
|
|
2679
|
+
gh(["issue", "edit", String(number), "-R", repoSlug, "--add-label", label]);
|
|
2680
|
+
labelsApplied.push(label);
|
|
2681
|
+
} catch (err) {
|
|
2682
|
+
warnings.push(
|
|
2683
|
+
`label ${label}: ${err instanceof Error ? err.message : firstErr instanceof Error ? firstErr.message : String(err)}`
|
|
2684
|
+
);
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
for (const assignee of assignees) {
|
|
2689
|
+
try {
|
|
2690
|
+
gh(["issue", "edit", String(number), "-R", repoSlug, "--add-assignee", assignee]);
|
|
2691
|
+
assigneesApplied.push(assignee);
|
|
2692
|
+
} catch (err) {
|
|
2693
|
+
warnings.push(`assignee ${assignee}: ${err instanceof Error ? err.message : String(err)}`);
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
return {
|
|
2697
|
+
...labelsApplied.length > 0 ? { labelsApplied } : {},
|
|
2698
|
+
...assigneesApplied.length > 0 ? { assigneesApplied } : {},
|
|
2699
|
+
...warnings.length > 0 ? { warnings } : {}
|
|
2700
|
+
};
|
|
2701
|
+
}
|
|
2702
|
+
function ensureIssue(repoSlug, key, title, body, opts) {
|
|
2637
2703
|
const marker = trackMarker(key);
|
|
2638
2704
|
try {
|
|
2639
2705
|
const raw = gh(["issue", "list", "-R", repoSlug, "--state", "open", "--limit", "100", "--json", "number,body"]);
|
|
2640
2706
|
const issues = JSON.parse(raw);
|
|
2641
2707
|
const existing = issues.find((i) => (i.body ?? "").includes(marker));
|
|
2642
|
-
if (existing)
|
|
2708
|
+
if (existing) {
|
|
2709
|
+
const updates2 = applyIssueUpdates(repoSlug, existing.number, opts);
|
|
2710
|
+
return updates2 ? { created: false, number: existing.number, ...updates2 } : { created: false, number: existing.number };
|
|
2711
|
+
}
|
|
2643
2712
|
const url = gh(["issue", "create", "-R", repoSlug, "--title", title, "--body-file", "-"], {
|
|
2644
2713
|
input: `${body}
|
|
2645
2714
|
|
|
@@ -2647,7 +2716,9 @@ ${marker}`
|
|
|
2647
2716
|
});
|
|
2648
2717
|
const m = url.trim().match(/\/(\d+)\s*$/);
|
|
2649
2718
|
if (!m) return { error: `issue created but could not parse its number from: ${url}` };
|
|
2650
|
-
|
|
2719
|
+
const number = Number(m[1]);
|
|
2720
|
+
const updates = applyIssueUpdates(repoSlug, number, opts);
|
|
2721
|
+
return updates ? { created: true, number, ...updates } : { created: true, number };
|
|
2651
2722
|
} catch (err) {
|
|
2652
2723
|
return { error: err instanceof Error ? err.message : String(err) };
|
|
2653
2724
|
}
|
|
@@ -2841,13 +2912,19 @@ function capabilityToolDefinitions(opts) {
|
|
|
2841
2912
|
title: z3.string().min(1).describe("Issue title (used only on first creation)."),
|
|
2842
2913
|
body: z3.string().min(1).describe(
|
|
2843
2914
|
"Issue body markdown (used only on first creation). Include the operator mention verbatim if the capability body has one."
|
|
2844
|
-
)
|
|
2915
|
+
),
|
|
2916
|
+
labels: z3.array(z3.string().min(1)).optional().describe(
|
|
2917
|
+
"Optional labels to apply to the tracking issue every time, including reused issues. Use for dashboard visibility, e.g. ['kody:backlog']."
|
|
2918
|
+
),
|
|
2919
|
+
assignees: z3.array(z3.string().min(1)).optional().describe("Optional GitHub logins to assign to the tracking issue every time, including reused issues.")
|
|
2845
2920
|
},
|
|
2846
2921
|
handler: async (args) => {
|
|
2847
2922
|
const key = String(args.key ?? "");
|
|
2848
2923
|
const title = String(args.title ?? "");
|
|
2849
2924
|
const body = String(args.body ?? "");
|
|
2850
|
-
const
|
|
2925
|
+
const labels = Array.isArray(args.labels) ? args.labels.map((label) => String(label)) : void 0;
|
|
2926
|
+
const assignees = Array.isArray(args.assignees) ? args.assignees.map((assignee) => String(assignee)) : void 0;
|
|
2927
|
+
const result = ensureIssue(opts.repoSlug, key, title, body, { labels, assignees });
|
|
2851
2928
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
2852
2929
|
}
|
|
2853
2930
|
};
|
|
@@ -18706,7 +18783,7 @@ async function runExecutable(profileName, input) {
|
|
|
18706
18783
|
});
|
|
18707
18784
|
if (out.prUrl) process.stdout.write(`PR_URL=${out.prUrl}
|
|
18708
18785
|
`);
|
|
18709
|
-
else if (out.reason) process.stdout.write(`PR_URL=FAILED: ${out.reason}
|
|
18786
|
+
else if (out.exitCode !== 0 && out.reason) process.stdout.write(`PR_URL=FAILED: ${out.reason}
|
|
18710
18787
|
`);
|
|
18711
18788
|
return out;
|
|
18712
18789
|
};
|
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.315",
|
|
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",
|