codewhale 0.8.67 → 0.9.1

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
@@ -1,17 +1,17 @@
1
1
  # codewhale
2
2
 
3
- > The terminal coding agent for any model — open models first.
3
+ > The terminal coding agent for supported hosted and local models — open models first.
4
4
 
5
- CodeWhale is a Rust TUI and CLI for many model providers — DeepSeek,
6
- OpenRouter, Hugging Face, and local vLLM/SGLang/Ollama are first-class routes,
5
+ Codewhale is a Rust TUI and CLI for many model providers — DeepSeek,
6
+ OpenRouter, Hugging Face, and local vLLM/SGLang/Ollama are supported 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
@@ -66,15 +66,23 @@ Prebuilt binaries for the GitHub release are downloaded automatically:
66
66
  - Linux x64
67
67
  - Linux arm64
68
68
  - macOS x64 / arm64
69
- - Windows x64
69
+ - Windows x64 / arm64
70
+ - Android arm64 / Termux (preview; requires matching Android assets in the
71
+ selected GitHub Release)
72
+
73
+ The source-candidate wrapper recognizes Android arm64 and resolves the
74
+ Termux-native `codewhale`, `codew`, and `codewhale-tui` assets. That path works
75
+ only for package versions whose matching GitHub Release publishes all three
76
+ assets, and remains preview support pending real-device QA. See the support
77
+ table in [docs/INSTALL.md](https://github.com/Hmbown/CodeWhale/blob/main/docs/INSTALL.md).
70
78
 
71
79
  HarmonyOS PC (`openharmony`) is treated as `linux`, so it gets the Linux
72
80
  binaries matching your CPU architecture (x64 or arm64). Linux riscv64 prebuilts
73
81
  are temporarily paused while the locked `rquickjs-sys` dependency lacks
74
82
  `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
83
+ (FreeBSD, Linux riscv64, …) aren't shipped as prebuilts. Unsupported platforms,
84
+ checksum failures, and glibc compatibility problems still fail with a clear
85
+ error pointing you at the full
78
86
  [docs/INSTALL.md](https://github.com/Hmbown/CodeWhale/blob/main/docs/INSTALL.md)
79
87
  guide.
80
88
 
@@ -84,7 +92,7 @@ guide.
84
92
  | --- | --- |
85
93
  | `codewhaleBinaryVersion` in `package.json` | Default native binary version. `deepseekBinaryVersion` is still read as a backward-compat fallback. |
86
94
  | `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. |
95
+ | `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
96
  | `DEEPSEEK_TUI_VERSION` or `DEEPSEEK_VERSION` | Override the GitHub release version to download. |
89
97
  | `DEEPSEEK_TUI_GITHUB_REPO` or `DEEPSEEK_GITHUB_REPO` | Override the source repo. Defaults to `Hmbown/CodeWhale`. |
90
98
  | `DEEPSEEK_TUI_FORCE_DOWNLOAD=1` | Force download even when the cached binary is already present. |
@@ -101,12 +109,13 @@ offline installs, set `DEEPSEEK_TUI_DISABLE_INSTALL=1` or point
101
109
 
102
110
  ## Release integrity
103
111
 
104
- - `npm publish` runs a release-asset check to ensure all required binary assets
105
- exist for the target GitHub release before publishing.
112
+ - `npm publish` runs a release-asset check to ensure the required binaries,
113
+ archives, Windows installer, and checksum manifests exist for the target
114
+ GitHub release before publishing.
106
115
  - 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
116
+ that those release assets were updated by a successful `release.yml` run for
108
117
  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.
118
+ is set, it checks the mirror asset URLs and checksum manifests instead.
110
119
  - Install-time downloads are verified against the release checksum manifest before
111
120
  the wrapper marks them executable.
112
121
 
package/bin/codew.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const { run } = require("../scripts/run");
4
4
 
5
- run("codewhale").catch((error) => {
6
- console.error("Failed to start codewhale:", error.message);
5
+ run("codew").catch((error) => {
6
+ console.error("Failed to start codew:", error.message);
7
7
  process.exit(1);
8
8
  });
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.1",
4
+ "codewhaleBinaryVersion": "0.9.1",
5
+ "description": "Terminal coding agent for supported hosted and local models. One runtime on your machine. Rust, MIT.",
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,18 +2,46 @@ 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
+ "codewhale-windows-arm64.zip",
27
+ "codewhale-windows-arm64-portable.zip",
28
+ ];
5
29
 
6
30
  const ASSET_MATRIX = {
7
31
  linux: {
8
32
  x64: ["codewhale-linux-x64", "codewhale-tui-linux-x64", "codew-linux-x64"],
9
33
  arm64: ["codewhale-linux-arm64", "codewhale-tui-linux-arm64", "codew-linux-arm64"],
10
34
  },
35
+ android: {
36
+ arm64: ["codewhale-android-arm64", "codewhale-tui-android-arm64", "codew-android-arm64"],
37
+ },
11
38
  darwin: {
12
39
  x64: ["codewhale-macos-x64", "codewhale-tui-macos-x64", "codew-macos-x64"],
13
40
  arm64: ["codewhale-macos-arm64", "codewhale-tui-macos-arm64", "codew-macos-arm64"],
14
41
  },
15
42
  win32: {
16
43
  x64: ["codewhale-windows-x64.exe", "codewhale-tui-windows-x64.exe", "codew-windows-x64.exe", "codewhale.bat"],
44
+ arm64: ["codewhale-windows-arm64.exe", "codewhale-tui-windows-arm64.exe", "codew-windows-arm64.exe"],
17
45
  },
18
46
  };
19
47
 
@@ -102,12 +130,38 @@ function releaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
102
130
  }
103
131
  // When CODEWHALE_USE_CNB_MIRROR is set, use the CNB (China-friendly)
104
132
  // 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}/`;
133
+ if (usesCnbMirror()) {
134
+ assertCnbMirrorSupportedPlatform();
135
+ return `https://cnb.cool/codewhale.net/codewhale/-/releases/v${version}/`;
107
136
  }
108
137
  return `https://github.com/${repo}/releases/download/v${version}/`;
109
138
  }
110
139
 
140
+ function usesCnbMirror(env = process.env) {
141
+ const hasExplicitBase = Boolean(
142
+ env.CODEWHALE_RELEASE_BASE_URL ||
143
+ env.DEEPSEEK_TUI_RELEASE_BASE_URL ||
144
+ env.DEEPSEEK_RELEASE_BASE_URL,
145
+ );
146
+ return !hasExplicitBase && Boolean(env.CODEWHALE_USE_CNB_MIRROR);
147
+ }
148
+
149
+ function assertCnbMirrorSupportedPlatform(
150
+ rawPlatform = os.platform(),
151
+ arch = os.arch(),
152
+ ) {
153
+ const platform = PLATFORM_ALIASES[rawPlatform] || rawPlatform;
154
+ if (platform === "linux" && arch === "x64") {
155
+ return;
156
+ }
157
+ throw new Error(
158
+ "CODEWHALE_USE_CNB_MIRROR=1 currently supports only Linux x64 " +
159
+ `(including OpenHarmony x64); detected ${rawPlatform} ${arch}. ` +
160
+ "Use the GitHub Release or set CODEWHALE_RELEASE_BASE_URL to a " +
161
+ "complete mirror for this platform.",
162
+ );
163
+ }
164
+
111
165
  function releaseAssetUrl(baseName, version, repo = "Hmbown/CodeWhale") {
112
166
  return new URL(baseName, releaseBaseUrl(version, repo)).toString();
113
167
  }
@@ -131,17 +185,35 @@ function allAssetNames() {
131
185
  }
132
186
 
133
187
  function allReleaseAssetNames() {
134
- return [...allAssetNames(), CHECKSUM_MANIFEST];
188
+ return [
189
+ ...allAssetNames(),
190
+ ...BUNDLE_ASSET_NAMES,
191
+ WINDOWS_INSTALLER_ASSET,
192
+ BUNDLE_CHECKSUM_MANIFEST,
193
+ CHECKSUM_MANIFEST,
194
+ ];
195
+ }
196
+
197
+ function checksummedReleaseAssetNames() {
198
+ return allReleaseAssetNames().filter((name) => name !== CHECKSUM_MANIFEST);
135
199
  }
136
200
 
137
201
  module.exports = {
138
202
  allAssetNames,
139
203
  allReleaseAssetNames,
204
+ assertCnbMirrorSupportedPlatform,
205
+ BUNDLE_ASSET_NAMES,
206
+ BUNDLE_CHECKSUM_MANIFEST,
140
207
  CHECKSUM_MANIFEST,
208
+ checksummedReleaseAssetNames,
209
+ CNB_BINARY_ASSET_NAMES,
210
+ CNB_RELEASE_ASSET_NAMES,
141
211
  checksumManifestUrl,
142
212
  detectBinaryNames,
143
213
  executableName,
144
214
  releaseAssetUrl,
145
215
  releaseBaseUrl,
146
216
  releaseBinaryDirectory,
217
+ usesCnbMirror,
218
+ WINDOWS_INSTALLER_ASSET,
147
219
  };
@@ -142,13 +142,17 @@ function maxAttempts(context = "runtime", env = process.env) {
142
142
  }
143
143
 
144
144
  function binaryPaths() {
145
- const { codewhale, tui } = detectBinaryNames();
145
+ const { codewhale, codew, tui } = detectBinaryNames();
146
146
  const releaseDir = releaseBinaryDirectory();
147
147
  return {
148
148
  codewhale: {
149
149
  asset: codewhale,
150
150
  target: path.join(releaseDir, process.platform === "win32" ? "codewhale.exe" : "codewhale"),
151
151
  },
152
+ codew: {
153
+ asset: codew,
154
+ target: path.join(releaseDir, process.platform === "win32" ? "codew.exe" : "codew"),
155
+ },
152
156
  tui: {
153
157
  asset: tui,
154
158
  target: path.join(releaseDir, process.platform === "win32" ? "codewhale-tui.exe" : "codewhale-tui"),
@@ -203,7 +207,7 @@ function installFailureHint(error) {
203
207
  "codewhale install hint:",
204
208
  ` DEEPSEEK_TUI_RELEASE_BASE_URL is set to ${releaseBase}`,
205
209
  " Verify that this directory contains codewhale-artifacts-sha256.txt",
206
- " plus the codewhale/codewhale-tui binary assets for your platform.",
210
+ " plus the codewhale/codew/codewhale-tui binary assets for your platform.",
207
211
  ].join("\n");
208
212
  }
209
213
 
@@ -1133,6 +1137,7 @@ async function run(options = {}) {
1133
1137
 
1134
1138
  await Promise.all([
1135
1139
  ensureBinary(paths.codewhale.target, paths.codewhale.asset, version, repo, getChecksums, { context }),
1140
+ ensureBinary(paths.codew.target, paths.codew.asset, version, repo, getChecksums, { context }),
1136
1141
  ensureBinary(paths.tui.target, paths.tui.asset, version, repo, getChecksums, { context }),
1137
1142
  ]);
1138
1143
  }
@@ -1143,6 +1148,9 @@ async function getBinaryPath(name) {
1143
1148
  if (name === "codewhale") {
1144
1149
  return paths.codewhale.target;
1145
1150
  }
1151
+ if (name === "codew") {
1152
+ return paths.codew.target;
1153
+ }
1146
1154
  if (name === "codewhale-tui") {
1147
1155
  return paths.tui.target;
1148
1156
  }
@@ -1159,8 +1167,10 @@ module.exports = {
1159
1167
  adoptExistingBinaryIfValid,
1160
1168
  shouldIgnoreInstallFailure,
1161
1169
  shouldSkipOptionalPostinstall,
1170
+ httpRequest,
1162
1171
  defaultTimeoutMs,
1163
1172
  defaultStallMs,
1173
+ binaryPaths,
1164
1174
  ensureBinary,
1165
1175
  maxAttempts,
1166
1176
  withRetry,
@@ -1182,4 +1192,4 @@ if (require.main === module) {
1182
1192
  }
1183
1193
  process.exit(1);
1184
1194
  });
1185
- }
1195
+ }
@@ -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);
@@ -58,6 +68,7 @@ test("known platforms are unaffected by alias map", () => {
58
68
  ["linux", "x64", "codewhale-linux-x64"],
59
69
  ["darwin", "arm64", "codewhale-macos-arm64"],
60
70
  ["win32", "x64", "codewhale-windows-x64.exe"],
71
+ ["win32", "arm64", "codewhale-windows-arm64.exe"],
61
72
  ]) {
62
73
  withMockedOs(platform, arch, () => {
63
74
  const { detectBinaryNames } = require(ARTIFACTS_PATH);
@@ -67,6 +78,19 @@ test("known platforms are unaffected by alias map", () => {
67
78
  }
68
79
  });
69
80
 
81
+ test("Windows arm64 resolves the complete native binary family", () => {
82
+ withMockedOs("win32", "arm64", () => {
83
+ const { detectBinaryNames } = require(ARTIFACTS_PATH);
84
+ assert.deepEqual(detectBinaryNames(), {
85
+ platform: "win32",
86
+ arch: "arm64",
87
+ codewhale: "codewhale-windows-arm64.exe",
88
+ tui: "codewhale-tui-windows-arm64.exe",
89
+ codew: "codew-windows-arm64.exe",
90
+ });
91
+ });
92
+ });
93
+
70
94
  test("linux riscv64 reports the temporary upstream binding blocker", () => {
71
95
  withMockedOs("linux", "riscv64", () => {
72
96
  const { detectBinaryNames } = require(ARTIFACTS_PATH);
@@ -82,14 +106,121 @@ test("linux riscv64 reports the temporary upstream binding blocker", () => {
82
106
  });
83
107
  });
84
108
 
85
- test("allAssetNames includes every matrix entry", () => {
86
- const { allAssetNames, allReleaseAssetNames } = require(ARTIFACTS_PATH);
109
+ test("release asset inventory includes binaries, archives, installer, and manifests", () => {
110
+ const {
111
+ allAssetNames,
112
+ allReleaseAssetNames,
113
+ BUNDLE_ASSET_NAMES,
114
+ BUNDLE_CHECKSUM_MANIFEST,
115
+ CHECKSUM_MANIFEST,
116
+ checksummedReleaseAssetNames,
117
+ WINDOWS_INSTALLER_ASSET,
118
+ } = require(ARTIFACTS_PATH);
87
119
  const assetNames = allAssetNames();
120
+ const releaseAssetNames = allReleaseAssetNames();
88
121
  assert.ok(assetNames.includes("codewhale-windows-x64.exe"));
89
122
  assert.ok(assetNames.includes("codewhale-tui-windows-x64.exe"));
90
123
  assert.ok(assetNames.includes("codew-windows-x64.exe"));
91
124
  assert.ok(assetNames.includes("codewhale.bat"));
125
+ assert.ok(assetNames.includes("codewhale-windows-arm64.exe"));
126
+ assert.ok(assetNames.includes("codewhale-tui-windows-arm64.exe"));
127
+ assert.ok(assetNames.includes("codew-windows-arm64.exe"));
128
+ assert.ok(assetNames.includes("codewhale-android-arm64"));
129
+ assert.ok(assetNames.includes("codewhale-tui-android-arm64"));
130
+ assert.ok(assetNames.includes("codew-android-arm64"));
92
131
  assert.ok(!assetNames.includes("codewhale-linux-riscv64"));
93
- assert.ok(allReleaseAssetNames().includes("codew-windows-x64.exe"));
94
- assert.ok(allReleaseAssetNames().includes("codewhale.bat"));
132
+ assert.ok(releaseAssetNames.includes("codew-windows-x64.exe"));
133
+ assert.ok(releaseAssetNames.includes("codewhale.bat"));
134
+ assert.ok(releaseAssetNames.includes("codew-windows-arm64.exe"));
135
+ assert.ok(releaseAssetNames.includes("codew-android-arm64"));
136
+ for (const bundle of BUNDLE_ASSET_NAMES) {
137
+ assert.ok(releaseAssetNames.includes(bundle));
138
+ }
139
+ assert.ok(releaseAssetNames.includes(WINDOWS_INSTALLER_ASSET));
140
+ assert.ok(releaseAssetNames.includes(BUNDLE_CHECKSUM_MANIFEST));
141
+ assert.ok(releaseAssetNames.includes(CHECKSUM_MANIFEST));
142
+ assert.ok(checksummedReleaseAssetNames().includes(BUNDLE_CHECKSUM_MANIFEST));
143
+ assert.ok(!checksummedReleaseAssetNames().includes(CHECKSUM_MANIFEST));
144
+ });
145
+
146
+ test("CNB mirror URLs use the repository that publishes release assets", () => {
147
+ withMockedOs("linux", "x64", () => {
148
+ const keys = [
149
+ "CODEWHALE_RELEASE_BASE_URL",
150
+ "DEEPSEEK_TUI_RELEASE_BASE_URL",
151
+ "DEEPSEEK_RELEASE_BASE_URL",
152
+ "CODEWHALE_USE_CNB_MIRROR",
153
+ ];
154
+ const previous = Object.fromEntries(keys.map((key) => [key, process.env[key]]));
155
+ try {
156
+ for (const key of keys) delete process.env[key];
157
+ process.env.CODEWHALE_USE_CNB_MIRROR = "1";
158
+ const {
159
+ checksumManifestUrl,
160
+ CNB_RELEASE_ASSET_NAMES,
161
+ releaseAssetUrl,
162
+ releaseBaseUrl,
163
+ } = require(ARTIFACTS_PATH);
164
+
165
+ assert.deepEqual(CNB_RELEASE_ASSET_NAMES, [
166
+ "codewhale-linux-x64",
167
+ "codew-linux-x64",
168
+ "codewhale-tui-linux-x64",
169
+ "codewhale-artifacts-sha256.txt",
170
+ ]);
171
+ assert.equal(
172
+ releaseBaseUrl("0.8.68"),
173
+ "https://cnb.cool/codewhale.net/codewhale/-/releases/v0.8.68/",
174
+ );
175
+ assert.equal(
176
+ releaseAssetUrl("codewhale-linux-x64", "0.8.68"),
177
+ "https://cnb.cool/codewhale.net/codewhale/-/releases/v0.8.68/codewhale-linux-x64",
178
+ );
179
+ assert.equal(
180
+ checksumManifestUrl("0.8.68"),
181
+ "https://cnb.cool/codewhale.net/codewhale/-/releases/v0.8.68/codewhale-artifacts-sha256.txt",
182
+ );
183
+ } finally {
184
+ for (const key of keys) {
185
+ if (previous[key] === undefined) delete process.env[key];
186
+ else process.env[key] = previous[key];
187
+ }
188
+ }
189
+ });
190
+ });
191
+
192
+ test("CNB mirror fails clearly outside its Linux x64 build matrix", () => {
193
+ withMockedOs("darwin", "arm64", () => {
194
+ const previous = process.env.CODEWHALE_USE_CNB_MIRROR;
195
+ process.env.CODEWHALE_USE_CNB_MIRROR = "1";
196
+ try {
197
+ const { releaseBaseUrl } = require(ARTIFACTS_PATH);
198
+ assert.throws(
199
+ () => releaseBaseUrl("0.8.68"),
200
+ /currently supports only Linux x64.*detected darwin arm64/,
201
+ );
202
+ } finally {
203
+ if (previous === undefined) delete process.env.CODEWHALE_USE_CNB_MIRROR;
204
+ else process.env.CODEWHALE_USE_CNB_MIRROR = previous;
205
+ }
206
+ });
207
+ });
208
+
209
+ test("an explicit release base takes precedence over the CNB shortcut", () => {
210
+ withMockedOs("darwin", "arm64", () => {
211
+ const previousBase = process.env.CODEWHALE_RELEASE_BASE_URL;
212
+ const previousCnb = process.env.CODEWHALE_USE_CNB_MIRROR;
213
+ process.env.CODEWHALE_RELEASE_BASE_URL = "https://mirror.example/v0.8.68";
214
+ process.env.CODEWHALE_USE_CNB_MIRROR = "1";
215
+ try {
216
+ const { releaseBaseUrl, usesCnbMirror } = require(ARTIFACTS_PATH);
217
+ assert.equal(usesCnbMirror(), false);
218
+ assert.equal(releaseBaseUrl("0.8.68"), "https://mirror.example/v0.8.68/");
219
+ } finally {
220
+ if (previousBase === undefined) delete process.env.CODEWHALE_RELEASE_BASE_URL;
221
+ else process.env.CODEWHALE_RELEASE_BASE_URL = previousBase;
222
+ if (previousCnb === undefined) delete process.env.CODEWHALE_USE_CNB_MIRROR;
223
+ else process.env.CODEWHALE_USE_CNB_MIRROR = previousCnb;
224
+ }
225
+ });
95
226
  });
@@ -64,6 +64,13 @@ test("install script remains parseable before the Node support guard runs", () =
64
64
  assert.equal(installScript.includes("?."), false);
65
65
  });
66
66
 
67
+ test("native shortcut has its own platform asset and installed path", () => {
68
+ const paths = _internal.binaryPaths();
69
+ assert.match(paths.codew.asset, /^codew-/);
70
+ assert.equal(path.basename(paths.codew.target), process.platform === "win32" ? "codew.exe" : "codew");
71
+ assert.notEqual(paths.codew.target, paths.codewhale.target);
72
+ });
73
+
67
74
  test("install failure hint explains release base override for blocked GitHub downloads", () => {
68
75
  const previous = process.env.DEEPSEEK_TUI_RELEASE_BASE_URL;
69
76
  delete process.env.DEEPSEEK_TUI_RELEASE_BASE_URL;
@@ -112,10 +119,10 @@ test("install failure hint checks configured release base when override is alrea
112
119
  }
113
120
  });
114
121
 
115
- test("glibc preflight message is CodeWhale-branded and actionable", () => {
122
+ test("glibc preflight message is Codewhale-branded and actionable", () => {
116
123
  const message = glibcInternal.glibcCompatibilityMessage([2, 39, 0], [2, 35, 0]);
117
124
 
118
- assert.match(message, /Prebuilt CodeWhale Linux binaries require GLIBC_2\.39/);
125
+ assert.match(message, /Prebuilt Codewhale Linux binaries require GLIBC_2\.39/);
119
126
  assert.match(message, /this system has glibc 2\.35/);
120
127
  assert.match(message, /cargo install codewhale-cli --locked/);
121
128
  assert.match(message, /Linux x64 release asset is a static \(musl\) build/);
@@ -263,3 +270,15 @@ test("resolvePackageVersion honors codewhaleBinaryVersion precedence (#3769)", (
263
270
  "8.8.8",
264
271
  );
265
272
  });
273
+
274
+ test("httpRequest handles invalid URL parsing errors", async () => {
275
+ const { httpRequest } = _internal;
276
+ const invalidUrl = "not-a-valid-url";
277
+ try {
278
+ await httpRequest(invalidUrl);
279
+ assert.fail("httpRequest should throw for an invalid URL");
280
+ } catch (err) {
281
+ assert.equal(err.name, "NonRetryableError");
282
+ assert.match(err.message, /Invalid URL: not-a-valid-url/);
283
+ }
284
+ });
@@ -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
+ });
package/test/run.test.js CHANGED
@@ -33,6 +33,29 @@ test("version flags prefer the installed binary over package metadata", async ()
33
33
  assert.deepEqual(exits, [0]);
34
34
  });
35
35
 
36
+ test("codew wrapper dispatches the native shortcut binary", async () => {
37
+ const resolvedNames = [];
38
+ const spawned = [];
39
+
40
+ await run("codew", {
41
+ args: ["--version"],
42
+ getBinaryPath: async (name) => {
43
+ resolvedNames.push(name);
44
+ return "/tmp/codew-test-binary";
45
+ },
46
+ spawnSync: (binary, args) => {
47
+ spawned.push({ binary, args });
48
+ return { status: 0 };
49
+ },
50
+ exit: () => {},
51
+ });
52
+
53
+ assert.deepEqual(resolvedNames, ["codew"]);
54
+ assert.deepEqual(spawned, [
55
+ { binary: "/tmp/codew-test-binary", args: ["--version"] },
56
+ ]);
57
+ });
58
+
36
59
  test("version flags fall back to package metadata when the binary is unavailable", async () => {
37
60
  const originalLog = console.log;
38
61
  const lines = [];