codewhale 0.9.9 → 0.9.10
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 +85 -16
- 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.10",
|
|
4
|
+
"codewhaleBinaryVersion": "0.9.10",
|
|
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
|
@@ -128,41 +128,102 @@ function executableName(base, platform) {
|
|
|
128
128
|
return platform === "win32" ? `${base}.exe` : base;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
function ensureTrailingSlash(baseUrl) {
|
|
132
|
+
const trimmed = String(baseUrl).trim();
|
|
133
|
+
return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function githubReleaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
|
|
137
|
+
return `https://github.com/${repo}/releases/download/v${version}/`;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function cnbReleaseBaseUrl(version) {
|
|
141
|
+
return `https://cnb.cool/codewhale.net/codewhale/-/releases/download/v${version}/`;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function releaseAssetUrlFromBase(baseName, baseUrl) {
|
|
145
|
+
return new URL(baseName, ensureTrailingSlash(baseUrl)).toString();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function explicitReleaseBase(env = process.env) {
|
|
149
|
+
const candidates = [
|
|
150
|
+
env.CODEWHALE_RELEASE_BASE_URL,
|
|
151
|
+
env.DEEPSEEK_TUI_RELEASE_BASE_URL,
|
|
152
|
+
env.DEEPSEEK_RELEASE_BASE_URL,
|
|
153
|
+
];
|
|
154
|
+
for (const candidate of candidates) {
|
|
155
|
+
const override = String(candidate || "").trim();
|
|
156
|
+
if (override) {
|
|
157
|
+
return ensureTrailingSlash(override);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return "";
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function hasExplicitReleaseBase(env = process.env) {
|
|
164
|
+
return Boolean(explicitReleaseBase(env));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function isCnbSupportedTarget(
|
|
168
|
+
rawPlatform = os.platform(),
|
|
169
|
+
arch = os.arch(),
|
|
170
|
+
) {
|
|
171
|
+
const platform = PLATFORM_ALIASES[rawPlatform] || rawPlatform;
|
|
172
|
+
return platform === "linux" && arch === "x64";
|
|
173
|
+
}
|
|
174
|
+
|
|
131
175
|
function releaseBaseUrl(version, repo = "Hmbown/CodeWhale") {
|
|
132
176
|
// CODEWHALE_RELEASE_BASE_URL is the canonical override.
|
|
133
177
|
// 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;
|
|
178
|
+
const override = explicitReleaseBase();
|
|
138
179
|
if (override) {
|
|
139
|
-
|
|
140
|
-
return trimmed.endsWith("/") ? trimmed : `${trimmed}/`;
|
|
180
|
+
return override;
|
|
141
181
|
}
|
|
142
182
|
// When CODEWHALE_USE_CNB_MIRROR is set, use the CNB (China-friendly)
|
|
143
183
|
// mirror that already builds and publishes binary release assets.
|
|
144
184
|
if (usesCnbMirror()) {
|
|
145
185
|
assertCnbMirrorSupportedPlatform();
|
|
146
|
-
return
|
|
186
|
+
return cnbReleaseBaseUrl(version);
|
|
147
187
|
}
|
|
148
|
-
return
|
|
188
|
+
return githubReleaseBaseUrl(version, repo);
|
|
149
189
|
}
|
|
150
190
|
|
|
151
191
|
function usesCnbMirror(env = process.env) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
192
|
+
return !hasExplicitReleaseBase(env) && env.CODEWHALE_USE_CNB_MIRROR === "1";
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function shouldRaceFirstPartyMirrors(
|
|
196
|
+
env = process.env,
|
|
197
|
+
rawPlatform = os.platform(),
|
|
198
|
+
arch = os.arch(),
|
|
199
|
+
) {
|
|
200
|
+
return (
|
|
201
|
+
isCnbSupportedTarget(rawPlatform, arch) &&
|
|
202
|
+
!hasExplicitReleaseBase(env) &&
|
|
203
|
+
env.CODEWHALE_USE_CNB_MIRROR !== "1"
|
|
156
204
|
);
|
|
157
|
-
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function firstPartyReleaseSources(version, repo = "Hmbown/CodeWhale") {
|
|
208
|
+
return [
|
|
209
|
+
{
|
|
210
|
+
id: "github",
|
|
211
|
+
label: "GitHub Releases",
|
|
212
|
+
baseUrl: githubReleaseBaseUrl(version, repo),
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: "cnb",
|
|
216
|
+
label: "CNB first-party mirror",
|
|
217
|
+
baseUrl: cnbReleaseBaseUrl(version),
|
|
218
|
+
},
|
|
219
|
+
];
|
|
158
220
|
}
|
|
159
221
|
|
|
160
222
|
function assertCnbMirrorSupportedPlatform(
|
|
161
223
|
rawPlatform = os.platform(),
|
|
162
224
|
arch = os.arch(),
|
|
163
225
|
) {
|
|
164
|
-
|
|
165
|
-
if (platform === "linux" && arch === "x64") {
|
|
226
|
+
if (isCnbSupportedTarget(rawPlatform, arch)) {
|
|
166
227
|
return;
|
|
167
228
|
}
|
|
168
229
|
throw new Error(
|
|
@@ -174,7 +235,7 @@ function assertCnbMirrorSupportedPlatform(
|
|
|
174
235
|
}
|
|
175
236
|
|
|
176
237
|
function releaseAssetUrl(baseName, version, repo = "Hmbown/CodeWhale") {
|
|
177
|
-
return
|
|
238
|
+
return releaseAssetUrlFromBase(baseName, releaseBaseUrl(version, repo));
|
|
178
239
|
}
|
|
179
240
|
|
|
180
241
|
function checksumManifestUrl(version, repo = "Hmbown/CodeWhale") {
|
|
@@ -221,12 +282,20 @@ module.exports = {
|
|
|
221
282
|
CNB_BINARY_ASSET_NAMES,
|
|
222
283
|
CNB_RELEASE_ASSET_NAMES,
|
|
223
284
|
checksumManifestUrl,
|
|
285
|
+
cnbReleaseBaseUrl,
|
|
224
286
|
detectBinaryNames,
|
|
225
287
|
executableName,
|
|
288
|
+
explicitReleaseBase,
|
|
289
|
+
firstPartyReleaseSources,
|
|
290
|
+
githubReleaseBaseUrl,
|
|
291
|
+
hasExplicitReleaseBase,
|
|
292
|
+
isCnbSupportedTarget,
|
|
226
293
|
LEGACY_TUI_BRIDGE_ASSET_NAMES,
|
|
227
294
|
releaseAssetUrl,
|
|
295
|
+
releaseAssetUrlFromBase,
|
|
228
296
|
releaseBaseUrl,
|
|
229
297
|
releaseBinaryDirectory,
|
|
298
|
+
shouldRaceFirstPartyMirrors,
|
|
230
299
|
usesCnbMirror,
|
|
231
300
|
WINDOWS_INSTALLER_ASSET,
|
|
232
301
|
};
|