@socketsecurity/lib 6.0.4 → 6.0.6

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.
Files changed (211) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/ai/discover.js +3 -2
  3. package/dist/ai/spawn.js +8 -5
  4. package/dist/ai/worktree.js +11 -6
  5. package/dist/ansi/strip.js +2 -2
  6. package/dist/archives/_internal.js +4 -4
  7. package/dist/archives/zip.js +1 -1
  8. package/dist/arrays/_internal.js +2 -2
  9. package/dist/arrays/chunk.js +1 -1
  10. package/dist/arrays/join.js +2 -2
  11. package/dist/arrays/unique.js +1 -1
  12. package/dist/bin/acorn-bindgen.cjs +769 -0
  13. package/dist/bin/acorn.wasm +0 -0
  14. package/dist/bin/check-primordials.js +3 -2
  15. package/dist/bin/check.js +3 -2
  16. package/dist/bin/exec.js +1 -1
  17. package/dist/bin/prim.cjs +39064 -0
  18. package/dist/bin/resolve.js +1 -1
  19. package/dist/colors/socket-palette.js +2 -2
  20. package/dist/compression/_internal.js +3 -2
  21. package/dist/compression/brotli.js +5 -12
  22. package/dist/compression/gzip.js +5 -13
  23. package/dist/constants/agents.js +4 -4
  24. package/dist/constants/packages.js +6 -6
  25. package/dist/constants/socket.js +1 -1
  26. package/dist/crypto/hash.js +2 -2
  27. package/dist/debug/_internal.js +2 -2
  28. package/dist/debug/caller-info.js +1 -1
  29. package/dist/debug/namespace.js +5 -5
  30. package/dist/debug/output.js +3 -3
  31. package/dist/dlx/binary-download.js +3 -2
  32. package/dist/eco/npm/npm/flags.js +5 -5
  33. package/dist/eco/npm/pnpm/flags.js +3 -3
  34. package/dist/env/boolean.js +1 -1
  35. package/dist/env/ci.js +1 -1
  36. package/dist/env/debug.js +1 -1
  37. package/dist/env/github.js +8 -8
  38. package/dist/env/home.js +1 -1
  39. package/dist/env/locale.js +3 -3
  40. package/dist/env/node-auth-token.js +1 -1
  41. package/dist/env/node-env.js +1 -1
  42. package/dist/env/npm.js +5 -5
  43. package/dist/env/number.js +1 -1
  44. package/dist/env/package-manager.js +3 -3
  45. package/dist/env/path.js +1 -1
  46. package/dist/env/pre-commit.js +1 -1
  47. package/dist/env/rewire.js +2 -2
  48. package/dist/env/shell.js +1 -1
  49. package/dist/env/socket-cli.js +13 -13
  50. package/dist/env/socket.js +33 -32
  51. package/dist/env/string.js +1 -1
  52. package/dist/env/temp-dir.js +3 -3
  53. package/dist/env/term.js +1 -1
  54. package/dist/env/test.js +3 -3
  55. package/dist/env/windows.js +4 -4
  56. package/dist/env/xdg.js +3 -3
  57. package/dist/events/exit/_internal.js +5 -5
  58. package/dist/events/exit/handler.js +1 -1
  59. package/dist/events/exit/intercept.js +2 -2
  60. package/dist/events/exit/lifecycle.js +3 -3
  61. package/dist/events/exit/signals.js +1 -1
  62. package/dist/external/@sinclair/typebox/value.js +5 -1
  63. package/dist/external/@sinclair/typebox.js +5 -1
  64. package/dist/external/@socketregistry/packageurl-js.js +27 -0
  65. package/dist/external-tools/bazel/resolve.js +2 -1
  66. package/dist/external-tools/cdxgen/resolve.js +2 -1
  67. package/dist/external-tools/from-pip-venv.d.ts +73 -0
  68. package/dist/external-tools/from-pip-venv.js +98 -0
  69. package/dist/external-tools/janus/asset-names.js +1 -1
  70. package/dist/external-tools/janus/from-download.js +3 -5
  71. package/dist/external-tools/janus/resolve.js +2 -1
  72. package/dist/external-tools/jre/from-download.js +2 -1
  73. package/dist/external-tools/jre/resolve.js +2 -1
  74. package/dist/external-tools/manifest.js +7 -5
  75. package/dist/external-tools/opengrep/resolve.js +2 -1
  76. package/dist/external-tools/sbt/resolve.js +2 -1
  77. package/dist/external-tools/skillspector/from-dlx.d.ts +24 -0
  78. package/dist/external-tools/skillspector/from-dlx.js +41 -0
  79. package/dist/external-tools/skillspector/from-path.d.ts +8 -0
  80. package/dist/external-tools/skillspector/from-path.js +32 -0
  81. package/dist/external-tools/skillspector/from-vfs.d.ts +8 -0
  82. package/dist/external-tools/skillspector/from-vfs.js +27 -0
  83. package/dist/external-tools/skillspector/resolve.d.ts +34 -0
  84. package/dist/external-tools/skillspector/resolve.js +53 -0
  85. package/dist/external-tools/skillspector/types.d.ts +24 -0
  86. package/dist/external-tools/skillspector/types.js +2 -0
  87. package/dist/external-tools/synp/resolve.js +2 -1
  88. package/dist/external-tools/trivy/resolve.js +2 -1
  89. package/dist/external-tools/trufflehog/resolve.js +2 -1
  90. package/dist/external-tools/uv/resolve.js +2 -1
  91. package/dist/fs/access.js +4 -4
  92. package/dist/fs/encoding.js +2 -2
  93. package/dist/fs/find-up.js +2 -2
  94. package/dist/fs/inspect.js +6 -6
  95. package/dist/fs/read-dir.js +3 -3
  96. package/dist/fs/read-file.js +6 -6
  97. package/dist/fs/read-json.js +2 -2
  98. package/dist/fs/safe.js +2 -2
  99. package/dist/fs/unique.js +1 -1
  100. package/dist/fs/validate.js +1 -1
  101. package/dist/fs/write-json.js +1 -1
  102. package/dist/git/_internal.js +2 -1
  103. package/dist/globs/_internal.js +4 -4
  104. package/dist/globs/match.js +4 -3
  105. package/dist/globs/matcher.js +3 -3
  106. package/dist/globs/stream.js +1 -1
  107. package/dist/http-request/browser.js +17 -11
  108. package/dist/http-request/download.js +1 -1
  109. package/dist/http-request/headers.d.ts +32 -3
  110. package/dist/http-request/headers.js +42 -13
  111. package/dist/http-request/request-attempt.js +1 -0
  112. package/dist/http-request/request-types.d.ts +5 -0
  113. package/dist/http-request/request.js +32 -15
  114. package/dist/http-request/response-reader.d.ts +12 -1
  115. package/dist/http-request/response-reader.js +22 -2
  116. package/dist/http-request/user-agent.js +1 -1
  117. package/dist/json/edit.js +1 -1
  118. package/dist/json/parse.js +4 -4
  119. package/dist/logger/colors.js +2 -2
  120. package/dist/logger/console.js +1 -1
  121. package/dist/logger/node.js +0 -1
  122. package/dist/logger/symbols.js +1 -1
  123. package/dist/node/async-hooks.js +2 -2
  124. package/dist/node/child-process.js +2 -2
  125. package/dist/node/crypto.js +2 -2
  126. package/dist/node/events.js +2 -2
  127. package/dist/node/fs-promises.js +2 -2
  128. package/dist/node/fs.js +2 -2
  129. package/dist/node/http.js +2 -2
  130. package/dist/node/https.js +2 -2
  131. package/dist/node/module.js +3 -3
  132. package/dist/node/os.js +2 -2
  133. package/dist/node/path.js +2 -2
  134. package/dist/node/timers-promises.js +2 -2
  135. package/dist/node/url.js +2 -2
  136. package/dist/node/util.js +2 -2
  137. package/dist/objects/getters.js +2 -2
  138. package/dist/objects/inspect.js +3 -3
  139. package/dist/objects/mutate.js +1 -1
  140. package/dist/objects/predicates.js +4 -4
  141. package/dist/objects/sort.js +4 -4
  142. package/dist/packages/edit-class.js +1 -1
  143. package/dist/packages/edit.js +2 -2
  144. package/dist/packages/exports.js +6 -6
  145. package/dist/packages/licenses.js +8 -8
  146. package/dist/packages/manifest.js +3 -3
  147. package/dist/packages/normalize.js +4 -4
  148. package/dist/packages/operations.js +11 -11
  149. package/dist/packages/provenance.d.ts +6 -0
  150. package/dist/packages/provenance.js +12 -3
  151. package/dist/packages/specs.js +5 -5
  152. package/dist/packages/validation.js +3 -3
  153. package/dist/paths/_internal.js +3 -3
  154. package/dist/paths/conversion.js +4 -4
  155. package/dist/paths/normalize.js +3 -1
  156. package/dist/paths/packages.js +3 -3
  157. package/dist/paths/predicates.js +7 -7
  158. package/dist/paths/resolve.js +3 -3
  159. package/dist/process/spawn/_internal.js +3 -3
  160. package/dist/process/spawn/errors.js +2 -2
  161. package/dist/process/spawn/stdio.js +1 -1
  162. package/dist/promises/_internal.js +1 -1
  163. package/dist/promises/iterate.js +5 -5
  164. package/dist/promises/options.js +3 -3
  165. package/dist/promises/retry.js +1 -1
  166. package/dist/secrets/_internal.js +3 -2
  167. package/dist/secrets/keychain.js +5 -4
  168. package/dist/secrets/linux.js +6 -4
  169. package/dist/secrets/macos.js +5 -3
  170. package/dist/secrets/rc.js +9 -6
  171. package/dist/secrets/windows.js +7 -4
  172. package/dist/shell/parse.d.ts +108 -1
  173. package/dist/shell/parse.js +168 -2
  174. package/dist/smol/detect.js +1 -1
  175. package/dist/smol/http.js +1 -1
  176. package/dist/smol/https.js +1 -1
  177. package/dist/smol/manifest.js +1 -1
  178. package/dist/smol/path.js +1 -1
  179. package/dist/smol/primordial.js +1 -1
  180. package/dist/smol/purl.js +1 -1
  181. package/dist/smol/versions.js +1 -1
  182. package/dist/smol/vfs.js +1 -1
  183. package/dist/sorts/_internal.js +4 -4
  184. package/dist/sorts/natural.js +3 -3
  185. package/dist/sorts/semver.js +1 -1
  186. package/dist/sorts/strings.js +1 -1
  187. package/dist/spinner/default.js +1 -1
  188. package/dist/spinner/spinner.js +1 -1
  189. package/dist/ssri/convert.js +2 -2
  190. package/dist/ssri/parse.js +1 -1
  191. package/dist/ssri/validate.js +2 -2
  192. package/dist/stdio/prompts.js +1 -1
  193. package/dist/streams/parallel.js +2 -2
  194. package/dist/streams/transform.js +1 -1
  195. package/dist/strings/format.js +4 -4
  196. package/dist/strings/predicates.js +2 -2
  197. package/dist/strings/search.js +1 -1
  198. package/dist/strings/transform.js +3 -3
  199. package/dist/strings/width.js +3 -3
  200. package/dist/temporal/instant.js +4 -2
  201. package/dist/temporal/slots.js +3 -2
  202. package/dist/themes/context.js +2 -2
  203. package/dist/url/parse.js +2 -2
  204. package/dist/url/predicates.js +1 -1
  205. package/dist/url/search-params.js +6 -6
  206. package/dist/words/article.js +1 -1
  207. package/dist/words/capitalize.js +1 -1
  208. package/dist/words/pluralize.d.ts +24 -2
  209. package/dist/words/pluralize.js +37 -2
  210. package/dist/words/types.d.ts +25 -2
  211. package/package.json +45 -5
package/CHANGELOG.md CHANGED
@@ -5,6 +5,30 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [6.0.6](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.6) - 2026-06-01
9
+
10
+ ### Added
11
+
12
+ - **`http-request` now negotiates and decompresses `gzip` / `br` response bodies.** Buffered requests advertise `Accept-Encoding: gzip, br` and transparently decompress responses by `Content-Encoding`. Node's HTTP client does neither, so a compressed Socket API response previously reached callers as raw deflated bytes. Streamed requests (`stream: true`, e.g. `httpDownload`) intentionally skip the `Accept-Encoding` header so piped-to-disk payloads stay raw and checksum cleanly. Callers can override (e.g. `'identity'`).
13
+ - **`http-request/headers` — `basicAuthHeader(token)`.** Builds the Socket API Basic-auth shape (token-as-username, empty password) so call sites stop hand-rolling `Basic ${base64(token + ':')}`.
14
+ - **`http-request` retry instrumentation.** Adds `Retry-Attempt`, `Retry-Max`, and `Retry-After` request headers on retried attempts so server-side logs can correlate a retry chain.
15
+ - **`prim` CLI bin.** `prim` is now published as a `bin` entry (`dist/bin/prim.cjs`); installs from `@socketsecurity/lib` make `npx prim` work. Also new in this release: `prim --diff` for unified line-diffs in dry-run mode, multi-hop cycle detection in `validateRewrites`, and a two-phase apply with cross-batch validation.
16
+ - **`sanitizeHeaders` shape-based redaction.** `isSensitiveHeaderName` regex (`auth | cookie | credential | key | password | secret | token`) covers custom token headers (`x-amz-security-token`, `api-key`, …) without an explicit allowlist. Same reasoning as "a denylist is itself a leak."
17
+ - **`packages/provenance` — staged-publish detection.** `getTrustStatus` now reads `_npmUser.approver` and surfaces `stagedPublish: true` when a registry version was promoted out of staging via the 2FA-gated approve step (pnpm/pnpm#12056). Adds a new top tier to the trust ladder: `stagedPublish` ranks above `trustedPublisher` and `provenance`. The `TRUST_LEVELS` tuple (`'none' | 'provenance' | 'trustedPublisher' | 'stagedPublish'`), `getTrustLevel`, `getTrustLevelName`, `compareTrust`, and `didTrustDecrease` all extend to level 3.
18
+ - **`words/pluralize` — `Intl.PluralRules` dictionary mode.** New `options.forms` accepts a `{ singular?, plural, zero?, two?, few?, many? }` dictionary keyed by CLDR plural category for locale-aware pluralization of irregulars and non-English counts. `singular` and `plural` map to CLDR's `one` and `other`; the remaining four are optional and fall back to `plural`. New `options.locale` (BCP 47, default `'en-US'`) and `options.type` (`'cardinal' | 'ordinal'`, default `'cardinal'`) configure the underlying `Intl.PluralRules`. Defaults are unchanged — `pluralize('file', { count: n })` still uses the simple `+s` rule with zero `Intl` cost. Cache reuses one `Intl.PluralRules` instance per `<locale>:<type>` pair.
19
+ - **`external-tools/from-pip-venv` — generic Python-package install helper.** Two functions: `createPipVenv({ cacheDir, entryPoint, installSpec })` creates a venv (`python -m venv --clear`) + runs `pip install <spec>` inside it, returning the entry-point binary path. Idempotent: hits the existing venv when its entry-point already exists. `findPython()` locates `python3` (or `python` on Windows) on PATH. Parallel to `from-download.ts` — that one handles single-binary tools from GitHub releases; this handles Python packages from PyPI or git.
20
+ - **`external-tools/skillspector` — resolver for [NVIDIA SkillSpector](https://github.com/NVIDIA/skillspector).** Third-party-skill security scanner; sibling to AgentShield in fleet security tooling. 4-tier resolution (VFS → PATH → DLX-venv → fail) matching the canonical shape used by `external-tools/uv/`. PATH tier distinguishes pipx-installed binaries (`source: 'pipx'`) from plain PATH binaries (`source: 'path'`). DLX-venv tier composes `from-pip-venv` against the pinned upstream git SHA — upstream has no PyPI release or GH tags as of 2026-06-01.
21
+
22
+ ### Fixed
23
+
24
+ - **`walkUp` emits `D:/` not `D:` at a Windows drive root.** `normalizePath('D:\\')` collapses the trailing separator to `D:` — correct in general (where `D:` means current dir on the `D:` drive), wrong for the filesystem root `walkUp` must yield. A new `normalizeWalkDir` helper preserves the root slash on bare drive letters and defers to `normalizePath` everywhere else.
25
+
26
+ ## [6.0.5](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.5) - 2026-05-28
27
+
28
+ ### Fixed
29
+
30
+ - **`/*@__PURE__*/` annotations in three modules** were positioned where rolldown (and any bundler honoring tree-shaking pure-call hints) ignored them, emitting `INVALID_ANNOTATION` warnings during downstream builds. The annotations are now adjacent to their `require()` call expressions in `globs/matcher` (`getMatchesGlob`'s `path.matchesGlob` probe) and `strings/width` (`getEastAsianWidth`'s lazy load). A stale `/*@__PURE__*/` on the `Logger` class declaration in `logger/node` was removed — class declarations are not call expressions and the annotation was being silently dropped.
31
+
8
32
  ## [6.0.4](https://github.com/SocketDev/socket-lib/releases/tag/v6.0.4) - 2026-05-28
9
33
 
10
34
  ### Added
@@ -2,6 +2,7 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
+ const require_primordials_date = require('../primordials/date.js');
5
6
  const require_primordials_json = require('../primordials/json.js');
6
7
  const require_bin_which = require('../bin/which.js');
7
8
  const require_errors_message = require('../errors/message.js');
@@ -93,7 +94,7 @@ function readDiskCache(cachePath) {
93
94
  if (!(0, node_fs.existsSync)(cachePath)) return;
94
95
  try {
95
96
  const parsed = require_primordials_json.JSONParse((0, node_fs.readFileSync)(cachePath, "utf8"));
96
- if (typeof parsed !== "object" || parsed === null || typeof parsed.writtenAt !== "number" || Date.now() - parsed.writtenAt > CACHE_TTL_MS) return;
97
+ if (typeof parsed !== "object" || parsed === null || typeof parsed.writtenAt !== "number" || require_primordials_date.DateNow() - parsed.writtenAt > CACHE_TTL_MS) return;
97
98
  return parsed.agents;
98
99
  } catch {
99
100
  return;
@@ -111,7 +112,7 @@ async function writeDiskCache(cachePath, agents) {
111
112
  await (0, node_fs_promises.mkdir)(node_path.default.dirname(cachePath), { recursive: true });
112
113
  (0, node_fs.writeFileSync)(cachePath, require_primordials_json.JSONStringify({
113
114
  agents,
114
- writtenAt: Date.now()
115
+ writtenAt: require_primordials_date.DateNow()
115
116
  }, void 0, 2) + "\n");
116
117
  } catch (e) {
117
118
  logger.error(`discoverAiAgents: cache write failed (${require_errors_message.errorMessage(e)})`);
package/dist/ai/spawn.js CHANGED
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_primordials_error = require('../primordials/error.js');
5
+ const require_primordials_date = require('../primordials/date.js');
4
6
  const require_primordials_object = require('../primordials/object.js');
5
7
  const require_errors_message = require('../errors/message.js');
6
8
  const require_ai_discover = require('./discover.js');
7
9
  const require_process_spawn_errors = require('../process/spawn/errors.js');
8
10
  const require_process_spawn_child = require('../process/spawn/child.js');
11
+ const require_primordials_promise = require('../primordials/promise.js');
9
12
 
10
13
  //#region src/ai/spawn.mts
11
14
  /**
@@ -98,7 +101,7 @@ function isOverloaded(stdout, stderr) {
98
101
  async function pickAgent(requested, cwd) {
99
102
  const discovered = await require_ai_discover.discoverAiAgents({ repoRoot: cwd });
100
103
  if (requested) {
101
- if (!(requested in discovered)) throw new Error(`spawnAiAgent: requested agent "${requested}" is not on PATH. Install the CLI or pass a different agent. Discovered: ${require_primordials_object.ObjectKeys(discovered).join(", ") || "(none)"}`);
104
+ if (!(requested in discovered)) throw new require_primordials_error.ErrorCtor(`spawnAiAgent: requested agent "${requested}" is not on PATH. Install the CLI or pass a different agent. Discovered: ${require_primordials_object.ObjectKeys(discovered).join(", ") || "(none)"}`);
102
105
  return requested;
103
106
  }
104
107
  if ("claude" in discovered) return "claude";
@@ -107,7 +110,7 @@ async function pickAgent(requested, cwd) {
107
110
  "opencode",
108
111
  "gemini"
109
112
  ]) if (candidate in discovered) return candidate;
110
- throw new Error("spawnAiAgent: no AI agent CLI on PATH. Install one of: claude, codex, opencode, gemini.");
113
+ throw new require_primordials_error.ErrorCtor("spawnAiAgent: no AI agent CLI on PATH. Install one of: claude, codex, opencode, gemini.");
111
114
  }
112
115
  /**
113
116
  * Spawn an AI agent CLI subprocess with the locked-down flag set.
@@ -137,7 +140,7 @@ async function spawnAiAgent(opts) {
137
140
  let stderr = "";
138
141
  let exitCode = 0;
139
142
  let attempts = 0;
140
- const start = Date.now();
143
+ const start = require_primordials_date.DateNow();
141
144
  while (attempts < MAX_ATTEMPTS) {
142
145
  attempts += 1;
143
146
  stdout = "";
@@ -166,11 +169,11 @@ async function spawnAiAgent(opts) {
166
169
  }
167
170
  }
168
171
  if (!isOverloaded(stdout, stderr) || attempts >= MAX_ATTEMPTS) break;
169
- await new Promise((resolve) => setTimeout(resolve, backoffFor(attempts)));
172
+ await new require_primordials_promise.PromiseCtor((resolve) => setTimeout(resolve, backoffFor(attempts)));
170
173
  }
171
174
  return {
172
175
  attempts,
173
- durationMs: Date.now() - start,
176
+ durationMs: require_primordials_date.DateNow() - start,
174
177
  exitCode,
175
178
  stderr,
176
179
  stdout
@@ -2,9 +2,14 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
+ const require_primordials_error = require('../primordials/error.js');
6
+ const require_primordials_math = require('../primordials/math.js');
7
+ const require_primordials_array = require('../primordials/array.js');
8
+ const require_primordials_date = require('../primordials/date.js');
5
9
  const require_errors_message = require('../errors/message.js');
6
10
  const require_process_spawn_errors = require('../process/spawn/errors.js');
7
11
  const require_process_spawn_child = require('../process/spawn/child.js');
12
+ const require_primordials_promise = require('../primordials/promise.js');
8
13
  let node_fs = require("node:fs");
9
14
  let node_path = require("node:path");
10
15
  node_path = require_runtime.__toESM(node_path, 1);
@@ -51,7 +56,7 @@ async function runOne(item, index, worktreeBranch, worktreePath, baseRepo, branc
51
56
  const add = tryGit(baseRepo, "worktree", "add", "-b", worktreeBranch, worktreePath, branch);
52
57
  if (!add.ok) return {
53
58
  cleanup: "kept",
54
- error: /* @__PURE__ */ new Error(`git worktree add failed: ${add.output}`),
59
+ error: new require_primordials_error.ErrorCtor(`git worktree add failed: ${add.output}`),
55
60
  merged: false,
56
61
  status: "rejected",
57
62
  worktreePath
@@ -73,7 +78,7 @@ async function runOne(item, index, worktreeBranch, worktreePath, baseRepo, branc
73
78
  if (error === void 0 && hasCommitted) {
74
79
  const merge = tryGit(baseRepo, "merge", "--ff-only", worktreeBranch);
75
80
  if (merge.ok) merged = true;
76
- else error = /* @__PURE__ */ new Error(`git merge --ff-only failed: ${merge.output}`);
81
+ else error = new require_primordials_error.ErrorCtor(`git merge --ff-only failed: ${merge.output}`);
77
82
  }
78
83
  let didCleanup = "kept";
79
84
  if (error === void 0 && (cleanup === "always" || cleanup === "on-empty" && !hasCommitted && !hasUncommitted)) {
@@ -130,9 +135,9 @@ async function runOne(item, index, worktreeBranch, worktreePath, baseRepo, branc
130
135
  async function spawnAiAgentsInWorktrees(items, fn, options) {
131
136
  const cleanup = options.cleanup ?? "always";
132
137
  const namePrefix = options.namePrefix ?? "agent-task";
133
- const concurrency = Math.max(1, Math.min(options.concurrency ?? DEFAULT_CONCURRENCY, MAX_CONCURRENCY));
138
+ const concurrency = require_primordials_math.MathMax(1, Math.min(options.concurrency ?? DEFAULT_CONCURRENCY, MAX_CONCURRENCY));
134
139
  const baseRepo = options.baseRepo;
135
- if (!(0, node_fs.existsSync)(node_path.default.join(baseRepo, ".git"))) throw new Error(`spawnAiAgentsInWorktrees: baseRepo is not a git checkout: ${baseRepo}`);
140
+ if (!(0, node_fs.existsSync)(node_path.default.join(baseRepo, ".git"))) throw new require_primordials_error.ErrorCtor(`spawnAiAgentsInWorktrees: baseRepo is not a git checkout: ${baseRepo}`);
136
141
  const branch = options.branch ?? currentBranch(baseRepo);
137
142
  const worktreeRoot = options.worktreeRoot ?? node_path.default.join(process.platform === "win32" ? process.env["TEMP"] ?? "." : "/tmp", `${namePrefix}-${Date.now()}`);
138
143
  const settled = [];
@@ -143,10 +148,10 @@ async function spawnAiAgentsInWorktrees(items, fn, options) {
143
148
  cursor += 1;
144
149
  if (idx >= items.length) return;
145
150
  const item = items[idx];
146
- settled[idx] = await runOne(item, idx, `${namePrefix}-${idx}-${Date.now()}`, node_path.default.join(worktreeRoot, `${namePrefix}-${idx}`), baseRepo, branch, cleanup, fn);
151
+ settled[idx] = await runOne(item, idx, `${namePrefix}-${idx}-${require_primordials_date.DateNow()}`, node_path.default.join(worktreeRoot, `${namePrefix}-${idx}`), baseRepo, branch, cleanup, fn);
147
152
  }
148
153
  }
149
- await Promise.all(Array.from({ length: concurrency }, () => worker()));
154
+ await require_primordials_promise.PromiseAll(require_primordials_array.ArrayFrom({ length: concurrency }, () => worker()));
150
155
  return settled;
151
156
  }
152
157
  function tryGit(cwd, ...args) {
@@ -26,7 +26,7 @@ const ANSI_REGEX = /\x1b\[[0-9;]*m/g;
26
26
  * ansiRegex({ onlyFirst: true }) // matches only the first code
27
27
  * ```
28
28
  */
29
- /* @__NO_SIDE_EFFECTS__ */
29
+ /*@__NO_SIDE_EFFECTS__*/
30
30
  function ansiRegex(options) {
31
31
  const { onlyFirst } = options ?? {};
32
32
  return new require_primordials_regexp.RegExpCtor(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`, onlyFirst ? void 0 : "g");
@@ -40,7 +40,7 @@ function ansiRegex(options) {
40
40
  * stripAnsi('\u001b[1mBold\u001b[0m') // 'Bold'
41
41
  * ```
42
42
  */
43
- /* @__NO_SIDE_EFFECTS__ */
43
+ /*@__NO_SIDE_EFFECTS__*/
44
44
  function stripAnsi(text) {
45
45
  return require_primordials_string.StringPrototypeReplace(text, ANSI_REGEX, "");
46
46
  }
@@ -38,14 +38,14 @@ function assertArchiveExists(archivePath) {
38
38
  throw err;
39
39
  }
40
40
  }
41
- /* @__NO_SIDE_EFFECTS__ */
41
+ /*@__NO_SIDE_EFFECTS__*/
42
42
  function getAdmZip() {
43
- if (_AdmZip === void 0) _AdmZip = /* @__PURE__ */ require("../external/adm-zip.js");
43
+ if (_AdmZip === void 0) _AdmZip = /*@__PURE__*/ require("../external/adm-zip.js");
44
44
  return _AdmZip;
45
45
  }
46
- /* @__NO_SIDE_EFFECTS__ */
46
+ /*@__NO_SIDE_EFFECTS__*/
47
47
  function getTarFs() {
48
- if (_tarFs === void 0) _tarFs = /* @__PURE__ */ require("../external/tar-fs.js");
48
+ if (_tarFs === void 0) _tarFs = /*@__PURE__*/ require("../external/tar-fs.js");
49
49
  return _tarFs;
50
50
  }
51
51
  /**
@@ -6,9 +6,9 @@ const require_paths_normalize = require('../paths/normalize.js');
6
6
  const require_primordials_array = require('../primordials/array.js');
7
7
  const require_primordials_map_set = require('../primordials/map-set.js');
8
8
  const require_node_path = require('../node/path.js');
9
+ const require_primordials_promise = require('../primordials/promise.js');
9
10
  const require_archives__internal = require('./_internal.js');
10
11
  const require_fs_safe = require('../fs/safe.js');
11
- const require_primordials_promise = require('../primordials/promise.js');
12
12
 
13
13
  //#region src/archives/zip.ts
14
14
  /**
@@ -28,7 +28,7 @@ let _disjunctionFormatter;
28
28
  * @returns Cached Intl.ListFormat instance configured for conjunction
29
29
  * formatting.
30
30
  */
31
- /* @__NO_SIDE_EFFECTS__ */
31
+ /*@__NO_SIDE_EFFECTS__*/
32
32
  function getConjunctionFormatter() {
33
33
  if (_conjunctionFormatter === void 0)
34
34
  /* c8 ignore start */
@@ -56,7 +56,7 @@ function getConjunctionFormatter() {
56
56
  * @returns Cached Intl.ListFormat instance configured for disjunction
57
57
  * formatting.
58
58
  */
59
- /* @__NO_SIDE_EFFECTS__ */
59
+ /*@__NO_SIDE_EFFECTS__*/
60
60
  function getDisjunctionFormatter() {
61
61
  if (_disjunctionFormatter === void 0)
62
62
  /* c8 ignore start */
@@ -40,7 +40,7 @@ const require_primordials_error = require('../primordials/error.js');
40
40
  *
41
41
  * @throws {Error} If chunk size is less than or equal to 0
42
42
  */
43
- /* @__NO_SIDE_EFFECTS__ */
43
+ /*@__NO_SIDE_EFFECTS__*/
44
44
  function arrayChunk(arr, size) {
45
45
  const chunkSize = size ?? 2;
46
46
  if (chunkSize <= 0) throw new require_primordials_error.ErrorCtor("Chunk size must be greater than 0");
@@ -43,7 +43,7 @@ const require_arrays__internal = require('./_internal.js');
43
43
  *
44
44
  * @returns Formatted string with proper "and" conjunction
45
45
  */
46
- /* @__NO_SIDE_EFFECTS__ */
46
+ /*@__NO_SIDE_EFFECTS__*/
47
47
  function joinAnd(arr) {
48
48
  return (/* @__PURE__ */ require_arrays__internal.getConjunctionFormatter()).format(arr);
49
49
  }
@@ -82,7 +82,7 @@ function joinAnd(arr) {
82
82
  *
83
83
  * @returns Formatted string with proper "or" disjunction
84
84
  */
85
- /* @__NO_SIDE_EFFECTS__ */
85
+ /*@__NO_SIDE_EFFECTS__*/
86
86
  function joinOr(arr) {
87
87
  return (/* @__PURE__ */ require_arrays__internal.getDisjunctionFormatter()).format(arr);
88
88
  }
@@ -39,7 +39,7 @@ const require_primordials_map_set = require('../primordials/map-set.js');
39
39
  *
40
40
  * @returns New array with duplicate values removed
41
41
  */
42
- /* @__NO_SIDE_EFFECTS__ */
42
+ /*@__NO_SIDE_EFFECTS__*/
43
43
  function arrayUnique(arr) {
44
44
  return [...new require_primordials_map_set.SetCtor(arr)];
45
45
  }