@kody-ade/kody-engine 0.3.52 → 0.3.54

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 +47 -12
  2. package/package.json +1 -1
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.52",
6
+ version: "0.3.54",
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",
@@ -807,9 +807,16 @@ function autoDispatch(opts) {
807
807
  const aliased = firstToken ? aliases[firstToken] ?? firstToken : null;
808
808
  let executable = null;
809
809
  let consumedFirstToken = false;
810
- if (aliased && getProfileInputs(aliased) !== null) {
811
- executable = aliased;
812
- consumedFirstToken = true;
810
+ if (aliased) {
811
+ if (getProfileInputs(aliased) !== null) {
812
+ executable = aliased;
813
+ consumedFirstToken = true;
814
+ } else if (firstToken && aliases[firstToken] && aliases[firstToken] === aliased) {
815
+ process.stderr.write(
816
+ `[kody] dispatch: alias '${firstToken}' \u2192 '${aliased}' has no matching executable; falling back to default
817
+ `
818
+ );
819
+ }
813
820
  }
814
821
  if (!executable) {
815
822
  executable = isPr ? opts?.config?.defaultPrExecutable ?? "fix" : opts?.config?.defaultExecutable ?? null;
@@ -1940,7 +1947,10 @@ function parseAgentResult(finalText) {
1940
1947
  priorArt: "",
1941
1948
  failureReason: "agent produced no final message"
1942
1949
  };
1943
- const failedMatch = text.match(/(?:^|\n)\s*FAILED\s*:\s*(.+?)\s*$/s);
1950
+ const MARKDOWN_PREFIX = "[\\s>*_#`~\\-]*";
1951
+ const FAILED_RE = new RegExp(`(?:^|\\n)${MARKDOWN_PREFIX}FAILED${MARKDOWN_PREFIX}\\s*:\\s*(.+?)\\s*$`, "is");
1952
+ const DONE_RE = new RegExp(`(?:^|\\n)${MARKDOWN_PREFIX}DONE\\b`, "i");
1953
+ const failedMatch = text.match(FAILED_RE);
1944
1954
  if (failedMatch) {
1945
1955
  return {
1946
1956
  done: false,
@@ -1949,11 +1959,11 @@ function parseAgentResult(finalText) {
1949
1959
  feedbackActions: "",
1950
1960
  planDeviations: "",
1951
1961
  priorArt: "",
1952
- failureReason: failedMatch[1].trim()
1962
+ failureReason: stripMarkdownEmphasis(failedMatch[1])
1953
1963
  };
1954
1964
  }
1955
- const hasDoneMarker = /(^|\n)\s*DONE\b/i.test(text);
1956
- const hasCommitMsg = /^[ \t]*COMMIT_MSG\s*:/im.test(text);
1965
+ const hasDoneMarker = DONE_RE.test(text);
1966
+ const hasCommitMsg = /^[\s>*_#`~\-]*COMMIT_MSG\s*:/im.test(text);
1957
1967
  if (!hasDoneMarker && !hasCommitMsg) {
1958
1968
  return {
1959
1969
  done: false,
@@ -1965,8 +1975,8 @@ function parseAgentResult(finalText) {
1965
1975
  failureReason: "no DONE or FAILED marker in agent output"
1966
1976
  };
1967
1977
  }
1968
- const commitMatch = text.match(/^[ \t]*COMMIT_MSG\s*:\s*(.+)$/im);
1969
- const commitMessage = commitMatch ? commitMatch[1].trim() : "";
1978
+ const commitMatch = text.match(/^[\s>*_#`~\-]*COMMIT_MSG[\s>*_#`~\-]*\s*:\s*(.+)$/im);
1979
+ const commitMessage = commitMatch ? stripMarkdownEmphasis(commitMatch[1]) : "";
1970
1980
  const feedbackActions = extractBlock(
1971
1981
  text,
1972
1982
  /(?:^|\n)[ \t]*FEEDBACK_ACTIONS\s*:[ \t]*\n/i,
@@ -1992,6 +2002,9 @@ function parseAgentResult(finalText) {
1992
2002
  }
1993
2003
  return { done: true, commitMessage, prSummary, feedbackActions, planDeviations, priorArt, failureReason: "" };
1994
2004
  }
2005
+ function stripMarkdownEmphasis(s) {
2006
+ return s.trim().replace(/^[*_`~]+|[*_`~]+$/g, "").trim();
2007
+ }
1995
2008
  function extractBlock(text, startMarker, endMarker) {
1996
2009
  const startIdx = text.search(startMarker);
1997
2010
  if (startIdx === -1) return "";
@@ -3334,8 +3347,8 @@ var ensurePr2 = async (ctx) => {
3334
3347
  }
3335
3348
  };
3336
3349
  function computeFailureReason(ctx) {
3337
- const misses = ctx.data.coverageMisses ?? [];
3338
- if (misses.length > 0) return `missing tests: ${misses.map((m) => m.expectedTest).join(", ")}`;
3350
+ const expectedTests = collectExpectedTests(ctx.data.coverageMisses);
3351
+ if (expectedTests.length > 0) return `missing tests: ${expectedTests.join(", ")}`;
3339
3352
  const agentDone = Boolean(ctx.data.agentDone);
3340
3353
  if (!agentDone) {
3341
3354
  return ctx.data.agentFailureReason || ctx.data.agentError || ctx.data.commitCrash || "agent did not emit DONE";
@@ -3343,6 +3356,28 @@ function computeFailureReason(ctx) {
3343
3356
  if (ctx.data.verifyOk === false) return ctx.data.verifyReason || "verify failed";
3344
3357
  return "";
3345
3358
  }
3359
+ function collectExpectedTests(raw) {
3360
+ if (!Array.isArray(raw) || raw.length === 0) return [];
3361
+ const out = [];
3362
+ let unparseable = 0;
3363
+ for (const item of raw) {
3364
+ if (!item || typeof item !== "object") {
3365
+ unparseable++;
3366
+ continue;
3367
+ }
3368
+ const r = item;
3369
+ const candidate = r.expectedTest ?? r.expected ?? r.file;
3370
+ if (typeof candidate === "string" && candidate.length > 0) out.push(candidate);
3371
+ else unparseable++;
3372
+ }
3373
+ if (unparseable > 0) {
3374
+ process.stderr.write(
3375
+ `[kody] ensurePr: ${unparseable} coverageMisses entry/entries had no recognizable test path \u2014 shape may have drifted
3376
+ `
3377
+ );
3378
+ }
3379
+ return out;
3380
+ }
3346
3381
 
3347
3382
  // src/scripts/finishFlow.ts
3348
3383
  import { execFileSync as execFileSync10 } from "child_process";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.3.52",
3
+ "version": "0.3.54",
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",