codewhale 0.8.66 → 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 +17 -15
- package/package.json +4 -4
- package/scripts/artifacts.js +84 -5
- package/scripts/preflight-glibc.js +2 -2
- package/scripts/verify-release-assets.js +32 -8
- package/test/artifacts.test.js +133 -5
- package/test/install.test.js +3 -3
- package/test/release-assets.test.js +117 -2
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
|
-
|
|
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
|
-
|
|
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
|
|
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,18 +65,19 @@ Prebuilt binaries for the GitHub release are downloaded automatically:
|
|
|
65
65
|
|
|
66
66
|
- Linux x64
|
|
67
67
|
- Linux arm64
|
|
68
|
-
-
|
|
68
|
+
- Android arm64 (Termux)
|
|
69
69
|
- macOS x64 / arm64
|
|
70
70
|
- Windows x64
|
|
71
71
|
|
|
72
72
|
HarmonyOS PC (`openharmony`) is treated as `linux`, so it gets the Linux
|
|
73
|
-
binaries matching your CPU architecture (x64
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
binaries matching your CPU architecture (x64 or arm64). Linux riscv64 prebuilts
|
|
74
|
+
are temporarily paused while the locked `rquickjs-sys` dependency lacks
|
|
75
|
+
`riscv64gc-unknown-linux-gnu` bindings. Other platform/architecture combinations
|
|
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
|
|
|
81
82
|
## Wrapper configuration
|
|
82
83
|
|
|
@@ -84,7 +85,7 @@ build-from-source 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
|
|
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
|
|
105
|
-
exist for the target
|
|
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
|
|
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
|
|
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.
|
|
4
|
-
"codewhaleBinaryVersion": "0.
|
|
5
|
-
"description": "Install and run
|
|
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": "
|
|
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
|
},
|
package/scripts/artifacts.js
CHANGED
|
@@ -2,12 +2,36 @@ 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"],
|
|
11
35
|
},
|
|
12
36
|
darwin: {
|
|
13
37
|
x64: ["codewhale-macos-x64", "codewhale-tui-macos-x64", "codew-macos-x64"],
|
|
@@ -39,10 +63,11 @@ function detectBinaryNames() {
|
|
|
39
63
|
const pair = defaults[arch];
|
|
40
64
|
if (!pair) {
|
|
41
65
|
const supported = Object.keys(defaults).map(a => `'${a}'`).join(', ');
|
|
66
|
+
const hint = platform === "linux" && arch === "riscv64" ? unsupportedRiscvHint() : unsupportedBuildHint();
|
|
42
67
|
throw new Error(
|
|
43
68
|
`Unsupported architecture: ${arch} on platform ${platform}. ` +
|
|
44
69
|
`Supported architectures: ${supported}.\n\n` +
|
|
45
|
-
|
|
70
|
+
hint,
|
|
46
71
|
);
|
|
47
72
|
}
|
|
48
73
|
return {
|
|
@@ -75,6 +100,16 @@ function unsupportedBuildHint() {
|
|
|
75
100
|
].join("\n");
|
|
76
101
|
}
|
|
77
102
|
|
|
103
|
+
function unsupportedRiscvHint() {
|
|
104
|
+
return [
|
|
105
|
+
"Linux riscv64 prebuilt binaries are temporarily unavailable.",
|
|
106
|
+
"CodeWhale currently depends on rquickjs-sys, which does not ship",
|
|
107
|
+
"riscv64gc-unknown-linux-gnu bindings in the locked dependency set.",
|
|
108
|
+
"",
|
|
109
|
+
"Track the release notes and docs/INSTALL.md for the next RISC-V support update.",
|
|
110
|
+
].join("\n");
|
|
111
|
+
}
|
|
112
|
+
|
|
78
113
|
function executableName(base, platform) {
|
|
79
114
|
return platform === "win32" ? `${base}.exe` : base;
|
|
80
115
|
}
|
|
@@ -92,12 +127,38 @@ function releaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
|
|
|
92
127
|
}
|
|
93
128
|
// When CODEWHALE_USE_CNB_MIRROR is set, use the CNB (China-friendly)
|
|
94
129
|
// mirror that already builds and publishes binary release assets.
|
|
95
|
-
if (
|
|
96
|
-
|
|
130
|
+
if (usesCnbMirror()) {
|
|
131
|
+
assertCnbMirrorSupportedPlatform();
|
|
132
|
+
return `https://cnb.cool/codewhale.net/codewhale/-/releases/v${version}/`;
|
|
97
133
|
}
|
|
98
134
|
return `https://github.com/${repo}/releases/download/v${version}/`;
|
|
99
135
|
}
|
|
100
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
|
+
|
|
101
162
|
function releaseAssetUrl(baseName, version, repo = "Hmbown/CodeWhale") {
|
|
102
163
|
return new URL(baseName, releaseBaseUrl(version, repo)).toString();
|
|
103
164
|
}
|
|
@@ -121,17 +182,35 @@ function allAssetNames() {
|
|
|
121
182
|
}
|
|
122
183
|
|
|
123
184
|
function allReleaseAssetNames() {
|
|
124
|
-
return [
|
|
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);
|
|
125
196
|
}
|
|
126
197
|
|
|
127
198
|
module.exports = {
|
|
128
199
|
allAssetNames,
|
|
129
200
|
allReleaseAssetNames,
|
|
201
|
+
assertCnbMirrorSupportedPlatform,
|
|
202
|
+
BUNDLE_ASSET_NAMES,
|
|
203
|
+
BUNDLE_CHECKSUM_MANIFEST,
|
|
130
204
|
CHECKSUM_MANIFEST,
|
|
205
|
+
checksummedReleaseAssetNames,
|
|
206
|
+
CNB_BINARY_ASSET_NAMES,
|
|
207
|
+
CNB_RELEASE_ASSET_NAMES,
|
|
131
208
|
checksumManifestUrl,
|
|
132
209
|
detectBinaryNames,
|
|
133
210
|
executableName,
|
|
134
211
|
releaseAssetUrl,
|
|
135
212
|
releaseBaseUrl,
|
|
136
213
|
releaseBinaryDirectory,
|
|
214
|
+
usesCnbMirror,
|
|
215
|
+
WINDOWS_INSTALLER_ASSET,
|
|
137
216
|
};
|
|
@@ -96,10 +96,10 @@ 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
|
|
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
|
-
"but the Linux arm64
|
|
102
|
+
"but the Linux arm64 asset is a GNU libc build linked against",
|
|
103
103
|
"Ubuntu 24.04/glibc 2.39, which Ubuntu 22.04 (glibc 2.35) cannot run.",
|
|
104
104
|
"",
|
|
105
105
|
buildFromSourceHint(),
|
|
@@ -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
|
|
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}
|
|
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
|
|
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
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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,
|
package/test/artifacts.test.js
CHANGED
|
@@ -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);
|
|
@@ -57,7 +67,6 @@ test("known platforms are unaffected by alias map", () => {
|
|
|
57
67
|
for (const [platform, arch, expectedCodeWhale] of [
|
|
58
68
|
["linux", "x64", "codewhale-linux-x64"],
|
|
59
69
|
["darwin", "arm64", "codewhale-macos-arm64"],
|
|
60
|
-
["linux", "riscv64", "codewhale-linux-riscv64"],
|
|
61
70
|
["win32", "x64", "codewhale-windows-x64.exe"],
|
|
62
71
|
]) {
|
|
63
72
|
withMockedOs(platform, arch, () => {
|
|
@@ -68,13 +77,132 @@ test("known platforms are unaffected by alias map", () => {
|
|
|
68
77
|
}
|
|
69
78
|
});
|
|
70
79
|
|
|
71
|
-
test("
|
|
72
|
-
|
|
80
|
+
test("linux riscv64 reports the temporary upstream binding blocker", () => {
|
|
81
|
+
withMockedOs("linux", "riscv64", () => {
|
|
82
|
+
const { detectBinaryNames } = require(ARTIFACTS_PATH);
|
|
83
|
+
assert.throws(
|
|
84
|
+
() => detectBinaryNames(),
|
|
85
|
+
(err) => {
|
|
86
|
+
assert.match(err.message, /Unsupported architecture: riscv64 on platform linux/);
|
|
87
|
+
assert.match(err.message, /rquickjs-sys/);
|
|
88
|
+
assert.match(err.message, /riscv64gc-unknown-linux-gnu/);
|
|
89
|
+
return true;
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
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);
|
|
73
105
|
const assetNames = allAssetNames();
|
|
106
|
+
const releaseAssetNames = allReleaseAssetNames();
|
|
74
107
|
assert.ok(assetNames.includes("codewhale-windows-x64.exe"));
|
|
75
108
|
assert.ok(assetNames.includes("codewhale-tui-windows-x64.exe"));
|
|
76
109
|
assert.ok(assetNames.includes("codew-windows-x64.exe"));
|
|
77
110
|
assert.ok(assetNames.includes("codewhale.bat"));
|
|
78
|
-
assert.ok(
|
|
79
|
-
assert.ok(
|
|
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"));
|
|
114
|
+
assert.ok(!assetNames.includes("codewhale-linux-riscv64"));
|
|
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
|
+
});
|
|
80
208
|
});
|
package/test/install.test.js
CHANGED
|
@@ -112,14 +112,14 @@ test("install failure hint checks configured release base when override is alrea
|
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
test("glibc preflight message is
|
|
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
|
|
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/);
|
|
122
|
-
assert.match(message, /arm64
|
|
122
|
+
assert.match(message, /Linux arm64 asset is a GNU libc build/);
|
|
123
123
|
assert.match(message, /CODEWHALE_SKIP_GLIBC_CHECK=1/);
|
|
124
124
|
});
|
|
125
125
|
|
|
@@ -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
|
|
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
|
|
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
|
+
});
|