@ankhorage/devtools 2.3.37 → 2.3.38

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.3.37](././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: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v2.3.38](././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: checked](././paradox/badges/tests.svg) ![paradox: warnings](././paradox/badges/docs.svg)
7
7
 
8
8
  Shared tooling, repository automation, and agent standards for Ankhorage TypeScript projects
9
9
 
@@ -31,7 +31,7 @@ jobs:
31
31
  node-version: '__ANKH_NODE_VERSION__'
32
32
 
33
33
  - name: Install dependencies
34
- run: bun install
34
+ run: bun install --frozen-lockfile
35
35
 
36
36
  - name: Reject package version rollback
37
37
  if: github.event_name == 'pull_request'
@@ -68,7 +68,7 @@ jobs:
68
68
  run: npm install -g npm@11.5.1
69
69
 
70
70
  - name: Install dependencies
71
- run: bun install
71
+ run: bun install --frozen-lockfile
72
72
 
73
73
  - name: Build package
74
74
  run: |
@@ -258,6 +258,7 @@ jobs:
258
258
  if: steps.release.outputs.versioned == 'true'
259
259
  run: |
260
260
  set -euo pipefail
261
+ # Changesets can intentionally update package metadata and the lockfile during versioning.
261
262
  bun install --ignore-scripts
262
263
  if node -e "const p=require('./package.json'); process.exit(p.scripts?.build?0:1)"; then
263
264
  bun run build
@@ -538,7 +539,7 @@ jobs:
538
539
  needs: release
539
540
  if: needs.release.outputs.versioned == 'true'
540
541
  runs-on: ubuntu-latest
541
- timeout-minutes: 5
542
+ timeout-minutes: 40
542
543
 
543
544
  steps:
544
545
  - name: Setup Node for npm verification
@@ -557,29 +558,83 @@ jobs:
557
558
  run: |
558
559
  set -euo pipefail
559
560
  package_spec="${PUBLISHED_PACKAGE_NAME}@${PUBLISHED_PACKAGE_VERSION}"
560
- pack_dir="${RUNNER_TEMP}/npm-pack-verification"
561
- pack_log="${RUNNER_TEMP}/npm-pack-verification.log"
562
- max_attempts=5
563
- retry_seconds=15
564
- mkdir -p "$pack_dir"
561
+ registry_evidence="${RUNNER_TEMP}/npm-publish-verification.json"
562
+ registry_error="${RUNNER_TEMP}/npm-publish-verification.error"
563
+ metadata_values="${RUNNER_TEMP}/npm-publish-verification.values"
564
+ artifact="${RUNNER_TEMP}/npm-publish-verification.tgz"
565
+ download_error="${RUNNER_TEMP}/npm-publish-verification.download.error"
566
+ max_attempts=60
567
+ retry_seconds=30
565
568
 
566
569
  for attempt in $(seq 1 "$max_attempts"); do
567
570
  echo "Verifying ${package_spec} on npm (attempt ${attempt}/${max_attempts})..."
568
- if npm pack "$package_spec" --ignore-scripts --prefer-online --pack-destination "$pack_dir" >"$pack_log" 2>&1; then
569
- if find "$pack_dir" -maxdepth 1 -type f -name '*.tgz' -size +0c -print -quit | grep -q .; then
570
- echo "Verified ${package_spec}: public npm package downloaded successfully."
571
- exit 0
571
+ if npm view "$package_spec" name version dist.tarball dist.integrity --json >"$registry_evidence" 2>"$registry_error"; then
572
+ if ! node -e '
573
+ const metadata = require(process.argv[1]);
574
+ const fields = [metadata.name, metadata.version, metadata["dist.tarball"], metadata["dist.integrity"]];
575
+ if (fields.some((field) => typeof field !== "string" || field.length === 0)) process.exit(1);
576
+ for (const field of fields) console.log(field);
577
+ ' "$registry_evidence" >"$metadata_values"; then
578
+ echo "::error title=Invalid npm registry metadata::${package_spec} returned incomplete metadata."
579
+ cat "$registry_evidence"
580
+ exit 1
581
+ fi
582
+
583
+ package_name="$(sed -n '1p' "$metadata_values")"
584
+ resolved_version="$(sed -n '2p' "$metadata_values")"
585
+ tarball="$(sed -n '3p' "$metadata_values")"
586
+ integrity="$(sed -n '4p' "$metadata_values")"
587
+ if [ "$package_name" != "$PUBLISHED_PACKAGE_NAME" ] || [ "$resolved_version" != "$PUBLISHED_PACKAGE_VERSION" ] || [[ "$integrity" != sha512-* ]]; then
588
+ echo "::error title=Wrong npm publication metadata::Expected ${package_spec} with SHA-512 integrity, received ${package_name}@${resolved_version}."
589
+ exit 1
590
+ fi
591
+
592
+ if curl --fail --location --silent --show-error --output "$artifact" "$tarball" 2>"$download_error"; then
593
+ if EXPECTED_INTEGRITY="$integrity" ARTIFACT="$artifact" node -e '
594
+ const { createHash } = require("node:crypto");
595
+ const { readFileSync } = require("node:fs");
596
+ const actual = `sha512-${createHash("sha512").update(readFileSync(process.env.ARTIFACT)).digest("base64")}`;
597
+ if (actual !== process.env.EXPECTED_INTEGRITY) {
598
+ console.error(`Expected ${process.env.EXPECTED_INTEGRITY}, received ${actual}.`);
599
+ process.exit(1);
600
+ }
601
+ '; then
602
+ echo "Verified ${package_spec}: exact registry metadata, tarball download, and SHA-512 integrity."
603
+ exit 0
604
+ fi
605
+
606
+ echo "::error title=Wrong npm tarball::${package_spec} failed its registry SHA-512 integrity check."
607
+ exit 1
572
608
  fi
573
- echo "npm pack succeeded without producing a non-empty tarball."
609
+
610
+ if grep -Eq '(^|[^0-9])40[13]([^0-9]|$)' "$download_error"; then
611
+ echo "::error title=npm tarball authorization failed::Could not download ${package_spec}; verify registry credentials and access."
612
+ cat "$download_error"
613
+ exit 1
614
+ fi
615
+ if grep -Eq '(^|[^0-9])404([^0-9]|$)' "$download_error"; then
616
+ echo "Tarball propagation is still pending for ${package_spec}."
617
+ else
618
+ echo "Tarball download failed due to a network or registry error."
619
+ cat "$download_error"
620
+ fi
621
+ elif grep -Eq 'npm error code E(401|403)' "$registry_error"; then
622
+ echo "::error title=npm registry authorization failed::Could not read ${package_spec}; verify registry credentials and access."
623
+ cat "$registry_error"
624
+ exit 1
625
+ elif grep -Eq 'npm error code E404' "$registry_error"; then
626
+ echo "Registry propagation is still pending for ${package_spec}."
627
+ else
628
+ echo "Registry metadata lookup failed due to a network or registry error."
629
+ cat "$registry_error"
574
630
  fi
575
631
 
576
- tail -n 20 "$pack_log" || true
577
632
  if [ "$attempt" -lt "$max_attempts" ]; then
578
633
  sleep "$retry_seconds"
579
634
  fi
580
635
  done
581
636
 
582
- echo "::error title=npm publication not retrievable::${package_spec} could not be downloaded from public npm after ${max_attempts} attempts."
637
+ echo "::error title=npm publication propagation timeout::${package_spec} did not become independently retrievable after ${max_attempts} attempts."
583
638
  exit 1
584
639
 
585
640
  finalize:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/devtools",
3
- "version": "2.3.37",
3
+ "version": "2.3.38",
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",