@kody-ade/kody-engine 0.3.24 → 0.3.25

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.24",
6
+ version: "0.3.25",
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",
@@ -227,6 +227,7 @@ function parseReleaseConfig(raw) {
227
227
  if (typeof r.e2eCommand === "string") out.e2eCommand = r.e2eCommand;
228
228
  if (typeof r.draftRelease === "boolean") out.draftRelease = r.draftRelease;
229
229
  if (typeof r.releaseBranch === "string") out.releaseBranch = r.releaseBranch;
230
+ if (typeof r.devBranch === "string" && r.devBranch.length > 0) out.devBranch = r.devBranch;
230
231
  if (typeof r.timeoutMs === "number" && r.timeoutMs > 0) out.timeoutMs = Math.floor(r.timeoutMs);
231
232
  return Object.keys(out).length > 0 ? out : void 0;
232
233
  }
@@ -1,17 +1,26 @@
1
1
  #!/usr/bin/env bash
2
2
  #
3
- # release-deploy: run the configured deployCommand and/or notifyCommand
4
- # after release-publish has tagged and published the artifact. No agent.
3
+ # release-deploy: promote the integration branch (dev) to the default
4
+ # branch (main). Runs AFTER release-publish has tagged the bump commit
5
+ # on dev. No agent.
5
6
  #
6
- # Both commands are optional. With neither set, deploy is a no-op success
7
- # (the orchestrator still advances to "done").
7
+ # Behavior:
8
+ # - If release.devBranch is unset OR equals git.defaultBranch:
9
+ # no-op success (single-branch repos have nothing to promote).
10
+ # - Else: fast-forward `defaultBranch` to `devBranch` and push. If a
11
+ # fast-forward isn't possible (defaultBranch has commits dev doesn't
12
+ # have), fall back to `git merge --no-ff` so history is preserved.
13
+ #
14
+ # After the merge, runs `release.notifyCommand` (if set) as a best-effort
15
+ # post-deploy hook.
8
16
  #
9
17
  # Inputs (env):
10
18
  # KODY_ARG_DRY_RUN true|false
11
19
  # KODY_ARG_ISSUE triggering issue/PR number (optional)
12
20
  #
13
21
  # Config (env):
14
- # KODY_CFG_RELEASE_DEPLOYCOMMAND optional; $VERSION substituted
22
+ # KODY_CFG_GIT_DEFAULTBRANCH e.g. main
23
+ # KODY_CFG_RELEASE_DEVBRANCH e.g. dev (unset → no-op)
15
24
  # KODY_CFG_RELEASE_NOTIFYCOMMAND optional; $VERSION substituted
16
25
  # KODY_CFG_RELEASE_TIMEOUTMS per-command timeout in ms (default 600000)
17
26
  #
@@ -22,52 +31,62 @@
22
31
  set -euo pipefail
23
32
 
24
33
  dry_run="${KODY_ARG_DRY_RUN:-false}"
25
- deploy_cmd="${KODY_CFG_RELEASE_DEPLOYCOMMAND:-}"
34
+ default_branch="${KODY_CFG_GIT_DEFAULTBRANCH:-main}"
35
+ dev_branch="${KODY_CFG_RELEASE_DEVBRANCH:-}"
26
36
  notify_cmd="${KODY_CFG_RELEASE_NOTIFYCOMMAND:-}"
27
37
  timeout_ms="${KODY_CFG_RELEASE_TIMEOUTMS:-600000}"
28
38
  timeout_s=$((timeout_ms / 1000))
29
39
 
30
40
  read_pkg_version() {
31
- python3 -c "import json; print(json.load(open('package.json'))['version'])"
41
+ python3 -c "import json; print(json.load(open('package.json'))['version'])" 2>/dev/null || echo "unknown"
32
42
  }
33
43
 
34
- if [[ ! -f package.json ]]; then
35
- echo "KODY_REASON=release deploy: package.json not found"
36
- echo "KODY_SKIP_AGENT=true"
37
- exit 99
38
- fi
39
-
40
44
  version=$(read_pkg_version)
41
45
  echo "→ release deploy: v${version}"
42
46
 
43
- if [[ -z "$deploy_cmd" && -z "$notify_cmd" ]]; then
44
- echo "KODY_REASON=no deployCommand or notifyCommand configured nothing to run"
47
+ # Single-branch repos: nothing to promote.
48
+ if [[ -z "$dev_branch" || "$dev_branch" == "$default_branch" ]]; then
49
+ echo "KODY_REASON=no devBranch configured (or equals defaultBranch) — nothing to promote"
45
50
  echo "KODY_SKIP_AGENT=true"
46
51
  exit 0
47
52
  fi
48
53
 
49
54
  if [[ "$dry_run" == "true" ]]; then
50
- echo "KODY_REASON=dry-run — would run deploy/notify commands"
55
+ echo "KODY_REASON=dry-run — would merge ${dev_branch} into ${default_branch}"
51
56
  echo "KODY_SKIP_AGENT=true"
52
57
  exit 0
53
58
  fi
54
59
 
55
60
  export HUSKY=0 SKIP_HOOKS=1 CI="${CI:-1}"
56
61
 
57
- deploy_status="skipped"
58
- if [[ -n "$deploy_cmd" ]]; then
59
- cmd="${deploy_cmd//\$VERSION/$version}"
60
- echo " deploy: ${cmd}"
61
- if timeout "${timeout_s}" bash -c "$cmd"; then
62
- deploy_status="ok"
63
- else
64
- deploy_status="failed"
65
- echo "KODY_REASON=release deploy: deployCommand failed"
62
+ # Sync local refs.
63
+ git fetch origin "$dev_branch" "$default_branch" --tags
64
+
65
+ # Move to defaultBranch and reset to its remote tip.
66
+ git checkout "$default_branch"
67
+ git reset --hard "origin/$default_branch"
68
+
69
+ # Try fast-forward first; fall back to a merge commit.
70
+ if git merge --ff-only "origin/$dev_branch" 2>/dev/null; then
71
+ echo " fast-forwarded ${default_branch} to origin/${dev_branch}"
72
+ else
73
+ echo " fast-forward not possible — using --no-ff merge"
74
+ if ! git -c commit.gpgsign=false merge --no-ff "origin/$dev_branch" -m "chore: deploy ${dev_branch} → ${default_branch} (v${version})"; then
75
+ echo "KODY_REASON=release deploy: merge ${dev_branch} into ${default_branch} failed (conflicts?)"
66
76
  echo "KODY_SKIP_AGENT=true"
67
77
  exit 1
68
78
  fi
69
79
  fi
70
80
 
81
+ if ! git push origin "$default_branch"; then
82
+ echo "KODY_REASON=release deploy: push to origin/${default_branch} failed"
83
+ echo "KODY_SKIP_AGENT=true"
84
+ exit 1
85
+ fi
86
+
87
+ echo " pushed ${default_branch}"
88
+
89
+ # Optional post-deploy notification.
71
90
  notify_status="skipped"
72
91
  if [[ -n "$notify_cmd" ]]; then
73
92
  cmd="${notify_cmd//\$VERSION/$version}"
@@ -80,5 +99,5 @@ if [[ -n "$notify_cmd" ]]; then
80
99
  fi
81
100
  fi
82
101
 
83
- echo "KODY_REASON=deploy=${deploy_status} notify=${notify_status}"
102
+ echo "KODY_REASON=promoted ${dev_branch} → ${default_branch} (notify=${notify_status})"
84
103
  echo "KODY_SKIP_AGENT=true"
@@ -26,6 +26,10 @@ bump="${KODY_ARG_BUMP:-patch}"
26
26
  dry_run="${KODY_ARG_DRY_RUN:-false}"
27
27
  prefer="${KODY_ARG_PREFER:-}"
28
28
  default_branch="${KODY_CFG_GIT_DEFAULTBRANCH:-main}"
29
+ dev_branch="${KODY_CFG_RELEASE_DEVBRANCH:-}"
30
+ # PR target: dev branch when configured (and different from default), else default.
31
+ pr_base="${dev_branch:-$default_branch}"
32
+ [[ "$pr_base" == "$default_branch" ]] && pr_base="$default_branch"
29
33
  version_files_json="${KODY_CFG_RELEASE_VERSIONFILES:-}"
30
34
 
31
35
  fail() {
@@ -313,8 +317,8 @@ _… truncated; see CHANGELOG.md_"
313
317
  else
314
318
  body_entry="$entry"
315
319
  fi
316
- body=$'Automated release PR opened by kody.\n\n'"$body_entry"$'\n\nMerge this and then run `kody release --mode finalize`.'
317
- pr_url=$(printf '%s' "$body" | gh pr create --head "$release_branch" --base "$default_branch" --title "chore: release ${tag}" --body-file -)
320
+ body=$'Automated release PR opened by kody.\n\n'"$body_entry"$'\n\nThe release orchestrator will merge this into `'"${pr_base}"$'` and continue to publish + deploy.'
321
+ pr_url=$(printf '%s' "$body" | gh pr create --head "$release_branch" --base "$pr_base" --title "chore: release ${tag}" --body-file -)
318
322
  fi
319
323
 
320
324
  if [[ -z "$pr_url" ]]; then
@@ -24,6 +24,13 @@ set -euo pipefail
24
24
 
25
25
  dry_run="${KODY_ARG_DRY_RUN:-false}"
26
26
  default_branch="${KODY_CFG_GIT_DEFAULTBRANCH:-main}"
27
+ dev_branch="${KODY_CFG_RELEASE_DEVBRANCH:-}"
28
+ # Tag the branch where the release-prepare PR was merged: devBranch when set
29
+ # (and different from default), else defaultBranch.
30
+ target_branch="$default_branch"
31
+ if [[ -n "$dev_branch" && "$dev_branch" != "$default_branch" ]]; then
32
+ target_branch="$dev_branch"
33
+ fi
27
34
  publish_cmd="${KODY_CFG_RELEASE_PUBLISHCOMMAND:-}"
28
35
  draft="${KODY_CFG_RELEASE_DRAFTRELEASE:-false}"
29
36
  timeout_ms="${KODY_CFG_RELEASE_TIMEOUTMS:-600000}"
@@ -46,10 +53,10 @@ fi
46
53
  export HUSKY=0 SKIP_HOOKS=1 CI="${CI:-1}"
47
54
 
48
55
  # Make sure we're on the merged commit. The orchestrator merged the release
49
- # PR into default_branch; pull so the local tree has the bump commit.
50
- git fetch origin "$default_branch" --tags
51
- git checkout "$default_branch"
52
- git reset --hard "origin/$default_branch"
56
+ # PR into target_branch; pull so the local tree has the bump commit.
57
+ git fetch origin "$target_branch" --tags
58
+ git checkout "$target_branch"
59
+ git reset --hard "origin/$target_branch"
53
60
 
54
61
  version=$(read_pkg_version)
55
62
  tag="v${version}"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.3.24",
3
+ "version": "0.3.25",
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",