codewhale 0.8.67 → 0.9.0

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
@@ -2,16 +2,16 @@
2
2
 
3
3
  > The terminal coding agent for any model — open models first.
4
4
 
5
- CodeWhale is a Rust TUI and CLI for many model providers — DeepSeek,
5
+ Codewhale is a Rust TUI and CLI for many model providers — DeepSeek,
6
6
  OpenRouter, Hugging Face, and local vLLM/SGLang/Ollama are first-class routes,
7
7
  and it speaks natively to Anthropic Claude and OpenAI when that's what you have
8
8
  — with approval-gated tools, OS sandboxing, side-git snapshots, and `/restore`
9
9
  rollback.
10
10
 
11
11
  This npm package is a small launcher: it downloads the matching native
12
- CodeWhale binaries for your platform, verifies them against the release
12
+ Codewhale binaries for your platform, verifies them against the release
13
13
  SHA-256 manifest, and installs the `codewhale`, `codew`, and `codewhale-tui`
14
- commands. The application state and credentials still live in CodeWhale's
14
+ commands. The application state and credentials still live in Codewhale's
15
15
  normal config files, not inside `node_modules`.
16
16
 
17
17
  > Previously published as `deepseek-tui`. See
@@ -65,6 +65,7 @@ Prebuilt binaries for the GitHub release are downloaded automatically:
65
65
 
66
66
  - Linux x64
67
67
  - Linux arm64
68
+ - Android arm64 (Termux)
68
69
  - macOS x64 / arm64
69
70
  - Windows x64
70
71
 
@@ -72,9 +73,9 @@ HarmonyOS PC (`openharmony`) is treated as `linux`, so it gets the Linux
72
73
  binaries matching your CPU architecture (x64 or arm64). Linux riscv64 prebuilts
73
74
  are temporarily paused while the locked `rquickjs-sys` dependency lacks
74
75
  `riscv64gc-unknown-linux-gnu` bindings. Other platform/architecture combinations
75
- (musl, FreeBSD, …) aren't shipped as prebuilts. Unsupported platforms, checksum
76
- failures, and glibc compatibility problems still fail with a clear error pointing
77
- you at the full
76
+ (FreeBSD, Linux riscv64, …) aren't shipped as prebuilts. Unsupported platforms,
77
+ checksum failures, and glibc compatibility problems still fail with a clear
78
+ error pointing you at the full
78
79
  [docs/INSTALL.md](https://github.com/Hmbown/CodeWhale/blob/main/docs/INSTALL.md)
79
80
  guide.
80
81
 
@@ -84,7 +85,7 @@ guide.
84
85
  | --- | --- |
85
86
  | `codewhaleBinaryVersion` in `package.json` | Default native binary version. `deepseekBinaryVersion` is still read as a backward-compat fallback. |
86
87
  | `CODEWHALE_RELEASE_BASE_URL` | Canonical override: use an internal or mirrored release-asset directory when GitHub Releases is unavailable. The directory must contain `codewhale-artifacts-sha256.txt` and the platform binaries. `DEEPSEEK_TUI_RELEASE_BASE_URL` and `DEEPSEEK_RELEASE_BASE_URL` are the implemented legacy fallbacks. |
87
- | `CODEWHALE_USE_CNB_MIRROR=1` | Download release assets from the CNB (China-friendly) mirror instead of GitHub. |
88
+ | `CODEWHALE_USE_CNB_MIRROR=1` | Download from the CNB (China-friendly) mirror on Linux x64 and OpenHarmony x64. Other targets fail with a clear unsupported-mirror error; use GitHub or a complete `CODEWHALE_RELEASE_BASE_URL` mirror there. |
88
89
  | `DEEPSEEK_TUI_VERSION` or `DEEPSEEK_VERSION` | Override the GitHub release version to download. |
89
90
  | `DEEPSEEK_TUI_GITHUB_REPO` or `DEEPSEEK_GITHUB_REPO` | Override the source repo. Defaults to `Hmbown/CodeWhale`. |
90
91
  | `DEEPSEEK_TUI_FORCE_DOWNLOAD=1` | Force download even when the cached binary is already present. |
@@ -101,12 +102,13 @@ offline installs, set `DEEPSEEK_TUI_DISABLE_INSTALL=1` or point
101
102
 
102
103
  ## Release integrity
103
104
 
104
- - `npm publish` runs a release-asset check to ensure all required binary assets
105
- exist for the target GitHub release before publishing.
105
+ - `npm publish` runs a release-asset check to ensure the required binaries,
106
+ archives, Windows installer, and checksum manifests exist for the target
107
+ GitHub release before publishing.
106
108
  - For the default GitHub Release source, `npm run release:check` also verifies
107
- that the npm-facing assets were updated by a successful `release.yml` run for
109
+ that those release assets were updated by a successful `release.yml` run for
108
110
  the tag commit. When `CODEWHALE_RELEASE_BASE_URL` or a legacy mirror override
109
- is set, it checks the mirror asset URLs and checksum manifest instead.
111
+ is set, it checks the mirror asset URLs and checksum manifests instead.
110
112
  - Install-time downloads are verified against the release checksum manifest before
111
113
  the wrapper marks them executable.
112
114
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "codewhale",
3
- "version": "0.8.67",
4
- "codewhaleBinaryVersion": "0.8.67",
5
- "description": "Install and run CodeWhale, the agentic terminal for open-source and open-weight coding models, from GitHub release artifacts.",
3
+ "version": "0.9.0",
4
+ "codewhaleBinaryVersion": "0.9.0",
5
+ "description": "Install and run Codewhale, the agentic terminal for open-source and open-weight coding models, from GitHub release artifacts.",
6
6
  "author": "Hmbown",
7
7
  "license": "MIT",
8
8
  "funding": [
@@ -41,7 +41,7 @@
41
41
  "scripts": {
42
42
  "release:check": "node scripts/verify-release-assets.js",
43
43
  "postinstall": "node scripts/install.js --optional",
44
- "prepublishOnly": "node scripts/verify-release-assets.js",
44
+ "prepublishOnly": "bash ../../scripts/release/require-release-tag-checkout.sh && bash ../../scripts/release/verify-release-assets.sh",
45
45
  "prepack": "node scripts/install.js",
46
46
  "test": "node --test test/*.test.js"
47
47
  },
@@ -2,12 +2,37 @@ const path = require("path");
2
2
  const os = require("os");
3
3
 
4
4
  const CHECKSUM_MANIFEST = "codewhale-artifacts-sha256.txt";
5
+ const BUNDLE_CHECKSUM_MANIFEST = "codewhale-bundles-sha256.txt";
6
+ const WINDOWS_INSTALLER_ASSET = "CodeWhaleSetup.exe";
7
+
8
+ const CNB_BINARY_ASSET_NAMES = [
9
+ "codewhale-linux-x64",
10
+ "codew-linux-x64",
11
+ "codewhale-tui-linux-x64",
12
+ ];
13
+ const CNB_RELEASE_ASSET_NAMES = [
14
+ ...CNB_BINARY_ASSET_NAMES,
15
+ CHECKSUM_MANIFEST,
16
+ ];
17
+
18
+ const BUNDLE_ASSET_NAMES = [
19
+ "codewhale-linux-x64.tar.gz",
20
+ "codewhale-linux-arm64.tar.gz",
21
+ "codewhale-android-arm64.tar.gz",
22
+ "codewhale-macos-x64.tar.gz",
23
+ "codewhale-macos-arm64.tar.gz",
24
+ "codewhale-windows-x64.zip",
25
+ "codewhale-windows-x64-portable.zip",
26
+ ];
5
27
 
6
28
  const ASSET_MATRIX = {
7
29
  linux: {
8
30
  x64: ["codewhale-linux-x64", "codewhale-tui-linux-x64", "codew-linux-x64"],
9
31
  arm64: ["codewhale-linux-arm64", "codewhale-tui-linux-arm64", "codew-linux-arm64"],
10
32
  },
33
+ android: {
34
+ arm64: ["codewhale-android-arm64", "codewhale-tui-android-arm64", "codew-android-arm64"],
35
+ },
11
36
  darwin: {
12
37
  x64: ["codewhale-macos-x64", "codewhale-tui-macos-x64", "codew-macos-x64"],
13
38
  arm64: ["codewhale-macos-arm64", "codewhale-tui-macos-arm64", "codew-macos-arm64"],
@@ -102,12 +127,38 @@ function releaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
102
127
  }
103
128
  // When CODEWHALE_USE_CNB_MIRROR is set, use the CNB (China-friendly)
104
129
  // mirror that already builds and publishes binary release assets.
105
- if (process.env.CODEWHALE_USE_CNB_MIRROR) {
106
- return `https://cnb.cool/Hmbown/CodeWhale/-/releases/v${version}/`;
130
+ if (usesCnbMirror()) {
131
+ assertCnbMirrorSupportedPlatform();
132
+ return `https://cnb.cool/codewhale.net/codewhale/-/releases/v${version}/`;
107
133
  }
108
134
  return `https://github.com/${repo}/releases/download/v${version}/`;
109
135
  }
110
136
 
137
+ function usesCnbMirror(env = process.env) {
138
+ const hasExplicitBase = Boolean(
139
+ env.CODEWHALE_RELEASE_BASE_URL ||
140
+ env.DEEPSEEK_TUI_RELEASE_BASE_URL ||
141
+ env.DEEPSEEK_RELEASE_BASE_URL,
142
+ );
143
+ return !hasExplicitBase && Boolean(env.CODEWHALE_USE_CNB_MIRROR);
144
+ }
145
+
146
+ function assertCnbMirrorSupportedPlatform(
147
+ rawPlatform = os.platform(),
148
+ arch = os.arch(),
149
+ ) {
150
+ const platform = PLATFORM_ALIASES[rawPlatform] || rawPlatform;
151
+ if (platform === "linux" && arch === "x64") {
152
+ return;
153
+ }
154
+ throw new Error(
155
+ "CODEWHALE_USE_CNB_MIRROR=1 currently supports only Linux x64 " +
156
+ `(including OpenHarmony x64); detected ${rawPlatform} ${arch}. ` +
157
+ "Use the GitHub Release or set CODEWHALE_RELEASE_BASE_URL to a " +
158
+ "complete mirror for this platform.",
159
+ );
160
+ }
161
+
111
162
  function releaseAssetUrl(baseName, version, repo = "Hmbown/CodeWhale") {
112
163
  return new URL(baseName, releaseBaseUrl(version, repo)).toString();
113
164
  }
@@ -131,17 +182,35 @@ function allAssetNames() {
131
182
  }
132
183
 
133
184
  function allReleaseAssetNames() {
134
- return [...allAssetNames(), CHECKSUM_MANIFEST];
185
+ return [
186
+ ...allAssetNames(),
187
+ ...BUNDLE_ASSET_NAMES,
188
+ WINDOWS_INSTALLER_ASSET,
189
+ BUNDLE_CHECKSUM_MANIFEST,
190
+ CHECKSUM_MANIFEST,
191
+ ];
192
+ }
193
+
194
+ function checksummedReleaseAssetNames() {
195
+ return allReleaseAssetNames().filter((name) => name !== CHECKSUM_MANIFEST);
135
196
  }
136
197
 
137
198
  module.exports = {
138
199
  allAssetNames,
139
200
  allReleaseAssetNames,
201
+ assertCnbMirrorSupportedPlatform,
202
+ BUNDLE_ASSET_NAMES,
203
+ BUNDLE_CHECKSUM_MANIFEST,
140
204
  CHECKSUM_MANIFEST,
205
+ checksummedReleaseAssetNames,
206
+ CNB_BINARY_ASSET_NAMES,
207
+ CNB_RELEASE_ASSET_NAMES,
141
208
  checksumManifestUrl,
142
209
  detectBinaryNames,
143
210
  executableName,
144
211
  releaseAssetUrl,
145
212
  releaseBaseUrl,
146
213
  releaseBinaryDirectory,
214
+ usesCnbMirror,
215
+ WINDOWS_INSTALLER_ASSET,
147
216
  };
@@ -96,7 +96,7 @@ function glibcCompatibilityMessage(required, host) {
96
96
  ? `this system has glibc ${formatVersion(host)}, which is too old for that asset.`
97
97
  : "this system does not appear to provide GNU libc.";
98
98
  return [
99
- `Prebuilt CodeWhale Linux binaries require GLIBC_${formatVersion(required)}, but ${hostLine}`,
99
+ `Prebuilt Codewhale Linux binaries require GLIBC_${formatVersion(required)}, but ${hostLine}`,
100
100
  "",
101
101
  "The Linux x64 release asset is a static (musl) build that runs on any glibc,",
102
102
  "but the Linux arm64 asset is a GNU libc build linked against",
@@ -1,10 +1,15 @@
1
1
  const https = require("https");
2
2
  const http = require("http");
3
3
  const {
4
- allAssetNames,
5
4
  allReleaseAssetNames,
5
+ BUNDLE_ASSET_NAMES,
6
+ BUNDLE_CHECKSUM_MANIFEST,
7
+ checksummedReleaseAssetNames,
6
8
  checksumManifestUrl,
9
+ CNB_BINARY_ASSET_NAMES,
10
+ CNB_RELEASE_ASSET_NAMES,
7
11
  releaseAssetUrl,
12
+ usesCnbMirror,
8
13
  } = require("./artifacts");
9
14
 
10
15
  const pkg = require("../package.json");
@@ -233,7 +238,7 @@ function assertReleaseAssetsFresh(release, expectedAssets, run) {
233
238
  const assetsByName = new Map((release.assets || []).map((asset) => [asset.name, asset]));
234
239
  const missing = expectedAssets.filter((asset) => !assetsByName.has(asset));
235
240
  if (missing.length > 0) {
236
- throw new Error(`GitHub Release is missing required npm-facing asset(s): ${missing.join(", ")}`);
241
+ throw new Error(`GitHub Release is missing required release asset(s): ${missing.join(", ")}`);
237
242
  }
238
243
 
239
244
  const runStartedAt = parseGitHubTime(run.run_started_at || run.created_at, "workflow run start");
@@ -264,7 +269,7 @@ async function verifyGitHubReleaseFreshness(repo, version, expectedAssets) {
264
269
  const run = await findReleaseWorkflowRun(repo, tag, tagSha);
265
270
  assertReleaseAssetsFresh(release, expectedAssets, run);
266
271
  console.log(
267
- `GitHub release asset freshness OK: ${expectedAssets.length} npm-facing assets for ${tag} were produced by run ${run.database_id || run.id} at ${tagSha.slice(0, 12)}.`,
272
+ `GitHub release asset freshness OK: ${expectedAssets.length} release assets for ${tag} were produced by run ${run.database_id || run.id} at ${tagSha.slice(0, 12)}.`,
268
273
  );
269
274
  }
270
275
 
@@ -284,10 +289,18 @@ function parseChecksumManifest(text) {
284
289
  return checksums;
285
290
  }
286
291
 
292
+ function assertChecksumManifestIncludes(checksums, expectedAssets, label) {
293
+ const missing = expectedAssets.filter((asset) => !checksums.has(asset));
294
+ if (missing.length > 0) {
295
+ throw new Error(`${label} is missing ${missing.join(", ")}`);
296
+ }
297
+ }
298
+
287
299
  async function run() {
288
300
  const version = resolveBinaryVersion();
289
301
  const repo = resolveRepo();
290
- const assets = allReleaseAssetNames();
302
+ const cnbMirror = usesCnbMirror();
303
+ const assets = cnbMirror ? CNB_RELEASE_ASSET_NAMES : allReleaseAssetNames();
291
304
 
292
305
  assertPackageVersionMatchesBinaryVersion(version);
293
306
 
@@ -305,10 +318,20 @@ async function run() {
305
318
  const checksums = parseChecksumManifest(
306
319
  await downloadText(checksumManifestUrl(version, repo)),
307
320
  );
308
- for (const asset of allAssetNames()) {
309
- if (!checksums.has(asset)) {
310
- throw new Error(`Checksum manifest is missing ${asset}`);
311
- }
321
+ assertChecksumManifestIncludes(
322
+ checksums,
323
+ cnbMirror ? CNB_BINARY_ASSET_NAMES : checksummedReleaseAssetNames(),
324
+ "Canonical checksum manifest",
325
+ );
326
+ if (!cnbMirror) {
327
+ const bundleChecksums = parseChecksumManifest(
328
+ await downloadText(releaseAssetUrl(BUNDLE_CHECKSUM_MANIFEST, version, repo)),
329
+ );
330
+ assertChecksumManifestIncludes(
331
+ bundleChecksums,
332
+ BUNDLE_ASSET_NAMES,
333
+ "Bundle checksum manifest",
334
+ );
312
335
  }
313
336
  console.log("Release assets verified.");
314
337
  }
@@ -321,6 +344,7 @@ if (require.main === module) {
321
344
  }
322
345
 
323
346
  module.exports = {
347
+ assertChecksumManifestIncludes,
324
348
  assertPackageVersionMatchesBinaryVersion,
325
349
  assertReleaseAssetsFresh,
326
350
  hasReleaseBaseOverride,
@@ -40,6 +40,16 @@ test("openharmony arm64 resolves to linux arm64 binaries", () => {
40
40
  });
41
41
  });
42
42
 
43
+ test("android arm64 resolves to Termux-native Android assets", () => {
44
+ withMockedOs("android", "arm64", () => {
45
+ const { detectBinaryNames } = require(ARTIFACTS_PATH);
46
+ const result = detectBinaryNames();
47
+ assert.equal(result.codewhale, "codewhale-android-arm64");
48
+ assert.equal(result.tui, "codewhale-tui-android-arm64");
49
+ assert.equal(result.codew, "codew-android-arm64");
50
+ });
51
+ });
52
+
43
53
  test("genuinely unsupported platform throws with raw platform name", () => {
44
54
  withMockedOs("freebsd", "x64", () => {
45
55
  const { detectBinaryNames } = require(ARTIFACTS_PATH);
@@ -82,14 +92,117 @@ test("linux riscv64 reports the temporary upstream binding blocker", () => {
82
92
  });
83
93
  });
84
94
 
85
- test("allAssetNames includes every matrix entry", () => {
86
- const { allAssetNames, allReleaseAssetNames } = require(ARTIFACTS_PATH);
95
+ test("release asset inventory includes binaries, archives, installer, and manifests", () => {
96
+ const {
97
+ allAssetNames,
98
+ allReleaseAssetNames,
99
+ BUNDLE_ASSET_NAMES,
100
+ BUNDLE_CHECKSUM_MANIFEST,
101
+ CHECKSUM_MANIFEST,
102
+ checksummedReleaseAssetNames,
103
+ WINDOWS_INSTALLER_ASSET,
104
+ } = require(ARTIFACTS_PATH);
87
105
  const assetNames = allAssetNames();
106
+ const releaseAssetNames = allReleaseAssetNames();
88
107
  assert.ok(assetNames.includes("codewhale-windows-x64.exe"));
89
108
  assert.ok(assetNames.includes("codewhale-tui-windows-x64.exe"));
90
109
  assert.ok(assetNames.includes("codew-windows-x64.exe"));
91
110
  assert.ok(assetNames.includes("codewhale.bat"));
111
+ assert.ok(assetNames.includes("codewhale-android-arm64"));
112
+ assert.ok(assetNames.includes("codewhale-tui-android-arm64"));
113
+ assert.ok(assetNames.includes("codew-android-arm64"));
92
114
  assert.ok(!assetNames.includes("codewhale-linux-riscv64"));
93
- assert.ok(allReleaseAssetNames().includes("codew-windows-x64.exe"));
94
- assert.ok(allReleaseAssetNames().includes("codewhale.bat"));
115
+ assert.ok(releaseAssetNames.includes("codew-windows-x64.exe"));
116
+ assert.ok(releaseAssetNames.includes("codewhale.bat"));
117
+ assert.ok(releaseAssetNames.includes("codew-android-arm64"));
118
+ for (const bundle of BUNDLE_ASSET_NAMES) {
119
+ assert.ok(releaseAssetNames.includes(bundle));
120
+ }
121
+ assert.ok(releaseAssetNames.includes(WINDOWS_INSTALLER_ASSET));
122
+ assert.ok(releaseAssetNames.includes(BUNDLE_CHECKSUM_MANIFEST));
123
+ assert.ok(releaseAssetNames.includes(CHECKSUM_MANIFEST));
124
+ assert.ok(checksummedReleaseAssetNames().includes(BUNDLE_CHECKSUM_MANIFEST));
125
+ assert.ok(!checksummedReleaseAssetNames().includes(CHECKSUM_MANIFEST));
126
+ });
127
+
128
+ test("CNB mirror URLs use the repository that publishes release assets", () => {
129
+ withMockedOs("linux", "x64", () => {
130
+ const keys = [
131
+ "CODEWHALE_RELEASE_BASE_URL",
132
+ "DEEPSEEK_TUI_RELEASE_BASE_URL",
133
+ "DEEPSEEK_RELEASE_BASE_URL",
134
+ "CODEWHALE_USE_CNB_MIRROR",
135
+ ];
136
+ const previous = Object.fromEntries(keys.map((key) => [key, process.env[key]]));
137
+ try {
138
+ for (const key of keys) delete process.env[key];
139
+ process.env.CODEWHALE_USE_CNB_MIRROR = "1";
140
+ const {
141
+ checksumManifestUrl,
142
+ CNB_RELEASE_ASSET_NAMES,
143
+ releaseAssetUrl,
144
+ releaseBaseUrl,
145
+ } = require(ARTIFACTS_PATH);
146
+
147
+ assert.deepEqual(CNB_RELEASE_ASSET_NAMES, [
148
+ "codewhale-linux-x64",
149
+ "codew-linux-x64",
150
+ "codewhale-tui-linux-x64",
151
+ "codewhale-artifacts-sha256.txt",
152
+ ]);
153
+ assert.equal(
154
+ releaseBaseUrl("0.8.68"),
155
+ "https://cnb.cool/codewhale.net/codewhale/-/releases/v0.8.68/",
156
+ );
157
+ assert.equal(
158
+ releaseAssetUrl("codewhale-linux-x64", "0.8.68"),
159
+ "https://cnb.cool/codewhale.net/codewhale/-/releases/v0.8.68/codewhale-linux-x64",
160
+ );
161
+ assert.equal(
162
+ checksumManifestUrl("0.8.68"),
163
+ "https://cnb.cool/codewhale.net/codewhale/-/releases/v0.8.68/codewhale-artifacts-sha256.txt",
164
+ );
165
+ } finally {
166
+ for (const key of keys) {
167
+ if (previous[key] === undefined) delete process.env[key];
168
+ else process.env[key] = previous[key];
169
+ }
170
+ }
171
+ });
172
+ });
173
+
174
+ test("CNB mirror fails clearly outside its Linux x64 build matrix", () => {
175
+ withMockedOs("darwin", "arm64", () => {
176
+ const previous = process.env.CODEWHALE_USE_CNB_MIRROR;
177
+ process.env.CODEWHALE_USE_CNB_MIRROR = "1";
178
+ try {
179
+ const { releaseBaseUrl } = require(ARTIFACTS_PATH);
180
+ assert.throws(
181
+ () => releaseBaseUrl("0.8.68"),
182
+ /currently supports only Linux x64.*detected darwin arm64/,
183
+ );
184
+ } finally {
185
+ if (previous === undefined) delete process.env.CODEWHALE_USE_CNB_MIRROR;
186
+ else process.env.CODEWHALE_USE_CNB_MIRROR = previous;
187
+ }
188
+ });
189
+ });
190
+
191
+ test("an explicit release base takes precedence over the CNB shortcut", () => {
192
+ withMockedOs("darwin", "arm64", () => {
193
+ const previousBase = process.env.CODEWHALE_RELEASE_BASE_URL;
194
+ const previousCnb = process.env.CODEWHALE_USE_CNB_MIRROR;
195
+ process.env.CODEWHALE_RELEASE_BASE_URL = "https://mirror.example/v0.8.68";
196
+ process.env.CODEWHALE_USE_CNB_MIRROR = "1";
197
+ try {
198
+ const { releaseBaseUrl, usesCnbMirror } = require(ARTIFACTS_PATH);
199
+ assert.equal(usesCnbMirror(), false);
200
+ assert.equal(releaseBaseUrl("0.8.68"), "https://mirror.example/v0.8.68/");
201
+ } finally {
202
+ if (previousBase === undefined) delete process.env.CODEWHALE_RELEASE_BASE_URL;
203
+ else process.env.CODEWHALE_RELEASE_BASE_URL = previousBase;
204
+ if (previousCnb === undefined) delete process.env.CODEWHALE_USE_CNB_MIRROR;
205
+ else process.env.CODEWHALE_USE_CNB_MIRROR = previousCnb;
206
+ }
207
+ });
95
208
  });
@@ -112,10 +112,10 @@ test("install failure hint checks configured release base when override is alrea
112
112
  }
113
113
  });
114
114
 
115
- test("glibc preflight message is CodeWhale-branded and actionable", () => {
115
+ test("glibc preflight message is Codewhale-branded and actionable", () => {
116
116
  const message = glibcInternal.glibcCompatibilityMessage([2, 39, 0], [2, 35, 0]);
117
117
 
118
- assert.match(message, /Prebuilt CodeWhale Linux binaries require GLIBC_2\.39/);
118
+ assert.match(message, /Prebuilt Codewhale Linux binaries require GLIBC_2\.39/);
119
119
  assert.match(message, /this system has glibc 2\.35/);
120
120
  assert.match(message, /cargo install codewhale-cli --locked/);
121
121
  assert.match(message, /Linux x64 release asset is a static \(musl\) build/);
@@ -1,8 +1,20 @@
1
1
  const assert = require("node:assert/strict");
2
+ const { execFileSync } = require("node:child_process");
3
+ const fs = require("node:fs");
4
+ const os = require("node:os");
5
+ const path = require("node:path");
2
6
  const test = require("node:test");
3
7
 
4
8
  const pkg = require("../package.json");
5
9
  const {
10
+ allReleaseAssetNames,
11
+ BUNDLE_ASSET_NAMES,
12
+ BUNDLE_CHECKSUM_MANIFEST,
13
+ CHECKSUM_MANIFEST,
14
+ checksummedReleaseAssetNames,
15
+ } = require("../scripts/artifacts");
16
+ const {
17
+ assertChecksumManifestIncludes,
6
18
  assertPackageVersionMatchesBinaryVersion,
7
19
  assertReleaseAssetsFresh,
8
20
  parseChecksumManifest,
@@ -27,7 +39,7 @@ test("parseChecksumManifest rejects malformed checksum rows", () => {
27
39
  );
28
40
  });
29
41
 
30
- test("assertReleaseAssetsFresh rejects missing npm-facing assets", () => {
42
+ test("assertReleaseAssetsFresh rejects missing release assets", () => {
31
43
  assert.throws(
32
44
  () =>
33
45
  assertReleaseAssetsFresh(
@@ -35,7 +47,39 @@ test("assertReleaseAssetsFresh rejects missing npm-facing assets", () => {
35
47
  ["codewhale-linux-x64", "codewhale-artifacts-sha256.txt"],
36
48
  { database_id: 123, created_at: "2026-06-26T00:00:00Z" },
37
49
  ),
38
- /missing required npm-facing asset/,
50
+ /missing required release asset/,
51
+ );
52
+ });
53
+
54
+ test("assertChecksumManifestIncludes rejects missing bundle manifest and archive rows", () => {
55
+ const manifest = parseChecksumManifest(
56
+ `${"a".repeat(64)} codewhale-linux-x64.tar.gz`,
57
+ );
58
+
59
+ assert.throws(
60
+ () =>
61
+ assertChecksumManifestIncludes(
62
+ manifest,
63
+ ["codewhale-linux-x64.tar.gz", "codewhale-bundles-sha256.txt"],
64
+ "Canonical checksum manifest",
65
+ ),
66
+ /Canonical checksum manifest is missing codewhale-bundles-sha256\.txt/,
67
+ );
68
+ });
69
+
70
+ test("bundle checksum rows use public archive basenames", () => {
71
+ const manifest = parseChecksumManifest(
72
+ `${"a".repeat(64)} bundles/codewhale-linux-x64.tar.gz`,
73
+ );
74
+
75
+ assert.throws(
76
+ () =>
77
+ assertChecksumManifestIncludes(
78
+ manifest,
79
+ ["codewhale-linux-x64.tar.gz"],
80
+ "Bundle checksum manifest",
81
+ ),
82
+ /Bundle checksum manifest is missing codewhale-linux-x64\.tar\.gz/,
39
83
  );
40
84
  });
41
85
 
@@ -92,3 +136,74 @@ test("assertPackageVersionMatchesBinaryVersion allows packaging-only releases on
92
136
  }
93
137
  }
94
138
  });
139
+
140
+ test("npm publication requires the checkout guard and canonical release-asset gate", () => {
141
+ assert.equal(
142
+ pkg.scripts.prepublishOnly,
143
+ "bash ../../scripts/release/require-release-tag-checkout.sh && " +
144
+ "bash ../../scripts/release/verify-release-assets.sh",
145
+ );
146
+ });
147
+
148
+ test("full local release fixture satisfies the public asset inventory", () => {
149
+ const repoRoot = path.resolve(__dirname, "..", "..", "..");
150
+ const fixtureRoot = fs.mkdtempSync(path.join(os.tmpdir(), "codewhale-assets-"));
151
+ const buildDir = path.join(fixtureRoot, "build");
152
+ const outputDir = path.join(fixtureRoot, "assets");
153
+ const executableSuffix = process.platform === "win32" ? ".exe" : "";
154
+
155
+ try {
156
+ fs.mkdirSync(buildDir, { recursive: true });
157
+ for (const binary of ["codewhale", "codew", "codewhale-tui"]) {
158
+ fs.writeFileSync(
159
+ path.join(buildDir, `${binary}${executableSuffix}`),
160
+ `fixture:${binary}\n`,
161
+ );
162
+ }
163
+
164
+ execFileSync(
165
+ process.execPath,
166
+ [
167
+ path.join(repoRoot, "scripts", "release", "prepare-local-release-assets.js"),
168
+ outputDir,
169
+ buildDir,
170
+ ],
171
+ {
172
+ env: { ...process.env, DEEPSEEK_TUI_PREPARE_ALL_ASSETS: "1" },
173
+ stdio: "pipe",
174
+ },
175
+ );
176
+
177
+ for (const assetName of allReleaseAssetNames()) {
178
+ assert.equal(
179
+ fs.existsSync(path.join(outputDir, assetName)),
180
+ true,
181
+ `missing fixture asset ${assetName}`,
182
+ );
183
+ }
184
+
185
+ const canonicalChecksums = parseChecksumManifest(
186
+ fs.readFileSync(path.join(outputDir, CHECKSUM_MANIFEST), "utf8"),
187
+ );
188
+ assert.doesNotThrow(() =>
189
+ assertChecksumManifestIncludes(
190
+ canonicalChecksums,
191
+ checksummedReleaseAssetNames(),
192
+ "Canonical checksum manifest",
193
+ ),
194
+ );
195
+
196
+ const bundleChecksums = parseChecksumManifest(
197
+ fs.readFileSync(path.join(outputDir, BUNDLE_CHECKSUM_MANIFEST), "utf8"),
198
+ );
199
+ assert.doesNotThrow(() =>
200
+ assertChecksumManifestIncludes(
201
+ bundleChecksums,
202
+ BUNDLE_ASSET_NAMES,
203
+ "Bundle checksum manifest",
204
+ ),
205
+ );
206
+ } finally {
207
+ fs.rmSync(fixtureRoot, { recursive: true, force: true });
208
+ }
209
+ });