devkill 0.12.2

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 (274) hide show
  1. package/LICENSE +21 -0
  2. package/README.es.md +253 -0
  3. package/README.id.md +238 -0
  4. package/README.md +377 -0
  5. package/README.pt.md +241 -0
  6. package/README.tr.md +242 -0
  7. package/lib/cli/cli.controller.d.ts +81 -0
  8. package/lib/cli/cli.controller.js +760 -0
  9. package/lib/cli/cli.controller.js.map +1 -0
  10. package/lib/cli/interfaces/cli-options.interface.d.ts +5 -0
  11. package/lib/cli/interfaces/cli-options.interface.js +2 -0
  12. package/lib/cli/interfaces/cli-options.interface.js.map +1 -0
  13. package/lib/cli/interfaces/command-keys.interface.d.ts +17 -0
  14. package/lib/cli/interfaces/command-keys.interface.js +2 -0
  15. package/lib/cli/interfaces/command-keys.interface.js.map +1 -0
  16. package/lib/cli/interfaces/config.interface.d.ts +17 -0
  17. package/lib/cli/interfaces/config.interface.js +2 -0
  18. package/lib/cli/interfaces/config.interface.js.map +1 -0
  19. package/lib/cli/interfaces/index.d.ts +11 -0
  20. package/lib/cli/interfaces/index.js +12 -0
  21. package/lib/cli/interfaces/index.js.map +1 -0
  22. package/lib/cli/interfaces/json-output.interface.d.ts +30 -0
  23. package/lib/cli/interfaces/json-output.interface.js +2 -0
  24. package/lib/cli/interfaces/json-output.interface.js.map +1 -0
  25. package/lib/cli/interfaces/key-press.interface.d.ts +7 -0
  26. package/lib/cli/interfaces/key-press.interface.js +2 -0
  27. package/lib/cli/interfaces/key-press.interface.js.map +1 -0
  28. package/lib/cli/interfaces/node-version.interface.d.ts +5 -0
  29. package/lib/cli/interfaces/node-version.interface.js +2 -0
  30. package/lib/cli/interfaces/node-version.interface.js.map +1 -0
  31. package/lib/cli/interfaces/stats.interface.d.ts +15 -0
  32. package/lib/cli/interfaces/stats.interface.js +2 -0
  33. package/lib/cli/interfaces/stats.interface.js.map +1 -0
  34. package/lib/cli/interfaces/ui-positions.interface.d.ts +5 -0
  35. package/lib/cli/interfaces/ui-positions.interface.js +2 -0
  36. package/lib/cli/interfaces/ui-positions.interface.js.map +1 -0
  37. package/lib/cli/interfaces/version.interface.d.ts +5 -0
  38. package/lib/cli/interfaces/version.interface.js +2 -0
  39. package/lib/cli/interfaces/version.interface.js.map +1 -0
  40. package/lib/cli/models/start-parameters.model.d.ts +7 -0
  41. package/lib/cli/models/start-parameters.model.js +25 -0
  42. package/lib/cli/models/start-parameters.model.js.map +1 -0
  43. package/lib/cli/services/console.service.d.ts +23 -0
  44. package/lib/cli/services/console.service.js +87 -0
  45. package/lib/cli/services/console.service.js.map +1 -0
  46. package/lib/cli/services/https.service.d.ts +4 -0
  47. package/lib/cli/services/https.service.js +32 -0
  48. package/lib/cli/services/https.service.js.map +1 -0
  49. package/lib/cli/services/index.d.ts +7 -0
  50. package/lib/cli/services/index.js +8 -0
  51. package/lib/cli/services/index.js.map +1 -0
  52. package/lib/cli/services/json-output.service.d.ts +20 -0
  53. package/lib/cli/services/json-output.service.js +101 -0
  54. package/lib/cli/services/json-output.service.js.map +1 -0
  55. package/lib/cli/services/results.service.d.ts +13 -0
  56. package/lib/cli/services/results.service.js +61 -0
  57. package/lib/cli/services/results.service.js.map +1 -0
  58. package/lib/cli/services/scan.service.d.ts +13 -0
  59. package/lib/cli/services/scan.service.js +79 -0
  60. package/lib/cli/services/scan.service.js.map +1 -0
  61. package/lib/cli/services/spinner.service.d.ts +9 -0
  62. package/lib/cli/services/spinner.service.js +27 -0
  63. package/lib/cli/services/spinner.service.js.map +1 -0
  64. package/lib/cli/services/ui.service.d.ts +17 -0
  65. package/lib/cli/services/ui.service.js +59 -0
  66. package/lib/cli/services/ui.service.js.map +1 -0
  67. package/lib/cli/services/update.service.d.ts +15 -0
  68. package/lib/cli/services/update.service.js +37 -0
  69. package/lib/cli/services/update.service.js.map +1 -0
  70. package/lib/cli/ui/base.ui.d.ts +28 -0
  71. package/lib/cli/ui/base.ui.js +49 -0
  72. package/lib/cli/ui/base.ui.js.map +1 -0
  73. package/lib/cli/ui/components/general.ui.d.ts +7 -0
  74. package/lib/cli/ui/components/general.ui.js +13 -0
  75. package/lib/cli/ui/components/general.ui.js.map +1 -0
  76. package/lib/cli/ui/components/header/header-ui.constants.d.ts +7 -0
  77. package/lib/cli/ui/components/header/header-ui.constants.js +7 -0
  78. package/lib/cli/ui/components/header/header-ui.constants.js.map +1 -0
  79. package/lib/cli/ui/components/header/header.ui.d.ts +18 -0
  80. package/lib/cli/ui/components/header/header.ui.js +96 -0
  81. package/lib/cli/ui/components/header/header.ui.js.map +1 -0
  82. package/lib/cli/ui/components/header/stats.ui.d.ts +25 -0
  83. package/lib/cli/ui/components/header/stats.ui.js +198 -0
  84. package/lib/cli/ui/components/header/stats.ui.js.map +1 -0
  85. package/lib/cli/ui/components/header/status.ui.d.ts +33 -0
  86. package/lib/cli/ui/components/header/status.ui.js +188 -0
  87. package/lib/cli/ui/components/header/status.ui.js.map +1 -0
  88. package/lib/cli/ui/components/help/help-command.ui.d.ts +9 -0
  89. package/lib/cli/ui/components/help/help-command.ui.js +61 -0
  90. package/lib/cli/ui/components/help/help-command.ui.js.map +1 -0
  91. package/lib/cli/ui/components/help/help.constants.d.ts +8 -0
  92. package/lib/cli/ui/components/help/help.constants.js +270 -0
  93. package/lib/cli/ui/components/help/help.constants.js.map +1 -0
  94. package/lib/cli/ui/components/help/help.ui.d.ts +30 -0
  95. package/lib/cli/ui/components/help/help.ui.js +176 -0
  96. package/lib/cli/ui/components/help/help.ui.js.map +1 -0
  97. package/lib/cli/ui/components/logs.ui.d.ts +24 -0
  98. package/lib/cli/ui/components/logs.ui.js +132 -0
  99. package/lib/cli/ui/components/logs.ui.js.map +1 -0
  100. package/lib/cli/ui/components/options.ui.d.ts +29 -0
  101. package/lib/cli/ui/components/options.ui.js +327 -0
  102. package/lib/cli/ui/components/options.ui.js.map +1 -0
  103. package/lib/cli/ui/components/profile-picker.ui.d.ts +25 -0
  104. package/lib/cli/ui/components/profile-picker.ui.js +117 -0
  105. package/lib/cli/ui/components/profile-picker.ui.js.map +1 -0
  106. package/lib/cli/ui/components/result-details.ui.d.ts +23 -0
  107. package/lib/cli/ui/components/result-details.ui.js +182 -0
  108. package/lib/cli/ui/components/result-details.ui.js.map +1 -0
  109. package/lib/cli/ui/components/results.ui.d.ts +86 -0
  110. package/lib/cli/ui/components/results.ui.js +620 -0
  111. package/lib/cli/ui/components/results.ui.js.map +1 -0
  112. package/lib/cli/ui/components/warning.ui.d.ts +12 -0
  113. package/lib/cli/ui/components/warning.ui.js +30 -0
  114. package/lib/cli/ui/components/warning.ui.js.map +1 -0
  115. package/lib/cli/ui/heavy.ui.d.ts +18 -0
  116. package/lib/cli/ui/heavy.ui.js +37 -0
  117. package/lib/cli/ui/heavy.ui.js.map +1 -0
  118. package/lib/cli/ui/index.d.ts +14 -0
  119. package/lib/cli/ui/index.js +15 -0
  120. package/lib/cli/ui/index.js.map +1 -0
  121. package/lib/constants/cli.constants.d.ts +14 -0
  122. package/lib/constants/cli.constants.js +138 -0
  123. package/lib/constants/cli.constants.js.map +1 -0
  124. package/lib/constants/index.d.ts +8 -0
  125. package/lib/constants/index.js +9 -0
  126. package/lib/constants/index.js.map +1 -0
  127. package/lib/constants/main.constants.d.ts +96 -0
  128. package/lib/constants/main.constants.js +79 -0
  129. package/lib/constants/main.constants.js.map +1 -0
  130. package/lib/constants/messages.constants.d.ts +31 -0
  131. package/lib/constants/messages.constants.js +37 -0
  132. package/lib/constants/messages.constants.js.map +1 -0
  133. package/lib/constants/options.constants.d.ts +6 -0
  134. package/lib/constants/options.constants.js +8 -0
  135. package/lib/constants/options.constants.js.map +1 -0
  136. package/lib/constants/os-service-map.constants.d.ts +10 -0
  137. package/lib/constants/os-service-map.constants.js +11 -0
  138. package/lib/constants/os-service-map.constants.js.map +1 -0
  139. package/lib/constants/result-descriptions.constants.d.ts +142 -0
  140. package/lib/constants/result-descriptions.constants.js +203 -0
  141. package/lib/constants/result-descriptions.constants.js.map +1 -0
  142. package/lib/constants/sort.result.d.ts +6 -0
  143. package/lib/constants/sort.result.js +22 -0
  144. package/lib/constants/sort.result.js.map +1 -0
  145. package/lib/constants/spinner.constants.d.ts +5 -0
  146. package/lib/constants/spinner.constants.js +88 -0
  147. package/lib/constants/spinner.constants.js.map +1 -0
  148. package/lib/constants/status.constants.d.ts +7 -0
  149. package/lib/constants/status.constants.js +9 -0
  150. package/lib/constants/status.constants.js.map +1 -0
  151. package/lib/constants/update.constants.d.ts +2 -0
  152. package/lib/constants/update.constants.js +3 -0
  153. package/lib/constants/update.constants.js.map +1 -0
  154. package/lib/constants/workers.constants.d.ts +14 -0
  155. package/lib/constants/workers.constants.js +16 -0
  156. package/lib/constants/workers.constants.js.map +1 -0
  157. package/lib/core/constants/global-ignored.constants.d.ts +1 -0
  158. package/lib/core/constants/global-ignored.constants.js +44 -0
  159. package/lib/core/constants/global-ignored.constants.js.map +1 -0
  160. package/lib/core/constants/index.d.ts +1 -0
  161. package/lib/core/constants/index.js +2 -0
  162. package/lib/core/constants/index.js.map +1 -0
  163. package/lib/core/constants/profiles.constants.d.ts +8 -0
  164. package/lib/core/constants/profiles.constants.js +138 -0
  165. package/lib/core/constants/profiles.constants.js.map +1 -0
  166. package/lib/core/devkill.d.ts +25 -0
  167. package/lib/core/devkill.js +129 -0
  168. package/lib/core/devkill.js.map +1 -0
  169. package/lib/core/index.d.ts +4 -0
  170. package/lib/core/index.js +5 -0
  171. package/lib/core/index.js.map +1 -0
  172. package/lib/core/interfaces/devkill.interface.d.ts +78 -0
  173. package/lib/core/interfaces/devkill.interface.js +2 -0
  174. package/lib/core/interfaces/devkill.interface.js.map +1 -0
  175. package/lib/core/interfaces/devkillrc-config.interface.d.ts +87 -0
  176. package/lib/core/interfaces/devkillrc-config.interface.js +12 -0
  177. package/lib/core/interfaces/devkillrc-config.interface.js.map +1 -0
  178. package/lib/core/interfaces/file-service.interface.d.ts +76 -0
  179. package/lib/core/interfaces/file-service.interface.js +2 -0
  180. package/lib/core/interfaces/file-service.interface.js.map +1 -0
  181. package/lib/core/interfaces/folder.interface.d.ts +89 -0
  182. package/lib/core/interfaces/folder.interface.js +2 -0
  183. package/lib/core/interfaces/folder.interface.js.map +1 -0
  184. package/lib/core/interfaces/index.d.ts +6 -0
  185. package/lib/core/interfaces/index.js +7 -0
  186. package/lib/core/interfaces/index.js.map +1 -0
  187. package/lib/core/interfaces/logger-service.interface.d.ts +59 -0
  188. package/lib/core/interfaces/logger-service.interface.js +2 -0
  189. package/lib/core/interfaces/logger-service.interface.js.map +1 -0
  190. package/lib/core/interfaces/npkill.interface.d.ts +78 -0
  191. package/lib/core/interfaces/npkill.interface.js +2 -0
  192. package/lib/core/interfaces/npkill.interface.js.map +1 -0
  193. package/lib/core/interfaces/npkillrc-config.interface.d.ts +87 -0
  194. package/lib/core/interfaces/npkillrc-config.interface.js +12 -0
  195. package/lib/core/interfaces/npkillrc-config.interface.js.map +1 -0
  196. package/lib/core/interfaces/profile.interface.d.ts +9 -0
  197. package/lib/core/interfaces/profile.interface.js +2 -0
  198. package/lib/core/interfaces/profile.interface.js.map +1 -0
  199. package/lib/core/interfaces/search-status.model.d.ts +35 -0
  200. package/lib/core/interfaces/search-status.model.js +48 -0
  201. package/lib/core/interfaces/search-status.model.js.map +1 -0
  202. package/lib/core/interfaces/services.interface.d.ts +26 -0
  203. package/lib/core/interfaces/services.interface.js +2 -0
  204. package/lib/core/interfaces/services.interface.js.map +1 -0
  205. package/lib/core/npkill.d.ts +25 -0
  206. package/lib/core/npkill.js +129 -0
  207. package/lib/core/npkill.js.map +1 -0
  208. package/lib/core/services/config/config-merger.d.ts +17 -0
  209. package/lib/core/services/config/config-merger.js +57 -0
  210. package/lib/core/services/config/config-merger.js.map +1 -0
  211. package/lib/core/services/config/config-validator.d.ts +3 -0
  212. package/lib/core/services/config/config-validator.js +43 -0
  213. package/lib/core/services/config/config-validator.js.map +1 -0
  214. package/lib/core/services/config/index.d.ts +4 -0
  215. package/lib/core/services/config/index.js +5 -0
  216. package/lib/core/services/config/index.js.map +1 -0
  217. package/lib/core/services/config/profile-validator.d.ts +6 -0
  218. package/lib/core/services/config/profile-validator.js +68 -0
  219. package/lib/core/services/config/profile-validator.js.map +1 -0
  220. package/lib/core/services/config/property-validators.d.ts +33 -0
  221. package/lib/core/services/config/property-validators.js +125 -0
  222. package/lib/core/services/config/property-validators.js.map +1 -0
  223. package/lib/core/services/config.service.d.ts +37 -0
  224. package/lib/core/services/config.service.js +100 -0
  225. package/lib/core/services/config.service.js.map +1 -0
  226. package/lib/core/services/files/files.service.d.ts +28 -0
  227. package/lib/core/services/files/files.service.js +207 -0
  228. package/lib/core/services/files/files.service.js.map +1 -0
  229. package/lib/core/services/files/files.worker.d.ts +1 -0
  230. package/lib/core/services/files/files.worker.js +286 -0
  231. package/lib/core/services/files/files.worker.js.map +1 -0
  232. package/lib/core/services/files/files.worker.service.d.ts +90 -0
  233. package/lib/core/services/files/files.worker.service.js +216 -0
  234. package/lib/core/services/files/files.worker.service.js.map +1 -0
  235. package/lib/core/services/files/index.d.ts +4 -0
  236. package/lib/core/services/files/index.js +5 -0
  237. package/lib/core/services/files/index.js.map +1 -0
  238. package/lib/core/services/files/unix-files.service.d.ts +9 -0
  239. package/lib/core/services/files/unix-files.service.js +28 -0
  240. package/lib/core/services/files/unix-files.service.js.map +1 -0
  241. package/lib/core/services/files/windows-files.service.d.ts +9 -0
  242. package/lib/core/services/files/windows-files.service.js +16 -0
  243. package/lib/core/services/files/windows-files.service.js.map +1 -0
  244. package/lib/core/services/index.d.ts +5 -0
  245. package/lib/core/services/index.js +6 -0
  246. package/lib/core/services/index.js.map +1 -0
  247. package/lib/core/services/logger.service.d.ts +22 -0
  248. package/lib/core/services/logger.service.js +84 -0
  249. package/lib/core/services/logger.service.js.map +1 -0
  250. package/lib/core/services/profiles.service.d.ts +54 -0
  251. package/lib/core/services/profiles.service.js +86 -0
  252. package/lib/core/services/profiles.service.js.map +1 -0
  253. package/lib/core/services/stream.service.d.ts +12 -0
  254. package/lib/core/services/stream.service.js +39 -0
  255. package/lib/core/services/stream.service.js.map +1 -0
  256. package/lib/dirname.d.ts +2 -0
  257. package/lib/dirname.js +6 -0
  258. package/lib/dirname.js.map +1 -0
  259. package/lib/index.d.ts +2 -0
  260. package/lib/index.js +11 -0
  261. package/lib/index.js.map +1 -0
  262. package/lib/main.d.ts +2 -0
  263. package/lib/main.js +19 -0
  264. package/lib/main.js.map +1 -0
  265. package/lib/utils/get-file-content.d.ts +1 -0
  266. package/lib/utils/get-file-content.js +6 -0
  267. package/lib/utils/get-file-content.js.map +1 -0
  268. package/lib/utils/is-safe-to-delete.d.ts +1 -0
  269. package/lib/utils/is-safe-to-delete.js +9 -0
  270. package/lib/utils/is-safe-to-delete.js.map +1 -0
  271. package/lib/utils/unit-conversions.d.ts +11 -0
  272. package/lib/utils/unit-conversions.js +54 -0
  273. package/lib/utils/unit-conversions.js.map +1 -0
  274. package/package.json +96 -0
@@ -0,0 +1,89 @@
1
+ /** Unit for representing file/directory sizes. */
2
+ export type SizeUnit = 'bytes';
3
+ /** Options soported for the sortBy scan option. */
4
+ export type SortBy = 'path' | 'size' | 'age';
5
+ /**
6
+ * Analysis of potential risks associated with deleting a directory.
7
+ */
8
+ export interface RiskAnalysis {
9
+ /** Whether the directory is considered sensitive or risky to delete. */
10
+ isSensitive: boolean;
11
+ /** Human-readable reason for the risk assessment. */
12
+ reason?: string;
13
+ }
14
+ /**
15
+ * Represents a folder found during the scan process.
16
+ */
17
+ export interface ScanFoundFolder {
18
+ /** Full path to the found folder. */
19
+ path: string;
20
+ /** Optional risk analysis for the folder. */
21
+ riskAnalysis?: RiskAnalysis;
22
+ }
23
+ /**
24
+ * Configuration options for scanning directories.
25
+ */
26
+ export interface ScanOptions {
27
+ /** Target directories to scan for matching folders. */
28
+ targets: string[];
29
+ /** Array of directory paths to exclude from the scan. */
30
+ exclude?: string[];
31
+ /** Criteria for sorting scan results. */
32
+ sortBy?: SortBy;
33
+ /** Whether to perform risk analysis on found directories. Default: true. */
34
+ performRiskAnalysis?: boolean;
35
+ }
36
+ /**
37
+ * Options for calculating directory size.
38
+ */
39
+ export interface GetSizeOptions {
40
+ /** Unit to return the size in. Default: bytes. */
41
+ unit?: SizeUnit;
42
+ }
43
+ /**
44
+ * Result of a directory size calculation.
45
+ */
46
+ export interface GetSizeResult {
47
+ /** Size value in the specified unit. Default: bytes. */
48
+ size: number;
49
+ /** Unit of the size measurement. */
50
+ unit: SizeUnit;
51
+ }
52
+ /**
53
+ * Options for finding the newest file in a directory.
54
+ */
55
+ export type GetNewestFileOptions = {};
56
+ /**
57
+ * Information about the most recently modified file in a directory.
58
+ */
59
+ export interface GetNewestFileResult {
60
+ /** Full path to the newest file. */
61
+ path: string;
62
+ /** Name of the newest file. */
63
+ name: string;
64
+ /** Unix timestamp of the file's last modification. */
65
+ timestamp: number;
66
+ }
67
+ /**
68
+ * Options for directory deletion operations.
69
+ */
70
+ export interface DeleteOptions {
71
+ /** If true, simulate deletion without actually removing files. */
72
+ dryRun?: boolean;
73
+ }
74
+ /**
75
+ * Result of a directory deletion operation.
76
+ */
77
+ export interface DeleteResult {
78
+ /** Path that was attempted to be deleted. */
79
+ path: string;
80
+ /** Whether the deletion was successful. */
81
+ success: boolean;
82
+ /** Error information if deletion failed. */
83
+ error?: {
84
+ /** Human-readable error message. */
85
+ message: string;
86
+ /** Error code if available. */
87
+ code?: string;
88
+ };
89
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=folder.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"folder.interface.js","sourceRoot":"","sources":["../../../src/core/interfaces/folder.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export * from './file-service.interface.js';
2
+ export * from './folder.interface.js';
3
+ export * from './services.interface.js';
4
+ export * from './search-status.model.js';
5
+ export * from './devkillrc-config.interface.js';
6
+ export * from './profile.interface.js';
@@ -0,0 +1,7 @@
1
+ export * from './file-service.interface.js';
2
+ export * from './folder.interface.js';
3
+ export * from './services.interface.js';
4
+ export * from './search-status.model.js';
5
+ export * from './devkillrc-config.interface.js';
6
+ export * from './profile.interface.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,59 @@
1
+ import type { Observable } from 'rxjs';
2
+ /**
3
+ * Represents an individual entry in the log.
4
+ */
5
+ export interface LogEntry {
6
+ type: 'info' | 'warn' | 'error';
7
+ timestamp: number;
8
+ message: string;
9
+ }
10
+ /**
11
+ * Interface for a logging service that allows logging messages
12
+ * of different types, retrieving them, and saving them to a file.
13
+ */
14
+ export interface ILoggerService {
15
+ /**
16
+ * Logs an info message.
17
+ * @param message The message to log.
18
+ */
19
+ info(message: string): void;
20
+ /**
21
+ * Logs a warning message.
22
+ * @param message The message to log.
23
+ */
24
+ warn(message: string): void;
25
+ /**
26
+ * Logs an error message.
27
+ * @param message The message to log.
28
+ */
29
+ error(message: string): void;
30
+ /**
31
+ * Gets log entries filtered by type.
32
+ * @param type The type of entries to retrieve ('all', 'info', 'warn', 'error'). Default is 'all'.
33
+ * @returns An array of log entries.
34
+ */
35
+ get(type?: 'all' | 'info' | 'warn' | 'error'): LogEntry[];
36
+ /**
37
+ * Gets an Observable that emits the full array of log entries whenever it changes.
38
+ * @returns An Observable of an array of log entries.
39
+ */
40
+ getLog$(): Observable<LogEntry[]>;
41
+ /**
42
+ * Gets an Observable that emits log entries filtered by type whenever they change.
43
+ * @param type The type of entries to retrieve ('all', 'info', 'warn', 'error'). Default is 'all'.
44
+ * @returns An Observable of an array of log entries.
45
+ */
46
+ getLogByType$(type?: 'all' | 'info' | 'warn' | 'error'): Observable<LogEntry[]>;
47
+ /**
48
+ * Saves the current log content to a specified file.
49
+ * Rotates the log file if one with the same name already exists.
50
+ * @param path The full path of the file where the log will be saved.
51
+ */
52
+ saveToFile(path: string): void;
53
+ /**
54
+ * Suggests a default file path to save the log,
55
+ * usually in the system's temporary directory.
56
+ * @returns The suggested file path.
57
+ */
58
+ getSuggestLogFilePath(): string;
59
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=logger-service.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-service.interface.js","sourceRoot":"","sources":["../../../src/core/interfaces/logger-service.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,78 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ScanFoundFolder, GetNewestFileResult, GetSizeOptions, GetSizeResult, ScanOptions, DeleteResult, DeleteOptions } from './folder.interface.js';
3
+ import { LogEntry } from '@core/interfaces/logger-service.interface.js';
4
+ export type ProfileFilterType = 'base' | 'user' | 'all';
5
+ /**
6
+ * Result of validating a root folder path.
7
+ */
8
+ export interface IsValidRootFolderResult {
9
+ /** Whether the folder is valid as a root. */
10
+ isValid: boolean;
11
+ /** Reason for invalidity, if not valid. */
12
+ invalidReason?: string;
13
+ }
14
+ /**
15
+ * Npkill is a powerful search engine that allows you to scan the file system
16
+ * for specified directories. It also allows you to perform operations on them
17
+ * in order to clean them up.
18
+ */
19
+ export interface NpkillInterface {
20
+ /**
21
+ * Starts the recursive search from the specified directory.
22
+ * @param rootPath Root directory to scan from.
23
+ * @param options Optional scan options.
24
+ * @returns Observable that emits the results that are found in real time.
25
+ */
26
+ startScan$(rootPath: string, options?: ScanOptions): Observable<ScanFoundFolder>;
27
+ /**
28
+ * Stops the current scan if any.
29
+ *
30
+ * Frees resources and terminates the observable returned by `startScan$`.
31
+ */
32
+ stopScan(): void;
33
+ /**
34
+ * Returns the total size of the contents of a directory.
35
+ * @param path Path to the directory.
36
+ * @param options Optional size options.
37
+ * @returns Observable that outputs a value with the result of the operation.
38
+ */
39
+ getSize$(path: string, options?: GetSizeOptions): Observable<GetSizeResult>;
40
+ /**
41
+ * Retrieves the most recently modified file (the one with the latest
42
+ * modification timestamp) within a given directory and its subdirectories,
43
+ * recursively.
44
+ * @param path Path to the directory.
45
+ * @returns Observable that outputs a value with the result of the
46
+ * operation. May return null if no files exist or the most recent file
47
+ * cannot be determined.
48
+ */
49
+ getNewestFile$(path: string): Observable<GetNewestFileResult | null>;
50
+ /**
51
+ * Deletes the specified directory. For security purposes, this directory
52
+ * must be contained within the `target` path defined when initiating the scan
53
+ * with `startScan$` or throw an exception.
54
+ * @param path Path to delete.
55
+ * @param options Optional delete options.
56
+ * @returns Observable emitting the delete result.
57
+ * @throws Error if the path is not within the target directory.
58
+ */
59
+ delete$(path: string, options?: DeleteOptions): Observable<DeleteResult>;
60
+ /**
61
+ * Gets the log stream generated by npkill.
62
+ * @returns Observable emitting an array of log entries.
63
+ */
64
+ getLogs$(): Observable<LogEntry[]>;
65
+ /**
66
+ * Checks if a given route has problems initiating a scan. Validates that the
67
+ * path belongs to a directory, that the directory exists and that there are
68
+ * no permissions issues.
69
+ * @param path Path to validate.
70
+ * @returns Result of validation.
71
+ */
72
+ isValidRootFolder(path: string): IsValidRootFolderResult;
73
+ /**
74
+ * Get the current version of npkill.
75
+ * @returns Version string defined in npkill's package.json.
76
+ */
77
+ getVersion(): string;
78
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=npkill.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npkill.interface.js","sourceRoot":"","sources":["../../../src/core/interfaces/npkill.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,87 @@
1
+ import { PROFILE } from './profile.interface.js';
2
+ /**
3
+ * Represents the structure of .npkillrc configuration file.
4
+ * All properties are optional as users may only override specific settings.
5
+ */
6
+ export interface INpkillrcConfig {
7
+ /**
8
+ * Absolute path from which the search will begin.
9
+ * @example "/home/user/my-projects/"
10
+ */
11
+ rootDir?: string;
12
+ /**
13
+ * Array of directory names to exclude from search.
14
+ * These directories and their subdirectories will be skipped.
15
+ * @example [".git", "important-project"]
16
+ */
17
+ exclude?: string[];
18
+ /**
19
+ * Default sort order for results.
20
+ * @default "none"
21
+ */
22
+ sortBy?: 'none' | 'size' | 'path' | 'age';
23
+ /**
24
+ * Unit for displaying folder sizes.
25
+ * - "auto": Sizes < 1024MB shown in MB, larger sizes in GB
26
+ * - "mb": Always show in megabytes
27
+ * - "gb": Always show in gigabytes
28
+ * @default "auto"
29
+ */
30
+ sizeUnit?: 'auto' | 'mb' | 'gb';
31
+ /**
32
+ * Exclude sensitive results.
33
+ * @default false
34
+ */
35
+ excludeSensitiveResults?: boolean;
36
+ /**
37
+ * Enable dry-run mode by default.
38
+ * When true, deletions are simulated (nothing is actually deleted).
39
+ * @default false
40
+ */
41
+ dryRun?: boolean;
42
+ /**
43
+ * Check for npkill updates on startup.
44
+ * @default true
45
+ */
46
+ checkUpdates?: boolean;
47
+ /**
48
+ * Profiles to use.
49
+ * @example ["node", "python"]
50
+ * @default ["node"]
51
+ */
52
+ defaultProfiles?: string[];
53
+ /**
54
+ * Custom profiles with specific target directories.
55
+ * Profile names can be used with the -p/--profiles flag.
56
+ * @example
57
+ * {
58
+ * "webdev": {
59
+ * "targets": ["node_modules", "dist", ".next"],
60
+ * "description": "Web development artifacts"
61
+ * },
62
+ * "python": {
63
+ * "targets": [".venv", "__pycache__"],
64
+ * "description": "Python virtual environments and caches"
65
+ * }
66
+ * }
67
+ */
68
+ profiles?: Record<string, PROFILE>;
69
+ }
70
+ /**
71
+ * Result of loading and parsing a .npkillrc configuration file.
72
+ */
73
+ export interface IConfigLoadResult {
74
+ /**
75
+ * The parsed configuration, or null if loading failed.
76
+ */
77
+ config: INpkillrcConfig | null;
78
+ /**
79
+ * Path to the configuration file that was loaded or attempted to load.
80
+ */
81
+ configPath: string;
82
+ /**
83
+ * Error message if loading or parsing failed.
84
+ */
85
+ error?: string;
86
+ }
87
+ export declare const VALID_NPKILLRC_PROPERTIES: readonly ["rootDir", "exclude", "sortBy", "sizeUnit", "excludeSensitiveResults", "dryRun", "checkUpdates", "defaultProfiles", "profiles"];
@@ -0,0 +1,12 @@
1
+ export const VALID_NPKILLRC_PROPERTIES = [
2
+ 'rootDir',
3
+ 'exclude',
4
+ 'sortBy',
5
+ 'sizeUnit',
6
+ 'excludeSensitiveResults',
7
+ 'dryRun',
8
+ 'checkUpdates',
9
+ 'defaultProfiles',
10
+ 'profiles',
11
+ ];
12
+ //# sourceMappingURL=npkillrc-config.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npkillrc-config.interface.js","sourceRoot":"","sources":["../../../src/core/interfaces/npkillrc-config.interface.ts"],"names":[],"mappings":"AAmGA,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU;IACV,yBAAyB;IACzB,QAAQ;IACR,cAAc;IACd,iBAAiB;IACjB,UAAU;CAC2C,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Represents a profile with target directories and description.
3
+ */
4
+ export interface PROFILE {
5
+ /** Array of directory names to search for */
6
+ targets: string[];
7
+ /** Description of what this profile is for */
8
+ description: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=profile.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.interface.js","sourceRoot":"","sources":["../../../src/core/interfaces/profile.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import type { WorkerStatus } from '../services/files/files.worker.service.js';
2
+ /**
3
+ * Tracks the progress and status of directory scanning operations.
4
+ * Maintains counters for various stages of the scan process including
5
+ * search tasks, statistics calculation, and deletion operations.
6
+ */
7
+ export declare class ScanStatus {
8
+ /** Number of search tasks currently pending execution. */
9
+ pendingSearchTasks: number;
10
+ /** Number of search tasks that have been completed. */
11
+ completedSearchTasks: number;
12
+ /** Number of pending statistics calculations for found directories. */
13
+ pendingStatsCalculation: number;
14
+ /** Number of completed statistics calculations. */
15
+ completedStatsCalculation: number;
16
+ /** Total number of matching directories found during the scan. */
17
+ resultsFound: number;
18
+ /** Number of deletion operations currently pending. */
19
+ pendingDeletions: number;
20
+ /** Current status of the worker threads handling the scan. */
21
+ workerStatus: WorkerStatus;
22
+ /** Information about active worker jobs. */
23
+ workersJobs: any;
24
+ /**
25
+ * Records the discovery of a new matching directory.
26
+ * Increments result count and pending statistics calculation.
27
+ */
28
+ newResult(): void;
29
+ /**
30
+ * Records the completion of a statistics calculation.
31
+ * Decrements pending count and increments completed count.
32
+ */
33
+ completeStatCalculation(): void;
34
+ reset(): void;
35
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Tracks the progress and status of directory scanning operations.
3
+ * Maintains counters for various stages of the scan process including
4
+ * search tasks, statistics calculation, and deletion operations.
5
+ */
6
+ export class ScanStatus {
7
+ /** Number of search tasks currently pending execution. */
8
+ pendingSearchTasks = 0;
9
+ /** Number of search tasks that have been completed. */
10
+ completedSearchTasks = 0;
11
+ /** Number of pending statistics calculations for found directories. */
12
+ pendingStatsCalculation = 0;
13
+ /** Number of completed statistics calculations. */
14
+ completedStatsCalculation = 0;
15
+ /** Total number of matching directories found during the scan. */
16
+ resultsFound = 0;
17
+ /** Number of deletion operations currently pending. */
18
+ pendingDeletions = 0;
19
+ /** Current status of the worker threads handling the scan. */
20
+ workerStatus = 'stopped';
21
+ /** Information about active worker jobs. */
22
+ workersJobs;
23
+ /**
24
+ * Records the discovery of a new matching directory.
25
+ * Increments result count and pending statistics calculation.
26
+ */
27
+ newResult() {
28
+ this.resultsFound++;
29
+ this.pendingStatsCalculation++;
30
+ }
31
+ /**
32
+ * Records the completion of a statistics calculation.
33
+ * Decrements pending count and increments completed count.
34
+ */
35
+ completeStatCalculation() {
36
+ this.pendingStatsCalculation--;
37
+ this.completedStatsCalculation++;
38
+ }
39
+ reset() {
40
+ this.pendingSearchTasks = 0;
41
+ this.completedSearchTasks = 0;
42
+ this.pendingStatsCalculation = 0;
43
+ this.completedStatsCalculation = 0;
44
+ this.resultsFound = 0;
45
+ this.pendingDeletions = 0;
46
+ }
47
+ }
48
+ //# sourceMappingURL=search-status.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-status.model.js","sourceRoot":"","sources":["../../../src/core/interfaces/search-status.model.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,UAAU;IACrB,0DAA0D;IACnD,kBAAkB,GAAG,CAAC,CAAC;IAC9B,uDAAuD;IAChD,oBAAoB,GAAG,CAAC,CAAC;IAChC,uEAAuE;IAChE,uBAAuB,GAAG,CAAC,CAAC;IACnC,mDAAmD;IAC5C,yBAAyB,GAAG,CAAC,CAAC;IACrC,kEAAkE;IAC3D,YAAY,GAAG,CAAC,CAAC;IACxB,uDAAuD;IAChD,gBAAgB,GAAG,CAAC,CAAC;IAC5B,8DAA8D;IACvD,YAAY,GAAiB,SAAS,CAAC;IAC9C,4CAA4C;IACrC,WAAW,CAAC;IAEnB;;;OAGG;IACH,SAAS;QACP,IAAI,CAAC,YAAY,EAAE,CAAC;QACpB,IAAI,CAAC,uBAAuB,EAAE,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,uBAAuB;QACrB,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC/B,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACnC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC;QAC9B,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,yBAAyB,GAAG,CAAC,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC;IAC5B,CAAC;CACF"}
@@ -0,0 +1,26 @@
1
+ import type { FileService, FileWorkerService } from '@core/services/files/index.js';
2
+ import type { LoggerService } from '@core/services/logger.service.js';
3
+ import type { ProfilesService } from '@core/services/profiles.service.js';
4
+ import type { StreamService } from '@core/services/stream.service.js';
5
+ import type { ResultsService } from '../../cli/services/index.js';
6
+ import type { ScanStatus } from './search-status.model.js';
7
+ /**
8
+ * Collection of all core services used by npkill.
9
+ * Provides centralized access to logging, file operations, streaming, and result management.
10
+ */
11
+ export interface Services {
12
+ /** Service for logging messages and managing log output. */
13
+ logger: LoggerService;
14
+ /** Status tracker for ongoing scan operations. */
15
+ searchStatus: ScanStatus;
16
+ /** Service for file system operations and directory management. */
17
+ fileService: FileService;
18
+ /** Worker service for background file processing tasks. */
19
+ fileWorkerService: FileWorkerService;
20
+ /** Service for managing reactive streams and data flow. */
21
+ streamService: StreamService;
22
+ /** Service for managing and formatting scan results. */
23
+ resultsService: ResultsService;
24
+ /** Service for managing profiles. */
25
+ profilesService: ProfilesService;
26
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=services.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.interface.js","sourceRoot":"","sources":["../../../src/core/interfaces/services.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ import { Observable } from 'rxjs';
2
+ import { LoggerService } from './services/logger.service.js';
3
+ import { Services } from './interfaces/services.interface.js';
4
+ import { ScanFoundFolder, GetNewestFileResult, GetSizeResult, ScanOptions, DeleteOptions, DeleteResult } from './interfaces/folder.interface.js';
5
+ import { IsValidRootFolderResult, NpkillInterface } from './interfaces/npkill.interface.js';
6
+ import { LogEntry } from './interfaces/logger-service.interface.js';
7
+ /**
8
+ * Main npkill class that implements the core directory scanning and cleanup functionality.
9
+ * Provides methods for recursive directory scanning, size calculation, file analysis,
10
+ * and safe deletion operations.
11
+ */
12
+ export declare class Npkill implements NpkillInterface {
13
+ private readonly services;
14
+ constructor(customServices?: Partial<Services>);
15
+ private searchDuration;
16
+ startScan$(rootPath: string, options: ScanOptions): Observable<ScanFoundFolder>;
17
+ getSize$(path: string): Observable<GetSizeResult>;
18
+ getNewestFile$(path: string): Observable<GetNewestFileResult | null>;
19
+ delete$(path: string, options?: DeleteOptions): Observable<DeleteResult>;
20
+ getLogs$(): Observable<LogEntry[]>;
21
+ stopScan(): void;
22
+ isValidRootFolder(path: string): IsValidRootFolderResult;
23
+ getVersion(): string;
24
+ get logger(): LoggerService;
25
+ }