codewhale 0.9.9 → 0.9.11
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 +21 -12
- package/package.json +2 -2
- package/scripts/artifacts.js +88 -18
- package/scripts/install.js +532 -53
- package/scripts/run.js +3 -0
- package/scripts/verify-release-assets.js +7 -1
- package/test/install.test.js +64 -2
- package/test/postinstall.test.js +1 -0
- package/test/source-selection.test.js +866 -0
package/README.md
CHANGED
|
@@ -34,9 +34,12 @@ npm install codewhale
|
|
|
34
34
|
npx codewhale --help
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
`postinstall` tries to download platform binaries into `bin/downloads/`.
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
`postinstall` tries to download platform binaries into `bin/downloads/`. On
|
|
38
|
+
Linux x64 it concurrently probes the GitHub Releases and CNB first-party
|
|
39
|
+
checksum manifests for this package version, locks the first source that
|
|
40
|
+
validates, and downloads binaries only from that source. If GitHub release
|
|
41
|
+
assets are temporarily unreachable, install continues and the wrapper retries
|
|
42
|
+
the download on first run.
|
|
40
43
|
|
|
41
44
|
## First run
|
|
42
45
|
|
|
@@ -90,20 +93,26 @@ guide.
|
|
|
90
93
|
| Setting | What it does |
|
|
91
94
|
| --- | --- |
|
|
92
95
|
| `codewhaleBinaryVersion` in `package.json` | Default native binary version. `deepseekBinaryVersion` is still read as a backward-compat fallback. |
|
|
93
|
-
| `CODEWHALE_RELEASE_BASE_URL` | Canonical override: use an internal or mirrored release-asset directory
|
|
94
|
-
| `CODEWHALE_USE_CNB_MIRROR=1` |
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
96
|
+
| `CODEWHALE_RELEASE_BASE_URL` | Canonical override: use an internal or mirrored release-asset directory and skip the Linux x64 GitHub/CNB race. 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. |
|
|
97
|
+
| `CODEWHALE_USE_CNB_MIRROR=1` | Force the CNB (China-friendly) first-party mirror on Linux x64 and OpenHarmony x64, skipping the automatic race. Other targets fail with a clear unsupported-mirror error; use GitHub or a complete `CODEWHALE_RELEASE_BASE_URL` mirror there. Without this variable, Linux x64 still probes CNB and GitHub together and uses the first valid checksum manifest. |
|
|
98
|
+
| `CODEWHALE_VERSION` | Override the release version to download. |
|
|
99
|
+
| `CODEWHALE_GITHUB_REPO` | Override the source repo. Defaults to `Hmbown/CodeWhale`. |
|
|
100
|
+
| `CODEWHALE_FORCE_DOWNLOAD=1` | Force download even when the cached binary is already present. |
|
|
101
|
+
| `CODEWHALE_DISABLE_INSTALL=1` | Skip install-time download. |
|
|
102
|
+
| `CODEWHALE_OPTIONAL_INSTALL=1` | Make install-time retryable download failures warn and exit `0` instead of failing `npm install`. |
|
|
103
|
+
| `CODEWHALE_QUIET_INSTALL=1` | Suppress installer progress messages. |
|
|
104
|
+
| `CODEWHALE_DOWNLOAD_TIMEOUT_MS` | Override the total download budget. |
|
|
105
|
+
| `CODEWHALE_DOWNLOAD_STALL_MS` | Override the no-progress stall budget. |
|
|
106
|
+
| `CODEWHALE_SKIP_GLIBC_CHECK=1` | Bypass the Linux glibc preflight check at your own risk. |
|
|
107
|
+
|
|
108
|
+
The corresponding `DEEPSEEK_TUI_*` and `DEEPSEEK_*` names remain accepted as
|
|
109
|
+
legacy aliases, after the canonical Codewhale names.
|
|
101
110
|
|
|
102
111
|
### Proxies
|
|
103
112
|
|
|
104
113
|
Downloads respect `HTTPS_PROXY` / `HTTP_PROXY` (CONNECT tunneling included)
|
|
105
114
|
and `NO_PROXY`, so the wrapper works behind corporate proxies. For fully
|
|
106
|
-
offline installs, set `
|
|
115
|
+
offline installs, set `CODEWHALE_DISABLE_INSTALL=1` or point
|
|
107
116
|
`CODEWHALE_RELEASE_BASE_URL` at a local mirror.
|
|
108
117
|
|
|
109
118
|
## Release integrity
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codewhale",
|
|
3
|
-
"version": "0.9.
|
|
4
|
-
"codewhaleBinaryVersion": "0.9.
|
|
3
|
+
"version": "0.9.11",
|
|
4
|
+
"codewhaleBinaryVersion": "0.9.11",
|
|
5
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",
|
package/scripts/artifacts.js
CHANGED
|
@@ -5,7 +5,8 @@ const CHECKSUM_MANIFEST = "codewhale-artifacts-sha256.txt";
|
|
|
5
5
|
const BUNDLE_CHECKSUM_MANIFEST = "codewhale-bundles-sha256.txt";
|
|
6
6
|
const WINDOWS_INSTALLER_ASSET = "CodeWhaleSetup.exe";
|
|
7
7
|
|
|
8
|
-
// v0.9.5
|
|
8
|
+
// Compatibility bridge introduced in v0.9.5: already-shipped v0.9.4 clients
|
|
9
|
+
// require these names before
|
|
9
10
|
// they will advertise or install a newer release. They contain byte-identical
|
|
10
11
|
// copies of the consolidated `codewhale` runtime; current installers do not
|
|
11
12
|
// expose them as a third command.
|
|
@@ -101,7 +102,7 @@ function unsupportedBuildHint() {
|
|
|
101
102
|
"You can still run codewhale by building from source with Cargo (single binary):",
|
|
102
103
|
"",
|
|
103
104
|
" # Requires Rust 1.88+ (https://rustup.rs)",
|
|
104
|
-
" cargo install codewhale-cli --locked # provides `codewhale`
|
|
105
|
+
" cargo install codewhale-cli --locked # provides `codewhale`",
|
|
105
106
|
"",
|
|
106
107
|
"Or build from a checkout:",
|
|
107
108
|
"",
|
|
@@ -128,41 +129,102 @@ function executableName(base, platform) {
|
|
|
128
129
|
return platform === "win32" ? `${base}.exe` : base;
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
function ensureTrailingSlash(baseUrl) {
|
|
133
|
+
const trimmed = String(baseUrl).trim();
|
|
134
|
+
return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function githubReleaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
|
|
138
|
+
return `https://github.com/${repo}/releases/download/v${version}/`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function cnbReleaseBaseUrl(version) {
|
|
142
|
+
return `https://cnb.cool/codewhale.net/codewhale/-/releases/download/v${version}/`;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function releaseAssetUrlFromBase(baseName, baseUrl) {
|
|
146
|
+
return new URL(baseName, ensureTrailingSlash(baseUrl)).toString();
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function explicitReleaseBase(env = process.env) {
|
|
150
|
+
const candidates = [
|
|
151
|
+
env.CODEWHALE_RELEASE_BASE_URL,
|
|
152
|
+
env.DEEPSEEK_TUI_RELEASE_BASE_URL,
|
|
153
|
+
env.DEEPSEEK_RELEASE_BASE_URL,
|
|
154
|
+
];
|
|
155
|
+
for (const candidate of candidates) {
|
|
156
|
+
const override = String(candidate || "").trim();
|
|
157
|
+
if (override) {
|
|
158
|
+
return ensureTrailingSlash(override);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return "";
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function hasExplicitReleaseBase(env = process.env) {
|
|
165
|
+
return Boolean(explicitReleaseBase(env));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function isCnbSupportedTarget(
|
|
169
|
+
rawPlatform = os.platform(),
|
|
170
|
+
arch = os.arch(),
|
|
171
|
+
) {
|
|
172
|
+
const platform = PLATFORM_ALIASES[rawPlatform] || rawPlatform;
|
|
173
|
+
return platform === "linux" && arch === "x64";
|
|
174
|
+
}
|
|
175
|
+
|
|
131
176
|
function releaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
|
|
132
177
|
// CODEWHALE_RELEASE_BASE_URL is the canonical override.
|
|
133
178
|
// DEEPSEEK_TUI_RELEASE_BASE_URL / DEEPSEEK_RELEASE_BASE_URL are legacy aliases.
|
|
134
|
-
const override =
|
|
135
|
-
process.env.CODEWHALE_RELEASE_BASE_URL ||
|
|
136
|
-
process.env.DEEPSEEK_TUI_RELEASE_BASE_URL ||
|
|
137
|
-
process.env.DEEPSEEK_RELEASE_BASE_URL;
|
|
179
|
+
const override = explicitReleaseBase();
|
|
138
180
|
if (override) {
|
|
139
|
-
|
|
140
|
-
return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
|
|
181
|
+
return override;
|
|
141
182
|
}
|
|
142
183
|
// When CODEWHALE_USE_CNB_MIRROR is set, use the CNB (China-friendly)
|
|
143
184
|
// mirror that already builds and publishes binary release assets.
|
|
144
185
|
if (usesCnbMirror()) {
|
|
145
186
|
assertCnbMirrorSupportedPlatform();
|
|
146
|
-
return
|
|
187
|
+
return cnbReleaseBaseUrl(version);
|
|
147
188
|
}
|
|
148
|
-
return
|
|
189
|
+
return githubReleaseBaseUrl(version, repo);
|
|
149
190
|
}
|
|
150
191
|
|
|
151
192
|
function usesCnbMirror(env = process.env) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
193
|
+
return !hasExplicitReleaseBase(env) && env.CODEWHALE_USE_CNB_MIRROR === "1";
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function shouldRaceFirstPartyMirrors(
|
|
197
|
+
env = process.env,
|
|
198
|
+
rawPlatform = os.platform(),
|
|
199
|
+
arch = os.arch(),
|
|
200
|
+
) {
|
|
201
|
+
return (
|
|
202
|
+
isCnbSupportedTarget(rawPlatform, arch) &&
|
|
203
|
+
!hasExplicitReleaseBase(env) &&
|
|
204
|
+
env.CODEWHALE_USE_CNB_MIRROR !== "1"
|
|
156
205
|
);
|
|
157
|
-
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function firstPartyReleaseSources(version, repo = "Hmbown/CodeWhale") {
|
|
209
|
+
return [
|
|
210
|
+
{
|
|
211
|
+
id: "github",
|
|
212
|
+
label: "GitHub Releases",
|
|
213
|
+
baseUrl: githubReleaseBaseUrl(version, repo),
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "cnb",
|
|
217
|
+
label: "CNB first-party mirror",
|
|
218
|
+
baseUrl: cnbReleaseBaseUrl(version),
|
|
219
|
+
},
|
|
220
|
+
];
|
|
158
221
|
}
|
|
159
222
|
|
|
160
223
|
function assertCnbMirrorSupportedPlatform(
|
|
161
224
|
rawPlatform = os.platform(),
|
|
162
225
|
arch = os.arch(),
|
|
163
226
|
) {
|
|
164
|
-
|
|
165
|
-
if (platform === "linux" && arch === "x64") {
|
|
227
|
+
if (isCnbSupportedTarget(rawPlatform, arch)) {
|
|
166
228
|
return;
|
|
167
229
|
}
|
|
168
230
|
throw new Error(
|
|
@@ -174,7 +236,7 @@ function assertCnbMirrorSupportedPlatform(
|
|
|
174
236
|
}
|
|
175
237
|
|
|
176
238
|
function releaseAssetUrl(baseName, version, repo = "Hmbown/CodeWhale") {
|
|
177
|
-
return
|
|
239
|
+
return releaseAssetUrlFromBase(baseName, releaseBaseUrl(version, repo));
|
|
178
240
|
}
|
|
179
241
|
|
|
180
242
|
function checksumManifestUrl(version, repo = "Hmbown/CodeWhale") {
|
|
@@ -221,12 +283,20 @@ module.exports = {
|
|
|
221
283
|
CNB_BINARY_ASSET_NAMES,
|
|
222
284
|
CNB_RELEASE_ASSET_NAMES,
|
|
223
285
|
checksumManifestUrl,
|
|
286
|
+
cnbReleaseBaseUrl,
|
|
224
287
|
detectBinaryNames,
|
|
225
288
|
executableName,
|
|
289
|
+
explicitReleaseBase,
|
|
290
|
+
firstPartyReleaseSources,
|
|
291
|
+
githubReleaseBaseUrl,
|
|
292
|
+
hasExplicitReleaseBase,
|
|
293
|
+
isCnbSupportedTarget,
|
|
226
294
|
LEGACY_TUI_BRIDGE_ASSET_NAMES,
|
|
227
295
|
releaseAssetUrl,
|
|
296
|
+
releaseAssetUrlFromBase,
|
|
228
297
|
releaseBaseUrl,
|
|
229
298
|
releaseBinaryDirectory,
|
|
299
|
+
shouldRaceFirstPartyMirrors,
|
|
230
300
|
usesCnbMirror,
|
|
231
301
|
WINDOWS_INSTALLER_ASSET,
|
|
232
302
|
};
|