@kody-ade/kody-engine 0.4.160 → 0.4.161

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 +84 -112
  2. package/package.json +1 -1
package/dist/bin/kody.js CHANGED
@@ -1061,7 +1061,7 @@ var init_loadPriorArt = __esm({
1061
1061
  // package.json
1062
1062
  var package_default = {
1063
1063
  name: "@kody-ade/kody-engine",
1064
- version: "0.4.160",
1064
+ version: "0.4.161",
1065
1065
  description: "kody \u2014 autonomous development engine. Single-session Claude Code agent behind a generic executor + declarative executable profiles.",
1066
1066
  license: "MIT",
1067
1067
  type: "module",
@@ -1117,7 +1117,7 @@ var package_default = {
1117
1117
  };
1118
1118
 
1119
1119
  // src/chat-cli.ts
1120
- import { execFileSync as execFileSync31 } from "child_process";
1120
+ import { execFileSync as execFileSync29 } from "child_process";
1121
1121
  import * as fs43 from "fs";
1122
1122
  import * as path39 from "path";
1123
1123
 
@@ -2819,7 +2819,7 @@ async function emit2(sink, type, sessionId, suffix, payload) {
2819
2819
  }
2820
2820
 
2821
2821
  // src/kody-cli.ts
2822
- import { execFileSync as execFileSync30 } from "child_process";
2822
+ import { execFileSync as execFileSync28 } from "child_process";
2823
2823
  import * as fs42 from "fs";
2824
2824
  import * as path38 from "path";
2825
2825
 
@@ -3227,7 +3227,7 @@ function coerceBare(spec, value) {
3227
3227
  }
3228
3228
 
3229
3229
  // src/executor.ts
3230
- import { execFileSync as execFileSync29, spawn as spawn9 } from "child_process";
3230
+ import { execFileSync as execFileSync27, spawn as spawn9 } from "child_process";
3231
3231
  import * as fs41 from "fs";
3232
3232
  import * as path37 from "path";
3233
3233
 
@@ -4699,7 +4699,7 @@ var advanceFlow = async (ctx, profile) => {
4699
4699
  `
4700
4700
  );
4701
4701
  }
4702
- ghComment(flow.issueNumber, `@kody ${flow.name}`, ctx.cwd, "re-trigger orchestrator");
4702
+ ctx.output.nextDispatch = { executable: flow.name, cliArgs: { issue: flow.issueNumber } };
4703
4703
  };
4704
4704
 
4705
4705
  // src/scripts/brainServe.ts
@@ -6865,8 +6865,6 @@ var discoverQaContext = async (ctx) => {
6865
6865
  };
6866
6866
 
6867
6867
  // src/scripts/dispatch.ts
6868
- import { execFileSync as execFileSync11 } from "child_process";
6869
- var API_TIMEOUT_MS4 = 3e4;
6870
6868
  var dispatch = async (ctx, _profile, _agentResult, args) => {
6871
6869
  const next = args?.next;
6872
6870
  if (!next) {
@@ -6898,20 +6896,10 @@ var dispatch = async (ctx, _profile, _agentResult, args) => {
6898
6896
  }
6899
6897
  const usePr = target === "pr" && state?.core.prUrl;
6900
6898
  const targetNumber = usePr ? parsePr(state.core.prUrl) ?? issueNumber : issueNumber;
6901
- const sub = usePr ? "pr" : "issue";
6902
- const body = `@kody ${next}`;
6903
- try {
6904
- execFileSync11("gh", [sub, "comment", String(targetNumber), "--body", body], {
6905
- timeout: API_TIMEOUT_MS4,
6906
- cwd: ctx.cwd,
6907
- stdio: ["ignore", "pipe", "pipe"]
6908
- });
6909
- } catch (err) {
6910
- process.stderr.write(
6911
- `[kody dispatch] failed to post @kody ${next} on ${sub} #${targetNumber}: ${err instanceof Error ? err.message : String(err)}
6912
- `
6913
- );
6914
- }
6899
+ ctx.output.nextDispatch = {
6900
+ executable: next,
6901
+ cliArgs: usePr ? { pr: targetNumber } : { issue: targetNumber }
6902
+ };
6915
6903
  };
6916
6904
  function parsePr(url) {
6917
6905
  const m = url.match(/\/pull\/(\d+)(?:[/?#]|$)/);
@@ -6921,8 +6909,8 @@ function parsePr(url) {
6921
6909
  }
6922
6910
 
6923
6911
  // src/scripts/dispatchClassified.ts
6924
- import { execFileSync as execFileSync12 } from "child_process";
6925
- var API_TIMEOUT_MS5 = 3e4;
6912
+ import { execFileSync as execFileSync11 } from "child_process";
6913
+ var API_TIMEOUT_MS4 = 3e4;
6926
6914
  var VALID_CLASSES2 = /* @__PURE__ */ new Set(["feature", "bug", "spec", "chore"]);
6927
6915
  var dispatchClassified = async (ctx) => {
6928
6916
  const issueNumber = ctx.args.issue;
@@ -6942,9 +6930,9 @@ var dispatchClassified = async (ctx) => {
6942
6930
 
6943
6931
  ${stateBody}`;
6944
6932
  try {
6945
- execFileSync12("gh", ["issue", "comment", String(issueNumber), "--body", body], {
6933
+ execFileSync11("gh", ["issue", "comment", String(issueNumber), "--body", body], {
6946
6934
  cwd: ctx.cwd,
6947
- timeout: API_TIMEOUT_MS5,
6935
+ timeout: API_TIMEOUT_MS4,
6948
6936
  stdio: ["ignore", "pipe", "pipe"]
6949
6937
  });
6950
6938
  } catch (err) {
@@ -7616,20 +7604,18 @@ var dispatchNextTask = async (ctx) => {
7616
7604
  return;
7617
7605
  }
7618
7606
  const base = goal.leafPr?.headRefName ?? goal.defaultBranch;
7619
- process.stdout.write(`[goal-tick] dispatching @kody on #${next.number} (--base ${base})
7620
- `);
7621
- const comment = commentOnIssue(next.number, `@kody --base ${base}`, ctx.cwd);
7622
- if (!comment.ok) {
7623
- process.stderr.write(`[goal-tick] dispatchNextTask: comment failed on #${next.number}: ${comment.error}
7607
+ process.stdout.write(`[goal-tick] dispatching #${next.number} in-process via classify (--base ${base})
7624
7608
  `);
7625
- return;
7626
- }
7609
+ ctx.output.nextDispatch = {
7610
+ executable: "classify",
7611
+ cliArgs: { issue: next.number, base }
7612
+ };
7627
7613
  goal.lastDispatchedIssue = next.number;
7628
7614
  };
7629
7615
 
7630
7616
  // src/pr.ts
7631
7617
  init_issue();
7632
- import { execFileSync as execFileSync13 } from "child_process";
7618
+ import { execFileSync as execFileSync12 } from "child_process";
7633
7619
  function prMergeStatus(prNumber, cwd) {
7634
7620
  try {
7635
7621
  const out = gh(
@@ -7755,7 +7741,7 @@ function isAlreadyExistsError(err) {
7755
7741
  return ALREADY_EXISTS_RE.test(msg);
7756
7742
  }
7757
7743
  function git2(args, cwd) {
7758
- return execFileSync13("git", args, {
7744
+ return execFileSync12("git", args, {
7759
7745
  encoding: "utf-8",
7760
7746
  timeout: 3e4,
7761
7747
  cwd,
@@ -8086,14 +8072,14 @@ var finalizeTerminal = async (ctx) => {
8086
8072
 
8087
8073
  // src/scripts/finishFlow.ts
8088
8074
  init_issue();
8089
- import { execFileSync as execFileSync14 } from "child_process";
8075
+ import { execFileSync as execFileSync13 } from "child_process";
8090
8076
  var TERMINAL_PHASE = {
8091
8077
  "review-passed": { phase: "shipped", status: "succeeded" },
8092
8078
  "fix-applied": { phase: "shipped", status: "succeeded" },
8093
8079
  "review-failed": { phase: "failed", status: "failed" },
8094
8080
  aborted: { phase: "failed", status: "failed" }
8095
8081
  };
8096
- var API_TIMEOUT_MS6 = 3e4;
8082
+ var API_TIMEOUT_MS5 = 3e4;
8097
8083
  var STATUS_ICON = {
8098
8084
  "review-passed": "\u2705",
8099
8085
  "fix-applied": "\u2705",
@@ -8126,8 +8112,8 @@ var finishFlow = async (ctx, profile, _agentResult, args) => {
8126
8112
  **PR:** ${state.core.prUrl}` : "";
8127
8113
  const body = `${icon} kody flow \`${flowName}\` finished \u2014 \`${reason}\`${prSuffix}`;
8128
8114
  try {
8129
- execFileSync14("gh", ["issue", "comment", String(issueNumber), "--body", body], {
8130
- timeout: API_TIMEOUT_MS6,
8115
+ execFileSync13("gh", ["issue", "comment", String(issueNumber), "--body", body], {
8116
+ timeout: API_TIMEOUT_MS5,
8131
8117
  cwd: ctx.cwd,
8132
8118
  stdio: ["ignore", "pipe", "pipe"]
8133
8119
  });
@@ -8156,9 +8142,9 @@ var finishFlow = async (ctx, profile, _agentResult, args) => {
8156
8142
  };
8157
8143
 
8158
8144
  // src/branch.ts
8159
- import { execFileSync as execFileSync15 } from "child_process";
8145
+ import { execFileSync as execFileSync14 } from "child_process";
8160
8146
  function git3(args, cwd) {
8161
- return execFileSync15("git", args, {
8147
+ return execFileSync14("git", args, {
8162
8148
  encoding: "utf-8",
8163
8149
  timeout: 3e4,
8164
8150
  cwd,
@@ -8175,11 +8161,11 @@ function getCurrentBranch(cwd) {
8175
8161
  }
8176
8162
  function resetWorkingTree(cwd) {
8177
8163
  try {
8178
- execFileSync15("git", ["reset", "--hard", "HEAD"], { cwd, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
8164
+ execFileSync14("git", ["reset", "--hard", "HEAD"], { cwd, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
8179
8165
  } catch {
8180
8166
  }
8181
8167
  try {
8182
- execFileSync15("git", ["clean", "-fd"], { cwd, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
8168
+ execFileSync14("git", ["clean", "-fd"], { cwd, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
8183
8169
  } catch {
8184
8170
  }
8185
8171
  }
@@ -8191,14 +8177,14 @@ function checkoutPrBranch(prNumber, cwd) {
8191
8177
  GH_TOKEN: process.env.GH_PAT?.trim() || process.env.GH_TOKEN || ""
8192
8178
  };
8193
8179
  try {
8194
- execFileSync15("git", ["reset", "--hard", "HEAD"], { cwd, env, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
8180
+ execFileSync14("git", ["reset", "--hard", "HEAD"], { cwd, env, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
8195
8181
  } catch {
8196
8182
  }
8197
8183
  try {
8198
- execFileSync15("git", ["clean", "-fd"], { cwd, env, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
8184
+ execFileSync14("git", ["clean", "-fd"], { cwd, env, stdio: ["ignore", "pipe", "pipe"], timeout: 3e4 });
8199
8185
  } catch {
8200
8186
  }
8201
- execFileSync15("gh", ["pr", "checkout", String(prNumber)], {
8187
+ execFileSync14("gh", ["pr", "checkout", String(prNumber)], {
8202
8188
  cwd,
8203
8189
  env,
8204
8190
  stdio: ["ignore", "pipe", "pipe"],
@@ -8324,7 +8310,7 @@ function ensureFeatureBranch(issueNumber, title, defaultBranch2, cwd, baseBranch
8324
8310
  }
8325
8311
 
8326
8312
  // src/gha.ts
8327
- import { execFileSync as execFileSync16 } from "child_process";
8313
+ import { execFileSync as execFileSync15 } from "child_process";
8328
8314
  import * as fs30 from "fs";
8329
8315
  function getRunUrl() {
8330
8316
  const server = process.env.GITHUB_SERVER_URL;
@@ -8367,7 +8353,7 @@ function reactToTriggerComment(cwd) {
8367
8353
  for (let attempt = 0; attempt < 3; attempt++) {
8368
8354
  if (attempt > 0) sleepMs(attempt === 1 ? 500 : 1500);
8369
8355
  try {
8370
- execFileSync16("gh", args, opts);
8356
+ execFileSync15("gh", args, opts);
8371
8357
  return;
8372
8358
  } catch (err) {
8373
8359
  lastErr = err;
@@ -8380,7 +8366,7 @@ function reactToTriggerComment(cwd) {
8380
8366
  }
8381
8367
  function sleepMs(ms) {
8382
8368
  try {
8383
- execFileSync16("sleep", [(ms / 1e3).toString()], { stdio: "ignore", timeout: ms + 1e3 });
8369
+ execFileSync15("sleep", [(ms / 1e3).toString()], { stdio: "ignore", timeout: ms + 1e3 });
8384
8370
  } catch {
8385
8371
  }
8386
8372
  }
@@ -8389,7 +8375,7 @@ function sleepMs(ms) {
8389
8375
  init_issue();
8390
8376
 
8391
8377
  // src/workflow.ts
8392
- import { execFileSync as execFileSync17 } from "child_process";
8378
+ import { execFileSync as execFileSync16 } from "child_process";
8393
8379
  var GH_TIMEOUT_MS = 3e4;
8394
8380
  function ghToken3() {
8395
8381
  return process.env.GH_PAT?.trim() || process.env.GH_TOKEN;
@@ -8397,7 +8383,7 @@ function ghToken3() {
8397
8383
  function gh3(args, cwd) {
8398
8384
  const token = ghToken3();
8399
8385
  const env = token ? { ...process.env, GH_TOKEN: token } : { ...process.env };
8400
- return execFileSync17("gh", args, {
8386
+ return execFileSync16("gh", args, {
8401
8387
  encoding: "utf-8",
8402
8388
  timeout: GH_TIMEOUT_MS,
8403
8389
  cwd,
@@ -8632,7 +8618,7 @@ var handleAbandonedGoal = async (ctx) => {
8632
8618
  };
8633
8619
 
8634
8620
  // src/scripts/initFlow.ts
8635
- import { execFileSync as execFileSync18 } from "child_process";
8621
+ import { execFileSync as execFileSync17 } from "child_process";
8636
8622
  import * as fs31 from "fs";
8637
8623
  import * as path29 from "path";
8638
8624
  function detectPackageManager(cwd) {
@@ -8658,7 +8644,7 @@ function schemaUrlFromPkg() {
8658
8644
  function detectOwnerRepo(cwd) {
8659
8645
  let url;
8660
8646
  try {
8661
- url = execFileSync18("git", ["remote", "get-url", "origin"], {
8647
+ url = execFileSync17("git", ["remote", "get-url", "origin"], {
8662
8648
  cwd,
8663
8649
  encoding: "utf-8",
8664
8650
  stdio: ["ignore", "pipe", "pipe"]
@@ -8743,7 +8729,7 @@ jobs:
8743
8729
  `;
8744
8730
  function defaultBranchFromGit(cwd) {
8745
8731
  try {
8746
- const ref = execFileSync18("git", ["symbolic-ref", "refs/remotes/origin/HEAD"], {
8732
+ const ref = execFileSync17("git", ["symbolic-ref", "refs/remotes/origin/HEAD"], {
8747
8733
  cwd,
8748
8734
  encoding: "utf-8",
8749
8735
  stdio: ["ignore", "pipe", "pipe"]
@@ -8751,7 +8737,7 @@ function defaultBranchFromGit(cwd) {
8751
8737
  return ref.replace("refs/remotes/origin/", "");
8752
8738
  } catch {
8753
8739
  try {
8754
- return execFileSync18("git", ["branch", "--show-current"], {
8740
+ return execFileSync17("git", ["branch", "--show-current"], {
8755
8741
  cwd,
8756
8742
  encoding: "utf-8",
8757
8743
  stdio: ["ignore", "pipe", "pipe"]
@@ -9441,8 +9427,8 @@ var mergeFlow = async (ctx) => {
9441
9427
  };
9442
9428
 
9443
9429
  // src/scripts/mergeReleasePr.ts
9444
- import { execFileSync as execFileSync19 } from "child_process";
9445
- var API_TIMEOUT_MS7 = 6e4;
9430
+ import { execFileSync as execFileSync18 } from "child_process";
9431
+ var API_TIMEOUT_MS6 = 6e4;
9446
9432
  var mergeReleasePr = async (ctx) => {
9447
9433
  const state = ctx.data.taskState;
9448
9434
  const prUrl = state?.core.prUrl;
@@ -9460,8 +9446,8 @@ var mergeReleasePr = async (ctx) => {
9460
9446
  process.stderr.write(`[kody mergeReleasePr] merging PR #${prNumber} (${prUrl})
9461
9447
  `);
9462
9448
  try {
9463
- const out = execFileSync19("gh", ["pr", "merge", String(prNumber), "--merge"], {
9464
- timeout: API_TIMEOUT_MS7,
9449
+ const out = execFileSync18("gh", ["pr", "merge", String(prNumber), "--merge"], {
9450
+ timeout: API_TIMEOUT_MS6,
9465
9451
  cwd: ctx.cwd,
9466
9452
  stdio: ["ignore", "pipe", "pipe"]
9467
9453
  });
@@ -10942,8 +10928,8 @@ ${body}`;
10942
10928
  }
10943
10929
 
10944
10930
  // src/scripts/recordClassification.ts
10945
- import { execFileSync as execFileSync20 } from "child_process";
10946
- var API_TIMEOUT_MS8 = 3e4;
10931
+ import { execFileSync as execFileSync19 } from "child_process";
10932
+ var API_TIMEOUT_MS7 = 3e4;
10947
10933
  var VALID_CLASSES3 = /* @__PURE__ */ new Set(["feature", "bug", "spec", "chore"]);
10948
10934
  var recordClassification = async (ctx) => {
10949
10935
  const issueNumber = ctx.args.issue;
@@ -10990,9 +10976,9 @@ function parseClassification(prSummary) {
10990
10976
  }
10991
10977
  function tryAuditComment(issueNumber, body, cwd) {
10992
10978
  try {
10993
- execFileSync20("gh", ["issue", "comment", String(issueNumber), "--body", body], {
10979
+ execFileSync19("gh", ["issue", "comment", String(issueNumber), "--body", body], {
10994
10980
  cwd,
10995
- timeout: API_TIMEOUT_MS8,
10981
+ timeout: API_TIMEOUT_MS7,
10996
10982
  stdio: ["ignore", "pipe", "pipe"]
10997
10983
  });
10998
10984
  } catch {
@@ -11104,7 +11090,7 @@ var resolveArtifacts = async (ctx, profile) => {
11104
11090
  };
11105
11091
 
11106
11092
  // src/scripts/resolveFlow.ts
11107
- import { execFileSync as execFileSync21 } from "child_process";
11093
+ import { execFileSync as execFileSync20 } from "child_process";
11108
11094
  init_issue();
11109
11095
  var CONFLICT_DIFF_MAX_BYTES = 4e4;
11110
11096
  var resolveFlow = async (ctx) => {
@@ -11198,7 +11184,7 @@ function buildPreferBlock(prefer, baseBranch) {
11198
11184
  }
11199
11185
  function getConflictedFiles(cwd) {
11200
11186
  try {
11201
- const out = execFileSync21("git", ["diff", "--name-only", "--diff-filter=U"], {
11187
+ const out = execFileSync20("git", ["diff", "--name-only", "--diff-filter=U"], {
11202
11188
  encoding: "utf-8",
11203
11189
  cwd,
11204
11190
  env: { ...process.env, HUSKY: "0" }
@@ -11213,7 +11199,7 @@ function getConflictMarkersPreview(files, cwd, maxBytes = CONFLICT_DIFF_MAX_BYTE
11213
11199
  let total = 0;
11214
11200
  for (const f of files) {
11215
11201
  try {
11216
- const content = execFileSync21("cat", [f], { encoding: "utf-8", cwd }).toString();
11202
+ const content = execFileSync20("cat", [f], { encoding: "utf-8", cwd }).toString();
11217
11203
  const snippet = `### ${f}
11218
11204
 
11219
11205
  \`\`\`
@@ -11237,12 +11223,12 @@ function tryPostPr3(prNumber, body, cwd) {
11237
11223
  function pushEmptyCommit(branch, cwd) {
11238
11224
  const env = { ...process.env, HUSKY: "0", SKIP_HOOKS: "1" };
11239
11225
  try {
11240
- execFileSync21(
11226
+ execFileSync20(
11241
11227
  "git",
11242
11228
  ["commit", "--allow-empty", "-m", "chore: kody resolve refresh \u2014 empty commit to recompute mergeable status"],
11243
11229
  { cwd, env, stdio: ["ignore", "pipe", "pipe"] }
11244
11230
  );
11245
- execFileSync21("git", ["push", "-u", "origin", branch], {
11231
+ execFileSync20("git", ["push", "-u", "origin", branch], {
11246
11232
  cwd,
11247
11233
  env,
11248
11234
  stdio: ["ignore", "pipe", "pipe"]
@@ -11373,10 +11359,10 @@ var resolvePreviewUrl = async (ctx) => {
11373
11359
  };
11374
11360
 
11375
11361
  // src/scripts/resolveQaUrl.ts
11376
- import { execFileSync as execFileSync22 } from "child_process";
11362
+ import { execFileSync as execFileSync21 } from "child_process";
11377
11363
  function ghQuery(args, cwd) {
11378
11364
  try {
11379
- const out = execFileSync22("gh", args, {
11365
+ const out = execFileSync21("gh", args, {
11380
11366
  cwd,
11381
11367
  stdio: ["ignore", "pipe", "pipe"],
11382
11368
  encoding: "utf-8",
@@ -11446,7 +11432,7 @@ var resolveQaUrl = async (ctx) => {
11446
11432
  };
11447
11433
 
11448
11434
  // src/scripts/revertFlow.ts
11449
- import { execFileSync as execFileSync23 } from "child_process";
11435
+ import { execFileSync as execFileSync22 } from "child_process";
11450
11436
  init_issue();
11451
11437
  var SHA_RE = /^[0-9a-f]{4,40}$/i;
11452
11438
  var revertFlow = async (ctx) => {
@@ -11529,7 +11515,7 @@ function buildPrSummary(resolved) {
11529
11515
  return resolved.map((r) => `- Reverted \`${r.full.slice(0, 7)}\`${r.subject ? ` \u2014 ${r.subject}` : ""}`).join("\n");
11530
11516
  }
11531
11517
  function git4(args, cwd) {
11532
- return execFileSync23("git", args, {
11518
+ return execFileSync22("git", args, {
11533
11519
  encoding: "utf-8",
11534
11520
  timeout: 3e4,
11535
11521
  cwd,
@@ -11539,7 +11525,7 @@ function git4(args, cwd) {
11539
11525
  }
11540
11526
  function isAncestorOfHead(sha, cwd) {
11541
11527
  try {
11542
- execFileSync23("git", ["merge-base", "--is-ancestor", sha, "HEAD"], {
11528
+ execFileSync22("git", ["merge-base", "--is-ancestor", sha, "HEAD"], {
11543
11529
  cwd,
11544
11530
  env: { ...process.env, HUSKY: "0", SKIP_HOOKS: "1" },
11545
11531
  stdio: ["ignore", "ignore", "ignore"]
@@ -12185,11 +12171,11 @@ var skipAgent = async (ctx) => {
12185
12171
  };
12186
12172
 
12187
12173
  // src/scripts/stageMergeConflicts.ts
12188
- import { execFileSync as execFileSync24 } from "child_process";
12174
+ import { execFileSync as execFileSync23 } from "child_process";
12189
12175
  var stageMergeConflicts = async (ctx) => {
12190
12176
  if (ctx.data.agentDone === false) return;
12191
12177
  try {
12192
- execFileSync24("git", ["add", "-A"], {
12178
+ execFileSync23("git", ["add", "-A"], {
12193
12179
  cwd: ctx.cwd,
12194
12180
  env: { ...process.env, HUSKY: "0", SKIP_HOOKS: "1" },
12195
12181
  stdio: "pipe"
@@ -12200,8 +12186,6 @@ var stageMergeConflicts = async (ctx) => {
12200
12186
 
12201
12187
  // src/scripts/startFlow.ts
12202
12188
  init_issue();
12203
- import { execFileSync as execFileSync25 } from "child_process";
12204
- var API_TIMEOUT_MS9 = 3e4;
12205
12189
  var startFlow = async (ctx, profile, _agentResult, args) => {
12206
12190
  const entry = args?.entry;
12207
12191
  if (!entry) {
@@ -12228,28 +12212,16 @@ var startFlow = async (ctx, profile, _agentResult, args) => {
12228
12212
  hops: 0
12229
12213
  };
12230
12214
  }
12231
- postKodyComment(target, issueNumber, state, entry, ctx.cwd);
12215
+ const usePr = target === "pr" && !!state?.core.prUrl;
12216
+ const targetNumber = usePr ? parsePrNumber(state.core.prUrl) ?? issueNumber : issueNumber;
12217
+ ctx.output.nextDispatch = {
12218
+ executable: entry,
12219
+ cliArgs: usePr ? { pr: targetNumber } : { issue: targetNumber }
12220
+ };
12232
12221
  };
12233
- function postKodyComment(target, issueNumber, state, next, cwd) {
12234
- const targetNumber = target === "pr" && state?.core.prUrl ? parsePrNumber(state.core.prUrl) ?? issueNumber : issueNumber;
12235
- const sub = target === "pr" && state?.core.prUrl ? "pr" : "issue";
12236
- const body = `@kody ${next}`;
12237
- try {
12238
- execFileSync25("gh", [sub, "comment", String(targetNumber), "--body", body], {
12239
- timeout: API_TIMEOUT_MS9,
12240
- cwd,
12241
- stdio: ["ignore", "pipe", "pipe"]
12242
- });
12243
- } catch (err) {
12244
- process.stderr.write(
12245
- `[kody startFlow] failed to post @kody ${next} on ${sub} #${targetNumber}: ${err instanceof Error ? err.message : String(err)}
12246
- `
12247
- );
12248
- }
12249
- }
12250
12222
 
12251
12223
  // src/scripts/syncFlow.ts
12252
- import { execFileSync as execFileSync26 } from "child_process";
12224
+ import { execFileSync as execFileSync24 } from "child_process";
12253
12225
  init_issue();
12254
12226
  var DONE2 = {
12255
12227
  label: "kody:done",
@@ -12327,7 +12299,7 @@ function bail2(ctx, prNumber, reason) {
12327
12299
  }
12328
12300
  function revParseHead(cwd) {
12329
12301
  try {
12330
- return execFileSync26("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).toString().trim();
12302
+ return execFileSync24("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).toString().trim();
12331
12303
  } catch {
12332
12304
  return "";
12333
12305
  }
@@ -12584,8 +12556,8 @@ var verifyWithRetry = async (ctx) => {
12584
12556
 
12585
12557
  // src/scripts/waitForCi.ts
12586
12558
  init_issue();
12587
- import { execFileSync as execFileSync27 } from "child_process";
12588
- var API_TIMEOUT_MS10 = 3e4;
12559
+ import { execFileSync as execFileSync25 } from "child_process";
12560
+ var API_TIMEOUT_MS8 = 3e4;
12589
12561
  var waitForCi = async (ctx, _profile, _agentResult, args) => {
12590
12562
  const timeoutMinutes = numArg(args, "timeoutMinutes", 30);
12591
12563
  const pollSeconds = numArg(args, "pollSeconds", 30);
@@ -12662,9 +12634,9 @@ var waitForCi = async (ctx, _profile, _agentResult, args) => {
12662
12634
  };
12663
12635
  function fetchChecks(prNumber, cwd) {
12664
12636
  try {
12665
- const raw = execFileSync27("gh", ["pr", "checks", String(prNumber), "--json", "bucket,state,name,workflow,link"], {
12637
+ const raw = execFileSync25("gh", ["pr", "checks", String(prNumber), "--json", "bucket,state,name,workflow,link"], {
12666
12638
  encoding: "utf-8",
12667
- timeout: API_TIMEOUT_MS10,
12639
+ timeout: API_TIMEOUT_MS8,
12668
12640
  cwd,
12669
12641
  stdio: ["ignore", "pipe", "pipe"]
12670
12642
  });
@@ -13138,7 +13110,7 @@ var allScriptNames = /* @__PURE__ */ new Set([
13138
13110
  ]);
13139
13111
 
13140
13112
  // src/tools.ts
13141
- import { execFileSync as execFileSync28 } from "child_process";
13113
+ import { execFileSync as execFileSync26 } from "child_process";
13142
13114
  function verifyCliTools(tools, cwd) {
13143
13115
  const out = [];
13144
13116
  for (const t of tools) out.push(verifyOne(t, cwd));
@@ -13175,7 +13147,7 @@ function verifyOne(tool4, cwd) {
13175
13147
  }
13176
13148
  function runShell(cmd, cwd, timeoutMs = 3e4) {
13177
13149
  try {
13178
- const stdout = execFileSync28("sh", ["-c", cmd], {
13150
+ const stdout = execFileSync26("sh", ["-c", cmd], {
13179
13151
  cwd,
13180
13152
  stdio: ["ignore", "pipe", "pipe"],
13181
13153
  timeout: timeoutMs,
@@ -13965,7 +13937,7 @@ async function runContainerLoop(profile, ctx, input) {
13965
13937
  }
13966
13938
  function resetWorkingTree2(cwd) {
13967
13939
  try {
13968
- execFileSync29("git", ["reset", "--hard", "HEAD"], {
13940
+ execFileSync27("git", ["reset", "--hard", "HEAD"], {
13969
13941
  cwd,
13970
13942
  stdio: ["ignore", "pipe", "pipe"],
13971
13943
  timeout: 3e4
@@ -14151,7 +14123,7 @@ function detectPackageManager2(cwd) {
14151
14123
  }
14152
14124
  function shellOut(cmd, args, cwd, stream = true) {
14153
14125
  try {
14154
- execFileSync30(cmd, args, {
14126
+ execFileSync28(cmd, args, {
14155
14127
  cwd,
14156
14128
  stdio: stream ? "inherit" : "pipe",
14157
14129
  env: { ...process.env, HUSKY: "0", SKIP_HOOKS: "1", CI: process.env.CI ?? "1" }
@@ -14164,7 +14136,7 @@ function shellOut(cmd, args, cwd, stream = true) {
14164
14136
  }
14165
14137
  function isOnPath(bin) {
14166
14138
  try {
14167
- execFileSync30("which", [bin], { stdio: "pipe" });
14139
+ execFileSync28("which", [bin], { stdio: "pipe" });
14168
14140
  return true;
14169
14141
  } catch {
14170
14142
  return false;
@@ -14205,7 +14177,7 @@ function installLitellmIfNeeded(cwd) {
14205
14177
  } catch {
14206
14178
  }
14207
14179
  try {
14208
- execFileSync30("python3", ["-c", "import litellm"], { stdio: "pipe" });
14180
+ execFileSync28("python3", ["-c", "import litellm"], { stdio: "pipe" });
14209
14181
  process.stdout.write("\u2192 kody: litellm already installed\n");
14210
14182
  return 0;
14211
14183
  } catch {
@@ -14215,16 +14187,16 @@ function installLitellmIfNeeded(cwd) {
14215
14187
  }
14216
14188
  function configureGitIdentity(cwd) {
14217
14189
  try {
14218
- const name = execFileSync30("git", ["config", "user.name"], { cwd, stdio: "pipe", encoding: "utf-8" }).trim();
14190
+ const name = execFileSync28("git", ["config", "user.name"], { cwd, stdio: "pipe", encoding: "utf-8" }).trim();
14219
14191
  if (name) return;
14220
14192
  } catch {
14221
14193
  }
14222
14194
  try {
14223
- execFileSync30("git", ["config", "user.name", "github-actions[bot]"], { cwd, stdio: "pipe" });
14195
+ execFileSync28("git", ["config", "user.name", "github-actions[bot]"], { cwd, stdio: "pipe" });
14224
14196
  } catch {
14225
14197
  }
14226
14198
  try {
14227
- execFileSync30("git", ["config", "user.email", "41898282+github-actions[bot]@users.noreply.github.com"], {
14199
+ execFileSync28("git", ["config", "user.email", "41898282+github-actions[bot]@users.noreply.github.com"], {
14228
14200
  cwd,
14229
14201
  stdio: "pipe"
14230
14202
  });
@@ -14388,7 +14360,7 @@ ${CI_HELP}`);
14388
14360
  verbose: args.verbose,
14389
14361
  quiet: args.quiet
14390
14362
  });
14391
- const MAX_CHAIN_HOPS = 4;
14363
+ const MAX_CHAIN_HOPS = 60;
14392
14364
  for (let hops = 1; result.nextDispatch && hops <= MAX_CHAIN_HOPS; hops++) {
14393
14365
  const next = result.nextDispatch;
14394
14366
  process.stdout.write(`\u2192 kody: in-process hand-off \u2192 ${next.executable} (hop ${hops}/${MAX_CHAIN_HOPS})
@@ -14564,8 +14536,8 @@ function commitChatFiles(cwd, sessionId, verbose) {
14564
14536
  if (paths.length === 0) return;
14565
14537
  const opts = { cwd, stdio: verbose ? "inherit" : "pipe" };
14566
14538
  try {
14567
- execFileSync31("git", ["add", "-f", ...paths], opts);
14568
- execFileSync31("git", ["commit", "--quiet", "-m", `chat: reply for ${sessionId}`], opts);
14539
+ execFileSync29("git", ["add", "-f", ...paths], opts);
14540
+ execFileSync29("git", ["commit", "--quiet", "-m", `chat: reply for ${sessionId}`], opts);
14569
14541
  } catch (err) {
14570
14542
  const msg = err instanceof Error ? err.message : String(err);
14571
14543
  process.stderr.write(`[kody:chat] commit skipped: ${msg}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.4.160",
3
+ "version": "0.4.161",
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",