Files
codewhale/scripts/release/check-published.sh
T
Hunter Bown 23daefbe24 feat(npm): publish as codewhale; keep deepseek-tui as deprecation shim
Rename the npm wrapper directory and package from `deepseek-tui` to
`codewhale`. Move under `npm/codewhale/`:
  - `package.json` renamed (name, bin, internal field) — keeps a
    `deepseekBinaryVersion` fallback so old metadata still works.
  - Bin entry points renamed to `bin/codewhale.js` and
    `bin/codewhale-tui.js`; they spawn the corresponding canonical
    binaries via the wrapper.
  - `scripts/artifacts.js` switches to the canonical asset-name matrix
    (`codewhale-*`, `codewhale-tui-*`) and `codewhale-artifacts-sha256.txt`.
  - `scripts/run.js` exports `runCodewhale` and `runCodewhaleTui`; the
    legacy `runDeepseek` exports are gone since nothing else inside the
    package depended on them.
  - `scripts/install.js`, `verify-release-assets.js`, `preflight-glibc.js`
    update brand-mention strings + User-Agent headers. Env vars
    (`DEEPSEEK_TUI_*`, `DEEPSEEK_*`) are explicitly anti-scope and are
    left in place.
  - Tests retargeted at the canonical asset names; all 19 still pass.
  - README rewritten with the new install command and a deprecation
    note about the old package.

Create a one-release deprecation shim at `npm/deepseek-tui/`:
  - `package.json` with no `bin`, just a postinstall script that
    prints a clear message telling the user to install `codewhale`
    instead.
  - `README.md` with the same migration note.
  - Will be removed in v0.9.0 (or whenever Hunter retires the shims).

Release-side scripts in `scripts/release/` follow the rename:
  - `prepare-local-release-assets.js` now requires `npm/codewhale/...`
    and copies the canonical `codewhale*` binaries.
  - `npm-wrapper-smoke.js` smokes the renamed package.
  - `check-versions.sh` reads `npm/codewhale/package.json` for the
    primary check and additionally pins the legacy shim package to
    the same version.
  - `check-published.sh` queries `codewhale@<version>` (with
    `codewhaleBinaryVersion` lookup that falls back to the legacy
    `deepseekBinaryVersion` field).
  - `.github/workflows/auto-tag.yml` watches both `npm/codewhale/` and
    `npm/deepseek-tui/` package.json for auto-tag triggers.

Verified:
  - `npm test` inside `npm/codewhale/` passes 19/19.
  - `npm install --dry-run --ignore-scripts` succeeds for both
    `npm/codewhale/` and `npm/deepseek-tui/`.
  - `scripts/release/check-versions.sh` reports OK.
  - Rust gates re-run: `cargo check`, `cargo fmt --check`,
    `cargo clippy -- -D warnings`, all clean.

No `npm publish` is run from this change — Hunter publishes manually
when the rebrand is ready to ship.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 11:11:53 -05:00

115 lines
3.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(cd "${script_dir}/../.." && pwd)"
# shellcheck source=scripts/release/crates.sh
source "${script_dir}/crates.sh"
usage() {
cat <<'EOF'
usage: scripts/release/check-published.sh [--allow-npm-binary-mismatch] [VERSION]
Verifies that a release version is visible on both npm and crates.io.
Defaults VERSION to the workspace version in Cargo.toml.
Use --allow-npm-binary-mismatch only for npm packaging-only releases where
the npm package intentionally points at an older GitHub binary release.
EOF
}
allow_npm_binary_mismatch=0
version=""
while (($# > 0)); do
case "$1" in
--allow-npm-binary-mismatch)
allow_npm_binary_mismatch=1
;;
-h|--help)
usage
exit 0
;;
*)
if [[ -n "${version}" ]]; then
usage >&2
exit 2
fi
version="$1"
;;
esac
shift
done
cd "${repo_root}"
if [[ -z "${version}" ]]; then
version="$(grep -E '^version = "' Cargo.toml | head -n1 | sed -E 's/^version = "([^"]+)".*/\1/')"
fi
if [[ -z "${version}" ]]; then
echo "Could not determine release version." >&2
exit 1
fi
fail=0
echo "Checking published release ${version}..."
# Canonical post-rebrand npm package.
if npm_version="$(npm view "codewhale@${version}" version 2>/dev/null)"; then
echo "npm codewhale@${npm_version} is published."
else
echo "npm codewhale@${version} is not published." >&2
fail=1
fi
# `codewhaleBinaryVersion` is the new internal version-pin field. Fall back
# to the legacy `deepseekBinaryVersion` field for old/transition packages.
binary_field=""
npm_binary_version=""
if value="$(npm view "codewhale@${version}" codewhaleBinaryVersion 2>/dev/null)" && [[ -n "${value}" ]]; then
binary_field="codewhaleBinaryVersion"
npm_binary_version="${value}"
elif value="$(npm view "codewhale@${version}" deepseekBinaryVersion 2>/dev/null)" && [[ -n "${value}" ]]; then
binary_field="deepseekBinaryVersion"
npm_binary_version="${value}"
fi
if [[ -n "${binary_field}" ]]; then
if [[ "${npm_binary_version}" == "${version}" ]]; then
echo "npm ${binary_field}=${npm_binary_version}."
elif [[ "${allow_npm_binary_mismatch}" == "1" ]]; then
echo "npm ${binary_field}=${npm_binary_version} (allowed packaging-only mismatch)."
else
echo "npm ${binary_field}=${npm_binary_version}, expected ${version}." >&2
fail=1
fi
elif [[ "${allow_npm_binary_mismatch}" == "1" ]]; then
echo "npm codewhaleBinaryVersion is absent (allowed packaging-only mismatch)."
else
echo "npm codewhaleBinaryVersion is absent for codewhale@${version}." >&2
fail=1
fi
# Legacy `deepseek-tui` deprecation shim package. Best-effort check —
# absence after the transition release is expected and not fatal.
if legacy_version="$(npm view "deepseek-tui@${version}" version 2>/dev/null)"; then
echo "npm deepseek-tui@${legacy_version} (deprecation shim) is published."
fi
for crate in "${release_crates[@]}"; do
if curl -fsSL "https://crates.io/api/v1/crates/${crate}/${version}" >/dev/null 2>&1; then
echo "crates.io ${crate}@${version} is published."
else
echo "crates.io ${crate}@${version} is not published." >&2
fail=1
fi
done
if [[ "${fail}" == "0" ]]; then
echo "Published release OK: npm codewhale@${version} and ${#release_crates[@]} crates are visible."
fi
exit "${fail}"