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,138 @@
1
+ export const DEFAULT_PROFILE = 'node';
2
+ export const BASE_PROFILES = {
3
+ node: {
4
+ description: 'All the usual suspects related with the node/web/javascript dev toolchain: node_modules, caches, build artifacts, and assorted JavaScript junk. Safe to clean and your disk will thank you.',
5
+ targets: [
6
+ 'node_modules',
7
+ '.npm',
8
+ '.pnpm-store',
9
+ '.next',
10
+ '.nuxt',
11
+ '.angular',
12
+ '.svelte-kit',
13
+ '.vite',
14
+ '.nx',
15
+ '.turbo',
16
+ '.parcel-cache',
17
+ '.rpt2_cache',
18
+ '.eslintcache',
19
+ '.esbuild',
20
+ '.cache',
21
+ '.rollup.cache',
22
+ 'storybook-static',
23
+ 'coverage',
24
+ '.nyc_output',
25
+ '.jest',
26
+ 'gatsby_cache',
27
+ '.docusaurus',
28
+ '.swc',
29
+ '.stylelintcache',
30
+ 'deno_cache',
31
+ ],
32
+ },
33
+ python: {
34
+ description: "The usual Python leftovers — caches, virtual environments, and test artifacts. Safe to clear once you've closed your IDE and virtualenvs.",
35
+ targets: [
36
+ '__pycache__',
37
+ '.pytest_cache',
38
+ '.mypy_cache',
39
+ '.ruff_cache',
40
+ '.tox',
41
+ '.nox',
42
+ '.pytype',
43
+ '.pyre',
44
+ 'htmlcov',
45
+ '.venv',
46
+ 'venv',
47
+ ],
48
+ },
49
+ 'data-science': {
50
+ description: 'Jupyter checkpoints, virtualenvs, MLflow runs, and experiment outputs. Great for learning, terrible for disk space.',
51
+ targets: [
52
+ '.ipynb_checkpoints',
53
+ '__pycache__',
54
+ '.venv',
55
+ 'venv',
56
+ 'outputs',
57
+ '.dvc',
58
+ '.mlruns',
59
+ ],
60
+ },
61
+ java: {
62
+ description: 'Build outputs and Gradle junk.',
63
+ targets: ['target', '.gradle', 'out'],
64
+ },
65
+ android: {
66
+ description: "Native build caches and intermediate files from Android Studio. Deleting won't hurt, but expect a rebuild marathon next time.",
67
+ targets: ['.cxx', 'externalNativeBuild'],
68
+ },
69
+ swift: {
70
+ description: "Xcode's playground leftovers and Swift package builds. Heavy, harmless, and happy to go.",
71
+ targets: ['DerivedData', '.swiftpm'],
72
+ },
73
+ dotnet: {
74
+ description: "Compilation artifacts and Visual Studio cache folders. Disposable once you're done building or testing.",
75
+ targets: ['obj', 'TestResults', '.vs'],
76
+ },
77
+ rust: {
78
+ description: 'Cargo build targets. Huge, regenerable, and surprisingly clingy, your disk will appreciate the reset.',
79
+ targets: ['target'],
80
+ },
81
+ ruby: {
82
+ description: 'Bundler caches and dependency leftovers.',
83
+ targets: ['.bundle'],
84
+ },
85
+ elixir: {
86
+ description: 'Mix build folders, dependencies, and coverage reports. Easy to regenerate, safe to purge.',
87
+ targets: ['_build', 'deps', 'cover'],
88
+ },
89
+ haskell: {
90
+ description: "GHC and Stack build outputs. A collection of intermediate binaries you definitely don't need anymore.",
91
+ targets: ['dist-newstyle', '.stack-work'],
92
+ },
93
+ scala: {
94
+ description: 'Bloop, Metals, and build outputs from Scala projects.',
95
+ targets: ['.bloop', '.metals', 'target'],
96
+ },
97
+ cpp: {
98
+ description: 'CMake build directories and temporary artifacts. Rebuilds take time, but space is priceless.',
99
+ targets: ['CMakeFiles', 'cmake-build-debug', 'cmake-build-release'],
100
+ },
101
+ unity: {
102
+ description: "Unity's cache and build artifacts. Expect longer load times next launch but it can save tons of space on unused projects.",
103
+ targets: ['Library', 'Temp', 'Obj'],
104
+ },
105
+ unreal: {
106
+ description: 'Intermediate and binary build caches. Safe to clean. Unreal will (happily?) recompile.',
107
+ targets: ['Intermediate', 'DerivedDataCache', 'Binaries'],
108
+ },
109
+ godot: {
110
+ description: 'Editor caches and import data. Godot can recreate these in a blink.',
111
+ targets: ['.import', '.godot'],
112
+ },
113
+ infra: {
114
+ description: 'Leftovers from deployment tools like Serverless, Vercel, Netlify, and Terraform.',
115
+ targets: [
116
+ '.serverless',
117
+ '.vercel',
118
+ '.netlify',
119
+ '.terraform',
120
+ '.sass-cache',
121
+ '.cpcache',
122
+ 'elm_stuff',
123
+ 'nimcache',
124
+ 'deno_cache',
125
+ ],
126
+ },
127
+ };
128
+ const ALL_TARGETS = [
129
+ ...new Set(Object.values(BASE_PROFILES).flatMap((profile) => profile.targets)),
130
+ ];
131
+ export const DEFAULT_PROFILES = {
132
+ ...BASE_PROFILES,
133
+ all: {
134
+ targets: ALL_TARGETS,
135
+ description: 'Includes all targets listed above. Not recommended, as it mixes unrelated ecosystems and may remove context-specific data (a good recipe for chaos if used recklessly).',
136
+ },
137
+ };
138
+ //# sourceMappingURL=profiles.constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profiles.constants.js","sourceRoot":"","sources":["../../../src/core/constants/profiles.constants.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAuC;IAC/D,IAAI,EAAE;QACJ,WAAW,EACT,6LAA6L;QAC/L,OAAO,EAAE;YACP,cAAc;YACd,MAAM;YACN,aAAa;YACb,OAAO;YACP,OAAO;YACP,UA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ootFolderResult } from './interfaces/devkill.interface.js';
3
+ import type { DeleteOptions, DeleteResult, GetNewestFileResult, GetSizeResult, ScanFoundFolder, ScanOptions } from './interfaces/folder.interface.js';
4
+ import type { Services } from './interfaces/services.interface.js';
5
+ import { LoggerService } from './services/logger.service.js';
6
+ import type { LogEntry } from './interfaces/logger-service.interface.js';
7
+ /**
8
+ * Main devkill 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 Devkill implements DevkillInterface {
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
+ }
@@ -0,0 +1,129 @@
1
+ import { from } from 'rxjs';
2
+ import { catchError, filter, map, mergeMap, take, tap } from 'rxjs/operators';
3
+ import { OSServiceMap } from '../constants/os-service-map.constants.js';
4
+ import _dirname from '../dirname.js';
5
+ import { ScanStatus } from './interfaces/search-status.model.js';
6
+ import { FileWorkerService } from './services/files/index.js';
7
+ import { LoggerService } from './services/logger.service.js';
8
+ import { ProfilesService } from './services/profiles.service.js';
9
+ import { StreamService } from './services/stream.service.js';
10
+ import { ResultsService } from '../cli/services/results.service.js';
11
+ import { getFileContent } from '../utils/get-file-content.js';
12
+ /**
13
+ * Main devkill class that implements the core directory scanning and cleanup functionality.
14
+ * Provides methods for recursive directory scanning, size calculation, file analysis,
15
+ * and safe deletion operations.
16
+ */
17
+ export class Devkill {
18
+ services;
19
+ constructor(customServices) {
20
+ const defaultServices = createDefaultServices(customServices?.searchStatus, customServices?.logger);
21
+ this.services = { ...defaultServices, ...customServices };
22
+ this.logger.info(process.argv.join(' '));
23
+ this.logger.info(`Devkill started! v${this.getVersion()}`);
24
+ }
25
+ searchDuration = 0;
26
+ startScan$(rootPath, options) {
27
+ const { fileService } = this.services;
28
+ this.logger.info(`Scan started in ${rootPath}`);
29
+ const startTime = Date.now();
30
+ return fileService.listDir(rootPath, options).pipe(catchError(() => {
31
+ throw new Error('Error while listing directories');
32
+ }), mergeMap((dataFolder) => from(splitData(dataFolder))), filter((path) => path !== ''), map((path) => {
33
+ if (options.performRiskAnalysis !== undefined &&
34
+ !options.performRiskAnalysis) {
35
+ return { path };
36
+ }
37
+ const riskAnalysis = fileService.isDangerous(path);
38
+ return {
39
+ path,
40
+ riskAnalysis,
41
+ };
42
+ }), tap((nodeFolder) => this.logger.info(`Folder found: ${String(nodeFolder.path)}`)), tap({
43
+ complete: () => {
44
+ this.searchDuration = (Date.now() - startTime) / 1000;
45
+ this.logger.info(`Search completed after ${this.searchDuration}s`);
46
+ },
47
+ }));
48
+ }
49
+ getSize$(path) {
50
+ const { fileService } = this.services;
51
+ this.logger.info(`Calculating folder size for ${String(path)}`);
52
+ return fileService.getFolderSize(path).pipe(take(1), map((size) => ({ size, unit: 'bytes' })), tap(({ size }) => this.logger.info(`Size of ${path}: ${size} bytes`)));
53
+ }
54
+ getNewestFile$(path) {
55
+ const { fileService } = this.services;
56
+ this.logger.info(`Calculating last mod. of ${path}`);
57
+ return from(fileService.getRecentModificationInDir(path)).pipe(tap((result) => {
58
+ if (!result) {
59
+ return;
60
+ }
61
+ this.logger.info(`Last mod. of ${path}: ${result.timestamp}`);
62
+ }));
63
+ }
64
+ delete$(path, options) {
65
+ const { fileService } = this.services;
66
+ this.logger.info(`Deleting ${String(path)} ${options?.dryRun ? '(dry run)' : ''}...`);
67
+ const deleteOperation = options?.dryRun
68
+ ? from(fileService.fakeDeleteDir())
69
+ : from(fileService.deleteDir(path));
70
+ return deleteOperation.pipe(map((result) => {
71
+ if (!result) {
72
+ this.logger.error(`Failed to delete ${String(path)}`);
73
+ return { path, success: false };
74
+ }
75
+ this.logger.info(`Deleted ${String(path)}: ${result}`);
76
+ return {
77
+ path,
78
+ success: result,
79
+ };
80
+ }));
81
+ }
82
+ getLogs$() {
83
+ return this.services.logger.getLog$();
84
+ }
85
+ stopScan() {
86
+ this.logger.info('Stopping scan...');
87
+ this.services.fileService.stopScan();
88
+ }
89
+ isValidRootFolder(path) {
90
+ return this.services.fileService.isValidRootFolder(path);
91
+ }
92
+ getVersion() {
93
+ const packageJson = `${_dirname}/../package.json`;
94
+ const packageData = JSON.parse(getFileContent(packageJson));
95
+ return packageData.version;
96
+ }
97
+ get logger() {
98
+ return this.services.logger;
99
+ }
100
+ }
101
+ function createDefaultServices(searchStatus, logger) {
102
+ const actualLogger = logger || new LoggerService();
103
+ const actualSearchStatus = searchStatus || new ScanStatus();
104
+ const fileWorkerService = new FileWorkerService(actualLogger, actualSearchStatus);
105
+ const streamService = new StreamService();
106
+ const resultsService = new ResultsService();
107
+ const profilesService = new ProfilesService();
108
+ const OSService = OSServiceMap[process.platform];
109
+ if (typeof OSService === 'undefined') {
110
+ throw new Error(`Unsupported platform: ${process.platform}. Cannot load OS service.`);
111
+ }
112
+ const fileService = new OSService(streamService, fileWorkerService);
113
+ return {
114
+ logger: actualLogger,
115
+ searchStatus: actualSearchStatus,
116
+ fileService,
117
+ fileWorkerService,
118
+ streamService,
119
+ resultsService,
120
+ profilesService,
121
+ };
122
+ }
123
+ function splitData(data, separator = '\n') {
124
+ if (data === '') {
125
+ return [];
126
+ }
127
+ return data.split(separator);
128
+ }
129
+ //# sourceMappingURL=devkill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devkill.js","sourceRoot":"","sources":["../../src/core/devkill.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,IAAI,EAAE,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,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zB,MAAsB;IAEtB,MAAM,YAAY,GAAG,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;IACnD,MAAM,kBAAkB,GAAG,YAAY,IAAI,IAAI,UAAU,EAAE,CAAC;IAC5D,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAC7C,YAAY,EACZ,kBAAkB,CACnB,CAAC;IACF,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;IAC1C,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;IAC5C,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAE9C,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjD,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACb,yBAAyB,OAAO,CAAC,QAAQ,2BAA2B,CACrE,CAAC;IACJ,CAAC;IACD,MAAM,WAAW,GAAG,IAAI,SAAS,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;IAEpE,OAAO;QACL,MAAM,EAAE,YAAY;QACpB,YAAY,EAAE,kBAAkB;QAChC,WAAW;QACX,iBAAiB;QACjB,aAAa;QACb,cAAc;QACd,eAAe;KAChB,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,SAAS,GAAG,IAAI;IAC/C,IAAI,IAAI,KAAK,EAAE,EAAE,CAAC;QAChB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './devkill.js';
2
+ export * from './interfaces/index.js';
3
+ export * from './services/index.js';
4
+ export * from './constants/index.js';
@@ -0,0 +1,5 @@
1
+ export * from './devkill.js';
2
+ export * from './interfaces/index.js';
3
+ export * from './services/index.js';
4
+ export * from './constants/index.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,78 @@
1
+ import type { LogEntry } from '@core/interfaces/logger-service.interface.js';
2
+ import type { Observable } from 'rxjs';
3
+ import type { DeleteOptions, DeleteResult, GetNewestFileResult, GetSizeOptions, GetSizeResult, ScanFoundFolder, ScanOptions } from './folder.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
+ * Devkill 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 DevkillInterface {
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 devkill.
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 devkill.
75
+ * @returns Version string defined in devkill's package.json.
76
+ */
77
+ getVersion(): string;
78
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=devkill.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devkill.interface.js","sourceRoot":"","sources":["../../../src/core/interfaces/devkill.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,87 @@
1
+ import type { PROFILE } from './profile.interface.js';
2
+ /**
3
+ * Represents the structure of .devkillrc configuration file.
4
+ * All properties are optional as users may only override specific settings.
5
+ */
6
+ export interface IDevkillrcConfig {
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 devkill 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 .devkillrc configuration file.
72
+ */
73
+ export interface IConfigLoadResult {
74
+ /**
75
+ * The parsed configuration, or null if loading failed.
76
+ */
77
+ config: IDevkillrcConfig | 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_DEVKILLRC_PROPERTIES: readonly ["rootDir", "exclude", "sortBy", "sizeUnit", "excludeSensitiveResults", "dryRun", "checkUpdates", "defaultProfiles", "profiles"];
@@ -0,0 +1,12 @@
1
+ export const VALID_DEVKILLRC_PROPERTIES = [
2
+ 'rootDir',
3
+ 'exclude',
4
+ 'sortBy',
5
+ 'sizeUnit',
6
+ 'excludeSensitiveResults',
7
+ 'dryRun',
8
+ 'checkUpdates',
9
+ 'defaultProfiles',
10
+ 'profiles',
11
+ ];
12
+ //# sourceMappingURL=devkillrc-config.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devkillrc-config.interface.js","sourceRoot":"","sources":["../../../src/core/interfaces/devkillrc-config.interface.ts"],"names":[],"mappings":"AAmGA,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU;IACV,yBAAyB;IACzB,QAAQ;IACR,cAAc;IACd,iBAAiB;IACjB,UAAU;CAC4C,CAAC"}
@@ -0,0 +1,76 @@
1
+ import type { Observable } from 'rxjs';
2
+ import type { GetNewestFileResult, RiskAnalysis } from '../interfaces/index.js';
3
+ import type { FileWorkerService } from '../services/files/files.worker.service.js';
4
+ import type { IsValidRootFolderResult } from './devkill.interface.js';
5
+ import type { ScanOptions } from './folder.interface.js';
6
+ /**
7
+ * Core file system operations service for npkill.
8
+ * Provides methods for directory scanning, size calculation, deletion, and validation.
9
+ */
10
+ export interface IFileService {
11
+ /** Worker service for handling file operations in background threads. */
12
+ fileWorkerService: FileWorkerService;
13
+ /**
14
+ * Calculates the total size of a directory.
15
+ * @param path Path to the directory to measure.
16
+ * @returns Observable emitting the size in bytes.
17
+ */
18
+ getFolderSize: (path: string) => Observable<number>;
19
+ /**
20
+ * Lists directories matching scan criteria.
21
+ * @param path Root path to start listing from.
22
+ * @param params Scan options for filtering and configuration.
23
+ * @returns Observable emitting found directory paths.
24
+ */
25
+ listDir: (path: string, params: ScanOptions) => Observable<string>;
26
+ /**
27
+ * Permanently deletes a directory and its contents.
28
+ * @param path Path to the directory to delete.
29
+ * @returns Promise resolving to true if deletion was successful.
30
+ */
31
+ deleteDir: (path: string) => Promise<boolean>;
32
+ /**
33
+ * Simulates directory deletion without actually removing files.
34
+ * @param _path Path to the directory that would be deleted.
35
+ * @returns Promise resolving to true (always succeeds for dry run).
36
+ */
37
+ fakeDeleteDir: (_path: string) => Promise<boolean>;
38
+ /**
39
+ * Validates whether a path is suitable as a scan root directory.
40
+ * @param path Path to validate.
41
+ * @returns Validation result with success status and error reason if invalid.
42
+ */
43
+ isValidRootFolder(path: string): IsValidRootFolderResult;
44
+ /**
45
+ * Analyzes a directory path for potential deletion risks.
46
+ * @param path Path to analyze for safety.
47
+ * @returns Risk analysis indicating if the path is dangerous to delete.
48
+ */
49
+ isDangerous: (path: string) => RiskAnalysis;
50
+ /**
51
+ * Finds the most recently modified file in a directory tree.
52
+ * @param path Root directory to search within.
53
+ * @returns Promise resolving to newest file info, or null if no files found.
54
+ */
55
+ getRecentModificationInDir: (path: string) => Promise<GetNewestFileResult | null>;
56
+ /**
57
+ * Retrieves file statistics for all files in a directory.
58
+ * @param dirname Directory to analyze.
59
+ * @returns Promise resolving to array of file statistics.
60
+ */
61
+ getFileStatsInDir: (dirname: string) => Promise<IFileStat[]>;
62
+ /**
63
+ * Stops any ongoing scan operations.
64
+ * Cancels workers and cleans up resources.
65
+ */
66
+ stopScan: () => void;
67
+ }
68
+ /**
69
+ * Statistical information about a file.
70
+ */
71
+ export interface IFileStat {
72
+ /** Full path to the file. */
73
+ path: string;
74
+ /** Unix timestamp of the file's last modification. */
75
+ modificationTime: number;
76
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=file-service.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-service.interface.js","sourceRoot":"","sources":["../../../src/core/interfaces/file-service.interface.ts"],"names":[],"mappings":""}