@socketsecurity/lib 3.2.7 → 3.3.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 (79) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/README.md +18 -240
  3. package/dist/agent.js +10 -10
  4. package/dist/bin.js +4 -4
  5. package/dist/colors.d.ts +37 -0
  6. package/dist/colors.js +58 -0
  7. package/dist/constants/node.js +1 -1
  8. package/dist/constants/packages.js +7 -7
  9. package/dist/constants/process.js +1 -1
  10. package/dist/debug.js +3 -3
  11. package/dist/dlx-binary.js +4 -4
  12. package/dist/effects/text-shimmer.js +1 -1
  13. package/dist/env/ci.js +2 -2
  14. package/dist/env/debug.js +1 -1
  15. package/dist/env/github.js +1 -1
  16. package/dist/env/home.js +1 -1
  17. package/dist/env/locale.js +1 -1
  18. package/dist/env/node-auth-token.js +1 -1
  19. package/dist/env/node-env.js +1 -1
  20. package/dist/env/npm.js +1 -1
  21. package/dist/env/package-manager.js +1 -1
  22. package/dist/env/path.js +1 -1
  23. package/dist/env/pre-commit.js +2 -2
  24. package/dist/env/rewire.d.ts +5 -5
  25. package/dist/env/rewire.js +22 -14
  26. package/dist/env/shell.js +1 -1
  27. package/dist/env/socket-cli-shadow.js +2 -2
  28. package/dist/env/socket-cli.js +2 -2
  29. package/dist/env/socket.js +2 -2
  30. package/dist/env/temp-dir.js +1 -1
  31. package/dist/env/term.js +1 -1
  32. package/dist/env/test.js +3 -3
  33. package/dist/env/windows.js +1 -1
  34. package/dist/env/xdg.js +1 -1
  35. package/dist/external/@inquirer/confirm.js +2 -2
  36. package/dist/external/@inquirer/input.js +2 -2
  37. package/dist/external/@inquirer/password.js +3 -3
  38. package/dist/external/@inquirer/search.js +2 -2
  39. package/dist/external/@inquirer/select.js +3 -3
  40. package/dist/external/@socketregistry/yocto-spinner.js +1 -1
  41. package/dist/external/yoctocolors-cjs.js +1 -1
  42. package/dist/fs.js +4 -6
  43. package/dist/git.js +1 -1
  44. package/dist/github.js +2 -2
  45. package/dist/globs.js +3 -4
  46. package/dist/lifecycle-script-names.d.ts +9 -2
  47. package/dist/lifecycle-script-names.js +11 -4
  48. package/dist/logger.d.ts +106 -81
  49. package/dist/logger.js +234 -205
  50. package/dist/maintained-node-versions.d.ts +3 -2
  51. package/dist/maintained-node-versions.js +11 -4
  52. package/dist/objects.js +1 -1
  53. package/dist/package-default-node-range.d.ts +3 -2
  54. package/dist/package-default-node-range.js +12 -5
  55. package/dist/package-default-socket-categories.d.ts +7 -2
  56. package/dist/package-default-socket-categories.js +11 -4
  57. package/dist/package-extensions.d.ts +3 -2
  58. package/dist/package-extensions.js +11 -4
  59. package/dist/packages/exports.js +1 -1
  60. package/dist/packages/isolation.js +2 -2
  61. package/dist/packages/licenses.js +2 -2
  62. package/dist/packages/manifest.js +3 -3
  63. package/dist/packages/normalize.js +1 -1
  64. package/dist/packages/operations.js +5 -5
  65. package/dist/packages/provenance.js +1 -1
  66. package/dist/path.js +1 -1
  67. package/dist/paths.js +14 -14
  68. package/dist/promises.js +2 -2
  69. package/dist/spawn.js +1 -1
  70. package/dist/spinner.d.ts +29 -51
  71. package/dist/spinner.js +155 -149
  72. package/dist/stdio/prompts.js +1 -1
  73. package/dist/temporary-executor.js +1 -1
  74. package/dist/themes/types.d.ts +2 -1
  75. package/dist/themes/utils.d.ts +1 -1
  76. package/dist/utils/get-ipc.d.ts +0 -1
  77. package/dist/utils/get-ipc.js +4 -4
  78. package/dist/versions.d.ts +1 -1
  79. package/package.json +10 -9
@@ -27,7 +27,7 @@ __export(exports_exports, {
27
27
  resolvePackageJsonEntryExports: () => resolvePackageJsonEntryExports
28
28
  });
29
29
  module.exports = __toCommonJS(exports_exports);
30
- var import_core = require("../constants/core");
30
+ var import_core = require("#constants/core");
31
31
  var import_arrays = require("../arrays");
32
32
  var import_objects = require("../objects");
33
33
  // @__NO_SIDE_EFFECTS__
@@ -23,10 +23,10 @@ __export(isolation_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(isolation_exports);
25
25
  var import_fs = require("fs");
26
- var import_platform = require("../constants/platform");
26
+ var import_platform = require("#constants/platform");
27
27
  var import_path = require("../path");
28
28
  var import_operations = require("./operations");
29
- var import_paths = require("../paths");
29
+ var import_paths = require("#lib/paths");
30
30
  let _path;
31
31
  // @__NO_SIDE_EFFECTS__
32
32
  function getPath() {
@@ -29,8 +29,8 @@ __export(licenses_exports, {
29
29
  visitLicenses: () => visitLicenses
30
30
  });
31
31
  module.exports = __toCommonJS(licenses_exports);
32
- var import_core = require("../constants/core");
33
- var import_licenses = require("../constants/licenses");
32
+ var import_core = require("#constants/core");
33
+ var import_licenses = require("#constants/licenses");
34
34
  var import_objects = require("../objects");
35
35
  var import_path = require("../path");
36
36
  const copyLeftLicenses = (0, import_licenses.getCopyLeftLicenses)();
@@ -24,9 +24,9 @@ __export(manifest_exports, {
24
24
  fetchPackagePackument: () => fetchPackagePackument
25
25
  });
26
26
  module.exports = __toCommonJS(manifest_exports);
27
- var import_packages = require("../constants/packages");
28
- var import_process = require("../constants/process");
29
- var import_socket = require("../constants/socket");
27
+ var import_packages = require("#constants/packages");
28
+ var import_process = require("#constants/process");
29
+ var import_socket = require("#constants/socket");
30
30
  var import_arrays = require("../arrays");
31
31
  var import_objects = require("../objects");
32
32
  var import_exports = require("./exports");
@@ -71,7 +71,7 @@ let _findPackageExtensions;
71
71
  // @__NO_SIDE_EFFECTS__
72
72
  function _getFindPackageExtensions() {
73
73
  if (_findPackageExtensions === void 0) {
74
- const operations = require("./operations");
74
+ const operations = require("#packages/operations");
75
75
  _findPackageExtensions = operations.findPackageExtensions;
76
76
  }
77
77
  return _findPackageExtensions;
@@ -30,9 +30,9 @@ __export(operations_exports, {
30
30
  resolveRegistryPackageName: () => resolveRegistryPackageName
31
31
  });
32
32
  module.exports = __toCommonJS(operations_exports);
33
- var import_packages = require("../constants/packages");
34
- var import_process = require("../constants/process");
35
- var import_socket = require("../constants/socket");
33
+ var import_packages = require("#constants/packages");
34
+ var import_process = require("#constants/process");
35
+ var import_socket = require("#constants/socket");
36
36
  var import_fs = require("../fs");
37
37
  var import_objects = require("../objects");
38
38
  var import_normalize = require("./normalize");
@@ -110,7 +110,7 @@ let _toEditablePackageJson;
110
110
  // @__NO_SIDE_EFFECTS__
111
111
  function _getToEditablePackageJson() {
112
112
  if (_toEditablePackageJson === void 0) {
113
- _toEditablePackageJson = require("./editable").toEditablePackageJson;
113
+ _toEditablePackageJson = require("#packages/editable").toEditablePackageJson;
114
114
  }
115
115
  return _toEditablePackageJson;
116
116
  }
@@ -118,7 +118,7 @@ let _toEditablePackageJsonSync;
118
118
  // @__NO_SIDE_EFFECTS__
119
119
  function _getToEditablePackageJsonSync() {
120
120
  if (_toEditablePackageJsonSync === void 0) {
121
- _toEditablePackageJsonSync = require("./editable").toEditablePackageJsonSync;
121
+ _toEditablePackageJsonSync = require("#packages/editable").toEditablePackageJsonSync;
122
122
  }
123
123
  return _toEditablePackageJsonSync;
124
124
  }
@@ -23,7 +23,7 @@ __export(provenance_exports, {
23
23
  getProvenanceDetails: () => getProvenanceDetails
24
24
  });
25
25
  module.exports = __toCommonJS(provenance_exports);
26
- var import_agents = require("../constants/agents");
26
+ var import_agents = require("#constants/agents");
27
27
  var import_abort = require("../abort");
28
28
  var import_url = require("../url");
29
29
  const ArrayIsArray = Array.isArray;
package/dist/path.js CHANGED
@@ -30,7 +30,7 @@ __export(path_exports, {
30
30
  trimLeadingDotSlash: () => trimLeadingDotSlash
31
31
  });
32
32
  module.exports = __toCommonJS(path_exports);
33
- var import_platform = require("./constants/platform");
33
+ var import_platform = require("#constants/platform");
34
34
  var import_strings = require("./strings");
35
35
  const CHAR_BACKWARD_SLASH = 92;
36
36
  const CHAR_COLON = 58;
package/dist/paths.js CHANGED
@@ -47,9 +47,9 @@ __export(paths_exports, {
47
47
  module.exports = __toCommonJS(paths_exports);
48
48
  var os = __toESM(require("os"));
49
49
  var path = __toESM(require("path"));
50
- var import_home = require("./env/home");
51
- var import_socket = require("./env/socket");
52
- var import_windows = require("./env/windows");
50
+ var import_home = require("#env/home");
51
+ var import_socket = require("#env/socket");
52
+ var import_windows = require("#env/windows");
53
53
  var import_path = require("./path");
54
54
  var import_rewire = require("./paths/rewire");
55
55
  function getOsHomeDir() {
@@ -68,7 +68,7 @@ function getSocketUserDir() {
68
68
  path.join(
69
69
  getUserHomeDir(),
70
70
  /*@__INLINE__*/
71
- require("./constants/paths").DOT_SOCKET_DIR
71
+ require("#constants/paths").DOT_SOCKET_DIR
72
72
  )
73
73
  );
74
74
  }
@@ -79,7 +79,7 @@ function getSocketAppDir(appName) {
79
79
  path.join(
80
80
  getSocketUserDir(),
81
81
  `${/*@__INLINE__*/
82
- require("./constants/socket").SOCKET_APP_PREFIX}${appName}`
82
+ require("#constants/socket").SOCKET_APP_PREFIX}${appName}`
83
83
  )
84
84
  );
85
85
  }
@@ -95,7 +95,7 @@ function getSocketCacacheDir() {
95
95
  path.join(
96
96
  getSocketUserDir(),
97
97
  `${/*@__INLINE__*/
98
- require("./constants/socket").SOCKET_APP_PREFIX}cacache`
98
+ require("#constants/socket").SOCKET_APP_PREFIX}cacache`
99
99
  )
100
100
  );
101
101
  }
@@ -110,8 +110,8 @@ function getSocketDlxDir() {
110
110
  path.join(
111
111
  getSocketUserDir(),
112
112
  `${/*@__INLINE__*/
113
- require("./constants/socket").SOCKET_APP_PREFIX}${/*@__INLINE__*/
114
- require("./constants/socket").SOCKET_DLX_APP_NAME}`
113
+ require("#constants/socket").SOCKET_APP_PREFIX}${/*@__INLINE__*/
114
+ require("#constants/socket").SOCKET_DLX_APP_NAME}`
115
115
  )
116
116
  );
117
117
  }
@@ -120,7 +120,7 @@ function getSocketAppCacheDir(appName) {
120
120
  path.join(
121
121
  getSocketAppDir(appName),
122
122
  /*@__INLINE__*/
123
- require("./constants/paths").CACHE_DIR
123
+ require("#constants/paths").CACHE_DIR
124
124
  )
125
125
  );
126
126
  }
@@ -129,20 +129,20 @@ function getSocketAppCacheTtlDir(appName) {
129
129
  path.join(
130
130
  getSocketAppCacheDir(appName),
131
131
  /*@__INLINE__*/
132
- require("./constants/paths").CACHE_TTL_DIR
132
+ require("#constants/paths").CACHE_TTL_DIR
133
133
  )
134
134
  );
135
135
  }
136
136
  function getSocketCliDir() {
137
137
  return getSocketAppDir(
138
138
  /*@__INLINE__*/
139
- require("./constants/socket").SOCKET_CLI_APP_NAME
139
+ require("#constants/socket").SOCKET_CLI_APP_NAME
140
140
  );
141
141
  }
142
142
  function getSocketRegistryDir() {
143
143
  return getSocketAppDir(
144
144
  /*@__INLINE__*/
145
- require("./constants/socket").SOCKET_REGISTRY_APP_NAME
145
+ require("#constants/socket").SOCKET_REGISTRY_APP_NAME
146
146
  );
147
147
  }
148
148
  function getSocketRegistryGithubCacheDir() {
@@ -150,10 +150,10 @@ function getSocketRegistryGithubCacheDir() {
150
150
  path.join(
151
151
  getSocketAppCacheTtlDir(
152
152
  /*@__INLINE__*/
153
- require("./constants/socket").SOCKET_REGISTRY_APP_NAME
153
+ require("#constants/socket").SOCKET_REGISTRY_APP_NAME
154
154
  ),
155
155
  /*@__INLINE__*/
156
- require("./constants/github").CACHE_GITHUB_DIR
156
+ require("#constants/github").CACHE_GITHUB_DIR
157
157
  )
158
158
  );
159
159
  }
package/dist/promises.js CHANGED
@@ -29,8 +29,8 @@ __export(promises_exports, {
29
29
  resolveRetryOptions: () => resolveRetryOptions
30
30
  });
31
31
  module.exports = __toCommonJS(promises_exports);
32
- var import_core = require("./constants/core");
33
- var import_process = require("./constants/process");
32
+ var import_core = require("#constants/core");
33
+ var import_process = require("#constants/process");
34
34
  var import_arrays = require("./arrays");
35
35
  const abortSignal = (0, import_process.getAbortSignal)();
36
36
  let _timers;
package/dist/spawn.js CHANGED
@@ -25,7 +25,7 @@ __export(spawn_exports, {
25
25
  spawnSync: () => spawnSync
26
26
  });
27
27
  module.exports = __toCommonJS(spawn_exports);
28
- var import_process = require("./constants/process");
28
+ var import_process = require("#constants/process");
29
29
  var import_arrays = require("./arrays");
30
30
  var import_objects = require("./objects");
31
31
  var import_strings = require("./strings");
package/dist/spinner.d.ts CHANGED
@@ -3,39 +3,13 @@
3
3
  * Provides animated progress indicators with CI environment detection.
4
4
  */
5
5
  import type { Writable } from 'stream';
6
+ import type { ColorInherit, ColorRgb, ColorValue } from './colors';
6
7
  import type { ShimmerColorGradient, ShimmerConfig, ShimmerDirection, ShimmerState } from './effects/text-shimmer';
7
- /**
8
- * Named color values supported by the spinner.
9
- * Maps to standard terminal colors with bright variants.
10
- */
11
- export type ColorName = 'black' | 'blue' | 'blueBright' | 'cyan' | 'cyanBright' | 'gray' | 'green' | 'greenBright' | 'magenta' | 'magentaBright' | 'red' | 'redBright' | 'white' | 'whiteBright' | 'yellow' | 'yellowBright';
12
- /**
13
- * Special 'inherit' color value that uses the spinner's current color.
14
- * Used with shimmer effects to dynamically inherit the spinner color.
15
- */
16
- export type ColorInherit = 'inherit';
17
- /**
18
- * RGB color tuple with values 0-255 for red, green, and blue channels.
19
- * @example [140, 82, 255] // Socket purple
20
- * @example [255, 0, 0] // Red
21
- */
22
- export type ColorRgb = readonly [number, number, number];
23
- /**
24
- * Union of all supported color types: named colors or RGB tuples.
25
- */
26
- export type ColorValue = ColorName | ColorRgb;
27
8
  /**
28
9
  * Symbol types for status messages.
29
- * Maps to log symbols: success (), fail (), info (), warn (⚠).
30
- */
31
- export type SymbolType = 'fail' | 'info' | 'success' | 'warn';
32
- /**
33
- * Convert a color value to RGB tuple format.
34
- * Named colors are looked up in the `colorToRgb` map, RGB tuples are returned as-is.
35
- * @param color - Color name or RGB tuple
36
- * @returns RGB tuple with values 0-255
10
+ * Maps to log symbols: fail (), info (), reason (), success (✓), warn (⚠).
37
11
  */
38
- export declare function toRgb(color: ColorValue): ColorRgb;
12
+ export type SymbolType = 'fail' | 'info' | 'reason' | 'success' | 'warn';
39
13
  /**
40
14
  * Progress tracking information for display in spinner.
41
15
  * Used by `progress()` and `progressStep()` methods to show animated progress bars.
@@ -63,7 +37,7 @@ export type ShimmerInfo = ShimmerState & {
63
37
  * KEY BEHAVIORS:
64
38
  * - Methods WITHOUT "AndStop" keep the spinner running (e.g., `success()`, `fail()`)
65
39
  * - Methods WITH "AndStop" auto-clear the spinner line (e.g., `successAndStop()`, `failAndStop()`)
66
- * - Status messages (done, success, fail, info, warn, step, substep) go to stderr
40
+ * - Status messages (done, success, fail, info, warn, reason, step, substep) go to stderr
67
41
  * - Data messages (`log()`) go to stdout
68
42
  *
69
43
  * @example
@@ -95,6 +69,16 @@ export type Spinner = {
95
69
  debug(text?: string | undefined, ...extras: unknown[]): Spinner;
96
70
  /** Show debug message and stop the spinner (only if debug mode enabled) */
97
71
  debugAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
72
+ /** Decrease indentation by specified spaces (default: 2) */
73
+ dedent(spaces?: number | undefined): Spinner;
74
+ /** Disable shimmer effect (preserves config for later re-enable) */
75
+ disableShimmer(): Spinner;
76
+ /** Alias for `success()` - show success without stopping */
77
+ done(text?: string | undefined, ...extras: unknown[]): Spinner;
78
+ /** Alias for `successAndStop()` - show success and stop */
79
+ doneAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
80
+ /** Enable shimmer effect (restores saved config or uses defaults) */
81
+ enableShimmer(): Spinner;
98
82
  /** Alias for `fail()` - show error without stopping */
99
83
  error(text?: string | undefined, ...extras: unknown[]): Spinner;
100
84
  /** Alias for `failAndStop()` - show error and stop */
@@ -103,13 +87,8 @@ export type Spinner = {
103
87
  fail(text?: string | undefined, ...extras: unknown[]): Spinner;
104
88
  /** Show failure (✗) and stop the spinner, auto-clearing the line */
105
89
  failAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
106
- /** Get current spinner text (getter) or set new text (setter) */
107
- text(value: string): Spinner;
108
- text(): string;
109
90
  /** Increase indentation by specified spaces (default: 2) */
110
91
  indent(spaces?: number | undefined): Spinner;
111
- /** Decrease indentation by specified spaces (default: 2) */
112
- dedent(spaces?: number | undefined): Spinner;
113
92
  /** Show info (ℹ) message without stopping the spinner */
114
93
  info(text?: string | undefined, ...extras: unknown[]): Spinner;
115
94
  /** Show info (ℹ) message and stop the spinner, auto-clearing the line */
@@ -118,34 +97,33 @@ export type Spinner = {
118
97
  log(text?: string | undefined, ...extras: unknown[]): Spinner;
119
98
  /** Log and stop the spinner, auto-clearing the line */
120
99
  logAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
100
+ /** Update progress bar with current/total values and optional unit */
101
+ progress(current: number, total: number, unit?: string | undefined): Spinner;
102
+ /** Increment progress by specified amount (default: 1) */
103
+ progressStep(amount?: number): Spinner;
104
+ /** Show reasoning (∴) message without stopping the spinner */
105
+ reason(text?: string | undefined, ...extras: unknown[]): Spinner;
106
+ /** Show reasoning (∴) message and stop the spinner, auto-clearing the line */
107
+ reasonAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
108
+ /** Set complete shimmer configuration */
109
+ setShimmer(config: ShimmerConfig): Spinner;
121
110
  /** Start spinning with optional text */
122
111
  start(text?: string | undefined): Spinner;
112
+ /** Show main step message to stderr without stopping */
113
+ step(text?: string | undefined, ...extras: unknown[]): Spinner;
123
114
  /** Stop spinning and clear internal state, auto-clearing the line */
124
115
  stop(text?: string | undefined): Spinner;
125
116
  /** Stop and show final text without clearing the line */
126
117
  stopAndPersist(text?: string | undefined): Spinner;
127
- /** Show main step message to stderr without stopping */
128
- step(text?: string | undefined, ...extras: unknown[]): Spinner;
129
118
  /** Show indented substep message to stderr without stopping */
130
119
  substep(text?: string | undefined, ...extras: unknown[]): Spinner;
131
120
  /** Show success (✓) without stopping the spinner */
132
121
  success(text?: string | undefined, ...extras: unknown[]): Spinner;
133
122
  /** Show success (✓) and stop the spinner, auto-clearing the line */
134
123
  successAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
135
- /** Alias for `success()` - show success without stopping */
136
- done(text?: string | undefined, ...extras: unknown[]): Spinner;
137
- /** Alias for `successAndStop()` - show success and stop */
138
- doneAndStop(text?: string | undefined, ...extras: unknown[]): Spinner;
139
- /** Update progress bar with current/total values and optional unit */
140
- progress(current: number, total: number, unit?: string | undefined): Spinner;
141
- /** Increment progress by specified amount (default: 1) */
142
- progressStep(amount?: number): Spinner;
143
- /** Enable shimmer effect (restores saved config or uses defaults) */
144
- enableShimmer(): Spinner;
145
- /** Disable shimmer effect (preserves config for later re-enable) */
146
- disableShimmer(): Spinner;
147
- /** Set complete shimmer configuration */
148
- setShimmer(config: ShimmerConfig): Spinner;
124
+ /** Get current spinner text (getter) or set new text (setter) */
125
+ text(value: string): Spinner;
126
+ text(): string;
149
127
  /** Update partial shimmer configuration */
150
128
  updateShimmer(config: Partial<ShimmerConfig>): Spinner;
151
129
  /** Show warning (⚠) without stopping the spinner */