maxsimcli 5.0.7 → 5.1.0

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 (91) hide show
  1. package/README.md +101 -99
  2. package/dist/assets/CHANGELOG.md +7 -0
  3. package/dist/assets/hooks/maxsim-capture-learnings.cjs +128 -0
  4. package/dist/assets/hooks/maxsim-capture-learnings.cjs.map +1 -0
  5. package/dist/assets/hooks/maxsim-check-update.cjs +126 -88
  6. package/dist/assets/hooks/maxsim-check-update.cjs.map +1 -1
  7. package/dist/assets/hooks/maxsim-notification-sound.cjs +87 -43
  8. package/dist/assets/hooks/maxsim-notification-sound.cjs.map +1 -1
  9. package/dist/assets/hooks/maxsim-statusline.cjs +45 -171
  10. package/dist/assets/hooks/maxsim-statusline.cjs.map +1 -1
  11. package/dist/assets/hooks/maxsim-stop-sound.cjs +86 -43
  12. package/dist/assets/hooks/maxsim-stop-sound.cjs.map +1 -1
  13. package/dist/assets/hooks/maxsim-sync-reminder.cjs +72 -21
  14. package/dist/assets/hooks/maxsim-sync-reminder.cjs.map +1 -1
  15. package/dist/assets/templates/agents/AGENTS.md +62 -51
  16. package/dist/assets/templates/agents/executor.md +44 -59
  17. package/dist/assets/templates/agents/planner.md +36 -31
  18. package/dist/assets/templates/agents/researcher.md +35 -43
  19. package/dist/assets/templates/agents/verifier.md +29 -31
  20. package/dist/assets/templates/commands/maxsim/debug.md +20 -154
  21. package/dist/assets/templates/commands/maxsim/execute.md +19 -33
  22. package/dist/assets/templates/commands/maxsim/go.md +21 -20
  23. package/dist/assets/templates/commands/maxsim/help.md +5 -14
  24. package/dist/assets/templates/commands/maxsim/init.md +18 -40
  25. package/dist/assets/templates/commands/maxsim/plan.md +22 -37
  26. package/dist/assets/templates/commands/maxsim/progress.md +15 -16
  27. package/dist/assets/templates/commands/maxsim/quick.md +18 -29
  28. package/dist/assets/templates/commands/maxsim/settings.md +18 -26
  29. package/dist/assets/templates/references/continuation-format.md +2 -4
  30. package/dist/assets/templates/references/model-profiles.md +2 -2
  31. package/dist/assets/templates/references/planning-config.md +10 -11
  32. package/dist/assets/templates/references/self-improvement.md +120 -0
  33. package/dist/assets/templates/rules/conventions.md +1 -1
  34. package/dist/assets/templates/rules/verification-protocol.md +1 -1
  35. package/dist/assets/templates/skills/brainstorming/SKILL.md +35 -26
  36. package/dist/assets/templates/skills/code-review/SKILL.md +78 -55
  37. package/dist/assets/templates/skills/commit-conventions/SKILL.md +70 -36
  38. package/dist/assets/templates/skills/github-operations/SKILL.md +142 -0
  39. package/dist/assets/templates/skills/handoff-contract/SKILL.md +62 -28
  40. package/dist/assets/templates/skills/maxsim-batch/SKILL.md +68 -42
  41. package/dist/assets/templates/skills/maxsim-simplify/SKILL.md +65 -40
  42. package/dist/assets/templates/skills/project-memory/SKILL.md +121 -0
  43. package/dist/assets/templates/skills/research/SKILL.md +126 -0
  44. package/dist/assets/templates/skills/roadmap-writing/SKILL.md +71 -68
  45. package/dist/assets/templates/skills/systematic-debugging/SKILL.md +37 -25
  46. package/dist/assets/templates/skills/tdd/SKILL.md +36 -39
  47. package/dist/assets/templates/skills/using-maxsim/SKILL.md +69 -55
  48. package/dist/assets/templates/skills/verification/SKILL.md +167 -0
  49. package/dist/assets/templates/workflows/batch.md +249 -268
  50. package/dist/assets/templates/workflows/diagnose-issues.md +225 -151
  51. package/dist/assets/templates/workflows/execute-plan.md +191 -981
  52. package/dist/assets/templates/workflows/execute.md +350 -309
  53. package/dist/assets/templates/workflows/go.md +119 -138
  54. package/dist/assets/templates/workflows/health.md +71 -114
  55. package/dist/assets/templates/workflows/help.md +85 -147
  56. package/dist/assets/templates/workflows/init-existing.md +180 -1373
  57. package/dist/assets/templates/workflows/init.md +53 -165
  58. package/dist/assets/templates/workflows/new-milestone.md +91 -334
  59. package/dist/assets/templates/workflows/new-project.md +165 -1384
  60. package/dist/assets/templates/workflows/plan-create.md +182 -73
  61. package/dist/assets/templates/workflows/plan-discuss.md +89 -82
  62. package/dist/assets/templates/workflows/plan-research.md +191 -85
  63. package/dist/assets/templates/workflows/plan.md +122 -58
  64. package/dist/assets/templates/workflows/progress.md +76 -310
  65. package/dist/assets/templates/workflows/quick.md +70 -495
  66. package/dist/assets/templates/workflows/sdd.md +231 -221
  67. package/dist/assets/templates/workflows/settings.md +90 -120
  68. package/dist/assets/templates/workflows/verify-phase.md +296 -258
  69. package/dist/cli.cjs +17 -23465
  70. package/dist/cli.cjs.map +1 -1
  71. package/dist/install.cjs +356 -8358
  72. package/dist/install.cjs.map +1 -1
  73. package/package.json +16 -22
  74. package/dist/assets/templates/skills/agent-system-map/SKILL.md +0 -92
  75. package/dist/assets/templates/skills/evidence-collection/SKILL.md +0 -87
  76. package/dist/assets/templates/skills/github-artifact-protocol/SKILL.md +0 -67
  77. package/dist/assets/templates/skills/github-tools-guide/SKILL.md +0 -89
  78. package/dist/assets/templates/skills/input-validation/SKILL.md +0 -51
  79. package/dist/assets/templates/skills/memory-management/SKILL.md +0 -75
  80. package/dist/assets/templates/skills/research-methodology/SKILL.md +0 -137
  81. package/dist/assets/templates/skills/sdd/SKILL.md +0 -91
  82. package/dist/assets/templates/skills/tool-priority-guide/SKILL.md +0 -80
  83. package/dist/assets/templates/skills/verification-before-completion/SKILL.md +0 -71
  84. package/dist/assets/templates/skills/verification-gates/SKILL.md +0 -169
  85. package/dist/assets/templates/workflows/discuss-phase.md +0 -683
  86. package/dist/assets/templates/workflows/research-phase.md +0 -73
  87. package/dist/assets/templates/workflows/verify-work.md +0 -572
  88. package/dist/core-D5zUr9cb.cjs +0 -4305
  89. package/dist/core-D5zUr9cb.cjs.map +0 -1
  90. package/dist/skills-CjFWZIGM.cjs +0 -6824
  91. package/dist/skills-CjFWZIGM.cjs.map +0 -1
@@ -1,4305 +0,0 @@
1
- #!/usr/bin/env node
2
- const require_install = require('./install.cjs');
3
- let node_fs = require("node:fs");
4
- node_fs = require_install.__toESM(node_fs);
5
- let node_path = require("node:path");
6
- node_path = require_install.__toESM(node_path);
7
- let node_os = require("node:os");
8
- node_os = require_install.__toESM(node_os);
9
- let child_process = require("child_process");
10
- let node_buffer = require("node:buffer");
11
- require("node:events");
12
-
13
- //#region ../../node_modules/ms/index.js
14
- var require_ms = /* @__PURE__ */ require_install.__commonJSMin(((exports, module) => {
15
- /**
16
- * Helpers.
17
- */
18
- var s = 1e3;
19
- var m = s * 60;
20
- var h = m * 60;
21
- var d = h * 24;
22
- var w = d * 7;
23
- var y = d * 365.25;
24
- /**
25
- * Parse or format the given `val`.
26
- *
27
- * Options:
28
- *
29
- * - `long` verbose formatting [false]
30
- *
31
- * @param {String|Number} val
32
- * @param {Object} [options]
33
- * @throws {Error} throw an error if val is not a non-empty string or a number
34
- * @return {String|Number}
35
- * @api public
36
- */
37
- module.exports = function(val, options) {
38
- options = options || {};
39
- var type = typeof val;
40
- if (type === "string" && val.length > 0) return parse(val);
41
- else if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
42
- throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
43
- };
44
- /**
45
- * Parse the given `str` and return milliseconds.
46
- *
47
- * @param {String} str
48
- * @return {Number}
49
- * @api private
50
- */
51
- function parse(str) {
52
- str = String(str);
53
- if (str.length > 100) return;
54
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
55
- if (!match) return;
56
- var n = parseFloat(match[1]);
57
- switch ((match[2] || "ms").toLowerCase()) {
58
- case "years":
59
- case "year":
60
- case "yrs":
61
- case "yr":
62
- case "y": return n * y;
63
- case "weeks":
64
- case "week":
65
- case "w": return n * w;
66
- case "days":
67
- case "day":
68
- case "d": return n * d;
69
- case "hours":
70
- case "hour":
71
- case "hrs":
72
- case "hr":
73
- case "h": return n * h;
74
- case "minutes":
75
- case "minute":
76
- case "mins":
77
- case "min":
78
- case "m": return n * m;
79
- case "seconds":
80
- case "second":
81
- case "secs":
82
- case "sec":
83
- case "s": return n * s;
84
- case "milliseconds":
85
- case "millisecond":
86
- case "msecs":
87
- case "msec":
88
- case "ms": return n;
89
- default: return;
90
- }
91
- }
92
- /**
93
- * Short format for `ms`.
94
- *
95
- * @param {Number} ms
96
- * @return {String}
97
- * @api private
98
- */
99
- function fmtShort(ms) {
100
- var msAbs = Math.abs(ms);
101
- if (msAbs >= d) return Math.round(ms / d) + "d";
102
- if (msAbs >= h) return Math.round(ms / h) + "h";
103
- if (msAbs >= m) return Math.round(ms / m) + "m";
104
- if (msAbs >= s) return Math.round(ms / s) + "s";
105
- return ms + "ms";
106
- }
107
- /**
108
- * Long format for `ms`.
109
- *
110
- * @param {Number} ms
111
- * @return {String}
112
- * @api private
113
- */
114
- function fmtLong(ms) {
115
- var msAbs = Math.abs(ms);
116
- if (msAbs >= d) return plural(ms, msAbs, d, "day");
117
- if (msAbs >= h) return plural(ms, msAbs, h, "hour");
118
- if (msAbs >= m) return plural(ms, msAbs, m, "minute");
119
- if (msAbs >= s) return plural(ms, msAbs, s, "second");
120
- return ms + " ms";
121
- }
122
- /**
123
- * Pluralization helper.
124
- */
125
- function plural(ms, msAbs, n, name) {
126
- var isPlural = msAbs >= n * 1.5;
127
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
128
- }
129
- }));
130
-
131
- //#endregion
132
- //#region ../../node_modules/debug/src/common.js
133
- var require_common = /* @__PURE__ */ require_install.__commonJSMin(((exports, module) => {
134
- /**
135
- * This is the common logic for both the Node.js and web browser
136
- * implementations of `debug()`.
137
- */
138
- function setup(env) {
139
- createDebug.debug = createDebug;
140
- createDebug.default = createDebug;
141
- createDebug.coerce = coerce;
142
- createDebug.disable = disable;
143
- createDebug.enable = enable;
144
- createDebug.enabled = enabled;
145
- createDebug.humanize = require_ms();
146
- createDebug.destroy = destroy;
147
- Object.keys(env).forEach((key) => {
148
- createDebug[key] = env[key];
149
- });
150
- /**
151
- * The currently active debug mode names, and names to skip.
152
- */
153
- createDebug.names = [];
154
- createDebug.skips = [];
155
- /**
156
- * Map of special "%n" handling functions, for the debug "format" argument.
157
- *
158
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
159
- */
160
- createDebug.formatters = {};
161
- /**
162
- * Selects a color for a debug namespace
163
- * @param {String} namespace The namespace string for the debug instance to be colored
164
- * @return {Number|String} An ANSI color code for the given namespace
165
- * @api private
166
- */
167
- function selectColor(namespace) {
168
- let hash = 0;
169
- for (let i = 0; i < namespace.length; i++) {
170
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
171
- hash |= 0;
172
- }
173
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
174
- }
175
- createDebug.selectColor = selectColor;
176
- /**
177
- * Create a debugger with the given `namespace`.
178
- *
179
- * @param {String} namespace
180
- * @return {Function}
181
- * @api public
182
- */
183
- function createDebug(namespace) {
184
- let prevTime;
185
- let enableOverride = null;
186
- let namespacesCache;
187
- let enabledCache;
188
- function debug(...args) {
189
- if (!debug.enabled) return;
190
- const self = debug;
191
- const curr = Number(/* @__PURE__ */ new Date());
192
- self.diff = curr - (prevTime || curr);
193
- self.prev = prevTime;
194
- self.curr = curr;
195
- prevTime = curr;
196
- args[0] = createDebug.coerce(args[0]);
197
- if (typeof args[0] !== "string") args.unshift("%O");
198
- let index = 0;
199
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
200
- if (match === "%%") return "%";
201
- index++;
202
- const formatter = createDebug.formatters[format];
203
- if (typeof formatter === "function") {
204
- const val = args[index];
205
- match = formatter.call(self, val);
206
- args.splice(index, 1);
207
- index--;
208
- }
209
- return match;
210
- });
211
- createDebug.formatArgs.call(self, args);
212
- (self.log || createDebug.log).apply(self, args);
213
- }
214
- debug.namespace = namespace;
215
- debug.useColors = createDebug.useColors();
216
- debug.color = createDebug.selectColor(namespace);
217
- debug.extend = extend;
218
- debug.destroy = createDebug.destroy;
219
- Object.defineProperty(debug, "enabled", {
220
- enumerable: true,
221
- configurable: false,
222
- get: () => {
223
- if (enableOverride !== null) return enableOverride;
224
- if (namespacesCache !== createDebug.namespaces) {
225
- namespacesCache = createDebug.namespaces;
226
- enabledCache = createDebug.enabled(namespace);
227
- }
228
- return enabledCache;
229
- },
230
- set: (v) => {
231
- enableOverride = v;
232
- }
233
- });
234
- if (typeof createDebug.init === "function") createDebug.init(debug);
235
- return debug;
236
- }
237
- function extend(namespace, delimiter) {
238
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
239
- newDebug.log = this.log;
240
- return newDebug;
241
- }
242
- /**
243
- * Enables a debug mode by namespaces. This can include modes
244
- * separated by a colon and wildcards.
245
- *
246
- * @param {String} namespaces
247
- * @api public
248
- */
249
- function enable(namespaces) {
250
- createDebug.save(namespaces);
251
- createDebug.namespaces = namespaces;
252
- createDebug.names = [];
253
- createDebug.skips = [];
254
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
255
- for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
256
- else createDebug.names.push(ns);
257
- }
258
- /**
259
- * Checks if the given string matches a namespace template, honoring
260
- * asterisks as wildcards.
261
- *
262
- * @param {String} search
263
- * @param {String} template
264
- * @return {Boolean}
265
- */
266
- function matchesTemplate(search, template) {
267
- let searchIndex = 0;
268
- let templateIndex = 0;
269
- let starIndex = -1;
270
- let matchIndex = 0;
271
- while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
272
- starIndex = templateIndex;
273
- matchIndex = searchIndex;
274
- templateIndex++;
275
- } else {
276
- searchIndex++;
277
- templateIndex++;
278
- }
279
- else if (starIndex !== -1) {
280
- templateIndex = starIndex + 1;
281
- matchIndex++;
282
- searchIndex = matchIndex;
283
- } else return false;
284
- while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
285
- return templateIndex === template.length;
286
- }
287
- /**
288
- * Disable debug output.
289
- *
290
- * @return {String} namespaces
291
- * @api public
292
- */
293
- function disable() {
294
- const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
295
- createDebug.enable("");
296
- return namespaces;
297
- }
298
- /**
299
- * Returns true if the given mode name is enabled, false otherwise.
300
- *
301
- * @param {String} name
302
- * @return {Boolean}
303
- * @api public
304
- */
305
- function enabled(name) {
306
- for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
307
- for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
308
- return false;
309
- }
310
- /**
311
- * Coerce `val`.
312
- *
313
- * @param {Mixed} val
314
- * @return {Mixed}
315
- * @api private
316
- */
317
- function coerce(val) {
318
- if (val instanceof Error) return val.stack || val.message;
319
- return val;
320
- }
321
- /**
322
- * XXX DO NOT USE. This is a temporary stub function.
323
- * XXX It WILL be removed in the next major release.
324
- */
325
- function destroy() {
326
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
327
- }
328
- createDebug.enable(createDebug.load());
329
- return createDebug;
330
- }
331
- module.exports = setup;
332
- }));
333
-
334
- //#endregion
335
- //#region ../../node_modules/debug/src/browser.js
336
- var require_browser = /* @__PURE__ */ require_install.__commonJSMin(((exports, module) => {
337
- /**
338
- * This is the web browser implementation of `debug()`.
339
- */
340
- exports.formatArgs = formatArgs;
341
- exports.save = save;
342
- exports.load = load;
343
- exports.useColors = useColors;
344
- exports.storage = localstorage();
345
- exports.destroy = (() => {
346
- let warned = false;
347
- return () => {
348
- if (!warned) {
349
- warned = true;
350
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
351
- }
352
- };
353
- })();
354
- /**
355
- * Colors.
356
- */
357
- exports.colors = [
358
- "#0000CC",
359
- "#0000FF",
360
- "#0033CC",
361
- "#0033FF",
362
- "#0066CC",
363
- "#0066FF",
364
- "#0099CC",
365
- "#0099FF",
366
- "#00CC00",
367
- "#00CC33",
368
- "#00CC66",
369
- "#00CC99",
370
- "#00CCCC",
371
- "#00CCFF",
372
- "#3300CC",
373
- "#3300FF",
374
- "#3333CC",
375
- "#3333FF",
376
- "#3366CC",
377
- "#3366FF",
378
- "#3399CC",
379
- "#3399FF",
380
- "#33CC00",
381
- "#33CC33",
382
- "#33CC66",
383
- "#33CC99",
384
- "#33CCCC",
385
- "#33CCFF",
386
- "#6600CC",
387
- "#6600FF",
388
- "#6633CC",
389
- "#6633FF",
390
- "#66CC00",
391
- "#66CC33",
392
- "#9900CC",
393
- "#9900FF",
394
- "#9933CC",
395
- "#9933FF",
396
- "#99CC00",
397
- "#99CC33",
398
- "#CC0000",
399
- "#CC0033",
400
- "#CC0066",
401
- "#CC0099",
402
- "#CC00CC",
403
- "#CC00FF",
404
- "#CC3300",
405
- "#CC3333",
406
- "#CC3366",
407
- "#CC3399",
408
- "#CC33CC",
409
- "#CC33FF",
410
- "#CC6600",
411
- "#CC6633",
412
- "#CC9900",
413
- "#CC9933",
414
- "#CCCC00",
415
- "#CCCC33",
416
- "#FF0000",
417
- "#FF0033",
418
- "#FF0066",
419
- "#FF0099",
420
- "#FF00CC",
421
- "#FF00FF",
422
- "#FF3300",
423
- "#FF3333",
424
- "#FF3366",
425
- "#FF3399",
426
- "#FF33CC",
427
- "#FF33FF",
428
- "#FF6600",
429
- "#FF6633",
430
- "#FF9900",
431
- "#FF9933",
432
- "#FFCC00",
433
- "#FFCC33"
434
- ];
435
- /**
436
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
437
- * and the Firebug extension (any Firefox version) are known
438
- * to support "%c" CSS customizations.
439
- *
440
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
441
- */
442
- function useColors() {
443
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
444
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
445
- let m;
446
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
447
- }
448
- /**
449
- * Colorize log arguments if enabled.
450
- *
451
- * @api public
452
- */
453
- function formatArgs(args) {
454
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
455
- if (!this.useColors) return;
456
- const c = "color: " + this.color;
457
- args.splice(1, 0, c, "color: inherit");
458
- let index = 0;
459
- let lastC = 0;
460
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
461
- if (match === "%%") return;
462
- index++;
463
- if (match === "%c") lastC = index;
464
- });
465
- args.splice(lastC, 0, c);
466
- }
467
- /**
468
- * Invokes `console.debug()` when available.
469
- * No-op when `console.debug` is not a "function".
470
- * If `console.debug` is not available, falls back
471
- * to `console.log`.
472
- *
473
- * @api public
474
- */
475
- exports.log = console.debug || console.log || (() => {});
476
- /**
477
- * Save `namespaces`.
478
- *
479
- * @param {String} namespaces
480
- * @api private
481
- */
482
- function save(namespaces) {
483
- try {
484
- if (namespaces) exports.storage.setItem("debug", namespaces);
485
- else exports.storage.removeItem("debug");
486
- } catch (error) {}
487
- }
488
- /**
489
- * Load `namespaces`.
490
- *
491
- * @return {String} returns the previously persisted debug modes
492
- * @api private
493
- */
494
- function load() {
495
- let r;
496
- try {
497
- r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
498
- } catch (error) {}
499
- if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
500
- return r;
501
- }
502
- /**
503
- * Localstorage attempts to return the localstorage.
504
- *
505
- * This is necessary because safari throws
506
- * when a user disables cookies/localstorage
507
- * and you attempt to access it.
508
- *
509
- * @return {LocalStorage}
510
- * @api private
511
- */
512
- function localstorage() {
513
- try {
514
- return localStorage;
515
- } catch (error) {}
516
- }
517
- module.exports = require_common()(exports);
518
- const { formatters } = module.exports;
519
- /**
520
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
521
- */
522
- formatters.j = function(v) {
523
- try {
524
- return JSON.stringify(v);
525
- } catch (error) {
526
- return "[UnexpectedJSONParseError]: " + error.message;
527
- }
528
- };
529
- }));
530
-
531
- //#endregion
532
- //#region ../../node_modules/has-flag/index.js
533
- var require_has_flag = /* @__PURE__ */ require_install.__commonJSMin(((exports, module) => {
534
- module.exports = (flag, argv = process.argv) => {
535
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
536
- const position = argv.indexOf(prefix + flag);
537
- const terminatorPosition = argv.indexOf("--");
538
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
539
- };
540
- }));
541
-
542
- //#endregion
543
- //#region ../../node_modules/supports-color/index.js
544
- var require_supports_color = /* @__PURE__ */ require_install.__commonJSMin(((exports, module) => {
545
- const os$1 = require("os");
546
- const tty$1 = require("tty");
547
- const hasFlag = require_has_flag();
548
- const { env } = process;
549
- let forceColor;
550
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
551
- else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
552
- if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
553
- else if (env.FORCE_COLOR === "false") forceColor = 0;
554
- else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
555
- function translateLevel(level) {
556
- if (level === 0) return false;
557
- return {
558
- level,
559
- hasBasic: true,
560
- has256: level >= 2,
561
- has16m: level >= 3
562
- };
563
- }
564
- function supportsColor(haveStream, streamIsTTY) {
565
- if (forceColor === 0) return 0;
566
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
567
- if (hasFlag("color=256")) return 2;
568
- if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
569
- const min = forceColor || 0;
570
- if (env.TERM === "dumb") return min;
571
- if (process.platform === "win32") {
572
- const osRelease = os$1.release().split(".");
573
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
574
- return 1;
575
- }
576
- if ("CI" in env) {
577
- if ([
578
- "TRAVIS",
579
- "CIRCLECI",
580
- "APPVEYOR",
581
- "GITLAB_CI",
582
- "GITHUB_ACTIONS",
583
- "BUILDKITE"
584
- ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
585
- return min;
586
- }
587
- if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
588
- if (env.COLORTERM === "truecolor") return 3;
589
- if ("TERM_PROGRAM" in env) {
590
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
591
- switch (env.TERM_PROGRAM) {
592
- case "iTerm.app": return version >= 3 ? 3 : 2;
593
- case "Apple_Terminal": return 2;
594
- }
595
- }
596
- if (/-256(color)?$/i.test(env.TERM)) return 2;
597
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
598
- if ("COLORTERM" in env) return 1;
599
- return min;
600
- }
601
- function getSupportLevel(stream) {
602
- return translateLevel(supportsColor(stream, stream && stream.isTTY));
603
- }
604
- module.exports = {
605
- supportsColor: getSupportLevel,
606
- stdout: translateLevel(supportsColor(true, tty$1.isatty(1))),
607
- stderr: translateLevel(supportsColor(true, tty$1.isatty(2)))
608
- };
609
- }));
610
-
611
- //#endregion
612
- //#region ../../node_modules/debug/src/node.js
613
- var require_node = /* @__PURE__ */ require_install.__commonJSMin(((exports, module) => {
614
- /**
615
- * Module dependencies.
616
- */
617
- const tty = require("tty");
618
- const util = require("util");
619
- /**
620
- * This is the Node.js implementation of `debug()`.
621
- */
622
- exports.init = init;
623
- exports.log = log;
624
- exports.formatArgs = formatArgs;
625
- exports.save = save;
626
- exports.load = load;
627
- exports.useColors = useColors;
628
- exports.destroy = util.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
629
- /**
630
- * Colors.
631
- */
632
- exports.colors = [
633
- 6,
634
- 2,
635
- 3,
636
- 4,
637
- 5,
638
- 1
639
- ];
640
- try {
641
- const supportsColor = require_supports_color();
642
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
643
- 20,
644
- 21,
645
- 26,
646
- 27,
647
- 32,
648
- 33,
649
- 38,
650
- 39,
651
- 40,
652
- 41,
653
- 42,
654
- 43,
655
- 44,
656
- 45,
657
- 56,
658
- 57,
659
- 62,
660
- 63,
661
- 68,
662
- 69,
663
- 74,
664
- 75,
665
- 76,
666
- 77,
667
- 78,
668
- 79,
669
- 80,
670
- 81,
671
- 92,
672
- 93,
673
- 98,
674
- 99,
675
- 112,
676
- 113,
677
- 128,
678
- 129,
679
- 134,
680
- 135,
681
- 148,
682
- 149,
683
- 160,
684
- 161,
685
- 162,
686
- 163,
687
- 164,
688
- 165,
689
- 166,
690
- 167,
691
- 168,
692
- 169,
693
- 170,
694
- 171,
695
- 172,
696
- 173,
697
- 178,
698
- 179,
699
- 184,
700
- 185,
701
- 196,
702
- 197,
703
- 198,
704
- 199,
705
- 200,
706
- 201,
707
- 202,
708
- 203,
709
- 204,
710
- 205,
711
- 206,
712
- 207,
713
- 208,
714
- 209,
715
- 214,
716
- 215,
717
- 220,
718
- 221
719
- ];
720
- } catch (error) {}
721
- /**
722
- * Build up the default `inspectOpts` object from the environment variables.
723
- *
724
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
725
- */
726
- exports.inspectOpts = Object.keys(process.env).filter((key) => {
727
- return /^debug_/i.test(key);
728
- }).reduce((obj, key) => {
729
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
730
- return k.toUpperCase();
731
- });
732
- let val = process.env[key];
733
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
734
- else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
735
- else if (val === "null") val = null;
736
- else val = Number(val);
737
- obj[prop] = val;
738
- return obj;
739
- }, {});
740
- /**
741
- * Is stdout a TTY? Colored output is enabled when `true`.
742
- */
743
- function useColors() {
744
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
745
- }
746
- /**
747
- * Adds ANSI color escape codes if enabled.
748
- *
749
- * @api public
750
- */
751
- function formatArgs(args) {
752
- const { namespace: name, useColors } = this;
753
- if (useColors) {
754
- const c = this.color;
755
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
756
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
757
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
758
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
759
- } else args[0] = getDate() + name + " " + args[0];
760
- }
761
- function getDate() {
762
- if (exports.inspectOpts.hideDate) return "";
763
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
764
- }
765
- /**
766
- * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
767
- */
768
- function log(...args) {
769
- return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
770
- }
771
- /**
772
- * Save `namespaces`.
773
- *
774
- * @param {String} namespaces
775
- * @api private
776
- */
777
- function save(namespaces) {
778
- if (namespaces) process.env.DEBUG = namespaces;
779
- else delete process.env.DEBUG;
780
- }
781
- /**
782
- * Load `namespaces`.
783
- *
784
- * @return {String} returns the previously persisted debug modes
785
- * @api private
786
- */
787
- function load() {
788
- return process.env.DEBUG;
789
- }
790
- /**
791
- * Init logic for `debug` instances.
792
- *
793
- * Create a new `inspectOpts` object in case `useColors` is set
794
- * differently for a particular `debug` instance.
795
- */
796
- function init(debug) {
797
- debug.inspectOpts = {};
798
- const keys = Object.keys(exports.inspectOpts);
799
- for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
800
- }
801
- module.exports = require_common()(exports);
802
- const { formatters } = module.exports;
803
- /**
804
- * Map %o to `util.inspect()`, all on a single line.
805
- */
806
- formatters.o = function(v) {
807
- this.inspectOpts.colors = this.useColors;
808
- return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
809
- };
810
- /**
811
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
812
- */
813
- formatters.O = function(v) {
814
- this.inspectOpts.colors = this.useColors;
815
- return util.inspect(v, this.inspectOpts);
816
- };
817
- }));
818
-
819
- //#endregion
820
- //#region ../../node_modules/debug/src/index.js
821
- var require_src$1 = /* @__PURE__ */ require_install.__commonJSMin(((exports, module) => {
822
- /**
823
- * Detect Electron renderer / nwjs process, which is node, but we should
824
- * treat as a browser.
825
- */
826
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
827
- else module.exports = require_node();
828
- }));
829
-
830
- //#endregion
831
- //#region ../../node_modules/@kwsites/file-exists/dist/src/index.js
832
- var require_src = /* @__PURE__ */ require_install.__commonJSMin(((exports) => {
833
- var __importDefault = exports && exports.__importDefault || function(mod) {
834
- return mod && mod.__esModule ? mod : { "default": mod };
835
- };
836
- Object.defineProperty(exports, "__esModule", { value: true });
837
- const fs_1 = require("fs");
838
- const log = __importDefault(require_src$1()).default("@kwsites/file-exists");
839
- function check(path, isFile, isDirectory) {
840
- log(`checking %s`, path);
841
- try {
842
- const stat = fs_1.statSync(path);
843
- if (stat.isFile() && isFile) {
844
- log(`[OK] path represents a file`);
845
- return true;
846
- }
847
- if (stat.isDirectory() && isDirectory) {
848
- log(`[OK] path represents a directory`);
849
- return true;
850
- }
851
- log(`[FAIL] path represents something other than a file or directory`);
852
- return false;
853
- } catch (e) {
854
- if (e.code === "ENOENT") {
855
- log(`[FAIL] path is not accessible: %o`, e);
856
- return false;
857
- }
858
- log(`[FATAL] %o`, e);
859
- throw e;
860
- }
861
- }
862
- /**
863
- * Synchronous validation of a path existing either as a file or as a directory.
864
- *
865
- * @param {string} path The path to check
866
- * @param {number} type One or both of the exported numeric constants
867
- */
868
- function exists(path, type = exports.READABLE) {
869
- return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
870
- }
871
- exports.exists = exists;
872
- /**
873
- * Constant representing a file
874
- */
875
- exports.FILE = 1;
876
- /**
877
- * Constant representing a folder
878
- */
879
- exports.FOLDER = 2;
880
- /**
881
- * Constant representing either a file or a folder
882
- */
883
- exports.READABLE = exports.FILE + exports.FOLDER;
884
- }));
885
-
886
- //#endregion
887
- //#region ../../node_modules/@kwsites/file-exists/dist/index.js
888
- var require_dist$1 = /* @__PURE__ */ require_install.__commonJSMin(((exports) => {
889
- function __export(m) {
890
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
891
- }
892
- Object.defineProperty(exports, "__esModule", { value: true });
893
- __export(require_src());
894
- }));
895
-
896
- //#endregion
897
- //#region ../../node_modules/@kwsites/promise-deferred/dist/index.js
898
- var require_dist = /* @__PURE__ */ require_install.__commonJSMin(((exports) => {
899
- Object.defineProperty(exports, "__esModule", { value: true });
900
- exports.createDeferred = exports.deferred = void 0;
901
- /**
902
- * Creates a new `DeferredPromise`
903
- *
904
- * ```typescript
905
- import {deferred} from '@kwsites/promise-deferred`;
906
- ```
907
- */
908
- function deferred() {
909
- let done;
910
- let fail;
911
- let status = "pending";
912
- return {
913
- promise: new Promise((_done, _fail) => {
914
- done = _done;
915
- fail = _fail;
916
- }),
917
- done(result) {
918
- if (status === "pending") {
919
- status = "resolved";
920
- done(result);
921
- }
922
- },
923
- fail(error) {
924
- if (status === "pending") {
925
- status = "rejected";
926
- fail(error);
927
- }
928
- },
929
- get fulfilled() {
930
- return status !== "pending";
931
- },
932
- get status() {
933
- return status;
934
- }
935
- };
936
- }
937
- exports.deferred = deferred;
938
- /**
939
- * Alias of the exported `deferred` function, to help consumers wanting to use `deferred` as the
940
- * local variable name rather than the factory import name, without needing to rename on import.
941
- *
942
- * ```typescript
943
- import {createDeferred} from '@kwsites/promise-deferred`;
944
- ```
945
- */
946
- exports.createDeferred = deferred;
947
- }));
948
-
949
- //#endregion
950
- //#region ../../node_modules/simple-git/dist/esm/index.js
951
- var import_dist = require_dist$1();
952
- var import_src = /* @__PURE__ */ require_install.__toESM(require_src$1(), 1);
953
- var import_dist$1 = require_dist();
954
- var __defProp = Object.defineProperty;
955
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
956
- var __getOwnPropNames = Object.getOwnPropertyNames;
957
- var __hasOwnProp = Object.prototype.hasOwnProperty;
958
- var __esm = (fn, res) => function __init() {
959
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
960
- };
961
- var __commonJS = (cb, mod) => function __require() {
962
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
963
- };
964
- var __export = (target, all) => {
965
- for (var name in all) __defProp(target, name, {
966
- get: all[name],
967
- enumerable: true
968
- });
969
- };
970
- var __copyProps = (to, from, except, desc) => {
971
- if (from && typeof from === "object" || typeof from === "function") {
972
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
973
- get: () => from[key],
974
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
975
- });
976
- }
977
- return to;
978
- };
979
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
980
- function pathspec(...paths) {
981
- const key = new String(paths);
982
- cache.set(key, paths);
983
- return key;
984
- }
985
- function isPathSpec(path) {
986
- return path instanceof String && cache.has(path);
987
- }
988
- var cache;
989
- var init_pathspec = __esm({ "src/lib/args/pathspec.ts"() {
990
- "use strict";
991
- cache = /* @__PURE__ */ new WeakMap();
992
- } });
993
- var GitError;
994
- var init_git_error = __esm({ "src/lib/errors/git-error.ts"() {
995
- "use strict";
996
- GitError = class extends Error {
997
- constructor(task, message) {
998
- super(message);
999
- this.task = task;
1000
- Object.setPrototypeOf(this, new.target.prototype);
1001
- }
1002
- };
1003
- } });
1004
- var GitResponseError;
1005
- var init_git_response_error = __esm({ "src/lib/errors/git-response-error.ts"() {
1006
- "use strict";
1007
- init_git_error();
1008
- GitResponseError = class extends GitError {
1009
- constructor(git, message) {
1010
- super(void 0, message || String(git));
1011
- this.git = git;
1012
- }
1013
- };
1014
- } });
1015
- var TaskConfigurationError;
1016
- var init_task_configuration_error = __esm({ "src/lib/errors/task-configuration-error.ts"() {
1017
- "use strict";
1018
- init_git_error();
1019
- TaskConfigurationError = class extends GitError {
1020
- constructor(message) {
1021
- super(void 0, message);
1022
- }
1023
- };
1024
- } });
1025
- function asFunction(source) {
1026
- if (typeof source !== "function") return NOOP;
1027
- return source;
1028
- }
1029
- function isUserFunction(source) {
1030
- return typeof source === "function" && source !== NOOP;
1031
- }
1032
- function splitOn(input, char) {
1033
- const index = input.indexOf(char);
1034
- if (index <= 0) return [input, ""];
1035
- return [input.substr(0, index), input.substr(index + 1)];
1036
- }
1037
- function first(input, offset = 0) {
1038
- return isArrayLike(input) && input.length > offset ? input[offset] : void 0;
1039
- }
1040
- function last(input, offset = 0) {
1041
- if (isArrayLike(input) && input.length > offset) return input[input.length - 1 - offset];
1042
- }
1043
- function isArrayLike(input) {
1044
- return filterHasLength(input);
1045
- }
1046
- function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
1047
- return input.split(separator).reduce((output, line) => {
1048
- const lineContent = trimmed2 ? line.trim() : line;
1049
- if (lineContent) output.push(lineContent);
1050
- return output;
1051
- }, []);
1052
- }
1053
- function forEachLineWithContent(input, callback) {
1054
- return toLinesWithContent(input, true).map((line) => callback(line));
1055
- }
1056
- function folderExists(path) {
1057
- return (0, import_dist.exists)(path, import_dist.FOLDER);
1058
- }
1059
- function append(target, item) {
1060
- if (Array.isArray(target)) {
1061
- if (!target.includes(item)) target.push(item);
1062
- } else target.add(item);
1063
- return item;
1064
- }
1065
- function including(target, item) {
1066
- if (Array.isArray(target) && !target.includes(item)) target.push(item);
1067
- return target;
1068
- }
1069
- function remove(target, item) {
1070
- if (Array.isArray(target)) {
1071
- const index = target.indexOf(item);
1072
- if (index >= 0) target.splice(index, 1);
1073
- } else target.delete(item);
1074
- return item;
1075
- }
1076
- function asArray(source) {
1077
- return Array.isArray(source) ? source : [source];
1078
- }
1079
- function asCamelCase(str) {
1080
- return str.replace(/[\s-]+(.)/g, (_all, chr) => {
1081
- return chr.toUpperCase();
1082
- });
1083
- }
1084
- function asStringArray(source) {
1085
- return asArray(source).map((item) => {
1086
- return item instanceof String ? item : String(item);
1087
- });
1088
- }
1089
- function asNumber(source, onNaN = 0) {
1090
- if (source == null) return onNaN;
1091
- const num = parseInt(source, 10);
1092
- return Number.isNaN(num) ? onNaN : num;
1093
- }
1094
- function prefixedArray(input, prefix) {
1095
- const output = [];
1096
- for (let i = 0, max = input.length; i < max; i++) output.push(prefix, input[i]);
1097
- return output;
1098
- }
1099
- function bufferToString(input) {
1100
- return (Array.isArray(input) ? node_buffer.Buffer.concat(input) : input).toString("utf-8");
1101
- }
1102
- function pick(source, properties) {
1103
- const out = {};
1104
- properties.forEach((key) => {
1105
- if (source[key] !== void 0) out[key] = source[key];
1106
- });
1107
- return out;
1108
- }
1109
- function delay(duration = 0) {
1110
- return new Promise((done) => setTimeout(done, duration));
1111
- }
1112
- function orVoid(input) {
1113
- if (input === false) return;
1114
- return input;
1115
- }
1116
- var NULL, NOOP, objectToString;
1117
- var init_util = __esm({ "src/lib/utils/util.ts"() {
1118
- "use strict";
1119
- init_argument_filters();
1120
- NULL = "\0";
1121
- NOOP = () => {};
1122
- objectToString = Object.prototype.toString.call.bind(Object.prototype.toString);
1123
- } });
1124
- function filterType(input, filter, def) {
1125
- if (filter(input)) return input;
1126
- return arguments.length > 2 ? def : void 0;
1127
- }
1128
- function filterPrimitives(input, omit) {
1129
- const type = isPathSpec(input) ? "string" : typeof input;
1130
- return /number|string|boolean/.test(type) && (!omit || !omit.includes(type));
1131
- }
1132
- function filterPlainObject(input) {
1133
- return !!input && objectToString(input) === "[object Object]";
1134
- }
1135
- function filterFunction(input) {
1136
- return typeof input === "function";
1137
- }
1138
- var filterArray, filterNumber, filterString, filterStringOrStringArray, filterHasLength;
1139
- var init_argument_filters = __esm({ "src/lib/utils/argument-filters.ts"() {
1140
- "use strict";
1141
- init_pathspec();
1142
- init_util();
1143
- filterArray = (input) => {
1144
- return Array.isArray(input);
1145
- };
1146
- filterNumber = (input) => {
1147
- return typeof input === "number";
1148
- };
1149
- filterString = (input) => {
1150
- return typeof input === "string";
1151
- };
1152
- filterStringOrStringArray = (input) => {
1153
- return filterString(input) || Array.isArray(input) && input.every(filterString);
1154
- };
1155
- filterHasLength = (input) => {
1156
- if (input == null || "number|boolean|function".includes(typeof input)) return false;
1157
- return typeof input.length === "number";
1158
- };
1159
- } });
1160
- var ExitCodes;
1161
- var init_exit_codes = __esm({ "src/lib/utils/exit-codes.ts"() {
1162
- "use strict";
1163
- ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {
1164
- ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS";
1165
- ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR";
1166
- ExitCodes2[ExitCodes2["NOT_FOUND"] = -2] = "NOT_FOUND";
1167
- ExitCodes2[ExitCodes2["UNCLEAN"] = 128] = "UNCLEAN";
1168
- return ExitCodes2;
1169
- })(ExitCodes || {});
1170
- } });
1171
- var GitOutputStreams;
1172
- var init_git_output_streams = __esm({ "src/lib/utils/git-output-streams.ts"() {
1173
- "use strict";
1174
- GitOutputStreams = class _GitOutputStreams {
1175
- constructor(stdOut, stdErr) {
1176
- this.stdOut = stdOut;
1177
- this.stdErr = stdErr;
1178
- }
1179
- asStrings() {
1180
- return new _GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
1181
- }
1182
- };
1183
- } });
1184
- function useMatchesDefault() {
1185
- throw new Error(`LineParser:useMatches not implemented`);
1186
- }
1187
- var LineParser, RemoteLineParser;
1188
- var init_line_parser = __esm({ "src/lib/utils/line-parser.ts"() {
1189
- "use strict";
1190
- LineParser = class {
1191
- constructor(regExp, useMatches) {
1192
- this.matches = [];
1193
- this.useMatches = useMatchesDefault;
1194
- this.parse = (line, target) => {
1195
- this.resetMatches();
1196
- if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) return false;
1197
- return this.useMatches(target, this.prepareMatches()) !== false;
1198
- };
1199
- this._regExp = Array.isArray(regExp) ? regExp : [regExp];
1200
- if (useMatches) this.useMatches = useMatches;
1201
- }
1202
- resetMatches() {
1203
- this.matches.length = 0;
1204
- }
1205
- prepareMatches() {
1206
- return this.matches;
1207
- }
1208
- addMatch(reg, index, line) {
1209
- const matched = line && reg.exec(line);
1210
- if (matched) this.pushMatch(index, matched);
1211
- return !!matched;
1212
- }
1213
- pushMatch(_index, matched) {
1214
- this.matches.push(...matched.slice(1));
1215
- }
1216
- };
1217
- RemoteLineParser = class extends LineParser {
1218
- addMatch(reg, index, line) {
1219
- return /^remote:\s/.test(String(line)) && super.addMatch(reg, index, line);
1220
- }
1221
- pushMatch(index, matched) {
1222
- if (index > 0 || matched.length > 1) super.pushMatch(index, matched);
1223
- }
1224
- };
1225
- } });
1226
- function createInstanceConfig(...options) {
1227
- const baseDir = process.cwd();
1228
- const config = Object.assign({
1229
- baseDir,
1230
- ...defaultOptions
1231
- }, ...options.filter((o) => typeof o === "object" && o));
1232
- config.baseDir = config.baseDir || baseDir;
1233
- config.trimmed = config.trimmed === true;
1234
- return config;
1235
- }
1236
- var defaultOptions;
1237
- var init_simple_git_options = __esm({ "src/lib/utils/simple-git-options.ts"() {
1238
- "use strict";
1239
- defaultOptions = {
1240
- binary: "git",
1241
- maxConcurrentProcesses: 5,
1242
- config: [],
1243
- trimmed: false
1244
- };
1245
- } });
1246
- function appendTaskOptions(options, commands = []) {
1247
- if (!filterPlainObject(options)) return commands;
1248
- return Object.keys(options).reduce((commands2, key) => {
1249
- const value = options[key];
1250
- if (isPathSpec(value)) commands2.push(value);
1251
- else if (filterPrimitives(value, ["boolean"])) commands2.push(key + "=" + value);
1252
- else if (Array.isArray(value)) {
1253
- for (const v of value) if (!filterPrimitives(v, ["string", "number"])) commands2.push(key + "=" + v);
1254
- } else commands2.push(key);
1255
- return commands2;
1256
- }, commands);
1257
- }
1258
- function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
1259
- const command = [];
1260
- for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) if ("string|number".includes(typeof args[i])) command.push(String(args[i]));
1261
- appendTaskOptions(trailingOptionsArgument(args), command);
1262
- if (!objectOnly) command.push(...trailingArrayArgument(args));
1263
- return command;
1264
- }
1265
- function trailingArrayArgument(args) {
1266
- return asStringArray(filterType(last(args, typeof last(args) === "function" ? 1 : 0), filterArray, []));
1267
- }
1268
- function trailingOptionsArgument(args) {
1269
- return filterType(last(args, filterFunction(last(args)) ? 1 : 0), filterPlainObject);
1270
- }
1271
- function trailingFunctionArgument(args, includeNoop = true) {
1272
- const callback = asFunction(last(args));
1273
- return includeNoop || isUserFunction(callback) ? callback : void 0;
1274
- }
1275
- var init_task_options = __esm({ "src/lib/utils/task-options.ts"() {
1276
- "use strict";
1277
- init_argument_filters();
1278
- init_util();
1279
- init_pathspec();
1280
- } });
1281
- function callTaskParser(parser4, streams) {
1282
- return parser4(streams.stdOut, streams.stdErr);
1283
- }
1284
- function parseStringResponse(result, parsers12, texts, trim = true) {
1285
- asArray(texts).forEach((text) => {
1286
- for (let lines = toLinesWithContent(text, trim), i = 0, max = lines.length; i < max; i++) {
1287
- const line = (offset = 0) => {
1288
- if (i + offset >= max) return;
1289
- return lines[i + offset];
1290
- };
1291
- parsers12.some(({ parse }) => parse(line, result));
1292
- }
1293
- });
1294
- return result;
1295
- }
1296
- var init_task_parser = __esm({ "src/lib/utils/task-parser.ts"() {
1297
- "use strict";
1298
- init_util();
1299
- } });
1300
- var utils_exports = {};
1301
- __export(utils_exports, {
1302
- ExitCodes: () => ExitCodes,
1303
- GitOutputStreams: () => GitOutputStreams,
1304
- LineParser: () => LineParser,
1305
- NOOP: () => NOOP,
1306
- NULL: () => NULL,
1307
- RemoteLineParser: () => RemoteLineParser,
1308
- append: () => append,
1309
- appendTaskOptions: () => appendTaskOptions,
1310
- asArray: () => asArray,
1311
- asCamelCase: () => asCamelCase,
1312
- asFunction: () => asFunction,
1313
- asNumber: () => asNumber,
1314
- asStringArray: () => asStringArray,
1315
- bufferToString: () => bufferToString,
1316
- callTaskParser: () => callTaskParser,
1317
- createInstanceConfig: () => createInstanceConfig,
1318
- delay: () => delay,
1319
- filterArray: () => filterArray,
1320
- filterFunction: () => filterFunction,
1321
- filterHasLength: () => filterHasLength,
1322
- filterNumber: () => filterNumber,
1323
- filterPlainObject: () => filterPlainObject,
1324
- filterPrimitives: () => filterPrimitives,
1325
- filterString: () => filterString,
1326
- filterStringOrStringArray: () => filterStringOrStringArray,
1327
- filterType: () => filterType,
1328
- first: () => first,
1329
- folderExists: () => folderExists,
1330
- forEachLineWithContent: () => forEachLineWithContent,
1331
- getTrailingOptions: () => getTrailingOptions,
1332
- including: () => including,
1333
- isUserFunction: () => isUserFunction,
1334
- last: () => last,
1335
- objectToString: () => objectToString,
1336
- orVoid: () => orVoid,
1337
- parseStringResponse: () => parseStringResponse,
1338
- pick: () => pick,
1339
- prefixedArray: () => prefixedArray,
1340
- remove: () => remove,
1341
- splitOn: () => splitOn,
1342
- toLinesWithContent: () => toLinesWithContent,
1343
- trailingFunctionArgument: () => trailingFunctionArgument,
1344
- trailingOptionsArgument: () => trailingOptionsArgument
1345
- });
1346
- var init_utils = __esm({ "src/lib/utils/index.ts"() {
1347
- "use strict";
1348
- init_argument_filters();
1349
- init_exit_codes();
1350
- init_git_output_streams();
1351
- init_line_parser();
1352
- init_simple_git_options();
1353
- init_task_options();
1354
- init_task_parser();
1355
- init_util();
1356
- } });
1357
- var check_is_repo_exports = {};
1358
- __export(check_is_repo_exports, {
1359
- CheckRepoActions: () => CheckRepoActions,
1360
- checkIsBareRepoTask: () => checkIsBareRepoTask,
1361
- checkIsRepoRootTask: () => checkIsRepoRootTask,
1362
- checkIsRepoTask: () => checkIsRepoTask
1363
- });
1364
- function checkIsRepoTask(action) {
1365
- switch (action) {
1366
- case "bare": return checkIsBareRepoTask();
1367
- case "root": return checkIsRepoRootTask();
1368
- }
1369
- return {
1370
- commands: ["rev-parse", "--is-inside-work-tree"],
1371
- format: "utf-8",
1372
- onError,
1373
- parser
1374
- };
1375
- }
1376
- function checkIsRepoRootTask() {
1377
- return {
1378
- commands: ["rev-parse", "--git-dir"],
1379
- format: "utf-8",
1380
- onError,
1381
- parser(path) {
1382
- return /^\.(git)?$/.test(path.trim());
1383
- }
1384
- };
1385
- }
1386
- function checkIsBareRepoTask() {
1387
- return {
1388
- commands: ["rev-parse", "--is-bare-repository"],
1389
- format: "utf-8",
1390
- onError,
1391
- parser
1392
- };
1393
- }
1394
- function isNotRepoMessage(error) {
1395
- return /(Not a git repository|Kein Git-Repository)/i.test(String(error));
1396
- }
1397
- var CheckRepoActions, onError, parser;
1398
- var init_check_is_repo = __esm({ "src/lib/tasks/check-is-repo.ts"() {
1399
- "use strict";
1400
- init_utils();
1401
- CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {
1402
- CheckRepoActions2["BARE"] = "bare";
1403
- CheckRepoActions2["IN_TREE"] = "tree";
1404
- CheckRepoActions2["IS_REPO_ROOT"] = "root";
1405
- return CheckRepoActions2;
1406
- })(CheckRepoActions || {});
1407
- onError = ({ exitCode }, error, done, fail) => {
1408
- if (exitCode === 128 && isNotRepoMessage(error)) return done(Buffer.from("false"));
1409
- fail(error);
1410
- };
1411
- parser = (text) => {
1412
- return text.trim() === "true";
1413
- };
1414
- } });
1415
- function cleanSummaryParser(dryRun, text) {
1416
- const summary = new CleanResponse(dryRun);
1417
- const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
1418
- toLinesWithContent(text).forEach((line) => {
1419
- const removed = line.replace(regexp, "");
1420
- summary.paths.push(removed);
1421
- (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
1422
- });
1423
- return summary;
1424
- }
1425
- var CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp;
1426
- var init_CleanSummary = __esm({ "src/lib/responses/CleanSummary.ts"() {
1427
- "use strict";
1428
- init_utils();
1429
- CleanResponse = class {
1430
- constructor(dryRun) {
1431
- this.dryRun = dryRun;
1432
- this.paths = [];
1433
- this.files = [];
1434
- this.folders = [];
1435
- }
1436
- };
1437
- removalRegexp = /^[a-z]+\s*/i;
1438
- dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i;
1439
- isFolderRegexp = /\/$/;
1440
- } });
1441
- var task_exports = {};
1442
- __export(task_exports, {
1443
- EMPTY_COMMANDS: () => EMPTY_COMMANDS,
1444
- adhocExecTask: () => adhocExecTask,
1445
- configurationErrorTask: () => configurationErrorTask,
1446
- isBufferTask: () => isBufferTask,
1447
- isEmptyTask: () => isEmptyTask,
1448
- straightThroughBufferTask: () => straightThroughBufferTask,
1449
- straightThroughStringTask: () => straightThroughStringTask
1450
- });
1451
- function adhocExecTask(parser4) {
1452
- return {
1453
- commands: EMPTY_COMMANDS,
1454
- format: "empty",
1455
- parser: parser4
1456
- };
1457
- }
1458
- function configurationErrorTask(error) {
1459
- return {
1460
- commands: EMPTY_COMMANDS,
1461
- format: "empty",
1462
- parser() {
1463
- throw typeof error === "string" ? new TaskConfigurationError(error) : error;
1464
- }
1465
- };
1466
- }
1467
- function straightThroughStringTask(commands, trimmed2 = false) {
1468
- return {
1469
- commands,
1470
- format: "utf-8",
1471
- parser(text) {
1472
- return trimmed2 ? String(text).trim() : text;
1473
- }
1474
- };
1475
- }
1476
- function straightThroughBufferTask(commands) {
1477
- return {
1478
- commands,
1479
- format: "buffer",
1480
- parser(buffer) {
1481
- return buffer;
1482
- }
1483
- };
1484
- }
1485
- function isBufferTask(task) {
1486
- return task.format === "buffer";
1487
- }
1488
- function isEmptyTask(task) {
1489
- return task.format === "empty" || !task.commands.length;
1490
- }
1491
- var EMPTY_COMMANDS;
1492
- var init_task = __esm({ "src/lib/tasks/task.ts"() {
1493
- "use strict";
1494
- init_task_configuration_error();
1495
- EMPTY_COMMANDS = [];
1496
- } });
1497
- var clean_exports = {};
1498
- __export(clean_exports, {
1499
- CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE,
1500
- CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED,
1501
- CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION,
1502
- CleanOptions: () => CleanOptions,
1503
- cleanTask: () => cleanTask,
1504
- cleanWithOptionsTask: () => cleanWithOptionsTask,
1505
- isCleanOptionsArray: () => isCleanOptionsArray
1506
- });
1507
- function cleanWithOptionsTask(mode, customArgs) {
1508
- const { cleanMode, options, valid } = getCleanOptions(mode);
1509
- if (!cleanMode) return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);
1510
- if (!valid.options) return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));
1511
- options.push(...customArgs);
1512
- if (options.some(isInteractiveMode)) return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);
1513
- return cleanTask(cleanMode, options);
1514
- }
1515
- function cleanTask(mode, customArgs) {
1516
- return {
1517
- commands: [
1518
- "clean",
1519
- `-${mode}`,
1520
- ...customArgs
1521
- ],
1522
- format: "utf-8",
1523
- parser(text) {
1524
- return cleanSummaryParser(mode === "n", text);
1525
- }
1526
- };
1527
- }
1528
- function isCleanOptionsArray(input) {
1529
- return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));
1530
- }
1531
- function getCleanOptions(input) {
1532
- let cleanMode;
1533
- let options = [];
1534
- let valid = {
1535
- cleanMode: false,
1536
- options: true
1537
- };
1538
- input.replace(/[^a-z]i/g, "").split("").forEach((char) => {
1539
- if (isCleanMode(char)) {
1540
- cleanMode = char;
1541
- valid.cleanMode = true;
1542
- } else valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`);
1543
- });
1544
- return {
1545
- cleanMode,
1546
- options,
1547
- valid
1548
- };
1549
- }
1550
- function isCleanMode(cleanMode) {
1551
- return cleanMode === "f" || cleanMode === "n";
1552
- }
1553
- function isKnownOption(option) {
1554
- return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));
1555
- }
1556
- function isInteractiveMode(option) {
1557
- if (/^-[^\-]/.test(option)) return option.indexOf("i") > 0;
1558
- return option === "--interactive";
1559
- }
1560
- var CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues;
1561
- var init_clean = __esm({ "src/lib/tasks/clean.ts"() {
1562
- "use strict";
1563
- init_CleanSummary();
1564
- init_utils();
1565
- init_task();
1566
- CONFIG_ERROR_INTERACTIVE_MODE = "Git clean interactive mode is not supported";
1567
- CONFIG_ERROR_MODE_REQUIRED = "Git clean mode parameter (\"n\" or \"f\") is required";
1568
- CONFIG_ERROR_UNKNOWN_OPTION = "Git clean unknown option found in: ";
1569
- CleanOptions = /* @__PURE__ */ ((CleanOptions2) => {
1570
- CleanOptions2["DRY_RUN"] = "n";
1571
- CleanOptions2["FORCE"] = "f";
1572
- CleanOptions2["IGNORED_INCLUDED"] = "x";
1573
- CleanOptions2["IGNORED_ONLY"] = "X";
1574
- CleanOptions2["EXCLUDING"] = "e";
1575
- CleanOptions2["QUIET"] = "q";
1576
- CleanOptions2["RECURSIVE"] = "d";
1577
- return CleanOptions2;
1578
- })(CleanOptions || {});
1579
- CleanOptionValues = /* @__PURE__ */ new Set(["i", ...asStringArray(Object.values(CleanOptions))]);
1580
- } });
1581
- function configListParser(text) {
1582
- const config = new ConfigList();
1583
- for (const item of configParser(text)) config.addValue(item.file, String(item.key), item.value);
1584
- return config;
1585
- }
1586
- function configGetParser(text, key) {
1587
- let value = null;
1588
- const values = [];
1589
- const scopes = /* @__PURE__ */ new Map();
1590
- for (const item of configParser(text, key)) {
1591
- if (item.key !== key) continue;
1592
- values.push(value = item.value);
1593
- if (!scopes.has(item.file)) scopes.set(item.file, []);
1594
- scopes.get(item.file).push(value);
1595
- }
1596
- return {
1597
- key,
1598
- paths: Array.from(scopes.keys()),
1599
- scopes,
1600
- value,
1601
- values
1602
- };
1603
- }
1604
- function configFilePath(filePath) {
1605
- return filePath.replace(/^(file):/, "");
1606
- }
1607
- function* configParser(text, requestedKey = null) {
1608
- const lines = text.split("\0");
1609
- for (let i = 0, max = lines.length - 1; i < max;) {
1610
- const file = configFilePath(lines[i++]);
1611
- let value = lines[i++];
1612
- let key = requestedKey;
1613
- if (value.includes("\n")) {
1614
- const line = splitOn(value, "\n");
1615
- key = line[0];
1616
- value = line[1];
1617
- }
1618
- yield {
1619
- file,
1620
- key,
1621
- value
1622
- };
1623
- }
1624
- }
1625
- var ConfigList;
1626
- var init_ConfigList = __esm({ "src/lib/responses/ConfigList.ts"() {
1627
- "use strict";
1628
- init_utils();
1629
- ConfigList = class {
1630
- constructor() {
1631
- this.files = [];
1632
- this.values = /* @__PURE__ */ Object.create(null);
1633
- }
1634
- get all() {
1635
- if (!this._all) this._all = this.files.reduce((all, file) => {
1636
- return Object.assign(all, this.values[file]);
1637
- }, {});
1638
- return this._all;
1639
- }
1640
- addFile(file) {
1641
- if (!(file in this.values)) {
1642
- const latest = last(this.files);
1643
- this.values[file] = latest ? Object.create(this.values[latest]) : {};
1644
- this.files.push(file);
1645
- }
1646
- return this.values[file];
1647
- }
1648
- addValue(file, key, value) {
1649
- const values = this.addFile(file);
1650
- if (!Object.hasOwn(values, key)) values[key] = value;
1651
- else if (Array.isArray(values[key])) values[key].push(value);
1652
- else values[key] = [values[key], value];
1653
- this._all = void 0;
1654
- }
1655
- };
1656
- } });
1657
- function asConfigScope(scope, fallback) {
1658
- if (typeof scope === "string" && Object.hasOwn(GitConfigScope, scope)) return scope;
1659
- return fallback;
1660
- }
1661
- function addConfigTask(key, value, append2, scope) {
1662
- const commands = ["config", `--${scope}`];
1663
- if (append2) commands.push("--add");
1664
- commands.push(key, value);
1665
- return {
1666
- commands,
1667
- format: "utf-8",
1668
- parser(text) {
1669
- return text;
1670
- }
1671
- };
1672
- }
1673
- function getConfigTask(key, scope) {
1674
- const commands = [
1675
- "config",
1676
- "--null",
1677
- "--show-origin",
1678
- "--get-all",
1679
- key
1680
- ];
1681
- if (scope) commands.splice(1, 0, `--${scope}`);
1682
- return {
1683
- commands,
1684
- format: "utf-8",
1685
- parser(text) {
1686
- return configGetParser(text, key);
1687
- }
1688
- };
1689
- }
1690
- function listConfigTask(scope) {
1691
- const commands = [
1692
- "config",
1693
- "--list",
1694
- "--show-origin",
1695
- "--null"
1696
- ];
1697
- if (scope) commands.push(`--${scope}`);
1698
- return {
1699
- commands,
1700
- format: "utf-8",
1701
- parser(text) {
1702
- return configListParser(text);
1703
- }
1704
- };
1705
- }
1706
- function config_default() {
1707
- return {
1708
- addConfig(key, value, ...rest) {
1709
- return this._runTask(addConfigTask(key, value, rest[0] === true, asConfigScope(rest[1], "local")), trailingFunctionArgument(arguments));
1710
- },
1711
- getConfig(key, scope) {
1712
- return this._runTask(getConfigTask(key, asConfigScope(scope, void 0)), trailingFunctionArgument(arguments));
1713
- },
1714
- listConfig(...rest) {
1715
- return this._runTask(listConfigTask(asConfigScope(rest[0], void 0)), trailingFunctionArgument(arguments));
1716
- }
1717
- };
1718
- }
1719
- var GitConfigScope;
1720
- var init_config = __esm({ "src/lib/tasks/config.ts"() {
1721
- "use strict";
1722
- init_ConfigList();
1723
- init_utils();
1724
- GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {
1725
- GitConfigScope2["system"] = "system";
1726
- GitConfigScope2["global"] = "global";
1727
- GitConfigScope2["local"] = "local";
1728
- GitConfigScope2["worktree"] = "worktree";
1729
- return GitConfigScope2;
1730
- })(GitConfigScope || {});
1731
- } });
1732
- function isDiffNameStatus(input) {
1733
- return diffNameStatus.has(input);
1734
- }
1735
- var DiffNameStatus, diffNameStatus;
1736
- var init_diff_name_status = __esm({ "src/lib/tasks/diff-name-status.ts"() {
1737
- "use strict";
1738
- DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {
1739
- DiffNameStatus2["ADDED"] = "A";
1740
- DiffNameStatus2["COPIED"] = "C";
1741
- DiffNameStatus2["DELETED"] = "D";
1742
- DiffNameStatus2["MODIFIED"] = "M";
1743
- DiffNameStatus2["RENAMED"] = "R";
1744
- DiffNameStatus2["CHANGED"] = "T";
1745
- DiffNameStatus2["UNMERGED"] = "U";
1746
- DiffNameStatus2["UNKNOWN"] = "X";
1747
- DiffNameStatus2["BROKEN"] = "B";
1748
- return DiffNameStatus2;
1749
- })(DiffNameStatus || {});
1750
- diffNameStatus = new Set(Object.values(DiffNameStatus));
1751
- } });
1752
- function grepQueryBuilder(...params) {
1753
- return new GrepQuery().param(...params);
1754
- }
1755
- function parseGrep(grep) {
1756
- const paths = /* @__PURE__ */ new Set();
1757
- const results = {};
1758
- forEachLineWithContent(grep, (input) => {
1759
- const [path, line, preview] = input.split(NULL);
1760
- paths.add(path);
1761
- (results[path] = results[path] || []).push({
1762
- line: asNumber(line),
1763
- path,
1764
- preview
1765
- });
1766
- });
1767
- return {
1768
- paths,
1769
- results
1770
- };
1771
- }
1772
- function grep_default() {
1773
- return { grep(searchTerm) {
1774
- const then = trailingFunctionArgument(arguments);
1775
- const options = getTrailingOptions(arguments);
1776
- for (const option of disallowedOptions) if (options.includes(option)) return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then);
1777
- if (typeof searchTerm === "string") searchTerm = grepQueryBuilder().param(searchTerm);
1778
- const commands = [
1779
- "grep",
1780
- "--null",
1781
- "-n",
1782
- "--full-name",
1783
- ...options,
1784
- ...searchTerm
1785
- ];
1786
- return this._runTask({
1787
- commands,
1788
- format: "utf-8",
1789
- parser(stdOut) {
1790
- return parseGrep(stdOut);
1791
- }
1792
- }, then);
1793
- } };
1794
- }
1795
- var disallowedOptions, Query, _a, GrepQuery;
1796
- var init_grep = __esm({ "src/lib/tasks/grep.ts"() {
1797
- "use strict";
1798
- init_utils();
1799
- init_task();
1800
- disallowedOptions = ["-h"];
1801
- Query = Symbol("grepQuery");
1802
- GrepQuery = class {
1803
- constructor() {
1804
- this[_a] = [];
1805
- }
1806
- *[(_a = Query, Symbol.iterator)]() {
1807
- for (const query of this[Query]) yield query;
1808
- }
1809
- and(...and) {
1810
- and.length && this[Query].push("--and", "(", ...prefixedArray(and, "-e"), ")");
1811
- return this;
1812
- }
1813
- param(...param) {
1814
- this[Query].push(...prefixedArray(param, "-e"));
1815
- return this;
1816
- }
1817
- };
1818
- } });
1819
- var reset_exports = {};
1820
- __export(reset_exports, {
1821
- ResetMode: () => ResetMode,
1822
- getResetMode: () => getResetMode,
1823
- resetTask: () => resetTask
1824
- });
1825
- function resetTask(mode, customArgs) {
1826
- const commands = ["reset"];
1827
- if (isValidResetMode(mode)) commands.push(`--${mode}`);
1828
- commands.push(...customArgs);
1829
- return straightThroughStringTask(commands);
1830
- }
1831
- function getResetMode(mode) {
1832
- if (isValidResetMode(mode)) return mode;
1833
- switch (typeof mode) {
1834
- case "string":
1835
- case "undefined": return "soft";
1836
- }
1837
- }
1838
- function isValidResetMode(mode) {
1839
- return typeof mode === "string" && validResetModes.includes(mode);
1840
- }
1841
- var ResetMode, validResetModes;
1842
- var init_reset = __esm({ "src/lib/tasks/reset.ts"() {
1843
- "use strict";
1844
- init_utils();
1845
- init_task();
1846
- ResetMode = /* @__PURE__ */ ((ResetMode2) => {
1847
- ResetMode2["MIXED"] = "mixed";
1848
- ResetMode2["SOFT"] = "soft";
1849
- ResetMode2["HARD"] = "hard";
1850
- ResetMode2["MERGE"] = "merge";
1851
- ResetMode2["KEEP"] = "keep";
1852
- return ResetMode2;
1853
- })(ResetMode || {});
1854
- validResetModes = asStringArray(Object.values(ResetMode));
1855
- } });
1856
- function createLog() {
1857
- return (0, import_src.default)("simple-git");
1858
- }
1859
- function prefixedLogger(to, prefix, forward) {
1860
- if (!prefix || !String(prefix).replace(/\s*/, "")) return !forward ? to : (message, ...args) => {
1861
- to(message, ...args);
1862
- forward(message, ...args);
1863
- };
1864
- return (message, ...args) => {
1865
- to(`%s ${message}`, prefix, ...args);
1866
- if (forward) forward(message, ...args);
1867
- };
1868
- }
1869
- function childLoggerName(name, childDebugger, { namespace: parentNamespace }) {
1870
- if (typeof name === "string") return name;
1871
- const childNamespace = childDebugger && childDebugger.namespace || "";
1872
- if (childNamespace.startsWith(parentNamespace)) return childNamespace.substr(parentNamespace.length + 1);
1873
- return childNamespace || parentNamespace;
1874
- }
1875
- function createLogger(label, verbose, initialStep, infoDebugger = createLog()) {
1876
- const labelPrefix = label && `[${label}]` || "";
1877
- const spawned = [];
1878
- const debugDebugger = typeof verbose === "string" ? infoDebugger.extend(verbose) : verbose;
1879
- const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);
1880
- return step(initialStep);
1881
- function sibling(name, initial) {
1882
- return append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger));
1883
- }
1884
- function step(phase) {
1885
- const stepPrefix = phase && `[${phase}]` || "";
1886
- const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP;
1887
- const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2);
1888
- return Object.assign(debugDebugger ? debug2 : info, {
1889
- label,
1890
- sibling,
1891
- info,
1892
- step
1893
- });
1894
- }
1895
- }
1896
- var init_git_logger = __esm({ "src/lib/git-logger.ts"() {
1897
- "use strict";
1898
- init_utils();
1899
- import_src.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
1900
- import_src.default.formatters.B = (value) => {
1901
- if (Buffer.isBuffer(value)) return value.toString("utf8");
1902
- return objectToString(value);
1903
- };
1904
- } });
1905
- var TasksPendingQueue;
1906
- var init_tasks_pending_queue = __esm({ "src/lib/runners/tasks-pending-queue.ts"() {
1907
- "use strict";
1908
- init_git_error();
1909
- init_git_logger();
1910
- TasksPendingQueue = class _TasksPendingQueue {
1911
- constructor(logLabel = "GitExecutor") {
1912
- this.logLabel = logLabel;
1913
- this._queue = /* @__PURE__ */ new Map();
1914
- }
1915
- withProgress(task) {
1916
- return this._queue.get(task);
1917
- }
1918
- createProgress(task) {
1919
- const name = _TasksPendingQueue.getName(task.commands[0]);
1920
- return {
1921
- task,
1922
- logger: createLogger(this.logLabel, name),
1923
- name
1924
- };
1925
- }
1926
- push(task) {
1927
- const progress = this.createProgress(task);
1928
- progress.logger("Adding task to the queue, commands = %o", task.commands);
1929
- this._queue.set(task, progress);
1930
- return progress;
1931
- }
1932
- fatal(err) {
1933
- for (const [task, { logger }] of Array.from(this._queue.entries())) {
1934
- if (task === err.task) {
1935
- logger.info(`Failed %o`, err);
1936
- logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`);
1937
- } else logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message);
1938
- this.complete(task);
1939
- }
1940
- if (this._queue.size !== 0) throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);
1941
- }
1942
- complete(task) {
1943
- if (this.withProgress(task)) this._queue.delete(task);
1944
- }
1945
- attempt(task) {
1946
- const progress = this.withProgress(task);
1947
- if (!progress) throw new GitError(void 0, "TasksPendingQueue: attempt called for an unknown task");
1948
- progress.logger("Starting task");
1949
- return progress;
1950
- }
1951
- static getName(name = "empty") {
1952
- return `task:${name}:${++_TasksPendingQueue.counter}`;
1953
- }
1954
- static {
1955
- this.counter = 0;
1956
- }
1957
- };
1958
- } });
1959
- function pluginContext(task, commands) {
1960
- return {
1961
- method: first(task.commands) || "",
1962
- commands
1963
- };
1964
- }
1965
- function onErrorReceived(target, logger) {
1966
- return (err) => {
1967
- logger(`[ERROR] child process exception %o`, err);
1968
- target.push(Buffer.from(String(err.stack), "ascii"));
1969
- };
1970
- }
1971
- function onDataReceived(target, name, logger, output) {
1972
- return (buffer) => {
1973
- logger(`%s received %L bytes`, name, buffer);
1974
- output(`%B`, buffer);
1975
- target.push(buffer);
1976
- };
1977
- }
1978
- var GitExecutorChain;
1979
- var init_git_executor_chain = __esm({ "src/lib/runners/git-executor-chain.ts"() {
1980
- "use strict";
1981
- init_git_error();
1982
- init_task();
1983
- init_utils();
1984
- init_tasks_pending_queue();
1985
- GitExecutorChain = class {
1986
- constructor(_executor, _scheduler, _plugins) {
1987
- this._executor = _executor;
1988
- this._scheduler = _scheduler;
1989
- this._plugins = _plugins;
1990
- this._chain = Promise.resolve();
1991
- this._queue = new TasksPendingQueue();
1992
- }
1993
- get cwd() {
1994
- return this._cwd || this._executor.cwd;
1995
- }
1996
- set cwd(cwd) {
1997
- this._cwd = cwd;
1998
- }
1999
- get env() {
2000
- return this._executor.env;
2001
- }
2002
- get outputHandler() {
2003
- return this._executor.outputHandler;
2004
- }
2005
- chain() {
2006
- return this;
2007
- }
2008
- push(task) {
2009
- this._queue.push(task);
2010
- return this._chain = this._chain.then(() => this.attemptTask(task));
2011
- }
2012
- async attemptTask(task) {
2013
- const onScheduleComplete = await this._scheduler.next();
2014
- const onQueueComplete = () => this._queue.complete(task);
2015
- try {
2016
- const { logger } = this._queue.attempt(task);
2017
- return await (isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger));
2018
- } catch (e) {
2019
- throw this.onFatalException(task, e);
2020
- } finally {
2021
- onQueueComplete();
2022
- onScheduleComplete();
2023
- }
2024
- }
2025
- onFatalException(task, e) {
2026
- const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
2027
- this._chain = Promise.resolve();
2028
- this._queue.fatal(gitError);
2029
- return gitError;
2030
- }
2031
- async attemptRemoteTask(task, logger) {
2032
- const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
2033
- const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext(task, task.commands));
2034
- const raw = await this.gitResponse(task, binary, args, this.outputHandler, logger.step("SPAWN"));
2035
- const outputStreams = await this.handleTaskData(task, args, raw, logger.step("HANDLE"));
2036
- logger(`passing response to task's parser as a %s`, task.format);
2037
- if (isBufferTask(task)) return callTaskParser(task.parser, outputStreams);
2038
- return callTaskParser(task.parser, outputStreams.asStrings());
2039
- }
2040
- async attemptEmptyTask(task, logger) {
2041
- logger(`empty task bypassing child process to call to task's parser`);
2042
- return task.parser(this);
2043
- }
2044
- handleTaskData(task, args, result, logger) {
2045
- const { exitCode, rejection, stdOut, stdErr } = result;
2046
- return new Promise((done, fail) => {
2047
- logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
2048
- const { error } = this._plugins.exec("task.error", { error: rejection }, {
2049
- ...pluginContext(task, args),
2050
- ...result
2051
- });
2052
- if (error && task.onError) {
2053
- logger.info(`exitCode=%s handling with custom error handler`);
2054
- return task.onError(result, error, (newStdOut) => {
2055
- logger.info(`custom error handler treated as success`);
2056
- logger(`custom error returned a %s`, objectToString(newStdOut));
2057
- done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr)));
2058
- }, fail);
2059
- }
2060
- if (error) {
2061
- logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection);
2062
- return fail(error);
2063
- }
2064
- logger.info(`retrieving task output complete`);
2065
- done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
2066
- });
2067
- }
2068
- async gitResponse(task, command, args, outputHandler, logger) {
2069
- const outputLogger = logger.sibling("output");
2070
- const spawnOptions = this._plugins.exec("spawn.options", {
2071
- cwd: this.cwd,
2072
- env: this.env,
2073
- windowsHide: true
2074
- }, pluginContext(task, task.commands));
2075
- return new Promise((done) => {
2076
- const stdOut = [];
2077
- const stdErr = [];
2078
- logger.info(`%s %o`, command, args);
2079
- logger("%O", spawnOptions);
2080
- let rejection = this._beforeSpawn(task, args);
2081
- if (rejection) return done({
2082
- stdOut,
2083
- stdErr,
2084
- exitCode: 9901,
2085
- rejection
2086
- });
2087
- this._plugins.exec("spawn.before", void 0, {
2088
- ...pluginContext(task, args),
2089
- kill(reason) {
2090
- rejection = reason || rejection;
2091
- }
2092
- });
2093
- const spawned = (0, child_process.spawn)(command, args, spawnOptions);
2094
- spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")));
2095
- spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")));
2096
- spawned.on("error", onErrorReceived(stdErr, logger));
2097
- if (outputHandler) {
2098
- logger(`Passing child process stdOut/stdErr to custom outputHandler`);
2099
- outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
2100
- }
2101
- this._plugins.exec("spawn.after", void 0, {
2102
- ...pluginContext(task, args),
2103
- spawned,
2104
- close(exitCode, reason) {
2105
- done({
2106
- stdOut,
2107
- stdErr,
2108
- exitCode,
2109
- rejection: rejection || reason
2110
- });
2111
- },
2112
- kill(reason) {
2113
- if (spawned.killed) return;
2114
- rejection = reason;
2115
- spawned.kill("SIGINT");
2116
- }
2117
- });
2118
- });
2119
- }
2120
- _beforeSpawn(task, args) {
2121
- let rejection;
2122
- this._plugins.exec("spawn.before", void 0, {
2123
- ...pluginContext(task, args),
2124
- kill(reason) {
2125
- rejection = reason || rejection;
2126
- }
2127
- });
2128
- return rejection;
2129
- }
2130
- };
2131
- } });
2132
- var git_executor_exports = {};
2133
- __export(git_executor_exports, { GitExecutor: () => GitExecutor });
2134
- var GitExecutor;
2135
- var init_git_executor = __esm({ "src/lib/runners/git-executor.ts"() {
2136
- "use strict";
2137
- init_git_executor_chain();
2138
- GitExecutor = class {
2139
- constructor(cwd, _scheduler, _plugins) {
2140
- this.cwd = cwd;
2141
- this._scheduler = _scheduler;
2142
- this._plugins = _plugins;
2143
- this._chain = new GitExecutorChain(this, this._scheduler, this._plugins);
2144
- }
2145
- chain() {
2146
- return new GitExecutorChain(this, this._scheduler, this._plugins);
2147
- }
2148
- push(task) {
2149
- return this._chain.push(task);
2150
- }
2151
- };
2152
- } });
2153
- function taskCallback(task, response, callback = NOOP) {
2154
- const onSuccess = (data) => {
2155
- callback(null, data);
2156
- };
2157
- const onError2 = (err) => {
2158
- if (err?.task === task) callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, void 0);
2159
- };
2160
- response.then(onSuccess, onError2);
2161
- }
2162
- function addDeprecationNoticeToError(err) {
2163
- let log = (name) => {
2164
- console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`);
2165
- log = NOOP;
2166
- };
2167
- return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
2168
- function descriptorReducer(all, name) {
2169
- if (name in err) return all;
2170
- all[name] = {
2171
- enumerable: false,
2172
- configurable: false,
2173
- get() {
2174
- log(name);
2175
- return err.git[name];
2176
- }
2177
- };
2178
- return all;
2179
- }
2180
- }
2181
- var init_task_callback = __esm({ "src/lib/task-callback.ts"() {
2182
- "use strict";
2183
- init_git_response_error();
2184
- init_utils();
2185
- } });
2186
- function changeWorkingDirectoryTask(directory, root) {
2187
- return adhocExecTask((instance) => {
2188
- if (!folderExists(directory)) throw new Error(`Git.cwd: cannot change to non-directory "${directory}"`);
2189
- return (root || instance).cwd = directory;
2190
- });
2191
- }
2192
- var init_change_working_directory = __esm({ "src/lib/tasks/change-working-directory.ts"() {
2193
- "use strict";
2194
- init_utils();
2195
- init_task();
2196
- } });
2197
- function checkoutTask(args) {
2198
- const commands = ["checkout", ...args];
2199
- if (commands[1] === "-b" && commands.includes("-B")) commands[1] = remove(commands, "-B");
2200
- return straightThroughStringTask(commands);
2201
- }
2202
- function checkout_default() {
2203
- return {
2204
- checkout() {
2205
- return this._runTask(checkoutTask(getTrailingOptions(arguments, 1)), trailingFunctionArgument(arguments));
2206
- },
2207
- checkoutBranch(branchName, startPoint) {
2208
- return this._runTask(checkoutTask([
2209
- "-b",
2210
- branchName,
2211
- startPoint,
2212
- ...getTrailingOptions(arguments)
2213
- ]), trailingFunctionArgument(arguments));
2214
- },
2215
- checkoutLocalBranch(branchName) {
2216
- return this._runTask(checkoutTask([
2217
- "-b",
2218
- branchName,
2219
- ...getTrailingOptions(arguments)
2220
- ]), trailingFunctionArgument(arguments));
2221
- }
2222
- };
2223
- }
2224
- var init_checkout = __esm({ "src/lib/tasks/checkout.ts"() {
2225
- "use strict";
2226
- init_utils();
2227
- init_task();
2228
- } });
2229
- function countObjectsResponse() {
2230
- return {
2231
- count: 0,
2232
- garbage: 0,
2233
- inPack: 0,
2234
- packs: 0,
2235
- prunePackable: 0,
2236
- size: 0,
2237
- sizeGarbage: 0,
2238
- sizePack: 0
2239
- };
2240
- }
2241
- function count_objects_default() {
2242
- return { countObjects() {
2243
- return this._runTask({
2244
- commands: ["count-objects", "--verbose"],
2245
- format: "utf-8",
2246
- parser(stdOut) {
2247
- return parseStringResponse(countObjectsResponse(), [parser2], stdOut);
2248
- }
2249
- });
2250
- } };
2251
- }
2252
- var parser2;
2253
- var init_count_objects = __esm({ "src/lib/tasks/count-objects.ts"() {
2254
- "use strict";
2255
- init_utils();
2256
- parser2 = new LineParser(/([a-z-]+): (\d+)$/, (result, [key, value]) => {
2257
- const property = asCamelCase(key);
2258
- if (Object.hasOwn(result, property)) result[property] = asNumber(value);
2259
- });
2260
- } });
2261
- function parseCommitResult(stdOut) {
2262
- return parseStringResponse({
2263
- author: null,
2264
- branch: "",
2265
- commit: "",
2266
- root: false,
2267
- summary: {
2268
- changes: 0,
2269
- insertions: 0,
2270
- deletions: 0
2271
- }
2272
- }, parsers, stdOut);
2273
- }
2274
- var parsers;
2275
- var init_parse_commit = __esm({ "src/lib/parsers/parse-commit.ts"() {
2276
- "use strict";
2277
- init_utils();
2278
- parsers = [
2279
- new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => {
2280
- result.branch = branch;
2281
- result.commit = commit;
2282
- result.root = !!root;
2283
- }),
2284
- new LineParser(/\s*Author:\s(.+)/i, (result, [author]) => {
2285
- const parts = author.split("<");
2286
- const email = parts.pop();
2287
- if (!email || !email.includes("@")) return;
2288
- result.author = {
2289
- email: email.substr(0, email.length - 1),
2290
- name: parts.join("<").trim()
2291
- };
2292
- }),
2293
- new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => {
2294
- result.summary.changes = parseInt(changes, 10) || 0;
2295
- result.summary.insertions = parseInt(insertions, 10) || 0;
2296
- result.summary.deletions = parseInt(deletions, 10) || 0;
2297
- }),
2298
- new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => {
2299
- result.summary.changes = parseInt(changes, 10) || 0;
2300
- const count = parseInt(lines, 10) || 0;
2301
- if (direction === "-") result.summary.deletions = count;
2302
- else if (direction === "+") result.summary.insertions = count;
2303
- })
2304
- ];
2305
- } });
2306
- function commitTask(message, files, customArgs) {
2307
- return {
2308
- commands: [
2309
- "-c",
2310
- "core.abbrev=40",
2311
- "commit",
2312
- ...prefixedArray(message, "-m"),
2313
- ...files,
2314
- ...customArgs
2315
- ],
2316
- format: "utf-8",
2317
- parser: parseCommitResult
2318
- };
2319
- }
2320
- function commit_default() {
2321
- return { commit(message, ...rest) {
2322
- const next = trailingFunctionArgument(arguments);
2323
- const task = rejectDeprecatedSignatures(message) || commitTask(asArray(message), asArray(filterType(rest[0], filterStringOrStringArray, [])), [...asStringArray(filterType(rest[1], filterArray, [])), ...getTrailingOptions(arguments, 0, true)]);
2324
- return this._runTask(task, next);
2325
- } };
2326
- function rejectDeprecatedSignatures(message) {
2327
- return !filterStringOrStringArray(message) && configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`);
2328
- }
2329
- }
2330
- var init_commit = __esm({ "src/lib/tasks/commit.ts"() {
2331
- "use strict";
2332
- init_parse_commit();
2333
- init_utils();
2334
- init_task();
2335
- } });
2336
- function first_commit_default() {
2337
- return { firstCommit() {
2338
- return this._runTask(straightThroughStringTask([
2339
- "rev-list",
2340
- "--max-parents=0",
2341
- "HEAD"
2342
- ], true), trailingFunctionArgument(arguments));
2343
- } };
2344
- }
2345
- var init_first_commit = __esm({ "src/lib/tasks/first-commit.ts"() {
2346
- "use strict";
2347
- init_utils();
2348
- init_task();
2349
- } });
2350
- function hashObjectTask(filePath, write) {
2351
- const commands = ["hash-object", filePath];
2352
- if (write) commands.push("-w");
2353
- return straightThroughStringTask(commands, true);
2354
- }
2355
- var init_hash_object = __esm({ "src/lib/tasks/hash-object.ts"() {
2356
- "use strict";
2357
- init_task();
2358
- } });
2359
- function parseInit(bare, path, text) {
2360
- const response = String(text).trim();
2361
- let result;
2362
- if (result = initResponseRegex.exec(response)) return new InitSummary(bare, path, false, result[1]);
2363
- if (result = reInitResponseRegex.exec(response)) return new InitSummary(bare, path, true, result[1]);
2364
- let gitDir = "";
2365
- const tokens = response.split(" ");
2366
- while (tokens.length) if (tokens.shift() === "in") {
2367
- gitDir = tokens.join(" ");
2368
- break;
2369
- }
2370
- return new InitSummary(bare, path, /^re/i.test(response), gitDir);
2371
- }
2372
- var InitSummary, initResponseRegex, reInitResponseRegex;
2373
- var init_InitSummary = __esm({ "src/lib/responses/InitSummary.ts"() {
2374
- "use strict";
2375
- InitSummary = class {
2376
- constructor(bare, path, existing, gitDir) {
2377
- this.bare = bare;
2378
- this.path = path;
2379
- this.existing = existing;
2380
- this.gitDir = gitDir;
2381
- }
2382
- };
2383
- initResponseRegex = /^Init.+ repository in (.+)$/;
2384
- reInitResponseRegex = /^Rein.+ in (.+)$/;
2385
- } });
2386
- function hasBareCommand(command) {
2387
- return command.includes(bareCommand);
2388
- }
2389
- function initTask(bare = false, path, customArgs) {
2390
- const commands = ["init", ...customArgs];
2391
- if (bare && !hasBareCommand(commands)) commands.splice(1, 0, bareCommand);
2392
- return {
2393
- commands,
2394
- format: "utf-8",
2395
- parser(text) {
2396
- return parseInit(commands.includes("--bare"), path, text);
2397
- }
2398
- };
2399
- }
2400
- var bareCommand;
2401
- var init_init = __esm({ "src/lib/tasks/init.ts"() {
2402
- "use strict";
2403
- init_InitSummary();
2404
- bareCommand = "--bare";
2405
- } });
2406
- function logFormatFromCommand(customArgs) {
2407
- for (let i = 0; i < customArgs.length; i++) {
2408
- const format = logFormatRegex.exec(customArgs[i]);
2409
- if (format) return `--${format[1]}`;
2410
- }
2411
- return "";
2412
- }
2413
- function isLogFormat(customArg) {
2414
- return logFormatRegex.test(customArg);
2415
- }
2416
- var logFormatRegex;
2417
- var init_log_format = __esm({ "src/lib/args/log-format.ts"() {
2418
- "use strict";
2419
- logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;
2420
- } });
2421
- var DiffSummary;
2422
- var init_DiffSummary = __esm({ "src/lib/responses/DiffSummary.ts"() {
2423
- "use strict";
2424
- DiffSummary = class {
2425
- constructor() {
2426
- this.changed = 0;
2427
- this.deletions = 0;
2428
- this.insertions = 0;
2429
- this.files = [];
2430
- }
2431
- };
2432
- } });
2433
- function getDiffParser(format = "") {
2434
- const parser4 = diffSummaryParsers[format];
2435
- return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false);
2436
- }
2437
- var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers;
2438
- var init_parse_diff_summary = __esm({ "src/lib/parsers/parse-diff-summary.ts"() {
2439
- "use strict";
2440
- init_log_format();
2441
- init_DiffSummary();
2442
- init_diff_name_status();
2443
- init_utils();
2444
- statParser = [
2445
- new LineParser(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => {
2446
- result.files.push({
2447
- file: file.trim(),
2448
- changes: asNumber(changes),
2449
- insertions: alterations.replace(/[^+]/g, "").length,
2450
- deletions: alterations.replace(/[^-]/g, "").length,
2451
- binary: false
2452
- });
2453
- }),
2454
- new LineParser(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, (result, [file, before, after]) => {
2455
- result.files.push({
2456
- file: file.trim(),
2457
- before: asNumber(before),
2458
- after: asNumber(after),
2459
- binary: true
2460
- });
2461
- }),
2462
- new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, (result, [changed, summary]) => {
2463
- const inserted = /(\d+) i/.exec(summary);
2464
- const deleted = /(\d+) d/.exec(summary);
2465
- result.changed = asNumber(changed);
2466
- result.insertions = asNumber(inserted?.[1]);
2467
- result.deletions = asNumber(deleted?.[1]);
2468
- })
2469
- ];
2470
- numStatParser = [new LineParser(/(\d+)\t(\d+)\t(.+)$/, (result, [changesInsert, changesDelete, file]) => {
2471
- const insertions = asNumber(changesInsert);
2472
- const deletions = asNumber(changesDelete);
2473
- result.changed++;
2474
- result.insertions += insertions;
2475
- result.deletions += deletions;
2476
- result.files.push({
2477
- file,
2478
- changes: insertions + deletions,
2479
- insertions,
2480
- deletions,
2481
- binary: false
2482
- });
2483
- }), new LineParser(/-\t-\t(.+)$/, (result, [file]) => {
2484
- result.changed++;
2485
- result.files.push({
2486
- file,
2487
- after: 0,
2488
- before: 0,
2489
- binary: true
2490
- });
2491
- })];
2492
- nameOnlyParser = [new LineParser(/(.+)$/, (result, [file]) => {
2493
- result.changed++;
2494
- result.files.push({
2495
- file,
2496
- changes: 0,
2497
- insertions: 0,
2498
- deletions: 0,
2499
- binary: false
2500
- });
2501
- })];
2502
- nameStatusParser = [new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, similarity, from, _to, to]) => {
2503
- result.changed++;
2504
- result.files.push({
2505
- file: to ?? from,
2506
- changes: 0,
2507
- insertions: 0,
2508
- deletions: 0,
2509
- binary: false,
2510
- status: orVoid(isDiffNameStatus(status) && status),
2511
- from: orVoid(!!to && from !== to && from),
2512
- similarity: asNumber(similarity)
2513
- });
2514
- })];
2515
- diffSummaryParsers = {
2516
- [""]: statParser,
2517
- ["--stat"]: statParser,
2518
- ["--numstat"]: numStatParser,
2519
- ["--name-status"]: nameStatusParser,
2520
- ["--name-only"]: nameOnlyParser
2521
- };
2522
- } });
2523
- function lineBuilder(tokens, fields) {
2524
- return fields.reduce((line, field, index) => {
2525
- line[field] = tokens[index] || "";
2526
- return line;
2527
- }, /* @__PURE__ */ Object.create({ diff: null }));
2528
- }
2529
- function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "") {
2530
- const parseDiffResult = getDiffParser(logFormat);
2531
- return function(stdOut) {
2532
- const all = toLinesWithContent(stdOut.trim(), false, START_BOUNDARY).map(function(item) {
2533
- const lineDetail = item.split(COMMIT_BOUNDARY);
2534
- const listLogLine = lineBuilder(lineDetail[0].split(splitter), fields);
2535
- if (lineDetail.length > 1 && !!lineDetail[1].trim()) listLogLine.diff = parseDiffResult(lineDetail[1]);
2536
- return listLogLine;
2537
- });
2538
- return {
2539
- all,
2540
- latest: all.length && all[0] || null,
2541
- total: all.length
2542
- };
2543
- };
2544
- }
2545
- var START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames;
2546
- var init_parse_list_log_summary = __esm({ "src/lib/parsers/parse-list-log-summary.ts"() {
2547
- "use strict";
2548
- init_utils();
2549
- init_parse_diff_summary();
2550
- init_log_format();
2551
- START_BOUNDARY = "òòòòòò ";
2552
- COMMIT_BOUNDARY = " òò";
2553
- SPLITTER = " ò ";
2554
- defaultFieldNames = [
2555
- "hash",
2556
- "date",
2557
- "message",
2558
- "refs",
2559
- "author_name",
2560
- "author_email"
2561
- ];
2562
- } });
2563
- var diff_exports = {};
2564
- __export(diff_exports, {
2565
- diffSummaryTask: () => diffSummaryTask,
2566
- validateLogFormatConfig: () => validateLogFormatConfig
2567
- });
2568
- function diffSummaryTask(customArgs) {
2569
- let logFormat = logFormatFromCommand(customArgs);
2570
- const commands = ["diff"];
2571
- if (logFormat === "") {
2572
- logFormat = "--stat";
2573
- commands.push("--stat=4096");
2574
- }
2575
- commands.push(...customArgs);
2576
- return validateLogFormatConfig(commands) || {
2577
- commands,
2578
- format: "utf-8",
2579
- parser: getDiffParser(logFormat)
2580
- };
2581
- }
2582
- function validateLogFormatConfig(customArgs) {
2583
- const flags = customArgs.filter(isLogFormat);
2584
- if (flags.length > 1) return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${flags.join(",")}`);
2585
- if (flags.length && customArgs.includes("-z")) return configurationErrorTask(`Summary flag ${flags} parsing is not compatible with null termination option '-z'`);
2586
- }
2587
- var init_diff = __esm({ "src/lib/tasks/diff.ts"() {
2588
- "use strict";
2589
- init_log_format();
2590
- init_parse_diff_summary();
2591
- init_task();
2592
- } });
2593
- function prettyFormat(format, splitter) {
2594
- const fields = [];
2595
- const formatStr = [];
2596
- Object.keys(format).forEach((field) => {
2597
- fields.push(field);
2598
- formatStr.push(String(format[field]));
2599
- });
2600
- return [fields, formatStr.join(splitter)];
2601
- }
2602
- function userOptions(input) {
2603
- return Object.keys(input).reduce((out, key) => {
2604
- if (!(key in excludeOptions)) out[key] = input[key];
2605
- return out;
2606
- }, {});
2607
- }
2608
- function parseLogOptions(opt = {}, customArgs = []) {
2609
- const splitter = filterType(opt.splitter, filterString, SPLITTER);
2610
- const [fields, formatStr] = prettyFormat(filterPlainObject(opt.format) ? opt.format : {
2611
- hash: "%H",
2612
- date: opt.strictDate === false ? "%ai" : "%aI",
2613
- message: "%s",
2614
- refs: "%D",
2615
- body: opt.multiLine ? "%B" : "%b",
2616
- author_name: opt.mailMap !== false ? "%aN" : "%an",
2617
- author_email: opt.mailMap !== false ? "%aE" : "%ae"
2618
- }, splitter);
2619
- const suffix = [];
2620
- const command = [`--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`, ...customArgs];
2621
- const maxCount = opt.n || opt["max-count"] || opt.maxCount;
2622
- if (maxCount) command.push(`--max-count=${maxCount}`);
2623
- if (opt.from || opt.to) {
2624
- const rangeOperator = opt.symmetric !== false ? "..." : "..";
2625
- suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`);
2626
- }
2627
- if (filterString(opt.file)) command.push("--follow", pathspec(opt.file));
2628
- appendTaskOptions(userOptions(opt), command);
2629
- return {
2630
- fields,
2631
- splitter,
2632
- commands: [...command, ...suffix]
2633
- };
2634
- }
2635
- function logTask(splitter, fields, customArgs) {
2636
- const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));
2637
- return {
2638
- commands: ["log", ...customArgs],
2639
- format: "utf-8",
2640
- parser: parser4
2641
- };
2642
- }
2643
- function log_default() {
2644
- return { log(...rest) {
2645
- const next = trailingFunctionArgument(arguments);
2646
- const options = parseLogOptions(trailingOptionsArgument(arguments), asStringArray(filterType(arguments[0], filterArray, [])));
2647
- const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);
2648
- return this._runTask(task, next);
2649
- } };
2650
- function createLogTask(options) {
2651
- return logTask(options.splitter, options.fields, options.commands);
2652
- }
2653
- function rejectDeprecatedSignatures(from, to) {
2654
- return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`);
2655
- }
2656
- }
2657
- var excludeOptions;
2658
- var init_log = __esm({ "src/lib/tasks/log.ts"() {
2659
- "use strict";
2660
- init_log_format();
2661
- init_pathspec();
2662
- init_parse_list_log_summary();
2663
- init_utils();
2664
- init_task();
2665
- init_diff();
2666
- excludeOptions = /* @__PURE__ */ ((excludeOptions2) => {
2667
- excludeOptions2[excludeOptions2["--pretty"] = 0] = "--pretty";
2668
- excludeOptions2[excludeOptions2["max-count"] = 1] = "max-count";
2669
- excludeOptions2[excludeOptions2["maxCount"] = 2] = "maxCount";
2670
- excludeOptions2[excludeOptions2["n"] = 3] = "n";
2671
- excludeOptions2[excludeOptions2["file"] = 4] = "file";
2672
- excludeOptions2[excludeOptions2["format"] = 5] = "format";
2673
- excludeOptions2[excludeOptions2["from"] = 6] = "from";
2674
- excludeOptions2[excludeOptions2["to"] = 7] = "to";
2675
- excludeOptions2[excludeOptions2["splitter"] = 8] = "splitter";
2676
- excludeOptions2[excludeOptions2["symmetric"] = 9] = "symmetric";
2677
- excludeOptions2[excludeOptions2["mailMap"] = 10] = "mailMap";
2678
- excludeOptions2[excludeOptions2["multiLine"] = 11] = "multiLine";
2679
- excludeOptions2[excludeOptions2["strictDate"] = 12] = "strictDate";
2680
- return excludeOptions2;
2681
- })(excludeOptions || {});
2682
- } });
2683
- var MergeSummaryConflict, MergeSummaryDetail;
2684
- var init_MergeSummary = __esm({ "src/lib/responses/MergeSummary.ts"() {
2685
- "use strict";
2686
- MergeSummaryConflict = class {
2687
- constructor(reason, file = null, meta) {
2688
- this.reason = reason;
2689
- this.file = file;
2690
- this.meta = meta;
2691
- }
2692
- toString() {
2693
- return `${this.file}:${this.reason}`;
2694
- }
2695
- };
2696
- MergeSummaryDetail = class {
2697
- constructor() {
2698
- this.conflicts = [];
2699
- this.merges = [];
2700
- this.result = "success";
2701
- }
2702
- get failed() {
2703
- return this.conflicts.length > 0;
2704
- }
2705
- get reason() {
2706
- return this.result;
2707
- }
2708
- toString() {
2709
- if (this.conflicts.length) return `CONFLICTS: ${this.conflicts.join(", ")}`;
2710
- return "OK";
2711
- }
2712
- };
2713
- } });
2714
- var PullSummary, PullFailedSummary;
2715
- var init_PullSummary = __esm({ "src/lib/responses/PullSummary.ts"() {
2716
- "use strict";
2717
- PullSummary = class {
2718
- constructor() {
2719
- this.remoteMessages = { all: [] };
2720
- this.created = [];
2721
- this.deleted = [];
2722
- this.files = [];
2723
- this.deletions = {};
2724
- this.insertions = {};
2725
- this.summary = {
2726
- changes: 0,
2727
- deletions: 0,
2728
- insertions: 0
2729
- };
2730
- }
2731
- };
2732
- PullFailedSummary = class {
2733
- constructor() {
2734
- this.remote = "";
2735
- this.hash = {
2736
- local: "",
2737
- remote: ""
2738
- };
2739
- this.branch = {
2740
- local: "",
2741
- remote: ""
2742
- };
2743
- this.message = "";
2744
- }
2745
- toString() {
2746
- return this.message;
2747
- }
2748
- };
2749
- } });
2750
- function objectEnumerationResult(remoteMessages) {
2751
- return remoteMessages.objects = remoteMessages.objects || {
2752
- compressing: 0,
2753
- counting: 0,
2754
- enumerating: 0,
2755
- packReused: 0,
2756
- reused: {
2757
- count: 0,
2758
- delta: 0
2759
- },
2760
- total: {
2761
- count: 0,
2762
- delta: 0
2763
- }
2764
- };
2765
- }
2766
- function asObjectCount(source) {
2767
- const count = /^\s*(\d+)/.exec(source);
2768
- const delta = /delta (\d+)/i.exec(source);
2769
- return {
2770
- count: asNumber(count && count[1] || "0"),
2771
- delta: asNumber(delta && delta[1] || "0")
2772
- };
2773
- }
2774
- var remoteMessagesObjectParsers;
2775
- var init_parse_remote_objects = __esm({ "src/lib/parsers/parse-remote-objects.ts"() {
2776
- "use strict";
2777
- init_utils();
2778
- remoteMessagesObjectParsers = [
2779
- new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => {
2780
- const key = action.toLowerCase();
2781
- const enumeration = objectEnumerationResult(result.remoteMessages);
2782
- Object.assign(enumeration, { [key]: asNumber(count) });
2783
- }),
2784
- new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => {
2785
- const key = action.toLowerCase();
2786
- const enumeration = objectEnumerationResult(result.remoteMessages);
2787
- Object.assign(enumeration, { [key]: asNumber(count) });
2788
- }),
2789
- new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => {
2790
- const objects = objectEnumerationResult(result.remoteMessages);
2791
- objects.total = asObjectCount(total);
2792
- objects.reused = asObjectCount(reused);
2793
- objects.packReused = asNumber(packReused);
2794
- })
2795
- ];
2796
- } });
2797
- function parseRemoteMessages(_stdOut, stdErr) {
2798
- return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers2, stdErr);
2799
- }
2800
- var parsers2, RemoteMessageSummary;
2801
- var init_parse_remote_messages = __esm({ "src/lib/parsers/parse-remote-messages.ts"() {
2802
- "use strict";
2803
- init_utils();
2804
- init_parse_remote_objects();
2805
- parsers2 = [
2806
- new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text]) => {
2807
- result.remoteMessages.all.push(text.trim());
2808
- return false;
2809
- }),
2810
- ...remoteMessagesObjectParsers,
2811
- new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => {
2812
- result.remoteMessages.pullRequestUrl = pullRequestUrl;
2813
- }),
2814
- new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => {
2815
- result.remoteMessages.vulnerabilities = {
2816
- count: asNumber(count),
2817
- summary,
2818
- url
2819
- };
2820
- })
2821
- ];
2822
- RemoteMessageSummary = class {
2823
- constructor() {
2824
- this.all = [];
2825
- }
2826
- };
2827
- } });
2828
- function parsePullErrorResult(stdOut, stdErr) {
2829
- const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, [stdOut, stdErr]);
2830
- return pullError.message && pullError;
2831
- }
2832
- var FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult;
2833
- var init_parse_pull = __esm({ "src/lib/parsers/parse-pull.ts"() {
2834
- "use strict";
2835
- init_PullSummary();
2836
- init_utils();
2837
- init_parse_remote_messages();
2838
- FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;
2839
- SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
2840
- ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
2841
- parsers3 = [
2842
- new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {
2843
- result.files.push(file);
2844
- if (insertions) result.insertions[file] = insertions.length;
2845
- if (deletions) result.deletions[file] = deletions.length;
2846
- }),
2847
- new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {
2848
- if (insertions !== void 0 || deletions !== void 0) {
2849
- result.summary.changes = +changes || 0;
2850
- result.summary.insertions = +insertions || 0;
2851
- result.summary.deletions = +deletions || 0;
2852
- return true;
2853
- }
2854
- return false;
2855
- }),
2856
- new LineParser(ACTION_REGEX, (result, [action, file]) => {
2857
- append(result.files, file);
2858
- append(action === "create" ? result.created : result.deleted, file);
2859
- })
2860
- ];
2861
- errorParsers = [
2862
- new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),
2863
- new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)),
2864
- new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {
2865
- result.branch.local = branchLocal;
2866
- result.hash.local = hashLocal;
2867
- result.branch.remote = branchRemote;
2868
- result.hash.remote = hashRemote;
2869
- })
2870
- ];
2871
- parsePullDetail = (stdOut, stdErr) => {
2872
- return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]);
2873
- };
2874
- parsePullResult = (stdOut, stdErr) => {
2875
- return Object.assign(new PullSummary(), parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr));
2876
- };
2877
- } });
2878
- var parsers4, parseMergeResult, parseMergeDetail;
2879
- var init_parse_merge = __esm({ "src/lib/parsers/parse-merge.ts"() {
2880
- "use strict";
2881
- init_MergeSummary();
2882
- init_utils();
2883
- init_parse_pull();
2884
- parsers4 = [
2885
- new LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
2886
- summary.merges.push(autoMerge);
2887
- }),
2888
- new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
2889
- summary.conflicts.push(new MergeSummaryConflict(reason, file));
2890
- }),
2891
- new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => {
2892
- summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));
2893
- }),
2894
- new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
2895
- summary.conflicts.push(new MergeSummaryConflict(reason, null));
2896
- }),
2897
- new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
2898
- summary.result = result;
2899
- })
2900
- ];
2901
- parseMergeResult = (stdOut, stdErr) => {
2902
- return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));
2903
- };
2904
- parseMergeDetail = (stdOut) => {
2905
- return parseStringResponse(new MergeSummaryDetail(), parsers4, stdOut);
2906
- };
2907
- } });
2908
- function mergeTask(customArgs) {
2909
- if (!customArgs.length) return configurationErrorTask("Git.merge requires at least one option");
2910
- return {
2911
- commands: ["merge", ...customArgs],
2912
- format: "utf-8",
2913
- parser(stdOut, stdErr) {
2914
- const merge = parseMergeResult(stdOut, stdErr);
2915
- if (merge.failed) throw new GitResponseError(merge);
2916
- return merge;
2917
- }
2918
- };
2919
- }
2920
- var init_merge = __esm({ "src/lib/tasks/merge.ts"() {
2921
- "use strict";
2922
- init_git_response_error();
2923
- init_parse_merge();
2924
- init_task();
2925
- } });
2926
- function pushResultPushedItem(local, remote, status) {
2927
- const deleted = status.includes("deleted");
2928
- const tag = status.includes("tag") || /^refs\/tags/.test(local);
2929
- const alreadyUpdated = !status.includes("new");
2930
- return {
2931
- deleted,
2932
- tag,
2933
- branch: !tag,
2934
- new: !alreadyUpdated,
2935
- alreadyUpdated,
2936
- local,
2937
- remote
2938
- };
2939
- }
2940
- var parsers5, parsePushResult, parsePushDetail;
2941
- var init_parse_push = __esm({ "src/lib/parsers/parse-push.ts"() {
2942
- "use strict";
2943
- init_utils();
2944
- init_parse_remote_messages();
2945
- parsers5 = [
2946
- new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {
2947
- result.repo = repo;
2948
- }),
2949
- new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
2950
- result.ref = {
2951
- ...result.ref || {},
2952
- local
2953
- };
2954
- }),
2955
- new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
2956
- result.pushed.push(pushResultPushedItem(local, remote, type));
2957
- }),
2958
- new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => {
2959
- result.branch = {
2960
- ...result.branch || {},
2961
- local,
2962
- remote,
2963
- remoteName
2964
- };
2965
- }),
2966
- new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => {
2967
- result.update = {
2968
- head: {
2969
- local,
2970
- remote
2971
- },
2972
- hash: {
2973
- from,
2974
- to
2975
- }
2976
- };
2977
- })
2978
- ];
2979
- parsePushResult = (stdOut, stdErr) => {
2980
- const pushDetail = parsePushDetail(stdOut, stdErr);
2981
- const responseDetail = parseRemoteMessages(stdOut, stdErr);
2982
- return {
2983
- ...pushDetail,
2984
- ...responseDetail
2985
- };
2986
- };
2987
- parsePushDetail = (stdOut, stdErr) => {
2988
- return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);
2989
- };
2990
- } });
2991
- var push_exports = {};
2992
- __export(push_exports, {
2993
- pushTagsTask: () => pushTagsTask,
2994
- pushTask: () => pushTask
2995
- });
2996
- function pushTagsTask(ref = {}, customArgs) {
2997
- append(customArgs, "--tags");
2998
- return pushTask(ref, customArgs);
2999
- }
3000
- function pushTask(ref = {}, customArgs) {
3001
- const commands = ["push", ...customArgs];
3002
- if (ref.branch) commands.splice(1, 0, ref.branch);
3003
- if (ref.remote) commands.splice(1, 0, ref.remote);
3004
- remove(commands, "-v");
3005
- append(commands, "--verbose");
3006
- append(commands, "--porcelain");
3007
- return {
3008
- commands,
3009
- format: "utf-8",
3010
- parser: parsePushResult
3011
- };
3012
- }
3013
- var init_push = __esm({ "src/lib/tasks/push.ts"() {
3014
- "use strict";
3015
- init_parse_push();
3016
- init_utils();
3017
- } });
3018
- function show_default() {
3019
- return {
3020
- showBuffer() {
3021
- const commands = ["show", ...getTrailingOptions(arguments, 1)];
3022
- if (!commands.includes("--binary")) commands.splice(1, 0, "--binary");
3023
- return this._runTask(straightThroughBufferTask(commands), trailingFunctionArgument(arguments));
3024
- },
3025
- show() {
3026
- const commands = ["show", ...getTrailingOptions(arguments, 1)];
3027
- return this._runTask(straightThroughStringTask(commands), trailingFunctionArgument(arguments));
3028
- }
3029
- };
3030
- }
3031
- var init_show = __esm({ "src/lib/tasks/show.ts"() {
3032
- "use strict";
3033
- init_utils();
3034
- init_task();
3035
- } });
3036
- var fromPathRegex, FileStatusSummary;
3037
- var init_FileStatusSummary = __esm({ "src/lib/responses/FileStatusSummary.ts"() {
3038
- "use strict";
3039
- fromPathRegex = /^(.+)\0(.+)$/;
3040
- FileStatusSummary = class {
3041
- constructor(path, index, working_dir) {
3042
- this.path = path;
3043
- this.index = index;
3044
- this.working_dir = working_dir;
3045
- if (index === "R" || working_dir === "R") {
3046
- const detail = fromPathRegex.exec(path) || [
3047
- null,
3048
- path,
3049
- path
3050
- ];
3051
- this.from = detail[2] || "";
3052
- this.path = detail[1] || "";
3053
- }
3054
- }
3055
- };
3056
- } });
3057
- function renamedFile(line) {
3058
- const [to, from] = line.split(NULL);
3059
- return {
3060
- from: from || to,
3061
- to
3062
- };
3063
- }
3064
- function parser3(indexX, indexY, handler) {
3065
- return [`${indexX}${indexY}`, handler];
3066
- }
3067
- function conflicts(indexX, ...indexY) {
3068
- return indexY.map((y) => parser3(indexX, y, (result, file) => result.conflicted.push(file)));
3069
- }
3070
- function splitLine(result, lineStr) {
3071
- const trimmed2 = lineStr.trim();
3072
- switch (" ") {
3073
- case trimmed2.charAt(2): return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.slice(3));
3074
- case trimmed2.charAt(1): return data(" ", trimmed2.charAt(0), trimmed2.slice(2));
3075
- default: return;
3076
- }
3077
- function data(index, workingDir, path) {
3078
- const raw = `${index}${workingDir}`;
3079
- const handler = parsers6.get(raw);
3080
- if (handler) handler(result, path);
3081
- if (raw !== "##" && raw !== "!!") result.files.push(new FileStatusSummary(path, index, workingDir));
3082
- }
3083
- }
3084
- var StatusSummary, parsers6, parseStatusSummary;
3085
- var init_StatusSummary = __esm({ "src/lib/responses/StatusSummary.ts"() {
3086
- "use strict";
3087
- init_utils();
3088
- init_FileStatusSummary();
3089
- StatusSummary = class {
3090
- constructor() {
3091
- this.not_added = [];
3092
- this.conflicted = [];
3093
- this.created = [];
3094
- this.deleted = [];
3095
- this.ignored = void 0;
3096
- this.modified = [];
3097
- this.renamed = [];
3098
- this.files = [];
3099
- this.staged = [];
3100
- this.ahead = 0;
3101
- this.behind = 0;
3102
- this.current = null;
3103
- this.tracking = null;
3104
- this.detached = false;
3105
- this.isClean = () => {
3106
- return !this.files.length;
3107
- };
3108
- }
3109
- };
3110
- parsers6 = new Map([
3111
- parser3(" ", "A", (result, file) => result.created.push(file)),
3112
- parser3(" ", "D", (result, file) => result.deleted.push(file)),
3113
- parser3(" ", "M", (result, file) => result.modified.push(file)),
3114
- parser3("A", " ", (result, file) => {
3115
- result.created.push(file);
3116
- result.staged.push(file);
3117
- }),
3118
- parser3("A", "M", (result, file) => {
3119
- result.created.push(file);
3120
- result.staged.push(file);
3121
- result.modified.push(file);
3122
- }),
3123
- parser3("D", " ", (result, file) => {
3124
- result.deleted.push(file);
3125
- result.staged.push(file);
3126
- }),
3127
- parser3("M", " ", (result, file) => {
3128
- result.modified.push(file);
3129
- result.staged.push(file);
3130
- }),
3131
- parser3("M", "M", (result, file) => {
3132
- result.modified.push(file);
3133
- result.staged.push(file);
3134
- }),
3135
- parser3("R", " ", (result, file) => {
3136
- result.renamed.push(renamedFile(file));
3137
- }),
3138
- parser3("R", "M", (result, file) => {
3139
- const renamed = renamedFile(file);
3140
- result.renamed.push(renamed);
3141
- result.modified.push(renamed.to);
3142
- }),
3143
- parser3("!", "!", (_result, _file) => {
3144
- (_result.ignored = _result.ignored || []).push(_file);
3145
- }),
3146
- parser3("?", "?", (result, file) => result.not_added.push(file)),
3147
- ...conflicts("A", "A", "U"),
3148
- ...conflicts("D", "D", "U"),
3149
- ...conflicts("U", "A", "D", "U"),
3150
- ["##", (result, line) => {
3151
- const aheadReg = /ahead (\d+)/;
3152
- const behindReg = /behind (\d+)/;
3153
- const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
3154
- const trackingReg = /\.{3}(\S*)/;
3155
- const onEmptyBranchReg = /\son\s(\S+?)(?=\.{3}|$)/;
3156
- let regexResult = aheadReg.exec(line);
3157
- result.ahead = regexResult && +regexResult[1] || 0;
3158
- regexResult = behindReg.exec(line);
3159
- result.behind = regexResult && +regexResult[1] || 0;
3160
- regexResult = currentReg.exec(line);
3161
- result.current = filterType(regexResult?.[1], filterString, null);
3162
- regexResult = trackingReg.exec(line);
3163
- result.tracking = filterType(regexResult?.[1], filterString, null);
3164
- regexResult = onEmptyBranchReg.exec(line);
3165
- if (regexResult) result.current = filterType(regexResult?.[1], filterString, result.current);
3166
- result.detached = /\(no branch\)/.test(line);
3167
- }]
3168
- ]);
3169
- parseStatusSummary = function(text) {
3170
- const lines = text.split(NULL);
3171
- const status = new StatusSummary();
3172
- for (let i = 0, l = lines.length; i < l;) {
3173
- let line = lines[i++].trim();
3174
- if (!line) continue;
3175
- if (line.charAt(0) === "R") line += NULL + (lines[i++] || "");
3176
- splitLine(status, line);
3177
- }
3178
- return status;
3179
- };
3180
- } });
3181
- function statusTask(customArgs) {
3182
- return {
3183
- format: "utf-8",
3184
- commands: [
3185
- "status",
3186
- "--porcelain",
3187
- "-b",
3188
- "-u",
3189
- "--null",
3190
- ...customArgs.filter((arg) => !ignoredOptions.includes(arg))
3191
- ],
3192
- parser(text) {
3193
- return parseStatusSummary(text);
3194
- }
3195
- };
3196
- }
3197
- var ignoredOptions;
3198
- var init_status = __esm({ "src/lib/tasks/status.ts"() {
3199
- "use strict";
3200
- init_StatusSummary();
3201
- ignoredOptions = ["--null", "-z"];
3202
- } });
3203
- function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) {
3204
- return Object.defineProperty({
3205
- major,
3206
- minor,
3207
- patch,
3208
- agent,
3209
- installed
3210
- }, "toString", {
3211
- value() {
3212
- return `${this.major}.${this.minor}.${this.patch}`;
3213
- },
3214
- configurable: false,
3215
- enumerable: false
3216
- });
3217
- }
3218
- function notInstalledResponse() {
3219
- return versionResponse(0, 0, 0, "", false);
3220
- }
3221
- function version_default() {
3222
- return { version() {
3223
- return this._runTask({
3224
- commands: ["--version"],
3225
- format: "utf-8",
3226
- parser: versionParser,
3227
- onError(result, error, done, fail) {
3228
- if (result.exitCode === -2) return done(Buffer.from(NOT_INSTALLED));
3229
- fail(error);
3230
- }
3231
- });
3232
- } };
3233
- }
3234
- function versionParser(stdOut) {
3235
- if (stdOut === NOT_INSTALLED) return notInstalledResponse();
3236
- return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut);
3237
- }
3238
- var NOT_INSTALLED, parsers7;
3239
- var init_version = __esm({ "src/lib/tasks/version.ts"() {
3240
- "use strict";
3241
- init_utils();
3242
- NOT_INSTALLED = "installed=false";
3243
- parsers7 = [new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, (result, [major, minor, patch, agent = ""]) => {
3244
- Object.assign(result, versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent));
3245
- }), new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/, (result, [major, minor, patch, agent = ""]) => {
3246
- Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));
3247
- })];
3248
- } });
3249
- var simple_git_api_exports = {};
3250
- __export(simple_git_api_exports, { SimpleGitApi: () => SimpleGitApi });
3251
- var SimpleGitApi;
3252
- var init_simple_git_api = __esm({ "src/lib/simple-git-api.ts"() {
3253
- "use strict";
3254
- init_task_callback();
3255
- init_change_working_directory();
3256
- init_checkout();
3257
- init_count_objects();
3258
- init_commit();
3259
- init_config();
3260
- init_first_commit();
3261
- init_grep();
3262
- init_hash_object();
3263
- init_init();
3264
- init_log();
3265
- init_merge();
3266
- init_push();
3267
- init_show();
3268
- init_status();
3269
- init_task();
3270
- init_version();
3271
- init_utils();
3272
- SimpleGitApi = class {
3273
- constructor(_executor) {
3274
- this._executor = _executor;
3275
- }
3276
- _runTask(task, then) {
3277
- const chain = this._executor.chain();
3278
- const promise = chain.push(task);
3279
- if (then) taskCallback(task, promise, then);
3280
- return Object.create(this, {
3281
- then: { value: promise.then.bind(promise) },
3282
- catch: { value: promise.catch.bind(promise) },
3283
- _executor: { value: chain }
3284
- });
3285
- }
3286
- add(files) {
3287
- return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments));
3288
- }
3289
- cwd(directory) {
3290
- const next = trailingFunctionArgument(arguments);
3291
- if (typeof directory === "string") return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
3292
- if (typeof directory?.path === "string") return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || void 0), next);
3293
- return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next);
3294
- }
3295
- hashObject(path, write) {
3296
- return this._runTask(hashObjectTask(path, write === true), trailingFunctionArgument(arguments));
3297
- }
3298
- init(bare) {
3299
- return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
3300
- }
3301
- merge() {
3302
- return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
3303
- }
3304
- mergeFromTo(remote, branch) {
3305
- if (!(filterString(remote) && filterString(branch))) return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`));
3306
- return this._runTask(mergeTask([
3307
- remote,
3308
- branch,
3309
- ...getTrailingOptions(arguments)
3310
- ]), trailingFunctionArgument(arguments, false));
3311
- }
3312
- outputHandler(handler) {
3313
- this._executor.outputHandler = handler;
3314
- return this;
3315
- }
3316
- push() {
3317
- const task = pushTask({
3318
- remote: filterType(arguments[0], filterString),
3319
- branch: filterType(arguments[1], filterString)
3320
- }, getTrailingOptions(arguments));
3321
- return this._runTask(task, trailingFunctionArgument(arguments));
3322
- }
3323
- stash() {
3324
- return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments));
3325
- }
3326
- status() {
3327
- return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
3328
- }
3329
- };
3330
- Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), count_objects_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default());
3331
- } });
3332
- var scheduler_exports = {};
3333
- __export(scheduler_exports, { Scheduler: () => Scheduler });
3334
- var createScheduledTask, Scheduler;
3335
- var init_scheduler = __esm({ "src/lib/runners/scheduler.ts"() {
3336
- "use strict";
3337
- init_utils();
3338
- init_git_logger();
3339
- createScheduledTask = /* @__PURE__ */ (() => {
3340
- let id = 0;
3341
- return () => {
3342
- id++;
3343
- const { promise, done } = (0, import_dist$1.createDeferred)();
3344
- return {
3345
- promise,
3346
- done,
3347
- id
3348
- };
3349
- };
3350
- })();
3351
- Scheduler = class {
3352
- constructor(concurrency = 2) {
3353
- this.concurrency = concurrency;
3354
- this.logger = createLogger("", "scheduler");
3355
- this.pending = [];
3356
- this.running = [];
3357
- this.logger(`Constructed, concurrency=%s`, concurrency);
3358
- }
3359
- schedule() {
3360
- if (!this.pending.length || this.running.length >= this.concurrency) {
3361
- this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency);
3362
- return;
3363
- }
3364
- const task = append(this.running, this.pending.shift());
3365
- this.logger(`Attempting id=%s`, task.id);
3366
- task.done(() => {
3367
- this.logger(`Completing id=`, task.id);
3368
- remove(this.running, task);
3369
- this.schedule();
3370
- });
3371
- }
3372
- next() {
3373
- const { promise, id } = append(this.pending, createScheduledTask());
3374
- this.logger(`Scheduling id=%s`, id);
3375
- this.schedule();
3376
- return promise;
3377
- }
3378
- };
3379
- } });
3380
- var apply_patch_exports = {};
3381
- __export(apply_patch_exports, { applyPatchTask: () => applyPatchTask });
3382
- function applyPatchTask(patches, customArgs) {
3383
- return straightThroughStringTask([
3384
- "apply",
3385
- ...customArgs,
3386
- ...patches
3387
- ]);
3388
- }
3389
- var init_apply_patch = __esm({ "src/lib/tasks/apply-patch.ts"() {
3390
- "use strict";
3391
- init_task();
3392
- } });
3393
- function branchDeletionSuccess(branch, hash) {
3394
- return {
3395
- branch,
3396
- hash,
3397
- success: true
3398
- };
3399
- }
3400
- function branchDeletionFailure(branch) {
3401
- return {
3402
- branch,
3403
- hash: null,
3404
- success: false
3405
- };
3406
- }
3407
- var BranchDeletionBatch;
3408
- var init_BranchDeleteSummary = __esm({ "src/lib/responses/BranchDeleteSummary.ts"() {
3409
- "use strict";
3410
- BranchDeletionBatch = class {
3411
- constructor() {
3412
- this.all = [];
3413
- this.branches = {};
3414
- this.errors = [];
3415
- }
3416
- get success() {
3417
- return !this.errors.length;
3418
- }
3419
- };
3420
- } });
3421
- function hasBranchDeletionError(data, processExitCode) {
3422
- return processExitCode === 1 && deleteErrorRegex.test(data);
3423
- }
3424
- var deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions;
3425
- var init_parse_branch_delete = __esm({ "src/lib/parsers/parse-branch-delete.ts"() {
3426
- "use strict";
3427
- init_BranchDeleteSummary();
3428
- init_utils();
3429
- deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
3430
- deleteErrorRegex = /^error[^']+'([^']+)'/m;
3431
- parsers8 = [new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {
3432
- const deletion = branchDeletionSuccess(branch, hash);
3433
- result.all.push(deletion);
3434
- result.branches[branch] = deletion;
3435
- }), new LineParser(deleteErrorRegex, (result, [branch]) => {
3436
- const deletion = branchDeletionFailure(branch);
3437
- result.errors.push(deletion);
3438
- result.all.push(deletion);
3439
- result.branches[branch] = deletion;
3440
- })];
3441
- parseBranchDeletions = (stdOut, stdErr) => {
3442
- return parseStringResponse(new BranchDeletionBatch(), parsers8, [stdOut, stdErr]);
3443
- };
3444
- } });
3445
- var BranchSummaryResult;
3446
- var init_BranchSummary = __esm({ "src/lib/responses/BranchSummary.ts"() {
3447
- "use strict";
3448
- BranchSummaryResult = class {
3449
- constructor() {
3450
- this.all = [];
3451
- this.branches = {};
3452
- this.current = "";
3453
- this.detached = false;
3454
- }
3455
- push(status, detached, name, commit, label) {
3456
- if (status === "*") {
3457
- this.detached = detached;
3458
- this.current = name;
3459
- }
3460
- this.all.push(name);
3461
- this.branches[name] = {
3462
- current: status === "*",
3463
- linkedWorkTree: status === "+",
3464
- name,
3465
- commit,
3466
- label
3467
- };
3468
- }
3469
- };
3470
- } });
3471
- function branchStatus(input) {
3472
- return input ? input.charAt(0) : "";
3473
- }
3474
- function parseBranchSummary(stdOut, currentOnly = false) {
3475
- return parseStringResponse(new BranchSummaryResult(), currentOnly ? [currentBranchParser] : parsers9, stdOut);
3476
- }
3477
- var parsers9, currentBranchParser;
3478
- var init_parse_branch = __esm({ "src/lib/parsers/parse-branch.ts"() {
3479
- "use strict";
3480
- init_BranchSummary();
3481
- init_utils();
3482
- parsers9 = [new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
3483
- result.push(branchStatus(current), true, name, commit, label);
3484
- }), new LineParser(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => {
3485
- result.push(branchStatus(current), false, name, commit, label);
3486
- })];
3487
- currentBranchParser = new LineParser(/^(\S+)$/s, (result, [name]) => {
3488
- result.push("*", false, name, "", "");
3489
- });
3490
- } });
3491
- var branch_exports = {};
3492
- __export(branch_exports, {
3493
- branchLocalTask: () => branchLocalTask,
3494
- branchTask: () => branchTask,
3495
- containsDeleteBranchCommand: () => containsDeleteBranchCommand,
3496
- deleteBranchTask: () => deleteBranchTask,
3497
- deleteBranchesTask: () => deleteBranchesTask
3498
- });
3499
- function containsDeleteBranchCommand(commands) {
3500
- const deleteCommands = [
3501
- "-d",
3502
- "-D",
3503
- "--delete"
3504
- ];
3505
- return commands.some((command) => deleteCommands.includes(command));
3506
- }
3507
- function branchTask(customArgs) {
3508
- const isDelete = containsDeleteBranchCommand(customArgs);
3509
- const isCurrentOnly = customArgs.includes("--show-current");
3510
- const commands = ["branch", ...customArgs];
3511
- if (commands.length === 1) commands.push("-a");
3512
- if (!commands.includes("-v")) commands.splice(1, 0, "-v");
3513
- return {
3514
- format: "utf-8",
3515
- commands,
3516
- parser(stdOut, stdErr) {
3517
- if (isDelete) return parseBranchDeletions(stdOut, stdErr).all[0];
3518
- return parseBranchSummary(stdOut, isCurrentOnly);
3519
- }
3520
- };
3521
- }
3522
- function branchLocalTask() {
3523
- return {
3524
- format: "utf-8",
3525
- commands: ["branch", "-v"],
3526
- parser(stdOut) {
3527
- return parseBranchSummary(stdOut);
3528
- }
3529
- };
3530
- }
3531
- function deleteBranchesTask(branches, forceDelete = false) {
3532
- return {
3533
- format: "utf-8",
3534
- commands: [
3535
- "branch",
3536
- "-v",
3537
- forceDelete ? "-D" : "-d",
3538
- ...branches
3539
- ],
3540
- parser(stdOut, stdErr) {
3541
- return parseBranchDeletions(stdOut, stdErr);
3542
- },
3543
- onError({ exitCode, stdOut }, error, done, fail) {
3544
- if (!hasBranchDeletionError(String(error), exitCode)) return fail(error);
3545
- done(stdOut);
3546
- }
3547
- };
3548
- }
3549
- function deleteBranchTask(branch, forceDelete = false) {
3550
- const task = {
3551
- format: "utf-8",
3552
- commands: [
3553
- "branch",
3554
- "-v",
3555
- forceDelete ? "-D" : "-d",
3556
- branch
3557
- ],
3558
- parser(stdOut, stdErr) {
3559
- return parseBranchDeletions(stdOut, stdErr).branches[branch];
3560
- },
3561
- onError({ exitCode, stdErr, stdOut }, error, _, fail) {
3562
- if (!hasBranchDeletionError(String(error), exitCode)) return fail(error);
3563
- throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error));
3564
- }
3565
- };
3566
- return task;
3567
- }
3568
- var init_branch = __esm({ "src/lib/tasks/branch.ts"() {
3569
- "use strict";
3570
- init_git_response_error();
3571
- init_parse_branch_delete();
3572
- init_parse_branch();
3573
- init_utils();
3574
- } });
3575
- function toPath(input) {
3576
- const path = input.trim().replace(/^["']|["']$/g, "");
3577
- return path && (0, node_path.normalize)(path);
3578
- }
3579
- var parseCheckIgnore;
3580
- var init_CheckIgnore = __esm({ "src/lib/responses/CheckIgnore.ts"() {
3581
- "use strict";
3582
- parseCheckIgnore = (text) => {
3583
- return text.split(/\n/g).map(toPath).filter(Boolean);
3584
- };
3585
- } });
3586
- var check_ignore_exports = {};
3587
- __export(check_ignore_exports, { checkIgnoreTask: () => checkIgnoreTask });
3588
- function checkIgnoreTask(paths) {
3589
- return {
3590
- commands: ["check-ignore", ...paths],
3591
- format: "utf-8",
3592
- parser: parseCheckIgnore
3593
- };
3594
- }
3595
- var init_check_ignore = __esm({ "src/lib/tasks/check-ignore.ts"() {
3596
- "use strict";
3597
- init_CheckIgnore();
3598
- } });
3599
- var clone_exports = {};
3600
- __export(clone_exports, {
3601
- cloneMirrorTask: () => cloneMirrorTask,
3602
- cloneTask: () => cloneTask
3603
- });
3604
- function disallowedCommand(command) {
3605
- return /^--upload-pack(=|$)/.test(command);
3606
- }
3607
- function cloneTask(repo, directory, customArgs) {
3608
- const commands = ["clone", ...customArgs];
3609
- filterString(repo) && commands.push(repo);
3610
- filterString(directory) && commands.push(directory);
3611
- if (commands.find(disallowedCommand)) return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
3612
- return straightThroughStringTask(commands);
3613
- }
3614
- function cloneMirrorTask(repo, directory, customArgs) {
3615
- append(customArgs, "--mirror");
3616
- return cloneTask(repo, directory, customArgs);
3617
- }
3618
- var init_clone = __esm({ "src/lib/tasks/clone.ts"() {
3619
- "use strict";
3620
- init_task();
3621
- init_utils();
3622
- } });
3623
- function parseFetchResult(stdOut, stdErr) {
3624
- return parseStringResponse({
3625
- raw: stdOut,
3626
- remote: null,
3627
- branches: [],
3628
- tags: [],
3629
- updated: [],
3630
- deleted: []
3631
- }, parsers10, [stdOut, stdErr]);
3632
- }
3633
- var parsers10;
3634
- var init_parse_fetch = __esm({ "src/lib/parsers/parse-fetch.ts"() {
3635
- "use strict";
3636
- init_utils();
3637
- parsers10 = [
3638
- new LineParser(/From (.+)$/, (result, [remote]) => {
3639
- result.remote = remote;
3640
- }),
3641
- new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
3642
- result.branches.push({
3643
- name,
3644
- tracking
3645
- });
3646
- }),
3647
- new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
3648
- result.tags.push({
3649
- name,
3650
- tracking
3651
- });
3652
- }),
3653
- new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/, (result, [tracking]) => {
3654
- result.deleted.push({ tracking });
3655
- }),
3656
- new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, (result, [from, to, name, tracking]) => {
3657
- result.updated.push({
3658
- name,
3659
- tracking,
3660
- to,
3661
- from
3662
- });
3663
- })
3664
- ];
3665
- } });
3666
- var fetch_exports = {};
3667
- __export(fetch_exports, { fetchTask: () => fetchTask });
3668
- function disallowedCommand2(command) {
3669
- return /^--upload-pack(=|$)/.test(command);
3670
- }
3671
- function fetchTask(remote, branch, customArgs) {
3672
- const commands = ["fetch", ...customArgs];
3673
- if (remote && branch) commands.push(remote, branch);
3674
- if (commands.find(disallowedCommand2)) return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
3675
- return {
3676
- commands,
3677
- format: "utf-8",
3678
- parser: parseFetchResult
3679
- };
3680
- }
3681
- var init_fetch = __esm({ "src/lib/tasks/fetch.ts"() {
3682
- "use strict";
3683
- init_parse_fetch();
3684
- init_task();
3685
- } });
3686
- function parseMoveResult(stdOut) {
3687
- return parseStringResponse({ moves: [] }, parsers11, stdOut);
3688
- }
3689
- var parsers11;
3690
- var init_parse_move = __esm({ "src/lib/parsers/parse-move.ts"() {
3691
- "use strict";
3692
- init_utils();
3693
- parsers11 = [new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
3694
- result.moves.push({
3695
- from,
3696
- to
3697
- });
3698
- })];
3699
- } });
3700
- var move_exports = {};
3701
- __export(move_exports, { moveTask: () => moveTask });
3702
- function moveTask(from, to) {
3703
- return {
3704
- commands: [
3705
- "mv",
3706
- "-v",
3707
- ...asArray(from),
3708
- to
3709
- ],
3710
- format: "utf-8",
3711
- parser: parseMoveResult
3712
- };
3713
- }
3714
- var init_move = __esm({ "src/lib/tasks/move.ts"() {
3715
- "use strict";
3716
- init_parse_move();
3717
- init_utils();
3718
- } });
3719
- var pull_exports = {};
3720
- __export(pull_exports, { pullTask: () => pullTask });
3721
- function pullTask(remote, branch, customArgs) {
3722
- const commands = ["pull", ...customArgs];
3723
- if (remote && branch) commands.splice(1, 0, remote, branch);
3724
- return {
3725
- commands,
3726
- format: "utf-8",
3727
- parser(stdOut, stdErr) {
3728
- return parsePullResult(stdOut, stdErr);
3729
- },
3730
- onError(result, _error, _done, fail) {
3731
- const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr));
3732
- if (pullError) return fail(new GitResponseError(pullError));
3733
- fail(_error);
3734
- }
3735
- };
3736
- }
3737
- var init_pull = __esm({ "src/lib/tasks/pull.ts"() {
3738
- "use strict";
3739
- init_git_response_error();
3740
- init_parse_pull();
3741
- init_utils();
3742
- } });
3743
- function parseGetRemotes(text) {
3744
- const remotes = {};
3745
- forEach(text, ([name]) => remotes[name] = { name });
3746
- return Object.values(remotes);
3747
- }
3748
- function parseGetRemotesVerbose(text) {
3749
- const remotes = {};
3750
- forEach(text, ([name, url, purpose]) => {
3751
- if (!Object.hasOwn(remotes, name)) remotes[name] = {
3752
- name,
3753
- refs: {
3754
- fetch: "",
3755
- push: ""
3756
- }
3757
- };
3758
- if (purpose && url) remotes[name].refs[purpose.replace(/[^a-z]/g, "")] = url;
3759
- });
3760
- return Object.values(remotes);
3761
- }
3762
- function forEach(text, handler) {
3763
- forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
3764
- }
3765
- var init_GetRemoteSummary = __esm({ "src/lib/responses/GetRemoteSummary.ts"() {
3766
- "use strict";
3767
- init_utils();
3768
- } });
3769
- var remote_exports = {};
3770
- __export(remote_exports, {
3771
- addRemoteTask: () => addRemoteTask,
3772
- getRemotesTask: () => getRemotesTask,
3773
- listRemotesTask: () => listRemotesTask,
3774
- remoteTask: () => remoteTask,
3775
- removeRemoteTask: () => removeRemoteTask
3776
- });
3777
- function addRemoteTask(remoteName, remoteRepo, customArgs) {
3778
- return straightThroughStringTask([
3779
- "remote",
3780
- "add",
3781
- ...customArgs,
3782
- remoteName,
3783
- remoteRepo
3784
- ]);
3785
- }
3786
- function getRemotesTask(verbose) {
3787
- const commands = ["remote"];
3788
- if (verbose) commands.push("-v");
3789
- return {
3790
- commands,
3791
- format: "utf-8",
3792
- parser: verbose ? parseGetRemotesVerbose : parseGetRemotes
3793
- };
3794
- }
3795
- function listRemotesTask(customArgs) {
3796
- const commands = [...customArgs];
3797
- if (commands[0] !== "ls-remote") commands.unshift("ls-remote");
3798
- return straightThroughStringTask(commands);
3799
- }
3800
- function remoteTask(customArgs) {
3801
- const commands = [...customArgs];
3802
- if (commands[0] !== "remote") commands.unshift("remote");
3803
- return straightThroughStringTask(commands);
3804
- }
3805
- function removeRemoteTask(remoteName) {
3806
- return straightThroughStringTask([
3807
- "remote",
3808
- "remove",
3809
- remoteName
3810
- ]);
3811
- }
3812
- var init_remote = __esm({ "src/lib/tasks/remote.ts"() {
3813
- "use strict";
3814
- init_GetRemoteSummary();
3815
- init_task();
3816
- } });
3817
- var stash_list_exports = {};
3818
- __export(stash_list_exports, { stashListTask: () => stashListTask });
3819
- function stashListTask(opt = {}, customArgs) {
3820
- const options = parseLogOptions(opt);
3821
- const commands = [
3822
- "stash",
3823
- "list",
3824
- ...options.commands,
3825
- ...customArgs
3826
- ];
3827
- const parser4 = createListLogSummaryParser(options.splitter, options.fields, logFormatFromCommand(commands));
3828
- return validateLogFormatConfig(commands) || {
3829
- commands,
3830
- format: "utf-8",
3831
- parser: parser4
3832
- };
3833
- }
3834
- var init_stash_list = __esm({ "src/lib/tasks/stash-list.ts"() {
3835
- "use strict";
3836
- init_log_format();
3837
- init_parse_list_log_summary();
3838
- init_diff();
3839
- init_log();
3840
- } });
3841
- var sub_module_exports = {};
3842
- __export(sub_module_exports, {
3843
- addSubModuleTask: () => addSubModuleTask,
3844
- initSubModuleTask: () => initSubModuleTask,
3845
- subModuleTask: () => subModuleTask,
3846
- updateSubModuleTask: () => updateSubModuleTask
3847
- });
3848
- function addSubModuleTask(repo, path) {
3849
- return subModuleTask([
3850
- "add",
3851
- repo,
3852
- path
3853
- ]);
3854
- }
3855
- function initSubModuleTask(customArgs) {
3856
- return subModuleTask(["init", ...customArgs]);
3857
- }
3858
- function subModuleTask(customArgs) {
3859
- const commands = [...customArgs];
3860
- if (commands[0] !== "submodule") commands.unshift("submodule");
3861
- return straightThroughStringTask(commands);
3862
- }
3863
- function updateSubModuleTask(customArgs) {
3864
- return subModuleTask(["update", ...customArgs]);
3865
- }
3866
- var init_sub_module = __esm({ "src/lib/tasks/sub-module.ts"() {
3867
- "use strict";
3868
- init_task();
3869
- } });
3870
- function singleSorted(a, b) {
3871
- const aIsNum = Number.isNaN(a);
3872
- if (aIsNum !== Number.isNaN(b)) return aIsNum ? 1 : -1;
3873
- return aIsNum ? sorted(a, b) : 0;
3874
- }
3875
- function sorted(a, b) {
3876
- return a === b ? 0 : a > b ? 1 : -1;
3877
- }
3878
- function trimmed(input) {
3879
- return input.trim();
3880
- }
3881
- function toNumber(input) {
3882
- if (typeof input === "string") return parseInt(input.replace(/^\D+/g, ""), 10) || 0;
3883
- return 0;
3884
- }
3885
- var TagList, parseTagList;
3886
- var init_TagList = __esm({ "src/lib/responses/TagList.ts"() {
3887
- "use strict";
3888
- TagList = class {
3889
- constructor(all, latest) {
3890
- this.all = all;
3891
- this.latest = latest;
3892
- }
3893
- };
3894
- parseTagList = function(data, customSort = false) {
3895
- const tags = data.split("\n").map(trimmed).filter(Boolean);
3896
- if (!customSort) tags.sort(function(tagA, tagB) {
3897
- const partsA = tagA.split(".");
3898
- const partsB = tagB.split(".");
3899
- if (partsA.length === 1 || partsB.length === 1) return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));
3900
- for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {
3901
- const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));
3902
- if (diff) return diff;
3903
- }
3904
- return 0;
3905
- });
3906
- const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(".") >= 0);
3907
- return new TagList(tags, latest);
3908
- };
3909
- } });
3910
- var tag_exports = {};
3911
- __export(tag_exports, {
3912
- addAnnotatedTagTask: () => addAnnotatedTagTask,
3913
- addTagTask: () => addTagTask,
3914
- tagListTask: () => tagListTask
3915
- });
3916
- function tagListTask(customArgs = []) {
3917
- const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));
3918
- return {
3919
- format: "utf-8",
3920
- commands: [
3921
- "tag",
3922
- "-l",
3923
- ...customArgs
3924
- ],
3925
- parser(text) {
3926
- return parseTagList(text, hasCustomSort);
3927
- }
3928
- };
3929
- }
3930
- function addTagTask(name) {
3931
- return {
3932
- format: "utf-8",
3933
- commands: ["tag", name],
3934
- parser() {
3935
- return { name };
3936
- }
3937
- };
3938
- }
3939
- function addAnnotatedTagTask(name, tagMessage) {
3940
- return {
3941
- format: "utf-8",
3942
- commands: [
3943
- "tag",
3944
- "-a",
3945
- "-m",
3946
- tagMessage,
3947
- name
3948
- ],
3949
- parser() {
3950
- return { name };
3951
- }
3952
- };
3953
- }
3954
- var init_tag = __esm({ "src/lib/tasks/tag.ts"() {
3955
- "use strict";
3956
- init_TagList();
3957
- } });
3958
- var require_git = __commonJS({ "src/git.js"(exports, module) {
3959
- "use strict";
3960
- var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));
3961
- var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));
3962
- var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));
3963
- var { adhocExecTask: adhocExecTask2, configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));
3964
- var { asArray: asArray2, filterArray: filterArray2, filterPrimitives: filterPrimitives2, filterString: filterString2, filterStringOrStringArray: filterStringOrStringArray2, filterType: filterType2, getTrailingOptions: getTrailingOptions2, trailingFunctionArgument: trailingFunctionArgument2, trailingOptionsArgument: trailingOptionsArgument2 } = (init_utils(), __toCommonJS(utils_exports));
3965
- var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));
3966
- var { branchTask: branchTask2, branchLocalTask: branchLocalTask2, deleteBranchesTask: deleteBranchesTask2, deleteBranchTask: deleteBranchTask2 } = (init_branch(), __toCommonJS(branch_exports));
3967
- var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));
3968
- var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));
3969
- var { cloneTask: cloneTask2, cloneMirrorTask: cloneMirrorTask2 } = (init_clone(), __toCommonJS(clone_exports));
3970
- var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));
3971
- var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));
3972
- var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));
3973
- var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));
3974
- var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));
3975
- var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));
3976
- var { addRemoteTask: addRemoteTask2, getRemotesTask: getRemotesTask2, listRemotesTask: listRemotesTask2, remoteTask: remoteTask2, removeRemoteTask: removeRemoteTask2 } = (init_remote(), __toCommonJS(remote_exports));
3977
- var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));
3978
- var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));
3979
- var { addSubModuleTask: addSubModuleTask2, initSubModuleTask: initSubModuleTask2, subModuleTask: subModuleTask2, updateSubModuleTask: updateSubModuleTask2 } = (init_sub_module(), __toCommonJS(sub_module_exports));
3980
- var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));
3981
- var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));
3982
- function Git2(options, plugins) {
3983
- this._plugins = plugins;
3984
- this._executor = new GitExecutor2(options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins);
3985
- this._trimmed = options.trimmed;
3986
- }
3987
- (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;
3988
- Git2.prototype.customBinary = function(command) {
3989
- this._plugins.reconfigure("binary", command);
3990
- return this;
3991
- };
3992
- Git2.prototype.env = function(name, value) {
3993
- if (arguments.length === 1 && typeof name === "object") this._executor.env = name;
3994
- else (this._executor.env = this._executor.env || {})[name] = value;
3995
- return this;
3996
- };
3997
- Git2.prototype.stashList = function(options) {
3998
- return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments));
3999
- };
4000
- function createCloneTask(api, task, repoPath, localPath) {
4001
- if (typeof repoPath !== "string") return configurationErrorTask2(`git.${api}() requires a string 'repoPath'`);
4002
- return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments));
4003
- }
4004
- Git2.prototype.clone = function() {
4005
- return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments));
4006
- };
4007
- Git2.prototype.mirror = function() {
4008
- return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments));
4009
- };
4010
- Git2.prototype.mv = function(from, to) {
4011
- return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));
4012
- };
4013
- Git2.prototype.checkoutLatestTag = function(then) {
4014
- var git = this;
4015
- return this.pull(function() {
4016
- git.tags(function(err, tags) {
4017
- git.checkout(tags.latest, then);
4018
- });
4019
- });
4020
- };
4021
- Git2.prototype.pull = function(remote, branch, options, then) {
4022
- return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
4023
- };
4024
- Git2.prototype.fetch = function(remote, branch) {
4025
- return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
4026
- };
4027
- Git2.prototype.silent = function(silence) {
4028
- return this._runTask(adhocExecTask2(() => console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")));
4029
- };
4030
- Git2.prototype.tags = function(options, then) {
4031
- return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
4032
- };
4033
- Git2.prototype.rebase = function() {
4034
- return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments));
4035
- };
4036
- Git2.prototype.reset = function(mode) {
4037
- return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
4038
- };
4039
- Git2.prototype.revert = function(commit) {
4040
- const next = trailingFunctionArgument2(arguments);
4041
- if (typeof commit !== "string") return this._runTask(configurationErrorTask2("Commit must be a string"), next);
4042
- return this._runTask(straightThroughStringTask2([
4043
- "revert",
4044
- ...getTrailingOptions2(arguments, 0, true),
4045
- commit
4046
- ]), next);
4047
- };
4048
- Git2.prototype.addTag = function(name) {
4049
- const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name");
4050
- return this._runTask(task, trailingFunctionArgument2(arguments));
4051
- };
4052
- Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {
4053
- return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments));
4054
- };
4055
- Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {
4056
- return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
4057
- };
4058
- Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {
4059
- return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
4060
- };
4061
- Git2.prototype.branch = function(options, then) {
4062
- return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
4063
- };
4064
- Git2.prototype.branchLocal = function(then) {
4065
- return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));
4066
- };
4067
- Git2.prototype.raw = function(commands) {
4068
- const createRestCommands = !Array.isArray(commands);
4069
- const command = [].slice.call(createRestCommands ? arguments : commands, 0);
4070
- for (let i = 0; i < command.length && createRestCommands; i++) if (!filterPrimitives2(command[i])) {
4071
- command.splice(i, command.length - i);
4072
- break;
4073
- }
4074
- command.push(...getTrailingOptions2(arguments, 0, true));
4075
- var next = trailingFunctionArgument2(arguments);
4076
- if (!command.length) return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next);
4077
- return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
4078
- };
4079
- Git2.prototype.submoduleAdd = function(repo, path, then) {
4080
- return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments));
4081
- };
4082
- Git2.prototype.submoduleUpdate = function(args, then) {
4083
- return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
4084
- };
4085
- Git2.prototype.submoduleInit = function(args, then) {
4086
- return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
4087
- };
4088
- Git2.prototype.subModule = function(options, then) {
4089
- return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
4090
- };
4091
- Git2.prototype.listRemote = function() {
4092
- return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
4093
- };
4094
- Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {
4095
- return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
4096
- };
4097
- Git2.prototype.removeRemote = function(remoteName, then) {
4098
- return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));
4099
- };
4100
- Git2.prototype.getRemotes = function(verbose, then) {
4101
- return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));
4102
- };
4103
- Git2.prototype.remote = function(options, then) {
4104
- return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
4105
- };
4106
- Git2.prototype.tag = function(options, then) {
4107
- const command = getTrailingOptions2(arguments);
4108
- if (command[0] !== "tag") command.unshift("tag");
4109
- return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));
4110
- };
4111
- Git2.prototype.updateServerInfo = function(then) {
4112
- return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments));
4113
- };
4114
- Git2.prototype.pushTags = function(remote, then) {
4115
- const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments));
4116
- return this._runTask(task, trailingFunctionArgument2(arguments));
4117
- };
4118
- Git2.prototype.rm = function(files) {
4119
- return this._runTask(straightThroughStringTask2([
4120
- "rm",
4121
- "-f",
4122
- ...asArray2(files)
4123
- ]), trailingFunctionArgument2(arguments));
4124
- };
4125
- Git2.prototype.rmKeepLocal = function(files) {
4126
- return this._runTask(straightThroughStringTask2([
4127
- "rm",
4128
- "--cached",
4129
- ...asArray2(files)
4130
- ]), trailingFunctionArgument2(arguments));
4131
- };
4132
- Git2.prototype.catFile = function(options, then) {
4133
- return this._catFile("utf-8", arguments);
4134
- };
4135
- Git2.prototype.binaryCatFile = function() {
4136
- return this._catFile("buffer", arguments);
4137
- };
4138
- Git2.prototype._catFile = function(format, args) {
4139
- var handler = trailingFunctionArgument2(args);
4140
- var command = ["cat-file"];
4141
- var options = args[0];
4142
- if (typeof options === "string") return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler);
4143
- if (Array.isArray(options)) command.push.apply(command, options);
4144
- const task = format === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);
4145
- return this._runTask(task, handler);
4146
- };
4147
- Git2.prototype.diff = function(options, then) {
4148
- const task = filterString2(options) ? configurationErrorTask2("git.diff: supplying options as a single string is no longer supported, switch to an array of strings") : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]);
4149
- return this._runTask(task, trailingFunctionArgument2(arguments));
4150
- };
4151
- Git2.prototype.diffSummary = function() {
4152
- return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments));
4153
- };
4154
- Git2.prototype.applyPatch = function(patches) {
4155
- const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(`git.applyPatch requires one or more string patches as the first argument`) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1)));
4156
- return this._runTask(task, trailingFunctionArgument2(arguments));
4157
- };
4158
- Git2.prototype.revparse = function() {
4159
- const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)];
4160
- return this._runTask(straightThroughStringTask2(commands, true), trailingFunctionArgument2(arguments));
4161
- };
4162
- Git2.prototype.clean = function(mode, options, then) {
4163
- const usingCleanOptionsArray = isCleanOptionsArray2(mode);
4164
- const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || "";
4165
- const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
4166
- return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments));
4167
- };
4168
- Git2.prototype.exec = function(then) {
4169
- return this._runTask({
4170
- commands: [],
4171
- format: "utf-8",
4172
- parser() {
4173
- if (typeof then === "function") then();
4174
- }
4175
- });
4176
- };
4177
- Git2.prototype.clearQueue = function() {
4178
- return this._runTask(adhocExecTask2(() => console.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")));
4179
- };
4180
- Git2.prototype.checkIgnore = function(pathnames, then) {
4181
- return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments));
4182
- };
4183
- Git2.prototype.checkIsRepo = function(checkType, then) {
4184
- return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments));
4185
- };
4186
- module.exports = Git2;
4187
- } });
4188
- init_pathspec();
4189
- init_git_error();
4190
- init_git_error();
4191
- init_git_error();
4192
- init_git_response_error();
4193
- init_task_configuration_error();
4194
- init_check_is_repo();
4195
- init_clean();
4196
- init_config();
4197
- init_diff_name_status();
4198
- init_grep();
4199
- init_reset();
4200
- init_utils();
4201
- init_utils();
4202
- var never = (0, import_dist$1.deferred)().promise;
4203
- init_utils();
4204
- init_git_error();
4205
- init_utils();
4206
- init_utils();
4207
- init_utils();
4208
- init_pathspec();
4209
- init_utils();
4210
- var Git = require_git();
4211
- init_git_response_error();
4212
-
4213
- //#endregion
4214
- //#region ../../node_modules/slugify/slugify.js
4215
- var require_slugify = /* @__PURE__ */ require_install.__commonJSMin(((exports, module) => {
4216
- (function(name, root, factory) {
4217
- if (typeof exports === "object") {
4218
- module.exports = factory();
4219
- module.exports["default"] = factory();
4220
- } else if (typeof define === "function" && define.amd) define(factory);
4221
- else root[name] = factory();
4222
- })("slugify", exports, function() {
4223
- var charMap = JSON.parse("{\"$\":\"dollar\",\"%\":\"percent\",\"&\":\"and\",\"<\":\"less\",\">\":\"greater\",\"|\":\"or\",\"¢\":\"cent\",\"£\":\"pound\",\"¤\":\"currency\",\"¥\":\"yen\",\"©\":\"(c)\",\"ª\":\"a\",\"®\":\"(r)\",\"º\":\"o\",\"À\":\"A\",\"Á\":\"A\",\"Â\":\"A\",\"Ã\":\"A\",\"Ä\":\"A\",\"Å\":\"A\",\"Æ\":\"AE\",\"Ç\":\"C\",\"È\":\"E\",\"É\":\"E\",\"Ê\":\"E\",\"Ë\":\"E\",\"Ì\":\"I\",\"Í\":\"I\",\"Î\":\"I\",\"Ï\":\"I\",\"Ð\":\"D\",\"Ñ\":\"N\",\"Ò\":\"O\",\"Ó\":\"O\",\"Ô\":\"O\",\"Õ\":\"O\",\"Ö\":\"O\",\"Ø\":\"O\",\"Ù\":\"U\",\"Ú\":\"U\",\"Û\":\"U\",\"Ü\":\"U\",\"Ý\":\"Y\",\"Þ\":\"TH\",\"ß\":\"ss\",\"à\":\"a\",\"á\":\"a\",\"â\":\"a\",\"ã\":\"a\",\"ä\":\"a\",\"å\":\"a\",\"æ\":\"ae\",\"ç\":\"c\",\"è\":\"e\",\"é\":\"e\",\"ê\":\"e\",\"ë\":\"e\",\"ì\":\"i\",\"í\":\"i\",\"î\":\"i\",\"ï\":\"i\",\"ð\":\"d\",\"ñ\":\"n\",\"ò\":\"o\",\"ó\":\"o\",\"ô\":\"o\",\"õ\":\"o\",\"ö\":\"o\",\"ø\":\"o\",\"ù\":\"u\",\"ú\":\"u\",\"û\":\"u\",\"ü\":\"u\",\"ý\":\"y\",\"þ\":\"th\",\"ÿ\":\"y\",\"Ā\":\"A\",\"ā\":\"a\",\"Ă\":\"A\",\"ă\":\"a\",\"Ą\":\"A\",\"ą\":\"a\",\"Ć\":\"C\",\"ć\":\"c\",\"Č\":\"C\",\"č\":\"c\",\"Ď\":\"D\",\"ď\":\"d\",\"Đ\":\"DJ\",\"đ\":\"dj\",\"Ē\":\"E\",\"ē\":\"e\",\"Ė\":\"E\",\"ė\":\"e\",\"Ę\":\"e\",\"ę\":\"e\",\"Ě\":\"E\",\"ě\":\"e\",\"Ğ\":\"G\",\"ğ\":\"g\",\"Ģ\":\"G\",\"ģ\":\"g\",\"Ĩ\":\"I\",\"ĩ\":\"i\",\"Ī\":\"i\",\"ī\":\"i\",\"Į\":\"I\",\"į\":\"i\",\"İ\":\"I\",\"ı\":\"i\",\"Ķ\":\"k\",\"ķ\":\"k\",\"Ļ\":\"L\",\"ļ\":\"l\",\"Ľ\":\"L\",\"ľ\":\"l\",\"Ł\":\"L\",\"ł\":\"l\",\"Ń\":\"N\",\"ń\":\"n\",\"Ņ\":\"N\",\"ņ\":\"n\",\"Ň\":\"N\",\"ň\":\"n\",\"Ō\":\"O\",\"ō\":\"o\",\"Ő\":\"O\",\"ő\":\"o\",\"Œ\":\"OE\",\"œ\":\"oe\",\"Ŕ\":\"R\",\"ŕ\":\"r\",\"Ř\":\"R\",\"ř\":\"r\",\"Ś\":\"S\",\"ś\":\"s\",\"Ş\":\"S\",\"ş\":\"s\",\"Š\":\"S\",\"š\":\"s\",\"Ţ\":\"T\",\"ţ\":\"t\",\"Ť\":\"T\",\"ť\":\"t\",\"Ũ\":\"U\",\"ũ\":\"u\",\"Ū\":\"u\",\"ū\":\"u\",\"Ů\":\"U\",\"ů\":\"u\",\"Ű\":\"U\",\"ű\":\"u\",\"Ų\":\"U\",\"ų\":\"u\",\"Ŵ\":\"W\",\"ŵ\":\"w\",\"Ŷ\":\"Y\",\"ŷ\":\"y\",\"Ÿ\":\"Y\",\"Ź\":\"Z\",\"ź\":\"z\",\"Ż\":\"Z\",\"ż\":\"z\",\"Ž\":\"Z\",\"ž\":\"z\",\"Ə\":\"E\",\"ƒ\":\"f\",\"Ơ\":\"O\",\"ơ\":\"o\",\"Ư\":\"U\",\"ư\":\"u\",\"Lj\":\"LJ\",\"lj\":\"lj\",\"Nj\":\"NJ\",\"nj\":\"nj\",\"Ș\":\"S\",\"ș\":\"s\",\"Ț\":\"T\",\"ț\":\"t\",\"ə\":\"e\",\"˚\":\"o\",\"Ά\":\"A\",\"Έ\":\"E\",\"Ή\":\"H\",\"Ί\":\"I\",\"Ό\":\"O\",\"Ύ\":\"Y\",\"Ώ\":\"W\",\"ΐ\":\"i\",\"Α\":\"A\",\"Β\":\"B\",\"Γ\":\"G\",\"Δ\":\"D\",\"Ε\":\"E\",\"Ζ\":\"Z\",\"Η\":\"H\",\"Θ\":\"8\",\"Ι\":\"I\",\"Κ\":\"K\",\"Λ\":\"L\",\"Μ\":\"M\",\"Ν\":\"N\",\"Ξ\":\"3\",\"Ο\":\"O\",\"Π\":\"P\",\"Ρ\":\"R\",\"Σ\":\"S\",\"Τ\":\"T\",\"Υ\":\"Y\",\"Φ\":\"F\",\"Χ\":\"X\",\"Ψ\":\"PS\",\"Ω\":\"W\",\"Ϊ\":\"I\",\"Ϋ\":\"Y\",\"ά\":\"a\",\"έ\":\"e\",\"ή\":\"h\",\"ί\":\"i\",\"ΰ\":\"y\",\"α\":\"a\",\"β\":\"b\",\"γ\":\"g\",\"δ\":\"d\",\"ε\":\"e\",\"ζ\":\"z\",\"η\":\"h\",\"θ\":\"8\",\"ι\":\"i\",\"κ\":\"k\",\"λ\":\"l\",\"μ\":\"m\",\"ν\":\"n\",\"ξ\":\"3\",\"ο\":\"o\",\"π\":\"p\",\"ρ\":\"r\",\"ς\":\"s\",\"σ\":\"s\",\"τ\":\"t\",\"υ\":\"y\",\"φ\":\"f\",\"χ\":\"x\",\"ψ\":\"ps\",\"ω\":\"w\",\"ϊ\":\"i\",\"ϋ\":\"y\",\"ό\":\"o\",\"ύ\":\"y\",\"ώ\":\"w\",\"Ё\":\"Yo\",\"Ђ\":\"DJ\",\"Є\":\"Ye\",\"І\":\"I\",\"Ї\":\"Yi\",\"Ј\":\"J\",\"Љ\":\"LJ\",\"Њ\":\"NJ\",\"Ћ\":\"C\",\"Џ\":\"DZ\",\"А\":\"A\",\"Б\":\"B\",\"В\":\"V\",\"Г\":\"G\",\"Д\":\"D\",\"Е\":\"E\",\"Ж\":\"Zh\",\"З\":\"Z\",\"И\":\"I\",\"Й\":\"J\",\"К\":\"K\",\"Л\":\"L\",\"М\":\"M\",\"Н\":\"N\",\"О\":\"O\",\"П\":\"P\",\"Р\":\"R\",\"С\":\"S\",\"Т\":\"T\",\"У\":\"U\",\"Ф\":\"F\",\"Х\":\"H\",\"Ц\":\"C\",\"Ч\":\"Ch\",\"Ш\":\"Sh\",\"Щ\":\"Sh\",\"Ъ\":\"U\",\"Ы\":\"Y\",\"Ь\":\"\",\"Э\":\"E\",\"Ю\":\"Yu\",\"Я\":\"Ya\",\"а\":\"a\",\"б\":\"b\",\"в\":\"v\",\"г\":\"g\",\"д\":\"d\",\"е\":\"e\",\"ж\":\"zh\",\"з\":\"z\",\"и\":\"i\",\"й\":\"j\",\"к\":\"k\",\"л\":\"l\",\"м\":\"m\",\"н\":\"n\",\"о\":\"o\",\"п\":\"p\",\"р\":\"r\",\"с\":\"s\",\"т\":\"t\",\"у\":\"u\",\"ф\":\"f\",\"х\":\"h\",\"ц\":\"c\",\"ч\":\"ch\",\"ш\":\"sh\",\"щ\":\"sh\",\"ъ\":\"u\",\"ы\":\"y\",\"ь\":\"\",\"э\":\"e\",\"ю\":\"yu\",\"я\":\"ya\",\"ё\":\"yo\",\"ђ\":\"dj\",\"є\":\"ye\",\"і\":\"i\",\"ї\":\"yi\",\"ј\":\"j\",\"љ\":\"lj\",\"њ\":\"nj\",\"ћ\":\"c\",\"ѝ\":\"u\",\"џ\":\"dz\",\"Ґ\":\"G\",\"ґ\":\"g\",\"Ғ\":\"GH\",\"ғ\":\"gh\",\"Қ\":\"KH\",\"қ\":\"kh\",\"Ң\":\"NG\",\"ң\":\"ng\",\"Ү\":\"UE\",\"ү\":\"ue\",\"Ұ\":\"U\",\"ұ\":\"u\",\"Һ\":\"H\",\"һ\":\"h\",\"Ә\":\"AE\",\"ә\":\"ae\",\"Ө\":\"OE\",\"ө\":\"oe\",\"Ա\":\"A\",\"Բ\":\"B\",\"Գ\":\"G\",\"Դ\":\"D\",\"Ե\":\"E\",\"Զ\":\"Z\",\"Է\":\"E'\",\"Ը\":\"Y'\",\"Թ\":\"T'\",\"Ժ\":\"JH\",\"Ի\":\"I\",\"Լ\":\"L\",\"Խ\":\"X\",\"Ծ\":\"C'\",\"Կ\":\"K\",\"Հ\":\"H\",\"Ձ\":\"D'\",\"Ղ\":\"GH\",\"Ճ\":\"TW\",\"Մ\":\"M\",\"Յ\":\"Y\",\"Ն\":\"N\",\"Շ\":\"SH\",\"Չ\":\"CH\",\"Պ\":\"P\",\"Ջ\":\"J\",\"Ռ\":\"R'\",\"Ս\":\"S\",\"Վ\":\"V\",\"Տ\":\"T\",\"Ր\":\"R\",\"Ց\":\"C\",\"Փ\":\"P'\",\"Ք\":\"Q'\",\"Օ\":\"O''\",\"Ֆ\":\"F\",\"և\":\"EV\",\"ء\":\"a\",\"آ\":\"aa\",\"أ\":\"a\",\"ؤ\":\"u\",\"إ\":\"i\",\"ئ\":\"e\",\"ا\":\"a\",\"ب\":\"b\",\"ة\":\"h\",\"ت\":\"t\",\"ث\":\"th\",\"ج\":\"j\",\"ح\":\"h\",\"خ\":\"kh\",\"د\":\"d\",\"ذ\":\"th\",\"ر\":\"r\",\"ز\":\"z\",\"س\":\"s\",\"ش\":\"sh\",\"ص\":\"s\",\"ض\":\"dh\",\"ط\":\"t\",\"ظ\":\"z\",\"ع\":\"a\",\"غ\":\"gh\",\"ف\":\"f\",\"ق\":\"q\",\"ك\":\"k\",\"ل\":\"l\",\"م\":\"m\",\"ن\":\"n\",\"ه\":\"h\",\"و\":\"w\",\"ى\":\"a\",\"ي\":\"y\",\"ً\":\"an\",\"ٌ\":\"on\",\"ٍ\":\"en\",\"َ\":\"a\",\"ُ\":\"u\",\"ِ\":\"e\",\"ْ\":\"\",\"٠\":\"0\",\"١\":\"1\",\"٢\":\"2\",\"٣\":\"3\",\"٤\":\"4\",\"٥\":\"5\",\"٦\":\"6\",\"٧\":\"7\",\"٨\":\"8\",\"٩\":\"9\",\"پ\":\"p\",\"چ\":\"ch\",\"ژ\":\"zh\",\"ک\":\"k\",\"گ\":\"g\",\"ی\":\"y\",\"۰\":\"0\",\"۱\":\"1\",\"۲\":\"2\",\"۳\":\"3\",\"۴\":\"4\",\"۵\":\"5\",\"۶\":\"6\",\"۷\":\"7\",\"۸\":\"8\",\"۹\":\"9\",\"฿\":\"baht\",\"ა\":\"a\",\"ბ\":\"b\",\"გ\":\"g\",\"დ\":\"d\",\"ე\":\"e\",\"ვ\":\"v\",\"ზ\":\"z\",\"თ\":\"t\",\"ი\":\"i\",\"კ\":\"k\",\"ლ\":\"l\",\"მ\":\"m\",\"ნ\":\"n\",\"ო\":\"o\",\"პ\":\"p\",\"ჟ\":\"zh\",\"რ\":\"r\",\"ს\":\"s\",\"ტ\":\"t\",\"უ\":\"u\",\"ფ\":\"f\",\"ქ\":\"k\",\"ღ\":\"gh\",\"ყ\":\"q\",\"შ\":\"sh\",\"ჩ\":\"ch\",\"ც\":\"ts\",\"ძ\":\"dz\",\"წ\":\"ts\",\"ჭ\":\"ch\",\"ხ\":\"kh\",\"ჯ\":\"j\",\"ჰ\":\"h\",\"Ṣ\":\"S\",\"ṣ\":\"s\",\"Ẁ\":\"W\",\"ẁ\":\"w\",\"Ẃ\":\"W\",\"ẃ\":\"w\",\"Ẅ\":\"W\",\"ẅ\":\"w\",\"ẞ\":\"SS\",\"Ạ\":\"A\",\"ạ\":\"a\",\"Ả\":\"A\",\"ả\":\"a\",\"Ấ\":\"A\",\"ấ\":\"a\",\"Ầ\":\"A\",\"ầ\":\"a\",\"Ẩ\":\"A\",\"ẩ\":\"a\",\"Ẫ\":\"A\",\"ẫ\":\"a\",\"Ậ\":\"A\",\"ậ\":\"a\",\"Ắ\":\"A\",\"ắ\":\"a\",\"Ằ\":\"A\",\"ằ\":\"a\",\"Ẳ\":\"A\",\"ẳ\":\"a\",\"Ẵ\":\"A\",\"ẵ\":\"a\",\"Ặ\":\"A\",\"ặ\":\"a\",\"Ẹ\":\"E\",\"ẹ\":\"e\",\"Ẻ\":\"E\",\"ẻ\":\"e\",\"Ẽ\":\"E\",\"ẽ\":\"e\",\"Ế\":\"E\",\"ế\":\"e\",\"Ề\":\"E\",\"ề\":\"e\",\"Ể\":\"E\",\"ể\":\"e\",\"Ễ\":\"E\",\"ễ\":\"e\",\"Ệ\":\"E\",\"ệ\":\"e\",\"Ỉ\":\"I\",\"ỉ\":\"i\",\"Ị\":\"I\",\"ị\":\"i\",\"Ọ\":\"O\",\"ọ\":\"o\",\"Ỏ\":\"O\",\"ỏ\":\"o\",\"Ố\":\"O\",\"ố\":\"o\",\"Ồ\":\"O\",\"ồ\":\"o\",\"Ổ\":\"O\",\"ổ\":\"o\",\"Ỗ\":\"O\",\"ỗ\":\"o\",\"Ộ\":\"O\",\"ộ\":\"o\",\"Ớ\":\"O\",\"ớ\":\"o\",\"Ờ\":\"O\",\"ờ\":\"o\",\"Ở\":\"O\",\"ở\":\"o\",\"Ỡ\":\"O\",\"ỡ\":\"o\",\"Ợ\":\"O\",\"ợ\":\"o\",\"Ụ\":\"U\",\"ụ\":\"u\",\"Ủ\":\"U\",\"ủ\":\"u\",\"Ứ\":\"U\",\"ứ\":\"u\",\"Ừ\":\"U\",\"ừ\":\"u\",\"Ử\":\"U\",\"ử\":\"u\",\"Ữ\":\"U\",\"ữ\":\"u\",\"Ự\":\"U\",\"ự\":\"u\",\"Ỳ\":\"Y\",\"ỳ\":\"y\",\"Ỵ\":\"Y\",\"ỵ\":\"y\",\"Ỷ\":\"Y\",\"ỷ\":\"y\",\"Ỹ\":\"Y\",\"ỹ\":\"y\",\"–\":\"-\",\"‘\":\"'\",\"’\":\"'\",\"“\":\"\\\"\",\"”\":\"\\\"\",\"„\":\"\\\"\",\"†\":\"+\",\"•\":\"*\",\"…\":\"...\",\"₠\":\"ecu\",\"₢\":\"cruzeiro\",\"₣\":\"french franc\",\"₤\":\"lira\",\"₥\":\"mill\",\"₦\":\"naira\",\"₧\":\"peseta\",\"₨\":\"rupee\",\"₩\":\"won\",\"₪\":\"new shequel\",\"₫\":\"dong\",\"€\":\"euro\",\"₭\":\"kip\",\"₮\":\"tugrik\",\"₯\":\"drachma\",\"₰\":\"penny\",\"₱\":\"peso\",\"₲\":\"guarani\",\"₳\":\"austral\",\"₴\":\"hryvnia\",\"₵\":\"cedi\",\"₸\":\"kazakhstani tenge\",\"₹\":\"indian rupee\",\"₺\":\"turkish lira\",\"₽\":\"russian ruble\",\"₿\":\"bitcoin\",\"℠\":\"sm\",\"™\":\"tm\",\"∂\":\"d\",\"∆\":\"delta\",\"∑\":\"sum\",\"∞\":\"infinity\",\"♥\":\"love\",\"元\":\"yuan\",\"円\":\"yen\",\"﷼\":\"rial\",\"ﻵ\":\"laa\",\"ﻷ\":\"laa\",\"ﻹ\":\"lai\",\"ﻻ\":\"la\"}");
4224
- var locales = JSON.parse("{\"bg\":{\"Й\":\"Y\",\"Ц\":\"Ts\",\"Щ\":\"Sht\",\"Ъ\":\"A\",\"Ь\":\"Y\",\"й\":\"y\",\"ц\":\"ts\",\"щ\":\"sht\",\"ъ\":\"a\",\"ь\":\"y\"},\"de\":{\"Ä\":\"AE\",\"ä\":\"ae\",\"Ö\":\"OE\",\"ö\":\"oe\",\"Ü\":\"UE\",\"ü\":\"ue\",\"ß\":\"ss\",\"%\":\"prozent\",\"&\":\"und\",\"|\":\"oder\",\"∑\":\"summe\",\"∞\":\"unendlich\",\"♥\":\"liebe\"},\"es\":{\"%\":\"por ciento\",\"&\":\"y\",\"<\":\"menor que\",\">\":\"mayor que\",\"|\":\"o\",\"¢\":\"centavos\",\"£\":\"libras\",\"¤\":\"moneda\",\"₣\":\"francos\",\"∑\":\"suma\",\"∞\":\"infinito\",\"♥\":\"amor\"},\"fr\":{\"%\":\"pourcent\",\"&\":\"et\",\"<\":\"plus petit\",\">\":\"plus grand\",\"|\":\"ou\",\"¢\":\"centime\",\"£\":\"livre\",\"¤\":\"devise\",\"₣\":\"franc\",\"∑\":\"somme\",\"∞\":\"infini\",\"♥\":\"amour\"},\"pt\":{\"%\":\"porcento\",\"&\":\"e\",\"<\":\"menor\",\">\":\"maior\",\"|\":\"ou\",\"¢\":\"centavo\",\"∑\":\"soma\",\"£\":\"libra\",\"∞\":\"infinito\",\"♥\":\"amor\"},\"uk\":{\"И\":\"Y\",\"и\":\"y\",\"Й\":\"Y\",\"й\":\"y\",\"Ц\":\"Ts\",\"ц\":\"ts\",\"Х\":\"Kh\",\"х\":\"kh\",\"Щ\":\"Shch\",\"щ\":\"shch\",\"Г\":\"H\",\"г\":\"h\"},\"vi\":{\"Đ\":\"D\",\"đ\":\"d\"},\"da\":{\"Ø\":\"OE\",\"ø\":\"oe\",\"Å\":\"AA\",\"å\":\"aa\",\"%\":\"procent\",\"&\":\"og\",\"|\":\"eller\",\"$\":\"dollar\",\"<\":\"mindre end\",\">\":\"større end\"},\"nb\":{\"&\":\"og\",\"Å\":\"AA\",\"Æ\":\"AE\",\"Ø\":\"OE\",\"å\":\"aa\",\"æ\":\"ae\",\"ø\":\"oe\"},\"it\":{\"&\":\"e\"},\"nl\":{\"&\":\"en\"},\"sv\":{\"&\":\"och\",\"Å\":\"AA\",\"Ä\":\"AE\",\"Ö\":\"OE\",\"å\":\"aa\",\"ä\":\"ae\",\"ö\":\"oe\"}}");
4225
- function replace(string, options) {
4226
- if (typeof string !== "string") throw new Error("slugify: string argument expected");
4227
- options = typeof options === "string" ? { replacement: options } : options || {};
4228
- var locale = locales[options.locale] || {};
4229
- var replacement = options.replacement === void 0 ? "-" : options.replacement;
4230
- var trim = options.trim === void 0 ? true : options.trim;
4231
- var slug = string.normalize().split("").reduce(function(result, ch) {
4232
- var appendChar = locale[ch];
4233
- if (appendChar === void 0) appendChar = charMap[ch];
4234
- if (appendChar === void 0) appendChar = ch;
4235
- if (appendChar === replacement) appendChar = " ";
4236
- return result + appendChar.replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]+/g, "");
4237
- }, "");
4238
- if (options.strict) slug = slug.replace(/[^A-Za-z0-9\s]/g, "");
4239
- if (trim) slug = slug.trim();
4240
- slug = slug.replace(/\s+/g, replacement);
4241
- if (options.lower) slug = slug.toLowerCase();
4242
- return slug;
4243
- }
4244
- replace.extend = function(customMap) {
4245
- Object.assign(charMap, customMap);
4246
- };
4247
- return replace;
4248
- });
4249
- }));
4250
-
4251
- //#endregion
4252
- //#region src/core/core.ts
4253
- /**
4254
- * Core — Shared utilities, constants, and internal helpers
4255
- *
4256
- * Ported from maxsim/bin/lib/core.cjs
4257
- */
4258
- var import_slugify = /* @__PURE__ */ require_install.__toESM(require_slugify());
4259
- /** Thrown by output() to signal successful command completion. */
4260
- var CliOutput = class {
4261
- result;
4262
- raw;
4263
- rawValue;
4264
- constructor(result, raw, rawValue) {
4265
- this.result = result;
4266
- this.raw = raw ?? false;
4267
- this.rawValue = rawValue;
4268
- }
4269
- };
4270
- /** Thrown by error() to signal a command error. */
4271
- var CliError = class {
4272
- message;
4273
- constructor(message) {
4274
- this.message = message;
4275
- }
4276
- };
4277
- /**
4278
- * Handle a CliOutput by writing to stdout. Extracted so cli.ts can use it.
4279
- */
4280
- function writeOutput(out) {
4281
- if (out.raw && out.rawValue !== void 0) process.stdout.write(String(out.rawValue));
4282
- else {
4283
- const json = JSON.stringify(out.result, null, 2);
4284
- if (json.length > 5e4) {
4285
- const tmpPath = node_path.default.join(node_os.default.tmpdir(), `maxsim-${Date.now()}.json`);
4286
- node_fs.default.writeFileSync(tmpPath, json, "utf-8");
4287
- process.stdout.write("@file:" + tmpPath);
4288
- } else process.stdout.write(json);
4289
- }
4290
- }
4291
- /** Read a file, returning null if it doesn't exist or fails. */
4292
- async function safeReadFile(filePath) {
4293
- try {
4294
- return await node_fs.promises.readFile(filePath, "utf-8");
4295
- } catch {
4296
- return null;
4297
- }
4298
- }
4299
-
4300
- //#endregion
4301
- exports.CliError = CliError;
4302
- exports.CliOutput = CliOutput;
4303
- exports.safeReadFile = safeReadFile;
4304
- exports.writeOutput = writeOutput;
4305
- //# sourceMappingURL=core-D5zUr9cb.cjs.map