@wirecat/cli-base 0.125.2 → 0.125.3

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/CHANGELOG.md CHANGED
@@ -8,6 +8,15 @@ Versions before 0.8.0 are in the [git tags](https://github.com/WireCatLabs/cli-b
8
8
  Every entry says what changed as a caller sees it, why, and what to watch for — the rules are
9
9
  [`docs/dev/CONVENTIONS.md`](docs/dev/CONVENTIONS.md#the-changelog).
10
10
 
11
+ ## 0.125.3 — 21.11.2026
12
+
13
+ ### Fixed
14
+
15
+ - **`cli-dev audit --family` installs again when the registry drops the connection.** npm's `--fetch-retries` does
16
+ not cover a download cut off midway (`read ECONNRESET`), and about half the family installs failed that way. A
17
+ network error now tries the install up to three times; any other error, such as a package npm does not have,
18
+ fails at once as before.
19
+
11
20
  ## 0.125.2 — 21.11.2026
12
21
 
13
22
  ### Security
@@ -1,3 +1,4 @@
1
+ import type { SpawnSyncReturns } from "node:child_process";
1
2
  import type { ParityGroup } from "../standards/audit.js";
2
3
  /** Every other CLI of the parity groups that npm has, by name. */
3
4
  export declare const familyPackages: (groups: readonly ParityGroup[], own: string) => Map<string, string>;
@@ -7,4 +8,4 @@ export interface Family {
7
8
  close: () => void;
8
9
  }
9
10
  /** Installs the latest published `packages` into a folder of their own, without their install scripts. */
10
- export declare const installFamily: (packages: ReadonlyMap<string, string>) => Family;
11
+ export declare const installFamily: (packages: ReadonlyMap<string, string>, install?: (args: string[]) => SpawnSyncReturns<string>, wait?: number) => Family;
@@ -18,11 +18,15 @@ export const familyPackages = (groups, own) => new Map([...new Set(groups.flatMa
18
18
  .filter((name) => name !== own && PACKAGES.has(name))
19
19
  .sort()
20
20
  .map((name) => [name, PACKAGES.get(name)]));
21
+ // `--fetch-retries` covers a refused request, not a connection the registry drops mid-download: about half the
22
+ // installs of eight CLIs failed that way on 2026-11-19 and 2026-11-21 (`read ECONNRESET`).
23
+ const NETWORK = /^npm error network |\b(ECONNRESET|ETIMEDOUT|EAI_AGAIN|ECONNREFUSED|EPIPE|ENETUNREACH)\b/m;
24
+ const ATTEMPTS = 3;
21
25
  /** Installs the latest published `packages` into a folder of their own, without their install scripts. */
22
- export const installFamily = (packages) => {
26
+ export const installFamily = (packages, install = (args) => spawn.sync("npm", args, { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 }), wait = 3000) => {
23
27
  const prefix = mkdtempSync(join(tmpdir(), "cli-dev-family-"));
24
28
  const close = () => rmSync(prefix, { recursive: true, force: true });
25
- const run = spawn.sync("npm", [
29
+ const args = [
26
30
  "install",
27
31
  "--global",
28
32
  "--prefix",
@@ -35,7 +39,13 @@ export const installFamily = (packages) => {
35
39
  "--fetch-retries",
36
40
  "6",
37
41
  ...packages.values(),
38
- ], { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 });
42
+ ];
43
+ let run = install(args);
44
+ for (let attempt = 1; attempt < ATTEMPTS && run.status !== 0 && NETWORK.test(String(run.stderr)); attempt++) {
45
+ // A connection the registry dropped under load is often dropped again at once.
46
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, wait);
47
+ run = install(args);
48
+ }
39
49
  if (run.error || run.status !== 0) {
40
50
  close();
41
51
  throw new Error(`npm install of the family failed: ${run.error?.message ?? String(run.stderr).trim()}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-base",
3
- "version": "0.125.2",
3
+ "version": "0.125.3",
4
4
  "description": "The parts every command line tool needs: output modes, terminal rendering, error model, exit codes, credentials, clocks",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",