@baton-dx/cli 0.4.4 → 0.5.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.
- package/dist/{ai-tool-detection-BFep6YS9.mjs → ai-tool-detection-Bw4qveB8.mjs} +1 -1
- package/dist/{ai-tool-detection-CMsBNa9e.mjs → ai-tool-detection-DMnwwNBI.mjs} +1 -1
- package/dist/{ai-tool-detection-CMsBNa9e.mjs.map → ai-tool-detection-DMnwwNBI.mjs.map} +1 -1
- package/dist/{context-detection-Ddu0mj_K.mjs → context-detection-C7T1evnW.mjs} +40 -11
- package/dist/context-detection-C7T1evnW.mjs.map +1 -0
- package/dist/{create-DEZA3dPb.mjs → create-Cx1nCS3X.mjs} +4 -6
- package/dist/{create-DEZA3dPb.mjs.map → create-Cx1nCS3X.mjs.map} +1 -1
- package/dist/index.mjs +1051 -486
- package/dist/index.mjs.map +1 -1
- package/dist/{list-BT2zFAVc.mjs → list-BsAASsXi.mjs} +4 -5
- package/dist/{list-BT2zFAVc.mjs.map → list-BsAASsXi.mjs.map} +1 -1
- package/dist/{prompt-DtgNNhRW.mjs → prompt-C7kAOs-S.mjs} +5 -5
- package/dist/prompt-C7kAOs-S.mjs.map +1 -0
- package/dist/{remove-BBFBYUPy.mjs → remove-36qv7yQ3.mjs} +2 -2
- package/dist/{remove-BBFBYUPy.mjs.map → remove-36qv7yQ3.mjs.map} +1 -1
- package/dist/{src-dY02psbw.mjs → src-n95I0s2u.mjs} +4572 -61
- package/dist/src-n95I0s2u.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-BbwQpWto.mjs +0 -33
- package/dist/context-detection-Ddu0mj_K.mjs.map +0 -1
- package/dist/esm-BagM-kVd.mjs +0 -4526
- package/dist/esm-BagM-kVd.mjs.map +0 -1
- package/dist/esm-CuRZ1S4C.mjs +0 -4
- package/dist/prompt-DtgNNhRW.mjs.map +0 -1
- package/dist/src-dY02psbw.mjs.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i as AI_TOOL_PATHS, r as evaluateDetection } from "./ai-tool-detection-CMsBNa9e.mjs";
|
|
5
|
-
import { d as esm_default, m as simpleGit } from "./esm-BagM-kVd.mjs";
|
|
2
|
+
import { _ as __commonJSMin, m as require_dist$2, v as __require, y as __toESM } from "./context-detection-C7T1evnW.mjs";
|
|
3
|
+
import { i as AI_TOOL_PATHS, r as evaluateDetection } from "./ai-tool-detection-DMnwwNBI.mjs";
|
|
6
4
|
import { access, mkdir, readFile, readdir, rm, rmdir, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
7
|
-
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
5
|
+
import { dirname, isAbsolute, join, normalize, relative, resolve } from "node:path";
|
|
8
6
|
import { promisify } from "node:util";
|
|
9
7
|
import { homedir } from "node:os";
|
|
10
8
|
import { createHash } from "node:crypto";
|
|
9
|
+
import { Buffer as Buffer$1 } from "node:buffer";
|
|
10
|
+
import { spawn } from "child_process";
|
|
11
|
+
import { EventEmitter } from "node:events";
|
|
11
12
|
import { execFile } from "node:child_process";
|
|
12
13
|
|
|
13
14
|
//#region ../ai-tool-paths/src/types.ts
|
|
@@ -146,7 +147,7 @@ var FileNotFoundError = class extends BatonError {
|
|
|
146
147
|
|
|
147
148
|
//#endregion
|
|
148
149
|
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
149
|
-
var util;
|
|
150
|
+
var util$1;
|
|
150
151
|
(function(util) {
|
|
151
152
|
util.assertEqual = (_) => {};
|
|
152
153
|
function assertIs(_arg) {}
|
|
@@ -188,7 +189,7 @@ var util;
|
|
|
188
189
|
if (typeof value === "bigint") return value.toString();
|
|
189
190
|
return value;
|
|
190
191
|
};
|
|
191
|
-
})(util || (util = {}));
|
|
192
|
+
})(util$1 || (util$1 = {}));
|
|
192
193
|
var objectUtil;
|
|
193
194
|
(function(objectUtil) {
|
|
194
195
|
objectUtil.mergeShapes = (first, second) => {
|
|
@@ -198,7 +199,7 @@ var objectUtil;
|
|
|
198
199
|
};
|
|
199
200
|
};
|
|
200
201
|
})(objectUtil || (objectUtil = {}));
|
|
201
|
-
const ZodParsedType = util.arrayToEnum([
|
|
202
|
+
const ZodParsedType = util$1.arrayToEnum([
|
|
202
203
|
"string",
|
|
203
204
|
"nan",
|
|
204
205
|
"number",
|
|
@@ -243,7 +244,7 @@ const getParsedType = (data) => {
|
|
|
243
244
|
|
|
244
245
|
//#endregion
|
|
245
246
|
//#region ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
|
|
246
|
-
const ZodIssueCode = util.arrayToEnum([
|
|
247
|
+
const ZodIssueCode = util$1.arrayToEnum([
|
|
247
248
|
"invalid_type",
|
|
248
249
|
"invalid_literal",
|
|
249
250
|
"custom",
|
|
@@ -315,7 +316,7 @@ var ZodError = class ZodError extends Error {
|
|
|
315
316
|
return this.message;
|
|
316
317
|
}
|
|
317
318
|
get message() {
|
|
318
|
-
return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
|
|
319
|
+
return JSON.stringify(this.issues, util$1.jsonStringifyReplacer, 2);
|
|
319
320
|
}
|
|
320
321
|
get isEmpty() {
|
|
321
322
|
return this.issues.length === 0;
|
|
@@ -351,19 +352,19 @@ const errorMap = (issue, _ctx) => {
|
|
|
351
352
|
else message = `Expected ${issue.expected}, received ${issue.received}`;
|
|
352
353
|
break;
|
|
353
354
|
case ZodIssueCode.invalid_literal:
|
|
354
|
-
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
|
|
355
|
+
message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util$1.jsonStringifyReplacer)}`;
|
|
355
356
|
break;
|
|
356
357
|
case ZodIssueCode.unrecognized_keys:
|
|
357
|
-
message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
|
|
358
|
+
message = `Unrecognized key(s) in object: ${util$1.joinValues(issue.keys, ", ")}`;
|
|
358
359
|
break;
|
|
359
360
|
case ZodIssueCode.invalid_union:
|
|
360
361
|
message = `Invalid input`;
|
|
361
362
|
break;
|
|
362
363
|
case ZodIssueCode.invalid_union_discriminator:
|
|
363
|
-
message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
|
|
364
|
+
message = `Invalid discriminator value. Expected ${util$1.joinValues(issue.options)}`;
|
|
364
365
|
break;
|
|
365
366
|
case ZodIssueCode.invalid_enum_value:
|
|
366
|
-
message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
|
|
367
|
+
message = `Invalid enum value. Expected ${util$1.joinValues(issue.options)}, received '${issue.received}'`;
|
|
367
368
|
break;
|
|
368
369
|
case ZodIssueCode.invalid_arguments:
|
|
369
370
|
message = `Invalid function arguments`;
|
|
@@ -380,7 +381,7 @@ const errorMap = (issue, _ctx) => {
|
|
|
380
381
|
if (typeof issue.validation.position === "number") message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
|
|
381
382
|
} else if ("startsWith" in issue.validation) message = `Invalid input: must start with "${issue.validation.startsWith}"`;
|
|
382
383
|
else if ("endsWith" in issue.validation) message = `Invalid input: must end with "${issue.validation.endsWith}"`;
|
|
383
|
-
else util.assertNever(issue.validation);
|
|
384
|
+
else util$1.assertNever(issue.validation);
|
|
384
385
|
else if (issue.validation !== "regex") message = `Invalid ${issue.validation}`;
|
|
385
386
|
else message = "Invalid";
|
|
386
387
|
break;
|
|
@@ -414,7 +415,7 @@ const errorMap = (issue, _ctx) => {
|
|
|
414
415
|
break;
|
|
415
416
|
default:
|
|
416
417
|
message = _ctx.defaultError;
|
|
417
|
-
util.assertNever(issue);
|
|
418
|
+
util$1.assertNever(issue);
|
|
418
419
|
}
|
|
419
420
|
return { message };
|
|
420
421
|
};
|
|
@@ -1212,7 +1213,7 @@ var ZodString = class ZodString extends ZodType {
|
|
|
1212
1213
|
});
|
|
1213
1214
|
status.dirty();
|
|
1214
1215
|
}
|
|
1215
|
-
} else util.assertNever(check);
|
|
1216
|
+
} else util$1.assertNever(check);
|
|
1216
1217
|
return {
|
|
1217
1218
|
status: status.value,
|
|
1218
1219
|
value: input.data
|
|
@@ -1521,7 +1522,7 @@ var ZodNumber = class ZodNumber extends ZodType {
|
|
|
1521
1522
|
let ctx = void 0;
|
|
1522
1523
|
const status = new ParseStatus();
|
|
1523
1524
|
for (const check of this._def.checks) if (check.kind === "int") {
|
|
1524
|
-
if (!util.isInteger(input.data)) {
|
|
1525
|
+
if (!util$1.isInteger(input.data)) {
|
|
1525
1526
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1526
1527
|
addIssueToContext(ctx, {
|
|
1527
1528
|
code: ZodIssueCode.invalid_type,
|
|
@@ -1576,7 +1577,7 @@ var ZodNumber = class ZodNumber extends ZodType {
|
|
|
1576
1577
|
});
|
|
1577
1578
|
status.dirty();
|
|
1578
1579
|
}
|
|
1579
|
-
} else util.assertNever(check);
|
|
1580
|
+
} else util$1.assertNever(check);
|
|
1580
1581
|
return {
|
|
1581
1582
|
status: status.value,
|
|
1582
1583
|
value: input.data
|
|
@@ -1690,7 +1691,7 @@ var ZodNumber = class ZodNumber extends ZodType {
|
|
|
1690
1691
|
return max;
|
|
1691
1692
|
}
|
|
1692
1693
|
get isInt() {
|
|
1693
|
-
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
1694
|
+
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util$1.isInteger(ch.value));
|
|
1694
1695
|
}
|
|
1695
1696
|
get isFinite() {
|
|
1696
1697
|
let max = null;
|
|
@@ -1761,7 +1762,7 @@ var ZodBigInt = class ZodBigInt extends ZodType {
|
|
|
1761
1762
|
});
|
|
1762
1763
|
status.dirty();
|
|
1763
1764
|
}
|
|
1764
|
-
} else util.assertNever(check);
|
|
1765
|
+
} else util$1.assertNever(check);
|
|
1765
1766
|
return {
|
|
1766
1767
|
status: status.value,
|
|
1767
1768
|
value: input.data
|
|
@@ -1933,7 +1934,7 @@ var ZodDate = class ZodDate extends ZodType {
|
|
|
1933
1934
|
});
|
|
1934
1935
|
status.dirty();
|
|
1935
1936
|
}
|
|
1936
|
-
} else util.assertNever(check);
|
|
1937
|
+
} else util$1.assertNever(check);
|
|
1937
1938
|
return {
|
|
1938
1939
|
status: status.value,
|
|
1939
1940
|
value: new Date(input.data.getTime())
|
|
@@ -2256,7 +2257,7 @@ var ZodObject = class ZodObject extends ZodType {
|
|
|
2256
2257
|
const shape = this._def.shape();
|
|
2257
2258
|
this._cached = {
|
|
2258
2259
|
shape,
|
|
2259
|
-
keys: util.objectKeys(shape)
|
|
2260
|
+
keys: util$1.objectKeys(shape)
|
|
2260
2261
|
};
|
|
2261
2262
|
return this._cached;
|
|
2262
2263
|
}
|
|
@@ -2404,7 +2405,7 @@ var ZodObject = class ZodObject extends ZodType {
|
|
|
2404
2405
|
}
|
|
2405
2406
|
pick(mask) {
|
|
2406
2407
|
const shape = {};
|
|
2407
|
-
for (const key of util.objectKeys(mask)) if (mask[key] && this.shape[key]) shape[key] = this.shape[key];
|
|
2408
|
+
for (const key of util$1.objectKeys(mask)) if (mask[key] && this.shape[key]) shape[key] = this.shape[key];
|
|
2408
2409
|
return new ZodObject({
|
|
2409
2410
|
...this._def,
|
|
2410
2411
|
shape: () => shape
|
|
@@ -2412,7 +2413,7 @@ var ZodObject = class ZodObject extends ZodType {
|
|
|
2412
2413
|
}
|
|
2413
2414
|
omit(mask) {
|
|
2414
2415
|
const shape = {};
|
|
2415
|
-
for (const key of util.objectKeys(this.shape)) if (!mask[key]) shape[key] = this.shape[key];
|
|
2416
|
+
for (const key of util$1.objectKeys(this.shape)) if (!mask[key]) shape[key] = this.shape[key];
|
|
2416
2417
|
return new ZodObject({
|
|
2417
2418
|
...this._def,
|
|
2418
2419
|
shape: () => shape
|
|
@@ -2426,7 +2427,7 @@ var ZodObject = class ZodObject extends ZodType {
|
|
|
2426
2427
|
}
|
|
2427
2428
|
partial(mask) {
|
|
2428
2429
|
const newShape = {};
|
|
2429
|
-
for (const key of util.objectKeys(this.shape)) {
|
|
2430
|
+
for (const key of util$1.objectKeys(this.shape)) {
|
|
2430
2431
|
const fieldSchema = this.shape[key];
|
|
2431
2432
|
if (mask && !mask[key]) newShape[key] = fieldSchema;
|
|
2432
2433
|
else newShape[key] = fieldSchema.optional();
|
|
@@ -2438,7 +2439,7 @@ var ZodObject = class ZodObject extends ZodType {
|
|
|
2438
2439
|
}
|
|
2439
2440
|
required(mask) {
|
|
2440
2441
|
const newShape = {};
|
|
2441
|
-
for (const key of util.objectKeys(this.shape)) if (mask && !mask[key]) newShape[key] = this.shape[key];
|
|
2442
|
+
for (const key of util$1.objectKeys(this.shape)) if (mask && !mask[key]) newShape[key] = this.shape[key];
|
|
2442
2443
|
else {
|
|
2443
2444
|
let newField = this.shape[key];
|
|
2444
2445
|
while (newField instanceof ZodOptional) newField = newField._def.innerType;
|
|
@@ -2450,7 +2451,7 @@ var ZodObject = class ZodObject extends ZodType {
|
|
|
2450
2451
|
});
|
|
2451
2452
|
}
|
|
2452
2453
|
keyof() {
|
|
2453
|
-
return createZodEnum(util.objectKeys(this.shape));
|
|
2454
|
+
return createZodEnum(util$1.objectKeys(this.shape));
|
|
2454
2455
|
}
|
|
2455
2456
|
};
|
|
2456
2457
|
ZodObject.create = (shape, params) => {
|
|
@@ -2567,7 +2568,7 @@ const getDiscriminator = (type) => {
|
|
|
2567
2568
|
else if (type instanceof ZodEffects) return getDiscriminator(type.innerType());
|
|
2568
2569
|
else if (type instanceof ZodLiteral) return [type.value];
|
|
2569
2570
|
else if (type instanceof ZodEnum) return type.options;
|
|
2570
|
-
else if (type instanceof ZodNativeEnum) return util.objectValues(type.enum);
|
|
2571
|
+
else if (type instanceof ZodNativeEnum) return util$1.objectValues(type.enum);
|
|
2571
2572
|
else if (type instanceof ZodDefault) return getDiscriminator(type._def.innerType);
|
|
2572
2573
|
else if (type instanceof ZodUndefined) return [void 0];
|
|
2573
2574
|
else if (type instanceof ZodNull) return [null];
|
|
@@ -2655,8 +2656,8 @@ function mergeValues(a, b) {
|
|
|
2655
2656
|
data: a
|
|
2656
2657
|
};
|
|
2657
2658
|
else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
2658
|
-
const bKeys = util.objectKeys(b);
|
|
2659
|
-
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
2659
|
+
const bKeys = util$1.objectKeys(b);
|
|
2660
|
+
const sharedKeys = util$1.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
2660
2661
|
const newObj = {
|
|
2661
2662
|
...a,
|
|
2662
2663
|
...b
|
|
@@ -3161,7 +3162,7 @@ var ZodEnum = class ZodEnum extends ZodType {
|
|
|
3161
3162
|
const ctx = this._getOrReturnCtx(input);
|
|
3162
3163
|
const expectedValues = this._def.values;
|
|
3163
3164
|
addIssueToContext(ctx, {
|
|
3164
|
-
expected: util.joinValues(expectedValues),
|
|
3165
|
+
expected: util$1.joinValues(expectedValues),
|
|
3165
3166
|
received: ctx.parsedType,
|
|
3166
3167
|
code: ZodIssueCode.invalid_type
|
|
3167
3168
|
});
|
|
@@ -3214,20 +3215,20 @@ var ZodEnum = class ZodEnum extends ZodType {
|
|
|
3214
3215
|
ZodEnum.create = createZodEnum;
|
|
3215
3216
|
var ZodNativeEnum = class extends ZodType {
|
|
3216
3217
|
_parse(input) {
|
|
3217
|
-
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
3218
|
+
const nativeEnumValues = util$1.getValidEnumValues(this._def.values);
|
|
3218
3219
|
const ctx = this._getOrReturnCtx(input);
|
|
3219
3220
|
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
3220
|
-
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3221
|
+
const expectedValues = util$1.objectValues(nativeEnumValues);
|
|
3221
3222
|
addIssueToContext(ctx, {
|
|
3222
|
-
expected: util.joinValues(expectedValues),
|
|
3223
|
+
expected: util$1.joinValues(expectedValues),
|
|
3223
3224
|
received: ctx.parsedType,
|
|
3224
3225
|
code: ZodIssueCode.invalid_type
|
|
3225
3226
|
});
|
|
3226
3227
|
return INVALID;
|
|
3227
3228
|
}
|
|
3228
|
-
if (!this._cache) this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
3229
|
+
if (!this._cache) this._cache = new Set(util$1.getValidEnumValues(this._def.values));
|
|
3229
3230
|
if (!this._cache.has(input.data)) {
|
|
3230
|
-
const expectedValues = util.objectValues(nativeEnumValues);
|
|
3231
|
+
const expectedValues = util$1.objectValues(nativeEnumValues);
|
|
3231
3232
|
addIssueToContext(ctx, {
|
|
3232
3233
|
received: ctx.data,
|
|
3233
3234
|
code: ZodIssueCode.invalid_enum_value,
|
|
@@ -3384,7 +3385,7 @@ var ZodEffects = class extends ZodType {
|
|
|
3384
3385
|
value: result
|
|
3385
3386
|
}));
|
|
3386
3387
|
});
|
|
3387
|
-
util.assertNever(effect);
|
|
3388
|
+
util$1.assertNever(effect);
|
|
3388
3389
|
}
|
|
3389
3390
|
};
|
|
3390
3391
|
ZodEffects.create = (schema, effect, params) => {
|
|
@@ -3909,7 +3910,7 @@ const lockfileSchema = objectType({
|
|
|
3909
3910
|
|
|
3910
3911
|
//#endregion
|
|
3911
3912
|
//#region ../core/src/utils/yaml-parser.ts
|
|
3912
|
-
var import_dist = require_dist();
|
|
3913
|
+
var import_dist$2 = require_dist$2();
|
|
3913
3914
|
function isErrnoException(error) {
|
|
3914
3915
|
return error instanceof Error && "code" in error;
|
|
3915
3916
|
}
|
|
@@ -3918,7 +3919,7 @@ function isErrnoException(error) {
|
|
|
3918
3919
|
*/
|
|
3919
3920
|
async function loadAndValidateYaml(filePath, schema, entityName) {
|
|
3920
3921
|
try {
|
|
3921
|
-
const data = (0, import_dist.parse)(await readFile(filePath, "utf-8"));
|
|
3922
|
+
const data = (0, import_dist$2.parse)(await readFile(filePath, "utf-8"));
|
|
3922
3923
|
const result = schema.safeParse(data);
|
|
3923
3924
|
if (!result.success) throw new ManifestValidationError(`Invalid ${entityName}: ${result.error.errors.map((err) => `${err.path.join(".")}: ${err.message}`).join("; ")}`);
|
|
3924
3925
|
return result.data;
|
|
@@ -3933,7 +3934,7 @@ async function loadAndValidateYaml(filePath, schema, entityName) {
|
|
|
3933
3934
|
*/
|
|
3934
3935
|
async function loadProfileManifest(filePath) {
|
|
3935
3936
|
try {
|
|
3936
|
-
const raw = (0, import_dist.parse)(await readFile(filePath, "utf-8"));
|
|
3937
|
+
const raw = (0, import_dist$2.parse)(await readFile(filePath, "utf-8"));
|
|
3937
3938
|
if (raw && typeof raw === "object" && "tools" in raw && !raw.ai?.tools) console.warn(`Warning: "${filePath}" has top-level "tools:" — this is ignored. Move it under "ai:" section:\n\nai:\n tools:\n - ...\n`);
|
|
3938
3939
|
} catch {}
|
|
3939
3940
|
return loadAndValidateYaml(filePath, profileManifestSchema, "profile manifest");
|
|
@@ -3944,12 +3945,6 @@ async function loadProfileManifest(filePath) {
|
|
|
3944
3945
|
async function loadProjectManifest(filePath) {
|
|
3945
3946
|
return loadAndValidateYaml(filePath, projectManifestSchema, "project manifest");
|
|
3946
3947
|
}
|
|
3947
|
-
/**
|
|
3948
|
-
* Loads and validates a lockfile from a YAML file
|
|
3949
|
-
*/
|
|
3950
|
-
async function loadLockfile(filePath) {
|
|
3951
|
-
return loadAndValidateYaml(filePath, lockfileSchema, "lockfile");
|
|
3952
|
-
}
|
|
3953
3948
|
|
|
3954
3949
|
//#endregion
|
|
3955
3950
|
//#region ../core/src/utils/source-parser.ts
|
|
@@ -4073,7 +4068,7 @@ function parseFrontmatter(raw) {
|
|
|
4073
4068
|
const yamlBlock = trimmed.slice(4, endIndex);
|
|
4074
4069
|
const content = trimmed.slice(endIndex + 4).trimStart();
|
|
4075
4070
|
try {
|
|
4076
|
-
const data = (0, import_dist.parse)(yamlBlock);
|
|
4071
|
+
const data = (0, import_dist$2.parse)(yamlBlock);
|
|
4077
4072
|
return {
|
|
4078
4073
|
data: typeof data === "object" && data !== null ? data : {},
|
|
4079
4074
|
content
|
|
@@ -4107,7 +4102,7 @@ var BaseAIToolAdapter = class {
|
|
|
4107
4102
|
memoryFilename = "AGENTS.md";
|
|
4108
4103
|
async isInstalled() {
|
|
4109
4104
|
try {
|
|
4110
|
-
const { detectInstalledAITools } = await import("./ai-tool-detection-
|
|
4105
|
+
const { detectInstalledAITools } = await import("./ai-tool-detection-Bw4qveB8.mjs");
|
|
4111
4106
|
return (await detectInstalledAITools()).includes(this.key);
|
|
4112
4107
|
} catch {
|
|
4113
4108
|
return false;
|
|
@@ -4760,7 +4755,7 @@ async function removeGitignoreManagedSection(projectRoot) {
|
|
|
4760
4755
|
* predictable .gitignore content regardless of which tools a profile supports
|
|
4761
4756
|
* or a developer has installed.
|
|
4762
4757
|
*
|
|
4763
|
-
* Returns deduplicated, sorted patterns
|
|
4758
|
+
* Returns deduplicated, sorted patterns for AI tool and IDE configurations.
|
|
4764
4759
|
*/
|
|
4765
4760
|
function collectComprehensivePatterns(options) {
|
|
4766
4761
|
const patterns = /* @__PURE__ */ new Set();
|
|
@@ -4783,10 +4778,4526 @@ function collectComprehensivePatterns(options) {
|
|
|
4783
4778
|
}
|
|
4784
4779
|
}
|
|
4785
4780
|
for (const target of fileTargets) patterns.add(target);
|
|
4786
|
-
patterns.add("baton.lock");
|
|
4787
4781
|
return [...patterns].sort();
|
|
4788
4782
|
}
|
|
4789
4783
|
|
|
4784
|
+
//#endregion
|
|
4785
|
+
//#region ../../node_modules/.bun/ms@2.1.3/node_modules/ms/index.js
|
|
4786
|
+
var require_ms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4787
|
+
/**
|
|
4788
|
+
* Helpers.
|
|
4789
|
+
*/
|
|
4790
|
+
var s = 1e3;
|
|
4791
|
+
var m = s * 60;
|
|
4792
|
+
var h = m * 60;
|
|
4793
|
+
var d = h * 24;
|
|
4794
|
+
var w = d * 7;
|
|
4795
|
+
var y = d * 365.25;
|
|
4796
|
+
/**
|
|
4797
|
+
* Parse or format the given `val`.
|
|
4798
|
+
*
|
|
4799
|
+
* Options:
|
|
4800
|
+
*
|
|
4801
|
+
* - `long` verbose formatting [false]
|
|
4802
|
+
*
|
|
4803
|
+
* @param {String|Number} val
|
|
4804
|
+
* @param {Object} [options]
|
|
4805
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
4806
|
+
* @return {String|Number}
|
|
4807
|
+
* @api public
|
|
4808
|
+
*/
|
|
4809
|
+
module.exports = function(val, options) {
|
|
4810
|
+
options = options || {};
|
|
4811
|
+
var type = typeof val;
|
|
4812
|
+
if (type === "string" && val.length > 0) return parse(val);
|
|
4813
|
+
else if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
|
|
4814
|
+
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
4815
|
+
};
|
|
4816
|
+
/**
|
|
4817
|
+
* Parse the given `str` and return milliseconds.
|
|
4818
|
+
*
|
|
4819
|
+
* @param {String} str
|
|
4820
|
+
* @return {Number}
|
|
4821
|
+
* @api private
|
|
4822
|
+
*/
|
|
4823
|
+
function parse(str) {
|
|
4824
|
+
str = String(str);
|
|
4825
|
+
if (str.length > 100) return;
|
|
4826
|
+
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);
|
|
4827
|
+
if (!match) return;
|
|
4828
|
+
var n = parseFloat(match[1]);
|
|
4829
|
+
switch ((match[2] || "ms").toLowerCase()) {
|
|
4830
|
+
case "years":
|
|
4831
|
+
case "year":
|
|
4832
|
+
case "yrs":
|
|
4833
|
+
case "yr":
|
|
4834
|
+
case "y": return n * y;
|
|
4835
|
+
case "weeks":
|
|
4836
|
+
case "week":
|
|
4837
|
+
case "w": return n * w;
|
|
4838
|
+
case "days":
|
|
4839
|
+
case "day":
|
|
4840
|
+
case "d": return n * d;
|
|
4841
|
+
case "hours":
|
|
4842
|
+
case "hour":
|
|
4843
|
+
case "hrs":
|
|
4844
|
+
case "hr":
|
|
4845
|
+
case "h": return n * h;
|
|
4846
|
+
case "minutes":
|
|
4847
|
+
case "minute":
|
|
4848
|
+
case "mins":
|
|
4849
|
+
case "min":
|
|
4850
|
+
case "m": return n * m;
|
|
4851
|
+
case "seconds":
|
|
4852
|
+
case "second":
|
|
4853
|
+
case "secs":
|
|
4854
|
+
case "sec":
|
|
4855
|
+
case "s": return n * s;
|
|
4856
|
+
case "milliseconds":
|
|
4857
|
+
case "millisecond":
|
|
4858
|
+
case "msecs":
|
|
4859
|
+
case "msec":
|
|
4860
|
+
case "ms": return n;
|
|
4861
|
+
default: return;
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
/**
|
|
4865
|
+
* Short format for `ms`.
|
|
4866
|
+
*
|
|
4867
|
+
* @param {Number} ms
|
|
4868
|
+
* @return {String}
|
|
4869
|
+
* @api private
|
|
4870
|
+
*/
|
|
4871
|
+
function fmtShort(ms) {
|
|
4872
|
+
var msAbs = Math.abs(ms);
|
|
4873
|
+
if (msAbs >= d) return Math.round(ms / d) + "d";
|
|
4874
|
+
if (msAbs >= h) return Math.round(ms / h) + "h";
|
|
4875
|
+
if (msAbs >= m) return Math.round(ms / m) + "m";
|
|
4876
|
+
if (msAbs >= s) return Math.round(ms / s) + "s";
|
|
4877
|
+
return ms + "ms";
|
|
4878
|
+
}
|
|
4879
|
+
/**
|
|
4880
|
+
* Long format for `ms`.
|
|
4881
|
+
*
|
|
4882
|
+
* @param {Number} ms
|
|
4883
|
+
* @return {String}
|
|
4884
|
+
* @api private
|
|
4885
|
+
*/
|
|
4886
|
+
function fmtLong(ms) {
|
|
4887
|
+
var msAbs = Math.abs(ms);
|
|
4888
|
+
if (msAbs >= d) return plural(ms, msAbs, d, "day");
|
|
4889
|
+
if (msAbs >= h) return plural(ms, msAbs, h, "hour");
|
|
4890
|
+
if (msAbs >= m) return plural(ms, msAbs, m, "minute");
|
|
4891
|
+
if (msAbs >= s) return plural(ms, msAbs, s, "second");
|
|
4892
|
+
return ms + " ms";
|
|
4893
|
+
}
|
|
4894
|
+
/**
|
|
4895
|
+
* Pluralization helper.
|
|
4896
|
+
*/
|
|
4897
|
+
function plural(ms, msAbs, n, name) {
|
|
4898
|
+
var isPlural = msAbs >= n * 1.5;
|
|
4899
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
4900
|
+
}
|
|
4901
|
+
}));
|
|
4902
|
+
|
|
4903
|
+
//#endregion
|
|
4904
|
+
//#region ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/common.js
|
|
4905
|
+
var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
4906
|
+
/**
|
|
4907
|
+
* This is the common logic for both the Node.js and web browser
|
|
4908
|
+
* implementations of `debug()`.
|
|
4909
|
+
*/
|
|
4910
|
+
function setup(env) {
|
|
4911
|
+
createDebug.debug = createDebug;
|
|
4912
|
+
createDebug.default = createDebug;
|
|
4913
|
+
createDebug.coerce = coerce;
|
|
4914
|
+
createDebug.disable = disable;
|
|
4915
|
+
createDebug.enable = enable;
|
|
4916
|
+
createDebug.enabled = enabled;
|
|
4917
|
+
createDebug.humanize = require_ms();
|
|
4918
|
+
createDebug.destroy = destroy;
|
|
4919
|
+
Object.keys(env).forEach((key) => {
|
|
4920
|
+
createDebug[key] = env[key];
|
|
4921
|
+
});
|
|
4922
|
+
/**
|
|
4923
|
+
* The currently active debug mode names, and names to skip.
|
|
4924
|
+
*/
|
|
4925
|
+
createDebug.names = [];
|
|
4926
|
+
createDebug.skips = [];
|
|
4927
|
+
/**
|
|
4928
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
4929
|
+
*
|
|
4930
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
4931
|
+
*/
|
|
4932
|
+
createDebug.formatters = {};
|
|
4933
|
+
/**
|
|
4934
|
+
* Selects a color for a debug namespace
|
|
4935
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
4936
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
4937
|
+
* @api private
|
|
4938
|
+
*/
|
|
4939
|
+
function selectColor(namespace) {
|
|
4940
|
+
let hash = 0;
|
|
4941
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
4942
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
4943
|
+
hash |= 0;
|
|
4944
|
+
}
|
|
4945
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
4946
|
+
}
|
|
4947
|
+
createDebug.selectColor = selectColor;
|
|
4948
|
+
/**
|
|
4949
|
+
* Create a debugger with the given `namespace`.
|
|
4950
|
+
*
|
|
4951
|
+
* @param {String} namespace
|
|
4952
|
+
* @return {Function}
|
|
4953
|
+
* @api public
|
|
4954
|
+
*/
|
|
4955
|
+
function createDebug(namespace) {
|
|
4956
|
+
let prevTime;
|
|
4957
|
+
let enableOverride = null;
|
|
4958
|
+
let namespacesCache;
|
|
4959
|
+
let enabledCache;
|
|
4960
|
+
function debug(...args) {
|
|
4961
|
+
if (!debug.enabled) return;
|
|
4962
|
+
const self = debug;
|
|
4963
|
+
const curr = Number(/* @__PURE__ */ new Date());
|
|
4964
|
+
self.diff = curr - (prevTime || curr);
|
|
4965
|
+
self.prev = prevTime;
|
|
4966
|
+
self.curr = curr;
|
|
4967
|
+
prevTime = curr;
|
|
4968
|
+
args[0] = createDebug.coerce(args[0]);
|
|
4969
|
+
if (typeof args[0] !== "string") args.unshift("%O");
|
|
4970
|
+
let index = 0;
|
|
4971
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
4972
|
+
if (match === "%%") return "%";
|
|
4973
|
+
index++;
|
|
4974
|
+
const formatter = createDebug.formatters[format];
|
|
4975
|
+
if (typeof formatter === "function") {
|
|
4976
|
+
const val = args[index];
|
|
4977
|
+
match = formatter.call(self, val);
|
|
4978
|
+
args.splice(index, 1);
|
|
4979
|
+
index--;
|
|
4980
|
+
}
|
|
4981
|
+
return match;
|
|
4982
|
+
});
|
|
4983
|
+
createDebug.formatArgs.call(self, args);
|
|
4984
|
+
(self.log || createDebug.log).apply(self, args);
|
|
4985
|
+
}
|
|
4986
|
+
debug.namespace = namespace;
|
|
4987
|
+
debug.useColors = createDebug.useColors();
|
|
4988
|
+
debug.color = createDebug.selectColor(namespace);
|
|
4989
|
+
debug.extend = extend;
|
|
4990
|
+
debug.destroy = createDebug.destroy;
|
|
4991
|
+
Object.defineProperty(debug, "enabled", {
|
|
4992
|
+
enumerable: true,
|
|
4993
|
+
configurable: false,
|
|
4994
|
+
get: () => {
|
|
4995
|
+
if (enableOverride !== null) return enableOverride;
|
|
4996
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
4997
|
+
namespacesCache = createDebug.namespaces;
|
|
4998
|
+
enabledCache = createDebug.enabled(namespace);
|
|
4999
|
+
}
|
|
5000
|
+
return enabledCache;
|
|
5001
|
+
},
|
|
5002
|
+
set: (v) => {
|
|
5003
|
+
enableOverride = v;
|
|
5004
|
+
}
|
|
5005
|
+
});
|
|
5006
|
+
if (typeof createDebug.init === "function") createDebug.init(debug);
|
|
5007
|
+
return debug;
|
|
5008
|
+
}
|
|
5009
|
+
function extend(namespace, delimiter) {
|
|
5010
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
5011
|
+
newDebug.log = this.log;
|
|
5012
|
+
return newDebug;
|
|
5013
|
+
}
|
|
5014
|
+
/**
|
|
5015
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
5016
|
+
* separated by a colon and wildcards.
|
|
5017
|
+
*
|
|
5018
|
+
* @param {String} namespaces
|
|
5019
|
+
* @api public
|
|
5020
|
+
*/
|
|
5021
|
+
function enable(namespaces) {
|
|
5022
|
+
createDebug.save(namespaces);
|
|
5023
|
+
createDebug.namespaces = namespaces;
|
|
5024
|
+
createDebug.names = [];
|
|
5025
|
+
createDebug.skips = [];
|
|
5026
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
5027
|
+
for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
|
|
5028
|
+
else createDebug.names.push(ns);
|
|
5029
|
+
}
|
|
5030
|
+
/**
|
|
5031
|
+
* Checks if the given string matches a namespace template, honoring
|
|
5032
|
+
* asterisks as wildcards.
|
|
5033
|
+
*
|
|
5034
|
+
* @param {String} search
|
|
5035
|
+
* @param {String} template
|
|
5036
|
+
* @return {Boolean}
|
|
5037
|
+
*/
|
|
5038
|
+
function matchesTemplate(search, template) {
|
|
5039
|
+
let searchIndex = 0;
|
|
5040
|
+
let templateIndex = 0;
|
|
5041
|
+
let starIndex = -1;
|
|
5042
|
+
let matchIndex = 0;
|
|
5043
|
+
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
|
|
5044
|
+
starIndex = templateIndex;
|
|
5045
|
+
matchIndex = searchIndex;
|
|
5046
|
+
templateIndex++;
|
|
5047
|
+
} else {
|
|
5048
|
+
searchIndex++;
|
|
5049
|
+
templateIndex++;
|
|
5050
|
+
}
|
|
5051
|
+
else if (starIndex !== -1) {
|
|
5052
|
+
templateIndex = starIndex + 1;
|
|
5053
|
+
matchIndex++;
|
|
5054
|
+
searchIndex = matchIndex;
|
|
5055
|
+
} else return false;
|
|
5056
|
+
while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
|
|
5057
|
+
return templateIndex === template.length;
|
|
5058
|
+
}
|
|
5059
|
+
/**
|
|
5060
|
+
* Disable debug output.
|
|
5061
|
+
*
|
|
5062
|
+
* @return {String} namespaces
|
|
5063
|
+
* @api public
|
|
5064
|
+
*/
|
|
5065
|
+
function disable() {
|
|
5066
|
+
const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
|
|
5067
|
+
createDebug.enable("");
|
|
5068
|
+
return namespaces;
|
|
5069
|
+
}
|
|
5070
|
+
/**
|
|
5071
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
5072
|
+
*
|
|
5073
|
+
* @param {String} name
|
|
5074
|
+
* @return {Boolean}
|
|
5075
|
+
* @api public
|
|
5076
|
+
*/
|
|
5077
|
+
function enabled(name) {
|
|
5078
|
+
for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
|
|
5079
|
+
for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
|
|
5080
|
+
return false;
|
|
5081
|
+
}
|
|
5082
|
+
/**
|
|
5083
|
+
* Coerce `val`.
|
|
5084
|
+
*
|
|
5085
|
+
* @param {Mixed} val
|
|
5086
|
+
* @return {Mixed}
|
|
5087
|
+
* @api private
|
|
5088
|
+
*/
|
|
5089
|
+
function coerce(val) {
|
|
5090
|
+
if (val instanceof Error) return val.stack || val.message;
|
|
5091
|
+
return val;
|
|
5092
|
+
}
|
|
5093
|
+
/**
|
|
5094
|
+
* XXX DO NOT USE. This is a temporary stub function.
|
|
5095
|
+
* XXX It WILL be removed in the next major release.
|
|
5096
|
+
*/
|
|
5097
|
+
function destroy() {
|
|
5098
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
5099
|
+
}
|
|
5100
|
+
createDebug.enable(createDebug.load());
|
|
5101
|
+
return createDebug;
|
|
5102
|
+
}
|
|
5103
|
+
module.exports = setup;
|
|
5104
|
+
}));
|
|
5105
|
+
|
|
5106
|
+
//#endregion
|
|
5107
|
+
//#region ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/browser.js
|
|
5108
|
+
var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5109
|
+
/**
|
|
5110
|
+
* This is the web browser implementation of `debug()`.
|
|
5111
|
+
*/
|
|
5112
|
+
exports.formatArgs = formatArgs;
|
|
5113
|
+
exports.save = save;
|
|
5114
|
+
exports.load = load;
|
|
5115
|
+
exports.useColors = useColors;
|
|
5116
|
+
exports.storage = localstorage();
|
|
5117
|
+
exports.destroy = (() => {
|
|
5118
|
+
let warned = false;
|
|
5119
|
+
return () => {
|
|
5120
|
+
if (!warned) {
|
|
5121
|
+
warned = true;
|
|
5122
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
5123
|
+
}
|
|
5124
|
+
};
|
|
5125
|
+
})();
|
|
5126
|
+
/**
|
|
5127
|
+
* Colors.
|
|
5128
|
+
*/
|
|
5129
|
+
exports.colors = [
|
|
5130
|
+
"#0000CC",
|
|
5131
|
+
"#0000FF",
|
|
5132
|
+
"#0033CC",
|
|
5133
|
+
"#0033FF",
|
|
5134
|
+
"#0066CC",
|
|
5135
|
+
"#0066FF",
|
|
5136
|
+
"#0099CC",
|
|
5137
|
+
"#0099FF",
|
|
5138
|
+
"#00CC00",
|
|
5139
|
+
"#00CC33",
|
|
5140
|
+
"#00CC66",
|
|
5141
|
+
"#00CC99",
|
|
5142
|
+
"#00CCCC",
|
|
5143
|
+
"#00CCFF",
|
|
5144
|
+
"#3300CC",
|
|
5145
|
+
"#3300FF",
|
|
5146
|
+
"#3333CC",
|
|
5147
|
+
"#3333FF",
|
|
5148
|
+
"#3366CC",
|
|
5149
|
+
"#3366FF",
|
|
5150
|
+
"#3399CC",
|
|
5151
|
+
"#3399FF",
|
|
5152
|
+
"#33CC00",
|
|
5153
|
+
"#33CC33",
|
|
5154
|
+
"#33CC66",
|
|
5155
|
+
"#33CC99",
|
|
5156
|
+
"#33CCCC",
|
|
5157
|
+
"#33CCFF",
|
|
5158
|
+
"#6600CC",
|
|
5159
|
+
"#6600FF",
|
|
5160
|
+
"#6633CC",
|
|
5161
|
+
"#6633FF",
|
|
5162
|
+
"#66CC00",
|
|
5163
|
+
"#66CC33",
|
|
5164
|
+
"#9900CC",
|
|
5165
|
+
"#9900FF",
|
|
5166
|
+
"#9933CC",
|
|
5167
|
+
"#9933FF",
|
|
5168
|
+
"#99CC00",
|
|
5169
|
+
"#99CC33",
|
|
5170
|
+
"#CC0000",
|
|
5171
|
+
"#CC0033",
|
|
5172
|
+
"#CC0066",
|
|
5173
|
+
"#CC0099",
|
|
5174
|
+
"#CC00CC",
|
|
5175
|
+
"#CC00FF",
|
|
5176
|
+
"#CC3300",
|
|
5177
|
+
"#CC3333",
|
|
5178
|
+
"#CC3366",
|
|
5179
|
+
"#CC3399",
|
|
5180
|
+
"#CC33CC",
|
|
5181
|
+
"#CC33FF",
|
|
5182
|
+
"#CC6600",
|
|
5183
|
+
"#CC6633",
|
|
5184
|
+
"#CC9900",
|
|
5185
|
+
"#CC9933",
|
|
5186
|
+
"#CCCC00",
|
|
5187
|
+
"#CCCC33",
|
|
5188
|
+
"#FF0000",
|
|
5189
|
+
"#FF0033",
|
|
5190
|
+
"#FF0066",
|
|
5191
|
+
"#FF0099",
|
|
5192
|
+
"#FF00CC",
|
|
5193
|
+
"#FF00FF",
|
|
5194
|
+
"#FF3300",
|
|
5195
|
+
"#FF3333",
|
|
5196
|
+
"#FF3366",
|
|
5197
|
+
"#FF3399",
|
|
5198
|
+
"#FF33CC",
|
|
5199
|
+
"#FF33FF",
|
|
5200
|
+
"#FF6600",
|
|
5201
|
+
"#FF6633",
|
|
5202
|
+
"#FF9900",
|
|
5203
|
+
"#FF9933",
|
|
5204
|
+
"#FFCC00",
|
|
5205
|
+
"#FFCC33"
|
|
5206
|
+
];
|
|
5207
|
+
/**
|
|
5208
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
5209
|
+
* and the Firebug extension (any Firefox version) are known
|
|
5210
|
+
* to support "%c" CSS customizations.
|
|
5211
|
+
*
|
|
5212
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
5213
|
+
*/
|
|
5214
|
+
function useColors() {
|
|
5215
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
|
|
5216
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
|
|
5217
|
+
let m;
|
|
5218
|
+
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+)/);
|
|
5219
|
+
}
|
|
5220
|
+
/**
|
|
5221
|
+
* Colorize log arguments if enabled.
|
|
5222
|
+
*
|
|
5223
|
+
* @api public
|
|
5224
|
+
*/
|
|
5225
|
+
function formatArgs(args) {
|
|
5226
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
5227
|
+
if (!this.useColors) return;
|
|
5228
|
+
const c = "color: " + this.color;
|
|
5229
|
+
args.splice(1, 0, c, "color: inherit");
|
|
5230
|
+
let index = 0;
|
|
5231
|
+
let lastC = 0;
|
|
5232
|
+
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
5233
|
+
if (match === "%%") return;
|
|
5234
|
+
index++;
|
|
5235
|
+
if (match === "%c") lastC = index;
|
|
5236
|
+
});
|
|
5237
|
+
args.splice(lastC, 0, c);
|
|
5238
|
+
}
|
|
5239
|
+
/**
|
|
5240
|
+
* Invokes `console.debug()` when available.
|
|
5241
|
+
* No-op when `console.debug` is not a "function".
|
|
5242
|
+
* If `console.debug` is not available, falls back
|
|
5243
|
+
* to `console.log`.
|
|
5244
|
+
*
|
|
5245
|
+
* @api public
|
|
5246
|
+
*/
|
|
5247
|
+
exports.log = console.debug || console.log || (() => {});
|
|
5248
|
+
/**
|
|
5249
|
+
* Save `namespaces`.
|
|
5250
|
+
*
|
|
5251
|
+
* @param {String} namespaces
|
|
5252
|
+
* @api private
|
|
5253
|
+
*/
|
|
5254
|
+
function save(namespaces) {
|
|
5255
|
+
try {
|
|
5256
|
+
if (namespaces) exports.storage.setItem("debug", namespaces);
|
|
5257
|
+
else exports.storage.removeItem("debug");
|
|
5258
|
+
} catch (error) {}
|
|
5259
|
+
}
|
|
5260
|
+
/**
|
|
5261
|
+
* Load `namespaces`.
|
|
5262
|
+
*
|
|
5263
|
+
* @return {String} returns the previously persisted debug modes
|
|
5264
|
+
* @api private
|
|
5265
|
+
*/
|
|
5266
|
+
function load() {
|
|
5267
|
+
let r;
|
|
5268
|
+
try {
|
|
5269
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
5270
|
+
} catch (error) {}
|
|
5271
|
+
if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
|
|
5272
|
+
return r;
|
|
5273
|
+
}
|
|
5274
|
+
/**
|
|
5275
|
+
* Localstorage attempts to return the localstorage.
|
|
5276
|
+
*
|
|
5277
|
+
* This is necessary because safari throws
|
|
5278
|
+
* when a user disables cookies/localstorage
|
|
5279
|
+
* and you attempt to access it.
|
|
5280
|
+
*
|
|
5281
|
+
* @return {LocalStorage}
|
|
5282
|
+
* @api private
|
|
5283
|
+
*/
|
|
5284
|
+
function localstorage() {
|
|
5285
|
+
try {
|
|
5286
|
+
return localStorage;
|
|
5287
|
+
} catch (error) {}
|
|
5288
|
+
}
|
|
5289
|
+
module.exports = require_common()(exports);
|
|
5290
|
+
const { formatters } = module.exports;
|
|
5291
|
+
/**
|
|
5292
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
5293
|
+
*/
|
|
5294
|
+
formatters.j = function(v) {
|
|
5295
|
+
try {
|
|
5296
|
+
return JSON.stringify(v);
|
|
5297
|
+
} catch (error) {
|
|
5298
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
5299
|
+
}
|
|
5300
|
+
};
|
|
5301
|
+
}));
|
|
5302
|
+
|
|
5303
|
+
//#endregion
|
|
5304
|
+
//#region ../../node_modules/.bun/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
5305
|
+
var require_has_flag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5306
|
+
module.exports = (flag, argv = process.argv) => {
|
|
5307
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
5308
|
+
const position = argv.indexOf(prefix + flag);
|
|
5309
|
+
const terminatorPosition = argv.indexOf("--");
|
|
5310
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
5311
|
+
};
|
|
5312
|
+
}));
|
|
5313
|
+
|
|
5314
|
+
//#endregion
|
|
5315
|
+
//#region ../../node_modules/.bun/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
5316
|
+
var require_supports_color = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5317
|
+
const os = __require("os");
|
|
5318
|
+
const tty$1 = __require("tty");
|
|
5319
|
+
const hasFlag = require_has_flag();
|
|
5320
|
+
const { env } = process;
|
|
5321
|
+
let forceColor;
|
|
5322
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
|
|
5323
|
+
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
|
|
5324
|
+
if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
|
|
5325
|
+
else if (env.FORCE_COLOR === "false") forceColor = 0;
|
|
5326
|
+
else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
5327
|
+
function translateLevel(level) {
|
|
5328
|
+
if (level === 0) return false;
|
|
5329
|
+
return {
|
|
5330
|
+
level,
|
|
5331
|
+
hasBasic: true,
|
|
5332
|
+
has256: level >= 2,
|
|
5333
|
+
has16m: level >= 3
|
|
5334
|
+
};
|
|
5335
|
+
}
|
|
5336
|
+
function supportsColor(haveStream, streamIsTTY) {
|
|
5337
|
+
if (forceColor === 0) return 0;
|
|
5338
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
5339
|
+
if (hasFlag("color=256")) return 2;
|
|
5340
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
5341
|
+
const min = forceColor || 0;
|
|
5342
|
+
if (env.TERM === "dumb") return min;
|
|
5343
|
+
if (process.platform === "win32") {
|
|
5344
|
+
const osRelease = os.release().split(".");
|
|
5345
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
5346
|
+
return 1;
|
|
5347
|
+
}
|
|
5348
|
+
if ("CI" in env) {
|
|
5349
|
+
if ([
|
|
5350
|
+
"TRAVIS",
|
|
5351
|
+
"CIRCLECI",
|
|
5352
|
+
"APPVEYOR",
|
|
5353
|
+
"GITLAB_CI",
|
|
5354
|
+
"GITHUB_ACTIONS",
|
|
5355
|
+
"BUILDKITE"
|
|
5356
|
+
].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
|
|
5357
|
+
return min;
|
|
5358
|
+
}
|
|
5359
|
+
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
5360
|
+
if (env.COLORTERM === "truecolor") return 3;
|
|
5361
|
+
if ("TERM_PROGRAM" in env) {
|
|
5362
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
5363
|
+
switch (env.TERM_PROGRAM) {
|
|
5364
|
+
case "iTerm.app": return version >= 3 ? 3 : 2;
|
|
5365
|
+
case "Apple_Terminal": return 2;
|
|
5366
|
+
}
|
|
5367
|
+
}
|
|
5368
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
5369
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
5370
|
+
if ("COLORTERM" in env) return 1;
|
|
5371
|
+
return min;
|
|
5372
|
+
}
|
|
5373
|
+
function getSupportLevel(stream) {
|
|
5374
|
+
return translateLevel(supportsColor(stream, stream && stream.isTTY));
|
|
5375
|
+
}
|
|
5376
|
+
module.exports = {
|
|
5377
|
+
supportsColor: getSupportLevel,
|
|
5378
|
+
stdout: translateLevel(supportsColor(true, tty$1.isatty(1))),
|
|
5379
|
+
stderr: translateLevel(supportsColor(true, tty$1.isatty(2)))
|
|
5380
|
+
};
|
|
5381
|
+
}));
|
|
5382
|
+
|
|
5383
|
+
//#endregion
|
|
5384
|
+
//#region ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/node.js
|
|
5385
|
+
var require_node = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5386
|
+
/**
|
|
5387
|
+
* Module dependencies.
|
|
5388
|
+
*/
|
|
5389
|
+
const tty = __require("tty");
|
|
5390
|
+
const util = __require("util");
|
|
5391
|
+
/**
|
|
5392
|
+
* This is the Node.js implementation of `debug()`.
|
|
5393
|
+
*/
|
|
5394
|
+
exports.init = init;
|
|
5395
|
+
exports.log = log;
|
|
5396
|
+
exports.formatArgs = formatArgs;
|
|
5397
|
+
exports.save = save;
|
|
5398
|
+
exports.load = load;
|
|
5399
|
+
exports.useColors = useColors;
|
|
5400
|
+
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`.");
|
|
5401
|
+
/**
|
|
5402
|
+
* Colors.
|
|
5403
|
+
*/
|
|
5404
|
+
exports.colors = [
|
|
5405
|
+
6,
|
|
5406
|
+
2,
|
|
5407
|
+
3,
|
|
5408
|
+
4,
|
|
5409
|
+
5,
|
|
5410
|
+
1
|
|
5411
|
+
];
|
|
5412
|
+
try {
|
|
5413
|
+
const supportsColor = require_supports_color();
|
|
5414
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
|
|
5415
|
+
20,
|
|
5416
|
+
21,
|
|
5417
|
+
26,
|
|
5418
|
+
27,
|
|
5419
|
+
32,
|
|
5420
|
+
33,
|
|
5421
|
+
38,
|
|
5422
|
+
39,
|
|
5423
|
+
40,
|
|
5424
|
+
41,
|
|
5425
|
+
42,
|
|
5426
|
+
43,
|
|
5427
|
+
44,
|
|
5428
|
+
45,
|
|
5429
|
+
56,
|
|
5430
|
+
57,
|
|
5431
|
+
62,
|
|
5432
|
+
63,
|
|
5433
|
+
68,
|
|
5434
|
+
69,
|
|
5435
|
+
74,
|
|
5436
|
+
75,
|
|
5437
|
+
76,
|
|
5438
|
+
77,
|
|
5439
|
+
78,
|
|
5440
|
+
79,
|
|
5441
|
+
80,
|
|
5442
|
+
81,
|
|
5443
|
+
92,
|
|
5444
|
+
93,
|
|
5445
|
+
98,
|
|
5446
|
+
99,
|
|
5447
|
+
112,
|
|
5448
|
+
113,
|
|
5449
|
+
128,
|
|
5450
|
+
129,
|
|
5451
|
+
134,
|
|
5452
|
+
135,
|
|
5453
|
+
148,
|
|
5454
|
+
149,
|
|
5455
|
+
160,
|
|
5456
|
+
161,
|
|
5457
|
+
162,
|
|
5458
|
+
163,
|
|
5459
|
+
164,
|
|
5460
|
+
165,
|
|
5461
|
+
166,
|
|
5462
|
+
167,
|
|
5463
|
+
168,
|
|
5464
|
+
169,
|
|
5465
|
+
170,
|
|
5466
|
+
171,
|
|
5467
|
+
172,
|
|
5468
|
+
173,
|
|
5469
|
+
178,
|
|
5470
|
+
179,
|
|
5471
|
+
184,
|
|
5472
|
+
185,
|
|
5473
|
+
196,
|
|
5474
|
+
197,
|
|
5475
|
+
198,
|
|
5476
|
+
199,
|
|
5477
|
+
200,
|
|
5478
|
+
201,
|
|
5479
|
+
202,
|
|
5480
|
+
203,
|
|
5481
|
+
204,
|
|
5482
|
+
205,
|
|
5483
|
+
206,
|
|
5484
|
+
207,
|
|
5485
|
+
208,
|
|
5486
|
+
209,
|
|
5487
|
+
214,
|
|
5488
|
+
215,
|
|
5489
|
+
220,
|
|
5490
|
+
221
|
|
5491
|
+
];
|
|
5492
|
+
} catch (error) {}
|
|
5493
|
+
/**
|
|
5494
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
|
5495
|
+
*
|
|
5496
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
5497
|
+
*/
|
|
5498
|
+
exports.inspectOpts = Object.keys(process.env).filter((key) => {
|
|
5499
|
+
return /^debug_/i.test(key);
|
|
5500
|
+
}).reduce((obj, key) => {
|
|
5501
|
+
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
5502
|
+
return k.toUpperCase();
|
|
5503
|
+
});
|
|
5504
|
+
let val = process.env[key];
|
|
5505
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
|
5506
|
+
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
|
5507
|
+
else if (val === "null") val = null;
|
|
5508
|
+
else val = Number(val);
|
|
5509
|
+
obj[prop] = val;
|
|
5510
|
+
return obj;
|
|
5511
|
+
}, {});
|
|
5512
|
+
/**
|
|
5513
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
5514
|
+
*/
|
|
5515
|
+
function useColors() {
|
|
5516
|
+
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
5517
|
+
}
|
|
5518
|
+
/**
|
|
5519
|
+
* Adds ANSI color escape codes if enabled.
|
|
5520
|
+
*
|
|
5521
|
+
* @api public
|
|
5522
|
+
*/
|
|
5523
|
+
function formatArgs(args) {
|
|
5524
|
+
const { namespace: name, useColors } = this;
|
|
5525
|
+
if (useColors) {
|
|
5526
|
+
const c = this.color;
|
|
5527
|
+
const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
|
|
5528
|
+
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
5529
|
+
args[0] = prefix + args[0].split("\n").join("\n" + prefix);
|
|
5530
|
+
args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
5531
|
+
} else args[0] = getDate() + name + " " + args[0];
|
|
5532
|
+
}
|
|
5533
|
+
function getDate() {
|
|
5534
|
+
if (exports.inspectOpts.hideDate) return "";
|
|
5535
|
+
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
5536
|
+
}
|
|
5537
|
+
/**
|
|
5538
|
+
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
|
5539
|
+
*/
|
|
5540
|
+
function log(...args) {
|
|
5541
|
+
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
|
|
5542
|
+
}
|
|
5543
|
+
/**
|
|
5544
|
+
* Save `namespaces`.
|
|
5545
|
+
*
|
|
5546
|
+
* @param {String} namespaces
|
|
5547
|
+
* @api private
|
|
5548
|
+
*/
|
|
5549
|
+
function save(namespaces) {
|
|
5550
|
+
if (namespaces) process.env.DEBUG = namespaces;
|
|
5551
|
+
else delete process.env.DEBUG;
|
|
5552
|
+
}
|
|
5553
|
+
/**
|
|
5554
|
+
* Load `namespaces`.
|
|
5555
|
+
*
|
|
5556
|
+
* @return {String} returns the previously persisted debug modes
|
|
5557
|
+
* @api private
|
|
5558
|
+
*/
|
|
5559
|
+
function load() {
|
|
5560
|
+
return process.env.DEBUG;
|
|
5561
|
+
}
|
|
5562
|
+
/**
|
|
5563
|
+
* Init logic for `debug` instances.
|
|
5564
|
+
*
|
|
5565
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
|
5566
|
+
* differently for a particular `debug` instance.
|
|
5567
|
+
*/
|
|
5568
|
+
function init(debug) {
|
|
5569
|
+
debug.inspectOpts = {};
|
|
5570
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
5571
|
+
for (let i = 0; i < keys.length; i++) debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
5572
|
+
}
|
|
5573
|
+
module.exports = require_common()(exports);
|
|
5574
|
+
const { formatters } = module.exports;
|
|
5575
|
+
/**
|
|
5576
|
+
* Map %o to `util.inspect()`, all on a single line.
|
|
5577
|
+
*/
|
|
5578
|
+
formatters.o = function(v) {
|
|
5579
|
+
this.inspectOpts.colors = this.useColors;
|
|
5580
|
+
return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
5581
|
+
};
|
|
5582
|
+
/**
|
|
5583
|
+
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
5584
|
+
*/
|
|
5585
|
+
formatters.O = function(v) {
|
|
5586
|
+
this.inspectOpts.colors = this.useColors;
|
|
5587
|
+
return util.inspect(v, this.inspectOpts);
|
|
5588
|
+
};
|
|
5589
|
+
}));
|
|
5590
|
+
|
|
5591
|
+
//#endregion
|
|
5592
|
+
//#region ../../node_modules/.bun/debug@4.4.3/node_modules/debug/src/index.js
|
|
5593
|
+
var require_src$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5594
|
+
/**
|
|
5595
|
+
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
5596
|
+
* treat as a browser.
|
|
5597
|
+
*/
|
|
5598
|
+
if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) module.exports = require_browser();
|
|
5599
|
+
else module.exports = require_node();
|
|
5600
|
+
}));
|
|
5601
|
+
|
|
5602
|
+
//#endregion
|
|
5603
|
+
//#region ../../node_modules/.bun/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/src/index.js
|
|
5604
|
+
var require_src = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5605
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
5606
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
5607
|
+
};
|
|
5608
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5609
|
+
const fs_1 = __require("fs");
|
|
5610
|
+
const log = __importDefault(require_src$1()).default("@kwsites/file-exists");
|
|
5611
|
+
function check(path, isFile, isDirectory) {
|
|
5612
|
+
log(`checking %s`, path);
|
|
5613
|
+
try {
|
|
5614
|
+
const stat = fs_1.statSync(path);
|
|
5615
|
+
if (stat.isFile() && isFile) {
|
|
5616
|
+
log(`[OK] path represents a file`);
|
|
5617
|
+
return true;
|
|
5618
|
+
}
|
|
5619
|
+
if (stat.isDirectory() && isDirectory) {
|
|
5620
|
+
log(`[OK] path represents a directory`);
|
|
5621
|
+
return true;
|
|
5622
|
+
}
|
|
5623
|
+
log(`[FAIL] path represents something other than a file or directory`);
|
|
5624
|
+
return false;
|
|
5625
|
+
} catch (e) {
|
|
5626
|
+
if (e.code === "ENOENT") {
|
|
5627
|
+
log(`[FAIL] path is not accessible: %o`, e);
|
|
5628
|
+
return false;
|
|
5629
|
+
}
|
|
5630
|
+
log(`[FATAL] %o`, e);
|
|
5631
|
+
throw e;
|
|
5632
|
+
}
|
|
5633
|
+
}
|
|
5634
|
+
/**
|
|
5635
|
+
* Synchronous validation of a path existing either as a file or as a directory.
|
|
5636
|
+
*
|
|
5637
|
+
* @param {string} path The path to check
|
|
5638
|
+
* @param {number} type One or both of the exported numeric constants
|
|
5639
|
+
*/
|
|
5640
|
+
function exists(path, type = exports.READABLE) {
|
|
5641
|
+
return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
|
|
5642
|
+
}
|
|
5643
|
+
exports.exists = exists;
|
|
5644
|
+
/**
|
|
5645
|
+
* Constant representing a file
|
|
5646
|
+
*/
|
|
5647
|
+
exports.FILE = 1;
|
|
5648
|
+
/**
|
|
5649
|
+
* Constant representing a folder
|
|
5650
|
+
*/
|
|
5651
|
+
exports.FOLDER = 2;
|
|
5652
|
+
/**
|
|
5653
|
+
* Constant representing either a file or a folder
|
|
5654
|
+
*/
|
|
5655
|
+
exports.READABLE = exports.FILE + exports.FOLDER;
|
|
5656
|
+
}));
|
|
5657
|
+
|
|
5658
|
+
//#endregion
|
|
5659
|
+
//#region ../../node_modules/.bun/@kwsites+file-exists@1.1.1/node_modules/@kwsites/file-exists/dist/index.js
|
|
5660
|
+
var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5661
|
+
function __export(m) {
|
|
5662
|
+
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
5663
|
+
}
|
|
5664
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5665
|
+
__export(require_src());
|
|
5666
|
+
}));
|
|
5667
|
+
|
|
5668
|
+
//#endregion
|
|
5669
|
+
//#region ../../node_modules/.bun/@kwsites+promise-deferred@1.1.1/node_modules/@kwsites/promise-deferred/dist/index.js
|
|
5670
|
+
var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5671
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5672
|
+
exports.createDeferred = exports.deferred = void 0;
|
|
5673
|
+
/**
|
|
5674
|
+
* Creates a new `DeferredPromise`
|
|
5675
|
+
*
|
|
5676
|
+
* ```typescript
|
|
5677
|
+
import {deferred} from '@kwsites/promise-deferred`;
|
|
5678
|
+
```
|
|
5679
|
+
*/
|
|
5680
|
+
function deferred() {
|
|
5681
|
+
let done;
|
|
5682
|
+
let fail;
|
|
5683
|
+
let status = "pending";
|
|
5684
|
+
return {
|
|
5685
|
+
promise: new Promise((_done, _fail) => {
|
|
5686
|
+
done = _done;
|
|
5687
|
+
fail = _fail;
|
|
5688
|
+
}),
|
|
5689
|
+
done(result) {
|
|
5690
|
+
if (status === "pending") {
|
|
5691
|
+
status = "resolved";
|
|
5692
|
+
done(result);
|
|
5693
|
+
}
|
|
5694
|
+
},
|
|
5695
|
+
fail(error) {
|
|
5696
|
+
if (status === "pending") {
|
|
5697
|
+
status = "rejected";
|
|
5698
|
+
fail(error);
|
|
5699
|
+
}
|
|
5700
|
+
},
|
|
5701
|
+
get fulfilled() {
|
|
5702
|
+
return status !== "pending";
|
|
5703
|
+
},
|
|
5704
|
+
get status() {
|
|
5705
|
+
return status;
|
|
5706
|
+
}
|
|
5707
|
+
};
|
|
5708
|
+
}
|
|
5709
|
+
exports.deferred = deferred;
|
|
5710
|
+
/**
|
|
5711
|
+
* Alias of the exported `deferred` function, to help consumers wanting to use `deferred` as the
|
|
5712
|
+
* local variable name rather than the factory import name, without needing to rename on import.
|
|
5713
|
+
*
|
|
5714
|
+
* ```typescript
|
|
5715
|
+
import {createDeferred} from '@kwsites/promise-deferred`;
|
|
5716
|
+
```
|
|
5717
|
+
*/
|
|
5718
|
+
exports.createDeferred = deferred;
|
|
5719
|
+
}));
|
|
5720
|
+
|
|
5721
|
+
//#endregion
|
|
5722
|
+
//#region ../../node_modules/.bun/simple-git@3.30.0/node_modules/simple-git/dist/esm/index.js
|
|
5723
|
+
var import_dist = require_dist$1();
|
|
5724
|
+
var import_src = /* @__PURE__ */ __toESM(require_src$1(), 1);
|
|
5725
|
+
var import_dist$1 = require_dist();
|
|
5726
|
+
var __defProp = Object.defineProperty;
|
|
5727
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5728
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5729
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5730
|
+
var __esm = (fn, res) => function __init() {
|
|
5731
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5732
|
+
};
|
|
5733
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
5734
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5735
|
+
};
|
|
5736
|
+
var __export = (target, all) => {
|
|
5737
|
+
for (var name in all) __defProp(target, name, {
|
|
5738
|
+
get: all[name],
|
|
5739
|
+
enumerable: true
|
|
5740
|
+
});
|
|
5741
|
+
};
|
|
5742
|
+
var __copyProps = (to, from, except, desc) => {
|
|
5743
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
5744
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
5745
|
+
get: () => from[key],
|
|
5746
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
5747
|
+
});
|
|
5748
|
+
}
|
|
5749
|
+
return to;
|
|
5750
|
+
};
|
|
5751
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
5752
|
+
function pathspec(...paths) {
|
|
5753
|
+
const key = new String(paths);
|
|
5754
|
+
cache.set(key, paths);
|
|
5755
|
+
return key;
|
|
5756
|
+
}
|
|
5757
|
+
function isPathSpec(path) {
|
|
5758
|
+
return path instanceof String && cache.has(path);
|
|
5759
|
+
}
|
|
5760
|
+
function toPaths(pathSpec) {
|
|
5761
|
+
return cache.get(pathSpec) || [];
|
|
5762
|
+
}
|
|
5763
|
+
var cache;
|
|
5764
|
+
var init_pathspec = __esm({ "src/lib/args/pathspec.ts"() {
|
|
5765
|
+
"use strict";
|
|
5766
|
+
cache = /* @__PURE__ */ new WeakMap();
|
|
5767
|
+
} });
|
|
5768
|
+
var GitError;
|
|
5769
|
+
var init_git_error = __esm({ "src/lib/errors/git-error.ts"() {
|
|
5770
|
+
"use strict";
|
|
5771
|
+
GitError = class extends Error {
|
|
5772
|
+
constructor(task, message) {
|
|
5773
|
+
super(message);
|
|
5774
|
+
this.task = task;
|
|
5775
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
5776
|
+
}
|
|
5777
|
+
};
|
|
5778
|
+
} });
|
|
5779
|
+
var GitResponseError;
|
|
5780
|
+
var init_git_response_error = __esm({ "src/lib/errors/git-response-error.ts"() {
|
|
5781
|
+
"use strict";
|
|
5782
|
+
init_git_error();
|
|
5783
|
+
GitResponseError = class extends GitError {
|
|
5784
|
+
constructor(git, message) {
|
|
5785
|
+
super(void 0, message || String(git));
|
|
5786
|
+
this.git = git;
|
|
5787
|
+
}
|
|
5788
|
+
};
|
|
5789
|
+
} });
|
|
5790
|
+
var TaskConfigurationError;
|
|
5791
|
+
var init_task_configuration_error = __esm({ "src/lib/errors/task-configuration-error.ts"() {
|
|
5792
|
+
"use strict";
|
|
5793
|
+
init_git_error();
|
|
5794
|
+
TaskConfigurationError = class extends GitError {
|
|
5795
|
+
constructor(message) {
|
|
5796
|
+
super(void 0, message);
|
|
5797
|
+
}
|
|
5798
|
+
};
|
|
5799
|
+
} });
|
|
5800
|
+
function asFunction(source) {
|
|
5801
|
+
if (typeof source !== "function") return NOOP;
|
|
5802
|
+
return source;
|
|
5803
|
+
}
|
|
5804
|
+
function isUserFunction(source) {
|
|
5805
|
+
return typeof source === "function" && source !== NOOP;
|
|
5806
|
+
}
|
|
5807
|
+
function splitOn(input, char) {
|
|
5808
|
+
const index = input.indexOf(char);
|
|
5809
|
+
if (index <= 0) return [input, ""];
|
|
5810
|
+
return [input.substr(0, index), input.substr(index + 1)];
|
|
5811
|
+
}
|
|
5812
|
+
function first(input, offset = 0) {
|
|
5813
|
+
return isArrayLike(input) && input.length > offset ? input[offset] : void 0;
|
|
5814
|
+
}
|
|
5815
|
+
function last(input, offset = 0) {
|
|
5816
|
+
if (isArrayLike(input) && input.length > offset) return input[input.length - 1 - offset];
|
|
5817
|
+
}
|
|
5818
|
+
function isArrayLike(input) {
|
|
5819
|
+
return filterHasLength(input);
|
|
5820
|
+
}
|
|
5821
|
+
function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
|
|
5822
|
+
return input.split(separator).reduce((output, line) => {
|
|
5823
|
+
const lineContent = trimmed2 ? line.trim() : line;
|
|
5824
|
+
if (lineContent) output.push(lineContent);
|
|
5825
|
+
return output;
|
|
5826
|
+
}, []);
|
|
5827
|
+
}
|
|
5828
|
+
function forEachLineWithContent(input, callback) {
|
|
5829
|
+
return toLinesWithContent(input, true).map((line) => callback(line));
|
|
5830
|
+
}
|
|
5831
|
+
function folderExists(path) {
|
|
5832
|
+
return (0, import_dist.exists)(path, import_dist.FOLDER);
|
|
5833
|
+
}
|
|
5834
|
+
function append(target, item) {
|
|
5835
|
+
if (Array.isArray(target)) {
|
|
5836
|
+
if (!target.includes(item)) target.push(item);
|
|
5837
|
+
} else target.add(item);
|
|
5838
|
+
return item;
|
|
5839
|
+
}
|
|
5840
|
+
function including(target, item) {
|
|
5841
|
+
if (Array.isArray(target) && !target.includes(item)) target.push(item);
|
|
5842
|
+
return target;
|
|
5843
|
+
}
|
|
5844
|
+
function remove(target, item) {
|
|
5845
|
+
if (Array.isArray(target)) {
|
|
5846
|
+
const index = target.indexOf(item);
|
|
5847
|
+
if (index >= 0) target.splice(index, 1);
|
|
5848
|
+
} else target.delete(item);
|
|
5849
|
+
return item;
|
|
5850
|
+
}
|
|
5851
|
+
function asArray(source) {
|
|
5852
|
+
return Array.isArray(source) ? source : [source];
|
|
5853
|
+
}
|
|
5854
|
+
function asCamelCase(str) {
|
|
5855
|
+
return str.replace(/[\s-]+(.)/g, (_all, chr) => {
|
|
5856
|
+
return chr.toUpperCase();
|
|
5857
|
+
});
|
|
5858
|
+
}
|
|
5859
|
+
function asStringArray(source) {
|
|
5860
|
+
return asArray(source).map((item) => {
|
|
5861
|
+
return item instanceof String ? item : String(item);
|
|
5862
|
+
});
|
|
5863
|
+
}
|
|
5864
|
+
function asNumber(source, onNaN = 0) {
|
|
5865
|
+
if (source == null) return onNaN;
|
|
5866
|
+
const num = parseInt(source, 10);
|
|
5867
|
+
return Number.isNaN(num) ? onNaN : num;
|
|
5868
|
+
}
|
|
5869
|
+
function prefixedArray(input, prefix) {
|
|
5870
|
+
const output = [];
|
|
5871
|
+
for (let i = 0, max = input.length; i < max; i++) output.push(prefix, input[i]);
|
|
5872
|
+
return output;
|
|
5873
|
+
}
|
|
5874
|
+
function bufferToString(input) {
|
|
5875
|
+
return (Array.isArray(input) ? Buffer$1.concat(input) : input).toString("utf-8");
|
|
5876
|
+
}
|
|
5877
|
+
function pick(source, properties) {
|
|
5878
|
+
const out = {};
|
|
5879
|
+
properties.forEach((key) => {
|
|
5880
|
+
if (source[key] !== void 0) out[key] = source[key];
|
|
5881
|
+
});
|
|
5882
|
+
return out;
|
|
5883
|
+
}
|
|
5884
|
+
function delay(duration = 0) {
|
|
5885
|
+
return new Promise((done) => setTimeout(done, duration));
|
|
5886
|
+
}
|
|
5887
|
+
function orVoid(input) {
|
|
5888
|
+
if (input === false) return;
|
|
5889
|
+
return input;
|
|
5890
|
+
}
|
|
5891
|
+
var NULL, NOOP, objectToString;
|
|
5892
|
+
var init_util = __esm({ "src/lib/utils/util.ts"() {
|
|
5893
|
+
"use strict";
|
|
5894
|
+
init_argument_filters();
|
|
5895
|
+
NULL = "\0";
|
|
5896
|
+
NOOP = () => {};
|
|
5897
|
+
objectToString = Object.prototype.toString.call.bind(Object.prototype.toString);
|
|
5898
|
+
} });
|
|
5899
|
+
function filterType(input, filter, def) {
|
|
5900
|
+
if (filter(input)) return input;
|
|
5901
|
+
return arguments.length > 2 ? def : void 0;
|
|
5902
|
+
}
|
|
5903
|
+
function filterPrimitives(input, omit) {
|
|
5904
|
+
const type = isPathSpec(input) ? "string" : typeof input;
|
|
5905
|
+
return /number|string|boolean/.test(type) && (!omit || !omit.includes(type));
|
|
5906
|
+
}
|
|
5907
|
+
function filterPlainObject(input) {
|
|
5908
|
+
return !!input && objectToString(input) === "[object Object]";
|
|
5909
|
+
}
|
|
5910
|
+
function filterFunction(input) {
|
|
5911
|
+
return typeof input === "function";
|
|
5912
|
+
}
|
|
5913
|
+
var filterArray, filterNumber, filterString, filterStringOrStringArray, filterHasLength;
|
|
5914
|
+
var init_argument_filters = __esm({ "src/lib/utils/argument-filters.ts"() {
|
|
5915
|
+
"use strict";
|
|
5916
|
+
init_pathspec();
|
|
5917
|
+
init_util();
|
|
5918
|
+
filterArray = (input) => {
|
|
5919
|
+
return Array.isArray(input);
|
|
5920
|
+
};
|
|
5921
|
+
filterNumber = (input) => {
|
|
5922
|
+
return typeof input === "number";
|
|
5923
|
+
};
|
|
5924
|
+
filterString = (input) => {
|
|
5925
|
+
return typeof input === "string";
|
|
5926
|
+
};
|
|
5927
|
+
filterStringOrStringArray = (input) => {
|
|
5928
|
+
return filterString(input) || Array.isArray(input) && input.every(filterString);
|
|
5929
|
+
};
|
|
5930
|
+
filterHasLength = (input) => {
|
|
5931
|
+
if (input == null || "number|boolean|function".includes(typeof input)) return false;
|
|
5932
|
+
return typeof input.length === "number";
|
|
5933
|
+
};
|
|
5934
|
+
} });
|
|
5935
|
+
var ExitCodes;
|
|
5936
|
+
var init_exit_codes = __esm({ "src/lib/utils/exit-codes.ts"() {
|
|
5937
|
+
"use strict";
|
|
5938
|
+
ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {
|
|
5939
|
+
ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS";
|
|
5940
|
+
ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR";
|
|
5941
|
+
ExitCodes2[ExitCodes2["NOT_FOUND"] = -2] = "NOT_FOUND";
|
|
5942
|
+
ExitCodes2[ExitCodes2["UNCLEAN"] = 128] = "UNCLEAN";
|
|
5943
|
+
return ExitCodes2;
|
|
5944
|
+
})(ExitCodes || {});
|
|
5945
|
+
} });
|
|
5946
|
+
var GitOutputStreams;
|
|
5947
|
+
var init_git_output_streams = __esm({ "src/lib/utils/git-output-streams.ts"() {
|
|
5948
|
+
"use strict";
|
|
5949
|
+
GitOutputStreams = class _GitOutputStreams {
|
|
5950
|
+
constructor(stdOut, stdErr) {
|
|
5951
|
+
this.stdOut = stdOut;
|
|
5952
|
+
this.stdErr = stdErr;
|
|
5953
|
+
}
|
|
5954
|
+
asStrings() {
|
|
5955
|
+
return new _GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
|
|
5956
|
+
}
|
|
5957
|
+
};
|
|
5958
|
+
} });
|
|
5959
|
+
function useMatchesDefault() {
|
|
5960
|
+
throw new Error(`LineParser:useMatches not implemented`);
|
|
5961
|
+
}
|
|
5962
|
+
var LineParser, RemoteLineParser;
|
|
5963
|
+
var init_line_parser = __esm({ "src/lib/utils/line-parser.ts"() {
|
|
5964
|
+
"use strict";
|
|
5965
|
+
LineParser = class {
|
|
5966
|
+
constructor(regExp, useMatches) {
|
|
5967
|
+
this.matches = [];
|
|
5968
|
+
this.useMatches = useMatchesDefault;
|
|
5969
|
+
this.parse = (line, target) => {
|
|
5970
|
+
this.resetMatches();
|
|
5971
|
+
if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) return false;
|
|
5972
|
+
return this.useMatches(target, this.prepareMatches()) !== false;
|
|
5973
|
+
};
|
|
5974
|
+
this._regExp = Array.isArray(regExp) ? regExp : [regExp];
|
|
5975
|
+
if (useMatches) this.useMatches = useMatches;
|
|
5976
|
+
}
|
|
5977
|
+
resetMatches() {
|
|
5978
|
+
this.matches.length = 0;
|
|
5979
|
+
}
|
|
5980
|
+
prepareMatches() {
|
|
5981
|
+
return this.matches;
|
|
5982
|
+
}
|
|
5983
|
+
addMatch(reg, index, line) {
|
|
5984
|
+
const matched = line && reg.exec(line);
|
|
5985
|
+
if (matched) this.pushMatch(index, matched);
|
|
5986
|
+
return !!matched;
|
|
5987
|
+
}
|
|
5988
|
+
pushMatch(_index, matched) {
|
|
5989
|
+
this.matches.push(...matched.slice(1));
|
|
5990
|
+
}
|
|
5991
|
+
};
|
|
5992
|
+
RemoteLineParser = class extends LineParser {
|
|
5993
|
+
addMatch(reg, index, line) {
|
|
5994
|
+
return /^remote:\s/.test(String(line)) && super.addMatch(reg, index, line);
|
|
5995
|
+
}
|
|
5996
|
+
pushMatch(index, matched) {
|
|
5997
|
+
if (index > 0 || matched.length > 1) super.pushMatch(index, matched);
|
|
5998
|
+
}
|
|
5999
|
+
};
|
|
6000
|
+
} });
|
|
6001
|
+
function createInstanceConfig(...options) {
|
|
6002
|
+
const baseDir = process.cwd();
|
|
6003
|
+
const config = Object.assign({
|
|
6004
|
+
baseDir,
|
|
6005
|
+
...defaultOptions
|
|
6006
|
+
}, ...options.filter((o) => typeof o === "object" && o));
|
|
6007
|
+
config.baseDir = config.baseDir || baseDir;
|
|
6008
|
+
config.trimmed = config.trimmed === true;
|
|
6009
|
+
return config;
|
|
6010
|
+
}
|
|
6011
|
+
var defaultOptions;
|
|
6012
|
+
var init_simple_git_options = __esm({ "src/lib/utils/simple-git-options.ts"() {
|
|
6013
|
+
"use strict";
|
|
6014
|
+
defaultOptions = {
|
|
6015
|
+
binary: "git",
|
|
6016
|
+
maxConcurrentProcesses: 5,
|
|
6017
|
+
config: [],
|
|
6018
|
+
trimmed: false
|
|
6019
|
+
};
|
|
6020
|
+
} });
|
|
6021
|
+
function appendTaskOptions(options, commands = []) {
|
|
6022
|
+
if (!filterPlainObject(options)) return commands;
|
|
6023
|
+
return Object.keys(options).reduce((commands2, key) => {
|
|
6024
|
+
const value = options[key];
|
|
6025
|
+
if (isPathSpec(value)) commands2.push(value);
|
|
6026
|
+
else if (filterPrimitives(value, ["boolean"])) commands2.push(key + "=" + value);
|
|
6027
|
+
else if (Array.isArray(value)) {
|
|
6028
|
+
for (const v of value) if (!filterPrimitives(v, ["string", "number"])) commands2.push(key + "=" + v);
|
|
6029
|
+
} else commands2.push(key);
|
|
6030
|
+
return commands2;
|
|
6031
|
+
}, commands);
|
|
6032
|
+
}
|
|
6033
|
+
function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
|
|
6034
|
+
const command = [];
|
|
6035
|
+
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]));
|
|
6036
|
+
appendTaskOptions(trailingOptionsArgument(args), command);
|
|
6037
|
+
if (!objectOnly) command.push(...trailingArrayArgument(args));
|
|
6038
|
+
return command;
|
|
6039
|
+
}
|
|
6040
|
+
function trailingArrayArgument(args) {
|
|
6041
|
+
return asStringArray(filterType(last(args, typeof last(args) === "function" ? 1 : 0), filterArray, []));
|
|
6042
|
+
}
|
|
6043
|
+
function trailingOptionsArgument(args) {
|
|
6044
|
+
return filterType(last(args, filterFunction(last(args)) ? 1 : 0), filterPlainObject);
|
|
6045
|
+
}
|
|
6046
|
+
function trailingFunctionArgument(args, includeNoop = true) {
|
|
6047
|
+
const callback = asFunction(last(args));
|
|
6048
|
+
return includeNoop || isUserFunction(callback) ? callback : void 0;
|
|
6049
|
+
}
|
|
6050
|
+
var init_task_options = __esm({ "src/lib/utils/task-options.ts"() {
|
|
6051
|
+
"use strict";
|
|
6052
|
+
init_argument_filters();
|
|
6053
|
+
init_util();
|
|
6054
|
+
init_pathspec();
|
|
6055
|
+
} });
|
|
6056
|
+
function callTaskParser(parser4, streams) {
|
|
6057
|
+
return parser4(streams.stdOut, streams.stdErr);
|
|
6058
|
+
}
|
|
6059
|
+
function parseStringResponse(result, parsers12, texts, trim = true) {
|
|
6060
|
+
asArray(texts).forEach((text) => {
|
|
6061
|
+
for (let lines = toLinesWithContent(text, trim), i = 0, max = lines.length; i < max; i++) {
|
|
6062
|
+
const line = (offset = 0) => {
|
|
6063
|
+
if (i + offset >= max) return;
|
|
6064
|
+
return lines[i + offset];
|
|
6065
|
+
};
|
|
6066
|
+
parsers12.some(({ parse }) => parse(line, result));
|
|
6067
|
+
}
|
|
6068
|
+
});
|
|
6069
|
+
return result;
|
|
6070
|
+
}
|
|
6071
|
+
var init_task_parser = __esm({ "src/lib/utils/task-parser.ts"() {
|
|
6072
|
+
"use strict";
|
|
6073
|
+
init_util();
|
|
6074
|
+
} });
|
|
6075
|
+
var utils_exports = {};
|
|
6076
|
+
__export(utils_exports, {
|
|
6077
|
+
ExitCodes: () => ExitCodes,
|
|
6078
|
+
GitOutputStreams: () => GitOutputStreams,
|
|
6079
|
+
LineParser: () => LineParser,
|
|
6080
|
+
NOOP: () => NOOP,
|
|
6081
|
+
NULL: () => NULL,
|
|
6082
|
+
RemoteLineParser: () => RemoteLineParser,
|
|
6083
|
+
append: () => append,
|
|
6084
|
+
appendTaskOptions: () => appendTaskOptions,
|
|
6085
|
+
asArray: () => asArray,
|
|
6086
|
+
asCamelCase: () => asCamelCase,
|
|
6087
|
+
asFunction: () => asFunction,
|
|
6088
|
+
asNumber: () => asNumber,
|
|
6089
|
+
asStringArray: () => asStringArray,
|
|
6090
|
+
bufferToString: () => bufferToString,
|
|
6091
|
+
callTaskParser: () => callTaskParser,
|
|
6092
|
+
createInstanceConfig: () => createInstanceConfig,
|
|
6093
|
+
delay: () => delay,
|
|
6094
|
+
filterArray: () => filterArray,
|
|
6095
|
+
filterFunction: () => filterFunction,
|
|
6096
|
+
filterHasLength: () => filterHasLength,
|
|
6097
|
+
filterNumber: () => filterNumber,
|
|
6098
|
+
filterPlainObject: () => filterPlainObject,
|
|
6099
|
+
filterPrimitives: () => filterPrimitives,
|
|
6100
|
+
filterString: () => filterString,
|
|
6101
|
+
filterStringOrStringArray: () => filterStringOrStringArray,
|
|
6102
|
+
filterType: () => filterType,
|
|
6103
|
+
first: () => first,
|
|
6104
|
+
folderExists: () => folderExists,
|
|
6105
|
+
forEachLineWithContent: () => forEachLineWithContent,
|
|
6106
|
+
getTrailingOptions: () => getTrailingOptions,
|
|
6107
|
+
including: () => including,
|
|
6108
|
+
isUserFunction: () => isUserFunction,
|
|
6109
|
+
last: () => last,
|
|
6110
|
+
objectToString: () => objectToString,
|
|
6111
|
+
orVoid: () => orVoid,
|
|
6112
|
+
parseStringResponse: () => parseStringResponse,
|
|
6113
|
+
pick: () => pick,
|
|
6114
|
+
prefixedArray: () => prefixedArray,
|
|
6115
|
+
remove: () => remove,
|
|
6116
|
+
splitOn: () => splitOn,
|
|
6117
|
+
toLinesWithContent: () => toLinesWithContent,
|
|
6118
|
+
trailingFunctionArgument: () => trailingFunctionArgument,
|
|
6119
|
+
trailingOptionsArgument: () => trailingOptionsArgument
|
|
6120
|
+
});
|
|
6121
|
+
var init_utils = __esm({ "src/lib/utils/index.ts"() {
|
|
6122
|
+
"use strict";
|
|
6123
|
+
init_argument_filters();
|
|
6124
|
+
init_exit_codes();
|
|
6125
|
+
init_git_output_streams();
|
|
6126
|
+
init_line_parser();
|
|
6127
|
+
init_simple_git_options();
|
|
6128
|
+
init_task_options();
|
|
6129
|
+
init_task_parser();
|
|
6130
|
+
init_util();
|
|
6131
|
+
} });
|
|
6132
|
+
var check_is_repo_exports = {};
|
|
6133
|
+
__export(check_is_repo_exports, {
|
|
6134
|
+
CheckRepoActions: () => CheckRepoActions,
|
|
6135
|
+
checkIsBareRepoTask: () => checkIsBareRepoTask,
|
|
6136
|
+
checkIsRepoRootTask: () => checkIsRepoRootTask,
|
|
6137
|
+
checkIsRepoTask: () => checkIsRepoTask
|
|
6138
|
+
});
|
|
6139
|
+
function checkIsRepoTask(action) {
|
|
6140
|
+
switch (action) {
|
|
6141
|
+
case "bare": return checkIsBareRepoTask();
|
|
6142
|
+
case "root": return checkIsRepoRootTask();
|
|
6143
|
+
}
|
|
6144
|
+
return {
|
|
6145
|
+
commands: ["rev-parse", "--is-inside-work-tree"],
|
|
6146
|
+
format: "utf-8",
|
|
6147
|
+
onError,
|
|
6148
|
+
parser
|
|
6149
|
+
};
|
|
6150
|
+
}
|
|
6151
|
+
function checkIsRepoRootTask() {
|
|
6152
|
+
return {
|
|
6153
|
+
commands: ["rev-parse", "--git-dir"],
|
|
6154
|
+
format: "utf-8",
|
|
6155
|
+
onError,
|
|
6156
|
+
parser(path) {
|
|
6157
|
+
return /^\.(git)?$/.test(path.trim());
|
|
6158
|
+
}
|
|
6159
|
+
};
|
|
6160
|
+
}
|
|
6161
|
+
function checkIsBareRepoTask() {
|
|
6162
|
+
return {
|
|
6163
|
+
commands: ["rev-parse", "--is-bare-repository"],
|
|
6164
|
+
format: "utf-8",
|
|
6165
|
+
onError,
|
|
6166
|
+
parser
|
|
6167
|
+
};
|
|
6168
|
+
}
|
|
6169
|
+
function isNotRepoMessage(error) {
|
|
6170
|
+
return /(Not a git repository|Kein Git-Repository)/i.test(String(error));
|
|
6171
|
+
}
|
|
6172
|
+
var CheckRepoActions, onError, parser;
|
|
6173
|
+
var init_check_is_repo = __esm({ "src/lib/tasks/check-is-repo.ts"() {
|
|
6174
|
+
"use strict";
|
|
6175
|
+
init_utils();
|
|
6176
|
+
CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {
|
|
6177
|
+
CheckRepoActions2["BARE"] = "bare";
|
|
6178
|
+
CheckRepoActions2["IN_TREE"] = "tree";
|
|
6179
|
+
CheckRepoActions2["IS_REPO_ROOT"] = "root";
|
|
6180
|
+
return CheckRepoActions2;
|
|
6181
|
+
})(CheckRepoActions || {});
|
|
6182
|
+
onError = ({ exitCode }, error, done, fail) => {
|
|
6183
|
+
if (exitCode === 128 && isNotRepoMessage(error)) return done(Buffer.from("false"));
|
|
6184
|
+
fail(error);
|
|
6185
|
+
};
|
|
6186
|
+
parser = (text) => {
|
|
6187
|
+
return text.trim() === "true";
|
|
6188
|
+
};
|
|
6189
|
+
} });
|
|
6190
|
+
function cleanSummaryParser(dryRun, text) {
|
|
6191
|
+
const summary = new CleanResponse(dryRun);
|
|
6192
|
+
const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
|
|
6193
|
+
toLinesWithContent(text).forEach((line) => {
|
|
6194
|
+
const removed = line.replace(regexp, "");
|
|
6195
|
+
summary.paths.push(removed);
|
|
6196
|
+
(isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
|
|
6197
|
+
});
|
|
6198
|
+
return summary;
|
|
6199
|
+
}
|
|
6200
|
+
var CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp;
|
|
6201
|
+
var init_CleanSummary = __esm({ "src/lib/responses/CleanSummary.ts"() {
|
|
6202
|
+
"use strict";
|
|
6203
|
+
init_utils();
|
|
6204
|
+
CleanResponse = class {
|
|
6205
|
+
constructor(dryRun) {
|
|
6206
|
+
this.dryRun = dryRun;
|
|
6207
|
+
this.paths = [];
|
|
6208
|
+
this.files = [];
|
|
6209
|
+
this.folders = [];
|
|
6210
|
+
}
|
|
6211
|
+
};
|
|
6212
|
+
removalRegexp = /^[a-z]+\s*/i;
|
|
6213
|
+
dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i;
|
|
6214
|
+
isFolderRegexp = /\/$/;
|
|
6215
|
+
} });
|
|
6216
|
+
var task_exports = {};
|
|
6217
|
+
__export(task_exports, {
|
|
6218
|
+
EMPTY_COMMANDS: () => EMPTY_COMMANDS,
|
|
6219
|
+
adhocExecTask: () => adhocExecTask,
|
|
6220
|
+
configurationErrorTask: () => configurationErrorTask,
|
|
6221
|
+
isBufferTask: () => isBufferTask,
|
|
6222
|
+
isEmptyTask: () => isEmptyTask,
|
|
6223
|
+
straightThroughBufferTask: () => straightThroughBufferTask,
|
|
6224
|
+
straightThroughStringTask: () => straightThroughStringTask
|
|
6225
|
+
});
|
|
6226
|
+
function adhocExecTask(parser4) {
|
|
6227
|
+
return {
|
|
6228
|
+
commands: EMPTY_COMMANDS,
|
|
6229
|
+
format: "empty",
|
|
6230
|
+
parser: parser4
|
|
6231
|
+
};
|
|
6232
|
+
}
|
|
6233
|
+
function configurationErrorTask(error) {
|
|
6234
|
+
return {
|
|
6235
|
+
commands: EMPTY_COMMANDS,
|
|
6236
|
+
format: "empty",
|
|
6237
|
+
parser() {
|
|
6238
|
+
throw typeof error === "string" ? new TaskConfigurationError(error) : error;
|
|
6239
|
+
}
|
|
6240
|
+
};
|
|
6241
|
+
}
|
|
6242
|
+
function straightThroughStringTask(commands, trimmed2 = false) {
|
|
6243
|
+
return {
|
|
6244
|
+
commands,
|
|
6245
|
+
format: "utf-8",
|
|
6246
|
+
parser(text) {
|
|
6247
|
+
return trimmed2 ? String(text).trim() : text;
|
|
6248
|
+
}
|
|
6249
|
+
};
|
|
6250
|
+
}
|
|
6251
|
+
function straightThroughBufferTask(commands) {
|
|
6252
|
+
return {
|
|
6253
|
+
commands,
|
|
6254
|
+
format: "buffer",
|
|
6255
|
+
parser(buffer) {
|
|
6256
|
+
return buffer;
|
|
6257
|
+
}
|
|
6258
|
+
};
|
|
6259
|
+
}
|
|
6260
|
+
function isBufferTask(task) {
|
|
6261
|
+
return task.format === "buffer";
|
|
6262
|
+
}
|
|
6263
|
+
function isEmptyTask(task) {
|
|
6264
|
+
return task.format === "empty" || !task.commands.length;
|
|
6265
|
+
}
|
|
6266
|
+
var EMPTY_COMMANDS;
|
|
6267
|
+
var init_task = __esm({ "src/lib/tasks/task.ts"() {
|
|
6268
|
+
"use strict";
|
|
6269
|
+
init_task_configuration_error();
|
|
6270
|
+
EMPTY_COMMANDS = [];
|
|
6271
|
+
} });
|
|
6272
|
+
var clean_exports = {};
|
|
6273
|
+
__export(clean_exports, {
|
|
6274
|
+
CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE,
|
|
6275
|
+
CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED,
|
|
6276
|
+
CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION,
|
|
6277
|
+
CleanOptions: () => CleanOptions,
|
|
6278
|
+
cleanTask: () => cleanTask,
|
|
6279
|
+
cleanWithOptionsTask: () => cleanWithOptionsTask,
|
|
6280
|
+
isCleanOptionsArray: () => isCleanOptionsArray
|
|
6281
|
+
});
|
|
6282
|
+
function cleanWithOptionsTask(mode, customArgs) {
|
|
6283
|
+
const { cleanMode, options, valid } = getCleanOptions(mode);
|
|
6284
|
+
if (!cleanMode) return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);
|
|
6285
|
+
if (!valid.options) return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));
|
|
6286
|
+
options.push(...customArgs);
|
|
6287
|
+
if (options.some(isInteractiveMode)) return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);
|
|
6288
|
+
return cleanTask(cleanMode, options);
|
|
6289
|
+
}
|
|
6290
|
+
function cleanTask(mode, customArgs) {
|
|
6291
|
+
return {
|
|
6292
|
+
commands: [
|
|
6293
|
+
"clean",
|
|
6294
|
+
`-${mode}`,
|
|
6295
|
+
...customArgs
|
|
6296
|
+
],
|
|
6297
|
+
format: "utf-8",
|
|
6298
|
+
parser(text) {
|
|
6299
|
+
return cleanSummaryParser(mode === "n", text);
|
|
6300
|
+
}
|
|
6301
|
+
};
|
|
6302
|
+
}
|
|
6303
|
+
function isCleanOptionsArray(input) {
|
|
6304
|
+
return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));
|
|
6305
|
+
}
|
|
6306
|
+
function getCleanOptions(input) {
|
|
6307
|
+
let cleanMode;
|
|
6308
|
+
let options = [];
|
|
6309
|
+
let valid = {
|
|
6310
|
+
cleanMode: false,
|
|
6311
|
+
options: true
|
|
6312
|
+
};
|
|
6313
|
+
input.replace(/[^a-z]i/g, "").split("").forEach((char) => {
|
|
6314
|
+
if (isCleanMode(char)) {
|
|
6315
|
+
cleanMode = char;
|
|
6316
|
+
valid.cleanMode = true;
|
|
6317
|
+
} else valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`);
|
|
6318
|
+
});
|
|
6319
|
+
return {
|
|
6320
|
+
cleanMode,
|
|
6321
|
+
options,
|
|
6322
|
+
valid
|
|
6323
|
+
};
|
|
6324
|
+
}
|
|
6325
|
+
function isCleanMode(cleanMode) {
|
|
6326
|
+
return cleanMode === "f" || cleanMode === "n";
|
|
6327
|
+
}
|
|
6328
|
+
function isKnownOption(option) {
|
|
6329
|
+
return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));
|
|
6330
|
+
}
|
|
6331
|
+
function isInteractiveMode(option) {
|
|
6332
|
+
if (/^-[^\-]/.test(option)) return option.indexOf("i") > 0;
|
|
6333
|
+
return option === "--interactive";
|
|
6334
|
+
}
|
|
6335
|
+
var CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues;
|
|
6336
|
+
var init_clean = __esm({ "src/lib/tasks/clean.ts"() {
|
|
6337
|
+
"use strict";
|
|
6338
|
+
init_CleanSummary();
|
|
6339
|
+
init_utils();
|
|
6340
|
+
init_task();
|
|
6341
|
+
CONFIG_ERROR_INTERACTIVE_MODE = "Git clean interactive mode is not supported";
|
|
6342
|
+
CONFIG_ERROR_MODE_REQUIRED = "Git clean mode parameter (\"n\" or \"f\") is required";
|
|
6343
|
+
CONFIG_ERROR_UNKNOWN_OPTION = "Git clean unknown option found in: ";
|
|
6344
|
+
CleanOptions = /* @__PURE__ */ ((CleanOptions2) => {
|
|
6345
|
+
CleanOptions2["DRY_RUN"] = "n";
|
|
6346
|
+
CleanOptions2["FORCE"] = "f";
|
|
6347
|
+
CleanOptions2["IGNORED_INCLUDED"] = "x";
|
|
6348
|
+
CleanOptions2["IGNORED_ONLY"] = "X";
|
|
6349
|
+
CleanOptions2["EXCLUDING"] = "e";
|
|
6350
|
+
CleanOptions2["QUIET"] = "q";
|
|
6351
|
+
CleanOptions2["RECURSIVE"] = "d";
|
|
6352
|
+
return CleanOptions2;
|
|
6353
|
+
})(CleanOptions || {});
|
|
6354
|
+
CleanOptionValues = /* @__PURE__ */ new Set(["i", ...asStringArray(Object.values(CleanOptions))]);
|
|
6355
|
+
} });
|
|
6356
|
+
function configListParser(text) {
|
|
6357
|
+
const config = new ConfigList();
|
|
6358
|
+
for (const item of configParser(text)) config.addValue(item.file, String(item.key), item.value);
|
|
6359
|
+
return config;
|
|
6360
|
+
}
|
|
6361
|
+
function configGetParser(text, key) {
|
|
6362
|
+
let value = null;
|
|
6363
|
+
const values = [];
|
|
6364
|
+
const scopes = /* @__PURE__ */ new Map();
|
|
6365
|
+
for (const item of configParser(text, key)) {
|
|
6366
|
+
if (item.key !== key) continue;
|
|
6367
|
+
values.push(value = item.value);
|
|
6368
|
+
if (!scopes.has(item.file)) scopes.set(item.file, []);
|
|
6369
|
+
scopes.get(item.file).push(value);
|
|
6370
|
+
}
|
|
6371
|
+
return {
|
|
6372
|
+
key,
|
|
6373
|
+
paths: Array.from(scopes.keys()),
|
|
6374
|
+
scopes,
|
|
6375
|
+
value,
|
|
6376
|
+
values
|
|
6377
|
+
};
|
|
6378
|
+
}
|
|
6379
|
+
function configFilePath(filePath) {
|
|
6380
|
+
return filePath.replace(/^(file):/, "");
|
|
6381
|
+
}
|
|
6382
|
+
function* configParser(text, requestedKey = null) {
|
|
6383
|
+
const lines = text.split("\0");
|
|
6384
|
+
for (let i = 0, max = lines.length - 1; i < max;) {
|
|
6385
|
+
const file = configFilePath(lines[i++]);
|
|
6386
|
+
let value = lines[i++];
|
|
6387
|
+
let key = requestedKey;
|
|
6388
|
+
if (value.includes("\n")) {
|
|
6389
|
+
const line = splitOn(value, "\n");
|
|
6390
|
+
key = line[0];
|
|
6391
|
+
value = line[1];
|
|
6392
|
+
}
|
|
6393
|
+
yield {
|
|
6394
|
+
file,
|
|
6395
|
+
key,
|
|
6396
|
+
value
|
|
6397
|
+
};
|
|
6398
|
+
}
|
|
6399
|
+
}
|
|
6400
|
+
var ConfigList;
|
|
6401
|
+
var init_ConfigList = __esm({ "src/lib/responses/ConfigList.ts"() {
|
|
6402
|
+
"use strict";
|
|
6403
|
+
init_utils();
|
|
6404
|
+
ConfigList = class {
|
|
6405
|
+
constructor() {
|
|
6406
|
+
this.files = [];
|
|
6407
|
+
this.values = /* @__PURE__ */ Object.create(null);
|
|
6408
|
+
}
|
|
6409
|
+
get all() {
|
|
6410
|
+
if (!this._all) this._all = this.files.reduce((all, file) => {
|
|
6411
|
+
return Object.assign(all, this.values[file]);
|
|
6412
|
+
}, {});
|
|
6413
|
+
return this._all;
|
|
6414
|
+
}
|
|
6415
|
+
addFile(file) {
|
|
6416
|
+
if (!(file in this.values)) {
|
|
6417
|
+
const latest = last(this.files);
|
|
6418
|
+
this.values[file] = latest ? Object.create(this.values[latest]) : {};
|
|
6419
|
+
this.files.push(file);
|
|
6420
|
+
}
|
|
6421
|
+
return this.values[file];
|
|
6422
|
+
}
|
|
6423
|
+
addValue(file, key, value) {
|
|
6424
|
+
const values = this.addFile(file);
|
|
6425
|
+
if (!Object.hasOwn(values, key)) values[key] = value;
|
|
6426
|
+
else if (Array.isArray(values[key])) values[key].push(value);
|
|
6427
|
+
else values[key] = [values[key], value];
|
|
6428
|
+
this._all = void 0;
|
|
6429
|
+
}
|
|
6430
|
+
};
|
|
6431
|
+
} });
|
|
6432
|
+
function asConfigScope(scope, fallback) {
|
|
6433
|
+
if (typeof scope === "string" && Object.hasOwn(GitConfigScope, scope)) return scope;
|
|
6434
|
+
return fallback;
|
|
6435
|
+
}
|
|
6436
|
+
function addConfigTask(key, value, append2, scope) {
|
|
6437
|
+
const commands = ["config", `--${scope}`];
|
|
6438
|
+
if (append2) commands.push("--add");
|
|
6439
|
+
commands.push(key, value);
|
|
6440
|
+
return {
|
|
6441
|
+
commands,
|
|
6442
|
+
format: "utf-8",
|
|
6443
|
+
parser(text) {
|
|
6444
|
+
return text;
|
|
6445
|
+
}
|
|
6446
|
+
};
|
|
6447
|
+
}
|
|
6448
|
+
function getConfigTask(key, scope) {
|
|
6449
|
+
const commands = [
|
|
6450
|
+
"config",
|
|
6451
|
+
"--null",
|
|
6452
|
+
"--show-origin",
|
|
6453
|
+
"--get-all",
|
|
6454
|
+
key
|
|
6455
|
+
];
|
|
6456
|
+
if (scope) commands.splice(1, 0, `--${scope}`);
|
|
6457
|
+
return {
|
|
6458
|
+
commands,
|
|
6459
|
+
format: "utf-8",
|
|
6460
|
+
parser(text) {
|
|
6461
|
+
return configGetParser(text, key);
|
|
6462
|
+
}
|
|
6463
|
+
};
|
|
6464
|
+
}
|
|
6465
|
+
function listConfigTask(scope) {
|
|
6466
|
+
const commands = [
|
|
6467
|
+
"config",
|
|
6468
|
+
"--list",
|
|
6469
|
+
"--show-origin",
|
|
6470
|
+
"--null"
|
|
6471
|
+
];
|
|
6472
|
+
if (scope) commands.push(`--${scope}`);
|
|
6473
|
+
return {
|
|
6474
|
+
commands,
|
|
6475
|
+
format: "utf-8",
|
|
6476
|
+
parser(text) {
|
|
6477
|
+
return configListParser(text);
|
|
6478
|
+
}
|
|
6479
|
+
};
|
|
6480
|
+
}
|
|
6481
|
+
function config_default() {
|
|
6482
|
+
return {
|
|
6483
|
+
addConfig(key, value, ...rest) {
|
|
6484
|
+
return this._runTask(addConfigTask(key, value, rest[0] === true, asConfigScope(rest[1], "local")), trailingFunctionArgument(arguments));
|
|
6485
|
+
},
|
|
6486
|
+
getConfig(key, scope) {
|
|
6487
|
+
return this._runTask(getConfigTask(key, asConfigScope(scope, void 0)), trailingFunctionArgument(arguments));
|
|
6488
|
+
},
|
|
6489
|
+
listConfig(...rest) {
|
|
6490
|
+
return this._runTask(listConfigTask(asConfigScope(rest[0], void 0)), trailingFunctionArgument(arguments));
|
|
6491
|
+
}
|
|
6492
|
+
};
|
|
6493
|
+
}
|
|
6494
|
+
var GitConfigScope;
|
|
6495
|
+
var init_config = __esm({ "src/lib/tasks/config.ts"() {
|
|
6496
|
+
"use strict";
|
|
6497
|
+
init_ConfigList();
|
|
6498
|
+
init_utils();
|
|
6499
|
+
GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {
|
|
6500
|
+
GitConfigScope2["system"] = "system";
|
|
6501
|
+
GitConfigScope2["global"] = "global";
|
|
6502
|
+
GitConfigScope2["local"] = "local";
|
|
6503
|
+
GitConfigScope2["worktree"] = "worktree";
|
|
6504
|
+
return GitConfigScope2;
|
|
6505
|
+
})(GitConfigScope || {});
|
|
6506
|
+
} });
|
|
6507
|
+
function isDiffNameStatus(input) {
|
|
6508
|
+
return diffNameStatus.has(input);
|
|
6509
|
+
}
|
|
6510
|
+
var DiffNameStatus, diffNameStatus;
|
|
6511
|
+
var init_diff_name_status = __esm({ "src/lib/tasks/diff-name-status.ts"() {
|
|
6512
|
+
"use strict";
|
|
6513
|
+
DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {
|
|
6514
|
+
DiffNameStatus2["ADDED"] = "A";
|
|
6515
|
+
DiffNameStatus2["COPIED"] = "C";
|
|
6516
|
+
DiffNameStatus2["DELETED"] = "D";
|
|
6517
|
+
DiffNameStatus2["MODIFIED"] = "M";
|
|
6518
|
+
DiffNameStatus2["RENAMED"] = "R";
|
|
6519
|
+
DiffNameStatus2["CHANGED"] = "T";
|
|
6520
|
+
DiffNameStatus2["UNMERGED"] = "U";
|
|
6521
|
+
DiffNameStatus2["UNKNOWN"] = "X";
|
|
6522
|
+
DiffNameStatus2["BROKEN"] = "B";
|
|
6523
|
+
return DiffNameStatus2;
|
|
6524
|
+
})(DiffNameStatus || {});
|
|
6525
|
+
diffNameStatus = new Set(Object.values(DiffNameStatus));
|
|
6526
|
+
} });
|
|
6527
|
+
function grepQueryBuilder(...params) {
|
|
6528
|
+
return new GrepQuery().param(...params);
|
|
6529
|
+
}
|
|
6530
|
+
function parseGrep(grep) {
|
|
6531
|
+
const paths = /* @__PURE__ */ new Set();
|
|
6532
|
+
const results = {};
|
|
6533
|
+
forEachLineWithContent(grep, (input) => {
|
|
6534
|
+
const [path, line, preview] = input.split(NULL);
|
|
6535
|
+
paths.add(path);
|
|
6536
|
+
(results[path] = results[path] || []).push({
|
|
6537
|
+
line: asNumber(line),
|
|
6538
|
+
path,
|
|
6539
|
+
preview
|
|
6540
|
+
});
|
|
6541
|
+
});
|
|
6542
|
+
return {
|
|
6543
|
+
paths,
|
|
6544
|
+
results
|
|
6545
|
+
};
|
|
6546
|
+
}
|
|
6547
|
+
function grep_default() {
|
|
6548
|
+
return { grep(searchTerm) {
|
|
6549
|
+
const then = trailingFunctionArgument(arguments);
|
|
6550
|
+
const options = getTrailingOptions(arguments);
|
|
6551
|
+
for (const option of disallowedOptions) if (options.includes(option)) return this._runTask(configurationErrorTask(`git.grep: use of "${option}" is not supported.`), then);
|
|
6552
|
+
if (typeof searchTerm === "string") searchTerm = grepQueryBuilder().param(searchTerm);
|
|
6553
|
+
const commands = [
|
|
6554
|
+
"grep",
|
|
6555
|
+
"--null",
|
|
6556
|
+
"-n",
|
|
6557
|
+
"--full-name",
|
|
6558
|
+
...options,
|
|
6559
|
+
...searchTerm
|
|
6560
|
+
];
|
|
6561
|
+
return this._runTask({
|
|
6562
|
+
commands,
|
|
6563
|
+
format: "utf-8",
|
|
6564
|
+
parser(stdOut) {
|
|
6565
|
+
return parseGrep(stdOut);
|
|
6566
|
+
}
|
|
6567
|
+
}, then);
|
|
6568
|
+
} };
|
|
6569
|
+
}
|
|
6570
|
+
var disallowedOptions, Query, _a, GrepQuery;
|
|
6571
|
+
var init_grep = __esm({ "src/lib/tasks/grep.ts"() {
|
|
6572
|
+
"use strict";
|
|
6573
|
+
init_utils();
|
|
6574
|
+
init_task();
|
|
6575
|
+
disallowedOptions = ["-h"];
|
|
6576
|
+
Query = Symbol("grepQuery");
|
|
6577
|
+
GrepQuery = class {
|
|
6578
|
+
constructor() {
|
|
6579
|
+
this[_a] = [];
|
|
6580
|
+
}
|
|
6581
|
+
*[(_a = Query, Symbol.iterator)]() {
|
|
6582
|
+
for (const query of this[Query]) yield query;
|
|
6583
|
+
}
|
|
6584
|
+
and(...and) {
|
|
6585
|
+
and.length && this[Query].push("--and", "(", ...prefixedArray(and, "-e"), ")");
|
|
6586
|
+
return this;
|
|
6587
|
+
}
|
|
6588
|
+
param(...param) {
|
|
6589
|
+
this[Query].push(...prefixedArray(param, "-e"));
|
|
6590
|
+
return this;
|
|
6591
|
+
}
|
|
6592
|
+
};
|
|
6593
|
+
} });
|
|
6594
|
+
var reset_exports = {};
|
|
6595
|
+
__export(reset_exports, {
|
|
6596
|
+
ResetMode: () => ResetMode,
|
|
6597
|
+
getResetMode: () => getResetMode,
|
|
6598
|
+
resetTask: () => resetTask
|
|
6599
|
+
});
|
|
6600
|
+
function resetTask(mode, customArgs) {
|
|
6601
|
+
const commands = ["reset"];
|
|
6602
|
+
if (isValidResetMode(mode)) commands.push(`--${mode}`);
|
|
6603
|
+
commands.push(...customArgs);
|
|
6604
|
+
return straightThroughStringTask(commands);
|
|
6605
|
+
}
|
|
6606
|
+
function getResetMode(mode) {
|
|
6607
|
+
if (isValidResetMode(mode)) return mode;
|
|
6608
|
+
switch (typeof mode) {
|
|
6609
|
+
case "string":
|
|
6610
|
+
case "undefined": return "soft";
|
|
6611
|
+
}
|
|
6612
|
+
}
|
|
6613
|
+
function isValidResetMode(mode) {
|
|
6614
|
+
return typeof mode === "string" && validResetModes.includes(mode);
|
|
6615
|
+
}
|
|
6616
|
+
var ResetMode, validResetModes;
|
|
6617
|
+
var init_reset = __esm({ "src/lib/tasks/reset.ts"() {
|
|
6618
|
+
"use strict";
|
|
6619
|
+
init_utils();
|
|
6620
|
+
init_task();
|
|
6621
|
+
ResetMode = /* @__PURE__ */ ((ResetMode2) => {
|
|
6622
|
+
ResetMode2["MIXED"] = "mixed";
|
|
6623
|
+
ResetMode2["SOFT"] = "soft";
|
|
6624
|
+
ResetMode2["HARD"] = "hard";
|
|
6625
|
+
ResetMode2["MERGE"] = "merge";
|
|
6626
|
+
ResetMode2["KEEP"] = "keep";
|
|
6627
|
+
return ResetMode2;
|
|
6628
|
+
})(ResetMode || {});
|
|
6629
|
+
validResetModes = asStringArray(Object.values(ResetMode));
|
|
6630
|
+
} });
|
|
6631
|
+
function createLog() {
|
|
6632
|
+
return (0, import_src.default)("simple-git");
|
|
6633
|
+
}
|
|
6634
|
+
function prefixedLogger(to, prefix, forward) {
|
|
6635
|
+
if (!prefix || !String(prefix).replace(/\s*/, "")) return !forward ? to : (message, ...args) => {
|
|
6636
|
+
to(message, ...args);
|
|
6637
|
+
forward(message, ...args);
|
|
6638
|
+
};
|
|
6639
|
+
return (message, ...args) => {
|
|
6640
|
+
to(`%s ${message}`, prefix, ...args);
|
|
6641
|
+
if (forward) forward(message, ...args);
|
|
6642
|
+
};
|
|
6643
|
+
}
|
|
6644
|
+
function childLoggerName(name, childDebugger, { namespace: parentNamespace }) {
|
|
6645
|
+
if (typeof name === "string") return name;
|
|
6646
|
+
const childNamespace = childDebugger && childDebugger.namespace || "";
|
|
6647
|
+
if (childNamespace.startsWith(parentNamespace)) return childNamespace.substr(parentNamespace.length + 1);
|
|
6648
|
+
return childNamespace || parentNamespace;
|
|
6649
|
+
}
|
|
6650
|
+
function createLogger(label, verbose, initialStep, infoDebugger = createLog()) {
|
|
6651
|
+
const labelPrefix = label && `[${label}]` || "";
|
|
6652
|
+
const spawned = [];
|
|
6653
|
+
const debugDebugger = typeof verbose === "string" ? infoDebugger.extend(verbose) : verbose;
|
|
6654
|
+
const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);
|
|
6655
|
+
return step(initialStep);
|
|
6656
|
+
function sibling(name, initial) {
|
|
6657
|
+
return append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger));
|
|
6658
|
+
}
|
|
6659
|
+
function step(phase) {
|
|
6660
|
+
const stepPrefix = phase && `[${phase}]` || "";
|
|
6661
|
+
const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP;
|
|
6662
|
+
const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2);
|
|
6663
|
+
return Object.assign(debugDebugger ? debug2 : info, {
|
|
6664
|
+
label,
|
|
6665
|
+
sibling,
|
|
6666
|
+
info,
|
|
6667
|
+
step
|
|
6668
|
+
});
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
var init_git_logger = __esm({ "src/lib/git-logger.ts"() {
|
|
6672
|
+
"use strict";
|
|
6673
|
+
init_utils();
|
|
6674
|
+
import_src.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
|
|
6675
|
+
import_src.default.formatters.B = (value) => {
|
|
6676
|
+
if (Buffer.isBuffer(value)) return value.toString("utf8");
|
|
6677
|
+
return objectToString(value);
|
|
6678
|
+
};
|
|
6679
|
+
} });
|
|
6680
|
+
var TasksPendingQueue;
|
|
6681
|
+
var init_tasks_pending_queue = __esm({ "src/lib/runners/tasks-pending-queue.ts"() {
|
|
6682
|
+
"use strict";
|
|
6683
|
+
init_git_error();
|
|
6684
|
+
init_git_logger();
|
|
6685
|
+
TasksPendingQueue = class _TasksPendingQueue {
|
|
6686
|
+
constructor(logLabel = "GitExecutor") {
|
|
6687
|
+
this.logLabel = logLabel;
|
|
6688
|
+
this._queue = /* @__PURE__ */ new Map();
|
|
6689
|
+
}
|
|
6690
|
+
withProgress(task) {
|
|
6691
|
+
return this._queue.get(task);
|
|
6692
|
+
}
|
|
6693
|
+
createProgress(task) {
|
|
6694
|
+
const name = _TasksPendingQueue.getName(task.commands[0]);
|
|
6695
|
+
return {
|
|
6696
|
+
task,
|
|
6697
|
+
logger: createLogger(this.logLabel, name),
|
|
6698
|
+
name
|
|
6699
|
+
};
|
|
6700
|
+
}
|
|
6701
|
+
push(task) {
|
|
6702
|
+
const progress = this.createProgress(task);
|
|
6703
|
+
progress.logger("Adding task to the queue, commands = %o", task.commands);
|
|
6704
|
+
this._queue.set(task, progress);
|
|
6705
|
+
return progress;
|
|
6706
|
+
}
|
|
6707
|
+
fatal(err) {
|
|
6708
|
+
for (const [task, { logger }] of Array.from(this._queue.entries())) {
|
|
6709
|
+
if (task === err.task) {
|
|
6710
|
+
logger.info(`Failed %o`, err);
|
|
6711
|
+
logger(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`);
|
|
6712
|
+
} else logger.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`, err.message);
|
|
6713
|
+
this.complete(task);
|
|
6714
|
+
}
|
|
6715
|
+
if (this._queue.size !== 0) throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);
|
|
6716
|
+
}
|
|
6717
|
+
complete(task) {
|
|
6718
|
+
if (this.withProgress(task)) this._queue.delete(task);
|
|
6719
|
+
}
|
|
6720
|
+
attempt(task) {
|
|
6721
|
+
const progress = this.withProgress(task);
|
|
6722
|
+
if (!progress) throw new GitError(void 0, "TasksPendingQueue: attempt called for an unknown task");
|
|
6723
|
+
progress.logger("Starting task");
|
|
6724
|
+
return progress;
|
|
6725
|
+
}
|
|
6726
|
+
static getName(name = "empty") {
|
|
6727
|
+
return `task:${name}:${++_TasksPendingQueue.counter}`;
|
|
6728
|
+
}
|
|
6729
|
+
static {
|
|
6730
|
+
this.counter = 0;
|
|
6731
|
+
}
|
|
6732
|
+
};
|
|
6733
|
+
} });
|
|
6734
|
+
function pluginContext(task, commands) {
|
|
6735
|
+
return {
|
|
6736
|
+
method: first(task.commands) || "",
|
|
6737
|
+
commands
|
|
6738
|
+
};
|
|
6739
|
+
}
|
|
6740
|
+
function onErrorReceived(target, logger) {
|
|
6741
|
+
return (err) => {
|
|
6742
|
+
logger(`[ERROR] child process exception %o`, err);
|
|
6743
|
+
target.push(Buffer.from(String(err.stack), "ascii"));
|
|
6744
|
+
};
|
|
6745
|
+
}
|
|
6746
|
+
function onDataReceived(target, name, logger, output) {
|
|
6747
|
+
return (buffer) => {
|
|
6748
|
+
logger(`%s received %L bytes`, name, buffer);
|
|
6749
|
+
output(`%B`, buffer);
|
|
6750
|
+
target.push(buffer);
|
|
6751
|
+
};
|
|
6752
|
+
}
|
|
6753
|
+
var GitExecutorChain;
|
|
6754
|
+
var init_git_executor_chain = __esm({ "src/lib/runners/git-executor-chain.ts"() {
|
|
6755
|
+
"use strict";
|
|
6756
|
+
init_git_error();
|
|
6757
|
+
init_task();
|
|
6758
|
+
init_utils();
|
|
6759
|
+
init_tasks_pending_queue();
|
|
6760
|
+
GitExecutorChain = class {
|
|
6761
|
+
constructor(_executor, _scheduler, _plugins) {
|
|
6762
|
+
this._executor = _executor;
|
|
6763
|
+
this._scheduler = _scheduler;
|
|
6764
|
+
this._plugins = _plugins;
|
|
6765
|
+
this._chain = Promise.resolve();
|
|
6766
|
+
this._queue = new TasksPendingQueue();
|
|
6767
|
+
}
|
|
6768
|
+
get cwd() {
|
|
6769
|
+
return this._cwd || this._executor.cwd;
|
|
6770
|
+
}
|
|
6771
|
+
set cwd(cwd) {
|
|
6772
|
+
this._cwd = cwd;
|
|
6773
|
+
}
|
|
6774
|
+
get env() {
|
|
6775
|
+
return this._executor.env;
|
|
6776
|
+
}
|
|
6777
|
+
get outputHandler() {
|
|
6778
|
+
return this._executor.outputHandler;
|
|
6779
|
+
}
|
|
6780
|
+
chain() {
|
|
6781
|
+
return this;
|
|
6782
|
+
}
|
|
6783
|
+
push(task) {
|
|
6784
|
+
this._queue.push(task);
|
|
6785
|
+
return this._chain = this._chain.then(() => this.attemptTask(task));
|
|
6786
|
+
}
|
|
6787
|
+
async attemptTask(task) {
|
|
6788
|
+
const onScheduleComplete = await this._scheduler.next();
|
|
6789
|
+
const onQueueComplete = () => this._queue.complete(task);
|
|
6790
|
+
try {
|
|
6791
|
+
const { logger } = this._queue.attempt(task);
|
|
6792
|
+
return await (isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger));
|
|
6793
|
+
} catch (e) {
|
|
6794
|
+
throw this.onFatalException(task, e);
|
|
6795
|
+
} finally {
|
|
6796
|
+
onQueueComplete();
|
|
6797
|
+
onScheduleComplete();
|
|
6798
|
+
}
|
|
6799
|
+
}
|
|
6800
|
+
onFatalException(task, e) {
|
|
6801
|
+
const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
|
|
6802
|
+
this._chain = Promise.resolve();
|
|
6803
|
+
this._queue.fatal(gitError);
|
|
6804
|
+
return gitError;
|
|
6805
|
+
}
|
|
6806
|
+
async attemptRemoteTask(task, logger) {
|
|
6807
|
+
const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
|
|
6808
|
+
const args = this._plugins.exec("spawn.args", [...task.commands], pluginContext(task, task.commands));
|
|
6809
|
+
const raw = await this.gitResponse(task, binary, args, this.outputHandler, logger.step("SPAWN"));
|
|
6810
|
+
const outputStreams = await this.handleTaskData(task, args, raw, logger.step("HANDLE"));
|
|
6811
|
+
logger(`passing response to task's parser as a %s`, task.format);
|
|
6812
|
+
if (isBufferTask(task)) return callTaskParser(task.parser, outputStreams);
|
|
6813
|
+
return callTaskParser(task.parser, outputStreams.asStrings());
|
|
6814
|
+
}
|
|
6815
|
+
async attemptEmptyTask(task, logger) {
|
|
6816
|
+
logger(`empty task bypassing child process to call to task's parser`);
|
|
6817
|
+
return task.parser(this);
|
|
6818
|
+
}
|
|
6819
|
+
handleTaskData(task, args, result, logger) {
|
|
6820
|
+
const { exitCode, rejection, stdOut, stdErr } = result;
|
|
6821
|
+
return new Promise((done, fail) => {
|
|
6822
|
+
logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
|
|
6823
|
+
const { error } = this._plugins.exec("task.error", { error: rejection }, {
|
|
6824
|
+
...pluginContext(task, args),
|
|
6825
|
+
...result
|
|
6826
|
+
});
|
|
6827
|
+
if (error && task.onError) {
|
|
6828
|
+
logger.info(`exitCode=%s handling with custom error handler`);
|
|
6829
|
+
return task.onError(result, error, (newStdOut) => {
|
|
6830
|
+
logger.info(`custom error handler treated as success`);
|
|
6831
|
+
logger(`custom error returned a %s`, objectToString(newStdOut));
|
|
6832
|
+
done(new GitOutputStreams(Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut, Buffer.concat(stdErr)));
|
|
6833
|
+
}, fail);
|
|
6834
|
+
}
|
|
6835
|
+
if (error) {
|
|
6836
|
+
logger.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`, exitCode, stdErr.length, rejection);
|
|
6837
|
+
return fail(error);
|
|
6838
|
+
}
|
|
6839
|
+
logger.info(`retrieving task output complete`);
|
|
6840
|
+
done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
|
|
6841
|
+
});
|
|
6842
|
+
}
|
|
6843
|
+
async gitResponse(task, command, args, outputHandler, logger) {
|
|
6844
|
+
const outputLogger = logger.sibling("output");
|
|
6845
|
+
const spawnOptions = this._plugins.exec("spawn.options", {
|
|
6846
|
+
cwd: this.cwd,
|
|
6847
|
+
env: this.env,
|
|
6848
|
+
windowsHide: true
|
|
6849
|
+
}, pluginContext(task, task.commands));
|
|
6850
|
+
return new Promise((done) => {
|
|
6851
|
+
const stdOut = [];
|
|
6852
|
+
const stdErr = [];
|
|
6853
|
+
logger.info(`%s %o`, command, args);
|
|
6854
|
+
logger("%O", spawnOptions);
|
|
6855
|
+
let rejection = this._beforeSpawn(task, args);
|
|
6856
|
+
if (rejection) return done({
|
|
6857
|
+
stdOut,
|
|
6858
|
+
stdErr,
|
|
6859
|
+
exitCode: 9901,
|
|
6860
|
+
rejection
|
|
6861
|
+
});
|
|
6862
|
+
this._plugins.exec("spawn.before", void 0, {
|
|
6863
|
+
...pluginContext(task, args),
|
|
6864
|
+
kill(reason) {
|
|
6865
|
+
rejection = reason || rejection;
|
|
6866
|
+
}
|
|
6867
|
+
});
|
|
6868
|
+
const spawned = spawn(command, args, spawnOptions);
|
|
6869
|
+
spawned.stdout.on("data", onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut")));
|
|
6870
|
+
spawned.stderr.on("data", onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr")));
|
|
6871
|
+
spawned.on("error", onErrorReceived(stdErr, logger));
|
|
6872
|
+
if (outputHandler) {
|
|
6873
|
+
logger(`Passing child process stdOut/stdErr to custom outputHandler`);
|
|
6874
|
+
outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
|
|
6875
|
+
}
|
|
6876
|
+
this._plugins.exec("spawn.after", void 0, {
|
|
6877
|
+
...pluginContext(task, args),
|
|
6878
|
+
spawned,
|
|
6879
|
+
close(exitCode, reason) {
|
|
6880
|
+
done({
|
|
6881
|
+
stdOut,
|
|
6882
|
+
stdErr,
|
|
6883
|
+
exitCode,
|
|
6884
|
+
rejection: rejection || reason
|
|
6885
|
+
});
|
|
6886
|
+
},
|
|
6887
|
+
kill(reason) {
|
|
6888
|
+
if (spawned.killed) return;
|
|
6889
|
+
rejection = reason;
|
|
6890
|
+
spawned.kill("SIGINT");
|
|
6891
|
+
}
|
|
6892
|
+
});
|
|
6893
|
+
});
|
|
6894
|
+
}
|
|
6895
|
+
_beforeSpawn(task, args) {
|
|
6896
|
+
let rejection;
|
|
6897
|
+
this._plugins.exec("spawn.before", void 0, {
|
|
6898
|
+
...pluginContext(task, args),
|
|
6899
|
+
kill(reason) {
|
|
6900
|
+
rejection = reason || rejection;
|
|
6901
|
+
}
|
|
6902
|
+
});
|
|
6903
|
+
return rejection;
|
|
6904
|
+
}
|
|
6905
|
+
};
|
|
6906
|
+
} });
|
|
6907
|
+
var git_executor_exports = {};
|
|
6908
|
+
__export(git_executor_exports, { GitExecutor: () => GitExecutor });
|
|
6909
|
+
var GitExecutor;
|
|
6910
|
+
var init_git_executor = __esm({ "src/lib/runners/git-executor.ts"() {
|
|
6911
|
+
"use strict";
|
|
6912
|
+
init_git_executor_chain();
|
|
6913
|
+
GitExecutor = class {
|
|
6914
|
+
constructor(cwd, _scheduler, _plugins) {
|
|
6915
|
+
this.cwd = cwd;
|
|
6916
|
+
this._scheduler = _scheduler;
|
|
6917
|
+
this._plugins = _plugins;
|
|
6918
|
+
this._chain = new GitExecutorChain(this, this._scheduler, this._plugins);
|
|
6919
|
+
}
|
|
6920
|
+
chain() {
|
|
6921
|
+
return new GitExecutorChain(this, this._scheduler, this._plugins);
|
|
6922
|
+
}
|
|
6923
|
+
push(task) {
|
|
6924
|
+
return this._chain.push(task);
|
|
6925
|
+
}
|
|
6926
|
+
};
|
|
6927
|
+
} });
|
|
6928
|
+
function taskCallback(task, response, callback = NOOP) {
|
|
6929
|
+
const onSuccess = (data) => {
|
|
6930
|
+
callback(null, data);
|
|
6931
|
+
};
|
|
6932
|
+
const onError2 = (err) => {
|
|
6933
|
+
if (err?.task === task) callback(err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err, void 0);
|
|
6934
|
+
};
|
|
6935
|
+
response.then(onSuccess, onError2);
|
|
6936
|
+
}
|
|
6937
|
+
function addDeprecationNoticeToError(err) {
|
|
6938
|
+
let log = (name) => {
|
|
6939
|
+
console.warn(`simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`);
|
|
6940
|
+
log = NOOP;
|
|
6941
|
+
};
|
|
6942
|
+
return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
|
|
6943
|
+
function descriptorReducer(all, name) {
|
|
6944
|
+
if (name in err) return all;
|
|
6945
|
+
all[name] = {
|
|
6946
|
+
enumerable: false,
|
|
6947
|
+
configurable: false,
|
|
6948
|
+
get() {
|
|
6949
|
+
log(name);
|
|
6950
|
+
return err.git[name];
|
|
6951
|
+
}
|
|
6952
|
+
};
|
|
6953
|
+
return all;
|
|
6954
|
+
}
|
|
6955
|
+
}
|
|
6956
|
+
var init_task_callback = __esm({ "src/lib/task-callback.ts"() {
|
|
6957
|
+
"use strict";
|
|
6958
|
+
init_git_response_error();
|
|
6959
|
+
init_utils();
|
|
6960
|
+
} });
|
|
6961
|
+
function changeWorkingDirectoryTask(directory, root) {
|
|
6962
|
+
return adhocExecTask((instance) => {
|
|
6963
|
+
if (!folderExists(directory)) throw new Error(`Git.cwd: cannot change to non-directory "${directory}"`);
|
|
6964
|
+
return (root || instance).cwd = directory;
|
|
6965
|
+
});
|
|
6966
|
+
}
|
|
6967
|
+
var init_change_working_directory = __esm({ "src/lib/tasks/change-working-directory.ts"() {
|
|
6968
|
+
"use strict";
|
|
6969
|
+
init_utils();
|
|
6970
|
+
init_task();
|
|
6971
|
+
} });
|
|
6972
|
+
function checkoutTask(args) {
|
|
6973
|
+
const commands = ["checkout", ...args];
|
|
6974
|
+
if (commands[1] === "-b" && commands.includes("-B")) commands[1] = remove(commands, "-B");
|
|
6975
|
+
return straightThroughStringTask(commands);
|
|
6976
|
+
}
|
|
6977
|
+
function checkout_default() {
|
|
6978
|
+
return {
|
|
6979
|
+
checkout() {
|
|
6980
|
+
return this._runTask(checkoutTask(getTrailingOptions(arguments, 1)), trailingFunctionArgument(arguments));
|
|
6981
|
+
},
|
|
6982
|
+
checkoutBranch(branchName, startPoint) {
|
|
6983
|
+
return this._runTask(checkoutTask([
|
|
6984
|
+
"-b",
|
|
6985
|
+
branchName,
|
|
6986
|
+
startPoint,
|
|
6987
|
+
...getTrailingOptions(arguments)
|
|
6988
|
+
]), trailingFunctionArgument(arguments));
|
|
6989
|
+
},
|
|
6990
|
+
checkoutLocalBranch(branchName) {
|
|
6991
|
+
return this._runTask(checkoutTask([
|
|
6992
|
+
"-b",
|
|
6993
|
+
branchName,
|
|
6994
|
+
...getTrailingOptions(arguments)
|
|
6995
|
+
]), trailingFunctionArgument(arguments));
|
|
6996
|
+
}
|
|
6997
|
+
};
|
|
6998
|
+
}
|
|
6999
|
+
var init_checkout = __esm({ "src/lib/tasks/checkout.ts"() {
|
|
7000
|
+
"use strict";
|
|
7001
|
+
init_utils();
|
|
7002
|
+
init_task();
|
|
7003
|
+
} });
|
|
7004
|
+
function countObjectsResponse() {
|
|
7005
|
+
return {
|
|
7006
|
+
count: 0,
|
|
7007
|
+
garbage: 0,
|
|
7008
|
+
inPack: 0,
|
|
7009
|
+
packs: 0,
|
|
7010
|
+
prunePackable: 0,
|
|
7011
|
+
size: 0,
|
|
7012
|
+
sizeGarbage: 0,
|
|
7013
|
+
sizePack: 0
|
|
7014
|
+
};
|
|
7015
|
+
}
|
|
7016
|
+
function count_objects_default() {
|
|
7017
|
+
return { countObjects() {
|
|
7018
|
+
return this._runTask({
|
|
7019
|
+
commands: ["count-objects", "--verbose"],
|
|
7020
|
+
format: "utf-8",
|
|
7021
|
+
parser(stdOut) {
|
|
7022
|
+
return parseStringResponse(countObjectsResponse(), [parser2], stdOut);
|
|
7023
|
+
}
|
|
7024
|
+
});
|
|
7025
|
+
} };
|
|
7026
|
+
}
|
|
7027
|
+
var parser2;
|
|
7028
|
+
var init_count_objects = __esm({ "src/lib/tasks/count-objects.ts"() {
|
|
7029
|
+
"use strict";
|
|
7030
|
+
init_utils();
|
|
7031
|
+
parser2 = new LineParser(/([a-z-]+): (\d+)$/, (result, [key, value]) => {
|
|
7032
|
+
const property = asCamelCase(key);
|
|
7033
|
+
if (Object.hasOwn(result, property)) result[property] = asNumber(value);
|
|
7034
|
+
});
|
|
7035
|
+
} });
|
|
7036
|
+
function parseCommitResult(stdOut) {
|
|
7037
|
+
return parseStringResponse({
|
|
7038
|
+
author: null,
|
|
7039
|
+
branch: "",
|
|
7040
|
+
commit: "",
|
|
7041
|
+
root: false,
|
|
7042
|
+
summary: {
|
|
7043
|
+
changes: 0,
|
|
7044
|
+
insertions: 0,
|
|
7045
|
+
deletions: 0
|
|
7046
|
+
}
|
|
7047
|
+
}, parsers, stdOut);
|
|
7048
|
+
}
|
|
7049
|
+
var parsers;
|
|
7050
|
+
var init_parse_commit = __esm({ "src/lib/parsers/parse-commit.ts"() {
|
|
7051
|
+
"use strict";
|
|
7052
|
+
init_utils();
|
|
7053
|
+
parsers = [
|
|
7054
|
+
new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => {
|
|
7055
|
+
result.branch = branch;
|
|
7056
|
+
result.commit = commit;
|
|
7057
|
+
result.root = !!root;
|
|
7058
|
+
}),
|
|
7059
|
+
new LineParser(/\s*Author:\s(.+)/i, (result, [author]) => {
|
|
7060
|
+
const parts = author.split("<");
|
|
7061
|
+
const email = parts.pop();
|
|
7062
|
+
if (!email || !email.includes("@")) return;
|
|
7063
|
+
result.author = {
|
|
7064
|
+
email: email.substr(0, email.length - 1),
|
|
7065
|
+
name: parts.join("<").trim()
|
|
7066
|
+
};
|
|
7067
|
+
}),
|
|
7068
|
+
new LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => {
|
|
7069
|
+
result.summary.changes = parseInt(changes, 10) || 0;
|
|
7070
|
+
result.summary.insertions = parseInt(insertions, 10) || 0;
|
|
7071
|
+
result.summary.deletions = parseInt(deletions, 10) || 0;
|
|
7072
|
+
}),
|
|
7073
|
+
new LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => {
|
|
7074
|
+
result.summary.changes = parseInt(changes, 10) || 0;
|
|
7075
|
+
const count = parseInt(lines, 10) || 0;
|
|
7076
|
+
if (direction === "-") result.summary.deletions = count;
|
|
7077
|
+
else if (direction === "+") result.summary.insertions = count;
|
|
7078
|
+
})
|
|
7079
|
+
];
|
|
7080
|
+
} });
|
|
7081
|
+
function commitTask(message, files, customArgs) {
|
|
7082
|
+
return {
|
|
7083
|
+
commands: [
|
|
7084
|
+
"-c",
|
|
7085
|
+
"core.abbrev=40",
|
|
7086
|
+
"commit",
|
|
7087
|
+
...prefixedArray(message, "-m"),
|
|
7088
|
+
...files,
|
|
7089
|
+
...customArgs
|
|
7090
|
+
],
|
|
7091
|
+
format: "utf-8",
|
|
7092
|
+
parser: parseCommitResult
|
|
7093
|
+
};
|
|
7094
|
+
}
|
|
7095
|
+
function commit_default() {
|
|
7096
|
+
return { commit(message, ...rest) {
|
|
7097
|
+
const next = trailingFunctionArgument(arguments);
|
|
7098
|
+
const task = rejectDeprecatedSignatures(message) || commitTask(asArray(message), asArray(filterType(rest[0], filterStringOrStringArray, [])), [...asStringArray(filterType(rest[1], filterArray, [])), ...getTrailingOptions(arguments, 0, true)]);
|
|
7099
|
+
return this._runTask(task, next);
|
|
7100
|
+
} };
|
|
7101
|
+
function rejectDeprecatedSignatures(message) {
|
|
7102
|
+
return !filterStringOrStringArray(message) && configurationErrorTask(`git.commit: requires the commit message to be supplied as a string/string[]`);
|
|
7103
|
+
}
|
|
7104
|
+
}
|
|
7105
|
+
var init_commit = __esm({ "src/lib/tasks/commit.ts"() {
|
|
7106
|
+
"use strict";
|
|
7107
|
+
init_parse_commit();
|
|
7108
|
+
init_utils();
|
|
7109
|
+
init_task();
|
|
7110
|
+
} });
|
|
7111
|
+
function first_commit_default() {
|
|
7112
|
+
return { firstCommit() {
|
|
7113
|
+
return this._runTask(straightThroughStringTask([
|
|
7114
|
+
"rev-list",
|
|
7115
|
+
"--max-parents=0",
|
|
7116
|
+
"HEAD"
|
|
7117
|
+
], true), trailingFunctionArgument(arguments));
|
|
7118
|
+
} };
|
|
7119
|
+
}
|
|
7120
|
+
var init_first_commit = __esm({ "src/lib/tasks/first-commit.ts"() {
|
|
7121
|
+
"use strict";
|
|
7122
|
+
init_utils();
|
|
7123
|
+
init_task();
|
|
7124
|
+
} });
|
|
7125
|
+
function hashObjectTask(filePath, write) {
|
|
7126
|
+
const commands = ["hash-object", filePath];
|
|
7127
|
+
if (write) commands.push("-w");
|
|
7128
|
+
return straightThroughStringTask(commands, true);
|
|
7129
|
+
}
|
|
7130
|
+
var init_hash_object = __esm({ "src/lib/tasks/hash-object.ts"() {
|
|
7131
|
+
"use strict";
|
|
7132
|
+
init_task();
|
|
7133
|
+
} });
|
|
7134
|
+
function parseInit(bare, path, text) {
|
|
7135
|
+
const response = String(text).trim();
|
|
7136
|
+
let result;
|
|
7137
|
+
if (result = initResponseRegex.exec(response)) return new InitSummary(bare, path, false, result[1]);
|
|
7138
|
+
if (result = reInitResponseRegex.exec(response)) return new InitSummary(bare, path, true, result[1]);
|
|
7139
|
+
let gitDir = "";
|
|
7140
|
+
const tokens = response.split(" ");
|
|
7141
|
+
while (tokens.length) if (tokens.shift() === "in") {
|
|
7142
|
+
gitDir = tokens.join(" ");
|
|
7143
|
+
break;
|
|
7144
|
+
}
|
|
7145
|
+
return new InitSummary(bare, path, /^re/i.test(response), gitDir);
|
|
7146
|
+
}
|
|
7147
|
+
var InitSummary, initResponseRegex, reInitResponseRegex;
|
|
7148
|
+
var init_InitSummary = __esm({ "src/lib/responses/InitSummary.ts"() {
|
|
7149
|
+
"use strict";
|
|
7150
|
+
InitSummary = class {
|
|
7151
|
+
constructor(bare, path, existing, gitDir) {
|
|
7152
|
+
this.bare = bare;
|
|
7153
|
+
this.path = path;
|
|
7154
|
+
this.existing = existing;
|
|
7155
|
+
this.gitDir = gitDir;
|
|
7156
|
+
}
|
|
7157
|
+
};
|
|
7158
|
+
initResponseRegex = /^Init.+ repository in (.+)$/;
|
|
7159
|
+
reInitResponseRegex = /^Rein.+ in (.+)$/;
|
|
7160
|
+
} });
|
|
7161
|
+
function hasBareCommand(command) {
|
|
7162
|
+
return command.includes(bareCommand);
|
|
7163
|
+
}
|
|
7164
|
+
function initTask(bare = false, path, customArgs) {
|
|
7165
|
+
const commands = ["init", ...customArgs];
|
|
7166
|
+
if (bare && !hasBareCommand(commands)) commands.splice(1, 0, bareCommand);
|
|
7167
|
+
return {
|
|
7168
|
+
commands,
|
|
7169
|
+
format: "utf-8",
|
|
7170
|
+
parser(text) {
|
|
7171
|
+
return parseInit(commands.includes("--bare"), path, text);
|
|
7172
|
+
}
|
|
7173
|
+
};
|
|
7174
|
+
}
|
|
7175
|
+
var bareCommand;
|
|
7176
|
+
var init_init = __esm({ "src/lib/tasks/init.ts"() {
|
|
7177
|
+
"use strict";
|
|
7178
|
+
init_InitSummary();
|
|
7179
|
+
bareCommand = "--bare";
|
|
7180
|
+
} });
|
|
7181
|
+
function logFormatFromCommand(customArgs) {
|
|
7182
|
+
for (let i = 0; i < customArgs.length; i++) {
|
|
7183
|
+
const format = logFormatRegex.exec(customArgs[i]);
|
|
7184
|
+
if (format) return `--${format[1]}`;
|
|
7185
|
+
}
|
|
7186
|
+
return "";
|
|
7187
|
+
}
|
|
7188
|
+
function isLogFormat(customArg) {
|
|
7189
|
+
return logFormatRegex.test(customArg);
|
|
7190
|
+
}
|
|
7191
|
+
var logFormatRegex;
|
|
7192
|
+
var init_log_format = __esm({ "src/lib/args/log-format.ts"() {
|
|
7193
|
+
"use strict";
|
|
7194
|
+
logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;
|
|
7195
|
+
} });
|
|
7196
|
+
var DiffSummary;
|
|
7197
|
+
var init_DiffSummary = __esm({ "src/lib/responses/DiffSummary.ts"() {
|
|
7198
|
+
"use strict";
|
|
7199
|
+
DiffSummary = class {
|
|
7200
|
+
constructor() {
|
|
7201
|
+
this.changed = 0;
|
|
7202
|
+
this.deletions = 0;
|
|
7203
|
+
this.insertions = 0;
|
|
7204
|
+
this.files = [];
|
|
7205
|
+
}
|
|
7206
|
+
};
|
|
7207
|
+
} });
|
|
7208
|
+
function getDiffParser(format = "") {
|
|
7209
|
+
const parser4 = diffSummaryParsers[format];
|
|
7210
|
+
return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false);
|
|
7211
|
+
}
|
|
7212
|
+
var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers;
|
|
7213
|
+
var init_parse_diff_summary = __esm({ "src/lib/parsers/parse-diff-summary.ts"() {
|
|
7214
|
+
"use strict";
|
|
7215
|
+
init_log_format();
|
|
7216
|
+
init_DiffSummary();
|
|
7217
|
+
init_diff_name_status();
|
|
7218
|
+
init_utils();
|
|
7219
|
+
statParser = [
|
|
7220
|
+
new LineParser(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/, (result, [file, changes, alterations = ""]) => {
|
|
7221
|
+
result.files.push({
|
|
7222
|
+
file: file.trim(),
|
|
7223
|
+
changes: asNumber(changes),
|
|
7224
|
+
insertions: alterations.replace(/[^+]/g, "").length,
|
|
7225
|
+
deletions: alterations.replace(/[^-]/g, "").length,
|
|
7226
|
+
binary: false
|
|
7227
|
+
});
|
|
7228
|
+
}),
|
|
7229
|
+
new LineParser(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/, (result, [file, before, after]) => {
|
|
7230
|
+
result.files.push({
|
|
7231
|
+
file: file.trim(),
|
|
7232
|
+
before: asNumber(before),
|
|
7233
|
+
after: asNumber(after),
|
|
7234
|
+
binary: true
|
|
7235
|
+
});
|
|
7236
|
+
}),
|
|
7237
|
+
new LineParser(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/, (result, [changed, summary]) => {
|
|
7238
|
+
const inserted = /(\d+) i/.exec(summary);
|
|
7239
|
+
const deleted = /(\d+) d/.exec(summary);
|
|
7240
|
+
result.changed = asNumber(changed);
|
|
7241
|
+
result.insertions = asNumber(inserted?.[1]);
|
|
7242
|
+
result.deletions = asNumber(deleted?.[1]);
|
|
7243
|
+
})
|
|
7244
|
+
];
|
|
7245
|
+
numStatParser = [new LineParser(/(\d+)\t(\d+)\t(.+)$/, (result, [changesInsert, changesDelete, file]) => {
|
|
7246
|
+
const insertions = asNumber(changesInsert);
|
|
7247
|
+
const deletions = asNumber(changesDelete);
|
|
7248
|
+
result.changed++;
|
|
7249
|
+
result.insertions += insertions;
|
|
7250
|
+
result.deletions += deletions;
|
|
7251
|
+
result.files.push({
|
|
7252
|
+
file,
|
|
7253
|
+
changes: insertions + deletions,
|
|
7254
|
+
insertions,
|
|
7255
|
+
deletions,
|
|
7256
|
+
binary: false
|
|
7257
|
+
});
|
|
7258
|
+
}), new LineParser(/-\t-\t(.+)$/, (result, [file]) => {
|
|
7259
|
+
result.changed++;
|
|
7260
|
+
result.files.push({
|
|
7261
|
+
file,
|
|
7262
|
+
after: 0,
|
|
7263
|
+
before: 0,
|
|
7264
|
+
binary: true
|
|
7265
|
+
});
|
|
7266
|
+
})];
|
|
7267
|
+
nameOnlyParser = [new LineParser(/(.+)$/, (result, [file]) => {
|
|
7268
|
+
result.changed++;
|
|
7269
|
+
result.files.push({
|
|
7270
|
+
file,
|
|
7271
|
+
changes: 0,
|
|
7272
|
+
insertions: 0,
|
|
7273
|
+
deletions: 0,
|
|
7274
|
+
binary: false
|
|
7275
|
+
});
|
|
7276
|
+
})];
|
|
7277
|
+
nameStatusParser = [new LineParser(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/, (result, [status, similarity, from, _to, to]) => {
|
|
7278
|
+
result.changed++;
|
|
7279
|
+
result.files.push({
|
|
7280
|
+
file: to ?? from,
|
|
7281
|
+
changes: 0,
|
|
7282
|
+
insertions: 0,
|
|
7283
|
+
deletions: 0,
|
|
7284
|
+
binary: false,
|
|
7285
|
+
status: orVoid(isDiffNameStatus(status) && status),
|
|
7286
|
+
from: orVoid(!!to && from !== to && from),
|
|
7287
|
+
similarity: asNumber(similarity)
|
|
7288
|
+
});
|
|
7289
|
+
})];
|
|
7290
|
+
diffSummaryParsers = {
|
|
7291
|
+
[""]: statParser,
|
|
7292
|
+
["--stat"]: statParser,
|
|
7293
|
+
["--numstat"]: numStatParser,
|
|
7294
|
+
["--name-status"]: nameStatusParser,
|
|
7295
|
+
["--name-only"]: nameOnlyParser
|
|
7296
|
+
};
|
|
7297
|
+
} });
|
|
7298
|
+
function lineBuilder(tokens, fields) {
|
|
7299
|
+
return fields.reduce((line, field, index) => {
|
|
7300
|
+
line[field] = tokens[index] || "";
|
|
7301
|
+
return line;
|
|
7302
|
+
}, /* @__PURE__ */ Object.create({ diff: null }));
|
|
7303
|
+
}
|
|
7304
|
+
function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "") {
|
|
7305
|
+
const parseDiffResult = getDiffParser(logFormat);
|
|
7306
|
+
return function(stdOut) {
|
|
7307
|
+
const all = toLinesWithContent(stdOut.trim(), false, START_BOUNDARY).map(function(item) {
|
|
7308
|
+
const lineDetail = item.split(COMMIT_BOUNDARY);
|
|
7309
|
+
const listLogLine = lineBuilder(lineDetail[0].split(splitter), fields);
|
|
7310
|
+
if (lineDetail.length > 1 && !!lineDetail[1].trim()) listLogLine.diff = parseDiffResult(lineDetail[1]);
|
|
7311
|
+
return listLogLine;
|
|
7312
|
+
});
|
|
7313
|
+
return {
|
|
7314
|
+
all,
|
|
7315
|
+
latest: all.length && all[0] || null,
|
|
7316
|
+
total: all.length
|
|
7317
|
+
};
|
|
7318
|
+
};
|
|
7319
|
+
}
|
|
7320
|
+
var START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames;
|
|
7321
|
+
var init_parse_list_log_summary = __esm({ "src/lib/parsers/parse-list-log-summary.ts"() {
|
|
7322
|
+
"use strict";
|
|
7323
|
+
init_utils();
|
|
7324
|
+
init_parse_diff_summary();
|
|
7325
|
+
init_log_format();
|
|
7326
|
+
START_BOUNDARY = "òòòòòò ";
|
|
7327
|
+
COMMIT_BOUNDARY = " òò";
|
|
7328
|
+
SPLITTER = " ò ";
|
|
7329
|
+
defaultFieldNames = [
|
|
7330
|
+
"hash",
|
|
7331
|
+
"date",
|
|
7332
|
+
"message",
|
|
7333
|
+
"refs",
|
|
7334
|
+
"author_name",
|
|
7335
|
+
"author_email"
|
|
7336
|
+
];
|
|
7337
|
+
} });
|
|
7338
|
+
var diff_exports = {};
|
|
7339
|
+
__export(diff_exports, {
|
|
7340
|
+
diffSummaryTask: () => diffSummaryTask,
|
|
7341
|
+
validateLogFormatConfig: () => validateLogFormatConfig
|
|
7342
|
+
});
|
|
7343
|
+
function diffSummaryTask(customArgs) {
|
|
7344
|
+
let logFormat = logFormatFromCommand(customArgs);
|
|
7345
|
+
const commands = ["diff"];
|
|
7346
|
+
if (logFormat === "") {
|
|
7347
|
+
logFormat = "--stat";
|
|
7348
|
+
commands.push("--stat=4096");
|
|
7349
|
+
}
|
|
7350
|
+
commands.push(...customArgs);
|
|
7351
|
+
return validateLogFormatConfig(commands) || {
|
|
7352
|
+
commands,
|
|
7353
|
+
format: "utf-8",
|
|
7354
|
+
parser: getDiffParser(logFormat)
|
|
7355
|
+
};
|
|
7356
|
+
}
|
|
7357
|
+
function validateLogFormatConfig(customArgs) {
|
|
7358
|
+
const flags = customArgs.filter(isLogFormat);
|
|
7359
|
+
if (flags.length > 1) return configurationErrorTask(`Summary flags are mutually exclusive - pick one of ${flags.join(",")}`);
|
|
7360
|
+
if (flags.length && customArgs.includes("-z")) return configurationErrorTask(`Summary flag ${flags} parsing is not compatible with null termination option '-z'`);
|
|
7361
|
+
}
|
|
7362
|
+
var init_diff = __esm({ "src/lib/tasks/diff.ts"() {
|
|
7363
|
+
"use strict";
|
|
7364
|
+
init_log_format();
|
|
7365
|
+
init_parse_diff_summary();
|
|
7366
|
+
init_task();
|
|
7367
|
+
} });
|
|
7368
|
+
function prettyFormat(format, splitter) {
|
|
7369
|
+
const fields = [];
|
|
7370
|
+
const formatStr = [];
|
|
7371
|
+
Object.keys(format).forEach((field) => {
|
|
7372
|
+
fields.push(field);
|
|
7373
|
+
formatStr.push(String(format[field]));
|
|
7374
|
+
});
|
|
7375
|
+
return [fields, formatStr.join(splitter)];
|
|
7376
|
+
}
|
|
7377
|
+
function userOptions(input) {
|
|
7378
|
+
return Object.keys(input).reduce((out, key) => {
|
|
7379
|
+
if (!(key in excludeOptions)) out[key] = input[key];
|
|
7380
|
+
return out;
|
|
7381
|
+
}, {});
|
|
7382
|
+
}
|
|
7383
|
+
function parseLogOptions(opt = {}, customArgs = []) {
|
|
7384
|
+
const splitter = filterType(opt.splitter, filterString, SPLITTER);
|
|
7385
|
+
const [fields, formatStr] = prettyFormat(filterPlainObject(opt.format) ? opt.format : {
|
|
7386
|
+
hash: "%H",
|
|
7387
|
+
date: opt.strictDate === false ? "%ai" : "%aI",
|
|
7388
|
+
message: "%s",
|
|
7389
|
+
refs: "%D",
|
|
7390
|
+
body: opt.multiLine ? "%B" : "%b",
|
|
7391
|
+
author_name: opt.mailMap !== false ? "%aN" : "%an",
|
|
7392
|
+
author_email: opt.mailMap !== false ? "%aE" : "%ae"
|
|
7393
|
+
}, splitter);
|
|
7394
|
+
const suffix = [];
|
|
7395
|
+
const command = [`--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`, ...customArgs];
|
|
7396
|
+
const maxCount = opt.n || opt["max-count"] || opt.maxCount;
|
|
7397
|
+
if (maxCount) command.push(`--max-count=${maxCount}`);
|
|
7398
|
+
if (opt.from || opt.to) {
|
|
7399
|
+
const rangeOperator = opt.symmetric !== false ? "..." : "..";
|
|
7400
|
+
suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`);
|
|
7401
|
+
}
|
|
7402
|
+
if (filterString(opt.file)) command.push("--follow", pathspec(opt.file));
|
|
7403
|
+
appendTaskOptions(userOptions(opt), command);
|
|
7404
|
+
return {
|
|
7405
|
+
fields,
|
|
7406
|
+
splitter,
|
|
7407
|
+
commands: [...command, ...suffix]
|
|
7408
|
+
};
|
|
7409
|
+
}
|
|
7410
|
+
function logTask(splitter, fields, customArgs) {
|
|
7411
|
+
const parser4 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));
|
|
7412
|
+
return {
|
|
7413
|
+
commands: ["log", ...customArgs],
|
|
7414
|
+
format: "utf-8",
|
|
7415
|
+
parser: parser4
|
|
7416
|
+
};
|
|
7417
|
+
}
|
|
7418
|
+
function log_default() {
|
|
7419
|
+
return { log(...rest) {
|
|
7420
|
+
const next = trailingFunctionArgument(arguments);
|
|
7421
|
+
const options = parseLogOptions(trailingOptionsArgument(arguments), asStringArray(filterType(arguments[0], filterArray, [])));
|
|
7422
|
+
const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);
|
|
7423
|
+
return this._runTask(task, next);
|
|
7424
|
+
} };
|
|
7425
|
+
function createLogTask(options) {
|
|
7426
|
+
return logTask(options.splitter, options.fields, options.commands);
|
|
7427
|
+
}
|
|
7428
|
+
function rejectDeprecatedSignatures(from, to) {
|
|
7429
|
+
return filterString(from) && filterString(to) && configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`);
|
|
7430
|
+
}
|
|
7431
|
+
}
|
|
7432
|
+
var excludeOptions;
|
|
7433
|
+
var init_log = __esm({ "src/lib/tasks/log.ts"() {
|
|
7434
|
+
"use strict";
|
|
7435
|
+
init_log_format();
|
|
7436
|
+
init_pathspec();
|
|
7437
|
+
init_parse_list_log_summary();
|
|
7438
|
+
init_utils();
|
|
7439
|
+
init_task();
|
|
7440
|
+
init_diff();
|
|
7441
|
+
excludeOptions = /* @__PURE__ */ ((excludeOptions2) => {
|
|
7442
|
+
excludeOptions2[excludeOptions2["--pretty"] = 0] = "--pretty";
|
|
7443
|
+
excludeOptions2[excludeOptions2["max-count"] = 1] = "max-count";
|
|
7444
|
+
excludeOptions2[excludeOptions2["maxCount"] = 2] = "maxCount";
|
|
7445
|
+
excludeOptions2[excludeOptions2["n"] = 3] = "n";
|
|
7446
|
+
excludeOptions2[excludeOptions2["file"] = 4] = "file";
|
|
7447
|
+
excludeOptions2[excludeOptions2["format"] = 5] = "format";
|
|
7448
|
+
excludeOptions2[excludeOptions2["from"] = 6] = "from";
|
|
7449
|
+
excludeOptions2[excludeOptions2["to"] = 7] = "to";
|
|
7450
|
+
excludeOptions2[excludeOptions2["splitter"] = 8] = "splitter";
|
|
7451
|
+
excludeOptions2[excludeOptions2["symmetric"] = 9] = "symmetric";
|
|
7452
|
+
excludeOptions2[excludeOptions2["mailMap"] = 10] = "mailMap";
|
|
7453
|
+
excludeOptions2[excludeOptions2["multiLine"] = 11] = "multiLine";
|
|
7454
|
+
excludeOptions2[excludeOptions2["strictDate"] = 12] = "strictDate";
|
|
7455
|
+
return excludeOptions2;
|
|
7456
|
+
})(excludeOptions || {});
|
|
7457
|
+
} });
|
|
7458
|
+
var MergeSummaryConflict, MergeSummaryDetail;
|
|
7459
|
+
var init_MergeSummary = __esm({ "src/lib/responses/MergeSummary.ts"() {
|
|
7460
|
+
"use strict";
|
|
7461
|
+
MergeSummaryConflict = class {
|
|
7462
|
+
constructor(reason, file = null, meta) {
|
|
7463
|
+
this.reason = reason;
|
|
7464
|
+
this.file = file;
|
|
7465
|
+
this.meta = meta;
|
|
7466
|
+
}
|
|
7467
|
+
toString() {
|
|
7468
|
+
return `${this.file}:${this.reason}`;
|
|
7469
|
+
}
|
|
7470
|
+
};
|
|
7471
|
+
MergeSummaryDetail = class {
|
|
7472
|
+
constructor() {
|
|
7473
|
+
this.conflicts = [];
|
|
7474
|
+
this.merges = [];
|
|
7475
|
+
this.result = "success";
|
|
7476
|
+
}
|
|
7477
|
+
get failed() {
|
|
7478
|
+
return this.conflicts.length > 0;
|
|
7479
|
+
}
|
|
7480
|
+
get reason() {
|
|
7481
|
+
return this.result;
|
|
7482
|
+
}
|
|
7483
|
+
toString() {
|
|
7484
|
+
if (this.conflicts.length) return `CONFLICTS: ${this.conflicts.join(", ")}`;
|
|
7485
|
+
return "OK";
|
|
7486
|
+
}
|
|
7487
|
+
};
|
|
7488
|
+
} });
|
|
7489
|
+
var PullSummary, PullFailedSummary;
|
|
7490
|
+
var init_PullSummary = __esm({ "src/lib/responses/PullSummary.ts"() {
|
|
7491
|
+
"use strict";
|
|
7492
|
+
PullSummary = class {
|
|
7493
|
+
constructor() {
|
|
7494
|
+
this.remoteMessages = { all: [] };
|
|
7495
|
+
this.created = [];
|
|
7496
|
+
this.deleted = [];
|
|
7497
|
+
this.files = [];
|
|
7498
|
+
this.deletions = {};
|
|
7499
|
+
this.insertions = {};
|
|
7500
|
+
this.summary = {
|
|
7501
|
+
changes: 0,
|
|
7502
|
+
deletions: 0,
|
|
7503
|
+
insertions: 0
|
|
7504
|
+
};
|
|
7505
|
+
}
|
|
7506
|
+
};
|
|
7507
|
+
PullFailedSummary = class {
|
|
7508
|
+
constructor() {
|
|
7509
|
+
this.remote = "";
|
|
7510
|
+
this.hash = {
|
|
7511
|
+
local: "",
|
|
7512
|
+
remote: ""
|
|
7513
|
+
};
|
|
7514
|
+
this.branch = {
|
|
7515
|
+
local: "",
|
|
7516
|
+
remote: ""
|
|
7517
|
+
};
|
|
7518
|
+
this.message = "";
|
|
7519
|
+
}
|
|
7520
|
+
toString() {
|
|
7521
|
+
return this.message;
|
|
7522
|
+
}
|
|
7523
|
+
};
|
|
7524
|
+
} });
|
|
7525
|
+
function objectEnumerationResult(remoteMessages) {
|
|
7526
|
+
return remoteMessages.objects = remoteMessages.objects || {
|
|
7527
|
+
compressing: 0,
|
|
7528
|
+
counting: 0,
|
|
7529
|
+
enumerating: 0,
|
|
7530
|
+
packReused: 0,
|
|
7531
|
+
reused: {
|
|
7532
|
+
count: 0,
|
|
7533
|
+
delta: 0
|
|
7534
|
+
},
|
|
7535
|
+
total: {
|
|
7536
|
+
count: 0,
|
|
7537
|
+
delta: 0
|
|
7538
|
+
}
|
|
7539
|
+
};
|
|
7540
|
+
}
|
|
7541
|
+
function asObjectCount(source) {
|
|
7542
|
+
const count = /^\s*(\d+)/.exec(source);
|
|
7543
|
+
const delta = /delta (\d+)/i.exec(source);
|
|
7544
|
+
return {
|
|
7545
|
+
count: asNumber(count && count[1] || "0"),
|
|
7546
|
+
delta: asNumber(delta && delta[1] || "0")
|
|
7547
|
+
};
|
|
7548
|
+
}
|
|
7549
|
+
var remoteMessagesObjectParsers;
|
|
7550
|
+
var init_parse_remote_objects = __esm({ "src/lib/parsers/parse-remote-objects.ts"() {
|
|
7551
|
+
"use strict";
|
|
7552
|
+
init_utils();
|
|
7553
|
+
remoteMessagesObjectParsers = [
|
|
7554
|
+
new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => {
|
|
7555
|
+
const key = action.toLowerCase();
|
|
7556
|
+
const enumeration = objectEnumerationResult(result.remoteMessages);
|
|
7557
|
+
Object.assign(enumeration, { [key]: asNumber(count) });
|
|
7558
|
+
}),
|
|
7559
|
+
new RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => {
|
|
7560
|
+
const key = action.toLowerCase();
|
|
7561
|
+
const enumeration = objectEnumerationResult(result.remoteMessages);
|
|
7562
|
+
Object.assign(enumeration, { [key]: asNumber(count) });
|
|
7563
|
+
}),
|
|
7564
|
+
new RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => {
|
|
7565
|
+
const objects = objectEnumerationResult(result.remoteMessages);
|
|
7566
|
+
objects.total = asObjectCount(total);
|
|
7567
|
+
objects.reused = asObjectCount(reused);
|
|
7568
|
+
objects.packReused = asNumber(packReused);
|
|
7569
|
+
})
|
|
7570
|
+
];
|
|
7571
|
+
} });
|
|
7572
|
+
function parseRemoteMessages(_stdOut, stdErr) {
|
|
7573
|
+
return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers2, stdErr);
|
|
7574
|
+
}
|
|
7575
|
+
var parsers2, RemoteMessageSummary;
|
|
7576
|
+
var init_parse_remote_messages = __esm({ "src/lib/parsers/parse-remote-messages.ts"() {
|
|
7577
|
+
"use strict";
|
|
7578
|
+
init_utils();
|
|
7579
|
+
init_parse_remote_objects();
|
|
7580
|
+
parsers2 = [
|
|
7581
|
+
new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text]) => {
|
|
7582
|
+
result.remoteMessages.all.push(text.trim());
|
|
7583
|
+
return false;
|
|
7584
|
+
}),
|
|
7585
|
+
...remoteMessagesObjectParsers,
|
|
7586
|
+
new RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => {
|
|
7587
|
+
result.remoteMessages.pullRequestUrl = pullRequestUrl;
|
|
7588
|
+
}),
|
|
7589
|
+
new RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => {
|
|
7590
|
+
result.remoteMessages.vulnerabilities = {
|
|
7591
|
+
count: asNumber(count),
|
|
7592
|
+
summary,
|
|
7593
|
+
url
|
|
7594
|
+
};
|
|
7595
|
+
})
|
|
7596
|
+
];
|
|
7597
|
+
RemoteMessageSummary = class {
|
|
7598
|
+
constructor() {
|
|
7599
|
+
this.all = [];
|
|
7600
|
+
}
|
|
7601
|
+
};
|
|
7602
|
+
} });
|
|
7603
|
+
function parsePullErrorResult(stdOut, stdErr) {
|
|
7604
|
+
const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, [stdOut, stdErr]);
|
|
7605
|
+
return pullError.message && pullError;
|
|
7606
|
+
}
|
|
7607
|
+
var FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult;
|
|
7608
|
+
var init_parse_pull = __esm({ "src/lib/parsers/parse-pull.ts"() {
|
|
7609
|
+
"use strict";
|
|
7610
|
+
init_PullSummary();
|
|
7611
|
+
init_utils();
|
|
7612
|
+
init_parse_remote_messages();
|
|
7613
|
+
FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;
|
|
7614
|
+
SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
|
|
7615
|
+
ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
|
|
7616
|
+
parsers3 = [
|
|
7617
|
+
new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {
|
|
7618
|
+
result.files.push(file);
|
|
7619
|
+
if (insertions) result.insertions[file] = insertions.length;
|
|
7620
|
+
if (deletions) result.deletions[file] = deletions.length;
|
|
7621
|
+
}),
|
|
7622
|
+
new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {
|
|
7623
|
+
if (insertions !== void 0 || deletions !== void 0) {
|
|
7624
|
+
result.summary.changes = +changes || 0;
|
|
7625
|
+
result.summary.insertions = +insertions || 0;
|
|
7626
|
+
result.summary.deletions = +deletions || 0;
|
|
7627
|
+
return true;
|
|
7628
|
+
}
|
|
7629
|
+
return false;
|
|
7630
|
+
}),
|
|
7631
|
+
new LineParser(ACTION_REGEX, (result, [action, file]) => {
|
|
7632
|
+
append(result.files, file);
|
|
7633
|
+
append(action === "create" ? result.created : result.deleted, file);
|
|
7634
|
+
})
|
|
7635
|
+
];
|
|
7636
|
+
errorParsers = [
|
|
7637
|
+
new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),
|
|
7638
|
+
new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)),
|
|
7639
|
+
new LineParser(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/, (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {
|
|
7640
|
+
result.branch.local = branchLocal;
|
|
7641
|
+
result.hash.local = hashLocal;
|
|
7642
|
+
result.branch.remote = branchRemote;
|
|
7643
|
+
result.hash.remote = hashRemote;
|
|
7644
|
+
})
|
|
7645
|
+
];
|
|
7646
|
+
parsePullDetail = (stdOut, stdErr) => {
|
|
7647
|
+
return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]);
|
|
7648
|
+
};
|
|
7649
|
+
parsePullResult = (stdOut, stdErr) => {
|
|
7650
|
+
return Object.assign(new PullSummary(), parsePullDetail(stdOut, stdErr), parseRemoteMessages(stdOut, stdErr));
|
|
7651
|
+
};
|
|
7652
|
+
} });
|
|
7653
|
+
var parsers4, parseMergeResult, parseMergeDetail;
|
|
7654
|
+
var init_parse_merge = __esm({ "src/lib/parsers/parse-merge.ts"() {
|
|
7655
|
+
"use strict";
|
|
7656
|
+
init_MergeSummary();
|
|
7657
|
+
init_utils();
|
|
7658
|
+
init_parse_pull();
|
|
7659
|
+
parsers4 = [
|
|
7660
|
+
new LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
|
|
7661
|
+
summary.merges.push(autoMerge);
|
|
7662
|
+
}),
|
|
7663
|
+
new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
|
|
7664
|
+
summary.conflicts.push(new MergeSummaryConflict(reason, file));
|
|
7665
|
+
}),
|
|
7666
|
+
new LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => {
|
|
7667
|
+
summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));
|
|
7668
|
+
}),
|
|
7669
|
+
new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
|
|
7670
|
+
summary.conflicts.push(new MergeSummaryConflict(reason, null));
|
|
7671
|
+
}),
|
|
7672
|
+
new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
|
|
7673
|
+
summary.result = result;
|
|
7674
|
+
})
|
|
7675
|
+
];
|
|
7676
|
+
parseMergeResult = (stdOut, stdErr) => {
|
|
7677
|
+
return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));
|
|
7678
|
+
};
|
|
7679
|
+
parseMergeDetail = (stdOut) => {
|
|
7680
|
+
return parseStringResponse(new MergeSummaryDetail(), parsers4, stdOut);
|
|
7681
|
+
};
|
|
7682
|
+
} });
|
|
7683
|
+
function mergeTask(customArgs) {
|
|
7684
|
+
if (!customArgs.length) return configurationErrorTask("Git.merge requires at least one option");
|
|
7685
|
+
return {
|
|
7686
|
+
commands: ["merge", ...customArgs],
|
|
7687
|
+
format: "utf-8",
|
|
7688
|
+
parser(stdOut, stdErr) {
|
|
7689
|
+
const merge = parseMergeResult(stdOut, stdErr);
|
|
7690
|
+
if (merge.failed) throw new GitResponseError(merge);
|
|
7691
|
+
return merge;
|
|
7692
|
+
}
|
|
7693
|
+
};
|
|
7694
|
+
}
|
|
7695
|
+
var init_merge = __esm({ "src/lib/tasks/merge.ts"() {
|
|
7696
|
+
"use strict";
|
|
7697
|
+
init_git_response_error();
|
|
7698
|
+
init_parse_merge();
|
|
7699
|
+
init_task();
|
|
7700
|
+
} });
|
|
7701
|
+
function pushResultPushedItem(local, remote, status) {
|
|
7702
|
+
const deleted = status.includes("deleted");
|
|
7703
|
+
const tag = status.includes("tag") || /^refs\/tags/.test(local);
|
|
7704
|
+
const alreadyUpdated = !status.includes("new");
|
|
7705
|
+
return {
|
|
7706
|
+
deleted,
|
|
7707
|
+
tag,
|
|
7708
|
+
branch: !tag,
|
|
7709
|
+
new: !alreadyUpdated,
|
|
7710
|
+
alreadyUpdated,
|
|
7711
|
+
local,
|
|
7712
|
+
remote
|
|
7713
|
+
};
|
|
7714
|
+
}
|
|
7715
|
+
var parsers5, parsePushResult, parsePushDetail;
|
|
7716
|
+
var init_parse_push = __esm({ "src/lib/parsers/parse-push.ts"() {
|
|
7717
|
+
"use strict";
|
|
7718
|
+
init_utils();
|
|
7719
|
+
init_parse_remote_messages();
|
|
7720
|
+
parsers5 = [
|
|
7721
|
+
new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {
|
|
7722
|
+
result.repo = repo;
|
|
7723
|
+
}),
|
|
7724
|
+
new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
|
|
7725
|
+
result.ref = {
|
|
7726
|
+
...result.ref || {},
|
|
7727
|
+
local
|
|
7728
|
+
};
|
|
7729
|
+
}),
|
|
7730
|
+
new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
|
|
7731
|
+
result.pushed.push(pushResultPushedItem(local, remote, type));
|
|
7732
|
+
}),
|
|
7733
|
+
new LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => {
|
|
7734
|
+
result.branch = {
|
|
7735
|
+
...result.branch || {},
|
|
7736
|
+
local,
|
|
7737
|
+
remote,
|
|
7738
|
+
remoteName
|
|
7739
|
+
};
|
|
7740
|
+
}),
|
|
7741
|
+
new LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => {
|
|
7742
|
+
result.update = {
|
|
7743
|
+
head: {
|
|
7744
|
+
local,
|
|
7745
|
+
remote
|
|
7746
|
+
},
|
|
7747
|
+
hash: {
|
|
7748
|
+
from,
|
|
7749
|
+
to
|
|
7750
|
+
}
|
|
7751
|
+
};
|
|
7752
|
+
})
|
|
7753
|
+
];
|
|
7754
|
+
parsePushResult = (stdOut, stdErr) => {
|
|
7755
|
+
const pushDetail = parsePushDetail(stdOut, stdErr);
|
|
7756
|
+
const responseDetail = parseRemoteMessages(stdOut, stdErr);
|
|
7757
|
+
return {
|
|
7758
|
+
...pushDetail,
|
|
7759
|
+
...responseDetail
|
|
7760
|
+
};
|
|
7761
|
+
};
|
|
7762
|
+
parsePushDetail = (stdOut, stdErr) => {
|
|
7763
|
+
return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);
|
|
7764
|
+
};
|
|
7765
|
+
} });
|
|
7766
|
+
var push_exports = {};
|
|
7767
|
+
__export(push_exports, {
|
|
7768
|
+
pushTagsTask: () => pushTagsTask,
|
|
7769
|
+
pushTask: () => pushTask
|
|
7770
|
+
});
|
|
7771
|
+
function pushTagsTask(ref = {}, customArgs) {
|
|
7772
|
+
append(customArgs, "--tags");
|
|
7773
|
+
return pushTask(ref, customArgs);
|
|
7774
|
+
}
|
|
7775
|
+
function pushTask(ref = {}, customArgs) {
|
|
7776
|
+
const commands = ["push", ...customArgs];
|
|
7777
|
+
if (ref.branch) commands.splice(1, 0, ref.branch);
|
|
7778
|
+
if (ref.remote) commands.splice(1, 0, ref.remote);
|
|
7779
|
+
remove(commands, "-v");
|
|
7780
|
+
append(commands, "--verbose");
|
|
7781
|
+
append(commands, "--porcelain");
|
|
7782
|
+
return {
|
|
7783
|
+
commands,
|
|
7784
|
+
format: "utf-8",
|
|
7785
|
+
parser: parsePushResult
|
|
7786
|
+
};
|
|
7787
|
+
}
|
|
7788
|
+
var init_push = __esm({ "src/lib/tasks/push.ts"() {
|
|
7789
|
+
"use strict";
|
|
7790
|
+
init_parse_push();
|
|
7791
|
+
init_utils();
|
|
7792
|
+
} });
|
|
7793
|
+
function show_default() {
|
|
7794
|
+
return {
|
|
7795
|
+
showBuffer() {
|
|
7796
|
+
const commands = ["show", ...getTrailingOptions(arguments, 1)];
|
|
7797
|
+
if (!commands.includes("--binary")) commands.splice(1, 0, "--binary");
|
|
7798
|
+
return this._runTask(straightThroughBufferTask(commands), trailingFunctionArgument(arguments));
|
|
7799
|
+
},
|
|
7800
|
+
show() {
|
|
7801
|
+
const commands = ["show", ...getTrailingOptions(arguments, 1)];
|
|
7802
|
+
return this._runTask(straightThroughStringTask(commands), trailingFunctionArgument(arguments));
|
|
7803
|
+
}
|
|
7804
|
+
};
|
|
7805
|
+
}
|
|
7806
|
+
var init_show = __esm({ "src/lib/tasks/show.ts"() {
|
|
7807
|
+
"use strict";
|
|
7808
|
+
init_utils();
|
|
7809
|
+
init_task();
|
|
7810
|
+
} });
|
|
7811
|
+
var fromPathRegex, FileStatusSummary;
|
|
7812
|
+
var init_FileStatusSummary = __esm({ "src/lib/responses/FileStatusSummary.ts"() {
|
|
7813
|
+
"use strict";
|
|
7814
|
+
fromPathRegex = /^(.+)\0(.+)$/;
|
|
7815
|
+
FileStatusSummary = class {
|
|
7816
|
+
constructor(path, index, working_dir) {
|
|
7817
|
+
this.path = path;
|
|
7818
|
+
this.index = index;
|
|
7819
|
+
this.working_dir = working_dir;
|
|
7820
|
+
if (index === "R" || working_dir === "R") {
|
|
7821
|
+
const detail = fromPathRegex.exec(path) || [
|
|
7822
|
+
null,
|
|
7823
|
+
path,
|
|
7824
|
+
path
|
|
7825
|
+
];
|
|
7826
|
+
this.from = detail[2] || "";
|
|
7827
|
+
this.path = detail[1] || "";
|
|
7828
|
+
}
|
|
7829
|
+
}
|
|
7830
|
+
};
|
|
7831
|
+
} });
|
|
7832
|
+
function renamedFile(line) {
|
|
7833
|
+
const [to, from] = line.split(NULL);
|
|
7834
|
+
return {
|
|
7835
|
+
from: from || to,
|
|
7836
|
+
to
|
|
7837
|
+
};
|
|
7838
|
+
}
|
|
7839
|
+
function parser3(indexX, indexY, handler) {
|
|
7840
|
+
return [`${indexX}${indexY}`, handler];
|
|
7841
|
+
}
|
|
7842
|
+
function conflicts(indexX, ...indexY) {
|
|
7843
|
+
return indexY.map((y) => parser3(indexX, y, (result, file) => append(result.conflicted, file)));
|
|
7844
|
+
}
|
|
7845
|
+
function splitLine(result, lineStr) {
|
|
7846
|
+
const trimmed2 = lineStr.trim();
|
|
7847
|
+
switch (" ") {
|
|
7848
|
+
case trimmed2.charAt(2): return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.substr(3));
|
|
7849
|
+
case trimmed2.charAt(1): return data(" ", trimmed2.charAt(0), trimmed2.substr(2));
|
|
7850
|
+
default: return;
|
|
7851
|
+
}
|
|
7852
|
+
function data(index, workingDir, path) {
|
|
7853
|
+
const raw = `${index}${workingDir}`;
|
|
7854
|
+
const handler = parsers6.get(raw);
|
|
7855
|
+
if (handler) handler(result, path);
|
|
7856
|
+
if (raw !== "##" && raw !== "!!") result.files.push(new FileStatusSummary(path, index, workingDir));
|
|
7857
|
+
}
|
|
7858
|
+
}
|
|
7859
|
+
var StatusSummary, parsers6, parseStatusSummary;
|
|
7860
|
+
var init_StatusSummary = __esm({ "src/lib/responses/StatusSummary.ts"() {
|
|
7861
|
+
"use strict";
|
|
7862
|
+
init_utils();
|
|
7863
|
+
init_FileStatusSummary();
|
|
7864
|
+
StatusSummary = class {
|
|
7865
|
+
constructor() {
|
|
7866
|
+
this.not_added = [];
|
|
7867
|
+
this.conflicted = [];
|
|
7868
|
+
this.created = [];
|
|
7869
|
+
this.deleted = [];
|
|
7870
|
+
this.ignored = void 0;
|
|
7871
|
+
this.modified = [];
|
|
7872
|
+
this.renamed = [];
|
|
7873
|
+
this.files = [];
|
|
7874
|
+
this.staged = [];
|
|
7875
|
+
this.ahead = 0;
|
|
7876
|
+
this.behind = 0;
|
|
7877
|
+
this.current = null;
|
|
7878
|
+
this.tracking = null;
|
|
7879
|
+
this.detached = false;
|
|
7880
|
+
this.isClean = () => {
|
|
7881
|
+
return !this.files.length;
|
|
7882
|
+
};
|
|
7883
|
+
}
|
|
7884
|
+
};
|
|
7885
|
+
parsers6 = new Map([
|
|
7886
|
+
parser3(" ", "A", (result, file) => append(result.created, file)),
|
|
7887
|
+
parser3(" ", "D", (result, file) => append(result.deleted, file)),
|
|
7888
|
+
parser3(" ", "M", (result, file) => append(result.modified, file)),
|
|
7889
|
+
parser3("A", " ", (result, file) => append(result.created, file) && append(result.staged, file)),
|
|
7890
|
+
parser3("A", "M", (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)),
|
|
7891
|
+
parser3("D", " ", (result, file) => append(result.deleted, file) && append(result.staged, file)),
|
|
7892
|
+
parser3("M", " ", (result, file) => append(result.modified, file) && append(result.staged, file)),
|
|
7893
|
+
parser3("M", "M", (result, file) => append(result.modified, file) && append(result.staged, file)),
|
|
7894
|
+
parser3("R", " ", (result, file) => {
|
|
7895
|
+
append(result.renamed, renamedFile(file));
|
|
7896
|
+
}),
|
|
7897
|
+
parser3("R", "M", (result, file) => {
|
|
7898
|
+
const renamed = renamedFile(file);
|
|
7899
|
+
append(result.renamed, renamed);
|
|
7900
|
+
append(result.modified, renamed.to);
|
|
7901
|
+
}),
|
|
7902
|
+
parser3("!", "!", (_result, _file) => {
|
|
7903
|
+
append(_result.ignored = _result.ignored || [], _file);
|
|
7904
|
+
}),
|
|
7905
|
+
parser3("?", "?", (result, file) => append(result.not_added, file)),
|
|
7906
|
+
...conflicts("A", "A", "U"),
|
|
7907
|
+
...conflicts("D", "D", "U"),
|
|
7908
|
+
...conflicts("U", "A", "D", "U"),
|
|
7909
|
+
["##", (result, line) => {
|
|
7910
|
+
const aheadReg = /ahead (\d+)/;
|
|
7911
|
+
const behindReg = /behind (\d+)/;
|
|
7912
|
+
const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
|
|
7913
|
+
const trackingReg = /\.{3}(\S*)/;
|
|
7914
|
+
const onEmptyBranchReg = /\son\s(\S+?)(?=\.{3}|$)/;
|
|
7915
|
+
let regexResult = aheadReg.exec(line);
|
|
7916
|
+
result.ahead = regexResult && +regexResult[1] || 0;
|
|
7917
|
+
regexResult = behindReg.exec(line);
|
|
7918
|
+
result.behind = regexResult && +regexResult[1] || 0;
|
|
7919
|
+
regexResult = currentReg.exec(line);
|
|
7920
|
+
result.current = filterType(regexResult?.[1], filterString, null);
|
|
7921
|
+
regexResult = trackingReg.exec(line);
|
|
7922
|
+
result.tracking = filterType(regexResult?.[1], filterString, null);
|
|
7923
|
+
regexResult = onEmptyBranchReg.exec(line);
|
|
7924
|
+
if (regexResult) result.current = filterType(regexResult?.[1], filterString, result.current);
|
|
7925
|
+
result.detached = /\(no branch\)/.test(line);
|
|
7926
|
+
}]
|
|
7927
|
+
]);
|
|
7928
|
+
parseStatusSummary = function(text) {
|
|
7929
|
+
const lines = text.split(NULL);
|
|
7930
|
+
const status = new StatusSummary();
|
|
7931
|
+
for (let i = 0, l = lines.length; i < l;) {
|
|
7932
|
+
let line = lines[i++].trim();
|
|
7933
|
+
if (!line) continue;
|
|
7934
|
+
if (line.charAt(0) === "R") line += NULL + (lines[i++] || "");
|
|
7935
|
+
splitLine(status, line);
|
|
7936
|
+
}
|
|
7937
|
+
return status;
|
|
7938
|
+
};
|
|
7939
|
+
} });
|
|
7940
|
+
function statusTask(customArgs) {
|
|
7941
|
+
return {
|
|
7942
|
+
format: "utf-8",
|
|
7943
|
+
commands: [
|
|
7944
|
+
"status",
|
|
7945
|
+
"--porcelain",
|
|
7946
|
+
"-b",
|
|
7947
|
+
"-u",
|
|
7948
|
+
"--null",
|
|
7949
|
+
...customArgs.filter((arg) => !ignoredOptions.includes(arg))
|
|
7950
|
+
],
|
|
7951
|
+
parser(text) {
|
|
7952
|
+
return parseStatusSummary(text);
|
|
7953
|
+
}
|
|
7954
|
+
};
|
|
7955
|
+
}
|
|
7956
|
+
var ignoredOptions;
|
|
7957
|
+
var init_status = __esm({ "src/lib/tasks/status.ts"() {
|
|
7958
|
+
"use strict";
|
|
7959
|
+
init_StatusSummary();
|
|
7960
|
+
ignoredOptions = ["--null", "-z"];
|
|
7961
|
+
} });
|
|
7962
|
+
function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) {
|
|
7963
|
+
return Object.defineProperty({
|
|
7964
|
+
major,
|
|
7965
|
+
minor,
|
|
7966
|
+
patch,
|
|
7967
|
+
agent,
|
|
7968
|
+
installed
|
|
7969
|
+
}, "toString", {
|
|
7970
|
+
value() {
|
|
7971
|
+
return `${this.major}.${this.minor}.${this.patch}`;
|
|
7972
|
+
},
|
|
7973
|
+
configurable: false,
|
|
7974
|
+
enumerable: false
|
|
7975
|
+
});
|
|
7976
|
+
}
|
|
7977
|
+
function notInstalledResponse() {
|
|
7978
|
+
return versionResponse(0, 0, 0, "", false);
|
|
7979
|
+
}
|
|
7980
|
+
function version_default() {
|
|
7981
|
+
return { version() {
|
|
7982
|
+
return this._runTask({
|
|
7983
|
+
commands: ["--version"],
|
|
7984
|
+
format: "utf-8",
|
|
7985
|
+
parser: versionParser,
|
|
7986
|
+
onError(result, error, done, fail) {
|
|
7987
|
+
if (result.exitCode === -2) return done(Buffer.from(NOT_INSTALLED));
|
|
7988
|
+
fail(error);
|
|
7989
|
+
}
|
|
7990
|
+
});
|
|
7991
|
+
} };
|
|
7992
|
+
}
|
|
7993
|
+
function versionParser(stdOut) {
|
|
7994
|
+
if (stdOut === NOT_INSTALLED) return notInstalledResponse();
|
|
7995
|
+
return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut);
|
|
7996
|
+
}
|
|
7997
|
+
var NOT_INSTALLED, parsers7;
|
|
7998
|
+
var init_version = __esm({ "src/lib/tasks/version.ts"() {
|
|
7999
|
+
"use strict";
|
|
8000
|
+
init_utils();
|
|
8001
|
+
NOT_INSTALLED = "installed=false";
|
|
8002
|
+
parsers7 = [new LineParser(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/, (result, [major, minor, patch, agent = ""]) => {
|
|
8003
|
+
Object.assign(result, versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent));
|
|
8004
|
+
}), new LineParser(/version (\d+)\.(\d+)\.(\D+)(.+)?$/, (result, [major, minor, patch, agent = ""]) => {
|
|
8005
|
+
Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));
|
|
8006
|
+
})];
|
|
8007
|
+
} });
|
|
8008
|
+
var simple_git_api_exports = {};
|
|
8009
|
+
__export(simple_git_api_exports, { SimpleGitApi: () => SimpleGitApi });
|
|
8010
|
+
var SimpleGitApi;
|
|
8011
|
+
var init_simple_git_api = __esm({ "src/lib/simple-git-api.ts"() {
|
|
8012
|
+
"use strict";
|
|
8013
|
+
init_task_callback();
|
|
8014
|
+
init_change_working_directory();
|
|
8015
|
+
init_checkout();
|
|
8016
|
+
init_count_objects();
|
|
8017
|
+
init_commit();
|
|
8018
|
+
init_config();
|
|
8019
|
+
init_first_commit();
|
|
8020
|
+
init_grep();
|
|
8021
|
+
init_hash_object();
|
|
8022
|
+
init_init();
|
|
8023
|
+
init_log();
|
|
8024
|
+
init_merge();
|
|
8025
|
+
init_push();
|
|
8026
|
+
init_show();
|
|
8027
|
+
init_status();
|
|
8028
|
+
init_task();
|
|
8029
|
+
init_version();
|
|
8030
|
+
init_utils();
|
|
8031
|
+
SimpleGitApi = class {
|
|
8032
|
+
constructor(_executor) {
|
|
8033
|
+
this._executor = _executor;
|
|
8034
|
+
}
|
|
8035
|
+
_runTask(task, then) {
|
|
8036
|
+
const chain = this._executor.chain();
|
|
8037
|
+
const promise = chain.push(task);
|
|
8038
|
+
if (then) taskCallback(task, promise, then);
|
|
8039
|
+
return Object.create(this, {
|
|
8040
|
+
then: { value: promise.then.bind(promise) },
|
|
8041
|
+
catch: { value: promise.catch.bind(promise) },
|
|
8042
|
+
_executor: { value: chain }
|
|
8043
|
+
});
|
|
8044
|
+
}
|
|
8045
|
+
add(files) {
|
|
8046
|
+
return this._runTask(straightThroughStringTask(["add", ...asArray(files)]), trailingFunctionArgument(arguments));
|
|
8047
|
+
}
|
|
8048
|
+
cwd(directory) {
|
|
8049
|
+
const next = trailingFunctionArgument(arguments);
|
|
8050
|
+
if (typeof directory === "string") return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
|
|
8051
|
+
if (typeof directory?.path === "string") return this._runTask(changeWorkingDirectoryTask(directory.path, directory.root && this._executor || void 0), next);
|
|
8052
|
+
return this._runTask(configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"), next);
|
|
8053
|
+
}
|
|
8054
|
+
hashObject(path, write) {
|
|
8055
|
+
return this._runTask(hashObjectTask(path, write === true), trailingFunctionArgument(arguments));
|
|
8056
|
+
}
|
|
8057
|
+
init(bare) {
|
|
8058
|
+
return this._runTask(initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
|
|
8059
|
+
}
|
|
8060
|
+
merge() {
|
|
8061
|
+
return this._runTask(mergeTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
|
|
8062
|
+
}
|
|
8063
|
+
mergeFromTo(remote, branch) {
|
|
8064
|
+
if (!(filterString(remote) && filterString(branch))) return this._runTask(configurationErrorTask(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`));
|
|
8065
|
+
return this._runTask(mergeTask([
|
|
8066
|
+
remote,
|
|
8067
|
+
branch,
|
|
8068
|
+
...getTrailingOptions(arguments)
|
|
8069
|
+
]), trailingFunctionArgument(arguments, false));
|
|
8070
|
+
}
|
|
8071
|
+
outputHandler(handler) {
|
|
8072
|
+
this._executor.outputHandler = handler;
|
|
8073
|
+
return this;
|
|
8074
|
+
}
|
|
8075
|
+
push() {
|
|
8076
|
+
const task = pushTask({
|
|
8077
|
+
remote: filterType(arguments[0], filterString),
|
|
8078
|
+
branch: filterType(arguments[1], filterString)
|
|
8079
|
+
}, getTrailingOptions(arguments));
|
|
8080
|
+
return this._runTask(task, trailingFunctionArgument(arguments));
|
|
8081
|
+
}
|
|
8082
|
+
stash() {
|
|
8083
|
+
return this._runTask(straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]), trailingFunctionArgument(arguments));
|
|
8084
|
+
}
|
|
8085
|
+
status() {
|
|
8086
|
+
return this._runTask(statusTask(getTrailingOptions(arguments)), trailingFunctionArgument(arguments));
|
|
8087
|
+
}
|
|
8088
|
+
};
|
|
8089
|
+
Object.assign(SimpleGitApi.prototype, checkout_default(), commit_default(), config_default(), count_objects_default(), first_commit_default(), grep_default(), log_default(), show_default(), version_default());
|
|
8090
|
+
} });
|
|
8091
|
+
var scheduler_exports = {};
|
|
8092
|
+
__export(scheduler_exports, { Scheduler: () => Scheduler });
|
|
8093
|
+
var createScheduledTask, Scheduler;
|
|
8094
|
+
var init_scheduler = __esm({ "src/lib/runners/scheduler.ts"() {
|
|
8095
|
+
"use strict";
|
|
8096
|
+
init_utils();
|
|
8097
|
+
init_git_logger();
|
|
8098
|
+
createScheduledTask = /* @__PURE__ */ (() => {
|
|
8099
|
+
let id = 0;
|
|
8100
|
+
return () => {
|
|
8101
|
+
id++;
|
|
8102
|
+
const { promise, done } = (0, import_dist$1.createDeferred)();
|
|
8103
|
+
return {
|
|
8104
|
+
promise,
|
|
8105
|
+
done,
|
|
8106
|
+
id
|
|
8107
|
+
};
|
|
8108
|
+
};
|
|
8109
|
+
})();
|
|
8110
|
+
Scheduler = class {
|
|
8111
|
+
constructor(concurrency = 2) {
|
|
8112
|
+
this.concurrency = concurrency;
|
|
8113
|
+
this.logger = createLogger("", "scheduler");
|
|
8114
|
+
this.pending = [];
|
|
8115
|
+
this.running = [];
|
|
8116
|
+
this.logger(`Constructed, concurrency=%s`, concurrency);
|
|
8117
|
+
}
|
|
8118
|
+
schedule() {
|
|
8119
|
+
if (!this.pending.length || this.running.length >= this.concurrency) {
|
|
8120
|
+
this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`, this.pending.length, this.running.length, this.concurrency);
|
|
8121
|
+
return;
|
|
8122
|
+
}
|
|
8123
|
+
const task = append(this.running, this.pending.shift());
|
|
8124
|
+
this.logger(`Attempting id=%s`, task.id);
|
|
8125
|
+
task.done(() => {
|
|
8126
|
+
this.logger(`Completing id=`, task.id);
|
|
8127
|
+
remove(this.running, task);
|
|
8128
|
+
this.schedule();
|
|
8129
|
+
});
|
|
8130
|
+
}
|
|
8131
|
+
next() {
|
|
8132
|
+
const { promise, id } = append(this.pending, createScheduledTask());
|
|
8133
|
+
this.logger(`Scheduling id=%s`, id);
|
|
8134
|
+
this.schedule();
|
|
8135
|
+
return promise;
|
|
8136
|
+
}
|
|
8137
|
+
};
|
|
8138
|
+
} });
|
|
8139
|
+
var apply_patch_exports = {};
|
|
8140
|
+
__export(apply_patch_exports, { applyPatchTask: () => applyPatchTask });
|
|
8141
|
+
function applyPatchTask(patches, customArgs) {
|
|
8142
|
+
return straightThroughStringTask([
|
|
8143
|
+
"apply",
|
|
8144
|
+
...customArgs,
|
|
8145
|
+
...patches
|
|
8146
|
+
]);
|
|
8147
|
+
}
|
|
8148
|
+
var init_apply_patch = __esm({ "src/lib/tasks/apply-patch.ts"() {
|
|
8149
|
+
"use strict";
|
|
8150
|
+
init_task();
|
|
8151
|
+
} });
|
|
8152
|
+
function branchDeletionSuccess(branch, hash) {
|
|
8153
|
+
return {
|
|
8154
|
+
branch,
|
|
8155
|
+
hash,
|
|
8156
|
+
success: true
|
|
8157
|
+
};
|
|
8158
|
+
}
|
|
8159
|
+
function branchDeletionFailure(branch) {
|
|
8160
|
+
return {
|
|
8161
|
+
branch,
|
|
8162
|
+
hash: null,
|
|
8163
|
+
success: false
|
|
8164
|
+
};
|
|
8165
|
+
}
|
|
8166
|
+
var BranchDeletionBatch;
|
|
8167
|
+
var init_BranchDeleteSummary = __esm({ "src/lib/responses/BranchDeleteSummary.ts"() {
|
|
8168
|
+
"use strict";
|
|
8169
|
+
BranchDeletionBatch = class {
|
|
8170
|
+
constructor() {
|
|
8171
|
+
this.all = [];
|
|
8172
|
+
this.branches = {};
|
|
8173
|
+
this.errors = [];
|
|
8174
|
+
}
|
|
8175
|
+
get success() {
|
|
8176
|
+
return !this.errors.length;
|
|
8177
|
+
}
|
|
8178
|
+
};
|
|
8179
|
+
} });
|
|
8180
|
+
function hasBranchDeletionError(data, processExitCode) {
|
|
8181
|
+
return processExitCode === 1 && deleteErrorRegex.test(data);
|
|
8182
|
+
}
|
|
8183
|
+
var deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions;
|
|
8184
|
+
var init_parse_branch_delete = __esm({ "src/lib/parsers/parse-branch-delete.ts"() {
|
|
8185
|
+
"use strict";
|
|
8186
|
+
init_BranchDeleteSummary();
|
|
8187
|
+
init_utils();
|
|
8188
|
+
deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
|
|
8189
|
+
deleteErrorRegex = /^error[^']+'([^']+)'/m;
|
|
8190
|
+
parsers8 = [new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {
|
|
8191
|
+
const deletion = branchDeletionSuccess(branch, hash);
|
|
8192
|
+
result.all.push(deletion);
|
|
8193
|
+
result.branches[branch] = deletion;
|
|
8194
|
+
}), new LineParser(deleteErrorRegex, (result, [branch]) => {
|
|
8195
|
+
const deletion = branchDeletionFailure(branch);
|
|
8196
|
+
result.errors.push(deletion);
|
|
8197
|
+
result.all.push(deletion);
|
|
8198
|
+
result.branches[branch] = deletion;
|
|
8199
|
+
})];
|
|
8200
|
+
parseBranchDeletions = (stdOut, stdErr) => {
|
|
8201
|
+
return parseStringResponse(new BranchDeletionBatch(), parsers8, [stdOut, stdErr]);
|
|
8202
|
+
};
|
|
8203
|
+
} });
|
|
8204
|
+
var BranchSummaryResult;
|
|
8205
|
+
var init_BranchSummary = __esm({ "src/lib/responses/BranchSummary.ts"() {
|
|
8206
|
+
"use strict";
|
|
8207
|
+
BranchSummaryResult = class {
|
|
8208
|
+
constructor() {
|
|
8209
|
+
this.all = [];
|
|
8210
|
+
this.branches = {};
|
|
8211
|
+
this.current = "";
|
|
8212
|
+
this.detached = false;
|
|
8213
|
+
}
|
|
8214
|
+
push(status, detached, name, commit, label) {
|
|
8215
|
+
if (status === "*") {
|
|
8216
|
+
this.detached = detached;
|
|
8217
|
+
this.current = name;
|
|
8218
|
+
}
|
|
8219
|
+
this.all.push(name);
|
|
8220
|
+
this.branches[name] = {
|
|
8221
|
+
current: status === "*",
|
|
8222
|
+
linkedWorkTree: status === "+",
|
|
8223
|
+
name,
|
|
8224
|
+
commit,
|
|
8225
|
+
label
|
|
8226
|
+
};
|
|
8227
|
+
}
|
|
8228
|
+
};
|
|
8229
|
+
} });
|
|
8230
|
+
function branchStatus(input) {
|
|
8231
|
+
return input ? input.charAt(0) : "";
|
|
8232
|
+
}
|
|
8233
|
+
function parseBranchSummary(stdOut, currentOnly = false) {
|
|
8234
|
+
return parseStringResponse(new BranchSummaryResult(), currentOnly ? [currentBranchParser] : parsers9, stdOut);
|
|
8235
|
+
}
|
|
8236
|
+
var parsers9, currentBranchParser;
|
|
8237
|
+
var init_parse_branch = __esm({ "src/lib/parsers/parse-branch.ts"() {
|
|
8238
|
+
"use strict";
|
|
8239
|
+
init_BranchSummary();
|
|
8240
|
+
init_utils();
|
|
8241
|
+
parsers9 = [new LineParser(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
|
|
8242
|
+
result.push(branchStatus(current), true, name, commit, label);
|
|
8243
|
+
}), new LineParser(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s, (result, [current, name, commit, label]) => {
|
|
8244
|
+
result.push(branchStatus(current), false, name, commit, label);
|
|
8245
|
+
})];
|
|
8246
|
+
currentBranchParser = new LineParser(/^(\S+)$/s, (result, [name]) => {
|
|
8247
|
+
result.push("*", false, name, "", "");
|
|
8248
|
+
});
|
|
8249
|
+
} });
|
|
8250
|
+
var branch_exports = {};
|
|
8251
|
+
__export(branch_exports, {
|
|
8252
|
+
branchLocalTask: () => branchLocalTask,
|
|
8253
|
+
branchTask: () => branchTask,
|
|
8254
|
+
containsDeleteBranchCommand: () => containsDeleteBranchCommand,
|
|
8255
|
+
deleteBranchTask: () => deleteBranchTask,
|
|
8256
|
+
deleteBranchesTask: () => deleteBranchesTask
|
|
8257
|
+
});
|
|
8258
|
+
function containsDeleteBranchCommand(commands) {
|
|
8259
|
+
const deleteCommands = [
|
|
8260
|
+
"-d",
|
|
8261
|
+
"-D",
|
|
8262
|
+
"--delete"
|
|
8263
|
+
];
|
|
8264
|
+
return commands.some((command) => deleteCommands.includes(command));
|
|
8265
|
+
}
|
|
8266
|
+
function branchTask(customArgs) {
|
|
8267
|
+
const isDelete = containsDeleteBranchCommand(customArgs);
|
|
8268
|
+
const isCurrentOnly = customArgs.includes("--show-current");
|
|
8269
|
+
const commands = ["branch", ...customArgs];
|
|
8270
|
+
if (commands.length === 1) commands.push("-a");
|
|
8271
|
+
if (!commands.includes("-v")) commands.splice(1, 0, "-v");
|
|
8272
|
+
return {
|
|
8273
|
+
format: "utf-8",
|
|
8274
|
+
commands,
|
|
8275
|
+
parser(stdOut, stdErr) {
|
|
8276
|
+
if (isDelete) return parseBranchDeletions(stdOut, stdErr).all[0];
|
|
8277
|
+
return parseBranchSummary(stdOut, isCurrentOnly);
|
|
8278
|
+
}
|
|
8279
|
+
};
|
|
8280
|
+
}
|
|
8281
|
+
function branchLocalTask() {
|
|
8282
|
+
return {
|
|
8283
|
+
format: "utf-8",
|
|
8284
|
+
commands: ["branch", "-v"],
|
|
8285
|
+
parser(stdOut) {
|
|
8286
|
+
return parseBranchSummary(stdOut);
|
|
8287
|
+
}
|
|
8288
|
+
};
|
|
8289
|
+
}
|
|
8290
|
+
function deleteBranchesTask(branches, forceDelete = false) {
|
|
8291
|
+
return {
|
|
8292
|
+
format: "utf-8",
|
|
8293
|
+
commands: [
|
|
8294
|
+
"branch",
|
|
8295
|
+
"-v",
|
|
8296
|
+
forceDelete ? "-D" : "-d",
|
|
8297
|
+
...branches
|
|
8298
|
+
],
|
|
8299
|
+
parser(stdOut, stdErr) {
|
|
8300
|
+
return parseBranchDeletions(stdOut, stdErr);
|
|
8301
|
+
},
|
|
8302
|
+
onError({ exitCode, stdOut }, error, done, fail) {
|
|
8303
|
+
if (!hasBranchDeletionError(String(error), exitCode)) return fail(error);
|
|
8304
|
+
done(stdOut);
|
|
8305
|
+
}
|
|
8306
|
+
};
|
|
8307
|
+
}
|
|
8308
|
+
function deleteBranchTask(branch, forceDelete = false) {
|
|
8309
|
+
const task = {
|
|
8310
|
+
format: "utf-8",
|
|
8311
|
+
commands: [
|
|
8312
|
+
"branch",
|
|
8313
|
+
"-v",
|
|
8314
|
+
forceDelete ? "-D" : "-d",
|
|
8315
|
+
branch
|
|
8316
|
+
],
|
|
8317
|
+
parser(stdOut, stdErr) {
|
|
8318
|
+
return parseBranchDeletions(stdOut, stdErr).branches[branch];
|
|
8319
|
+
},
|
|
8320
|
+
onError({ exitCode, stdErr, stdOut }, error, _, fail) {
|
|
8321
|
+
if (!hasBranchDeletionError(String(error), exitCode)) return fail(error);
|
|
8322
|
+
throw new GitResponseError(task.parser(bufferToString(stdOut), bufferToString(stdErr)), String(error));
|
|
8323
|
+
}
|
|
8324
|
+
};
|
|
8325
|
+
return task;
|
|
8326
|
+
}
|
|
8327
|
+
var init_branch = __esm({ "src/lib/tasks/branch.ts"() {
|
|
8328
|
+
"use strict";
|
|
8329
|
+
init_git_response_error();
|
|
8330
|
+
init_parse_branch_delete();
|
|
8331
|
+
init_parse_branch();
|
|
8332
|
+
init_utils();
|
|
8333
|
+
} });
|
|
8334
|
+
function toPath(input) {
|
|
8335
|
+
const path = input.trim().replace(/^["']|["']$/g, "");
|
|
8336
|
+
return path && normalize(path);
|
|
8337
|
+
}
|
|
8338
|
+
var parseCheckIgnore;
|
|
8339
|
+
var init_CheckIgnore = __esm({ "src/lib/responses/CheckIgnore.ts"() {
|
|
8340
|
+
"use strict";
|
|
8341
|
+
parseCheckIgnore = (text) => {
|
|
8342
|
+
return text.split(/\n/g).map(toPath).filter(Boolean);
|
|
8343
|
+
};
|
|
8344
|
+
} });
|
|
8345
|
+
var check_ignore_exports = {};
|
|
8346
|
+
__export(check_ignore_exports, { checkIgnoreTask: () => checkIgnoreTask });
|
|
8347
|
+
function checkIgnoreTask(paths) {
|
|
8348
|
+
return {
|
|
8349
|
+
commands: ["check-ignore", ...paths],
|
|
8350
|
+
format: "utf-8",
|
|
8351
|
+
parser: parseCheckIgnore
|
|
8352
|
+
};
|
|
8353
|
+
}
|
|
8354
|
+
var init_check_ignore = __esm({ "src/lib/tasks/check-ignore.ts"() {
|
|
8355
|
+
"use strict";
|
|
8356
|
+
init_CheckIgnore();
|
|
8357
|
+
} });
|
|
8358
|
+
var clone_exports = {};
|
|
8359
|
+
__export(clone_exports, {
|
|
8360
|
+
cloneMirrorTask: () => cloneMirrorTask,
|
|
8361
|
+
cloneTask: () => cloneTask
|
|
8362
|
+
});
|
|
8363
|
+
function disallowedCommand(command) {
|
|
8364
|
+
return /^--upload-pack(=|$)/.test(command);
|
|
8365
|
+
}
|
|
8366
|
+
function cloneTask(repo, directory, customArgs) {
|
|
8367
|
+
const commands = ["clone", ...customArgs];
|
|
8368
|
+
filterString(repo) && commands.push(repo);
|
|
8369
|
+
filterString(directory) && commands.push(directory);
|
|
8370
|
+
if (commands.find(disallowedCommand)) return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
|
|
8371
|
+
return straightThroughStringTask(commands);
|
|
8372
|
+
}
|
|
8373
|
+
function cloneMirrorTask(repo, directory, customArgs) {
|
|
8374
|
+
append(customArgs, "--mirror");
|
|
8375
|
+
return cloneTask(repo, directory, customArgs);
|
|
8376
|
+
}
|
|
8377
|
+
var init_clone = __esm({ "src/lib/tasks/clone.ts"() {
|
|
8378
|
+
"use strict";
|
|
8379
|
+
init_task();
|
|
8380
|
+
init_utils();
|
|
8381
|
+
} });
|
|
8382
|
+
function parseFetchResult(stdOut, stdErr) {
|
|
8383
|
+
return parseStringResponse({
|
|
8384
|
+
raw: stdOut,
|
|
8385
|
+
remote: null,
|
|
8386
|
+
branches: [],
|
|
8387
|
+
tags: [],
|
|
8388
|
+
updated: [],
|
|
8389
|
+
deleted: []
|
|
8390
|
+
}, parsers10, [stdOut, stdErr]);
|
|
8391
|
+
}
|
|
8392
|
+
var parsers10;
|
|
8393
|
+
var init_parse_fetch = __esm({ "src/lib/parsers/parse-fetch.ts"() {
|
|
8394
|
+
"use strict";
|
|
8395
|
+
init_utils();
|
|
8396
|
+
parsers10 = [
|
|
8397
|
+
new LineParser(/From (.+)$/, (result, [remote]) => {
|
|
8398
|
+
result.remote = remote;
|
|
8399
|
+
}),
|
|
8400
|
+
new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
|
|
8401
|
+
result.branches.push({
|
|
8402
|
+
name,
|
|
8403
|
+
tracking
|
|
8404
|
+
});
|
|
8405
|
+
}),
|
|
8406
|
+
new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
|
|
8407
|
+
result.tags.push({
|
|
8408
|
+
name,
|
|
8409
|
+
tracking
|
|
8410
|
+
});
|
|
8411
|
+
}),
|
|
8412
|
+
new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/, (result, [tracking]) => {
|
|
8413
|
+
result.deleted.push({ tracking });
|
|
8414
|
+
}),
|
|
8415
|
+
new LineParser(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/, (result, [from, to, name, tracking]) => {
|
|
8416
|
+
result.updated.push({
|
|
8417
|
+
name,
|
|
8418
|
+
tracking,
|
|
8419
|
+
to,
|
|
8420
|
+
from
|
|
8421
|
+
});
|
|
8422
|
+
})
|
|
8423
|
+
];
|
|
8424
|
+
} });
|
|
8425
|
+
var fetch_exports = {};
|
|
8426
|
+
__export(fetch_exports, { fetchTask: () => fetchTask });
|
|
8427
|
+
function disallowedCommand2(command) {
|
|
8428
|
+
return /^--upload-pack(=|$)/.test(command);
|
|
8429
|
+
}
|
|
8430
|
+
function fetchTask(remote, branch, customArgs) {
|
|
8431
|
+
const commands = ["fetch", ...customArgs];
|
|
8432
|
+
if (remote && branch) commands.push(remote, branch);
|
|
8433
|
+
if (commands.find(disallowedCommand2)) return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
|
|
8434
|
+
return {
|
|
8435
|
+
commands,
|
|
8436
|
+
format: "utf-8",
|
|
8437
|
+
parser: parseFetchResult
|
|
8438
|
+
};
|
|
8439
|
+
}
|
|
8440
|
+
var init_fetch = __esm({ "src/lib/tasks/fetch.ts"() {
|
|
8441
|
+
"use strict";
|
|
8442
|
+
init_parse_fetch();
|
|
8443
|
+
init_task();
|
|
8444
|
+
} });
|
|
8445
|
+
function parseMoveResult(stdOut) {
|
|
8446
|
+
return parseStringResponse({ moves: [] }, parsers11, stdOut);
|
|
8447
|
+
}
|
|
8448
|
+
var parsers11;
|
|
8449
|
+
var init_parse_move = __esm({ "src/lib/parsers/parse-move.ts"() {
|
|
8450
|
+
"use strict";
|
|
8451
|
+
init_utils();
|
|
8452
|
+
parsers11 = [new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
|
|
8453
|
+
result.moves.push({
|
|
8454
|
+
from,
|
|
8455
|
+
to
|
|
8456
|
+
});
|
|
8457
|
+
})];
|
|
8458
|
+
} });
|
|
8459
|
+
var move_exports = {};
|
|
8460
|
+
__export(move_exports, { moveTask: () => moveTask });
|
|
8461
|
+
function moveTask(from, to) {
|
|
8462
|
+
return {
|
|
8463
|
+
commands: [
|
|
8464
|
+
"mv",
|
|
8465
|
+
"-v",
|
|
8466
|
+
...asArray(from),
|
|
8467
|
+
to
|
|
8468
|
+
],
|
|
8469
|
+
format: "utf-8",
|
|
8470
|
+
parser: parseMoveResult
|
|
8471
|
+
};
|
|
8472
|
+
}
|
|
8473
|
+
var init_move = __esm({ "src/lib/tasks/move.ts"() {
|
|
8474
|
+
"use strict";
|
|
8475
|
+
init_parse_move();
|
|
8476
|
+
init_utils();
|
|
8477
|
+
} });
|
|
8478
|
+
var pull_exports = {};
|
|
8479
|
+
__export(pull_exports, { pullTask: () => pullTask });
|
|
8480
|
+
function pullTask(remote, branch, customArgs) {
|
|
8481
|
+
const commands = ["pull", ...customArgs];
|
|
8482
|
+
if (remote && branch) commands.splice(1, 0, remote, branch);
|
|
8483
|
+
return {
|
|
8484
|
+
commands,
|
|
8485
|
+
format: "utf-8",
|
|
8486
|
+
parser(stdOut, stdErr) {
|
|
8487
|
+
return parsePullResult(stdOut, stdErr);
|
|
8488
|
+
},
|
|
8489
|
+
onError(result, _error, _done, fail) {
|
|
8490
|
+
const pullError = parsePullErrorResult(bufferToString(result.stdOut), bufferToString(result.stdErr));
|
|
8491
|
+
if (pullError) return fail(new GitResponseError(pullError));
|
|
8492
|
+
fail(_error);
|
|
8493
|
+
}
|
|
8494
|
+
};
|
|
8495
|
+
}
|
|
8496
|
+
var init_pull = __esm({ "src/lib/tasks/pull.ts"() {
|
|
8497
|
+
"use strict";
|
|
8498
|
+
init_git_response_error();
|
|
8499
|
+
init_parse_pull();
|
|
8500
|
+
init_utils();
|
|
8501
|
+
} });
|
|
8502
|
+
function parseGetRemotes(text) {
|
|
8503
|
+
const remotes = {};
|
|
8504
|
+
forEach(text, ([name]) => remotes[name] = { name });
|
|
8505
|
+
return Object.values(remotes);
|
|
8506
|
+
}
|
|
8507
|
+
function parseGetRemotesVerbose(text) {
|
|
8508
|
+
const remotes = {};
|
|
8509
|
+
forEach(text, ([name, url, purpose]) => {
|
|
8510
|
+
if (!Object.hasOwn(remotes, name)) remotes[name] = {
|
|
8511
|
+
name,
|
|
8512
|
+
refs: {
|
|
8513
|
+
fetch: "",
|
|
8514
|
+
push: ""
|
|
8515
|
+
}
|
|
8516
|
+
};
|
|
8517
|
+
if (purpose && url) remotes[name].refs[purpose.replace(/[^a-z]/g, "")] = url;
|
|
8518
|
+
});
|
|
8519
|
+
return Object.values(remotes);
|
|
8520
|
+
}
|
|
8521
|
+
function forEach(text, handler) {
|
|
8522
|
+
forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
|
|
8523
|
+
}
|
|
8524
|
+
var init_GetRemoteSummary = __esm({ "src/lib/responses/GetRemoteSummary.ts"() {
|
|
8525
|
+
"use strict";
|
|
8526
|
+
init_utils();
|
|
8527
|
+
} });
|
|
8528
|
+
var remote_exports = {};
|
|
8529
|
+
__export(remote_exports, {
|
|
8530
|
+
addRemoteTask: () => addRemoteTask,
|
|
8531
|
+
getRemotesTask: () => getRemotesTask,
|
|
8532
|
+
listRemotesTask: () => listRemotesTask,
|
|
8533
|
+
remoteTask: () => remoteTask,
|
|
8534
|
+
removeRemoteTask: () => removeRemoteTask
|
|
8535
|
+
});
|
|
8536
|
+
function addRemoteTask(remoteName, remoteRepo, customArgs) {
|
|
8537
|
+
return straightThroughStringTask([
|
|
8538
|
+
"remote",
|
|
8539
|
+
"add",
|
|
8540
|
+
...customArgs,
|
|
8541
|
+
remoteName,
|
|
8542
|
+
remoteRepo
|
|
8543
|
+
]);
|
|
8544
|
+
}
|
|
8545
|
+
function getRemotesTask(verbose) {
|
|
8546
|
+
const commands = ["remote"];
|
|
8547
|
+
if (verbose) commands.push("-v");
|
|
8548
|
+
return {
|
|
8549
|
+
commands,
|
|
8550
|
+
format: "utf-8",
|
|
8551
|
+
parser: verbose ? parseGetRemotesVerbose : parseGetRemotes
|
|
8552
|
+
};
|
|
8553
|
+
}
|
|
8554
|
+
function listRemotesTask(customArgs) {
|
|
8555
|
+
const commands = [...customArgs];
|
|
8556
|
+
if (commands[0] !== "ls-remote") commands.unshift("ls-remote");
|
|
8557
|
+
return straightThroughStringTask(commands);
|
|
8558
|
+
}
|
|
8559
|
+
function remoteTask(customArgs) {
|
|
8560
|
+
const commands = [...customArgs];
|
|
8561
|
+
if (commands[0] !== "remote") commands.unshift("remote");
|
|
8562
|
+
return straightThroughStringTask(commands);
|
|
8563
|
+
}
|
|
8564
|
+
function removeRemoteTask(remoteName) {
|
|
8565
|
+
return straightThroughStringTask([
|
|
8566
|
+
"remote",
|
|
8567
|
+
"remove",
|
|
8568
|
+
remoteName
|
|
8569
|
+
]);
|
|
8570
|
+
}
|
|
8571
|
+
var init_remote = __esm({ "src/lib/tasks/remote.ts"() {
|
|
8572
|
+
"use strict";
|
|
8573
|
+
init_GetRemoteSummary();
|
|
8574
|
+
init_task();
|
|
8575
|
+
} });
|
|
8576
|
+
var stash_list_exports = {};
|
|
8577
|
+
__export(stash_list_exports, { stashListTask: () => stashListTask });
|
|
8578
|
+
function stashListTask(opt = {}, customArgs) {
|
|
8579
|
+
const options = parseLogOptions(opt);
|
|
8580
|
+
const commands = [
|
|
8581
|
+
"stash",
|
|
8582
|
+
"list",
|
|
8583
|
+
...options.commands,
|
|
8584
|
+
...customArgs
|
|
8585
|
+
];
|
|
8586
|
+
const parser4 = createListLogSummaryParser(options.splitter, options.fields, logFormatFromCommand(commands));
|
|
8587
|
+
return validateLogFormatConfig(commands) || {
|
|
8588
|
+
commands,
|
|
8589
|
+
format: "utf-8",
|
|
8590
|
+
parser: parser4
|
|
8591
|
+
};
|
|
8592
|
+
}
|
|
8593
|
+
var init_stash_list = __esm({ "src/lib/tasks/stash-list.ts"() {
|
|
8594
|
+
"use strict";
|
|
8595
|
+
init_log_format();
|
|
8596
|
+
init_parse_list_log_summary();
|
|
8597
|
+
init_diff();
|
|
8598
|
+
init_log();
|
|
8599
|
+
} });
|
|
8600
|
+
var sub_module_exports = {};
|
|
8601
|
+
__export(sub_module_exports, {
|
|
8602
|
+
addSubModuleTask: () => addSubModuleTask,
|
|
8603
|
+
initSubModuleTask: () => initSubModuleTask,
|
|
8604
|
+
subModuleTask: () => subModuleTask,
|
|
8605
|
+
updateSubModuleTask: () => updateSubModuleTask
|
|
8606
|
+
});
|
|
8607
|
+
function addSubModuleTask(repo, path) {
|
|
8608
|
+
return subModuleTask([
|
|
8609
|
+
"add",
|
|
8610
|
+
repo,
|
|
8611
|
+
path
|
|
8612
|
+
]);
|
|
8613
|
+
}
|
|
8614
|
+
function initSubModuleTask(customArgs) {
|
|
8615
|
+
return subModuleTask(["init", ...customArgs]);
|
|
8616
|
+
}
|
|
8617
|
+
function subModuleTask(customArgs) {
|
|
8618
|
+
const commands = [...customArgs];
|
|
8619
|
+
if (commands[0] !== "submodule") commands.unshift("submodule");
|
|
8620
|
+
return straightThroughStringTask(commands);
|
|
8621
|
+
}
|
|
8622
|
+
function updateSubModuleTask(customArgs) {
|
|
8623
|
+
return subModuleTask(["update", ...customArgs]);
|
|
8624
|
+
}
|
|
8625
|
+
var init_sub_module = __esm({ "src/lib/tasks/sub-module.ts"() {
|
|
8626
|
+
"use strict";
|
|
8627
|
+
init_task();
|
|
8628
|
+
} });
|
|
8629
|
+
function singleSorted(a, b) {
|
|
8630
|
+
const aIsNum = Number.isNaN(a);
|
|
8631
|
+
if (aIsNum !== Number.isNaN(b)) return aIsNum ? 1 : -1;
|
|
8632
|
+
return aIsNum ? sorted(a, b) : 0;
|
|
8633
|
+
}
|
|
8634
|
+
function sorted(a, b) {
|
|
8635
|
+
return a === b ? 0 : a > b ? 1 : -1;
|
|
8636
|
+
}
|
|
8637
|
+
function trimmed(input) {
|
|
8638
|
+
return input.trim();
|
|
8639
|
+
}
|
|
8640
|
+
function toNumber(input) {
|
|
8641
|
+
if (typeof input === "string") return parseInt(input.replace(/^\D+/g, ""), 10) || 0;
|
|
8642
|
+
return 0;
|
|
8643
|
+
}
|
|
8644
|
+
var TagList, parseTagList;
|
|
8645
|
+
var init_TagList = __esm({ "src/lib/responses/TagList.ts"() {
|
|
8646
|
+
"use strict";
|
|
8647
|
+
TagList = class {
|
|
8648
|
+
constructor(all, latest) {
|
|
8649
|
+
this.all = all;
|
|
8650
|
+
this.latest = latest;
|
|
8651
|
+
}
|
|
8652
|
+
};
|
|
8653
|
+
parseTagList = function(data, customSort = false) {
|
|
8654
|
+
const tags = data.split("\n").map(trimmed).filter(Boolean);
|
|
8655
|
+
if (!customSort) tags.sort(function(tagA, tagB) {
|
|
8656
|
+
const partsA = tagA.split(".");
|
|
8657
|
+
const partsB = tagB.split(".");
|
|
8658
|
+
if (partsA.length === 1 || partsB.length === 1) return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));
|
|
8659
|
+
for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {
|
|
8660
|
+
const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));
|
|
8661
|
+
if (diff) return diff;
|
|
8662
|
+
}
|
|
8663
|
+
return 0;
|
|
8664
|
+
});
|
|
8665
|
+
const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(".") >= 0);
|
|
8666
|
+
return new TagList(tags, latest);
|
|
8667
|
+
};
|
|
8668
|
+
} });
|
|
8669
|
+
var tag_exports = {};
|
|
8670
|
+
__export(tag_exports, {
|
|
8671
|
+
addAnnotatedTagTask: () => addAnnotatedTagTask,
|
|
8672
|
+
addTagTask: () => addTagTask,
|
|
8673
|
+
tagListTask: () => tagListTask
|
|
8674
|
+
});
|
|
8675
|
+
function tagListTask(customArgs = []) {
|
|
8676
|
+
const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));
|
|
8677
|
+
return {
|
|
8678
|
+
format: "utf-8",
|
|
8679
|
+
commands: [
|
|
8680
|
+
"tag",
|
|
8681
|
+
"-l",
|
|
8682
|
+
...customArgs
|
|
8683
|
+
],
|
|
8684
|
+
parser(text) {
|
|
8685
|
+
return parseTagList(text, hasCustomSort);
|
|
8686
|
+
}
|
|
8687
|
+
};
|
|
8688
|
+
}
|
|
8689
|
+
function addTagTask(name) {
|
|
8690
|
+
return {
|
|
8691
|
+
format: "utf-8",
|
|
8692
|
+
commands: ["tag", name],
|
|
8693
|
+
parser() {
|
|
8694
|
+
return { name };
|
|
8695
|
+
}
|
|
8696
|
+
};
|
|
8697
|
+
}
|
|
8698
|
+
function addAnnotatedTagTask(name, tagMessage) {
|
|
8699
|
+
return {
|
|
8700
|
+
format: "utf-8",
|
|
8701
|
+
commands: [
|
|
8702
|
+
"tag",
|
|
8703
|
+
"-a",
|
|
8704
|
+
"-m",
|
|
8705
|
+
tagMessage,
|
|
8706
|
+
name
|
|
8707
|
+
],
|
|
8708
|
+
parser() {
|
|
8709
|
+
return { name };
|
|
8710
|
+
}
|
|
8711
|
+
};
|
|
8712
|
+
}
|
|
8713
|
+
var init_tag = __esm({ "src/lib/tasks/tag.ts"() {
|
|
8714
|
+
"use strict";
|
|
8715
|
+
init_TagList();
|
|
8716
|
+
} });
|
|
8717
|
+
var require_git = __commonJS({ "src/git.js"(exports, module) {
|
|
8718
|
+
"use strict";
|
|
8719
|
+
var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));
|
|
8720
|
+
var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));
|
|
8721
|
+
var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));
|
|
8722
|
+
var { configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));
|
|
8723
|
+
var { asArray: asArray2, filterArray: filterArray2, filterPrimitives: filterPrimitives2, filterString: filterString2, filterStringOrStringArray: filterStringOrStringArray2, filterType: filterType2, getTrailingOptions: getTrailingOptions2, trailingFunctionArgument: trailingFunctionArgument2, trailingOptionsArgument: trailingOptionsArgument2 } = (init_utils(), __toCommonJS(utils_exports));
|
|
8724
|
+
var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));
|
|
8725
|
+
var { branchTask: branchTask2, branchLocalTask: branchLocalTask2, deleteBranchesTask: deleteBranchesTask2, deleteBranchTask: deleteBranchTask2 } = (init_branch(), __toCommonJS(branch_exports));
|
|
8726
|
+
var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));
|
|
8727
|
+
var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));
|
|
8728
|
+
var { cloneTask: cloneTask2, cloneMirrorTask: cloneMirrorTask2 } = (init_clone(), __toCommonJS(clone_exports));
|
|
8729
|
+
var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));
|
|
8730
|
+
var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));
|
|
8731
|
+
var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));
|
|
8732
|
+
var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));
|
|
8733
|
+
var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));
|
|
8734
|
+
var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));
|
|
8735
|
+
var { addRemoteTask: addRemoteTask2, getRemotesTask: getRemotesTask2, listRemotesTask: listRemotesTask2, remoteTask: remoteTask2, removeRemoteTask: removeRemoteTask2 } = (init_remote(), __toCommonJS(remote_exports));
|
|
8736
|
+
var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));
|
|
8737
|
+
var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));
|
|
8738
|
+
var { addSubModuleTask: addSubModuleTask2, initSubModuleTask: initSubModuleTask2, subModuleTask: subModuleTask2, updateSubModuleTask: updateSubModuleTask2 } = (init_sub_module(), __toCommonJS(sub_module_exports));
|
|
8739
|
+
var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));
|
|
8740
|
+
var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));
|
|
8741
|
+
function Git2(options, plugins) {
|
|
8742
|
+
this._plugins = plugins;
|
|
8743
|
+
this._executor = new GitExecutor2(options.baseDir, new Scheduler2(options.maxConcurrentProcesses), plugins);
|
|
8744
|
+
this._trimmed = options.trimmed;
|
|
8745
|
+
}
|
|
8746
|
+
(Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;
|
|
8747
|
+
Git2.prototype.customBinary = function(command) {
|
|
8748
|
+
this._plugins.reconfigure("binary", command);
|
|
8749
|
+
return this;
|
|
8750
|
+
};
|
|
8751
|
+
Git2.prototype.env = function(name, value) {
|
|
8752
|
+
if (arguments.length === 1 && typeof name === "object") this._executor.env = name;
|
|
8753
|
+
else (this._executor.env = this._executor.env || {})[name] = value;
|
|
8754
|
+
return this;
|
|
8755
|
+
};
|
|
8756
|
+
Git2.prototype.stashList = function(options) {
|
|
8757
|
+
return this._runTask(stashListTask2(trailingOptionsArgument2(arguments) || {}, filterArray2(options) && options || []), trailingFunctionArgument2(arguments));
|
|
8758
|
+
};
|
|
8759
|
+
function createCloneTask(api, task, repoPath, localPath) {
|
|
8760
|
+
if (typeof repoPath !== "string") return configurationErrorTask2(`git.${api}() requires a string 'repoPath'`);
|
|
8761
|
+
return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments));
|
|
8762
|
+
}
|
|
8763
|
+
Git2.prototype.clone = function() {
|
|
8764
|
+
return this._runTask(createCloneTask("clone", cloneTask2, ...arguments), trailingFunctionArgument2(arguments));
|
|
8765
|
+
};
|
|
8766
|
+
Git2.prototype.mirror = function() {
|
|
8767
|
+
return this._runTask(createCloneTask("mirror", cloneMirrorTask2, ...arguments), trailingFunctionArgument2(arguments));
|
|
8768
|
+
};
|
|
8769
|
+
Git2.prototype.mv = function(from, to) {
|
|
8770
|
+
return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));
|
|
8771
|
+
};
|
|
8772
|
+
Git2.prototype.checkoutLatestTag = function(then) {
|
|
8773
|
+
var git = this;
|
|
8774
|
+
return this.pull(function() {
|
|
8775
|
+
git.tags(function(err, tags) {
|
|
8776
|
+
git.checkout(tags.latest, then);
|
|
8777
|
+
});
|
|
8778
|
+
});
|
|
8779
|
+
};
|
|
8780
|
+
Git2.prototype.pull = function(remote, branch, options, then) {
|
|
8781
|
+
return this._runTask(pullTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
8782
|
+
};
|
|
8783
|
+
Git2.prototype.fetch = function(remote, branch) {
|
|
8784
|
+
return this._runTask(fetchTask2(filterType2(remote, filterString2), filterType2(branch, filterString2), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
8785
|
+
};
|
|
8786
|
+
Git2.prototype.silent = function(silence) {
|
|
8787
|
+
console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3");
|
|
8788
|
+
return this;
|
|
8789
|
+
};
|
|
8790
|
+
Git2.prototype.tags = function(options, then) {
|
|
8791
|
+
return this._runTask(tagListTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
8792
|
+
};
|
|
8793
|
+
Git2.prototype.rebase = function() {
|
|
8794
|
+
return this._runTask(straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]), trailingFunctionArgument2(arguments));
|
|
8795
|
+
};
|
|
8796
|
+
Git2.prototype.reset = function(mode) {
|
|
8797
|
+
return this._runTask(resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
8798
|
+
};
|
|
8799
|
+
Git2.prototype.revert = function(commit) {
|
|
8800
|
+
const next = trailingFunctionArgument2(arguments);
|
|
8801
|
+
if (typeof commit !== "string") return this._runTask(configurationErrorTask2("Commit must be a string"), next);
|
|
8802
|
+
return this._runTask(straightThroughStringTask2([
|
|
8803
|
+
"revert",
|
|
8804
|
+
...getTrailingOptions2(arguments, 0, true),
|
|
8805
|
+
commit
|
|
8806
|
+
]), next);
|
|
8807
|
+
};
|
|
8808
|
+
Git2.prototype.addTag = function(name) {
|
|
8809
|
+
const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name");
|
|
8810
|
+
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
8811
|
+
};
|
|
8812
|
+
Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {
|
|
8813
|
+
return this._runTask(addAnnotatedTagTask2(tagName, tagMessage), trailingFunctionArgument2(arguments));
|
|
8814
|
+
};
|
|
8815
|
+
Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {
|
|
8816
|
+
return this._runTask(deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
|
|
8817
|
+
};
|
|
8818
|
+
Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {
|
|
8819
|
+
return this._runTask(deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false), trailingFunctionArgument2(arguments));
|
|
8820
|
+
};
|
|
8821
|
+
Git2.prototype.branch = function(options, then) {
|
|
8822
|
+
return this._runTask(branchTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
8823
|
+
};
|
|
8824
|
+
Git2.prototype.branchLocal = function(then) {
|
|
8825
|
+
return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));
|
|
8826
|
+
};
|
|
8827
|
+
Git2.prototype.raw = function(commands) {
|
|
8828
|
+
const createRestCommands = !Array.isArray(commands);
|
|
8829
|
+
const command = [].slice.call(createRestCommands ? arguments : commands, 0);
|
|
8830
|
+
for (let i = 0; i < command.length && createRestCommands; i++) if (!filterPrimitives2(command[i])) {
|
|
8831
|
+
command.splice(i, command.length - i);
|
|
8832
|
+
break;
|
|
8833
|
+
}
|
|
8834
|
+
command.push(...getTrailingOptions2(arguments, 0, true));
|
|
8835
|
+
var next = trailingFunctionArgument2(arguments);
|
|
8836
|
+
if (!command.length) return this._runTask(configurationErrorTask2("Raw: must supply one or more command to execute"), next);
|
|
8837
|
+
return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
|
|
8838
|
+
};
|
|
8839
|
+
Git2.prototype.submoduleAdd = function(repo, path, then) {
|
|
8840
|
+
return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments));
|
|
8841
|
+
};
|
|
8842
|
+
Git2.prototype.submoduleUpdate = function(args, then) {
|
|
8843
|
+
return this._runTask(updateSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
|
|
8844
|
+
};
|
|
8845
|
+
Git2.prototype.submoduleInit = function(args, then) {
|
|
8846
|
+
return this._runTask(initSubModuleTask2(getTrailingOptions2(arguments, true)), trailingFunctionArgument2(arguments));
|
|
8847
|
+
};
|
|
8848
|
+
Git2.prototype.subModule = function(options, then) {
|
|
8849
|
+
return this._runTask(subModuleTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
8850
|
+
};
|
|
8851
|
+
Git2.prototype.listRemote = function() {
|
|
8852
|
+
return this._runTask(listRemotesTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
8853
|
+
};
|
|
8854
|
+
Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {
|
|
8855
|
+
return this._runTask(addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
8856
|
+
};
|
|
8857
|
+
Git2.prototype.removeRemote = function(remoteName, then) {
|
|
8858
|
+
return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));
|
|
8859
|
+
};
|
|
8860
|
+
Git2.prototype.getRemotes = function(verbose, then) {
|
|
8861
|
+
return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));
|
|
8862
|
+
};
|
|
8863
|
+
Git2.prototype.remote = function(options, then) {
|
|
8864
|
+
return this._runTask(remoteTask2(getTrailingOptions2(arguments)), trailingFunctionArgument2(arguments));
|
|
8865
|
+
};
|
|
8866
|
+
Git2.prototype.tag = function(options, then) {
|
|
8867
|
+
const command = getTrailingOptions2(arguments);
|
|
8868
|
+
if (command[0] !== "tag") command.unshift("tag");
|
|
8869
|
+
return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));
|
|
8870
|
+
};
|
|
8871
|
+
Git2.prototype.updateServerInfo = function(then) {
|
|
8872
|
+
return this._runTask(straightThroughStringTask2(["update-server-info"]), trailingFunctionArgument2(arguments));
|
|
8873
|
+
};
|
|
8874
|
+
Git2.prototype.pushTags = function(remote, then) {
|
|
8875
|
+
const task = pushTagsTask2({ remote: filterType2(remote, filterString2) }, getTrailingOptions2(arguments));
|
|
8876
|
+
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
8877
|
+
};
|
|
8878
|
+
Git2.prototype.rm = function(files) {
|
|
8879
|
+
return this._runTask(straightThroughStringTask2([
|
|
8880
|
+
"rm",
|
|
8881
|
+
"-f",
|
|
8882
|
+
...asArray2(files)
|
|
8883
|
+
]), trailingFunctionArgument2(arguments));
|
|
8884
|
+
};
|
|
8885
|
+
Git2.prototype.rmKeepLocal = function(files) {
|
|
8886
|
+
return this._runTask(straightThroughStringTask2([
|
|
8887
|
+
"rm",
|
|
8888
|
+
"--cached",
|
|
8889
|
+
...asArray2(files)
|
|
8890
|
+
]), trailingFunctionArgument2(arguments));
|
|
8891
|
+
};
|
|
8892
|
+
Git2.prototype.catFile = function(options, then) {
|
|
8893
|
+
return this._catFile("utf-8", arguments);
|
|
8894
|
+
};
|
|
8895
|
+
Git2.prototype.binaryCatFile = function() {
|
|
8896
|
+
return this._catFile("buffer", arguments);
|
|
8897
|
+
};
|
|
8898
|
+
Git2.prototype._catFile = function(format, args) {
|
|
8899
|
+
var handler = trailingFunctionArgument2(args);
|
|
8900
|
+
var command = ["cat-file"];
|
|
8901
|
+
var options = args[0];
|
|
8902
|
+
if (typeof options === "string") return this._runTask(configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"), handler);
|
|
8903
|
+
if (Array.isArray(options)) command.push.apply(command, options);
|
|
8904
|
+
const task = format === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);
|
|
8905
|
+
return this._runTask(task, handler);
|
|
8906
|
+
};
|
|
8907
|
+
Git2.prototype.diff = function(options, then) {
|
|
8908
|
+
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)]);
|
|
8909
|
+
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
8910
|
+
};
|
|
8911
|
+
Git2.prototype.diffSummary = function() {
|
|
8912
|
+
return this._runTask(diffSummaryTask2(getTrailingOptions2(arguments, 1)), trailingFunctionArgument2(arguments));
|
|
8913
|
+
};
|
|
8914
|
+
Git2.prototype.applyPatch = function(patches) {
|
|
8915
|
+
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)));
|
|
8916
|
+
return this._runTask(task, trailingFunctionArgument2(arguments));
|
|
8917
|
+
};
|
|
8918
|
+
Git2.prototype.revparse = function() {
|
|
8919
|
+
const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)];
|
|
8920
|
+
return this._runTask(straightThroughStringTask2(commands, true), trailingFunctionArgument2(arguments));
|
|
8921
|
+
};
|
|
8922
|
+
Git2.prototype.clean = function(mode, options, then) {
|
|
8923
|
+
const usingCleanOptionsArray = isCleanOptionsArray2(mode);
|
|
8924
|
+
const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || "";
|
|
8925
|
+
const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
|
|
8926
|
+
return this._runTask(cleanWithOptionsTask2(cleanMode, customArgs), trailingFunctionArgument2(arguments));
|
|
8927
|
+
};
|
|
8928
|
+
Git2.prototype.exec = function(then) {
|
|
8929
|
+
return this._runTask({
|
|
8930
|
+
commands: [],
|
|
8931
|
+
format: "utf-8",
|
|
8932
|
+
parser() {
|
|
8933
|
+
if (typeof then === "function") then();
|
|
8934
|
+
}
|
|
8935
|
+
});
|
|
8936
|
+
};
|
|
8937
|
+
Git2.prototype.clearQueue = function() {
|
|
8938
|
+
return this;
|
|
8939
|
+
};
|
|
8940
|
+
Git2.prototype.checkIgnore = function(pathnames, then) {
|
|
8941
|
+
return this._runTask(checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))), trailingFunctionArgument2(arguments));
|
|
8942
|
+
};
|
|
8943
|
+
Git2.prototype.checkIsRepo = function(checkType, then) {
|
|
8944
|
+
return this._runTask(checkIsRepoTask2(filterType2(checkType, filterString2)), trailingFunctionArgument2(arguments));
|
|
8945
|
+
};
|
|
8946
|
+
module.exports = Git2;
|
|
8947
|
+
} });
|
|
8948
|
+
init_pathspec();
|
|
8949
|
+
init_git_error();
|
|
8950
|
+
var GitConstructError = class extends GitError {
|
|
8951
|
+
constructor(config, message) {
|
|
8952
|
+
super(void 0, message);
|
|
8953
|
+
this.config = config;
|
|
8954
|
+
}
|
|
8955
|
+
};
|
|
8956
|
+
init_git_error();
|
|
8957
|
+
init_git_error();
|
|
8958
|
+
var GitPluginError = class extends GitError {
|
|
8959
|
+
constructor(task, plugin, message) {
|
|
8960
|
+
super(task, message);
|
|
8961
|
+
this.task = task;
|
|
8962
|
+
this.plugin = plugin;
|
|
8963
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
8964
|
+
}
|
|
8965
|
+
};
|
|
8966
|
+
init_git_response_error();
|
|
8967
|
+
init_task_configuration_error();
|
|
8968
|
+
init_check_is_repo();
|
|
8969
|
+
init_clean();
|
|
8970
|
+
init_config();
|
|
8971
|
+
init_diff_name_status();
|
|
8972
|
+
init_grep();
|
|
8973
|
+
init_reset();
|
|
8974
|
+
function abortPlugin(signal) {
|
|
8975
|
+
if (!signal) return;
|
|
8976
|
+
return [{
|
|
8977
|
+
type: "spawn.before",
|
|
8978
|
+
action(_data, context) {
|
|
8979
|
+
if (signal.aborted) context.kill(new GitPluginError(void 0, "abort", "Abort already signaled"));
|
|
8980
|
+
}
|
|
8981
|
+
}, {
|
|
8982
|
+
type: "spawn.after",
|
|
8983
|
+
action(_data, context) {
|
|
8984
|
+
function kill() {
|
|
8985
|
+
context.kill(new GitPluginError(void 0, "abort", "Abort signal received"));
|
|
8986
|
+
}
|
|
8987
|
+
signal.addEventListener("abort", kill);
|
|
8988
|
+
context.spawned.on("close", () => signal.removeEventListener("abort", kill));
|
|
8989
|
+
}
|
|
8990
|
+
}];
|
|
8991
|
+
}
|
|
8992
|
+
function isConfigSwitch(arg) {
|
|
8993
|
+
return typeof arg === "string" && arg.trim().toLowerCase() === "-c";
|
|
8994
|
+
}
|
|
8995
|
+
function preventProtocolOverride(arg, next) {
|
|
8996
|
+
if (!isConfigSwitch(arg)) return;
|
|
8997
|
+
if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) return;
|
|
8998
|
+
throw new GitPluginError(void 0, "unsafe", "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol");
|
|
8999
|
+
}
|
|
9000
|
+
function preventUploadPack(arg, method) {
|
|
9001
|
+
if (/^\s*--(upload|receive)-pack/.test(arg)) throw new GitPluginError(void 0, "unsafe", `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`);
|
|
9002
|
+
if (method === "clone" && /^\s*-u\b/.test(arg)) throw new GitPluginError(void 0, "unsafe", `Use of clone with option -u is not permitted without enabling allowUnsafePack`);
|
|
9003
|
+
if (method === "push" && /^\s*--exec\b/.test(arg)) throw new GitPluginError(void 0, "unsafe", `Use of push with option --exec is not permitted without enabling allowUnsafePack`);
|
|
9004
|
+
}
|
|
9005
|
+
function blockUnsafeOperationsPlugin({ allowUnsafeProtocolOverride = false, allowUnsafePack = false } = {}) {
|
|
9006
|
+
return {
|
|
9007
|
+
type: "spawn.args",
|
|
9008
|
+
action(args, context) {
|
|
9009
|
+
args.forEach((current, index) => {
|
|
9010
|
+
const next = index < args.length ? args[index + 1] : "";
|
|
9011
|
+
allowUnsafeProtocolOverride || preventProtocolOverride(current, next);
|
|
9012
|
+
allowUnsafePack || preventUploadPack(current, context.method);
|
|
9013
|
+
});
|
|
9014
|
+
return args;
|
|
9015
|
+
}
|
|
9016
|
+
};
|
|
9017
|
+
}
|
|
9018
|
+
init_utils();
|
|
9019
|
+
function commandConfigPrefixingPlugin(configuration) {
|
|
9020
|
+
const prefix = prefixedArray(configuration, "-c");
|
|
9021
|
+
return {
|
|
9022
|
+
type: "spawn.args",
|
|
9023
|
+
action(data) {
|
|
9024
|
+
return [...prefix, ...data];
|
|
9025
|
+
}
|
|
9026
|
+
};
|
|
9027
|
+
}
|
|
9028
|
+
init_utils();
|
|
9029
|
+
var never = (0, import_dist$1.deferred)().promise;
|
|
9030
|
+
function completionDetectionPlugin({ onClose = true, onExit = 50 } = {}) {
|
|
9031
|
+
function createEvents() {
|
|
9032
|
+
let exitCode = -1;
|
|
9033
|
+
const events = {
|
|
9034
|
+
close: (0, import_dist$1.deferred)(),
|
|
9035
|
+
closeTimeout: (0, import_dist$1.deferred)(),
|
|
9036
|
+
exit: (0, import_dist$1.deferred)(),
|
|
9037
|
+
exitTimeout: (0, import_dist$1.deferred)()
|
|
9038
|
+
};
|
|
9039
|
+
const result = Promise.race([onClose === false ? never : events.closeTimeout.promise, onExit === false ? never : events.exitTimeout.promise]);
|
|
9040
|
+
configureTimeout(onClose, events.close, events.closeTimeout);
|
|
9041
|
+
configureTimeout(onExit, events.exit, events.exitTimeout);
|
|
9042
|
+
return {
|
|
9043
|
+
close(code) {
|
|
9044
|
+
exitCode = code;
|
|
9045
|
+
events.close.done();
|
|
9046
|
+
},
|
|
9047
|
+
exit(code) {
|
|
9048
|
+
exitCode = code;
|
|
9049
|
+
events.exit.done();
|
|
9050
|
+
},
|
|
9051
|
+
get exitCode() {
|
|
9052
|
+
return exitCode;
|
|
9053
|
+
},
|
|
9054
|
+
result
|
|
9055
|
+
};
|
|
9056
|
+
}
|
|
9057
|
+
function configureTimeout(flag, event, timeout) {
|
|
9058
|
+
if (flag === false) return;
|
|
9059
|
+
(flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);
|
|
9060
|
+
}
|
|
9061
|
+
return {
|
|
9062
|
+
type: "spawn.after",
|
|
9063
|
+
async action(_data, { spawned, close }) {
|
|
9064
|
+
const events = createEvents();
|
|
9065
|
+
let deferClose = true;
|
|
9066
|
+
let quickClose = () => void (deferClose = false);
|
|
9067
|
+
spawned.stdout?.on("data", quickClose);
|
|
9068
|
+
spawned.stderr?.on("data", quickClose);
|
|
9069
|
+
spawned.on("error", quickClose);
|
|
9070
|
+
spawned.on("close", (code) => events.close(code));
|
|
9071
|
+
spawned.on("exit", (code) => events.exit(code));
|
|
9072
|
+
try {
|
|
9073
|
+
await events.result;
|
|
9074
|
+
if (deferClose) await delay(50);
|
|
9075
|
+
close(events.exitCode);
|
|
9076
|
+
} catch (err) {
|
|
9077
|
+
close(events.exitCode, err);
|
|
9078
|
+
}
|
|
9079
|
+
}
|
|
9080
|
+
};
|
|
9081
|
+
}
|
|
9082
|
+
init_utils();
|
|
9083
|
+
var WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`;
|
|
9084
|
+
var WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;
|
|
9085
|
+
function isBadArgument(arg) {
|
|
9086
|
+
return !arg || !/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(arg);
|
|
9087
|
+
}
|
|
9088
|
+
function toBinaryConfig(input, allowUnsafe) {
|
|
9089
|
+
if (input.length < 1 || input.length > 2) throw new GitPluginError(void 0, "binary", WRONG_NUMBER_ERR);
|
|
9090
|
+
if (input.some(isBadArgument)) if (allowUnsafe) console.warn(WRONG_CHARS_ERR);
|
|
9091
|
+
else throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR);
|
|
9092
|
+
const [binary, prefix] = input;
|
|
9093
|
+
return {
|
|
9094
|
+
binary,
|
|
9095
|
+
prefix
|
|
9096
|
+
};
|
|
9097
|
+
}
|
|
9098
|
+
function customBinaryPlugin(plugins, input = ["git"], allowUnsafe = false) {
|
|
9099
|
+
let config = toBinaryConfig(asArray(input), allowUnsafe);
|
|
9100
|
+
plugins.on("binary", (input2) => {
|
|
9101
|
+
config = toBinaryConfig(asArray(input2), allowUnsafe);
|
|
9102
|
+
});
|
|
9103
|
+
plugins.append("spawn.binary", () => {
|
|
9104
|
+
return config.binary;
|
|
9105
|
+
});
|
|
9106
|
+
plugins.append("spawn.args", (data) => {
|
|
9107
|
+
return config.prefix ? [config.prefix, ...data] : data;
|
|
9108
|
+
});
|
|
9109
|
+
}
|
|
9110
|
+
init_git_error();
|
|
9111
|
+
function isTaskError(result) {
|
|
9112
|
+
return !!(result.exitCode && result.stdErr.length);
|
|
9113
|
+
}
|
|
9114
|
+
function getErrorMessage(result) {
|
|
9115
|
+
return Buffer.concat([...result.stdOut, ...result.stdErr]);
|
|
9116
|
+
}
|
|
9117
|
+
function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) {
|
|
9118
|
+
return (error, result) => {
|
|
9119
|
+
if (!overwrite && error || !isError(result)) return error;
|
|
9120
|
+
return errorMessage(result);
|
|
9121
|
+
};
|
|
9122
|
+
}
|
|
9123
|
+
function errorDetectionPlugin(config) {
|
|
9124
|
+
return {
|
|
9125
|
+
type: "task.error",
|
|
9126
|
+
action(data, context) {
|
|
9127
|
+
const error = config(data.error, {
|
|
9128
|
+
stdErr: context.stdErr,
|
|
9129
|
+
stdOut: context.stdOut,
|
|
9130
|
+
exitCode: context.exitCode
|
|
9131
|
+
});
|
|
9132
|
+
if (Buffer.isBuffer(error)) return { error: new GitError(void 0, error.toString("utf-8")) };
|
|
9133
|
+
return { error };
|
|
9134
|
+
}
|
|
9135
|
+
};
|
|
9136
|
+
}
|
|
9137
|
+
init_utils();
|
|
9138
|
+
var PluginStore = class {
|
|
9139
|
+
constructor() {
|
|
9140
|
+
this.plugins = /* @__PURE__ */ new Set();
|
|
9141
|
+
this.events = new EventEmitter();
|
|
9142
|
+
}
|
|
9143
|
+
on(type, listener) {
|
|
9144
|
+
this.events.on(type, listener);
|
|
9145
|
+
}
|
|
9146
|
+
reconfigure(type, data) {
|
|
9147
|
+
this.events.emit(type, data);
|
|
9148
|
+
}
|
|
9149
|
+
append(type, action) {
|
|
9150
|
+
const plugin = append(this.plugins, {
|
|
9151
|
+
type,
|
|
9152
|
+
action
|
|
9153
|
+
});
|
|
9154
|
+
return () => this.plugins.delete(plugin);
|
|
9155
|
+
}
|
|
9156
|
+
add(plugin) {
|
|
9157
|
+
const plugins = [];
|
|
9158
|
+
asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2)));
|
|
9159
|
+
return () => {
|
|
9160
|
+
plugins.forEach((plugin2) => this.plugins.delete(plugin2));
|
|
9161
|
+
};
|
|
9162
|
+
}
|
|
9163
|
+
exec(type, data, context) {
|
|
9164
|
+
let output = data;
|
|
9165
|
+
const contextual = Object.freeze(Object.create(context));
|
|
9166
|
+
for (const plugin of this.plugins) if (plugin.type === type) output = plugin.action(output, contextual);
|
|
9167
|
+
return output;
|
|
9168
|
+
}
|
|
9169
|
+
};
|
|
9170
|
+
init_utils();
|
|
9171
|
+
function progressMonitorPlugin(progress) {
|
|
9172
|
+
const progressCommand = "--progress";
|
|
9173
|
+
const progressMethods = [
|
|
9174
|
+
"checkout",
|
|
9175
|
+
"clone",
|
|
9176
|
+
"fetch",
|
|
9177
|
+
"pull",
|
|
9178
|
+
"push"
|
|
9179
|
+
];
|
|
9180
|
+
return [{
|
|
9181
|
+
type: "spawn.args",
|
|
9182
|
+
action(args, context) {
|
|
9183
|
+
if (!progressMethods.includes(context.method)) return args;
|
|
9184
|
+
return including(args, progressCommand);
|
|
9185
|
+
}
|
|
9186
|
+
}, {
|
|
9187
|
+
type: "spawn.after",
|
|
9188
|
+
action(_data, context) {
|
|
9189
|
+
if (!context.commands.includes(progressCommand)) return;
|
|
9190
|
+
context.spawned.stderr?.on("data", (chunk) => {
|
|
9191
|
+
const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8"));
|
|
9192
|
+
if (!message) return;
|
|
9193
|
+
progress({
|
|
9194
|
+
method: context.method,
|
|
9195
|
+
stage: progressEventStage(message[1]),
|
|
9196
|
+
progress: asNumber(message[2]),
|
|
9197
|
+
processed: asNumber(message[3]),
|
|
9198
|
+
total: asNumber(message[4])
|
|
9199
|
+
});
|
|
9200
|
+
});
|
|
9201
|
+
}
|
|
9202
|
+
}];
|
|
9203
|
+
}
|
|
9204
|
+
function progressEventStage(input) {
|
|
9205
|
+
return String(input.toLowerCase().split(" ", 1)) || "unknown";
|
|
9206
|
+
}
|
|
9207
|
+
init_utils();
|
|
9208
|
+
function spawnOptionsPlugin(spawnOptions) {
|
|
9209
|
+
const options = pick(spawnOptions, ["uid", "gid"]);
|
|
9210
|
+
return {
|
|
9211
|
+
type: "spawn.options",
|
|
9212
|
+
action(data) {
|
|
9213
|
+
return {
|
|
9214
|
+
...options,
|
|
9215
|
+
...data
|
|
9216
|
+
};
|
|
9217
|
+
}
|
|
9218
|
+
};
|
|
9219
|
+
}
|
|
9220
|
+
function timeoutPlugin({ block, stdErr = true, stdOut = true }) {
|
|
9221
|
+
if (block > 0) return {
|
|
9222
|
+
type: "spawn.after",
|
|
9223
|
+
action(_data, context) {
|
|
9224
|
+
let timeout;
|
|
9225
|
+
function wait() {
|
|
9226
|
+
timeout && clearTimeout(timeout);
|
|
9227
|
+
timeout = setTimeout(kill, block);
|
|
9228
|
+
}
|
|
9229
|
+
function stop() {
|
|
9230
|
+
context.spawned.stdout?.off("data", wait);
|
|
9231
|
+
context.spawned.stderr?.off("data", wait);
|
|
9232
|
+
context.spawned.off("exit", stop);
|
|
9233
|
+
context.spawned.off("close", stop);
|
|
9234
|
+
timeout && clearTimeout(timeout);
|
|
9235
|
+
}
|
|
9236
|
+
function kill() {
|
|
9237
|
+
stop();
|
|
9238
|
+
context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`));
|
|
9239
|
+
}
|
|
9240
|
+
stdOut && context.spawned.stdout?.on("data", wait);
|
|
9241
|
+
stdErr && context.spawned.stderr?.on("data", wait);
|
|
9242
|
+
context.spawned.on("exit", stop);
|
|
9243
|
+
context.spawned.on("close", stop);
|
|
9244
|
+
wait();
|
|
9245
|
+
}
|
|
9246
|
+
};
|
|
9247
|
+
}
|
|
9248
|
+
init_pathspec();
|
|
9249
|
+
function suffixPathsPlugin() {
|
|
9250
|
+
return {
|
|
9251
|
+
type: "spawn.args",
|
|
9252
|
+
action(data) {
|
|
9253
|
+
const prefix = [];
|
|
9254
|
+
let suffix;
|
|
9255
|
+
function append2(args) {
|
|
9256
|
+
(suffix = suffix || []).push(...args);
|
|
9257
|
+
}
|
|
9258
|
+
for (let i = 0; i < data.length; i++) {
|
|
9259
|
+
const param = data[i];
|
|
9260
|
+
if (isPathSpec(param)) {
|
|
9261
|
+
append2(toPaths(param));
|
|
9262
|
+
continue;
|
|
9263
|
+
}
|
|
9264
|
+
if (param === "--") {
|
|
9265
|
+
append2(data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item));
|
|
9266
|
+
break;
|
|
9267
|
+
}
|
|
9268
|
+
prefix.push(param);
|
|
9269
|
+
}
|
|
9270
|
+
return !suffix ? prefix : [
|
|
9271
|
+
...prefix,
|
|
9272
|
+
"--",
|
|
9273
|
+
...suffix.map(String)
|
|
9274
|
+
];
|
|
9275
|
+
}
|
|
9276
|
+
};
|
|
9277
|
+
}
|
|
9278
|
+
init_utils();
|
|
9279
|
+
var Git = require_git();
|
|
9280
|
+
function gitInstanceFactory(baseDir, options) {
|
|
9281
|
+
const plugins = new PluginStore();
|
|
9282
|
+
const config = createInstanceConfig(baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {}, options);
|
|
9283
|
+
if (!folderExists(config.baseDir)) throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`);
|
|
9284
|
+
if (Array.isArray(config.config)) plugins.add(commandConfigPrefixingPlugin(config.config));
|
|
9285
|
+
plugins.add(blockUnsafeOperationsPlugin(config.unsafe));
|
|
9286
|
+
plugins.add(suffixPathsPlugin());
|
|
9287
|
+
plugins.add(completionDetectionPlugin(config.completion));
|
|
9288
|
+
config.abort && plugins.add(abortPlugin(config.abort));
|
|
9289
|
+
config.progress && plugins.add(progressMonitorPlugin(config.progress));
|
|
9290
|
+
config.timeout && plugins.add(timeoutPlugin(config.timeout));
|
|
9291
|
+
config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));
|
|
9292
|
+
plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));
|
|
9293
|
+
config.errors && plugins.add(errorDetectionPlugin(config.errors));
|
|
9294
|
+
customBinaryPlugin(plugins, config.binary, config.unsafe?.allowUnsafeCustomBinary);
|
|
9295
|
+
return new Git(config, plugins);
|
|
9296
|
+
}
|
|
9297
|
+
init_git_response_error();
|
|
9298
|
+
var simpleGit = gitInstanceFactory;
|
|
9299
|
+
var esm_default = gitInstanceFactory;
|
|
9300
|
+
|
|
4790
9301
|
//#endregion
|
|
4791
9302
|
//#region ../core/src/sources/git-clone.ts
|
|
4792
9303
|
const CACHE_DIR = join(homedir(), ".baton", "cache");
|
|
@@ -6480,14 +10991,14 @@ function generateLock(packages) {
|
|
|
6480
10991
|
* Writes a lockfile object to disk as YAML
|
|
6481
10992
|
*/
|
|
6482
10993
|
async function writeLock(lockfile, filePath) {
|
|
6483
|
-
await writeFile(filePath, (0, import_dist.stringify)(lockfile), "utf-8");
|
|
10994
|
+
await writeFile(filePath, (0, import_dist$2.stringify)(lockfile), "utf-8");
|
|
6484
10995
|
}
|
|
6485
10996
|
/**
|
|
6486
10997
|
* Reads and validates an existing lockfile from disk
|
|
6487
10998
|
*/
|
|
6488
10999
|
async function readLock(filePath) {
|
|
6489
11000
|
try {
|
|
6490
|
-
const parsed = (0, import_dist.parse)(await readFile(filePath, "utf-8"));
|
|
11001
|
+
const parsed = (0, import_dist$2.parse)(await readFile(filePath, "utf-8"));
|
|
6491
11002
|
const result = lockfileSchema.safeParse(parsed);
|
|
6492
11003
|
if (!result.success) throw new Error(`Invalid lockfile: ${result.error.errors.map((e) => e.message).join(", ")}`);
|
|
6493
11004
|
return result.data;
|
|
@@ -6552,7 +11063,7 @@ async function removePlacedFiles(filePaths, projectRoot) {
|
|
|
6552
11063
|
async function loadProfileManifestSafe(sourceRoot, profilePath) {
|
|
6553
11064
|
const manifestPath = join(sourceRoot, profilePath, "baton.profile.yaml");
|
|
6554
11065
|
try {
|
|
6555
|
-
const parsed = (0, import_dist.parse)(await readFile(manifestPath, "utf-8"));
|
|
11066
|
+
const parsed = (0, import_dist$2.parse)(await readFile(manifestPath, "utf-8"));
|
|
6556
11067
|
const manifest = profileManifestSchema.parse(parsed);
|
|
6557
11068
|
return {
|
|
6558
11069
|
name: manifest.name,
|
|
@@ -6583,7 +11094,7 @@ async function loadProfileManifestSafe(sourceRoot, profilePath) {
|
|
|
6583
11094
|
async function findSourceManifest(sourceRoot) {
|
|
6584
11095
|
const manifestPath = join(sourceRoot, "baton.source.yaml");
|
|
6585
11096
|
try {
|
|
6586
|
-
const parsed = (0, import_dist.parse)(await readFile(manifestPath, "utf-8"));
|
|
11097
|
+
const parsed = (0, import_dist$2.parse)(await readFile(manifestPath, "utf-8"));
|
|
6587
11098
|
return sourceManifestSchema.parse(parsed);
|
|
6588
11099
|
} catch (error) {
|
|
6589
11100
|
if (error.code === "ENOENT") throw new Error(`Source manifest not found at ${manifestPath}. This directory is not a Baton source repository.`);
|
|
@@ -14546,7 +19057,7 @@ function getGlobalConfigPath() {
|
|
|
14546
19057
|
async function loadGlobalConfig() {
|
|
14547
19058
|
const configPath = getGlobalConfigPath();
|
|
14548
19059
|
try {
|
|
14549
|
-
const parsed = (0, import_dist.parse)(await readFile(configPath, "utf-8"));
|
|
19060
|
+
const parsed = (0, import_dist$2.parse)(await readFile(configPath, "utf-8"));
|
|
14550
19061
|
return globalConfigSchema.parse(parsed);
|
|
14551
19062
|
} catch (error) {
|
|
14552
19063
|
if (error.code === "ENOENT") return globalConfigSchema.parse({});
|
|
@@ -14566,7 +19077,7 @@ async function saveGlobalConfig(config) {
|
|
|
14566
19077
|
const validated = globalConfigSchema.parse(config);
|
|
14567
19078
|
const configPath = getGlobalConfigPath();
|
|
14568
19079
|
await mkdir(getBatonHome(), { recursive: true });
|
|
14569
|
-
await writeFile(configPath, (0, import_dist.stringify)(validated), "utf-8");
|
|
19080
|
+
await writeFile(configPath, (0, import_dist$2.stringify)(validated), "utf-8");
|
|
14570
19081
|
}
|
|
14571
19082
|
/**
|
|
14572
19083
|
* Adds a source repository to the global configuration.
|
|
@@ -14813,7 +19324,7 @@ function getPreferencesPath(projectRoot) {
|
|
|
14813
19324
|
async function readProjectPreferences(projectRoot) {
|
|
14814
19325
|
const prefsPath = getPreferencesPath(projectRoot);
|
|
14815
19326
|
try {
|
|
14816
|
-
const parsed = (0, import_dist.parse)(await readFile(prefsPath, "utf-8"));
|
|
19327
|
+
const parsed = (0, import_dist$2.parse)(await readFile(prefsPath, "utf-8"));
|
|
14817
19328
|
return projectPreferencesSchema.parse(parsed);
|
|
14818
19329
|
} catch (error) {
|
|
14819
19330
|
if (error.code === "ENOENT") return null;
|
|
@@ -14833,7 +19344,7 @@ async function writeProjectPreferences(projectRoot, prefs) {
|
|
|
14833
19344
|
const validated = projectPreferencesSchema.parse(prefs);
|
|
14834
19345
|
const prefsPath = getPreferencesPath(projectRoot);
|
|
14835
19346
|
await mkdir(dirname(prefsPath), { recursive: true });
|
|
14836
|
-
await writeFile(prefsPath, (0, import_dist.stringify)(validated), "utf-8");
|
|
19347
|
+
await writeFile(prefsPath, (0, import_dist$2.stringify)(validated), "utf-8");
|
|
14837
19348
|
await ensureBatonDirGitignored(projectRoot);
|
|
14838
19349
|
}
|
|
14839
19350
|
|
|
@@ -14887,5 +19398,5 @@ async function resolvePreferences(projectRoot) {
|
|
|
14887
19398
|
}
|
|
14888
19399
|
|
|
14889
19400
|
//#endregion
|
|
14890
|
-
export {
|
|
14891
|
-
//# sourceMappingURL=src-
|
|
19401
|
+
export { parseSource as $, resolveProfileChain as A, cloneGitSource as B, mergeSkills as C, sortProfilesByWeight as D, isLockedProfile as E, removePlacedFiles as F, updateGitignore as G, collectComprehensivePatterns as H, generateLock as I, idePlatformRegistry as J, getIdePlatformTargetDir as K, readLock as L, placeFile as M, discoverProfilesInSourceRepo as N, mergeContentParts as O, findSourceManifest as P, parseFrontmatter as Q, writeLock as R, mergeRulesWithWarnings as S, getProfileWeight as T, ensureBatonDirGitignored as U, esm_default as V, removeGitignoreManagedSection as W, getAIToolAdaptersForKeys as X, isKnownIdePlatform as Y, getAllAIToolAdapters as Z, require_lib as _, clearIdeCache as a, getAIToolConfig as at, mergeAgentsWithWarnings as b, getDefaultGlobalSource as c, getGlobalSources as d, loadProfileManifest as et, loadGlobalConfig as f, setGlobalIdePlatforms as g, setGlobalAiTools as h, computeIntersection as i, SourceParseError as it, detectLegacyPaths as j, resolveProfileSupport as k, getGlobalAiTools as l, saveGlobalConfig as m, readProjectPreferences as n, KEBAB_CASE_REGEX as nt, detectInstalledIdes as o, getAIToolPath as ot, removeGlobalSource as p, getRegisteredIdePlatforms as q, writeProjectPreferences as r, FileNotFoundError as rt, addGlobalSource as s, getAllAIToolKeys as st, resolvePreferences as t, loadProjectManifest as tt, getGlobalIdePlatforms as u, mergeMemory as v, mergeSkillsWithWarnings as w, mergeRules as x, mergeMemoryWithWarnings as y, resolveVersion as z };
|
|
19402
|
+
//# sourceMappingURL=src-n95I0s2u.mjs.map
|