@taskless/cli 0.2.0 → 0.2.1
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/index.js +1229 -831
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import * as
|
|
2
|
+
import * as kt from "node:tty";
|
|
3
3
|
import { readFileSync as qn, existsSync as Dn } from "node:fs";
|
|
4
|
-
import { join as
|
|
4
|
+
import { join as _, resolve as H, dirname as at, basename as As } from "node:path";
|
|
5
5
|
import { homedir as Mn } from "node:os";
|
|
6
|
-
import { readFile as Ie, rm as
|
|
6
|
+
import { readFile as Ie, rm as Pe, mkdir as Ue, writeFile as qe, stat as Cs, readdir as Mt } from "node:fs/promises";
|
|
7
7
|
import { createRequire as Bn } from "node:module";
|
|
8
8
|
import { spawn as Fn } from "node:child_process";
|
|
9
9
|
import { createInterface as Kn } from "node:readline";
|
|
@@ -71,21 +71,21 @@ const M = {
|
|
|
71
71
|
level: M.verbose
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
function
|
|
74
|
+
function bt(s) {
|
|
75
75
|
if (s === null || typeof s != "object")
|
|
76
76
|
return !1;
|
|
77
77
|
const e = Object.getPrototypeOf(s);
|
|
78
78
|
return e !== null && e !== Object.prototype && Object.getPrototypeOf(e) !== null || Symbol.iterator in s ? !1 : Symbol.toStringTag in s ? Object.prototype.toString.call(s) === "[object Module]" : !0;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
if (!
|
|
82
|
-
return
|
|
80
|
+
function Lt(s, e, t = ".", n) {
|
|
81
|
+
if (!bt(e))
|
|
82
|
+
return Lt(s, {}, t);
|
|
83
83
|
const i = Object.assign({}, e);
|
|
84
84
|
for (const r in s) {
|
|
85
85
|
if (r === "__proto__" || r === "constructor")
|
|
86
86
|
continue;
|
|
87
87
|
const o = s[r];
|
|
88
|
-
o != null && (Array.isArray(o) && Array.isArray(i[r]) ? i[r] = [...o, ...i[r]] :
|
|
88
|
+
o != null && (Array.isArray(o) && Array.isArray(i[r]) ? i[r] = [...o, ...i[r]] : bt(o) && bt(i[r]) ? i[r] = Lt(
|
|
89
89
|
o,
|
|
90
90
|
i[r],
|
|
91
91
|
(t ? `${t}.` : "") + r.toString()
|
|
@@ -93,20 +93,20 @@ function Ct(s, e, t = ".", n) {
|
|
|
93
93
|
}
|
|
94
94
|
return i;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Wn(s) {
|
|
97
97
|
return (...e) => (
|
|
98
98
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
99
|
-
e.reduce((t, n) =>
|
|
99
|
+
e.reduce((t, n) => Lt(t, n, ""), {})
|
|
100
100
|
);
|
|
101
101
|
}
|
|
102
|
-
const
|
|
102
|
+
const Vn = Wn();
|
|
103
103
|
function Hn(s) {
|
|
104
104
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
105
105
|
}
|
|
106
106
|
function Yn(s) {
|
|
107
107
|
return !(!Hn(s) || !s.message && !s.args || s.stack);
|
|
108
108
|
}
|
|
109
|
-
let
|
|
109
|
+
let St = !1;
|
|
110
110
|
const ls = [];
|
|
111
111
|
class P {
|
|
112
112
|
options;
|
|
@@ -119,11 +119,11 @@ class P {
|
|
|
119
119
|
*/
|
|
120
120
|
constructor(e = {}) {
|
|
121
121
|
const t = e.types || as;
|
|
122
|
-
this.options =
|
|
122
|
+
this.options = Vn(
|
|
123
123
|
{
|
|
124
124
|
...e,
|
|
125
125
|
defaults: { ...e.defaults },
|
|
126
|
-
level:
|
|
126
|
+
level: vt(e.level, t),
|
|
127
127
|
reporters: [...e.reporters || []]
|
|
128
128
|
},
|
|
129
129
|
{
|
|
@@ -164,7 +164,7 @@ class P {
|
|
|
164
164
|
* @param {number} level - The new log level to set.
|
|
165
165
|
*/
|
|
166
166
|
set level(e) {
|
|
167
|
-
this.options.level =
|
|
167
|
+
this.options.level = vt(
|
|
168
168
|
e,
|
|
169
169
|
this.options.types,
|
|
170
170
|
this.options.level
|
|
@@ -302,13 +302,13 @@ class P {
|
|
|
302
302
|
* Pauses logging, queues incoming logs until resumed.
|
|
303
303
|
*/
|
|
304
304
|
pauseLogs() {
|
|
305
|
-
|
|
305
|
+
St = !0;
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
308
|
* Resumes logging, processing any queued logs.
|
|
309
309
|
*/
|
|
310
310
|
resumeLogs() {
|
|
311
|
-
|
|
311
|
+
St = !1;
|
|
312
312
|
const e = ls.splice(0);
|
|
313
313
|
for (const t of e)
|
|
314
314
|
t[0]._logFn(t[1], t[2]);
|
|
@@ -326,7 +326,7 @@ class P {
|
|
|
326
326
|
}
|
|
327
327
|
_wrapLogFn(e, t) {
|
|
328
328
|
return (...n) => {
|
|
329
|
-
if (
|
|
329
|
+
if (St) {
|
|
330
330
|
ls.push([this, e, n, t]);
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
@@ -340,7 +340,7 @@ class P {
|
|
|
340
340
|
date: /* @__PURE__ */ new Date(),
|
|
341
341
|
args: [],
|
|
342
342
|
...e,
|
|
343
|
-
level:
|
|
343
|
+
level: vt(e.level, this.options.types)
|
|
344
344
|
};
|
|
345
345
|
!n && t.length === 1 && Yn(t[0]) ? Object.assign(i, t[0]) : i.args = [...t], i.message && (i.args.unshift(i.message), delete i.message), i.additional && (Array.isArray(i.additional) || (i.additional = i.additional.split(`
|
|
346
346
|
`)), i.args.push(`
|
|
@@ -381,7 +381,7 @@ class P {
|
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function vt(s, e = {}, t = 3) {
|
|
385
385
|
return s === void 0 ? t : typeof s == "number" ? s : e[s] && e[s].level !== void 0 ? e[s].level : t;
|
|
386
386
|
}
|
|
387
387
|
P.prototype.add = P.prototype.addReporter;
|
|
@@ -391,10 +391,10 @@ P.prototype.withScope = P.prototype.withTag;
|
|
|
391
391
|
P.prototype.mock = P.prototype.mockTypes;
|
|
392
392
|
P.prototype.pause = P.prototype.pauseLogs;
|
|
393
393
|
P.prototype.resume = P.prototype.resumeLogs;
|
|
394
|
-
function
|
|
394
|
+
function zn(s = {}) {
|
|
395
395
|
return new P(s);
|
|
396
396
|
}
|
|
397
|
-
class
|
|
397
|
+
class Gn {
|
|
398
398
|
options;
|
|
399
399
|
defaultColor;
|
|
400
400
|
levelColorMap;
|
|
@@ -433,24 +433,24 @@ class zn {
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
function Qn(s = {}) {
|
|
436
|
-
return
|
|
437
|
-
reporters: s.reporters || [new
|
|
436
|
+
return zn({
|
|
437
|
+
reporters: s.reporters || [new Gn({})],
|
|
438
438
|
prompt(t, n = {}) {
|
|
439
439
|
return n.type === "confirm" ? Promise.resolve(confirm(t)) : Promise.resolve(prompt(t));
|
|
440
440
|
},
|
|
441
441
|
...s
|
|
442
442
|
});
|
|
443
443
|
}
|
|
444
|
-
const
|
|
444
|
+
const xe = Qn(), {
|
|
445
445
|
env: ie = {},
|
|
446
|
-
argv:
|
|
446
|
+
argv: Es = [],
|
|
447
447
|
platform: Xn = ""
|
|
448
|
-
} = typeof process > "u" ? {} : process, Zn = "NO_COLOR" in ie ||
|
|
449
|
-
function
|
|
450
|
-
return i + (o < 0 ? r :
|
|
448
|
+
} = typeof process > "u" ? {} : process, Zn = "NO_COLOR" in ie || Es.includes("--no-color"), ei = "FORCE_COLOR" in ie || Es.includes("--color"), ti = Xn === "win32", Ls = ie.TERM === "dumb", si = kt && kt.isatty && kt.isatty(1) && ie.TERM && !Ls, ni = "CI" in ie && ("GITHUB_ACTIONS" in ie || "GITLAB_CI" in ie || "CIRCLECI" in ie), ii = !Zn && (ei || ti && !Ls || si || ni);
|
|
449
|
+
function $s(s, e, t, n, i = e.slice(0, Math.max(0, s)) + n, r = e.slice(Math.max(0, s + t.length)), o = r.indexOf(t)) {
|
|
450
|
+
return i + (o < 0 ? r : $s(o, r, t, n));
|
|
451
451
|
}
|
|
452
452
|
function ri(s, e, t, n, i) {
|
|
453
|
-
return s < 0 ? t + e + n : t +
|
|
453
|
+
return s < 0 ? t + e + n : t + $s(s, e, n, i) + n;
|
|
454
454
|
}
|
|
455
455
|
function oi(s, e, t = s, n = s.length + 1) {
|
|
456
456
|
return (i) => i || !(i === "" || i === void 0) ? ri(
|
|
@@ -461,51 +461,51 @@ function oi(s, e, t = s, n = s.length + 1) {
|
|
|
461
461
|
t
|
|
462
462
|
) : "";
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function O(s, e, t) {
|
|
465
465
|
return oi(`\x1B[${s}m`, `\x1B[${e}m`, t);
|
|
466
466
|
}
|
|
467
467
|
const cs = {
|
|
468
|
-
reset:
|
|
469
|
-
bold:
|
|
470
|
-
dim:
|
|
471
|
-
italic:
|
|
472
|
-
underline:
|
|
473
|
-
inverse:
|
|
474
|
-
hidden:
|
|
475
|
-
strikethrough:
|
|
476
|
-
black:
|
|
477
|
-
red:
|
|
478
|
-
green:
|
|
479
|
-
yellow:
|
|
480
|
-
blue:
|
|
481
|
-
magenta:
|
|
482
|
-
cyan:
|
|
483
|
-
white:
|
|
484
|
-
gray:
|
|
485
|
-
bgBlack:
|
|
486
|
-
bgRed:
|
|
487
|
-
bgGreen:
|
|
488
|
-
bgYellow:
|
|
489
|
-
bgBlue:
|
|
490
|
-
bgMagenta:
|
|
491
|
-
bgCyan:
|
|
492
|
-
bgWhite:
|
|
493
|
-
blackBright:
|
|
494
|
-
redBright:
|
|
495
|
-
greenBright:
|
|
496
|
-
yellowBright:
|
|
497
|
-
blueBright:
|
|
498
|
-
magentaBright:
|
|
499
|
-
cyanBright:
|
|
500
|
-
whiteBright:
|
|
501
|
-
bgBlackBright:
|
|
502
|
-
bgRedBright:
|
|
503
|
-
bgGreenBright:
|
|
504
|
-
bgYellowBright:
|
|
505
|
-
bgBlueBright:
|
|
506
|
-
bgMagentaBright:
|
|
507
|
-
bgCyanBright:
|
|
508
|
-
bgWhiteBright:
|
|
468
|
+
reset: O(0, 0),
|
|
469
|
+
bold: O(1, 22, "\x1B[22m\x1B[1m"),
|
|
470
|
+
dim: O(2, 22, "\x1B[22m\x1B[2m"),
|
|
471
|
+
italic: O(3, 23),
|
|
472
|
+
underline: O(4, 24),
|
|
473
|
+
inverse: O(7, 27),
|
|
474
|
+
hidden: O(8, 28),
|
|
475
|
+
strikethrough: O(9, 29),
|
|
476
|
+
black: O(30, 39),
|
|
477
|
+
red: O(31, 39),
|
|
478
|
+
green: O(32, 39),
|
|
479
|
+
yellow: O(33, 39),
|
|
480
|
+
blue: O(34, 39),
|
|
481
|
+
magenta: O(35, 39),
|
|
482
|
+
cyan: O(36, 39),
|
|
483
|
+
white: O(37, 39),
|
|
484
|
+
gray: O(90, 39),
|
|
485
|
+
bgBlack: O(40, 49),
|
|
486
|
+
bgRed: O(41, 49),
|
|
487
|
+
bgGreen: O(42, 49),
|
|
488
|
+
bgYellow: O(43, 49),
|
|
489
|
+
bgBlue: O(44, 49),
|
|
490
|
+
bgMagenta: O(45, 49),
|
|
491
|
+
bgCyan: O(46, 49),
|
|
492
|
+
bgWhite: O(47, 49),
|
|
493
|
+
blackBright: O(90, 39),
|
|
494
|
+
redBright: O(91, 39),
|
|
495
|
+
greenBright: O(92, 39),
|
|
496
|
+
yellowBright: O(93, 39),
|
|
497
|
+
blueBright: O(94, 39),
|
|
498
|
+
magentaBright: O(95, 39),
|
|
499
|
+
cyanBright: O(96, 39),
|
|
500
|
+
whiteBright: O(97, 39),
|
|
501
|
+
bgBlackBright: O(100, 49),
|
|
502
|
+
bgRedBright: O(101, 49),
|
|
503
|
+
bgGreenBright: O(102, 49),
|
|
504
|
+
bgYellowBright: O(103, 49),
|
|
505
|
+
bgBlueBright: O(104, 49),
|
|
506
|
+
bgMagentaBright: O(105, 49),
|
|
507
|
+
bgCyanBright: O(106, 49),
|
|
508
|
+
bgWhiteBright: O(107, 49)
|
|
509
509
|
};
|
|
510
510
|
function ai(s = ii) {
|
|
511
511
|
return s ? cs : Object.fromEntries(Object.keys(cs).map((e) => [e, String]));
|
|
@@ -514,7 +514,7 @@ const Q = ai();
|
|
|
514
514
|
function li(s) {
|
|
515
515
|
return Array.isArray(s) ? s : s === void 0 ? [] : [s];
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function It(s, e = "") {
|
|
518
518
|
const t = [];
|
|
519
519
|
for (const n of s)
|
|
520
520
|
for (const [i, r] of n.entries())
|
|
@@ -526,7 +526,7 @@ function vt(s, e = "") {
|
|
|
526
526
|
).join(`
|
|
527
527
|
`);
|
|
528
528
|
}
|
|
529
|
-
function
|
|
529
|
+
function V(s) {
|
|
530
530
|
return typeof s == "function" ? s() : s;
|
|
531
531
|
}
|
|
532
532
|
class be extends Error {
|
|
@@ -539,7 +539,7 @@ function fi(s = "") {
|
|
|
539
539
|
if (!ci.test(s))
|
|
540
540
|
return s !== s.toLowerCase();
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function xs(s, e) {
|
|
543
543
|
const t = ui, n = [];
|
|
544
544
|
if (!s || typeof s != "string")
|
|
545
545
|
return n;
|
|
@@ -573,15 +573,15 @@ function hi(s) {
|
|
|
573
573
|
return s ? s[0].toLowerCase() + s.slice(1) : "";
|
|
574
574
|
}
|
|
575
575
|
function pi(s, e) {
|
|
576
|
-
return s ? (Array.isArray(s) ? s :
|
|
576
|
+
return s ? (Array.isArray(s) ? s : xs(s)).map((t) => di(t)).join("") : "";
|
|
577
577
|
}
|
|
578
578
|
function mi(s, e) {
|
|
579
579
|
return hi(pi(s || ""));
|
|
580
580
|
}
|
|
581
581
|
function gi(s, e) {
|
|
582
|
-
return s ? (Array.isArray(s) ? s :
|
|
582
|
+
return s ? (Array.isArray(s) ? s : xs(s)).map((t) => t.toLowerCase()).join("-") : "";
|
|
583
583
|
}
|
|
584
|
-
function
|
|
584
|
+
function Tt(s) {
|
|
585
585
|
return s == null ? [] : Array.isArray(s) ? s : [s];
|
|
586
586
|
}
|
|
587
587
|
function yi(s, e, t, n) {
|
|
@@ -594,9 +594,9 @@ function wi(s = [], e = {}) {
|
|
|
594
594
|
const a = { _: [] };
|
|
595
595
|
let l = 0, c = 0, h = 0;
|
|
596
596
|
const d = s.length, u = e.alias !== void 0, f = e.unknown !== void 0, g = e.default !== void 0;
|
|
597
|
-
if (e.alias = e.alias || {}, e.string =
|
|
597
|
+
if (e.alias = e.alias || {}, e.string = Tt(e.string), e.boolean = Tt(e.boolean), u)
|
|
598
598
|
for (t in e.alias)
|
|
599
|
-
for (n = e.alias[t] =
|
|
599
|
+
for (n = e.alias[t] = Tt(e.alias[t]), l = 0; l < n.length; l++)
|
|
600
600
|
(e.alias[n[l]] = n.concat(t)).splice(l, 1);
|
|
601
601
|
for (l = e.boolean.length; l-- > 0; )
|
|
602
602
|
for (n = e.alias[e.boolean[l]] || [], c = n.length; c-- > 0; )
|
|
@@ -650,7 +650,7 @@ function ki(s, e) {
|
|
|
650
650
|
mixed: [],
|
|
651
651
|
alias: {},
|
|
652
652
|
default: {}
|
|
653
|
-
}, n =
|
|
653
|
+
}, n = js(e);
|
|
654
654
|
for (const a of n)
|
|
655
655
|
a.type !== "positional" && (a.type === "string" ? t.string.push(a.name) : a.type === "boolean" && t.boolean.push(a.name), a.default !== void 0 && (t.default[a.name] = a.default), a.alias && (t.alias[a.name] = a.alias));
|
|
656
656
|
const i = wi(s, t), [...r] = i._, o = new Proxy(i, {
|
|
@@ -675,7 +675,7 @@ function ki(s, e) {
|
|
|
675
675
|
throw new be(`Missing required argument: --${a.name}`, "EARG");
|
|
676
676
|
return o;
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function js(s) {
|
|
679
679
|
const e = [];
|
|
680
680
|
for (const [t, n] of Object.entries(s || {}))
|
|
681
681
|
e.push({
|
|
@@ -685,8 +685,8 @@ function Rs(s) {
|
|
|
685
685
|
});
|
|
686
686
|
return e;
|
|
687
687
|
}
|
|
688
|
-
async function
|
|
689
|
-
const t = await
|
|
688
|
+
async function Rs(s, e) {
|
|
689
|
+
const t = await V(s.args || {}), n = ki(e.rawArgs, t), i = {
|
|
690
690
|
rawArgs: e.rawArgs,
|
|
691
691
|
args: n,
|
|
692
692
|
data: e.data,
|
|
@@ -695,7 +695,7 @@ async function xs(s, e) {
|
|
|
695
695
|
typeof s.setup == "function" && await s.setup(i);
|
|
696
696
|
let r;
|
|
697
697
|
try {
|
|
698
|
-
const o = await
|
|
698
|
+
const o = await V(s.subCommands);
|
|
699
699
|
if (o && Object.keys(o).length > 0) {
|
|
700
700
|
const a = e.rawArgs.findIndex(
|
|
701
701
|
(c) => !c.startsWith("-")
|
|
@@ -706,8 +706,8 @@ async function xs(s, e) {
|
|
|
706
706
|
`Unknown command \`${l}\``,
|
|
707
707
|
"E_UNKNOWN_COMMAND"
|
|
708
708
|
);
|
|
709
|
-
const c = await
|
|
710
|
-
c && await
|
|
709
|
+
const c = await V(o[l]);
|
|
710
|
+
c && await Rs(c, {
|
|
711
711
|
rawArgs: e.rawArgs.slice(a + 1)
|
|
712
712
|
});
|
|
713
713
|
} else if (!s.run)
|
|
@@ -720,9 +720,9 @@ async function xs(s, e) {
|
|
|
720
720
|
return { result: r };
|
|
721
721
|
}
|
|
722
722
|
async function $t(s, e, t) {
|
|
723
|
-
const n = await
|
|
723
|
+
const n = await V(s.subCommands);
|
|
724
724
|
if (n && Object.keys(n).length > 0) {
|
|
725
|
-
const i = e.findIndex((a) => !a.startsWith("-")), r = e[i], o = await
|
|
725
|
+
const i = e.findIndex((a) => !a.startsWith("-")), r = e[i], o = await V(n[r]);
|
|
726
726
|
if (o)
|
|
727
727
|
return $t(
|
|
728
728
|
o,
|
|
@@ -734,14 +734,14 @@ async function $t(s, e, t) {
|
|
|
734
734
|
}
|
|
735
735
|
async function Ps(s, e) {
|
|
736
736
|
try {
|
|
737
|
-
|
|
737
|
+
xe.log(await bi(s, e) + `
|
|
738
738
|
`);
|
|
739
739
|
} catch (t) {
|
|
740
|
-
|
|
740
|
+
xe.error(t);
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
743
|
async function bi(s, e) {
|
|
744
|
-
const t = await
|
|
744
|
+
const t = await V(s.meta || {}), n = js(await V(s.args || {})), i = await V(e?.meta || {}), r = `${i.name ? `${i.name} ` : ""}` + (t.name || process.argv[1]), o = [], a = [], l = [], c = [];
|
|
745
745
|
for (const f of n)
|
|
746
746
|
if (f.type === "positional") {
|
|
747
747
|
const g = f.name.toUpperCase(), p = f.required !== !1 && f.default === void 0, m = f.default ? `="${f.default}"` : "";
|
|
@@ -763,9 +763,9 @@ async function bi(s, e) {
|
|
|
763
763
|
]), g && c.push(p);
|
|
764
764
|
}
|
|
765
765
|
if (s.subCommands) {
|
|
766
|
-
const f = [], g = await
|
|
766
|
+
const f = [], g = await V(s.subCommands);
|
|
767
767
|
for (const [p, m] of Object.entries(g)) {
|
|
768
|
-
const k = await
|
|
768
|
+
const k = await V(m), y = await V(k?.meta);
|
|
769
769
|
l.push([`\`${p}\``, y?.description || ""]), f.push(p);
|
|
770
770
|
}
|
|
771
771
|
c.push(f.join("|"));
|
|
@@ -781,7 +781,7 @@ async function bi(s, e) {
|
|
|
781
781
|
return h.push(
|
|
782
782
|
`${Q.underline(Q.bold("USAGE"))} \`${r}${u ? " [OPTIONS]" : ""} ${c.join(" ")}\``,
|
|
783
783
|
""
|
|
784
|
-
), a.length > 0 && (h.push(Q.underline(Q.bold("ARGUMENTS")), ""), h.push(
|
|
784
|
+
), a.length > 0 && (h.push(Q.underline(Q.bold("ARGUMENTS")), ""), h.push(It(a, " ")), h.push("")), o.length > 0 && (h.push(Q.underline(Q.bold("OPTIONS")), ""), h.push(It(o, " ")), h.push("")), l.length > 0 && (h.push(Q.underline(Q.bold("COMMANDS")), ""), h.push(It(l, " ")), h.push(
|
|
785
785
|
"",
|
|
786
786
|
`Use \`${r} <command> --help\` for more information about a command.`
|
|
787
787
|
)), h.filter((f) => typeof f == "string").join(`
|
|
@@ -796,65 +796,65 @@ async function Si(s, e = {}) {
|
|
|
796
796
|
const i = typeof s.meta == "function" ? await s.meta() : await s.meta;
|
|
797
797
|
if (!i?.version)
|
|
798
798
|
throw new be("No version specified", "E_NO_VERSION");
|
|
799
|
-
|
|
799
|
+
xe.log(i.version);
|
|
800
800
|
} else
|
|
801
|
-
await
|
|
801
|
+
await Rs(s, { rawArgs: t });
|
|
802
802
|
} catch (i) {
|
|
803
803
|
const r = i instanceof be;
|
|
804
|
-
r ||
|
|
805
|
-
`), r && await n(...await $t(s, t)),
|
|
804
|
+
r || xe.error(i, `
|
|
805
|
+
`), r && await n(...await $t(s, t)), xe.error(i.message), process.exit(1);
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
808
|
const Bt = "auth.json";
|
|
809
|
-
function
|
|
810
|
-
const s = process.env.XDG_CONFIG_HOME ??
|
|
811
|
-
return
|
|
809
|
+
function lt() {
|
|
810
|
+
const s = process.env.XDG_CONFIG_HOME ?? _(Mn(), ".config");
|
|
811
|
+
return _(s, "taskless");
|
|
812
812
|
}
|
|
813
|
-
async function
|
|
813
|
+
async function Be() {
|
|
814
814
|
const s = process.env.TASKLESS_TOKEN;
|
|
815
815
|
if (s) return s;
|
|
816
816
|
try {
|
|
817
|
-
const e =
|
|
817
|
+
const e = _(lt(), Bt), t = await Ie(e, "utf8");
|
|
818
818
|
return JSON.parse(t).access_token;
|
|
819
819
|
} catch {
|
|
820
820
|
return;
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
823
|
async function vi(s) {
|
|
824
|
-
const e =
|
|
825
|
-
await
|
|
826
|
-
const t =
|
|
827
|
-
await
|
|
824
|
+
const e = lt();
|
|
825
|
+
await Ue(e, { recursive: !0 });
|
|
826
|
+
const t = _(e, Bt);
|
|
827
|
+
await qe(t, JSON.stringify(s, null, 2) + `
|
|
828
828
|
`, {
|
|
829
829
|
mode: 384
|
|
830
830
|
});
|
|
831
831
|
}
|
|
832
832
|
async function Ii() {
|
|
833
833
|
try {
|
|
834
|
-
const s =
|
|
835
|
-
return await
|
|
834
|
+
const s = _(lt(), Bt);
|
|
835
|
+
return await Pe(s), !0;
|
|
836
836
|
} catch {
|
|
837
837
|
return !1;
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
const
|
|
841
|
-
function
|
|
840
|
+
const Ti = "https://app.taskless.io/cli", Oi = "config.json";
|
|
841
|
+
function Ni() {
|
|
842
842
|
try {
|
|
843
|
-
const s =
|
|
843
|
+
const s = _(lt(), Oi), e = qn(s, "utf8");
|
|
844
844
|
return JSON.parse(e);
|
|
845
845
|
} catch {
|
|
846
846
|
return;
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
|
-
function
|
|
849
|
+
function xt() {
|
|
850
850
|
if (process.env.TASKLESS_API_URL) return process.env.TASKLESS_API_URL;
|
|
851
|
-
const s =
|
|
852
|
-
return s?.apiUrl ? s.apiUrl :
|
|
851
|
+
const s = Ni();
|
|
852
|
+
return s?.apiUrl ? s.apiUrl : Ti;
|
|
853
853
|
}
|
|
854
854
|
const us = "taskless-cli";
|
|
855
855
|
class _i {
|
|
856
856
|
async requestDeviceCode() {
|
|
857
|
-
const e =
|
|
857
|
+
const e = xt(), t = await fetch(`${e}/auth/device`, {
|
|
858
858
|
method: "POST",
|
|
859
859
|
headers: { "Content-Type": "application/json" },
|
|
860
860
|
body: JSON.stringify({ client_id: us })
|
|
@@ -868,7 +868,7 @@ class _i {
|
|
|
868
868
|
return await t.json();
|
|
869
869
|
}
|
|
870
870
|
async pollForToken(e) {
|
|
871
|
-
const t =
|
|
871
|
+
const t = xt(), n = await fetch(`${t}/auth/token`, {
|
|
872
872
|
method: "POST",
|
|
873
873
|
headers: { "Content-Type": "application/json" },
|
|
874
874
|
body: JSON.stringify({
|
|
@@ -903,13 +903,13 @@ class _i {
|
|
|
903
903
|
};
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
const fs = new _i(),
|
|
906
|
+
const fs = new _i(), Ai = {
|
|
907
907
|
meta: {
|
|
908
908
|
name: "login",
|
|
909
909
|
description: "Authenticate with taskless.io"
|
|
910
910
|
},
|
|
911
911
|
async run() {
|
|
912
|
-
if (await
|
|
912
|
+
if (await Be()) {
|
|
913
913
|
console.log("You are already logged in."), console.log("Run `taskless auth logout` first to re-authenticate.");
|
|
914
914
|
return;
|
|
915
915
|
}
|
|
@@ -957,7 +957,7 @@ Open this URL in your browser:
|
|
|
957
957
|
), process.exitCode = 1;
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
|
-
},
|
|
960
|
+
}, Ci = {
|
|
961
961
|
meta: {
|
|
962
962
|
name: "logout",
|
|
963
963
|
description: "Remove saved authentication"
|
|
@@ -966,17 +966,17 @@ Open this URL in your browser:
|
|
|
966
966
|
const s = await Ii();
|
|
967
967
|
console.log(s ? "Logged out." : "Not logged in.");
|
|
968
968
|
}
|
|
969
|
-
},
|
|
969
|
+
}, Ei = {
|
|
970
970
|
meta: {
|
|
971
971
|
name: "auth",
|
|
972
972
|
description: "Manage authentication with taskless.io"
|
|
973
973
|
},
|
|
974
974
|
subCommands: {
|
|
975
|
-
login:
|
|
976
|
-
logout:
|
|
975
|
+
login: Ai,
|
|
976
|
+
logout: Ci
|
|
977
977
|
}
|
|
978
978
|
};
|
|
979
|
-
function
|
|
979
|
+
function Li(s) {
|
|
980
980
|
return {
|
|
981
981
|
source: "ast-grep",
|
|
982
982
|
ruleId: s.ruleId,
|
|
@@ -992,32 +992,32 @@ function $i(s) {
|
|
|
992
992
|
fix: s.replacement
|
|
993
993
|
};
|
|
994
994
|
}
|
|
995
|
-
function
|
|
996
|
-
const s =
|
|
995
|
+
function $i() {
|
|
996
|
+
const s = at(Jn(import.meta.url)), e = H(s, "..", "node_modules", ".bin"), t = process.platform === "win32" ? ";" : ":";
|
|
997
997
|
return `${e}${t}${process.env.PATH ?? ""}`;
|
|
998
998
|
}
|
|
999
|
-
function
|
|
999
|
+
function xi() {
|
|
1000
1000
|
const s = [process.platform, process.arch];
|
|
1001
1001
|
process.platform === "linux" ? s.push("gnu") : process.platform === "win32" && s.push("msvc");
|
|
1002
1002
|
const e = `@ast-grep/cli-${s.join("-")}`, t = process.platform === "win32" ? "ast-grep.exe" : "ast-grep";
|
|
1003
1003
|
try {
|
|
1004
|
-
const i = Bn(import.meta.url).resolve(`${e}/package.json`), r = H(
|
|
1004
|
+
const i = Bn(import.meta.url).resolve(`${e}/package.json`), r = H(at(i), t);
|
|
1005
1005
|
if (Dn(r))
|
|
1006
1006
|
return r;
|
|
1007
1007
|
} catch {
|
|
1008
1008
|
}
|
|
1009
1009
|
return "sg";
|
|
1010
1010
|
}
|
|
1011
|
-
async function
|
|
1011
|
+
async function ji(s) {
|
|
1012
1012
|
return new Promise((e, t) => {
|
|
1013
|
-
const n =
|
|
1013
|
+
const n = xi(), r = Fn(
|
|
1014
1014
|
n,
|
|
1015
1015
|
["scan", "--config", ".taskless/sgconfig.yml", "--json=stream"],
|
|
1016
1016
|
{
|
|
1017
1017
|
shell: n === "sg",
|
|
1018
1018
|
cwd: s,
|
|
1019
1019
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1020
|
-
env: { ...process.env, PATH:
|
|
1020
|
+
env: { ...process.env, PATH: $i() }
|
|
1021
1021
|
}
|
|
1022
1022
|
), o = [], a = [];
|
|
1023
1023
|
Kn({ input: r.stdout }).on("line", (c) => {
|
|
@@ -1025,7 +1025,7 @@ async function Ri(s) {
|
|
|
1025
1025
|
if (h !== "")
|
|
1026
1026
|
try {
|
|
1027
1027
|
const d = JSON.parse(h);
|
|
1028
|
-
o.push(
|
|
1028
|
+
o.push(Li(d));
|
|
1029
1029
|
} catch {
|
|
1030
1030
|
}
|
|
1031
1031
|
}), r.stderr.on("data", (c) => {
|
|
@@ -1050,7 +1050,7 @@ async function Ri(s) {
|
|
|
1050
1050
|
});
|
|
1051
1051
|
});
|
|
1052
1052
|
}
|
|
1053
|
-
function
|
|
1053
|
+
function Ri(s) {
|
|
1054
1054
|
if (s.length === 0)
|
|
1055
1055
|
return "No issues found.";
|
|
1056
1056
|
const e = [];
|
|
@@ -1117,8 +1117,8 @@ const Pi = {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
},
|
|
1119
1119
|
async run({ args: s }) {
|
|
1120
|
-
const e = H(s.dir ?? process.cwd()), t =
|
|
1121
|
-
if (!await
|
|
1120
|
+
const e = H(s.dir ?? process.cwd()), t = _(e, ".taskless", "taskless.json");
|
|
1121
|
+
if (!await Cs(t).then((a) => a.isFile()).catch(() => !1)) {
|
|
1122
1122
|
const a = "Error: .taskless/taskless.json not found. Run `taskless init` to set up your project.";
|
|
1123
1123
|
s.json ? console.log(se([], { success: !1, error: a })) : console.error(a), process.exit(1);
|
|
1124
1124
|
}
|
|
@@ -1145,7 +1145,7 @@ const Pi = {
|
|
|
1145
1145
|
const a = `Error: Scaffold version ${i} is below the minimum required for 'taskless check'. Run \`taskless update-engine\` to update.`;
|
|
1146
1146
|
s.json ? console.log(se([], { success: !1, error: a })) : console.error(a), process.exit(1);
|
|
1147
1147
|
}
|
|
1148
|
-
const r =
|
|
1148
|
+
const r = _(e, ".taskless", "rules");
|
|
1149
1149
|
let o = [];
|
|
1150
1150
|
try {
|
|
1151
1151
|
o = (await Mt(r)).filter((l) => l.endsWith(".yml"));
|
|
@@ -1157,7 +1157,7 @@ const Pi = {
|
|
|
1157
1157
|
" If you expected rules here, check that your Taskless skills have generated .yml rule files."
|
|
1158
1158
|
)), process.exit(0));
|
|
1159
1159
|
try {
|
|
1160
|
-
const { results: a } = await
|
|
1160
|
+
const { results: a } = await ji(e), l = s.json ? se(a) : Ri(a);
|
|
1161
1161
|
console.log(l);
|
|
1162
1162
|
const c = a.some((h) => h.severity === "error");
|
|
1163
1163
|
process.exit(c ? 1 : 0);
|
|
@@ -1171,7 +1171,7 @@ name: taskless-check
|
|
|
1171
1171
|
description: Checks a repository using the Taskless rules via the CLI. Use when the user wants to run a check, test rules, or validate code against taskless rules. Trigger on "check my code", "run taskless check", "test my rules", or "validate with taskless".
|
|
1172
1172
|
metadata:
|
|
1173
1173
|
author: taskless
|
|
1174
|
-
version: 0.2.
|
|
1174
|
+
version: 0.2.1
|
|
1175
1175
|
commandName: tskl:check
|
|
1176
1176
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1177
1177
|
---
|
|
@@ -1194,7 +1194,7 @@ name: taskless-create-rule
|
|
|
1194
1194
|
description: Creates a new Taskless rule from a description. Use when the user wants to create a rule, add a lint rule, define a code pattern to detect, or generate an ast-grep rule. Trigger on "create a rule", "add a taskless rule", "new rule for", or "detect this pattern".
|
|
1195
1195
|
metadata:
|
|
1196
1196
|
author: taskless
|
|
1197
|
-
version: 0.2.
|
|
1197
|
+
version: 0.2.1
|
|
1198
1198
|
commandName: tskl:rule
|
|
1199
1199
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1200
1200
|
---
|
|
@@ -1278,7 +1278,7 @@ name: taskless-delete-rule
|
|
|
1278
1278
|
description: Deletes a Taskless rule and its test files. Use when the user wants to remove a rule, delete a lint rule, or clean up an unwanted rule. Trigger on "delete rule", "remove taskless rule", "delete this rule", or "remove rule".
|
|
1279
1279
|
metadata:
|
|
1280
1280
|
author: taskless
|
|
1281
|
-
version: 0.2.
|
|
1281
|
+
version: 0.2.1
|
|
1282
1282
|
commandName: "-"
|
|
1283
1283
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1284
1284
|
---
|
|
@@ -1313,7 +1313,7 @@ name: taskless-improve-rule
|
|
|
1313
1313
|
description: Improves existing Taskless rules by iterating with guidance. Use when the user wants to refine, fix, or improve existing rules. Trigger on "improve rule", "fix my rule", "iterate on rule", "refine taskless rule", or "my rule isn't working".
|
|
1314
1314
|
metadata:
|
|
1315
1315
|
author: taskless
|
|
1316
|
-
version: 0.2.
|
|
1316
|
+
version: 0.2.1
|
|
1317
1317
|
commandName: tskl:improve
|
|
1318
1318
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1319
1319
|
---
|
|
@@ -1443,7 +1443,7 @@ name: taskless-info
|
|
|
1443
1443
|
description: Confirms that the Taskless skills plugin is installed and working. Use when the user wants to verify their Taskless setup, check plugin status, test the connection, or run a health check. Trigger on "is taskless working", "check taskless", "taskless status", or "taskless info".
|
|
1444
1444
|
metadata:
|
|
1445
1445
|
author: taskless
|
|
1446
|
-
version: 0.2.
|
|
1446
|
+
version: 0.2.1
|
|
1447
1447
|
commandName: tskl:info
|
|
1448
1448
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1449
1449
|
---
|
|
@@ -1493,7 +1493,7 @@ name: taskless-login
|
|
|
1493
1493
|
description: Explains how to authenticate with Taskless. Use when the user wants to log in, authenticate, connect their account, or set up credentials. Trigger on "taskless login", "authenticate taskless", "taskless auth", or "connect to taskless".
|
|
1494
1494
|
metadata:
|
|
1495
1495
|
author: taskless
|
|
1496
|
-
version: 0.2.
|
|
1496
|
+
version: 0.2.1
|
|
1497
1497
|
commandName: tskl:login
|
|
1498
1498
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1499
1499
|
---
|
|
@@ -1514,7 +1514,7 @@ name: taskless-logout
|
|
|
1514
1514
|
description: Explains how to remove saved Taskless authentication. Use when the user wants to log out, disconnect, remove credentials, or clear their Taskless session. Trigger on "taskless logout", "disconnect taskless", or "remove taskless auth".
|
|
1515
1515
|
metadata:
|
|
1516
1516
|
author: taskless
|
|
1517
|
-
version: 0.2.
|
|
1517
|
+
version: 0.2.1
|
|
1518
1518
|
commandName: tskl:logout
|
|
1519
1519
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1520
1520
|
---
|
|
@@ -1535,7 +1535,7 @@ name: taskless-update-engine
|
|
|
1535
1535
|
description: Requests a scaffold upgrade for the .taskless/ engine directory. Use when the user needs to update their Taskless scaffold, upgrade their engine version, or when the CLI reports a stale scaffold version. Trigger on "update engine", "upgrade taskless", "taskless update-engine", or "scaffold is out of date".
|
|
1536
1536
|
metadata:
|
|
1537
1537
|
author: taskless
|
|
1538
|
-
version: 0.2.
|
|
1538
|
+
version: 0.2.1
|
|
1539
1539
|
commandName: tskl:update-engine
|
|
1540
1540
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1541
1541
|
---
|
|
@@ -1567,41 +1567,421 @@ When this skill is invoked, run the update-engine CLI command to request a scaff
|
|
|
1567
1567
|
- **Authentication required**: Suggest the \`taskless-login\` skill.
|
|
1568
1568
|
- **Missing config**: Suggest running \`pnpm dlx @taskless/cli@latest init\` to set up the project.
|
|
1569
1569
|
- **API errors**: Report the error message and suggest trying again.
|
|
1570
|
-
`,
|
|
1571
|
-
|
|
1570
|
+
`, Wi = `---
|
|
1571
|
+
name: "Taskless: Check"
|
|
1572
|
+
description: Checks a repository using the Taskless rules via the CLI. Use when the user wants to run a check, test rules, or validate code against taskless rules. Trigger on "check my code", "run taskless check", "test my rules", or "validate with taskless".
|
|
1573
|
+
category: Taskless
|
|
1574
|
+
tags:
|
|
1575
|
+
- taskless
|
|
1576
|
+
metadata:
|
|
1577
|
+
author: taskless
|
|
1578
|
+
version: 0.2.1
|
|
1579
|
+
commandName: tskl:check
|
|
1580
|
+
---
|
|
1581
|
+
|
|
1582
|
+
# Taskless Check
|
|
1583
|
+
|
|
1584
|
+
When this skill is invoked, perform a check of the codebase using the Taskless CLI and report the results.
|
|
1585
|
+
|
|
1586
|
+
## Instructions
|
|
1587
|
+
|
|
1588
|
+
1. **Read current command documentation.** Run \`pnpm dlx @taskless/cli@latest help check\` and read the output. Use this to understand the command's options, output format, and exit codes.
|
|
1589
|
+
|
|
1590
|
+
2. **Invoke the CLI with JSON output.** Run \`pnpm dlx @taskless/cli@latest check --json\` and capture stdout.
|
|
1591
|
+
|
|
1592
|
+
3. **Parse the response.** Parse the JSON output with \`JSON.parse()\`. Use the fields described in the help output to determine success or failure and report any issues found to the user.
|
|
1593
|
+
|
|
1594
|
+
4. **Handle errors.** If the command exits with a non-zero code or the output is not valid JSON, report the error and suggest running \`pnpm dlx @taskless/cli@latest init\` if configuration is missing.
|
|
1595
|
+
`, Vi = `---
|
|
1596
|
+
name: "Taskless: Improve"
|
|
1597
|
+
description: Improves existing Taskless rules by iterating with guidance. Use when the user wants to refine, fix, or improve existing rules. Trigger on "improve rule", "fix my rule", "iterate on rule", "refine taskless rule", or "my rule isn't working".
|
|
1598
|
+
category: Taskless
|
|
1599
|
+
tags:
|
|
1600
|
+
- taskless
|
|
1601
|
+
metadata:
|
|
1602
|
+
author: taskless
|
|
1603
|
+
version: 0.2.1
|
|
1604
|
+
commandName: tskl:improve
|
|
1605
|
+
---
|
|
1606
|
+
|
|
1607
|
+
# Taskless Improve
|
|
1608
|
+
|
|
1609
|
+
When this skill is invoked, help the user improve an existing Taskless rule by determining the best approach and executing it.
|
|
1610
|
+
|
|
1611
|
+
This is a decision-making skill. You must evaluate the situation and choose the right strategy — not every improvement is a simple iteration.
|
|
1612
|
+
|
|
1613
|
+
## Instructions
|
|
1614
|
+
|
|
1615
|
+
1. **Read current command documentation.** Run \`pnpm dlx @taskless/cli@latest help rules improve\` and read the output. Use this to understand the improve command's \`--from\` JSON fields, options, and examples.
|
|
1616
|
+
|
|
1617
|
+
2. **Inventory existing rules.** Scan the \`.taskless/rules/\` directory for \`.yml\` files. Read each rule file to understand what rules exist. For each rule, note:
|
|
1618
|
+
- The rule ID (filename without \`.yml\`)
|
|
1619
|
+
- The language it targets
|
|
1620
|
+
- The pattern it detects (from the \`message\`, \`note\`, or \`rule\` fields)
|
|
1621
|
+
- Any associated test files in \`.taskless/tests/\`
|
|
1622
|
+
|
|
1623
|
+
Present a summary of the existing rules to the user if they have not indicated a specific rule they want to improve.
|
|
1624
|
+
|
|
1625
|
+
3. **Understand the improvement request.** Ask the user what they want to improve. Gather specifics:
|
|
1626
|
+
- Which rule(s) are problematic?
|
|
1627
|
+
- What is the rule doing wrong? (false positives, false negatives, wrong fix, missing edge cases, etc.)
|
|
1628
|
+
- Can they show an example of the incorrect behavior?
|
|
1629
|
+
- What would the correct behavior look like?
|
|
1630
|
+
|
|
1631
|
+
4. **Search for evidence in the codebase.** Proactively scan the codebase for instances where the rule is triggering (or failing to trigger). Show the user what you found:
|
|
1632
|
+
- "I found N places where this rule fires. Are any of these false positives?"
|
|
1633
|
+
- "I found N places where this pattern exists but the rule doesn't catch it. Should it?"
|
|
1634
|
+
|
|
1635
|
+
5. **Decide on approach.** Based on the user's feedback and your analysis, determine the best strategy:
|
|
1636
|
+
|
|
1637
|
+
### Option A — Iterate on a single rule (most common)
|
|
1638
|
+
|
|
1639
|
+
Use this when the user wants to refine an existing rule that is fundamentally correct but needs adjustment. Examples:
|
|
1640
|
+
- The rule has false positives that need to be excluded
|
|
1641
|
+
- The rule misses certain variations of the pattern
|
|
1642
|
+
- The fix suggestion is incorrect or incomplete
|
|
1643
|
+
- The rule needs to handle edge cases better
|
|
1644
|
+
|
|
1645
|
+
### Option B — Replace an existing rule
|
|
1646
|
+
|
|
1647
|
+
Use this when the rule is fundamentally wrong and needs a completely different approach. Examples:
|
|
1648
|
+
- The rule's pattern matching strategy is incorrect (e.g., using string matching when AST matching is better suited to the task)
|
|
1649
|
+
- The rule targets the wrong language construct entirely
|
|
1650
|
+
- The user's requirements have changed significantly from the original rule
|
|
1651
|
+
|
|
1652
|
+
For this approach: create a new rule (via the rule create flow) and then delete the old one.
|
|
1653
|
+
|
|
1654
|
+
### Option C — Create additional rules
|
|
1655
|
+
|
|
1656
|
+
Use this when the user's need has expanded beyond what a single rule can cover. Examples:
|
|
1657
|
+
- The user wants to detect the same pattern in multiple languages
|
|
1658
|
+
- The pattern has distinct variants that are better handled by separate rules
|
|
1659
|
+
- The user wants related but distinct checks
|
|
1660
|
+
|
|
1661
|
+
For this approach: create new rules and optionally remove old ones that are being superseded.
|
|
1662
|
+
|
|
1663
|
+
**Present your chosen approach to the user and get confirmation before proceeding.**
|
|
1664
|
+
|
|
1665
|
+
6. **Execute the chosen approach.**
|
|
1666
|
+
|
|
1667
|
+
### For Option A (iterate):
|
|
1668
|
+
|
|
1669
|
+
a. **Build the JSON payload.** Create a JSON object with:
|
|
1670
|
+
- \`ruleId\`: The rule ID to iterate on (this is the internal request ID from when the rule was generated — check the rule's YAML metadata for this, or use the rule filename as a fallback identifier). Providing the rule ID allows the API to understand the existing rule's logic and how to adjust it based on your guidance.
|
|
1671
|
+
- \`guidance\`: A clear, specific description of what should change. Include:
|
|
1672
|
+
- What the rule is doing wrong
|
|
1673
|
+
- What it should do instead
|
|
1674
|
+
- Specific examples of false positives/negatives
|
|
1675
|
+
- Any exclusions or edge cases to handle
|
|
1676
|
+
- \`references\` (optional): Include the current rule file and test file contents so the API has full context. Each reference is \`{ "filename": "<path relative to .taskless/>", "content": "<file contents>" }\`.
|
|
1677
|
+
|
|
1678
|
+
Example payload:
|
|
1679
|
+
|
|
1680
|
+
\`\`\`json
|
|
1681
|
+
{
|
|
1682
|
+
"ruleId": "abc123-def456",
|
|
1683
|
+
"guidance": "The rule currently flags console.log statements inside catch blocks, but these are intentional error logging. Exclude console.log/console.error/console.warn calls that appear inside catch blocks. Also exclude any console calls in files under src/scripts/ as those are CLI tools where console output is expected.",
|
|
1684
|
+
"references": [
|
|
1685
|
+
{
|
|
1686
|
+
"filename": "rules/no-console-log.yml",
|
|
1687
|
+
"content": "id: no-console-log\\nlanguage: typescript\\n..."
|
|
1688
|
+
},
|
|
1689
|
+
{
|
|
1690
|
+
"filename": "tests/no-console-log-test.yml",
|
|
1691
|
+
"content": "id: no-console-log\\n..."
|
|
1692
|
+
}
|
|
1693
|
+
]
|
|
1694
|
+
}
|
|
1695
|
+
\`\`\`
|
|
1696
|
+
|
|
1697
|
+
b. **Write the JSON to a temp file.** Write to \`.taskless/.tmp-improve-request.json\`.
|
|
1698
|
+
|
|
1699
|
+
c. **Invoke the CLI.** Run \`pnpm dlx @taskless/cli@latest rules improve --from .taskless/.tmp-improve-request.json --json\`. The command may take 30-60 seconds as it polls the API.
|
|
1700
|
+
|
|
1701
|
+
d. **Clean up.** After the command completes (success or failure), delete \`.taskless/.tmp-improve-request.json\`.
|
|
1702
|
+
|
|
1703
|
+
e. **Report results.** Show the updated file paths.
|
|
1704
|
+
|
|
1705
|
+
### For Option B (replace):
|
|
1706
|
+
|
|
1707
|
+
a. Note the old rule ID for deletion.
|
|
1708
|
+
b. Work with the user to create a new rule following the same process as the \`taskless-create-rule\` skill (gather prompt, examples, exclusions, etc.).
|
|
1709
|
+
c. Run the create command: \`pnpm dlx @taskless/cli@latest rules create --from .taskless/.tmp-rule-request.json --json\`.
|
|
1710
|
+
d. After the new rule is generated, delete the old rule: \`pnpm dlx @taskless/cli@latest rules delete <old-rule-id>\`.
|
|
1711
|
+
e. Clean up temp files and report results.
|
|
1712
|
+
|
|
1713
|
+
### For Option C (expand):
|
|
1714
|
+
|
|
1715
|
+
a. For each new rule needed, follow the \`taskless-create-rule\` process.
|
|
1716
|
+
b. If any old rules are being superseded, delete them after the new rules are created.
|
|
1717
|
+
c. Report all changes.
|
|
1718
|
+
|
|
1719
|
+
7. **Suggest testing.** After any approach, suggest running \`taskless-check\` to test the updated rules against the codebase.
|
|
1720
|
+
|
|
1721
|
+
8. **Handle errors.** If the CLI fails:
|
|
1722
|
+
- **Authentication required**: Suggest the \`taskless-login\` skill.
|
|
1723
|
+
- **Missing config**: Suggest running \`pnpm dlx @taskless/cli@latest init\` to set up the project.
|
|
1724
|
+
- **Stale scaffold version**: Suggest the \`taskless-update-engine\` skill.
|
|
1725
|
+
- **Rule not found**: The ruleId may be incorrect. Check the rule's metadata or suggest creating a new rule instead.
|
|
1726
|
+
- **API errors**: Report the error message and suggest trying again.
|
|
1727
|
+
`, Hi = `---
|
|
1728
|
+
name: "Taskless: Info"
|
|
1729
|
+
description: Confirms that the Taskless skills plugin is installed and working. Use when the user wants to verify their Taskless setup, check plugin status, test the connection, or run a health check. Trigger on "is taskless working", "check taskless", "taskless status", or "taskless info".
|
|
1730
|
+
category: Taskless
|
|
1731
|
+
tags:
|
|
1732
|
+
- taskless
|
|
1733
|
+
metadata:
|
|
1734
|
+
author: taskless
|
|
1735
|
+
version: 0.2.1
|
|
1736
|
+
commandName: tskl:info
|
|
1737
|
+
---
|
|
1738
|
+
|
|
1739
|
+
# Taskless Info
|
|
1740
|
+
|
|
1741
|
+
When this skill is invoked, verify that the Taskless CLI is reachable and report its version.
|
|
1742
|
+
|
|
1743
|
+
## Instructions
|
|
1744
|
+
|
|
1745
|
+
1. **Read current command documentation.** Run \`pnpm dlx @taskless/cli@latest help info\` and read the output. Use this to understand the command's output format and available options.
|
|
1746
|
+
|
|
1747
|
+
2. **Invoke the CLI.** Run \`pnpm dlx @taskless/cli@latest info\` and capture stdout.
|
|
1748
|
+
|
|
1749
|
+
3. **Parse the response.** The CLI outputs JSON to stdout. Parse it with \`JSON.parse()\` and extract the fields described in the help output. Key fields to report:
|
|
1750
|
+
- \`version\`: The version of the Taskless CLI.
|
|
1751
|
+
- \`tools\`: An array of coding agent tools with their installed skills and versions.
|
|
1752
|
+
- \`loggedIn\`: Indicates if the user is logged into Taskless.
|
|
1753
|
+
|
|
1754
|
+
4. **Report the result.** Display a confirmation message with the version:
|
|
1755
|
+
|
|
1756
|
+
\`\`\`
|
|
1757
|
+
Taskless skills plugin is installed and working.
|
|
1758
|
+
CLI version: <version>
|
|
1759
|
+
|
|
1760
|
+
Tools:
|
|
1761
|
+
- <Tool Name>
|
|
1762
|
+
- <Skill Name>: Installed version <installedVersion>, Current version <currentVersion>, Up to date: <current as "YES" or "NO">
|
|
1763
|
+
...
|
|
1764
|
+
\`\`\`
|
|
1765
|
+
|
|
1766
|
+
5. **Handle errors.** If the command fails (non-zero exit code) or the output is not valid JSON:
|
|
1767
|
+
- Report that the Taskless CLI could not be reached.
|
|
1768
|
+
- Suggest checking network connectivity and that npm/pnpm is available.
|
|
1769
|
+
- Show the raw error output if available.
|
|
1770
|
+
|
|
1771
|
+
6. **Report if Upgrade is Required** If any installed skill is not current, include a note that an upgrade is recommended. Offer to run \`pnpm dlx @taskless/cli@latest init\` for them to reinitialize with the latest skills.
|
|
1772
|
+
|
|
1773
|
+
## Example Output
|
|
1774
|
+
|
|
1775
|
+
\`\`\`
|
|
1776
|
+
Taskless skills plugin is installed and working.
|
|
1777
|
+
CLI version: 0.0.1
|
|
1778
|
+
\`\`\`
|
|
1779
|
+
`, Yi = `---
|
|
1780
|
+
name: "Taskless: Login"
|
|
1781
|
+
description: Explains how to authenticate with Taskless. Use when the user wants to log in, authenticate, connect their account, or set up credentials. Trigger on "taskless login", "authenticate taskless", "taskless auth", or "connect to taskless".
|
|
1782
|
+
category: Taskless
|
|
1783
|
+
tags:
|
|
1784
|
+
- taskless
|
|
1785
|
+
metadata:
|
|
1786
|
+
author: taskless
|
|
1787
|
+
version: 0.2.1
|
|
1788
|
+
commandName: tskl:login
|
|
1789
|
+
---
|
|
1790
|
+
|
|
1791
|
+
# Taskless Login
|
|
1792
|
+
|
|
1793
|
+
When this skill is invoked, explain the authentication process and provide the CLI command the user needs to run.
|
|
1794
|
+
|
|
1795
|
+
**Important:** Do NOT attempt to run the login command. The device flow requires interactive terminal input (displaying a URL and polling for browser-based authorization) that cannot be performed by an agent.
|
|
1796
|
+
|
|
1797
|
+
## Instructions
|
|
1798
|
+
|
|
1799
|
+
1. **Read current command documentation.** Run \`pnpm dlx @taskless/cli@latest help auth login\` and read the output. Use this to understand the login flow, credential storage, and alternatives.
|
|
1800
|
+
|
|
1801
|
+
2. **Present the login command and explain the process.** Using the information from the help output, display the command the user should run in their terminal and explain what will happen (device flow, credential storage, environment variable alternative).
|
|
1802
|
+
`, zi = `---
|
|
1803
|
+
name: "Taskless: Logout"
|
|
1804
|
+
description: Explains how to remove saved Taskless authentication. Use when the user wants to log out, disconnect, remove credentials, or clear their Taskless session. Trigger on "taskless logout", "disconnect taskless", or "remove taskless auth".
|
|
1805
|
+
category: Taskless
|
|
1806
|
+
tags:
|
|
1807
|
+
- taskless
|
|
1808
|
+
metadata:
|
|
1809
|
+
author: taskless
|
|
1810
|
+
version: 0.2.1
|
|
1811
|
+
commandName: tskl:logout
|
|
1812
|
+
---
|
|
1813
|
+
|
|
1814
|
+
# Taskless Logout
|
|
1815
|
+
|
|
1816
|
+
When this skill is invoked, explain how to remove saved authentication and provide the CLI command.
|
|
1817
|
+
|
|
1818
|
+
**Important:** Do NOT attempt to run the logout command. Provide the command for the user to run in their terminal.
|
|
1819
|
+
|
|
1820
|
+
## Instructions
|
|
1821
|
+
|
|
1822
|
+
1. **Read current command documentation.** Run \`pnpm dlx @taskless/cli@latest help auth logout\` and read the output. Use this to understand what the command does, credential storage location, and any caveats.
|
|
1823
|
+
|
|
1824
|
+
2. **Present the logout command and explain what it does.** Using the information from the help output, display the command the user should run and explain the effects (credential removal, environment variable note).
|
|
1825
|
+
`, Gi = `---
|
|
1826
|
+
name: "Taskless: Rule"
|
|
1827
|
+
description: Creates a new Taskless rule from a description. Use when the user wants to create a rule, add a lint rule, define a code pattern to detect, or generate an ast-grep rule. Trigger on "create a rule", "add a taskless rule", "new rule for", or "detect this pattern".
|
|
1828
|
+
category: Taskless
|
|
1829
|
+
tags:
|
|
1830
|
+
- taskless
|
|
1831
|
+
metadata:
|
|
1832
|
+
author: taskless
|
|
1833
|
+
version: 0.2.1
|
|
1834
|
+
commandName: tskl:rule
|
|
1835
|
+
---
|
|
1836
|
+
|
|
1837
|
+
# Taskless Rule Create
|
|
1838
|
+
|
|
1839
|
+
When this skill is invoked, work with the user to build a comprehensive rule request, then write a JSON file and run the CLI to generate a rule.
|
|
1840
|
+
|
|
1841
|
+
Your goal is to produce the best possible rule by enriching the user's initial description with concrete examples, edge cases, and exclusions — not just pass their request through verbatim.
|
|
1842
|
+
|
|
1843
|
+
## Instructions
|
|
1844
|
+
|
|
1845
|
+
1. **Read current command documentation.** Run \`pnpm dlx @taskless/cli@latest help rules create\` and read the output. Use this to understand the command's \`--from\` JSON fields, options, and examples.
|
|
1846
|
+
|
|
1847
|
+
2. **Gather the rule description.** Ask the user what pattern they want to detect. This becomes the \`prompt\` field (required).
|
|
1848
|
+
|
|
1849
|
+
3. **Enrich the request.** After receiving the initial description, actively work with the user to strengthen the rule. Do all of the following:
|
|
1850
|
+
|
|
1851
|
+
a. **Search the codebase for real examples.** Proactively scan the codebase for instances of the pattern they want to detect. Show them what you found and ask:
|
|
1852
|
+
- "I found N instances of this pattern in your codebase. Should I include some as examples in the rule request?"
|
|
1853
|
+
- If you find variations of the pattern, highlight them as potential edge cases.
|
|
1854
|
+
|
|
1855
|
+
b. **Ask for success and failure cases.** Even if the user provided examples, ask if there are other cases to consider:
|
|
1856
|
+
- "Are there edge cases or variations of this pattern that should also be caught?"
|
|
1857
|
+
- "Can you show me an example of the _correct_ way to write this code?"
|
|
1858
|
+
- Use any examples the user provided in their description as a starting point, but look for more.
|
|
1859
|
+
|
|
1860
|
+
c. **Collect default ignores from the project.** Before asking the user about exclusions, check the project for existing ignore patterns that inform what files the rule should skip. Look at:
|
|
1861
|
+
- \`.gitignore\` — files already excluded from version control (e.g., \`node_modules/\`, \`dist/\`, build artifacts)
|
|
1862
|
+
- Linter configs (e.g., \`eslint.config.js\`, \`.eslintignore\`) — files or directories already excluded from linting
|
|
1863
|
+
- \`tsconfig.json\` \`exclude\` field — files excluded from type checking
|
|
1864
|
+
- Any other relevant config that signals "these files are not authored source code"
|
|
1865
|
+
|
|
1866
|
+
Use these to build a baseline set of ignores. Present them to the user as defaults that will be included in the rule prompt.
|
|
1867
|
+
|
|
1868
|
+
d. **Ask about additional exclusions.** Beyond the defaults, ask the user if there are files, directories, or contexts where the pattern is acceptable:
|
|
1869
|
+
- "Are there any files or directories where this pattern should be allowed? (e.g., \`.d.ts\` files, test files, generated code)"
|
|
1870
|
+
- Incorporate both the default ignores and user-specified exclusions into the \`prompt\` field so the rule generator understands the boundaries.
|
|
1871
|
+
|
|
1872
|
+
e. **Infer the language.** Detect the language from the codebase or the user's examples. Confirm your assumption with the user.
|
|
1873
|
+
|
|
1874
|
+
4. **Confirm the enriched request.** Before submitting, present a summary of what you'll send to the API:
|
|
1875
|
+
- The full prompt (including any exclusion notes)
|
|
1876
|
+
- The language
|
|
1877
|
+
- The success case(s)
|
|
1878
|
+
- The failure case(s)
|
|
1879
|
+
|
|
1880
|
+
Ask the user to confirm or adjust before proceeding.
|
|
1881
|
+
|
|
1882
|
+
5. **Write the JSON payload to a file.** Build a JSON object with the gathered fields. Write the JSON to \`.taskless/.tmp-rule-request.json\`.
|
|
1883
|
+
|
|
1884
|
+
**Multiple examples:** The \`successCases\` and \`failureCases\` fields are arrays of strings. Each example is a separate array element:
|
|
1885
|
+
|
|
1886
|
+
\`\`\`json
|
|
1887
|
+
{
|
|
1888
|
+
"prompt": "...",
|
|
1889
|
+
"failureCases": [
|
|
1890
|
+
"/// <reference types=\\"@cloudflare/workers-types\\" />\\nexport class MyWorker { ... }",
|
|
1891
|
+
"/// <reference types=\\"vite/client\\" />\\nconst x = import.meta.env.FOO;"
|
|
1892
|
+
],
|
|
1893
|
+
"successCases": [
|
|
1894
|
+
"import type { DurableObjectState } from 'cloudflare:workers';\\nexport class MyWorker { ... }",
|
|
1895
|
+
"// .d.ts files are exempt — triple-slash is idiomatic there\\n/// <reference types=\\"@cloudflare/workers-types\\" />"
|
|
1896
|
+
]
|
|
1897
|
+
}
|
|
1898
|
+
\`\`\`
|
|
1899
|
+
|
|
1900
|
+
6. **Invoke the CLI.** Run \`pnpm dlx @taskless/cli@latest rules create --from .taskless/.tmp-rule-request.json --json\`. The command may take 30-60 seconds as it polls the API.
|
|
1901
|
+
|
|
1902
|
+
7. **Clean up.** After the command completes (success or failure), delete the \`.taskless/.tmp-rule-request.json\` file.
|
|
1903
|
+
|
|
1904
|
+
8. **Report the results.** When the CLI completes, show the generated file paths and suggest running \`taskless-check\` to test the new rule.
|
|
1905
|
+
|
|
1906
|
+
9. **Handle errors.** If the CLI fails:
|
|
1907
|
+
- **Authentication required**: Suggest the \`taskless-login\` skill.
|
|
1908
|
+
- **Missing config**: Suggest running \`pnpm dlx @taskless/cli@latest init\` to set up the project.
|
|
1909
|
+
- **Stale scaffold version**: Suggest the \`taskless-update-engine\` skill.
|
|
1910
|
+
- **API errors**: Report the error message and suggest trying again.
|
|
1911
|
+
`, Qi = `---
|
|
1912
|
+
name: "Taskless: Update Engine"
|
|
1913
|
+
description: Requests a scaffold upgrade for the .taskless/ engine directory. Use when the user needs to update their Taskless scaffold, upgrade their engine version, or when the CLI reports a stale scaffold version. Trigger on "update engine", "upgrade taskless", "taskless update-engine", or "scaffold is out of date".
|
|
1914
|
+
category: Taskless
|
|
1915
|
+
tags:
|
|
1916
|
+
- taskless
|
|
1917
|
+
metadata:
|
|
1918
|
+
author: taskless
|
|
1919
|
+
version: 0.2.1
|
|
1920
|
+
commandName: tskl:update-engine
|
|
1921
|
+
---
|
|
1922
|
+
|
|
1923
|
+
# Taskless Update Engine
|
|
1924
|
+
|
|
1925
|
+
When this skill is invoked, run the update-engine CLI command to request a scaffold upgrade PR from the Taskless backend.
|
|
1926
|
+
|
|
1927
|
+
## Instructions
|
|
1928
|
+
|
|
1929
|
+
1. **Detect the package manager.** Check for \`pnpm-lock.yaml\` in the project root. If present, use \`pnpm dlx\`; otherwise, use \`npx\`.
|
|
1930
|
+
|
|
1931
|
+
2. **Run the update-engine command.** Execute:
|
|
1932
|
+
|
|
1933
|
+
\`\`\`
|
|
1934
|
+
pnpm dlx @taskless/cli@latest update-engine --json
|
|
1935
|
+
\`\`\`
|
|
1936
|
+
|
|
1937
|
+
(or \`npx @taskless/cli@latest update-engine --json\` if not using pnpm)
|
|
1938
|
+
|
|
1939
|
+
3. **Parse and report the output.** The command outputs JSON to stdout:
|
|
1940
|
+
- \`{ "status": "current" }\` — Tell the user their project is already up to date.
|
|
1941
|
+
- \`{ "status": "open", "prUrl": "<url>" }\` — Show the PR URL and suggest the user review and merge it.
|
|
1942
|
+
- \`{ "status": "exists", "requestId": "<id>", "prUrl": "<url>" }\` — Show the existing PR URL and suggest the user review and merge it.
|
|
1943
|
+
- \`{ "status": "merged", "prUrl": "<url>" }\` — Tell the user the upgrade was merged and they should pull their branch.
|
|
1944
|
+
- \`{ "status": "closed", "prUrl": "<url>" }\` — Tell the user the PR was closed and suggest re-running the command.
|
|
1945
|
+
|
|
1946
|
+
4. **Handle errors.** If the CLI exits with a non-zero code:
|
|
1947
|
+
- **Authentication required**: Suggest the \`taskless-login\` skill.
|
|
1948
|
+
- **Missing config**: Suggest running \`pnpm dlx @taskless/cli@latest init\` to set up the project.
|
|
1949
|
+
- **API errors**: Report the error message and suggest trying again.
|
|
1950
|
+
`, Kt = /* @__PURE__ */ Symbol.for("yaml.alias"), jt = /* @__PURE__ */ Symbol.for("yaml.document"), re = /* @__PURE__ */ Symbol.for("yaml.map"), Ds = /* @__PURE__ */ Symbol.for("yaml.pair"), G = /* @__PURE__ */ Symbol.for("yaml.scalar"), Te = /* @__PURE__ */ Symbol.for("yaml.seq"), J = /* @__PURE__ */ Symbol.for("yaml.node.type"), fe = (s) => !!s && typeof s == "object" && s[J] === Kt, Fe = (s) => !!s && typeof s == "object" && s[J] === jt, Ke = (s) => !!s && typeof s == "object" && s[J] === re, x = (s) => !!s && typeof s == "object" && s[J] === Ds, A = (s) => !!s && typeof s == "object" && s[J] === G, Je = (s) => !!s && typeof s == "object" && s[J] === Te;
|
|
1951
|
+
function L(s) {
|
|
1572
1952
|
if (s && typeof s == "object")
|
|
1573
1953
|
switch (s[J]) {
|
|
1574
1954
|
case re:
|
|
1575
|
-
case
|
|
1955
|
+
case Te:
|
|
1576
1956
|
return !0;
|
|
1577
1957
|
}
|
|
1578
1958
|
return !1;
|
|
1579
1959
|
}
|
|
1580
|
-
function
|
|
1960
|
+
function $(s) {
|
|
1581
1961
|
if (s && typeof s == "object")
|
|
1582
1962
|
switch (s[J]) {
|
|
1583
1963
|
case Kt:
|
|
1584
1964
|
case re:
|
|
1585
|
-
case
|
|
1586
|
-
case
|
|
1965
|
+
case G:
|
|
1966
|
+
case Te:
|
|
1587
1967
|
return !0;
|
|
1588
1968
|
}
|
|
1589
1969
|
return !1;
|
|
1590
1970
|
}
|
|
1591
|
-
const Ms = (s) => (
|
|
1592
|
-
function
|
|
1593
|
-
const t =
|
|
1594
|
-
|
|
1971
|
+
const Ms = (s) => (A(s) || L(s)) && !!s.anchor, ae = /* @__PURE__ */ Symbol("break visit"), Xi = /* @__PURE__ */ Symbol("skip children"), je = /* @__PURE__ */ Symbol("remove node");
|
|
1972
|
+
function Oe(s, e) {
|
|
1973
|
+
const t = Zi(e);
|
|
1974
|
+
Fe(s) ? me(null, s.contents, t, Object.freeze([s])) === je && (s.contents = null) : me(null, s, t, Object.freeze([]));
|
|
1595
1975
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1976
|
+
Oe.BREAK = ae;
|
|
1977
|
+
Oe.SKIP = Xi;
|
|
1978
|
+
Oe.REMOVE = je;
|
|
1599
1979
|
function me(s, e, t, n) {
|
|
1600
|
-
const i =
|
|
1601
|
-
if (
|
|
1602
|
-
return
|
|
1980
|
+
const i = er(s, e, t, n);
|
|
1981
|
+
if ($(i) || x(i))
|
|
1982
|
+
return tr(s, n, i), me(s, i, t, n);
|
|
1603
1983
|
if (typeof i != "symbol") {
|
|
1604
|
-
if (
|
|
1984
|
+
if (L(e)) {
|
|
1605
1985
|
n = Object.freeze(n.concat(e));
|
|
1606
1986
|
for (let r = 0; r < e.items.length; ++r) {
|
|
1607
1987
|
const o = me(r, e.items[r], t, n);
|
|
@@ -1610,24 +1990,24 @@ function me(s, e, t, n) {
|
|
|
1610
1990
|
else {
|
|
1611
1991
|
if (o === ae)
|
|
1612
1992
|
return ae;
|
|
1613
|
-
o ===
|
|
1993
|
+
o === je && (e.items.splice(r, 1), r -= 1);
|
|
1614
1994
|
}
|
|
1615
1995
|
}
|
|
1616
|
-
} else if (
|
|
1996
|
+
} else if (x(e)) {
|
|
1617
1997
|
n = Object.freeze(n.concat(e));
|
|
1618
1998
|
const r = me("key", e.key, t, n);
|
|
1619
1999
|
if (r === ae)
|
|
1620
2000
|
return ae;
|
|
1621
|
-
r ===
|
|
2001
|
+
r === je && (e.key = null);
|
|
1622
2002
|
const o = me("value", e.value, t, n);
|
|
1623
2003
|
if (o === ae)
|
|
1624
2004
|
return ae;
|
|
1625
|
-
o ===
|
|
2005
|
+
o === je && (e.value = null);
|
|
1626
2006
|
}
|
|
1627
2007
|
}
|
|
1628
2008
|
return i;
|
|
1629
2009
|
}
|
|
1630
|
-
function
|
|
2010
|
+
function Zi(s) {
|
|
1631
2011
|
return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
|
|
1632
2012
|
Alias: s.Node,
|
|
1633
2013
|
Map: s.Node,
|
|
@@ -1642,41 +2022,41 @@ function Wi(s) {
|
|
|
1642
2022
|
Seq: s.Collection
|
|
1643
2023
|
}, s) : s;
|
|
1644
2024
|
}
|
|
1645
|
-
function
|
|
2025
|
+
function er(s, e, t, n) {
|
|
1646
2026
|
if (typeof t == "function")
|
|
1647
2027
|
return t(s, e, n);
|
|
1648
|
-
if (Fe(e))
|
|
1649
|
-
return t.Map?.(s, e, n);
|
|
1650
2028
|
if (Ke(e))
|
|
2029
|
+
return t.Map?.(s, e, n);
|
|
2030
|
+
if (Je(e))
|
|
1651
2031
|
return t.Seq?.(s, e, n);
|
|
1652
|
-
if (
|
|
2032
|
+
if (x(e))
|
|
1653
2033
|
return t.Pair?.(s, e, n);
|
|
1654
|
-
if (
|
|
2034
|
+
if (A(e))
|
|
1655
2035
|
return t.Scalar?.(s, e, n);
|
|
1656
2036
|
if (fe(e))
|
|
1657
2037
|
return t.Alias?.(s, e, n);
|
|
1658
2038
|
}
|
|
1659
|
-
function
|
|
2039
|
+
function tr(s, e, t) {
|
|
1660
2040
|
const n = e[e.length - 1];
|
|
1661
|
-
if (
|
|
2041
|
+
if (L(n))
|
|
1662
2042
|
n.items[s] = t;
|
|
1663
|
-
else if (
|
|
2043
|
+
else if (x(n))
|
|
1664
2044
|
s === "key" ? n.key = t : n.value = t;
|
|
1665
|
-
else if (
|
|
2045
|
+
else if (Fe(n))
|
|
1666
2046
|
n.contents = t;
|
|
1667
2047
|
else {
|
|
1668
2048
|
const i = fe(n) ? "alias" : "scalar";
|
|
1669
2049
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
1670
2050
|
}
|
|
1671
2051
|
}
|
|
1672
|
-
const
|
|
2052
|
+
const sr = {
|
|
1673
2053
|
"!": "%21",
|
|
1674
2054
|
",": "%2C",
|
|
1675
2055
|
"[": "%5B",
|
|
1676
2056
|
"]": "%5D",
|
|
1677
2057
|
"{": "%7B",
|
|
1678
2058
|
"}": "%7D"
|
|
1679
|
-
},
|
|
2059
|
+
}, nr = (s) => s.replace(/[!,[\]{}]/g, (e) => sr[e]);
|
|
1680
2060
|
class q {
|
|
1681
2061
|
constructor(e, t) {
|
|
1682
2062
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, q.defaultYaml, e), this.tags = Object.assign({}, q.defaultTags, t);
|
|
@@ -1766,16 +2146,16 @@ class q {
|
|
|
1766
2146
|
tagString(e) {
|
|
1767
2147
|
for (const [t, n] of Object.entries(this.tags))
|
|
1768
2148
|
if (e.startsWith(n))
|
|
1769
|
-
return t +
|
|
2149
|
+
return t + nr(e.substring(n.length));
|
|
1770
2150
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
1771
2151
|
}
|
|
1772
2152
|
toString(e) {
|
|
1773
2153
|
const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], n = Object.entries(this.tags);
|
|
1774
2154
|
let i;
|
|
1775
|
-
if (e && n.length > 0 &&
|
|
2155
|
+
if (e && n.length > 0 && $(e.contents)) {
|
|
1776
2156
|
const r = {};
|
|
1777
|
-
|
|
1778
|
-
|
|
2157
|
+
Oe(e.contents, (o, a) => {
|
|
2158
|
+
$(a) && a.tag && (r[a.tag] = !0);
|
|
1779
2159
|
}), i = Object.keys(r);
|
|
1780
2160
|
} else
|
|
1781
2161
|
i = [];
|
|
@@ -1796,7 +2176,7 @@ function Bs(s) {
|
|
|
1796
2176
|
}
|
|
1797
2177
|
function Fs(s) {
|
|
1798
2178
|
const e = /* @__PURE__ */ new Set();
|
|
1799
|
-
return
|
|
2179
|
+
return Oe(s, {
|
|
1800
2180
|
Value(t, n) {
|
|
1801
2181
|
n.anchor && e.add(n.anchor);
|
|
1802
2182
|
}
|
|
@@ -1809,7 +2189,7 @@ function Ks(s, e) {
|
|
|
1809
2189
|
return n;
|
|
1810
2190
|
}
|
|
1811
2191
|
}
|
|
1812
|
-
function
|
|
2192
|
+
function ir(s, e) {
|
|
1813
2193
|
const t = [], n = /* @__PURE__ */ new Map();
|
|
1814
2194
|
let i = null;
|
|
1815
2195
|
return {
|
|
@@ -1826,7 +2206,7 @@ function Qi(s, e) {
|
|
|
1826
2206
|
setAnchors: () => {
|
|
1827
2207
|
for (const r of t) {
|
|
1828
2208
|
const o = n.get(r);
|
|
1829
|
-
if (typeof o == "object" && o.anchor && (
|
|
2209
|
+
if (typeof o == "object" && o.anchor && (A(o.node) || L(o.node)))
|
|
1830
2210
|
o.node.anchor = o.anchor;
|
|
1831
2211
|
else {
|
|
1832
2212
|
const a = new Error("Failed to resolve repeated object (this should not happen)");
|
|
@@ -1887,7 +2267,7 @@ class Jt {
|
|
|
1887
2267
|
}
|
|
1888
2268
|
/** A plain JavaScript representation of this node. */
|
|
1889
2269
|
toJS(e, { mapAsMap: t, maxAliasCount: n, onAnchor: i, reviver: r } = {}) {
|
|
1890
|
-
if (!
|
|
2270
|
+
if (!Fe(e))
|
|
1891
2271
|
throw new TypeError("A document argument is required");
|
|
1892
2272
|
const o = {
|
|
1893
2273
|
anchors: /* @__PURE__ */ new Map(),
|
|
@@ -1903,7 +2283,7 @@ class Jt {
|
|
|
1903
2283
|
return typeof r == "function" ? ge(r, { "": a }, "", a) : a;
|
|
1904
2284
|
}
|
|
1905
2285
|
}
|
|
1906
|
-
class
|
|
2286
|
+
class Wt extends Jt {
|
|
1907
2287
|
constructor(e) {
|
|
1908
2288
|
super(Kt), this.source = e, Object.defineProperty(this, "tag", {
|
|
1909
2289
|
set() {
|
|
@@ -1917,7 +2297,7 @@ class Vt extends Jt {
|
|
|
1917
2297
|
*/
|
|
1918
2298
|
resolve(e, t) {
|
|
1919
2299
|
let n;
|
|
1920
|
-
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [],
|
|
2300
|
+
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], Oe(e, {
|
|
1921
2301
|
Node: (r, o) => {
|
|
1922
2302
|
(fe(o) || Ms(o)) && n.push(o);
|
|
1923
2303
|
}
|
|
@@ -1943,7 +2323,7 @@ class Vt extends Jt {
|
|
|
1943
2323
|
const l = "This should not happen: Alias anchor was not resolved?";
|
|
1944
2324
|
throw new ReferenceError(l);
|
|
1945
2325
|
}
|
|
1946
|
-
if (r >= 0 && (a.count += 1, a.aliasCount === 0 && (a.aliasCount =
|
|
2326
|
+
if (r >= 0 && (a.count += 1, a.aliasCount === 0 && (a.aliasCount = st(i, o, n)), a.count * a.aliasCount > r)) {
|
|
1947
2327
|
const l = "Excessive alias count indicates a resource exhaustion attack";
|
|
1948
2328
|
throw new ReferenceError(l);
|
|
1949
2329
|
}
|
|
@@ -1962,27 +2342,27 @@ class Vt extends Jt {
|
|
|
1962
2342
|
return i;
|
|
1963
2343
|
}
|
|
1964
2344
|
}
|
|
1965
|
-
function
|
|
2345
|
+
function st(s, e, t) {
|
|
1966
2346
|
if (fe(e)) {
|
|
1967
2347
|
const n = e.resolve(s), i = t && n && t.get(n);
|
|
1968
2348
|
return i ? i.count * i.aliasCount : 0;
|
|
1969
|
-
} else if (
|
|
2349
|
+
} else if (L(e)) {
|
|
1970
2350
|
let n = 0;
|
|
1971
2351
|
for (const i of e.items) {
|
|
1972
|
-
const r =
|
|
2352
|
+
const r = st(s, i, t);
|
|
1973
2353
|
r > n && (n = r);
|
|
1974
2354
|
}
|
|
1975
2355
|
return n;
|
|
1976
|
-
} else if (
|
|
1977
|
-
const n =
|
|
2356
|
+
} else if (x(e)) {
|
|
2357
|
+
const n = st(s, e.key, t), i = st(s, e.value, t);
|
|
1978
2358
|
return Math.max(n, i);
|
|
1979
2359
|
}
|
|
1980
2360
|
return 1;
|
|
1981
2361
|
}
|
|
1982
2362
|
const Js = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
1983
|
-
class
|
|
2363
|
+
class T extends Jt {
|
|
1984
2364
|
constructor(e) {
|
|
1985
|
-
super(
|
|
2365
|
+
super(G), this.value = e;
|
|
1986
2366
|
}
|
|
1987
2367
|
toJSON(e, t) {
|
|
1988
2368
|
return t?.keep ? this.value : K(this.value, e, t);
|
|
@@ -1991,13 +2371,13 @@ class O extends Jt {
|
|
|
1991
2371
|
return String(this.value);
|
|
1992
2372
|
}
|
|
1993
2373
|
}
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
const
|
|
2000
|
-
function
|
|
2374
|
+
T.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
2375
|
+
T.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
2376
|
+
T.PLAIN = "PLAIN";
|
|
2377
|
+
T.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
2378
|
+
T.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
2379
|
+
const rr = "tag:yaml.org,2002:";
|
|
2380
|
+
function or(s, e, t) {
|
|
2001
2381
|
if (e) {
|
|
2002
2382
|
const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
|
|
2003
2383
|
if (!i)
|
|
@@ -2006,10 +2386,10 @@ function Zi(s, e, t) {
|
|
|
2006
2386
|
}
|
|
2007
2387
|
return t.find((n) => n.identify?.(s) && !n.format);
|
|
2008
2388
|
}
|
|
2009
|
-
function
|
|
2010
|
-
if (
|
|
2389
|
+
function De(s, e, t) {
|
|
2390
|
+
if (Fe(s) && (s = s.contents), $(s))
|
|
2011
2391
|
return s;
|
|
2012
|
-
if (
|
|
2392
|
+
if (x(s)) {
|
|
2013
2393
|
const d = t.schema[re].createNode?.(t.schema, null, t);
|
|
2014
2394
|
return d.items.push(s), d;
|
|
2015
2395
|
}
|
|
@@ -2018,20 +2398,20 @@ function qe(s, e, t) {
|
|
|
2018
2398
|
let l;
|
|
2019
2399
|
if (n && s && typeof s == "object") {
|
|
2020
2400
|
if (l = a.get(s), l)
|
|
2021
|
-
return l.anchor ?? (l.anchor = i(s)), new
|
|
2401
|
+
return l.anchor ?? (l.anchor = i(s)), new Wt(l.anchor);
|
|
2022
2402
|
l = { anchor: null, node: null }, a.set(s, l);
|
|
2023
2403
|
}
|
|
2024
|
-
e?.startsWith("!!") && (e =
|
|
2025
|
-
let c =
|
|
2404
|
+
e?.startsWith("!!") && (e = rr + e.slice(2));
|
|
2405
|
+
let c = or(s, e, o.tags);
|
|
2026
2406
|
if (!c) {
|
|
2027
2407
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
2028
|
-
const d = new
|
|
2408
|
+
const d = new T(s);
|
|
2029
2409
|
return l && (l.node = d), d;
|
|
2030
2410
|
}
|
|
2031
|
-
c = s instanceof Map ? o[re] : Symbol.iterator in Object(s) ? o[
|
|
2411
|
+
c = s instanceof Map ? o[re] : Symbol.iterator in Object(s) ? o[Te] : o[re];
|
|
2032
2412
|
}
|
|
2033
2413
|
r && (r(c), delete t.onTagObj);
|
|
2034
|
-
const h = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new
|
|
2414
|
+
const h = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new T(s);
|
|
2035
2415
|
return e ? h.tag = e : c.default || (h.tag = c.tag), l && (l.node = h), h;
|
|
2036
2416
|
}
|
|
2037
2417
|
function rt(s, e, t) {
|
|
@@ -2044,7 +2424,7 @@ function rt(s, e, t) {
|
|
|
2044
2424
|
} else
|
|
2045
2425
|
n = /* @__PURE__ */ new Map([[r, n]]);
|
|
2046
2426
|
}
|
|
2047
|
-
return
|
|
2427
|
+
return De(n, void 0, {
|
|
2048
2428
|
aliasDuplicateObjects: !1,
|
|
2049
2429
|
keepUndefined: !1,
|
|
2050
2430
|
onAnchor: () => {
|
|
@@ -2054,8 +2434,8 @@ function rt(s, e, t) {
|
|
|
2054
2434
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2055
2435
|
});
|
|
2056
2436
|
}
|
|
2057
|
-
const
|
|
2058
|
-
class
|
|
2437
|
+
const Le = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
|
|
2438
|
+
class Ws extends Jt {
|
|
2059
2439
|
constructor(e, t) {
|
|
2060
2440
|
super(e), Object.defineProperty(this, "schema", {
|
|
2061
2441
|
value: t,
|
|
@@ -2071,7 +2451,7 @@ class Vs extends Jt {
|
|
|
2071
2451
|
*/
|
|
2072
2452
|
clone(e) {
|
|
2073
2453
|
const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
2074
|
-
return e && (t.schema = e), t.items = t.items.map((n) =>
|
|
2454
|
+
return e && (t.schema = e), t.items = t.items.map((n) => $(n) || x(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
|
|
2075
2455
|
}
|
|
2076
2456
|
/**
|
|
2077
2457
|
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
@@ -2079,11 +2459,11 @@ class Vs extends Jt {
|
|
|
2079
2459
|
* that already exists in the map.
|
|
2080
2460
|
*/
|
|
2081
2461
|
addIn(e, t) {
|
|
2082
|
-
if (
|
|
2462
|
+
if (Le(e))
|
|
2083
2463
|
this.add(t);
|
|
2084
2464
|
else {
|
|
2085
2465
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
2086
|
-
if (
|
|
2466
|
+
if (L(r))
|
|
2087
2467
|
r.addIn(i, t);
|
|
2088
2468
|
else if (r === void 0 && this.schema)
|
|
2089
2469
|
this.set(n, rt(this.schema, i, t));
|
|
@@ -2100,7 +2480,7 @@ class Vs extends Jt {
|
|
|
2100
2480
|
if (n.length === 0)
|
|
2101
2481
|
return this.delete(t);
|
|
2102
2482
|
const i = this.get(t, !0);
|
|
2103
|
-
if (
|
|
2483
|
+
if (L(i))
|
|
2104
2484
|
return i.deleteIn(n);
|
|
2105
2485
|
throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`);
|
|
2106
2486
|
}
|
|
@@ -2111,14 +2491,14 @@ class Vs extends Jt {
|
|
|
2111
2491
|
*/
|
|
2112
2492
|
getIn(e, t) {
|
|
2113
2493
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
2114
|
-
return i.length === 0 ? !t &&
|
|
2494
|
+
return i.length === 0 ? !t && A(r) ? r.value : r : L(r) ? r.getIn(i, t) : void 0;
|
|
2115
2495
|
}
|
|
2116
2496
|
hasAllNullValues(e) {
|
|
2117
2497
|
return this.items.every((t) => {
|
|
2118
|
-
if (!
|
|
2498
|
+
if (!x(t))
|
|
2119
2499
|
return !1;
|
|
2120
2500
|
const n = t.value;
|
|
2121
|
-
return n == null || e &&
|
|
2501
|
+
return n == null || e && A(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
2122
2502
|
});
|
|
2123
2503
|
}
|
|
2124
2504
|
/**
|
|
@@ -2129,7 +2509,7 @@ class Vs extends Jt {
|
|
|
2129
2509
|
if (n.length === 0)
|
|
2130
2510
|
return this.has(t);
|
|
2131
2511
|
const i = this.get(t, !0);
|
|
2132
|
-
return
|
|
2512
|
+
return L(i) ? i.hasIn(n) : !1;
|
|
2133
2513
|
}
|
|
2134
2514
|
/**
|
|
2135
2515
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -2141,7 +2521,7 @@ class Vs extends Jt {
|
|
|
2141
2521
|
this.set(n, t);
|
|
2142
2522
|
else {
|
|
2143
2523
|
const r = this.get(n, !0);
|
|
2144
|
-
if (
|
|
2524
|
+
if (L(r))
|
|
2145
2525
|
r.setIn(i, t);
|
|
2146
2526
|
else if (r === void 0 && this.schema)
|
|
2147
2527
|
this.set(n, rt(this.schema, i, t));
|
|
@@ -2150,15 +2530,15 @@ class Vs extends Jt {
|
|
|
2150
2530
|
}
|
|
2151
2531
|
}
|
|
2152
2532
|
}
|
|
2153
|
-
const
|
|
2533
|
+
const ar = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
2154
2534
|
function X(s, e) {
|
|
2155
2535
|
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
2156
2536
|
}
|
|
2157
2537
|
const le = (s, e, t) => s.endsWith(`
|
|
2158
2538
|
`) ? X(t, e) : t.includes(`
|
|
2159
2539
|
`) ? `
|
|
2160
|
-
` + X(t, e) : (s.endsWith(" ") ? "" : " ") + t,
|
|
2161
|
-
function
|
|
2540
|
+
` + X(t, e) : (s.endsWith(" ") ? "" : " ") + t, Vs = "flow", Rt = "block", nt = "quoted";
|
|
2541
|
+
function ct(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: a } = {}) {
|
|
2162
2542
|
if (!i || i < 0)
|
|
2163
2543
|
return s;
|
|
2164
2544
|
i < r && (r = 0);
|
|
@@ -2171,7 +2551,7 @@ function lt(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
2171
2551
|
let u, f, g = !1, p = -1, m = -1, k = -1;
|
|
2172
2552
|
t === Rt && (p = ds(s, p, e.length), p !== -1 && (d = p + l));
|
|
2173
2553
|
for (let b; b = s[p += 1]; ) {
|
|
2174
|
-
if (t ===
|
|
2554
|
+
if (t === nt && b === "\\") {
|
|
2175
2555
|
switch (m = p, s[p + 1]) {
|
|
2176
2556
|
case "x":
|
|
2177
2557
|
p += 3;
|
|
@@ -2200,7 +2580,7 @@ function lt(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
2200
2580
|
if (p >= d)
|
|
2201
2581
|
if (u)
|
|
2202
2582
|
c.push(u), d = u + l, u = void 0;
|
|
2203
|
-
else if (t ===
|
|
2583
|
+
else if (t === nt) {
|
|
2204
2584
|
for (; f === " " || f === " "; )
|
|
2205
2585
|
f = b, b = s[p += 1], g = !0;
|
|
2206
2586
|
const S = p > k + 1 ? p - 2 : m - 1;
|
|
@@ -2219,7 +2599,7 @@ function lt(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
2219
2599
|
for (let b = 0; b < c.length; ++b) {
|
|
2220
2600
|
const S = c[b], v = c[b + 1] || s.length;
|
|
2221
2601
|
S === 0 ? y = `
|
|
2222
|
-
${e}${s.slice(0, v)}` : (t ===
|
|
2602
|
+
${e}${s.slice(0, v)}` : (t === nt && h[S] && (y += `${s[S]}\\`), y += `
|
|
2223
2603
|
${e}${s.slice(S + 1, v)}`);
|
|
2224
2604
|
}
|
|
2225
2605
|
return y;
|
|
@@ -2238,12 +2618,12 @@ function ds(s, e, t) {
|
|
|
2238
2618
|
}
|
|
2239
2619
|
return n;
|
|
2240
2620
|
}
|
|
2241
|
-
const
|
|
2621
|
+
const ut = (s, e) => ({
|
|
2242
2622
|
indentAtStart: e ? s.indent.length : s.indentAtStart,
|
|
2243
2623
|
lineWidth: s.options.lineWidth,
|
|
2244
2624
|
minContentWidth: s.options.minContentWidth
|
|
2245
|
-
}),
|
|
2246
|
-
function
|
|
2625
|
+
}), ft = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
2626
|
+
function lr(s, e, t) {
|
|
2247
2627
|
if (!e || e < 0)
|
|
2248
2628
|
return !1;
|
|
2249
2629
|
const n = e - t, i = s.length;
|
|
@@ -2259,11 +2639,11 @@ function tr(s, e, t) {
|
|
|
2259
2639
|
}
|
|
2260
2640
|
return !0;
|
|
2261
2641
|
}
|
|
2262
|
-
function
|
|
2642
|
+
function Re(s, e) {
|
|
2263
2643
|
const t = JSON.stringify(s);
|
|
2264
2644
|
if (e.options.doubleQuotedAsJSON)
|
|
2265
2645
|
return t;
|
|
2266
|
-
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (
|
|
2646
|
+
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (ft(s) ? " " : "");
|
|
2267
2647
|
let o = "", a = 0;
|
|
2268
2648
|
for (let l = 0, c = t[l]; c; c = t[++l])
|
|
2269
2649
|
if (c === " " && t[l + 1] === "\\" && t[l + 2] === "n" && (o += t.slice(a, l) + "\\ ", l += 1, a = l, c = "\\"), c === "\\")
|
|
@@ -2318,41 +2698,41 @@ function xe(s, e) {
|
|
|
2318
2698
|
default:
|
|
2319
2699
|
l += 1;
|
|
2320
2700
|
}
|
|
2321
|
-
return o = a ? o + t.slice(a) : t, n ? o :
|
|
2701
|
+
return o = a ? o + t.slice(a) : t, n ? o : ct(o, r, nt, ut(e, !1));
|
|
2322
2702
|
}
|
|
2323
|
-
function
|
|
2703
|
+
function Pt(s, e) {
|
|
2324
2704
|
if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
|
|
2325
2705
|
`) || /[ \t]\n|\n[ \t]/.test(s))
|
|
2326
|
-
return
|
|
2327
|
-
const t = e.indent || (
|
|
2706
|
+
return Re(s, e);
|
|
2707
|
+
const t = e.indent || (ft(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
2328
2708
|
${t}`) + "'";
|
|
2329
|
-
return e.implicitKey ? n :
|
|
2709
|
+
return e.implicitKey ? n : ct(n, t, Vs, ut(e, !1));
|
|
2330
2710
|
}
|
|
2331
2711
|
function ye(s, e) {
|
|
2332
2712
|
const { singleQuote: t } = e.options;
|
|
2333
2713
|
let n;
|
|
2334
2714
|
if (t === !1)
|
|
2335
|
-
n =
|
|
2715
|
+
n = Re;
|
|
2336
2716
|
else {
|
|
2337
2717
|
const i = s.includes('"'), r = s.includes("'");
|
|
2338
|
-
i && !r ? n =
|
|
2718
|
+
i && !r ? n = Pt : r && !i ? n = Re : n = t ? Pt : Re;
|
|
2339
2719
|
}
|
|
2340
2720
|
return n(s, e);
|
|
2341
2721
|
}
|
|
2342
|
-
let
|
|
2722
|
+
let Ut;
|
|
2343
2723
|
try {
|
|
2344
|
-
|
|
2724
|
+
Ut = new RegExp(`(^|(?<!
|
|
2345
2725
|
))
|
|
2346
2726
|
+(?!
|
|
2347
2727
|
|$)`, "g");
|
|
2348
2728
|
} catch {
|
|
2349
|
-
|
|
2729
|
+
Ut = /\n+(?!\n|$)/g;
|
|
2350
2730
|
}
|
|
2351
|
-
function
|
|
2731
|
+
function it({ comment: s, type: e, value: t }, n, i, r) {
|
|
2352
2732
|
const { blockQuote: o, commentString: a, lineWidth: l } = n.options;
|
|
2353
2733
|
if (!o || /\n[\t ]+$/.test(t))
|
|
2354
2734
|
return ye(t, n);
|
|
2355
|
-
const c = n.indent || (n.forceBlockIndent ||
|
|
2735
|
+
const c = n.indent || (n.forceBlockIndent || ft(t) ? " " : ""), h = o === "literal" ? !0 : o === "folded" || e === T.BLOCK_FOLDED ? !1 : e === T.BLOCK_LITERAL ? !0 : !lr(t, l, c.length);
|
|
2356
2736
|
if (!t)
|
|
2357
2737
|
return h ? `|
|
|
2358
2738
|
` : `>
|
|
@@ -2368,7 +2748,7 @@ function nt({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
2368
2748
|
const g = f.indexOf(`
|
|
2369
2749
|
`);
|
|
2370
2750
|
g === -1 ? d = "-" : t === f || g !== f.length - 1 ? (d = "+", r && r()) : d = "", f && (t = t.slice(0, -f.length), f[f.length - 1] === `
|
|
2371
|
-
` && (f = f.slice(0, -1)), f = f.replace(
|
|
2751
|
+
` && (f = f.slice(0, -1)), f = f.replace(Ut, `$&${c}`));
|
|
2372
2752
|
let p = !1, m, k = -1;
|
|
2373
2753
|
for (m = 0; m < t.length; ++m) {
|
|
2374
2754
|
const v = t[m];
|
|
@@ -2387,11 +2767,11 @@ function nt({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
2387
2767
|
const v = t.replace(/\n+/g, `
|
|
2388
2768
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
2389
2769
|
let I = !1;
|
|
2390
|
-
const
|
|
2391
|
-
o !== "folded" && e !==
|
|
2770
|
+
const N = ut(n, !0);
|
|
2771
|
+
o !== "folded" && e !== T.BLOCK_FOLDED && (N.onOverflow = () => {
|
|
2392
2772
|
I = !0;
|
|
2393
2773
|
});
|
|
2394
|
-
const w =
|
|
2774
|
+
const w = ct(`${y}${v}${f}`, c, Rt, N);
|
|
2395
2775
|
if (!I)
|
|
2396
2776
|
return `>${S}
|
|
2397
2777
|
${c}${w}`;
|
|
@@ -2399,20 +2779,20 @@ ${c}${w}`;
|
|
|
2399
2779
|
return t = t.replace(/\n+/g, `$&${c}`), `|${S}
|
|
2400
2780
|
${c}${y}${t}${f}`;
|
|
2401
2781
|
}
|
|
2402
|
-
function
|
|
2782
|
+
function cr(s, e, t, n) {
|
|
2403
2783
|
const { type: i, value: r } = s, { actualString: o, implicitKey: a, indent: l, indentStep: c, inFlow: h } = e;
|
|
2404
2784
|
if (a && r.includes(`
|
|
2405
2785
|
`) || h && /[[\]{},]/.test(r))
|
|
2406
2786
|
return ye(r, e);
|
|
2407
2787
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
2408
2788
|
return a || h || !r.includes(`
|
|
2409
|
-
`) ? ye(r, e) :
|
|
2410
|
-
if (!a && !h && i !==
|
|
2789
|
+
`) ? ye(r, e) : it(s, e, t, n);
|
|
2790
|
+
if (!a && !h && i !== T.PLAIN && r.includes(`
|
|
2411
2791
|
`))
|
|
2412
|
-
return
|
|
2413
|
-
if (
|
|
2792
|
+
return it(s, e, t, n);
|
|
2793
|
+
if (ft(r)) {
|
|
2414
2794
|
if (l === "")
|
|
2415
|
-
return e.forceBlockIndent = !0,
|
|
2795
|
+
return e.forceBlockIndent = !0, it(s, e, t, n);
|
|
2416
2796
|
if (a && l === c)
|
|
2417
2797
|
return ye(r, e);
|
|
2418
2798
|
}
|
|
@@ -2423,23 +2803,23 @@ ${l}`);
|
|
|
2423
2803
|
if (g.some(u) || f?.some(u))
|
|
2424
2804
|
return ye(r, e);
|
|
2425
2805
|
}
|
|
2426
|
-
return a ? d :
|
|
2806
|
+
return a ? d : ct(d, l, Vs, ut(e, !1));
|
|
2427
2807
|
}
|
|
2428
|
-
function
|
|
2808
|
+
function Vt(s, e, t, n) {
|
|
2429
2809
|
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
2430
2810
|
let { type: a } = s;
|
|
2431
|
-
a !==
|
|
2811
|
+
a !== T.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (a = T.QUOTE_DOUBLE);
|
|
2432
2812
|
const l = (h) => {
|
|
2433
2813
|
switch (h) {
|
|
2434
|
-
case
|
|
2435
|
-
case
|
|
2436
|
-
return i || r ? ye(o.value, e) :
|
|
2437
|
-
case
|
|
2438
|
-
return
|
|
2439
|
-
case
|
|
2440
|
-
return
|
|
2441
|
-
case
|
|
2442
|
-
return
|
|
2814
|
+
case T.BLOCK_FOLDED:
|
|
2815
|
+
case T.BLOCK_LITERAL:
|
|
2816
|
+
return i || r ? ye(o.value, e) : it(o, e, t, n);
|
|
2817
|
+
case T.QUOTE_DOUBLE:
|
|
2818
|
+
return Re(o.value, e);
|
|
2819
|
+
case T.QUOTE_SINGLE:
|
|
2820
|
+
return Pt(o.value, e);
|
|
2821
|
+
case T.PLAIN:
|
|
2822
|
+
return cr(o, e, t, n);
|
|
2443
2823
|
default:
|
|
2444
2824
|
return null;
|
|
2445
2825
|
}
|
|
@@ -2455,7 +2835,7 @@ function Wt(s, e, t, n) {
|
|
|
2455
2835
|
function Hs(s, e) {
|
|
2456
2836
|
const t = Object.assign({
|
|
2457
2837
|
blockQuote: !0,
|
|
2458
|
-
commentString:
|
|
2838
|
+
commentString: ar,
|
|
2459
2839
|
defaultKeyType: null,
|
|
2460
2840
|
defaultStringType: "PLAIN",
|
|
2461
2841
|
directives: null,
|
|
@@ -2493,14 +2873,14 @@ function Hs(s, e) {
|
|
|
2493
2873
|
options: t
|
|
2494
2874
|
};
|
|
2495
2875
|
}
|
|
2496
|
-
function
|
|
2876
|
+
function ur(s, e) {
|
|
2497
2877
|
if (e.tag) {
|
|
2498
2878
|
const i = s.filter((r) => r.tag === e.tag);
|
|
2499
2879
|
if (i.length > 0)
|
|
2500
2880
|
return i.find((r) => r.format === e.format) ?? i[0];
|
|
2501
2881
|
}
|
|
2502
2882
|
let t, n;
|
|
2503
|
-
if (
|
|
2883
|
+
if (A(e)) {
|
|
2504
2884
|
n = e.value;
|
|
2505
2885
|
let i = s.filter((r) => r.identify?.(n));
|
|
2506
2886
|
if (i.length > 1) {
|
|
@@ -2516,16 +2896,16 @@ function nr(s, e) {
|
|
|
2516
2896
|
}
|
|
2517
2897
|
return t;
|
|
2518
2898
|
}
|
|
2519
|
-
function
|
|
2899
|
+
function fr(s, e, { anchors: t, doc: n }) {
|
|
2520
2900
|
if (!n.directives)
|
|
2521
2901
|
return "";
|
|
2522
|
-
const i = [], r = (
|
|
2902
|
+
const i = [], r = (A(s) || L(s)) && s.anchor;
|
|
2523
2903
|
r && Bs(r) && (t.add(r), i.push(`&${r}`));
|
|
2524
2904
|
const o = s.tag ?? (e.default ? null : e.tag);
|
|
2525
2905
|
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
2526
2906
|
}
|
|
2527
2907
|
function Se(s, e, t, n) {
|
|
2528
|
-
if (
|
|
2908
|
+
if (x(s))
|
|
2529
2909
|
return s.toString(e, t, n);
|
|
2530
2910
|
if (fe(s)) {
|
|
2531
2911
|
if (e.doc.directives)
|
|
@@ -2535,26 +2915,26 @@ function Se(s, e, t, n) {
|
|
|
2535
2915
|
e.resolvedAliases ? e.resolvedAliases.add(s) : e.resolvedAliases = /* @__PURE__ */ new Set([s]), s = s.resolve(e.doc);
|
|
2536
2916
|
}
|
|
2537
2917
|
let i;
|
|
2538
|
-
const r =
|
|
2539
|
-
i ?? (i =
|
|
2540
|
-
const o =
|
|
2918
|
+
const r = $(s) ? s : e.doc.createNode(s, { onTagObj: (l) => i = l });
|
|
2919
|
+
i ?? (i = ur(e.doc.schema.tags, r));
|
|
2920
|
+
const o = fr(r, i, e);
|
|
2541
2921
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
2542
|
-
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) :
|
|
2543
|
-
return o ?
|
|
2922
|
+
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : A(r) ? Vt(r, e, t, n) : r.toString(e, t, n);
|
|
2923
|
+
return o ? A(r) || a[0] === "{" || a[0] === "[" ? `${o} ${a}` : `${o}
|
|
2544
2924
|
${e.indent}${a}` : a;
|
|
2545
2925
|
}
|
|
2546
|
-
function
|
|
2926
|
+
function dr({ key: s, value: e }, t, n, i) {
|
|
2547
2927
|
const { allNullValues: r, doc: o, indent: a, indentStep: l, options: { commentString: c, indentSeq: h, simpleKeys: d } } = t;
|
|
2548
|
-
let u =
|
|
2928
|
+
let u = $(s) && s.comment || null;
|
|
2549
2929
|
if (d) {
|
|
2550
2930
|
if (u)
|
|
2551
2931
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
2552
|
-
if (
|
|
2553
|
-
const
|
|
2554
|
-
throw new Error(
|
|
2932
|
+
if (L(s) || !$(s) && typeof s == "object") {
|
|
2933
|
+
const N = "With simple keys, collection cannot be used as a key value";
|
|
2934
|
+
throw new Error(N);
|
|
2555
2935
|
}
|
|
2556
2936
|
}
|
|
2557
|
-
let f = !d && (!s || u && e == null && !t.inFlow ||
|
|
2937
|
+
let f = !d && (!s || u && e == null && !t.inFlow || L(s) || (A(s) ? s.type === T.BLOCK_FOLDED || s.type === T.BLOCK_LITERAL : typeof s == "object"));
|
|
2558
2938
|
t = Object.assign({}, t, {
|
|
2559
2939
|
allNullValues: !1,
|
|
2560
2940
|
implicitKey: !f && (d || !r),
|
|
@@ -2574,32 +2954,32 @@ function rr({ key: s, value: e }, t, n, i) {
|
|
|
2574
2954
|
g && (u = null), f ? (u && (m += le(m, t.indent, c(u))), m = `? ${m}
|
|
2575
2955
|
${a}:`) : (m = `${m}:`, u && (m += le(m, t.indent, c(u))));
|
|
2576
2956
|
let k, y, b;
|
|
2577
|
-
|
|
2957
|
+
$(e) ? (k = !!e.spaceBefore, y = e.commentBefore, b = e.comment) : (k = !1, y = null, b = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !f && !u && A(e) && (t.indentAtStart = m.length + 1), p = !1, !h && l.length >= 2 && !t.inFlow && !f && Je(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
2578
2958
|
let S = !1;
|
|
2579
2959
|
const v = Se(e, t, () => S = !0, () => p = !0);
|
|
2580
2960
|
let I = " ";
|
|
2581
2961
|
if (u || k || y) {
|
|
2582
2962
|
if (I = k ? `
|
|
2583
2963
|
` : "", y) {
|
|
2584
|
-
const
|
|
2964
|
+
const N = c(y);
|
|
2585
2965
|
I += `
|
|
2586
|
-
${X(
|
|
2966
|
+
${X(N, t.indent)}`;
|
|
2587
2967
|
}
|
|
2588
2968
|
v === "" && !t.inFlow ? I === `
|
|
2589
2969
|
` && b && (I = `
|
|
2590
2970
|
|
|
2591
2971
|
`) : I += `
|
|
2592
2972
|
${t.indent}`;
|
|
2593
|
-
} else if (!f &&
|
|
2594
|
-
const
|
|
2595
|
-
`),
|
|
2596
|
-
if (
|
|
2597
|
-
let
|
|
2598
|
-
if (
|
|
2599
|
-
let
|
|
2600
|
-
|
|
2973
|
+
} else if (!f && L(e)) {
|
|
2974
|
+
const N = v[0], w = v.indexOf(`
|
|
2975
|
+
`), C = w !== -1, B = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
2976
|
+
if (C || !B) {
|
|
2977
|
+
let z = !1;
|
|
2978
|
+
if (C && (N === "&" || N === "!")) {
|
|
2979
|
+
let E = v.indexOf(" ");
|
|
2980
|
+
N === "&" && E !== -1 && E < w && v[E + 1] === "!" && (E = v.indexOf(" ", E + 1)), (E === -1 || w < E) && (z = !0);
|
|
2601
2981
|
}
|
|
2602
|
-
|
|
2982
|
+
z || (I = `
|
|
2603
2983
|
${t.indent}`);
|
|
2604
2984
|
}
|
|
2605
2985
|
} else (v === "" || v[0] === `
|
|
@@ -2609,18 +2989,18 @@ ${t.indent}`);
|
|
|
2609
2989
|
function Ys(s, e) {
|
|
2610
2990
|
(s === "debug" || s === "warn") && console.warn(e);
|
|
2611
2991
|
}
|
|
2612
|
-
const
|
|
2613
|
-
identify: (s) => s ===
|
|
2992
|
+
const Qe = "<<", Z = {
|
|
2993
|
+
identify: (s) => s === Qe || typeof s == "symbol" && s.description === Qe,
|
|
2614
2994
|
default: "key",
|
|
2615
2995
|
tag: "tag:yaml.org,2002:merge",
|
|
2616
2996
|
test: /^<<$/,
|
|
2617
|
-
resolve: () => Object.assign(new
|
|
2618
|
-
addToJSMap:
|
|
2997
|
+
resolve: () => Object.assign(new T(Symbol(Qe)), {
|
|
2998
|
+
addToJSMap: zs
|
|
2619
2999
|
}),
|
|
2620
|
-
stringify: () =>
|
|
2621
|
-
},
|
|
2622
|
-
function
|
|
2623
|
-
if (t = s && fe(t) ? t.resolve(s.doc) : t,
|
|
3000
|
+
stringify: () => Qe
|
|
3001
|
+
}, hr = (s, e) => (Z.identify(e) || A(e) && (!e.type || e.type === T.PLAIN) && Z.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === Z.tag && t.default);
|
|
3002
|
+
function zs(s, e, t) {
|
|
3003
|
+
if (t = s && fe(t) ? t.resolve(s.doc) : t, Je(t))
|
|
2624
3004
|
for (const n of t.items)
|
|
2625
3005
|
Ot(s, e, n);
|
|
2626
3006
|
else if (Array.isArray(t))
|
|
@@ -2631,7 +3011,7 @@ function Gs(s, e, t) {
|
|
|
2631
3011
|
}
|
|
2632
3012
|
function Ot(s, e, t) {
|
|
2633
3013
|
const n = s && fe(t) ? t.resolve(s.doc) : t;
|
|
2634
|
-
if (!
|
|
3014
|
+
if (!Ke(n))
|
|
2635
3015
|
throw new Error("Merge sources must be maps or map aliases");
|
|
2636
3016
|
const i = n.toJSON(null, s, Map);
|
|
2637
3017
|
for (const [r, o] of i)
|
|
@@ -2643,11 +3023,11 @@ function Ot(s, e, t) {
|
|
|
2643
3023
|
});
|
|
2644
3024
|
return e;
|
|
2645
3025
|
}
|
|
2646
|
-
function
|
|
2647
|
-
if (
|
|
3026
|
+
function Gs(s, e, { key: t, value: n }) {
|
|
3027
|
+
if ($(t) && t.addToJSMap)
|
|
2648
3028
|
t.addToJSMap(s, e, n);
|
|
2649
|
-
else if (
|
|
2650
|
-
|
|
3029
|
+
else if (hr(s, t))
|
|
3030
|
+
zs(s, e, n);
|
|
2651
3031
|
else {
|
|
2652
3032
|
const i = K(t, "", s);
|
|
2653
3033
|
if (e instanceof Map)
|
|
@@ -2655,7 +3035,7 @@ function zs(s, e, { key: t, value: n }) {
|
|
|
2655
3035
|
else if (e instanceof Set)
|
|
2656
3036
|
e.add(i);
|
|
2657
3037
|
else {
|
|
2658
|
-
const r =
|
|
3038
|
+
const r = pr(t, i, s), o = K(n, r, s);
|
|
2659
3039
|
r in e ? Object.defineProperty(e, r, {
|
|
2660
3040
|
value: o,
|
|
2661
3041
|
writable: !0,
|
|
@@ -2666,12 +3046,12 @@ function zs(s, e, { key: t, value: n }) {
|
|
|
2666
3046
|
}
|
|
2667
3047
|
return e;
|
|
2668
3048
|
}
|
|
2669
|
-
function
|
|
3049
|
+
function pr(s, e, t) {
|
|
2670
3050
|
if (e === null)
|
|
2671
3051
|
return "";
|
|
2672
3052
|
if (typeof e != "object")
|
|
2673
3053
|
return String(e);
|
|
2674
|
-
if (
|
|
3054
|
+
if ($(s) && t?.doc) {
|
|
2675
3055
|
const n = Hs(t.doc, {});
|
|
2676
3056
|
n.anchors = /* @__PURE__ */ new Set();
|
|
2677
3057
|
for (const r of t.anchors.keys())
|
|
@@ -2687,7 +3067,7 @@ function ar(s, e, t) {
|
|
|
2687
3067
|
return JSON.stringify(e);
|
|
2688
3068
|
}
|
|
2689
3069
|
function Ht(s, e, t) {
|
|
2690
|
-
const n =
|
|
3070
|
+
const n = De(s, void 0, t), i = De(e, void 0, t);
|
|
2691
3071
|
return new D(n, i);
|
|
2692
3072
|
}
|
|
2693
3073
|
class D {
|
|
@@ -2696,30 +3076,30 @@ class D {
|
|
|
2696
3076
|
}
|
|
2697
3077
|
clone(e) {
|
|
2698
3078
|
let { key: t, value: n } = this;
|
|
2699
|
-
return
|
|
3079
|
+
return $(t) && (t = t.clone(e)), $(n) && (n = n.clone(e)), new D(t, n);
|
|
2700
3080
|
}
|
|
2701
3081
|
toJSON(e, t) {
|
|
2702
3082
|
const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
2703
|
-
return
|
|
3083
|
+
return Gs(t, n, this);
|
|
2704
3084
|
}
|
|
2705
3085
|
toString(e, t, n) {
|
|
2706
|
-
return e?.doc ?
|
|
3086
|
+
return e?.doc ? dr(this, e, t, n) : JSON.stringify(this);
|
|
2707
3087
|
}
|
|
2708
3088
|
}
|
|
2709
3089
|
function Qs(s, e, t) {
|
|
2710
|
-
return (e.inFlow ?? s.flow ?
|
|
3090
|
+
return (e.inFlow ?? s.flow ? gr : mr)(s, e, t);
|
|
2711
3091
|
}
|
|
2712
|
-
function
|
|
3092
|
+
function mr({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: a }) {
|
|
2713
3093
|
const { indent: l, options: { commentString: c } } = t, h = Object.assign({}, t, { indent: r, type: null });
|
|
2714
3094
|
let d = !1;
|
|
2715
3095
|
const u = [];
|
|
2716
3096
|
for (let g = 0; g < e.length; ++g) {
|
|
2717
3097
|
const p = e[g];
|
|
2718
3098
|
let m = null;
|
|
2719
|
-
if (
|
|
3099
|
+
if ($(p))
|
|
2720
3100
|
!d && p.spaceBefore && u.push(""), ot(t, u, p.commentBefore, d), p.comment && (m = p.comment);
|
|
2721
|
-
else if (
|
|
2722
|
-
const y =
|
|
3101
|
+
else if (x(p)) {
|
|
3102
|
+
const y = $(p.key) ? p.key : null;
|
|
2723
3103
|
y && (!d && y.spaceBefore && u.push(""), ot(t, u, y.commentBefore, d));
|
|
2724
3104
|
}
|
|
2725
3105
|
d = !1;
|
|
@@ -2741,7 +3121,7 @@ ${l}${p}` : `
|
|
|
2741
3121
|
return s ? (f += `
|
|
2742
3122
|
` + X(c(s), l), a && a()) : d && o && o(), f;
|
|
2743
3123
|
}
|
|
2744
|
-
function
|
|
3124
|
+
function gr({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
2745
3125
|
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: a } } = e;
|
|
2746
3126
|
n += r;
|
|
2747
3127
|
const l = Object.assign({}, e, {
|
|
@@ -2754,12 +3134,12 @@ function cr({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
|
2754
3134
|
for (let g = 0; g < s.length; ++g) {
|
|
2755
3135
|
const p = s[g];
|
|
2756
3136
|
let m = null;
|
|
2757
|
-
if (
|
|
3137
|
+
if ($(p))
|
|
2758
3138
|
p.spaceBefore && d.push(""), ot(e, d, p.commentBefore, !1), p.comment && (m = p.comment);
|
|
2759
|
-
else if (
|
|
2760
|
-
const y =
|
|
3139
|
+
else if (x(p)) {
|
|
3140
|
+
const y = $(p.key) ? p.key : null;
|
|
2761
3141
|
y && (y.spaceBefore && d.push(""), ot(e, d, y.commentBefore, !1), y.comment && (c = !0));
|
|
2762
|
-
const b =
|
|
3142
|
+
const b = $(p.value) ? p.value : null;
|
|
2763
3143
|
b ? (b.comment && (m = b.comment), b.commentBefore && (c = !0)) : p.value == null && y?.comment && (m = y.comment);
|
|
2764
3144
|
}
|
|
2765
3145
|
m && (c = !0);
|
|
@@ -2792,12 +3172,12 @@ function ot({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
|
2792
3172
|
}
|
|
2793
3173
|
}
|
|
2794
3174
|
function ce(s, e) {
|
|
2795
|
-
const t =
|
|
3175
|
+
const t = A(e) ? e.value : e;
|
|
2796
3176
|
for (const n of s)
|
|
2797
|
-
if (
|
|
3177
|
+
if (x(n) && (n.key === e || n.key === t || A(n.key) && n.key.value === t))
|
|
2798
3178
|
return n;
|
|
2799
3179
|
}
|
|
2800
|
-
class F extends
|
|
3180
|
+
class F extends Ws {
|
|
2801
3181
|
static get tagName() {
|
|
2802
3182
|
return "tag:yaml.org,2002:map";
|
|
2803
3183
|
}
|
|
@@ -2832,12 +3212,12 @@ class F extends Vs {
|
|
|
2832
3212
|
*/
|
|
2833
3213
|
add(e, t) {
|
|
2834
3214
|
let n;
|
|
2835
|
-
|
|
3215
|
+
x(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new D(e, e?.value) : n = new D(e.key, e.value);
|
|
2836
3216
|
const i = ce(this.items, n.key), r = this.schema?.sortMapEntries;
|
|
2837
3217
|
if (i) {
|
|
2838
3218
|
if (!t)
|
|
2839
3219
|
throw new Error(`Key ${n.key} already set`);
|
|
2840
|
-
|
|
3220
|
+
A(i.value) && Js(n.value) ? i.value.value = n.value : i.value = n.value;
|
|
2841
3221
|
} else if (r) {
|
|
2842
3222
|
const o = this.items.findIndex((a) => r(n, a) < 0);
|
|
2843
3223
|
o === -1 ? this.items.push(n) : this.items.splice(o, 0, n);
|
|
@@ -2850,7 +3230,7 @@ class F extends Vs {
|
|
|
2850
3230
|
}
|
|
2851
3231
|
get(e, t) {
|
|
2852
3232
|
const i = ce(this.items, e)?.value;
|
|
2853
|
-
return (!t &&
|
|
3233
|
+
return (!t && A(i) ? i.value : i) ?? void 0;
|
|
2854
3234
|
}
|
|
2855
3235
|
has(e) {
|
|
2856
3236
|
return !!ce(this.items, e);
|
|
@@ -2867,14 +3247,14 @@ class F extends Vs {
|
|
|
2867
3247
|
const i = n ? new n() : t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
2868
3248
|
t?.onCreate && t.onCreate(i);
|
|
2869
3249
|
for (const r of this.items)
|
|
2870
|
-
|
|
3250
|
+
Gs(t, i, r);
|
|
2871
3251
|
return i;
|
|
2872
3252
|
}
|
|
2873
3253
|
toString(e, t, n) {
|
|
2874
3254
|
if (!e)
|
|
2875
3255
|
return JSON.stringify(this);
|
|
2876
3256
|
for (const i of this.items)
|
|
2877
|
-
if (!
|
|
3257
|
+
if (!x(i))
|
|
2878
3258
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);
|
|
2879
3259
|
return !e.allNullValues && this.hasAllNullValues(!1) && (e = Object.assign({}, e, { allNullValues: !0 })), Qs(this, e, {
|
|
2880
3260
|
blockItemPrefix: "",
|
|
@@ -2885,22 +3265,22 @@ class F extends Vs {
|
|
|
2885
3265
|
});
|
|
2886
3266
|
}
|
|
2887
3267
|
}
|
|
2888
|
-
const
|
|
3268
|
+
const Ne = {
|
|
2889
3269
|
collection: "map",
|
|
2890
3270
|
default: !0,
|
|
2891
3271
|
nodeClass: F,
|
|
2892
3272
|
tag: "tag:yaml.org,2002:map",
|
|
2893
3273
|
resolve(s, e) {
|
|
2894
|
-
return
|
|
3274
|
+
return Ke(s) || e("Expected a mapping for this tag"), s;
|
|
2895
3275
|
},
|
|
2896
3276
|
createNode: (s, e, t) => F.from(s, e, t)
|
|
2897
3277
|
};
|
|
2898
|
-
class ue extends
|
|
3278
|
+
class ue extends Ws {
|
|
2899
3279
|
static get tagName() {
|
|
2900
3280
|
return "tag:yaml.org,2002:seq";
|
|
2901
3281
|
}
|
|
2902
3282
|
constructor(e) {
|
|
2903
|
-
super(
|
|
3283
|
+
super(Te, e), this.items = [];
|
|
2904
3284
|
}
|
|
2905
3285
|
add(e) {
|
|
2906
3286
|
this.items.push(e);
|
|
@@ -2914,15 +3294,15 @@ class ue extends Vs {
|
|
|
2914
3294
|
* @returns `true` if the item was found and removed.
|
|
2915
3295
|
*/
|
|
2916
3296
|
delete(e) {
|
|
2917
|
-
const t =
|
|
3297
|
+
const t = Xe(e);
|
|
2918
3298
|
return typeof t != "number" ? !1 : this.items.splice(t, 1).length > 0;
|
|
2919
3299
|
}
|
|
2920
3300
|
get(e, t) {
|
|
2921
|
-
const n =
|
|
3301
|
+
const n = Xe(e);
|
|
2922
3302
|
if (typeof n != "number")
|
|
2923
3303
|
return;
|
|
2924
3304
|
const i = this.items[n];
|
|
2925
|
-
return !t &&
|
|
3305
|
+
return !t && A(i) ? i.value : i;
|
|
2926
3306
|
}
|
|
2927
3307
|
/**
|
|
2928
3308
|
* Checks if the collection includes a value with the key `key`.
|
|
@@ -2931,7 +3311,7 @@ class ue extends Vs {
|
|
|
2931
3311
|
* It may be wrapped in a `Scalar`.
|
|
2932
3312
|
*/
|
|
2933
3313
|
has(e) {
|
|
2934
|
-
const t =
|
|
3314
|
+
const t = Xe(e);
|
|
2935
3315
|
return typeof t == "number" && t < this.items.length;
|
|
2936
3316
|
}
|
|
2937
3317
|
/**
|
|
@@ -2942,11 +3322,11 @@ class ue extends Vs {
|
|
|
2942
3322
|
* It may be wrapped in a `Scalar`.
|
|
2943
3323
|
*/
|
|
2944
3324
|
set(e, t) {
|
|
2945
|
-
const n =
|
|
3325
|
+
const n = Xe(e);
|
|
2946
3326
|
if (typeof n != "number")
|
|
2947
3327
|
throw new Error(`Expected a valid index, not ${e}.`);
|
|
2948
3328
|
const i = this.items[n];
|
|
2949
|
-
|
|
3329
|
+
A(i) && Js(t) ? i.value = t : this.items[n] = t;
|
|
2950
3330
|
}
|
|
2951
3331
|
toJSON(e, t) {
|
|
2952
3332
|
const n = [];
|
|
@@ -2974,14 +3354,14 @@ class ue extends Vs {
|
|
|
2974
3354
|
const l = t instanceof Set ? a : String(o++);
|
|
2975
3355
|
a = i.call(t, l, a);
|
|
2976
3356
|
}
|
|
2977
|
-
r.items.push(
|
|
3357
|
+
r.items.push(De(a, void 0, n));
|
|
2978
3358
|
}
|
|
2979
3359
|
}
|
|
2980
3360
|
return r;
|
|
2981
3361
|
}
|
|
2982
3362
|
}
|
|
2983
|
-
function
|
|
2984
|
-
let e =
|
|
3363
|
+
function Xe(s) {
|
|
3364
|
+
let e = A(s) ? s.value : s;
|
|
2985
3365
|
return e && typeof e == "string" && (e = Number(e)), typeof e == "number" && Number.isInteger(e) && e >= 0 ? e : null;
|
|
2986
3366
|
}
|
|
2987
3367
|
const _e = {
|
|
@@ -2990,31 +3370,31 @@ const _e = {
|
|
|
2990
3370
|
nodeClass: ue,
|
|
2991
3371
|
tag: "tag:yaml.org,2002:seq",
|
|
2992
3372
|
resolve(s, e) {
|
|
2993
|
-
return
|
|
3373
|
+
return Je(s) || e("Expected a sequence for this tag"), s;
|
|
2994
3374
|
},
|
|
2995
3375
|
createNode: (s, e, t) => ue.from(s, e, t)
|
|
2996
|
-
},
|
|
3376
|
+
}, dt = {
|
|
2997
3377
|
identify: (s) => typeof s == "string",
|
|
2998
3378
|
default: !0,
|
|
2999
3379
|
tag: "tag:yaml.org,2002:str",
|
|
3000
3380
|
resolve: (s) => s,
|
|
3001
3381
|
stringify(s, e, t, n) {
|
|
3002
|
-
return e = Object.assign({ actualString: !0 }, e),
|
|
3382
|
+
return e = Object.assign({ actualString: !0 }, e), Vt(s, e, t, n);
|
|
3003
3383
|
}
|
|
3004
|
-
},
|
|
3384
|
+
}, ht = {
|
|
3005
3385
|
identify: (s) => s == null,
|
|
3006
|
-
createNode: () => new
|
|
3386
|
+
createNode: () => new T(null),
|
|
3007
3387
|
default: !0,
|
|
3008
3388
|
tag: "tag:yaml.org,2002:null",
|
|
3009
3389
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
3010
|
-
resolve: () => new
|
|
3011
|
-
stringify: ({ source: s }, e) => typeof s == "string" &&
|
|
3390
|
+
resolve: () => new T(null),
|
|
3391
|
+
stringify: ({ source: s }, e) => typeof s == "string" && ht.test.test(s) ? s : e.options.nullStr
|
|
3012
3392
|
}, Yt = {
|
|
3013
3393
|
identify: (s) => typeof s == "boolean",
|
|
3014
3394
|
default: !0,
|
|
3015
3395
|
tag: "tag:yaml.org,2002:bool",
|
|
3016
3396
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
3017
|
-
resolve: (s) => new
|
|
3397
|
+
resolve: (s) => new T(s[0] === "t" || s[0] === "T"),
|
|
3018
3398
|
stringify({ source: s, value: e }, t) {
|
|
3019
3399
|
if (s && Yt.test.test(s)) {
|
|
3020
3400
|
const n = s[0] === "t" || s[0] === "T";
|
|
@@ -3064,43 +3444,43 @@ const Xs = {
|
|
|
3064
3444
|
tag: "tag:yaml.org,2002:float",
|
|
3065
3445
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
3066
3446
|
resolve(s) {
|
|
3067
|
-
const e = new
|
|
3447
|
+
const e = new T(parseFloat(s)), t = s.indexOf(".");
|
|
3068
3448
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
3069
3449
|
},
|
|
3070
3450
|
stringify: Y
|
|
3071
|
-
},
|
|
3451
|
+
}, pt = (s) => typeof s == "bigint" || Number.isInteger(s), zt = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
3072
3452
|
function tn(s, e, t) {
|
|
3073
3453
|
const { value: n } = s;
|
|
3074
|
-
return
|
|
3454
|
+
return pt(n) && n >= 0 ? t + n.toString(e) : Y(s);
|
|
3075
3455
|
}
|
|
3076
3456
|
const sn = {
|
|
3077
|
-
identify: (s) =>
|
|
3457
|
+
identify: (s) => pt(s) && s >= 0,
|
|
3078
3458
|
default: !0,
|
|
3079
3459
|
tag: "tag:yaml.org,2002:int",
|
|
3080
3460
|
format: "OCT",
|
|
3081
3461
|
test: /^0o[0-7]+$/,
|
|
3082
|
-
resolve: (s, e, t) =>
|
|
3462
|
+
resolve: (s, e, t) => zt(s, 2, 8, t),
|
|
3083
3463
|
stringify: (s) => tn(s, 8, "0o")
|
|
3084
3464
|
}, nn = {
|
|
3085
|
-
identify:
|
|
3465
|
+
identify: pt,
|
|
3086
3466
|
default: !0,
|
|
3087
3467
|
tag: "tag:yaml.org,2002:int",
|
|
3088
3468
|
test: /^[-+]?[0-9]+$/,
|
|
3089
|
-
resolve: (s, e, t) =>
|
|
3469
|
+
resolve: (s, e, t) => zt(s, 0, 10, t),
|
|
3090
3470
|
stringify: Y
|
|
3091
3471
|
}, rn = {
|
|
3092
|
-
identify: (s) =>
|
|
3472
|
+
identify: (s) => pt(s) && s >= 0,
|
|
3093
3473
|
default: !0,
|
|
3094
3474
|
tag: "tag:yaml.org,2002:int",
|
|
3095
3475
|
format: "HEX",
|
|
3096
3476
|
test: /^0x[0-9a-fA-F]+$/,
|
|
3097
|
-
resolve: (s, e, t) =>
|
|
3477
|
+
resolve: (s, e, t) => zt(s, 2, 16, t),
|
|
3098
3478
|
stringify: (s) => tn(s, 16, "0x")
|
|
3099
|
-
},
|
|
3100
|
-
|
|
3479
|
+
}, yr = [
|
|
3480
|
+
Ne,
|
|
3101
3481
|
_e,
|
|
3102
|
-
ft,
|
|
3103
3482
|
dt,
|
|
3483
|
+
ht,
|
|
3104
3484
|
Yt,
|
|
3105
3485
|
sn,
|
|
3106
3486
|
nn,
|
|
@@ -3112,22 +3492,22 @@ const sn = {
|
|
|
3112
3492
|
function hs(s) {
|
|
3113
3493
|
return typeof s == "bigint" || Number.isInteger(s);
|
|
3114
3494
|
}
|
|
3115
|
-
const
|
|
3495
|
+
const Ze = ({ value: s }) => JSON.stringify(s), wr = [
|
|
3116
3496
|
{
|
|
3117
3497
|
identify: (s) => typeof s == "string",
|
|
3118
3498
|
default: !0,
|
|
3119
3499
|
tag: "tag:yaml.org,2002:str",
|
|
3120
3500
|
resolve: (s) => s,
|
|
3121
|
-
stringify:
|
|
3501
|
+
stringify: Ze
|
|
3122
3502
|
},
|
|
3123
3503
|
{
|
|
3124
3504
|
identify: (s) => s == null,
|
|
3125
|
-
createNode: () => new
|
|
3505
|
+
createNode: () => new T(null),
|
|
3126
3506
|
default: !0,
|
|
3127
3507
|
tag: "tag:yaml.org,2002:null",
|
|
3128
3508
|
test: /^null$/,
|
|
3129
3509
|
resolve: () => null,
|
|
3130
|
-
stringify:
|
|
3510
|
+
stringify: Ze
|
|
3131
3511
|
},
|
|
3132
3512
|
{
|
|
3133
3513
|
identify: (s) => typeof s == "boolean",
|
|
@@ -3135,7 +3515,7 @@ const Xe = ({ value: s }) => JSON.stringify(s), fr = [
|
|
|
3135
3515
|
tag: "tag:yaml.org,2002:bool",
|
|
3136
3516
|
test: /^true$|^false$/,
|
|
3137
3517
|
resolve: (s) => s === "true",
|
|
3138
|
-
stringify:
|
|
3518
|
+
stringify: Ze
|
|
3139
3519
|
},
|
|
3140
3520
|
{
|
|
3141
3521
|
identify: hs,
|
|
@@ -3151,16 +3531,16 @@ const Xe = ({ value: s }) => JSON.stringify(s), fr = [
|
|
|
3151
3531
|
tag: "tag:yaml.org,2002:float",
|
|
3152
3532
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
3153
3533
|
resolve: (s) => parseFloat(s),
|
|
3154
|
-
stringify:
|
|
3534
|
+
stringify: Ze
|
|
3155
3535
|
}
|
|
3156
|
-
],
|
|
3536
|
+
], kr = {
|
|
3157
3537
|
default: !0,
|
|
3158
3538
|
tag: "",
|
|
3159
3539
|
test: /^/,
|
|
3160
3540
|
resolve(s, e) {
|
|
3161
3541
|
return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
|
|
3162
3542
|
}
|
|
3163
|
-
},
|
|
3543
|
+
}, br = [Ne, _e].concat(wr, kr), Gt = {
|
|
3164
3544
|
identify: (s) => s instanceof Uint8Array,
|
|
3165
3545
|
// Buffer inherits from Uint8Array
|
|
3166
3546
|
default: !1,
|
|
@@ -3194,24 +3574,24 @@ const Xe = ({ value: s }) => JSON.stringify(s), fr = [
|
|
|
3194
3574
|
a = btoa(l);
|
|
3195
3575
|
} else
|
|
3196
3576
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
3197
|
-
if (e ?? (e =
|
|
3577
|
+
if (e ?? (e = T.BLOCK_LITERAL), e !== T.QUOTE_DOUBLE) {
|
|
3198
3578
|
const l = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(a.length / l), h = new Array(c);
|
|
3199
3579
|
for (let d = 0, u = 0; d < c; ++d, u += l)
|
|
3200
3580
|
h[d] = a.substr(u, l);
|
|
3201
|
-
a = h.join(e ===
|
|
3581
|
+
a = h.join(e === T.BLOCK_LITERAL ? `
|
|
3202
3582
|
` : " ");
|
|
3203
3583
|
}
|
|
3204
|
-
return
|
|
3584
|
+
return Vt({ comment: s, type: e, value: a }, n, i, r);
|
|
3205
3585
|
}
|
|
3206
3586
|
};
|
|
3207
3587
|
function on(s, e) {
|
|
3208
|
-
if (
|
|
3588
|
+
if (Je(s))
|
|
3209
3589
|
for (let t = 0; t < s.items.length; ++t) {
|
|
3210
3590
|
let n = s.items[t];
|
|
3211
|
-
if (!
|
|
3212
|
-
if (
|
|
3591
|
+
if (!x(n)) {
|
|
3592
|
+
if (Ke(n)) {
|
|
3213
3593
|
n.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
3214
|
-
const i = n.items[0] || new D(new
|
|
3594
|
+
const i = n.items[0] || new D(new T(null));
|
|
3215
3595
|
if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
|
|
3216
3596
|
${i.key.commentBefore}` : n.commentBefore), n.comment) {
|
|
3217
3597
|
const r = i.value ?? i.key;
|
|
@@ -3220,7 +3600,7 @@ ${r.comment}` : n.comment;
|
|
|
3220
3600
|
}
|
|
3221
3601
|
n = i;
|
|
3222
3602
|
}
|
|
3223
|
-
s.items[t] =
|
|
3603
|
+
s.items[t] = x(n) ? n : new D(n);
|
|
3224
3604
|
}
|
|
3225
3605
|
}
|
|
3226
3606
|
else
|
|
@@ -3274,7 +3654,7 @@ class we extends ue {
|
|
|
3274
3654
|
t?.onCreate && t.onCreate(n);
|
|
3275
3655
|
for (const i of this.items) {
|
|
3276
3656
|
let r, o;
|
|
3277
|
-
if (
|
|
3657
|
+
if (x(i) ? (r = K(i.key, "", t), o = K(i.value, r, t)) : r = K(i, "", t), n.has(r))
|
|
3278
3658
|
throw new Error("Ordered maps must not include duplicate keys");
|
|
3279
3659
|
n.set(r, o);
|
|
3280
3660
|
}
|
|
@@ -3295,7 +3675,7 @@ const Xt = {
|
|
|
3295
3675
|
resolve(s, e) {
|
|
3296
3676
|
const t = on(s, e), n = [];
|
|
3297
3677
|
for (const { key: i } of t.items)
|
|
3298
|
-
|
|
3678
|
+
A(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
|
|
3299
3679
|
return Object.assign(new we(), t);
|
|
3300
3680
|
},
|
|
3301
3681
|
createNode: (s, e, t) => we.from(s, e, t)
|
|
@@ -3308,23 +3688,23 @@ const cn = {
|
|
|
3308
3688
|
default: !0,
|
|
3309
3689
|
tag: "tag:yaml.org,2002:bool",
|
|
3310
3690
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
3311
|
-
resolve: () => new
|
|
3691
|
+
resolve: () => new T(!0),
|
|
3312
3692
|
stringify: ln
|
|
3313
3693
|
}, un = {
|
|
3314
3694
|
identify: (s) => s === !1,
|
|
3315
3695
|
default: !0,
|
|
3316
3696
|
tag: "tag:yaml.org,2002:bool",
|
|
3317
3697
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
3318
|
-
resolve: () => new
|
|
3698
|
+
resolve: () => new T(!1),
|
|
3319
3699
|
stringify: ln
|
|
3320
|
-
},
|
|
3700
|
+
}, Sr = {
|
|
3321
3701
|
identify: (s) => typeof s == "number",
|
|
3322
3702
|
default: !0,
|
|
3323
3703
|
tag: "tag:yaml.org,2002:float",
|
|
3324
3704
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
3325
3705
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
3326
3706
|
stringify: Y
|
|
3327
|
-
},
|
|
3707
|
+
}, vr = {
|
|
3328
3708
|
identify: (s) => typeof s == "number",
|
|
3329
3709
|
default: !0,
|
|
3330
3710
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -3335,13 +3715,13 @@ const cn = {
|
|
|
3335
3715
|
const e = Number(s.value);
|
|
3336
3716
|
return isFinite(e) ? e.toExponential() : Y(s);
|
|
3337
3717
|
}
|
|
3338
|
-
},
|
|
3718
|
+
}, Ir = {
|
|
3339
3719
|
identify: (s) => typeof s == "number",
|
|
3340
3720
|
default: !0,
|
|
3341
3721
|
tag: "tag:yaml.org,2002:float",
|
|
3342
3722
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
3343
3723
|
resolve(s) {
|
|
3344
|
-
const e = new
|
|
3724
|
+
const e = new T(parseFloat(s.replace(/_/g, ""))), t = s.indexOf(".");
|
|
3345
3725
|
if (t !== -1) {
|
|
3346
3726
|
const n = s.substring(t + 1).replace(/_/g, "");
|
|
3347
3727
|
n[n.length - 1] === "0" && (e.minFractionDigits = n.length);
|
|
@@ -3349,8 +3729,8 @@ const cn = {
|
|
|
3349
3729
|
return e;
|
|
3350
3730
|
},
|
|
3351
3731
|
stringify: Y
|
|
3352
|
-
},
|
|
3353
|
-
function
|
|
3732
|
+
}, We = (s) => typeof s == "bigint" || Number.isInteger(s);
|
|
3733
|
+
function mt(s, e, t, { intAsBigInt: n }) {
|
|
3354
3734
|
const i = s[0];
|
|
3355
3735
|
if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
|
|
3356
3736
|
switch (t) {
|
|
@@ -3372,42 +3752,42 @@ function pt(s, e, t, { intAsBigInt: n }) {
|
|
|
3372
3752
|
}
|
|
3373
3753
|
function Zt(s, e, t) {
|
|
3374
3754
|
const { value: n } = s;
|
|
3375
|
-
if (
|
|
3755
|
+
if (We(n)) {
|
|
3376
3756
|
const i = n.toString(e);
|
|
3377
3757
|
return n < 0 ? "-" + t + i.substr(1) : t + i;
|
|
3378
3758
|
}
|
|
3379
3759
|
return Y(s);
|
|
3380
3760
|
}
|
|
3381
|
-
const
|
|
3382
|
-
identify:
|
|
3761
|
+
const Tr = {
|
|
3762
|
+
identify: We,
|
|
3383
3763
|
default: !0,
|
|
3384
3764
|
tag: "tag:yaml.org,2002:int",
|
|
3385
3765
|
format: "BIN",
|
|
3386
3766
|
test: /^[-+]?0b[0-1_]+$/,
|
|
3387
|
-
resolve: (s, e, t) =>
|
|
3767
|
+
resolve: (s, e, t) => mt(s, 2, 2, t),
|
|
3388
3768
|
stringify: (s) => Zt(s, 2, "0b")
|
|
3389
|
-
},
|
|
3390
|
-
identify:
|
|
3769
|
+
}, Or = {
|
|
3770
|
+
identify: We,
|
|
3391
3771
|
default: !0,
|
|
3392
3772
|
tag: "tag:yaml.org,2002:int",
|
|
3393
3773
|
format: "OCT",
|
|
3394
3774
|
test: /^[-+]?0[0-7_]+$/,
|
|
3395
|
-
resolve: (s, e, t) =>
|
|
3775
|
+
resolve: (s, e, t) => mt(s, 1, 8, t),
|
|
3396
3776
|
stringify: (s) => Zt(s, 8, "0")
|
|
3397
|
-
},
|
|
3398
|
-
identify:
|
|
3777
|
+
}, Nr = {
|
|
3778
|
+
identify: We,
|
|
3399
3779
|
default: !0,
|
|
3400
3780
|
tag: "tag:yaml.org,2002:int",
|
|
3401
3781
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
3402
|
-
resolve: (s, e, t) =>
|
|
3782
|
+
resolve: (s, e, t) => mt(s, 0, 10, t),
|
|
3403
3783
|
stringify: Y
|
|
3404
|
-
},
|
|
3405
|
-
identify:
|
|
3784
|
+
}, _r = {
|
|
3785
|
+
identify: We,
|
|
3406
3786
|
default: !0,
|
|
3407
3787
|
tag: "tag:yaml.org,2002:int",
|
|
3408
3788
|
format: "HEX",
|
|
3409
3789
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
3410
|
-
resolve: (s, e, t) =>
|
|
3790
|
+
resolve: (s, e, t) => mt(s, 2, 16, t),
|
|
3411
3791
|
stringify: (s) => Zt(s, 16, "0x")
|
|
3412
3792
|
};
|
|
3413
3793
|
class ke extends F {
|
|
@@ -3416,7 +3796,7 @@ class ke extends F {
|
|
|
3416
3796
|
}
|
|
3417
3797
|
add(e) {
|
|
3418
3798
|
let t;
|
|
3419
|
-
|
|
3799
|
+
x(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new D(e.key, null) : t = new D(e, null), ce(this.items, t.key) || this.items.push(t);
|
|
3420
3800
|
}
|
|
3421
3801
|
/**
|
|
3422
3802
|
* If `keepPair` is `true`, returns the Pair matching `key`.
|
|
@@ -3424,7 +3804,7 @@ class ke extends F {
|
|
|
3424
3804
|
*/
|
|
3425
3805
|
get(e, t) {
|
|
3426
3806
|
const n = ce(this.items, e);
|
|
3427
|
-
return !t &&
|
|
3807
|
+
return !t && x(n) ? A(n.key) ? n.key.value : n.key : n;
|
|
3428
3808
|
}
|
|
3429
3809
|
set(e, t) {
|
|
3430
3810
|
if (typeof t != "boolean")
|
|
@@ -3459,7 +3839,7 @@ const es = {
|
|
|
3459
3839
|
tag: "tag:yaml.org,2002:set",
|
|
3460
3840
|
createNode: (s, e, t) => ke.from(s, e, t),
|
|
3461
3841
|
resolve(s, e) {
|
|
3462
|
-
if (
|
|
3842
|
+
if (Ke(s)) {
|
|
3463
3843
|
if (s.hasAllNullValues(!0))
|
|
3464
3844
|
return Object.assign(new ke(), s);
|
|
3465
3845
|
e("Set items must all have null values");
|
|
@@ -3499,7 +3879,7 @@ const dn = {
|
|
|
3499
3879
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
3500
3880
|
resolve: (s) => ts(s, !1),
|
|
3501
3881
|
stringify: fn
|
|
3502
|
-
},
|
|
3882
|
+
}, gt = {
|
|
3503
3883
|
identify: (s) => s instanceof Date,
|
|
3504
3884
|
default: !0,
|
|
3505
3885
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -3508,7 +3888,7 @@ const dn = {
|
|
|
3508
3888
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
3509
3889
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
3510
3890
|
resolve(s) {
|
|
3511
|
-
const e = s.match(
|
|
3891
|
+
const e = s.match(gt.test);
|
|
3512
3892
|
if (!e)
|
|
3513
3893
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
3514
3894
|
const [, t, n, i, r, o, a] = e.map(Number), l = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
@@ -3522,35 +3902,35 @@ const dn = {
|
|
|
3522
3902
|
},
|
|
3523
3903
|
stringify: ({ value: s }) => s?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
3524
3904
|
}, ps = [
|
|
3525
|
-
|
|
3905
|
+
Ne,
|
|
3526
3906
|
_e,
|
|
3527
|
-
ft,
|
|
3528
3907
|
dt,
|
|
3908
|
+
ht,
|
|
3529
3909
|
cn,
|
|
3530
3910
|
un,
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3911
|
+
Tr,
|
|
3912
|
+
Or,
|
|
3913
|
+
Nr,
|
|
3914
|
+
_r,
|
|
3915
|
+
Sr,
|
|
3916
|
+
vr,
|
|
3917
|
+
Ir,
|
|
3918
|
+
Gt,
|
|
3539
3919
|
Z,
|
|
3540
3920
|
Xt,
|
|
3541
3921
|
Qt,
|
|
3542
3922
|
es,
|
|
3543
3923
|
dn,
|
|
3544
3924
|
hn,
|
|
3545
|
-
|
|
3925
|
+
gt
|
|
3546
3926
|
], ms = /* @__PURE__ */ new Map([
|
|
3547
|
-
["core",
|
|
3548
|
-
["failsafe", [
|
|
3549
|
-
["json",
|
|
3927
|
+
["core", yr],
|
|
3928
|
+
["failsafe", [Ne, _e, dt]],
|
|
3929
|
+
["json", br],
|
|
3550
3930
|
["yaml11", ps],
|
|
3551
3931
|
["yaml-1.1", ps]
|
|
3552
3932
|
]), gs = {
|
|
3553
|
-
binary:
|
|
3933
|
+
binary: Gt,
|
|
3554
3934
|
bool: Yt,
|
|
3555
3935
|
float: en,
|
|
3556
3936
|
floatExp: Zs,
|
|
@@ -3560,21 +3940,21 @@ const dn = {
|
|
|
3560
3940
|
intHex: rn,
|
|
3561
3941
|
intOct: sn,
|
|
3562
3942
|
intTime: dn,
|
|
3563
|
-
map:
|
|
3943
|
+
map: Ne,
|
|
3564
3944
|
merge: Z,
|
|
3565
|
-
null:
|
|
3945
|
+
null: ht,
|
|
3566
3946
|
omap: Xt,
|
|
3567
3947
|
pairs: Qt,
|
|
3568
3948
|
seq: _e,
|
|
3569
3949
|
set: es,
|
|
3570
|
-
timestamp:
|
|
3571
|
-
},
|
|
3572
|
-
"tag:yaml.org,2002:binary":
|
|
3950
|
+
timestamp: gt
|
|
3951
|
+
}, Ar = {
|
|
3952
|
+
"tag:yaml.org,2002:binary": Gt,
|
|
3573
3953
|
"tag:yaml.org,2002:merge": Z,
|
|
3574
3954
|
"tag:yaml.org,2002:omap": Xt,
|
|
3575
3955
|
"tag:yaml.org,2002:pairs": Qt,
|
|
3576
3956
|
"tag:yaml.org,2002:set": es,
|
|
3577
|
-
"tag:yaml.org,2002:timestamp":
|
|
3957
|
+
"tag:yaml.org,2002:timestamp": gt
|
|
3578
3958
|
};
|
|
3579
3959
|
function Nt(s, e, t) {
|
|
3580
3960
|
const n = ms.get(e);
|
|
@@ -3601,17 +3981,17 @@ function Nt(s, e, t) {
|
|
|
3601
3981
|
return r.includes(a) || r.push(a), r;
|
|
3602
3982
|
}, []);
|
|
3603
3983
|
}
|
|
3604
|
-
const
|
|
3984
|
+
const Cr = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
3605
3985
|
class ss {
|
|
3606
3986
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: a }) {
|
|
3607
|
-
this.compat = Array.isArray(e) ? Nt(e, "compat") : e ? Nt(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ?
|
|
3987
|
+
this.compat = Array.isArray(e) ? Nt(e, "compat") : e ? Nt(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? Ar : {}, this.tags = Nt(t, this.name, n), this.toStringOptions = a ?? null, Object.defineProperty(this, re, { value: Ne }), Object.defineProperty(this, G, { value: dt }), Object.defineProperty(this, Te, { value: _e }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? Cr : null;
|
|
3608
3988
|
}
|
|
3609
3989
|
clone() {
|
|
3610
3990
|
const e = Object.create(ss.prototype, Object.getOwnPropertyDescriptors(this));
|
|
3611
3991
|
return e.tags = this.tags.slice(), e;
|
|
3612
3992
|
}
|
|
3613
3993
|
}
|
|
3614
|
-
function
|
|
3994
|
+
function Er(s, e) {
|
|
3615
3995
|
const t = [];
|
|
3616
3996
|
let n = e.directives === !0;
|
|
3617
3997
|
if (e.directives !== !1 && s.directives) {
|
|
@@ -3627,7 +4007,7 @@ function Ir(s, e) {
|
|
|
3627
4007
|
}
|
|
3628
4008
|
let o = !1, a = null;
|
|
3629
4009
|
if (s.contents) {
|
|
3630
|
-
if (
|
|
4010
|
+
if ($(s.contents)) {
|
|
3631
4011
|
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
3632
4012
|
const h = r(s.contents.commentBefore);
|
|
3633
4013
|
t.push(X(h, ""));
|
|
@@ -3682,7 +4062,7 @@ class Ve {
|
|
|
3682
4062
|
const e = Object.create(Ve.prototype, {
|
|
3683
4063
|
[J]: { value: jt }
|
|
3684
4064
|
});
|
|
3685
|
-
return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents =
|
|
4065
|
+
return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = $(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
|
|
3686
4066
|
}
|
|
3687
4067
|
/** Adds a value to the document. */
|
|
3688
4068
|
add(e) {
|
|
@@ -3707,7 +4087,7 @@ class Ve {
|
|
|
3707
4087
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
3708
4088
|
!t || n.has(t) ? Ks(t || "a", n) : t;
|
|
3709
4089
|
}
|
|
3710
|
-
return new
|
|
4090
|
+
return new Wt(e.anchor);
|
|
3711
4091
|
}
|
|
3712
4092
|
createNode(e, t, n) {
|
|
3713
4093
|
let i;
|
|
@@ -3717,7 +4097,7 @@ class Ve {
|
|
|
3717
4097
|
const m = (y) => typeof y == "number" || y instanceof String || y instanceof Number, k = t.filter(m).map(String);
|
|
3718
4098
|
k.length > 0 && (t = t.concat(k)), i = t;
|
|
3719
4099
|
} else n === void 0 && t && (n = t, t = void 0);
|
|
3720
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: h } = n ?? {}, { onAnchor: d, setAnchors: u, sourceObjects: f } =
|
|
4100
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: h } = n ?? {}, { onAnchor: d, setAnchors: u, sourceObjects: f } = ir(
|
|
3721
4101
|
this,
|
|
3722
4102
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
3723
4103
|
o || "a"
|
|
@@ -3729,8 +4109,8 @@ class Ve {
|
|
|
3729
4109
|
replacer: i,
|
|
3730
4110
|
schema: this.schema,
|
|
3731
4111
|
sourceObjects: f
|
|
3732
|
-
}, p =
|
|
3733
|
-
return a &&
|
|
4112
|
+
}, p = De(e, h, g);
|
|
4113
|
+
return a && L(p) && (p.flow = !0), u(), p;
|
|
3734
4114
|
}
|
|
3735
4115
|
/**
|
|
3736
4116
|
* Convert a key and a value into a `Pair` using the current schema,
|
|
@@ -3752,7 +4132,7 @@ class Ve {
|
|
|
3752
4132
|
* @returns `true` if the item was found and removed.
|
|
3753
4133
|
*/
|
|
3754
4134
|
deleteIn(e) {
|
|
3755
|
-
return
|
|
4135
|
+
return Le(e) ? this.contents == null ? !1 : (this.contents = null, !0) : he(this.contents) ? this.contents.deleteIn(e) : !1;
|
|
3756
4136
|
}
|
|
3757
4137
|
/**
|
|
3758
4138
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3760,7 +4140,7 @@ class Ve {
|
|
|
3760
4140
|
* `true` (collections are always returned intact).
|
|
3761
4141
|
*/
|
|
3762
4142
|
get(e, t) {
|
|
3763
|
-
return
|
|
4143
|
+
return L(this.contents) ? this.contents.get(e, t) : void 0;
|
|
3764
4144
|
}
|
|
3765
4145
|
/**
|
|
3766
4146
|
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
@@ -3768,19 +4148,19 @@ class Ve {
|
|
|
3768
4148
|
* `true` (collections are always returned intact).
|
|
3769
4149
|
*/
|
|
3770
4150
|
getIn(e, t) {
|
|
3771
|
-
return
|
|
4151
|
+
return Le(e) ? !t && A(this.contents) ? this.contents.value : this.contents : L(this.contents) ? this.contents.getIn(e, t) : void 0;
|
|
3772
4152
|
}
|
|
3773
4153
|
/**
|
|
3774
4154
|
* Checks if the document includes a value with the key `key`.
|
|
3775
4155
|
*/
|
|
3776
4156
|
has(e) {
|
|
3777
|
-
return
|
|
4157
|
+
return L(this.contents) ? this.contents.has(e) : !1;
|
|
3778
4158
|
}
|
|
3779
4159
|
/**
|
|
3780
4160
|
* Checks if the document includes a value at `path`.
|
|
3781
4161
|
*/
|
|
3782
4162
|
hasIn(e) {
|
|
3783
|
-
return
|
|
4163
|
+
return Le(e) ? this.contents !== void 0 : L(this.contents) ? this.contents.hasIn(e) : !1;
|
|
3784
4164
|
}
|
|
3785
4165
|
/**
|
|
3786
4166
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3794,7 +4174,7 @@ class Ve {
|
|
|
3794
4174
|
* boolean to add/remove the item from the set.
|
|
3795
4175
|
*/
|
|
3796
4176
|
setIn(e, t) {
|
|
3797
|
-
|
|
4177
|
+
Le(e) ? this.contents = t : this.contents == null ? this.contents = rt(this.schema, Array.from(e), t) : he(this.contents) && this.contents.setIn(e, t);
|
|
3798
4178
|
}
|
|
3799
4179
|
/**
|
|
3800
4180
|
* Change the YAML version and schema used by the document.
|
|
@@ -3861,11 +4241,11 @@ class Ve {
|
|
|
3861
4241
|
const t = JSON.stringify(e.indent);
|
|
3862
4242
|
throw new Error(`"indent" option must be a positive integer, not ${t}`);
|
|
3863
4243
|
}
|
|
3864
|
-
return
|
|
4244
|
+
return Er(this, e);
|
|
3865
4245
|
}
|
|
3866
4246
|
}
|
|
3867
4247
|
function he(s) {
|
|
3868
|
-
if (
|
|
4248
|
+
if (L(s))
|
|
3869
4249
|
return !0;
|
|
3870
4250
|
throw new Error("Expected a YAML collection as document contents");
|
|
3871
4251
|
}
|
|
@@ -3874,12 +4254,12 @@ class pn extends Error {
|
|
|
3874
4254
|
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
3875
4255
|
}
|
|
3876
4256
|
}
|
|
3877
|
-
class
|
|
4257
|
+
class $e extends pn {
|
|
3878
4258
|
constructor(e, t, n) {
|
|
3879
4259
|
super("YAMLParseError", e, t, n);
|
|
3880
4260
|
}
|
|
3881
4261
|
}
|
|
3882
|
-
class
|
|
4262
|
+
class Lr extends pn {
|
|
3883
4263
|
constructor(e, t, n) {
|
|
3884
4264
|
super("YAMLWarning", e, t, n);
|
|
3885
4265
|
}
|
|
@@ -3921,8 +4301,8 @@ function ve(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
|
|
|
3921
4301
|
break;
|
|
3922
4302
|
case "comment": {
|
|
3923
4303
|
h || r(w, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
3924
|
-
const
|
|
3925
|
-
d ? d += u +
|
|
4304
|
+
const C = w.source.substring(1) || " ";
|
|
4305
|
+
d ? d += u + C : d = C, u = "", c = !1;
|
|
3926
4306
|
break;
|
|
3927
4307
|
}
|
|
3928
4308
|
case "newline":
|
|
@@ -3947,7 +4327,7 @@ function ve(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
|
|
|
3947
4327
|
default:
|
|
3948
4328
|
r(w, "UNEXPECTED_TOKEN", `Unexpected ${w.type} token`), c = !1, h = !1;
|
|
3949
4329
|
}
|
|
3950
|
-
const I = s[s.length - 1],
|
|
4330
|
+
const I = s[s.length - 1], N = I ? I.offset + I.source.length : i;
|
|
3951
4331
|
return g && n && n.type !== "space" && n.type !== "newline" && n.type !== "comma" && (n.type !== "scalar" || n.source !== "") && r(n.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), p && (c && p.indent <= o || n?.type === "block-map" || n?.type === "block-seq") && r(p, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
3952
4332
|
comma: b,
|
|
3953
4333
|
found: S,
|
|
@@ -3957,11 +4337,11 @@ function ve(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
|
|
|
3957
4337
|
anchor: m,
|
|
3958
4338
|
tag: k,
|
|
3959
4339
|
newlineAfterProp: y,
|
|
3960
|
-
end:
|
|
3961
|
-
start: v ??
|
|
4340
|
+
end: N,
|
|
4341
|
+
start: v ?? N
|
|
3962
4342
|
};
|
|
3963
4343
|
}
|
|
3964
|
-
function
|
|
4344
|
+
function Me(s) {
|
|
3965
4345
|
if (!s)
|
|
3966
4346
|
return null;
|
|
3967
4347
|
switch (s.type) {
|
|
@@ -3988,7 +4368,7 @@ function De(s) {
|
|
|
3988
4368
|
if (t.type === "newline")
|
|
3989
4369
|
return !0;
|
|
3990
4370
|
}
|
|
3991
|
-
if (
|
|
4371
|
+
if (Me(e.key) || Me(e.value))
|
|
3992
4372
|
return !0;
|
|
3993
4373
|
}
|
|
3994
4374
|
return !1;
|
|
@@ -3996,21 +4376,21 @@ function De(s) {
|
|
|
3996
4376
|
return !0;
|
|
3997
4377
|
}
|
|
3998
4378
|
}
|
|
3999
|
-
function
|
|
4379
|
+
function qt(s, e, t) {
|
|
4000
4380
|
if (e?.type === "flow-collection") {
|
|
4001
4381
|
const n = e.end[0];
|
|
4002
|
-
n.indent === s && (n.source === "]" || n.source === "}") &&
|
|
4382
|
+
n.indent === s && (n.source === "]" || n.source === "}") && Me(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
4003
4383
|
}
|
|
4004
4384
|
}
|
|
4005
4385
|
function mn(s, e, t) {
|
|
4006
4386
|
const { uniqueKeys: n } = s.options;
|
|
4007
4387
|
if (n === !1)
|
|
4008
4388
|
return !1;
|
|
4009
|
-
const i = typeof n == "function" ? n : (r, o) => r === o ||
|
|
4389
|
+
const i = typeof n == "function" ? n : (r, o) => r === o || A(r) && A(o) && r.value === o.value;
|
|
4010
4390
|
return e.some((r) => i(r.key, t));
|
|
4011
4391
|
}
|
|
4012
4392
|
const ws = "All mapping items must start at the same column";
|
|
4013
|
-
function
|
|
4393
|
+
function $r({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
4014
4394
|
const o = r?.nodeClass ?? F, a = new o(t.schema);
|
|
4015
4395
|
t.atRoot && (t.atRoot = !1);
|
|
4016
4396
|
let l = n.offset, c = null;
|
|
@@ -4029,11 +4409,11 @@ function Nr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4029
4409
|
` + p.comment : a.comment = p.comment);
|
|
4030
4410
|
continue;
|
|
4031
4411
|
}
|
|
4032
|
-
(p.newlineAfterProp ||
|
|
4412
|
+
(p.newlineAfterProp || Me(u)) && i(u ?? d[d.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
4033
4413
|
} else p.found?.indent !== n.indent && i(l, "BAD_INDENT", ws);
|
|
4034
4414
|
t.atKey = !0;
|
|
4035
4415
|
const k = p.end, y = u ? s(t, u, p, i) : e(t, k, d, null, p, i);
|
|
4036
|
-
t.schema.compat &&
|
|
4416
|
+
t.schema.compat && qt(n.indent, u, i), t.atKey = !1, mn(t, a.items, y) && i(k, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4037
4417
|
const b = ve(f ?? [], {
|
|
4038
4418
|
indicator: "map-value-ind",
|
|
4039
4419
|
next: g,
|
|
@@ -4045,7 +4425,7 @@ function Nr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4045
4425
|
if (l = b.end, b.found) {
|
|
4046
4426
|
m && (g?.type === "block-map" && !b.hasNewline && i(l, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && p.start < b.found.offset - 1024 && i(y.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
4047
4427
|
const S = g ? s(t, g, b, i) : e(t, l, f, null, b, i);
|
|
4048
|
-
t.schema.compat &&
|
|
4428
|
+
t.schema.compat && qt(n.indent, g, i), l = S.range[2];
|
|
4049
4429
|
const v = new D(y, S);
|
|
4050
4430
|
t.options.keepSourceTokens && (v.srcToken = h), a.items.push(v);
|
|
4051
4431
|
} else {
|
|
@@ -4057,7 +4437,7 @@ function Nr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4057
4437
|
}
|
|
4058
4438
|
return c && c < l && i(c, "IMPOSSIBLE", "Map comment with trailing content"), a.range = [n.offset, l, c ?? l], a;
|
|
4059
4439
|
}
|
|
4060
|
-
function
|
|
4440
|
+
function xr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
4061
4441
|
const o = r?.nodeClass ?? ue, a = new o(t.schema);
|
|
4062
4442
|
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
4063
4443
|
let l = n.offset, c = null;
|
|
@@ -4078,11 +4458,11 @@ function Tr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4078
4458
|
continue;
|
|
4079
4459
|
}
|
|
4080
4460
|
const f = d ? s(t, d, u, i) : e(t, u.end, h, null, u, i);
|
|
4081
|
-
t.schema.compat &&
|
|
4461
|
+
t.schema.compat && qt(n.indent, d, i), l = f.range[2], a.items.push(f);
|
|
4082
4462
|
}
|
|
4083
4463
|
return a.range = [n.offset, l, c ?? l], a;
|
|
4084
4464
|
}
|
|
4085
|
-
function
|
|
4465
|
+
function He(s, e, t, n) {
|
|
4086
4466
|
let i = "";
|
|
4087
4467
|
if (s) {
|
|
4088
4468
|
let r = !1, o = "";
|
|
@@ -4109,8 +4489,8 @@ function We(s, e, t, n) {
|
|
|
4109
4489
|
}
|
|
4110
4490
|
return { comment: i, offset: e };
|
|
4111
4491
|
}
|
|
4112
|
-
const
|
|
4113
|
-
function
|
|
4492
|
+
const _t = "Block collections are not allowed within flow collections", At = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
4493
|
+
function jr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
4114
4494
|
const o = n.start.source === "{", a = o ? "flow map" : "flow sequence", l = r?.nodeClass ?? (o ? F : ue), c = new l(t.schema);
|
|
4115
4495
|
c.flow = !0;
|
|
4116
4496
|
const h = t.atRoot;
|
|
@@ -4132,7 +4512,7 @@ function _r({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4132
4512
|
` + I.comment : c.comment = I.comment), d = I.end;
|
|
4133
4513
|
continue;
|
|
4134
4514
|
}
|
|
4135
|
-
!o && t.options.strict &&
|
|
4515
|
+
!o && t.options.strict && Me(b) && i(
|
|
4136
4516
|
b,
|
|
4137
4517
|
// checked by containsNewline()
|
|
4138
4518
|
"MULTILINE_IMPLICIT_KEY",
|
|
@@ -4142,32 +4522,32 @@ function _r({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4142
4522
|
if (m === 0)
|
|
4143
4523
|
I.comma && i(I.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`);
|
|
4144
4524
|
else if (I.comma || i(I.start, "MISSING_CHAR", `Missing , between ${a} items`), I.comment) {
|
|
4145
|
-
let
|
|
4525
|
+
let N = "";
|
|
4146
4526
|
e: for (const w of y)
|
|
4147
4527
|
switch (w.type) {
|
|
4148
4528
|
case "comma":
|
|
4149
4529
|
case "space":
|
|
4150
4530
|
break;
|
|
4151
4531
|
case "comment":
|
|
4152
|
-
|
|
4532
|
+
N = w.source.substring(1);
|
|
4153
4533
|
break e;
|
|
4154
4534
|
default:
|
|
4155
4535
|
break e;
|
|
4156
4536
|
}
|
|
4157
|
-
if (
|
|
4537
|
+
if (N) {
|
|
4158
4538
|
let w = c.items[c.items.length - 1];
|
|
4159
|
-
|
|
4160
|
-
` +
|
|
4539
|
+
x(w) && (w = w.value ?? w.key), w.comment ? w.comment += `
|
|
4540
|
+
` + N : w.comment = N, I.comment = I.comment.substring(N.length + 1);
|
|
4161
4541
|
}
|
|
4162
4542
|
}
|
|
4163
4543
|
if (!o && !S && !I.found) {
|
|
4164
|
-
const
|
|
4165
|
-
c.items.push(
|
|
4544
|
+
const N = v ? s(t, v, I, i) : e(t, I.end, S, null, I, i);
|
|
4545
|
+
c.items.push(N), d = N.range[2], At(v) && i(N.range, "BLOCK_IN_FLOW", _t);
|
|
4166
4546
|
} else {
|
|
4167
4547
|
t.atKey = !0;
|
|
4168
|
-
const
|
|
4169
|
-
|
|
4170
|
-
const
|
|
4548
|
+
const N = I.end, w = b ? s(t, b, I, i) : e(t, N, y, null, I, i);
|
|
4549
|
+
At(b) && i(w.range, "BLOCK_IN_FLOW", _t), t.atKey = !1;
|
|
4550
|
+
const C = ve(S ?? [], {
|
|
4171
4551
|
flow: a,
|
|
4172
4552
|
indicator: "map-value-ind",
|
|
4173
4553
|
next: v,
|
|
@@ -4176,34 +4556,34 @@ function _r({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4176
4556
|
parentIndent: n.indent,
|
|
4177
4557
|
startOnNewline: !1
|
|
4178
4558
|
});
|
|
4179
|
-
if (
|
|
4559
|
+
if (C.found) {
|
|
4180
4560
|
if (!o && !I.found && t.options.strict) {
|
|
4181
4561
|
if (S)
|
|
4182
|
-
for (const
|
|
4183
|
-
if (
|
|
4562
|
+
for (const E of S) {
|
|
4563
|
+
if (E === C.found)
|
|
4184
4564
|
break;
|
|
4185
|
-
if (
|
|
4186
|
-
i(
|
|
4565
|
+
if (E.type === "newline") {
|
|
4566
|
+
i(E, "MULTILINE_IMPLICIT_KEY", "Implicit keys of flow sequence pairs need to be on a single line");
|
|
4187
4567
|
break;
|
|
4188
4568
|
}
|
|
4189
4569
|
}
|
|
4190
|
-
I.start <
|
|
4570
|
+
I.start < C.found.offset - 1024 && i(C.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
4191
4571
|
}
|
|
4192
|
-
} else v && ("source" in v && v.source?.[0] === ":" ? i(v, "MISSING_CHAR", `Missing space after : in ${a}`) : i(
|
|
4193
|
-
const B = v ? s(t, v,
|
|
4194
|
-
B ?
|
|
4195
|
-
` +
|
|
4196
|
-
const
|
|
4197
|
-
if (t.options.keepSourceTokens && (
|
|
4198
|
-
const
|
|
4199
|
-
mn(t,
|
|
4572
|
+
} else v && ("source" in v && v.source?.[0] === ":" ? i(v, "MISSING_CHAR", `Missing space after : in ${a}`) : i(C.start, "MISSING_CHAR", `Missing , or : between ${a} items`));
|
|
4573
|
+
const B = v ? s(t, v, C, i) : C.found ? e(t, C.end, S, null, C, i) : null;
|
|
4574
|
+
B ? At(v) && i(B.range, "BLOCK_IN_FLOW", _t) : C.comment && (w.comment ? w.comment += `
|
|
4575
|
+
` + C.comment : w.comment = C.comment);
|
|
4576
|
+
const z = new D(w, B);
|
|
4577
|
+
if (t.options.keepSourceTokens && (z.srcToken = k), o) {
|
|
4578
|
+
const E = c;
|
|
4579
|
+
mn(t, E.items, w) && i(N, "DUPLICATE_KEY", "Map keys must be unique"), E.items.push(z);
|
|
4200
4580
|
} else {
|
|
4201
|
-
const
|
|
4202
|
-
|
|
4581
|
+
const E = new F(t.schema);
|
|
4582
|
+
E.flow = !0, E.items.push(z);
|
|
4203
4583
|
const de = (B ?? w).range;
|
|
4204
|
-
|
|
4584
|
+
E.range = [w.range[0], de[1], de[2]], c.items.push(E);
|
|
4205
4585
|
}
|
|
4206
|
-
d = B ? B.range[2] :
|
|
4586
|
+
d = B ? B.range[2] : C.end;
|
|
4207
4587
|
}
|
|
4208
4588
|
}
|
|
4209
4589
|
const u = o ? "}" : "]", [f, ...g] = n.end;
|
|
@@ -4215,18 +4595,18 @@ function _r({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4215
4595
|
i(d, h ? "MISSING_CHAR" : "BAD_INDENT", k), f && f.source.length !== 1 && g.unshift(f);
|
|
4216
4596
|
}
|
|
4217
4597
|
if (g.length > 0) {
|
|
4218
|
-
const m =
|
|
4598
|
+
const m = He(g, p, t.options.strict, i);
|
|
4219
4599
|
m.comment && (c.comment ? c.comment += `
|
|
4220
4600
|
` + m.comment : c.comment = m.comment), c.range = [n.offset, p, m.offset];
|
|
4221
4601
|
} else
|
|
4222
4602
|
c.range = [n.offset, p, p];
|
|
4223
4603
|
return c;
|
|
4224
4604
|
}
|
|
4225
|
-
function
|
|
4226
|
-
const o = t.type === "block-map" ?
|
|
4605
|
+
function Ct(s, e, t, n, i, r) {
|
|
4606
|
+
const o = t.type === "block-map" ? $r(s, e, t, n, r) : t.type === "block-seq" ? xr(s, e, t, n, r) : jr(s, e, t, n, r), a = o.constructor;
|
|
4227
4607
|
return i === "!" || i === a.tagName ? (o.tag = a.tagName, o) : (i && (o.tag = i), o);
|
|
4228
4608
|
}
|
|
4229
|
-
function
|
|
4609
|
+
function Rr(s, e, t, n, i) {
|
|
4230
4610
|
const r = n.tag, o = r ? e.directives.tagName(r.source, (u) => i(r, "TAG_RESOLVE_FAILED", u)) : null;
|
|
4231
4611
|
if (t.type === "block-seq") {
|
|
4232
4612
|
const { anchor: u, newlineAfterProp: f } = n, g = u && r ? u.offset > r.offset ? u : r : u ?? r;
|
|
@@ -4234,23 +4614,23 @@ function Er(s, e, t, n, i) {
|
|
|
4234
4614
|
}
|
|
4235
4615
|
const a = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
4236
4616
|
if (!r || !o || o === "!" || o === F.tagName && a === "map" || o === ue.tagName && a === "seq")
|
|
4237
|
-
return
|
|
4617
|
+
return Ct(s, e, t, i, o);
|
|
4238
4618
|
let l = e.schema.tags.find((u) => u.tag === o && u.collection === a);
|
|
4239
4619
|
if (!l) {
|
|
4240
4620
|
const u = e.schema.knownTags[o];
|
|
4241
4621
|
if (u?.collection === a)
|
|
4242
4622
|
e.schema.tags.push(Object.assign({}, u, { default: !1 })), l = u;
|
|
4243
4623
|
else
|
|
4244
|
-
return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${a} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0),
|
|
4624
|
+
return u ? i(r, "BAD_COLLECTION_TYPE", `${u.tag} used for ${a} collection, but expects ${u.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), Ct(s, e, t, i, o);
|
|
4245
4625
|
}
|
|
4246
|
-
const c =
|
|
4626
|
+
const c = Ct(s, e, t, i, o, l), h = l.resolve?.(c, (u) => i(r, "TAG_RESOLVE_FAILED", u), e.options) ?? c, d = $(h) ? h : new T(h);
|
|
4247
4627
|
return d.range = c.range, d.tag = o, l?.format && (d.format = l.format), d;
|
|
4248
4628
|
}
|
|
4249
|
-
function
|
|
4250
|
-
const n = e.offset, i =
|
|
4629
|
+
function Pr(s, e, t) {
|
|
4630
|
+
const n = e.offset, i = Ur(e, s.options.strict, t);
|
|
4251
4631
|
if (!i)
|
|
4252
4632
|
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
4253
|
-
const r = i.mode === ">" ?
|
|
4633
|
+
const r = i.mode === ">" ? T.BLOCK_FOLDED : T.BLOCK_LITERAL, o = e.source ? qr(e.source) : [];
|
|
4254
4634
|
let a = o.length;
|
|
4255
4635
|
for (let p = o.length - 1; p >= 0; --p) {
|
|
4256
4636
|
const m = o[p][1];
|
|
@@ -4290,7 +4670,7 @@ function Ar(s, e, t) {
|
|
|
4290
4670
|
const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
4291
4671
|
t(c - k.length - (y ? 2 : 1), "BAD_INDENT", S), m = "";
|
|
4292
4672
|
}
|
|
4293
|
-
r ===
|
|
4673
|
+
r === T.BLOCK_LITERAL ? (d += u + m.slice(l) + k, u = `
|
|
4294
4674
|
`) : m.length > l || k[0] === " " ? (u === " " ? u = `
|
|
4295
4675
|
` : !f && u === `
|
|
4296
4676
|
` && (u = `
|
|
@@ -4319,7 +4699,7 @@ function Ar(s, e, t) {
|
|
|
4319
4699
|
const g = n + i.length + e.source.length;
|
|
4320
4700
|
return { value: d, type: r, comment: i.comment, range: [n, g, g] };
|
|
4321
4701
|
}
|
|
4322
|
-
function
|
|
4702
|
+
function Ur({ offset: s, props: e }, t, n) {
|
|
4323
4703
|
if (e[0].type !== "block-scalar-header")
|
|
4324
4704
|
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
4325
4705
|
const { source: i } = e[0], r = i[0];
|
|
@@ -4361,25 +4741,25 @@ function Cr({ offset: s, props: e }, t, n) {
|
|
|
4361
4741
|
}
|
|
4362
4742
|
return { mode: r, indent: o, chomp: a, comment: h, length: d };
|
|
4363
4743
|
}
|
|
4364
|
-
function
|
|
4744
|
+
function qr(s) {
|
|
4365
4745
|
const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n?.[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
|
|
4366
4746
|
for (let o = 1; o < e.length; o += 2)
|
|
4367
4747
|
r.push([e[o], e[o + 1]]);
|
|
4368
4748
|
return r;
|
|
4369
4749
|
}
|
|
4370
|
-
function
|
|
4750
|
+
function Dr(s, e, t) {
|
|
4371
4751
|
const { offset: n, type: i, source: r, end: o } = s;
|
|
4372
4752
|
let a, l;
|
|
4373
4753
|
const c = (u, f, g) => t(n + u, f, g);
|
|
4374
4754
|
switch (i) {
|
|
4375
4755
|
case "scalar":
|
|
4376
|
-
a =
|
|
4756
|
+
a = T.PLAIN, l = Mr(r, c);
|
|
4377
4757
|
break;
|
|
4378
4758
|
case "single-quoted-scalar":
|
|
4379
|
-
a =
|
|
4759
|
+
a = T.QUOTE_SINGLE, l = Br(r, c);
|
|
4380
4760
|
break;
|
|
4381
4761
|
case "double-quoted-scalar":
|
|
4382
|
-
a =
|
|
4762
|
+
a = T.QUOTE_DOUBLE, l = Fr(r, c);
|
|
4383
4763
|
break;
|
|
4384
4764
|
/* istanbul ignore next should not happen */
|
|
4385
4765
|
default:
|
|
@@ -4390,7 +4770,7 @@ function Lr(s, e, t) {
|
|
|
4390
4770
|
range: [n, n + r.length, n + r.length]
|
|
4391
4771
|
};
|
|
4392
4772
|
}
|
|
4393
|
-
const h = n + r.length, d =
|
|
4773
|
+
const h = n + r.length, d = He(o, h, e, t);
|
|
4394
4774
|
return {
|
|
4395
4775
|
value: l,
|
|
4396
4776
|
type: a,
|
|
@@ -4398,7 +4778,7 @@ function Lr(s, e, t) {
|
|
|
4398
4778
|
range: [n, h, d.offset]
|
|
4399
4779
|
};
|
|
4400
4780
|
}
|
|
4401
|
-
function
|
|
4781
|
+
function Mr(s, e) {
|
|
4402
4782
|
let t = "";
|
|
4403
4783
|
switch (s[0]) {
|
|
4404
4784
|
/* istanbul ignore next should not happen */
|
|
@@ -4424,7 +4804,7 @@ function jr(s, e) {
|
|
|
4424
4804
|
}
|
|
4425
4805
|
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), gn(s);
|
|
4426
4806
|
}
|
|
4427
|
-
function
|
|
4807
|
+
function Br(s, e) {
|
|
4428
4808
|
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), gn(s.slice(1, -1)).replace(/''/g, "'");
|
|
4429
4809
|
}
|
|
4430
4810
|
function gn(s) {
|
|
@@ -4447,7 +4827,7 @@ function gn(s) {
|
|
|
4447
4827
|
const a = /[ \t]*(.*)/sy;
|
|
4448
4828
|
return a.lastIndex = o, n = a.exec(s), i + r + (n?.[1] ?? "");
|
|
4449
4829
|
}
|
|
4450
|
-
function
|
|
4830
|
+
function Fr(s, e) {
|
|
4451
4831
|
let t = "";
|
|
4452
4832
|
for (let n = 1; n < s.length - 1; ++n) {
|
|
4453
4833
|
const i = s[n];
|
|
@@ -4455,11 +4835,11 @@ function xr(s, e) {
|
|
|
4455
4835
|
`))
|
|
4456
4836
|
if (i === `
|
|
4457
4837
|
`) {
|
|
4458
|
-
const { fold: r, offset: o } =
|
|
4838
|
+
const { fold: r, offset: o } = Kr(s, n);
|
|
4459
4839
|
t += r, n = o;
|
|
4460
4840
|
} else if (i === "\\") {
|
|
4461
4841
|
let r = s[++n];
|
|
4462
|
-
const o =
|
|
4842
|
+
const o = Jr[r];
|
|
4463
4843
|
if (o)
|
|
4464
4844
|
t += o;
|
|
4465
4845
|
else if (r === `
|
|
@@ -4472,7 +4852,7 @@ function xr(s, e) {
|
|
|
4472
4852
|
r = s[++n + 1];
|
|
4473
4853
|
else if (r === "x" || r === "u" || r === "U") {
|
|
4474
4854
|
const a = { x: 2, u: 4, U: 8 }[r];
|
|
4475
|
-
t +=
|
|
4855
|
+
t += Wr(s, n + 1, a, e), n += a;
|
|
4476
4856
|
} else {
|
|
4477
4857
|
const a = s.substr(n - 1, 2);
|
|
4478
4858
|
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${a}`), t += a;
|
|
@@ -4490,7 +4870,7 @@ function xr(s, e) {
|
|
|
4490
4870
|
}
|
|
4491
4871
|
return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
|
|
4492
4872
|
}
|
|
4493
|
-
function
|
|
4873
|
+
function Kr(s, e) {
|
|
4494
4874
|
let t = "", n = s[e + 1];
|
|
4495
4875
|
for (; (n === " " || n === " " || n === `
|
|
4496
4876
|
` || n === "\r") && !(n === "\r" && s[e + 2] !== `
|
|
@@ -4500,7 +4880,7 @@ function Pr(s, e) {
|
|
|
4500
4880
|
`), e += 1, n = s[e + 1];
|
|
4501
4881
|
return t || (t = " "), { fold: t, offset: e };
|
|
4502
4882
|
}
|
|
4503
|
-
const
|
|
4883
|
+
const Jr = {
|
|
4504
4884
|
0: "\0",
|
|
4505
4885
|
// null character
|
|
4506
4886
|
a: "\x07",
|
|
@@ -4534,7 +4914,7 @@ const Ur = {
|
|
|
4534
4914
|
"\\": "\\",
|
|
4535
4915
|
" ": " "
|
|
4536
4916
|
};
|
|
4537
|
-
function
|
|
4917
|
+
function Wr(s, e, t, n) {
|
|
4538
4918
|
const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
4539
4919
|
if (isNaN(o)) {
|
|
4540
4920
|
const a = s.substr(e - 2, t + 2);
|
|
@@ -4543,22 +4923,22 @@ function qr(s, e, t, n) {
|
|
|
4543
4923
|
return String.fromCodePoint(o);
|
|
4544
4924
|
}
|
|
4545
4925
|
function yn(s, e, t, n) {
|
|
4546
|
-
const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ?
|
|
4926
|
+
const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ? Pr(s, e, n) : Dr(e, s.options.strict, n), l = t ? s.directives.tagName(t.source, (d) => n(t, "TAG_RESOLVE_FAILED", d)) : null;
|
|
4547
4927
|
let c;
|
|
4548
|
-
s.options.stringKeys && s.atKey ? c = s.schema[
|
|
4928
|
+
s.options.stringKeys && s.atKey ? c = s.schema[G] : l ? c = Vr(s.schema, i, l, t, n) : e.type === "scalar" ? c = Hr(s, i, e, n) : c = s.schema[G];
|
|
4549
4929
|
let h;
|
|
4550
4930
|
try {
|
|
4551
4931
|
const d = c.resolve(i, (u) => n(t ?? e, "TAG_RESOLVE_FAILED", u), s.options);
|
|
4552
|
-
h =
|
|
4932
|
+
h = A(d) ? d : new T(d);
|
|
4553
4933
|
} catch (d) {
|
|
4554
4934
|
const u = d instanceof Error ? d.message : String(d);
|
|
4555
|
-
n(t ?? e, "TAG_RESOLVE_FAILED", u), h = new
|
|
4935
|
+
n(t ?? e, "TAG_RESOLVE_FAILED", u), h = new T(i);
|
|
4556
4936
|
}
|
|
4557
4937
|
return h.range = a, h.source = i, r && (h.type = r), l && (h.tag = l), c.format && (h.format = c.format), o && (h.comment = o), h;
|
|
4558
4938
|
}
|
|
4559
|
-
function
|
|
4939
|
+
function Vr(s, e, t, n, i) {
|
|
4560
4940
|
if (t === "!")
|
|
4561
|
-
return s[
|
|
4941
|
+
return s[G];
|
|
4562
4942
|
const r = [];
|
|
4563
4943
|
for (const a of s.tags)
|
|
4564
4944
|
if (!a.collection && a.tag === t)
|
|
@@ -4570,12 +4950,12 @@ function Dr(s, e, t, n, i) {
|
|
|
4570
4950
|
if (a.test?.test(e))
|
|
4571
4951
|
return a;
|
|
4572
4952
|
const o = s.knownTags[t];
|
|
4573
|
-
return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[
|
|
4953
|
+
return o && !o.collection ? (s.tags.push(Object.assign({}, o, { default: !1, test: void 0 })), o) : (i(n, "TAG_RESOLVE_FAILED", `Unresolved tag: ${t}`, t !== "tag:yaml.org,2002:str"), s[G]);
|
|
4574
4954
|
}
|
|
4575
|
-
function
|
|
4576
|
-
const o = t.tags.find((a) => (a.default === !0 || s && a.default === "key") && a.test?.test(n)) || t[
|
|
4955
|
+
function Hr({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
4956
|
+
const o = t.tags.find((a) => (a.default === !0 || s && a.default === "key") && a.test?.test(n)) || t[G];
|
|
4577
4957
|
if (t.compat) {
|
|
4578
|
-
const a = t.compat.find((l) => l.default && l.test?.test(n)) ?? t[
|
|
4958
|
+
const a = t.compat.find((l) => l.default && l.test?.test(n)) ?? t[G];
|
|
4579
4959
|
if (o.tag !== a.tag) {
|
|
4580
4960
|
const l = e.tagString(o.tag), c = e.tagString(a.tag), h = `Value may be parsed as either ${l} or ${c}`;
|
|
4581
4961
|
r(i, "TAG_RESOLVE_FAILED", h, !0);
|
|
@@ -4583,7 +4963,7 @@ function Mr({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
|
4583
4963
|
}
|
|
4584
4964
|
return o;
|
|
4585
4965
|
}
|
|
4586
|
-
function
|
|
4966
|
+
function Yr(s, e, t) {
|
|
4587
4967
|
if (e) {
|
|
4588
4968
|
t ?? (t = e.length);
|
|
4589
4969
|
for (let n = t - 1; n >= 0; --n) {
|
|
@@ -4602,13 +4982,13 @@ function Br(s, e, t) {
|
|
|
4602
4982
|
}
|
|
4603
4983
|
return s;
|
|
4604
4984
|
}
|
|
4605
|
-
const
|
|
4985
|
+
const zr = { composeNode: wn, composeEmptyNode: ns };
|
|
4606
4986
|
function wn(s, e, t, n) {
|
|
4607
4987
|
const i = s.atKey, { spaceBefore: r, comment: o, anchor: a, tag: l } = t;
|
|
4608
4988
|
let c, h = !0;
|
|
4609
4989
|
switch (e.type) {
|
|
4610
4990
|
case "alias":
|
|
4611
|
-
c =
|
|
4991
|
+
c = Gr(s, e, n), (a || l) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
4612
4992
|
break;
|
|
4613
4993
|
case "scalar":
|
|
4614
4994
|
case "single-quoted-scalar":
|
|
@@ -4619,31 +4999,31 @@ function wn(s, e, t, n) {
|
|
|
4619
4999
|
case "block-map":
|
|
4620
5000
|
case "block-seq":
|
|
4621
5001
|
case "flow-collection":
|
|
4622
|
-
c =
|
|
5002
|
+
c = Rr(zr, s, e, t, n), a && (c.anchor = a.source.substring(1));
|
|
4623
5003
|
break;
|
|
4624
5004
|
default: {
|
|
4625
5005
|
const d = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
4626
5006
|
n(e, "UNEXPECTED_TOKEN", d), c = ns(s, e.offset, void 0, null, t, n), h = !1;
|
|
4627
5007
|
}
|
|
4628
5008
|
}
|
|
4629
|
-
return a && c.anchor === "" && n(a, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!
|
|
5009
|
+
return a && c.anchor === "" && n(a, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!A(c) || typeof c.value != "string" || c.tag && c.tag !== "tag:yaml.org,2002:str") && n(l ?? e, "NON_STRING_KEY", "With stringKeys, all keys must be strings"), r && (c.spaceBefore = !0), o && (e.type === "scalar" && e.source === "" ? c.comment = o : c.commentBefore = o), s.options.keepSourceTokens && h && (c.srcToken = e), c;
|
|
4630
5010
|
}
|
|
4631
5011
|
function ns(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: a, end: l }, c) {
|
|
4632
5012
|
const h = {
|
|
4633
5013
|
type: "scalar",
|
|
4634
|
-
offset:
|
|
5014
|
+
offset: Yr(e, t, n),
|
|
4635
5015
|
indent: -1,
|
|
4636
5016
|
source: ""
|
|
4637
5017
|
}, d = yn(s, h, a, c);
|
|
4638
5018
|
return o && (d.anchor = o.source.substring(1), d.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (d.spaceBefore = !0), r && (d.comment = r, d.range[2] = l), d;
|
|
4639
5019
|
}
|
|
4640
|
-
function
|
|
4641
|
-
const r = new
|
|
5020
|
+
function Gr({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
5021
|
+
const r = new Wt(t.substring(1));
|
|
4642
5022
|
r.source === "" && i(e, "BAD_ALIAS", "Alias cannot be an empty string"), r.source.endsWith(":") && i(e + t.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", !0);
|
|
4643
|
-
const o = e + t.length, a =
|
|
5023
|
+
const o = e + t.length, a = He(n, o, s.strict, i);
|
|
4644
5024
|
return r.range = [e, o, a.offset], a.comment && (r.comment = a.comment), r;
|
|
4645
5025
|
}
|
|
4646
|
-
function
|
|
5026
|
+
function Qr(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
4647
5027
|
const a = Object.assign({ _directives: e }, s), l = new Ve(void 0, a), c = {
|
|
4648
5028
|
atKey: !1,
|
|
4649
5029
|
atRoot: !0,
|
|
@@ -4659,10 +5039,10 @@ function Jr(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
|
4659
5039
|
startOnNewline: !0
|
|
4660
5040
|
});
|
|
4661
5041
|
h.found && (l.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !h.hasNewline && o(h.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), l.contents = i ? wn(c, i, h, o) : ns(c, h.end, n, null, h, o);
|
|
4662
|
-
const d = l.contents.range[2], u =
|
|
5042
|
+
const d = l.contents.range[2], u = He(r, d, !1, o);
|
|
4663
5043
|
return u.comment && (l.comment = u.comment), l.range = [t, d, u.offset], l;
|
|
4664
5044
|
}
|
|
4665
|
-
function
|
|
5045
|
+
function Ee(s) {
|
|
4666
5046
|
if (typeof s == "number")
|
|
4667
5047
|
return [s, s + 1];
|
|
4668
5048
|
if (Array.isArray(s))
|
|
@@ -4690,11 +5070,11 @@ function ks(s) {
|
|
|
4690
5070
|
}
|
|
4691
5071
|
return { comment: e, afterEmptyLine: n };
|
|
4692
5072
|
}
|
|
4693
|
-
class
|
|
5073
|
+
class Xr {
|
|
4694
5074
|
constructor(e = {}) {
|
|
4695
5075
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
4696
|
-
const o =
|
|
4697
|
-
r ? this.warnings.push(new
|
|
5076
|
+
const o = Ee(t);
|
|
5077
|
+
r ? this.warnings.push(new Lr(o, n, i)) : this.errors.push(new $e(o, n, i));
|
|
4698
5078
|
}, this.directives = new q({ version: e.version || "1.2" }), this.options = e;
|
|
4699
5079
|
}
|
|
4700
5080
|
decorate(e, t) {
|
|
@@ -4706,9 +5086,9 @@ class Vr {
|
|
|
4706
5086
|
${n}` : n;
|
|
4707
5087
|
else if (i || e.directives.docStart || !r)
|
|
4708
5088
|
e.commentBefore = n;
|
|
4709
|
-
else if (
|
|
5089
|
+
else if (L(r) && !r.flow && r.items.length > 0) {
|
|
4710
5090
|
let o = r.items[0];
|
|
4711
|
-
|
|
5091
|
+
x(o) && (o = o.key);
|
|
4712
5092
|
const a = o.commentBefore;
|
|
4713
5093
|
o.commentBefore = a ? `${n}
|
|
4714
5094
|
${a}` : n;
|
|
@@ -4749,12 +5129,12 @@ ${o}` : n;
|
|
|
4749
5129
|
switch (e.type) {
|
|
4750
5130
|
case "directive":
|
|
4751
5131
|
this.directives.add(e.source, (t, n, i) => {
|
|
4752
|
-
const r =
|
|
5132
|
+
const r = Ee(e);
|
|
4753
5133
|
r[0] += t, this.onError(r, "BAD_DIRECTIVE", n, i);
|
|
4754
5134
|
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
4755
5135
|
break;
|
|
4756
5136
|
case "document": {
|
|
4757
|
-
const t =
|
|
5137
|
+
const t = Qr(this.options, this.directives, e, this.onError);
|
|
4758
5138
|
this.atDirectives && !t.directives.docStart && this.onError(e, "MISSING_CHAR", "Missing directives-end/doc-start indicator line"), this.decorate(t, !1), this.doc && (yield this.doc), this.doc = t, this.atDirectives = !1;
|
|
4759
5139
|
break;
|
|
4760
5140
|
}
|
|
@@ -4766,18 +5146,18 @@ ${o}` : n;
|
|
|
4766
5146
|
this.prelude.push(e.source);
|
|
4767
5147
|
break;
|
|
4768
5148
|
case "error": {
|
|
4769
|
-
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new
|
|
5149
|
+
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new $e(Ee(e), "UNEXPECTED_TOKEN", t);
|
|
4770
5150
|
this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
|
|
4771
5151
|
break;
|
|
4772
5152
|
}
|
|
4773
5153
|
case "doc-end": {
|
|
4774
5154
|
if (!this.doc) {
|
|
4775
5155
|
const n = "Unexpected doc-end without preceding document";
|
|
4776
|
-
this.errors.push(new
|
|
5156
|
+
this.errors.push(new $e(Ee(e), "UNEXPECTED_TOKEN", n));
|
|
4777
5157
|
break;
|
|
4778
5158
|
}
|
|
4779
5159
|
this.doc.directives.docEnd = !0;
|
|
4780
|
-
const t =
|
|
5160
|
+
const t = He(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
|
|
4781
5161
|
if (this.decorate(this.doc, !0), t.comment) {
|
|
4782
5162
|
const n = this.doc.comment;
|
|
4783
5163
|
this.doc.comment = n ? `${n}
|
|
@@ -4787,7 +5167,7 @@ ${t.comment}` : t.comment;
|
|
|
4787
5167
|
break;
|
|
4788
5168
|
}
|
|
4789
5169
|
default:
|
|
4790
|
-
this.errors.push(new
|
|
5170
|
+
this.errors.push(new $e(Ee(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
|
|
4791
5171
|
}
|
|
4792
5172
|
}
|
|
4793
5173
|
/**
|
|
@@ -4805,8 +5185,8 @@ ${t.comment}` : t.comment;
|
|
|
4805
5185
|
}
|
|
4806
5186
|
}
|
|
4807
5187
|
}
|
|
4808
|
-
const kn = "\uFEFF", bn = "", Sn = "",
|
|
4809
|
-
function
|
|
5188
|
+
const kn = "\uFEFF", bn = "", Sn = "", Dt = "";
|
|
5189
|
+
function Zr(s) {
|
|
4810
5190
|
switch (s) {
|
|
4811
5191
|
case kn:
|
|
4812
5192
|
return "byte-order-mark";
|
|
@@ -4814,7 +5194,7 @@ function Wr(s) {
|
|
|
4814
5194
|
return "doc-mode";
|
|
4815
5195
|
case Sn:
|
|
4816
5196
|
return "flow-error-end";
|
|
4817
|
-
case
|
|
5197
|
+
case Dt:
|
|
4818
5198
|
return "scalar";
|
|
4819
5199
|
case "---":
|
|
4820
5200
|
return "doc-start";
|
|
@@ -4867,7 +5247,7 @@ function Wr(s) {
|
|
|
4867
5247
|
}
|
|
4868
5248
|
return null;
|
|
4869
5249
|
}
|
|
4870
|
-
function
|
|
5250
|
+
function W(s) {
|
|
4871
5251
|
switch (s) {
|
|
4872
5252
|
case void 0:
|
|
4873
5253
|
case " ":
|
|
@@ -4880,9 +5260,9 @@ function V(s) {
|
|
|
4880
5260
|
return !1;
|
|
4881
5261
|
}
|
|
4882
5262
|
}
|
|
4883
|
-
const bs = new Set("0123456789ABCDEFabcdef"),
|
|
4884
|
-
\r `),
|
|
4885
|
-
class
|
|
5263
|
+
const bs = new Set("0123456789ABCDEFabcdef"), eo = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), et = new Set(",[]{}"), to = new Set(` ,[]{}
|
|
5264
|
+
\r `), Et = (s) => !s || to.has(s);
|
|
5265
|
+
class so {
|
|
4886
5266
|
constructor() {
|
|
4887
5267
|
this.atEnd = !1, this.blockScalarIndent = -1, this.blockScalarKeep = !1, this.buffer = "", this.flowKey = !1, this.flowLevel = 0, this.indentNext = 0, this.indentValue = 0, this.lineEndPos = null, this.next = null, this.pos = 0;
|
|
4888
5268
|
}
|
|
@@ -4931,7 +5311,7 @@ class Gr {
|
|
|
4931
5311
|
}
|
|
4932
5312
|
if (t === "-" || t === ".") {
|
|
4933
5313
|
const n = this.buffer.substr(e, 3);
|
|
4934
|
-
if ((n === "---" || n === "...") &&
|
|
5314
|
+
if ((n === "---" || n === "...") && W(this.buffer[e + 3]))
|
|
4935
5315
|
return -1;
|
|
4936
5316
|
}
|
|
4937
5317
|
return e;
|
|
@@ -5008,16 +5388,16 @@ class Gr {
|
|
|
5008
5388
|
if (!this.atEnd && !this.hasChars(4))
|
|
5009
5389
|
return this.setNext("line-start");
|
|
5010
5390
|
const t = this.peek(3);
|
|
5011
|
-
if ((t === "---" || t === "...") &&
|
|
5391
|
+
if ((t === "---" || t === "...") && W(this.charAt(3)))
|
|
5012
5392
|
return yield* this.pushCount(3), this.indentValue = 0, this.indentNext = 0, t === "---" ? "doc" : "stream";
|
|
5013
5393
|
}
|
|
5014
|
-
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !
|
|
5394
|
+
return this.indentValue = yield* this.pushSpaces(!1), this.indentNext > this.indentValue && !W(this.charAt(1)) && (this.indentNext = this.indentValue), yield* this.parseBlockStart();
|
|
5015
5395
|
}
|
|
5016
5396
|
*parseBlockStart() {
|
|
5017
5397
|
const [e, t] = this.peek(2);
|
|
5018
5398
|
if (!t && !this.atEnd)
|
|
5019
5399
|
return this.setNext("block-start");
|
|
5020
|
-
if ((e === "-" || e === "?" || e === ":") &&
|
|
5400
|
+
if ((e === "-" || e === "?" || e === ":") && W(t)) {
|
|
5021
5401
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0));
|
|
5022
5402
|
return this.indentNext = this.indentValue + 1, this.indentValue += n, yield* this.parseBlockStart();
|
|
5023
5403
|
}
|
|
@@ -5042,7 +5422,7 @@ class Gr {
|
|
|
5042
5422
|
case "]":
|
|
5043
5423
|
return yield* this.pushCount(1), "doc";
|
|
5044
5424
|
case "*":
|
|
5045
|
-
return yield* this.pushUntil(
|
|
5425
|
+
return yield* this.pushUntil(Et), "doc";
|
|
5046
5426
|
case '"':
|
|
5047
5427
|
case "'":
|
|
5048
5428
|
return yield* this.parseQuotedScalar();
|
|
@@ -5061,7 +5441,7 @@ class Gr {
|
|
|
5061
5441
|
const i = this.getLine();
|
|
5062
5442
|
if (i === null)
|
|
5063
5443
|
return this.setNext("flow");
|
|
5064
|
-
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) &&
|
|
5444
|
+
if ((n !== -1 && n < this.indentNext && i[0] !== "#" || n === 0 && (i.startsWith("---") || i.startsWith("...")) && W(i[3])) && !(n === this.indentNext - 1 && this.flowLevel === 1 && (i[0] === "]" || i[0] === "}")))
|
|
5065
5445
|
return this.flowLevel = 0, yield Sn, yield* this.parseLineStart();
|
|
5066
5446
|
let r = 0;
|
|
5067
5447
|
for (; i[r] === ","; )
|
|
@@ -5078,13 +5458,13 @@ class Gr {
|
|
|
5078
5458
|
case "]":
|
|
5079
5459
|
return yield* this.pushCount(1), this.flowKey = !0, this.flowLevel -= 1, this.flowLevel ? "flow" : "doc";
|
|
5080
5460
|
case "*":
|
|
5081
|
-
return yield* this.pushUntil(
|
|
5461
|
+
return yield* this.pushUntil(Et), "flow";
|
|
5082
5462
|
case '"':
|
|
5083
5463
|
case "'":
|
|
5084
5464
|
return this.flowKey = !0, yield* this.parseQuotedScalar();
|
|
5085
5465
|
case ":": {
|
|
5086
5466
|
const o = this.charAt(1);
|
|
5087
|
-
if (this.flowKey ||
|
|
5467
|
+
if (this.flowKey || W(o) || o === ",")
|
|
5088
5468
|
return this.flowKey = !1, yield* this.pushCount(1), yield* this.pushSpaces(!0), "flow";
|
|
5089
5469
|
}
|
|
5090
5470
|
// fallthrough
|
|
@@ -5139,7 +5519,7 @@ class Gr {
|
|
|
5139
5519
|
else if (t !== "-")
|
|
5140
5520
|
break;
|
|
5141
5521
|
}
|
|
5142
|
-
return yield* this.pushUntil((t) =>
|
|
5522
|
+
return yield* this.pushUntil((t) => W(t) || t === "#");
|
|
5143
5523
|
}
|
|
5144
5524
|
*parseBlockScalar() {
|
|
5145
5525
|
let e = this.pos - 1, t = 0, n;
|
|
@@ -5202,7 +5582,7 @@ class Gr {
|
|
|
5202
5582
|
else
|
|
5203
5583
|
break;
|
|
5204
5584
|
} while (!0);
|
|
5205
|
-
return yield
|
|
5585
|
+
return yield Dt, yield* this.pushToIndex(e + 1, !0), yield* this.parseLineStart();
|
|
5206
5586
|
}
|
|
5207
5587
|
*parsePlainScalar() {
|
|
5208
5588
|
const e = this.flowLevel > 0;
|
|
@@ -5210,14 +5590,14 @@ class Gr {
|
|
|
5210
5590
|
for (; i = this.buffer[++n]; )
|
|
5211
5591
|
if (i === ":") {
|
|
5212
5592
|
const r = this.buffer[n + 1];
|
|
5213
|
-
if (
|
|
5593
|
+
if (W(r) || e && et.has(r))
|
|
5214
5594
|
break;
|
|
5215
5595
|
t = n;
|
|
5216
|
-
} else if (
|
|
5596
|
+
} else if (W(i)) {
|
|
5217
5597
|
let r = this.buffer[n + 1];
|
|
5218
5598
|
if (i === "\r" && (r === `
|
|
5219
5599
|
` ? (n += 1, i = `
|
|
5220
|
-
`, r = this.buffer[n + 1]) : t = n), r === "#" || e &&
|
|
5600
|
+
`, r = this.buffer[n + 1]) : t = n), r === "#" || e && et.has(r))
|
|
5221
5601
|
break;
|
|
5222
5602
|
if (i === `
|
|
5223
5603
|
`) {
|
|
@@ -5227,11 +5607,11 @@ class Gr {
|
|
|
5227
5607
|
n = Math.max(n, o - 2);
|
|
5228
5608
|
}
|
|
5229
5609
|
} else {
|
|
5230
|
-
if (e &&
|
|
5610
|
+
if (e && et.has(i))
|
|
5231
5611
|
break;
|
|
5232
5612
|
t = n;
|
|
5233
5613
|
}
|
|
5234
|
-
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield
|
|
5614
|
+
return !i && !this.atEnd ? this.setNext("plain-scalar") : (yield Dt, yield* this.pushToIndex(t + 1, !0), e ? "flow" : "doc");
|
|
5235
5615
|
}
|
|
5236
5616
|
*pushCount(e) {
|
|
5237
5617
|
return e > 0 ? (yield this.buffer.substr(this.pos, e), this.pos += e, e) : 0;
|
|
@@ -5245,14 +5625,14 @@ class Gr {
|
|
|
5245
5625
|
case "!":
|
|
5246
5626
|
return (yield* this.pushTag()) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
5247
5627
|
case "&":
|
|
5248
|
-
return (yield* this.pushUntil(
|
|
5628
|
+
return (yield* this.pushUntil(Et)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
5249
5629
|
case "-":
|
|
5250
5630
|
// this is an error
|
|
5251
5631
|
case "?":
|
|
5252
5632
|
// this is an error outside flow collections
|
|
5253
5633
|
case ":": {
|
|
5254
5634
|
const e = this.flowLevel > 0, t = this.charAt(1);
|
|
5255
|
-
if (
|
|
5635
|
+
if (W(t) || e && et.has(t))
|
|
5256
5636
|
return e ? this.flowKey && (this.flowKey = !1) : this.indentNext = this.indentValue + 1, (yield* this.pushCount(1)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
5257
5637
|
}
|
|
5258
5638
|
}
|
|
@@ -5261,13 +5641,13 @@ class Gr {
|
|
|
5261
5641
|
*pushTag() {
|
|
5262
5642
|
if (this.charAt(1) === "<") {
|
|
5263
5643
|
let e = this.pos + 2, t = this.buffer[e];
|
|
5264
|
-
for (; !
|
|
5644
|
+
for (; !W(t) && t !== ">"; )
|
|
5265
5645
|
t = this.buffer[++e];
|
|
5266
5646
|
return yield* this.pushToIndex(t === ">" ? e + 1 : e, !1);
|
|
5267
5647
|
} else {
|
|
5268
5648
|
let e = this.pos + 1, t = this.buffer[e];
|
|
5269
5649
|
for (; t; )
|
|
5270
|
-
if (
|
|
5650
|
+
if (eo.has(t))
|
|
5271
5651
|
t = this.buffer[++e];
|
|
5272
5652
|
else if (t === "%" && bs.has(this.buffer[e + 1]) && bs.has(this.buffer[e + 2]))
|
|
5273
5653
|
t = this.buffer[e += 3];
|
|
@@ -5297,7 +5677,7 @@ class Gr {
|
|
|
5297
5677
|
return yield* this.pushToIndex(t, !1);
|
|
5298
5678
|
}
|
|
5299
5679
|
}
|
|
5300
|
-
class
|
|
5680
|
+
class no {
|
|
5301
5681
|
constructor() {
|
|
5302
5682
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
5303
5683
|
let t = 0, n = this.lineStarts.length;
|
|
@@ -5344,7 +5724,7 @@ function vn(s) {
|
|
|
5344
5724
|
return !1;
|
|
5345
5725
|
}
|
|
5346
5726
|
}
|
|
5347
|
-
function
|
|
5727
|
+
function tt(s) {
|
|
5348
5728
|
switch (s.type) {
|
|
5349
5729
|
case "document":
|
|
5350
5730
|
return s.start;
|
|
@@ -5381,13 +5761,13 @@ function vs(s) {
|
|
|
5381
5761
|
for (const e of s.items)
|
|
5382
5762
|
e.sep && !e.value && !ne(e.start, "explicit-key-ind") && !ne(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, vn(e.value) ? e.value.end ? Array.prototype.push.apply(e.value.end, e.sep) : e.value.end = e.sep : Array.prototype.push.apply(e.start, e.sep), delete e.sep);
|
|
5383
5763
|
}
|
|
5384
|
-
class
|
|
5764
|
+
class io {
|
|
5385
5765
|
/**
|
|
5386
5766
|
* @param onNewLine - If defined, called separately with the start position of
|
|
5387
5767
|
* each new line (in `parse()`, including the start of input).
|
|
5388
5768
|
*/
|
|
5389
5769
|
constructor(e) {
|
|
5390
|
-
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new
|
|
5770
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new so(), this.onNewLine = e;
|
|
5391
5771
|
}
|
|
5392
5772
|
/**
|
|
5393
5773
|
* Parse `source` as a YAML stream.
|
|
@@ -5411,7 +5791,7 @@ class Qr {
|
|
|
5411
5791
|
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
5412
5792
|
return;
|
|
5413
5793
|
}
|
|
5414
|
-
const t =
|
|
5794
|
+
const t = Zr(e);
|
|
5415
5795
|
if (t)
|
|
5416
5796
|
if (t === "scalar")
|
|
5417
5797
|
this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
|
|
@@ -5595,7 +5975,7 @@ class Qr {
|
|
|
5595
5975
|
}
|
|
5596
5976
|
*scalar(e) {
|
|
5597
5977
|
if (this.type === "map-value-ind") {
|
|
5598
|
-
const t =
|
|
5978
|
+
const t = tt(this.peek(2)), n = pe(t);
|
|
5599
5979
|
let i;
|
|
5600
5980
|
e.end ? (i = e.end, i.push(this.sourceToken), delete e.end) : i = [this.sourceToken];
|
|
5601
5981
|
const r = {
|
|
@@ -5852,7 +6232,7 @@ class Qr {
|
|
|
5852
6232
|
if (n.type === "block-map" && (this.type === "map-value-ind" && n.indent === e.indent || this.type === "newline" && !n.items[n.items.length - 1].sep))
|
|
5853
6233
|
yield* this.pop(), yield* this.step();
|
|
5854
6234
|
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
5855
|
-
const i =
|
|
6235
|
+
const i = tt(n), r = pe(i);
|
|
5856
6236
|
vs(e);
|
|
5857
6237
|
const o = e.end.splice(1, e.end.length);
|
|
5858
6238
|
o.push(this.sourceToken);
|
|
@@ -5916,7 +6296,7 @@ class Qr {
|
|
|
5916
6296
|
};
|
|
5917
6297
|
case "explicit-key-ind": {
|
|
5918
6298
|
this.onKeyLine = !0;
|
|
5919
|
-
const t =
|
|
6299
|
+
const t = tt(e), n = pe(t);
|
|
5920
6300
|
return n.push(this.sourceToken), {
|
|
5921
6301
|
type: "block-map",
|
|
5922
6302
|
offset: this.offset,
|
|
@@ -5926,7 +6306,7 @@ class Qr {
|
|
|
5926
6306
|
}
|
|
5927
6307
|
case "map-value-ind": {
|
|
5928
6308
|
this.onKeyLine = !0;
|
|
5929
|
-
const t =
|
|
6309
|
+
const t = tt(e), n = pe(t);
|
|
5930
6310
|
return {
|
|
5931
6311
|
type: "block-map",
|
|
5932
6312
|
offset: this.offset,
|
|
@@ -5960,25 +6340,25 @@ class Qr {
|
|
|
5960
6340
|
}
|
|
5961
6341
|
}
|
|
5962
6342
|
}
|
|
5963
|
-
function
|
|
6343
|
+
function ro(s) {
|
|
5964
6344
|
const e = s.prettyErrors !== !1;
|
|
5965
|
-
return { lineCounter: s.lineCounter || e && new
|
|
6345
|
+
return { lineCounter: s.lineCounter || e && new no() || null, prettyErrors: e };
|
|
5966
6346
|
}
|
|
5967
|
-
function
|
|
5968
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
6347
|
+
function oo(s, e = {}) {
|
|
6348
|
+
const { lineCounter: t, prettyErrors: n } = ro(e), i = new io(t?.addNewLine), r = new Xr(e);
|
|
5969
6349
|
let o = null;
|
|
5970
6350
|
for (const a of r.compose(i.parse(s), !0, s.length))
|
|
5971
6351
|
if (!o)
|
|
5972
6352
|
o = a;
|
|
5973
6353
|
else if (o.options.logLevel !== "silent") {
|
|
5974
|
-
o.errors.push(new
|
|
6354
|
+
o.errors.push(new $e(a.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
5975
6355
|
break;
|
|
5976
6356
|
}
|
|
5977
6357
|
return n && t && (o.errors.forEach(ys(s, t)), o.warnings.forEach(ys(s, t))), o;
|
|
5978
6358
|
}
|
|
5979
|
-
function
|
|
6359
|
+
function ao(s, e, t) {
|
|
5980
6360
|
let n;
|
|
5981
|
-
const i =
|
|
6361
|
+
const i = oo(s, t);
|
|
5982
6362
|
if (!i)
|
|
5983
6363
|
return null;
|
|
5984
6364
|
if (i.warnings.forEach((r) => Ys(i.options.logLevel, r)), i.errors.length > 0) {
|
|
@@ -5999,17 +6379,17 @@ function In(s, e, t) {
|
|
|
5999
6379
|
if (!i)
|
|
6000
6380
|
return;
|
|
6001
6381
|
}
|
|
6002
|
-
return
|
|
6382
|
+
return Fe(s) && !n ? s.toString(t) : new Ve(s, n, t).toString(t);
|
|
6003
6383
|
}
|
|
6004
|
-
const
|
|
6005
|
-
function
|
|
6006
|
-
const e =
|
|
6384
|
+
const lo = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/;
|
|
6385
|
+
function Tn(s) {
|
|
6386
|
+
const e = lo.exec(s);
|
|
6007
6387
|
return e ? {
|
|
6008
|
-
data:
|
|
6388
|
+
data: ao(e[1] ?? "") ?? {},
|
|
6009
6389
|
content: e[2] ?? ""
|
|
6010
6390
|
} : { data: {}, content: s };
|
|
6011
6391
|
}
|
|
6012
|
-
const
|
|
6392
|
+
const co = /* @__PURE__ */ Object.assign({
|
|
6013
6393
|
"../../../../skills/taskless-check/SKILL.md": Ui,
|
|
6014
6394
|
"../../../../skills/taskless-create-rule/SKILL.md": qi,
|
|
6015
6395
|
"../../../../skills/taskless-delete-rule/SKILL.md": Di,
|
|
@@ -6018,7 +6398,15 @@ const so = /* @__PURE__ */ Object.assign({
|
|
|
6018
6398
|
"../../../../skills/taskless-login/SKILL.md": Fi,
|
|
6019
6399
|
"../../../../skills/taskless-logout/SKILL.md": Ki,
|
|
6020
6400
|
"../../../../skills/taskless-update-engine/SKILL.md": Ji
|
|
6021
|
-
}),
|
|
6401
|
+
}), uo = /* @__PURE__ */ Object.assign({
|
|
6402
|
+
"../../../../commands/tskl/check.md": Wi,
|
|
6403
|
+
"../../../../commands/tskl/improve.md": Vi,
|
|
6404
|
+
"../../../../commands/tskl/info.md": Hi,
|
|
6405
|
+
"../../../../commands/tskl/login.md": Yi,
|
|
6406
|
+
"../../../../commands/tskl/logout.md": zi,
|
|
6407
|
+
"../../../../commands/tskl/rule.md": Gi,
|
|
6408
|
+
"../../../../commands/tskl/update-engine.md": Qi
|
|
6409
|
+
}), fo = [
|
|
6022
6410
|
{
|
|
6023
6411
|
name: "Claude Code",
|
|
6024
6412
|
dir: ".claude",
|
|
@@ -6026,20 +6414,20 @@ const so = /* @__PURE__ */ Object.assign({
|
|
|
6026
6414
|
path: "skills"
|
|
6027
6415
|
},
|
|
6028
6416
|
commands: {
|
|
6029
|
-
path: "commands/
|
|
6417
|
+
path: "commands/tskl"
|
|
6030
6418
|
}
|
|
6031
6419
|
}
|
|
6032
6420
|
];
|
|
6033
|
-
async function
|
|
6421
|
+
async function On(s) {
|
|
6034
6422
|
return (await Promise.all(
|
|
6035
|
-
|
|
6423
|
+
fo.map(async (t) => await Cs(_(s, t.dir)).then((i) => i.isDirectory()).catch(() => !1) ? t : void 0)
|
|
6036
6424
|
)).filter((t) => t !== void 0);
|
|
6037
6425
|
}
|
|
6038
|
-
function
|
|
6039
|
-
return Object.entries(
|
|
6040
|
-
const t =
|
|
6426
|
+
function Nn() {
|
|
6427
|
+
return Object.entries(co).map(([s, e]) => {
|
|
6428
|
+
const t = Tn(e), n = t.data;
|
|
6041
6429
|
return {
|
|
6042
|
-
name: n.name ??
|
|
6430
|
+
name: n.name ?? As(at(s)),
|
|
6043
6431
|
description: n.description ?? "",
|
|
6044
6432
|
content: e,
|
|
6045
6433
|
body: t.content,
|
|
@@ -6047,14 +6435,15 @@ function Tn() {
|
|
|
6047
6435
|
};
|
|
6048
6436
|
});
|
|
6049
6437
|
}
|
|
6050
|
-
function
|
|
6051
|
-
return Object.entries(
|
|
6052
|
-
filename:
|
|
6438
|
+
function ho() {
|
|
6439
|
+
return Object.entries(uo).map(([s, e]) => ({
|
|
6440
|
+
filename: As(s),
|
|
6053
6441
|
content: e
|
|
6054
6442
|
}));
|
|
6055
6443
|
}
|
|
6056
|
-
|
|
6057
|
-
|
|
6444
|
+
const po = ["taskless-", "use-taskless-"], mo = ["tskl", "taskless"];
|
|
6445
|
+
async function go(s, e) {
|
|
6446
|
+
const t = _(s, e.dir, e.skills.path);
|
|
6058
6447
|
let n;
|
|
6059
6448
|
try {
|
|
6060
6449
|
n = await Mt(t);
|
|
@@ -6062,50 +6451,59 @@ async function oo(s, e) {
|
|
|
6062
6451
|
return;
|
|
6063
6452
|
}
|
|
6064
6453
|
const i = n.filter(
|
|
6065
|
-
(r) =>
|
|
6454
|
+
(r) => po.some((o) => r.startsWith(o))
|
|
6066
6455
|
);
|
|
6067
6456
|
for (const r of i)
|
|
6068
|
-
await
|
|
6457
|
+
await Pe(_(t, r), { recursive: !0, force: !0 });
|
|
6458
|
+
}
|
|
6459
|
+
async function yo(s, e) {
|
|
6460
|
+
if (!e.commands) return;
|
|
6461
|
+
const t = _(s, e.dir, at(e.commands.path));
|
|
6462
|
+
for (const n of mo)
|
|
6463
|
+
await Pe(_(t, n), {
|
|
6464
|
+
recursive: !0,
|
|
6465
|
+
force: !0
|
|
6466
|
+
});
|
|
6069
6467
|
}
|
|
6070
|
-
async function
|
|
6468
|
+
async function wo(s, e, t, n) {
|
|
6071
6469
|
const i = [], r = [];
|
|
6072
|
-
await
|
|
6470
|
+
await go(s, e), await yo(s, e);
|
|
6073
6471
|
for (const o of t) {
|
|
6074
|
-
const a =
|
|
6075
|
-
await
|
|
6472
|
+
const a = _(s, e.dir, e.skills.path, o.name);
|
|
6473
|
+
await Ue(a, { recursive: !0 }), await qe(_(a, "SKILL.md"), o.content, "utf8"), i.push(o.name);
|
|
6076
6474
|
}
|
|
6077
6475
|
if (e.commands) {
|
|
6078
|
-
const o =
|
|
6079
|
-
await
|
|
6476
|
+
const o = _(s, e.dir, e.commands.path);
|
|
6477
|
+
await Ue(o, { recursive: !0 });
|
|
6080
6478
|
for (const a of n)
|
|
6081
|
-
await
|
|
6082
|
-
|
|
6479
|
+
await qe(
|
|
6480
|
+
_(o, a.filename),
|
|
6083
6481
|
a.content,
|
|
6084
6482
|
"utf8"
|
|
6085
6483
|
), r.push(a.filename);
|
|
6086
6484
|
}
|
|
6087
6485
|
return { skills: i, commands: r };
|
|
6088
6486
|
}
|
|
6089
|
-
async function
|
|
6487
|
+
async function ko(s) {
|
|
6090
6488
|
try {
|
|
6091
6489
|
const e = await Ie(s, "utf8");
|
|
6092
|
-
return
|
|
6490
|
+
return Tn(e).data.metadata?.version;
|
|
6093
6491
|
} catch {
|
|
6094
6492
|
return;
|
|
6095
6493
|
}
|
|
6096
6494
|
}
|
|
6097
|
-
async function
|
|
6098
|
-
const e =
|
|
6495
|
+
async function bo(s) {
|
|
6496
|
+
const e = Nn(), t = await On(s), n = [];
|
|
6099
6497
|
for (const i of t) {
|
|
6100
6498
|
const r = [];
|
|
6101
6499
|
for (const o of e) {
|
|
6102
|
-
const a =
|
|
6500
|
+
const a = _(
|
|
6103
6501
|
s,
|
|
6104
6502
|
i.dir,
|
|
6105
6503
|
i.skills.path,
|
|
6106
6504
|
o.name,
|
|
6107
6505
|
"SKILL.md"
|
|
6108
|
-
), l = await
|
|
6506
|
+
), l = await ko(a), c = o.metadata.version ?? "unknown";
|
|
6109
6507
|
r.push({
|
|
6110
6508
|
name: o.name,
|
|
6111
6509
|
installedVersion: l,
|
|
@@ -6117,7 +6515,7 @@ async function co(s) {
|
|
|
6117
6515
|
}
|
|
6118
6516
|
return n;
|
|
6119
6517
|
}
|
|
6120
|
-
const
|
|
6518
|
+
const So = {
|
|
6121
6519
|
meta: {
|
|
6122
6520
|
name: "init",
|
|
6123
6521
|
description: "Install or update Taskless skills"
|
|
@@ -6130,7 +6528,7 @@ const uo = {
|
|
|
6130
6528
|
}
|
|
6131
6529
|
},
|
|
6132
6530
|
async run({ args: s }) {
|
|
6133
|
-
const e = H(s.dir ?? process.cwd()), t =
|
|
6531
|
+
const e = H(s.dir ?? process.cwd()), t = Nn(), n = ho(), i = await On(e);
|
|
6134
6532
|
if (i.length === 0) {
|
|
6135
6533
|
console.log(
|
|
6136
6534
|
`No supported tool directories detected.
|
|
@@ -6142,7 +6540,7 @@ Alternative installation methods:
|
|
|
6142
6540
|
return;
|
|
6143
6541
|
}
|
|
6144
6542
|
for (const r of i) {
|
|
6145
|
-
const o = await
|
|
6543
|
+
const o = await wo(e, r, t, n);
|
|
6146
6544
|
console.log(
|
|
6147
6545
|
`${r.name}: installed ${String(o.skills.length)} skill(s)`
|
|
6148
6546
|
);
|
|
@@ -6153,11 +6551,11 @@ Alternative installation methods:
|
|
|
6153
6551
|
);
|
|
6154
6552
|
}
|
|
6155
6553
|
}
|
|
6156
|
-
},
|
|
6157
|
-
function
|
|
6554
|
+
}, vo = /\{[^{}]+\}/g, Io = () => typeof process == "object" && Number.parseInt(process?.versions?.node?.substring(0, 2)) >= 18 && process.versions.undici;
|
|
6555
|
+
function To() {
|
|
6158
6556
|
return Math.random().toString(36).slice(2, 11);
|
|
6159
6557
|
}
|
|
6160
|
-
function
|
|
6558
|
+
function Oo(s) {
|
|
6161
6559
|
let {
|
|
6162
6560
|
baseUrl: e = "",
|
|
6163
6561
|
Request: t = globalThis.Request,
|
|
@@ -6169,7 +6567,7 @@ function mo(s) {
|
|
|
6169
6567
|
requestInitExt: l = void 0,
|
|
6170
6568
|
...c
|
|
6171
6569
|
} = { ...s };
|
|
6172
|
-
l =
|
|
6570
|
+
l = Io() ? l : void 0, e = Os(e);
|
|
6173
6571
|
const h = [];
|
|
6174
6572
|
async function d(u, f) {
|
|
6175
6573
|
const {
|
|
@@ -6180,28 +6578,28 @@ function mo(s) {
|
|
|
6180
6578
|
params: y = {},
|
|
6181
6579
|
parseAs: b = "json",
|
|
6182
6580
|
querySerializer: S,
|
|
6183
|
-
bodySerializer: v = r ??
|
|
6581
|
+
bodySerializer: v = r ?? _o,
|
|
6184
6582
|
pathSerializer: I,
|
|
6185
|
-
body:
|
|
6583
|
+
body: N,
|
|
6186
6584
|
middleware: w = [],
|
|
6187
|
-
...
|
|
6585
|
+
...C
|
|
6188
6586
|
} = f || {};
|
|
6189
6587
|
let B = e;
|
|
6190
|
-
g && (B =
|
|
6191
|
-
let
|
|
6192
|
-
S && (
|
|
6588
|
+
g && (B = Os(g) ?? e);
|
|
6589
|
+
let z = typeof i == "function" ? i : Is(i);
|
|
6590
|
+
S && (z = typeof S == "function" ? S : Is({
|
|
6193
6591
|
...typeof i == "object" ? i : {},
|
|
6194
6592
|
...S
|
|
6195
6593
|
}));
|
|
6196
|
-
const
|
|
6197
|
-
|
|
6594
|
+
const E = I || o || No, de = N === void 0 ? void 0 : v(
|
|
6595
|
+
N,
|
|
6198
6596
|
// Note: we declare mergeHeaders() both here and below because it’s a bit of a chicken-or-egg situation:
|
|
6199
6597
|
// bodySerializer() needs all headers so we aren’t dropping ones set by the user, however,
|
|
6200
6598
|
// the result of this ALSO sets the lowest-priority content-type header. So we re-merge below,
|
|
6201
6599
|
// setting the content-type at the very beginning to be overwritten.
|
|
6202
6600
|
// Lastly, based on the way headers work, it’s not a simple “present-or-not” check becauase null intentionally un-sets headers.
|
|
6203
|
-
|
|
6204
|
-
), Pn =
|
|
6601
|
+
Ts(a, k, y.header)
|
|
6602
|
+
), Pn = Ts(
|
|
6205
6603
|
// with no body, we should not to set Content-Type
|
|
6206
6604
|
de === void 0 || // if serialized body is FormData; browser will correctly set Content-Type & boundary expression
|
|
6207
6605
|
de instanceof FormData ? {} : {
|
|
@@ -6213,116 +6611,116 @@ function mo(s) {
|
|
|
6213
6611
|
), ee = [...h, ...w], Un = {
|
|
6214
6612
|
redirect: "follow",
|
|
6215
6613
|
...c,
|
|
6216
|
-
...
|
|
6614
|
+
...C,
|
|
6217
6615
|
body: de,
|
|
6218
6616
|
headers: Pn
|
|
6219
6617
|
};
|
|
6220
|
-
let
|
|
6221
|
-
|
|
6618
|
+
let Ye, ze, te = new m(
|
|
6619
|
+
Ao(u, { baseUrl: B, params: y, querySerializer: z, pathSerializer: E }),
|
|
6222
6620
|
Un
|
|
6223
|
-
),
|
|
6224
|
-
for (const U in
|
|
6225
|
-
U in te || (te[U] =
|
|
6621
|
+
), j;
|
|
6622
|
+
for (const U in C)
|
|
6623
|
+
U in te || (te[U] = C[U]);
|
|
6226
6624
|
if (ee.length) {
|
|
6227
|
-
|
|
6625
|
+
Ye = To(), ze = Object.freeze({
|
|
6228
6626
|
baseUrl: B,
|
|
6229
6627
|
fetch: p,
|
|
6230
6628
|
parseAs: b,
|
|
6231
|
-
querySerializer:
|
|
6629
|
+
querySerializer: z,
|
|
6232
6630
|
bodySerializer: v,
|
|
6233
|
-
pathSerializer:
|
|
6631
|
+
pathSerializer: E
|
|
6234
6632
|
});
|
|
6235
6633
|
for (const U of ee)
|
|
6236
6634
|
if (U && typeof U == "object" && typeof U.onRequest == "function") {
|
|
6237
|
-
const
|
|
6635
|
+
const R = await U.onRequest({
|
|
6238
6636
|
request: te,
|
|
6239
6637
|
schemaPath: u,
|
|
6240
6638
|
params: y,
|
|
6241
|
-
options:
|
|
6242
|
-
id:
|
|
6639
|
+
options: ze,
|
|
6640
|
+
id: Ye
|
|
6243
6641
|
});
|
|
6244
|
-
if (
|
|
6245
|
-
if (
|
|
6246
|
-
te =
|
|
6247
|
-
else if (
|
|
6248
|
-
|
|
6642
|
+
if (R)
|
|
6643
|
+
if (R instanceof m)
|
|
6644
|
+
te = R;
|
|
6645
|
+
else if (R instanceof Response) {
|
|
6646
|
+
j = R;
|
|
6249
6647
|
break;
|
|
6250
6648
|
} else
|
|
6251
6649
|
throw new Error("onRequest: must return new Request() or Response() when modifying the request");
|
|
6252
6650
|
}
|
|
6253
6651
|
}
|
|
6254
|
-
if (!
|
|
6652
|
+
if (!j) {
|
|
6255
6653
|
try {
|
|
6256
|
-
|
|
6654
|
+
j = await p(te, l);
|
|
6257
6655
|
} catch (U) {
|
|
6258
|
-
let
|
|
6656
|
+
let R = U;
|
|
6259
6657
|
if (ee.length)
|
|
6260
6658
|
for (let oe = ee.length - 1; oe >= 0; oe--) {
|
|
6261
6659
|
const Ge = ee[oe];
|
|
6262
6660
|
if (Ge && typeof Ge == "object" && typeof Ge.onError == "function") {
|
|
6263
|
-
const
|
|
6661
|
+
const Ce = await Ge.onError({
|
|
6264
6662
|
request: te,
|
|
6265
|
-
error:
|
|
6663
|
+
error: R,
|
|
6266
6664
|
schemaPath: u,
|
|
6267
6665
|
params: y,
|
|
6268
|
-
options:
|
|
6269
|
-
id:
|
|
6666
|
+
options: ze,
|
|
6667
|
+
id: Ye
|
|
6270
6668
|
});
|
|
6271
|
-
if (
|
|
6272
|
-
if (
|
|
6273
|
-
|
|
6669
|
+
if (Ce) {
|
|
6670
|
+
if (Ce instanceof Response) {
|
|
6671
|
+
R = void 0, j = Ce;
|
|
6274
6672
|
break;
|
|
6275
6673
|
}
|
|
6276
|
-
if (
|
|
6277
|
-
|
|
6674
|
+
if (Ce instanceof Error) {
|
|
6675
|
+
R = Ce;
|
|
6278
6676
|
continue;
|
|
6279
6677
|
}
|
|
6280
6678
|
throw new Error("onError: must return new Response() or instance of Error");
|
|
6281
6679
|
}
|
|
6282
6680
|
}
|
|
6283
6681
|
}
|
|
6284
|
-
if (
|
|
6285
|
-
throw
|
|
6682
|
+
if (R)
|
|
6683
|
+
throw R;
|
|
6286
6684
|
}
|
|
6287
6685
|
if (ee.length)
|
|
6288
6686
|
for (let U = ee.length - 1; U >= 0; U--) {
|
|
6289
|
-
const
|
|
6290
|
-
if (
|
|
6291
|
-
const oe = await
|
|
6687
|
+
const R = ee[U];
|
|
6688
|
+
if (R && typeof R == "object" && typeof R.onResponse == "function") {
|
|
6689
|
+
const oe = await R.onResponse({
|
|
6292
6690
|
request: te,
|
|
6293
|
-
response:
|
|
6691
|
+
response: j,
|
|
6294
6692
|
schemaPath: u,
|
|
6295
6693
|
params: y,
|
|
6296
|
-
options:
|
|
6297
|
-
id:
|
|
6694
|
+
options: ze,
|
|
6695
|
+
id: Ye
|
|
6298
6696
|
});
|
|
6299
6697
|
if (oe) {
|
|
6300
6698
|
if (!(oe instanceof Response))
|
|
6301
6699
|
throw new Error("onResponse: must return new Response() when modifying the response");
|
|
6302
|
-
|
|
6700
|
+
j = oe;
|
|
6303
6701
|
}
|
|
6304
6702
|
}
|
|
6305
6703
|
}
|
|
6306
6704
|
}
|
|
6307
|
-
const os =
|
|
6308
|
-
if (
|
|
6309
|
-
return
|
|
6310
|
-
if (
|
|
6705
|
+
const os = j.headers.get("Content-Length");
|
|
6706
|
+
if (j.status === 204 || te.method === "HEAD" || os === "0" && !j.headers.get("Transfer-Encoding")?.includes("chunked"))
|
|
6707
|
+
return j.ok ? { data: void 0, response: j } : { error: void 0, response: j };
|
|
6708
|
+
if (j.ok)
|
|
6311
6709
|
return { data: await (async () => {
|
|
6312
6710
|
if (b === "stream")
|
|
6313
|
-
return
|
|
6711
|
+
return j.body;
|
|
6314
6712
|
if (b === "json" && !os) {
|
|
6315
|
-
const
|
|
6316
|
-
return
|
|
6713
|
+
const R = await j.text();
|
|
6714
|
+
return R ? JSON.parse(R) : void 0;
|
|
6317
6715
|
}
|
|
6318
|
-
return await
|
|
6319
|
-
})(), response:
|
|
6320
|
-
let
|
|
6716
|
+
return await j[b]();
|
|
6717
|
+
})(), response: j };
|
|
6718
|
+
let wt = await j.text();
|
|
6321
6719
|
try {
|
|
6322
|
-
|
|
6720
|
+
wt = JSON.parse(wt);
|
|
6323
6721
|
} catch {
|
|
6324
6722
|
}
|
|
6325
|
-
return { error:
|
|
6723
|
+
return { error: wt, response: j };
|
|
6326
6724
|
}
|
|
6327
6725
|
return {
|
|
6328
6726
|
request(u, f, g) {
|
|
@@ -6378,7 +6776,7 @@ function mo(s) {
|
|
|
6378
6776
|
}
|
|
6379
6777
|
};
|
|
6380
6778
|
}
|
|
6381
|
-
function
|
|
6779
|
+
function yt(s, e, t) {
|
|
6382
6780
|
if (e == null)
|
|
6383
6781
|
return "";
|
|
6384
6782
|
if (typeof e == "object")
|
|
@@ -6412,12 +6810,12 @@ function _n(s, e, t) {
|
|
|
6412
6810
|
}
|
|
6413
6811
|
for (const o in e) {
|
|
6414
6812
|
const a = t.style === "deepObject" ? `${s}[${o}]` : o;
|
|
6415
|
-
n.push(
|
|
6813
|
+
n.push(yt(a, e[o], t));
|
|
6416
6814
|
}
|
|
6417
6815
|
const r = n.join(i);
|
|
6418
6816
|
return t.style === "label" || t.style === "matrix" ? `${i}${r}` : r;
|
|
6419
6817
|
}
|
|
6420
|
-
function
|
|
6818
|
+
function An(s, e, t) {
|
|
6421
6819
|
if (!Array.isArray(e))
|
|
6422
6820
|
return "";
|
|
6423
6821
|
if (t.explode === !1) {
|
|
@@ -6437,7 +6835,7 @@ function En(s, e, t) {
|
|
|
6437
6835
|
}
|
|
6438
6836
|
const n = { simple: ",", label: ".", matrix: ";" }[t.style] || "&", i = [];
|
|
6439
6837
|
for (const r of e)
|
|
6440
|
-
t.style === "simple" || t.style === "label" ? i.push(t.allowReserved === !0 ? r : encodeURIComponent(r)) : i.push(
|
|
6838
|
+
t.style === "simple" || t.style === "label" ? i.push(t.allowReserved === !0 ? r : encodeURIComponent(r)) : i.push(yt(s, r, t));
|
|
6441
6839
|
return t.style === "label" || t.style === "matrix" ? `${n}${i.join(n)}` : i.join(n);
|
|
6442
6840
|
}
|
|
6443
6841
|
function Is(s) {
|
|
@@ -6451,7 +6849,7 @@ function Is(s) {
|
|
|
6451
6849
|
if (r.length === 0)
|
|
6452
6850
|
continue;
|
|
6453
6851
|
n.push(
|
|
6454
|
-
|
|
6852
|
+
An(i, r, {
|
|
6455
6853
|
style: "form",
|
|
6456
6854
|
explode: !0,
|
|
6457
6855
|
...s?.array,
|
|
@@ -6471,21 +6869,21 @@ function Is(s) {
|
|
|
6471
6869
|
);
|
|
6472
6870
|
continue;
|
|
6473
6871
|
}
|
|
6474
|
-
n.push(
|
|
6872
|
+
n.push(yt(i, r, s));
|
|
6475
6873
|
}
|
|
6476
6874
|
}
|
|
6477
6875
|
return n.join("&");
|
|
6478
6876
|
};
|
|
6479
6877
|
}
|
|
6480
|
-
function
|
|
6878
|
+
function No(s, e) {
|
|
6481
6879
|
let t = s;
|
|
6482
|
-
for (const n of s.match(
|
|
6880
|
+
for (const n of s.match(vo) ?? []) {
|
|
6483
6881
|
let i = n.substring(1, n.length - 1), r = !1, o = "simple";
|
|
6484
6882
|
if (i.endsWith("*") && (r = !0, i = i.substring(0, i.length - 1)), i.startsWith(".") ? (o = "label", i = i.substring(1)) : i.startsWith(";") && (o = "matrix", i = i.substring(1)), !e || e[i] === void 0 || e[i] === null)
|
|
6485
6883
|
continue;
|
|
6486
6884
|
const a = e[i];
|
|
6487
6885
|
if (Array.isArray(a)) {
|
|
6488
|
-
t = t.replace(n,
|
|
6886
|
+
t = t.replace(n, An(i, a, { style: o, explode: r }));
|
|
6489
6887
|
continue;
|
|
6490
6888
|
}
|
|
6491
6889
|
if (typeof a == "object") {
|
|
@@ -6493,23 +6891,23 @@ function go(s, e) {
|
|
|
6493
6891
|
continue;
|
|
6494
6892
|
}
|
|
6495
6893
|
if (o === "matrix") {
|
|
6496
|
-
t = t.replace(n, `;${
|
|
6894
|
+
t = t.replace(n, `;${yt(i, a)}`);
|
|
6497
6895
|
continue;
|
|
6498
6896
|
}
|
|
6499
6897
|
t = t.replace(n, o === "label" ? `.${encodeURIComponent(a)}` : encodeURIComponent(a));
|
|
6500
6898
|
}
|
|
6501
6899
|
return t;
|
|
6502
6900
|
}
|
|
6503
|
-
function
|
|
6901
|
+
function _o(s, e) {
|
|
6504
6902
|
return s instanceof FormData ? s : e && (e.get instanceof Function ? e.get("Content-Type") ?? e.get("content-type") : e["Content-Type"] ?? e["content-type"]) === "application/x-www-form-urlencoded" ? new URLSearchParams(s).toString() : JSON.stringify(s);
|
|
6505
6903
|
}
|
|
6506
|
-
function
|
|
6904
|
+
function Ao(s, e) {
|
|
6507
6905
|
let t = `${e.baseUrl}${s}`;
|
|
6508
6906
|
e.params?.path && (t = e.pathSerializer(t, e.params.path));
|
|
6509
6907
|
let n = e.querySerializer(e.params.query ?? {});
|
|
6510
6908
|
return n.startsWith("?") && (n = n.substring(1)), n && (t += `?${n}`), t;
|
|
6511
6909
|
}
|
|
6512
|
-
function
|
|
6910
|
+
function Ts(...s) {
|
|
6513
6911
|
const e = new Headers();
|
|
6514
6912
|
for (const t of s) {
|
|
6515
6913
|
if (!t || typeof t != "object")
|
|
@@ -6525,25 +6923,25 @@ function Os(...s) {
|
|
|
6525
6923
|
}
|
|
6526
6924
|
return e;
|
|
6527
6925
|
}
|
|
6528
|
-
function
|
|
6926
|
+
function Os(s) {
|
|
6529
6927
|
return s.endsWith("/") ? s.substring(0, s.length - 1) : s;
|
|
6530
6928
|
}
|
|
6531
|
-
function
|
|
6532
|
-
const e =
|
|
6533
|
-
return
|
|
6929
|
+
function Ae(s) {
|
|
6930
|
+
const e = xt().replace(/\/cli\/?$/, "");
|
|
6931
|
+
return Oo({
|
|
6534
6932
|
baseUrl: e,
|
|
6535
6933
|
headers: { Authorization: `Bearer ${s}` }
|
|
6536
6934
|
});
|
|
6537
6935
|
}
|
|
6538
|
-
async function
|
|
6936
|
+
async function Co(s) {
|
|
6539
6937
|
try {
|
|
6540
|
-
const e =
|
|
6938
|
+
const e = Ae(s), { data: t, error: n } = await e.GET("/cli/api/whoami");
|
|
6541
6939
|
return n ? void 0 : t;
|
|
6542
6940
|
} catch {
|
|
6543
6941
|
return;
|
|
6544
6942
|
}
|
|
6545
6943
|
}
|
|
6546
|
-
const
|
|
6944
|
+
const Eo = {
|
|
6547
6945
|
meta: {
|
|
6548
6946
|
name: "info",
|
|
6549
6947
|
description: "Show Taskless CLI information"
|
|
@@ -6556,10 +6954,10 @@ const bo = {
|
|
|
6556
6954
|
}
|
|
6557
6955
|
},
|
|
6558
6956
|
async run({ args: s }) {
|
|
6559
|
-
const e = H(s.dir ?? process.cwd()), [t, n] = await Promise.all([
|
|
6957
|
+
const e = H(s.dir ?? process.cwd()), [t, n] = await Promise.all([bo(e), Be()]);
|
|
6560
6958
|
let i;
|
|
6561
6959
|
if (n) {
|
|
6562
|
-
const r = await
|
|
6960
|
+
const r = await Co(n);
|
|
6563
6961
|
r && (i = {
|
|
6564
6962
|
user: r.user,
|
|
6565
6963
|
email: r.email,
|
|
@@ -6569,14 +6967,14 @@ const bo = {
|
|
|
6569
6967
|
console.log(
|
|
6570
6968
|
JSON.stringify({
|
|
6571
6969
|
success: !0,
|
|
6572
|
-
version: "0.2.
|
|
6970
|
+
version: "0.2.1",
|
|
6573
6971
|
tools: t,
|
|
6574
6972
|
loggedIn: n !== void 0,
|
|
6575
6973
|
auth: i
|
|
6576
6974
|
})
|
|
6577
6975
|
);
|
|
6578
6976
|
}
|
|
6579
|
-
},
|
|
6977
|
+
}, Lo = `Authenticate with taskless.io
|
|
6580
6978
|
|
|
6581
6979
|
Starts a device authorization flow. The CLI displays a URL and a one-time
|
|
6582
6980
|
code. Open the URL in a browser, enter the code, and authorize access.
|
|
@@ -6593,7 +6991,7 @@ Environment Variable:
|
|
|
6593
6991
|
|
|
6594
6992
|
Examples:
|
|
6595
6993
|
taskless auth login
|
|
6596
|
-
`,
|
|
6994
|
+
`, $o = `Remove saved authentication
|
|
6597
6995
|
|
|
6598
6996
|
Deletes the locally saved authentication token. If using the
|
|
6599
6997
|
TASKLESS_TOKEN environment variable, unset it separately.
|
|
@@ -6606,14 +7004,14 @@ Credential Storage:
|
|
|
6606
7004
|
|
|
6607
7005
|
Examples:
|
|
6608
7006
|
taskless auth logout
|
|
6609
|
-
`,
|
|
7007
|
+
`, xo = `Manage authentication with taskless.io
|
|
6610
7008
|
|
|
6611
7009
|
Commands:
|
|
6612
7010
|
login Authenticate via device flow
|
|
6613
7011
|
logout Remove saved credentials
|
|
6614
7012
|
|
|
6615
7013
|
Run \`taskless help auth <command>\` for details on a specific command.
|
|
6616
|
-
`,
|
|
7014
|
+
`, jo = `Run Taskless rules against your codebase
|
|
6617
7015
|
|
|
6618
7016
|
Scans your project using ast-grep rules defined in .taskless/rules/.
|
|
6619
7017
|
|
|
@@ -6640,7 +7038,7 @@ Examples:
|
|
|
6640
7038
|
taskless check
|
|
6641
7039
|
taskless check -d ./my-project
|
|
6642
7040
|
taskless check --json
|
|
6643
|
-
`,
|
|
7041
|
+
`, Ro = `Show Taskless CLI information
|
|
6644
7042
|
|
|
6645
7043
|
Outputs a JSON object with the CLI version, installed tool/skill status,
|
|
6646
7044
|
and authentication state.
|
|
@@ -6661,7 +7059,7 @@ Output:
|
|
|
6661
7059
|
Examples:
|
|
6662
7060
|
taskless info
|
|
6663
7061
|
taskless info -d ./my-project
|
|
6664
|
-
`,
|
|
7062
|
+
`, Po = `Install Taskless skills
|
|
6665
7063
|
|
|
6666
7064
|
Detects supported coding agent tools in your project and installs
|
|
6667
7065
|
Taskless skills and commands for each one. Currently supports Claude Code.
|
|
@@ -6685,7 +7083,7 @@ Alternative Installation:
|
|
|
6685
7083
|
Examples:
|
|
6686
7084
|
taskless init
|
|
6687
7085
|
taskless init -d ./my-project
|
|
6688
|
-
`,
|
|
7086
|
+
`, Uo = `Create a new rule from a JSON file
|
|
6689
7087
|
|
|
6690
7088
|
Reads a JSON file describing the desired rule, submits it to the Taskless
|
|
6691
7089
|
API for generation, and writes the resulting rule and test files to
|
|
@@ -6714,7 +7112,7 @@ Output:
|
|
|
6714
7112
|
Examples:
|
|
6715
7113
|
taskless rules create --from request.json
|
|
6716
7114
|
taskless rules create --from .taskless/.tmp-rule-request.json --json
|
|
6717
|
-
`,
|
|
7115
|
+
`, qo = `Delete a rule and its test files
|
|
6718
7116
|
|
|
6719
7117
|
Removes a rule YAML file and any associated test files from the project.
|
|
6720
7118
|
|
|
@@ -6734,7 +7132,7 @@ Exit Codes:
|
|
|
6734
7132
|
Examples:
|
|
6735
7133
|
taskless rules delete no-console-log
|
|
6736
7134
|
taskless rules delete detect-innerhtml -d ./my-project
|
|
6737
|
-
`,
|
|
7135
|
+
`, Do = `Improve an existing rule with guidance
|
|
6738
7136
|
|
|
6739
7137
|
Reads a JSON file containing the rule ID and improvement guidance, submits
|
|
6740
7138
|
it to the Taskless API, and writes the updated rule and test files to
|
|
@@ -6763,7 +7161,7 @@ Output:
|
|
|
6763
7161
|
Examples:
|
|
6764
7162
|
taskless rules improve --from request.json
|
|
6765
7163
|
taskless rules improve --from .taskless/.tmp-improve-request.json --json
|
|
6766
|
-
`,
|
|
7164
|
+
`, Mo = `Manage Taskless rules
|
|
6767
7165
|
|
|
6768
7166
|
Commands:
|
|
6769
7167
|
create Create a new rule from a description
|
|
@@ -6771,7 +7169,7 @@ Commands:
|
|
|
6771
7169
|
delete Delete a rule and its test files
|
|
6772
7170
|
|
|
6773
7171
|
Run \`taskless help rules <command>\` for details on a specific command.
|
|
6774
|
-
`,
|
|
7172
|
+
`, Bo = `Request a scaffold upgrade for the .taskless/ engine directory
|
|
6775
7173
|
|
|
6776
7174
|
Sends your project's current scaffold version to the Taskless backend,
|
|
6777
7175
|
which creates a pull request to upgrade the .taskless/ directory. The
|
|
@@ -6799,36 +7197,36 @@ Examples:
|
|
|
6799
7197
|
taskless update-engine
|
|
6800
7198
|
taskless update-engine --json
|
|
6801
7199
|
taskless update-engine -d ./my-project
|
|
6802
|
-
`,
|
|
6803
|
-
"../help/auth-login.txt":
|
|
6804
|
-
"../help/auth-logout.txt":
|
|
6805
|
-
"../help/auth.txt":
|
|
6806
|
-
"../help/check.txt":
|
|
6807
|
-
"../help/info.txt":
|
|
6808
|
-
"../help/init.txt":
|
|
6809
|
-
"../help/rules-create.txt":
|
|
6810
|
-
"../help/rules-delete.txt":
|
|
6811
|
-
"../help/rules-improve.txt":
|
|
6812
|
-
"../help/rules.txt":
|
|
6813
|
-
"../help/update-engine.txt":
|
|
7200
|
+
`, Fo = /* @__PURE__ */ Object.assign({
|
|
7201
|
+
"../help/auth-login.txt": Lo,
|
|
7202
|
+
"../help/auth-logout.txt": $o,
|
|
7203
|
+
"../help/auth.txt": xo,
|
|
7204
|
+
"../help/check.txt": jo,
|
|
7205
|
+
"../help/info.txt": Ro,
|
|
7206
|
+
"../help/init.txt": Po,
|
|
7207
|
+
"../help/rules-create.txt": Uo,
|
|
7208
|
+
"../help/rules-delete.txt": qo,
|
|
7209
|
+
"../help/rules-improve.txt": Do,
|
|
7210
|
+
"../help/rules.txt": Mo,
|
|
7211
|
+
"../help/update-engine.txt": Bo
|
|
6814
7212
|
});
|
|
6815
|
-
function
|
|
7213
|
+
function Ko() {
|
|
6816
7214
|
const s = /* @__PURE__ */ new Map();
|
|
6817
|
-
for (const [e, t] of Object.entries(
|
|
7215
|
+
for (const [e, t] of Object.entries(Fo)) {
|
|
6818
7216
|
const n = e.split("/").pop()?.replace(/\.txt$/, "");
|
|
6819
7217
|
n && s.set(n, t);
|
|
6820
7218
|
}
|
|
6821
7219
|
return s;
|
|
6822
7220
|
}
|
|
6823
|
-
const
|
|
6824
|
-
async function
|
|
7221
|
+
const Jo = Ko();
|
|
7222
|
+
async function Ns(s) {
|
|
6825
7223
|
return typeof s == "function" ? s() : s;
|
|
6826
7224
|
}
|
|
6827
|
-
async function
|
|
6828
|
-
const e = await
|
|
6829
|
-
return (e.meta ? await
|
|
7225
|
+
async function Wo(s) {
|
|
7226
|
+
const e = await Ns(s);
|
|
7227
|
+
return (e.meta ? await Ns(e.meta) : void 0)?.description ?? "";
|
|
6830
7228
|
}
|
|
6831
|
-
function
|
|
7229
|
+
function Vo(s) {
|
|
6832
7230
|
return {
|
|
6833
7231
|
meta: {
|
|
6834
7232
|
name: "help",
|
|
@@ -6844,7 +7242,7 @@ function Po(s) {
|
|
|
6844
7242
|
const r = [];
|
|
6845
7243
|
for (const [a, l] of Object.entries(s)) {
|
|
6846
7244
|
if (a === "help") continue;
|
|
6847
|
-
const c = await
|
|
7245
|
+
const c = await Wo(l);
|
|
6848
7246
|
r.push([a, c]);
|
|
6849
7247
|
}
|
|
6850
7248
|
const o = Math.max(...r.map(([a]) => a.length));
|
|
@@ -6855,13 +7253,13 @@ function Po(s) {
|
|
|
6855
7253
|
);
|
|
6856
7254
|
return;
|
|
6857
7255
|
}
|
|
6858
|
-
const n = t.join("-"), i =
|
|
7256
|
+
const n = t.join("-"), i = Jo.get(n);
|
|
6859
7257
|
i ? console.log(i.trimEnd()) : (console.error(`Unknown command: ${t.join(" ")}`), console.error("Run `taskless help` for available commands."), process.exitCode = 1);
|
|
6860
7258
|
}
|
|
6861
7259
|
};
|
|
6862
7260
|
}
|
|
6863
7261
|
async function is(s) {
|
|
6864
|
-
const e =
|
|
7262
|
+
const e = _(s, ".taskless", "taskless.json");
|
|
6865
7263
|
let t;
|
|
6866
7264
|
try {
|
|
6867
7265
|
t = await Ie(e, "utf8");
|
|
@@ -6897,7 +7295,7 @@ async function is(s) {
|
|
|
6897
7295
|
repositoryUrl: typeof n.repositoryUrl == "string" ? n.repositoryUrl : void 0
|
|
6898
7296
|
};
|
|
6899
7297
|
}
|
|
6900
|
-
function
|
|
7298
|
+
function Cn(s) {
|
|
6901
7299
|
if (!qs("rules create", s.version)) {
|
|
6902
7300
|
const e = Ft["rules create"];
|
|
6903
7301
|
return {
|
|
@@ -6916,8 +7314,8 @@ function An(s) {
|
|
|
6916
7314
|
function rs(s) {
|
|
6917
7315
|
return s && typeof s == "object" ? s : {};
|
|
6918
7316
|
}
|
|
6919
|
-
async function
|
|
6920
|
-
const t =
|
|
7317
|
+
async function Ho(s, e) {
|
|
7318
|
+
const t = Ae(s), { data: n, error: i, response: r } = await t.POST("/cli/api/rule", {
|
|
6921
7319
|
body: e
|
|
6922
7320
|
});
|
|
6923
7321
|
if (!n) {
|
|
@@ -6936,8 +7334,8 @@ async function Uo(s, e) {
|
|
|
6936
7334
|
}
|
|
6937
7335
|
return n;
|
|
6938
7336
|
}
|
|
6939
|
-
async function
|
|
6940
|
-
const t =
|
|
7337
|
+
async function En(s, e) {
|
|
7338
|
+
const t = Ae(s), { data: n, error: i, response: r } = await t.GET("/cli/api/rule/{ruleId}", {
|
|
6941
7339
|
params: { path: { ruleId: e } }
|
|
6942
7340
|
});
|
|
6943
7341
|
if (!n) {
|
|
@@ -6946,8 +7344,8 @@ async function Cn(s, e) {
|
|
|
6946
7344
|
}
|
|
6947
7345
|
return n;
|
|
6948
7346
|
}
|
|
6949
|
-
async function
|
|
6950
|
-
const n =
|
|
7347
|
+
async function Yo(s, e, t) {
|
|
7348
|
+
const n = Ae(s), { data: i, error: r, response: o } = await n.POST(
|
|
6951
7349
|
"/cli/api/rule/{ruleId}/iterate",
|
|
6952
7350
|
{
|
|
6953
7351
|
params: { path: { ruleId: e } },
|
|
@@ -6966,48 +7364,48 @@ async function qo(s, e, t) {
|
|
|
6966
7364
|
}
|
|
6967
7365
|
return i;
|
|
6968
7366
|
}
|
|
6969
|
-
async function
|
|
6970
|
-
const t =
|
|
6971
|
-
await
|
|
6972
|
-
const n =
|
|
6973
|
-
return await
|
|
7367
|
+
async function Ln(s, e) {
|
|
7368
|
+
const t = _(s, ".taskless", "rules");
|
|
7369
|
+
await Ue(t, { recursive: !0 });
|
|
7370
|
+
const n = _(t, `${e.id}.yml`);
|
|
7371
|
+
return await qe(n, In(e.content, { lineWidth: 0 }), "utf8"), n;
|
|
6974
7372
|
}
|
|
6975
|
-
async function
|
|
6976
|
-
const n =
|
|
6977
|
-
await
|
|
6978
|
-
const i =
|
|
7373
|
+
async function $n(s, e, t) {
|
|
7374
|
+
const n = _(s, ".taskless", "rule-tests");
|
|
7375
|
+
await Ue(n, { recursive: !0 });
|
|
7376
|
+
const i = _(n, `${e.id}-${t}-test.yml`), r = {
|
|
6979
7377
|
id: e.id,
|
|
6980
7378
|
valid: e.tests?.valid ?? [],
|
|
6981
7379
|
invalid: e.tests?.invalid ?? []
|
|
6982
7380
|
};
|
|
6983
|
-
return await
|
|
7381
|
+
return await qe(i, In(r, { lineWidth: 0 }), "utf8"), i;
|
|
6984
7382
|
}
|
|
6985
|
-
async function
|
|
6986
|
-
const t =
|
|
7383
|
+
async function zo(s, e) {
|
|
7384
|
+
const t = _(s, ".taskless", "rules"), n = _(t, `${e}.yml`);
|
|
6987
7385
|
let i = !1;
|
|
6988
7386
|
try {
|
|
6989
|
-
await
|
|
7387
|
+
await Pe(n), i = !0;
|
|
6990
7388
|
} catch {
|
|
6991
7389
|
return !1;
|
|
6992
7390
|
}
|
|
6993
|
-
const r =
|
|
7391
|
+
const r = _(s, ".taskless", "rule-tests");
|
|
6994
7392
|
try {
|
|
6995
7393
|
const a = (await Mt(r)).filter(
|
|
6996
7394
|
(l) => l.startsWith(`${e}-`) && l.endsWith("-test.yml")
|
|
6997
7395
|
);
|
|
6998
7396
|
await Promise.all(
|
|
6999
|
-
a.map((l) =>
|
|
7397
|
+
a.map((l) => Pe(_(r, l)).catch(() => {
|
|
7000
7398
|
}))
|
|
7001
7399
|
);
|
|
7002
7400
|
} catch {
|
|
7003
7401
|
}
|
|
7004
7402
|
return i;
|
|
7005
7403
|
}
|
|
7006
|
-
function
|
|
7404
|
+
function xn() {
|
|
7007
7405
|
const s = /* @__PURE__ */ new Date(), e = String(s.getFullYear()), t = String(s.getMonth() + 1).padStart(2, "0"), n = String(s.getDate()).padStart(2, "0");
|
|
7008
7406
|
return `${e}${t}${n}`;
|
|
7009
7407
|
}
|
|
7010
|
-
const
|
|
7408
|
+
const jn = 15e3, Go = {
|
|
7011
7409
|
meta: {
|
|
7012
7410
|
name: "create",
|
|
7013
7411
|
description: "Create a new rule from a JSON file (use --from to specify the input file)"
|
|
@@ -7059,15 +7457,15 @@ const Rn = 15e3, Mo = {
|
|
|
7059
7457
|
`Error: ${c instanceof Error ? c.message : String(c)}`
|
|
7060
7458
|
), process.exit(1);
|
|
7061
7459
|
}
|
|
7062
|
-
const o =
|
|
7460
|
+
const o = Cn(r);
|
|
7063
7461
|
o.valid || (console.error(`Error: ${o.error}`), process.exit(1));
|
|
7064
|
-
const a = await
|
|
7462
|
+
const a = await Be();
|
|
7065
7463
|
a || (console.error(
|
|
7066
7464
|
"Error: Authentication required. Run `taskless auth login` first."
|
|
7067
7465
|
), process.exit(1));
|
|
7068
7466
|
let l;
|
|
7069
7467
|
try {
|
|
7070
|
-
l = (await
|
|
7468
|
+
l = (await Ho(a, {
|
|
7071
7469
|
orgId: r.orgId,
|
|
7072
7470
|
repositoryUrl: r.repositoryUrl,
|
|
7073
7471
|
prompt: i.prompt,
|
|
@@ -7080,10 +7478,10 @@ const Rn = 15e3, Mo = {
|
|
|
7080
7478
|
), process.exit(1);
|
|
7081
7479
|
}
|
|
7082
7480
|
for (console.error(`Rule submitted (${l}). Waiting for generation...`); ; ) {
|
|
7083
|
-
await new Promise((h) => setTimeout(h,
|
|
7481
|
+
await new Promise((h) => setTimeout(h, jn));
|
|
7084
7482
|
let c;
|
|
7085
7483
|
try {
|
|
7086
|
-
c = await
|
|
7484
|
+
c = await En(a, l);
|
|
7087
7485
|
} catch (h) {
|
|
7088
7486
|
console.error(
|
|
7089
7487
|
`Error: ${h instanceof Error ? h.message : String(h)}`
|
|
@@ -7103,11 +7501,11 @@ const Rn = 15e3, Mo = {
|
|
|
7103
7501
|
break;
|
|
7104
7502
|
}
|
|
7105
7503
|
case "generated": {
|
|
7106
|
-
const h =
|
|
7504
|
+
const h = xn(), d = [], u = c.rules ?? [];
|
|
7107
7505
|
for (const f of u) {
|
|
7108
|
-
const g = await
|
|
7506
|
+
const g = await Ln(e, f);
|
|
7109
7507
|
if (d.push(g), f.tests) {
|
|
7110
|
-
const p = await
|
|
7508
|
+
const p = await $n(e, f, h);
|
|
7111
7509
|
d.push(p);
|
|
7112
7510
|
}
|
|
7113
7511
|
}
|
|
@@ -7137,7 +7535,7 @@ const Rn = 15e3, Mo = {
|
|
|
7137
7535
|
}
|
|
7138
7536
|
}
|
|
7139
7537
|
}
|
|
7140
|
-
},
|
|
7538
|
+
}, Qo = {
|
|
7141
7539
|
meta: {
|
|
7142
7540
|
name: "improve",
|
|
7143
7541
|
description: "Improve an existing rule with guidance (use --from to specify the input file)"
|
|
@@ -7191,15 +7589,15 @@ const Rn = 15e3, Mo = {
|
|
|
7191
7589
|
`Error: ${c instanceof Error ? c.message : String(c)}`
|
|
7192
7590
|
), process.exit(1);
|
|
7193
7591
|
}
|
|
7194
|
-
const o =
|
|
7592
|
+
const o = Cn(r);
|
|
7195
7593
|
o.valid || (console.error(`Error: ${o.error}`), process.exit(1));
|
|
7196
|
-
const a = await
|
|
7594
|
+
const a = await Be();
|
|
7197
7595
|
a || (console.error(
|
|
7198
7596
|
"Error: Authentication required. Run `taskless auth login` first."
|
|
7199
7597
|
), process.exit(1));
|
|
7200
7598
|
let l;
|
|
7201
7599
|
try {
|
|
7202
|
-
l = (await
|
|
7600
|
+
l = (await Yo(a, i.ruleId, {
|
|
7203
7601
|
orgId: r.orgId,
|
|
7204
7602
|
guidance: i.guidance,
|
|
7205
7603
|
references: i.references
|
|
@@ -7212,10 +7610,10 @@ const Rn = 15e3, Mo = {
|
|
|
7212
7610
|
for (console.error(
|
|
7213
7611
|
`Iterate request submitted (${l}). Waiting for generation...`
|
|
7214
7612
|
); ; ) {
|
|
7215
|
-
await new Promise((h) => setTimeout(h,
|
|
7613
|
+
await new Promise((h) => setTimeout(h, jn));
|
|
7216
7614
|
let c;
|
|
7217
7615
|
try {
|
|
7218
|
-
c = await
|
|
7616
|
+
c = await En(a, l);
|
|
7219
7617
|
} catch (h) {
|
|
7220
7618
|
console.error(
|
|
7221
7619
|
`Error: ${h instanceof Error ? h.message : String(h)}`
|
|
@@ -7235,11 +7633,11 @@ const Rn = 15e3, Mo = {
|
|
|
7235
7633
|
break;
|
|
7236
7634
|
}
|
|
7237
7635
|
case "generated": {
|
|
7238
|
-
const h =
|
|
7636
|
+
const h = xn(), d = [], u = c.rules ?? [];
|
|
7239
7637
|
for (const f of u) {
|
|
7240
|
-
const g = await
|
|
7638
|
+
const g = await Ln(e, f);
|
|
7241
7639
|
if (d.push(g), f.tests) {
|
|
7242
|
-
const p = await
|
|
7640
|
+
const p = await $n(e, f, h);
|
|
7243
7641
|
d.push(p);
|
|
7244
7642
|
}
|
|
7245
7643
|
}
|
|
@@ -7269,7 +7667,7 @@ const Rn = 15e3, Mo = {
|
|
|
7269
7667
|
}
|
|
7270
7668
|
}
|
|
7271
7669
|
}
|
|
7272
|
-
},
|
|
7670
|
+
}, Xo = {
|
|
7273
7671
|
meta: {
|
|
7274
7672
|
name: "delete",
|
|
7275
7673
|
description: "Delete a rule and its test files"
|
|
@@ -7288,33 +7686,33 @@ const Rn = 15e3, Mo = {
|
|
|
7288
7686
|
},
|
|
7289
7687
|
async run({ args: s }) {
|
|
7290
7688
|
const e = H(s.dir ?? process.cwd()), t = s.id;
|
|
7291
|
-
await
|
|
7689
|
+
await zo(e, t) ? console.log(`Deleted rule "${t}" and associated test files.`) : (console.error(
|
|
7292
7690
|
`Error: Rule "${t}" not found in .taskless/rules/${t}.yml`
|
|
7293
7691
|
), process.exit(1));
|
|
7294
7692
|
}
|
|
7295
|
-
},
|
|
7693
|
+
}, Zo = {
|
|
7296
7694
|
meta: {
|
|
7297
7695
|
name: "rules",
|
|
7298
7696
|
description: "Manage Taskless rules"
|
|
7299
7697
|
},
|
|
7300
7698
|
subCommands: {
|
|
7301
|
-
create:
|
|
7302
|
-
improve:
|
|
7303
|
-
delete:
|
|
7699
|
+
create: Go,
|
|
7700
|
+
improve: Qo,
|
|
7701
|
+
delete: Xo
|
|
7304
7702
|
}
|
|
7305
7703
|
};
|
|
7306
|
-
function
|
|
7704
|
+
function Rn(s) {
|
|
7307
7705
|
return s && typeof s == "object" ? s : {};
|
|
7308
7706
|
}
|
|
7309
|
-
async function
|
|
7310
|
-
const t =
|
|
7707
|
+
async function ea(s, e) {
|
|
7708
|
+
const t = Ae(s), { data: n, error: i, response: r } = await t.POST(
|
|
7311
7709
|
"/cli/api/update-engine",
|
|
7312
7710
|
{
|
|
7313
7711
|
body: e
|
|
7314
7712
|
}
|
|
7315
7713
|
);
|
|
7316
7714
|
if (!n) {
|
|
7317
|
-
const o =
|
|
7715
|
+
const o = Rn(i);
|
|
7318
7716
|
if (r.status === 400 && o.error === "validation_error") {
|
|
7319
7717
|
const a = o.details ?? [];
|
|
7320
7718
|
throw new Error(`Validation error: ${a.join(", ")}`);
|
|
@@ -7329,22 +7727,22 @@ async function Jo(s, e) {
|
|
|
7329
7727
|
}
|
|
7330
7728
|
return n;
|
|
7331
7729
|
}
|
|
7332
|
-
async function
|
|
7333
|
-
const t =
|
|
7730
|
+
async function ta(s, e) {
|
|
7731
|
+
const t = Ae(s), { data: n, error: i, response: r } = await t.GET(
|
|
7334
7732
|
"/cli/api/update-engine/{requestId}",
|
|
7335
7733
|
{
|
|
7336
7734
|
params: { path: { requestId: e } }
|
|
7337
7735
|
}
|
|
7338
7736
|
);
|
|
7339
7737
|
if (!n) {
|
|
7340
|
-
const o =
|
|
7738
|
+
const o = Rn(i);
|
|
7341
7739
|
throw r.status === 401 ? new Error(
|
|
7342
7740
|
"Authentication required. Run `taskless auth login` first."
|
|
7343
7741
|
) : r.status === 404 && o.error === "not_found" ? new Error("Update request not found. It may have expired.") : new Error(`Status polling failed (HTTP ${String(r.status)})`);
|
|
7344
7742
|
}
|
|
7345
7743
|
return n;
|
|
7346
7744
|
}
|
|
7347
|
-
const
|
|
7745
|
+
const sa = 5e3, na = {
|
|
7348
7746
|
meta: {
|
|
7349
7747
|
name: "update-engine",
|
|
7350
7748
|
description: "Request a scaffold upgrade PR to update the .taskless/ engine directory"
|
|
@@ -7379,14 +7777,14 @@ const Wo = 5e3, Ho = {
|
|
|
7379
7777
|
const o = 'Missing "orgId" or "repositoryUrl" in .taskless/taskless.json. Run `taskless init` to set up your project.';
|
|
7380
7778
|
s.json ? console.log(JSON.stringify({ error: o })) : console.error(`Error: ${o}`), process.exit(1);
|
|
7381
7779
|
}
|
|
7382
|
-
const n = await
|
|
7780
|
+
const n = await Be();
|
|
7383
7781
|
if (!n) {
|
|
7384
7782
|
const o = "Authentication required. Run `taskless auth login` first.";
|
|
7385
7783
|
s.json ? console.log(JSON.stringify({ error: o })) : console.error(`Error: ${o}`), process.exit(1);
|
|
7386
7784
|
}
|
|
7387
7785
|
let i;
|
|
7388
7786
|
try {
|
|
7389
|
-
i = await
|
|
7787
|
+
i = await ea(n, {
|
|
7390
7788
|
orgId: t.orgId,
|
|
7391
7789
|
repositoryUrl: t.repositoryUrl,
|
|
7392
7790
|
version: t.version
|
|
@@ -7414,10 +7812,10 @@ Review and merge it to complete the upgrade.`
|
|
|
7414
7812
|
}
|
|
7415
7813
|
const { requestId: r } = i;
|
|
7416
7814
|
for (console.error("Update request accepted. Waiting for PR creation..."); ; ) {
|
|
7417
|
-
await new Promise((a) => setTimeout(a,
|
|
7815
|
+
await new Promise((a) => setTimeout(a, sa));
|
|
7418
7816
|
let o;
|
|
7419
7817
|
try {
|
|
7420
|
-
o = await
|
|
7818
|
+
o = await ta(n, r);
|
|
7421
7819
|
} catch (a) {
|
|
7422
7820
|
const l = a instanceof Error ? a.message : String(a);
|
|
7423
7821
|
s.json ? console.log(JSON.stringify({ error: l })) : console.error(`Error: ${l}`), process.exit(1);
|
|
@@ -7458,16 +7856,16 @@ Re-run \`taskless update-engine\` to create a new one.`
|
|
|
7458
7856
|
}
|
|
7459
7857
|
}
|
|
7460
7858
|
}, _s = {
|
|
7461
|
-
init:
|
|
7462
|
-
info:
|
|
7859
|
+
init: So,
|
|
7860
|
+
info: Eo,
|
|
7463
7861
|
check: Pi,
|
|
7464
|
-
auth:
|
|
7465
|
-
rules:
|
|
7466
|
-
"update-engine":
|
|
7467
|
-
},
|
|
7862
|
+
auth: Ei,
|
|
7863
|
+
rules: Zo,
|
|
7864
|
+
"update-engine": na
|
|
7865
|
+
}, ia = {
|
|
7468
7866
|
meta: {
|
|
7469
7867
|
name: "taskless",
|
|
7470
|
-
version: "0.2.
|
|
7868
|
+
version: "0.2.1",
|
|
7471
7869
|
description: "Taskless CLI"
|
|
7472
7870
|
},
|
|
7473
7871
|
args: {
|
|
@@ -7484,10 +7882,10 @@ Re-run \`taskless update-engine\` to create a new one.`
|
|
|
7484
7882
|
},
|
|
7485
7883
|
subCommands: {
|
|
7486
7884
|
..._s,
|
|
7487
|
-
help:
|
|
7885
|
+
help: Vo(_s)
|
|
7488
7886
|
},
|
|
7489
7887
|
async run({ rawArgs: s, cmd: e }) {
|
|
7490
7888
|
s.some((t) => !t.startsWith("-")) || await Ps(e);
|
|
7491
7889
|
}
|
|
7492
7890
|
};
|
|
7493
|
-
Si(
|
|
7891
|
+
Si(ia);
|