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/git-diff.cjs
CHANGED
|
@@ -141,7 +141,7 @@ var require_findEnvFiles = __commonJS({
|
|
|
141
141
|
var require_config = __commonJS({
|
|
142
142
|
"src/binary-collections/config.cjs"(exports2, module2) {
|
|
143
143
|
init_cjs_shims();
|
|
144
|
-
var path3 = require("
|
|
144
|
+
var path3 = require("upath");
|
|
145
145
|
var { findEnvWithToken } = require_findEnvFiles();
|
|
146
146
|
require("dotenv").config({ path: findEnvWithToken(), quiet: true, overwrite: true });
|
|
147
147
|
function getTempDir() {
|
|
@@ -165,9 +165,9 @@ var require_utils = __commonJS({
|
|
|
165
165
|
init_cjs_shims();
|
|
166
166
|
var fs3 = require("fs");
|
|
167
167
|
var path3 = require("upath");
|
|
168
|
-
var
|
|
168
|
+
var minimistLib = require("minimist");
|
|
169
|
+
var argv = minimistLib(process.argv.slice(2));
|
|
169
170
|
var { exec } = require("child_process");
|
|
170
|
-
var { URL: URL2 } = require("url");
|
|
171
171
|
var { promisify } = require("util");
|
|
172
172
|
var execAsync = promisify(exec);
|
|
173
173
|
async function parseGitRemotes() {
|
|
@@ -180,7 +180,7 @@ var require_utils = __commonJS({
|
|
|
180
180
|
if (name && url) {
|
|
181
181
|
const [repoUrl] = url.split(" ");
|
|
182
182
|
try {
|
|
183
|
-
const parsedUrl = new
|
|
183
|
+
const parsedUrl = new URL(repoUrl);
|
|
184
184
|
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
185
185
|
if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
|
|
186
186
|
let repoPath = pathParts.join("/");
|
|
@@ -201,15 +201,10 @@ var require_utils = __commonJS({
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
module2.exports.parseGitRemotes = parseGitRemotes;
|
|
204
|
-
function
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
|
|
204
|
+
function getArgs2(opts) {
|
|
205
|
+
if (opts) {
|
|
206
|
+
return minimistLib(process.argv.slice(2), opts);
|
|
208
207
|
}
|
|
209
|
-
return fullPath;
|
|
210
|
-
}
|
|
211
|
-
module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
|
|
212
|
-
function getArgs2() {
|
|
213
208
|
return argv;
|
|
214
209
|
}
|
|
215
210
|
module2.exports.getArgs = getArgs2;
|
|
@@ -879,16 +874,16 @@ var DIFF_OUTPUT_RELATIVE = import_upath2.default.relative(process.cwd(), DIFF_OU
|
|
|
879
874
|
var GPT_DIFF_OUTPUT_RELATIVE = import_upath2.default.relative(process.cwd(), GPT_DIFF_OUTPUT);
|
|
880
875
|
import_fs_extra2.default.ensureDirSync(CACHE_DIR, { mode: 493 });
|
|
881
876
|
function showHelp() {
|
|
882
|
-
console.log("\u{
|
|
883
|
-
console.log("
|
|
884
|
-
console.log("
|
|
885
|
-
console.log("
|
|
886
|
-
console.log("
|
|
887
|
-
console.log("
|
|
888
|
-
console.log("
|
|
889
|
-
console.log("
|
|
890
|
-
console.log("
|
|
891
|
-
console.log("
|
|
877
|
+
console.log("\u{1F4CB} Git Diff Helper");
|
|
878
|
+
console.log("Usage:");
|
|
879
|
+
console.log(" git-diff FILE Show staged diff of specified file");
|
|
880
|
+
console.log(" git-diff --staged-only Show staged diff of all files");
|
|
881
|
+
console.log(" git-diff -s | -S Same as --staged-only");
|
|
882
|
+
console.log(" git-diff --unstaged FILE Show unstaged diff of specified file");
|
|
883
|
+
console.log(" git-diff --unstaged Show unstaged diff of all files");
|
|
884
|
+
console.log(" git-diff -u Same as --unstaged");
|
|
885
|
+
console.log(" git-diff --ai Run ChatGPT automation for commit message");
|
|
886
|
+
console.log(" git-diff --help | -h Show this help message");
|
|
892
887
|
console.log("");
|
|
893
888
|
console.log(`\u{1F4BE} Output is saved to: ${DIFF_OUTPUT_RELATIVE}`);
|
|
894
889
|
console.log(`\u{1F916} GPT prompt is saved to: ${GPT_DIFF_OUTPUT_RELATIVE}`);
|
|
@@ -896,14 +891,14 @@ function showHelp() {
|
|
|
896
891
|
}
|
|
897
892
|
function runGitDiff(command, successMessage, errorMessage) {
|
|
898
893
|
try {
|
|
899
|
-
console.log(`\
|
|
894
|
+
console.log(`\u2139\uFE0F Running command: ${command}`);
|
|
900
895
|
const result = (0, import_child_process.execSync)(command, {
|
|
901
896
|
encoding: "utf8",
|
|
902
897
|
maxBuffer: 1024 * 1024 * 10
|
|
903
898
|
// 10MB buffer to handle large diffs
|
|
904
899
|
});
|
|
905
900
|
if (!result || result.trim() === "") {
|
|
906
|
-
console.log(`\u2139\uFE0F
|
|
901
|
+
console.log(`\u2139\uFE0F No changes found for the specified criteria`);
|
|
907
902
|
(0, import_sbg_utility.writefile)(DIFF_OUTPUT, "# No changes found\n");
|
|
908
903
|
console.log(`\u2705 Empty diff saved to "${DIFF_OUTPUT_RELATIVE}"`);
|
|
909
904
|
return false;
|
|
@@ -911,7 +906,7 @@ function runGitDiff(command, successMessage, errorMessage) {
|
|
|
911
906
|
(0, import_sbg_utility.writefile)(DIFF_OUTPUT, result);
|
|
912
907
|
(0, import_sbg_utility.writefile)(
|
|
913
908
|
GPT_DIFF_OUTPUT,
|
|
914
|
-
`Hello
|
|
909
|
+
`Hello!
|
|
915
910
|
Can you create a conventional commit message by diff content below:
|
|
916
911
|
|
|
917
912
|
\`\`\`${result}
|
|
@@ -926,14 +921,56 @@ Thank you!`
|
|
|
926
921
|
return true;
|
|
927
922
|
} catch (error) {
|
|
928
923
|
console.error(`\u274C ${errorMessage}`);
|
|
929
|
-
console.error(`\
|
|
930
|
-
console.error(`\
|
|
924
|
+
console.error(`\u274C Command: ${command}`);
|
|
925
|
+
console.error(`\u274C Error: ${error.message}`);
|
|
931
926
|
if (error.message.includes("not a git repository")) {
|
|
932
|
-
console.error("\
|
|
927
|
+
console.error("\u274C Make sure you are in a git repository");
|
|
933
928
|
}
|
|
934
929
|
process.exit(1);
|
|
935
930
|
}
|
|
936
931
|
}
|
|
932
|
+
function getUntrackedDiff() {
|
|
933
|
+
try {
|
|
934
|
+
const untrackedStr = (0, import_child_process.execSync)("git ls-files --others --exclude-standard", {
|
|
935
|
+
encoding: "utf8",
|
|
936
|
+
maxBuffer: 1024 * 1024 * 10
|
|
937
|
+
}).trim();
|
|
938
|
+
if (!untrackedStr) return "";
|
|
939
|
+
const untrackedFiles = untrackedStr.split("\n").filter(function(f) {
|
|
940
|
+
return f;
|
|
941
|
+
});
|
|
942
|
+
if (untrackedFiles.length === 0) return "";
|
|
943
|
+
var result = "\n# Untracked files:\n";
|
|
944
|
+
for (var i = 0; i < untrackedFiles.length; i++) {
|
|
945
|
+
var file = untrackedFiles[i];
|
|
946
|
+
if (!import_fs_extra2.default.existsSync(file)) continue;
|
|
947
|
+
var stat = import_fs_extra2.default.statSync(file);
|
|
948
|
+
if (!stat.isFile()) continue;
|
|
949
|
+
var content;
|
|
950
|
+
try {
|
|
951
|
+
content = import_fs_extra2.default.readFileSync(file, "utf8");
|
|
952
|
+
} catch (_a) {
|
|
953
|
+
continue;
|
|
954
|
+
}
|
|
955
|
+
var lines = content.split("\n");
|
|
956
|
+
if (lines.length > 0 && lines[lines.length - 1] === "") {
|
|
957
|
+
lines.pop();
|
|
958
|
+
}
|
|
959
|
+
result += "diff --git a/" + file + " b/" + file + "\n";
|
|
960
|
+
result += "new file mode 100644\n";
|
|
961
|
+
result += "index 0000000..0000000\n";
|
|
962
|
+
result += "--- /dev/null\n";
|
|
963
|
+
result += "+++ b/" + file + "\n";
|
|
964
|
+
result += "@@ -0,0 +1," + (lines.length || 0) + " @@\n";
|
|
965
|
+
for (var j = 0; j < lines.length; j++) {
|
|
966
|
+
result += "+" + lines[j] + "\n";
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
return result;
|
|
970
|
+
} catch (_b) {
|
|
971
|
+
return "";
|
|
972
|
+
}
|
|
973
|
+
}
|
|
937
974
|
function fileHasChanges(file, mode) {
|
|
938
975
|
const command = mode === "staged" ? `git diff --cached --quiet -- "${file}"` : `git diff --quiet -- "${file}"`;
|
|
939
976
|
try {
|
|
@@ -968,6 +1005,30 @@ async function mainGitDiff() {
|
|
|
968
1005
|
`Full ${fullDiffModeLabel} diff saved to "${import_ansi_colors.default.green(DIFF_OUTPUT_RELATIVE)}"`,
|
|
969
1006
|
"Failed to save all diff's"
|
|
970
1007
|
);
|
|
1008
|
+
const untrackedDiff = getUntrackedDiff();
|
|
1009
|
+
if (untrackedDiff) {
|
|
1010
|
+
const UNTRACKED_DIFF_OUTPUT = (0, import_config.getTempPath)(`git-diff/untracked-${FILENAME}.txt`);
|
|
1011
|
+
const UNTRACKED_GPT_DIFF_OUTPUT = (0, import_config.getTempPath)(`git-diff/gpt-untracked-${FILENAME}.txt`);
|
|
1012
|
+
const UNTRACKED_DIFF_OUTPUT_RELATIVE = import_upath2.default.relative(process.cwd(), UNTRACKED_DIFF_OUTPUT);
|
|
1013
|
+
(0, import_sbg_utility.writefile)(UNTRACKED_DIFF_OUTPUT, untrackedDiff);
|
|
1014
|
+
(0, import_sbg_utility.writefile)(
|
|
1015
|
+
UNTRACKED_GPT_DIFF_OUTPUT,
|
|
1016
|
+
`Hello!
|
|
1017
|
+
Can you create a conventional commit message by diff content below:
|
|
1018
|
+
|
|
1019
|
+
\`\`\`${untrackedDiff}
|
|
1020
|
+
\`\`\`
|
|
1021
|
+
|
|
1022
|
+
Give me result as codeblock with language "text" only.
|
|
1023
|
+
|
|
1024
|
+
Thank you!`
|
|
1025
|
+
);
|
|
1026
|
+
console.log(`\u2705 Untracked file diff saved to "${import_ansi_colors.default.green(UNTRACKED_DIFF_OUTPUT_RELATIVE)}"`);
|
|
1027
|
+
console.log(
|
|
1028
|
+
`\u{1F4BE} AI diff prompt saved to "${import_ansi_colors.default.green(import_upath2.default.relative(process.cwd(), UNTRACKED_GPT_DIFF_OUTPUT))}"`
|
|
1029
|
+
);
|
|
1030
|
+
hasDiff = true;
|
|
1031
|
+
}
|
|
971
1032
|
} else {
|
|
972
1033
|
let fileDiffMode = useUnstaged ? "unstaged" : "staged";
|
|
973
1034
|
if (!useUnstaged && !fileHasChanges(file, "staged") && fileHasChanges(file, "unstaged")) {
|
|
@@ -997,7 +1058,7 @@ async function mainGitDiff() {
|
|
|
997
1058
|
];
|
|
998
1059
|
const opencodePromptPath = (0, import_config.getTempPath)(`git-diff/opencode-${FILENAME}.txt`);
|
|
999
1060
|
(0, import_sbg_utility.writefile)(opencodePromptPath, opencodePrompt.join("\n"));
|
|
1000
|
-
console.log(`\
|
|
1061
|
+
console.log(`\u2705 OpenCode prompt saved to "${import_ansi_colors.default.green(import_upath2.default.relative(process.cwd(), opencodePromptPath))}"`);
|
|
1001
1062
|
}
|
|
1002
1063
|
if (args.ai) {
|
|
1003
1064
|
try {
|
|
@@ -1007,7 +1068,7 @@ async function mainGitDiff() {
|
|
|
1007
1068
|
console.error("\u{1F4A1} Try running with visible browser mode or check if Chrome is installed");
|
|
1008
1069
|
}
|
|
1009
1070
|
} else {
|
|
1010
|
-
console.log("\u{1F4A1}
|
|
1071
|
+
console.log("\u{1F4A1} Use --ai flag to generate commit message with ChatGPT");
|
|
1011
1072
|
}
|
|
1012
1073
|
}
|
|
1013
1074
|
var git_diff_default = runGitDiff;
|
package/lib/git-diff.js
CHANGED
|
@@ -45,19 +45,19 @@ exports.GPT_DIFF_OUTPUT_RELATIVE = GPT_DIFF_OUTPUT_RELATIVE;
|
|
|
45
45
|
// Ensure output directory exists
|
|
46
46
|
fs_extra_1.default.ensureDirSync(CACHE_DIR, { mode: 0o755 });
|
|
47
47
|
function showHelp() {
|
|
48
|
-
console.log('
|
|
49
|
-
console.log('
|
|
50
|
-
console.log('
|
|
51
|
-
console.log('
|
|
52
|
-
console.log('
|
|
53
|
-
console.log('
|
|
54
|
-
console.log('
|
|
55
|
-
console.log('
|
|
56
|
-
console.log('
|
|
57
|
-
console.log('
|
|
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
58
|
console.log('');
|
|
59
|
-
console.log(
|
|
60
|
-
console.log(
|
|
59
|
+
console.log(`💾 Output is saved to: ${DIFF_OUTPUT_RELATIVE}`);
|
|
60
|
+
console.log(`🤖 GPT prompt is saved to: ${GPT_DIFF_OUTPUT_RELATIVE}`);
|
|
61
61
|
process.exit(0);
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
@@ -92,46 +92,91 @@ function showHelp() {
|
|
|
92
92
|
*/
|
|
93
93
|
function runGitDiff(command, successMessage, errorMessage) {
|
|
94
94
|
try {
|
|
95
|
-
console.log(
|
|
95
|
+
console.log(`ℹ️ Running command: ${command}`);
|
|
96
96
|
const result = (0, child_process_1.execSync)(command, {
|
|
97
97
|
encoding: 'utf8',
|
|
98
98
|
maxBuffer: 1024 * 1024 * 10 // 10MB buffer to handle large diffs
|
|
99
99
|
});
|
|
100
100
|
// If result is empty, inform user but don't treat as error
|
|
101
101
|
if (!result || result.trim() === '') {
|
|
102
|
-
console.log(`ℹ️
|
|
102
|
+
console.log(`ℹ️ No changes found for the specified criteria`);
|
|
103
103
|
(0, sbg_utility_1.writefile)(DIFF_OUTPUT, '# No changes found\n');
|
|
104
104
|
console.log(`✅ Empty diff saved to "${DIFF_OUTPUT_RELATIVE}"`);
|
|
105
105
|
return false;
|
|
106
106
|
}
|
|
107
107
|
(0, sbg_utility_1.writefile)(DIFF_OUTPUT, result);
|
|
108
|
-
(0, sbg_utility_1.writefile)(GPT_DIFF_OUTPUT, `Hello
|
|
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!`);
|
|
109
109
|
console.log(`✅ ${successMessage}`);
|
|
110
110
|
console.log(`💾 GPT diff prompt saved to "${ansi_colors_1.default.green(GPT_DIFF_OUTPUT_RELATIVE)}"`);
|
|
111
111
|
return true;
|
|
112
112
|
}
|
|
113
113
|
catch (error) {
|
|
114
114
|
console.error(`❌ ${errorMessage}`);
|
|
115
|
-
console.error(
|
|
116
|
-
console.error(
|
|
115
|
+
console.error(`❌ Command: ${command}`);
|
|
116
|
+
console.error(`❌ Error: ${error.message}`);
|
|
117
117
|
// Check if it's a git-related error
|
|
118
118
|
if (error.message.includes('not a git repository')) {
|
|
119
|
-
console.error('
|
|
119
|
+
console.error('❌ Make sure you are in a git repository');
|
|
120
120
|
}
|
|
121
121
|
process.exit(1);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
/**
|
|
125
|
-
*
|
|
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.
|
|
126
128
|
*
|
|
127
|
-
*
|
|
128
|
-
* - exit code 0: no changes
|
|
129
|
-
* - exit code 1: changes exist
|
|
130
|
-
*
|
|
131
|
-
* @param {string} file - Target file path
|
|
132
|
-
* @param {"staged" | "unstaged"} mode - Diff mode to check
|
|
133
|
-
* @returns {boolean} True when changes exist for the given mode
|
|
129
|
+
* @returns {string} Formatted diff content for untracked files, or empty string if none
|
|
134
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
|
+
}
|
|
135
180
|
function fileHasChanges(file, mode) {
|
|
136
181
|
const command = mode === 'staged' ? `git diff --cached --quiet -- "${file}"` : `git diff --quiet -- "${file}"`;
|
|
137
182
|
try {
|
|
@@ -163,6 +208,18 @@ function mainGitDiff() {
|
|
|
163
208
|
if (!file) {
|
|
164
209
|
const fullDiffModeLabel = useUnstaged ? 'unstaged' : 'unstaged';
|
|
165
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
|
+
}
|
|
166
223
|
}
|
|
167
224
|
else {
|
|
168
225
|
let fileDiffMode = useUnstaged ? 'unstaged' : 'staged';
|
|
@@ -189,7 +246,7 @@ function mainGitDiff() {
|
|
|
189
246
|
];
|
|
190
247
|
const opencodePromptPath = (0, config_cjs_1.getTempPath)(`git-diff/opencode-${FILENAME}.txt`);
|
|
191
248
|
(0, sbg_utility_1.writefile)(opencodePromptPath, opencodePrompt.join('\n'));
|
|
192
|
-
console.log(
|
|
249
|
+
console.log(`✅ OpenCode prompt saved to "${ansi_colors_1.default.green(upath_1.default.relative(process.cwd(), opencodePromptPath))}"`);
|
|
193
250
|
}
|
|
194
251
|
// Generate commit message prompt from ChatGPT (only if --ai is specified)
|
|
195
252
|
if (args.ai) {
|
|
@@ -202,7 +259,7 @@ function mainGitDiff() {
|
|
|
202
259
|
}
|
|
203
260
|
}
|
|
204
261
|
else {
|
|
205
|
-
console.log('💡
|
|
262
|
+
console.log('💡 Use --ai flag to generate commit message with ChatGPT');
|
|
206
263
|
}
|
|
207
264
|
});
|
|
208
265
|
}
|
package/lib/git-diff.mjs
CHANGED
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
git_diff_default,
|
|
10
10
|
mainGitDiff,
|
|
11
11
|
runGitDiff
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-2MN4VPV2.mjs";
|
|
13
|
+
import "./chunk-X2B3X7D4.mjs";
|
|
14
14
|
import "./chunk-GAGABICI.mjs";
|
|
15
15
|
import "./chunk-H44UWUFY.mjs";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-6RK5UCTP.mjs";
|
|
17
17
|
import "./chunk-QQ4A6DLD.mjs";
|
|
18
18
|
export {
|
|
19
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
|
|
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
|
|
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
|
|
389
|
-
|
|
390
|
-
|
|
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;
|
|
@@ -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("
|
|
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-
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
59
|
-
|
|
60
|
-
|
|
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;
|
|
@@ -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("
|
|
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-
|
|
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("
|
|
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("
|
|
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) => {
|