binary-collections 2.0.6 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/bin/dir-tree.cmd +7 -0
  2. package/bin/git-diff +4 -0
  3. package/bin/git-diff.cmd +7 -0
  4. package/bin/{git-fix-encoding → git-fix} +1 -4
  5. package/bin/git-fix.cmd +7 -0
  6. package/bin/nodekill +0 -0
  7. package/bin/nodekill.cmd +0 -0
  8. package/bin/{submodule-install → submodule-install.txt} +0 -0
  9. package/bin/{submodule → submodule.txt} +0 -0
  10. package/lib/binary-collections-config.cjs +14 -0
  11. package/lib/binary-collections-config.d.mts +18 -0
  12. package/lib/binary-collections-config.d.ts +16 -0
  13. package/lib/binary-collections-config.js +39 -0
  14. package/lib/binary-collections-config.mjs +6 -0
  15. package/lib/binary-collections.cjs +105 -0
  16. package/lib/binary-collections.d.cts +2 -0
  17. package/lib/binary-collections.d.mts +121 -0
  18. package/lib/binary-collections.d.ts +121 -0
  19. package/lib/binary-collections.mjs +108 -0
  20. package/lib/chunk-4BYBVEYC.mjs +30 -0
  21. package/lib/chunk-AASHBCRW.mjs +57 -0
  22. package/lib/chunk-APBWENF6.mjs +135 -0
  23. package/lib/{chunk-M4IBUK4H.mjs → chunk-DPKAJKFO.mjs} +2 -4
  24. package/lib/chunk-EGSSKVDH.mjs +66 -0
  25. package/lib/{chunk-GA4DDV65.mjs → chunk-G3THLIDT.mjs} +3 -5
  26. package/lib/chunk-JGR2NW6D.mjs +187 -0
  27. package/lib/chunk-ONIBBBQ3.mjs +108 -0
  28. package/lib/chunk-SH3L6HHV.mjs +27 -0
  29. package/lib/chunk-VVEZVNIV.mjs +81 -0
  30. package/lib/{chunk-E75HJFJO.mjs → chunk-W3ENOM53.mjs} +2 -4
  31. package/lib/chunk-YV7DO3YV.mjs +48 -0
  32. package/lib/chunk-YX5U7XDR.mjs +58 -0
  33. package/lib/chunk-ZYAQRPUL.mjs +28 -0
  34. package/lib/clean-github-actions-caches.cjs +162 -0
  35. package/lib/clean-github-actions-caches.d.cts +1 -0
  36. package/lib/clean-github-actions-caches.d.mts +169 -0
  37. package/lib/clean-github-actions-caches.d.ts +169 -0
  38. package/lib/clean-github-actions-caches.mjs +132 -0
  39. package/lib/del-gradle.cjs +99 -15
  40. package/lib/del-gradle.d.ts +1 -2
  41. package/lib/del-gradle.js +12 -69
  42. package/lib/del-gradle.mjs +4 -6
  43. package/lib/del-node-modules.cjs +98 -14
  44. package/lib/del-node-modules.d.ts +1 -2
  45. package/lib/del-node-modules.js +11 -68
  46. package/lib/del-node-modules.mjs +3 -5
  47. package/lib/del-ps.cjs +98 -627
  48. package/lib/del-ps.d.ts +1 -2
  49. package/lib/del-ps.js +27 -702
  50. package/lib/del-ps.mjs +7 -12
  51. package/lib/del-yarn-caches.cjs +98 -14
  52. package/lib/del-yarn-caches.d.ts +1 -2
  53. package/lib/del-yarn-caches.js +6 -63
  54. package/lib/del-yarn-caches.mjs +3 -5
  55. package/lib/find-node-modules-cli.cjs +67 -0
  56. package/lib/find-node-modules-cli.d.mts +1 -0
  57. package/lib/find-node-modules-cli.d.ts +2 -0
  58. package/lib/find-node-modules-cli.js +3 -0
  59. package/lib/find-node-modules-cli.mjs +13 -0
  60. package/lib/find-node-modules.cjs +39 -9
  61. package/lib/find-node-modules.d.mts +12 -1
  62. package/lib/find-node-modules.d.ts +12 -2
  63. package/lib/find-node-modules.js +53 -12
  64. package/lib/find-node-modules.mjs +4 -19
  65. package/lib/git/gitattributes.cjs +171 -0
  66. package/lib/git/gitattributes.d.mts +35 -0
  67. package/lib/git/gitattributes.d.ts +33 -0
  68. package/lib/git/gitattributes.js +223 -0
  69. package/lib/git/gitattributes.mjs +6 -0
  70. package/lib/git/line-endings.cjs +74 -0
  71. package/lib/git/line-endings.d.cts +7 -0
  72. package/lib/git/line-endings.d.mts +83 -0
  73. package/lib/git/line-endings.d.ts +83 -0
  74. package/lib/git/line-endings.mjs +8 -0
  75. package/lib/git/normalize.cjs +42 -0
  76. package/lib/git/normalize.d.cts +6 -0
  77. package/lib/git/normalize.d.mts +43 -0
  78. package/lib/git/normalize.d.ts +43 -0
  79. package/lib/git/normalize.mjs +6 -0
  80. package/lib/git/permissions.cjs +15 -0
  81. package/lib/git/permissions.d.cts +6 -0
  82. package/lib/git/permissions.d.mts +17 -0
  83. package/lib/git/permissions.d.ts +17 -0
  84. package/lib/git/permissions.mjs +7 -0
  85. package/lib/git/pull-strategy.cjs +13 -0
  86. package/lib/git/pull-strategy.d.cts +5 -0
  87. package/lib/git/pull-strategy.d.mts +15 -0
  88. package/lib/git/pull-strategy.d.ts +15 -0
  89. package/lib/git/pull-strategy.mjs +7 -0
  90. package/lib/git/user-config.cjs +100 -0
  91. package/lib/git/user-config.d.cts +10 -0
  92. package/lib/git/user-config.d.mts +105 -0
  93. package/lib/git/user-config.d.ts +105 -0
  94. package/lib/git/user-config.mjs +8 -0
  95. package/lib/git/utils.cjs +70 -0
  96. package/lib/git/utils.d.cts +20 -0
  97. package/lib/git/utils.d.mts +69 -0
  98. package/lib/git/utils.d.ts +69 -0
  99. package/lib/git/utils.mjs +6 -0
  100. package/lib/git-diff.cjs +73 -0
  101. package/lib/git-diff.d.cts +2 -0
  102. package/lib/git-diff.d.mts +84 -0
  103. package/lib/git-diff.d.ts +84 -0
  104. package/lib/git-diff.mjs +88 -0
  105. package/lib/git-fix.cjs +129 -0
  106. package/lib/git-fix.d.cts +2 -0
  107. package/lib/git-fix.d.mts +141 -0
  108. package/lib/git-fix.d.ts +141 -0
  109. package/lib/git-fix.mjs +151 -0
  110. package/lib/git-purge.cjs +92 -621
  111. package/lib/git-purge.d.ts +1 -2
  112. package/lib/git-purge.js +53 -698
  113. package/lib/git-purge.mjs +4 -9
  114. package/lib/index.cjs +99 -1
  115. package/lib/index.d.mts +1 -2
  116. package/lib/index.d.ts +2 -2
  117. package/lib/index.js +8 -2
  118. package/lib/index.mjs +10 -3
  119. package/lib/npm-run-series.cjs +140 -1
  120. package/lib/npm-run-series.d.ts +1 -0
  121. package/lib/npm-run-series.js +81 -56
  122. package/lib/npm-run-series.mjs +7 -5
  123. package/lib/package-resolutions-updater.cjs +274 -0
  124. package/lib/package-resolutions-updater.d.mts +1 -0
  125. package/lib/package-resolutions-updater.d.ts +326 -0
  126. package/lib/package-resolutions-updater.mjs +316 -0
  127. package/lib/print-directory-tree.cjs +241 -0
  128. package/lib/print-directory-tree.d.cts +1 -0
  129. package/lib/print-directory-tree.d.mts +234 -0
  130. package/lib/print-directory-tree.d.ts +234 -0
  131. package/lib/print-directory-tree.mjs +182 -0
  132. package/lib/ps/connected-domain.cjs +0 -0
  133. package/lib/ps/connected-domain.d.ts +1 -2
  134. package/lib/ps/connected-domain.js +196 -150
  135. package/lib/ps/connected-domain.mjs +2 -3
  136. package/lib/ps/index.cjs +3 -3
  137. package/lib/ps/index.d.mjs +1 -2
  138. package/lib/ps/index.d.ts +2 -26
  139. package/lib/ps/index.js +233 -535
  140. package/lib/ps/index.mjs +9 -11
  141. package/lib/ps/isWin.cjs +0 -0
  142. package/lib/ps/isWin.d.ts +1 -2
  143. package/lib/ps/isWin.js +1 -2
  144. package/lib/ps/isWin.mjs +2 -3
  145. package/lib/ps/table-parser.cjs +0 -0
  146. package/lib/ps/table-parser.d.ts +1 -3
  147. package/lib/ps/table-parser.js +254 -345
  148. package/lib/ps/table-parser.mjs +3 -4
  149. package/lib/submodule-install.cjs +100 -0
  150. package/lib/submodule-install.d.cts +2 -0
  151. package/lib/submodule-install.d.mts +121 -0
  152. package/lib/submodule-install.d.ts +121 -0
  153. package/lib/submodule-install.mjs +107 -0
  154. package/lib/utils.cjs +98 -14
  155. package/lib/utils.d.mts +29 -9
  156. package/lib/utils.d.ts +30 -14
  157. package/lib/utils.js +173 -27
  158. package/lib/utils.mjs +2 -3
  159. package/lib/yarn-reinstall.cjs +44 -0
  160. package/lib/yarn-reinstall.d.cts +1 -0
  161. package/lib/yarn-reinstall.d.mts +49 -0
  162. package/lib/yarn-reinstall.d.ts +49 -0
  163. package/lib/yarn-reinstall.mjs +54 -0
  164. package/package.json +126 -99
  165. package/readme.md +238 -50
  166. package/src/package-resolutions-updater.mjs +325 -0
  167. package/src/print-directory-tree.cjs +234 -0
  168. package/src/ps/index.js +4 -3
  169. package/src/yarn-reinstall.cjs +49 -0
  170. package/test-project/package.json +16 -0
  171. package/tmp/test-repo/package.json +7 -0
  172. package/bin/git-fix-encoding.cmd +0 -6
  173. package/eslint.config.cjs +0 -97
  174. package/lib/chunk-7MSZ52XC.mjs +0 -14
  175. package/lib/chunk-AVDT32AY.mjs +0 -20
  176. package/lib/chunk-LPLPQBYP.mjs +0 -53
  177. package/lib/chunk-S4SJ7SDW.mjs +0 -625
  178. package/lib/package-resolutions.cjs +0 -28
  179. package/lib/package-resolutions.d.mts +0 -25
  180. package/lib/package-resolutions.d.ts +0 -25
  181. package/lib/package-resolutions.js +0 -28
  182. package/lib/package-resolutions.mjs +0 -31
  183. package/lib/ps/index.d.js +0 -17
@@ -0,0 +1,57 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var __esm = (fn, res) => function __init() {
15
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
16
+ };
17
+ var __commonJS = (cb, mod) => function __require2() {
18
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+
37
+ // node_modules/tsup/assets/esm_shims.js
38
+ import path from "path";
39
+ import { fileURLToPath } from "url";
40
+ var getFilename, getDirname, __dirname, __filename;
41
+ var init_esm_shims = __esm({
42
+ "node_modules/tsup/assets/esm_shims.js"() {
43
+ getFilename = () => fileURLToPath(import.meta.url);
44
+ getDirname = () => path.dirname(getFilename());
45
+ __dirname = /* @__PURE__ */ getDirname();
46
+ __filename = /* @__PURE__ */ getFilename();
47
+ }
48
+ });
49
+
50
+ export {
51
+ __require,
52
+ __commonJS,
53
+ __toESM,
54
+ __dirname,
55
+ __filename,
56
+ init_esm_shims
57
+ };
@@ -0,0 +1,135 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ __commonJS,
4
+ __require,
5
+ init_esm_shims
6
+ } from "./chunk-AASHBCRW.mjs";
7
+
8
+ // src/utils.js
9
+ var require_utils = __commonJS({
10
+ "src/utils.js"(exports, module) {
11
+ init_esm_shims();
12
+ var fs = __require("fs");
13
+ var path = __require("upath");
14
+ var argv = __require("minimist")(process.argv.slice(2));
15
+ var { exec } = __require("child_process");
16
+ var { URL } = __require("url");
17
+ var { promisify } = __require("util");
18
+ var execAsync = promisify(exec);
19
+ async function parseGitRemotes() {
20
+ try {
21
+ const { stdout } = await execAsync("git remote -v");
22
+ const lines = stdout.split("\n");
23
+ const remotes = {};
24
+ lines.forEach((line) => {
25
+ const [name, url] = line.split(" ");
26
+ if (name && url) {
27
+ const [repoUrl] = url.split(" ");
28
+ try {
29
+ const parsedUrl = new URL(repoUrl);
30
+ const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
31
+ if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
32
+ let repoPath = pathParts.join("/");
33
+ if (repoPath.endsWith(".git")) {
34
+ repoPath = repoPath.slice(0, -4);
35
+ }
36
+ remotes[name] = repoPath;
37
+ }
38
+ } catch (e) {
39
+ console.error("URL Parsing Error:", e.message);
40
+ }
41
+ }
42
+ });
43
+ return remotes;
44
+ } catch (error) {
45
+ console.error("Error:", error.message);
46
+ return {};
47
+ }
48
+ }
49
+ module.exports.parseGitRemotes = parseGitRemotes;
50
+ function joinPathPreserveDriveLetter(...segments) {
51
+ let fullPath = __require("path").join(...segments);
52
+ if (/^[a-z]:\\/.test(fullPath)) {
53
+ fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
54
+ }
55
+ return fullPath;
56
+ }
57
+ module.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
58
+ function getArgs() {
59
+ return argv;
60
+ }
61
+ module.exports.getArgs = getArgs;
62
+ function del(fullPath) {
63
+ if (fs.statSync(fullPath).isDirectory()) {
64
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
65
+ for (let i = 0; i < subdir.length; i++) {
66
+ del(subdir[i]);
67
+ }
68
+ } else {
69
+ try {
70
+ fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
71
+ console.log("deleted", fullPath);
72
+ } catch (_) {
73
+ console.log("failed delete", fullPath);
74
+ }
75
+ }
76
+ }
77
+ module.exports.del = del;
78
+ function delStream(globStream) {
79
+ globStream.stream().on("data", (result) => {
80
+ const fullPath = path.resolve(process.cwd(), result);
81
+ if (fs.statSync(fullPath).isDirectory()) {
82
+ const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
83
+ for (let i = 0; i < subdir.length; i++) {
84
+ del(subdir[i]);
85
+ }
86
+ }
87
+ del(fullPath);
88
+ });
89
+ }
90
+ module.exports.delStream = delStream;
91
+ function getFileTreeString(hashArray) {
92
+ const tree = {};
93
+ const hashMap = {};
94
+ for (const entry of hashArray) {
95
+ const [filePath, hash] = entry.split(" ");
96
+ hashMap[filePath] = hash;
97
+ const parts = filePath.split("/");
98
+ let current = tree;
99
+ for (let i = 0; i < parts.length; i++) {
100
+ const part = parts[i];
101
+ if (i === parts.length - 1) {
102
+ current[part] = null;
103
+ } else {
104
+ current[part] = current[part] || {};
105
+ current = current[part];
106
+ }
107
+ }
108
+ }
109
+ function printNode(node, prefix = "", parentPath = "") {
110
+ const keys = Object.keys(node).sort();
111
+ let lines = [];
112
+ keys.forEach((key, idx) => {
113
+ const isLast = idx === keys.length - 1;
114
+ const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
115
+ const currentPath = parentPath ? parentPath + "/" + key : key;
116
+ if (node[key] === null) {
117
+ lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
118
+ } else {
119
+ lines.push(prefix + branch + key + "/");
120
+ lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
121
+ }
122
+ });
123
+ return lines;
124
+ }
125
+ return printNode(tree, "", "").join("\n");
126
+ }
127
+ module.exports.getFileTreeString = getFileTreeString;
128
+ var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
129
+ module.exports.delay = delay;
130
+ }
131
+ });
132
+
133
+ export {
134
+ require_utils
135
+ };
@@ -1,10 +1,8 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
+ __commonJS,
3
4
  init_esm_shims
4
- } from "./chunk-7MSZ52XC.mjs";
5
- import {
6
- __commonJS
7
- } from "./chunk-AVDT32AY.mjs";
5
+ } from "./chunk-AASHBCRW.mjs";
8
6
 
9
7
  // src/ps/connected-domain.js
10
8
  var require_connected_domain = __commonJS({
@@ -0,0 +1,66 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ __commonJS,
4
+ __require,
5
+ init_esm_shims
6
+ } from "./chunk-AASHBCRW.mjs";
7
+
8
+ // src/git/utils.cjs
9
+ var require_utils = __commonJS({
10
+ "src/git/utils.cjs"(exports, module) {
11
+ init_esm_shims();
12
+ var { execSync, spawnSync } = __require("child_process");
13
+ function runGitCommand(args, description) {
14
+ try {
15
+ console.log(`[i] ${description}`);
16
+ const result = spawnSync("git", args, { encoding: "utf-8" });
17
+ if (result.status !== 0) {
18
+ console.error(`[\u2717] Failed: ${description}`);
19
+ console.error(`Error: ${result.stderr || result.stdout}`);
20
+ return false;
21
+ }
22
+ console.log(`[\u2713] ${description}`);
23
+ return true;
24
+ } catch (error) {
25
+ console.error(`[\u2717] Failed: ${description}`);
26
+ console.error(`Error: ${error.message}`);
27
+ return false;
28
+ }
29
+ }
30
+ function isGitRepository(cwd) {
31
+ const dir = typeof cwd === "string" ? cwd : process.cwd();
32
+ try {
33
+ execSync("git rev-parse --git-dir", { stdio: "pipe", cwd: dir });
34
+ return true;
35
+ } catch {
36
+ return false;
37
+ }
38
+ }
39
+ function runGitCommandOutput(args, description) {
40
+ try {
41
+ console.log(`[i] ${description}`);
42
+ const result = spawnSync("git", args, { encoding: "utf-8" });
43
+ if (result.status !== 0) {
44
+ console.error(`[\u2717] Failed: ${description}`);
45
+ console.error(`Error: ${result.stderr || result.stdout}`);
46
+ return null;
47
+ }
48
+ console.log(`[\u2713] ${description}`);
49
+ return result.stdout.trim();
50
+ } catch (error) {
51
+ console.error(`[\u2717] Failed: ${description}`);
52
+ console.error(`Error: ${error.message}`);
53
+ return null;
54
+ }
55
+ }
56
+ module.exports = {
57
+ runGitCommand,
58
+ runGitCommandOutput,
59
+ isGitRepository
60
+ };
61
+ }
62
+ });
63
+
64
+ export {
65
+ require_utils
66
+ };
@@ -1,13 +1,11 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_connected_domain
4
- } from "./chunk-M4IBUK4H.mjs";
4
+ } from "./chunk-DPKAJKFO.mjs";
5
5
  import {
6
+ __commonJS,
6
7
  init_esm_shims
7
- } from "./chunk-7MSZ52XC.mjs";
8
- import {
9
- __commonJS
10
- } from "./chunk-AVDT32AY.mjs";
8
+ } from "./chunk-AASHBCRW.mjs";
11
9
 
12
10
  // src/ps/table-parser.js
13
11
  var require_table_parser = __commonJS({
@@ -0,0 +1,187 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ __commonJS,
4
+ __require,
5
+ init_esm_shims
6
+ } from "./chunk-AASHBCRW.mjs";
7
+
8
+ // src/git/gitattributes.js
9
+ var require_gitattributes = __commonJS({
10
+ "src/git/gitattributes.js"(exports, module) {
11
+ init_esm_shims();
12
+ var fs = __require("fs");
13
+ function parseGitAttributes(gitattributesPath) {
14
+ const rules = [];
15
+ if (!fs.existsSync(gitattributesPath)) {
16
+ return rules;
17
+ }
18
+ const content = fs.readFileSync(gitattributesPath, "utf8");
19
+ const lines = content.split("\n");
20
+ lines.forEach((line, index) => {
21
+ const trimmedLine = line.trim();
22
+ if (!trimmedLine || trimmedLine.startsWith("#")) {
23
+ rules.push({
24
+ type: trimmedLine.startsWith("#") ? "comment" : "empty",
25
+ content: line,
26
+ lineNumber: index + 1
27
+ });
28
+ return;
29
+ }
30
+ const parts = trimmedLine.split(/\s+/);
31
+ if (parts.length >= 2) {
32
+ const pattern = parts[0];
33
+ const attributes = parts.slice(1).join(" ");
34
+ rules.push({
35
+ type: "rule",
36
+ pattern,
37
+ attributes,
38
+ content: line,
39
+ lineNumber: index + 1
40
+ });
41
+ } else {
42
+ rules.push({
43
+ type: "invalid",
44
+ content: line,
45
+ lineNumber: index + 1
46
+ });
47
+ }
48
+ });
49
+ return rules;
50
+ }
51
+ function patternsConflict(pattern1, pattern2) {
52
+ if (pattern1 === pattern2) {
53
+ return true;
54
+ }
55
+ if (pattern1 === "*" || pattern2 === "*") {
56
+ return pattern1 !== pattern2;
57
+ }
58
+ const normalize = (p) => p.replace(/\{[^}]+\}/g, "*").replace(/\*+/g, "*");
59
+ const norm1 = normalize(pattern1);
60
+ const norm2 = normalize(pattern2);
61
+ return norm1 === norm2;
62
+ }
63
+ function mergeGitAttributeRules(existingRules, desiredRules) {
64
+ let mergedRules;
65
+ if (existingRules.length === 0) {
66
+ mergedRules = desiredRules.map((desired, idx) => ({
67
+ type: "rule",
68
+ pattern: desired.pattern,
69
+ attributes: desired.attributes,
70
+ content: `${desired.pattern} ${desired.attributes}`,
71
+ lineNumber: idx + 1,
72
+ added: true
73
+ }));
74
+ return {
75
+ mergedRules,
76
+ conflicts: [],
77
+ changes: desiredRules.map((rule) => ({ action: "added", pattern: rule.pattern, attributes: rule.attributes }))
78
+ };
79
+ } else {
80
+ mergedRules = [...existingRules];
81
+ }
82
+ const conflicts = [];
83
+ const changes = [];
84
+ desiredRules.forEach((desired) => {
85
+ const existingIdx = mergedRules.findIndex((r) => r.type === "rule" && r.pattern === desired.pattern);
86
+ if (existingIdx !== -1) {
87
+ const existing = mergedRules[existingIdx];
88
+ if (existing.attributes === desired.attributes) {
89
+ conflicts.push({
90
+ pattern: desired.pattern,
91
+ existing: existing.attributes,
92
+ proposed: desired.attributes,
93
+ action: "kept existing (identical)"
94
+ });
95
+ } else if (desired.priority > (existing.priority || 0)) {
96
+ mergedRules[existingIdx] = {
97
+ type: "rule",
98
+ pattern: desired.pattern,
99
+ attributes: desired.attributes,
100
+ content: `${desired.pattern} ${desired.attributes}`,
101
+ lineNumber: existing.lineNumber,
102
+ replaced: true
103
+ };
104
+ conflicts.push({
105
+ pattern: desired.pattern,
106
+ existing: existing.attributes,
107
+ proposed: desired.attributes,
108
+ action: "replaced (higher priority)"
109
+ });
110
+ changes.push({
111
+ action: "replaced",
112
+ pattern: desired.pattern,
113
+ attributes: desired.attributes,
114
+ oldAttributes: existing.attributes
115
+ });
116
+ } else {
117
+ conflicts.push({
118
+ pattern: desired.pattern,
119
+ existing: existing.attributes,
120
+ proposed: desired.attributes,
121
+ action: "kept existing (lower priority)"
122
+ });
123
+ }
124
+ } else {
125
+ mergedRules.push({
126
+ type: "rule",
127
+ pattern: desired.pattern,
128
+ attributes: desired.attributes,
129
+ content: `${desired.pattern} ${desired.attributes}`,
130
+ lineNumber: mergedRules.length + 1,
131
+ added: true
132
+ });
133
+ changes.push({
134
+ action: "added",
135
+ pattern: desired.pattern,
136
+ attributes: desired.attributes
137
+ });
138
+ }
139
+ });
140
+ return { mergedRules, conflicts, changes };
141
+ }
142
+ function formatGitAttributes(rules) {
143
+ return rules.map((rule) => {
144
+ if (rule.type === "rule") {
145
+ return `${rule.pattern} ${rule.attributes}`;
146
+ }
147
+ return rule.content;
148
+ }).join("\n") + "\n";
149
+ }
150
+ function updateGitAttributes(gitattributesPath, desiredRules) {
151
+ try {
152
+ const existingRules = parseGitAttributes(gitattributesPath);
153
+ const { mergedRules, conflicts, changes } = mergeGitAttributeRules(existingRules, desiredRules);
154
+ let success = false;
155
+ if (changes.length > 0) {
156
+ const newContent = formatGitAttributes(mergedRules);
157
+ fs.writeFileSync(gitattributesPath, newContent);
158
+ success = true;
159
+ }
160
+ return {
161
+ success,
162
+ conflicts,
163
+ changes,
164
+ message: success ? `Updated .gitattributes with ${changes.length} changes` : "No changes needed - all rules already present"
165
+ };
166
+ } catch (error) {
167
+ return {
168
+ success: false,
169
+ error: error.message,
170
+ conflicts: [],
171
+ changes: []
172
+ };
173
+ }
174
+ }
175
+ module.exports = {
176
+ parseGitAttributes,
177
+ patternsConflict,
178
+ mergeGitAttributeRules,
179
+ formatGitAttributes,
180
+ updateGitAttributes
181
+ };
182
+ }
183
+ });
184
+
185
+ export {
186
+ require_gitattributes
187
+ };
@@ -0,0 +1,108 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_utils as require_utils2
4
+ } from "./chunk-EGSSKVDH.mjs";
5
+ import {
6
+ require_utils
7
+ } from "./chunk-APBWENF6.mjs";
8
+ import {
9
+ __commonJS,
10
+ __require,
11
+ init_esm_shims
12
+ } from "./chunk-AASHBCRW.mjs";
13
+
14
+ // src/git/user-config.cjs
15
+ var require_user_config = __commonJS({
16
+ "src/git/user-config.cjs"(exports, module) {
17
+ init_esm_shims();
18
+ var gch = __require("git-command-helper");
19
+ var { runGitCommand, runGitCommandOutput } = require_utils2();
20
+ var { getArgs } = require_utils();
21
+ function configureGitUser(cliUser = null, cliEmail = null, options = {}) {
22
+ console.log("\n=== Configuring Git User ===");
23
+ let username, email;
24
+ if (cliUser && cliEmail) {
25
+ username = cliUser.trim();
26
+ email = cliEmail.trim();
27
+ console.log("[i] Using CLI-provided user configuration");
28
+ } else {
29
+ username = process.env.GITHUB_USER ? process.env.GITHUB_USER.trim() : void 0;
30
+ email = process.env.GITHUB_EMAIL ? process.env.GITHUB_EMAIL.trim() : void 0;
31
+ if (username || email) {
32
+ console.log("[i] Using environment variable user configuration");
33
+ }
34
+ }
35
+ if (!username && !email) {
36
+ console.log("[i] No Git user configuration needed (no CLI args or environment variables set)");
37
+ return;
38
+ }
39
+ if (username) {
40
+ const success = runGitCommand(["config", "user.name", username], `Set Git username to "${username}"`);
41
+ if (!success) {
42
+ console.log("[i] Failed to set Git username, but continuing...");
43
+ }
44
+ } else {
45
+ console.log("[i] No username provided, skipping username configuration");
46
+ }
47
+ if (email) {
48
+ const success = runGitCommand(["config", "user.email", email], `Set Git email to "${email}"`);
49
+ if (!success) {
50
+ console.log("[i] Failed to set Git email, but continuing...");
51
+ }
52
+ } else {
53
+ console.log("[i] No email provided, skipping email configuration");
54
+ }
55
+ if (username || email) {
56
+ console.log("[\u2713] Git user configuration completed");
57
+ }
58
+ if (username) {
59
+ const remoteUrl = runGitCommandOutput(["remote", "get-url", "origin"], "Fetching remote URL for verification");
60
+ if (remoteUrl) {
61
+ console.log(`[i] Remote URL: ${remoteUrl}`);
62
+ const parsedUrl = gch.parseGitHubUrl(remoteUrl);
63
+ if (parsedUrl && parsedUrl.owner && username && parsedUrl.owner.toLowerCase() !== username.toLowerCase()) {
64
+ console.warn(
65
+ `
66
+ [!] The GitHub remote owner ("${parsedUrl.owner}") does not match the configured username ("${username}").`
67
+ );
68
+ console.warn(`[!] If this is not intentional, consider updating the remote URL to use your username.`);
69
+ console.warn(`[!] Example: git remote set-url origin https://github.com/${username}/<repo>.git
70
+ `);
71
+ const args = getArgs();
72
+ const updateRemote = options.updateRemote || args["update-remote"] === true;
73
+ if (updateRemote) {
74
+ let newUrl = remoteUrl;
75
+ if (/^https:\/\//.test(remoteUrl)) {
76
+ newUrl = remoteUrl.replace(/https:\/\/(?:[^@]+@)?github.com/, `https://${username}@github.com`);
77
+ } else if (/^git@github.com:/.test(remoteUrl)) {
78
+ console.warn(
79
+ `[!] For SSH remotes, set your SSH config or use HTTPS with username if you want to change authentication user.`
80
+ );
81
+ return;
82
+ }
83
+ if (newUrl !== remoteUrl) {
84
+ const updated = runGitCommand(["remote", "set-url", "origin", newUrl], `Set origin to ${newUrl}`);
85
+ if (updated) {
86
+ console.log(`[\u2713] Remote URL updated to: ${newUrl}`);
87
+ } else {
88
+ console.warn(`[!] Failed to update remote URL. Please update it manually if needed.`);
89
+ }
90
+ } else {
91
+ console.log(`[i] Remote URL does not use HTTPS or already contains the username.`);
92
+ }
93
+ } else {
94
+ console.log(`[i] Remote URL not changed. Use --update-remote to update automatically.`);
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ module.exports = {
101
+ configureGitUser
102
+ };
103
+ }
104
+ });
105
+
106
+ export {
107
+ require_user_config
108
+ };
@@ -0,0 +1,27 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_utils
4
+ } from "./chunk-EGSSKVDH.mjs";
5
+ import {
6
+ __commonJS,
7
+ init_esm_shims
8
+ } from "./chunk-AASHBCRW.mjs";
9
+
10
+ // src/git/pull-strategy.cjs
11
+ var require_pull_strategy = __commonJS({
12
+ "src/git/pull-strategy.cjs"(exports, module) {
13
+ init_esm_shims();
14
+ var { runGitCommand } = require_utils();
15
+ function setPullStrategy() {
16
+ console.log("\n=== Configuring Pull Strategy ===");
17
+ runGitCommand(["config", "pull.rebase", "false"], "Disable automatic rebase on pull");
18
+ }
19
+ module.exports = {
20
+ setPullStrategy
21
+ };
22
+ }
23
+ });
24
+
25
+ export {
26
+ require_pull_strategy
27
+ };
@@ -0,0 +1,81 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_gitattributes
4
+ } from "./chunk-JGR2NW6D.mjs";
5
+ import {
6
+ require_utils
7
+ } from "./chunk-EGSSKVDH.mjs";
8
+ import {
9
+ __commonJS,
10
+ __require,
11
+ init_esm_shims
12
+ } from "./chunk-AASHBCRW.mjs";
13
+
14
+ // src/git/line-endings.cjs
15
+ var require_line_endings = __commonJS({
16
+ "src/git/line-endings.cjs"(exports, module) {
17
+ init_esm_shims();
18
+ var path = __require("upath");
19
+ var fs = __require("fs");
20
+ var { runGitCommand } = require_utils();
21
+ var { updateGitAttributes } = require_gitattributes();
22
+ function forceLfLineEndings() {
23
+ console.log("\n=== Configuring LF Line Endings ===");
24
+ runGitCommand(["config", "core.autocrlf", "false"], "Disable automatic CRLF conversion");
25
+ runGitCommand(["config", "core.eol", "lf"], "Set end-of-line to LF");
26
+ const gitattributesPath = path.join(process.cwd(), ".gitattributes");
27
+ if (fs.existsSync(gitattributesPath)) {
28
+ let content = fs.readFileSync(gitattributesPath, "utf8");
29
+ if (!/^\*\s+text=auto\s+eol=lf/m.test(content)) {
30
+ content = `* text=auto eol=lf
31
+ ` + content;
32
+ fs.writeFileSync(gitattributesPath, content);
33
+ }
34
+ }
35
+ const desiredRules = [
36
+ { pattern: "*", attributes: "text=auto eol=lf", priority: 1 },
37
+ {
38
+ pattern: "*.{cmd,bat,ps1,sh,cmd1,cmd2,bat1,bat2,vbs}",
39
+ attributes: "text eol=crlf",
40
+ priority: 2
41
+ },
42
+ {
43
+ pattern: "*.{png,jpg,jpeg,gif,ico,svg,bmp,webp,avif,tiff,tif,psd,ai,eps,raw}",
44
+ attributes: "binary",
45
+ priority: 3
46
+ },
47
+ {
48
+ pattern: "*.{zip,tar,gz,7z,rar,exe,dll,so,bin,jar,war,ear,apk,msi,deb,rpm,iso,img,dmg,pdf,mp3,mp4,mov,avi,mkv,flv,wmv,ogg,webm,wav,aac,m4a,otf,ttf,woff,woff2,eot}",
49
+ attributes: "binary",
50
+ priority: 3
51
+ }
52
+ ];
53
+ const result = updateGitAttributes(gitattributesPath, desiredRules);
54
+ if (result.error) {
55
+ console.log(`[\u2717] Error updating .gitattributes: ${result.error}`);
56
+ return;
57
+ }
58
+ if (result.conflicts.length > 0) {
59
+ console.log("\n[!] Detected conflicts in .gitattributes:");
60
+ result.conflicts.forEach((conflict) => {
61
+ console.log(` ${conflict.pattern}: ${conflict.existing} -> ${conflict.proposed} (${conflict.action})`);
62
+ });
63
+ }
64
+ if (result.success) {
65
+ console.log(`[\u2713] ${result.message}:`);
66
+ result.changes.forEach((change) => {
67
+ console.log(` ${change.action}: ${change.pattern} ${change.attributes}`);
68
+ });
69
+ } else {
70
+ console.log(`[i] ${result.message}`);
71
+ }
72
+ }
73
+ module.exports = {
74
+ forceLfLineEndings
75
+ };
76
+ }
77
+ });
78
+
79
+ export {
80
+ require_line_endings
81
+ };