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/scripts/run.js CHANGED
@@ -9,6 +9,9 @@ function isVersionFlag(args = process.argv.slice(2)) {
9
9
 
10
10
  function printVersionFallback(binaryName) {
11
11
  const binVersion =
12
+ process.env.CODEWHALE_VERSION ||
13
+ process.env.DEEPSEEK_TUI_VERSION ||
14
+ process.env.DEEPSEEK_VERSION ||
12
15
  pkg.codewhaleBinaryVersion || pkg.deepseekBinaryVersion || pkg.version;
13
16
  console.log(`${binaryName} (npm wrapper) v${pkg.version}`);
14
17
  console.log(`binary version: v${binVersion}`);
@@ -16,6 +16,7 @@ const pkg = require("../package.json");
16
16
 
17
17
  function resolveBinaryVersion() {
18
18
  const configuredVersion =
19
+ process.env.CODEWHALE_VERSION ||
19
20
  process.env.DEEPSEEK_TUI_VERSION ||
20
21
  process.env.DEEPSEEK_VERSION ||
21
22
  pkg.codewhaleBinaryVersion || pkg.deepseekBinaryVersion ||
@@ -24,7 +25,12 @@ function resolveBinaryVersion() {
24
25
  }
25
26
 
26
27
  function resolveRepo() {
27
- return process.env.DEEPSEEK_TUI_GITHUB_REPO || process.env.DEEPSEEK_GITHUB_REPO || "Hmbown/CodeWhale";
28
+ return (
29
+ process.env.CODEWHALE_GITHUB_REPO ||
30
+ process.env.DEEPSEEK_TUI_GITHUB_REPO ||
31
+ process.env.DEEPSEEK_GITHUB_REPO ||
32
+ "Hmbown/CodeWhale"
33
+ );
28
34
  }
29
35
 
30
36
  function hasReleaseBaseOverride() {
@@ -30,13 +30,20 @@ async function exists(file) {
30
30
  }
31
31
 
32
32
  async function withoutForcedDownload(callback) {
33
+ const previousCodewhale = process.env.CODEWHALE_FORCE_DOWNLOAD;
33
34
  const previousTui = process.env.DEEPSEEK_TUI_FORCE_DOWNLOAD;
34
35
  const previousLegacy = process.env.DEEPSEEK_FORCE_DOWNLOAD;
36
+ delete process.env.CODEWHALE_FORCE_DOWNLOAD;
35
37
  delete process.env.DEEPSEEK_TUI_FORCE_DOWNLOAD;
36
38
  delete process.env.DEEPSEEK_FORCE_DOWNLOAD;
37
39
  try {
38
40
  return await callback();
39
41
  } finally {
42
+ if (previousCodewhale === undefined) {
43
+ delete process.env.CODEWHALE_FORCE_DOWNLOAD;
44
+ } else {
45
+ process.env.CODEWHALE_FORCE_DOWNLOAD = previousCodewhale;
46
+ }
40
47
  if (previousTui === undefined) {
41
48
  delete process.env.DEEPSEEK_TUI_FORCE_DOWNLOAD;
42
49
  } else {
@@ -84,7 +91,7 @@ test("install failure hint explains release base override for blocked GitHub dow
84
91
 
85
92
  const hint = installFailureHint(error);
86
93
 
87
- assert.match(hint, /DEEPSEEK_TUI_RELEASE_BASE_URL/);
94
+ assert.match(hint, /CODEWHALE_RELEASE_BASE_URL/);
88
95
  assert.match(hint, /codewhale-artifacts-sha256\.txt/);
89
96
  assert.match(hint, /platform binaries/);
90
97
  assert.match(hint, /#npm-binary-download-times-out/);
@@ -107,7 +114,7 @@ test("install failure hint checks configured release base when override is alrea
107
114
 
108
115
  const hint = installFailureHint(error);
109
116
 
110
- assert.match(hint, /is set to https:\/\/mirror\.example\/deepseek\//);
117
+ assert.match(hint, /resolves to https:\/\/mirror\.example\/deepseek\//);
111
118
  assert.match(hint, /codewhale-artifacts-sha256\.txt/);
112
119
  assert.doesNotMatch(hint, /If GitHub is unavailable/);
113
120
  } finally {
@@ -256,6 +263,18 @@ test("resolvePackageVersion honors codewhaleBinaryVersion precedence (#3769)", (
256
263
  );
257
264
  assert.equal(resolvePackageVersion({ version: "9.9.9" }, {}), "9.9.9");
258
265
 
266
+ assert.equal(
267
+ resolvePackageVersion(
268
+ { codewhaleBinaryVersion: "1.2.3" },
269
+ {
270
+ CODEWHALE_VERSION: "6.6.6",
271
+ DEEPSEEK_TUI_VERSION: "7.7.7",
272
+ DEEPSEEK_VERSION: "8.8.8",
273
+ },
274
+ ),
275
+ "6.6.6",
276
+ );
277
+
259
278
  // Legacy env vars still take precedence over package fields, unchanged.
260
279
  assert.equal(
261
280
  resolvePackageVersion(
@@ -273,6 +292,49 @@ test("resolvePackageVersion honors codewhaleBinaryVersion precedence (#3769)", (
273
292
  );
274
293
  });
275
294
 
295
+ test("canonical Codewhale installer variables outrank legacy aliases", () => {
296
+ assert.equal(
297
+ _internal.resolveRepo({
298
+ CODEWHALE_GITHUB_REPO: "example/codewhale",
299
+ DEEPSEEK_TUI_GITHUB_REPO: "legacy/tui",
300
+ DEEPSEEK_GITHUB_REPO: "legacy/root",
301
+ }),
302
+ "example/codewhale",
303
+ );
304
+ assert.equal(
305
+ _internal.isOptionalInstall([], {
306
+ CODEWHALE_OPTIONAL_INSTALL: "1",
307
+ }),
308
+ true,
309
+ );
310
+ assert.equal(
311
+ _internal.isQuietInstall({ CODEWHALE_QUIET_INSTALL: "1" }),
312
+ true,
313
+ );
314
+ assert.equal(
315
+ _internal.shouldForceDownload({ CODEWHALE_FORCE_DOWNLOAD: "1" }),
316
+ true,
317
+ );
318
+ assert.equal(
319
+ _internal.shouldDisableInstall({ CODEWHALE_DISABLE_INSTALL: "1" }),
320
+ true,
321
+ );
322
+ assert.equal(
323
+ _internal.downloadTimeoutMs("runtime", {
324
+ CODEWHALE_DOWNLOAD_TIMEOUT_MS: "1234",
325
+ DEEPSEEK_TUI_DOWNLOAD_TIMEOUT_MS: "9999",
326
+ }),
327
+ 1234,
328
+ );
329
+ assert.equal(
330
+ _internal.downloadStallMs("runtime", {
331
+ CODEWHALE_DOWNLOAD_STALL_MS: "5678",
332
+ DEEPSEEK_TUI_DOWNLOAD_STALL_MS: "9999",
333
+ }),
334
+ 5678,
335
+ );
336
+ });
337
+
276
338
  test("httpRequest handles invalid URL parsing errors", async () => {
277
339
  const { httpRequest } = _internal;
278
340
  const invalidUrl = "not-a-valid-url";
@@ -11,6 +11,7 @@ test("postinstall opts into optional install mode", () => {
11
11
  test("optional install can be enabled by command-line flag or env", () => {
12
12
  assert.equal(_internal.isOptionalInstall(["--optional"], {}), true);
13
13
  assert.equal(_internal.isOptionalInstall([], {}), false);
14
+ assert.equal(_internal.isOptionalInstall([], { CODEWHALE_OPTIONAL_INSTALL: "1" }), true);
14
15
  assert.equal(_internal.isOptionalInstall([], { DEEPSEEK_TUI_OPTIONAL_INSTALL: "1" }), true);
15
16
  assert.equal(_internal.isOptionalInstall([], { DEEPSEEK_OPTIONAL_INSTALL: "1" }), true);
16
17
  });