@socketsecurity/lib 6.0.7 → 6.0.9

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 (323) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +1 -1
  3. package/dist/ai/agent-context.d.mts +103 -0
  4. package/dist/ai/agent-context.js +157 -0
  5. package/dist/ai/backends.d.mts +83 -0
  6. package/dist/ai/backends.js +173 -0
  7. package/dist/ai/credentials.d.mts +49 -0
  8. package/dist/ai/credentials.js +82 -0
  9. package/dist/ai/discover.d.mts +4 -0
  10. package/dist/ai/discover.js +1 -1
  11. package/dist/ai/exec.d.mts +52 -0
  12. package/dist/ai/exec.js +92 -0
  13. package/dist/ai/http.d.mts +132 -0
  14. package/dist/ai/http.js +130 -0
  15. package/dist/ai/profiles.d.mts +41 -6
  16. package/dist/ai/profiles.js +52 -10
  17. package/dist/ai/route.d.mts +82 -0
  18. package/dist/ai/route.js +171 -0
  19. package/dist/ai/spawn.d.mts +42 -2
  20. package/dist/ai/spawn.js +146 -33
  21. package/dist/ai/subagent-status.d.mts +48 -0
  22. package/dist/ai/subagent-status.js +57 -0
  23. package/dist/ai/tier.d.mts +60 -0
  24. package/dist/ai/tier.js +53 -0
  25. package/dist/ai/types.d.mts +25 -2
  26. package/dist/ai/worktree.js +4 -0
  27. package/dist/archives/tar.js +1 -1
  28. package/dist/archives/zip.js +2 -2
  29. package/dist/argv/parse.d.ts +19 -2
  30. package/dist/argv/parse.js +1 -1
  31. package/dist/arrays/join.js +4 -0
  32. package/dist/bin/find.js +4 -4
  33. package/dist/bin/prim.cjs +23322 -18018
  34. package/dist/bin/resolve.js +2 -2
  35. package/dist/cache/ttl/store.js +2 -2
  36. package/dist/cli/check-primordials.d.ts +8 -3
  37. package/dist/cli/check-primordials.js +4 -4
  38. package/dist/compression/_internal.js +1 -1
  39. package/dist/compression/brotli.d.ts +1 -2
  40. package/dist/compression/brotli.js +5 -1
  41. package/dist/compression/gzip.js +5 -1
  42. package/dist/config/layers.d.ts +53 -0
  43. package/dist/config/layers.js +83 -0
  44. package/dist/constants/packages.d.ts +3 -0
  45. package/dist/constants/packages.js +2 -1
  46. package/dist/constants/socket.d.ts +2 -6
  47. package/dist/constants/socket.js +12 -14
  48. package/dist/cover/code.js +2 -2
  49. package/dist/crypto/hash.d.ts +4 -1
  50. package/dist/crypto/hash.js +4 -1
  51. package/dist/dlx/arborist.js +13 -3
  52. package/dist/dlx/binary-cache.js +1 -1
  53. package/dist/dlx/binary-resolution.js +1 -1
  54. package/dist/dlx/detect.d.ts +8 -0
  55. package/dist/dlx/firewall.d.ts +8 -0
  56. package/dist/dlx/lockfile.js +5 -2
  57. package/dist/dlx/manifest.js +1 -1
  58. package/dist/dlx/package.js +4 -0
  59. package/dist/eco/cargo/parse-lockfile.d.ts +1 -2
  60. package/dist/eco/cargo/parse-lockfile.js +3 -3
  61. package/dist/eco/manifest/detect-format.js +1 -1
  62. package/dist/eco/npm/npm/parse-lockfile.d.ts +3 -4
  63. package/dist/eco/npm/npm/parse-lockfile.js +2 -2
  64. package/dist/eco/npm/parse-package-json.d.ts +11 -0
  65. package/dist/eco/npm/parse-package-json.js +1 -1
  66. package/dist/eco/npm/pnpm/parse-lockfile.d.ts +5 -3
  67. package/dist/eco/npm/pnpm/parse-lockfile.js +3 -3
  68. package/dist/eco/npm/yarnpkg/yarn/exec.js +1 -1
  69. package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.d.ts +1 -2
  70. package/dist/eco/npm/yarnpkg/yarn/parse-lockfile.js +2 -2
  71. package/dist/env/proxy.js +1 -1
  72. package/dist/env/rewire.d.ts +6 -3
  73. package/dist/env/rewire.js +7 -8
  74. package/dist/env/socket.d.ts +7 -0
  75. package/dist/env/socket.js +10 -0
  76. package/dist/env/xdg.d.ts +17 -0
  77. package/dist/env/xdg.js +21 -1
  78. package/dist/errors/predicates.js +1 -1
  79. package/dist/errors/stack.js +1 -2
  80. package/dist/external/@npmcli/package-json.js +3455 -4881
  81. package/dist/external/@npmcli/promise-spawn.js +3 -1
  82. package/dist/external/@yarnpkg/extensions.js +1 -1
  83. package/dist/external/external-pack.js +1 -1
  84. package/dist/external/npm-pack.js +29164 -31799
  85. package/dist/external/pico-pack.js +4 -2
  86. package/dist/external/tar-fs.js +63 -16
  87. package/dist/external/which.js +3 -1
  88. package/dist/external-tools/bazel/asset-names.d.ts +1 -1
  89. package/dist/external-tools/bazel/asset-names.js +5 -2
  90. package/dist/external-tools/bazel/from-download.d.ts +1 -1
  91. package/dist/external-tools/bazel/from-download.js +5 -2
  92. package/dist/external-tools/bazel/resolve-bazel-version.js +4 -0
  93. package/dist/external-tools/bazel/resolve.d.ts +3 -3
  94. package/dist/external-tools/bazel/resolve.js +16 -8
  95. package/dist/external-tools/cdxgen/asset-names.d.ts +1 -1
  96. package/dist/external-tools/cdxgen/asset-names.js +5 -2
  97. package/dist/external-tools/cdxgen/from-download.d.ts +1 -1
  98. package/dist/external-tools/cdxgen/from-download.js +7 -4
  99. package/dist/external-tools/cdxgen/resolve.d.ts +3 -3
  100. package/dist/external-tools/cdxgen/resolve.js +16 -8
  101. package/dist/external-tools/from-download.d.ts +2 -2
  102. package/dist/external-tools/from-download.js +11 -5
  103. package/dist/external-tools/from-pip-venv.d.ts +1 -1
  104. package/dist/external-tools/from-pip-venv.js +12 -5
  105. package/dist/external-tools/janus/asset-names.d.ts +1 -1
  106. package/dist/external-tools/janus/asset-names.js +5 -2
  107. package/dist/external-tools/janus/from-download.d.ts +1 -1
  108. package/dist/external-tools/janus/from-download.js +5 -2
  109. package/dist/external-tools/janus/resolve.d.ts +3 -3
  110. package/dist/external-tools/janus/resolve.js +16 -8
  111. package/dist/external-tools/jre/asset-names.d.ts +1 -1
  112. package/dist/external-tools/jre/asset-names.js +5 -2
  113. package/dist/external-tools/jre/detect-platform-arch.js +1 -1
  114. package/dist/external-tools/jre/from-download.d.ts +1 -1
  115. package/dist/external-tools/jre/from-download.js +7 -4
  116. package/dist/external-tools/jre/from-java-home.js +2 -2
  117. package/dist/external-tools/jre/from-vfs.js +2 -2
  118. package/dist/external-tools/jre/resolve.d.ts +3 -3
  119. package/dist/external-tools/jre/resolve.js +16 -8
  120. package/dist/external-tools/manifest.d.ts +18 -0
  121. package/dist/external-tools/manifest.js +2 -2
  122. package/dist/external-tools/opengrep/asset-names.d.ts +1 -1
  123. package/dist/external-tools/opengrep/asset-names.js +5 -2
  124. package/dist/external-tools/opengrep/from-download.d.ts +1 -1
  125. package/dist/external-tools/opengrep/from-download.js +5 -2
  126. package/dist/external-tools/opengrep/resolve.d.ts +3 -3
  127. package/dist/external-tools/opengrep/resolve.js +16 -8
  128. package/dist/external-tools/python/asset-names.d.ts +1 -1
  129. package/dist/external-tools/python/asset-names.js +11 -4
  130. package/dist/external-tools/python/dlx.d.ts +3 -3
  131. package/dist/external-tools/python/dlx.js +20 -9
  132. package/dist/external-tools/python/from-download.d.ts +1 -1
  133. package/dist/external-tools/python/from-download.js +12 -5
  134. package/dist/external-tools/python/pin.js +6 -3
  135. package/dist/external-tools/python/pip-install.js +6 -3
  136. package/dist/external-tools/python/resolve.d.ts +3 -3
  137. package/dist/external-tools/python/resolve.js +19 -11
  138. package/dist/external-tools/python/uv-install.d.ts +89 -0
  139. package/dist/external-tools/python/uv-install.js +165 -0
  140. package/dist/external-tools/sbt/asset-names.d.ts +1 -1
  141. package/dist/external-tools/sbt/asset-names.js +5 -2
  142. package/dist/external-tools/sbt/from-download.d.ts +1 -1
  143. package/dist/external-tools/sbt/from-download.js +5 -2
  144. package/dist/external-tools/sbt/resolve.d.ts +3 -3
  145. package/dist/external-tools/sbt/resolve.js +16 -8
  146. package/dist/external-tools/skillspector/from-dlx.d.ts +1 -1
  147. package/dist/external-tools/skillspector/from-dlx.js +10 -3
  148. package/dist/external-tools/skillspector/from-uv.d.ts +30 -0
  149. package/dist/external-tools/skillspector/from-uv.js +56 -0
  150. package/dist/external-tools/skillspector/resolve.d.ts +20 -5
  151. package/dist/external-tools/skillspector/resolve.js +27 -6
  152. package/dist/external-tools/skillspector/types.d.ts +3 -1
  153. package/dist/external-tools/synp/asset-names.d.ts +1 -1
  154. package/dist/external-tools/synp/asset-names.js +6 -2
  155. package/dist/external-tools/synp/from-download.d.ts +1 -1
  156. package/dist/external-tools/synp/from-download.js +5 -2
  157. package/dist/external-tools/synp/resolve.d.ts +3 -3
  158. package/dist/external-tools/synp/resolve.js +16 -8
  159. package/dist/external-tools/trivy/asset-names.d.ts +1 -1
  160. package/dist/external-tools/trivy/asset-names.js +5 -2
  161. package/dist/external-tools/trivy/from-download.d.ts +1 -1
  162. package/dist/external-tools/trivy/from-download.js +7 -4
  163. package/dist/external-tools/trivy/resolve.d.ts +3 -3
  164. package/dist/external-tools/trivy/resolve.js +16 -8
  165. package/dist/external-tools/trufflehog/asset-names.d.ts +1 -1
  166. package/dist/external-tools/trufflehog/asset-names.js +5 -2
  167. package/dist/external-tools/trufflehog/from-download.d.ts +1 -1
  168. package/dist/external-tools/trufflehog/from-download.js +7 -4
  169. package/dist/external-tools/trufflehog/resolve.d.ts +3 -3
  170. package/dist/external-tools/trufflehog/resolve.js +16 -8
  171. package/dist/external-tools/uv/asset-names.d.ts +36 -0
  172. package/dist/external-tools/uv/asset-names.js +73 -0
  173. package/dist/external-tools/uv/from-download.d.ts +17 -0
  174. package/dist/external-tools/uv/from-download.js +50 -0
  175. package/dist/external-tools/uv/from-path.d.ts +5 -0
  176. package/dist/external-tools/uv/from-path.js +22 -0
  177. package/dist/external-tools/uv/from-vfs.d.ts +7 -0
  178. package/dist/external-tools/uv/from-vfs.js +26 -0
  179. package/dist/external-tools/uv/resolve.d.ts +25 -0
  180. package/dist/external-tools/uv/resolve.js +61 -0
  181. package/dist/external-tools/uv/types.d.ts +24 -0
  182. package/dist/external-tools/uv/types.js +2 -0
  183. package/dist/fleet/repo-config.d.ts +53 -0
  184. package/dist/fleet/repo-config.js +79 -0
  185. package/dist/fs/allowed-dirs-cache.d.ts +27 -1
  186. package/dist/fs/allowed-dirs-cache.js +39 -6
  187. package/dist/fs/copy.d.ts +88 -0
  188. package/dist/fs/copy.js +89 -0
  189. package/dist/fs/find.js +1 -1
  190. package/dist/fs/read-json-cache.d.ts +7 -0
  191. package/dist/fs/resolve-module.js +6 -2
  192. package/dist/fs/safe.js +1 -1
  193. package/dist/git/_internal.js +3 -3
  194. package/dist/git/repo.js +2 -4
  195. package/dist/git/staged.js +8 -0
  196. package/dist/git/tracked.d.ts +84 -0
  197. package/dist/git/tracked.js +163 -0
  198. package/dist/git/unstaged.js +8 -0
  199. package/dist/github/refs-graphql.js +4 -0
  200. package/dist/github/refs-rest.js +4 -0
  201. package/dist/globs/_internal.js +1 -1
  202. package/dist/globs/match.js +9 -1
  203. package/dist/globs/matcher.js +5 -1
  204. package/dist/http-request/browser.js +7 -3
  205. package/dist/http-request/checksum-file.js +1 -1
  206. package/dist/http-request/{browser-fetch.d.ts → fetch/browser.d.ts} +2 -2
  207. package/dist/http-request/{browser-fetch.js → fetch/browser.js} +4 -4
  208. package/dist/http-request/headers.js +1 -1
  209. package/dist/http-request/request-attempt.js +2 -2
  210. package/dist/http-request/user-agent.js +1 -1
  211. package/dist/integrity.d.ts +124 -71
  212. package/dist/integrity.js +168 -78
  213. package/dist/json/edit.js +38 -30
  214. package/dist/json/format.js +1 -1
  215. package/dist/logger/colors.d.ts +1 -2
  216. package/dist/logger/colors.js +2 -2
  217. package/dist/logger/symbols-builder.js +7 -8
  218. package/dist/logger/symbols.js +8 -8
  219. package/dist/native-messaging/install.d.ts +1 -1
  220. package/dist/native-messaging/install.js +7 -4
  221. package/dist/native-messaging/rate-limit.d.ts +7 -0
  222. package/dist/native-messaging/rate-limit.js +4 -0
  223. package/dist/node/async-hooks.js +1 -1
  224. package/dist/node/child-process.js +1 -1
  225. package/dist/node/crypto.js +1 -1
  226. package/dist/node/events.js +1 -1
  227. package/dist/node/fs-promises.js +1 -1
  228. package/dist/node/fs.d.ts +22 -6
  229. package/dist/node/fs.js +16 -3
  230. package/dist/node/http.js +1 -1
  231. package/dist/node/https.js +1 -1
  232. package/dist/node/module.d.ts +73 -2
  233. package/dist/node/module.js +97 -12
  234. package/dist/node/os.d.ts +10 -2
  235. package/dist/node/os.js +11 -4
  236. package/dist/node/path.d.ts +11 -2
  237. package/dist/node/path.js +17 -4
  238. package/dist/node/timers-promises.js +1 -1
  239. package/dist/node/url.js +1 -1
  240. package/dist/node/util.js +1 -1
  241. package/dist/objects/getters.js +1 -1
  242. package/dist/objects/mutate.js +2 -2
  243. package/dist/packages/edit-class.d.ts +2 -3
  244. package/dist/packages/edit-class.js +41 -35
  245. package/dist/packages/exports.js +4 -4
  246. package/dist/packages/fetch.js +1 -1
  247. package/dist/packages/isolation.js +2 -2
  248. package/dist/packages/licenses.js +2 -2
  249. package/dist/packages/manifest.d.ts +29 -0
  250. package/dist/packages/manifest.js +40 -4
  251. package/dist/packages/normalize.js +2 -2
  252. package/dist/packages/provenance.js +3 -3
  253. package/dist/packages/specs.js +1 -1
  254. package/dist/packages/tarball.js +4 -2
  255. package/dist/packages/types.d.ts +1 -2
  256. package/dist/paths/_internal.d.ts +1 -7
  257. package/dist/paths/_internal.js +9 -15
  258. package/dist/paths/conversion.js +1 -1
  259. package/dist/paths/dirnames.d.ts +1 -0
  260. package/dist/paths/dirnames.js +2 -0
  261. package/dist/paths/normalize.js +1 -1
  262. package/dist/paths/predicates.js +2 -1
  263. package/dist/paths/resolve.js +14 -19
  264. package/dist/paths/rewire.d.ts +5 -0
  265. package/dist/paths/socket.d.ts +137 -123
  266. package/dist/paths/socket.js +172 -131
  267. package/dist/perf/metrics.js +1 -1
  268. package/dist/perf/report.js +1 -1
  269. package/dist/primordials/process.d.ts +88 -0
  270. package/dist/primordials/process.js +132 -0
  271. package/dist/primordials/uncurry.d.ts +1 -2
  272. package/dist/process/spawn/child.js +8 -2
  273. package/dist/process/spawn/errors.js +1 -1
  274. package/dist/releases/github-archives.js +1 -1
  275. package/dist/releases/github-listing.d.ts +1 -2
  276. package/dist/schema/types.d.ts +3 -4
  277. package/dist/schema/validate.js +1 -1
  278. package/dist/secrets/broker.d.ts +35 -0
  279. package/dist/secrets/broker.js +72 -0
  280. package/dist/secrets/find.d.ts +8 -6
  281. package/dist/secrets/find.js +25 -5
  282. package/dist/secrets/keychain.d.ts +1 -1
  283. package/dist/secrets/linux.js +32 -44
  284. package/dist/secrets/macos.d.ts +1 -2
  285. package/dist/secrets/macos.js +20 -29
  286. package/dist/secrets/rc.d.ts +2 -2
  287. package/dist/secrets/rc.js +21 -13
  288. package/dist/secrets/socket-api-token.js +8 -0
  289. package/dist/secrets/windows.js +27 -33
  290. package/dist/shell/parse.d.ts +32 -0
  291. package/dist/shell/parse.js +60 -0
  292. package/dist/smol/detect.js +1 -1
  293. package/dist/smol/http.js +1 -1
  294. package/dist/smol/https.js +1 -1
  295. package/dist/smol/manifest.js +1 -1
  296. package/dist/smol/path.js +1 -1
  297. package/dist/smol/primordial.js +1 -1
  298. package/dist/smol/purl.js +1 -1
  299. package/dist/smol/versions.js +1 -1
  300. package/dist/smol/vfs.js +1 -1
  301. package/dist/sorts/_internal.d.ts +1 -2
  302. package/dist/sorts/_internal.js +2 -6
  303. package/dist/sorts/semver.js +2 -2
  304. package/dist/spinner/create-spinner-class.js +2 -2
  305. package/dist/spinner/spinner-internals.d.ts +1 -1
  306. package/dist/spinner/spinner-internals.js +9 -5
  307. package/dist/spinner/spinner.d.ts +4 -0
  308. package/dist/spinner/spinner.js +1 -1
  309. package/dist/stdio/progress.js +6 -2
  310. package/dist/stdio/prompts.d.ts +2 -10
  311. package/dist/stdio/prompts.js +11 -24
  312. package/dist/strings/format.js +1 -1
  313. package/dist/strings/search.js +1 -1
  314. package/dist/temporal/instant.js +2 -2
  315. package/dist/themes/context.d.ts +5 -3
  316. package/dist/themes/context.js +5 -6
  317. package/dist/url/assert-safe.d.ts +29 -0
  318. package/dist/url/assert-safe.js +54 -0
  319. package/dist/url/predicates.d.ts +31 -1
  320. package/dist/url/predicates.js +42 -1
  321. package/dist/url/types.d.ts +4 -0
  322. package/llms.txt +750 -0
  323. package/package.json +253 -125
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @file Fleet-convention config reader: a per-repo override (`.config/repo`)
3
+ * layered over the cascaded fleet default (`.config/fleet`). A thin wrapper
4
+ * over the generic `config/layers` reader that returns the named `{ fleet,
5
+ * repo }` shape fleet callers use, plus the `{ fleet, repo }` array-merge
6
+ * convenience. The generic, fleet-agnostic primitives (`readConfigLayers`,
7
+ * `mergeConfigArray`) live in `config/layers`. Lives in the published lib
8
+ * because it is the only import root the `.git-hooks/_shared` and
9
+ * `.claude/hooks/_shared` trees (which do not cross-import) plus `.config/*`
10
+ * can all reach.
11
+ */
12
+ export declare const FLEET_LAYER_DIRS: readonly string[];
13
+ export interface RepoConfigTiers<T> {
14
+ fleet: T | undefined;
15
+ repo: T | undefined;
16
+ }
17
+ export interface ResolveRepoConfigOptions {
18
+ repoRoot?: string | undefined;
19
+ cwd?: string | undefined;
20
+ }
21
+ /**
22
+ * Concatenate one array-valued key across the fleet + repo tiers. Fleet entries
23
+ * first, then repo entries. Convenience over `mergeConfigArray` for the `{
24
+ * fleet, repo }` shape.
25
+ *
26
+ * @param tiers - The `{ fleet, repo }` from `resolveRepoConfig`.
27
+ * @param key - The array-valued property to concatenate.
28
+ *
29
+ * @returns Fleet entries followed by repo entries; `[]` when neither is an
30
+ * array.
31
+ */
32
+ export declare function mergeRepoConfigArray<T extends Record<string, unknown>, K extends keyof T>(tiers: RepoConfigTiers<T>, key: K): Array<T[K] extends Array<infer E> ? E : never>;
33
+ /**
34
+ * Fleet-convention reader: a repo override (`.config/repo`) layered over the
35
+ * cascaded fleet default (`.config/fleet`). A thin wrapper over
36
+ * `readConfigLayers` that returns the named `{ fleet, repo }` shape callers
37
+ * already use; either tier is `undefined` when absent or unparseable.
38
+ *
39
+ * @example
40
+ * ;```typescript
41
+ * const { fleet, repo } = resolveRepoConfig<VitestTiers>('vitest')
42
+ * const nonIsolated = [
43
+ * ...(fleet?.nonIsolated ?? []),
44
+ * ...(repo?.nonIsolated ?? []),
45
+ * ]
46
+ * ```
47
+ *
48
+ * @param name - Base name of the config file (no directory, no `.json`).
49
+ * @param options - `repoRoot` / `cwd` for path resolution.
50
+ *
51
+ * @returns `{ fleet, repo }` parsed tiers; either may be `undefined`.
52
+ */
53
+ export declare function resolveRepoConfig<T = unknown>(name: string, options?: ResolveRepoConfigOptions | undefined): RepoConfigTiers<T>;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with rolldown */
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_config_layers = require('../config/layers.js');
5
+
6
+ //#region src/fleet/repo-config.ts
7
+ /**
8
+ * @file Fleet-convention config reader: a per-repo override (`.config/repo`)
9
+ * layered over the cascaded fleet default (`.config/fleet`). A thin wrapper
10
+ * over the generic `config/layers` reader that returns the named `{ fleet,
11
+ * repo }` shape fleet callers use, plus the `{ fleet, repo }` array-merge
12
+ * convenience. The generic, fleet-agnostic primitives (`readConfigLayers`,
13
+ * `mergeConfigArray`) live in `config/layers`. Lives in the published lib
14
+ * because it is the only import root the `.git-hooks/_shared` and
15
+ * `.claude/hooks/_shared` trees (which do not cross-import) plus `.config/*`
16
+ * can all reach.
17
+ */
18
+ const FLEET_LAYER_DIRS = [".config/fleet", ".config/repo"];
19
+ /**
20
+ * Concatenate one array-valued key across the fleet + repo tiers. Fleet entries
21
+ * first, then repo entries. Convenience over `mergeConfigArray` for the `{
22
+ * fleet, repo }` shape.
23
+ *
24
+ * @param tiers - The `{ fleet, repo }` from `resolveRepoConfig`.
25
+ * @param key - The array-valued property to concatenate.
26
+ *
27
+ * @returns Fleet entries followed by repo entries; `[]` when neither is an
28
+ * array.
29
+ */
30
+ function mergeRepoConfigArray(tiers, key) {
31
+ return require_config_layers.mergeConfigArray([tiers.fleet, tiers.repo], key);
32
+ }
33
+ /**
34
+ * Fleet-convention reader: a repo override (`.config/repo`) layered over the
35
+ * cascaded fleet default (`.config/fleet`). A thin wrapper over
36
+ * `readConfigLayers` that returns the named `{ fleet, repo }` shape callers
37
+ * already use; either tier is `undefined` when absent or unparseable.
38
+ *
39
+ * @example
40
+ * ;```typescript
41
+ * const { fleet, repo } = resolveRepoConfig<VitestTiers>('vitest')
42
+ * const nonIsolated = [
43
+ * ...(fleet?.nonIsolated ?? []),
44
+ * ...(repo?.nonIsolated ?? []),
45
+ * ]
46
+ * ```
47
+ *
48
+ * @param name - Base name of the config file (no directory, no `.json`).
49
+ * @param options - `repoRoot` / `cwd` for path resolution.
50
+ *
51
+ * @returns `{ fleet, repo }` parsed tiers; either may be `undefined`.
52
+ */
53
+ function resolveRepoConfig(name, options) {
54
+ const opts = {
55
+ __proto__: null,
56
+ ...options
57
+ };
58
+ const base = {
59
+ cwd: opts.cwd,
60
+ rootDir: opts.repoRoot
61
+ };
62
+ const [fleet] = require_config_layers.readConfigLayers(name, {
63
+ ...base,
64
+ dirs: [FLEET_LAYER_DIRS[0]]
65
+ });
66
+ const [repo] = require_config_layers.readConfigLayers(name, {
67
+ ...base,
68
+ dirs: [FLEET_LAYER_DIRS[1]]
69
+ });
70
+ return {
71
+ fleet,
72
+ repo
73
+ };
74
+ }
75
+
76
+ //#endregion
77
+ exports.FLEET_LAYER_DIRS = FLEET_LAYER_DIRS;
78
+ exports.mergeRepoConfigArray = mergeRepoConfigArray;
79
+ exports.resolveRepoConfig = resolveRepoConfig;
@@ -4,7 +4,17 @@
4
4
  * `invalidatePathCache` with `paths/rewire.ts` so test-time path overrides
5
5
  * flush the cache; the registration is the module's only side effect, so
6
6
  * callers that just need to flush the cache imperatively can call
7
- * `invalidatePathCache()` directly without that side effect repeating.
7
+ * `invalidatePathCache()` directly without that side effect repeating. The
8
+ * registration is deferred to a microtask (`registerInvalidationCallback`)
9
+ * rather than run at top-level module load. This module sits in a require
10
+ * cycle (`allowed-dirs-cache → _internal → paths/socket → …`); in the bundled
11
+ * CJS the `registerCacheInvalidation` import binding from `paths/rewire` is
12
+ * not yet initialized when this module first evaluates, so a synchronous
13
+ * top-level call threw `registerCacheInvalidation is not defined` at require
14
+ * time. Deferring to a microtask runs the call after the module graph has
15
+ * settled, breaking the init-order hazard while keeping the load-time
16
+ * registration contract (the callback is in place before any test hook
17
+ * fires).
8
18
  */
9
19
  /**
10
20
  * Invalidate the cached allowed directories. Called automatically by the
@@ -19,3 +29,19 @@
19
29
  * @internal Used for test rewiring
20
30
  */
21
31
  export declare function invalidatePathCache(): void;
32
+ /**
33
+ * Register `invalidatePathCache` with the rewire module after the current
34
+ * module-init turn, so the circular import is fully wired before the call.
35
+ * Guarded + self-rescheduling: in the require cycle (`allowed-dirs-cache →
36
+ * _internal → paths/socket → … → rewire`) the `registerCacheInvalidation` live
37
+ * binding can still be in its temporal dead zone when the first microtask fires
38
+ * under some import orders (vitest loads many modules concurrently), throwing
39
+ * `registerCacheInvalidation is not defined`. So check the binding is callable;
40
+ * if not, re-defer to the next microtask. The registration is a test-seam
41
+ * best-effort (it lets path-rewire flush this cache), so a bounded retry that
42
+ * lands on a later turn is correct — and a never-resolving binding (production,
43
+ * where rewire is unused) simply stops retrying without throwing.
44
+ *
45
+ * @internal
46
+ */
47
+ export declare function registerInvalidationCallback(attempt?: number): void;
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_paths_rewire = require('../paths/rewire.js');
5
- const require_fs__internal = require('./_internal.js');
6
4
 
7
5
  //#region src/fs/allowed-dirs-cache.ts
8
6
  /**
@@ -11,7 +9,17 @@ const require_fs__internal = require('./_internal.js');
11
9
  * `invalidatePathCache` with `paths/rewire.ts` so test-time path overrides
12
10
  * flush the cache; the registration is the module's only side effect, so
13
11
  * callers that just need to flush the cache imperatively can call
14
- * `invalidatePathCache()` directly without that side effect repeating.
12
+ * `invalidatePathCache()` directly without that side effect repeating. The
13
+ * registration is deferred to a microtask (`registerInvalidationCallback`)
14
+ * rather than run at top-level module load. This module sits in a require
15
+ * cycle (`allowed-dirs-cache → _internal → paths/socket → …`); in the bundled
16
+ * CJS the `registerCacheInvalidation` import binding from `paths/rewire` is
17
+ * not yet initialized when this module first evaluates, so a synchronous
18
+ * top-level call threw `registerCacheInvalidation is not defined` at require
19
+ * time. Deferring to a microtask runs the call after the module graph has
20
+ * settled, breaking the init-order hazard while keeping the load-time
21
+ * registration contract (the callback is in place before any test hook
22
+ * fires).
15
23
  */
16
24
  /**
17
25
  * Invalidate the cached allowed directories. Called automatically by the
@@ -26,9 +34,34 @@ const require_fs__internal = require('./_internal.js');
26
34
  * @internal Used for test rewiring
27
35
  */
28
36
  function invalidatePathCache() {
29
- require_fs__internal.clearAllowedDirectories();
37
+ clearAllowedDirectories();
30
38
  }
31
- require_paths_rewire.registerCacheInvalidation(invalidatePathCache);
39
+ /**
40
+ * Register `invalidatePathCache` with the rewire module after the current
41
+ * module-init turn, so the circular import is fully wired before the call.
42
+ * Guarded + self-rescheduling: in the require cycle (`allowed-dirs-cache →
43
+ * _internal → paths/socket → … → rewire`) the `registerCacheInvalidation` live
44
+ * binding can still be in its temporal dead zone when the first microtask fires
45
+ * under some import orders (vitest loads many modules concurrently), throwing
46
+ * `registerCacheInvalidation is not defined`. So check the binding is callable;
47
+ * if not, re-defer to the next microtask. The registration is a test-seam
48
+ * best-effort (it lets path-rewire flush this cache), so a bounded retry that
49
+ * lands on a later turn is correct — and a never-resolving binding (production,
50
+ * where rewire is unused) simply stops retrying without throwing.
51
+ *
52
+ * @internal
53
+ */
54
+ function registerInvalidationCallback(attempt = 0) {
55
+ try {
56
+ if (typeof registerCacheInvalidation === "function") {
57
+ registerCacheInvalidation(invalidatePathCache);
58
+ return;
59
+ }
60
+ } catch {}
61
+ if (attempt < 10) queueMicrotask(() => registerInvalidationCallback(attempt + 1));
62
+ }
63
+ queueMicrotask(() => registerInvalidationCallback());
32
64
 
33
65
  //#endregion
34
- exports.invalidatePathCache = invalidatePathCache;
66
+ exports.invalidatePathCache = invalidatePathCache;
67
+ exports.registerInvalidationCallback = registerInvalidationCallback;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @file Recursive copy for a file or directory tree, with three destination
3
+ * modes (see {@link CopyMode}). Plain `fs.cp` (even with `force`) overwrites
4
+ * files present in the source but never deletes destination files absent from
5
+ * it, so copying onto an existing target leaves stale leftovers behind. The
6
+ * `'pave'` mode makes the destination an exact copy of the source by staging
7
+ * a fresh tree in a sibling temp directory and swapping it in with a single
8
+ * rename — atomic, with no stale survivors.
9
+ */
10
+ import type { PathLike } from 'node:fs';
11
+ /**
12
+ * Named values for {@link CopyMode}. A frozen object rather than a TypeScript
13
+ * `enum` so the declaration is erasable (enums emit runtime helper code).
14
+ */
15
+ export declare const CopyMode: Readonly<{
16
+ readonly Fill: 'fill';
17
+ readonly Overlay: 'overlay';
18
+ readonly Pave: 'pave';
19
+ }>;
20
+ /**
21
+ * How {@link copy} treats an existing destination.
22
+ *
23
+ * - `'overlay'` (default) — overwrite files present in the source but leave any
24
+ * pre-existing destination-only files in place (a recursive `fs.cp`).
25
+ * - `'pave'` — replace the destination so it becomes an exact copy of the source;
26
+ * destination entries absent from the source do not survive. The swap is
27
+ * atomic (a sibling temp directory is renamed into place), so a partial tree
28
+ * is never observable.
29
+ * - `'fill'` — copy only what the destination lacks: existing files stay
30
+ * untouched (no-clobber), missing ones are added. Never throws on an existing
31
+ * file.
32
+ *
33
+ * Maps to `cp` (overlay), `rsync --delete` / robocopy `/MIR` (pave), and
34
+ * `cp -n` (fill).
35
+ */
36
+ export type CopyMode = (typeof CopyMode)[keyof typeof CopyMode];
37
+ /**
38
+ * Options for {@link copy}.
39
+ */
40
+ export interface CopyOptions {
41
+ /**
42
+ * Dereference symlinks — copy what each points to rather than the link
43
+ * itself.
44
+ *
45
+ * @default false
46
+ */
47
+ dereference?: boolean | undefined;
48
+ /**
49
+ * Predicate deciding which entries to copy. Return `false` to skip an entry
50
+ * (and, for a directory, everything beneath it). Receives resolved source
51
+ * and destination paths, matching `node:fs` `cp`'s `filter`.
52
+ */
53
+ filter?: ((source: string, destination: string) => boolean) | undefined;
54
+ /**
55
+ * How to treat an existing destination. See {@link CopyMode}.
56
+ *
57
+ * @default 'overlay'
58
+ */
59
+ mode?: CopyMode | undefined;
60
+ /**
61
+ * Abort signal to cancel the operation.
62
+ */
63
+ signal?: AbortSignal | undefined;
64
+ }
65
+ /**
66
+ * Recursively copy a file or directory tree from `from` to `to`.
67
+ *
68
+ * Works for both files and directories. The `mode` option chooses how an
69
+ * existing destination is treated — overlay (default), pave, or fill; see
70
+ * {@link CopyMode}.
71
+ *
72
+ * @example
73
+ * ;```ts
74
+ * // Overlay (default) — overwrite collisions, keep files already in dest:
75
+ * await copy('./src', './dest')
76
+ *
77
+ * // Pave — dest ends up identical to src, no stale survivors:
78
+ * await copy('./vendor/upstream', './deps/upstream', { mode: CopyMode.Pave })
79
+ *
80
+ * // Fill — add only what's missing, never overwrite an existing file:
81
+ * await copy('./defaults', './config', { mode: CopyMode.Fill })
82
+ * ```
83
+ *
84
+ * @param from - Source file or directory to copy.
85
+ * @param to - Destination path.
86
+ * @param options - Copy options (mode, filter, dereference, abort signal).
87
+ */
88
+ export declare function copy(from: PathLike, to: PathLike, options?: CopyOptions | undefined): Promise<void>;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /* Socket Lib - Built with rolldown */
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+ const require_primordials_object = require('../primordials/object.js');
5
+ const require_paths__internal = require('../paths/_internal.js');
6
+ const require_node_fs = require('../node/fs.js');
7
+ const require_node_path = require('../node/path.js');
8
+ const require_fs_safe = require('./safe.js');
9
+ const require_fs_unique = require('./unique.js');
10
+
11
+ //#region src/fs/copy.ts
12
+ /**
13
+ * @file Recursive copy for a file or directory tree, with three destination
14
+ * modes (see {@link CopyMode}). Plain `fs.cp` (even with `force`) overwrites
15
+ * files present in the source but never deletes destination files absent from
16
+ * it, so copying onto an existing target leaves stale leftovers behind. The
17
+ * `'pave'` mode makes the destination an exact copy of the source by staging
18
+ * a fresh tree in a sibling temp directory and swapping it in with a single
19
+ * rename — atomic, with no stale survivors.
20
+ */
21
+ /**
22
+ * Named values for {@link CopyMode}. A frozen object rather than a TypeScript
23
+ * `enum` so the declaration is erasable (enums emit runtime helper code).
24
+ */
25
+ const CopyMode = require_primordials_object.ObjectFreeze({
26
+ Fill: "fill",
27
+ Overlay: "overlay",
28
+ Pave: "pave"
29
+ });
30
+ /**
31
+ * Recursively copy a file or directory tree from `from` to `to`.
32
+ *
33
+ * Works for both files and directories. The `mode` option chooses how an
34
+ * existing destination is treated — overlay (default), pave, or fill; see
35
+ * {@link CopyMode}.
36
+ *
37
+ * @example
38
+ * ;```ts
39
+ * // Overlay (default) — overwrite collisions, keep files already in dest:
40
+ * await copy('./src', './dest')
41
+ *
42
+ * // Pave — dest ends up identical to src, no stale survivors:
43
+ * await copy('./vendor/upstream', './deps/upstream', { mode: CopyMode.Pave })
44
+ *
45
+ * // Fill — add only what's missing, never overwrite an existing file:
46
+ * await copy('./defaults', './config', { mode: CopyMode.Fill })
47
+ * ```
48
+ *
49
+ * @param from - Source file or directory to copy.
50
+ * @param to - Destination path.
51
+ * @param options - Copy options (mode, filter, dereference, abort signal).
52
+ */
53
+ async function copy(from, to, options) {
54
+ const fs = require_node_fs.getNodeFs();
55
+ const opts = {
56
+ __proto__: null,
57
+ ...options
58
+ };
59
+ const { mode } = opts;
60
+ const fromStr = require_paths__internal.pathLikeToString(from);
61
+ const toStr = require_paths__internal.pathLikeToString(to);
62
+ const cpOptions = {
63
+ __proto__: null,
64
+ dereference: opts.dereference === true,
65
+ force: mode !== CopyMode.Fill,
66
+ recursive: true,
67
+ ...opts.filter ? { filter: opts.filter } : {}
68
+ };
69
+ if (mode !== CopyMode.Pave) {
70
+ await fs.promises.cp(fromStr, toStr, cpOptions);
71
+ return;
72
+ }
73
+ const path = require_node_path.getNodePath();
74
+ const tmp = require_fs_unique.uniqueSync(`${toStr}.tmp`);
75
+ try {
76
+ await fs.promises.cp(fromStr, tmp, cpOptions);
77
+ await require_fs_safe.safeMkdir(path.dirname(toStr));
78
+ await require_fs_safe.safeDelete(toStr, { signal: opts.signal });
79
+ await fs.promises.rename(tmp, toStr);
80
+ } catch (e) {
81
+ /* c8 ignore start - best-effort cleanup of the staged copy on failure */
82
+ await require_fs_safe.safeDelete(tmp, { signal: opts.signal });
83
+ throw e;
84
+ }
85
+ }
86
+
87
+ //#endregion
88
+ exports.CopyMode = CopyMode;
89
+ exports.copy = copy;
package/dist/fs/find.js CHANGED
@@ -2,11 +2,11 @@
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_arrays_predicates = require('../arrays/predicates.js');
5
6
  const require_paths_normalize = require('../paths/normalize.js');
6
7
  const require_node_fs = require('../node/fs.js');
7
8
  const require_node_path = require('../node/path.js');
8
9
  const require_process_abort = require('../process/abort.js');
9
- const require_arrays_predicates = require('../arrays/predicates.js');
10
10
  const require_smol_path = require('../smol/path.js');
11
11
  const require_paths_walk = require('../paths/walk.js');
12
12
  let node_process = require("node:process");
@@ -30,6 +30,13 @@
30
30
  * CWDs would get separate cache entries — correct but pessimistic.
31
31
  */
32
32
  import type { JsonValue } from '../json/types';
33
+ export interface CacheEntry {
34
+ ino: number;
35
+ size: number;
36
+ mtimeMs: number;
37
+ parsed: JsonValue;
38
+ insertedAt: number;
39
+ }
33
40
  /**
34
41
  * Drop all cached entries. Tests call this between cases that depend on a fresh
35
42
  * read; long-running daemons can call it on file-watcher invalidation events
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
5
  const require_node_path = require('../node/path.js');
6
- let node_module = require("node:module");
7
6
  let node_process = require("node:process");
8
7
  node_process = require_runtime.__toESM(node_process);
8
+ let node_module = require("node:module");
9
9
 
10
10
  //#region src/fs/resolve-module.ts
11
11
  /**
@@ -32,7 +32,11 @@ function requireResolveFrom(fromDir, specifier, options) {
32
32
  }
33
33
  }
34
34
  function requireResolveFromCwd(specifier, options) {
35
- return options && options.nothrow ? requireResolveFrom(node_process.default.cwd(), specifier, { nothrow: true }) : requireResolveFrom(node_process.default.cwd(), specifier);
35
+ options = {
36
+ __proto__: null,
37
+ ...options
38
+ };
39
+ return options?.nothrow ? requireResolveFrom(node_process.default.cwd(), specifier, { nothrow: true }) : requireResolveFrom(node_process.default.cwd(), specifier);
36
40
  }
37
41
 
38
42
  //#endregion
package/dist/fs/safe.js CHANGED
@@ -2,13 +2,13 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_primordials_string = require('../primordials/string.js');
5
+ const require_arrays_predicates = require('../arrays/predicates.js');
5
6
  const require_paths__internal = require('../paths/_internal.js');
6
7
  const require_primordials_array = require('../primordials/array.js');
7
8
  const require_node_fs = require('../node/fs.js');
8
9
  const require_node_path = require('../node/path.js');
9
10
  const require_errors_predicates = require('../errors/predicates.js');
10
11
  const require_primordials_globals = require('../primordials/globals.js');
11
- const require_arrays_predicates = require('../arrays/predicates.js');
12
12
  const require_objects_mutate = require('../objects/mutate.js');
13
13
  const require_promises_retry = require('../promises/retry.js');
14
14
  const require_fs__internal = require('./_internal.js');
@@ -2,20 +2,20 @@
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
  const require_primordials_buffer = require('../primordials/buffer.js');
5
+ const require_primordials_object = require('../primordials/object.js');
5
6
  const require_primordials_string = require('../primordials/string.js');
7
+ const require_primordials_map_set = require('../primordials/map-set.js');
6
8
  const require_paths_normalize = require('../paths/normalize.js');
7
9
  const require_primordials_array = require('../primordials/array.js');
8
- const require_primordials_map_set = require('../primordials/map-set.js');
9
10
  const require_node_path = require('../node/path.js');
10
11
  const require_primordials_date = require('../primordials/date.js');
11
12
  const require_primordials_json = require('../primordials/json.js');
12
- const require_primordials_object = require('../primordials/object.js');
13
13
  const require_bin_which = require('../bin/which.js');
14
14
  const require_ansi_strip = require('../ansi/strip.js');
15
15
  const require_process_spawn_child = require('../process/spawn/child.js');
16
+ const require_git_repo = require('./repo.js');
16
17
  const require_debug_output = require('../debug/output.js');
17
18
  const require_globs_matcher = require('../globs/matcher.js');
18
- const require_git_repo = require('./repo.js');
19
19
 
20
20
  //#region src/git/_internal.ts
21
21
  /**
package/dist/git/repo.js CHANGED
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  /* Socket Lib - Built with rolldown */
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
- const require_runtime = require('../_virtual/_rolldown/runtime.js');
5
4
  const require_primordials_map_set = require('../primordials/map-set.js');
6
5
  const require_node_fs = require('../node/fs.js');
7
6
  const require_node_path = require('../node/path.js');
8
- let node_process = require("node:process");
9
- node_process = require_runtime.__toESM(node_process);
7
+ const require_primordials_process = require('../primordials/process.js');
10
8
 
11
9
  //#region src/git/repo.ts
12
10
  /**
@@ -112,7 +110,7 @@ function getCachedRealpath(pathname) {
112
110
  * @returns The resolved real path of `process.cwd()`.
113
111
  */
114
112
  function getCwd() {
115
- return getCachedRealpath(node_process.default.cwd());
113
+ return getCachedRealpath(require_primordials_process.processCwd());
116
114
  }
117
115
 
118
116
  //#endregion
@@ -44,6 +44,10 @@ const require_git__internal = require('./_internal.js');
44
44
  * @returns Promise resolving to array of staged file paths.
45
45
  */
46
46
  async function getStagedFiles(options) {
47
+ options = {
48
+ __proto__: null,
49
+ ...options
50
+ };
47
51
  const args = require_git__internal.getGitDiffSpawnArgs(options?.cwd).staged;
48
52
  return await require_git__internal.innerDiff(args, options);
49
53
  }
@@ -79,6 +83,10 @@ async function getStagedFiles(options) {
79
83
  * @returns Array of staged file paths.
80
84
  */
81
85
  function getStagedFilesSync(options) {
86
+ options = {
87
+ __proto__: null,
88
+ ...options
89
+ };
82
90
  const args = require_git__internal.getGitDiffSpawnArgs(options?.cwd).staged;
83
91
  return require_git__internal.innerDiffSync(args, options);
84
92
  }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @file Tracked-status + submodule-membership probes for a working-tree path.
3
+ * `isTracked` answers "does git track this exact path?"; `getSubmodulePaths`
4
+ * lists the repo's submodule mount points; `isInSubmodule` answers "does this
5
+ * path live inside one?"; `isUntrackedNonSubmodulePath` composes them into
6
+ * the safe-to-touch condition for cleanup tooling — never delete a tracked
7
+ * file or reach into a submodule's own tree (which would dirty it).
8
+ */
9
+ /**
10
+ * The repo's submodule mount points as normalized, repo-root-relative paths
11
+ * (e.g. `vendor/acorn`). Reads `git config` on `.gitmodules`, so it lists
12
+ * declared submodules whether or not they are initialized — the case a
13
+ * stderr-message check on `git ls-files` misses.
14
+ *
15
+ * @example
16
+ * ;```typescript
17
+ * await getSubmodulePaths()
18
+ * // => ['packages/acorn/upstream/acorn', 'vendor/mbedtls']
19
+ * ```
20
+ */
21
+ export declare function getSubmodulePaths(options?: GitPathOptions | undefined): Promise<string[]>;
22
+ /**
23
+ * Whether `targetPath` lives inside one of the repo's submodules. Resolves the
24
+ * submodule list itself; for a batch sweep prefer `getSubmodulePaths` once plus
25
+ * `pathIsUnderSubmodule` per path.
26
+ *
27
+ * @example
28
+ * ;```typescript
29
+ * await isInSubmodule('vendor/mbedtls/x.py') // => true
30
+ * await isInSubmodule('src/index.ts') // => false
31
+ * ```
32
+ */
33
+ export declare function isInSubmodule(targetPath: string, options?: GitPathOptions | undefined): Promise<boolean>;
34
+ export interface GitPathOptions {
35
+ /**
36
+ * The git working-tree directory the path is resolved against.
37
+ *
38
+ * @default process.cwd()
39
+ */
40
+ cwd?: string | undefined;
41
+ }
42
+ /**
43
+ * Whether git tracks `targetPath` exactly. Uses `git ls-files --error-unmatch`,
44
+ * which exits non-zero for an untracked path. A path inside a submodule, or one
45
+ * git does not know, returns `false`.
46
+ *
47
+ * @example
48
+ * ;```typescript
49
+ * await isTracked('src/index.ts') // => true
50
+ * await isTracked('.DS_Store') // => false
51
+ * ```
52
+ */
53
+ export declare function isTracked(targetPath: string, options?: GitPathOptions | undefined): Promise<boolean>;
54
+ /**
55
+ * Whether `targetPath` is git does NOT track AND does not live inside a
56
+ * submodule — the safe-to-touch condition for cleanup tooling. A tracked path
57
+ * is a deliberate file; a submodule-internal path belongs to that submodule's
58
+ * own git (touching it would dirty the submodule). Composes `isTracked` +
59
+ * `getSubmodulePaths`/`pathIsUnderSubmodule`. Fails closed — any check error
60
+ * resolves to `false`.
61
+ *
62
+ * For a batch sweep, call `getSubmodulePaths` once and compose `isTracked` +
63
+ * `pathIsUnderSubmodule` per path to avoid re-reading `.gitmodules` each time.
64
+ *
65
+ * @example
66
+ * ;```typescript
67
+ * await isUntrackedNonSubmodulePath('.DS_Store') // => true
68
+ * await isUntrackedNonSubmodulePath('src/index.ts') // => false (tracked)
69
+ * await isUntrackedNonSubmodulePath('vendor/sub/x.pyc') // => false (submodule)
70
+ * ```
71
+ */
72
+ export declare function isUntrackedNonSubmodulePath(targetPath: string, options?: GitPathOptions | undefined): Promise<boolean>;
73
+ /**
74
+ * Whether `relativePath` (repo-root-relative) lies at or under any of
75
+ * `submodulePaths`. Pure — pass the result of `getSubmodulePaths` so the git
76
+ * read happens once for a whole sweep.
77
+ *
78
+ * @example
79
+ * ;```typescript
80
+ * pathIsUnderSubmodule('vendor/mbedtls/scripts/__pycache__', ['vendor/mbedtls'])
81
+ * // => true
82
+ * ```
83
+ */
84
+ export declare function pathIsUnderSubmodule(relativePath: string, submodulePaths: string[]): boolean;