binary-collections 2.0.11 → 2.0.13

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 (330) hide show
  1. package/binaries/binary-executor.cjs +89 -13
  2. package/binaries/clean-nodemodule.cjs +89 -13
  3. package/binaries/clean-nodemodules.cjs +89 -13
  4. package/binaries/dev.cjs +89 -13
  5. package/binaries/empty.cjs +89 -13
  6. package/binaries/git-reduce-size.cjs +89 -13
  7. package/binaries/javakill.cjs +89 -13
  8. package/binaries/kill-process.cjs +89 -13
  9. package/binaries/nodekill.cjs +89 -13
  10. package/binaries/prod.cjs +89 -13
  11. package/binaries/py.cjs +89 -13
  12. package/binaries/rmfind.cjs +89 -13
  13. package/binaries/rmx +15 -1
  14. package/binaries/rmx.cjs +89 -13
  15. package/binaries/rmx.cmd +12 -0
  16. package/binaries/submodule-token.cjs +89 -13
  17. package/binaries/test-cjs +9 -1
  18. package/binaries/test-cjs.cjs +89 -13
  19. package/binaries/test-cjs.cmd +16 -1
  20. package/binaries/test-esm +16 -0
  21. package/binaries/test-esm.cjs +254 -0
  22. package/binaries/test-esm.cmd +23 -0
  23. package/binaries/yarn-clean +1 -1
  24. package/binaries/yarn-clean.cjs +89 -13
  25. package/binaries/yarn-clean.cmd +1 -1
  26. package/binaries/yarn-clean.py +33 -15
  27. package/binaries/yc +131 -0
  28. package/binaries/yc.cjs +254 -0
  29. package/binaries/ycw +256 -0
  30. package/binaries/ycw.cjs +254 -0
  31. package/docs-src/binary-collections.md +34 -0
  32. package/docs-src/changelog.md +26 -0
  33. package/docs-src/clean-github-actions-caches.md +91 -2
  34. package/docs-src/copy-move-file.md +59 -0
  35. package/docs-src/del-gradle.md +17 -0
  36. package/docs-src/del-ps.md +28 -0
  37. package/docs-src/downloader.md +62 -0
  38. package/docs-src/env-helpers.md +29 -0
  39. package/docs-src/find-node-modules.md +17 -0
  40. package/docs-src/git-diff.md +33 -0
  41. package/docs-src/git-fix.md +34 -0
  42. package/docs-src/git-purge.md +17 -0
  43. package/docs-src/git-reduce-size.md +17 -0
  44. package/docs-src/git-undo.md +21 -0
  45. package/docs-src/kill-night-crows.md +26 -0
  46. package/docs-src/node-cache-cleaner.md +182 -0
  47. package/docs-src/node-executor.md +50 -0
  48. package/docs-src/node-package-packer.md +48 -0
  49. package/docs-src/npm-run-series.md +43 -0
  50. package/docs-src/package-resolutions-updater.md +22 -0
  51. package/docs-src/php-cs-fixer-staged.md +19 -0
  52. package/docs-src/print-directory-tree.md +35 -0
  53. package/docs-src/print-tarball-tree.md +55 -0
  54. package/docs-src/py.md +19 -0
  55. package/docs-src/remove-module.md +32 -0
  56. package/docs-src/rmfind-rmx.md +21 -0
  57. package/docs-src/rmpath.md +38 -0
  58. package/docs-src/run-by-checksum.md +87 -0
  59. package/docs-src/submodule-install.md +31 -0
  60. package/docs-src/submodule-remove.md +22 -0
  61. package/docs-src/submodule-token.md +17 -0
  62. package/docs-src/test-runners.md +21 -0
  63. package/docs-src/yarn-install.md +31 -0
  64. package/docs-src/yarn-reinstall.md +27 -0
  65. package/lib/binary-collections/config.cjs +126 -0
  66. package/lib/binary-collections/config.mjs +7 -0
  67. package/lib/binary-collections/executeScript.cjs +19 -0
  68. package/lib/binary-collections/executeScript.d.cts +12 -0
  69. package/lib/binary-collections/executeScript.mjs +6 -0
  70. package/lib/binary-collections/findScript.cjs +309 -0
  71. package/lib/binary-collections/findScript.d.cts +12 -0
  72. package/lib/binary-collections/findScript.mjs +7 -0
  73. package/lib/binary-collections/listScript.cjs +291 -0
  74. package/lib/binary-collections/listScript.d.cts +19 -0
  75. package/lib/binary-collections/listScript.mjs +7 -0
  76. package/lib/binary-collections.cjs +264 -157
  77. package/lib/binary-collections.mjs +26 -286
  78. package/lib/changelog.cjs +9 -14
  79. package/lib/changelog.mjs +2 -2
  80. package/lib/chunk-2MN4VPV2.mjs +246 -0
  81. package/lib/chunk-6C7KTYGZ.mjs +41 -0
  82. package/lib/{chunk-Z6JLYU2J.mjs → chunk-6RK5UCTP.mjs} +7 -12
  83. package/lib/chunk-CD3HF3LK.mjs +190 -0
  84. package/lib/chunk-FLYSZFLW.mjs +61 -0
  85. package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
  86. package/lib/chunk-H44UWUFY.mjs +105 -0
  87. package/lib/chunk-KLKAIFKI.mjs +40 -0
  88. package/lib/chunk-LVSPEFU2.mjs +86 -0
  89. package/lib/{chunk-RWLXRTYP.mjs → chunk-MGPYPKIE.mjs} +2 -2
  90. package/lib/chunk-NGFK3EYW.mjs +28 -0
  91. package/lib/chunk-NQXUYO67.mjs +253 -0
  92. package/lib/chunk-NVEG3LEZ.mjs +143 -0
  93. package/lib/chunk-OBXLTXFJ.mjs +34 -0
  94. package/lib/chunk-OGXVGBRI.mjs +29 -0
  95. package/lib/chunk-OXV52GD5.mjs +62 -0
  96. package/lib/chunk-PXBMHE7O.mjs +35 -0
  97. package/lib/chunk-QD4T255Z.mjs +40 -0
  98. package/lib/chunk-QII2EKCS.mjs +26 -0
  99. package/lib/chunk-R5FJOR63.mjs +47 -0
  100. package/lib/chunk-RDGDLSPD.mjs +76 -0
  101. package/lib/chunk-RDN6HF5Z.mjs +79 -0
  102. package/lib/chunk-RJKTSUAX.mjs +123 -0
  103. package/lib/{chunk-XA3SNBPA.mjs → chunk-TBWXE7ST.mjs} +97 -38
  104. package/lib/chunk-UXCFNAR6.mjs +55 -0
  105. package/lib/{chunk-M3YIYRHT.mjs → chunk-UY5VUEA3.mjs} +1 -1
  106. package/lib/chunk-WSHVPGNM.mjs +44 -0
  107. package/lib/{chunk-66PAU5PS.mjs → chunk-X2B3X7D4.mjs} +10 -6
  108. package/lib/clean-github-actions-caches-cli.cjs +507 -0
  109. package/lib/clean-github-actions-caches-cli.mjs +74 -0
  110. package/lib/clean-github-actions-caches.cjs +246 -106
  111. package/lib/clean-github-actions-caches.d.cts +53 -1
  112. package/lib/clean-github-actions-caches.mjs +5 -130
  113. package/lib/cross-env/command.cjs +63 -0
  114. package/lib/cross-env/command.d.ts +8 -0
  115. package/lib/cross-env/command.js +45 -0
  116. package/lib/{ps/isWin.mjs → cross-env/command.mjs} +4 -5
  117. package/lib/cross-env/index.cjs +178 -0
  118. package/lib/cross-env/index.d.ts +8 -0
  119. package/lib/cross-env/index.js +102 -0
  120. package/lib/cross-env/index.mjs +101 -0
  121. package/lib/cross-env/variable.cjs +60 -0
  122. package/lib/cross-env/variable.d.ts +7 -0
  123. package/lib/cross-env/variable.js +59 -0
  124. package/lib/cross-env/variable.mjs +9 -0
  125. package/lib/del-gradle.cjs +8 -13
  126. package/lib/del-gradle.js +8 -8
  127. package/lib/del-gradle.mjs +1 -1
  128. package/lib/del-node-modules.cjs +185 -3
  129. package/lib/del-node-modules.js +25 -25
  130. package/lib/del-node-modules.mjs +6 -3
  131. package/lib/{del-ps.cjs → del-ps-cli.cjs} +38 -43
  132. package/lib/del-ps-cli.d.mts +1 -0
  133. package/lib/del-ps-cli.mjs +44 -0
  134. package/lib/del-yarn-caches.cjs +8 -13
  135. package/lib/del-yarn-caches.js +2 -2
  136. package/lib/del-yarn-caches.mjs +1 -1
  137. package/lib/downloader-cli.cjs +256 -0
  138. package/lib/downloader-cli.d.cts +2 -0
  139. package/lib/downloader-cli.mjs +90 -0
  140. package/lib/file/copy-cli.cjs +273 -0
  141. package/lib/file/copy-cli.d.mts +1 -0
  142. package/lib/file/copy-cli.mjs +59 -0
  143. package/lib/file/copy.cjs +56 -0
  144. package/lib/file/copy.d.mts +1 -0
  145. package/lib/file/copy.mjs +8 -0
  146. package/lib/file/move-cli.cjs +272 -0
  147. package/lib/file/move-cli.d.mts +1 -0
  148. package/lib/file/move-cli.mjs +59 -0
  149. package/lib/file/move.cjs +55 -0
  150. package/lib/file/move.d.mts +1 -0
  151. package/lib/file/move.mjs +8 -0
  152. package/lib/find-node-modules-cli.cjs +1 -1
  153. package/lib/find-node-modules-cli.js +1 -1
  154. package/lib/find-node-modules-cli.mjs +1 -1
  155. package/lib/find-node-modules.cjs +1 -1
  156. package/lib/find-node-modules.mjs +1 -1
  157. package/lib/free-chatgpt.cjs +27 -26
  158. package/lib/free-chatgpt.js +10 -10
  159. package/lib/free-chatgpt.mjs +2 -2
  160. package/lib/git/user-config.cjs +9 -14
  161. package/lib/git/user-config.mjs +2 -2
  162. package/lib/git-diff-cli.cjs +273 -66
  163. package/lib/git-diff-cli.mjs +5 -4
  164. package/lib/git-diff.cjs +273 -66
  165. package/lib/git-diff.d.ts +2 -1
  166. package/lib/git-diff.js +153 -39
  167. package/lib/git-diff.mjs +5 -4
  168. package/lib/git-fix.cjs +9 -14
  169. package/lib/git-fix.mjs +2 -2
  170. package/lib/git-purge.cjs +9 -14
  171. package/lib/git-purge.mjs +2 -2
  172. package/lib/index.cjs +1 -1
  173. package/lib/index.d.ts +1 -1
  174. package/lib/index.mjs +1 -1
  175. package/lib/kill-night-crows.cjs +7 -7
  176. package/lib/kill-night-crows.mjs +7 -7
  177. package/lib/node-cache-cleaner/npm.cjs +65 -0
  178. package/lib/node-cache-cleaner/npm.d.ts +2 -0
  179. package/lib/node-cache-cleaner/npm.js +41 -0
  180. package/lib/node-cache-cleaner/npm.mjs +10 -0
  181. package/lib/node-cache-cleaner/npx.cjs +89 -0
  182. package/lib/node-cache-cleaner/npx.d.ts +4 -0
  183. package/lib/node-cache-cleaner/npx.js +82 -0
  184. package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
  185. package/lib/node-cache-cleaner/yarn.cjs +73 -0
  186. package/lib/node-cache-cleaner/yarn.d.ts +2 -0
  187. package/lib/node-cache-cleaner/yarn.js +62 -0
  188. package/lib/node-cache-cleaner/yarn.mjs +10 -0
  189. package/lib/node-cache-cleaner-cli.cjs +365 -0
  190. package/lib/node-cache-cleaner-cli.d.ts +2 -0
  191. package/lib/node-cache-cleaner-cli.js +57 -0
  192. package/lib/node-cache-cleaner-cli.mjs +60 -0
  193. package/lib/node-executor.cjs +272 -0
  194. package/lib/node-executor.d.cts +2 -0
  195. package/lib/node-executor.mjs +106 -0
  196. package/lib/node-package-packer/build-readme.cjs +150 -0
  197. package/lib/node-package-packer/build-readme.d.mts +10 -0
  198. package/lib/node-package-packer/build-readme.mjs +10 -0
  199. package/lib/node-package-packer/build-tarball.cjs +495 -0
  200. package/lib/node-package-packer/build-tarball.d.mts +33 -0
  201. package/lib/node-package-packer/build-tarball.mjs +175 -0
  202. package/lib/node-package-packer-cli.cjs +525 -0
  203. package/lib/node-package-packer-cli.d.mts +1 -0
  204. package/lib/node-package-packer-cli.mjs +34 -0
  205. package/lib/npm-run-series.cjs +28 -40
  206. package/lib/npm-run-series.mjs +21 -7
  207. package/lib/package-resolutions-updater-cli.cjs +255 -173
  208. package/lib/package-resolutions-updater-cli.mjs +19 -40
  209. package/lib/package-resolutions-updater.cjs +244 -141
  210. package/lib/package-resolutions-updater.d.mts +54 -1
  211. package/lib/package-resolutions-updater.mjs +8 -5
  212. package/lib/php-cs-fixer-staged.cjs +1 -1
  213. package/lib/php-cs-fixer-staged.mjs +1 -1
  214. package/lib/print-directory-tree.cjs +18 -20
  215. package/lib/print-directory-tree.mjs +11 -8
  216. package/lib/print-tarball-tree.cjs +262 -0
  217. package/lib/print-tarball-tree.d.mts +1 -0
  218. package/lib/print-tarball-tree.mjs +68 -0
  219. package/lib/ps/connected-domain.js +10 -10
  220. package/lib/ps/index.cjs +11 -11
  221. package/lib/ps/index.mjs +180 -174
  222. package/lib/ps/table-parser.d.ts +3 -4
  223. package/lib/ps/table-parser.js +15 -22
  224. package/lib/remove-module.cjs +19 -24
  225. package/lib/remove-module.mjs +2 -2
  226. package/lib/rm-node-module-cli.cjs +389 -0
  227. package/lib/rm-node-module-cli.d.cts +1 -0
  228. package/lib/rm-node-module-cli.mjs +92 -0
  229. package/lib/rm-node-modules.cjs +127 -0
  230. package/lib/rm-node-modules.d.cts +35 -0
  231. package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
  232. package/lib/rmpath-cli.cjs +285 -0
  233. package/lib/rmpath-cli.d.mts +1 -0
  234. package/lib/rmpath-cli.mjs +23 -0
  235. package/lib/rmpath.cjs +6 -217
  236. package/lib/rmpath.mjs +5 -101
  237. package/lib/run-by-checksum/cache.cjs +69 -0
  238. package/lib/run-by-checksum/cache.d.ts +19 -0
  239. package/lib/run-by-checksum/cache.js +50 -0
  240. package/lib/run-by-checksum/cache.mjs +12 -0
  241. package/lib/run-by-checksum/hash.cjs +72 -0
  242. package/lib/run-by-checksum/hash.d.ts +14 -0
  243. package/lib/run-by-checksum/hash.js +85 -0
  244. package/lib/run-by-checksum/hash.mjs +10 -0
  245. package/lib/run-by-checksum/run.cjs +169 -0
  246. package/lib/run-by-checksum/run.d.ts +22 -0
  247. package/lib/run-by-checksum/run.js +93 -0
  248. package/lib/run-by-checksum/run.mjs +10 -0
  249. package/lib/run-by-checksum-cli.cjs +382 -0
  250. package/lib/run-by-checksum-cli.d.ts +2 -0
  251. package/lib/run-by-checksum-cli.js +43 -0
  252. package/lib/run-by-checksum-cli.mjs +56 -0
  253. package/lib/submodule-install.cjs +55 -47
  254. package/lib/submodule-install.mjs +48 -35
  255. package/lib/submodule-remove-cli.cjs +170 -4
  256. package/lib/submodule-remove-cli.js +5 -5
  257. package/lib/submodule-remove-cli.mjs +6 -4
  258. package/lib/utils/chatgpt.cjs +19 -13
  259. package/lib/utils/chatgpt.js +94 -94
  260. package/lib/utils/chatgpt.mjs +1 -1
  261. package/lib/utils/fetchResponse.cjs +24 -0
  262. package/lib/utils/fetchResponse.d.cts +25 -0
  263. package/lib/utils/fetchResponse.mjs +6 -0
  264. package/lib/utils/findEnvFiles.cjs +28 -46
  265. package/lib/utils/findEnvFiles.d.cts +19 -0
  266. package/lib/utils/findEnvFiles.mjs +3 -5
  267. package/lib/utils/findWorkspaceRoot.js +4 -4
  268. package/lib/utils/index.cjs +7 -12
  269. package/lib/utils/index.d.cts +2 -9
  270. package/lib/utils/index.mjs +1 -1
  271. package/lib/utils/isGithubTokenValid.js +7 -7
  272. package/lib/{ps/isWin.cjs → utils/isWindows.cjs} +12 -7
  273. package/lib/utils/isWindows.d.ts +5 -0
  274. package/lib/utils/isWindows.js +10 -0
  275. package/lib/utils/isWindows.mjs +10 -0
  276. package/lib/utils/runBash.cjs +53 -0
  277. package/lib/utils/runBash.d.cts +12 -0
  278. package/lib/utils/runBash.mjs +66 -0
  279. package/lib/yarn-per-branch-lock-installer.cjs +288 -0
  280. package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
  281. package/lib/yarn-per-branch-lock-installer.mjs +122 -0
  282. package/lib/yarn-reinstall.cjs +8 -13
  283. package/lib/yarn-reinstall.mjs +1 -1
  284. package/package.json +91 -57
  285. package/readme.html +784 -0
  286. package/readme.md +107 -219
  287. package/releases/readme.md +6 -3
  288. package/test/README.md +2 -2
  289. package/test-project/workspaces/workspace-a/readme.md +20 -0
  290. package/test-project/workspaces/workspace-a/release/readme.md +42 -0
  291. package/test-project/workspaces/workspace-a/test/readme.md +12 -0
  292. package/test-project/workspaces/workspace-b/readme.md +94 -0
  293. package/test-project/workspaces/workspace-b/requirements.txt +1 -0
  294. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
  295. package/tmp/test-repo/README.md +2 -35
  296. package/tmp/test-repo-runChecksum/test-complex-glob/README.md +1 -0
  297. package/tmp/test-repo-runChecksum/test-mixed-args/README.md +1 -0
  298. package/lib/binary-collections-config.cjs +0 -15
  299. package/lib/chunk-2CBJCW7E.mjs +0 -81
  300. package/lib/chunk-4UHL4WVN.mjs +0 -136
  301. package/lib/chunk-6HHJRKFB.mjs +0 -59
  302. package/lib/chunk-6S4NXESK.mjs +0 -26
  303. package/lib/chunk-7XTEJHOE.mjs +0 -193
  304. package/lib/chunk-AJDD5DZM.mjs +0 -109
  305. package/lib/chunk-FCDQGYBF.mjs +0 -136
  306. package/lib/chunk-GEYA2USY.mjs +0 -207
  307. package/lib/chunk-GJTGHXRA.mjs +0 -356
  308. package/lib/chunk-ID2WBTE2.mjs +0 -80
  309. package/lib/chunk-JXFOHKDM.mjs +0 -239
  310. package/lib/chunk-NCXAP7AA.mjs +0 -31
  311. package/lib/chunk-PDSXF5HY.mjs +0 -187
  312. package/lib/chunk-TOIVAQF7.mjs +0 -136
  313. package/lib/chunk-V5SKYJUB.mjs +0 -136
  314. package/lib/chunk-WSRETQCA.mjs +0 -59
  315. package/lib/chunk-YYLIQQKF.mjs +0 -31
  316. package/lib/del-ps.js +0 -32
  317. package/lib/del-ps.mjs +0 -43
  318. package/lib/ps/index.d.cjs +0 -17
  319. package/lib/ps/index.d.ts +0 -2
  320. package/lib/ps/index.js +0 -254
  321. package/lib/ps/isWin.d.ts +0 -2
  322. package/lib/ps/isWin.js +0 -4
  323. package/lib/utils/findEnvFiles.d.ts +0 -8
  324. package/lib/utils/findEnvFiles.js +0 -121
  325. package/test/package.json +0 -20
  326. package/test-project/package.json +0 -16
  327. package/tmp/test-repo/package.json +0 -7
  328. package/tmp/typedoc/readme.md +0 -320
  329. /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
  330. /package/lib/{del-ps.d.ts → clean-github-actions-caches-cli.d.cts} +0 -0
package/lib/git-diff.js CHANGED
@@ -16,19 +16,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.GPT_DIFF_OUTPUT_RELATIVE = exports.GPT_DIFF_OUTPUT = exports.DIFF_OUTPUT_RELATIVE = exports.DIFF_OUTPUT = exports.CACHE_DIR = void 0;
17
17
  exports.gitDiff = runGitDiff;
18
18
  exports.mainGitDiff = mainGitDiff;
19
+ const ansi_colors_1 = __importDefault(require("ansi-colors"));
19
20
  const child_process_1 = require("child_process");
20
21
  const fs_extra_1 = __importDefault(require("fs-extra"));
22
+ const sbg_utility_1 = require("sbg-utility");
21
23
  const upath_1 = __importDefault(require("upath"));
22
24
  const url_1 = require("url");
23
- const binary_collections_config_cjs_1 = require("./binary-collections-config.cjs");
25
+ const config_cjs_1 = require("./binary-collections/config.cjs");
24
26
  const chatgpt_js_1 = require("./utils/chatgpt.js");
25
27
  const index_cjs_1 = require("./utils/index.cjs");
26
28
  const __filename = (0, url_1.fileURLToPath)(import.meta.url);
27
29
  const __dirname = upath_1.default.dirname(__filename);
30
+ const args = (0, index_cjs_1.getArgs)();
31
+ const positional = args._ || [];
28
32
  // Output path using centralized temp directory configuration
29
- const DIFF_OUTPUT = (0, binary_collections_config_cjs_1.getTempPath)("git-diff.txt");
33
+ const FILENAME = (0, sbg_utility_1.md5)((positional[0] || 'default') + JSON.stringify(args));
34
+ const DIFF_OUTPUT = (0, config_cjs_1.getTempPath)(`git-diff/${FILENAME}.txt`);
30
35
  exports.DIFF_OUTPUT = DIFF_OUTPUT;
31
- const GPT_DIFF_OUTPUT = (0, binary_collections_config_cjs_1.getTempPath)("gpt-question.txt");
36
+ const GPT_DIFF_OUTPUT = (0, config_cjs_1.getTempPath)(`git-diff/gpt-${FILENAME}.txt`);
32
37
  exports.GPT_DIFF_OUTPUT = GPT_DIFF_OUTPUT;
33
38
  const CACHE_DIR = upath_1.default.dirname(DIFF_OUTPUT);
34
39
  exports.CACHE_DIR = CACHE_DIR;
@@ -38,20 +43,21 @@ exports.DIFF_OUTPUT_RELATIVE = DIFF_OUTPUT_RELATIVE;
38
43
  const GPT_DIFF_OUTPUT_RELATIVE = upath_1.default.relative(process.cwd(), GPT_DIFF_OUTPUT);
39
44
  exports.GPT_DIFF_OUTPUT_RELATIVE = GPT_DIFF_OUTPUT_RELATIVE;
40
45
  // Ensure output directory exists
41
- if (!fs_extra_1.default.existsSync(CACHE_DIR)) {
42
- fs_extra_1.default.mkdirSync(CACHE_DIR, { recursive: true });
43
- }
46
+ fs_extra_1.default.ensureDirSync(CACHE_DIR, { mode: 0o755 });
44
47
  function showHelp() {
45
- console.log("\u{1F4DD} Git Diff Helper");
46
- console.log("\u{1F4C4} Usage:");
47
- console.log(" \u{1F4C2} git-diff FILE Show staged diff of specified file");
48
- console.log(" \u{1F4C2} git-diff --staged-only Show staged diff of all files");
49
- console.log(" \u{1F4C2} git-diff -s | -S Same as --staged-only");
50
- console.log(" \u{1F4C2} git-diff --ai Run ChatGPT automation for commit message");
51
- console.log(" \u{1F4C2} git-diff --help | -h Show this help message");
52
- console.log("");
53
- console.log(`\u{1F4BE} Output is saved to: ${DIFF_OUTPUT_RELATIVE}`);
54
- console.log(`\u{1F916} GPT prompt is saved to: ${GPT_DIFF_OUTPUT_RELATIVE}`);
48
+ console.log('📋 Git Diff Helper');
49
+ console.log('Usage:');
50
+ console.log(' git-diff FILE Show staged diff of specified file');
51
+ console.log(' git-diff --staged-only Show staged diff of all files');
52
+ console.log(' git-diff -s | -S Same as --staged-only');
53
+ console.log(' git-diff --unstaged FILE Show unstaged diff of specified file');
54
+ console.log(' git-diff --unstaged Show unstaged diff of all files');
55
+ console.log(' git-diff -u Same as --unstaged');
56
+ console.log(' git-diff --ai Run ChatGPT automation for commit message');
57
+ console.log(' git-diff --help | -h Show this help message');
58
+ console.log('');
59
+ console.log(`💾 Output is saved to: ${DIFF_OUTPUT_RELATIVE}`);
60
+ console.log(`🤖 GPT prompt is saved to: ${GPT_DIFF_OUTPUT_RELATIVE}`);
55
61
  process.exit(0);
56
62
  }
57
63
  /**
@@ -64,6 +70,7 @@ function showHelp() {
64
70
  * @param {string} command - The git command to execute (e.g., "git --no-pager diff --staged")
65
71
  * @param {string} successMessage - Message to display when the command executes successfully
66
72
  * @param {string} errorMessage - Message to display when the command fails
73
+ * @returns {boolean} True when diff content exists, false when no changes were found
67
74
  *
68
75
  * @throws {Error} Exits the process with code 1 if the git command fails
69
76
  *
@@ -85,67 +92,174 @@ function showHelp() {
85
92
  */
86
93
  function runGitDiff(command, successMessage, errorMessage) {
87
94
  try {
88
- console.log(`🔍 [i] Running command: ${command}`);
95
+ console.log(`ℹ️ Running command: ${command}`);
89
96
  const result = (0, child_process_1.execSync)(command, {
90
- encoding: "utf8",
97
+ encoding: 'utf8',
91
98
  maxBuffer: 1024 * 1024 * 10 // 10MB buffer to handle large diffs
92
99
  });
93
100
  // If result is empty, inform user but don't treat as error
94
- if (!result || result.trim() === "") {
95
- console.log(`ℹ️ [i] No changes found for the specified criteria`);
96
- fs_extra_1.default.writeFileSync(DIFF_OUTPUT, "# No changes found\n");
101
+ if (!result || result.trim() === '') {
102
+ console.log(`ℹ️ No changes found for the specified criteria`);
103
+ (0, sbg_utility_1.writefile)(DIFF_OUTPUT, '# No changes found\n');
97
104
  console.log(`✅ Empty diff saved to "${DIFF_OUTPUT_RELATIVE}"`);
98
- return;
105
+ return false;
99
106
  }
100
- fs_extra_1.default.writeFileSync(DIFF_OUTPUT, result);
101
- fs_extra_1.default.writeFileSync(GPT_DIFF_OUTPUT, `Hello, ChatGPT!\nCan you create a conventional commit message by diff content below:\n\n\`\`\`${result}\n\`\`\`\n\nGive me result as codeblock with language "text" only.\n\nThank you!`);
107
+ (0, sbg_utility_1.writefile)(DIFF_OUTPUT, result);
108
+ (0, sbg_utility_1.writefile)(GPT_DIFF_OUTPUT, `Hello!\nCan you create a conventional commit message by diff content below:\n\n\`\`\`${result}\n\`\`\`\n\nGive me result as codeblock with language "text" only.\n\nThank you!`);
102
109
  console.log(`✅ ${successMessage}`);
103
- console.log(`💾 GPT diff prompt saved to "${GPT_DIFF_OUTPUT_RELATIVE}"`);
110
+ console.log(`💾 GPT diff prompt saved to "${ansi_colors_1.default.green(GPT_DIFF_OUTPUT_RELATIVE)}"`);
111
+ return true;
104
112
  }
105
113
  catch (error) {
106
114
  console.error(`❌ ${errorMessage}`);
107
- console.error(`📝 Command: ${command}`);
108
- console.error(`⚠️ Error: ${error.message}`);
115
+ console.error(`❌ Command: ${command}`);
116
+ console.error(`❌ Error: ${error.message}`);
109
117
  // Check if it's a git-related error
110
- if (error.message.includes("not a git repository")) {
111
- console.error("🚧 Make sure you are in a git repository");
118
+ if (error.message.includes('not a git repository')) {
119
+ console.error('❌ Make sure you are in a git repository');
112
120
  }
113
121
  process.exit(1);
114
122
  }
115
123
  }
124
+ /**
125
+ * Generates diff-formatted output for untracked files.
126
+ * Uses `git ls-files --others --exclude-standard` to find untracked files,
127
+ * then creates synthetic git diff entries for each.
128
+ *
129
+ * @returns {string} Formatted diff content for untracked files, or empty string if none
130
+ */
131
+ function getUntrackedDiff() {
132
+ try {
133
+ const untrackedStr = (0, child_process_1.execSync)('git ls-files --others --exclude-standard', {
134
+ encoding: 'utf8',
135
+ maxBuffer: 1024 * 1024 * 10
136
+ }).trim();
137
+ if (!untrackedStr)
138
+ return '';
139
+ const untrackedFiles = untrackedStr.split('\n').filter(function (f) {
140
+ return f;
141
+ });
142
+ if (untrackedFiles.length === 0)
143
+ return '';
144
+ var result = '\n# Untracked files:\n';
145
+ for (var i = 0; i < untrackedFiles.length; i++) {
146
+ var file = untrackedFiles[i];
147
+ if (!fs_extra_1.default.existsSync(file))
148
+ continue;
149
+ var stat = fs_extra_1.default.statSync(file);
150
+ if (!stat.isFile())
151
+ continue;
152
+ var content;
153
+ try {
154
+ content = fs_extra_1.default.readFileSync(file, 'utf8');
155
+ }
156
+ catch (_a) {
157
+ continue; // skip binary files
158
+ }
159
+ var lines = content.split('\n');
160
+ // Remove trailing empty line from split
161
+ if (lines.length > 0 && lines[lines.length - 1] === '') {
162
+ lines.pop();
163
+ }
164
+ result += 'diff --git a/' + file + ' b/' + file + '\n';
165
+ result += 'new file mode 100644\n';
166
+ result += 'index 0000000..0000000\n';
167
+ result += '--- /dev/null\n';
168
+ result += '+++ b/' + file + '\n';
169
+ result += '@@ -0,0 +1,' + (lines.length || 0) + ' @@\n';
170
+ for (var j = 0; j < lines.length; j++) {
171
+ result += '+' + lines[j] + '\n';
172
+ }
173
+ }
174
+ return result;
175
+ }
176
+ catch (_b) {
177
+ return '';
178
+ }
179
+ }
180
+ function fileHasChanges(file, mode) {
181
+ const command = mode === 'staged' ? `git diff --cached --quiet -- "${file}"` : `git diff --quiet -- "${file}"`;
182
+ try {
183
+ (0, child_process_1.execSync)(command, { stdio: 'ignore' });
184
+ return false;
185
+ }
186
+ catch (error) {
187
+ if (error.status === 1) {
188
+ return true;
189
+ }
190
+ throw error;
191
+ }
192
+ }
116
193
  function mainGitDiff() {
117
194
  return __awaiter(this, void 0, void 0, function* () {
118
- const args = (0, index_cjs_1.getArgs)();
119
- const positional = args._ || [];
120
195
  // Show help if no arguments or --help/-h is passed
121
196
  if (args.help || args.h) {
122
197
  showHelp();
123
198
  }
124
- if (args["staged-only"] || args.s || args.S) {
125
- runGitDiff("git --no-pager diff --staged", `Full staged diff saved to "${DIFF_OUTPUT_RELATIVE}"`, "Failed to save staged diff");
199
+ const useUnstaged = args.unstaged || args.u;
200
+ const fileFromFlag = typeof args.unstaged === 'string' ? args.unstaged : typeof args.u === 'string' ? args.u : null;
201
+ let hasDiff = false;
202
+ if (args['staged-only'] || args.s || args.S) {
203
+ hasDiff = runGitDiff('git --no-pager diff --staged', `Full staged diff saved to "${ansi_colors_1.default.green(DIFF_OUTPUT_RELATIVE)}"`, 'Failed to save staged diff');
126
204
  }
127
205
  else {
128
206
  // Handle specific file diff
129
- const file = positional[0];
207
+ const file = positional[0] || fileFromFlag;
130
208
  if (!file) {
131
- runGitDiff("git --no-pager diff", `Full staged diff saved to "${DIFF_OUTPUT_RELATIVE}"`, "Failed to save all diff's");
209
+ const fullDiffModeLabel = useUnstaged ? 'unstaged' : 'unstaged';
210
+ hasDiff = runGitDiff('git --no-pager diff', `Full ${fullDiffModeLabel} diff saved to "${ansi_colors_1.default.green(DIFF_OUTPUT_RELATIVE)}"`, "Failed to save all diff's");
211
+ // Save untracked file diffs to separate file
212
+ const untrackedDiff = getUntrackedDiff();
213
+ if (untrackedDiff) {
214
+ const UNTRACKED_DIFF_OUTPUT = (0, config_cjs_1.getTempPath)(`git-diff/untracked-${FILENAME}.txt`);
215
+ const UNTRACKED_GPT_DIFF_OUTPUT = (0, config_cjs_1.getTempPath)(`git-diff/gpt-untracked-${FILENAME}.txt`);
216
+ const UNTRACKED_DIFF_OUTPUT_RELATIVE = upath_1.default.relative(process.cwd(), UNTRACKED_DIFF_OUTPUT);
217
+ (0, sbg_utility_1.writefile)(UNTRACKED_DIFF_OUTPUT, untrackedDiff);
218
+ (0, sbg_utility_1.writefile)(UNTRACKED_GPT_DIFF_OUTPUT, `Hello!\nCan you create a conventional commit message by diff content below:\n\n\`\`\`${untrackedDiff}\n\`\`\`\n\nGive me result as codeblock with language "text" only.\n\nThank you!`);
219
+ console.log(`✅ Untracked file diff saved to "${ansi_colors_1.default.green(UNTRACKED_DIFF_OUTPUT_RELATIVE)}"`);
220
+ console.log(`💾 AI diff prompt saved to "${ansi_colors_1.default.green(upath_1.default.relative(process.cwd(), UNTRACKED_GPT_DIFF_OUTPUT))}"`);
221
+ hasDiff = true;
222
+ }
132
223
  }
133
224
  else {
134
- runGitDiff(`git --no-pager diff --cached -- "${file}"`, `Staged diff of "${file}" saved to "${DIFF_OUTPUT_RELATIVE}"`, `Failed to generate diff for "${file}"`);
225
+ let fileDiffMode = useUnstaged ? 'unstaged' : 'staged';
226
+ // Default behavior for file target: prefer staged changes, then fall back to unstaged.
227
+ if (!useUnstaged && !fileHasChanges(file, 'staged') && fileHasChanges(file, 'unstaged')) {
228
+ fileDiffMode = 'unstaged';
229
+ }
230
+ hasDiff = runGitDiff(fileDiffMode === 'unstaged' ? `git --no-pager diff -- "${file}"` : `git --no-pager diff --cached -- "${file}"`, `${fileDiffMode[0].toUpperCase() + fileDiffMode.slice(1)} diff of "${file}" saved to "${ansi_colors_1.default.green(DIFF_OUTPUT_RELATIVE)}"`, `Failed to generate ${fileDiffMode} diff for "${file}"`);
135
231
  }
136
232
  }
233
+ if (hasDiff) {
234
+ // Generate command prompt for opencode CLI
235
+ const opencodePrompt = [
236
+ '',
237
+ '🤖 OpenCode Prompt Helper',
238
+ '────────────────────────',
239
+ '',
240
+ '📄 App Prompt:',
241
+ ` Generate a conventional commit message from diff file: ${DIFF_OUTPUT}`,
242
+ '',
243
+ '💻 CLI Command:',
244
+ ` opencode run "Generate a conventional commit message from diff file ${DIFF_OUTPUT}"`,
245
+ ''
246
+ ];
247
+ const opencodePromptPath = (0, config_cjs_1.getTempPath)(`git-diff/opencode-${FILENAME}.txt`);
248
+ (0, sbg_utility_1.writefile)(opencodePromptPath, opencodePrompt.join('\n'));
249
+ console.log(`✅ OpenCode prompt saved to "${ansi_colors_1.default.green(upath_1.default.relative(process.cwd(), opencodePromptPath))}"`);
250
+ }
137
251
  // Generate commit message prompt from ChatGPT (only if --ai is specified)
138
252
  if (args.ai) {
139
253
  try {
140
254
  yield (0, chatgpt_js_1.runChatGpt)({ headless: true, questionFile: GPT_DIFF_OUTPUT });
141
255
  }
142
256
  catch (error) {
143
- console.error("❌ Error running ChatGPT:", error.message);
144
- console.error("💡 Try running with visible browser mode or check if Chrome is installed");
257
+ console.error('❌ Error running ChatGPT:', error.message);
258
+ console.error('💡 Try running with visible browser mode or check if Chrome is installed');
145
259
  }
146
260
  }
147
261
  else {
148
- console.log("💡 Tip: Use --ai flag to generate commit message with ChatGPT");
262
+ console.log('💡 Use --ai flag to generate commit message with ChatGPT');
149
263
  }
150
264
  });
151
265
  }
package/lib/git-diff.mjs CHANGED
@@ -9,10 +9,11 @@ import {
9
9
  git_diff_default,
10
10
  mainGitDiff,
11
11
  runGitDiff
12
- } from "./chunk-FCDQGYBF.mjs";
13
- import "./chunk-N436BNBK.mjs";
14
- import "./chunk-YYLIQQKF.mjs";
15
- import "./chunk-Z6JLYU2J.mjs";
12
+ } from "./chunk-2MN4VPV2.mjs";
13
+ import "./chunk-X2B3X7D4.mjs";
14
+ import "./chunk-GAGABICI.mjs";
15
+ import "./chunk-H44UWUFY.mjs";
16
+ import "./chunk-6RK5UCTP.mjs";
16
17
  import "./chunk-QQ4A6DLD.mjs";
17
18
  export {
18
19
  CACHE_DIR,
package/lib/git-fix.cjs CHANGED
@@ -349,9 +349,9 @@ var require_utils2 = __commonJS({
349
349
  init_cjs_shims();
350
350
  var fs = require("fs");
351
351
  var path2 = require("upath");
352
- var argv = require("minimist")(process.argv.slice(2));
352
+ var minimistLib = require("minimist");
353
+ var argv = minimistLib(process.argv.slice(2));
353
354
  var { exec } = require("child_process");
354
- var { URL: URL2 } = require("url");
355
355
  var { promisify } = require("util");
356
356
  var execAsync = promisify(exec);
357
357
  async function parseGitRemotes() {
@@ -364,7 +364,7 @@ var require_utils2 = __commonJS({
364
364
  if (name && url) {
365
365
  const [repoUrl] = url.split(" ");
366
366
  try {
367
- const parsedUrl = new URL2(repoUrl);
367
+ const parsedUrl = new URL(repoUrl);
368
368
  const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
369
369
  if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
370
370
  let repoPath = pathParts.join("/");
@@ -385,15 +385,10 @@ var require_utils2 = __commonJS({
385
385
  }
386
386
  }
387
387
  module2.exports.parseGitRemotes = parseGitRemotes;
388
- function joinPathPreserveDriveLetter(...segments) {
389
- let fullPath = require("path").join(...segments);
390
- if (/^[a-z]:\\/.test(fullPath)) {
391
- fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
388
+ function getArgs2(opts) {
389
+ if (opts) {
390
+ return minimistLib(process.argv.slice(2), opts);
392
391
  }
393
- return fullPath;
394
- }
395
- module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
396
- function getArgs2() {
397
392
  return argv;
398
393
  }
399
394
  module2.exports.getArgs = getArgs2;
@@ -418,7 +413,7 @@ var require_utils2 = __commonJS({
418
413
  try {
419
414
  fs.rmdirSync(fullPath);
420
415
  console.log("deleted", fullPath);
421
- } catch (e) {
416
+ } catch (_e) {
422
417
  try {
423
418
  fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
424
419
  console.log("deleted", fullPath);
@@ -431,7 +426,7 @@ var require_utils2 = __commonJS({
431
426
  try {
432
427
  fs.unlinkSync(fullPath);
433
428
  console.log("deleted", fullPath);
434
- } catch (e) {
429
+ } catch (_e) {
435
430
  try {
436
431
  fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
437
432
  console.log("deleted", fullPath);
@@ -522,7 +517,7 @@ var require_user_config = __commonJS({
522
517
  var gch = require("git-command-helper");
523
518
  var { runGitCommand, runGitCommandOutput } = require_utils();
524
519
  var { getArgs: getArgs2 } = require_utils2();
525
- require("dotenv").config({ path: require("path").join(process.cwd(), ".env"), quiet: true });
520
+ require("dotenv").config({ path: require("upath").join(process.cwd(), ".env"), quiet: true });
526
521
  function configureGitUser2(cliUser = null, cliEmail = null, options2 = {}) {
527
522
  console.log("\n=== Configuring Git User ===");
528
523
  let username, email;
package/lib/git-fix.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-A2JQXI5Z.mjs";
6
6
  import {
7
7
  require_user_config
8
- } from "./chunk-AJDD5DZM.mjs";
8
+ } from "./chunk-MGPYPKIE.mjs";
9
9
  import {
10
10
  require_line_endings
11
11
  } from "./chunk-ZDMWBSYF.mjs";
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-A3VUZEJK.mjs";
22
22
  import {
23
23
  require_utils
24
- } from "./chunk-Z6JLYU2J.mjs";
24
+ } from "./chunk-6RK5UCTP.mjs";
25
25
  import {
26
26
  __commonJS,
27
27
  __require,
package/lib/git-purge.cjs CHANGED
@@ -19,9 +19,9 @@ var require_utils = __commonJS({
19
19
  init_cjs_shims();
20
20
  var fs = require("fs");
21
21
  var path2 = require("upath");
22
- var argv = require("minimist")(process.argv.slice(2));
22
+ var minimistLib = require("minimist");
23
+ var argv = minimistLib(process.argv.slice(2));
23
24
  var { exec } = require("child_process");
24
- var { URL: URL2 } = require("url");
25
25
  var { promisify } = require("util");
26
26
  var execAsync = promisify(exec);
27
27
  async function parseGitRemotes() {
@@ -34,7 +34,7 @@ var require_utils = __commonJS({
34
34
  if (name && url) {
35
35
  const [repoUrl] = url.split(" ");
36
36
  try {
37
- const parsedUrl = new URL2(repoUrl);
37
+ const parsedUrl = new URL(repoUrl);
38
38
  const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
39
39
  if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
40
40
  let repoPath = pathParts.join("/");
@@ -55,15 +55,10 @@ var require_utils = __commonJS({
55
55
  }
56
56
  }
57
57
  module2.exports.parseGitRemotes = parseGitRemotes;
58
- function joinPathPreserveDriveLetter(...segments) {
59
- let fullPath = require("path").join(...segments);
60
- if (/^[a-z]:\\/.test(fullPath)) {
61
- fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
58
+ function getArgs(opts) {
59
+ if (opts) {
60
+ return minimistLib(process.argv.slice(2), opts);
62
61
  }
63
- return fullPath;
64
- }
65
- module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
66
- function getArgs() {
67
62
  return argv;
68
63
  }
69
64
  module2.exports.getArgs = getArgs;
@@ -88,7 +83,7 @@ var require_utils = __commonJS({
88
83
  try {
89
84
  fs.rmdirSync(fullPath);
90
85
  console.log("deleted", fullPath);
91
- } catch (e) {
86
+ } catch (_e) {
92
87
  try {
93
88
  fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
94
89
  console.log("deleted", fullPath);
@@ -101,7 +96,7 @@ var require_utils = __commonJS({
101
96
  try {
102
97
  fs.unlinkSync(fullPath);
103
98
  console.log("deleted", fullPath);
104
- } catch (e) {
99
+ } catch (_e) {
105
100
  try {
106
101
  fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
107
102
  console.log("deleted", fullPath);
@@ -189,7 +184,7 @@ var require_utils = __commonJS({
189
184
  init_cjs_shims();
190
185
  var { spawnAsync } = require("cross-spawn");
191
186
  var glob = require("glob");
192
- var path = require("path");
187
+ var path = require("upath");
193
188
  var { delay } = require_utils();
194
189
  var dirs = [];
195
190
  var fetchDirs = (pattern, callback) => {
package/lib/git-purge.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_utils
4
- } from "./chunk-Z6JLYU2J.mjs";
4
+ } from "./chunk-6RK5UCTP.mjs";
5
5
  import {
6
6
  __commonJS,
7
7
  __require,
@@ -14,7 +14,7 @@ var require_git_purge = __commonJS({
14
14
  init_esm_shims();
15
15
  var { spawnAsync } = __require("cross-spawn");
16
16
  var glob = __require("glob");
17
- var path = __require("path");
17
+ var path = __require("upath");
18
18
  var { delay } = require_utils();
19
19
  var dirs = [];
20
20
  var fetchDirs = (pattern, callback) => {
package/lib/index.cjs CHANGED
@@ -43,7 +43,7 @@ var require_find_node_modules = __commonJS({
43
43
  "src/find-node-modules.cjs"(exports2, module2) {
44
44
  init_cjs_shims();
45
45
  var glob = require("glob");
46
- var path = require("path");
46
+ var path = require("upath");
47
47
  function findNodeModules2(dir = process.cwd(), callback = null) {
48
48
  const finalDir = typeof dir === "string" ? dir : process.cwd();
49
49
  return new Promise((resolve, reject) => {
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { findNodeModules } from "./find-node-modules.cjs";
1
+ import { findNodeModules } from './find-node-modules.cjs';
2
2
  export { findNodeModules };
package/lib/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_find_node_modules
4
- } from "./chunk-M3YIYRHT.mjs";
4
+ } from "./chunk-UY5VUEA3.mjs";
5
5
  import {
6
6
  __toESM,
7
7
  init_esm_shims
@@ -65,19 +65,19 @@ ${scriptChecks.map((check) => ` ${check.exists ? "found" : "missing"} - ${check
65
65
  process.exit(0);
66
66
  }
67
67
  if (!scriptPath) {
68
- console.error(`PowerShell script not found in any of these paths:
69
- ${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`);
68
+ console.error(
69
+ `PowerShell script not found in any of these paths:
70
+ ${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`
71
+ );
70
72
  process.exit(1);
71
73
  }
72
74
  if (process.platform !== "win32") {
73
75
  console.error("kill-night-crows is supported only on Windows.");
74
76
  process.exit(1);
75
77
  }
76
- var result = (0, import_node_child_process.spawnSync)(
77
- "powershell.exe",
78
- ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args],
79
- { stdio: "inherit" }
80
- );
78
+ var result = (0, import_node_child_process.spawnSync)("powershell.exe", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args], {
79
+ stdio: "inherit"
80
+ });
81
81
  if (typeof result.status === "number") {
82
82
  process.exit(result.status);
83
83
  }
@@ -43,19 +43,19 @@ ${scriptChecks.map((check) => ` ${check.exists ? "found" : "missing"} - ${check
43
43
  process.exit(0);
44
44
  }
45
45
  if (!scriptPath) {
46
- console.error(`PowerShell script not found in any of these paths:
47
- ${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`);
46
+ console.error(
47
+ `PowerShell script not found in any of these paths:
48
+ ${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`
49
+ );
48
50
  process.exit(1);
49
51
  }
50
52
  if (process.platform !== "win32") {
51
53
  console.error("kill-night-crows is supported only on Windows.");
52
54
  process.exit(1);
53
55
  }
54
- var result = spawnSync(
55
- "powershell.exe",
56
- ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args],
57
- { stdio: "inherit" }
58
- );
56
+ var result = spawnSync("powershell.exe", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args], {
57
+ stdio: "inherit"
58
+ });
59
59
  if (typeof result.status === "number") {
60
60
  process.exit(result.status);
61
61
  }
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/node-cache-cleaner/npm.ts
20
+ var npm_exports = {};
21
+ __export(npm_exports, {
22
+ cleanNpmCache: () => cleanNpmCache,
23
+ npmVersion: () => npmVersion
24
+ });
25
+ module.exports = __toCommonJS(npm_exports);
26
+ var import_cross_spawn = require("cross-spawn");
27
+ function npmVersion() {
28
+ return new Promise((resolve, reject) => {
29
+ const process = (0, import_cross_spawn.spawn)("npm", ["--version"], {
30
+ stdio: "pipe",
31
+ shell: true
32
+ });
33
+ let version = "";
34
+ process.stdout.on("data", (data) => {
35
+ version += data.toString();
36
+ });
37
+ process.on("close", (code) => {
38
+ if (code === 0) {
39
+ resolve(version.trim());
40
+ } else {
41
+ reject(new Error(`NPM version check failed with exit code ${code}`));
42
+ }
43
+ });
44
+ });
45
+ }
46
+ function cleanNpmCache() {
47
+ return new Promise((resolve, reject) => {
48
+ const process = (0, import_cross_spawn.spawn)("npm", ["cache", "clean", "--force"], {
49
+ stdio: "inherit",
50
+ shell: true
51
+ });
52
+ process.on("close", (code) => {
53
+ if (code === 0) {
54
+ resolve(true);
55
+ } else {
56
+ reject(new Error(`NPM cache clean failed with exit code ${code}`));
57
+ }
58
+ });
59
+ });
60
+ }
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ cleanNpmCache,
64
+ npmVersion
65
+ });
@@ -0,0 +1,2 @@
1
+ export declare function npmVersion(): Promise<string>;
2
+ export declare function cleanNpmCache(): Promise<unknown>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.npmVersion = npmVersion;
4
+ exports.cleanNpmCache = cleanNpmCache;
5
+ const cross_spawn_1 = require("cross-spawn");
6
+ function npmVersion() {
7
+ return new Promise((resolve, reject) => {
8
+ const process = (0, cross_spawn_1.spawn)('npm', ['--version'], {
9
+ stdio: 'pipe',
10
+ shell: true
11
+ });
12
+ let version = '';
13
+ process.stdout.on('data', (data) => {
14
+ version += data.toString();
15
+ });
16
+ process.on('close', (code) => {
17
+ if (code === 0) {
18
+ resolve(version.trim());
19
+ }
20
+ else {
21
+ reject(new Error(`NPM version check failed with exit code ${code}`));
22
+ }
23
+ });
24
+ });
25
+ }
26
+ function cleanNpmCache() {
27
+ return new Promise((resolve, reject) => {
28
+ const process = (0, cross_spawn_1.spawn)('npm', ['cache', 'clean', '--force'], {
29
+ stdio: 'inherit',
30
+ shell: true
31
+ });
32
+ process.on('close', (code) => {
33
+ if (code === 0) {
34
+ resolve(true);
35
+ }
36
+ else {
37
+ reject(new Error(`NPM cache clean failed with exit code ${code}`));
38
+ }
39
+ });
40
+ });
41
+ }