@kody-ade/kody-engine 0.3.60 → 0.3.62
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 +58 -40
- package/dist/executables/release-deploy/deploy.sh +0 -0
- package/dist/executables/release-prepare/prepare.sh +0 -0
- package/dist/executables/release-publish/publish.sh +0 -0
- package/dist/executables/resolve/apply-prefer.sh +0 -0
- package/dist/executables/revert/revert.sh +0 -0
- package/package.json +15 -14
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.62",
|
|
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",
|
|
@@ -540,12 +540,35 @@ var CHAT_SYSTEM_PROMPT = [
|
|
|
540
540
|
" pytest, go test, cargo, etc., whatever the project uses).",
|
|
541
541
|
" - standard Unix utilities (curl, jq, sed, awk, find, etc.).",
|
|
542
542
|
"",
|
|
543
|
-
"#
|
|
544
|
-
"
|
|
545
|
-
"
|
|
546
|
-
"
|
|
547
|
-
"
|
|
548
|
-
"
|
|
543
|
+
"# Investigate before you answer (HARD RULE)",
|
|
544
|
+
"Do not answer from assumptions, training memory, or what the code 'probably'",
|
|
545
|
+
"does. Before replying to any question about this repo \u2014 its code, behavior,",
|
|
546
|
+
"config, history, issues, PRs, CI, or dependencies \u2014 you MUST first ground the",
|
|
547
|
+
"answer in concrete evidence collected in THIS session.",
|
|
548
|
+
"",
|
|
549
|
+
"Required pre-reply protocol for every non-trivial question:",
|
|
550
|
+
"1. Locate the relevant code with Glob/Grep. Don't guess paths.",
|
|
551
|
+
"2. Read the actual files end-to-end (or the relevant ranges). Read more than",
|
|
552
|
+
" you think you need \u2014 adjacent files, callers, tests, types.",
|
|
553
|
+
"3. If behavior depends on runtime state (CI, PRs, issues, git history), run",
|
|
554
|
+
" the matching `gh` / `git` / shell command and look at the real output.",
|
|
555
|
+
"4. Only after steps 1\u20133 do you compose the reply.",
|
|
556
|
+
"",
|
|
557
|
+
"Every factual claim about this repo in your reply must be backed by something",
|
|
558
|
+
"you actually read or executed in this session. Cite the source inline:",
|
|
559
|
+
"`path/to/file.ts:42`, `git show <sha>`, `gh pr view 123`, etc. If you cannot",
|
|
560
|
+
"produce a citation, you have not investigated enough \u2014 go back to step 1.",
|
|
561
|
+
"",
|
|
562
|
+
"Forbidden phrasings unless preceded by an actual tool failure quoted in your",
|
|
563
|
+
"reply: 'I don't have access', 'I can't see', 'it likely', 'it probably',",
|
|
564
|
+
"'typically this would', 'based on common patterns'. These are tells that you",
|
|
565
|
+
"skipped investigation \u2014 replace them with the result of the investigation.",
|
|
566
|
+
"",
|
|
567
|
+
"Speed is not the goal \u2014 correctness grounded in this specific codebase is.",
|
|
568
|
+
"Spend the tool calls. A short answer with three citations beats a long answer",
|
|
569
|
+
"with zero. If a question is genuinely trivial (greeting, clarification,",
|
|
570
|
+
"definition of a generic term unrelated to this repo), you may answer without",
|
|
571
|
+
"tools \u2014 but err on the side of investigating.",
|
|
549
572
|
"",
|
|
550
573
|
"Do not invent file paths, commit SHAs, line numbers, or command output. If you",
|
|
551
574
|
"cite something concrete, you must have just read or run it in this session."
|
|
@@ -563,14 +586,16 @@ async function runChatTurn(opts) {
|
|
|
563
586
|
await emit(opts.sink, "chat.error", opts.sessionId, "error", { error });
|
|
564
587
|
return { exitCode: 64, error };
|
|
565
588
|
}
|
|
566
|
-
const
|
|
589
|
+
const systemPrompt = opts.systemPrompt ?? CHAT_SYSTEM_PROMPT;
|
|
590
|
+
const prompt = buildPrompt(turns);
|
|
567
591
|
const invoke = opts.invokeAgent ?? ((p) => runAgent({
|
|
568
592
|
prompt: p,
|
|
569
593
|
model: opts.model,
|
|
570
594
|
cwd: opts.cwd,
|
|
571
595
|
litellmUrl: opts.litellmUrl,
|
|
572
596
|
verbose: opts.verbose,
|
|
573
|
-
quiet: opts.quiet
|
|
597
|
+
quiet: opts.quiet,
|
|
598
|
+
systemPromptAppend: systemPrompt
|
|
574
599
|
}));
|
|
575
600
|
let result;
|
|
576
601
|
try {
|
|
@@ -601,12 +626,9 @@ async function runChatTurn(opts) {
|
|
|
601
626
|
await emit(opts.sink, "chat.done", opts.sessionId, "done", { sessionId: opts.sessionId });
|
|
602
627
|
return { exitCode: 0, reply };
|
|
603
628
|
}
|
|
604
|
-
function buildPrompt(turns
|
|
605
|
-
const header = `System: ${systemPrompt}`;
|
|
629
|
+
function buildPrompt(turns) {
|
|
606
630
|
const body = turns.map((t) => `${t.role === "user" ? "User" : "Assistant"}: ${t.content}`).join("\n\n");
|
|
607
|
-
return `${
|
|
608
|
-
|
|
609
|
-
${body}
|
|
631
|
+
return `${body}
|
|
610
632
|
|
|
611
633
|
Assistant:`;
|
|
612
634
|
}
|
|
@@ -1996,7 +2018,7 @@ function parseAgentResult(finalText) {
|
|
|
1996
2018
|
};
|
|
1997
2019
|
}
|
|
1998
2020
|
const hasDoneMarker = DONE_RE.test(text);
|
|
1999
|
-
const hasCommitMsg = /^[\s>*_
|
|
2021
|
+
const hasCommitMsg = /^[\s>*_#`~-]*COMMIT_MSG\s*:/im.test(text);
|
|
2000
2022
|
if (!hasDoneMarker && !hasCommitMsg) {
|
|
2001
2023
|
return {
|
|
2002
2024
|
done: false,
|
|
@@ -2008,7 +2030,7 @@ function parseAgentResult(finalText) {
|
|
|
2008
2030
|
failureReason: "no DONE or FAILED marker in agent output"
|
|
2009
2031
|
};
|
|
2010
2032
|
}
|
|
2011
|
-
const commitMatch = text.match(/^[\s>*_
|
|
2033
|
+
const commitMatch = text.match(/^[\s>*_#`~-]*COMMIT_MSG[\s>*_#`~-]*\s*:\s*(.+)$/im);
|
|
2012
2034
|
const commitMessage = commitMatch ? stripMarkdownEmphasis(commitMatch[1]) : "";
|
|
2013
2035
|
const feedbackActions = extractBlock(
|
|
2014
2036
|
text,
|
|
@@ -5865,6 +5887,25 @@ function tryPostPr3(prNumber, body, cwd) {
|
|
|
5865
5887
|
}
|
|
5866
5888
|
}
|
|
5867
5889
|
|
|
5890
|
+
// src/scripts/resolvePreviewUrl.ts
|
|
5891
|
+
var DEFAULT_PREVIEW_URL = "http://localhost:3000";
|
|
5892
|
+
var resolvePreviewUrl = async (ctx) => {
|
|
5893
|
+
const fromFlag = typeof ctx.args.previewUrl === "string" ? ctx.args.previewUrl.trim() : "";
|
|
5894
|
+
if (fromFlag.length > 0) {
|
|
5895
|
+
ctx.data.previewUrl = fromFlag;
|
|
5896
|
+
ctx.data.previewUrlSource = "flag";
|
|
5897
|
+
return;
|
|
5898
|
+
}
|
|
5899
|
+
const fromEnv = (process.env.PREVIEW_URL ?? "").trim();
|
|
5900
|
+
if (fromEnv.length > 0) {
|
|
5901
|
+
ctx.data.previewUrl = fromEnv;
|
|
5902
|
+
ctx.data.previewUrlSource = "env";
|
|
5903
|
+
return;
|
|
5904
|
+
}
|
|
5905
|
+
ctx.data.previewUrl = DEFAULT_PREVIEW_URL;
|
|
5906
|
+
ctx.data.previewUrlSource = "default";
|
|
5907
|
+
};
|
|
5908
|
+
|
|
5868
5909
|
// src/scripts/revertFlow.ts
|
|
5869
5910
|
import { execFileSync as execFileSync19 } from "child_process";
|
|
5870
5911
|
var SHA_RE = /^[0-9a-f]{4,40}$/i;
|
|
@@ -5934,11 +5975,7 @@ var revertFlow = async (ctx) => {
|
|
|
5934
5975
|
const runUrl = getRunUrl();
|
|
5935
5976
|
const runSuffix = runUrl ? `, run ${runUrl}` : "";
|
|
5936
5977
|
const shaList = resolved.map((r) => `\`${r.full.slice(0, 7)}\``).join(", ");
|
|
5937
|
-
tryPostPr4(
|
|
5938
|
-
prNumber,
|
|
5939
|
-
`\u2699\uFE0F kody revert started on \`${ctx.data.branch}\`${runSuffix} \u2014 reverting ${shaList}`,
|
|
5940
|
-
ctx.cwd
|
|
5941
|
-
);
|
|
5978
|
+
tryPostPr4(prNumber, `\u2699\uFE0F kody revert started on \`${ctx.data.branch}\`${runSuffix} \u2014 reverting ${shaList}`, ctx.cwd);
|
|
5942
5979
|
};
|
|
5943
5980
|
function buildCommitMessage(resolved) {
|
|
5944
5981
|
if (resolved.length === 1) {
|
|
@@ -5982,25 +6019,6 @@ function tryPostPr4(prNumber, body, cwd) {
|
|
|
5982
6019
|
}
|
|
5983
6020
|
}
|
|
5984
6021
|
|
|
5985
|
-
// src/scripts/resolvePreviewUrl.ts
|
|
5986
|
-
var DEFAULT_PREVIEW_URL = "http://localhost:3000";
|
|
5987
|
-
var resolvePreviewUrl = async (ctx) => {
|
|
5988
|
-
const fromFlag = typeof ctx.args.previewUrl === "string" ? ctx.args.previewUrl.trim() : "";
|
|
5989
|
-
if (fromFlag.length > 0) {
|
|
5990
|
-
ctx.data.previewUrl = fromFlag;
|
|
5991
|
-
ctx.data.previewUrlSource = "flag";
|
|
5992
|
-
return;
|
|
5993
|
-
}
|
|
5994
|
-
const fromEnv = (process.env.PREVIEW_URL ?? "").trim();
|
|
5995
|
-
if (fromEnv.length > 0) {
|
|
5996
|
-
ctx.data.previewUrl = fromEnv;
|
|
5997
|
-
ctx.data.previewUrlSource = "env";
|
|
5998
|
-
return;
|
|
5999
|
-
}
|
|
6000
|
-
ctx.data.previewUrl = DEFAULT_PREVIEW_URL;
|
|
6001
|
-
ctx.data.previewUrlSource = "default";
|
|
6002
|
-
};
|
|
6003
|
-
|
|
6004
6022
|
// src/scripts/reviewFlow.ts
|
|
6005
6023
|
var reviewFlow = async (ctx) => {
|
|
6006
6024
|
const prNumber = ctx.args.pr;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
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.62",
|
|
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",
|
|
@@ -12,6 +12,18 @@
|
|
|
12
12
|
"templates",
|
|
13
13
|
"kody.config.schema.json"
|
|
14
14
|
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"kody": "tsx bin/kody.ts",
|
|
17
|
+
"build": "tsup && node scripts/copy-assets.cjs",
|
|
18
|
+
"test": "vitest run tests/unit tests/int --no-coverage",
|
|
19
|
+
"test:e2e": "vitest run tests/e2e --no-coverage",
|
|
20
|
+
"test:all": "vitest run tests --no-coverage",
|
|
21
|
+
"typecheck": "tsc --noEmit",
|
|
22
|
+
"lint": "biome check",
|
|
23
|
+
"lint:fix": "biome check --write",
|
|
24
|
+
"format": "biome format --write",
|
|
25
|
+
"prepublishOnly": "pnpm build"
|
|
26
|
+
},
|
|
15
27
|
"dependencies": {
|
|
16
28
|
"@actions/cache": "^6.0.0",
|
|
17
29
|
"@anthropic-ai/claude-agent-sdk": "0.2.119"
|
|
@@ -32,16 +44,5 @@
|
|
|
32
44
|
"url": "git+https://github.com/aharonyaircohen/kody-engine.git"
|
|
33
45
|
},
|
|
34
46
|
"homepage": "https://github.com/aharonyaircohen/kody-engine",
|
|
35
|
-
"bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
|
|
36
|
-
|
|
37
|
-
"kody": "tsx bin/kody.ts",
|
|
38
|
-
"build": "tsup && node scripts/copy-assets.cjs",
|
|
39
|
-
"test": "vitest run tests/unit tests/int --no-coverage",
|
|
40
|
-
"test:e2e": "vitest run tests/e2e --no-coverage",
|
|
41
|
-
"test:all": "vitest run tests --no-coverage",
|
|
42
|
-
"typecheck": "tsc --noEmit",
|
|
43
|
-
"lint": "biome check",
|
|
44
|
-
"lint:fix": "biome check --write",
|
|
45
|
-
"format": "biome format --write"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
47
|
+
"bugs": "https://github.com/aharonyaircohen/kody-engine/issues"
|
|
48
|
+
}
|