binary-collections 2.0.12 → 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 (231) 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.cjs +89 -13
  14. package/binaries/submodule-token.cjs +89 -13
  15. package/binaries/test-cjs.cjs +89 -13
  16. package/binaries/test-esm.cjs +89 -13
  17. package/binaries/yarn-clean.cjs +89 -13
  18. package/binaries/yc +22 -1
  19. package/binaries/yc.cjs +89 -13
  20. package/binaries/ycw +256 -0
  21. package/binaries/ycw.cjs +254 -0
  22. package/docs-src/binary-collections.md +34 -0
  23. package/docs-src/changelog.md +26 -0
  24. package/docs-src/clean-github-actions-caches.md +115 -0
  25. package/docs-src/copy-move-file.md +59 -0
  26. package/docs-src/del-gradle.md +17 -0
  27. package/docs-src/del-ps.md +28 -0
  28. package/docs-src/downloader.md +62 -0
  29. package/docs-src/env-helpers.md +29 -0
  30. package/docs-src/find-node-modules.md +17 -0
  31. package/docs-src/free-chatgpt.md +26 -0
  32. package/docs-src/git-diff.md +33 -0
  33. package/docs-src/git-fix.md +34 -0
  34. package/docs-src/git-purge.md +17 -0
  35. package/docs-src/git-reduce-size.md +17 -0
  36. package/docs-src/git-undo.md +21 -0
  37. package/docs-src/kill-night-crows.md +26 -0
  38. package/docs-src/node-cache-cleaner.md +182 -0
  39. package/docs-src/node-executor.md +50 -0
  40. package/docs-src/node-package-packer.md +48 -0
  41. package/docs-src/npm-run-series.md +43 -0
  42. package/docs-src/package-resolutions-updater.md +22 -0
  43. package/docs-src/php-cs-fixer-staged.md +19 -0
  44. package/docs-src/print-directory-tree.md +35 -0
  45. package/docs-src/print-tarball-tree.md +55 -0
  46. package/docs-src/py.md +19 -0
  47. package/docs-src/remove-module.md +32 -0
  48. package/docs-src/rmfind-rmx.md +21 -0
  49. package/docs-src/rmpath.md +38 -0
  50. package/docs-src/run-by-checksum.md +87 -0
  51. package/docs-src/submodule-install.md +31 -0
  52. package/docs-src/submodule-remove.md +22 -0
  53. package/docs-src/submodule-token.md +17 -0
  54. package/docs-src/test-runners.md +21 -0
  55. package/docs-src/yarn-install.md +31 -0
  56. package/docs-src/yarn-reinstall.md +27 -0
  57. package/lib/binary-collections/config.cjs +1 -1
  58. package/lib/binary-collections/config.mjs +1 -1
  59. package/lib/binary-collections/findScript.cjs +35 -10
  60. package/lib/binary-collections/findScript.mjs +2 -2
  61. package/lib/binary-collections/listScript.cjs +35 -10
  62. package/lib/binary-collections/listScript.mjs +2 -2
  63. package/lib/binary-collections.cjs +45 -25
  64. package/lib/binary-collections.mjs +11 -11
  65. package/lib/changelog.cjs +7 -12
  66. package/lib/changelog.mjs +2 -2
  67. package/lib/{chunk-SPTECFE5.mjs → chunk-2MN4VPV2.mjs} +86 -20
  68. package/lib/{chunk-V2IBPCEV.mjs → chunk-6C7KTYGZ.mjs} +3 -1
  69. package/lib/{chunk-5RTXZVCW.mjs → chunk-6RK5UCTP.mjs} +5 -10
  70. package/lib/{chunk-FB2WKVJD.mjs → chunk-CD3HF3LK.mjs} +67 -35
  71. package/lib/{chunk-6PU7BAHB.mjs → chunk-FLYSZFLW.mjs} +1 -1
  72. package/lib/chunk-KLKAIFKI.mjs +40 -0
  73. package/lib/chunk-LVSPEFU2.mjs +86 -0
  74. package/lib/{chunk-2LSRSEXF.mjs → chunk-MGPYPKIE.mjs} +2 -2
  75. package/lib/{chunk-ZOWVMII3.mjs → chunk-NQXUYO67.mjs} +35 -10
  76. package/lib/{chunk-C6D2TTYU.mjs → chunk-OBXLTXFJ.mjs} +4 -2
  77. package/lib/chunk-QD4T255Z.mjs +40 -0
  78. package/lib/{chunk-XPJGCDOD.mjs → chunk-QII2EKCS.mjs} +14 -2
  79. package/lib/chunk-RDGDLSPD.mjs +76 -0
  80. package/lib/{chunk-NCZPTKDV.mjs → chunk-RDN6HF5Z.mjs} +1 -1
  81. package/lib/chunk-RJKTSUAX.mjs +123 -0
  82. package/lib/{chunk-66KDU4TX.mjs → chunk-TBWXE7ST.mjs} +36 -61
  83. package/lib/{chunk-M3YIYRHT.mjs → chunk-UY5VUEA3.mjs} +1 -1
  84. package/lib/chunk-WSHVPGNM.mjs +44 -0
  85. package/lib/{chunk-G5UUEWUO.mjs → chunk-X2B3X7D4.mjs} +1 -1
  86. package/lib/clean-github-actions-caches-cli.cjs +255 -213
  87. package/lib/clean-github-actions-caches-cli.mjs +25 -7
  88. package/lib/clean-github-actions-caches.cjs +231 -35
  89. package/lib/clean-github-actions-caches.d.cts +39 -1
  90. package/lib/clean-github-actions-caches.mjs +2 -1
  91. package/lib/cross-env/command.cjs +2 -2
  92. package/lib/cross-env/command.js +2 -2
  93. package/lib/cross-env/command.mjs +2 -2
  94. package/lib/cross-env/index.cjs +2 -2
  95. package/lib/cross-env/index.mjs +3 -3
  96. package/lib/cross-env/variable.mjs +2 -2
  97. package/lib/del-gradle.cjs +6 -11
  98. package/lib/del-gradle.mjs +1 -1
  99. package/lib/del-node-modules.cjs +185 -3
  100. package/lib/del-node-modules.js +3 -3
  101. package/lib/del-node-modules.mjs +6 -3
  102. package/lib/{del-ps.cjs → del-ps-cli.cjs} +36 -41
  103. package/lib/del-ps-cli.mjs +44 -0
  104. package/lib/del-yarn-caches.cjs +6 -11
  105. package/lib/del-yarn-caches.mjs +1 -1
  106. package/lib/downloader-cli.cjs +256 -0
  107. package/lib/downloader-cli.d.cts +2 -0
  108. package/lib/downloader-cli.mjs +90 -0
  109. package/lib/file/copy-cli.cjs +183 -2
  110. package/lib/file/copy-cli.mjs +6 -2
  111. package/lib/file/move-cli.cjs +183 -2
  112. package/lib/file/move-cli.mjs +6 -2
  113. package/lib/find-node-modules-cli.cjs +1 -1
  114. package/lib/find-node-modules-cli.mjs +1 -1
  115. package/lib/find-node-modules.cjs +1 -1
  116. package/lib/find-node-modules.mjs +1 -1
  117. package/lib/free-chatgpt.cjs +6 -11
  118. package/lib/free-chatgpt.mjs +1 -1
  119. package/lib/git/user-config.cjs +7 -12
  120. package/lib/git/user-config.mjs +2 -2
  121. package/lib/git-diff-cli.cjs +91 -30
  122. package/lib/git-diff-cli.mjs +3 -3
  123. package/lib/git-diff.cjs +91 -30
  124. package/lib/git-diff.js +85 -28
  125. package/lib/git-diff.mjs +3 -3
  126. package/lib/git-fix.cjs +7 -12
  127. package/lib/git-fix.mjs +2 -2
  128. package/lib/git-purge.cjs +7 -12
  129. package/lib/git-purge.mjs +2 -2
  130. package/lib/index.cjs +1 -1
  131. package/lib/index.mjs +1 -1
  132. package/lib/node-cache-cleaner-cli.cjs +185 -2
  133. package/lib/node-cache-cleaner-cli.js +2 -5
  134. package/lib/node-cache-cleaner-cli.mjs +8 -4
  135. package/lib/node-executor.cjs +183 -2
  136. package/lib/node-executor.mjs +5 -2
  137. package/lib/node-package-packer/build-readme.cjs +150 -0
  138. package/lib/node-package-packer/build-readme.d.mts +10 -0
  139. package/lib/node-package-packer/build-readme.mjs +10 -0
  140. package/lib/node-package-packer/build-tarball.cjs +495 -0
  141. package/lib/node-package-packer/build-tarball.d.mts +33 -0
  142. package/lib/node-package-packer/build-tarball.mjs +175 -0
  143. package/lib/node-package-packer-cli.cjs +525 -0
  144. package/lib/node-package-packer-cli.d.mts +1 -0
  145. package/lib/node-package-packer-cli.mjs +34 -0
  146. package/lib/npm-run-series.cjs +7 -12
  147. package/lib/npm-run-series.mjs +2 -2
  148. package/lib/package-resolutions-updater-cli.cjs +73 -76
  149. package/lib/package-resolutions-updater-cli.mjs +4 -3
  150. package/lib/package-resolutions-updater.cjs +71 -74
  151. package/lib/package-resolutions-updater.d.mts +34 -0
  152. package/lib/package-resolutions-updater.mjs +3 -2
  153. package/lib/php-cs-fixer-staged.cjs +1 -1
  154. package/lib/php-cs-fixer-staged.mjs +1 -1
  155. package/lib/print-directory-tree.cjs +16 -18
  156. package/lib/print-directory-tree.mjs +11 -8
  157. package/lib/print-tarball-tree.cjs +262 -0
  158. package/lib/print-tarball-tree.d.mts +1 -0
  159. package/lib/print-tarball-tree.mjs +68 -0
  160. package/lib/ps/index.cjs +10 -10
  161. package/lib/ps/index.mjs +4 -4
  162. package/lib/ps/table-parser.d.ts +3 -4
  163. package/lib/ps/table-parser.js +9 -16
  164. package/lib/remove-module.cjs +17 -22
  165. package/lib/remove-module.mjs +2 -2
  166. package/lib/rm-node-module-cli.cjs +171 -4
  167. package/lib/rm-node-module-cli.mjs +7 -4
  168. package/lib/rmpath-cli.cjs +285 -0
  169. package/lib/rmpath-cli.d.mts +1 -0
  170. package/lib/rmpath-cli.mjs +23 -0
  171. package/lib/rmpath.cjs +6 -217
  172. package/lib/rmpath.mjs +5 -101
  173. package/lib/run-by-checksum/cache.cjs +69 -0
  174. package/lib/run-by-checksum/cache.d.ts +19 -0
  175. package/lib/run-by-checksum/cache.js +50 -0
  176. package/lib/run-by-checksum/cache.mjs +12 -0
  177. package/lib/run-by-checksum/hash.cjs +72 -0
  178. package/lib/run-by-checksum/hash.d.ts +14 -0
  179. package/lib/run-by-checksum/hash.js +85 -0
  180. package/lib/{ps/isWin.mjs → run-by-checksum/hash.mjs} +5 -5
  181. package/lib/run-by-checksum/run.cjs +169 -0
  182. package/lib/run-by-checksum/run.d.ts +22 -0
  183. package/lib/run-by-checksum/run.js +93 -0
  184. package/lib/run-by-checksum/run.mjs +10 -0
  185. package/lib/run-by-checksum-cli.cjs +382 -0
  186. package/lib/run-by-checksum-cli.d.ts +2 -0
  187. package/lib/run-by-checksum-cli.js +43 -0
  188. package/lib/run-by-checksum-cli.mjs +56 -0
  189. package/lib/submodule-install.cjs +8 -13
  190. package/lib/submodule-install.mjs +3 -3
  191. package/lib/submodule-remove-cli.cjs +169 -2
  192. package/lib/submodule-remove-cli.js +2 -2
  193. package/lib/submodule-remove-cli.mjs +5 -2
  194. package/lib/utils/fetchResponse.cjs +24 -0
  195. package/lib/utils/fetchResponse.d.cts +25 -0
  196. package/lib/utils/fetchResponse.mjs +6 -0
  197. package/lib/utils/index.cjs +5 -10
  198. package/lib/utils/index.d.cts +2 -9
  199. package/lib/utils/index.mjs +1 -1
  200. package/lib/utils/isWindows.mjs +3 -1
  201. package/lib/utils/runBash.cjs +1 -1
  202. package/lib/utils/runBash.mjs +1 -1
  203. package/lib/yarn-per-branch-lock-installer.cjs +202 -11
  204. package/lib/yarn-per-branch-lock-installer.mjs +24 -11
  205. package/lib/yarn-reinstall.cjs +6 -11
  206. package/lib/yarn-reinstall.mjs +1 -1
  207. package/package.json +35 -10
  208. package/readme.html +2 -2
  209. package/readme.md +5 -5
  210. package/releases/readme.md +6 -3
  211. package/tmp/test-repo-runChecksum/test-complex-glob/README.md +1 -0
  212. package/tmp/test-repo-runChecksum/test-mixed-args/README.md +1 -0
  213. package/.opencode/package.json +0 -5
  214. package/lib/chunk-6S4NXESK.mjs +0 -26
  215. package/lib/del-ps.js +0 -32
  216. package/lib/del-ps.mjs +0 -43
  217. package/lib/ps/isWin.cjs +0 -26
  218. package/lib/ps/isWin.d.ts +0 -2
  219. package/lib/ps/isWin.js +0 -4
  220. package/test/package.json +0 -20
  221. package/test-project/package.json +0 -22
  222. package/test-project/workspaces/workspace-a/package.json +0 -135
  223. package/test-project/workspaces/workspace-a/test/demo/package.json +0 -25
  224. package/test-project/workspaces/workspace-b/package.json +0 -139
  225. package/test-project/workspaces/workspace-b/test/sample-project/package.json +0 -7
  226. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +0 -96
  227. package/tmp/rm-node-modules-test-project/package.json +0 -17
  228. package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +0 -16
  229. package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +0 -16
  230. package/tmp/test-repo/package.json +0 -17
  231. /package/lib/{del-ps.d.ts → del-ps-cli.d.mts} +0 -0
@@ -5,6 +5,12 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
8
14
  var __copyProps = (to, from, except, desc) => {
9
15
  if (from && typeof from === "object" || typeof from === "function") {
10
16
  for (let key of __getOwnPropNames(from))
@@ -22,10 +28,185 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
22
28
  mod
23
29
  ));
24
30
 
31
+ // node_modules/tsup/assets/cjs_shims.js
32
+ var init_cjs_shims = __esm({
33
+ "node_modules/tsup/assets/cjs_shims.js"() {
34
+ }
35
+ });
36
+
37
+ // src/utils/index.cjs
38
+ var require_utils = __commonJS({
39
+ "src/utils/index.cjs"(exports2, module2) {
40
+ init_cjs_shims();
41
+ var fs2 = require("fs");
42
+ var path2 = require("upath");
43
+ var minimistLib = require("minimist");
44
+ var argv = minimistLib(process.argv.slice(2));
45
+ var { exec } = require("child_process");
46
+ var { promisify } = require("util");
47
+ var execAsync = promisify(exec);
48
+ async function parseGitRemotes() {
49
+ try {
50
+ const { stdout } = await execAsync("git remote -v");
51
+ const lines = stdout.split("\n");
52
+ const remotes = {};
53
+ lines.forEach((line) => {
54
+ const [name, url] = line.split(" ");
55
+ if (name && url) {
56
+ const [repoUrl] = url.split(" ");
57
+ try {
58
+ const parsedUrl = new URL(repoUrl);
59
+ const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
60
+ if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
61
+ let repoPath = pathParts.join("/");
62
+ if (repoPath.endsWith(".git")) {
63
+ repoPath = repoPath.slice(0, -4);
64
+ }
65
+ remotes[name] = repoPath;
66
+ }
67
+ } catch (e) {
68
+ console.error("URL Parsing Error:", e.message);
69
+ }
70
+ }
71
+ });
72
+ return remotes;
73
+ } catch (error) {
74
+ console.error("Error:", error.message);
75
+ return {};
76
+ }
77
+ }
78
+ module2.exports.parseGitRemotes = parseGitRemotes;
79
+ function getArgs2(opts) {
80
+ if (opts) {
81
+ return minimistLib(process.argv.slice(2), opts);
82
+ }
83
+ return argv;
84
+ }
85
+ module2.exports.getArgs = getArgs2;
86
+ function del(fullPath) {
87
+ try {
88
+ if (!fs2.existsSync(fullPath)) return;
89
+ const stat = fs2.lstatSync(fullPath);
90
+ if (stat.isSymbolicLink()) {
91
+ try {
92
+ fs2.unlinkSync(fullPath);
93
+ console.log("deleted symlink", fullPath);
94
+ } catch (e) {
95
+ console.log("failed delete symlink", fullPath, e && e.message);
96
+ }
97
+ return;
98
+ }
99
+ if (stat.isDirectory()) {
100
+ const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
101
+ for (let i = 0; i < subdir.length; i++) {
102
+ del(subdir[i]);
103
+ }
104
+ try {
105
+ fs2.rmdirSync(fullPath);
106
+ console.log("deleted", fullPath);
107
+ } catch (_e) {
108
+ try {
109
+ fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
110
+ console.log("deleted", fullPath);
111
+ } catch (ee) {
112
+ console.log("failed delete", fullPath, ee && ee.message);
113
+ }
114
+ }
115
+ return;
116
+ }
117
+ try {
118
+ fs2.unlinkSync(fullPath);
119
+ console.log("deleted", fullPath);
120
+ } catch (_e) {
121
+ try {
122
+ fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
123
+ console.log("deleted", fullPath);
124
+ } catch (ee) {
125
+ console.log("failed delete", fullPath, ee && ee.message);
126
+ }
127
+ }
128
+ } catch (err) {
129
+ console.log("failed delete", fullPath, err && err.message);
130
+ }
131
+ }
132
+ module2.exports.del = del;
133
+ function delStream(globStream) {
134
+ globStream.stream().on("data", (result) => {
135
+ const fullPath = path2.resolve(process.cwd(), result);
136
+ try {
137
+ if (fs2.existsSync(fullPath)) {
138
+ const stat = fs2.lstatSync(fullPath);
139
+ if (stat.isSymbolicLink()) {
140
+ try {
141
+ fs2.unlinkSync(fullPath);
142
+ console.log("deleted symlink", fullPath);
143
+ } catch (e) {
144
+ console.log("failed delete symlink", fullPath, e && e.message);
145
+ }
146
+ return;
147
+ }
148
+ if (stat.isDirectory()) {
149
+ const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
150
+ for (let i = 0; i < subdir.length; i++) {
151
+ del(subdir[i]);
152
+ }
153
+ }
154
+ }
155
+ del(fullPath);
156
+ } catch (err) {
157
+ console.log("failed processing", fullPath, err && err.message);
158
+ }
159
+ });
160
+ }
161
+ module2.exports.delStream = delStream;
162
+ function getFileTreeString(hashArray) {
163
+ const tree = {};
164
+ const hashMap = {};
165
+ for (const entry of hashArray) {
166
+ const [filePath, hash] = entry.split(" ");
167
+ hashMap[filePath] = hash;
168
+ const parts = filePath.split("/");
169
+ let current = tree;
170
+ for (let i = 0; i < parts.length; i++) {
171
+ const part = parts[i];
172
+ if (i === parts.length - 1) {
173
+ current[part] = null;
174
+ } else {
175
+ current[part] = current[part] || {};
176
+ current = current[part];
177
+ }
178
+ }
179
+ }
180
+ function printNode(node, prefix = "", parentPath = "") {
181
+ const keys = Object.keys(node).sort();
182
+ let lines = [];
183
+ keys.forEach((key, idx) => {
184
+ const isLast = idx === keys.length - 1;
185
+ const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
186
+ const currentPath = parentPath ? parentPath + "/" + key : key;
187
+ if (node[key] === null) {
188
+ lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
189
+ } else {
190
+ lines.push(prefix + branch + key + "/");
191
+ lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
192
+ }
193
+ });
194
+ return lines;
195
+ }
196
+ return printNode(tree, "", "").join("\n");
197
+ }
198
+ module2.exports.getFileTreeString = getFileTreeString;
199
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
200
+ module2.exports.delay = delay;
201
+ }
202
+ });
203
+
25
204
  // src/file/move-cli.mjs
26
- var import_minimist = __toESM(require("minimist"), 1);
205
+ init_cjs_shims();
206
+ var import_utils = __toESM(require_utils(), 1);
27
207
 
28
208
  // src/file/move.mjs
209
+ init_cjs_shims();
29
210
  var import_fs_extra = __toESM(require("fs-extra"), 1);
30
211
  var import_upath = __toESM(require("upath"), 1);
31
212
  async function move(src, dest) {
@@ -62,7 +243,7 @@ Examples:
62
243
  process.exit(exitCode);
63
244
  }
64
245
  async function main() {
65
- const args = (0, import_minimist.default)(process.argv.slice(2), {
246
+ const args = (0, import_utils.getArgs)({
66
247
  boolean: ["help", "h"],
67
248
  alias: {
68
249
  h: "help"
@@ -3,12 +3,16 @@ import {
3
3
  move
4
4
  } from "../chunk-NGFK3EYW.mjs";
5
5
  import {
6
+ require_utils
7
+ } from "../chunk-6RK5UCTP.mjs";
8
+ import {
9
+ __toESM,
6
10
  init_esm_shims
7
11
  } from "../chunk-QQ4A6DLD.mjs";
8
12
 
9
13
  // src/file/move-cli.mjs
10
14
  init_esm_shims();
11
- import minimist from "minimist";
15
+ var import_utils = __toESM(require_utils(), 1);
12
16
  function showHelp(exitCode = 0) {
13
17
  console.log(
14
18
  `
@@ -26,7 +30,7 @@ Examples:
26
30
  process.exit(exitCode);
27
31
  }
28
32
  async function main() {
29
- const args = minimist(process.argv.slice(2), {
33
+ const args = (0, import_utils.getArgs)({
30
34
  boolean: ["help", "h"],
31
35
  alias: {
32
36
  h: "help"
@@ -18,7 +18,7 @@ var require_find_node_modules = __commonJS({
18
18
  "src/find-node-modules.cjs"(exports2, module2) {
19
19
  init_cjs_shims();
20
20
  var glob = require("glob");
21
- var path = require("path");
21
+ var path = require("upath");
22
22
  function findNodeModules2(dir = process.cwd(), callback = null) {
23
23
  const finalDir = typeof dir === "string" ? dir : process.cwd();
24
24
  return new Promise((resolve, reject) => {
@@ -2,7 +2,7 @@
2
2
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
3
3
  import {
4
4
  require_find_node_modules
5
- } from "./chunk-M3YIYRHT.mjs";
5
+ } from "./chunk-UY5VUEA3.mjs";
6
6
  import {
7
7
  init_esm_shims
8
8
  } from "./chunk-QQ4A6DLD.mjs";
@@ -1,6 +1,6 @@
1
1
  // src/find-node-modules.cjs
2
2
  var glob = require("glob");
3
- var path = require("path");
3
+ var path = require("upath");
4
4
  function findNodeModules(dir = process.cwd(), callback = null) {
5
5
  const finalDir = typeof dir === "string" ? dir : process.cwd();
6
6
  return new Promise((resolve, reject) => {
@@ -1,6 +1,6 @@
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 "./chunk-QQ4A6DLD.mjs";
6
6
  export default require_find_node_modules();
@@ -40,9 +40,9 @@ var require_utils = __commonJS({
40
40
  init_cjs_shims();
41
41
  var fs2 = require("fs");
42
42
  var path2 = require("upath");
43
- var argv2 = require("minimist")(process.argv.slice(2));
43
+ var minimistLib = require("minimist");
44
+ var argv2 = minimistLib(process.argv.slice(2));
44
45
  var { exec } = require("child_process");
45
- var { URL: URL2 } = require("url");
46
46
  var { promisify } = require("util");
47
47
  var execAsync = promisify(exec);
48
48
  async function parseGitRemotes() {
@@ -55,7 +55,7 @@ var require_utils = __commonJS({
55
55
  if (name && url) {
56
56
  const [repoUrl] = url.split(" ");
57
57
  try {
58
- const parsedUrl = new URL2(repoUrl);
58
+ const parsedUrl = new URL(repoUrl);
59
59
  const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
60
60
  if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
61
61
  let repoPath = pathParts.join("/");
@@ -76,15 +76,10 @@ var require_utils = __commonJS({
76
76
  }
77
77
  }
78
78
  module2.exports.parseGitRemotes = parseGitRemotes;
79
- function joinPathPreserveDriveLetter(...segments) {
80
- let fullPath = require("path").join(...segments);
81
- if (/^[a-z]:\\/.test(fullPath)) {
82
- fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
79
+ function getArgs2(opts) {
80
+ if (opts) {
81
+ return minimistLib(process.argv.slice(2), opts);
83
82
  }
84
- return fullPath;
85
- }
86
- module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
87
- function getArgs2() {
88
83
  return argv2;
89
84
  }
90
85
  module2.exports.getArgs = getArgs2;
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-GAGABICI.mjs";
5
5
  import {
6
6
  require_utils
7
- } from "./chunk-5RTXZVCW.mjs";
7
+ } from "./chunk-6RK5UCTP.mjs";
8
8
  import {
9
9
  __toESM,
10
10
  init_esm_shims
@@ -74,9 +74,9 @@ var require_utils2 = __commonJS({
74
74
  init_cjs_shims();
75
75
  var fs = require("fs");
76
76
  var path = require("upath");
77
- var argv = require("minimist")(process.argv.slice(2));
77
+ var minimistLib = require("minimist");
78
+ var argv = minimistLib(process.argv.slice(2));
78
79
  var { exec } = require("child_process");
79
- var { URL: URL2 } = require("url");
80
80
  var { promisify } = require("util");
81
81
  var execAsync = promisify(exec);
82
82
  async function parseGitRemotes() {
@@ -89,7 +89,7 @@ var require_utils2 = __commonJS({
89
89
  if (name && url) {
90
90
  const [repoUrl] = url.split(" ");
91
91
  try {
92
- const parsedUrl = new URL2(repoUrl);
92
+ const parsedUrl = new URL(repoUrl);
93
93
  const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
94
94
  if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
95
95
  let repoPath = pathParts.join("/");
@@ -110,15 +110,10 @@ var require_utils2 = __commonJS({
110
110
  }
111
111
  }
112
112
  module2.exports.parseGitRemotes = parseGitRemotes;
113
- function joinPathPreserveDriveLetter(...segments) {
114
- let fullPath = require("path").join(...segments);
115
- if (/^[a-z]:\\/.test(fullPath)) {
116
- fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
113
+ function getArgs2(opts) {
114
+ if (opts) {
115
+ return minimistLib(process.argv.slice(2), opts);
117
116
  }
118
- return fullPath;
119
- }
120
- module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
121
- function getArgs2() {
122
117
  return argv;
123
118
  }
124
119
  module2.exports.getArgs = getArgs2;
@@ -245,7 +240,7 @@ init_cjs_shims();
245
240
  var gch = require("git-command-helper");
246
241
  var { runGitCommand, runGitCommandOutput } = require_utils();
247
242
  var { getArgs } = require_utils2();
248
- require("dotenv").config({ path: require("path").join(process.cwd(), ".env"), quiet: true });
243
+ require("dotenv").config({ path: require("upath").join(process.cwd(), ".env"), quiet: true });
249
244
  function configureGitUser(cliUser = null, cliEmail = null, options = {}) {
250
245
  console.log("\n=== Configuring Git User ===");
251
246
  let username, email;
@@ -1,8 +1,8 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_user_config
4
- } from "../chunk-2LSRSEXF.mjs";
4
+ } from "../chunk-MGPYPKIE.mjs";
5
5
  import "../chunk-A3VUZEJK.mjs";
6
- import "../chunk-5RTXZVCW.mjs";
6
+ import "../chunk-6RK5UCTP.mjs";
7
7
  import "../chunk-QQ4A6DLD.mjs";
8
8
  export default require_user_config();
@@ -136,7 +136,7 @@ var require_findEnvFiles = __commonJS({
136
136
  var require_config = __commonJS({
137
137
  "src/binary-collections/config.cjs"(exports2, module2) {
138
138
  init_cjs_shims();
139
- var path3 = require("path");
139
+ var path3 = require("upath");
140
140
  var { findEnvWithToken } = require_findEnvFiles();
141
141
  require("dotenv").config({ path: findEnvWithToken(), quiet: true, overwrite: true });
142
142
  function getTempDir() {
@@ -160,9 +160,9 @@ var require_utils = __commonJS({
160
160
  init_cjs_shims();
161
161
  var fs3 = require("fs");
162
162
  var path3 = require("upath");
163
- var argv = require("minimist")(process.argv.slice(2));
163
+ var minimistLib = require("minimist");
164
+ var argv = minimistLib(process.argv.slice(2));
164
165
  var { exec } = require("child_process");
165
- var { URL: URL2 } = require("url");
166
166
  var { promisify } = require("util");
167
167
  var execAsync = promisify(exec);
168
168
  async function parseGitRemotes() {
@@ -175,7 +175,7 @@ var require_utils = __commonJS({
175
175
  if (name && url) {
176
176
  const [repoUrl] = url.split(" ");
177
177
  try {
178
- const parsedUrl = new URL2(repoUrl);
178
+ const parsedUrl = new URL(repoUrl);
179
179
  const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
180
180
  if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
181
181
  let repoPath = pathParts.join("/");
@@ -196,15 +196,10 @@ var require_utils = __commonJS({
196
196
  }
197
197
  }
198
198
  module2.exports.parseGitRemotes = parseGitRemotes;
199
- function joinPathPreserveDriveLetter(...segments) {
200
- let fullPath = require("path").join(...segments);
201
- if (/^[a-z]:\\/.test(fullPath)) {
202
- fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
199
+ function getArgs2(opts) {
200
+ if (opts) {
201
+ return minimistLib(process.argv.slice(2), opts);
203
202
  }
204
- return fullPath;
205
- }
206
- module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
207
- function getArgs2() {
208
203
  return argv;
209
204
  }
210
205
  module2.exports.getArgs = getArgs2;
@@ -865,16 +860,16 @@ var DIFF_OUTPUT_RELATIVE = import_upath2.default.relative(process.cwd(), DIFF_OU
865
860
  var GPT_DIFF_OUTPUT_RELATIVE = import_upath2.default.relative(process.cwd(), GPT_DIFF_OUTPUT);
866
861
  import_fs_extra2.default.ensureDirSync(CACHE_DIR, { mode: 493 });
867
862
  function showHelp() {
868
- console.log("\u{1F4DD} Git Diff Helper");
869
- console.log("\u{1F4C4} Usage:");
870
- console.log(" \u{1F4C2} git-diff FILE Show staged diff of specified file");
871
- console.log(" \u{1F4C2} git-diff --staged-only Show staged diff of all files");
872
- console.log(" \u{1F4C2} git-diff -s | -S Same as --staged-only");
873
- console.log(" \u{1F4C2} git-diff --unstaged FILE Show unstaged diff of specified file");
874
- console.log(" \u{1F4C2} git-diff --unstaged Show unstaged diff of all files");
875
- console.log(" \u{1F4C2} git-diff -u Same as --unstaged");
876
- console.log(" \u{1F4C2} git-diff --ai Run ChatGPT automation for commit message");
877
- console.log(" \u{1F4C2} git-diff --help | -h Show this help message");
863
+ console.log("\u{1F4CB} Git Diff Helper");
864
+ console.log("Usage:");
865
+ console.log(" git-diff FILE Show staged diff of specified file");
866
+ console.log(" git-diff --staged-only Show staged diff of all files");
867
+ console.log(" git-diff -s | -S Same as --staged-only");
868
+ console.log(" git-diff --unstaged FILE Show unstaged diff of specified file");
869
+ console.log(" git-diff --unstaged Show unstaged diff of all files");
870
+ console.log(" git-diff -u Same as --unstaged");
871
+ console.log(" git-diff --ai Run ChatGPT automation for commit message");
872
+ console.log(" git-diff --help | -h Show this help message");
878
873
  console.log("");
879
874
  console.log(`\u{1F4BE} Output is saved to: ${DIFF_OUTPUT_RELATIVE}`);
880
875
  console.log(`\u{1F916} GPT prompt is saved to: ${GPT_DIFF_OUTPUT_RELATIVE}`);
@@ -882,14 +877,14 @@ function showHelp() {
882
877
  }
883
878
  function runGitDiff(command, successMessage, errorMessage) {
884
879
  try {
885
- console.log(`\u{1F50D} [i] Running command: ${command}`);
880
+ console.log(`\u2139\uFE0F Running command: ${command}`);
886
881
  const result = (0, import_child_process.execSync)(command, {
887
882
  encoding: "utf8",
888
883
  maxBuffer: 1024 * 1024 * 10
889
884
  // 10MB buffer to handle large diffs
890
885
  });
891
886
  if (!result || result.trim() === "") {
892
- console.log(`\u2139\uFE0F [i] No changes found for the specified criteria`);
887
+ console.log(`\u2139\uFE0F No changes found for the specified criteria`);
893
888
  (0, import_sbg_utility.writefile)(DIFF_OUTPUT, "# No changes found\n");
894
889
  console.log(`\u2705 Empty diff saved to "${DIFF_OUTPUT_RELATIVE}"`);
895
890
  return false;
@@ -897,7 +892,7 @@ function runGitDiff(command, successMessage, errorMessage) {
897
892
  (0, import_sbg_utility.writefile)(DIFF_OUTPUT, result);
898
893
  (0, import_sbg_utility.writefile)(
899
894
  GPT_DIFF_OUTPUT,
900
- `Hello, ChatGPT!
895
+ `Hello!
901
896
  Can you create a conventional commit message by diff content below:
902
897
 
903
898
  \`\`\`${result}
@@ -912,14 +907,56 @@ Thank you!`
912
907
  return true;
913
908
  } catch (error) {
914
909
  console.error(`\u274C ${errorMessage}`);
915
- console.error(`\u{1F4DD} Command: ${command}`);
916
- console.error(`\u26A0\uFE0F Error: ${error.message}`);
910
+ console.error(`\u274C Command: ${command}`);
911
+ console.error(`\u274C Error: ${error.message}`);
917
912
  if (error.message.includes("not a git repository")) {
918
- console.error("\u{1F6A7} Make sure you are in a git repository");
913
+ console.error("\u274C Make sure you are in a git repository");
919
914
  }
920
915
  process.exit(1);
921
916
  }
922
917
  }
918
+ function getUntrackedDiff() {
919
+ try {
920
+ const untrackedStr = (0, import_child_process.execSync)("git ls-files --others --exclude-standard", {
921
+ encoding: "utf8",
922
+ maxBuffer: 1024 * 1024 * 10
923
+ }).trim();
924
+ if (!untrackedStr) return "";
925
+ const untrackedFiles = untrackedStr.split("\n").filter(function(f) {
926
+ return f;
927
+ });
928
+ if (untrackedFiles.length === 0) return "";
929
+ var result = "\n# Untracked files:\n";
930
+ for (var i = 0; i < untrackedFiles.length; i++) {
931
+ var file = untrackedFiles[i];
932
+ if (!import_fs_extra2.default.existsSync(file)) continue;
933
+ var stat = import_fs_extra2.default.statSync(file);
934
+ if (!stat.isFile()) continue;
935
+ var content;
936
+ try {
937
+ content = import_fs_extra2.default.readFileSync(file, "utf8");
938
+ } catch (_a) {
939
+ continue;
940
+ }
941
+ var lines = content.split("\n");
942
+ if (lines.length > 0 && lines[lines.length - 1] === "") {
943
+ lines.pop();
944
+ }
945
+ result += "diff --git a/" + file + " b/" + file + "\n";
946
+ result += "new file mode 100644\n";
947
+ result += "index 0000000..0000000\n";
948
+ result += "--- /dev/null\n";
949
+ result += "+++ b/" + file + "\n";
950
+ result += "@@ -0,0 +1," + (lines.length || 0) + " @@\n";
951
+ for (var j = 0; j < lines.length; j++) {
952
+ result += "+" + lines[j] + "\n";
953
+ }
954
+ }
955
+ return result;
956
+ } catch (_b) {
957
+ return "";
958
+ }
959
+ }
923
960
  function fileHasChanges(file, mode) {
924
961
  const command = mode === "staged" ? `git diff --cached --quiet -- "${file}"` : `git diff --quiet -- "${file}"`;
925
962
  try {
@@ -954,6 +991,30 @@ async function mainGitDiff() {
954
991
  `Full ${fullDiffModeLabel} diff saved to "${import_ansi_colors.default.green(DIFF_OUTPUT_RELATIVE)}"`,
955
992
  "Failed to save all diff's"
956
993
  );
994
+ const untrackedDiff = getUntrackedDiff();
995
+ if (untrackedDiff) {
996
+ const UNTRACKED_DIFF_OUTPUT = (0, import_config.getTempPath)(`git-diff/untracked-${FILENAME}.txt`);
997
+ const UNTRACKED_GPT_DIFF_OUTPUT = (0, import_config.getTempPath)(`git-diff/gpt-untracked-${FILENAME}.txt`);
998
+ const UNTRACKED_DIFF_OUTPUT_RELATIVE = import_upath2.default.relative(process.cwd(), UNTRACKED_DIFF_OUTPUT);
999
+ (0, import_sbg_utility.writefile)(UNTRACKED_DIFF_OUTPUT, untrackedDiff);
1000
+ (0, import_sbg_utility.writefile)(
1001
+ UNTRACKED_GPT_DIFF_OUTPUT,
1002
+ `Hello!
1003
+ Can you create a conventional commit message by diff content below:
1004
+
1005
+ \`\`\`${untrackedDiff}
1006
+ \`\`\`
1007
+
1008
+ Give me result as codeblock with language "text" only.
1009
+
1010
+ Thank you!`
1011
+ );
1012
+ console.log(`\u2705 Untracked file diff saved to "${import_ansi_colors.default.green(UNTRACKED_DIFF_OUTPUT_RELATIVE)}"`);
1013
+ console.log(
1014
+ `\u{1F4BE} AI diff prompt saved to "${import_ansi_colors.default.green(import_upath2.default.relative(process.cwd(), UNTRACKED_GPT_DIFF_OUTPUT))}"`
1015
+ );
1016
+ hasDiff = true;
1017
+ }
957
1018
  } else {
958
1019
  let fileDiffMode = useUnstaged ? "unstaged" : "staged";
959
1020
  if (!useUnstaged && !fileHasChanges(file, "staged") && fileHasChanges(file, "unstaged")) {
@@ -983,7 +1044,7 @@ async function mainGitDiff() {
983
1044
  ];
984
1045
  const opencodePromptPath = (0, import_config.getTempPath)(`git-diff/opencode-${FILENAME}.txt`);
985
1046
  (0, import_sbg_utility.writefile)(opencodePromptPath, opencodePrompt.join("\n"));
986
- console.log(`\u{1F4A1} OpenCode prompt saved to "${import_ansi_colors.default.green(import_upath2.default.relative(process.cwd(), opencodePromptPath))}"`);
1047
+ console.log(`\u2705 OpenCode prompt saved to "${import_ansi_colors.default.green(import_upath2.default.relative(process.cwd(), opencodePromptPath))}"`);
987
1048
  }
988
1049
  if (args.ai) {
989
1050
  try {
@@ -993,7 +1054,7 @@ async function mainGitDiff() {
993
1054
  console.error("\u{1F4A1} Try running with visible browser mode or check if Chrome is installed");
994
1055
  }
995
1056
  } else {
996
- console.log("\u{1F4A1} Tip: Use --ai flag to generate commit message with ChatGPT");
1057
+ console.log("\u{1F4A1} Use --ai flag to generate commit message with ChatGPT");
997
1058
  }
998
1059
  }
999
1060
 
@@ -2,11 +2,11 @@
2
2
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
3
3
  import {
4
4
  mainGitDiff
5
- } from "./chunk-SPTECFE5.mjs";
6
- import "./chunk-G5UUEWUO.mjs";
5
+ } from "./chunk-2MN4VPV2.mjs";
6
+ import "./chunk-X2B3X7D4.mjs";
7
7
  import "./chunk-GAGABICI.mjs";
8
8
  import "./chunk-H44UWUFY.mjs";
9
- import "./chunk-5RTXZVCW.mjs";
9
+ import "./chunk-6RK5UCTP.mjs";
10
10
  import {
11
11
  init_esm_shims
12
12
  } from "./chunk-QQ4A6DLD.mjs";