binary-collections 2.0.11 → 2.0.12
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/.opencode/package.json +5 -0
- package/binaries/rmx +15 -1
- package/binaries/rmx.cmd +12 -0
- package/binaries/test-cjs +9 -1
- package/binaries/test-cjs.cmd +16 -1
- package/binaries/test-esm +16 -0
- package/binaries/test-esm.cjs +178 -0
- package/binaries/test-esm.cmd +23 -0
- package/binaries/yarn-clean +1 -1
- package/binaries/yarn-clean.cmd +1 -1
- package/binaries/yarn-clean.py +33 -15
- package/binaries/yc +110 -0
- package/binaries/yc.cjs +178 -0
- package/lib/binary-collections/config.cjs +126 -0
- package/lib/binary-collections/config.mjs +7 -0
- package/lib/binary-collections/executeScript.cjs +19 -0
- package/lib/binary-collections/executeScript.d.cts +12 -0
- package/lib/binary-collections/executeScript.mjs +6 -0
- package/lib/binary-collections/findScript.cjs +284 -0
- package/lib/binary-collections/findScript.d.cts +12 -0
- package/lib/binary-collections/findScript.mjs +7 -0
- package/lib/binary-collections/listScript.cjs +266 -0
- package/lib/binary-collections/listScript.d.cts +19 -0
- package/lib/binary-collections/listScript.mjs +7 -0
- package/lib/binary-collections.cjs +224 -137
- package/lib/binary-collections.mjs +22 -282
- package/lib/changelog.cjs +2 -2
- package/lib/changelog.mjs +1 -1
- package/lib/{chunk-AJDD5DZM.mjs → chunk-2LSRSEXF.mjs} +1 -1
- package/lib/{chunk-Z6JLYU2J.mjs → chunk-5RTXZVCW.mjs} +2 -2
- package/lib/{chunk-XA3SNBPA.mjs → chunk-66KDU4TX.mjs} +93 -9
- package/lib/chunk-6PU7BAHB.mjs +61 -0
- package/lib/chunk-C6D2TTYU.mjs +32 -0
- package/lib/chunk-FB2WKVJD.mjs +158 -0
- package/lib/{chunk-NCXAP7AA.mjs → chunk-G5UUEWUO.mjs} +9 -5
- package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
- package/lib/chunk-H44UWUFY.mjs +105 -0
- package/lib/chunk-NCZPTKDV.mjs +79 -0
- package/lib/chunk-NGFK3EYW.mjs +28 -0
- package/lib/chunk-NVEG3LEZ.mjs +143 -0
- package/lib/chunk-OGXVGBRI.mjs +29 -0
- package/lib/chunk-OXV52GD5.mjs +62 -0
- package/lib/chunk-PXBMHE7O.mjs +35 -0
- package/lib/chunk-R5FJOR63.mjs +47 -0
- package/lib/chunk-SPTECFE5.mjs +180 -0
- package/lib/chunk-UXCFNAR6.mjs +55 -0
- package/lib/chunk-V2IBPCEV.mjs +39 -0
- package/lib/chunk-XPJGCDOD.mjs +14 -0
- package/lib/chunk-ZOWVMII3.mjs +228 -0
- package/lib/clean-github-actions-caches-cli.cjs +465 -0
- package/lib/clean-github-actions-caches-cli.d.cts +1 -0
- package/lib/clean-github-actions-caches-cli.mjs +56 -0
- package/lib/clean-github-actions-caches.cjs +149 -205
- package/lib/clean-github-actions-caches.d.cts +15 -1
- package/lib/clean-github-actions-caches.mjs +4 -130
- package/lib/cross-env/command.cjs +63 -0
- package/lib/cross-env/command.d.ts +8 -0
- package/lib/cross-env/command.js +45 -0
- package/lib/cross-env/command.mjs +9 -0
- package/lib/cross-env/index.cjs +178 -0
- package/lib/cross-env/index.d.ts +8 -0
- package/lib/cross-env/index.js +102 -0
- package/lib/cross-env/index.mjs +101 -0
- package/lib/cross-env/variable.cjs +60 -0
- package/lib/cross-env/variable.d.ts +7 -0
- package/lib/cross-env/variable.js +59 -0
- package/lib/cross-env/variable.mjs +9 -0
- package/lib/del-gradle.cjs +2 -2
- package/lib/del-gradle.js +8 -8
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.js +24 -24
- package/lib/del-ps.cjs +2 -2
- package/lib/del-ps.js +8 -8
- package/lib/del-ps.mjs +1 -1
- package/lib/del-yarn-caches.cjs +2 -2
- package/lib/del-yarn-caches.js +2 -2
- package/lib/del-yarn-caches.mjs +1 -1
- package/lib/file/copy-cli.cjs +92 -0
- package/lib/file/copy-cli.d.mts +1 -0
- package/lib/file/copy-cli.mjs +55 -0
- package/lib/file/copy.cjs +56 -0
- package/lib/file/copy.d.mts +1 -0
- package/lib/file/copy.mjs +8 -0
- package/lib/file/move-cli.cjs +91 -0
- package/lib/file/move-cli.d.mts +1 -0
- package/lib/file/move-cli.mjs +55 -0
- package/lib/file/move.cjs +55 -0
- package/lib/file/move.d.mts +1 -0
- package/lib/file/move.mjs +8 -0
- package/lib/find-node-modules-cli.js +1 -1
- package/lib/free-chatgpt.cjs +21 -15
- package/lib/free-chatgpt.js +10 -10
- package/lib/free-chatgpt.mjs +2 -2
- package/lib/git/user-config.cjs +2 -2
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +188 -42
- package/lib/git-diff-cli.mjs +5 -4
- package/lib/git-diff.cjs +188 -42
- package/lib/git-diff.d.ts +2 -1
- package/lib/git-diff.js +91 -34
- package/lib/git-diff.mjs +5 -4
- package/lib/git-fix.cjs +2 -2
- package/lib/git-fix.mjs +2 -2
- package/lib/git-purge.cjs +2 -2
- package/lib/git-purge.mjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/kill-night-crows.cjs +7 -7
- package/lib/kill-night-crows.mjs +7 -7
- package/lib/node-cache-cleaner/npm.cjs +65 -0
- package/lib/node-cache-cleaner/npm.d.ts +2 -0
- package/lib/node-cache-cleaner/npm.js +41 -0
- package/lib/node-cache-cleaner/npm.mjs +10 -0
- package/lib/node-cache-cleaner/npx.cjs +89 -0
- package/lib/node-cache-cleaner/npx.d.ts +4 -0
- package/lib/node-cache-cleaner/npx.js +82 -0
- package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
- package/lib/node-cache-cleaner/yarn.cjs +73 -0
- package/lib/node-cache-cleaner/yarn.d.ts +2 -0
- package/lib/node-cache-cleaner/yarn.js +62 -0
- package/lib/node-cache-cleaner/yarn.mjs +10 -0
- package/lib/node-cache-cleaner-cli.cjs +182 -0
- package/lib/node-cache-cleaner-cli.d.ts +2 -0
- package/lib/node-cache-cleaner-cli.js +60 -0
- package/lib/node-cache-cleaner-cli.mjs +56 -0
- package/lib/node-executor.cjs +91 -0
- package/lib/node-executor.d.cts +2 -0
- package/lib/node-executor.mjs +103 -0
- package/lib/npm-run-series.cjs +21 -28
- package/lib/npm-run-series.mjs +20 -6
- package/lib/package-resolutions-updater-cli.cjs +213 -128
- package/lib/package-resolutions-updater-cli.mjs +17 -39
- package/lib/package-resolutions-updater.cjs +204 -98
- package/lib/package-resolutions-updater.d.mts +20 -1
- package/lib/package-resolutions-updater.mjs +7 -5
- package/lib/print-directory-tree.cjs +2 -2
- package/lib/print-directory-tree.mjs +1 -1
- package/lib/ps/connected-domain.js +10 -10
- package/lib/ps/index.cjs +1 -1
- package/lib/ps/index.mjs +177 -171
- package/lib/ps/isWin.js +1 -1
- package/lib/ps/table-parser.js +6 -6
- package/lib/remove-module.cjs +2 -2
- package/lib/remove-module.mjs +1 -1
- package/lib/rm-node-module-cli.cjs +222 -0
- package/lib/rm-node-module-cli.d.cts +1 -0
- package/lib/rm-node-module-cli.mjs +89 -0
- package/lib/rm-node-modules.cjs +127 -0
- package/lib/rm-node-modules.d.cts +35 -0
- package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
- package/lib/rmpath.cjs +2 -2
- package/lib/rmpath.mjs +1 -1
- package/lib/submodule-install.cjs +47 -34
- package/lib/submodule-install.mjs +46 -33
- package/lib/submodule-remove-cli.cjs +1 -2
- package/lib/submodule-remove-cli.js +3 -3
- package/lib/submodule-remove-cli.mjs +1 -2
- package/lib/utils/chatgpt.cjs +19 -13
- package/lib/utils/chatgpt.js +94 -94
- package/lib/utils/chatgpt.mjs +1 -1
- package/lib/utils/findEnvFiles.cjs +28 -46
- package/lib/utils/findEnvFiles.d.cts +19 -0
- package/lib/utils/findEnvFiles.mjs +3 -5
- package/lib/utils/findWorkspaceRoot.js +4 -4
- package/lib/utils/index.cjs +2 -2
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isGithubTokenValid.js +7 -7
- package/lib/{ps/index.d.cjs → utils/isWindows.cjs} +17 -3
- package/lib/utils/isWindows.d.ts +5 -0
- package/lib/utils/isWindows.js +10 -0
- package/lib/utils/isWindows.mjs +8 -0
- package/lib/utils/runBash.cjs +53 -0
- package/lib/utils/runBash.d.cts +12 -0
- package/lib/utils/runBash.mjs +66 -0
- package/lib/yarn-per-branch-lock-installer.cjs +97 -0
- package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
- package/lib/yarn-per-branch-lock-installer.mjs +109 -0
- package/lib/yarn-reinstall.cjs +2 -2
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +61 -52
- package/readme.html +784 -0
- package/readme.md +106 -218
- package/releases/readme.md +1 -1
- package/test/README.md +2 -2
- package/test-project/package.json +8 -2
- package/test-project/workspaces/workspace-a/package.json +135 -0
- package/test-project/workspaces/workspace-a/readme.md +20 -0
- package/test-project/workspaces/workspace-a/release/readme.md +42 -0
- package/test-project/workspaces/workspace-a/test/demo/package.json +25 -0
- package/test-project/workspaces/workspace-a/test/readme.md +12 -0
- package/test-project/workspaces/workspace-b/package.json +139 -0
- package/test-project/workspaces/workspace-b/readme.md +94 -0
- package/test-project/workspaces/workspace-b/requirements.txt +1 -0
- package/test-project/workspaces/workspace-b/test/sample-project/package.json +7 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +96 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
- package/tmp/rm-node-modules-test-project/package.json +17 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +16 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +16 -0
- package/tmp/test-repo/README.md +2 -35
- package/tmp/test-repo/package.json +13 -3
- package/docs-src/clean-github-actions-caches.md +0 -26
- package/docs-src/free-chatgpt.md +0 -26
- package/lib/binary-collections-config.cjs +0 -15
- package/lib/chunk-2CBJCW7E.mjs +0 -81
- package/lib/chunk-4UHL4WVN.mjs +0 -136
- package/lib/chunk-66PAU5PS.mjs +0 -31
- package/lib/chunk-6HHJRKFB.mjs +0 -59
- package/lib/chunk-7XTEJHOE.mjs +0 -193
- package/lib/chunk-FCDQGYBF.mjs +0 -136
- package/lib/chunk-GEYA2USY.mjs +0 -207
- package/lib/chunk-GJTGHXRA.mjs +0 -356
- package/lib/chunk-ID2WBTE2.mjs +0 -80
- package/lib/chunk-JXFOHKDM.mjs +0 -239
- package/lib/chunk-PDSXF5HY.mjs +0 -187
- package/lib/chunk-RWLXRTYP.mjs +0 -109
- package/lib/chunk-TOIVAQF7.mjs +0 -136
- package/lib/chunk-V5SKYJUB.mjs +0 -136
- package/lib/chunk-WSRETQCA.mjs +0 -59
- package/lib/chunk-YYLIQQKF.mjs +0 -31
- package/lib/ps/index.d.ts +0 -2
- package/lib/ps/index.js +0 -254
- package/lib/utils/findEnvFiles.d.ts +0 -8
- package/lib/utils/findEnvFiles.js +0 -121
- package/tmp/typedoc/readme.md +0 -320
- /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
package/lib/chunk-TOIVAQF7.mjs
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
runChatGpt
|
|
4
|
-
} from "./chunk-N436BNBK.mjs";
|
|
5
|
-
import {
|
|
6
|
-
require_binary_collections_config
|
|
7
|
-
} from "./chunk-66PAU5PS.mjs";
|
|
8
|
-
import {
|
|
9
|
-
require_utils
|
|
10
|
-
} from "./chunk-Z6JLYU2J.mjs";
|
|
11
|
-
import {
|
|
12
|
-
__toESM,
|
|
13
|
-
init_esm_shims
|
|
14
|
-
} from "./chunk-QQ4A6DLD.mjs";
|
|
15
|
-
|
|
16
|
-
// src/git-diff.js
|
|
17
|
-
init_esm_shims();
|
|
18
|
-
var import_binary_collections_config = __toESM(require_binary_collections_config(), 1);
|
|
19
|
-
import { execSync } from "child_process";
|
|
20
|
-
import fs from "fs-extra";
|
|
21
|
-
import path from "upath";
|
|
22
|
-
import { fileURLToPath } from "url";
|
|
23
|
-
var import_utils = __toESM(require_utils(), 1);
|
|
24
|
-
var __filename = fileURLToPath(import.meta.url);
|
|
25
|
-
var __dirname = path.dirname(__filename);
|
|
26
|
-
var DIFF_OUTPUT = (0, import_binary_collections_config.getTempPath)("git-diff.txt");
|
|
27
|
-
var GPT_DIFF_OUTPUT = (0, import_binary_collections_config.getTempPath)("gpt-question.txt");
|
|
28
|
-
var CACHE_DIR = path.dirname(DIFF_OUTPUT);
|
|
29
|
-
var DIFF_OUTPUT_RELATIVE = path.relative(process.cwd(), DIFF_OUTPUT);
|
|
30
|
-
var GPT_DIFF_OUTPUT_RELATIVE = path.relative(process.cwd(), GPT_DIFF_OUTPUT);
|
|
31
|
-
if (!fs.existsSync(CACHE_DIR)) {
|
|
32
|
-
fs.mkdirSync(CACHE_DIR, { recursive: true });
|
|
33
|
-
}
|
|
34
|
-
function showHelp() {
|
|
35
|
-
console.log("\u{1F4DD} Git Diff Helper");
|
|
36
|
-
console.log("\u{1F4C4} Usage:");
|
|
37
|
-
console.log(" \u{1F4C2} git-diff FILE Show staged diff of specified file");
|
|
38
|
-
console.log(" \u{1F4C2} git-diff --staged-only Show staged diff of all files");
|
|
39
|
-
console.log(" \u{1F4C2} git-diff -s | -S Same as --staged-only");
|
|
40
|
-
console.log(" \u{1F4C2} git-diff --ai Run ChatGPT automation for commit message");
|
|
41
|
-
console.log(" \u{1F4C2} git-diff --help | -h Show this help message");
|
|
42
|
-
console.log("");
|
|
43
|
-
console.log(`\u{1F4BE} Output is saved to: ${DIFF_OUTPUT_RELATIVE}`);
|
|
44
|
-
console.log(`\u{1F916} GPT prompt is saved to: ${GPT_DIFF_OUTPUT_RELATIVE}`);
|
|
45
|
-
process.exit(0);
|
|
46
|
-
}
|
|
47
|
-
function runGitDiff(command, successMessage, errorMessage) {
|
|
48
|
-
try {
|
|
49
|
-
console.log(`\u{1F50D} [i] Running command: ${command}`);
|
|
50
|
-
const result = execSync(command, {
|
|
51
|
-
encoding: "utf8",
|
|
52
|
-
maxBuffer: 1024 * 1024 * 10
|
|
53
|
-
// 10MB buffer to handle large diffs
|
|
54
|
-
});
|
|
55
|
-
if (!result || result.trim() === "") {
|
|
56
|
-
console.log(`\u2139\uFE0F [i] No changes found for the specified criteria`);
|
|
57
|
-
fs.writeFileSync(DIFF_OUTPUT, "# No changes found\n");
|
|
58
|
-
console.log(`\u2705 Empty diff saved to "${DIFF_OUTPUT_RELATIVE}"`);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
fs.writeFileSync(DIFF_OUTPUT, result);
|
|
62
|
-
fs.writeFileSync(
|
|
63
|
-
GPT_DIFF_OUTPUT,
|
|
64
|
-
`Hello, ChatGPT!
|
|
65
|
-
Can you create a conventional commit message by diff content below:
|
|
66
|
-
|
|
67
|
-
\`\`\`${result}
|
|
68
|
-
\`\`\`
|
|
69
|
-
|
|
70
|
-
Give me result as codeblock with language "text" only.
|
|
71
|
-
|
|
72
|
-
Thank you!`
|
|
73
|
-
);
|
|
74
|
-
console.log(`\u2705 ${successMessage}`);
|
|
75
|
-
console.log(`\u{1F4BE} GPT diff prompt saved to "${GPT_DIFF_OUTPUT_RELATIVE}"`);
|
|
76
|
-
} catch (error) {
|
|
77
|
-
console.error(`\u274C ${errorMessage}`);
|
|
78
|
-
console.error(`\u{1F4DD} Command: ${command}`);
|
|
79
|
-
console.error(`\u26A0\uFE0F Error: ${error.message}`);
|
|
80
|
-
if (error.message.includes("not a git repository")) {
|
|
81
|
-
console.error("\u{1F6A7} Make sure you are in a git repository");
|
|
82
|
-
}
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async function mainGitDiff() {
|
|
87
|
-
const args = (0, import_utils.getArgs)();
|
|
88
|
-
const positional = args._ || [];
|
|
89
|
-
if (args.help || args.h) {
|
|
90
|
-
showHelp();
|
|
91
|
-
}
|
|
92
|
-
if (args["staged-only"] || args.s || args.S) {
|
|
93
|
-
runGitDiff(
|
|
94
|
-
"git --no-pager diff --staged",
|
|
95
|
-
`Full staged diff saved to "${DIFF_OUTPUT_RELATIVE}"`,
|
|
96
|
-
"Failed to save staged diff"
|
|
97
|
-
);
|
|
98
|
-
} else {
|
|
99
|
-
const file = positional[0];
|
|
100
|
-
if (!file) {
|
|
101
|
-
runGitDiff(
|
|
102
|
-
"git --no-pager diff",
|
|
103
|
-
`Full staged diff saved to "${DIFF_OUTPUT_RELATIVE}"`,
|
|
104
|
-
"Failed to save all diff's"
|
|
105
|
-
);
|
|
106
|
-
} else {
|
|
107
|
-
runGitDiff(
|
|
108
|
-
`git --no-pager diff --cached -- "${file}"`,
|
|
109
|
-
`Staged diff of "${file}" saved to "${DIFF_OUTPUT_RELATIVE}"`,
|
|
110
|
-
`Failed to generate diff for "${file}"`
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (args.ai) {
|
|
115
|
-
try {
|
|
116
|
-
await runChatGpt({ headless: true, questionFile: GPT_DIFF_OUTPUT });
|
|
117
|
-
} catch (error) {
|
|
118
|
-
console.error("\u274C Error running ChatGPT:", error.message);
|
|
119
|
-
console.error("\u{1F4A1} Try running with visible browser mode or check if Chrome is installed");
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
console.log("\u{1F4A1} Tip: Use --ai flag to generate commit message with ChatGPT");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
var git_diff_default = runGitDiff;
|
|
126
|
-
|
|
127
|
-
export {
|
|
128
|
-
DIFF_OUTPUT,
|
|
129
|
-
GPT_DIFF_OUTPUT,
|
|
130
|
-
CACHE_DIR,
|
|
131
|
-
DIFF_OUTPUT_RELATIVE,
|
|
132
|
-
GPT_DIFF_OUTPUT_RELATIVE,
|
|
133
|
-
runGitDiff,
|
|
134
|
-
mainGitDiff,
|
|
135
|
-
git_diff_default
|
|
136
|
-
};
|
package/lib/chunk-V5SKYJUB.mjs
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
runChatGpt
|
|
4
|
-
} from "./chunk-N436BNBK.mjs";
|
|
5
|
-
import {
|
|
6
|
-
require_binary_collections_config
|
|
7
|
-
} from "./chunk-NCXAP7AA.mjs";
|
|
8
|
-
import {
|
|
9
|
-
require_utils
|
|
10
|
-
} from "./chunk-Z6JLYU2J.mjs";
|
|
11
|
-
import {
|
|
12
|
-
__toESM,
|
|
13
|
-
init_esm_shims
|
|
14
|
-
} from "./chunk-QQ4A6DLD.mjs";
|
|
15
|
-
|
|
16
|
-
// src/git-diff.js
|
|
17
|
-
init_esm_shims();
|
|
18
|
-
var import_binary_collections_config = __toESM(require_binary_collections_config(), 1);
|
|
19
|
-
import { execSync } from "child_process";
|
|
20
|
-
import fs from "fs-extra";
|
|
21
|
-
import path from "upath";
|
|
22
|
-
import { fileURLToPath } from "url";
|
|
23
|
-
var import_utils = __toESM(require_utils(), 1);
|
|
24
|
-
var __filename = fileURLToPath(import.meta.url);
|
|
25
|
-
var __dirname = path.dirname(__filename);
|
|
26
|
-
var DIFF_OUTPUT = (0, import_binary_collections_config.getTempPath)("git-diff.txt");
|
|
27
|
-
var GPT_DIFF_OUTPUT = (0, import_binary_collections_config.getTempPath)("gpt-question.txt");
|
|
28
|
-
var CACHE_DIR = path.dirname(DIFF_OUTPUT);
|
|
29
|
-
var DIFF_OUTPUT_RELATIVE = path.relative(process.cwd(), DIFF_OUTPUT);
|
|
30
|
-
var GPT_DIFF_OUTPUT_RELATIVE = path.relative(process.cwd(), GPT_DIFF_OUTPUT);
|
|
31
|
-
if (!fs.existsSync(CACHE_DIR)) {
|
|
32
|
-
fs.mkdirSync(CACHE_DIR, { recursive: true });
|
|
33
|
-
}
|
|
34
|
-
function showHelp() {
|
|
35
|
-
console.log("\u{1F4DD} Git Diff Helper");
|
|
36
|
-
console.log("\u{1F4C4} Usage:");
|
|
37
|
-
console.log(" \u{1F4C2} git-diff FILE Show staged diff of specified file");
|
|
38
|
-
console.log(" \u{1F4C2} git-diff --staged-only Show staged diff of all files");
|
|
39
|
-
console.log(" \u{1F4C2} git-diff -s | -S Same as --staged-only");
|
|
40
|
-
console.log(" \u{1F4C2} git-diff --ai Run ChatGPT automation for commit message");
|
|
41
|
-
console.log(" \u{1F4C2} git-diff --help | -h Show this help message");
|
|
42
|
-
console.log("");
|
|
43
|
-
console.log(`\u{1F4BE} Output is saved to: ${DIFF_OUTPUT_RELATIVE}`);
|
|
44
|
-
console.log(`\u{1F916} GPT prompt is saved to: ${GPT_DIFF_OUTPUT_RELATIVE}`);
|
|
45
|
-
process.exit(0);
|
|
46
|
-
}
|
|
47
|
-
function runGitDiff(command, successMessage, errorMessage) {
|
|
48
|
-
try {
|
|
49
|
-
console.log(`\u{1F50D} [i] Running command: ${command}`);
|
|
50
|
-
const result = execSync(command, {
|
|
51
|
-
encoding: "utf8",
|
|
52
|
-
maxBuffer: 1024 * 1024 * 10
|
|
53
|
-
// 10MB buffer to handle large diffs
|
|
54
|
-
});
|
|
55
|
-
if (!result || result.trim() === "") {
|
|
56
|
-
console.log(`\u2139\uFE0F [i] No changes found for the specified criteria`);
|
|
57
|
-
fs.writeFileSync(DIFF_OUTPUT, "# No changes found\n");
|
|
58
|
-
console.log(`\u2705 Empty diff saved to "${DIFF_OUTPUT_RELATIVE}"`);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
fs.writeFileSync(DIFF_OUTPUT, result);
|
|
62
|
-
fs.writeFileSync(
|
|
63
|
-
GPT_DIFF_OUTPUT,
|
|
64
|
-
`Hello, ChatGPT!
|
|
65
|
-
Can you create a conventional commit message by diff content below:
|
|
66
|
-
|
|
67
|
-
\`\`\`${result}
|
|
68
|
-
\`\`\`
|
|
69
|
-
|
|
70
|
-
Give me result as codeblock with language "text" only.
|
|
71
|
-
|
|
72
|
-
Thank you!`
|
|
73
|
-
);
|
|
74
|
-
console.log(`\u2705 ${successMessage}`);
|
|
75
|
-
console.log(`\u{1F4BE} GPT diff prompt saved to "${GPT_DIFF_OUTPUT_RELATIVE}"`);
|
|
76
|
-
} catch (error) {
|
|
77
|
-
console.error(`\u274C ${errorMessage}`);
|
|
78
|
-
console.error(`\u{1F4DD} Command: ${command}`);
|
|
79
|
-
console.error(`\u26A0\uFE0F Error: ${error.message}`);
|
|
80
|
-
if (error.message.includes("not a git repository")) {
|
|
81
|
-
console.error("\u{1F6A7} Make sure you are in a git repository");
|
|
82
|
-
}
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async function mainGitDiff() {
|
|
87
|
-
const args = (0, import_utils.getArgs)();
|
|
88
|
-
const positional = args._ || [];
|
|
89
|
-
if (args.help || args.h) {
|
|
90
|
-
showHelp();
|
|
91
|
-
}
|
|
92
|
-
if (args["staged-only"] || args.s || args.S) {
|
|
93
|
-
runGitDiff(
|
|
94
|
-
"git --no-pager diff --staged",
|
|
95
|
-
`Full staged diff saved to "${DIFF_OUTPUT_RELATIVE}"`,
|
|
96
|
-
"Failed to save staged diff"
|
|
97
|
-
);
|
|
98
|
-
} else {
|
|
99
|
-
const file = positional[0];
|
|
100
|
-
if (!file) {
|
|
101
|
-
runGitDiff(
|
|
102
|
-
"git --no-pager diff",
|
|
103
|
-
`Full staged diff saved to "${DIFF_OUTPUT_RELATIVE}"`,
|
|
104
|
-
"Failed to save all diff's"
|
|
105
|
-
);
|
|
106
|
-
} else {
|
|
107
|
-
runGitDiff(
|
|
108
|
-
`git --no-pager diff --cached -- "${file}"`,
|
|
109
|
-
`Staged diff of "${file}" saved to "${DIFF_OUTPUT_RELATIVE}"`,
|
|
110
|
-
`Failed to generate diff for "${file}"`
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (args.ai) {
|
|
115
|
-
try {
|
|
116
|
-
await runChatGpt({ headless: true, questionFile: GPT_DIFF_OUTPUT });
|
|
117
|
-
} catch (error) {
|
|
118
|
-
console.error("\u274C Error running ChatGPT:", error.message);
|
|
119
|
-
console.error("\u{1F4A1} Try running with visible browser mode or check if Chrome is installed");
|
|
120
|
-
}
|
|
121
|
-
} else {
|
|
122
|
-
console.log("\u{1F4A1} Tip: Use --ai flag to generate commit message with ChatGPT");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
var git_diff_default = runGitDiff;
|
|
126
|
-
|
|
127
|
-
export {
|
|
128
|
-
DIFF_OUTPUT,
|
|
129
|
-
GPT_DIFF_OUTPUT,
|
|
130
|
-
CACHE_DIR,
|
|
131
|
-
DIFF_OUTPUT_RELATIVE,
|
|
132
|
-
GPT_DIFF_OUTPUT_RELATIVE,
|
|
133
|
-
runGitDiff,
|
|
134
|
-
mainGitDiff,
|
|
135
|
-
git_diff_default
|
|
136
|
-
};
|
package/lib/chunk-WSRETQCA.mjs
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
__commonJS,
|
|
4
|
-
__require,
|
|
5
|
-
init_esm_shims
|
|
6
|
-
} from "./chunk-QQ4A6DLD.mjs";
|
|
7
|
-
|
|
8
|
-
// src/submodule-remove.cjs
|
|
9
|
-
var require_submodule_remove = __commonJS({
|
|
10
|
-
"src/submodule-remove.cjs"(exports, module) {
|
|
11
|
-
init_esm_shims();
|
|
12
|
-
var { spawnAsync } = __require("cross-spawn");
|
|
13
|
-
var path = __require("upath");
|
|
14
|
-
var fs = __require("fs-extra");
|
|
15
|
-
var dotenv = __require("dotenv");
|
|
16
|
-
dotenv.config({ path: path.resolve(process.cwd(), ".env"), override: true, quiet: true });
|
|
17
|
-
async function removeSubmodule(submodulePath) {
|
|
18
|
-
try {
|
|
19
|
-
await spawnAsync("git", ["submodule", "deinit", "-f", submodulePath], { stdio: "inherit" });
|
|
20
|
-
} catch (error) {
|
|
21
|
-
console.warn(`Warning: Could not deinitialize submodule "${submodulePath}". It may not exist.`);
|
|
22
|
-
console.warn(error.message);
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
await spawnAsync("git", ["config", "--remove-section", `submodule.${submodulePath}`], { stdio: "inherit" });
|
|
26
|
-
} catch (error) {
|
|
27
|
-
console.warn(`Warning: Could not remove git config section for submodule "${submodulePath}". It may not exist.`);
|
|
28
|
-
console.warn(error.message);
|
|
29
|
-
}
|
|
30
|
-
const gitModulesPath = path.resolve(".git", "modules", submodulePath);
|
|
31
|
-
if (fs.existsSync(gitModulesPath)) {
|
|
32
|
-
fs.rmSync(gitModulesPath, { recursive: true, force: true });
|
|
33
|
-
console.log(`Removed .git/modules entry for submodule "${submodulePath}".`);
|
|
34
|
-
} else {
|
|
35
|
-
console.warn(`Warning: The path "${gitModulesPath}" does not exist. Skipping removal of .git/modules entry.`);
|
|
36
|
-
}
|
|
37
|
-
const gitmodulesPath = path.resolve(".gitmodules");
|
|
38
|
-
if (fs.existsSync(gitmodulesPath)) {
|
|
39
|
-
let gitmodulesContent = fs.readFileSync(gitmodulesPath, "utf-8");
|
|
40
|
-
const submoduleSectionRegex = new RegExp(
|
|
41
|
-
`\\[submodule "${submodulePath.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}"]([\\s\\S]*?)(?=\\[|$)`,
|
|
42
|
-
"g"
|
|
43
|
-
);
|
|
44
|
-
gitmodulesContent = gitmodulesContent.replace(submoduleSectionRegex, "").trim();
|
|
45
|
-
fs.writeFileSync(gitmodulesPath, gitmodulesContent);
|
|
46
|
-
console.log(`Removed submodule "${submodulePath}" from .gitmodules.`);
|
|
47
|
-
} else {
|
|
48
|
-
console.warn(`Warning: The .gitmodules file does not exist. Skipping removal of submodule "${submodulePath}".`);
|
|
49
|
-
}
|
|
50
|
-
fs.rmSync(path.resolve(submodulePath), { recursive: true, force: true });
|
|
51
|
-
console.log(`Submodule "${submodulePath}" has been removed.`);
|
|
52
|
-
}
|
|
53
|
-
module.exports = removeSubmodule;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
export {
|
|
58
|
-
require_submodule_remove
|
|
59
|
-
};
|
package/lib/chunk-YYLIQQKF.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
__commonJS,
|
|
4
|
-
__require,
|
|
5
|
-
init_esm_shims
|
|
6
|
-
} from "./chunk-QQ4A6DLD.mjs";
|
|
7
|
-
|
|
8
|
-
// src/binary-collections-config.cjs
|
|
9
|
-
var require_binary_collections_config = __commonJS({
|
|
10
|
-
"src/binary-collections-config.cjs"(exports, module) {
|
|
11
|
-
init_esm_shims();
|
|
12
|
-
var path = __require("path");
|
|
13
|
-
__require("dotenv").config({ path: path.join(process.cwd(), ".env"), quiet: true, override: true });
|
|
14
|
-
function getTempDir() {
|
|
15
|
-
return process.env.TEMP_DIR || path.join(process.cwd(), "tmp");
|
|
16
|
-
}
|
|
17
|
-
function getTempPath(...segments) {
|
|
18
|
-
return path.join(getTempDir(), ...segments);
|
|
19
|
-
}
|
|
20
|
-
var TEMP_BASE_DIR = getTempDir();
|
|
21
|
-
module.exports = {
|
|
22
|
-
getTempDir,
|
|
23
|
-
getTempPath,
|
|
24
|
-
TEMP_BASE_DIR
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
require_binary_collections_config
|
|
31
|
-
};
|
package/lib/ps/index.d.ts
DELETED
package/lib/ps/index.js
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var ChildProcess = require("child_process");
|
|
3
|
-
var IS_WIN = require("./isWin").default;
|
|
4
|
-
var TableParser = require("./table-parser");
|
|
5
|
-
/**
|
|
6
|
-
* End of line.
|
|
7
|
-
* Basically, the EOL should be:
|
|
8
|
-
* - windows: \r\n
|
|
9
|
-
* - *nix: \n
|
|
10
|
-
* But i'm trying to get every possibilities covered.
|
|
11
|
-
*/
|
|
12
|
-
var EOL = /(\r\n)|(\n\r)|\n|\r/;
|
|
13
|
-
var SystemEOL = require("os").EOL;
|
|
14
|
-
// ps-node
|
|
15
|
-
/**
|
|
16
|
-
* Execute child process
|
|
17
|
-
* @type {Function}
|
|
18
|
-
* @param {String[]} args
|
|
19
|
-
* @param {Function} callback
|
|
20
|
-
* @param {Object=null} callback.err
|
|
21
|
-
* @param {Object[]} callback.stdout
|
|
22
|
-
*/
|
|
23
|
-
var Exec = (module.exports =
|
|
24
|
-
exports =
|
|
25
|
-
function (args, callback) {
|
|
26
|
-
var spawn = ChildProcess.spawn;
|
|
27
|
-
// on windows, if use ChildProcess.exec(`wmic process get`), the stdout will gives you nothing
|
|
28
|
-
// that's why I use `cmd` instead
|
|
29
|
-
if (IS_WIN) {
|
|
30
|
-
var CMD = spawn("cmd");
|
|
31
|
-
var stdout = "";
|
|
32
|
-
var stderr = null;
|
|
33
|
-
CMD.stdout.on("data", function (data) {
|
|
34
|
-
stdout += data.toString();
|
|
35
|
-
});
|
|
36
|
-
CMD.stderr.on("data", function (data) {
|
|
37
|
-
if (stderr === null) {
|
|
38
|
-
stderr = data.toString();
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
stderr += data.toString();
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
CMD.on("exit", function () {
|
|
45
|
-
var beginRow;
|
|
46
|
-
stdout = stdout.split(EOL);
|
|
47
|
-
// Find the line index for the titles
|
|
48
|
-
stdout.forEach(function (out, index) {
|
|
49
|
-
if (out && typeof beginRow == "undefined" && out.indexOf("CommandLine") === 0) {
|
|
50
|
-
beginRow = index;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
// get rid of the start (copyright) and the end (current pwd)
|
|
54
|
-
stdout.splice(stdout.length - 1, 1);
|
|
55
|
-
stdout.splice(0, beginRow);
|
|
56
|
-
callback(stderr, stdout.join(SystemEOL) || false);
|
|
57
|
-
});
|
|
58
|
-
CMD.stdin.write("wmic process get ProcessId,ParentProcessId,CommandLine \n");
|
|
59
|
-
CMD.stdin.end();
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
if (typeof args === "string") {
|
|
63
|
-
args = args.split(/\s+/);
|
|
64
|
-
}
|
|
65
|
-
const child = spawn("ps", args);
|
|
66
|
-
stdout = "";
|
|
67
|
-
stderr = null;
|
|
68
|
-
child.stdout.on("data", function (data) {
|
|
69
|
-
stdout += data.toString();
|
|
70
|
-
});
|
|
71
|
-
child.stderr.on("data", function (data) {
|
|
72
|
-
if (stderr === null) {
|
|
73
|
-
stderr = data.toString();
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
stderr += data.toString();
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
child.on("exit", function () {
|
|
80
|
-
if (stderr) {
|
|
81
|
-
return callback(stderr.toString());
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
callback(null, stdout || false);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
/**
|
|
90
|
-
* Query Process: Focus on pid & cmd
|
|
91
|
-
* @param query
|
|
92
|
-
* @param {String|String[]} query.pid
|
|
93
|
-
* @param {String} query.command RegExp String
|
|
94
|
-
* @param {String} query.arguments RegExp String
|
|
95
|
-
* @param {String|array} query.psargs
|
|
96
|
-
* @param {Function} callback
|
|
97
|
-
* @param {Object=null} callback.err
|
|
98
|
-
* @param {Object[]} callback.processList
|
|
99
|
-
* @return {Object}
|
|
100
|
-
*/
|
|
101
|
-
exports.lookup = function (query, callback) {
|
|
102
|
-
/**
|
|
103
|
-
* add 'lx' as default ps arguments, since the default ps output in linux like "ubuntu", wont include command arguments
|
|
104
|
-
*/
|
|
105
|
-
var exeArgs = query.psargs || ["lx"];
|
|
106
|
-
var filter = {};
|
|
107
|
-
var idList;
|
|
108
|
-
// Lookup by PID
|
|
109
|
-
if (query.pid) {
|
|
110
|
-
if (Array.isArray(query.pid)) {
|
|
111
|
-
idList = query.pid;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
idList = [query.pid];
|
|
115
|
-
}
|
|
116
|
-
// Cast all PIDs as Strings
|
|
117
|
-
idList = idList.map(function (v) {
|
|
118
|
-
return String(v);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
if (query.command) {
|
|
122
|
-
filter["command"] = new RegExp(query.command, "i");
|
|
123
|
-
}
|
|
124
|
-
if (query.arguments) {
|
|
125
|
-
filter["arguments"] = new RegExp(query.arguments, "i");
|
|
126
|
-
}
|
|
127
|
-
if (query.ppid) {
|
|
128
|
-
filter["ppid"] = new RegExp(query.ppid);
|
|
129
|
-
}
|
|
130
|
-
return Exec(exeArgs, function (err, output) {
|
|
131
|
-
if (err) {
|
|
132
|
-
return callback(err);
|
|
133
|
-
}
|
|
134
|
-
else {
|
|
135
|
-
var processList = parseGrid(output);
|
|
136
|
-
var resultList = [];
|
|
137
|
-
processList.forEach(function (p) {
|
|
138
|
-
var flt;
|
|
139
|
-
var type;
|
|
140
|
-
var result = true;
|
|
141
|
-
if (idList && idList.indexOf(String(p.pid)) < 0) {
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
for (type in filter) {
|
|
145
|
-
flt = filter[type];
|
|
146
|
-
result = flt.test(p[type]) ? result : false;
|
|
147
|
-
}
|
|
148
|
-
if (result) {
|
|
149
|
-
resultList.push(p);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
callback(null, resultList);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
};
|
|
156
|
-
/**
|
|
157
|
-
* Kill process
|
|
158
|
-
* @param pid
|
|
159
|
-
* @param {Object|String} signal
|
|
160
|
-
* @param {String} signal.signal
|
|
161
|
-
* @param {number} signal.timeout
|
|
162
|
-
* @param next
|
|
163
|
-
*/
|
|
164
|
-
exports.kill = function (pid, signal, next) {
|
|
165
|
-
//opts are optional
|
|
166
|
-
if (arguments.length == 2 && typeof signal == "function") {
|
|
167
|
-
next = signal;
|
|
168
|
-
signal = undefined;
|
|
169
|
-
}
|
|
170
|
-
var checkTimeoutSeconds = (signal && signal.timeout) || 30;
|
|
171
|
-
if (typeof signal === "object") {
|
|
172
|
-
signal = signal.signal;
|
|
173
|
-
}
|
|
174
|
-
try {
|
|
175
|
-
process.kill(pid, signal);
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
return next && next(e);
|
|
179
|
-
}
|
|
180
|
-
var checkConfident = 0;
|
|
181
|
-
var checkTimeoutTimer = null;
|
|
182
|
-
var checkIsTimeout = false;
|
|
183
|
-
function checkKilled(finishCallback) {
|
|
184
|
-
exports.lookup({ pid: pid }, function (err, list) {
|
|
185
|
-
if (checkIsTimeout)
|
|
186
|
-
return;
|
|
187
|
-
if (err) {
|
|
188
|
-
clearTimeout(checkTimeoutTimer);
|
|
189
|
-
if (finishCallback)
|
|
190
|
-
finishCallback(err);
|
|
191
|
-
}
|
|
192
|
-
else if (list.length > 0) {
|
|
193
|
-
checkConfident = checkConfident - 1 || 0;
|
|
194
|
-
checkKilled(finishCallback);
|
|
195
|
-
}
|
|
196
|
-
else {
|
|
197
|
-
checkConfident++;
|
|
198
|
-
if (checkConfident === 5) {
|
|
199
|
-
clearTimeout(checkTimeoutTimer);
|
|
200
|
-
if (finishCallback)
|
|
201
|
-
finishCallback();
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
checkKilled(finishCallback);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
if (next)
|
|
210
|
-
checkKilled(next);
|
|
211
|
-
checkTimeoutTimer =
|
|
212
|
-
next &&
|
|
213
|
-
setTimeout(function () {
|
|
214
|
-
checkIsTimeout = true;
|
|
215
|
-
next(new Error("Kill process timeout"));
|
|
216
|
-
}, checkTimeoutSeconds * 1000);
|
|
217
|
-
};
|
|
218
|
-
/**
|
|
219
|
-
* Parse the stdout into readable object.
|
|
220
|
-
* @param {String} output
|
|
221
|
-
*/
|
|
222
|
-
function parseGrid(output) {
|
|
223
|
-
if (!output) {
|
|
224
|
-
return [];
|
|
225
|
-
}
|
|
226
|
-
return formatOutput(TableParser.parse(output));
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* format the structure, extract pid, command, arguments, ppid
|
|
230
|
-
* @param data
|
|
231
|
-
* @return {Array}
|
|
232
|
-
*/
|
|
233
|
-
function formatOutput(data) {
|
|
234
|
-
var formatedData = [];
|
|
235
|
-
data.forEach(function (d) {
|
|
236
|
-
var pid = (d.PID && d.PID[0]) || (d.ProcessId && d.ProcessId[0]) || undefined;
|
|
237
|
-
var cmd = d.CMD || d.CommandLine || d.COMMAND || undefined;
|
|
238
|
-
var ppid = (d.PPID && d.PPID[0]) || (d.ParentProcessId && d.ParentProcessId[0]) || undefined;
|
|
239
|
-
if (pid && cmd) {
|
|
240
|
-
var command = cmd[0];
|
|
241
|
-
var args = "";
|
|
242
|
-
if (cmd.length > 1) {
|
|
243
|
-
args = cmd.slice(1);
|
|
244
|
-
}
|
|
245
|
-
formatedData.push({
|
|
246
|
-
pid: pid,
|
|
247
|
-
command: command,
|
|
248
|
-
arguments: args,
|
|
249
|
-
ppid: ppid
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
return formatedData;
|
|
254
|
-
}
|