@socketsecurity/lib 5.18.1 → 5.19.0

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 (305) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +6 -5
  3. package/dist/abort.d.ts +3 -0
  4. package/dist/abort.js +1 -0
  5. package/dist/agent.d.ts +66 -49
  6. package/dist/agent.js +51 -50
  7. package/dist/ansi.d.ts +2 -5
  8. package/dist/ansi.js +3 -2
  9. package/dist/archives.d.ts +25 -21
  10. package/dist/archives.js +35 -34
  11. package/dist/argv/flags.d.ts +100 -91
  12. package/dist/argv/flags.js +88 -87
  13. package/dist/argv/parse.d.ts +30 -40
  14. package/dist/argv/parse.js +33 -32
  15. package/dist/arrays.d.ts +4 -8
  16. package/dist/arrays.js +1 -0
  17. package/dist/bin.d.ts +7 -5
  18. package/dist/bin.js +52 -29
  19. package/dist/cacache.d.ts +13 -12
  20. package/dist/cacache.js +9 -8
  21. package/dist/cache-with-ttl.d.ts +53 -35
  22. package/dist/cache-with-ttl.js +1 -0
  23. package/dist/colors.d.ts +5 -5
  24. package/dist/colors.js +1 -0
  25. package/dist/constants/agents.d.ts +5 -9
  26. package/dist/constants/agents.js +3 -2
  27. package/dist/constants/core.d.ts +5 -10
  28. package/dist/constants/core.js +2 -1
  29. package/dist/constants/encoding.d.ts +3 -3
  30. package/dist/constants/encoding.js +1 -0
  31. package/dist/constants/github.d.ts +3 -3
  32. package/dist/constants/github.js +1 -0
  33. package/dist/constants/licenses.d.ts +9 -2
  34. package/dist/constants/licenses.js +1 -0
  35. package/dist/constants/lifecycle-script-names.js +1 -0
  36. package/dist/constants/maintained-node-versions.d.ts +3 -0
  37. package/dist/constants/maintained-node-versions.js +1 -0
  38. package/dist/constants/node.d.ts +125 -16
  39. package/dist/constants/node.js +74 -73
  40. package/dist/constants/package-default-node-range.d.ts +3 -1
  41. package/dist/constants/package-default-node-range.js +2 -1
  42. package/dist/constants/package-default-socket-categories.d.ts +0 -1
  43. package/dist/constants/package-default-socket-categories.js +1 -0
  44. package/dist/constants/packages.d.ts +12 -17
  45. package/dist/constants/packages.js +31 -16
  46. package/dist/constants/platform.d.ts +1 -2
  47. package/dist/constants/platform.js +2 -1
  48. package/dist/constants/process.d.ts +18 -0
  49. package/dist/constants/process.js +1 -0
  50. package/dist/constants/socket.d.ts +4 -10
  51. package/dist/constants/socket.js +2 -1
  52. package/dist/constants/testing.d.ts +3 -3
  53. package/dist/constants/testing.js +1 -0
  54. package/dist/constants/time.d.ts +3 -4
  55. package/dist/constants/time.js +1 -0
  56. package/dist/constants/typescript.d.ts +10 -3
  57. package/dist/constants/typescript.js +5 -4
  58. package/dist/cover/code.d.ts +3 -0
  59. package/dist/cover/code.js +12 -12
  60. package/dist/cover/formatters.d.ts +12 -9
  61. package/dist/cover/formatters.js +19 -18
  62. package/dist/cover/type.d.ts +3 -0
  63. package/dist/cover/type.js +1 -0
  64. package/dist/cover/types.js +1 -0
  65. package/dist/debug.d.ts +32 -47
  66. package/dist/debug.js +97 -96
  67. package/dist/dlx/arborist.d.ts +134 -0
  68. package/dist/dlx/arborist.js +177 -0
  69. package/dist/dlx/binary.d.ts +25 -9
  70. package/dist/dlx/binary.js +34 -12
  71. package/dist/dlx/cache.d.ts +1 -0
  72. package/dist/dlx/cache.js +2 -1
  73. package/dist/dlx/detect.d.ts +15 -0
  74. package/dist/dlx/detect.js +28 -20
  75. package/dist/dlx/dir.d.ts +1 -11
  76. package/dist/dlx/dir.js +2 -12
  77. package/dist/dlx/integrity.d.ts +86 -0
  78. package/dist/dlx/integrity.js +112 -0
  79. package/dist/dlx/lockfile.d.ts +115 -0
  80. package/dist/dlx/lockfile.js +139 -0
  81. package/dist/dlx/manifest.d.ts +26 -1
  82. package/dist/dlx/manifest.js +9 -6
  83. package/dist/dlx/package.d.ts +58 -3
  84. package/dist/dlx/package.js +101 -74
  85. package/dist/dlx/packages.d.ts +1 -11
  86. package/dist/dlx/packages.js +3 -14
  87. package/dist/dlx/paths.d.ts +1 -0
  88. package/dist/dlx/paths.js +2 -1
  89. package/dist/effects/pulse-frames.js +1 -0
  90. package/dist/effects/text-shimmer.d.ts +13 -2
  91. package/dist/effects/text-shimmer.js +50 -46
  92. package/dist/effects/types.js +1 -0
  93. package/dist/effects/ultra.js +1 -0
  94. package/dist/env/ci.d.ts +6 -1
  95. package/dist/env/ci.js +1 -0
  96. package/dist/env/debug.d.ts +5 -1
  97. package/dist/env/debug.js +1 -0
  98. package/dist/env/github.d.ts +19 -23
  99. package/dist/env/github.js +5 -4
  100. package/dist/env/helpers.d.ts +21 -9
  101. package/dist/env/helpers.js +5 -11
  102. package/dist/env/home.d.ts +17 -4
  103. package/dist/env/home.js +2 -1
  104. package/dist/env/locale.d.ts +4 -3
  105. package/dist/env/locale.js +1 -0
  106. package/dist/env/node-auth-token.d.ts +5 -1
  107. package/dist/env/node-auth-token.js +1 -0
  108. package/dist/env/node-env.d.ts +5 -1
  109. package/dist/env/node-env.js +1 -0
  110. package/dist/env/npm.d.ts +4 -5
  111. package/dist/env/npm.js +1 -0
  112. package/dist/env/package-manager.d.ts +4 -3
  113. package/dist/env/package-manager.js +2 -1
  114. package/dist/env/path.d.ts +5 -1
  115. package/dist/env/path.js +1 -0
  116. package/dist/env/pre-commit.d.ts +5 -1
  117. package/dist/env/pre-commit.js +1 -0
  118. package/dist/env/rewire.d.ts +10 -0
  119. package/dist/env/rewire.js +7 -5
  120. package/dist/env/shell.d.ts +5 -1
  121. package/dist/env/shell.js +1 -0
  122. package/dist/env/socket-cli-shadow.d.ts +4 -5
  123. package/dist/env/socket-cli-shadow.js +1 -0
  124. package/dist/env/socket-cli.d.ts +4 -14
  125. package/dist/env/socket-cli.js +1 -0
  126. package/dist/env/socket.d.ts +6 -18
  127. package/dist/env/socket.js +4 -3
  128. package/dist/env/temp-dir.d.ts +4 -3
  129. package/dist/env/temp-dir.js +1 -0
  130. package/dist/env/term.d.ts +5 -1
  131. package/dist/env/term.js +1 -0
  132. package/dist/env/test.d.ts +4 -3
  133. package/dist/env/test.js +1 -0
  134. package/dist/env/windows.d.ts +4 -4
  135. package/dist/env/windows.js +1 -0
  136. package/dist/env/xdg.d.ts +4 -3
  137. package/dist/env/xdg.js +1 -0
  138. package/dist/env.d.ts +83 -23
  139. package/dist/env.js +112 -80
  140. package/dist/errors.js +1 -0
  141. package/dist/external/@npmcli/package-json.js +9 -3968
  142. package/dist/external/@socketregistry/packageurl-js.js +2 -2
  143. package/dist/external/debug.js +162 -328
  144. package/dist/external/external-pack.js +3 -2835
  145. package/dist/external/npm-pack.js +13939 -33342
  146. package/dist/external/zod.js +160 -7558
  147. package/dist/fs.d.ts +92 -113
  148. package/dist/fs.js +35 -35
  149. package/dist/git.d.ts +170 -164
  150. package/dist/git.js +113 -87
  151. package/dist/github.d.ts +249 -227
  152. package/dist/github.js +82 -81
  153. package/dist/globs.d.ts +31 -17
  154. package/dist/globs.js +51 -58
  155. package/dist/http-request.d.ts +99 -99
  156. package/dist/http-request.js +182 -156
  157. package/dist/ipc-cli.d.ts +28 -0
  158. package/dist/{utils/get-ipc.js → ipc-cli.js} +4 -3
  159. package/dist/ipc.d.ts +9 -299
  160. package/dist/ipc.js +18 -204
  161. package/dist/json/edit.d.ts +3 -1
  162. package/dist/json/edit.js +30 -30
  163. package/dist/json/format.d.ts +36 -36
  164. package/dist/json/format.js +22 -21
  165. package/dist/json/parse.d.ts +4 -2
  166. package/dist/json/parse.js +1 -0
  167. package/dist/json/types.js +1 -0
  168. package/dist/{links/index.d.ts → links.d.ts} +6 -2
  169. package/dist/{links/index.js → links.js} +5 -4
  170. package/dist/logger.d.ts +4 -6
  171. package/dist/logger.js +61 -53
  172. package/dist/memoization.d.ts +52 -49
  173. package/dist/memoization.js +55 -33
  174. package/dist/objects.d.ts +25 -44
  175. package/dist/objects.js +2 -1
  176. package/dist/package-extensions.d.ts +6 -0
  177. package/dist/package-extensions.js +2 -1
  178. package/dist/packages/edit.d.ts +3 -5
  179. package/dist/packages/edit.js +4 -3
  180. package/dist/packages/exports.d.ts +11 -14
  181. package/dist/packages/exports.js +11 -10
  182. package/dist/packages/isolation.d.ts +4 -0
  183. package/dist/packages/isolation.js +20 -19
  184. package/dist/packages/licenses.d.ts +3 -10
  185. package/dist/packages/licenses.js +2 -1
  186. package/dist/packages/manifest.d.ts +3 -3
  187. package/dist/packages/manifest.js +1 -0
  188. package/dist/packages/normalize.d.ts +3 -4
  189. package/dist/packages/normalize.js +1 -0
  190. package/dist/packages/operations.d.ts +3 -10
  191. package/dist/packages/operations.js +1 -0
  192. package/dist/packages/provenance.d.ts +10 -8
  193. package/dist/packages/provenance.js +55 -54
  194. package/dist/packages/specs.d.ts +3 -5
  195. package/dist/packages/specs.js +1 -0
  196. package/dist/packages/validation.d.ts +3 -3
  197. package/dist/packages/validation.js +1 -0
  198. package/dist/packages.d.ts +2 -17
  199. package/dist/packages.js +2 -1
  200. package/dist/paths/dirnames.d.ts +0 -2
  201. package/dist/paths/dirnames.js +1 -0
  202. package/dist/paths/exts.d.ts +0 -1
  203. package/dist/paths/exts.js +1 -0
  204. package/dist/paths/filenames.d.ts +0 -1
  205. package/dist/paths/filenames.js +1 -0
  206. package/dist/paths/globs.d.ts +0 -1
  207. package/dist/paths/globs.js +1 -0
  208. package/dist/paths/normalize.d.ts +115 -123
  209. package/dist/paths/normalize.js +128 -127
  210. package/dist/paths/packages.d.ts +3 -2
  211. package/dist/paths/packages.js +2 -1
  212. package/dist/paths/rewire.d.ts +9 -0
  213. package/dist/paths/rewire.js +5 -3
  214. package/dist/paths/socket.d.ts +37 -23
  215. package/dist/paths/socket.js +26 -25
  216. package/dist/performance.d.ts +87 -84
  217. package/dist/performance.js +97 -96
  218. package/dist/process-lock.d.ts +41 -1
  219. package/dist/process-lock.js +24 -17
  220. package/dist/promise-queue.d.ts +6 -0
  221. package/dist/promise-queue.js +1 -0
  222. package/dist/promises.d.ts +40 -55
  223. package/dist/promises.js +12 -11
  224. package/dist/regexps.d.ts +0 -5
  225. package/dist/regexps.js +1 -0
  226. package/dist/releases/github.d.ts +59 -63
  227. package/dist/releases/github.js +95 -100
  228. package/dist/releases/socket-btm.d.ts +9 -2
  229. package/dist/releases/socket-btm.js +32 -25
  230. package/dist/sea.d.ts +5 -0
  231. package/dist/sea.js +1 -0
  232. package/dist/shadow.d.ts +4 -0
  233. package/dist/shadow.js +1 -0
  234. package/dist/signal-exit.d.ts +7 -7
  235. package/dist/signal-exit.js +46 -45
  236. package/dist/sorts.d.ts +5 -7
  237. package/dist/sorts.js +11 -10
  238. package/dist/spawn.d.ts +96 -77
  239. package/dist/spawn.js +39 -38
  240. package/dist/spinner.d.ts +21 -22
  241. package/dist/spinner.js +15 -11
  242. package/dist/ssri.d.ts +31 -36
  243. package/dist/ssri.js +15 -14
  244. package/dist/stdio/_stream.d.ts +31 -0
  245. package/dist/stdio/_stream.js +57 -0
  246. package/dist/stdio/divider.d.ts +40 -36
  247. package/dist/stdio/divider.js +10 -9
  248. package/dist/stdio/footer.d.ts +20 -0
  249. package/dist/stdio/footer.js +12 -2
  250. package/dist/stdio/header.d.ts +4 -16
  251. package/dist/stdio/header.js +1 -9
  252. package/dist/stdio/stderr.d.ts +51 -39
  253. package/dist/stdio/stderr.js +19 -22
  254. package/dist/stdio/stdout.d.ts +54 -52
  255. package/dist/stdio/stdout.js +35 -33
  256. package/dist/streams.d.ts +4 -3
  257. package/dist/streams.js +1 -0
  258. package/dist/strings.d.ts +31 -85
  259. package/dist/strings.js +5 -49
  260. package/dist/suppress-warnings.d.ts +32 -15
  261. package/dist/suppress-warnings.js +14 -13
  262. package/dist/tables.d.ts +30 -26
  263. package/dist/tables.js +24 -23
  264. package/dist/temporary-executor.d.ts +4 -0
  265. package/dist/temporary-executor.js +1 -0
  266. package/dist/themes/context.d.ts +30 -26
  267. package/dist/themes/context.js +19 -18
  268. package/dist/themes/index.d.ts +0 -4
  269. package/dist/themes/index.js +1 -0
  270. package/dist/themes/themes.d.ts +1 -1
  271. package/dist/themes/themes.js +1 -0
  272. package/dist/themes/types.js +1 -0
  273. package/dist/themes/utils.d.ts +46 -43
  274. package/dist/themes/utils.js +45 -44
  275. package/dist/types.d.ts +48 -52
  276. package/dist/types.js +35 -35
  277. package/dist/url.d.ts +48 -53
  278. package/dist/url.js +38 -37
  279. package/dist/validation/json-parser.d.ts +19 -190
  280. package/dist/validation/json-parser.js +5 -69
  281. package/dist/validation/types.d.ts +9 -33
  282. package/dist/validation/types.js +1 -0
  283. package/dist/versions.d.ts +1 -0
  284. package/dist/versions.js +2 -1
  285. package/dist/words.d.ts +3 -6
  286. package/dist/words.js +1 -0
  287. package/dist/zod.js +1 -0
  288. package/package.json +34 -70
  289. package/dist/external/@inquirer/checkbox.js +0 -5
  290. package/dist/external/@inquirer/confirm.js +0 -5
  291. package/dist/external/@inquirer/input.js +0 -5
  292. package/dist/external/@inquirer/password.js +0 -5
  293. package/dist/external/@inquirer/search.js +0 -5
  294. package/dist/external/@inquirer/select.js +0 -5
  295. package/dist/functions.d.ts +0 -57
  296. package/dist/functions.js +0 -70
  297. package/dist/stdio/clear.d.ts +0 -140
  298. package/dist/stdio/clear.js +0 -95
  299. package/dist/stdio/mask.d.ts +0 -151
  300. package/dist/stdio/mask.js +0 -224
  301. package/dist/stdio/progress.d.ts +0 -148
  302. package/dist/stdio/progress.js +0 -212
  303. package/dist/stdio/prompts.d.ts +0 -195
  304. package/dist/stdio/prompts.js +0 -176
  305. package/dist/utils/get-ipc.d.ts +0 -15
package/dist/git.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ /**
2
+ * @fileoverview Git helpers built on top of `spawn`.
3
+ * Provides utilities for querying repository state - changed/staged files,
4
+ * diffs, and related metadata - with path normalization, glob filtering,
5
+ * lazy fs/path loading, and debug instrumentation.
6
+ */
1
7
  /**
2
8
  * Options for git diff operations.
3
9
  *
@@ -17,6 +23,44 @@
17
23
  * const files = await getChangedFiles({ cwd: '/path/to/repo/src' })
18
24
  * ```
19
25
  */
26
+ /**
27
+ * Options for filtering packages by git changes.
28
+ *
29
+ * Used to determine which packages in a monorepo have changed files.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // Filter packages with changes
34
+ * const changed = filterPackagesByChanges(packages)
35
+ *
36
+ * // Force include all packages
37
+ * const all = filterPackagesByChanges(packages, { force: true })
38
+ *
39
+ * // Use custom package key
40
+ * const changed = filterPackagesByChanges(
41
+ * packages,
42
+ * { packageKey: 'directory' }
43
+ * )
44
+ * ```
45
+ */
46
+ export interface FilterPackagesByChangesOptions {
47
+ /**
48
+ * Force include all packages regardless of changes.
49
+ *
50
+ * @default false
51
+ */
52
+ force?: boolean | undefined;
53
+ /**
54
+ * Key to access package path in package objects.
55
+ *
56
+ * @default 'path'
57
+ */
58
+ packageKey?: string | undefined;
59
+ /**
60
+ * Additional options for filtering.
61
+ */
62
+ [key: string]: unknown;
63
+ }
20
64
  export interface GitDiffOptions {
21
65
  /**
22
66
  * Return absolute file paths instead of relative paths.
@@ -65,44 +109,6 @@ export interface GitDiffOptions {
65
109
  */
66
110
  [key: string]: unknown;
67
111
  }
68
- /**
69
- * Options for filtering packages by git changes.
70
- *
71
- * Used to determine which packages in a monorepo have changed files.
72
- *
73
- * @example
74
- * ```typescript
75
- * // Filter packages with changes
76
- * const changed = filterPackagesByChanges(packages)
77
- *
78
- * // Force include all packages
79
- * const all = filterPackagesByChanges(packages, { force: true })
80
- *
81
- * // Use custom package key
82
- * const changed = filterPackagesByChanges(
83
- * packages,
84
- * { packageKey: 'directory' }
85
- * )
86
- * ```
87
- */
88
- export interface FilterPackagesByChangesOptions {
89
- /**
90
- * Force include all packages regardless of changes.
91
- *
92
- * @default false
93
- */
94
- force?: boolean | undefined;
95
- /**
96
- * Key to access package path in package objects.
97
- *
98
- * @default 'path'
99
- */
100
- packageKey?: string | undefined;
101
- /**
102
- * Additional options for filtering.
103
- */
104
- [key: string]: unknown;
105
- }
106
112
  /**
107
113
  * Find git repository root by walking up from the given directory.
108
114
  *
@@ -203,68 +209,6 @@ export declare function getChangedFiles(options?: GitDiffOptions | undefined): P
203
209
  * ```
204
210
  */
205
211
  export declare function getChangedFilesSync(options?: GitDiffOptions | undefined): string[];
206
- /**
207
- * Get unstaged modified files (changes not yet staged for commit).
208
- *
209
- * Uses `git diff --name-only` which returns only unstaged modifications
210
- * to tracked files. Does NOT include:
211
- * - Untracked files (new files not added to git)
212
- * - Staged changes (files added with `git add`)
213
- *
214
- * This is a focused check for uncommitted changes to existing tracked files.
215
- * Useful for detecting work-in-progress modifications before staging.
216
- *
217
- * @param options - Options controlling path format and filtering.
218
- * @returns Promise resolving to array of unstaged file paths.
219
- *
220
- * @example
221
- * ```typescript
222
- * // Get unstaged files
223
- * const files = await getUnstagedFiles()
224
- * // => ['src/foo.ts', 'src/bar.ts']
225
- *
226
- * // After staging some files
227
- * await spawn('git', ['add', 'src/foo.ts'])
228
- * const files = await getUnstagedFiles()
229
- * // => ['src/bar.ts'] (foo.ts no longer included)
230
- *
231
- * // Get absolute paths
232
- * const files = await getUnstagedFiles({ absolute: true })
233
- * // => ['/path/to/repo/src/bar.ts']
234
- * ```
235
- */
236
- export declare function getUnstagedFiles(options?: GitDiffOptions | undefined): Promise<string[]>;
237
- /**
238
- * Get unstaged modified files (changes not yet staged for commit).
239
- *
240
- * Synchronous version of `getUnstagedFiles()`. Uses `git diff --name-only`
241
- * which returns only unstaged modifications to tracked files. Does NOT include:
242
- * - Untracked files (new files not added to git)
243
- * - Staged changes (files added with `git add`)
244
- *
245
- * This is a focused check for uncommitted changes to existing tracked files.
246
- * Useful for detecting work-in-progress modifications before staging.
247
- *
248
- * @param options - Options controlling path format and filtering.
249
- * @returns Array of unstaged file paths.
250
- *
251
- * @example
252
- * ```typescript
253
- * // Get unstaged files
254
- * const files = getUnstagedFilesSync()
255
- * // => ['src/foo.ts', 'src/bar.ts']
256
- *
257
- * // After staging some files
258
- * spawnSync('git', ['add', 'src/foo.ts'])
259
- * const files = getUnstagedFilesSync()
260
- * // => ['src/bar.ts'] (foo.ts no longer included)
261
- *
262
- * // Get absolute paths
263
- * const files = getUnstagedFilesSync({ absolute: true })
264
- * // => ['/path/to/repo/src/bar.ts']
265
- * ```
266
- */
267
- export declare function getUnstagedFilesSync(options?: GitDiffOptions | undefined): string[];
268
212
  /**
269
213
  * Get staged files ready for commit (changes added with `git add`).
270
214
  *
@@ -327,6 +271,68 @@ export declare function getStagedFiles(options?: GitDiffOptions | undefined): Pr
327
271
  * ```
328
272
  */
329
273
  export declare function getStagedFilesSync(options?: GitDiffOptions | undefined): string[];
274
+ /**
275
+ * Get unstaged modified files (changes not yet staged for commit).
276
+ *
277
+ * Uses `git diff --name-only` which returns only unstaged modifications
278
+ * to tracked files. Does NOT include:
279
+ * - Untracked files (new files not added to git)
280
+ * - Staged changes (files added with `git add`)
281
+ *
282
+ * This is a focused check for uncommitted changes to existing tracked files.
283
+ * Useful for detecting work-in-progress modifications before staging.
284
+ *
285
+ * @param options - Options controlling path format and filtering.
286
+ * @returns Promise resolving to array of unstaged file paths.
287
+ *
288
+ * @example
289
+ * ```typescript
290
+ * // Get unstaged files
291
+ * const files = await getUnstagedFiles()
292
+ * // => ['src/foo.ts', 'src/bar.ts']
293
+ *
294
+ * // After staging some files
295
+ * await spawn('git', ['add', 'src/foo.ts'])
296
+ * const files = await getUnstagedFiles()
297
+ * // => ['src/bar.ts'] (foo.ts no longer included)
298
+ *
299
+ * // Get absolute paths
300
+ * const files = await getUnstagedFiles({ absolute: true })
301
+ * // => ['/path/to/repo/src/bar.ts']
302
+ * ```
303
+ */
304
+ export declare function getUnstagedFiles(options?: GitDiffOptions | undefined): Promise<string[]>;
305
+ /**
306
+ * Get unstaged modified files (changes not yet staged for commit).
307
+ *
308
+ * Synchronous version of `getUnstagedFiles()`. Uses `git diff --name-only`
309
+ * which returns only unstaged modifications to tracked files. Does NOT include:
310
+ * - Untracked files (new files not added to git)
311
+ * - Staged changes (files added with `git add`)
312
+ *
313
+ * This is a focused check for uncommitted changes to existing tracked files.
314
+ * Useful for detecting work-in-progress modifications before staging.
315
+ *
316
+ * @param options - Options controlling path format and filtering.
317
+ * @returns Array of unstaged file paths.
318
+ *
319
+ * @example
320
+ * ```typescript
321
+ * // Get unstaged files
322
+ * const files = getUnstagedFilesSync()
323
+ * // => ['src/foo.ts', 'src/bar.ts']
324
+ *
325
+ * // After staging some files
326
+ * spawnSync('git', ['add', 'src/foo.ts'])
327
+ * const files = getUnstagedFilesSync()
328
+ * // => ['src/bar.ts'] (foo.ts no longer included)
329
+ *
330
+ * // Get absolute paths
331
+ * const files = getUnstagedFilesSync({ absolute: true })
332
+ * // => ['/path/to/repo/src/bar.ts']
333
+ * ```
334
+ */
335
+ export declare function getUnstagedFilesSync(options?: GitDiffOptions | undefined): string[];
330
336
  /**
331
337
  * Check if a file or directory has any git changes.
332
338
  *
@@ -399,142 +405,142 @@ export declare function isChanged(pathname: string, options?: GitDiffOptions | u
399
405
  */
400
406
  export declare function isChangedSync(pathname: string, options?: GitDiffOptions | undefined): boolean;
401
407
  /**
402
- * Check if a file or directory has unstaged changes.
408
+ * Check if a file or directory is staged for commit.
403
409
  *
404
- * Checks if the given pathname has modifications that are not yet staged
405
- * for commit (changes not added with `git add`). Does NOT include:
406
- * - Staged changes (already added with `git add`)
410
+ * Checks if the given pathname has changes staged with `git add` that will
411
+ * be included in the next commit. Does NOT include:
412
+ * - Unstaged modifications (changes not added with `git add`)
407
413
  * - Untracked files (new files not in git)
408
414
  *
409
- * For directories, returns `true` if ANY file within the directory has
410
- * unstaged changes.
415
+ * For directories, returns `true` if ANY file within the directory is staged.
411
416
  *
412
417
  * Symlinks in the pathname and cwd are automatically resolved using
413
418
  * `fs.realpathSync()` before comparison.
414
419
  *
415
420
  * @param pathname - File or directory path to check.
416
421
  * @param options - Options for the git diff check.
417
- * @returns Promise resolving to `true` if path has unstaged changes, `false` otherwise.
422
+ * @returns Promise resolving to `true` if path is staged, `false` otherwise.
418
423
  *
419
424
  * @example
420
425
  * ```typescript
421
- * // Check if file has unstaged changes
422
- * const unstaged = await isUnstaged('src/foo.ts')
423
- * // => true
426
+ * // Check if file is staged
427
+ * const staged = await isStaged('src/foo.ts')
428
+ * // => false
424
429
  *
425
- * // After staging the file
430
+ * // Stage the file
426
431
  * await spawn('git', ['add', 'src/foo.ts'])
427
- * const unstaged = await isUnstaged('src/foo.ts')
428
- * // => false
432
+ * const staged = await isStaged('src/foo.ts')
433
+ * // => true
429
434
  *
430
435
  * // Check directory
431
- * const unstaged = await isUnstaged('src/')
432
- * // => true (if any file in src/ has unstaged changes)
436
+ * const staged = await isStaged('src/')
437
+ * // => true (if any file in src/ is staged)
433
438
  * ```
434
439
  */
435
- export declare function isUnstaged(pathname: string, options?: GitDiffOptions | undefined): Promise<boolean>;
440
+ export declare function isStaged(pathname: string, options?: GitDiffOptions | undefined): Promise<boolean>;
436
441
  /**
437
- * Check if a file or directory has unstaged changes.
442
+ * Check if a file or directory is staged for commit.
438
443
  *
439
- * Synchronous version of `isUnstaged()`. Checks if the given pathname has
440
- * modifications that are not yet staged for commit (changes not added with
441
- * `git add`). Does NOT include:
442
- * - Staged changes (already added with `git add`)
444
+ * Synchronous version of `isStaged()`. Checks if the given pathname has
445
+ * changes staged with `git add` that will be included in the next commit.
446
+ * Does NOT include:
447
+ * - Unstaged modifications (changes not added with `git add`)
443
448
  * - Untracked files (new files not in git)
444
449
  *
445
- * For directories, returns `true` if ANY file within the directory has
446
- * unstaged changes.
450
+ * For directories, returns `true` if ANY file within the directory is staged.
447
451
  *
448
452
  * Symlinks in the pathname and cwd are automatically resolved using
449
453
  * `fs.realpathSync()` before comparison.
450
454
  *
451
455
  * @param pathname - File or directory path to check.
452
456
  * @param options - Options for the git diff check.
453
- * @returns `true` if path has unstaged changes, `false` otherwise.
457
+ * @returns `true` if path is staged, `false` otherwise.
454
458
  *
455
459
  * @example
456
460
  * ```typescript
457
- * // Check if file has unstaged changes
458
- * const unstaged = isUnstagedSync('src/foo.ts')
459
- * // => true
461
+ * // Check if file is staged
462
+ * const staged = isStagedSync('src/foo.ts')
463
+ * // => false
460
464
  *
461
- * // After staging the file
465
+ * // Stage the file
462
466
  * spawnSync('git', ['add', 'src/foo.ts'])
463
- * const unstaged = isUnstagedSync('src/foo.ts')
464
- * // => false
467
+ * const staged = isStagedSync('src/foo.ts')
468
+ * // => true
465
469
  *
466
470
  * // Check directory
467
- * const unstaged = isUnstagedSync('src/')
468
- * // => true (if any file in src/ has unstaged changes)
471
+ * const staged = isStagedSync('src/')
472
+ * // => true (if any file in src/ is staged)
469
473
  * ```
470
474
  */
471
- export declare function isUnstagedSync(pathname: string, options?: GitDiffOptions | undefined): boolean;
475
+ export declare function isStagedSync(pathname: string, options?: GitDiffOptions | undefined): boolean;
472
476
  /**
473
- * Check if a file or directory is staged for commit.
477
+ * Check if a file or directory has unstaged changes.
474
478
  *
475
- * Checks if the given pathname has changes staged with `git add` that will
476
- * be included in the next commit. Does NOT include:
477
- * - Unstaged modifications (changes not added with `git add`)
479
+ * Checks if the given pathname has modifications that are not yet staged
480
+ * for commit (changes not added with `git add`). Does NOT include:
481
+ * - Staged changes (already added with `git add`)
478
482
  * - Untracked files (new files not in git)
479
483
  *
480
- * For directories, returns `true` if ANY file within the directory is staged.
484
+ * For directories, returns `true` if ANY file within the directory has
485
+ * unstaged changes.
481
486
  *
482
487
  * Symlinks in the pathname and cwd are automatically resolved using
483
488
  * `fs.realpathSync()` before comparison.
484
489
  *
485
490
  * @param pathname - File or directory path to check.
486
491
  * @param options - Options for the git diff check.
487
- * @returns Promise resolving to `true` if path is staged, `false` otherwise.
492
+ * @returns Promise resolving to `true` if path has unstaged changes, `false` otherwise.
488
493
  *
489
494
  * @example
490
495
  * ```typescript
491
- * // Check if file is staged
492
- * const staged = await isStaged('src/foo.ts')
493
- * // => false
496
+ * // Check if file has unstaged changes
497
+ * const unstaged = await isUnstaged('src/foo.ts')
498
+ * // => true
494
499
  *
495
- * // Stage the file
500
+ * // After staging the file
496
501
  * await spawn('git', ['add', 'src/foo.ts'])
497
- * const staged = await isStaged('src/foo.ts')
498
- * // => true
502
+ * const unstaged = await isUnstaged('src/foo.ts')
503
+ * // => false
499
504
  *
500
505
  * // Check directory
501
- * const staged = await isStaged('src/')
502
- * // => true (if any file in src/ is staged)
506
+ * const unstaged = await isUnstaged('src/')
507
+ * // => true (if any file in src/ has unstaged changes)
503
508
  * ```
504
509
  */
505
- export declare function isStaged(pathname: string, options?: GitDiffOptions | undefined): Promise<boolean>;
510
+ export declare function isUnstaged(pathname: string, options?: GitDiffOptions | undefined): Promise<boolean>;
506
511
  /**
507
- * Check if a file or directory is staged for commit.
512
+ * Check if a file or directory has unstaged changes.
508
513
  *
509
- * Synchronous version of `isStaged()`. Checks if the given pathname has
510
- * changes staged with `git add` that will be included in the next commit.
511
- * Does NOT include:
512
- * - Unstaged modifications (changes not added with `git add`)
514
+ * Synchronous version of `isUnstaged()`. Checks if the given pathname has
515
+ * modifications that are not yet staged for commit (changes not added with
516
+ * `git add`). Does NOT include:
517
+ * - Staged changes (already added with `git add`)
513
518
  * - Untracked files (new files not in git)
514
519
  *
515
- * For directories, returns `true` if ANY file within the directory is staged.
520
+ * For directories, returns `true` if ANY file within the directory has
521
+ * unstaged changes.
516
522
  *
517
523
  * Symlinks in the pathname and cwd are automatically resolved using
518
524
  * `fs.realpathSync()` before comparison.
519
525
  *
520
526
  * @param pathname - File or directory path to check.
521
527
  * @param options - Options for the git diff check.
522
- * @returns `true` if path is staged, `false` otherwise.
528
+ * @returns `true` if path has unstaged changes, `false` otherwise.
523
529
  *
524
530
  * @example
525
531
  * ```typescript
526
- * // Check if file is staged
527
- * const staged = isStagedSync('src/foo.ts')
528
- * // => false
532
+ * // Check if file has unstaged changes
533
+ * const unstaged = isUnstagedSync('src/foo.ts')
534
+ * // => true
529
535
  *
530
- * // Stage the file
536
+ * // After staging the file
531
537
  * spawnSync('git', ['add', 'src/foo.ts'])
532
- * const staged = isStagedSync('src/foo.ts')
533
- * // => true
538
+ * const unstaged = isUnstagedSync('src/foo.ts')
539
+ * // => false
534
540
  *
535
541
  * // Check directory
536
- * const staged = isStagedSync('src/')
537
- * // => true (if any file in src/ is staged)
542
+ * const unstaged = isUnstagedSync('src/')
543
+ * // => true (if any file in src/ has unstaged changes)
538
544
  * ```
539
545
  */
540
- export declare function isStagedSync(pathname: string, options?: GitDiffOptions | undefined): boolean;
546
+ export declare function isUnstagedSync(pathname: string, options?: GitDiffOptions | undefined): boolean;