@ankhorage/devtools 2.9.0 → 2.9.2

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # Ankhorage Devtools
5
5
 
6
- ![license: MIT](././paradox/badges/license.svg) ![npm: v2.9.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: configured](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v2.9.2](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: configured](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Owns shared repository automation, managed development tooling, workflows, and agent standards for Ankhorage TypeScript projects.
9
9
 
@@ -41,6 +41,24 @@ jobs:
41
41
  echo "::error title=Renovate Sync App repository access required::Could not create the scoped Ankhorage release token for ${GITHUB_REPOSITORY}. Ensure the ankhorage-renovate-sync GitHub App is installed and authorized for this repository, then rerun Release. Bootstrap policy: https://github.com/ankhorage/renovate/issues/115"
42
42
  exit 1
43
43
 
44
+ - name: Create the Renovate snapshot token
45
+ id: renovate-snapshot-token
46
+ if: vars.ANKHORAGE_PRE_PUBLISH_SNAPSHOT_GATE_ENABLED == 'true'
47
+ continue-on-error: true
48
+ uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
49
+ with:
50
+ client-id: ${{ vars.ANKHORAGE_RENOVATE_SYNC_CLIENT_ID }}
51
+ private-key: ${{ secrets.ANKHORAGE_RENOVATE_SYNC_PRIVATE_KEY }}
52
+ owner: ankhorage
53
+ repositories: renovate
54
+ permission-contents: write
55
+
56
+ - name: Diagnose unavailable Renovate snapshot token
57
+ if: vars.ANKHORAGE_PRE_PUBLISH_SNAPSHOT_GATE_ENABLED == 'true' && steps.renovate-snapshot-token.outcome == 'failure'
58
+ run: |
59
+ echo "::error title=Renovate snapshot access required::Could not create the Renovate-scoped token needed to dispatch and read the durable release-wave ACK. Ensure the ankhorage-renovate-sync GitHub App has Contents: write access to ankhorage/renovate, then rerun Release."
60
+ exit 1
61
+
44
62
  - name: Checkout repository
45
63
  uses: actions/checkout@v4
46
64
  with:
@@ -206,6 +224,62 @@ jobs:
206
224
  BUN_INSTALL_CACHE_DIR="${RUNNER_TEMP}/doctor-cache" bunx @ankhorage/doctor@__ANKH_DOCTOR_VERSION__ validate .
207
225
  fi
208
226
 
227
+ - name: Determine immutable pre-publish release intent
228
+ id: pre-publish-release-intent
229
+ if: hashFiles('.changeset/config.json') != '' && vars.ANKHORAGE_PRE_PUBLISH_SNAPSHOT_GATE_ENABLED == 'true' && steps.published-release-recovery.outputs.recovery != 'true'
230
+ run: |
231
+ changesets_status_path="$RUNNER_TEMP/changesets-status.json"
232
+ bun ./node_modules/.bin/changeset status --output="$changesets_status_path" >/dev/null
233
+ release_intent="$(CHANGESETS_STATUS_PATH="$changesets_status_path" node -e '
234
+ const { readFileSync } = require("node:fs");
235
+ const status = JSON.parse(readFileSync(process.env.CHANGESETS_STATUS_PATH, "utf8"));
236
+ if (!Array.isArray(status.releases)) {
237
+ throw new Error("Changesets status is missing an explicit releases list.");
238
+ }
239
+ if (status.releases.length > 1) {
240
+ throw new Error("Changesets status must contain exactly one release or an explicit empty list.");
241
+ }
242
+ process.stdout.write(status.releases.length === 0 ? "false" : "true");
243
+ '")"
244
+ echo "release_intent=$release_intent" >> "$GITHUB_OUTPUT"
245
+
246
+ - name: Acknowledge immutable pre-publish release-wave snapshot
247
+ if: hashFiles('.changeset/config.json') != '' && vars.ANKHORAGE_PRE_PUBLISH_SNAPSHOT_GATE_ENABLED == 'true' && steps.published-release-recovery.outputs.recovery != 'true' && steps.pre-publish-release-intent.outputs.release_intent == 'true'
248
+ env:
249
+ GITHUB_TOKEN: ${{ steps.renovate-snapshot-token.outputs.token }}
250
+ RELEASE_WAVE_STATE_BRANCH: ${{ vars.ANKHORAGE_RELEASE_WAVE_STATE_BRANCH }}
251
+ run: |
252
+ test -n "$RELEASE_WAVE_STATE_BRANCH" || { echo "::error title=Release-wave state branch required::Provision the Renovate state branch before enabling the pre-publish gate."; exit 1; }
253
+ source_sha="$(git rev-parse HEAD)"
254
+ changesets_status_path="$RUNNER_TEMP/changesets-status.json"
255
+ test -f "$changesets_status_path" || { echo '::error title=Changesets status missing::Release intent evidence was not retained.'; exit 1; }
256
+ changesets_status_hash="$(sha256sum "$changesets_status_path" | cut -d ' ' -f 1)"
257
+ request_id="${GITHUB_REPOSITORY//\//-}-${source_sha}-${changesets_status_hash}"
258
+ payload="$(REQUEST_ID="$request_id" SOURCE_SHA="$source_sha" CHANGESETS_STATUS_HASH="$changesets_status_hash" node -e 'console.log(JSON.stringify({event_type:"pre-publish-release-wave-snapshot",client_payload:{requestId:process.env.REQUEST_ID,sourceRepository:process.env.GITHUB_REPOSITORY,sourceSha:process.env.SOURCE_SHA,changesetsStatusHash:process.env.CHANGESETS_STATUS_HASH}}))')"
259
+ REQUEST_ID="$request_id" SOURCE_SHA="$source_sha" CHANGESETS_STATUS_HASH="$changesets_status_hash" \
260
+ curl --fail-with-body --retry 3 --retry-all-errors -X POST -H "Authorization: Bearer $GITHUB_TOKEN" -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' "https://api.github.com/repos/ankhorage/renovate/dispatches" -d "$payload"
261
+ for attempt in $(seq 1 30); do
262
+ ack_path="$RUNNER_TEMP/release-wave-ack.json"
263
+ ack_status="$(curl --silent --show-error --output "$ack_path" --write-out '%{http_code}' -H "Authorization: Bearer $GITHUB_TOKEN" -H 'Accept: application/vnd.github+json' "https://api.github.com/repos/ankhorage/renovate/contents/.github/release-wave-publisher-snapshot-acks/${request_id}.json?ref=${RELEASE_WAVE_STATE_BRANCH}")" || { echo '::error title=Release-wave ACK read failed::Could not read the durable Renovate ACK.'; exit 1; }
264
+ if [ "$ack_status" = 200 ]; then
265
+ ack="$(cat "$ack_path")"
266
+ elif [ "$ack_status" = 404 ]; then
267
+ ack=""
268
+ else
269
+ cat "$ack_path"
270
+ echo "::error title=Release-wave ACK read rejected::Renovate returned HTTP ${ack_status} while reading the durable ACK."
271
+ exit 1
272
+ fi
273
+ if [ -n "$ack" ] && ACK="$ack" REQUEST_ID="$request_id" SOURCE_SHA="$source_sha" CHANGESETS_STATUS_HASH="$changesets_status_hash" node -e 'const ack=JSON.parse(Buffer.from(JSON.parse(process.env.ACK).content,"base64").toString("utf8")); if (ack.requestId!==process.env.REQUEST_ID || ack.sourceSha!==process.env.SOURCE_SHA || ack.changesetsStatusHash!==process.env.CHANGESETS_STATUS_HASH || !/^[a-f0-9]{64}$/.test(ack.epochId)) process.exit(1);'; then break; fi
274
+ [ "$attempt" = 30 ] && { echo "::error title=Release-wave ACK timeout::No matching durable Renovate ACK arrived."; exit 1; }
275
+ sleep 2
276
+ done
277
+ test "$(git rev-parse HEAD)" = "$source_sha" || { echo '::error title=Source changed::Release source changed while awaiting ACK.'; exit 1; }
278
+ changesets_recheck_path="$RUNNER_TEMP/changesets-status-recheck.json"
279
+ bun ./node_modules/.bin/changeset status --output="$changesets_recheck_path" >/dev/null
280
+ latest_hash="$(sha256sum "$changesets_recheck_path" | cut -d ' ' -f 1)"
281
+ test "$latest_hash" = "$changesets_status_hash" || { echo '::error title=Changesets changed::Release intent changed while awaiting ACK.'; exit 1; }
282
+
209
283
  - name: Version packages directly on main
210
284
  id: release
211
285
  if: hashFiles('.changeset/config.json') != ''
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/devtools",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
4
4
  "description": "Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/ankhorage/devtools#readme",
@@ -527,7 +527,7 @@
527
527
  "dependencies": {
528
528
  "@ankhorage/apm": "^0.8.15",
529
529
  "@ankhorage/capability": "^0.2.3",
530
- "@ankhorage/contracts": "^26.11.1",
530
+ "@ankhorage/contracts": "^26.12.0",
531
531
  "@ankhorage/project-detector": "^0.3.6",
532
532
  "@ankhorage/rules-repository": "^0.5.0",
533
533
  "@ankhorage/utility": "^0.5.5",