Files
codewhale/scripts/release/prepare-local-release-assets.js
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

77 lines
2.2 KiB
JavaScript
Executable File

#!/usr/bin/env node
const crypto = require("crypto");
const fs = require("fs/promises");
const path = require("path");
const {
allAssetNames,
CHECKSUM_MANIFEST,
detectBinaryNames,
} = require("../../npm/codewhale/scripts/artifacts");
async function sha256(filePath) {
const content = await fs.readFile(filePath);
return crypto.createHash("sha256").update(content).digest("hex");
}
async function main() {
const prepareAllAssets =
process.env.DEEPSEEK_TUI_PREPARE_ALL_ASSETS === "1" ||
process.env.DEEPSEEK_PREPARE_ALL_ASSETS === "1";
const outputDir = path.resolve(
process.argv[2] || path.join("target", "npm-release-assets"),
);
const buildDir = path.resolve(
process.argv[3] || path.join("target", "release"),
);
const { codewhale, tui } = detectBinaryNames();
const isWindows = process.platform === "win32";
const assets = [
{
source: path.join(buildDir, isWindows ? "codewhale.exe" : "codewhale"),
target: codewhale,
},
{
source: path.join(buildDir, isWindows ? "codewhale-tui.exe" : "codewhale-tui"),
target: tui,
},
];
if (prepareAllAssets) {
for (const assetName of allAssetNames()) {
if (assets.some((asset) => asset.target === assetName)) {
continue;
}
assets.push({
source: assetName.startsWith("codewhale-tui")
? path.join(buildDir, isWindows ? "codewhale-tui.exe" : "codewhale-tui")
: path.join(buildDir, isWindows ? "codewhale.exe" : "codewhale"),
target: assetName,
});
}
}
await fs.mkdir(outputDir, { recursive: true });
const manifestLines = [];
for (const asset of assets) {
const outputPath = path.join(outputDir, asset.target);
await fs.copyFile(asset.source, outputPath);
manifestLines.push(`${await sha256(outputPath)} ${asset.target}`);
}
manifestLines.sort();
const manifestPath = path.join(outputDir, CHECKSUM_MANIFEST);
await fs.writeFile(manifestPath, `${manifestLines.join("\n")}\n`, "utf8");
console.log(`Prepared ${assets.length} assets in ${outputDir}`);
console.log(`Wrote checksum manifest ${manifestPath}`);
}
main().catch((error) => {
console.error("Failed to prepare local release assets:", error.message);
process.exit(1);
});