@kody-ade/kody-engine 0.3.28 → 0.3.31

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 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.28",
6
+ version: "0.3.31",
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",
@@ -2580,6 +2580,19 @@ var dispatch = async (ctx, _profile, _agentResult, args) => {
2580
2580
  return;
2581
2581
  }
2582
2582
  const state = ctx.data.taskState;
2583
+ if (target === "pr" && !state?.core.prUrl) {
2584
+ const reason = `cannot dispatch @kody ${next}: target=pr but state.core.prUrl is not set`;
2585
+ process.stderr.write(`[kody dispatch] ${reason}
2586
+ `);
2587
+ const action = {
2588
+ type: "AGENT_NOT_RUN",
2589
+ payload: { reason, dispatchTarget: "pr", next },
2590
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
2591
+ };
2592
+ ctx.data.action = action;
2593
+ if (state) state.core.lastOutcome = action;
2594
+ return;
2595
+ }
2583
2596
  if (state?.flow) {
2584
2597
  state.flow.step = next;
2585
2598
  }
@@ -2880,11 +2893,15 @@ function firstLine(s) {
2880
2893
  }
2881
2894
  function findExistingPr(branch, cwd) {
2882
2895
  try {
2883
- const output = gh2(["pr", "view", branch, "--json", "number,url,body"], { cwd });
2884
- const parsed = JSON.parse(output);
2885
- if (typeof parsed?.number === "number" && typeof parsed?.url === "string") {
2886
- const body = typeof parsed.body === "string" ? parsed.body : "";
2887
- return { number: parsed.number, url: parsed.url, body };
2896
+ const output = gh2(
2897
+ ["pr", "list", "--head", branch, "--state", "open", "--json", "number,url,body", "--limit", "1"],
2898
+ { cwd }
2899
+ );
2900
+ const arr = JSON.parse(output);
2901
+ const first = Array.isArray(arr) ? arr[0] : null;
2902
+ if (first && typeof first.number === "number" && typeof first.url === "string") {
2903
+ const body = typeof first.body === "string" ? first.body : "";
2904
+ return { number: first.number, url: first.url, body };
2888
2905
  }
2889
2906
  return null;
2890
2907
  } catch {
@@ -3625,6 +3642,7 @@ jobs:
3625
3642
  issues: write
3626
3643
  pull-requests: write
3627
3644
  contents: write
3645
+ actions: read
3628
3646
  steps:
3629
3647
  - uses: actions/checkout@v4
3630
3648
  with:
@@ -78,9 +78,17 @@ if [[ -n "$existing" ]]; then
78
78
  echo " reusing existing deploy PR: ${existing}"
79
79
  pr_url="$existing"
80
80
  else
81
+ # Same Tracking-Issue marker as release-prepare — non-closing reference
82
+ # so the originating release issue stays open through the deploy step
83
+ # while the Kody Dashboard can still link this PR to the task for preview.
84
+ issue_arg="${KODY_ARG_ISSUE:-}"
85
+ tracking_line=""
86
+ if [[ "$issue_arg" =~ ^[0-9]+$ && "$issue_arg" != "0" ]]; then
87
+ tracking_line=$'\n\nTracking-Issue: #'"${issue_arg}"
88
+ fi
81
89
  body="Automated deploy PR opened by kody — promotes \`${default_branch}\` to \`${release_branch}\` for release **v${version}**.
82
90
 
83
- Merge this PR to deploy v${version} to \`${release_branch}\`."
91
+ Merge this PR to deploy v${version} to \`${release_branch}\`.${tracking_line}"
84
92
  if ! pr_url=$(printf '%s' "$body" | gh pr create --head "$default_branch" --base "$release_branch" --title "deploy: ${default_branch} → ${release_branch} (v${version})" --body-file -); then
85
93
  echo "KODY_REASON=release deploy: gh pr create failed"
86
94
  echo "KODY_SKIP_AGENT=true"
@@ -313,7 +313,19 @@ _… truncated; see CHANGELOG.md_"
313
313
  else
314
314
  body_entry="$entry"
315
315
  fi
316
- body=$'Automated release PR opened by kody.\n\n'"$body_entry"$'\n\nThe release orchestrator will merge this into `'"${default_branch}"$'` and continue to publish + deploy.'
316
+ # Link the PR back to the originating release issue WITHOUT auto-closing
317
+ # it. The orchestrator continues to publish + deploy after merge using the
318
+ # issue as the dispatch target, so the issue must stay open for the
319
+ # dashboard to keep showing the task as in-progress until finishFlow
320
+ # applies kody:done. We use `Tracking-Issue: #N` (not `Closes #N`) — GitHub
321
+ # treats this as plain text, the dashboard parses it as a fallback link
322
+ # signal, and no auto-close fires on PR merge.
323
+ issue_arg="${KODY_ARG_ISSUE:-}"
324
+ tracking_line=""
325
+ if [[ "$issue_arg" =~ ^[0-9]+$ && "$issue_arg" != "0" ]]; then
326
+ tracking_line=$'\n\nTracking-Issue: #'"${issue_arg}"
327
+ fi
328
+ body=$'Automated release PR opened by kody.\n\n'"$body_entry"$'\n\nThe release orchestrator will merge this into `'"${default_branch}"$'` and continue to publish + deploy.'"${tracking_line}"
317
329
  pr_url=$(printf '%s' "$body" | gh pr create --head "$release_branch" --base "$default_branch" --title "chore: release ${tag}" --body-file -)
318
330
  fi
319
331
 
@@ -57,17 +57,8 @@ documented in `AGENTS.md` / `CLAUDE.md` — reference those files by path
57
57
  cite it; don't copy it.
58
58
 
59
59
  ## Clarifying questions
60
- Numbered list. Each question must include a one-line "Why:" naming the
61
- concrete implementation decision the answer would unblock not "why it
62
- matters" in general, but which fork in the road it picks.
63
-
64
- Default to asking. Only skip this section when every entry in
65
- "Gaps & assumptions" is genuinely safe to proceed on without confirmation;
66
- if you skip, justify it in one line under the heading. Prefer a few sharp
67
- questions over many soft ones — a question that wouldn't change the
68
- implementation is noise. Address the questions to the issue author / a
69
- human reviewer; they'll be answered in a follow-up comment and picked up
70
- on the next research run via delta mode.
60
+ Numbered list. Each question must include a one-line "Why:" explaining why
61
+ the answer changes the implementation. Skip if there are genuinely none.
71
62
 
72
63
  ## Gaps & assumptions
73
64
  What is unknown, and — for each gap — what assumption the implementer would
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.3.28",
3
+ "version": "0.3.31",
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",
@@ -60,6 +60,7 @@ jobs:
60
60
  issues: write
61
61
  pull-requests: write
62
62
  contents: write
63
+ actions: read
63
64
  steps:
64
65
  - uses: actions/checkout@v4
65
66
  with: