ccjk 12.0.0 → 12.0.2

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 (161) hide show
  1. package/dist/chunks/agent-teams.mjs +17 -18
  2. package/dist/chunks/agent.mjs +105 -102
  3. package/dist/chunks/agents.mjs +87 -77
  4. package/dist/chunks/api-cli.mjs +41 -27
  5. package/dist/chunks/api-providers.mjs +2 -4
  6. package/dist/chunks/api.mjs +22 -11
  7. package/dist/chunks/auto-bootstrap.mjs +3 -5
  8. package/dist/chunks/auto-init.mjs +3 -4
  9. package/dist/chunks/auto-updater.mjs +103 -91
  10. package/dist/chunks/banner.mjs +41 -42
  11. package/dist/chunks/boost.mjs +30 -31
  12. package/dist/chunks/ccjk-agents.mjs +6 -9
  13. package/dist/chunks/ccjk-all.mjs +703 -85
  14. package/dist/chunks/ccjk-config.mjs +6 -6
  15. package/dist/chunks/ccjk-hooks.mjs +20 -9
  16. package/dist/chunks/ccjk-mcp.mjs +64 -52
  17. package/dist/chunks/ccjk-setup.mjs +35 -25
  18. package/dist/chunks/ccjk-skills.mjs +51 -41
  19. package/dist/chunks/ccr.mjs +42 -32
  20. package/dist/chunks/ccu.mjs +16 -12
  21. package/dist/chunks/check-updates.mjs +30 -19
  22. package/dist/chunks/claude-code-config-manager.mjs +25 -10
  23. package/dist/chunks/claude-code-incremental-manager.mjs +65 -51
  24. package/dist/chunks/claude-config.mjs +2 -2
  25. package/dist/chunks/claude-wrapper.mjs +9 -6
  26. package/dist/chunks/cleanup-migration.mjs +1 -1
  27. package/dist/chunks/cli-hook.mjs +10 -3
  28. package/dist/chunks/cloud-sync.mjs +1 -1
  29. package/dist/chunks/codex-config-switch.mjs +58 -45
  30. package/dist/chunks/codex-provider-manager.mjs +29 -16
  31. package/dist/chunks/codex-uninstaller.mjs +5 -6
  32. package/dist/chunks/codex.mjs +89 -89
  33. package/dist/chunks/commands.mjs +28 -29
  34. package/dist/chunks/commands2.mjs +4 -3
  35. package/dist/chunks/commit.mjs +42 -23
  36. package/dist/chunks/completion.mjs +46 -47
  37. package/dist/chunks/config-consolidator.mjs +12 -13
  38. package/dist/chunks/config-switch.mjs +66 -53
  39. package/dist/chunks/config.mjs +10 -10
  40. package/dist/chunks/config2.mjs +53 -42
  41. package/dist/chunks/config3.mjs +107 -93
  42. package/dist/chunks/constants.mjs +2 -4
  43. package/dist/chunks/context-loader.mjs +5 -4
  44. package/dist/chunks/context.mjs +77 -76
  45. package/dist/chunks/convoy-manager.mjs +4 -4
  46. package/dist/chunks/dashboard.mjs +28 -29
  47. package/dist/chunks/doctor.mjs +68 -54
  48. package/dist/chunks/evolution.mjs +37 -38
  49. package/dist/chunks/features.mjs +103 -92
  50. package/dist/chunks/fs-operations.mjs +1 -1
  51. package/dist/chunks/health-alerts.mjs +1 -1
  52. package/dist/chunks/health-check.mjs +1 -1
  53. package/dist/chunks/help.mjs +117 -116
  54. package/dist/chunks/hook-installer.mjs +3 -2
  55. package/dist/chunks/index.mjs +20 -6
  56. package/dist/chunks/index10.mjs +1171 -0
  57. package/dist/chunks/index11.mjs +1008 -0
  58. package/dist/chunks/index12.mjs +193 -0
  59. package/dist/chunks/index13.mjs +218 -0
  60. package/dist/chunks/index14.mjs +663 -0
  61. package/dist/chunks/index2.mjs +19 -10
  62. package/dist/chunks/index3.mjs +19079 -164
  63. package/dist/chunks/index4.mjs +8 -1171
  64. package/dist/chunks/index5.mjs +7479 -884
  65. package/dist/chunks/index6.mjs +160 -184
  66. package/dist/chunks/index7.mjs +3573 -653
  67. package/dist/chunks/index8.mjs +19 -0
  68. package/dist/chunks/index9.mjs +616 -0
  69. package/dist/chunks/init.mjs +173 -173
  70. package/dist/chunks/installer.mjs +92 -82
  71. package/dist/chunks/installer2.mjs +3 -2
  72. package/dist/chunks/interview.mjs +118 -107
  73. package/dist/chunks/json-config.mjs +3 -2
  74. package/dist/chunks/linux.mjs +3863 -0
  75. package/dist/chunks/macos.mjs +69 -0
  76. package/dist/chunks/main.mjs +635 -0
  77. package/dist/chunks/marketplace.mjs +69 -66
  78. package/dist/chunks/mcp-cli.mjs +61 -48
  79. package/dist/chunks/mcp.mjs +140 -127
  80. package/dist/chunks/menu.mjs +85 -85
  81. package/dist/chunks/metrics-display.mjs +41 -40
  82. package/dist/chunks/migrator.mjs +4 -5
  83. package/dist/chunks/monitor.mjs +95 -95
  84. package/dist/chunks/notification.mjs +151 -141
  85. package/dist/chunks/onboarding.mjs +26 -15
  86. package/dist/chunks/package.mjs +1 -1
  87. package/dist/chunks/paradigm.mjs +24 -23
  88. package/dist/chunks/permission-manager.mjs +10 -11
  89. package/dist/chunks/permissions.mjs +72 -57
  90. package/dist/chunks/persistence-manager.mjs +97 -84
  91. package/dist/chunks/persistence.mjs +1 -1
  92. package/dist/chunks/platform.mjs +29 -29
  93. package/dist/chunks/plugin.mjs +104 -105
  94. package/dist/chunks/prompts.mjs +36 -25
  95. package/dist/chunks/providers.mjs +68 -69
  96. package/dist/chunks/quick-actions.mjs +71 -72
  97. package/dist/chunks/quick-provider.mjs +56 -40
  98. package/dist/chunks/quick-setup.mjs +71 -60
  99. package/dist/chunks/remote.mjs +21 -12
  100. package/dist/chunks/session.mjs +116 -103
  101. package/dist/chunks/sessions.mjs +29 -28
  102. package/dist/chunks/silent-updater.mjs +8 -10
  103. package/dist/chunks/simple-config.mjs +13 -10
  104. package/dist/chunks/skill.mjs +8560 -103
  105. package/dist/chunks/skills-sync.mjs +5212 -79
  106. package/dist/chunks/skills.mjs +105 -94
  107. package/dist/chunks/slash-commands.mjs +36 -37
  108. package/dist/chunks/smart-defaults.mjs +7 -3
  109. package/dist/chunks/smart-guide.mjs +1 -1
  110. package/dist/chunks/startup.mjs +2 -4
  111. package/dist/chunks/stats.mjs +41 -42
  112. package/dist/chunks/status.mjs +49 -50
  113. package/dist/chunks/team.mjs +24 -12
  114. package/dist/chunks/thinking.mjs +74 -63
  115. package/dist/chunks/trace.mjs +20 -19
  116. package/dist/chunks/uninstall.mjs +69 -56
  117. package/dist/chunks/update.mjs +39 -28
  118. package/dist/chunks/upgrade-manager.mjs +24 -18
  119. package/dist/chunks/version-checker.mjs +45 -41
  120. package/dist/chunks/vim.mjs +81 -69
  121. package/dist/chunks/windows.mjs +14 -0
  122. package/dist/chunks/workflows.mjs +15 -15
  123. package/dist/chunks/wsl.mjs +129 -0
  124. package/dist/chunks/zero-config.mjs +45 -34
  125. package/dist/cli.mjs +20 -20
  126. package/dist/index.mjs +41 -31
  127. package/dist/shared/ccjk.BAGoDD49.mjs +36 -0
  128. package/dist/shared/ccjk.BBtCGd_g.mjs +899 -0
  129. package/dist/shared/{ccjk.CGcy7cNM.mjs → ccjk.BDKUdmLk.mjs} +1 -1
  130. package/dist/shared/{ccjk.DtMBiwVG.mjs → ccjk.BFxsJM0k.mjs} +1 -1
  131. package/dist/shared/{ccjk.j4uut26D.mjs → ccjk.BIxuVL3_.mjs} +5 -5
  132. package/dist/shared/ccjk.BRZ9ww8S.mjs +142 -0
  133. package/dist/shared/{ccjk.CN0edl87.mjs → ccjk.BSYWk9ML.mjs} +1 -1
  134. package/dist/shared/{ccjk.Dk1HDseQ.mjs → ccjk.BnpWvs9V.mjs} +75 -75
  135. package/dist/shared/ccjk.BoApaI4j.mjs +28 -0
  136. package/dist/shared/{ccjk.DKojSRzw.mjs → ccjk.BrPUmTqm.mjs} +1 -1
  137. package/dist/shared/{ccjk.C10pepYx.mjs → ccjk.BxSmJ8B7.mjs} +1 -1
  138. package/dist/shared/ccjk.Bx_rmYfN.mjs +69 -0
  139. package/dist/shared/ccjk.COweQ1RR.mjs +5 -0
  140. package/dist/shared/{ccjk.BN90X6oc.mjs → ccjk.CePkJq2S.mjs} +17 -17
  141. package/dist/shared/{ccjk.Bvoex4TZ.mjs → ccjk.CfKKcvWy.mjs} +1 -1
  142. package/dist/shared/ccjk.Cjgrln_h.mjs +297 -0
  143. package/dist/shared/ccjk.CxpGa6MC.mjs +2724 -0
  144. package/dist/shared/{ccjk.DfwJOEok.mjs → ccjk.D5MFQT7w.mjs} +1 -1
  145. package/dist/shared/{ccjk.cChAaGgT.mjs → ccjk.DG_o24cZ.mjs} +6 -6
  146. package/dist/shared/{ccjk.bhFAMRyc.mjs → ccjk.DLLw-h4Y.mjs} +32 -32
  147. package/dist/shared/ccjk.DOwtZMk8.mjs +4019 -0
  148. package/dist/shared/{ccjk.BsXQugfY.mjs → ccjk.DTdjs-qK.mjs} +13 -13
  149. package/dist/shared/{ccjk.Bdhyg3X-.mjs → ccjk.DsYaCCx4.mjs} +1 -1
  150. package/dist/shared/ccjk.KfSWcGlE.mjs +38 -0
  151. package/dist/shared/ccjk.RyizuzOI.mjs +21 -0
  152. package/dist/shared/{ccjk.h7_W-wTs.mjs → ccjk.SPoXMvZD.mjs} +1 -1
  153. package/dist/shared/ccjk.T_cX87dY.mjs +15 -0
  154. package/dist/shared/{ccjk.CrB6OYHv.mjs → ccjk._dESH4Rk.mjs} +2 -2
  155. package/dist/shared/ccjk.bQ7Dh1g4.mjs +249 -0
  156. package/dist/shared/{ccjk.CBhIZiPz.mjs → ccjk.hoqrwWdN.mjs} +1 -1
  157. package/dist/shared/{ccjk.BNwRnWYx.mjs → ccjk.s7OCVzdd.mjs} +1230 -33
  158. package/dist/shared/{ccjk.BOIUTf5z.mjs → ccjk.waa2ikKJ.mjs} +8 -9
  159. package/package.json +31 -30
  160. package/dist/shared/ccjk.DHbrGcgg.mjs +0 -13
  161. package/dist/shared/ccjk.DntgA8fQ.mjs +0 -42
@@ -0,0 +1,69 @@
1
+ import os__default from 'node:os';
2
+ import fs__default from 'node:fs';
3
+ import path__default from 'node:path';
4
+ import process__default from 'node:process';
5
+ import { m as moveFile } from '../shared/ccjk.Bx_rmYfN.mjs';
6
+ import { c as chunkedExec } from '../shared/ccjk.T_cX87dY.mjs';
7
+ import 'node:util';
8
+ import 'node:child_process';
9
+ import 'node:url';
10
+ import '../shared/ccjk.KfSWcGlE.mjs';
11
+
12
+ const isOlderThanMountainLion = Number(os__default.release().split('.')[0]) < 12;
13
+
14
+ // Binary source: https://github.com/sindresorhus/macos-trash
15
+ const binary = new URL('macos-trash', import.meta.url);
16
+
17
+ async function macOS(paths) {
18
+ if (isOlderThanMountainLion) {
19
+ throw new Error('macOS 10.12 or later required');
20
+ }
21
+
22
+ try {
23
+ await chunkedExec(binary, paths, 1000);
24
+ } catch (error) {
25
+ const message = String(error?.stderr || error?.message || '');
26
+ const shouldFallback = message.includes('couldn’t be moved to the trash because you don’t have permission')
27
+ || process__default.env.TRASH_FALLBACK === '1';
28
+
29
+ if (!shouldFallback) {
30
+ throw error;
31
+ }
32
+
33
+ // Fallback: move to user's Trash folder when the binary cannot run due to permissions.
34
+ const trashDirectories = [
35
+ path__default.join(os__default.homedir(), '.Trash'),
36
+ path__default.join(process__default.cwd(), '.Trash'),
37
+ ];
38
+
39
+ await Promise.all(paths.map(async filePath => {
40
+ const base = path__default.basename(filePath);
41
+ let lastError;
42
+
43
+ /* eslint-disable no-await-in-loop */
44
+ for (const dir of trashDirectories) {
45
+ try {
46
+ await fs__default.promises.mkdir(dir, {recursive: true});
47
+ let destination = path__default.join(dir, base);
48
+ let counter = 1;
49
+
50
+ while (fs__default.existsSync(destination)) {
51
+ destination = path__default.join(dir, `${base} ${counter++}`);
52
+ }
53
+
54
+ await moveFile(filePath, destination, {overwrite: false});
55
+ return;
56
+ } catch (error_) {
57
+ lastError = error_;
58
+ }
59
+ }
60
+ /* eslint-enable no-await-in-loop */
61
+
62
+ if (lastError) {
63
+ throw lastError;
64
+ }
65
+ }));
66
+ }
67
+ }
68
+
69
+ export { macOS as default };
@@ -0,0 +1,635 @@
1
+ import { createRequire } from 'module';
2
+ import { spawn } from 'node:child_process';
3
+ import { normalize, delimiter, resolve, dirname } from 'node:path';
4
+ import { cwd } from 'node:process';
5
+ import { PassThrough } from 'node:stream';
6
+ import readline__default from 'node:readline';
7
+
8
+ var l = Object.create;
9
+ var u = Object.defineProperty;
10
+ var d = Object.getOwnPropertyDescriptor;
11
+ var f = Object.getOwnPropertyNames;
12
+ var p = Object.getPrototypeOf;
13
+ var m = Object.prototype.hasOwnProperty;
14
+ var h = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
15
+ var g = (e, t, n, r) => {
16
+ if (t && typeof t === "object" || typeof t === "function") for (var i = f(t), a = 0, o = i.length, s; a < o; a++) {
17
+ s = i[a];
18
+ if (!m.call(e, s) && s !== n) u(e, s, {
19
+ get: ((e) => t[e]).bind(null, s),
20
+ enumerable: !(r = d(t, s)) || r.enumerable
21
+ });
22
+ }
23
+ return e;
24
+ };
25
+ var _ = (e, t, n) => (n = e != null ? l(p(e)) : {}, g(u(n, "default", {
26
+ value: e,
27
+ enumerable: true
28
+ }) , e));
29
+ var v = /* @__PURE__ */ createRequire(import.meta.url);
30
+ const y = /^path$/i;
31
+ const b = {
32
+ key: "PATH",
33
+ value: ""
34
+ };
35
+ function x(e) {
36
+ for (const t in e) {
37
+ if (!Object.prototype.hasOwnProperty.call(e, t) || !y.test(t)) continue;
38
+ const n = e[t];
39
+ if (!n) return b;
40
+ return {
41
+ key: t,
42
+ value: n
43
+ };
44
+ }
45
+ return b;
46
+ }
47
+ function S(e, t) {
48
+ const i = t.value.split(delimiter);
49
+ let o = e;
50
+ let s;
51
+ do {
52
+ i.push(resolve(o, "node_modules", ".bin"));
53
+ s = o;
54
+ o = dirname(o);
55
+ } while (o !== s);
56
+ return {
57
+ key: t.key,
58
+ value: i.join(delimiter)
59
+ };
60
+ }
61
+ function C(e, t) {
62
+ const n = {
63
+ ...process.env,
64
+ ...t
65
+ };
66
+ const r = S(e, x(n));
67
+ n[r.key] = r.value;
68
+ return n;
69
+ }
70
+ const w = (e) => {
71
+ let t = e.length;
72
+ const n = new PassThrough();
73
+ const r = () => {
74
+ if (--t === 0) n.emit("end");
75
+ };
76
+ for (const t of e) {
77
+ t.pipe(n, { end: false });
78
+ t.on("end", r);
79
+ }
80
+ return n;
81
+ };
82
+ var T = h((exports, t) => {
83
+ t.exports = a;
84
+ a.sync = o;
85
+ var n = v("fs");
86
+ function r(e, t) {
87
+ var n = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT;
88
+ if (!n) return true;
89
+ n = n.split(";");
90
+ if (n.indexOf("") !== -1) return true;
91
+ for (var r = 0; r < n.length; r++) {
92
+ var i = n[r].toLowerCase();
93
+ if (i && e.substr(-i.length).toLowerCase() === i) return true;
94
+ }
95
+ return false;
96
+ }
97
+ function i(e, t, n) {
98
+ if (!e.isSymbolicLink() && !e.isFile()) return false;
99
+ return r(t, n);
100
+ }
101
+ function a(e, t, r) {
102
+ n.stat(e, function(n, a) {
103
+ r(n, n ? false : i(a, e, t));
104
+ });
105
+ }
106
+ function o(e, t) {
107
+ return i(n.statSync(e), e, t);
108
+ }
109
+ });
110
+ var E = h((exports, t) => {
111
+ t.exports = r;
112
+ r.sync = i;
113
+ var n = v("fs");
114
+ function r(e, t, r) {
115
+ n.stat(e, function(e, n) {
116
+ r(e, e ? false : a(n, t));
117
+ });
118
+ }
119
+ function i(e, t) {
120
+ return a(n.statSync(e), t);
121
+ }
122
+ function a(e, t) {
123
+ return e.isFile() && o(e, t);
124
+ }
125
+ function o(e, t) {
126
+ var n = e.mode;
127
+ var r = e.uid;
128
+ var i = e.gid;
129
+ var a = t.uid !== void 0 ? t.uid : process.getuid && process.getuid();
130
+ var o = t.gid !== void 0 ? t.gid : process.getgid && process.getgid();
131
+ var s = parseInt("100", 8);
132
+ var c = parseInt("010", 8);
133
+ var l = parseInt("001", 8);
134
+ var u = s | c;
135
+ var d = n & l || n & c && i === o || n & s && r === a || n & u && a === 0;
136
+ return d;
137
+ }
138
+ });
139
+ var D = h((exports, t) => {
140
+ v("fs");
141
+ var r;
142
+ if (process.platform === "win32" || global.TESTING_WINDOWS) r = T();
143
+ else r = E();
144
+ t.exports = i;
145
+ i.sync = a;
146
+ function i(e, t, n) {
147
+ if (typeof t === "function") {
148
+ n = t;
149
+ t = {};
150
+ }
151
+ if (!n) {
152
+ if (typeof Promise !== "function") throw new TypeError("callback not provided");
153
+ return new Promise(function(n, r) {
154
+ i(e, t || {}, function(e, t) {
155
+ if (e) r(e);
156
+ else n(t);
157
+ });
158
+ });
159
+ }
160
+ r(e, t || {}, function(e, r) {
161
+ if (e) {
162
+ if (e.code === "EACCES" || t && t.ignoreErrors) {
163
+ e = null;
164
+ r = false;
165
+ }
166
+ }
167
+ n(e, r);
168
+ });
169
+ }
170
+ function a(e, t) {
171
+ try {
172
+ return r.sync(e, t || {});
173
+ } catch (e) {
174
+ if (t && t.ignoreErrors || e.code === "EACCES") return false;
175
+ else throw e;
176
+ }
177
+ }
178
+ });
179
+ var O = h((exports, t) => {
180
+ const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
181
+ const r = v("path");
182
+ const i = n ? ";" : ":";
183
+ const a = D();
184
+ const o = (e) => Object.assign(new Error(`not found: ${e}`), { code: "ENOENT" });
185
+ const s = (e, t) => {
186
+ const r = t.colon || i;
187
+ const a = e.match(/\//) || n && e.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t.path || process.env.PATH || "").split(r)];
188
+ const o = n ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
189
+ const s = n ? o.split(r) : [""];
190
+ if (n) {
191
+ if (e.indexOf(".") !== -1 && s[0] !== "") s.unshift("");
192
+ }
193
+ return {
194
+ pathEnv: a,
195
+ pathExt: s,
196
+ pathExtExe: o
197
+ };
198
+ };
199
+ const c = (e, t, n) => {
200
+ if (typeof t === "function") {
201
+ n = t;
202
+ t = {};
203
+ }
204
+ if (!t) t = {};
205
+ const { pathEnv: i, pathExt: c, pathExtExe: l } = s(e, t);
206
+ const u = [];
207
+ const d = (n) => new Promise((a, s) => {
208
+ if (n === i.length) return t.all && u.length ? a(u) : s(o(e));
209
+ const c = i[n];
210
+ const l = /^".*"$/.test(c) ? c.slice(1, -1) : c;
211
+ const d = r.join(l, e);
212
+ const p = !l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
213
+ a(f(p, n, 0));
214
+ });
215
+ const f = (e, n, r) => new Promise((i, o) => {
216
+ if (r === c.length) return i(d(n + 1));
217
+ const s = c[r];
218
+ a(e + s, { pathExt: l }, (a, o) => {
219
+ if (!a && o) if (t.all) u.push(e + s);
220
+ else return i(e + s);
221
+ return i(f(e, n, r + 1));
222
+ });
223
+ });
224
+ return n ? d(0).then((e) => n(null, e), n) : d(0);
225
+ };
226
+ const l = (e, t) => {
227
+ t = t || {};
228
+ const { pathEnv: n, pathExt: i, pathExtExe: c } = s(e, t);
229
+ const l = [];
230
+ for (let o = 0; o < n.length; o++) {
231
+ const s = n[o];
232
+ const u = /^".*"$/.test(s) ? s.slice(1, -1) : s;
233
+ const d = r.join(u, e);
234
+ const f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
235
+ for (let e = 0; e < i.length; e++) {
236
+ const n = f + i[e];
237
+ try {
238
+ const e = a.sync(n, { pathExt: c });
239
+ if (e) if (t.all) l.push(n);
240
+ else return n;
241
+ } catch (e) {}
242
+ }
243
+ }
244
+ if (t.all && l.length) return l;
245
+ if (t.nothrow) return null;
246
+ throw o(e);
247
+ };
248
+ t.exports = c;
249
+ c.sync = l;
250
+ });
251
+ var k = h((exports, t) => {
252
+ const n = (e = {}) => {
253
+ const t = e.env || process.env;
254
+ const n = e.platform || process.platform;
255
+ if (n !== "win32") return "PATH";
256
+ return Object.keys(t).reverse().find((e) => e.toUpperCase() === "PATH") || "Path";
257
+ };
258
+ t.exports = n;
259
+ t.exports.default = n;
260
+ });
261
+ var A = h((exports, t) => {
262
+ const n = v("path");
263
+ const r = O();
264
+ const i = k();
265
+ function a(e, t) {
266
+ const a = e.options.env || process.env;
267
+ const o = process.cwd();
268
+ const s = e.options.cwd != null;
269
+ const c = s && process.chdir !== void 0 && !process.chdir.disabled;
270
+ if (c) try {
271
+ process.chdir(e.options.cwd);
272
+ } catch (e) {}
273
+ let l;
274
+ try {
275
+ l = r.sync(e.command, {
276
+ path: a[i({ env: a })],
277
+ pathExt: t ? n.delimiter : void 0
278
+ });
279
+ } catch (e) {} finally {
280
+ if (c) process.chdir(o);
281
+ }
282
+ if (l) l = n.resolve(s ? e.options.cwd : "", l);
283
+ return l;
284
+ }
285
+ function o(e) {
286
+ return a(e) || a(e, true);
287
+ }
288
+ t.exports = o;
289
+ });
290
+ var j = h((exports, t) => {
291
+ const n = /([()\][%!^"`<>&|;, *?])/g;
292
+ function r(e) {
293
+ e = e.replace(n, "^$1");
294
+ return e;
295
+ }
296
+ function i(e, t) {
297
+ e = `${e}`;
298
+ e = e.replace(/(\\*)"/g, "$1$1\\\"");
299
+ e = e.replace(/(\\*)$/, "$1$1");
300
+ e = `"${e}"`;
301
+ e = e.replace(n, "^$1");
302
+ if (t) e = e.replace(n, "^$1");
303
+ return e;
304
+ }
305
+ t.exports.command = r;
306
+ t.exports.argument = i;
307
+ });
308
+ var M = h((exports, t) => {
309
+ t.exports = /^#!(.*)/;
310
+ });
311
+ var N = h((exports, t) => {
312
+ const n = M();
313
+ t.exports = (e = "") => {
314
+ const t = e.match(n);
315
+ if (!t) return null;
316
+ const [r, i] = t[0].replace(/#! ?/, "").split(" ");
317
+ const a = r.split("/").pop();
318
+ if (a === "env") return i;
319
+ return i ? `${a} ${i}` : a;
320
+ };
321
+ });
322
+ var P = h((exports, t) => {
323
+ const n = v("fs");
324
+ const r = N();
325
+ function i(e) {
326
+ const t = 150;
327
+ const i = Buffer.alloc(t);
328
+ let a;
329
+ try {
330
+ a = n.openSync(e, "r");
331
+ n.readSync(a, i, 0, t, 0);
332
+ n.closeSync(a);
333
+ } catch (e) {}
334
+ return r(i.toString());
335
+ }
336
+ t.exports = i;
337
+ });
338
+ var F = h((exports, t) => {
339
+ const n = v("path");
340
+ const r = A();
341
+ const i = j();
342
+ const a = P();
343
+ const o = process.platform === "win32";
344
+ const s = /\.(?:com|exe)$/i;
345
+ const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
346
+ function l(e) {
347
+ e.file = r(e);
348
+ const t = e.file && a(e.file);
349
+ if (t) {
350
+ e.args.unshift(e.file);
351
+ e.command = t;
352
+ return r(e);
353
+ }
354
+ return e.file;
355
+ }
356
+ function u(e) {
357
+ if (!o) return e;
358
+ const t = l(e);
359
+ const r = !s.test(t);
360
+ if (e.options.forceShell || r) {
361
+ const r = c.test(t);
362
+ e.command = n.normalize(e.command);
363
+ e.command = i.command(e.command);
364
+ e.args = e.args.map((e) => i.argument(e, r));
365
+ const a = [e.command].concat(e.args).join(" ");
366
+ e.args = [
367
+ "/d",
368
+ "/s",
369
+ "/c",
370
+ `"${a}"`
371
+ ];
372
+ e.command = process.env.comspec || "cmd.exe";
373
+ e.options.windowsVerbatimArguments = true;
374
+ }
375
+ return e;
376
+ }
377
+ function d(e, t, n) {
378
+ if (t && !Array.isArray(t)) {
379
+ n = t;
380
+ t = null;
381
+ }
382
+ t = t ? t.slice(0) : [];
383
+ n = Object.assign({}, n);
384
+ const r = {
385
+ command: e,
386
+ args: t,
387
+ options: n,
388
+ file: void 0,
389
+ original: {
390
+ command: e,
391
+ args: t
392
+ }
393
+ };
394
+ return n.shell ? r : u(r);
395
+ }
396
+ t.exports = d;
397
+ });
398
+ var I = h((exports, t) => {
399
+ const n = process.platform === "win32";
400
+ function r(e, t) {
401
+ return Object.assign(new Error(`${t} ${e.command} ENOENT`), {
402
+ code: "ENOENT",
403
+ errno: "ENOENT",
404
+ syscall: `${t} ${e.command}`,
405
+ path: e.command,
406
+ spawnargs: e.args
407
+ });
408
+ }
409
+ function i(e, t) {
410
+ if (!n) return;
411
+ const r = e.emit;
412
+ e.emit = function(n, i) {
413
+ if (n === "exit") {
414
+ const n = a(i, t);
415
+ if (n) return r.call(e, "error", n);
416
+ }
417
+ return r.apply(e, arguments);
418
+ };
419
+ }
420
+ function a(e, t) {
421
+ if (n && e === 1 && !t.file) return r(t.original, "spawn");
422
+ return null;
423
+ }
424
+ function o(e, t) {
425
+ if (n && e === 1 && !t.file) return r(t.original, "spawnSync");
426
+ return null;
427
+ }
428
+ t.exports = {
429
+ hookChildProcess: i,
430
+ verifyENOENT: a,
431
+ verifyENOENTSync: o,
432
+ notFoundError: r
433
+ };
434
+ });
435
+ var L = h((exports, t) => {
436
+ const n = v("child_process");
437
+ const r = F();
438
+ const i = I();
439
+ function a(e, t, a) {
440
+ const o = r(e, t, a);
441
+ const s = n.spawn(o.command, o.args, o.options);
442
+ i.hookChildProcess(s, o);
443
+ return s;
444
+ }
445
+ function o(e, t, a) {
446
+ const o = r(e, t, a);
447
+ const s = n.spawnSync(o.command, o.args, o.options);
448
+ s.error = s.error || i.verifyENOENTSync(s.status, o);
449
+ return s;
450
+ }
451
+ t.exports = a;
452
+ t.exports.spawn = a;
453
+ t.exports.sync = o;
454
+ t.exports._parse = r;
455
+ t.exports._enoent = i;
456
+ });
457
+ var R = _(L());
458
+ var z = class extends Error {
459
+ result;
460
+ output;
461
+ get exitCode() {
462
+ if (this.result.exitCode !== null) return this.result.exitCode;
463
+ return void 0;
464
+ }
465
+ constructor(e, t) {
466
+ super(`Process exited with non-zero status (${e.exitCode})`);
467
+ this.result = e;
468
+ this.output = t;
469
+ }
470
+ };
471
+ const B = {
472
+ timeout: void 0,
473
+ persist: false
474
+ };
475
+ const V = { windowsHide: true };
476
+ function H(e, t) {
477
+ const n = normalize(e);
478
+ const r = t ?? [];
479
+ return {
480
+ command: n,
481
+ args: r
482
+ };
483
+ }
484
+ function U(e) {
485
+ const t = new AbortController();
486
+ for (const n of e) {
487
+ if (n.aborted) {
488
+ t.abort();
489
+ return n;
490
+ }
491
+ const e = () => {
492
+ t.abort(n.reason);
493
+ };
494
+ n.addEventListener("abort", e, { signal: t.signal });
495
+ }
496
+ return t.signal;
497
+ }
498
+ async function W(e) {
499
+ let t = "";
500
+ for await (const n of e) t += n.toString();
501
+ return t;
502
+ }
503
+ var G = class {
504
+ _process;
505
+ _aborted = false;
506
+ _options;
507
+ _command;
508
+ _args;
509
+ _resolveClose;
510
+ _processClosed;
511
+ _thrownError;
512
+ get process() {
513
+ return this._process;
514
+ }
515
+ get pid() {
516
+ return this._process?.pid;
517
+ }
518
+ get exitCode() {
519
+ if (this._process && this._process.exitCode !== null) return this._process.exitCode;
520
+ return void 0;
521
+ }
522
+ constructor(e, t, n) {
523
+ this._options = {
524
+ ...B,
525
+ ...n
526
+ };
527
+ this._command = e;
528
+ this._args = t ?? [];
529
+ this._processClosed = new Promise((e) => {
530
+ this._resolveClose = e;
531
+ });
532
+ }
533
+ kill(e) {
534
+ return this._process?.kill(e) === true;
535
+ }
536
+ get aborted() {
537
+ return this._aborted;
538
+ }
539
+ get killed() {
540
+ return this._process?.killed === true;
541
+ }
542
+ pipe(e, t, n) {
543
+ return q(e, t, {
544
+ ...n,
545
+ stdin: this
546
+ });
547
+ }
548
+ async *[Symbol.asyncIterator]() {
549
+ const e = this._process;
550
+ if (!e) return;
551
+ const t = [];
552
+ if (this._streamErr) t.push(this._streamErr);
553
+ if (this._streamOut) t.push(this._streamOut);
554
+ const n = w(t);
555
+ const r = readline__default.createInterface({ input: n });
556
+ for await (const e of r) yield e.toString();
557
+ await this._processClosed;
558
+ e.removeAllListeners();
559
+ if (this._thrownError) throw this._thrownError;
560
+ if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this);
561
+ }
562
+ async _waitForOutput() {
563
+ const e = this._process;
564
+ if (!e) throw new Error("No process was started");
565
+ const [t, n] = await Promise.all([this._streamOut ? W(this._streamOut) : "", this._streamErr ? W(this._streamErr) : ""]);
566
+ await this._processClosed;
567
+ if (this._options?.stdin) await this._options.stdin;
568
+ e.removeAllListeners();
569
+ if (this._thrownError) throw this._thrownError;
570
+ const r = {
571
+ stderr: n,
572
+ stdout: t,
573
+ exitCode: this.exitCode
574
+ };
575
+ if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this, r);
576
+ return r;
577
+ }
578
+ then(e, t) {
579
+ return this._waitForOutput().then(e, t);
580
+ }
581
+ _streamOut;
582
+ _streamErr;
583
+ spawn() {
584
+ const e = cwd();
585
+ const n = this._options;
586
+ const r = {
587
+ ...V,
588
+ ...n.nodeOptions
589
+ };
590
+ const i = [];
591
+ this._resetState();
592
+ if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
593
+ if (n.signal !== void 0) i.push(n.signal);
594
+ if (n.persist === true) r.detached = true;
595
+ if (i.length > 0) r.signal = U(i);
596
+ r.env = C(e, r.env);
597
+ const { command: a, args: s } = H(this._command, this._args);
598
+ const c = (0, R._parse)(a, s, r);
599
+ const l = spawn(c.command, c.args, c.options);
600
+ if (l.stderr) this._streamErr = l.stderr;
601
+ if (l.stdout) this._streamOut = l.stdout;
602
+ this._process = l;
603
+ l.once("error", this._onError);
604
+ l.once("close", this._onClose);
605
+ if (n.stdin !== void 0 && l.stdin && n.stdin.process) {
606
+ const { stdout: e } = n.stdin.process;
607
+ if (e) e.pipe(l.stdin);
608
+ }
609
+ }
610
+ _resetState() {
611
+ this._aborted = false;
612
+ this._processClosed = new Promise((e) => {
613
+ this._resolveClose = e;
614
+ });
615
+ this._thrownError = void 0;
616
+ }
617
+ _onError = (e) => {
618
+ if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {
619
+ this._aborted = true;
620
+ return;
621
+ }
622
+ this._thrownError = e;
623
+ };
624
+ _onClose = () => {
625
+ if (this._resolveClose) this._resolveClose();
626
+ };
627
+ };
628
+ const K = (e, t, n) => {
629
+ const r = new G(e, t, n);
630
+ r.spawn();
631
+ return r;
632
+ };
633
+ const q = K;
634
+
635
+ export { G as ExecProcess, z as NonZeroExitError, q as exec, K as x };