@socketsecurity/lib 5.18.2 → 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.
- package/CHANGELOG.md +43 -0
- package/README.md +6 -5
- package/dist/abort.d.ts +3 -0
- package/dist/abort.js +1 -0
- package/dist/agent.d.ts +66 -49
- package/dist/agent.js +51 -50
- package/dist/ansi.d.ts +2 -5
- package/dist/ansi.js +3 -2
- package/dist/archives.d.ts +25 -21
- package/dist/archives.js +35 -34
- package/dist/argv/flags.d.ts +100 -91
- package/dist/argv/flags.js +88 -87
- package/dist/argv/parse.d.ts +30 -40
- package/dist/argv/parse.js +33 -32
- package/dist/arrays.d.ts +4 -8
- package/dist/arrays.js +1 -0
- package/dist/bin.d.ts +7 -5
- package/dist/bin.js +52 -29
- package/dist/cacache.d.ts +13 -12
- package/dist/cacache.js +9 -8
- package/dist/cache-with-ttl.d.ts +53 -35
- package/dist/cache-with-ttl.js +1 -0
- package/dist/colors.d.ts +5 -5
- package/dist/colors.js +1 -0
- package/dist/constants/agents.d.ts +5 -9
- package/dist/constants/agents.js +3 -2
- package/dist/constants/core.d.ts +5 -10
- package/dist/constants/core.js +2 -1
- package/dist/constants/encoding.d.ts +3 -3
- package/dist/constants/encoding.js +1 -0
- package/dist/constants/github.d.ts +3 -3
- package/dist/constants/github.js +1 -0
- package/dist/constants/licenses.d.ts +9 -2
- package/dist/constants/licenses.js +1 -0
- package/dist/constants/lifecycle-script-names.js +1 -0
- package/dist/constants/maintained-node-versions.d.ts +3 -0
- package/dist/constants/maintained-node-versions.js +1 -0
- package/dist/constants/node.d.ts +125 -16
- package/dist/constants/node.js +74 -73
- package/dist/constants/package-default-node-range.d.ts +3 -1
- package/dist/constants/package-default-node-range.js +2 -1
- package/dist/constants/package-default-socket-categories.d.ts +0 -1
- package/dist/constants/package-default-socket-categories.js +1 -0
- package/dist/constants/packages.d.ts +12 -17
- package/dist/constants/packages.js +31 -16
- package/dist/constants/platform.d.ts +1 -2
- package/dist/constants/platform.js +2 -1
- package/dist/constants/process.d.ts +18 -0
- package/dist/constants/process.js +1 -0
- package/dist/constants/socket.d.ts +4 -10
- package/dist/constants/socket.js +2 -1
- package/dist/constants/testing.d.ts +3 -3
- package/dist/constants/testing.js +1 -0
- package/dist/constants/time.d.ts +3 -4
- package/dist/constants/time.js +1 -0
- package/dist/constants/typescript.d.ts +10 -3
- package/dist/constants/typescript.js +5 -4
- package/dist/cover/code.d.ts +3 -0
- package/dist/cover/code.js +12 -12
- package/dist/cover/formatters.d.ts +12 -9
- package/dist/cover/formatters.js +19 -18
- package/dist/cover/type.d.ts +3 -0
- package/dist/cover/type.js +1 -0
- package/dist/cover/types.js +1 -0
- package/dist/debug.d.ts +32 -47
- package/dist/debug.js +97 -96
- package/dist/dlx/arborist.d.ts +134 -0
- package/dist/dlx/arborist.js +177 -0
- package/dist/dlx/binary.d.ts +25 -9
- package/dist/dlx/binary.js +34 -12
- package/dist/dlx/cache.d.ts +1 -0
- package/dist/dlx/cache.js +2 -1
- package/dist/dlx/detect.d.ts +15 -0
- package/dist/dlx/detect.js +28 -20
- package/dist/dlx/dir.d.ts +1 -11
- package/dist/dlx/dir.js +2 -12
- package/dist/dlx/integrity.d.ts +86 -0
- package/dist/dlx/integrity.js +112 -0
- package/dist/dlx/lockfile.d.ts +115 -0
- package/dist/dlx/lockfile.js +139 -0
- package/dist/dlx/manifest.d.ts +26 -1
- package/dist/dlx/manifest.js +9 -6
- package/dist/dlx/package.d.ts +58 -3
- package/dist/dlx/package.js +101 -74
- package/dist/dlx/packages.d.ts +1 -11
- package/dist/dlx/packages.js +3 -14
- package/dist/dlx/paths.d.ts +1 -0
- package/dist/dlx/paths.js +2 -1
- package/dist/effects/pulse-frames.js +1 -0
- package/dist/effects/text-shimmer.d.ts +13 -2
- package/dist/effects/text-shimmer.js +50 -46
- package/dist/effects/types.js +1 -0
- package/dist/effects/ultra.js +1 -0
- package/dist/env/ci.d.ts +6 -1
- package/dist/env/ci.js +1 -0
- package/dist/env/debug.d.ts +5 -1
- package/dist/env/debug.js +1 -0
- package/dist/env/github.d.ts +19 -23
- package/dist/env/github.js +5 -4
- package/dist/env/helpers.d.ts +21 -9
- package/dist/env/helpers.js +5 -11
- package/dist/env/home.d.ts +17 -4
- package/dist/env/home.js +2 -1
- package/dist/env/locale.d.ts +4 -3
- package/dist/env/locale.js +1 -0
- package/dist/env/node-auth-token.d.ts +5 -1
- package/dist/env/node-auth-token.js +1 -0
- package/dist/env/node-env.d.ts +5 -1
- package/dist/env/node-env.js +1 -0
- package/dist/env/npm.d.ts +4 -5
- package/dist/env/npm.js +1 -0
- package/dist/env/package-manager.d.ts +4 -3
- package/dist/env/package-manager.js +2 -1
- package/dist/env/path.d.ts +5 -1
- package/dist/env/path.js +1 -0
- package/dist/env/pre-commit.d.ts +5 -1
- package/dist/env/pre-commit.js +1 -0
- package/dist/env/rewire.d.ts +10 -0
- package/dist/env/rewire.js +7 -5
- package/dist/env/shell.d.ts +5 -1
- package/dist/env/shell.js +1 -0
- package/dist/env/socket-cli-shadow.d.ts +4 -5
- package/dist/env/socket-cli-shadow.js +1 -0
- package/dist/env/socket-cli.d.ts +4 -14
- package/dist/env/socket-cli.js +1 -0
- package/dist/env/socket.d.ts +6 -18
- package/dist/env/socket.js +4 -3
- package/dist/env/temp-dir.d.ts +4 -3
- package/dist/env/temp-dir.js +1 -0
- package/dist/env/term.d.ts +5 -1
- package/dist/env/term.js +1 -0
- package/dist/env/test.d.ts +4 -3
- package/dist/env/test.js +1 -0
- package/dist/env/windows.d.ts +4 -4
- package/dist/env/windows.js +1 -0
- package/dist/env/xdg.d.ts +4 -3
- package/dist/env/xdg.js +1 -0
- package/dist/env.d.ts +83 -23
- package/dist/env.js +112 -80
- package/dist/errors.js +1 -0
- package/dist/external/@npmcli/package-json.js +9 -3968
- package/dist/external/@socketregistry/packageurl-js.js +2 -2
- package/dist/external/debug.js +162 -328
- package/dist/external/external-pack.js +3 -2835
- package/dist/external/npm-pack.js +13939 -33342
- package/dist/external/zod.js +160 -7558
- package/dist/fs.d.ts +92 -113
- package/dist/fs.js +35 -35
- package/dist/git.d.ts +170 -164
- package/dist/git.js +113 -87
- package/dist/github.d.ts +249 -227
- package/dist/github.js +82 -81
- package/dist/globs.d.ts +31 -17
- package/dist/globs.js +51 -58
- package/dist/http-request.d.ts +99 -99
- package/dist/http-request.js +182 -156
- package/dist/ipc-cli.d.ts +28 -0
- package/dist/{utils/get-ipc.js → ipc-cli.js} +4 -3
- package/dist/ipc.d.ts +9 -299
- package/dist/ipc.js +18 -204
- package/dist/json/edit.d.ts +3 -1
- package/dist/json/edit.js +30 -30
- package/dist/json/format.d.ts +36 -36
- package/dist/json/format.js +22 -21
- package/dist/json/parse.d.ts +4 -2
- package/dist/json/parse.js +1 -0
- package/dist/json/types.js +1 -0
- package/dist/{links/index.d.ts → links.d.ts} +6 -2
- package/dist/{links/index.js → links.js} +5 -4
- package/dist/logger.d.ts +4 -6
- package/dist/logger.js +61 -53
- package/dist/memoization.d.ts +52 -49
- package/dist/memoization.js +55 -33
- package/dist/objects.d.ts +25 -44
- package/dist/objects.js +2 -1
- package/dist/package-extensions.d.ts +6 -0
- package/dist/package-extensions.js +2 -1
- package/dist/packages/edit.d.ts +3 -5
- package/dist/packages/edit.js +4 -3
- package/dist/packages/exports.d.ts +11 -14
- package/dist/packages/exports.js +11 -10
- package/dist/packages/isolation.d.ts +4 -0
- package/dist/packages/isolation.js +20 -19
- package/dist/packages/licenses.d.ts +3 -10
- package/dist/packages/licenses.js +2 -1
- package/dist/packages/manifest.d.ts +3 -3
- package/dist/packages/manifest.js +1 -0
- package/dist/packages/normalize.d.ts +3 -4
- package/dist/packages/normalize.js +1 -0
- package/dist/packages/operations.d.ts +3 -10
- package/dist/packages/operations.js +1 -0
- package/dist/packages/provenance.d.ts +10 -8
- package/dist/packages/provenance.js +55 -54
- package/dist/packages/specs.d.ts +3 -5
- package/dist/packages/specs.js +1 -0
- package/dist/packages/validation.d.ts +3 -3
- package/dist/packages/validation.js +1 -0
- package/dist/packages.d.ts +2 -17
- package/dist/packages.js +2 -1
- package/dist/paths/dirnames.d.ts +0 -2
- package/dist/paths/dirnames.js +1 -0
- package/dist/paths/exts.d.ts +0 -1
- package/dist/paths/exts.js +1 -0
- package/dist/paths/filenames.d.ts +0 -1
- package/dist/paths/filenames.js +1 -0
- package/dist/paths/globs.d.ts +0 -1
- package/dist/paths/globs.js +1 -0
- package/dist/paths/normalize.d.ts +115 -123
- package/dist/paths/normalize.js +128 -127
- package/dist/paths/packages.d.ts +3 -2
- package/dist/paths/packages.js +2 -1
- package/dist/paths/rewire.d.ts +9 -0
- package/dist/paths/rewire.js +5 -3
- package/dist/paths/socket.d.ts +37 -23
- package/dist/paths/socket.js +26 -25
- package/dist/performance.d.ts +87 -84
- package/dist/performance.js +97 -96
- package/dist/process-lock.d.ts +41 -1
- package/dist/process-lock.js +24 -17
- package/dist/promise-queue.d.ts +6 -0
- package/dist/promise-queue.js +1 -0
- package/dist/promises.d.ts +40 -55
- package/dist/promises.js +12 -11
- package/dist/regexps.d.ts +0 -5
- package/dist/regexps.js +1 -0
- package/dist/releases/github.d.ts +59 -63
- package/dist/releases/github.js +95 -100
- package/dist/releases/socket-btm.d.ts +9 -2
- package/dist/releases/socket-btm.js +32 -25
- package/dist/sea.d.ts +5 -0
- package/dist/sea.js +1 -0
- package/dist/shadow.d.ts +4 -0
- package/dist/shadow.js +1 -0
- package/dist/signal-exit.d.ts +7 -7
- package/dist/signal-exit.js +46 -45
- package/dist/sorts.d.ts +5 -7
- package/dist/sorts.js +11 -10
- package/dist/spawn.d.ts +96 -77
- package/dist/spawn.js +39 -38
- package/dist/spinner.d.ts +21 -22
- package/dist/spinner.js +15 -11
- package/dist/ssri.d.ts +31 -36
- package/dist/ssri.js +15 -14
- package/dist/stdio/_stream.d.ts +31 -0
- package/dist/stdio/_stream.js +57 -0
- package/dist/stdio/divider.d.ts +40 -36
- package/dist/stdio/divider.js +10 -9
- package/dist/stdio/footer.d.ts +20 -0
- package/dist/stdio/footer.js +12 -2
- package/dist/stdio/header.d.ts +4 -16
- package/dist/stdio/header.js +1 -9
- package/dist/stdio/stderr.d.ts +51 -39
- package/dist/stdio/stderr.js +19 -22
- package/dist/stdio/stdout.d.ts +54 -52
- package/dist/stdio/stdout.js +35 -33
- package/dist/streams.d.ts +4 -3
- package/dist/streams.js +1 -0
- package/dist/strings.d.ts +31 -85
- package/dist/strings.js +5 -49
- package/dist/suppress-warnings.d.ts +32 -15
- package/dist/suppress-warnings.js +14 -13
- package/dist/tables.d.ts +30 -26
- package/dist/tables.js +24 -23
- package/dist/temporary-executor.d.ts +4 -0
- package/dist/temporary-executor.js +1 -0
- package/dist/themes/context.d.ts +30 -26
- package/dist/themes/context.js +19 -18
- package/dist/themes/index.d.ts +0 -4
- package/dist/themes/index.js +1 -0
- package/dist/themes/themes.d.ts +1 -1
- package/dist/themes/themes.js +1 -0
- package/dist/themes/types.js +1 -0
- package/dist/themes/utils.d.ts +46 -43
- package/dist/themes/utils.js +45 -44
- package/dist/types.d.ts +48 -52
- package/dist/types.js +35 -35
- package/dist/url.d.ts +48 -53
- package/dist/url.js +38 -37
- package/dist/validation/json-parser.d.ts +19 -190
- package/dist/validation/json-parser.js +5 -69
- package/dist/validation/types.d.ts +9 -33
- package/dist/validation/types.js +1 -0
- package/dist/versions.d.ts +1 -0
- package/dist/versions.js +2 -1
- package/dist/words.d.ts +3 -6
- package/dist/words.js +1 -0
- package/dist/zod.js +1 -0
- package/package.json +34 -66
- package/dist/external/@inquirer/checkbox.js +0 -5
- package/dist/external/@inquirer/confirm.js +0 -5
- package/dist/external/@inquirer/input.js +0 -5
- package/dist/external/@inquirer/password.js +0 -5
- package/dist/external/@inquirer/search.js +0 -5
- package/dist/external/@inquirer/select.js +0 -5
- package/dist/functions.d.ts +0 -57
- package/dist/functions.js +0 -70
- package/dist/stdio/clear.d.ts +0 -140
- package/dist/stdio/clear.js +0 -95
- package/dist/stdio/mask.d.ts +0 -151
- package/dist/stdio/mask.js +0 -224
- package/dist/stdio/progress.d.ts +0 -148
- package/dist/stdio/progress.js +0 -212
- package/dist/stdio/prompts.d.ts +0 -195
- package/dist/stdio/prompts.js +0 -176
- 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
|
|
408
|
+
* Check if a file or directory is staged for commit.
|
|
403
409
|
*
|
|
404
|
-
* Checks if the given pathname has
|
|
405
|
-
*
|
|
406
|
-
* -
|
|
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
|
|
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
|
|
422
|
+
* @returns Promise resolving to `true` if path is staged, `false` otherwise.
|
|
418
423
|
*
|
|
419
424
|
* @example
|
|
420
425
|
* ```typescript
|
|
421
|
-
* // Check if file
|
|
422
|
-
* const
|
|
423
|
-
* // =>
|
|
426
|
+
* // Check if file is staged
|
|
427
|
+
* const staged = await isStaged('src/foo.ts')
|
|
428
|
+
* // => false
|
|
424
429
|
*
|
|
425
|
-
* //
|
|
430
|
+
* // Stage the file
|
|
426
431
|
* await spawn('git', ['add', 'src/foo.ts'])
|
|
427
|
-
* const
|
|
428
|
-
* // =>
|
|
432
|
+
* const staged = await isStaged('src/foo.ts')
|
|
433
|
+
* // => true
|
|
429
434
|
*
|
|
430
435
|
* // Check directory
|
|
431
|
-
* const
|
|
432
|
-
* // => true (if any file in src/
|
|
436
|
+
* const staged = await isStaged('src/')
|
|
437
|
+
* // => true (if any file in src/ is staged)
|
|
433
438
|
* ```
|
|
434
439
|
*/
|
|
435
|
-
export declare function
|
|
440
|
+
export declare function isStaged(pathname: string, options?: GitDiffOptions | undefined): Promise<boolean>;
|
|
436
441
|
/**
|
|
437
|
-
* Check if a file or directory
|
|
442
|
+
* Check if a file or directory is staged for commit.
|
|
438
443
|
*
|
|
439
|
-
* Synchronous version of `
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
* -
|
|
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
|
|
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
|
|
457
|
+
* @returns `true` if path is staged, `false` otherwise.
|
|
454
458
|
*
|
|
455
459
|
* @example
|
|
456
460
|
* ```typescript
|
|
457
|
-
* // Check if file
|
|
458
|
-
* const
|
|
459
|
-
* // =>
|
|
461
|
+
* // Check if file is staged
|
|
462
|
+
* const staged = isStagedSync('src/foo.ts')
|
|
463
|
+
* // => false
|
|
460
464
|
*
|
|
461
|
-
* //
|
|
465
|
+
* // Stage the file
|
|
462
466
|
* spawnSync('git', ['add', 'src/foo.ts'])
|
|
463
|
-
* const
|
|
464
|
-
* // =>
|
|
467
|
+
* const staged = isStagedSync('src/foo.ts')
|
|
468
|
+
* // => true
|
|
465
469
|
*
|
|
466
470
|
* // Check directory
|
|
467
|
-
* const
|
|
468
|
-
* // => true (if any file in src/
|
|
471
|
+
* const staged = isStagedSync('src/')
|
|
472
|
+
* // => true (if any file in src/ is staged)
|
|
469
473
|
* ```
|
|
470
474
|
*/
|
|
471
|
-
export declare function
|
|
475
|
+
export declare function isStagedSync(pathname: string, options?: GitDiffOptions | undefined): boolean;
|
|
472
476
|
/**
|
|
473
|
-
* Check if a file or directory
|
|
477
|
+
* Check if a file or directory has unstaged changes.
|
|
474
478
|
*
|
|
475
|
-
* Checks if the given pathname has
|
|
476
|
-
*
|
|
477
|
-
* -
|
|
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
|
|
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
|
|
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
|
|
492
|
-
* const
|
|
493
|
-
* // =>
|
|
496
|
+
* // Check if file has unstaged changes
|
|
497
|
+
* const unstaged = await isUnstaged('src/foo.ts')
|
|
498
|
+
* // => true
|
|
494
499
|
*
|
|
495
|
-
* //
|
|
500
|
+
* // After staging the file
|
|
496
501
|
* await spawn('git', ['add', 'src/foo.ts'])
|
|
497
|
-
* const
|
|
498
|
-
* // =>
|
|
502
|
+
* const unstaged = await isUnstaged('src/foo.ts')
|
|
503
|
+
* // => false
|
|
499
504
|
*
|
|
500
505
|
* // Check directory
|
|
501
|
-
* const
|
|
502
|
-
* // => true (if any file in src/
|
|
506
|
+
* const unstaged = await isUnstaged('src/')
|
|
507
|
+
* // => true (if any file in src/ has unstaged changes)
|
|
503
508
|
* ```
|
|
504
509
|
*/
|
|
505
|
-
export declare function
|
|
510
|
+
export declare function isUnstaged(pathname: string, options?: GitDiffOptions | undefined): Promise<boolean>;
|
|
506
511
|
/**
|
|
507
|
-
* Check if a file or directory
|
|
512
|
+
* Check if a file or directory has unstaged changes.
|
|
508
513
|
*
|
|
509
|
-
* Synchronous version of `
|
|
510
|
-
*
|
|
511
|
-
* Does NOT include:
|
|
512
|
-
* -
|
|
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
|
|
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
|
|
528
|
+
* @returns `true` if path has unstaged changes, `false` otherwise.
|
|
523
529
|
*
|
|
524
530
|
* @example
|
|
525
531
|
* ```typescript
|
|
526
|
-
* // Check if file
|
|
527
|
-
* const
|
|
528
|
-
* // =>
|
|
532
|
+
* // Check if file has unstaged changes
|
|
533
|
+
* const unstaged = isUnstagedSync('src/foo.ts')
|
|
534
|
+
* // => true
|
|
529
535
|
*
|
|
530
|
-
* //
|
|
536
|
+
* // After staging the file
|
|
531
537
|
* spawnSync('git', ['add', 'src/foo.ts'])
|
|
532
|
-
* const
|
|
533
|
-
* // =>
|
|
538
|
+
* const unstaged = isUnstagedSync('src/foo.ts')
|
|
539
|
+
* // => false
|
|
534
540
|
*
|
|
535
541
|
* // Check directory
|
|
536
|
-
* const
|
|
537
|
-
* // => true (if any file in src/
|
|
542
|
+
* const unstaged = isUnstagedSync('src/')
|
|
543
|
+
* // => true (if any file in src/ has unstaged changes)
|
|
538
544
|
* ```
|
|
539
545
|
*/
|
|
540
|
-
export declare function
|
|
546
|
+
export declare function isUnstagedSync(pathname: string, options?: GitDiffOptions | undefined): boolean;
|