cli-jaw 2.17.18 → 2.17.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-jaw",
3
- "version": "2.17.18",
3
+ "version": "2.17.20",
4
4
  "description": "Personal AI assistant powered by Pi, Antigravity, AI-E, Claude, Claude E, Codex, Codex App, Cursor, Grok, Kiro, OpenCode, and Copilot — Web, Terminal, Telegram, and Discord interfaces with 107 built-in skills",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -224,3 +224,28 @@ gh workflow run publish.yml \
224
224
  -f create-github-release=true
225
225
 
226
226
  echo "stable publish dispatched: cli-jaw@$STABLE_VERSION from $MERGED_MAIN_SHA"
227
+
228
+ # ─── Realign dev/preview onto the new main (#466) ───────────────────────────
229
+ # The squash above folds preview's commits into one NEW commit, so main stops
230
+ # being an ancestor of preview the instant this script succeeds — and the guard
231
+ # at the top of this same script requires exactly that ancestry on the next
232
+ # cycle. Left to prose in AGENTS.md, that realignment gets skipped, and the
233
+ # manual recovery it forces is what silently dropped #418's code from the
234
+ # published 2.17.13 tarball.
235
+ #
236
+ # realign_branch_onto_main lives in promotion-checkout.sh and builds the commit
237
+ # from plumbing, so the published tree is an input rather than a merge result.
238
+ # A failure here is a warning, not a release failure: the publish above already
239
+ # went out, and the only cost is that the NEXT promotion needs a manual repair
240
+ # (AGENTS.md carries that recipe).
241
+ realign_branch_onto_main preview "$MERGED_MAIN_SHA" \
242
+ "chore: record the v$STABLE_VERSION promotion as an ancestor" \
243
+ || echo "WARN: preview realignment failed; the next promotion will need a manual realign" >&2
244
+ realign_branch_onto_main dev "$MERGED_MAIN_SHA" \
245
+ "chore: record the v$STABLE_VERSION promotion as an ancestor" \
246
+ || echo "WARN: dev realignment failed; realign it before the next release" >&2
247
+
248
+ POST_PREVIEW="$(git ls-remote origin refs/heads/preview | cut -f1)"
249
+ if [ -n "$POST_PREVIEW" ] && ! git merge-base --is-ancestor "$MERGED_MAIN_SHA" "$POST_PREVIEW"; then
250
+ echo "WARN: origin/main is still not an ancestor of origin/preview — the next promotion will be blocked" >&2
251
+ fi
@@ -128,3 +128,52 @@ assert_promotion_checkout_ready_to_push() {
128
128
  return 1
129
129
  fi
130
130
  }
131
+
132
+ # ─── Post-promotion realignment (#466) ─────────────────────────────────────
133
+ #
134
+ # A squash promotion folds preview's commits into one NEW commit on main, so
135
+ # main stops being an ancestor of preview the moment the promotion succeeds —
136
+ # and promote-to-main.sh demands exactly that ancestry on the next cycle. The
137
+ # script breaks its own precondition every release. Leaving the repair to prose
138
+ # is what produced the 2.17.13 incident: a hand-made merge claimed to take the
139
+ # preview tree, took main's, and shipped a tarball missing #418's code.
140
+ #
141
+ # Built from plumbing (commit-tree) rather than a worktree on purpose: the tree
142
+ # is an INPUT here, not a merge result, so the published content cannot change
143
+ # no matter which side is which. The caller re-checks it anyway.
144
+ realign_branch_onto_main() {
145
+ local branch="$1" main_sha="$2" message="$3"
146
+ local head tree new_commit
147
+ head="$(git ls-remote origin "refs/heads/$branch" | cut -f1)"
148
+ if [ -z "$head" ]; then
149
+ echo "realign: no origin/$branch to realign" >&2
150
+ return 0
151
+ fi
152
+ if git merge-base --is-ancestor "$main_sha" "$head" 2>/dev/null; then
153
+ echo "realign: $branch already has main as an ancestor"
154
+ return 0
155
+ fi
156
+ git fetch origin "$branch" >/dev/null 2>&1 || true
157
+ tree="$(git rev-parse "$head^{tree}")" || {
158
+ promotion_error "realign: cannot read $branch tree"
159
+ return 1
160
+ }
161
+ new_commit="$(git commit-tree "$tree" -p "$head" -p "$main_sha" -m "$message")" || {
162
+ promotion_error "realign: could not create the realignment commit for $branch"
163
+ return 1
164
+ }
165
+ if [ "$(git rev-parse "$new_commit^{tree}")" != "$tree" ]; then
166
+ promotion_error "realign: $branch tree changed; refusing to push"
167
+ return 1
168
+ fi
169
+ if ! git merge-base --is-ancestor "$main_sha" "$new_commit"; then
170
+ promotion_error "realign: $main_sha is still not an ancestor of $branch; refusing to push"
171
+ return 1
172
+ fi
173
+ if git push origin "$new_commit:refs/heads/$branch" >/dev/null 2>&1; then
174
+ echo "realign: $branch now has main as an ancestor, tree unchanged"
175
+ else
176
+ echo "realign: could not push $branch (did it move?)" >&2
177
+ return 1
178
+ fi
179
+ }