@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
package/dist/logger.d.ts CHANGED
@@ -13,6 +13,7 @@
13
13
  * console.log(`${LOG_SYMBOLS.warn} Warning message`)
14
14
  * console.log(`${LOG_SYMBOLS.info} Information message`)
15
15
  * console.log(`${LOG_SYMBOLS.step} Processing step`)
16
+ * console.log(`${LOG_SYMBOLS.reason} Working through logic`)
16
17
  * ```
17
18
  */
18
19
  type LogSymbols = {
@@ -20,6 +21,8 @@ type LogSymbols = {
20
21
  fail: string;
21
22
  /** Blue colored information symbol (ℹ or i in ASCII) */
22
23
  info: string;
24
+ /** Dimmed yellow reasoning/working symbol (∴ or :. in ASCII) */
25
+ reason: string;
23
26
  /** Cyan colored step symbol (→ or > in ASCII) */
24
27
  step: string;
25
28
  /** Green colored success symbol (✔ or √ in ASCII) */
@@ -62,9 +65,9 @@ export type { LogSymbols, LoggerMethods, Task };
62
65
  /**
63
66
  * Log symbols for terminal output with colored indicators.
64
67
  *
65
- * Provides colored Unicode symbols (✔, ✖, ⚠, ℹ, ) with ASCII fallbacks (√, ×, ‼, i, >)
68
+ * Provides colored Unicode symbols (✖, ℹ, ∴, →, ✔, ⚠) with ASCII fallbacks (×, i, :., >, √, ‼)
66
69
  * for terminals that don't support Unicode. Symbols are colored according to the active
67
- * theme's color palette (success, error, warning, info, step).
70
+ * theme's color palette (error, info, reason, step, success, warning).
68
71
  *
69
72
  * The symbols are lazily initialized on first access and automatically update when the
70
73
  * fallback theme changes (via setTheme()). Note that LOG_SYMBOLS reflect the global
@@ -74,11 +77,12 @@ export type { LogSymbols, LoggerMethods, Task };
74
77
  * ```typescript
75
78
  * import { LOG_SYMBOLS } from '@socketsecurity/lib'
76
79
  *
77
- * console.log(`${LOG_SYMBOLS.success} Build completed`) // Theme success color ✔
78
80
  * console.log(`${LOG_SYMBOLS.fail} Build failed`) // Theme error color ✖
79
- * console.log(`${LOG_SYMBOLS.warn} Deprecated API used`) // Theme warning color ⚠
80
81
  * console.log(`${LOG_SYMBOLS.info} Starting process`) // Theme info color ℹ
82
+ * console.log(`${LOG_SYMBOLS.reason} Analyzing dependencies`) // Dimmed yellow ∴
81
83
  * console.log(`${LOG_SYMBOLS.step} Processing files`) // Theme step color →
84
+ * console.log(`${LOG_SYMBOLS.success} Build completed`) // Theme success color ✔
85
+ * console.log(`${LOG_SYMBOLS.warn} Deprecated API used`) // Theme warning color ⚠
82
86
  * ```
83
87
  */
84
88
  export declare const LOG_SYMBOLS: Record<string, string>;
@@ -288,6 +292,35 @@ export declare class Logger {
288
292
  * ```
289
293
  */
290
294
  assert(value: unknown, ...message: unknown[]): this;
295
+ /**
296
+ * Clears the current line in the terminal.
297
+ *
298
+ * Moves the cursor to the beginning of the line and clears all content.
299
+ * Works in both TTY and non-TTY environments. Useful for clearing
300
+ * progress indicators created with `progress()`.
301
+ *
302
+ * The stream to clear (stderr or stdout) depends on whether the logger
303
+ * is stream-bound.
304
+ *
305
+ * @returns The logger instance for chaining
306
+ *
307
+ * @example
308
+ * ```typescript
309
+ * logger.progress('Loading...')
310
+ * // ... do work ...
311
+ * logger.clearLine()
312
+ * logger.success('Loaded')
313
+ *
314
+ * // Clear multiple progress updates
315
+ * for (const file of files) {
316
+ * logger.progress(`Processing ${file}`)
317
+ * processFile(file)
318
+ * logger.clearLine()
319
+ * }
320
+ * logger.success('All files processed')
321
+ * ```
322
+ */
323
+ clearLine(): this;
291
324
  /**
292
325
  * Clears the visible terminal screen.
293
326
  *
@@ -413,6 +446,28 @@ export declare class Logger {
413
446
  * ```
414
447
  */
415
448
  dirxml(...data: unknown[]): this;
449
+ /**
450
+ * Logs a completion message with a success symbol (alias for `success()`).
451
+ *
452
+ * Provides semantic clarity when marking something as "done". Does NOT
453
+ * automatically clear the current line - call `clearLine()` first if
454
+ * needed after using `progress()`.
455
+ *
456
+ * @param args - Message and additional arguments to log
457
+ * @returns The logger instance for chaining
458
+ *
459
+ * @example
460
+ * ```typescript
461
+ * logger.done('Task completed')
462
+ *
463
+ * // After progress indicator
464
+ * logger.progress('Processing...')
465
+ * // ... do work ...
466
+ * logger.clearLine()
467
+ * logger.done('Processing complete')
468
+ * ```
469
+ */
470
+ done(...args: unknown[]): this;
416
471
  /**
417
472
  * Logs an error message to stderr.
418
473
  *
@@ -614,6 +669,53 @@ export declare class Logger {
614
669
  * ```
615
670
  */
616
671
  logNewline(): this;
672
+ /**
673
+ * Shows a progress indicator that can be cleared with `clearLine()`.
674
+ *
675
+ * Displays a simple status message with a '∴' prefix. Does not include
676
+ * animation or spinner. Intended to be cleared once the operation completes.
677
+ * The output stream (stderr or stdout) depends on whether the logger is
678
+ * stream-bound.
679
+ *
680
+ * @param text - The progress message to display
681
+ * @returns The logger instance for chaining
682
+ *
683
+ * @example
684
+ * ```typescript
685
+ * logger.progress('Processing files...')
686
+ * // ... do work ...
687
+ * logger.clearLine()
688
+ * logger.success('Files processed')
689
+ *
690
+ * // Stream-specific progress
691
+ * logger.stdout.progress('Loading...')
692
+ * // ... do work ...
693
+ * logger.stdout.clearLine()
694
+ * logger.stdout.log('Done')
695
+ * ```
696
+ */
697
+ progress(text: string): this;
698
+ /**
699
+ * Logs a reasoning/working message with a dimmed yellow therefore symbol.
700
+ *
701
+ * Automatically prefixes the message with `LOG_SYMBOLS.reason` (dimmed yellow ∴).
702
+ * Useful for showing intermediate reasoning, logic steps, or "working" output
703
+ * that leads to a conclusion. Always outputs to stderr. If the message starts
704
+ * with an existing symbol, it will be stripped and replaced.
705
+ *
706
+ * @param args - Message and additional arguments to log
707
+ * @returns The logger instance for chaining
708
+ *
709
+ * @example
710
+ * ```typescript
711
+ * logger.step('Analyzing package security')
712
+ * logger.reason('Found 3 direct dependencies')
713
+ * logger.reason('Checking 47 transitive dependencies')
714
+ * logger.reason('Risk score: 8.5/10')
715
+ * logger.fail('Package blocked due to high risk')
716
+ * ```
717
+ */
718
+ reason(...args: unknown[]): this;
617
719
  /**
618
720
  * Resets all indentation to zero.
619
721
  *
@@ -706,28 +808,6 @@ export declare class Logger {
706
808
  * ```
707
809
  */
708
810
  success(...args: unknown[]): this;
709
- /**
710
- * Logs a completion message with a success symbol (alias for `success()`).
711
- *
712
- * Provides semantic clarity when marking something as "done". Does NOT
713
- * automatically clear the current line - call `clearLine()` first if
714
- * needed after using `progress()`.
715
- *
716
- * @param args - Message and additional arguments to log
717
- * @returns The logger instance for chaining
718
- *
719
- * @example
720
- * ```typescript
721
- * logger.done('Task completed')
722
- *
723
- * // After progress indicator
724
- * logger.progress('Processing...')
725
- * // ... do work ...
726
- * logger.clearLine()
727
- * logger.done('Processing complete')
728
- * ```
729
- */
730
- done(...args: unknown[]): this;
731
811
  /**
732
812
  * Displays data in a table format.
733
813
  *
@@ -893,61 +973,6 @@ export declare class Logger {
893
973
  * ```
894
974
  */
895
975
  write(text: string): this;
896
- /**
897
- * Shows a progress indicator that can be cleared with `clearLine()`.
898
- *
899
- * Displays a simple status message with a '∴' prefix. Does not include
900
- * animation or spinner. Intended to be cleared once the operation completes.
901
- * The output stream (stderr or stdout) depends on whether the logger is
902
- * stream-bound.
903
- *
904
- * @param text - The progress message to display
905
- * @returns The logger instance for chaining
906
- *
907
- * @example
908
- * ```typescript
909
- * logger.progress('Processing files...')
910
- * // ... do work ...
911
- * logger.clearLine()
912
- * logger.success('Files processed')
913
- *
914
- * // Stream-specific progress
915
- * logger.stdout.progress('Loading...')
916
- * // ... do work ...
917
- * logger.stdout.clearLine()
918
- * logger.stdout.log('Done')
919
- * ```
920
- */
921
- progress(text: string): this;
922
- /**
923
- * Clears the current line in the terminal.
924
- *
925
- * Moves the cursor to the beginning of the line and clears all content.
926
- * Works in both TTY and non-TTY environments. Useful for clearing
927
- * progress indicators created with `progress()`.
928
- *
929
- * The stream to clear (stderr or stdout) depends on whether the logger
930
- * is stream-bound.
931
- *
932
- * @returns The logger instance for chaining
933
- *
934
- * @example
935
- * ```typescript
936
- * logger.progress('Loading...')
937
- * // ... do work ...
938
- * logger.clearLine()
939
- * logger.success('Loaded')
940
- *
941
- * // Clear multiple progress updates
942
- * for (const file of files) {
943
- * logger.progress(`Processing ${file}`)
944
- * processFile(file)
945
- * logger.clearLine()
946
- * }
947
- * logger.success('All files processed')
948
- * ```
949
- */
950
- clearLine(): this;
951
976
  }
952
977
  /**
953
978
  * Get the default logger instance.