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.
- package/binaries/binary-executor.cjs +89 -13
- package/binaries/clean-nodemodule.cjs +89 -13
- package/binaries/clean-nodemodules.cjs +89 -13
- package/binaries/dev.cjs +89 -13
- package/binaries/empty.cjs +89 -13
- package/binaries/git-reduce-size.cjs +89 -13
- package/binaries/javakill.cjs +89 -13
- package/binaries/kill-process.cjs +89 -13
- package/binaries/nodekill.cjs +89 -13
- package/binaries/prod.cjs +89 -13
- package/binaries/py.cjs +89 -13
- package/binaries/rmfind.cjs +89 -13
- package/binaries/rmx.cjs +89 -13
- package/binaries/submodule-token.cjs +89 -13
- package/binaries/test-cjs.cjs +89 -13
- package/binaries/test-esm.cjs +89 -13
- package/binaries/yarn-clean.cjs +89 -13
- package/binaries/yc +22 -1
- package/binaries/yc.cjs +89 -13
- package/binaries/ycw +256 -0
- package/binaries/ycw.cjs +254 -0
- package/docs-src/binary-collections.md +34 -0
- package/docs-src/changelog.md +26 -0
- package/docs-src/clean-github-actions-caches.md +115 -0
- package/docs-src/copy-move-file.md +59 -0
- package/docs-src/del-gradle.md +17 -0
- package/docs-src/del-ps.md +28 -0
- package/docs-src/downloader.md +62 -0
- package/docs-src/env-helpers.md +29 -0
- package/docs-src/find-node-modules.md +17 -0
- package/docs-src/free-chatgpt.md +26 -0
- package/docs-src/git-diff.md +33 -0
- package/docs-src/git-fix.md +34 -0
- package/docs-src/git-purge.md +17 -0
- package/docs-src/git-reduce-size.md +17 -0
- package/docs-src/git-undo.md +21 -0
- package/docs-src/kill-night-crows.md +26 -0
- package/docs-src/node-cache-cleaner.md +182 -0
- package/docs-src/node-executor.md +50 -0
- package/docs-src/node-package-packer.md +48 -0
- package/docs-src/npm-run-series.md +43 -0
- package/docs-src/package-resolutions-updater.md +22 -0
- package/docs-src/php-cs-fixer-staged.md +19 -0
- package/docs-src/print-directory-tree.md +35 -0
- package/docs-src/print-tarball-tree.md +55 -0
- package/docs-src/py.md +19 -0
- package/docs-src/remove-module.md +32 -0
- package/docs-src/rmfind-rmx.md +21 -0
- package/docs-src/rmpath.md +38 -0
- package/docs-src/run-by-checksum.md +87 -0
- package/docs-src/submodule-install.md +31 -0
- package/docs-src/submodule-remove.md +22 -0
- package/docs-src/submodule-token.md +17 -0
- package/docs-src/test-runners.md +21 -0
- package/docs-src/yarn-install.md +31 -0
- package/docs-src/yarn-reinstall.md +27 -0
- package/lib/binary-collections/config.cjs +1 -1
- package/lib/binary-collections/config.mjs +1 -1
- package/lib/binary-collections/findScript.cjs +35 -10
- package/lib/binary-collections/findScript.mjs +2 -2
- package/lib/binary-collections/listScript.cjs +35 -10
- package/lib/binary-collections/listScript.mjs +2 -2
- package/lib/binary-collections.cjs +45 -25
- package/lib/binary-collections.mjs +11 -11
- package/lib/changelog.cjs +7 -12
- package/lib/changelog.mjs +2 -2
- package/lib/{chunk-SPTECFE5.mjs → chunk-2MN4VPV2.mjs} +86 -20
- package/lib/{chunk-V2IBPCEV.mjs → chunk-6C7KTYGZ.mjs} +3 -1
- package/lib/{chunk-5RTXZVCW.mjs → chunk-6RK5UCTP.mjs} +5 -10
- package/lib/{chunk-FB2WKVJD.mjs → chunk-CD3HF3LK.mjs} +67 -35
- package/lib/{chunk-6PU7BAHB.mjs → chunk-FLYSZFLW.mjs} +1 -1
- package/lib/chunk-KLKAIFKI.mjs +40 -0
- package/lib/chunk-LVSPEFU2.mjs +86 -0
- package/lib/{chunk-2LSRSEXF.mjs → chunk-MGPYPKIE.mjs} +2 -2
- package/lib/{chunk-ZOWVMII3.mjs → chunk-NQXUYO67.mjs} +35 -10
- package/lib/{chunk-C6D2TTYU.mjs → chunk-OBXLTXFJ.mjs} +4 -2
- package/lib/chunk-QD4T255Z.mjs +40 -0
- package/lib/{chunk-XPJGCDOD.mjs → chunk-QII2EKCS.mjs} +14 -2
- package/lib/chunk-RDGDLSPD.mjs +76 -0
- package/lib/{chunk-NCZPTKDV.mjs → chunk-RDN6HF5Z.mjs} +1 -1
- package/lib/chunk-RJKTSUAX.mjs +123 -0
- package/lib/{chunk-66KDU4TX.mjs → chunk-TBWXE7ST.mjs} +36 -61
- package/lib/{chunk-M3YIYRHT.mjs → chunk-UY5VUEA3.mjs} +1 -1
- package/lib/chunk-WSHVPGNM.mjs +44 -0
- package/lib/{chunk-G5UUEWUO.mjs → chunk-X2B3X7D4.mjs} +1 -1
- package/lib/clean-github-actions-caches-cli.cjs +255 -213
- package/lib/clean-github-actions-caches-cli.mjs +25 -7
- package/lib/clean-github-actions-caches.cjs +231 -35
- package/lib/clean-github-actions-caches.d.cts +39 -1
- package/lib/clean-github-actions-caches.mjs +2 -1
- package/lib/cross-env/command.cjs +2 -2
- package/lib/cross-env/command.js +2 -2
- package/lib/cross-env/command.mjs +2 -2
- package/lib/cross-env/index.cjs +2 -2
- package/lib/cross-env/index.mjs +3 -3
- package/lib/cross-env/variable.mjs +2 -2
- package/lib/del-gradle.cjs +6 -11
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.cjs +185 -3
- package/lib/del-node-modules.js +3 -3
- package/lib/del-node-modules.mjs +6 -3
- package/lib/{del-ps.cjs → del-ps-cli.cjs} +36 -41
- package/lib/del-ps-cli.mjs +44 -0
- package/lib/del-yarn-caches.cjs +6 -11
- package/lib/del-yarn-caches.mjs +1 -1
- package/lib/downloader-cli.cjs +256 -0
- package/lib/downloader-cli.d.cts +2 -0
- package/lib/downloader-cli.mjs +90 -0
- package/lib/file/copy-cli.cjs +183 -2
- package/lib/file/copy-cli.mjs +6 -2
- package/lib/file/move-cli.cjs +183 -2
- package/lib/file/move-cli.mjs +6 -2
- package/lib/find-node-modules-cli.cjs +1 -1
- package/lib/find-node-modules-cli.mjs +1 -1
- package/lib/find-node-modules.cjs +1 -1
- package/lib/find-node-modules.mjs +1 -1
- package/lib/free-chatgpt.cjs +6 -11
- package/lib/free-chatgpt.mjs +1 -1
- package/lib/git/user-config.cjs +7 -12
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +91 -30
- package/lib/git-diff-cli.mjs +3 -3
- package/lib/git-diff.cjs +91 -30
- package/lib/git-diff.js +85 -28
- package/lib/git-diff.mjs +3 -3
- package/lib/git-fix.cjs +7 -12
- package/lib/git-fix.mjs +2 -2
- package/lib/git-purge.cjs +7 -12
- package/lib/git-purge.mjs +2 -2
- package/lib/index.cjs +1 -1
- package/lib/index.mjs +1 -1
- package/lib/node-cache-cleaner-cli.cjs +185 -2
- package/lib/node-cache-cleaner-cli.js +2 -5
- package/lib/node-cache-cleaner-cli.mjs +8 -4
- package/lib/node-executor.cjs +183 -2
- package/lib/node-executor.mjs +5 -2
- package/lib/node-package-packer/build-readme.cjs +150 -0
- package/lib/node-package-packer/build-readme.d.mts +10 -0
- package/lib/node-package-packer/build-readme.mjs +10 -0
- package/lib/node-package-packer/build-tarball.cjs +495 -0
- package/lib/node-package-packer/build-tarball.d.mts +33 -0
- package/lib/node-package-packer/build-tarball.mjs +175 -0
- package/lib/node-package-packer-cli.cjs +525 -0
- package/lib/node-package-packer-cli.d.mts +1 -0
- package/lib/node-package-packer-cli.mjs +34 -0
- package/lib/npm-run-series.cjs +7 -12
- package/lib/npm-run-series.mjs +2 -2
- package/lib/package-resolutions-updater-cli.cjs +73 -76
- package/lib/package-resolutions-updater-cli.mjs +4 -3
- package/lib/package-resolutions-updater.cjs +71 -74
- package/lib/package-resolutions-updater.d.mts +34 -0
- package/lib/package-resolutions-updater.mjs +3 -2
- package/lib/php-cs-fixer-staged.cjs +1 -1
- package/lib/php-cs-fixer-staged.mjs +1 -1
- package/lib/print-directory-tree.cjs +16 -18
- package/lib/print-directory-tree.mjs +11 -8
- package/lib/print-tarball-tree.cjs +262 -0
- package/lib/print-tarball-tree.d.mts +1 -0
- package/lib/print-tarball-tree.mjs +68 -0
- package/lib/ps/index.cjs +10 -10
- package/lib/ps/index.mjs +4 -4
- package/lib/ps/table-parser.d.ts +3 -4
- package/lib/ps/table-parser.js +9 -16
- package/lib/remove-module.cjs +17 -22
- package/lib/remove-module.mjs +2 -2
- package/lib/rm-node-module-cli.cjs +171 -4
- package/lib/rm-node-module-cli.mjs +7 -4
- package/lib/rmpath-cli.cjs +285 -0
- package/lib/rmpath-cli.d.mts +1 -0
- package/lib/rmpath-cli.mjs +23 -0
- package/lib/rmpath.cjs +6 -217
- package/lib/rmpath.mjs +5 -101
- package/lib/run-by-checksum/cache.cjs +69 -0
- package/lib/run-by-checksum/cache.d.ts +19 -0
- package/lib/run-by-checksum/cache.js +50 -0
- package/lib/run-by-checksum/cache.mjs +12 -0
- package/lib/run-by-checksum/hash.cjs +72 -0
- package/lib/run-by-checksum/hash.d.ts +14 -0
- package/lib/run-by-checksum/hash.js +85 -0
- package/lib/{ps/isWin.mjs → run-by-checksum/hash.mjs} +5 -5
- package/lib/run-by-checksum/run.cjs +169 -0
- package/lib/run-by-checksum/run.d.ts +22 -0
- package/lib/run-by-checksum/run.js +93 -0
- package/lib/run-by-checksum/run.mjs +10 -0
- package/lib/run-by-checksum-cli.cjs +382 -0
- package/lib/run-by-checksum-cli.d.ts +2 -0
- package/lib/run-by-checksum-cli.js +43 -0
- package/lib/run-by-checksum-cli.mjs +56 -0
- package/lib/submodule-install.cjs +8 -13
- package/lib/submodule-install.mjs +3 -3
- package/lib/submodule-remove-cli.cjs +169 -2
- package/lib/submodule-remove-cli.js +2 -2
- package/lib/submodule-remove-cli.mjs +5 -2
- package/lib/utils/fetchResponse.cjs +24 -0
- package/lib/utils/fetchResponse.d.cts +25 -0
- package/lib/utils/fetchResponse.mjs +6 -0
- package/lib/utils/index.cjs +5 -10
- package/lib/utils/index.d.cts +2 -9
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isWindows.mjs +3 -1
- package/lib/utils/runBash.cjs +1 -1
- package/lib/utils/runBash.mjs +1 -1
- package/lib/yarn-per-branch-lock-installer.cjs +202 -11
- package/lib/yarn-per-branch-lock-installer.mjs +24 -11
- package/lib/yarn-reinstall.cjs +6 -11
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +35 -10
- package/readme.html +2 -2
- package/readme.md +5 -5
- package/releases/readme.md +6 -3
- package/tmp/test-repo-runChecksum/test-complex-glob/README.md +1 -0
- package/tmp/test-repo-runChecksum/test-mixed-args/README.md +1 -0
- package/.opencode/package.json +0 -5
- package/lib/chunk-6S4NXESK.mjs +0 -26
- package/lib/del-ps.js +0 -32
- package/lib/del-ps.mjs +0 -43
- package/lib/ps/isWin.cjs +0 -26
- package/lib/ps/isWin.d.ts +0 -2
- package/lib/ps/isWin.js +0 -4
- package/test/package.json +0 -20
- package/test-project/package.json +0 -22
- package/test-project/workspaces/workspace-a/package.json +0 -135
- package/test-project/workspaces/workspace-a/test/demo/package.json +0 -25
- package/test-project/workspaces/workspace-b/package.json +0 -139
- package/test-project/workspaces/workspace-b/test/sample-project/package.json +0 -7
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +0 -96
- package/tmp/rm-node-modules-test-project/package.json +0 -17
- package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +0 -16
- package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +0 -16
- package/tmp/test-repo/package.json +0 -17
- /package/lib/{del-ps.d.ts → del-ps-cli.d.mts} +0 -0
package/lib/file/move-cli.cjs
CHANGED
|
@@ -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
|
-
|
|
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,
|
|
246
|
+
const args = (0, import_utils.getArgs)({
|
|
66
247
|
boolean: ["help", "h"],
|
|
67
248
|
alias: {
|
|
68
249
|
h: "help"
|
package/lib/file/move-cli.mjs
CHANGED
|
@@ -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
|
-
|
|
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 =
|
|
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("
|
|
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) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/find-node-modules.cjs
|
|
2
2
|
var glob = require("glob");
|
|
3
|
-
var path = require("
|
|
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-
|
|
4
|
+
} from "./chunk-UY5VUEA3.mjs";
|
|
5
5
|
import "./chunk-QQ4A6DLD.mjs";
|
|
6
6
|
export default require_find_node_modules();
|
package/lib/free-chatgpt.cjs
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
80
|
-
|
|
81
|
-
|
|
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;
|
package/lib/free-chatgpt.mjs
CHANGED
package/lib/git/user-config.cjs
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
114
|
-
|
|
115
|
-
|
|
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("
|
|
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;
|
package/lib/git/user-config.mjs
CHANGED
|
@@ -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-
|
|
4
|
+
} from "../chunk-MGPYPKIE.mjs";
|
|
5
5
|
import "../chunk-A3VUZEJK.mjs";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-6RK5UCTP.mjs";
|
|
7
7
|
import "../chunk-QQ4A6DLD.mjs";
|
|
8
8
|
export default require_user_config();
|
package/lib/git-diff-cli.cjs
CHANGED
|
@@ -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("
|
|
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
|
|
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
|
|
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
|
|
200
|
-
|
|
201
|
-
|
|
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{
|
|
869
|
-
console.log("
|
|
870
|
-
console.log("
|
|
871
|
-
console.log("
|
|
872
|
-
console.log("
|
|
873
|
-
console.log("
|
|
874
|
-
console.log("
|
|
875
|
-
console.log("
|
|
876
|
-
console.log("
|
|
877
|
-
console.log("
|
|
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(`\
|
|
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
|
|
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
|
|
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(`\
|
|
916
|
-
console.error(`\
|
|
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("\
|
|
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(`\
|
|
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}
|
|
1057
|
+
console.log("\u{1F4A1} Use --ai flag to generate commit message with ChatGPT");
|
|
997
1058
|
}
|
|
998
1059
|
}
|
|
999
1060
|
|
package/lib/git-diff-cli.mjs
CHANGED
|
@@ -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-
|
|
6
|
-
import "./chunk-
|
|
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-
|
|
9
|
+
import "./chunk-6RK5UCTP.mjs";
|
|
10
10
|
import {
|
|
11
11
|
init_esm_shims
|
|
12
12
|
} from "./chunk-QQ4A6DLD.mjs";
|