@kody-ade/kody-engine 0.3.70-beta.2 → 0.3.70-beta.4

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.70-beta.2",
6
+ version: "0.3.70-beta.4",
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",
@@ -91,8 +91,11 @@ open_deploy_pr() {
91
91
  if [[ -n "$existing" ]]; then
92
92
  echo " reusing existing deploy PR: ${existing}" >&2
93
93
  pr_url="$existing"
94
- if ! printf '%s' "$body" | gh pr edit "$pr_url" --body-file - >/dev/null 2>&1; then
95
- echo "[deploy] WARN: failed to refresh deploy PR body" >&2
94
+ local edit_err
95
+ if ! edit_err=$(printf '%s' "$body" | gh pr edit "$pr_url" --body-file - 2>&1); then
96
+ echo "[deploy] WARN: failed to refresh deploy PR body for ${pr_url}: ${edit_err}" >&2
97
+ else
98
+ echo " refreshed deploy PR body" >&2
96
99
  fi
97
100
  else
98
101
  if ! pr_url=$(printf '%s' "$body" | gh pr create --head "$default_branch" --base "$release_branch" --title "deploy: ${default_branch} → ${release_branch} (v${new_version})" --body-file -); then
@@ -15,14 +15,32 @@ tag_and_publish() {
15
15
  local timeout_s=$((timeout_ms / 1000))
16
16
  local tag="v${new_version}"
17
17
 
18
- # Refuse if the tag already exists locally (left over from a prior failed run).
19
- if git rev-parse --verify "$tag" >/dev/null 2>&1; then
20
- echo "[publish] tag ${tag} already exists locally" >&2
21
- return 1
18
+ # Idempotent tagging: if the tag already exists and points at HEAD,
19
+ # treat it as already-published. If it points elsewhere, fail loudly —
20
+ # something is inconsistent and a human should look.
21
+ local remote_sha local_sha head_sha
22
+ head_sha=$(git rev-parse HEAD)
23
+ if local_sha=$(git rev-parse --verify "$tag" 2>/dev/null); then
24
+ if [[ "$local_sha" == "$head_sha" ]]; then
25
+ echo " tag ${tag} already exists locally at HEAD — skipping create" >&2
26
+ else
27
+ echo "[publish] tag ${tag} exists locally at ${local_sha} but HEAD is ${head_sha}" >&2
28
+ return 1
29
+ fi
30
+ else
31
+ git tag -a "$tag" -m "Release ${tag}"
32
+ fi
33
+ # Push the tag if it isn't already on origin (or push always; gh will
34
+ # no-op on existing remote tag at the same sha).
35
+ if remote_sha=$(git ls-remote --tags origin "refs/tags/${tag}" 2>/dev/null | awk '{print $1}'); then
36
+ if [[ -z "$remote_sha" ]]; then
37
+ git push origin "$tag"
38
+ elif [[ "$remote_sha" != "$head_sha" ]]; then
39
+ echo " WARN: remote tag ${tag} points at ${remote_sha}, HEAD is ${head_sha}" >&2
40
+ fi
41
+ else
42
+ git push origin "$tag" || true
22
43
  fi
23
-
24
- git tag -a "$tag" -m "Release ${tag}"
25
- git push origin "$tag"
26
44
 
27
45
  # publishCommand (optional). Failure here is recorded but does not abort —
28
46
  # we still want the GH release entry so the tag is discoverable.
@@ -48,6 +66,16 @@ create_gh_release() {
48
66
  local draft_flag=""
49
67
  [[ "$draft" == "true" ]] && draft_flag="--draft"
50
68
 
69
+ # Idempotent: if a release for this tag already exists, reuse it.
70
+ local existing_url
71
+ if existing_url=$(gh release view "$tag" --json url -q .url 2>/dev/null); then
72
+ if [[ -n "$existing_url" ]]; then
73
+ echo " GH release for ${tag} already exists: ${existing_url}" >&2
74
+ echo "$existing_url"
75
+ return 0
76
+ fi
77
+ fi
78
+
51
79
  local release_url=""
52
80
  if release_url=$(gh release create "$tag" --title "$tag" --notes "Release ${tag} — automated by kody." $draft_flag 2>&1); then
53
81
  echo "$release_url"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kody-ade/kody-engine",
3
- "version": "0.3.70-beta.2",
3
+ "version": "0.3.70-beta.4",
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",