@taskless/cli 0.1.2 → 0.1.3
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 +713 -700
- package/package.json +10 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as it from "node:tty";
|
|
3
|
-
import { readFileSync as fn } from "node:fs";
|
|
4
|
-
import { join as C,
|
|
5
|
-
import { homedir as
|
|
3
|
+
import { readFileSync as fn, existsSync as dn } from "node:fs";
|
|
4
|
+
import { join as C, resolve as H, dirname as Tt, basename as us } from "node:path";
|
|
5
|
+
import { homedir as hn } from "node:os";
|
|
6
6
|
import { readFile as Ee, rm as gt, mkdir as _e, writeFile as Ce, stat as fs, readdir as ds } from "node:fs/promises";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { createRequire as pn } from "node:module";
|
|
8
|
+
import { spawn as mn } from "node:child_process";
|
|
9
|
+
import { createInterface as gn } from "node:readline";
|
|
10
|
+
import { fileURLToPath as yn } from "node:url";
|
|
10
11
|
const x = {
|
|
11
12
|
fatal: 0,
|
|
12
13
|
error: 0,
|
|
@@ -18,7 +19,7 @@ const x = {
|
|
|
18
19
|
debug: 4,
|
|
19
20
|
trace: 5,
|
|
20
21
|
verbose: Number.POSITIVE_INFINITY
|
|
21
|
-
},
|
|
22
|
+
}, Jt = {
|
|
22
23
|
// Silent
|
|
23
24
|
silent: {
|
|
24
25
|
level: -1
|
|
@@ -92,21 +93,21 @@ function yt(s, e, t = ".", n) {
|
|
|
92
93
|
}
|
|
93
94
|
return i;
|
|
94
95
|
}
|
|
95
|
-
function
|
|
96
|
+
function kn(s) {
|
|
96
97
|
return (...e) => (
|
|
97
98
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
98
99
|
e.reduce((t, n) => yt(t, n, ""), {})
|
|
99
100
|
);
|
|
100
101
|
}
|
|
101
|
-
const
|
|
102
|
-
function
|
|
102
|
+
const wn = kn();
|
|
103
|
+
function bn(s) {
|
|
103
104
|
return Object.prototype.toString.call(s) === "[object Object]";
|
|
104
105
|
}
|
|
105
|
-
function
|
|
106
|
-
return !(!
|
|
106
|
+
function Sn(s) {
|
|
107
|
+
return !(!bn(s) || !s.message && !s.args || s.stack);
|
|
107
108
|
}
|
|
108
109
|
let ot = !1;
|
|
109
|
-
const
|
|
110
|
+
const Vt = [];
|
|
110
111
|
class R {
|
|
111
112
|
options;
|
|
112
113
|
_lastLog;
|
|
@@ -117,8 +118,8 @@ class R {
|
|
|
117
118
|
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
118
119
|
*/
|
|
119
120
|
constructor(e = {}) {
|
|
120
|
-
const t = e.types ||
|
|
121
|
-
this.options =
|
|
121
|
+
const t = e.types || Jt;
|
|
122
|
+
this.options = wn(
|
|
122
123
|
{
|
|
123
124
|
...e,
|
|
124
125
|
defaults: { ...e.defaults },
|
|
@@ -126,7 +127,7 @@ class R {
|
|
|
126
127
|
reporters: [...e.reporters || []]
|
|
127
128
|
},
|
|
128
129
|
{
|
|
129
|
-
types:
|
|
130
|
+
types: Jt,
|
|
130
131
|
throttle: 1e3,
|
|
131
132
|
throttleMin: 5,
|
|
132
133
|
formatOptions: {
|
|
@@ -308,7 +309,7 @@ class R {
|
|
|
308
309
|
*/
|
|
309
310
|
resumeLogs() {
|
|
310
311
|
ot = !1;
|
|
311
|
-
const e =
|
|
312
|
+
const e = Vt.splice(0);
|
|
312
313
|
for (const t of e)
|
|
313
314
|
t[0]._logFn(t[1], t[2]);
|
|
314
315
|
}
|
|
@@ -326,7 +327,7 @@ class R {
|
|
|
326
327
|
_wrapLogFn(e, t) {
|
|
327
328
|
return (...n) => {
|
|
328
329
|
if (ot) {
|
|
329
|
-
|
|
330
|
+
Vt.push([this, e, n, t]);
|
|
330
331
|
return;
|
|
331
332
|
}
|
|
332
333
|
return this._logFn(e, n, t);
|
|
@@ -341,7 +342,7 @@ class R {
|
|
|
341
342
|
...e,
|
|
342
343
|
level: at(e.level, this.options.types)
|
|
343
344
|
};
|
|
344
|
-
!n && t.length === 1 &&
|
|
345
|
+
!n && t.length === 1 && Sn(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(`
|
|
345
346
|
`)), i.args.push(`
|
|
346
347
|
` + i.additional.join(`
|
|
347
348
|
`)), delete i.additional), i.type = typeof i.type == "string" ? i.type.toLowerCase() : "log", i.tag = typeof i.tag == "string" ? i.tag : "";
|
|
@@ -390,10 +391,10 @@ R.prototype.withScope = R.prototype.withTag;
|
|
|
390
391
|
R.prototype.mock = R.prototype.mockTypes;
|
|
391
392
|
R.prototype.pause = R.prototype.pauseLogs;
|
|
392
393
|
R.prototype.resume = R.prototype.resumeLogs;
|
|
393
|
-
function
|
|
394
|
+
function vn(s = {}) {
|
|
394
395
|
return new R(s);
|
|
395
396
|
}
|
|
396
|
-
class
|
|
397
|
+
class Nn {
|
|
397
398
|
options;
|
|
398
399
|
defaultColor;
|
|
399
400
|
levelColorMap;
|
|
@@ -431,28 +432,28 @@ class Sn {
|
|
|
431
432
|
) : t(a, o, ...e.args);
|
|
432
433
|
}
|
|
433
434
|
}
|
|
434
|
-
function
|
|
435
|
-
return
|
|
436
|
-
reporters: s.reporters || [new
|
|
435
|
+
function In(s = {}) {
|
|
436
|
+
return vn({
|
|
437
|
+
reporters: s.reporters || [new Nn({})],
|
|
437
438
|
prompt(t, n = {}) {
|
|
438
439
|
return n.type === "confirm" ? Promise.resolve(confirm(t)) : Promise.resolve(prompt(t));
|
|
439
440
|
},
|
|
440
441
|
...s
|
|
441
442
|
});
|
|
442
443
|
}
|
|
443
|
-
const Ie =
|
|
444
|
-
env:
|
|
444
|
+
const Ie = In(), {
|
|
445
|
+
env: X = {},
|
|
445
446
|
argv: hs = [],
|
|
446
|
-
platform:
|
|
447
|
-
} = typeof process > "u" ? {} : process,
|
|
447
|
+
platform: Tn = ""
|
|
448
|
+
} = typeof process > "u" ? {} : process, On = "NO_COLOR" in X || hs.includes("--no-color"), _n = "FORCE_COLOR" in X || hs.includes("--color"), Cn = Tn === "win32", ps = X.TERM === "dumb", Ln = it && it.isatty && it.isatty(1) && X.TERM && !ps, An = "CI" in X && ("GITHUB_ACTIONS" in X || "GITLAB_CI" in X || "CIRCLECI" in X), En = !On && (_n || Cn && !ps || Ln || An);
|
|
448
449
|
function ms(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)) {
|
|
449
450
|
return i + (o < 0 ? r : ms(o, r, t, n));
|
|
450
451
|
}
|
|
451
|
-
function
|
|
452
|
+
function $n(s, e, t, n, i) {
|
|
452
453
|
return s < 0 ? t + e + n : t + ms(s, e, n, i) + n;
|
|
453
454
|
}
|
|
454
|
-
function
|
|
455
|
-
return (i) => i || !(i === "" || i === void 0) ?
|
|
455
|
+
function jn(s, e, t = s, n = s.length + 1) {
|
|
456
|
+
return (i) => i || !(i === "" || i === void 0) ? $n(
|
|
456
457
|
("" + i).indexOf(e, n),
|
|
457
458
|
i,
|
|
458
459
|
s,
|
|
@@ -461,9 +462,9 @@ function En(s, e, t = s, n = s.length + 1) {
|
|
|
461
462
|
) : "";
|
|
462
463
|
}
|
|
463
464
|
function T(s, e, t) {
|
|
464
|
-
return
|
|
465
|
+
return jn(`\x1B[${s}m`, `\x1B[${e}m`, t);
|
|
465
466
|
}
|
|
466
|
-
const
|
|
467
|
+
const Wt = {
|
|
467
468
|
reset: T(0, 0),
|
|
468
469
|
bold: T(1, 22, "\x1B[22m\x1B[1m"),
|
|
469
470
|
dim: T(2, 22, "\x1B[22m\x1B[2m"),
|
|
@@ -506,11 +507,11 @@ const Vt = {
|
|
|
506
507
|
bgCyanBright: T(106, 49),
|
|
507
508
|
bgWhiteBright: T(107, 49)
|
|
508
509
|
};
|
|
509
|
-
function
|
|
510
|
-
return s ?
|
|
510
|
+
function Rn(s = En) {
|
|
511
|
+
return s ? Wt : Object.fromEntries(Object.keys(Wt).map((e) => [e, String]));
|
|
511
512
|
}
|
|
512
|
-
const V =
|
|
513
|
-
function
|
|
513
|
+
const V = Rn();
|
|
514
|
+
function Pn(s) {
|
|
514
515
|
return Array.isArray(s) ? s : s === void 0 ? [] : [s];
|
|
515
516
|
}
|
|
516
517
|
function lt(s, e = "") {
|
|
@@ -533,13 +534,13 @@ class pe extends Error {
|
|
|
533
534
|
super(e), this.code = t, this.name = "CLIError";
|
|
534
535
|
}
|
|
535
536
|
}
|
|
536
|
-
const
|
|
537
|
-
function
|
|
538
|
-
if (!
|
|
537
|
+
const Un = /\d/, xn = ["-", "_", "/", "."];
|
|
538
|
+
function Mn(s = "") {
|
|
539
|
+
if (!Un.test(s))
|
|
539
540
|
return s !== s.toLowerCase();
|
|
540
541
|
}
|
|
541
542
|
function gs(s, e) {
|
|
542
|
-
const t =
|
|
543
|
+
const t = xn, n = [];
|
|
543
544
|
if (!s || typeof s != "string")
|
|
544
545
|
return n;
|
|
545
546
|
let i = "", r, o;
|
|
@@ -549,15 +550,15 @@ function gs(s, e) {
|
|
|
549
550
|
n.push(i), i = "", r = void 0;
|
|
550
551
|
continue;
|
|
551
552
|
}
|
|
552
|
-
const c =
|
|
553
|
+
const c = Mn(a);
|
|
553
554
|
if (o === !1) {
|
|
554
555
|
if (r === !1 && c === !0) {
|
|
555
556
|
n.push(i), i = a, r = c;
|
|
556
557
|
continue;
|
|
557
558
|
}
|
|
558
559
|
if (r === !0 && c === !1 && i.length > 1) {
|
|
559
|
-
const
|
|
560
|
-
n.push(i.slice(0, Math.max(0, i.length - 1))), i =
|
|
560
|
+
const u = i.at(-1);
|
|
561
|
+
n.push(i.slice(0, Math.max(0, i.length - 1))), i = u + a, r = c;
|
|
561
562
|
continue;
|
|
562
563
|
}
|
|
563
564
|
}
|
|
@@ -565,35 +566,35 @@ function gs(s, e) {
|
|
|
565
566
|
}
|
|
566
567
|
return n.push(i), n;
|
|
567
568
|
}
|
|
568
|
-
function
|
|
569
|
+
function Dn(s) {
|
|
569
570
|
return s ? s[0].toUpperCase() + s.slice(1) : "";
|
|
570
571
|
}
|
|
571
|
-
function
|
|
572
|
+
function Bn(s) {
|
|
572
573
|
return s ? s[0].toLowerCase() + s.slice(1) : "";
|
|
573
574
|
}
|
|
574
|
-
function
|
|
575
|
-
return s ? (Array.isArray(s) ? s : gs(s)).map((t) =>
|
|
575
|
+
function qn(s, e) {
|
|
576
|
+
return s ? (Array.isArray(s) ? s : gs(s)).map((t) => Dn(t)).join("") : "";
|
|
576
577
|
}
|
|
577
|
-
function
|
|
578
|
-
return
|
|
578
|
+
function Kn(s, e) {
|
|
579
|
+
return Bn(qn(s || ""));
|
|
579
580
|
}
|
|
580
|
-
function
|
|
581
|
+
function Fn(s, e) {
|
|
581
582
|
return s ? (Array.isArray(s) ? s : gs(s)).map((t) => t.toLowerCase()).join("-") : "";
|
|
582
583
|
}
|
|
583
584
|
function ct(s) {
|
|
584
585
|
return s == null ? [] : Array.isArray(s) ? s : [s];
|
|
585
586
|
}
|
|
586
|
-
function
|
|
587
|
+
function Jn(s, e, t, n) {
|
|
587
588
|
let i;
|
|
588
589
|
const r = s[e], o = ~n.string.indexOf(e) ? t == null || t === !0 ? "" : String(t) : typeof t == "boolean" ? t : ~n.boolean.indexOf(e) ? t === "false" ? !1 : t === "true" || (s._.push((i = +t, i * 0 === 0 ? i : t)), !!t) : (i = +t, i * 0 === 0 ? i : t);
|
|
589
590
|
s[e] = r == null ? o : Array.isArray(r) ? r.concat(o) : [r, o];
|
|
590
591
|
}
|
|
591
|
-
function
|
|
592
|
+
function Vn(s = [], e = {}) {
|
|
592
593
|
let t, n, i, r, o;
|
|
593
594
|
const a = { _: [] };
|
|
594
|
-
let l = 0, c = 0,
|
|
595
|
-
const
|
|
596
|
-
if (e.alias = e.alias || {}, e.string = ct(e.string), e.boolean = ct(e.boolean),
|
|
595
|
+
let l = 0, c = 0, u = 0;
|
|
596
|
+
const f = s.length, d = e.alias !== void 0, p = e.unknown !== void 0, g = e.default !== void 0;
|
|
597
|
+
if (e.alias = e.alias || {}, e.string = ct(e.string), e.boolean = ct(e.boolean), d)
|
|
597
598
|
for (t in e.alias)
|
|
598
599
|
for (n = e.alias[t] = ct(e.alias[t]), l = 0; l < n.length; l++)
|
|
599
600
|
(e.alias[n[l]] = n.concat(t)).splice(l, 1);
|
|
@@ -610,7 +611,7 @@ function Fn(s = [], e = {}) {
|
|
|
610
611
|
e[r].push(n[l]);
|
|
611
612
|
}
|
|
612
613
|
const h = p ? Object.keys(e.alias) : [];
|
|
613
|
-
for (l = 0; l <
|
|
614
|
+
for (l = 0; l < f; l++) {
|
|
614
615
|
if (i = s[l], i === "--") {
|
|
615
616
|
a._ = a._.concat(s.slice(++l));
|
|
616
617
|
break;
|
|
@@ -624,25 +625,25 @@ function Fn(s = [], e = {}) {
|
|
|
624
625
|
return e.unknown(i);
|
|
625
626
|
a[r] = !1;
|
|
626
627
|
} else {
|
|
627
|
-
for (
|
|
628
|
+
for (u = c + 1; u < i.length && i.charCodeAt(u) !== 61; u++)
|
|
628
629
|
;
|
|
629
|
-
for (r = i.substring(c,
|
|
630
|
-
if (r = n[
|
|
630
|
+
for (r = i.substring(c, u), o = i.slice(Math.max(0, ++u)) || l + 1 === f || ("" + s[l + 1]).charCodeAt(0) === 45 || s[++l], n = c === 2 ? [r] : r, u = 0; u < n.length; u++) {
|
|
631
|
+
if (r = n[u], p && !~h.indexOf(r))
|
|
631
632
|
return e.unknown("-".repeat(c) + r);
|
|
632
|
-
|
|
633
|
+
Jn(a, r, u + 1 < n.length || o, e);
|
|
633
634
|
}
|
|
634
635
|
}
|
|
635
636
|
}
|
|
636
637
|
if (g)
|
|
637
638
|
for (t in e.default)
|
|
638
639
|
a[t] === void 0 && (a[t] = e.default[t]);
|
|
639
|
-
if (
|
|
640
|
+
if (d)
|
|
640
641
|
for (t in a)
|
|
641
642
|
for (n = e.alias[t] || []; n.length > 0; )
|
|
642
643
|
a[n.shift()] = a[t];
|
|
643
644
|
return a;
|
|
644
645
|
}
|
|
645
|
-
function
|
|
646
|
+
function Wn(s, e) {
|
|
646
647
|
const t = {
|
|
647
648
|
boolean: [],
|
|
648
649
|
string: [],
|
|
@@ -652,9 +653,9 @@ function Jn(s, e) {
|
|
|
652
653
|
}, n = ys(e);
|
|
653
654
|
for (const a of n)
|
|
654
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));
|
|
655
|
-
const i =
|
|
656
|
+
const i = Vn(s, t), [...r] = i._, o = new Proxy(i, {
|
|
656
657
|
get(a, l) {
|
|
657
|
-
return a[l] ?? a[
|
|
658
|
+
return a[l] ?? a[Kn(l)] ?? a[Fn(l)];
|
|
658
659
|
}
|
|
659
660
|
});
|
|
660
661
|
for (const [, a] of n.entries())
|
|
@@ -680,12 +681,12 @@ function ys(s) {
|
|
|
680
681
|
e.push({
|
|
681
682
|
...n,
|
|
682
683
|
name: t,
|
|
683
|
-
alias:
|
|
684
|
+
alias: Pn(n.alias)
|
|
684
685
|
});
|
|
685
686
|
return e;
|
|
686
687
|
}
|
|
687
688
|
async function ks(s, e) {
|
|
688
|
-
const t = await K(s.args || {}), n =
|
|
689
|
+
const t = await K(s.args || {}), n = Wn(e.rawArgs, t), i = {
|
|
689
690
|
rawArgs: e.rawArgs,
|
|
690
691
|
args: n,
|
|
691
692
|
data: e.data,
|
|
@@ -733,13 +734,13 @@ async function kt(s, e, t) {
|
|
|
733
734
|
}
|
|
734
735
|
async function ws(s, e) {
|
|
735
736
|
try {
|
|
736
|
-
Ie.log(await
|
|
737
|
+
Ie.log(await Yn(s, e) + `
|
|
737
738
|
`);
|
|
738
739
|
} catch (t) {
|
|
739
740
|
Ie.error(t);
|
|
740
741
|
}
|
|
741
742
|
}
|
|
742
|
-
async function
|
|
743
|
+
async function Yn(s, e) {
|
|
743
744
|
const t = await K(s.meta || {}), n = ys(await K(s.args || {})), i = await K(e?.meta || {}), r = `${i.name ? `${i.name} ` : ""}` + (t.name || process.argv[1]), o = [], a = [], l = [], c = [];
|
|
744
745
|
for (const p of n)
|
|
745
746
|
if (p.type === "positional") {
|
|
@@ -769,24 +770,24 @@ async function Vn(s, e) {
|
|
|
769
770
|
}
|
|
770
771
|
c.push(p.join("|"));
|
|
771
772
|
}
|
|
772
|
-
const
|
|
773
|
-
|
|
773
|
+
const u = [], f = t.version || i.version;
|
|
774
|
+
u.push(
|
|
774
775
|
V.gray(
|
|
775
|
-
`${t.description} (${r + (
|
|
776
|
+
`${t.description} (${r + (f ? ` v${f}` : "")})`
|
|
776
777
|
),
|
|
777
778
|
""
|
|
778
779
|
);
|
|
779
|
-
const
|
|
780
|
-
return
|
|
781
|
-
`${V.underline(V.bold("USAGE"))} \`${r}${
|
|
780
|
+
const d = o.length > 0 || a.length > 0;
|
|
781
|
+
return u.push(
|
|
782
|
+
`${V.underline(V.bold("USAGE"))} \`${r}${d ? " [OPTIONS]" : ""} ${c.join(" ")}\``,
|
|
782
783
|
""
|
|
783
|
-
), a.length > 0 && (
|
|
784
|
+
), a.length > 0 && (u.push(V.underline(V.bold("ARGUMENTS")), ""), u.push(lt(a, " ")), u.push("")), o.length > 0 && (u.push(V.underline(V.bold("OPTIONS")), ""), u.push(lt(o, " ")), u.push("")), l.length > 0 && (u.push(V.underline(V.bold("COMMANDS")), ""), u.push(lt(l, " ")), u.push(
|
|
784
785
|
"",
|
|
785
786
|
`Use \`${r} <command> --help\` for more information about a command.`
|
|
786
|
-
)),
|
|
787
|
+
)), u.filter((p) => typeof p == "string").join(`
|
|
787
788
|
`);
|
|
788
789
|
}
|
|
789
|
-
async function
|
|
790
|
+
async function Hn(s, e = {}) {
|
|
790
791
|
const t = e.rawArgs || process.argv.slice(2), n = e.showUsage || ws;
|
|
791
792
|
try {
|
|
792
793
|
if (t.includes("--help") || t.includes("-h"))
|
|
@@ -804,42 +805,42 @@ async function Wn(s, e = {}) {
|
|
|
804
805
|
`), r && await n(...await kt(s, t)), Ie.error(i.message), process.exit(1);
|
|
805
806
|
}
|
|
806
807
|
}
|
|
807
|
-
const
|
|
808
|
+
const Ot = "auth.json";
|
|
808
809
|
function He() {
|
|
809
|
-
const s = process.env.XDG_CONFIG_HOME ?? C(
|
|
810
|
+
const s = process.env.XDG_CONFIG_HOME ?? C(hn(), ".config");
|
|
810
811
|
return C(s, "taskless");
|
|
811
812
|
}
|
|
812
813
|
async function Ge() {
|
|
813
814
|
const s = process.env.TASKLESS_TOKEN;
|
|
814
815
|
if (s) return s;
|
|
815
816
|
try {
|
|
816
|
-
const e = C(He(),
|
|
817
|
+
const e = C(He(), Ot), t = await Ee(e, "utf8");
|
|
817
818
|
return JSON.parse(t).access_token;
|
|
818
819
|
} catch {
|
|
819
820
|
return;
|
|
820
821
|
}
|
|
821
822
|
}
|
|
822
|
-
async function
|
|
823
|
+
async function Gn(s) {
|
|
823
824
|
const e = He();
|
|
824
825
|
await _e(e, { recursive: !0 });
|
|
825
|
-
const t = C(e,
|
|
826
|
+
const t = C(e, Ot);
|
|
826
827
|
await Ce(t, JSON.stringify(s, null, 2) + `
|
|
827
828
|
`, {
|
|
828
829
|
mode: 384
|
|
829
830
|
});
|
|
830
831
|
}
|
|
831
|
-
async function
|
|
832
|
+
async function zn() {
|
|
832
833
|
try {
|
|
833
|
-
const s = C(He(),
|
|
834
|
+
const s = C(He(), Ot);
|
|
834
835
|
return await gt(s), !0;
|
|
835
836
|
} catch {
|
|
836
837
|
return !1;
|
|
837
838
|
}
|
|
838
839
|
}
|
|
839
|
-
const
|
|
840
|
-
function
|
|
840
|
+
const Qn = "https://app.taskless.io/cli", Xn = "config.json";
|
|
841
|
+
function Zn() {
|
|
841
842
|
try {
|
|
842
|
-
const s = C(He(),
|
|
843
|
+
const s = C(He(), Xn), e = fn(s, "utf8");
|
|
843
844
|
return JSON.parse(e);
|
|
844
845
|
} catch {
|
|
845
846
|
return;
|
|
@@ -847,16 +848,16 @@ function Qn() {
|
|
|
847
848
|
}
|
|
848
849
|
function ne() {
|
|
849
850
|
if (process.env.TASKLESS_API_URL) return process.env.TASKLESS_API_URL;
|
|
850
|
-
const s =
|
|
851
|
-
return s?.apiUrl ? s.apiUrl :
|
|
851
|
+
const s = Zn();
|
|
852
|
+
return s?.apiUrl ? s.apiUrl : Qn;
|
|
852
853
|
}
|
|
853
|
-
const
|
|
854
|
-
class
|
|
854
|
+
const Yt = "taskless-cli";
|
|
855
|
+
class ei {
|
|
855
856
|
async requestDeviceCode() {
|
|
856
857
|
const e = ne(), t = await fetch(`${e}/auth/device`, {
|
|
857
858
|
method: "POST",
|
|
858
859
|
headers: { "Content-Type": "application/json" },
|
|
859
|
-
body: JSON.stringify({ client_id:
|
|
860
|
+
body: JSON.stringify({ client_id: Yt })
|
|
860
861
|
});
|
|
861
862
|
if (!t.ok) {
|
|
862
863
|
const n = await t.text().catch(() => "");
|
|
@@ -873,7 +874,7 @@ class Xn {
|
|
|
873
874
|
body: JSON.stringify({
|
|
874
875
|
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
875
876
|
device_code: e,
|
|
876
|
-
client_id:
|
|
877
|
+
client_id: Yt
|
|
877
878
|
})
|
|
878
879
|
});
|
|
879
880
|
if (!n.ok) {
|
|
@@ -902,7 +903,7 @@ class Xn {
|
|
|
902
903
|
};
|
|
903
904
|
}
|
|
904
905
|
}
|
|
905
|
-
const
|
|
906
|
+
const Ht = new ei(), ti = {
|
|
906
907
|
meta: {
|
|
907
908
|
name: "login",
|
|
908
909
|
description: "Authenticate with taskless.io"
|
|
@@ -913,7 +914,7 @@ const Yt = new Xn(), Zn = {
|
|
|
913
914
|
return;
|
|
914
915
|
}
|
|
915
916
|
try {
|
|
916
|
-
const e = await
|
|
917
|
+
const e = await Ht.requestDeviceCode();
|
|
917
918
|
console.log(`
|
|
918
919
|
Open this URL in your browser:
|
|
919
920
|
`), console.log(
|
|
@@ -925,12 +926,12 @@ Open this URL in your browser:
|
|
|
925
926
|
let i = t;
|
|
926
927
|
for (; Date.now() < n; ) {
|
|
927
928
|
await new Promise((o) => setTimeout(o, i));
|
|
928
|
-
const r = await
|
|
929
|
+
const r = await Ht.pollForToken(
|
|
929
930
|
e.device_code
|
|
930
931
|
);
|
|
931
932
|
switch (r.status) {
|
|
932
933
|
case "success": {
|
|
933
|
-
await
|
|
934
|
+
await Gn(r.token), console.log("Logged in successfully.");
|
|
934
935
|
return;
|
|
935
936
|
}
|
|
936
937
|
case "slow_down": {
|
|
@@ -956,26 +957,26 @@ Open this URL in your browser:
|
|
|
956
957
|
), process.exitCode = 1;
|
|
957
958
|
}
|
|
958
959
|
}
|
|
959
|
-
},
|
|
960
|
+
}, si = {
|
|
960
961
|
meta: {
|
|
961
962
|
name: "logout",
|
|
962
963
|
description: "Remove saved authentication"
|
|
963
964
|
},
|
|
964
965
|
async run() {
|
|
965
|
-
const s = await
|
|
966
|
+
const s = await zn();
|
|
966
967
|
console.log(s ? "Logged out." : "Not logged in.");
|
|
967
968
|
}
|
|
968
|
-
},
|
|
969
|
+
}, ni = {
|
|
969
970
|
meta: {
|
|
970
971
|
name: "auth",
|
|
971
972
|
description: "Manage authentication with taskless.io"
|
|
972
973
|
},
|
|
973
974
|
subCommands: {
|
|
974
|
-
login:
|
|
975
|
-
logout:
|
|
975
|
+
login: ti,
|
|
976
|
+
logout: si
|
|
976
977
|
}
|
|
977
978
|
};
|
|
978
|
-
function
|
|
979
|
+
function ii(s) {
|
|
979
980
|
return {
|
|
980
981
|
source: "ast-grep",
|
|
981
982
|
ruleId: s.ruleId,
|
|
@@ -991,53 +992,65 @@ function si(s) {
|
|
|
991
992
|
fix: s.replacement
|
|
992
993
|
};
|
|
993
994
|
}
|
|
994
|
-
function
|
|
995
|
-
const s =
|
|
995
|
+
function ri() {
|
|
996
|
+
const s = Tt(yn(import.meta.url)), e = H(s, "..", "node_modules", ".bin"), t = process.platform === "win32" ? ";" : ":";
|
|
996
997
|
return `${e}${t}${process.env.PATH ?? ""}`;
|
|
997
998
|
}
|
|
998
|
-
|
|
999
|
+
function oi() {
|
|
1000
|
+
const s = [process.platform, process.arch];
|
|
1001
|
+
process.platform === "linux" ? s.push("gnu") : process.platform === "win32" && s.push("msvc");
|
|
1002
|
+
const e = `@ast-grep/cli-${s.join("-")}`, t = process.platform === "win32" ? "ast-grep.exe" : "ast-grep";
|
|
1003
|
+
try {
|
|
1004
|
+
const i = pn(import.meta.url).resolve(`${e}/package.json`), r = H(Tt(i), t);
|
|
1005
|
+
if (dn(r))
|
|
1006
|
+
return r;
|
|
1007
|
+
} catch {
|
|
1008
|
+
}
|
|
1009
|
+
return "sg";
|
|
1010
|
+
}
|
|
1011
|
+
async function ai(s) {
|
|
999
1012
|
return new Promise((e, t) => {
|
|
1000
|
-
const n =
|
|
1001
|
-
|
|
1013
|
+
const n = oi(), r = mn(
|
|
1014
|
+
n,
|
|
1002
1015
|
["scan", "--config", ".taskless/sgconfig.yml", "--json=stream"],
|
|
1003
1016
|
{
|
|
1004
|
-
shell:
|
|
1017
|
+
shell: n === "sg",
|
|
1005
1018
|
cwd: s,
|
|
1006
1019
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1007
|
-
env: { ...process.env, PATH:
|
|
1020
|
+
env: { ...process.env, PATH: ri() }
|
|
1008
1021
|
}
|
|
1009
|
-
),
|
|
1010
|
-
|
|
1011
|
-
const
|
|
1012
|
-
if (
|
|
1022
|
+
), o = [], a = [];
|
|
1023
|
+
gn({ input: r.stdout }).on("line", (c) => {
|
|
1024
|
+
const u = c.trim();
|
|
1025
|
+
if (u !== "")
|
|
1013
1026
|
try {
|
|
1014
|
-
const
|
|
1015
|
-
|
|
1027
|
+
const f = JSON.parse(u);
|
|
1028
|
+
o.push(ii(f));
|
|
1016
1029
|
} catch {
|
|
1017
1030
|
}
|
|
1018
|
-
}),
|
|
1019
|
-
|
|
1020
|
-
}),
|
|
1021
|
-
"code" in
|
|
1031
|
+
}), r.stderr.on("data", (c) => {
|
|
1032
|
+
a.push(c.toString());
|
|
1033
|
+
}), r.on("error", (c) => {
|
|
1034
|
+
"code" in c && c.code === "ENOENT" ? t(
|
|
1022
1035
|
new Error(
|
|
1023
1036
|
"ast-grep (sg) binary not found. Is @ast-grep/cli installed?"
|
|
1024
1037
|
)
|
|
1025
|
-
) : t(
|
|
1026
|
-
}),
|
|
1027
|
-
if (
|
|
1028
|
-
const
|
|
1038
|
+
) : t(c);
|
|
1039
|
+
}), r.on("close", (c) => {
|
|
1040
|
+
if (c !== null && c > 1) {
|
|
1041
|
+
const u = a.join("");
|
|
1029
1042
|
t(
|
|
1030
1043
|
new Error(
|
|
1031
|
-
`ast-grep scan failed with exit code ${String(
|
|
1044
|
+
`ast-grep scan failed with exit code ${String(c)}${u ? `: ${u.trim()}` : ""}`
|
|
1032
1045
|
)
|
|
1033
1046
|
);
|
|
1034
1047
|
return;
|
|
1035
1048
|
}
|
|
1036
|
-
e({ results:
|
|
1049
|
+
e({ results: o, exitCode: c ?? 0 });
|
|
1037
1050
|
});
|
|
1038
1051
|
});
|
|
1039
1052
|
}
|
|
1040
|
-
function
|
|
1053
|
+
function li(s) {
|
|
1041
1054
|
if (s.length === 0)
|
|
1042
1055
|
return "No issues found.";
|
|
1043
1056
|
const e = [];
|
|
@@ -1064,7 +1077,7 @@ function ri(s) {
|
|
|
1064
1077
|
), e.join(`
|
|
1065
1078
|
`);
|
|
1066
1079
|
}
|
|
1067
|
-
function
|
|
1080
|
+
function z(s, e) {
|
|
1068
1081
|
const t = s.some((n) => n.severity === "error");
|
|
1069
1082
|
return JSON.stringify({
|
|
1070
1083
|
success: e?.success ?? !t,
|
|
@@ -1078,15 +1091,15 @@ function bs(s) {
|
|
|
1078
1091
|
const t = Number(e[2]), n = Number(e[3]);
|
|
1079
1092
|
return t >= 1 && t <= 12 && n >= 1 && n <= 31;
|
|
1080
1093
|
}
|
|
1081
|
-
const
|
|
1094
|
+
const _t = {
|
|
1082
1095
|
"rules create": "2026-03-02",
|
|
1083
1096
|
check: "2026-02-18"
|
|
1084
1097
|
};
|
|
1085
1098
|
function Ss(s, e) {
|
|
1086
|
-
const t =
|
|
1099
|
+
const t = _t[s];
|
|
1087
1100
|
return t ? e >= t : !0;
|
|
1088
1101
|
}
|
|
1089
|
-
const
|
|
1102
|
+
const ci = {
|
|
1090
1103
|
meta: {
|
|
1091
1104
|
name: "check",
|
|
1092
1105
|
description: "Run Taskless rules against your codebase"
|
|
@@ -1104,33 +1117,33 @@ const oi = {
|
|
|
1104
1117
|
}
|
|
1105
1118
|
},
|
|
1106
1119
|
async run({ args: s }) {
|
|
1107
|
-
const e =
|
|
1120
|
+
const e = H(s.dir ?? process.cwd()), t = C(e, ".taskless", "taskless.json");
|
|
1108
1121
|
if (!await fs(t).then((a) => a.isFile()).catch(() => !1)) {
|
|
1109
1122
|
const a = "Error: .taskless/taskless.json not found. Run `taskless init` to set up your project.";
|
|
1110
|
-
s.json ? console.log(
|
|
1123
|
+
s.json ? console.log(z([], { success: !1, error: a })) : console.error(a), process.exit(1);
|
|
1111
1124
|
}
|
|
1112
1125
|
let i;
|
|
1113
1126
|
try {
|
|
1114
1127
|
const a = await Ee(t, "utf8"), l = JSON.parse(a);
|
|
1115
1128
|
if (!l.version) {
|
|
1116
1129
|
const c = 'Error: .taskless/taskless.json is missing the "version" field.';
|
|
1117
|
-
s.json ? console.log(
|
|
1130
|
+
s.json ? console.log(z([], { success: !1, error: c })) : console.error(c), process.exit(1);
|
|
1118
1131
|
}
|
|
1119
1132
|
if (!bs(l.version)) {
|
|
1120
1133
|
const c = `Error: Invalid spec version "${l.version}" in .taskless/taskless.json. Expected YYYY-MM-DD format.`;
|
|
1121
|
-
s.json ? console.log(
|
|
1134
|
+
s.json ? console.log(z([], { success: !1, error: c })) : console.error(c), process.exit(1);
|
|
1122
1135
|
}
|
|
1123
1136
|
i = l.version;
|
|
1124
1137
|
} catch (a) {
|
|
1125
1138
|
if (a instanceof SyntaxError) {
|
|
1126
1139
|
const l = "Error: .taskless/taskless.json is not valid JSON.";
|
|
1127
|
-
s.json ? console.log(
|
|
1140
|
+
s.json ? console.log(z([], { success: !1, error: l })) : console.error(l), process.exit(1);
|
|
1128
1141
|
}
|
|
1129
1142
|
throw a;
|
|
1130
1143
|
}
|
|
1131
1144
|
if (!Ss("check", i)) {
|
|
1132
1145
|
const a = `Error: Scaffold version ${i} is below the minimum required for 'taskless check'. Run \`taskless update-engine\` to update.`;
|
|
1133
|
-
s.json ? console.log(
|
|
1146
|
+
s.json ? console.log(z([], { success: !1, error: a })) : console.error(a), process.exit(1);
|
|
1134
1147
|
}
|
|
1135
1148
|
const r = C(e, ".taskless", "rules");
|
|
1136
1149
|
let o = [];
|
|
@@ -1138,27 +1151,27 @@ const oi = {
|
|
|
1138
1151
|
o = (await ds(r)).filter((l) => l.endsWith(".yml"));
|
|
1139
1152
|
} catch {
|
|
1140
1153
|
}
|
|
1141
|
-
o.length === 0 && (s.json ? console.log(
|
|
1154
|
+
o.length === 0 && (s.json ? console.log(z([], { success: !0 })) : (console.warn(
|
|
1142
1155
|
"Warning: No rules found in .taskless/rules/. Nothing to check."
|
|
1143
1156
|
), console.warn(` directory: ${r}`), console.warn(
|
|
1144
1157
|
" If you expected rules here, check that your Taskless skills have generated .yml rule files."
|
|
1145
1158
|
)), process.exit(0));
|
|
1146
1159
|
try {
|
|
1147
|
-
const { results: a } = await
|
|
1160
|
+
const { results: a } = await ai(e), l = s.json ? z(a) : li(a);
|
|
1148
1161
|
console.log(l);
|
|
1149
|
-
const c = a.some((
|
|
1162
|
+
const c = a.some((u) => u.severity === "error");
|
|
1150
1163
|
process.exit(c ? 1 : 0);
|
|
1151
1164
|
} catch (a) {
|
|
1152
1165
|
const l = `Error: ${a instanceof Error ? a.message : String(a)}`;
|
|
1153
|
-
s.json ? console.log(
|
|
1166
|
+
s.json ? console.log(z([], { success: !1, error: l })) : console.error(l), process.exit(1);
|
|
1154
1167
|
}
|
|
1155
1168
|
}
|
|
1156
|
-
},
|
|
1169
|
+
}, ui = `---
|
|
1157
1170
|
name: taskless-check
|
|
1158
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".
|
|
1159
1172
|
metadata:
|
|
1160
1173
|
author: taskless
|
|
1161
|
-
version: 0.1.
|
|
1174
|
+
version: 0.1.3
|
|
1162
1175
|
commandName: taskless:check
|
|
1163
1176
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1164
1177
|
---
|
|
@@ -1176,12 +1189,12 @@ When this skill is invoked, perform a check of the codebase using the Taskless C
|
|
|
1176
1189
|
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.
|
|
1177
1190
|
|
|
1178
1191
|
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 \`taskless init\` if configuration is missing.
|
|
1179
|
-
`,
|
|
1192
|
+
`, fi = `---
|
|
1180
1193
|
name: taskless-info
|
|
1181
1194
|
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".
|
|
1182
1195
|
metadata:
|
|
1183
1196
|
author: taskless
|
|
1184
|
-
version: 0.1.
|
|
1197
|
+
version: 0.1.3
|
|
1185
1198
|
commandName: taskless:info
|
|
1186
1199
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1187
1200
|
---
|
|
@@ -1226,12 +1239,12 @@ When this skill is invoked, verify that the Taskless CLI is reachable and report
|
|
|
1226
1239
|
Taskless skills plugin is installed and working.
|
|
1227
1240
|
CLI version: 0.0.1
|
|
1228
1241
|
\`\`\`
|
|
1229
|
-
`,
|
|
1242
|
+
`, di = `---
|
|
1230
1243
|
name: taskless-login
|
|
1231
1244
|
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".
|
|
1232
1245
|
metadata:
|
|
1233
1246
|
author: taskless
|
|
1234
|
-
version: 0.1.
|
|
1247
|
+
version: 0.1.3
|
|
1235
1248
|
commandName: taskless:login
|
|
1236
1249
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1237
1250
|
---
|
|
@@ -1247,12 +1260,12 @@ When this skill is invoked, explain the authentication process and provide the C
|
|
|
1247
1260
|
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.
|
|
1248
1261
|
|
|
1249
1262
|
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).
|
|
1250
|
-
`,
|
|
1263
|
+
`, hi = `---
|
|
1251
1264
|
name: taskless-logout
|
|
1252
1265
|
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".
|
|
1253
1266
|
metadata:
|
|
1254
1267
|
author: taskless
|
|
1255
|
-
version: 0.1.
|
|
1268
|
+
version: 0.1.3
|
|
1256
1269
|
commandName: taskless:logout
|
|
1257
1270
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1258
1271
|
---
|
|
@@ -1268,12 +1281,12 @@ When this skill is invoked, explain how to remove saved authentication and provi
|
|
|
1268
1281
|
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.
|
|
1269
1282
|
|
|
1270
1283
|
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).
|
|
1271
|
-
`,
|
|
1284
|
+
`, pi = `---
|
|
1272
1285
|
name: taskless-rule-create
|
|
1273
1286
|
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".
|
|
1274
1287
|
metadata:
|
|
1275
1288
|
author: taskless
|
|
1276
|
-
version: 0.1.
|
|
1289
|
+
version: 0.1.3
|
|
1277
1290
|
commandName: taskless:rule
|
|
1278
1291
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1279
1292
|
---
|
|
@@ -1305,12 +1318,12 @@ When this skill is invoked, gather the necessary information from the user, writ
|
|
|
1305
1318
|
- **Missing config**: Suggest running \`taskless init\` to set up the project.
|
|
1306
1319
|
- **Stale scaffold version**: Suggest running \`taskless update-engine\` to update the \`.taskless/\` engine directory.
|
|
1307
1320
|
- **API errors**: Report the error message and suggest trying again.
|
|
1308
|
-
`,
|
|
1321
|
+
`, mi = `---
|
|
1309
1322
|
name: taskless-rule-delete
|
|
1310
1323
|
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".
|
|
1311
1324
|
metadata:
|
|
1312
1325
|
author: taskless
|
|
1313
|
-
version: 0.1.
|
|
1326
|
+
version: 0.1.3
|
|
1314
1327
|
commandName: "-"
|
|
1315
1328
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1316
1329
|
---
|
|
@@ -1340,12 +1353,12 @@ When this skill is invoked, help the user identify which rule to delete, confirm
|
|
|
1340
1353
|
6. **Report the result.** Confirm which files were deleted.
|
|
1341
1354
|
|
|
1342
1355
|
7. **Handle errors.** If the CLI reports the rule was not found, inform the user and suggest checking the rule ID.
|
|
1343
|
-
`,
|
|
1356
|
+
`, gi = `---
|
|
1344
1357
|
name: taskless-update-engine
|
|
1345
1358
|
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".
|
|
1346
1359
|
metadata:
|
|
1347
1360
|
author: taskless
|
|
1348
|
-
version: 0.1.
|
|
1361
|
+
version: 0.1.3
|
|
1349
1362
|
commandName: taskless:update-engine
|
|
1350
1363
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1351
1364
|
---
|
|
@@ -1377,7 +1390,7 @@ When this skill is invoked, run the update-engine CLI command to request a scaff
|
|
|
1377
1390
|
- **Authentication required**: Suggest running \`taskless auth login\` first.
|
|
1378
1391
|
- **Missing config**: Suggest running \`taskless init\` to set up the project.
|
|
1379
1392
|
- **API errors**: Report the error message and suggest trying again.
|
|
1380
|
-
`,
|
|
1393
|
+
`, yi = `---
|
|
1381
1394
|
name: "Taskless: Check"
|
|
1382
1395
|
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".
|
|
1383
1396
|
category: Taskless
|
|
@@ -1385,7 +1398,7 @@ tags:
|
|
|
1385
1398
|
- taskless
|
|
1386
1399
|
metadata:
|
|
1387
1400
|
author: taskless
|
|
1388
|
-
version: 0.1.
|
|
1401
|
+
version: 0.1.3
|
|
1389
1402
|
commandName: taskless:check
|
|
1390
1403
|
---
|
|
1391
1404
|
|
|
@@ -1402,7 +1415,7 @@ When this skill is invoked, perform a check of the codebase using the Taskless C
|
|
|
1402
1415
|
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.
|
|
1403
1416
|
|
|
1404
1417
|
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 \`taskless init\` if configuration is missing.
|
|
1405
|
-
`,
|
|
1418
|
+
`, ki = `---
|
|
1406
1419
|
name: "Taskless: Info"
|
|
1407
1420
|
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".
|
|
1408
1421
|
category: Taskless
|
|
@@ -1410,7 +1423,7 @@ tags:
|
|
|
1410
1423
|
- taskless
|
|
1411
1424
|
metadata:
|
|
1412
1425
|
author: taskless
|
|
1413
|
-
version: 0.1.
|
|
1426
|
+
version: 0.1.3
|
|
1414
1427
|
commandName: taskless:info
|
|
1415
1428
|
---
|
|
1416
1429
|
|
|
@@ -1454,7 +1467,7 @@ When this skill is invoked, verify that the Taskless CLI is reachable and report
|
|
|
1454
1467
|
Taskless skills plugin is installed and working.
|
|
1455
1468
|
CLI version: 0.0.1
|
|
1456
1469
|
\`\`\`
|
|
1457
|
-
`,
|
|
1470
|
+
`, wi = `---
|
|
1458
1471
|
name: "Taskless: Login"
|
|
1459
1472
|
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".
|
|
1460
1473
|
category: Taskless
|
|
@@ -1462,7 +1475,7 @@ tags:
|
|
|
1462
1475
|
- taskless
|
|
1463
1476
|
metadata:
|
|
1464
1477
|
author: taskless
|
|
1465
|
-
version: 0.1.
|
|
1478
|
+
version: 0.1.3
|
|
1466
1479
|
commandName: taskless:login
|
|
1467
1480
|
---
|
|
1468
1481
|
|
|
@@ -1477,7 +1490,7 @@ When this skill is invoked, explain the authentication process and provide the C
|
|
|
1477
1490
|
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.
|
|
1478
1491
|
|
|
1479
1492
|
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).
|
|
1480
|
-
`,
|
|
1493
|
+
`, bi = `---
|
|
1481
1494
|
name: "Taskless: Logout"
|
|
1482
1495
|
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".
|
|
1483
1496
|
category: Taskless
|
|
@@ -1485,7 +1498,7 @@ tags:
|
|
|
1485
1498
|
- taskless
|
|
1486
1499
|
metadata:
|
|
1487
1500
|
author: taskless
|
|
1488
|
-
version: 0.1.
|
|
1501
|
+
version: 0.1.3
|
|
1489
1502
|
commandName: taskless:logout
|
|
1490
1503
|
---
|
|
1491
1504
|
|
|
@@ -1500,7 +1513,7 @@ When this skill is invoked, explain how to remove saved authentication and provi
|
|
|
1500
1513
|
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.
|
|
1501
1514
|
|
|
1502
1515
|
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).
|
|
1503
|
-
`,
|
|
1516
|
+
`, Si = `---
|
|
1504
1517
|
name: "Taskless: Rule"
|
|
1505
1518
|
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".
|
|
1506
1519
|
category: Taskless
|
|
@@ -1508,7 +1521,7 @@ tags:
|
|
|
1508
1521
|
- taskless
|
|
1509
1522
|
metadata:
|
|
1510
1523
|
author: taskless
|
|
1511
|
-
version: 0.1.
|
|
1524
|
+
version: 0.1.3
|
|
1512
1525
|
commandName: taskless:rule
|
|
1513
1526
|
---
|
|
1514
1527
|
|
|
@@ -1539,7 +1552,7 @@ When this skill is invoked, gather the necessary information from the user, writ
|
|
|
1539
1552
|
- **Missing config**: Suggest running \`taskless init\` to set up the project.
|
|
1540
1553
|
- **Stale scaffold version**: Suggest running \`taskless update-engine\` to update the \`.taskless/\` engine directory.
|
|
1541
1554
|
- **API errors**: Report the error message and suggest trying again.
|
|
1542
|
-
`,
|
|
1555
|
+
`, vi = `---
|
|
1543
1556
|
name: "Taskless: Update Engine"
|
|
1544
1557
|
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".
|
|
1545
1558
|
category: Taskless
|
|
@@ -1547,7 +1560,7 @@ tags:
|
|
|
1547
1560
|
- taskless
|
|
1548
1561
|
metadata:
|
|
1549
1562
|
author: taskless
|
|
1550
|
-
version: 0.1.
|
|
1563
|
+
version: 0.1.3
|
|
1551
1564
|
commandName: taskless:update-engine
|
|
1552
1565
|
---
|
|
1553
1566
|
|
|
@@ -1578,11 +1591,11 @@ When this skill is invoked, run the update-engine CLI command to request a scaff
|
|
|
1578
1591
|
- **Authentication required**: Suggest running \`taskless auth login\` first.
|
|
1579
1592
|
- **Missing config**: Suggest running \`taskless init\` to set up the project.
|
|
1580
1593
|
- **API errors**: Report the error message and suggest trying again.
|
|
1581
|
-
`,
|
|
1594
|
+
`, Ct = /* @__PURE__ */ Symbol.for("yaml.alias"), wt = /* @__PURE__ */ Symbol.for("yaml.document"), Z = /* @__PURE__ */ Symbol.for("yaml.map"), vs = /* @__PURE__ */ Symbol.for("yaml.pair"), J = /* @__PURE__ */ Symbol.for("yaml.scalar"), ye = /* @__PURE__ */ Symbol.for("yaml.seq"), B = /* @__PURE__ */ Symbol.for("yaml.node.type"), re = (s) => !!s && typeof s == "object" && s[B] === Ct, $e = (s) => !!s && typeof s == "object" && s[B] === wt, je = (s) => !!s && typeof s == "object" && s[B] === Z, E = (s) => !!s && typeof s == "object" && s[B] === vs, _ = (s) => !!s && typeof s == "object" && s[B] === J, Re = (s) => !!s && typeof s == "object" && s[B] === ye;
|
|
1582
1595
|
function L(s) {
|
|
1583
1596
|
if (s && typeof s == "object")
|
|
1584
1597
|
switch (s[B]) {
|
|
1585
|
-
case
|
|
1598
|
+
case Z:
|
|
1586
1599
|
case ye:
|
|
1587
1600
|
return !0;
|
|
1588
1601
|
}
|
|
@@ -1591,26 +1604,26 @@ function L(s) {
|
|
|
1591
1604
|
function A(s) {
|
|
1592
1605
|
if (s && typeof s == "object")
|
|
1593
1606
|
switch (s[B]) {
|
|
1594
|
-
case
|
|
1595
|
-
case
|
|
1607
|
+
case Ct:
|
|
1608
|
+
case Z:
|
|
1596
1609
|
case J:
|
|
1597
1610
|
case ye:
|
|
1598
1611
|
return !0;
|
|
1599
1612
|
}
|
|
1600
1613
|
return !1;
|
|
1601
1614
|
}
|
|
1602
|
-
const Ns = (s) => (_(s) || L(s)) && !!s.anchor, ee = /* @__PURE__ */ Symbol("break visit"),
|
|
1615
|
+
const Ns = (s) => (_(s) || L(s)) && !!s.anchor, ee = /* @__PURE__ */ Symbol("break visit"), Ni = /* @__PURE__ */ Symbol("skip children"), Te = /* @__PURE__ */ Symbol("remove node");
|
|
1603
1616
|
function ke(s, e) {
|
|
1604
|
-
const t =
|
|
1617
|
+
const t = Ii(e);
|
|
1605
1618
|
$e(s) ? ce(null, s.contents, t, Object.freeze([s])) === Te && (s.contents = null) : ce(null, s, t, Object.freeze([]));
|
|
1606
1619
|
}
|
|
1607
1620
|
ke.BREAK = ee;
|
|
1608
|
-
ke.SKIP =
|
|
1621
|
+
ke.SKIP = Ni;
|
|
1609
1622
|
ke.REMOVE = Te;
|
|
1610
1623
|
function ce(s, e, t, n) {
|
|
1611
|
-
const i =
|
|
1624
|
+
const i = Ti(s, e, t, n);
|
|
1612
1625
|
if (A(i) || E(i))
|
|
1613
|
-
return
|
|
1626
|
+
return Oi(s, n, i), ce(s, i, t, n);
|
|
1614
1627
|
if (typeof i != "symbol") {
|
|
1615
1628
|
if (L(e)) {
|
|
1616
1629
|
n = Object.freeze(n.concat(e));
|
|
@@ -1638,7 +1651,7 @@ function ce(s, e, t, n) {
|
|
|
1638
1651
|
}
|
|
1639
1652
|
return i;
|
|
1640
1653
|
}
|
|
1641
|
-
function
|
|
1654
|
+
function Ii(s) {
|
|
1642
1655
|
return typeof s == "object" && (s.Collection || s.Node || s.Value) ? Object.assign({
|
|
1643
1656
|
Alias: s.Node,
|
|
1644
1657
|
Map: s.Node,
|
|
@@ -1653,7 +1666,7 @@ function Si(s) {
|
|
|
1653
1666
|
Seq: s.Collection
|
|
1654
1667
|
}, s) : s;
|
|
1655
1668
|
}
|
|
1656
|
-
function
|
|
1669
|
+
function Ti(s, e, t, n) {
|
|
1657
1670
|
if (typeof t == "function")
|
|
1658
1671
|
return t(s, e, n);
|
|
1659
1672
|
if (je(e))
|
|
@@ -1667,7 +1680,7 @@ function vi(s, e, t, n) {
|
|
|
1667
1680
|
if (re(e))
|
|
1668
1681
|
return t.Alias?.(s, e, n);
|
|
1669
1682
|
}
|
|
1670
|
-
function
|
|
1683
|
+
function Oi(s, e, t) {
|
|
1671
1684
|
const n = e[e.length - 1];
|
|
1672
1685
|
if (L(n))
|
|
1673
1686
|
n.items[s] = t;
|
|
@@ -1680,14 +1693,14 @@ function Ni(s, e, t) {
|
|
|
1680
1693
|
throw new Error(`Cannot replace node with ${i} parent`);
|
|
1681
1694
|
}
|
|
1682
1695
|
}
|
|
1683
|
-
const
|
|
1696
|
+
const _i = {
|
|
1684
1697
|
"!": "%21",
|
|
1685
1698
|
",": "%2C",
|
|
1686
1699
|
"[": "%5B",
|
|
1687
1700
|
"]": "%5D",
|
|
1688
1701
|
"{": "%7B",
|
|
1689
1702
|
"}": "%7D"
|
|
1690
|
-
},
|
|
1703
|
+
}, Ci = (s) => s.replace(/[!,[\]{}]/g, (e) => _i[e]);
|
|
1691
1704
|
class P {
|
|
1692
1705
|
constructor(e, t) {
|
|
1693
1706
|
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, P.defaultYaml, e), this.tags = Object.assign({}, P.defaultTags, t);
|
|
@@ -1777,7 +1790,7 @@ class P {
|
|
|
1777
1790
|
tagString(e) {
|
|
1778
1791
|
for (const [t, n] of Object.entries(this.tags))
|
|
1779
1792
|
if (e.startsWith(n))
|
|
1780
|
-
return t +
|
|
1793
|
+
return t + Ci(e.substring(n.length));
|
|
1781
1794
|
return e[0] === "!" ? e : `!<${e}>`;
|
|
1782
1795
|
}
|
|
1783
1796
|
toString(e) {
|
|
@@ -1820,7 +1833,7 @@ function Os(s, e) {
|
|
|
1820
1833
|
return n;
|
|
1821
1834
|
}
|
|
1822
1835
|
}
|
|
1823
|
-
function
|
|
1836
|
+
function Li(s, e) {
|
|
1824
1837
|
const t = [], n = /* @__PURE__ */ new Map();
|
|
1825
1838
|
let i = null;
|
|
1826
1839
|
return {
|
|
@@ -1887,7 +1900,7 @@ function D(s, e, t) {
|
|
|
1887
1900
|
}
|
|
1888
1901
|
return typeof s == "bigint" && !t?.keep ? Number(s) : s;
|
|
1889
1902
|
}
|
|
1890
|
-
class
|
|
1903
|
+
class Lt {
|
|
1891
1904
|
constructor(e) {
|
|
1892
1905
|
Object.defineProperty(this, B, { value: e });
|
|
1893
1906
|
}
|
|
@@ -1914,9 +1927,9 @@ class Ct {
|
|
|
1914
1927
|
return typeof r == "function" ? ue(r, { "": a }, "", a) : a;
|
|
1915
1928
|
}
|
|
1916
1929
|
}
|
|
1917
|
-
class
|
|
1930
|
+
class At extends Lt {
|
|
1918
1931
|
constructor(e) {
|
|
1919
|
-
super(
|
|
1932
|
+
super(Ct), this.source = e, Object.defineProperty(this, "tag", {
|
|
1920
1933
|
set() {
|
|
1921
1934
|
throw new Error("Alias nodes cannot have tags");
|
|
1922
1935
|
}
|
|
@@ -1991,7 +2004,7 @@ function Fe(s, e, t) {
|
|
|
1991
2004
|
return 1;
|
|
1992
2005
|
}
|
|
1993
2006
|
const _s = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
1994
|
-
class N extends
|
|
2007
|
+
class N extends Lt {
|
|
1995
2008
|
constructor(e) {
|
|
1996
2009
|
super(J), this.value = e;
|
|
1997
2010
|
}
|
|
@@ -2007,8 +2020,8 @@ N.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
|
2007
2020
|
N.PLAIN = "PLAIN";
|
|
2008
2021
|
N.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
2009
2022
|
N.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
2010
|
-
const
|
|
2011
|
-
function
|
|
2023
|
+
const Ai = "tag:yaml.org,2002:";
|
|
2024
|
+
function Ei(s, e, t) {
|
|
2012
2025
|
if (e) {
|
|
2013
2026
|
const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
|
|
2014
2027
|
if (!i)
|
|
@@ -2021,29 +2034,29 @@ function Le(s, e, t) {
|
|
|
2021
2034
|
if ($e(s) && (s = s.contents), A(s))
|
|
2022
2035
|
return s;
|
|
2023
2036
|
if (E(s)) {
|
|
2024
|
-
const
|
|
2025
|
-
return
|
|
2037
|
+
const f = t.schema[Z].createNode?.(t.schema, null, t);
|
|
2038
|
+
return f.items.push(s), f;
|
|
2026
2039
|
}
|
|
2027
2040
|
(s instanceof String || s instanceof Number || s instanceof Boolean || typeof BigInt < "u" && s instanceof BigInt) && (s = s.valueOf());
|
|
2028
2041
|
const { aliasDuplicateObjects: n, onAnchor: i, onTagObj: r, schema: o, sourceObjects: a } = t;
|
|
2029
2042
|
let l;
|
|
2030
2043
|
if (n && s && typeof s == "object") {
|
|
2031
2044
|
if (l = a.get(s), l)
|
|
2032
|
-
return l.anchor ?? (l.anchor = i(s)), new
|
|
2045
|
+
return l.anchor ?? (l.anchor = i(s)), new At(l.anchor);
|
|
2033
2046
|
l = { anchor: null, node: null }, a.set(s, l);
|
|
2034
2047
|
}
|
|
2035
|
-
e?.startsWith("!!") && (e =
|
|
2036
|
-
let c =
|
|
2048
|
+
e?.startsWith("!!") && (e = Ai + e.slice(2));
|
|
2049
|
+
let c = Ei(s, e, o.tags);
|
|
2037
2050
|
if (!c) {
|
|
2038
2051
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
2039
|
-
const
|
|
2040
|
-
return l && (l.node =
|
|
2052
|
+
const f = new N(s);
|
|
2053
|
+
return l && (l.node = f), f;
|
|
2041
2054
|
}
|
|
2042
|
-
c = s instanceof Map ? o[
|
|
2055
|
+
c = s instanceof Map ? o[Z] : Symbol.iterator in Object(s) ? o[ye] : o[Z];
|
|
2043
2056
|
}
|
|
2044
2057
|
r && (r(c), delete t.onTagObj);
|
|
2045
|
-
const
|
|
2046
|
-
return e ?
|
|
2058
|
+
const u = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new N(s);
|
|
2059
|
+
return e ? u.tag = e : c.default || (u.tag = c.tag), l && (l.node = u), u;
|
|
2047
2060
|
}
|
|
2048
2061
|
function We(s, e, t) {
|
|
2049
2062
|
let n = t;
|
|
@@ -2066,7 +2079,7 @@ function We(s, e, t) {
|
|
|
2066
2079
|
});
|
|
2067
2080
|
}
|
|
2068
2081
|
const ve = (s) => s == null || typeof s == "object" && !!s[Symbol.iterator]().next().done;
|
|
2069
|
-
class Cs extends
|
|
2082
|
+
class Cs extends Lt {
|
|
2070
2083
|
constructor(e, t) {
|
|
2071
2084
|
super(e), Object.defineProperty(this, "schema", {
|
|
2072
2085
|
value: t,
|
|
@@ -2161,7 +2174,7 @@ class Cs extends Ct {
|
|
|
2161
2174
|
}
|
|
2162
2175
|
}
|
|
2163
2176
|
}
|
|
2164
|
-
const
|
|
2177
|
+
const $i = (s) => s.replace(/^(?!$)(?: $)?/gm, "#");
|
|
2165
2178
|
function W(s, e) {
|
|
2166
2179
|
return /^\n+$/.test(s) ? s.substring(1) : e ? s.replace(/^(?! *$)/gm, e) : s;
|
|
2167
2180
|
}
|
|
@@ -2176,11 +2189,11 @@ function ze(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
2176
2189
|
const l = Math.max(1 + r, 1 + i - e.length);
|
|
2177
2190
|
if (s.length <= l)
|
|
2178
2191
|
return s;
|
|
2179
|
-
const c = [],
|
|
2180
|
-
let
|
|
2181
|
-
typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) :
|
|
2182
|
-
let
|
|
2183
|
-
t === bt && (h =
|
|
2192
|
+
const c = [], u = {};
|
|
2193
|
+
let f = i - e.length;
|
|
2194
|
+
typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
|
|
2195
|
+
let d, p, g = !1, h = -1, m = -1, k = -1;
|
|
2196
|
+
t === bt && (h = Gt(s, h, e.length), h !== -1 && (f = h + l));
|
|
2184
2197
|
for (let b; b = s[h += 1]; ) {
|
|
2185
2198
|
if (t === Je && b === "\\") {
|
|
2186
2199
|
switch (m = h, s[h + 1]) {
|
|
@@ -2200,24 +2213,24 @@ function ze(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
2200
2213
|
}
|
|
2201
2214
|
if (b === `
|
|
2202
2215
|
`)
|
|
2203
|
-
t === bt && (h =
|
|
2216
|
+
t === bt && (h = Gt(s, h, e.length)), f = h + e.length + l, d = void 0;
|
|
2204
2217
|
else {
|
|
2205
2218
|
if (b === " " && p && p !== " " && p !== `
|
|
2206
2219
|
` && p !== " ") {
|
|
2207
2220
|
const S = s[h + 1];
|
|
2208
2221
|
S && S !== " " && S !== `
|
|
2209
|
-
` && S !== " " && (
|
|
2222
|
+
` && S !== " " && (d = h);
|
|
2210
2223
|
}
|
|
2211
|
-
if (h >=
|
|
2212
|
-
if (
|
|
2213
|
-
c.push(
|
|
2224
|
+
if (h >= f)
|
|
2225
|
+
if (d)
|
|
2226
|
+
c.push(d), f = d + l, d = void 0;
|
|
2214
2227
|
else if (t === Je) {
|
|
2215
2228
|
for (; p === " " || p === " "; )
|
|
2216
2229
|
p = b, b = s[h += 1], g = !0;
|
|
2217
2230
|
const S = h > k + 1 ? h - 2 : m - 1;
|
|
2218
|
-
if (
|
|
2231
|
+
if (u[S])
|
|
2219
2232
|
return s;
|
|
2220
|
-
c.push(S),
|
|
2233
|
+
c.push(S), u[S] = !0, f = S + l, d = void 0;
|
|
2221
2234
|
} else
|
|
2222
2235
|
g = !0;
|
|
2223
2236
|
}
|
|
@@ -2230,12 +2243,12 @@ function ze(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
2230
2243
|
for (let b = 0; b < c.length; ++b) {
|
|
2231
2244
|
const S = c[b], v = c[b + 1] || s.length;
|
|
2232
2245
|
S === 0 ? w = `
|
|
2233
|
-
${e}${s.slice(0, v)}` : (t === Je &&
|
|
2246
|
+
${e}${s.slice(0, v)}` : (t === Je && u[S] && (w += `${s[S]}\\`), w += `
|
|
2234
2247
|
${e}${s.slice(S + 1, v)}`);
|
|
2235
2248
|
}
|
|
2236
2249
|
return w;
|
|
2237
2250
|
}
|
|
2238
|
-
function
|
|
2251
|
+
function Gt(s, e, t) {
|
|
2239
2252
|
let n = e, i = e + 1, r = s[i];
|
|
2240
2253
|
for (; r === " " || r === " "; )
|
|
2241
2254
|
if (e < i + t)
|
|
@@ -2254,7 +2267,7 @@ const Qe = (s, e) => ({
|
|
|
2254
2267
|
lineWidth: s.options.lineWidth,
|
|
2255
2268
|
minContentWidth: s.options.minContentWidth
|
|
2256
2269
|
}), Xe = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
2257
|
-
function
|
|
2270
|
+
function ji(s, e, t) {
|
|
2258
2271
|
if (!e || e < 0)
|
|
2259
2272
|
return !1;
|
|
2260
2273
|
const n = e - t, i = s.length;
|
|
@@ -2282,8 +2295,8 @@ function Oe(s, e) {
|
|
|
2282
2295
|
case "u":
|
|
2283
2296
|
{
|
|
2284
2297
|
o += t.slice(a, l);
|
|
2285
|
-
const
|
|
2286
|
-
switch (
|
|
2298
|
+
const u = t.substr(l + 2, 4);
|
|
2299
|
+
switch (u) {
|
|
2287
2300
|
case "0000":
|
|
2288
2301
|
o += "\\0";
|
|
2289
2302
|
break;
|
|
@@ -2309,7 +2322,7 @@ function Oe(s, e) {
|
|
|
2309
2322
|
o += "\\P";
|
|
2310
2323
|
break;
|
|
2311
2324
|
default:
|
|
2312
|
-
|
|
2325
|
+
u.substr(0, 2) === "00" ? o += "\\x" + u.substr(2) : o += t.substr(l, 6);
|
|
2313
2326
|
}
|
|
2314
2327
|
l += 5, a = l + 1;
|
|
2315
2328
|
}
|
|
@@ -2363,22 +2376,22 @@ function Ve({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
2363
2376
|
const { blockQuote: o, commentString: a, lineWidth: l } = n.options;
|
|
2364
2377
|
if (!o || /\n[\t ]+$/.test(t))
|
|
2365
2378
|
return fe(t, n);
|
|
2366
|
-
const c = n.indent || (n.forceBlockIndent || Xe(t) ? " " : ""),
|
|
2379
|
+
const c = n.indent || (n.forceBlockIndent || Xe(t) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || e === N.BLOCK_FOLDED ? !1 : e === N.BLOCK_LITERAL ? !0 : !ji(t, l, c.length);
|
|
2367
2380
|
if (!t)
|
|
2368
|
-
return
|
|
2381
|
+
return u ? `|
|
|
2369
2382
|
` : `>
|
|
2370
2383
|
`;
|
|
2371
|
-
let
|
|
2372
|
-
for (
|
|
2373
|
-
const v = t[
|
|
2384
|
+
let f, d;
|
|
2385
|
+
for (d = t.length; d > 0; --d) {
|
|
2386
|
+
const v = t[d - 1];
|
|
2374
2387
|
if (v !== `
|
|
2375
2388
|
` && v !== " " && v !== " ")
|
|
2376
2389
|
break;
|
|
2377
2390
|
}
|
|
2378
|
-
let p = t.substring(
|
|
2391
|
+
let p = t.substring(d);
|
|
2379
2392
|
const g = p.indexOf(`
|
|
2380
2393
|
`);
|
|
2381
|
-
g === -1 ?
|
|
2394
|
+
g === -1 ? f = "-" : t === p || g !== p.length - 1 ? (f = "+", r && r()) : f = "", p && (t = t.slice(0, -p.length), p[p.length - 1] === `
|
|
2382
2395
|
` && (p = p.slice(0, -1)), p = p.replace(vt, `$&${c}`));
|
|
2383
2396
|
let h = !1, m, k = -1;
|
|
2384
2397
|
for (m = 0; m < t.length; ++m) {
|
|
@@ -2393,8 +2406,8 @@ function Ve({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
2393
2406
|
}
|
|
2394
2407
|
let w = t.substring(0, k < m ? k + 1 : m);
|
|
2395
2408
|
w && (t = t.substring(w.length), w = w.replace(/\n+/g, `$&${c}`));
|
|
2396
|
-
let S = (h ? c ? "2" : "1" : "") +
|
|
2397
|
-
if (s && (S += " " + a(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !
|
|
2409
|
+
let S = (h ? c ? "2" : "1" : "") + f;
|
|
2410
|
+
if (s && (S += " " + a(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !u) {
|
|
2398
2411
|
const v = t.replace(/\n+/g, `
|
|
2399
2412
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
2400
2413
|
let I = !1;
|
|
@@ -2410,15 +2423,15 @@ ${c}${y}`;
|
|
|
2410
2423
|
return t = t.replace(/\n+/g, `$&${c}`), `|${S}
|
|
2411
2424
|
${c}${w}${t}${p}`;
|
|
2412
2425
|
}
|
|
2413
|
-
function
|
|
2414
|
-
const { type: i, value: r } = s, { actualString: o, implicitKey: a, indent: l, indentStep: c, inFlow:
|
|
2426
|
+
function Ri(s, e, t, n) {
|
|
2427
|
+
const { type: i, value: r } = s, { actualString: o, implicitKey: a, indent: l, indentStep: c, inFlow: u } = e;
|
|
2415
2428
|
if (a && r.includes(`
|
|
2416
|
-
`) ||
|
|
2429
|
+
`) || u && /[[\]{},]/.test(r))
|
|
2417
2430
|
return fe(r, e);
|
|
2418
2431
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
2419
|
-
return a ||
|
|
2432
|
+
return a || u || !r.includes(`
|
|
2420
2433
|
`) ? fe(r, e) : Ve(s, e, t, n);
|
|
2421
|
-
if (!a && !
|
|
2434
|
+
if (!a && !u && i !== N.PLAIN && r.includes(`
|
|
2422
2435
|
`))
|
|
2423
2436
|
return Ve(s, e, t, n);
|
|
2424
2437
|
if (Xe(r)) {
|
|
@@ -2427,21 +2440,21 @@ function Ei(s, e, t, n) {
|
|
|
2427
2440
|
if (a && l === c)
|
|
2428
2441
|
return fe(r, e);
|
|
2429
2442
|
}
|
|
2430
|
-
const
|
|
2443
|
+
const f = r.replace(/\n+/g, `$&
|
|
2431
2444
|
${l}`);
|
|
2432
2445
|
if (o) {
|
|
2433
|
-
const
|
|
2434
|
-
if (g.some(
|
|
2446
|
+
const d = (h) => h.default && h.tag !== "tag:yaml.org,2002:str" && h.test?.test(f), { compat: p, tags: g } = e.doc.schema;
|
|
2447
|
+
if (g.some(d) || p?.some(d))
|
|
2435
2448
|
return fe(r, e);
|
|
2436
2449
|
}
|
|
2437
|
-
return a ?
|
|
2450
|
+
return a ? f : ze(f, l, Ls, Qe(e, !1));
|
|
2438
2451
|
}
|
|
2439
|
-
function
|
|
2452
|
+
function Et(s, e, t, n) {
|
|
2440
2453
|
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
2441
2454
|
let { type: a } = s;
|
|
2442
2455
|
a !== N.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (a = N.QUOTE_DOUBLE);
|
|
2443
|
-
const l = (
|
|
2444
|
-
switch (
|
|
2456
|
+
const l = (u) => {
|
|
2457
|
+
switch (u) {
|
|
2445
2458
|
case N.BLOCK_FOLDED:
|
|
2446
2459
|
case N.BLOCK_LITERAL:
|
|
2447
2460
|
return i || r ? fe(o.value, e) : Ve(o, e, t, n);
|
|
@@ -2450,23 +2463,23 @@ function At(s, e, t, n) {
|
|
|
2450
2463
|
case N.QUOTE_SINGLE:
|
|
2451
2464
|
return St(o.value, e);
|
|
2452
2465
|
case N.PLAIN:
|
|
2453
|
-
return
|
|
2466
|
+
return Ri(o, e, t, n);
|
|
2454
2467
|
default:
|
|
2455
2468
|
return null;
|
|
2456
2469
|
}
|
|
2457
2470
|
};
|
|
2458
2471
|
let c = l(a);
|
|
2459
2472
|
if (c === null) {
|
|
2460
|
-
const { defaultKeyType:
|
|
2461
|
-
if (c = l(
|
|
2462
|
-
throw new Error(`Unsupported default string type ${
|
|
2473
|
+
const { defaultKeyType: u, defaultStringType: f } = e.options, d = i && u || f;
|
|
2474
|
+
if (c = l(d), c === null)
|
|
2475
|
+
throw new Error(`Unsupported default string type ${d}`);
|
|
2463
2476
|
}
|
|
2464
2477
|
return c;
|
|
2465
2478
|
}
|
|
2466
2479
|
function As(s, e) {
|
|
2467
2480
|
const t = Object.assign({
|
|
2468
2481
|
blockQuote: !0,
|
|
2469
|
-
commentString:
|
|
2482
|
+
commentString: $i,
|
|
2470
2483
|
defaultKeyType: null,
|
|
2471
2484
|
defaultStringType: "PLAIN",
|
|
2472
2485
|
directives: null,
|
|
@@ -2504,7 +2517,7 @@ function As(s, e) {
|
|
|
2504
2517
|
options: t
|
|
2505
2518
|
};
|
|
2506
2519
|
}
|
|
2507
|
-
function
|
|
2520
|
+
function Pi(s, e) {
|
|
2508
2521
|
if (e.tag) {
|
|
2509
2522
|
const i = s.filter((r) => r.tag === e.tag);
|
|
2510
2523
|
if (i.length > 0)
|
|
@@ -2527,7 +2540,7 @@ function $i(s, e) {
|
|
|
2527
2540
|
}
|
|
2528
2541
|
return t;
|
|
2529
2542
|
}
|
|
2530
|
-
function
|
|
2543
|
+
function Ui(s, e, { anchors: t, doc: n }) {
|
|
2531
2544
|
if (!n.directives)
|
|
2532
2545
|
return "";
|
|
2533
2546
|
const i = [], r = (_(s) || L(s)) && s.anchor;
|
|
@@ -2547,49 +2560,49 @@ function me(s, e, t, n) {
|
|
|
2547
2560
|
}
|
|
2548
2561
|
let i;
|
|
2549
2562
|
const r = A(s) ? s : e.doc.createNode(s, { onTagObj: (l) => i = l });
|
|
2550
|
-
i ?? (i =
|
|
2551
|
-
const o =
|
|
2563
|
+
i ?? (i = Pi(e.doc.schema.tags, r));
|
|
2564
|
+
const o = Ui(r, i, e);
|
|
2552
2565
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
2553
|
-
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : _(r) ?
|
|
2566
|
+
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : _(r) ? Et(r, e, t, n) : r.toString(e, t, n);
|
|
2554
2567
|
return o ? _(r) || a[0] === "{" || a[0] === "[" ? `${o} ${a}` : `${o}
|
|
2555
2568
|
${e.indent}${a}` : a;
|
|
2556
2569
|
}
|
|
2557
|
-
function
|
|
2558
|
-
const { allNullValues: r, doc: o, indent: a, indentStep: l, options: { commentString: c, indentSeq:
|
|
2559
|
-
let
|
|
2560
|
-
if (
|
|
2561
|
-
if (
|
|
2570
|
+
function xi({ key: s, value: e }, t, n, i) {
|
|
2571
|
+
const { allNullValues: r, doc: o, indent: a, indentStep: l, options: { commentString: c, indentSeq: u, simpleKeys: f } } = t;
|
|
2572
|
+
let d = A(s) && s.comment || null;
|
|
2573
|
+
if (f) {
|
|
2574
|
+
if (d)
|
|
2562
2575
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
2563
2576
|
if (L(s) || !A(s) && typeof s == "object") {
|
|
2564
2577
|
const O = "With simple keys, collection cannot be used as a key value";
|
|
2565
2578
|
throw new Error(O);
|
|
2566
2579
|
}
|
|
2567
2580
|
}
|
|
2568
|
-
let p = !
|
|
2581
|
+
let p = !f && (!s || d && e == null && !t.inFlow || L(s) || (_(s) ? s.type === N.BLOCK_FOLDED || s.type === N.BLOCK_LITERAL : typeof s == "object"));
|
|
2569
2582
|
t = Object.assign({}, t, {
|
|
2570
2583
|
allNullValues: !1,
|
|
2571
|
-
implicitKey: !p && (
|
|
2584
|
+
implicitKey: !p && (f || !r),
|
|
2572
2585
|
indent: a + l
|
|
2573
2586
|
});
|
|
2574
2587
|
let g = !1, h = !1, m = me(s, t, () => g = !0, () => h = !0);
|
|
2575
2588
|
if (!p && !t.inFlow && m.length > 1024) {
|
|
2576
|
-
if (
|
|
2589
|
+
if (f)
|
|
2577
2590
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
2578
2591
|
p = !0;
|
|
2579
2592
|
}
|
|
2580
2593
|
if (t.inFlow) {
|
|
2581
2594
|
if (r || e == null)
|
|
2582
2595
|
return g && n && n(), m === "" ? "?" : p ? `? ${m}` : m;
|
|
2583
|
-
} else if (r && !
|
|
2584
|
-
return m = `? ${m}`,
|
|
2585
|
-
g && (
|
|
2586
|
-
${a}:`) : (m = `${m}:`,
|
|
2596
|
+
} else if (r && !f || e == null && p)
|
|
2597
|
+
return m = `? ${m}`, d && !g ? m += te(m, t.indent, c(d)) : h && i && i(), m;
|
|
2598
|
+
g && (d = null), p ? (d && (m += te(m, t.indent, c(d))), m = `? ${m}
|
|
2599
|
+
${a}:`) : (m = `${m}:`, d && (m += te(m, t.indent, c(d))));
|
|
2587
2600
|
let k, w, b;
|
|
2588
|
-
A(e) ? (k = !!e.spaceBefore, w = e.commentBefore, b = e.comment) : (k = !1, w = null, b = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !p && !
|
|
2601
|
+
A(e) ? (k = !!e.spaceBefore, w = e.commentBefore, b = e.comment) : (k = !1, w = null, b = null, e && typeof e == "object" && (e = o.createNode(e))), t.implicitKey = !1, !p && !d && _(e) && (t.indentAtStart = m.length + 1), h = !1, !u && l.length >= 2 && !t.inFlow && !p && Re(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
2589
2602
|
let S = !1;
|
|
2590
2603
|
const v = me(e, t, () => S = !0, () => h = !0);
|
|
2591
2604
|
let I = " ";
|
|
2592
|
-
if (
|
|
2605
|
+
if (d || k || w) {
|
|
2593
2606
|
if (I = k ? `
|
|
2594
2607
|
` : "", w) {
|
|
2595
2608
|
const O = c(w);
|
|
@@ -2603,8 +2616,8 @@ ${W(O, t.indent)}`;
|
|
|
2603
2616
|
${t.indent}`;
|
|
2604
2617
|
} else if (!p && L(e)) {
|
|
2605
2618
|
const O = v[0], y = v.indexOf(`
|
|
2606
|
-
`), $ = y !== -1,
|
|
2607
|
-
if ($ || !
|
|
2619
|
+
`), $ = y !== -1, G = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
2620
|
+
if ($ || !G) {
|
|
2608
2621
|
let oe = !1;
|
|
2609
2622
|
if ($ && (O === "&" || O === "!")) {
|
|
2610
2623
|
let j = v.indexOf(" ");
|
|
@@ -2629,7 +2642,7 @@ const Me = "<<", Y = {
|
|
|
2629
2642
|
addToJSMap: $s
|
|
2630
2643
|
}),
|
|
2631
2644
|
stringify: () => Me
|
|
2632
|
-
},
|
|
2645
|
+
}, Mi = (s, e) => (Y.identify(e) || _(e) && (!e.type || e.type === N.PLAIN) && Y.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === Y.tag && t.default);
|
|
2633
2646
|
function $s(s, e, t) {
|
|
2634
2647
|
if (t = s && re(t) ? t.resolve(s.doc) : t, Re(t))
|
|
2635
2648
|
for (const n of t.items)
|
|
@@ -2657,7 +2670,7 @@ function ut(s, e, t) {
|
|
|
2657
2670
|
function js(s, e, { key: t, value: n }) {
|
|
2658
2671
|
if (A(t) && t.addToJSMap)
|
|
2659
2672
|
t.addToJSMap(s, e, n);
|
|
2660
|
-
else if (
|
|
2673
|
+
else if (Mi(s, t))
|
|
2661
2674
|
$s(s, e, n);
|
|
2662
2675
|
else {
|
|
2663
2676
|
const i = D(t, "", s);
|
|
@@ -2666,7 +2679,7 @@ function js(s, e, { key: t, value: n }) {
|
|
|
2666
2679
|
else if (e instanceof Set)
|
|
2667
2680
|
e.add(i);
|
|
2668
2681
|
else {
|
|
2669
|
-
const r =
|
|
2682
|
+
const r = Di(t, i, s), o = D(n, r, s);
|
|
2670
2683
|
r in e ? Object.defineProperty(e, r, {
|
|
2671
2684
|
value: o,
|
|
2672
2685
|
writable: !0,
|
|
@@ -2677,7 +2690,7 @@ function js(s, e, { key: t, value: n }) {
|
|
|
2677
2690
|
}
|
|
2678
2691
|
return e;
|
|
2679
2692
|
}
|
|
2680
|
-
function
|
|
2693
|
+
function Di(s, e, t) {
|
|
2681
2694
|
if (e === null)
|
|
2682
2695
|
return "";
|
|
2683
2696
|
if (typeof e != "object")
|
|
@@ -2697,7 +2710,7 @@ function Ui(s, e, t) {
|
|
|
2697
2710
|
}
|
|
2698
2711
|
return JSON.stringify(e);
|
|
2699
2712
|
}
|
|
2700
|
-
function
|
|
2713
|
+
function $t(s, e, t) {
|
|
2701
2714
|
const n = Le(s, void 0, t), i = Le(e, void 0, t);
|
|
2702
2715
|
return new U(n, i);
|
|
2703
2716
|
}
|
|
@@ -2714,45 +2727,45 @@ class U {
|
|
|
2714
2727
|
return js(t, n, this);
|
|
2715
2728
|
}
|
|
2716
2729
|
toString(e, t, n) {
|
|
2717
|
-
return e?.doc ?
|
|
2730
|
+
return e?.doc ? xi(this, e, t, n) : JSON.stringify(this);
|
|
2718
2731
|
}
|
|
2719
2732
|
}
|
|
2720
2733
|
function Rs(s, e, t) {
|
|
2721
|
-
return (e.inFlow ?? s.flow ?
|
|
2734
|
+
return (e.inFlow ?? s.flow ? qi : Bi)(s, e, t);
|
|
2722
2735
|
}
|
|
2723
|
-
function
|
|
2724
|
-
const { indent: l, options: { commentString: c } } = t,
|
|
2725
|
-
let
|
|
2726
|
-
const
|
|
2736
|
+
function Bi({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: a }) {
|
|
2737
|
+
const { indent: l, options: { commentString: c } } = t, u = Object.assign({}, t, { indent: r, type: null });
|
|
2738
|
+
let f = !1;
|
|
2739
|
+
const d = [];
|
|
2727
2740
|
for (let g = 0; g < e.length; ++g) {
|
|
2728
2741
|
const h = e[g];
|
|
2729
2742
|
let m = null;
|
|
2730
2743
|
if (A(h))
|
|
2731
|
-
!
|
|
2744
|
+
!f && h.spaceBefore && d.push(""), Ye(t, d, h.commentBefore, f), h.comment && (m = h.comment);
|
|
2732
2745
|
else if (E(h)) {
|
|
2733
2746
|
const w = A(h.key) ? h.key : null;
|
|
2734
|
-
w && (!
|
|
2747
|
+
w && (!f && w.spaceBefore && d.push(""), Ye(t, d, w.commentBefore, f));
|
|
2735
2748
|
}
|
|
2736
|
-
|
|
2737
|
-
let k = me(h,
|
|
2738
|
-
m && (k += te(k, r, c(m))),
|
|
2749
|
+
f = !1;
|
|
2750
|
+
let k = me(h, u, () => m = null, () => f = !0);
|
|
2751
|
+
m && (k += te(k, r, c(m))), f && m && (f = !1), d.push(n + k);
|
|
2739
2752
|
}
|
|
2740
2753
|
let p;
|
|
2741
|
-
if (
|
|
2754
|
+
if (d.length === 0)
|
|
2742
2755
|
p = i.start + i.end;
|
|
2743
2756
|
else {
|
|
2744
|
-
p =
|
|
2745
|
-
for (let g = 1; g <
|
|
2746
|
-
const h =
|
|
2757
|
+
p = d[0];
|
|
2758
|
+
for (let g = 1; g < d.length; ++g) {
|
|
2759
|
+
const h = d[g];
|
|
2747
2760
|
p += h ? `
|
|
2748
2761
|
${l}${h}` : `
|
|
2749
2762
|
`;
|
|
2750
2763
|
}
|
|
2751
2764
|
}
|
|
2752
2765
|
return s ? (p += `
|
|
2753
|
-
` + W(c(s), l), a && a()) :
|
|
2766
|
+
` + W(c(s), l), a && a()) : f && o && o(), p;
|
|
2754
2767
|
}
|
|
2755
|
-
function
|
|
2768
|
+
function qi({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
2756
2769
|
const { indent: i, indentStep: r, flowCollectionPadding: o, options: { commentString: a } } = e;
|
|
2757
2770
|
n += r;
|
|
2758
2771
|
const l = Object.assign({}, e, {
|
|
@@ -2760,41 +2773,41 @@ function Mi({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
|
2760
2773
|
inFlow: !0,
|
|
2761
2774
|
type: null
|
|
2762
2775
|
});
|
|
2763
|
-
let c = !1,
|
|
2764
|
-
const
|
|
2776
|
+
let c = !1, u = 0;
|
|
2777
|
+
const f = [];
|
|
2765
2778
|
for (let g = 0; g < s.length; ++g) {
|
|
2766
2779
|
const h = s[g];
|
|
2767
2780
|
let m = null;
|
|
2768
2781
|
if (A(h))
|
|
2769
|
-
h.spaceBefore &&
|
|
2782
|
+
h.spaceBefore && f.push(""), Ye(e, f, h.commentBefore, !1), h.comment && (m = h.comment);
|
|
2770
2783
|
else if (E(h)) {
|
|
2771
2784
|
const w = A(h.key) ? h.key : null;
|
|
2772
|
-
w && (w.spaceBefore &&
|
|
2785
|
+
w && (w.spaceBefore && f.push(""), Ye(e, f, w.commentBefore, !1), w.comment && (c = !0));
|
|
2773
2786
|
const b = A(h.value) ? h.value : null;
|
|
2774
2787
|
b ? (b.comment && (m = b.comment), b.commentBefore && (c = !0)) : h.value == null && w?.comment && (m = w.comment);
|
|
2775
2788
|
}
|
|
2776
2789
|
m && (c = !0);
|
|
2777
2790
|
let k = me(h, l, () => m = null);
|
|
2778
|
-
g < s.length - 1 && (k += ","), m && (k += te(k, n, a(m))), !c && (
|
|
2779
|
-
`)) && (c = !0),
|
|
2791
|
+
g < s.length - 1 && (k += ","), m && (k += te(k, n, a(m))), !c && (f.length > u || k.includes(`
|
|
2792
|
+
`)) && (c = !0), f.push(k), u = f.length;
|
|
2780
2793
|
}
|
|
2781
|
-
const { start:
|
|
2782
|
-
if (
|
|
2783
|
-
return
|
|
2794
|
+
const { start: d, end: p } = t;
|
|
2795
|
+
if (f.length === 0)
|
|
2796
|
+
return d + p;
|
|
2784
2797
|
if (!c) {
|
|
2785
|
-
const g =
|
|
2798
|
+
const g = f.reduce((h, m) => h + m.length + 2, 2);
|
|
2786
2799
|
c = e.options.lineWidth > 0 && g > e.options.lineWidth;
|
|
2787
2800
|
}
|
|
2788
2801
|
if (c) {
|
|
2789
|
-
let g =
|
|
2790
|
-
for (const h of
|
|
2802
|
+
let g = d;
|
|
2803
|
+
for (const h of f)
|
|
2791
2804
|
g += h ? `
|
|
2792
2805
|
${r}${i}${h}` : `
|
|
2793
2806
|
`;
|
|
2794
2807
|
return `${g}
|
|
2795
2808
|
${i}${p}`;
|
|
2796
2809
|
} else
|
|
2797
|
-
return `${
|
|
2810
|
+
return `${d}${o}${f.join(" ")}${o}${p}`;
|
|
2798
2811
|
}
|
|
2799
2812
|
function Ye({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
2800
2813
|
if (n && i && (n = n.replace(/^\n+/, "")), n) {
|
|
@@ -2813,7 +2826,7 @@ class M extends Cs {
|
|
|
2813
2826
|
return "tag:yaml.org,2002:map";
|
|
2814
2827
|
}
|
|
2815
2828
|
constructor(e) {
|
|
2816
|
-
super(
|
|
2829
|
+
super(Z, e), this.items = [];
|
|
2817
2830
|
}
|
|
2818
2831
|
/**
|
|
2819
2832
|
* A generic collection parsing method that can be extended
|
|
@@ -2825,7 +2838,7 @@ class M extends Cs {
|
|
|
2825
2838
|
c = r.call(t, l, c);
|
|
2826
2839
|
else if (Array.isArray(r) && !r.includes(l))
|
|
2827
2840
|
return;
|
|
2828
|
-
(c !== void 0 || i) && o.items.push(
|
|
2841
|
+
(c !== void 0 || i) && o.items.push($t(l, c, n));
|
|
2829
2842
|
};
|
|
2830
2843
|
if (t instanceof Map)
|
|
2831
2844
|
for (const [l, c] of t)
|
|
@@ -3010,7 +3023,7 @@ const be = {
|
|
|
3010
3023
|
tag: "tag:yaml.org,2002:str",
|
|
3011
3024
|
resolve: (s) => s,
|
|
3012
3025
|
stringify(s, e, t, n) {
|
|
3013
|
-
return e = Object.assign({ actualString: !0 }, e),
|
|
3026
|
+
return e = Object.assign({ actualString: !0 }, e), Et(s, e, t, n);
|
|
3014
3027
|
}
|
|
3015
3028
|
}, et = {
|
|
3016
3029
|
identify: (s) => s == null,
|
|
@@ -3020,14 +3033,14 @@ const be = {
|
|
|
3020
3033
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
3021
3034
|
resolve: () => new N(null),
|
|
3022
3035
|
stringify: ({ source: s }, e) => typeof s == "string" && et.test.test(s) ? s : e.options.nullStr
|
|
3023
|
-
},
|
|
3036
|
+
}, jt = {
|
|
3024
3037
|
identify: (s) => typeof s == "boolean",
|
|
3025
3038
|
default: !0,
|
|
3026
3039
|
tag: "tag:yaml.org,2002:bool",
|
|
3027
3040
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
3028
3041
|
resolve: (s) => new N(s[0] === "t" || s[0] === "T"),
|
|
3029
3042
|
stringify({ source: s, value: e }, t) {
|
|
3030
|
-
if (s &&
|
|
3043
|
+
if (s && jt.test.test(s)) {
|
|
3031
3044
|
const n = s[0] === "t" || s[0] === "T";
|
|
3032
3045
|
if (e === n)
|
|
3033
3046
|
return s;
|
|
@@ -3079,7 +3092,7 @@ const Ps = {
|
|
|
3079
3092
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
3080
3093
|
},
|
|
3081
3094
|
stringify: F
|
|
3082
|
-
}, tt = (s) => typeof s == "bigint" || Number.isInteger(s),
|
|
3095
|
+
}, tt = (s) => typeof s == "bigint" || Number.isInteger(s), Rt = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
3083
3096
|
function Ms(s, e, t) {
|
|
3084
3097
|
const { value: n } = s;
|
|
3085
3098
|
return tt(n) && n >= 0 ? t + n.toString(e) : F(s);
|
|
@@ -3090,14 +3103,14 @@ const Ds = {
|
|
|
3090
3103
|
tag: "tag:yaml.org,2002:int",
|
|
3091
3104
|
format: "OCT",
|
|
3092
3105
|
test: /^0o[0-7]+$/,
|
|
3093
|
-
resolve: (s, e, t) =>
|
|
3106
|
+
resolve: (s, e, t) => Rt(s, 2, 8, t),
|
|
3094
3107
|
stringify: (s) => Ms(s, 8, "0o")
|
|
3095
3108
|
}, Bs = {
|
|
3096
3109
|
identify: tt,
|
|
3097
3110
|
default: !0,
|
|
3098
3111
|
tag: "tag:yaml.org,2002:int",
|
|
3099
3112
|
test: /^[-+]?[0-9]+$/,
|
|
3100
|
-
resolve: (s, e, t) =>
|
|
3113
|
+
resolve: (s, e, t) => Rt(s, 0, 10, t),
|
|
3101
3114
|
stringify: F
|
|
3102
3115
|
}, qs = {
|
|
3103
3116
|
identify: (s) => tt(s) && s >= 0,
|
|
@@ -3105,14 +3118,14 @@ const Ds = {
|
|
|
3105
3118
|
tag: "tag:yaml.org,2002:int",
|
|
3106
3119
|
format: "HEX",
|
|
3107
3120
|
test: /^0x[0-9a-fA-F]+$/,
|
|
3108
|
-
resolve: (s, e, t) =>
|
|
3121
|
+
resolve: (s, e, t) => Rt(s, 2, 16, t),
|
|
3109
3122
|
stringify: (s) => Ms(s, 16, "0x")
|
|
3110
|
-
},
|
|
3123
|
+
}, Ki = [
|
|
3111
3124
|
we,
|
|
3112
3125
|
be,
|
|
3113
3126
|
Ze,
|
|
3114
3127
|
et,
|
|
3115
|
-
|
|
3128
|
+
jt,
|
|
3116
3129
|
Ds,
|
|
3117
3130
|
Bs,
|
|
3118
3131
|
qs,
|
|
@@ -3120,10 +3133,10 @@ const Ds = {
|
|
|
3120
3133
|
Us,
|
|
3121
3134
|
xs
|
|
3122
3135
|
];
|
|
3123
|
-
function
|
|
3136
|
+
function zt(s) {
|
|
3124
3137
|
return typeof s == "bigint" || Number.isInteger(s);
|
|
3125
3138
|
}
|
|
3126
|
-
const Be = ({ value: s }) => JSON.stringify(s),
|
|
3139
|
+
const Be = ({ value: s }) => JSON.stringify(s), Fi = [
|
|
3127
3140
|
{
|
|
3128
3141
|
identify: (s) => typeof s == "string",
|
|
3129
3142
|
default: !0,
|
|
@@ -3149,12 +3162,12 @@ const Be = ({ value: s }) => JSON.stringify(s), Bi = [
|
|
|
3149
3162
|
stringify: Be
|
|
3150
3163
|
},
|
|
3151
3164
|
{
|
|
3152
|
-
identify:
|
|
3165
|
+
identify: zt,
|
|
3153
3166
|
default: !0,
|
|
3154
3167
|
tag: "tag:yaml.org,2002:int",
|
|
3155
3168
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
3156
3169
|
resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
|
|
3157
|
-
stringify: ({ value: s }) =>
|
|
3170
|
+
stringify: ({ value: s }) => zt(s) ? s.toString() : JSON.stringify(s)
|
|
3158
3171
|
},
|
|
3159
3172
|
{
|
|
3160
3173
|
identify: (s) => typeof s == "number",
|
|
@@ -3164,14 +3177,14 @@ const Be = ({ value: s }) => JSON.stringify(s), Bi = [
|
|
|
3164
3177
|
resolve: (s) => parseFloat(s),
|
|
3165
3178
|
stringify: Be
|
|
3166
3179
|
}
|
|
3167
|
-
],
|
|
3180
|
+
], Ji = {
|
|
3168
3181
|
default: !0,
|
|
3169
3182
|
tag: "",
|
|
3170
3183
|
test: /^/,
|
|
3171
3184
|
resolve(s, e) {
|
|
3172
3185
|
return e(`Unresolved plain scalar ${JSON.stringify(s)}`), s;
|
|
3173
3186
|
}
|
|
3174
|
-
},
|
|
3187
|
+
}, Vi = [we, be].concat(Fi, Ji), Pt = {
|
|
3175
3188
|
identify: (s) => s instanceof Uint8Array,
|
|
3176
3189
|
// Buffer inherits from Uint8Array
|
|
3177
3190
|
default: !1,
|
|
@@ -3206,13 +3219,13 @@ const Be = ({ value: s }) => JSON.stringify(s), Bi = [
|
|
|
3206
3219
|
} else
|
|
3207
3220
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
3208
3221
|
if (e ?? (e = N.BLOCK_LITERAL), e !== N.QUOTE_DOUBLE) {
|
|
3209
|
-
const l = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(a.length / l),
|
|
3210
|
-
for (let
|
|
3211
|
-
|
|
3212
|
-
a =
|
|
3222
|
+
const l = Math.max(n.options.lineWidth - n.indent.length, n.options.minContentWidth), c = Math.ceil(a.length / l), u = new Array(c);
|
|
3223
|
+
for (let f = 0, d = 0; f < c; ++f, d += l)
|
|
3224
|
+
u[f] = a.substr(d, l);
|
|
3225
|
+
a = u.join(e === N.BLOCK_LITERAL ? `
|
|
3213
3226
|
` : " ");
|
|
3214
3227
|
}
|
|
3215
|
-
return
|
|
3228
|
+
return Et({ comment: s, type: e, value: a }, n, i, r);
|
|
3216
3229
|
}
|
|
3217
3230
|
};
|
|
3218
3231
|
function Ks(s, e) {
|
|
@@ -3259,11 +3272,11 @@ function Fs(s, e, t) {
|
|
|
3259
3272
|
throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
|
|
3260
3273
|
} else
|
|
3261
3274
|
a = o;
|
|
3262
|
-
i.items.push(
|
|
3275
|
+
i.items.push($t(a, l, t));
|
|
3263
3276
|
}
|
|
3264
3277
|
return i;
|
|
3265
3278
|
}
|
|
3266
|
-
const
|
|
3279
|
+
const Ut = {
|
|
3267
3280
|
collection: "seq",
|
|
3268
3281
|
default: !1,
|
|
3269
3282
|
tag: "tag:yaml.org,2002:pairs",
|
|
@@ -3297,7 +3310,7 @@ class de extends ie {
|
|
|
3297
3310
|
}
|
|
3298
3311
|
}
|
|
3299
3312
|
de.tag = "tag:yaml.org,2002:omap";
|
|
3300
|
-
const
|
|
3313
|
+
const xt = {
|
|
3301
3314
|
collection: "seq",
|
|
3302
3315
|
identify: (s) => s instanceof Map,
|
|
3303
3316
|
nodeClass: de,
|
|
@@ -3328,14 +3341,14 @@ const Vs = {
|
|
|
3328
3341
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
3329
3342
|
resolve: () => new N(!1),
|
|
3330
3343
|
stringify: Js
|
|
3331
|
-
},
|
|
3344
|
+
}, Wi = {
|
|
3332
3345
|
identify: (s) => typeof s == "number",
|
|
3333
3346
|
default: !0,
|
|
3334
3347
|
tag: "tag:yaml.org,2002:float",
|
|
3335
3348
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
3336
3349
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
3337
3350
|
stringify: F
|
|
3338
|
-
},
|
|
3351
|
+
}, Yi = {
|
|
3339
3352
|
identify: (s) => typeof s == "number",
|
|
3340
3353
|
default: !0,
|
|
3341
3354
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -3346,7 +3359,7 @@ const Vs = {
|
|
|
3346
3359
|
const e = Number(s.value);
|
|
3347
3360
|
return isFinite(e) ? e.toExponential() : F(s);
|
|
3348
3361
|
}
|
|
3349
|
-
},
|
|
3362
|
+
}, Hi = {
|
|
3350
3363
|
identify: (s) => typeof s == "number",
|
|
3351
3364
|
default: !0,
|
|
3352
3365
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -3381,7 +3394,7 @@ function st(s, e, t, { intAsBigInt: n }) {
|
|
|
3381
3394
|
const r = parseInt(s, t);
|
|
3382
3395
|
return i === "-" ? -1 * r : r;
|
|
3383
3396
|
}
|
|
3384
|
-
function
|
|
3397
|
+
function Mt(s, e, t) {
|
|
3385
3398
|
const { value: n } = s;
|
|
3386
3399
|
if (Pe(n)) {
|
|
3387
3400
|
const i = n.toString(e);
|
|
@@ -3389,37 +3402,37 @@ function xt(s, e, t) {
|
|
|
3389
3402
|
}
|
|
3390
3403
|
return F(s);
|
|
3391
3404
|
}
|
|
3392
|
-
const
|
|
3405
|
+
const Gi = {
|
|
3393
3406
|
identify: Pe,
|
|
3394
3407
|
default: !0,
|
|
3395
3408
|
tag: "tag:yaml.org,2002:int",
|
|
3396
3409
|
format: "BIN",
|
|
3397
3410
|
test: /^[-+]?0b[0-1_]+$/,
|
|
3398
3411
|
resolve: (s, e, t) => st(s, 2, 2, t),
|
|
3399
|
-
stringify: (s) =>
|
|
3400
|
-
},
|
|
3412
|
+
stringify: (s) => Mt(s, 2, "0b")
|
|
3413
|
+
}, zi = {
|
|
3401
3414
|
identify: Pe,
|
|
3402
3415
|
default: !0,
|
|
3403
3416
|
tag: "tag:yaml.org,2002:int",
|
|
3404
3417
|
format: "OCT",
|
|
3405
3418
|
test: /^[-+]?0[0-7_]+$/,
|
|
3406
3419
|
resolve: (s, e, t) => st(s, 1, 8, t),
|
|
3407
|
-
stringify: (s) =>
|
|
3408
|
-
},
|
|
3420
|
+
stringify: (s) => Mt(s, 8, "0")
|
|
3421
|
+
}, Qi = {
|
|
3409
3422
|
identify: Pe,
|
|
3410
3423
|
default: !0,
|
|
3411
3424
|
tag: "tag:yaml.org,2002:int",
|
|
3412
3425
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
3413
3426
|
resolve: (s, e, t) => st(s, 0, 10, t),
|
|
3414
3427
|
stringify: F
|
|
3415
|
-
},
|
|
3428
|
+
}, Xi = {
|
|
3416
3429
|
identify: Pe,
|
|
3417
3430
|
default: !0,
|
|
3418
3431
|
tag: "tag:yaml.org,2002:int",
|
|
3419
3432
|
format: "HEX",
|
|
3420
3433
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
3421
3434
|
resolve: (s, e, t) => st(s, 2, 16, t),
|
|
3422
|
-
stringify: (s) =>
|
|
3435
|
+
stringify: (s) => Mt(s, 16, "0x")
|
|
3423
3436
|
};
|
|
3424
3437
|
class he extends M {
|
|
3425
3438
|
constructor(e) {
|
|
@@ -3457,12 +3470,12 @@ class he extends M {
|
|
|
3457
3470
|
const { replacer: i } = n, r = new this(e);
|
|
3458
3471
|
if (t && Symbol.iterator in Object(t))
|
|
3459
3472
|
for (let o of t)
|
|
3460
|
-
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(
|
|
3473
|
+
typeof i == "function" && (o = i.call(t, o, o)), r.items.push($t(o, null, n));
|
|
3461
3474
|
return r;
|
|
3462
3475
|
}
|
|
3463
3476
|
}
|
|
3464
3477
|
he.tag = "tag:yaml.org,2002:set";
|
|
3465
|
-
const
|
|
3478
|
+
const Dt = {
|
|
3466
3479
|
collection: "map",
|
|
3467
3480
|
identify: (s) => s instanceof Set,
|
|
3468
3481
|
nodeClass: he,
|
|
@@ -3479,7 +3492,7 @@ const Mt = {
|
|
|
3479
3492
|
return s;
|
|
3480
3493
|
}
|
|
3481
3494
|
};
|
|
3482
|
-
function
|
|
3495
|
+
function Bt(s, e) {
|
|
3483
3496
|
const t = s[0], n = t === "-" || t === "+" ? s.substring(1) : s, i = (o) => e ? BigInt(o) : Number(o), r = n.replace(/_/g, "").split(":").reduce((o, a) => o * i(60) + i(a), i(0));
|
|
3484
3497
|
return t === "-" ? i(-1) * r : r;
|
|
3485
3498
|
}
|
|
@@ -3500,7 +3513,7 @@ const Hs = {
|
|
|
3500
3513
|
tag: "tag:yaml.org,2002:int",
|
|
3501
3514
|
format: "TIME",
|
|
3502
3515
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
3503
|
-
resolve: (s, e, { intAsBigInt: t }) =>
|
|
3516
|
+
resolve: (s, e, { intAsBigInt: t }) => Bt(s, t),
|
|
3504
3517
|
stringify: Ys
|
|
3505
3518
|
}, Gs = {
|
|
3506
3519
|
identify: (s) => typeof s == "number",
|
|
@@ -3508,7 +3521,7 @@ const Hs = {
|
|
|
3508
3521
|
tag: "tag:yaml.org,2002:float",
|
|
3509
3522
|
format: "TIME",
|
|
3510
3523
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
3511
|
-
resolve: (s) =>
|
|
3524
|
+
resolve: (s) => Bt(s, !1),
|
|
3512
3525
|
stringify: Ys
|
|
3513
3526
|
}, nt = {
|
|
3514
3527
|
identify: (s) => s instanceof Date,
|
|
@@ -3524,45 +3537,45 @@ const Hs = {
|
|
|
3524
3537
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
3525
3538
|
const [, t, n, i, r, o, a] = e.map(Number), l = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
3526
3539
|
let c = Date.UTC(t, n - 1, i, r || 0, o || 0, a || 0, l);
|
|
3527
|
-
const
|
|
3528
|
-
if (
|
|
3529
|
-
let
|
|
3530
|
-
Math.abs(
|
|
3540
|
+
const u = e[8];
|
|
3541
|
+
if (u && u !== "Z") {
|
|
3542
|
+
let f = Bt(u, !1);
|
|
3543
|
+
Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
|
|
3531
3544
|
}
|
|
3532
3545
|
return new Date(c);
|
|
3533
3546
|
},
|
|
3534
3547
|
stringify: ({ value: s }) => s?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
3535
|
-
},
|
|
3548
|
+
}, Qt = [
|
|
3536
3549
|
we,
|
|
3537
3550
|
be,
|
|
3538
3551
|
Ze,
|
|
3539
3552
|
et,
|
|
3540
3553
|
Vs,
|
|
3541
3554
|
Ws,
|
|
3555
|
+
Gi,
|
|
3556
|
+
zi,
|
|
3557
|
+
Qi,
|
|
3558
|
+
Xi,
|
|
3542
3559
|
Wi,
|
|
3543
3560
|
Yi,
|
|
3544
3561
|
Hi,
|
|
3545
|
-
|
|
3546
|
-
Fi,
|
|
3547
|
-
Ji,
|
|
3548
|
-
Vi,
|
|
3549
|
-
Rt,
|
|
3562
|
+
Pt,
|
|
3550
3563
|
Y,
|
|
3564
|
+
xt,
|
|
3551
3565
|
Ut,
|
|
3552
|
-
|
|
3553
|
-
Mt,
|
|
3566
|
+
Dt,
|
|
3554
3567
|
Hs,
|
|
3555
3568
|
Gs,
|
|
3556
3569
|
nt
|
|
3557
|
-
],
|
|
3558
|
-
["core",
|
|
3570
|
+
], Xt = /* @__PURE__ */ new Map([
|
|
3571
|
+
["core", Ki],
|
|
3559
3572
|
["failsafe", [we, be, Ze]],
|
|
3560
|
-
["json",
|
|
3561
|
-
["yaml11",
|
|
3562
|
-
["yaml-1.1",
|
|
3563
|
-
]),
|
|
3564
|
-
binary:
|
|
3565
|
-
bool:
|
|
3573
|
+
["json", Vi],
|
|
3574
|
+
["yaml11", Qt],
|
|
3575
|
+
["yaml-1.1", Qt]
|
|
3576
|
+
]), Zt = {
|
|
3577
|
+
binary: Pt,
|
|
3578
|
+
bool: jt,
|
|
3566
3579
|
float: xs,
|
|
3567
3580
|
floatExp: Us,
|
|
3568
3581
|
floatNaN: Ps,
|
|
@@ -3574,21 +3587,21 @@ const Hs = {
|
|
|
3574
3587
|
map: we,
|
|
3575
3588
|
merge: Y,
|
|
3576
3589
|
null: et,
|
|
3577
|
-
omap:
|
|
3578
|
-
pairs:
|
|
3590
|
+
omap: xt,
|
|
3591
|
+
pairs: Ut,
|
|
3579
3592
|
seq: be,
|
|
3580
|
-
set:
|
|
3593
|
+
set: Dt,
|
|
3581
3594
|
timestamp: nt
|
|
3582
|
-
},
|
|
3583
|
-
"tag:yaml.org,2002:binary":
|
|
3595
|
+
}, Zi = {
|
|
3596
|
+
"tag:yaml.org,2002:binary": Pt,
|
|
3584
3597
|
"tag:yaml.org,2002:merge": Y,
|
|
3585
|
-
"tag:yaml.org,2002:omap":
|
|
3586
|
-
"tag:yaml.org,2002:pairs":
|
|
3587
|
-
"tag:yaml.org,2002:set":
|
|
3598
|
+
"tag:yaml.org,2002:omap": xt,
|
|
3599
|
+
"tag:yaml.org,2002:pairs": Ut,
|
|
3600
|
+
"tag:yaml.org,2002:set": Dt,
|
|
3588
3601
|
"tag:yaml.org,2002:timestamp": nt
|
|
3589
3602
|
};
|
|
3590
3603
|
function ft(s, e, t) {
|
|
3591
|
-
const n =
|
|
3604
|
+
const n = Xt.get(e);
|
|
3592
3605
|
if (n && !s)
|
|
3593
3606
|
return t && !n.includes(Y) ? n.concat(Y) : n.slice();
|
|
3594
3607
|
let i = n;
|
|
@@ -3596,7 +3609,7 @@ function ft(s, e, t) {
|
|
|
3596
3609
|
if (Array.isArray(s))
|
|
3597
3610
|
i = [];
|
|
3598
3611
|
else {
|
|
3599
|
-
const r = Array.from(
|
|
3612
|
+
const r = Array.from(Xt.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
|
|
3600
3613
|
throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`);
|
|
3601
3614
|
}
|
|
3602
3615
|
if (Array.isArray(s))
|
|
@@ -3604,25 +3617,25 @@ function ft(s, e, t) {
|
|
|
3604
3617
|
i = i.concat(r);
|
|
3605
3618
|
else typeof s == "function" && (i = s(i.slice()));
|
|
3606
3619
|
return t && (i = i.concat(Y)), i.reduce((r, o) => {
|
|
3607
|
-
const a = typeof o == "string" ?
|
|
3620
|
+
const a = typeof o == "string" ? Zt[o] : o;
|
|
3608
3621
|
if (!a) {
|
|
3609
|
-
const l = JSON.stringify(o), c = Object.keys(
|
|
3622
|
+
const l = JSON.stringify(o), c = Object.keys(Zt).map((u) => JSON.stringify(u)).join(", ");
|
|
3610
3623
|
throw new Error(`Unknown custom tag ${l}; use one of ${c}`);
|
|
3611
3624
|
}
|
|
3612
3625
|
return r.includes(a) || r.push(a), r;
|
|
3613
3626
|
}, []);
|
|
3614
3627
|
}
|
|
3615
|
-
const
|
|
3616
|
-
class
|
|
3628
|
+
const er = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
3629
|
+
class qt {
|
|
3617
3630
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: a }) {
|
|
3618
|
-
this.compat = Array.isArray(e) ? ft(e, "compat") : e ? ft(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ?
|
|
3631
|
+
this.compat = Array.isArray(e) ? ft(e, "compat") : e ? ft(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? Zi : {}, this.tags = ft(t, this.name, n), this.toStringOptions = a ?? null, Object.defineProperty(this, Z, { value: we }), Object.defineProperty(this, J, { value: Ze }), Object.defineProperty(this, ye, { value: be }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? er : null;
|
|
3619
3632
|
}
|
|
3620
3633
|
clone() {
|
|
3621
|
-
const e = Object.create(
|
|
3634
|
+
const e = Object.create(qt.prototype, Object.getOwnPropertyDescriptors(this));
|
|
3622
3635
|
return e.tags = this.tags.slice(), e;
|
|
3623
3636
|
}
|
|
3624
3637
|
}
|
|
3625
|
-
function
|
|
3638
|
+
function tr(s, e) {
|
|
3626
3639
|
const t = [];
|
|
3627
3640
|
let n = e.directives === !0;
|
|
3628
3641
|
if (e.directives !== !1 && s.directives) {
|
|
@@ -3640,8 +3653,8 @@ function Xi(s, e) {
|
|
|
3640
3653
|
if (s.contents) {
|
|
3641
3654
|
if (A(s.contents)) {
|
|
3642
3655
|
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
3643
|
-
const
|
|
3644
|
-
t.push(W(
|
|
3656
|
+
const u = r(s.contents.commentBefore);
|
|
3657
|
+
t.push(W(u, ""));
|
|
3645
3658
|
}
|
|
3646
3659
|
i.forceBlockIndent = !!s.comment, a = s.contents.comment;
|
|
3647
3660
|
}
|
|
@@ -3718,7 +3731,7 @@ class Ue {
|
|
|
3718
3731
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
3719
3732
|
!t || n.has(t) ? Os(t || "a", n) : t;
|
|
3720
3733
|
}
|
|
3721
|
-
return new
|
|
3734
|
+
return new At(e.anchor);
|
|
3722
3735
|
}
|
|
3723
3736
|
createNode(e, t, n) {
|
|
3724
3737
|
let i;
|
|
@@ -3728,20 +3741,20 @@ class Ue {
|
|
|
3728
3741
|
const m = (w) => typeof w == "number" || w instanceof String || w instanceof Number, k = t.filter(m).map(String);
|
|
3729
3742
|
k.length > 0 && (t = t.concat(k)), i = t;
|
|
3730
3743
|
} else n === void 0 && t && (n = t, t = void 0);
|
|
3731
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag:
|
|
3744
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: u } = n ?? {}, { onAnchor: f, setAnchors: d, sourceObjects: p } = Li(
|
|
3732
3745
|
this,
|
|
3733
3746
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
3734
3747
|
o || "a"
|
|
3735
3748
|
), g = {
|
|
3736
3749
|
aliasDuplicateObjects: r ?? !0,
|
|
3737
3750
|
keepUndefined: l ?? !1,
|
|
3738
|
-
onAnchor:
|
|
3751
|
+
onAnchor: f,
|
|
3739
3752
|
onTagObj: c,
|
|
3740
3753
|
replacer: i,
|
|
3741
3754
|
schema: this.schema,
|
|
3742
3755
|
sourceObjects: p
|
|
3743
|
-
}, h = Le(e,
|
|
3744
|
-
return a && L(h) && (h.flow = !0),
|
|
3756
|
+
}, h = Le(e, u, g);
|
|
3757
|
+
return a && L(h) && (h.flow = !0), d(), h;
|
|
3745
3758
|
}
|
|
3746
3759
|
/**
|
|
3747
3760
|
* Convert a key and a value into a `Pair` using the current schema,
|
|
@@ -3836,7 +3849,7 @@ class Ue {
|
|
|
3836
3849
|
if (t.schema instanceof Object)
|
|
3837
3850
|
this.schema = t.schema;
|
|
3838
3851
|
else if (n)
|
|
3839
|
-
this.schema = new
|
|
3852
|
+
this.schema = new qt(Object.assign(n, t));
|
|
3840
3853
|
else
|
|
3841
3854
|
throw new Error("With a null YAML version, the { schema: Schema } option is required");
|
|
3842
3855
|
}
|
|
@@ -3851,8 +3864,8 @@ class Ue {
|
|
|
3851
3864
|
maxAliasCount: typeof i == "number" ? i : 100
|
|
3852
3865
|
}, l = D(this.contents, t ?? "", a);
|
|
3853
3866
|
if (typeof r == "function")
|
|
3854
|
-
for (const { count: c, res:
|
|
3855
|
-
r(
|
|
3867
|
+
for (const { count: c, res: u } of a.anchors.values())
|
|
3868
|
+
r(u, c);
|
|
3856
3869
|
return typeof o == "function" ? ue(o, { "": l }, "", l) : l;
|
|
3857
3870
|
}
|
|
3858
3871
|
/**
|
|
@@ -3872,7 +3885,7 @@ class Ue {
|
|
|
3872
3885
|
const t = JSON.stringify(e.indent);
|
|
3873
3886
|
throw new Error(`"indent" option must be a positive integer, not ${t}`);
|
|
3874
3887
|
}
|
|
3875
|
-
return
|
|
3888
|
+
return tr(this, e);
|
|
3876
3889
|
}
|
|
3877
3890
|
}
|
|
3878
3891
|
function ae(s) {
|
|
@@ -3890,12 +3903,12 @@ class Ne extends zs {
|
|
|
3890
3903
|
super("YAMLParseError", e, t, n);
|
|
3891
3904
|
}
|
|
3892
3905
|
}
|
|
3893
|
-
class
|
|
3906
|
+
class sr extends zs {
|
|
3894
3907
|
constructor(e, t, n) {
|
|
3895
3908
|
super("YAMLWarning", e, t, n);
|
|
3896
3909
|
}
|
|
3897
3910
|
}
|
|
3898
|
-
const
|
|
3911
|
+
const es = (s, e) => (t) => {
|
|
3899
3912
|
if (t.pos[0] === -1)
|
|
3900
3913
|
return;
|
|
3901
3914
|
t.linePos = t.pos.map((a) => e.linePos(a));
|
|
@@ -3924,46 +3937,46 @@ ${c}
|
|
|
3924
3937
|
}
|
|
3925
3938
|
};
|
|
3926
3939
|
function ge(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: a }) {
|
|
3927
|
-
let l = !1, c = a,
|
|
3940
|
+
let l = !1, c = a, u = a, f = "", d = "", p = !1, g = !1, h = null, m = null, k = null, w = null, b = null, S = null, v = null;
|
|
3928
3941
|
for (const y of s)
|
|
3929
3942
|
switch (g && (y.type !== "space" && y.type !== "newline" && y.type !== "comma" && r(y.offset, "MISSING_CHAR", "Tags and anchors must be separated from the next token by white space"), g = !1), h && (c && y.type !== "comment" && y.type !== "newline" && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), h = null), y.type) {
|
|
3930
3943
|
case "space":
|
|
3931
|
-
!e && (t !== "doc-start" || n?.type !== "flow-collection") && y.source.includes(" ") && (h = y),
|
|
3944
|
+
!e && (t !== "doc-start" || n?.type !== "flow-collection") && y.source.includes(" ") && (h = y), u = !0;
|
|
3932
3945
|
break;
|
|
3933
3946
|
case "comment": {
|
|
3934
|
-
|
|
3947
|
+
u || r(y, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
3935
3948
|
const $ = y.source.substring(1) || " ";
|
|
3936
|
-
|
|
3949
|
+
f ? f += d + $ : f = $, d = "", c = !1;
|
|
3937
3950
|
break;
|
|
3938
3951
|
}
|
|
3939
3952
|
case "newline":
|
|
3940
|
-
c ?
|
|
3953
|
+
c ? f ? f += y.source : (!S || t !== "seq-item-ind") && (l = !0) : d += y.source, c = !0, p = !0, (m || k) && (w = y), u = !0;
|
|
3941
3954
|
break;
|
|
3942
3955
|
case "anchor":
|
|
3943
|
-
m && r(y, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), y.source.endsWith(":") && r(y.offset + y.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), m = y, v ?? (v = y.offset), c = !1,
|
|
3956
|
+
m && r(y, "MULTIPLE_ANCHORS", "A node can have at most one anchor"), y.source.endsWith(":") && r(y.offset + y.source.length - 1, "BAD_ALIAS", "Anchor ending in : is ambiguous", !0), m = y, v ?? (v = y.offset), c = !1, u = !1, g = !0;
|
|
3944
3957
|
break;
|
|
3945
3958
|
case "tag": {
|
|
3946
|
-
k && r(y, "MULTIPLE_TAGS", "A node can have at most one tag"), k = y, v ?? (v = y.offset), c = !1,
|
|
3959
|
+
k && r(y, "MULTIPLE_TAGS", "A node can have at most one tag"), k = y, v ?? (v = y.offset), c = !1, u = !1, g = !0;
|
|
3947
3960
|
break;
|
|
3948
3961
|
}
|
|
3949
3962
|
case t:
|
|
3950
|
-
(m || k) && r(y, "BAD_PROP_ORDER", `Anchors and tags must be after the ${y.source} indicator`), S && r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.source} in ${e ?? "collection"}`), S = y, c = t === "seq-item-ind" || t === "explicit-key-ind",
|
|
3963
|
+
(m || k) && r(y, "BAD_PROP_ORDER", `Anchors and tags must be after the ${y.source} indicator`), S && r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.source} in ${e ?? "collection"}`), S = y, c = t === "seq-item-ind" || t === "explicit-key-ind", u = !1;
|
|
3951
3964
|
break;
|
|
3952
3965
|
case "comma":
|
|
3953
3966
|
if (e) {
|
|
3954
|
-
b && r(y, "UNEXPECTED_TOKEN", `Unexpected , in ${e}`), b = y, c = !1,
|
|
3967
|
+
b && r(y, "UNEXPECTED_TOKEN", `Unexpected , in ${e}`), b = y, c = !1, u = !1;
|
|
3955
3968
|
break;
|
|
3956
3969
|
}
|
|
3957
3970
|
// else fallthrough
|
|
3958
3971
|
default:
|
|
3959
|
-
r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), c = !1,
|
|
3972
|
+
r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), c = !1, u = !1;
|
|
3960
3973
|
}
|
|
3961
3974
|
const I = s[s.length - 1], O = I ? I.offset + I.source.length : i;
|
|
3962
3975
|
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"), h && (c && h.indent <= o || n?.type === "block-map" || n?.type === "block-seq") && r(h, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
3963
3976
|
comma: b,
|
|
3964
3977
|
found: S,
|
|
3965
3978
|
spaceBefore: l,
|
|
3966
|
-
comment:
|
|
3979
|
+
comment: f,
|
|
3967
3980
|
hasNewline: p,
|
|
3968
3981
|
anchor: m,
|
|
3969
3982
|
tag: k,
|
|
@@ -4020,76 +4033,76 @@ function Qs(s, e, t) {
|
|
|
4020
4033
|
const i = typeof n == "function" ? n : (r, o) => r === o || _(r) && _(o) && r.value === o.value;
|
|
4021
4034
|
return e.some((r) => i(r.key, t));
|
|
4022
4035
|
}
|
|
4023
|
-
const
|
|
4024
|
-
function
|
|
4036
|
+
const ts = "All mapping items must start at the same column";
|
|
4037
|
+
function nr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
4025
4038
|
const o = r?.nodeClass ?? M, a = new o(t.schema);
|
|
4026
4039
|
t.atRoot && (t.atRoot = !1);
|
|
4027
4040
|
let l = n.offset, c = null;
|
|
4028
|
-
for (const
|
|
4029
|
-
const { start:
|
|
4041
|
+
for (const u of n.items) {
|
|
4042
|
+
const { start: f, key: d, sep: p, value: g } = u, h = ge(f, {
|
|
4030
4043
|
indicator: "explicit-key-ind",
|
|
4031
|
-
next:
|
|
4044
|
+
next: d ?? p?.[0],
|
|
4032
4045
|
offset: l,
|
|
4033
4046
|
onError: i,
|
|
4034
4047
|
parentIndent: n.indent,
|
|
4035
4048
|
startOnNewline: !0
|
|
4036
4049
|
}), m = !h.found;
|
|
4037
4050
|
if (m) {
|
|
4038
|
-
if (
|
|
4051
|
+
if (d && (d.type === "block-seq" ? i(l, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in d && d.indent !== n.indent && i(l, "BAD_INDENT", ts)), !h.anchor && !h.tag && !p) {
|
|
4039
4052
|
c = h.end, h.comment && (a.comment ? a.comment += `
|
|
4040
4053
|
` + h.comment : a.comment = h.comment);
|
|
4041
4054
|
continue;
|
|
4042
4055
|
}
|
|
4043
|
-
(h.newlineAfterProp || Ae(
|
|
4044
|
-
} else h.found?.indent !== n.indent && i(l, "BAD_INDENT",
|
|
4056
|
+
(h.newlineAfterProp || Ae(d)) && i(d ?? f[f.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
4057
|
+
} else h.found?.indent !== n.indent && i(l, "BAD_INDENT", ts);
|
|
4045
4058
|
t.atKey = !0;
|
|
4046
|
-
const k = h.end, w =
|
|
4047
|
-
t.schema.compat && Nt(n.indent,
|
|
4059
|
+
const k = h.end, w = d ? s(t, d, h, i) : e(t, k, f, null, h, i);
|
|
4060
|
+
t.schema.compat && Nt(n.indent, d, i), t.atKey = !1, Qs(t, a.items, w) && i(k, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4048
4061
|
const b = ge(p ?? [], {
|
|
4049
4062
|
indicator: "map-value-ind",
|
|
4050
4063
|
next: g,
|
|
4051
4064
|
offset: w.range[2],
|
|
4052
4065
|
onError: i,
|
|
4053
4066
|
parentIndent: n.indent,
|
|
4054
|
-
startOnNewline: !
|
|
4067
|
+
startOnNewline: !d || d.type === "block-scalar"
|
|
4055
4068
|
});
|
|
4056
4069
|
if (l = b.end, b.found) {
|
|
4057
4070
|
m && (g?.type === "block-map" && !b.hasNewline && i(l, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && h.start < b.found.offset - 1024 && i(w.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));
|
|
4058
4071
|
const S = g ? s(t, g, b, i) : e(t, l, p, null, b, i);
|
|
4059
4072
|
t.schema.compat && Nt(n.indent, g, i), l = S.range[2];
|
|
4060
4073
|
const v = new U(w, S);
|
|
4061
|
-
t.options.keepSourceTokens && (v.srcToken =
|
|
4074
|
+
t.options.keepSourceTokens && (v.srcToken = u), a.items.push(v);
|
|
4062
4075
|
} else {
|
|
4063
4076
|
m && i(w.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), b.comment && (w.comment ? w.comment += `
|
|
4064
4077
|
` + b.comment : w.comment = b.comment);
|
|
4065
4078
|
const S = new U(w);
|
|
4066
|
-
t.options.keepSourceTokens && (S.srcToken =
|
|
4079
|
+
t.options.keepSourceTokens && (S.srcToken = u), a.items.push(S);
|
|
4067
4080
|
}
|
|
4068
4081
|
}
|
|
4069
4082
|
return c && c < l && i(c, "IMPOSSIBLE", "Map comment with trailing content"), a.range = [n.offset, l, c ?? l], a;
|
|
4070
4083
|
}
|
|
4071
|
-
function
|
|
4084
|
+
function ir({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
4072
4085
|
const o = r?.nodeClass ?? ie, a = new o(t.schema);
|
|
4073
4086
|
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
4074
4087
|
let l = n.offset, c = null;
|
|
4075
|
-
for (const { start:
|
|
4076
|
-
const
|
|
4088
|
+
for (const { start: u, value: f } of n.items) {
|
|
4089
|
+
const d = ge(u, {
|
|
4077
4090
|
indicator: "seq-item-ind",
|
|
4078
|
-
next:
|
|
4091
|
+
next: f,
|
|
4079
4092
|
offset: l,
|
|
4080
4093
|
onError: i,
|
|
4081
4094
|
parentIndent: n.indent,
|
|
4082
4095
|
startOnNewline: !0
|
|
4083
4096
|
});
|
|
4084
|
-
if (!
|
|
4085
|
-
if (
|
|
4086
|
-
|
|
4097
|
+
if (!d.found)
|
|
4098
|
+
if (d.anchor || d.tag || f)
|
|
4099
|
+
f?.type === "block-seq" ? i(d.end, "BAD_INDENT", "All sequence items must start at the same column") : i(l, "MISSING_CHAR", "Sequence item without - indicator");
|
|
4087
4100
|
else {
|
|
4088
|
-
c =
|
|
4101
|
+
c = d.end, d.comment && (a.comment = d.comment);
|
|
4089
4102
|
continue;
|
|
4090
4103
|
}
|
|
4091
|
-
const p =
|
|
4092
|
-
t.schema.compat && Nt(n.indent,
|
|
4104
|
+
const p = f ? s(t, f, d, i) : e(t, d.end, u, null, d, i);
|
|
4105
|
+
t.schema.compat && Nt(n.indent, f, i), l = p.range[2], a.items.push(p);
|
|
4093
4106
|
}
|
|
4094
4107
|
return a.range = [n.offset, l, c ?? l], a;
|
|
4095
4108
|
}
|
|
@@ -4105,8 +4118,8 @@ function xe(s, e, t, n) {
|
|
|
4105
4118
|
break;
|
|
4106
4119
|
case "comment": {
|
|
4107
4120
|
t && !r && n(a, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
4108
|
-
const
|
|
4109
|
-
i ? i += o +
|
|
4121
|
+
const u = l.substring(1) || " ";
|
|
4122
|
+
i ? i += o + u : i = u, o = "";
|
|
4110
4123
|
break;
|
|
4111
4124
|
}
|
|
4112
4125
|
case "newline":
|
|
@@ -4121,18 +4134,18 @@ function xe(s, e, t, n) {
|
|
|
4121
4134
|
return { comment: i, offset: e };
|
|
4122
4135
|
}
|
|
4123
4136
|
const dt = "Block collections are not allowed within flow collections", ht = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
4124
|
-
function
|
|
4137
|
+
function rr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
4125
4138
|
const o = n.start.source === "{", a = o ? "flow map" : "flow sequence", l = r?.nodeClass ?? (o ? M : ie), c = new l(t.schema);
|
|
4126
4139
|
c.flow = !0;
|
|
4127
|
-
const
|
|
4128
|
-
|
|
4129
|
-
let
|
|
4140
|
+
const u = t.atRoot;
|
|
4141
|
+
u && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
4142
|
+
let f = n.offset + n.start.source.length;
|
|
4130
4143
|
for (let m = 0; m < n.items.length; ++m) {
|
|
4131
4144
|
const k = n.items[m], { start: w, key: b, sep: S, value: v } = k, I = ge(w, {
|
|
4132
4145
|
flow: a,
|
|
4133
4146
|
indicator: "explicit-key-ind",
|
|
4134
4147
|
next: b ?? S?.[0],
|
|
4135
|
-
offset:
|
|
4148
|
+
offset: f,
|
|
4136
4149
|
onError: i,
|
|
4137
4150
|
parentIndent: n.indent,
|
|
4138
4151
|
startOnNewline: !1
|
|
@@ -4140,7 +4153,7 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4140
4153
|
if (!I.found) {
|
|
4141
4154
|
if (!I.anchor && !I.tag && !S && !v) {
|
|
4142
4155
|
m === 0 && I.comma ? i(I.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${a}`) : m < n.items.length - 1 && i(I.start, "UNEXPECTED_TOKEN", `Unexpected empty item in ${a}`), I.comment && (c.comment ? c.comment += `
|
|
4143
|
-
` + I.comment : c.comment = I.comment),
|
|
4156
|
+
` + I.comment : c.comment = I.comment), f = I.end;
|
|
4144
4157
|
continue;
|
|
4145
4158
|
}
|
|
4146
4159
|
!o && t.options.strict && Ae(b) && i(
|
|
@@ -4173,7 +4186,7 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4173
4186
|
}
|
|
4174
4187
|
if (!o && !S && !I.found) {
|
|
4175
4188
|
const O = v ? s(t, v, I, i) : e(t, I.end, S, null, I, i);
|
|
4176
|
-
c.items.push(O),
|
|
4189
|
+
c.items.push(O), f = O.range[2], ht(v) && i(O.range, "BLOCK_IN_FLOW", dt);
|
|
4177
4190
|
} else {
|
|
4178
4191
|
t.atKey = !0;
|
|
4179
4192
|
const O = I.end, y = b ? s(t, b, I, i) : e(t, O, w, null, I, i);
|
|
@@ -4201,29 +4214,29 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4201
4214
|
I.start < $.found.offset - 1024 && i($.found, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit flow sequence key");
|
|
4202
4215
|
}
|
|
4203
4216
|
} else v && ("source" in v && v.source?.[0] === ":" ? i(v, "MISSING_CHAR", `Missing space after : in ${a}`) : i($.start, "MISSING_CHAR", `Missing , or : between ${a} items`));
|
|
4204
|
-
const
|
|
4205
|
-
|
|
4217
|
+
const G = v ? s(t, v, $, i) : $.found ? e(t, $.end, S, null, $, i) : null;
|
|
4218
|
+
G ? ht(v) && i(G.range, "BLOCK_IN_FLOW", dt) : $.comment && (y.comment ? y.comment += `
|
|
4206
4219
|
` + $.comment : y.comment = $.comment);
|
|
4207
|
-
const oe = new U(y,
|
|
4220
|
+
const oe = new U(y, G);
|
|
4208
4221
|
if (t.options.keepSourceTokens && (oe.srcToken = k), o) {
|
|
4209
4222
|
const j = c;
|
|
4210
4223
|
Qs(t, j.items, y) && i(O, "DUPLICATE_KEY", "Map keys must be unique"), j.items.push(oe);
|
|
4211
4224
|
} else {
|
|
4212
4225
|
const j = new M(t.schema);
|
|
4213
4226
|
j.flow = !0, j.items.push(oe);
|
|
4214
|
-
const
|
|
4215
|
-
j.range = [y.range[0],
|
|
4227
|
+
const Ft = (G ?? y).range;
|
|
4228
|
+
j.range = [y.range[0], Ft[1], Ft[2]], c.items.push(j);
|
|
4216
4229
|
}
|
|
4217
|
-
|
|
4230
|
+
f = G ? G.range[2] : $.end;
|
|
4218
4231
|
}
|
|
4219
4232
|
}
|
|
4220
|
-
const
|
|
4221
|
-
let h =
|
|
4222
|
-
if (p?.source ===
|
|
4233
|
+
const d = o ? "}" : "]", [p, ...g] = n.end;
|
|
4234
|
+
let h = f;
|
|
4235
|
+
if (p?.source === d)
|
|
4223
4236
|
h = p.offset + p.source.length;
|
|
4224
4237
|
else {
|
|
4225
|
-
const m = a[0].toUpperCase() + a.substring(1), k =
|
|
4226
|
-
i(
|
|
4238
|
+
const m = a[0].toUpperCase() + a.substring(1), k = u ? `${m} must end with a ${d}` : `${m} in block collection must be sufficiently indented and end with a ${d}`;
|
|
4239
|
+
i(f, u ? "MISSING_CHAR" : "BAD_INDENT", k), p && p.source.length !== 1 && g.unshift(p);
|
|
4227
4240
|
}
|
|
4228
4241
|
if (g.length > 0) {
|
|
4229
4242
|
const m = xe(g, h, t.options.strict, i);
|
|
@@ -4234,34 +4247,34 @@ function sr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4234
4247
|
return c;
|
|
4235
4248
|
}
|
|
4236
4249
|
function pt(s, e, t, n, i, r) {
|
|
4237
|
-
const o = t.type === "block-map" ?
|
|
4250
|
+
const o = t.type === "block-map" ? nr(s, e, t, n, r) : t.type === "block-seq" ? ir(s, e, t, n, r) : rr(s, e, t, n, r), a = o.constructor;
|
|
4238
4251
|
return i === "!" || i === a.tagName ? (o.tag = a.tagName, o) : (i && (o.tag = i), o);
|
|
4239
4252
|
}
|
|
4240
|
-
function
|
|
4241
|
-
const r = n.tag, o = r ? e.directives.tagName(r.source, (
|
|
4253
|
+
function or(s, e, t, n, i) {
|
|
4254
|
+
const r = n.tag, o = r ? e.directives.tagName(r.source, (d) => i(r, "TAG_RESOLVE_FAILED", d)) : null;
|
|
4242
4255
|
if (t.type === "block-seq") {
|
|
4243
|
-
const { anchor:
|
|
4256
|
+
const { anchor: d, newlineAfterProp: p } = n, g = d && r ? d.offset > r.offset ? d : r : d ?? r;
|
|
4244
4257
|
g && (!p || p.offset < g.offset) && i(g, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
4245
4258
|
}
|
|
4246
4259
|
const a = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
4247
4260
|
if (!r || !o || o === "!" || o === M.tagName && a === "map" || o === ie.tagName && a === "seq")
|
|
4248
4261
|
return pt(s, e, t, i, o);
|
|
4249
|
-
let l = e.schema.tags.find((
|
|
4262
|
+
let l = e.schema.tags.find((d) => d.tag === o && d.collection === a);
|
|
4250
4263
|
if (!l) {
|
|
4251
|
-
const
|
|
4252
|
-
if (
|
|
4253
|
-
e.schema.tags.push(Object.assign({},
|
|
4264
|
+
const d = e.schema.knownTags[o];
|
|
4265
|
+
if (d?.collection === a)
|
|
4266
|
+
e.schema.tags.push(Object.assign({}, d, { default: !1 })), l = d;
|
|
4254
4267
|
else
|
|
4255
|
-
return
|
|
4268
|
+
return d ? i(r, "BAD_COLLECTION_TYPE", `${d.tag} used for ${a} collection, but expects ${d.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), pt(s, e, t, i, o);
|
|
4256
4269
|
}
|
|
4257
|
-
const c = pt(s, e, t, i, o, l),
|
|
4258
|
-
return
|
|
4270
|
+
const c = pt(s, e, t, i, o, l), u = l.resolve?.(c, (d) => i(r, "TAG_RESOLVE_FAILED", d), e.options) ?? c, f = A(u) ? u : new N(u);
|
|
4271
|
+
return f.range = c.range, f.tag = o, l?.format && (f.format = l.format), f;
|
|
4259
4272
|
}
|
|
4260
|
-
function
|
|
4261
|
-
const n = e.offset, i =
|
|
4273
|
+
function ar(s, e, t) {
|
|
4274
|
+
const n = e.offset, i = lr(e, s.options.strict, t);
|
|
4262
4275
|
if (!i)
|
|
4263
4276
|
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
4264
|
-
const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = e.source ?
|
|
4277
|
+
const r = i.mode === ">" ? N.BLOCK_FOLDED : N.BLOCK_LITERAL, o = e.source ? cr(e.source) : [];
|
|
4265
4278
|
let a = o.length;
|
|
4266
4279
|
for (let h = o.length - 1; h >= 0; --h) {
|
|
4267
4280
|
const m = o[h][1];
|
|
@@ -4276,24 +4289,24 @@ function ir(s, e, t) {
|
|
|
4276
4289
|
let m = n + i.length;
|
|
4277
4290
|
return e.source && (m += e.source.length), { value: h, type: r, comment: i.comment, range: [n, m, m] };
|
|
4278
4291
|
}
|
|
4279
|
-
let l = e.indent + i.indent, c = e.offset + i.length,
|
|
4292
|
+
let l = e.indent + i.indent, c = e.offset + i.length, u = 0;
|
|
4280
4293
|
for (let h = 0; h < a; ++h) {
|
|
4281
4294
|
const [m, k] = o[h];
|
|
4282
4295
|
if (k === "" || k === "\r")
|
|
4283
4296
|
i.indent === 0 && m.length > l && (l = m.length);
|
|
4284
4297
|
else {
|
|
4285
|
-
m.length < l && t(c + m.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (l = m.length),
|
|
4298
|
+
m.length < l && t(c + m.length, "MISSING_CHAR", "Block scalars with more-indented leading empty lines must use an explicit indentation indicator"), i.indent === 0 && (l = m.length), u = h, l === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
|
|
4286
4299
|
break;
|
|
4287
4300
|
}
|
|
4288
4301
|
c += m.length + k.length + 1;
|
|
4289
4302
|
}
|
|
4290
4303
|
for (let h = o.length - 1; h >= a; --h)
|
|
4291
4304
|
o[h][0].length > l && (a = h + 1);
|
|
4292
|
-
let
|
|
4293
|
-
for (let h = 0; h <
|
|
4294
|
-
|
|
4305
|
+
let f = "", d = "", p = !1;
|
|
4306
|
+
for (let h = 0; h < u; ++h)
|
|
4307
|
+
f += o[h][0].slice(l) + `
|
|
4295
4308
|
`;
|
|
4296
|
-
for (let h =
|
|
4309
|
+
for (let h = u; h < a; ++h) {
|
|
4297
4310
|
let [m, k] = o[h];
|
|
4298
4311
|
c += m.length + k.length + 1;
|
|
4299
4312
|
const w = k[k.length - 1] === "\r";
|
|
@@ -4301,96 +4314,96 @@ function ir(s, e, t) {
|
|
|
4301
4314
|
const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
4302
4315
|
t(c - k.length - (w ? 2 : 1), "BAD_INDENT", S), m = "";
|
|
4303
4316
|
}
|
|
4304
|
-
r === N.BLOCK_LITERAL ? (
|
|
4305
|
-
`) : m.length > l || k[0] === " " ? (
|
|
4306
|
-
` : !p &&
|
|
4307
|
-
` && (
|
|
4317
|
+
r === N.BLOCK_LITERAL ? (f += d + m.slice(l) + k, d = `
|
|
4318
|
+
`) : m.length > l || k[0] === " " ? (d === " " ? d = `
|
|
4319
|
+
` : !p && d === `
|
|
4320
|
+
` && (d = `
|
|
4308
4321
|
|
|
4309
|
-
`),
|
|
4310
|
-
`, p = !0) : k === "" ?
|
|
4311
|
-
` ?
|
|
4312
|
-
` :
|
|
4313
|
-
` : (
|
|
4322
|
+
`), f += d + m.slice(l) + k, d = `
|
|
4323
|
+
`, p = !0) : k === "" ? d === `
|
|
4324
|
+
` ? f += `
|
|
4325
|
+
` : d = `
|
|
4326
|
+
` : (f += d + k, d = " ", p = !1);
|
|
4314
4327
|
}
|
|
4315
4328
|
switch (i.chomp) {
|
|
4316
4329
|
case "-":
|
|
4317
4330
|
break;
|
|
4318
4331
|
case "+":
|
|
4319
4332
|
for (let h = a; h < o.length; ++h)
|
|
4320
|
-
|
|
4333
|
+
f += `
|
|
4321
4334
|
` + o[h][0].slice(l);
|
|
4322
|
-
|
|
4323
|
-
` && (
|
|
4335
|
+
f[f.length - 1] !== `
|
|
4336
|
+
` && (f += `
|
|
4324
4337
|
`);
|
|
4325
4338
|
break;
|
|
4326
4339
|
default:
|
|
4327
|
-
|
|
4340
|
+
f += `
|
|
4328
4341
|
`;
|
|
4329
4342
|
}
|
|
4330
4343
|
const g = n + i.length + e.source.length;
|
|
4331
|
-
return { value:
|
|
4344
|
+
return { value: f, type: r, comment: i.comment, range: [n, g, g] };
|
|
4332
4345
|
}
|
|
4333
|
-
function
|
|
4346
|
+
function lr({ offset: s, props: e }, t, n) {
|
|
4334
4347
|
if (e[0].type !== "block-scalar-header")
|
|
4335
4348
|
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
4336
4349
|
const { source: i } = e[0], r = i[0];
|
|
4337
4350
|
let o = 0, a = "", l = -1;
|
|
4338
|
-
for (let
|
|
4339
|
-
const p = i[
|
|
4351
|
+
for (let d = 1; d < i.length; ++d) {
|
|
4352
|
+
const p = i[d];
|
|
4340
4353
|
if (!a && (p === "-" || p === "+"))
|
|
4341
4354
|
a = p;
|
|
4342
4355
|
else {
|
|
4343
4356
|
const g = Number(p);
|
|
4344
|
-
!o && g ? o = g : l === -1 && (l = s +
|
|
4357
|
+
!o && g ? o = g : l === -1 && (l = s + d);
|
|
4345
4358
|
}
|
|
4346
4359
|
}
|
|
4347
4360
|
l !== -1 && n(l, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
|
|
4348
|
-
let c = !1,
|
|
4349
|
-
for (let
|
|
4350
|
-
const p = e[
|
|
4361
|
+
let c = !1, u = "", f = i.length;
|
|
4362
|
+
for (let d = 1; d < e.length; ++d) {
|
|
4363
|
+
const p = e[d];
|
|
4351
4364
|
switch (p.type) {
|
|
4352
4365
|
case "space":
|
|
4353
4366
|
c = !0;
|
|
4354
4367
|
// fallthrough
|
|
4355
4368
|
case "newline":
|
|
4356
|
-
|
|
4369
|
+
f += p.source.length;
|
|
4357
4370
|
break;
|
|
4358
4371
|
case "comment":
|
|
4359
|
-
t && !c && n(p, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"),
|
|
4372
|
+
t && !c && n(p, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters"), f += p.source.length, u = p.source.substring(1);
|
|
4360
4373
|
break;
|
|
4361
4374
|
case "error":
|
|
4362
|
-
n(p, "UNEXPECTED_TOKEN", p.message),
|
|
4375
|
+
n(p, "UNEXPECTED_TOKEN", p.message), f += p.source.length;
|
|
4363
4376
|
break;
|
|
4364
4377
|
/* istanbul ignore next should not happen */
|
|
4365
4378
|
default: {
|
|
4366
4379
|
const g = `Unexpected token in block scalar header: ${p.type}`;
|
|
4367
4380
|
n(p, "UNEXPECTED_TOKEN", g);
|
|
4368
4381
|
const h = p.source;
|
|
4369
|
-
h && typeof h == "string" && (
|
|
4382
|
+
h && typeof h == "string" && (f += h.length);
|
|
4370
4383
|
}
|
|
4371
4384
|
}
|
|
4372
4385
|
}
|
|
4373
|
-
return { mode: r, indent: o, chomp: a, comment:
|
|
4386
|
+
return { mode: r, indent: o, chomp: a, comment: u, length: f };
|
|
4374
4387
|
}
|
|
4375
|
-
function
|
|
4388
|
+
function cr(s) {
|
|
4376
4389
|
const e = s.split(/\n( *)/), t = e[0], n = t.match(/^( *)/), r = [n?.[1] ? [n[1], t.slice(n[1].length)] : ["", t]];
|
|
4377
4390
|
for (let o = 1; o < e.length; o += 2)
|
|
4378
4391
|
r.push([e[o], e[o + 1]]);
|
|
4379
4392
|
return r;
|
|
4380
4393
|
}
|
|
4381
|
-
function
|
|
4394
|
+
function ur(s, e, t) {
|
|
4382
4395
|
const { offset: n, type: i, source: r, end: o } = s;
|
|
4383
4396
|
let a, l;
|
|
4384
|
-
const c = (
|
|
4397
|
+
const c = (d, p, g) => t(n + d, p, g);
|
|
4385
4398
|
switch (i) {
|
|
4386
4399
|
case "scalar":
|
|
4387
|
-
a = N.PLAIN, l =
|
|
4400
|
+
a = N.PLAIN, l = fr(r, c);
|
|
4388
4401
|
break;
|
|
4389
4402
|
case "single-quoted-scalar":
|
|
4390
|
-
a = N.QUOTE_SINGLE, l =
|
|
4403
|
+
a = N.QUOTE_SINGLE, l = dr(r, c);
|
|
4391
4404
|
break;
|
|
4392
4405
|
case "double-quoted-scalar":
|
|
4393
|
-
a = N.QUOTE_DOUBLE, l =
|
|
4406
|
+
a = N.QUOTE_DOUBLE, l = hr(r, c);
|
|
4394
4407
|
break;
|
|
4395
4408
|
/* istanbul ignore next should not happen */
|
|
4396
4409
|
default:
|
|
@@ -4401,15 +4414,15 @@ function ar(s, e, t) {
|
|
|
4401
4414
|
range: [n, n + r.length, n + r.length]
|
|
4402
4415
|
};
|
|
4403
4416
|
}
|
|
4404
|
-
const
|
|
4417
|
+
const u = n + r.length, f = xe(o, u, e, t);
|
|
4405
4418
|
return {
|
|
4406
4419
|
value: l,
|
|
4407
4420
|
type: a,
|
|
4408
|
-
comment:
|
|
4409
|
-
range: [n,
|
|
4421
|
+
comment: f.comment,
|
|
4422
|
+
range: [n, u, f.offset]
|
|
4410
4423
|
};
|
|
4411
4424
|
}
|
|
4412
|
-
function
|
|
4425
|
+
function fr(s, e) {
|
|
4413
4426
|
let t = "";
|
|
4414
4427
|
switch (s[0]) {
|
|
4415
4428
|
/* istanbul ignore next should not happen */
|
|
@@ -4435,7 +4448,7 @@ function lr(s, e) {
|
|
|
4435
4448
|
}
|
|
4436
4449
|
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), Xs(s);
|
|
4437
4450
|
}
|
|
4438
|
-
function
|
|
4451
|
+
function dr(s, e) {
|
|
4439
4452
|
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), Xs(s.slice(1, -1)).replace(/''/g, "'");
|
|
4440
4453
|
}
|
|
4441
4454
|
function Xs(s) {
|
|
@@ -4458,7 +4471,7 @@ function Xs(s) {
|
|
|
4458
4471
|
const a = /[ \t]*(.*)/sy;
|
|
4459
4472
|
return a.lastIndex = o, n = a.exec(s), i + r + (n?.[1] ?? "");
|
|
4460
4473
|
}
|
|
4461
|
-
function
|
|
4474
|
+
function hr(s, e) {
|
|
4462
4475
|
let t = "";
|
|
4463
4476
|
for (let n = 1; n < s.length - 1; ++n) {
|
|
4464
4477
|
const i = s[n];
|
|
@@ -4466,11 +4479,11 @@ function ur(s, e) {
|
|
|
4466
4479
|
`))
|
|
4467
4480
|
if (i === `
|
|
4468
4481
|
`) {
|
|
4469
|
-
const { fold: r, offset: o } =
|
|
4482
|
+
const { fold: r, offset: o } = pr(s, n);
|
|
4470
4483
|
t += r, n = o;
|
|
4471
4484
|
} else if (i === "\\") {
|
|
4472
4485
|
let r = s[++n];
|
|
4473
|
-
const o =
|
|
4486
|
+
const o = mr[r];
|
|
4474
4487
|
if (o)
|
|
4475
4488
|
t += o;
|
|
4476
4489
|
else if (r === `
|
|
@@ -4483,7 +4496,7 @@ function ur(s, e) {
|
|
|
4483
4496
|
r = s[++n + 1];
|
|
4484
4497
|
else if (r === "x" || r === "u" || r === "U") {
|
|
4485
4498
|
const a = { x: 2, u: 4, U: 8 }[r];
|
|
4486
|
-
t +=
|
|
4499
|
+
t += gr(s, n + 1, a, e), n += a;
|
|
4487
4500
|
} else {
|
|
4488
4501
|
const a = s.substr(n - 1, 2);
|
|
4489
4502
|
e(n - 1, "BAD_DQ_ESCAPE", `Invalid escape sequence ${a}`), t += a;
|
|
@@ -4501,7 +4514,7 @@ function ur(s, e) {
|
|
|
4501
4514
|
}
|
|
4502
4515
|
return (s[s.length - 1] !== '"' || s.length === 1) && e(s.length, "MISSING_CHAR", 'Missing closing "quote'), t;
|
|
4503
4516
|
}
|
|
4504
|
-
function
|
|
4517
|
+
function pr(s, e) {
|
|
4505
4518
|
let t = "", n = s[e + 1];
|
|
4506
4519
|
for (; (n === " " || n === " " || n === `
|
|
4507
4520
|
` || n === "\r") && !(n === "\r" && s[e + 2] !== `
|
|
@@ -4511,7 +4524,7 @@ function fr(s, e) {
|
|
|
4511
4524
|
`), e += 1, n = s[e + 1];
|
|
4512
4525
|
return t || (t = " "), { fold: t, offset: e };
|
|
4513
4526
|
}
|
|
4514
|
-
const
|
|
4527
|
+
const mr = {
|
|
4515
4528
|
0: "\0",
|
|
4516
4529
|
// null character
|
|
4517
4530
|
a: "\x07",
|
|
@@ -4545,7 +4558,7 @@ const dr = {
|
|
|
4545
4558
|
"\\": "\\",
|
|
4546
4559
|
" ": " "
|
|
4547
4560
|
};
|
|
4548
|
-
function
|
|
4561
|
+
function gr(s, e, t, n) {
|
|
4549
4562
|
const i = s.substr(e, t), o = i.length === t && /^[0-9a-fA-F]+$/.test(i) ? parseInt(i, 16) : NaN;
|
|
4550
4563
|
if (isNaN(o)) {
|
|
4551
4564
|
const a = s.substr(e - 2, t + 2);
|
|
@@ -4554,20 +4567,20 @@ function hr(s, e, t, n) {
|
|
|
4554
4567
|
return String.fromCodePoint(o);
|
|
4555
4568
|
}
|
|
4556
4569
|
function Zs(s, e, t, n) {
|
|
4557
|
-
const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ?
|
|
4570
|
+
const { value: i, type: r, comment: o, range: a } = e.type === "block-scalar" ? ar(s, e, n) : ur(e, s.options.strict, n), l = t ? s.directives.tagName(t.source, (f) => n(t, "TAG_RESOLVE_FAILED", f)) : null;
|
|
4558
4571
|
let c;
|
|
4559
|
-
s.options.stringKeys && s.atKey ? c = s.schema[J] : l ? c =
|
|
4560
|
-
let
|
|
4572
|
+
s.options.stringKeys && s.atKey ? c = s.schema[J] : l ? c = yr(s.schema, i, l, t, n) : e.type === "scalar" ? c = kr(s, i, e, n) : c = s.schema[J];
|
|
4573
|
+
let u;
|
|
4561
4574
|
try {
|
|
4562
|
-
const
|
|
4563
|
-
|
|
4564
|
-
} catch (
|
|
4565
|
-
const
|
|
4566
|
-
n(t ?? e, "TAG_RESOLVE_FAILED",
|
|
4575
|
+
const f = c.resolve(i, (d) => n(t ?? e, "TAG_RESOLVE_FAILED", d), s.options);
|
|
4576
|
+
u = _(f) ? f : new N(f);
|
|
4577
|
+
} catch (f) {
|
|
4578
|
+
const d = f instanceof Error ? f.message : String(f);
|
|
4579
|
+
n(t ?? e, "TAG_RESOLVE_FAILED", d), u = new N(i);
|
|
4567
4580
|
}
|
|
4568
|
-
return
|
|
4581
|
+
return u.range = a, u.source = i, r && (u.type = r), l && (u.tag = l), c.format && (u.format = c.format), o && (u.comment = o), u;
|
|
4569
4582
|
}
|
|
4570
|
-
function
|
|
4583
|
+
function yr(s, e, t, n, i) {
|
|
4571
4584
|
if (t === "!")
|
|
4572
4585
|
return s[J];
|
|
4573
4586
|
const r = [];
|
|
@@ -4583,18 +4596,18 @@ function pr(s, e, t, n, i) {
|
|
|
4583
4596
|
const o = s.knownTags[t];
|
|
4584
4597
|
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[J]);
|
|
4585
4598
|
}
|
|
4586
|
-
function
|
|
4599
|
+
function kr({ atKey: s, directives: e, schema: t }, n, i, r) {
|
|
4587
4600
|
const o = t.tags.find((a) => (a.default === !0 || s && a.default === "key") && a.test?.test(n)) || t[J];
|
|
4588
4601
|
if (t.compat) {
|
|
4589
4602
|
const a = t.compat.find((l) => l.default && l.test?.test(n)) ?? t[J];
|
|
4590
4603
|
if (o.tag !== a.tag) {
|
|
4591
|
-
const l = e.tagString(o.tag), c = e.tagString(a.tag),
|
|
4592
|
-
r(i, "TAG_RESOLVE_FAILED",
|
|
4604
|
+
const l = e.tagString(o.tag), c = e.tagString(a.tag), u = `Value may be parsed as either ${l} or ${c}`;
|
|
4605
|
+
r(i, "TAG_RESOLVE_FAILED", u, !0);
|
|
4593
4606
|
}
|
|
4594
4607
|
}
|
|
4595
4608
|
return o;
|
|
4596
4609
|
}
|
|
4597
|
-
function
|
|
4610
|
+
function wr(s, e, t) {
|
|
4598
4611
|
if (e) {
|
|
4599
4612
|
t ?? (t = e.length);
|
|
4600
4613
|
for (let n = t - 1; n >= 0; --n) {
|
|
@@ -4613,13 +4626,13 @@ function gr(s, e, t) {
|
|
|
4613
4626
|
}
|
|
4614
4627
|
return s;
|
|
4615
4628
|
}
|
|
4616
|
-
const
|
|
4629
|
+
const br = { composeNode: en, composeEmptyNode: Kt };
|
|
4617
4630
|
function en(s, e, t, n) {
|
|
4618
4631
|
const i = s.atKey, { spaceBefore: r, comment: o, anchor: a, tag: l } = t;
|
|
4619
|
-
let c,
|
|
4632
|
+
let c, u = !0;
|
|
4620
4633
|
switch (e.type) {
|
|
4621
4634
|
case "alias":
|
|
4622
|
-
c =
|
|
4635
|
+
c = Sr(s, e, n), (a || l) && n(e, "ALIAS_PROPS", "An alias node must not specify any properties");
|
|
4623
4636
|
break;
|
|
4624
4637
|
case "scalar":
|
|
4625
4638
|
case "single-quoted-scalar":
|
|
@@ -4630,38 +4643,38 @@ function en(s, e, t, n) {
|
|
|
4630
4643
|
case "block-map":
|
|
4631
4644
|
case "block-seq":
|
|
4632
4645
|
case "flow-collection":
|
|
4633
|
-
c =
|
|
4646
|
+
c = or(br, s, e, t, n), a && (c.anchor = a.source.substring(1));
|
|
4634
4647
|
break;
|
|
4635
4648
|
default: {
|
|
4636
|
-
const
|
|
4637
|
-
n(e, "UNEXPECTED_TOKEN",
|
|
4649
|
+
const f = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
4650
|
+
n(e, "UNEXPECTED_TOKEN", f), c = Kt(s, e.offset, void 0, null, t, n), u = !1;
|
|
4638
4651
|
}
|
|
4639
4652
|
}
|
|
4640
|
-
return a && c.anchor === "" && n(a, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!_(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 &&
|
|
4653
|
+
return a && c.anchor === "" && n(a, "BAD_ALIAS", "Anchor cannot be an empty string"), i && s.options.stringKeys && (!_(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 && u && (c.srcToken = e), c;
|
|
4641
4654
|
}
|
|
4642
|
-
function
|
|
4643
|
-
const
|
|
4655
|
+
function Kt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: a, end: l }, c) {
|
|
4656
|
+
const u = {
|
|
4644
4657
|
type: "scalar",
|
|
4645
|
-
offset:
|
|
4658
|
+
offset: wr(e, t, n),
|
|
4646
4659
|
indent: -1,
|
|
4647
4660
|
source: ""
|
|
4648
|
-
},
|
|
4649
|
-
return o && (
|
|
4661
|
+
}, f = Zs(s, u, a, c);
|
|
4662
|
+
return o && (f.anchor = o.source.substring(1), f.anchor === "" && c(o, "BAD_ALIAS", "Anchor cannot be an empty string")), i && (f.spaceBefore = !0), r && (f.comment = r, f.range[2] = l), f;
|
|
4650
4663
|
}
|
|
4651
|
-
function
|
|
4652
|
-
const r = new
|
|
4664
|
+
function Sr({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
4665
|
+
const r = new At(t.substring(1));
|
|
4653
4666
|
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);
|
|
4654
4667
|
const o = e + t.length, a = xe(n, o, s.strict, i);
|
|
4655
4668
|
return r.range = [e, o, a.offset], a.comment && (r.comment = a.comment), r;
|
|
4656
4669
|
}
|
|
4657
|
-
function
|
|
4670
|
+
function vr(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
4658
4671
|
const a = Object.assign({ _directives: e }, s), l = new Ue(void 0, a), c = {
|
|
4659
4672
|
atKey: !1,
|
|
4660
4673
|
atRoot: !0,
|
|
4661
4674
|
directives: l.directives,
|
|
4662
4675
|
options: l.options,
|
|
4663
4676
|
schema: l.schema
|
|
4664
|
-
},
|
|
4677
|
+
}, u = ge(n, {
|
|
4665
4678
|
indicator: "doc-start",
|
|
4666
4679
|
next: i ?? r?.[0],
|
|
4667
4680
|
offset: t,
|
|
@@ -4669,9 +4682,9 @@ function wr(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
|
4669
4682
|
parentIndent: 0,
|
|
4670
4683
|
startOnNewline: !0
|
|
4671
4684
|
});
|
|
4672
|
-
|
|
4673
|
-
const
|
|
4674
|
-
return
|
|
4685
|
+
u.found && (l.directives.docStart = !0, i && (i.type === "block-map" || i.type === "block-seq") && !u.hasNewline && o(u.end, "MISSING_CHAR", "Block collection cannot start on same line with directives-end marker")), l.contents = i ? en(c, i, u, o) : Kt(c, u.end, n, null, u, o);
|
|
4686
|
+
const f = l.contents.range[2], d = xe(r, f, !1, o);
|
|
4687
|
+
return d.comment && (l.comment = d.comment), l.range = [t, f, d.offset], l;
|
|
4675
4688
|
}
|
|
4676
4689
|
function Se(s) {
|
|
4677
4690
|
if (typeof s == "number")
|
|
@@ -4681,7 +4694,7 @@ function Se(s) {
|
|
|
4681
4694
|
const { offset: e, source: t } = s;
|
|
4682
4695
|
return [e, e + (typeof t == "string" ? t.length : 1)];
|
|
4683
4696
|
}
|
|
4684
|
-
function
|
|
4697
|
+
function ss(s) {
|
|
4685
4698
|
let e = "", t = !1, n = !1;
|
|
4686
4699
|
for (let i = 0; i < s.length; ++i) {
|
|
4687
4700
|
const r = s[i];
|
|
@@ -4701,15 +4714,15 @@ function ts(s) {
|
|
|
4701
4714
|
}
|
|
4702
4715
|
return { comment: e, afterEmptyLine: n };
|
|
4703
4716
|
}
|
|
4704
|
-
class
|
|
4717
|
+
class Nr {
|
|
4705
4718
|
constructor(e = {}) {
|
|
4706
4719
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
4707
4720
|
const o = Se(t);
|
|
4708
|
-
r ? this.warnings.push(new
|
|
4721
|
+
r ? this.warnings.push(new sr(o, n, i)) : this.errors.push(new Ne(o, n, i));
|
|
4709
4722
|
}, this.directives = new P({ version: e.version || "1.2" }), this.options = e;
|
|
4710
4723
|
}
|
|
4711
4724
|
decorate(e, t) {
|
|
4712
|
-
const { comment: n, afterEmptyLine: i } =
|
|
4725
|
+
const { comment: n, afterEmptyLine: i } = ss(this.prelude);
|
|
4713
4726
|
if (n) {
|
|
4714
4727
|
const r = e.contents;
|
|
4715
4728
|
if (t)
|
|
@@ -4738,7 +4751,7 @@ ${o}` : n;
|
|
|
4738
4751
|
*/
|
|
4739
4752
|
streamInfo() {
|
|
4740
4753
|
return {
|
|
4741
|
-
comment:
|
|
4754
|
+
comment: ss(this.prelude).comment,
|
|
4742
4755
|
directives: this.directives,
|
|
4743
4756
|
errors: this.errors,
|
|
4744
4757
|
warnings: this.warnings
|
|
@@ -4765,7 +4778,7 @@ ${o}` : n;
|
|
|
4765
4778
|
}), this.prelude.push(e.source), this.atDirectives = !0;
|
|
4766
4779
|
break;
|
|
4767
4780
|
case "document": {
|
|
4768
|
-
const t =
|
|
4781
|
+
const t = vr(this.options, this.directives, e, this.onError);
|
|
4769
4782
|
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;
|
|
4770
4783
|
break;
|
|
4771
4784
|
}
|
|
@@ -4817,7 +4830,7 @@ ${t.comment}` : t.comment;
|
|
|
4817
4830
|
}
|
|
4818
4831
|
}
|
|
4819
4832
|
const tn = "\uFEFF", sn = "", nn = "", It = "";
|
|
4820
|
-
function
|
|
4833
|
+
function Ir(s) {
|
|
4821
4834
|
switch (s) {
|
|
4822
4835
|
case tn:
|
|
4823
4836
|
return "byte-order-mark";
|
|
@@ -4891,9 +4904,9 @@ function q(s) {
|
|
|
4891
4904
|
return !1;
|
|
4892
4905
|
}
|
|
4893
4906
|
}
|
|
4894
|
-
const
|
|
4895
|
-
\r `), mt = (s) => !s ||
|
|
4896
|
-
class
|
|
4907
|
+
const ns = new Set("0123456789ABCDEFabcdef"), Tr = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), qe = new Set(",[]{}"), Or = new Set(` ,[]{}
|
|
4908
|
+
\r `), mt = (s) => !s || Or.has(s);
|
|
4909
|
+
class _r {
|
|
4897
4910
|
constructor() {
|
|
4898
4911
|
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;
|
|
4899
4912
|
}
|
|
@@ -5278,9 +5291,9 @@ class Ir {
|
|
|
5278
5291
|
} else {
|
|
5279
5292
|
let e = this.pos + 1, t = this.buffer[e];
|
|
5280
5293
|
for (; t; )
|
|
5281
|
-
if (
|
|
5294
|
+
if (Tr.has(t))
|
|
5282
5295
|
t = this.buffer[++e];
|
|
5283
|
-
else if (t === "%" &&
|
|
5296
|
+
else if (t === "%" && ns.has(this.buffer[e + 1]) && ns.has(this.buffer[e + 2]))
|
|
5284
5297
|
t = this.buffer[e += 3];
|
|
5285
5298
|
else
|
|
5286
5299
|
break;
|
|
@@ -5308,7 +5321,7 @@ class Ir {
|
|
|
5308
5321
|
return yield* this.pushToIndex(t, !1);
|
|
5309
5322
|
}
|
|
5310
5323
|
}
|
|
5311
|
-
class
|
|
5324
|
+
class Cr {
|
|
5312
5325
|
constructor() {
|
|
5313
5326
|
this.lineStarts = [], this.addNewLine = (e) => this.lineStarts.push(e), this.linePos = (e) => {
|
|
5314
5327
|
let t = 0, n = this.lineStarts.length;
|
|
@@ -5325,13 +5338,13 @@ class Tr {
|
|
|
5325
5338
|
};
|
|
5326
5339
|
}
|
|
5327
5340
|
}
|
|
5328
|
-
function
|
|
5341
|
+
function Q(s, e) {
|
|
5329
5342
|
for (let t = 0; t < s.length; ++t)
|
|
5330
5343
|
if (s[t].type === e)
|
|
5331
5344
|
return !0;
|
|
5332
5345
|
return !1;
|
|
5333
5346
|
}
|
|
5334
|
-
function
|
|
5347
|
+
function is(s) {
|
|
5335
5348
|
for (let e = 0; e < s.length; ++e)
|
|
5336
5349
|
switch (s[e].type) {
|
|
5337
5350
|
case "space":
|
|
@@ -5387,18 +5400,18 @@ function le(s) {
|
|
|
5387
5400
|
;
|
|
5388
5401
|
return s.splice(e, s.length);
|
|
5389
5402
|
}
|
|
5390
|
-
function
|
|
5403
|
+
function rs(s) {
|
|
5391
5404
|
if (s.start.type === "flow-seq-start")
|
|
5392
5405
|
for (const e of s.items)
|
|
5393
|
-
e.sep && !e.value && !
|
|
5406
|
+
e.sep && !e.value && !Q(e.start, "explicit-key-ind") && !Q(e.sep, "map-value-ind") && (e.key && (e.value = e.key), delete e.key, rn(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);
|
|
5394
5407
|
}
|
|
5395
|
-
class
|
|
5408
|
+
class Lr {
|
|
5396
5409
|
/**
|
|
5397
5410
|
* @param onNewLine - If defined, called separately with the start position of
|
|
5398
5411
|
* each new line (in `parse()`, including the start of input).
|
|
5399
5412
|
*/
|
|
5400
5413
|
constructor(e) {
|
|
5401
|
-
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new
|
|
5414
|
+
this.atNewLine = !0, this.atScalar = !1, this.indent = 0, this.offset = 0, this.onKeyLine = !1, this.stack = [], this.source = "", this.type = "", this.lexer = new _r(), this.onNewLine = e;
|
|
5402
5415
|
}
|
|
5403
5416
|
/**
|
|
5404
5417
|
* Parse `source` as a YAML stream.
|
|
@@ -5422,7 +5435,7 @@ class Or {
|
|
|
5422
5435
|
this.atScalar = !1, yield* this.step(), this.offset += e.length;
|
|
5423
5436
|
return;
|
|
5424
5437
|
}
|
|
5425
|
-
const t =
|
|
5438
|
+
const t = Ir(e);
|
|
5426
5439
|
if (t)
|
|
5427
5440
|
if (t === "scalar")
|
|
5428
5441
|
this.atNewLine = !1, this.atScalar = !0, this.type = "scalar";
|
|
@@ -5511,7 +5524,7 @@ class Or {
|
|
|
5511
5524
|
yield t;
|
|
5512
5525
|
else {
|
|
5513
5526
|
const n = this.peek(1);
|
|
5514
|
-
switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" &&
|
|
5527
|
+
switch (t.type === "block-scalar" ? t.indent = "indent" in n ? n.indent : 0 : t.type === "flow-collection" && n.type === "document" && (t.indent = 0), t.type === "flow-collection" && rs(t), n.type) {
|
|
5515
5528
|
case "document":
|
|
5516
5529
|
n.value = t;
|
|
5517
5530
|
break;
|
|
@@ -5547,7 +5560,7 @@ class Or {
|
|
|
5547
5560
|
}
|
|
5548
5561
|
if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
5549
5562
|
const i = t.items[t.items.length - 1];
|
|
5550
|
-
i && !i.sep && !i.value && i.start.length > 0 &&
|
|
5563
|
+
i && !i.sep && !i.value && i.start.length > 0 && is(i.start) === -1 && (t.indent === 0 || i.start.every((r) => r.type !== "comment" || r.indent < t.indent)) && (n.type === "document" ? n.end = i.start : n.items.push({ start: i.start }), t.items.splice(-1, 1));
|
|
5551
5564
|
}
|
|
5552
5565
|
}
|
|
5553
5566
|
}
|
|
@@ -5585,7 +5598,7 @@ class Or {
|
|
|
5585
5598
|
return yield* this.lineEnd(e);
|
|
5586
5599
|
switch (this.type) {
|
|
5587
5600
|
case "doc-start": {
|
|
5588
|
-
|
|
5601
|
+
is(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
|
|
5589
5602
|
return;
|
|
5590
5603
|
}
|
|
5591
5604
|
case "anchor":
|
|
@@ -5708,14 +5721,14 @@ class Or {
|
|
|
5708
5721
|
if (t.sep)
|
|
5709
5722
|
if (t.value)
|
|
5710
5723
|
e.items.push({ start: [], key: null, sep: [this.sourceToken] });
|
|
5711
|
-
else if (
|
|
5724
|
+
else if (Q(t.sep, "map-value-ind"))
|
|
5712
5725
|
this.stack.push({
|
|
5713
5726
|
type: "block-map",
|
|
5714
5727
|
offset: this.offset,
|
|
5715
5728
|
indent: this.indent,
|
|
5716
5729
|
items: [{ start: r, key: null, sep: [this.sourceToken] }]
|
|
5717
5730
|
});
|
|
5718
|
-
else if (rn(t.key) && !
|
|
5731
|
+
else if (rn(t.key) && !Q(t.sep, "newline")) {
|
|
5719
5732
|
const o = le(t.start), a = t.key, l = t.sep;
|
|
5720
5733
|
l.push(this.sourceToken), delete t.key, delete t.sep, this.stack.push({
|
|
5721
5734
|
type: "block-map",
|
|
@@ -5724,7 +5737,7 @@ class Or {
|
|
|
5724
5737
|
items: [{ start: o, key: a, sep: l }]
|
|
5725
5738
|
});
|
|
5726
5739
|
} else r.length > 0 ? t.sep = t.sep.concat(r, this.sourceToken) : t.sep.push(this.sourceToken);
|
|
5727
|
-
else if (
|
|
5740
|
+
else if (Q(t.start, "newline"))
|
|
5728
5741
|
Object.assign(t, { key: null, sep: [this.sourceToken] });
|
|
5729
5742
|
else {
|
|
5730
5743
|
const o = le(t.start);
|
|
@@ -5736,7 +5749,7 @@ class Or {
|
|
|
5736
5749
|
});
|
|
5737
5750
|
}
|
|
5738
5751
|
else
|
|
5739
|
-
t.sep ? t.value || i ? e.items.push({ start: r, key: null, sep: [this.sourceToken] }) :
|
|
5752
|
+
t.sep ? t.value || i ? e.items.push({ start: r, key: null, sep: [this.sourceToken] }) : Q(t.sep, "map-value-ind") ? this.stack.push({
|
|
5740
5753
|
type: "block-map",
|
|
5741
5754
|
offset: this.offset,
|
|
5742
5755
|
indent: this.indent,
|
|
@@ -5756,7 +5769,7 @@ class Or {
|
|
|
5756
5769
|
const o = this.startBlockValue(e);
|
|
5757
5770
|
if (o) {
|
|
5758
5771
|
if (o.type === "block-seq") {
|
|
5759
|
-
if (!t.explicitKey && t.sep && !
|
|
5772
|
+
if (!t.explicitKey && t.sep && !Q(t.sep, "newline")) {
|
|
5760
5773
|
yield* this.pop({
|
|
5761
5774
|
type: "error",
|
|
5762
5775
|
offset: this.offset,
|
|
@@ -5808,7 +5821,7 @@ class Or {
|
|
|
5808
5821
|
case "seq-item-ind":
|
|
5809
5822
|
if (this.indent !== e.indent)
|
|
5810
5823
|
break;
|
|
5811
|
-
t.value ||
|
|
5824
|
+
t.value || Q(t.start, "seq-item-ind") ? e.items.push({ start: [this.sourceToken] }) : t.start.push(this.sourceToken);
|
|
5812
5825
|
return;
|
|
5813
5826
|
}
|
|
5814
5827
|
if (this.indent > e.indent) {
|
|
@@ -5864,7 +5877,7 @@ class Or {
|
|
|
5864
5877
|
yield* this.pop(), yield* this.step();
|
|
5865
5878
|
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
5866
5879
|
const i = Ke(n), r = le(i);
|
|
5867
|
-
|
|
5880
|
+
rs(e);
|
|
5868
5881
|
const o = e.end.splice(1, e.end.length);
|
|
5869
5882
|
o.push(this.sourceToken);
|
|
5870
5883
|
const a = {
|
|
@@ -5971,12 +5984,12 @@ class Or {
|
|
|
5971
5984
|
}
|
|
5972
5985
|
}
|
|
5973
5986
|
}
|
|
5974
|
-
function
|
|
5987
|
+
function Ar(s) {
|
|
5975
5988
|
const e = s.prettyErrors !== !1;
|
|
5976
|
-
return { lineCounter: s.lineCounter || e && new
|
|
5989
|
+
return { lineCounter: s.lineCounter || e && new Cr() || null, prettyErrors: e };
|
|
5977
5990
|
}
|
|
5978
|
-
function
|
|
5979
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
5991
|
+
function Er(s, e = {}) {
|
|
5992
|
+
const { lineCounter: t, prettyErrors: n } = Ar(e), i = new Lr(t?.addNewLine), r = new Nr(e);
|
|
5980
5993
|
let o = null;
|
|
5981
5994
|
for (const a of r.compose(i.parse(s), !0, s.length))
|
|
5982
5995
|
if (!o)
|
|
@@ -5985,11 +5998,11 @@ function Cr(s, e = {}) {
|
|
|
5985
5998
|
o.errors.push(new Ne(a.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
5986
5999
|
break;
|
|
5987
6000
|
}
|
|
5988
|
-
return n && t && (o.errors.forEach(
|
|
6001
|
+
return n && t && (o.errors.forEach(es(s, t)), o.warnings.forEach(es(s, t))), o;
|
|
5989
6002
|
}
|
|
5990
|
-
function
|
|
6003
|
+
function $r(s, e, t) {
|
|
5991
6004
|
let n;
|
|
5992
|
-
const i =
|
|
6005
|
+
const i = Er(s, t);
|
|
5993
6006
|
if (!i)
|
|
5994
6007
|
return null;
|
|
5995
6008
|
if (i.warnings.forEach((r) => Es(i.options.logLevel, r)), i.errors.length > 0) {
|
|
@@ -6012,30 +6025,30 @@ function on(s, e, t) {
|
|
|
6012
6025
|
}
|
|
6013
6026
|
return $e(s) && !n ? s.toString(t) : new Ue(s, n, t).toString(t);
|
|
6014
6027
|
}
|
|
6015
|
-
const
|
|
6028
|
+
const jr = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/;
|
|
6016
6029
|
function an(s) {
|
|
6017
|
-
const e =
|
|
6030
|
+
const e = jr.exec(s);
|
|
6018
6031
|
return e ? {
|
|
6019
|
-
data:
|
|
6032
|
+
data: $r(e[1] ?? "") ?? {},
|
|
6020
6033
|
content: e[2] ?? ""
|
|
6021
6034
|
} : { data: {}, content: s };
|
|
6022
6035
|
}
|
|
6023
|
-
const
|
|
6024
|
-
"../../../../skills/taskless-check/SKILL.md":
|
|
6025
|
-
"../../../../skills/taskless-info/SKILL.md":
|
|
6026
|
-
"../../../../skills/taskless-login/SKILL.md":
|
|
6027
|
-
"../../../../skills/taskless-logout/SKILL.md":
|
|
6028
|
-
"../../../../skills/taskless-rule-create/SKILL.md":
|
|
6029
|
-
"../../../../skills/taskless-rule-delete/SKILL.md":
|
|
6030
|
-
"../../../../skills/taskless-update-engine/SKILL.md":
|
|
6031
|
-
}),
|
|
6032
|
-
"../../../../commands/taskless/check.md":
|
|
6033
|
-
"../../../../commands/taskless/info.md":
|
|
6034
|
-
"../../../../commands/taskless/login.md":
|
|
6035
|
-
"../../../../commands/taskless/logout.md":
|
|
6036
|
-
"../../../../commands/taskless/rule.md":
|
|
6037
|
-
"../../../../commands/taskless/update-engine.md":
|
|
6038
|
-
}),
|
|
6036
|
+
const Rr = /* @__PURE__ */ Object.assign({
|
|
6037
|
+
"../../../../skills/taskless-check/SKILL.md": ui,
|
|
6038
|
+
"../../../../skills/taskless-info/SKILL.md": fi,
|
|
6039
|
+
"../../../../skills/taskless-login/SKILL.md": di,
|
|
6040
|
+
"../../../../skills/taskless-logout/SKILL.md": hi,
|
|
6041
|
+
"../../../../skills/taskless-rule-create/SKILL.md": pi,
|
|
6042
|
+
"../../../../skills/taskless-rule-delete/SKILL.md": mi,
|
|
6043
|
+
"../../../../skills/taskless-update-engine/SKILL.md": gi
|
|
6044
|
+
}), Pr = /* @__PURE__ */ Object.assign({
|
|
6045
|
+
"../../../../commands/taskless/check.md": yi,
|
|
6046
|
+
"../../../../commands/taskless/info.md": ki,
|
|
6047
|
+
"../../../../commands/taskless/login.md": wi,
|
|
6048
|
+
"../../../../commands/taskless/logout.md": bi,
|
|
6049
|
+
"../../../../commands/taskless/rule.md": Si,
|
|
6050
|
+
"../../../../commands/taskless/update-engine.md": vi
|
|
6051
|
+
}), Ur = [
|
|
6039
6052
|
{
|
|
6040
6053
|
name: "Claude Code",
|
|
6041
6054
|
dir: ".claude",
|
|
@@ -6049,14 +6062,14 @@ const Er = /* @__PURE__ */ Object.assign({
|
|
|
6049
6062
|
];
|
|
6050
6063
|
async function ln(s) {
|
|
6051
6064
|
return (await Promise.all(
|
|
6052
|
-
|
|
6065
|
+
Ur.map(async (t) => await fs(C(s, t.dir)).then((i) => i.isDirectory()).catch(() => !1) ? t : void 0)
|
|
6053
6066
|
)).filter((t) => t !== void 0);
|
|
6054
6067
|
}
|
|
6055
6068
|
function cn() {
|
|
6056
|
-
return Object.entries(
|
|
6069
|
+
return Object.entries(Rr).map(([s, e]) => {
|
|
6057
6070
|
const t = an(e), n = t.data;
|
|
6058
6071
|
return {
|
|
6059
|
-
name: n.name ?? us(
|
|
6072
|
+
name: n.name ?? us(Tt(s)),
|
|
6060
6073
|
description: n.description ?? "",
|
|
6061
6074
|
content: e,
|
|
6062
6075
|
body: t.content,
|
|
@@ -6064,13 +6077,13 @@ function cn() {
|
|
|
6064
6077
|
};
|
|
6065
6078
|
});
|
|
6066
6079
|
}
|
|
6067
|
-
function
|
|
6068
|
-
return Object.entries(
|
|
6080
|
+
function xr() {
|
|
6081
|
+
return Object.entries(Pr).map(([s, e]) => ({
|
|
6069
6082
|
filename: us(s),
|
|
6070
6083
|
content: e
|
|
6071
6084
|
}));
|
|
6072
6085
|
}
|
|
6073
|
-
async function
|
|
6086
|
+
async function Mr(s, e, t, n) {
|
|
6074
6087
|
const i = [], r = [];
|
|
6075
6088
|
for (const o of t) {
|
|
6076
6089
|
const a = C(s, e.dir, e.skills.path, o.name);
|
|
@@ -6088,7 +6101,7 @@ async function Pr(s, e, t, n) {
|
|
|
6088
6101
|
}
|
|
6089
6102
|
return { skills: i, commands: r };
|
|
6090
6103
|
}
|
|
6091
|
-
async function
|
|
6104
|
+
async function Dr(s) {
|
|
6092
6105
|
try {
|
|
6093
6106
|
const e = await Ee(s, "utf8");
|
|
6094
6107
|
return an(e).data.metadata?.version;
|
|
@@ -6096,7 +6109,7 @@ async function Ur(s) {
|
|
|
6096
6109
|
return;
|
|
6097
6110
|
}
|
|
6098
6111
|
}
|
|
6099
|
-
async function
|
|
6112
|
+
async function Br(s) {
|
|
6100
6113
|
const e = cn(), t = await ln(s), n = [];
|
|
6101
6114
|
for (const i of t) {
|
|
6102
6115
|
const r = [];
|
|
@@ -6107,7 +6120,7 @@ async function xr(s) {
|
|
|
6107
6120
|
i.skills.path,
|
|
6108
6121
|
o.name,
|
|
6109
6122
|
"SKILL.md"
|
|
6110
|
-
), l = await
|
|
6123
|
+
), l = await Dr(a), c = o.metadata.version ?? "unknown";
|
|
6111
6124
|
r.push({
|
|
6112
6125
|
name: o.name,
|
|
6113
6126
|
installedVersion: l,
|
|
@@ -6119,7 +6132,7 @@ async function xr(s) {
|
|
|
6119
6132
|
}
|
|
6120
6133
|
return n;
|
|
6121
6134
|
}
|
|
6122
|
-
const
|
|
6135
|
+
const qr = {
|
|
6123
6136
|
meta: {
|
|
6124
6137
|
name: "init",
|
|
6125
6138
|
description: "Install or update Taskless skills"
|
|
@@ -6132,7 +6145,7 @@ const Mr = {
|
|
|
6132
6145
|
}
|
|
6133
6146
|
},
|
|
6134
6147
|
async run({ args: s }) {
|
|
6135
|
-
const e =
|
|
6148
|
+
const e = H(s.dir ?? process.cwd()), t = cn(), n = xr(), i = await ln(e);
|
|
6136
6149
|
if (i.length === 0) {
|
|
6137
6150
|
console.log(
|
|
6138
6151
|
`No supported tool directories detected.
|
|
@@ -6144,7 +6157,7 @@ Alternative installation methods:
|
|
|
6144
6157
|
return;
|
|
6145
6158
|
}
|
|
6146
6159
|
for (const r of i) {
|
|
6147
|
-
const o = await
|
|
6160
|
+
const o = await Mr(e, r, t, n);
|
|
6148
6161
|
console.log(
|
|
6149
6162
|
`${r.name}: installed ${String(o.skills.length)} skill(s)`
|
|
6150
6163
|
);
|
|
@@ -6156,7 +6169,7 @@ Alternative installation methods:
|
|
|
6156
6169
|
}
|
|
6157
6170
|
}
|
|
6158
6171
|
};
|
|
6159
|
-
async function
|
|
6172
|
+
async function Kr(s) {
|
|
6160
6173
|
try {
|
|
6161
6174
|
const e = ne(), t = await fetch(`${e}/api/whoami`, {
|
|
6162
6175
|
headers: { Authorization: `Bearer ${s}` }
|
|
@@ -6166,7 +6179,7 @@ async function Dr(s) {
|
|
|
6166
6179
|
return;
|
|
6167
6180
|
}
|
|
6168
6181
|
}
|
|
6169
|
-
const
|
|
6182
|
+
const Fr = {
|
|
6170
6183
|
meta: {
|
|
6171
6184
|
name: "info",
|
|
6172
6185
|
description: "Show Taskless CLI information"
|
|
@@ -6179,10 +6192,10 @@ const Br = {
|
|
|
6179
6192
|
}
|
|
6180
6193
|
},
|
|
6181
6194
|
async run({ args: s }) {
|
|
6182
|
-
const e =
|
|
6195
|
+
const e = H(s.dir ?? process.cwd()), [t, n] = await Promise.all([Br(e), Ge()]);
|
|
6183
6196
|
let i;
|
|
6184
6197
|
if (n) {
|
|
6185
|
-
const r = await
|
|
6198
|
+
const r = await Kr(n);
|
|
6186
6199
|
r && (i = {
|
|
6187
6200
|
user: r.user,
|
|
6188
6201
|
email: r.email,
|
|
@@ -6192,14 +6205,14 @@ const Br = {
|
|
|
6192
6205
|
console.log(
|
|
6193
6206
|
JSON.stringify({
|
|
6194
6207
|
success: !0,
|
|
6195
|
-
version: "0.1.
|
|
6208
|
+
version: "0.1.3",
|
|
6196
6209
|
tools: t,
|
|
6197
6210
|
loggedIn: n !== void 0,
|
|
6198
6211
|
auth: i
|
|
6199
6212
|
})
|
|
6200
6213
|
);
|
|
6201
6214
|
}
|
|
6202
|
-
},
|
|
6215
|
+
}, Jr = `Authenticate with taskless.io
|
|
6203
6216
|
|
|
6204
6217
|
Starts a device authorization flow. The CLI displays a URL and a one-time
|
|
6205
6218
|
code. Open the URL in a browser, enter the code, and authorize access.
|
|
@@ -6216,7 +6229,7 @@ Environment Variable:
|
|
|
6216
6229
|
|
|
6217
6230
|
Examples:
|
|
6218
6231
|
taskless auth login
|
|
6219
|
-
`,
|
|
6232
|
+
`, Vr = `Remove saved authentication
|
|
6220
6233
|
|
|
6221
6234
|
Deletes the locally saved authentication token. If using the
|
|
6222
6235
|
TASKLESS_TOKEN environment variable, unset it separately.
|
|
@@ -6229,14 +6242,14 @@ Credential Storage:
|
|
|
6229
6242
|
|
|
6230
6243
|
Examples:
|
|
6231
6244
|
taskless auth logout
|
|
6232
|
-
`,
|
|
6245
|
+
`, Wr = `Manage authentication with taskless.io
|
|
6233
6246
|
|
|
6234
6247
|
Commands:
|
|
6235
6248
|
login Authenticate via device flow
|
|
6236
6249
|
logout Remove saved credentials
|
|
6237
6250
|
|
|
6238
6251
|
Run \`taskless help auth <command>\` for details on a specific command.
|
|
6239
|
-
`,
|
|
6252
|
+
`, Yr = `Run Taskless rules against your codebase
|
|
6240
6253
|
|
|
6241
6254
|
Scans your project using ast-grep rules defined in .taskless/rules/.
|
|
6242
6255
|
|
|
@@ -6263,7 +6276,7 @@ Examples:
|
|
|
6263
6276
|
taskless check
|
|
6264
6277
|
taskless check -d ./my-project
|
|
6265
6278
|
taskless check --json
|
|
6266
|
-
`,
|
|
6279
|
+
`, Hr = `Show Taskless CLI information
|
|
6267
6280
|
|
|
6268
6281
|
Outputs a JSON object with the CLI version, installed tool/skill status,
|
|
6269
6282
|
and authentication state.
|
|
@@ -6284,7 +6297,7 @@ Output:
|
|
|
6284
6297
|
Examples:
|
|
6285
6298
|
taskless info
|
|
6286
6299
|
taskless info -d ./my-project
|
|
6287
|
-
`,
|
|
6300
|
+
`, Gr = `Install Taskless skills
|
|
6288
6301
|
|
|
6289
6302
|
Detects supported coding agent tools in your project and installs
|
|
6290
6303
|
Taskless skills and commands for each one. Currently supports Claude Code.
|
|
@@ -6308,7 +6321,7 @@ Alternative Installation:
|
|
|
6308
6321
|
Examples:
|
|
6309
6322
|
taskless init
|
|
6310
6323
|
taskless init -d ./my-project
|
|
6311
|
-
`,
|
|
6324
|
+
`, zr = `Create a new rule from a JSON file
|
|
6312
6325
|
|
|
6313
6326
|
Reads a JSON file describing the desired rule, submits it to the Taskless
|
|
6314
6327
|
API for generation, and writes the resulting rule and test files to
|
|
@@ -6338,7 +6351,7 @@ Output:
|
|
|
6338
6351
|
Examples:
|
|
6339
6352
|
taskless rules create --from request.json
|
|
6340
6353
|
taskless rules create --from .taskless/.tmp-rule-request.json --json
|
|
6341
|
-
`,
|
|
6354
|
+
`, Qr = `Delete a rule and its test files
|
|
6342
6355
|
|
|
6343
6356
|
Removes a rule YAML file and any associated test files from the project.
|
|
6344
6357
|
|
|
@@ -6358,14 +6371,14 @@ Exit Codes:
|
|
|
6358
6371
|
Examples:
|
|
6359
6372
|
taskless rules delete no-console-log
|
|
6360
6373
|
taskless rules delete detect-innerhtml -d ./my-project
|
|
6361
|
-
`,
|
|
6374
|
+
`, Xr = `Manage Taskless rules
|
|
6362
6375
|
|
|
6363
6376
|
Commands:
|
|
6364
6377
|
create Create a new rule from a description
|
|
6365
6378
|
delete Delete a rule and its test files
|
|
6366
6379
|
|
|
6367
6380
|
Run \`taskless help rules <command>\` for details on a specific command.
|
|
6368
|
-
`,
|
|
6381
|
+
`, Zr = `Request a scaffold upgrade for the .taskless/ engine directory
|
|
6369
6382
|
|
|
6370
6383
|
Sends your project's current scaffold version to the Taskless backend,
|
|
6371
6384
|
which creates a pull request to upgrade the .taskless/ directory. The
|
|
@@ -6393,35 +6406,35 @@ Examples:
|
|
|
6393
6406
|
taskless update-engine
|
|
6394
6407
|
taskless update-engine --json
|
|
6395
6408
|
taskless update-engine -d ./my-project
|
|
6396
|
-
`,
|
|
6397
|
-
"../help/auth-login.txt":
|
|
6398
|
-
"../help/auth-logout.txt":
|
|
6399
|
-
"../help/auth.txt":
|
|
6400
|
-
"../help/check.txt":
|
|
6401
|
-
"../help/info.txt":
|
|
6402
|
-
"../help/init.txt":
|
|
6403
|
-
"../help/rules-create.txt":
|
|
6404
|
-
"../help/rules-delete.txt":
|
|
6405
|
-
"../help/rules.txt":
|
|
6406
|
-
"../help/update-engine.txt":
|
|
6409
|
+
`, eo = /* @__PURE__ */ Object.assign({
|
|
6410
|
+
"../help/auth-login.txt": Jr,
|
|
6411
|
+
"../help/auth-logout.txt": Vr,
|
|
6412
|
+
"../help/auth.txt": Wr,
|
|
6413
|
+
"../help/check.txt": Yr,
|
|
6414
|
+
"../help/info.txt": Hr,
|
|
6415
|
+
"../help/init.txt": Gr,
|
|
6416
|
+
"../help/rules-create.txt": zr,
|
|
6417
|
+
"../help/rules-delete.txt": Qr,
|
|
6418
|
+
"../help/rules.txt": Xr,
|
|
6419
|
+
"../help/update-engine.txt": Zr
|
|
6407
6420
|
});
|
|
6408
|
-
function
|
|
6421
|
+
function to() {
|
|
6409
6422
|
const s = /* @__PURE__ */ new Map();
|
|
6410
|
-
for (const [e, t] of Object.entries(
|
|
6423
|
+
for (const [e, t] of Object.entries(eo)) {
|
|
6411
6424
|
const n = e.split("/").pop()?.replace(/\.txt$/, "");
|
|
6412
6425
|
n && s.set(n, t);
|
|
6413
6426
|
}
|
|
6414
6427
|
return s;
|
|
6415
6428
|
}
|
|
6416
|
-
const
|
|
6417
|
-
async function
|
|
6429
|
+
const so = to();
|
|
6430
|
+
async function os(s) {
|
|
6418
6431
|
return typeof s == "function" ? s() : s;
|
|
6419
6432
|
}
|
|
6420
|
-
async function
|
|
6421
|
-
const e = await
|
|
6422
|
-
return (e.meta ? await
|
|
6433
|
+
async function no(s) {
|
|
6434
|
+
const e = await os(s);
|
|
6435
|
+
return (e.meta ? await os(e.meta) : void 0)?.description ?? "";
|
|
6423
6436
|
}
|
|
6424
|
-
function
|
|
6437
|
+
function io(s) {
|
|
6425
6438
|
return {
|
|
6426
6439
|
meta: {
|
|
6427
6440
|
name: "help",
|
|
@@ -6437,7 +6450,7 @@ function to(s) {
|
|
|
6437
6450
|
const r = [];
|
|
6438
6451
|
for (const [a, l] of Object.entries(s)) {
|
|
6439
6452
|
if (a === "help") continue;
|
|
6440
|
-
const c = await
|
|
6453
|
+
const c = await no(l);
|
|
6441
6454
|
r.push([a, c]);
|
|
6442
6455
|
}
|
|
6443
6456
|
const o = Math.max(...r.map(([a]) => a.length));
|
|
@@ -6448,7 +6461,7 @@ function to(s) {
|
|
|
6448
6461
|
);
|
|
6449
6462
|
return;
|
|
6450
6463
|
}
|
|
6451
|
-
const n = t.join("-"), i =
|
|
6464
|
+
const n = t.join("-"), i = so.get(n);
|
|
6452
6465
|
i ? console.log(i.trimEnd()) : (console.error(`Unknown command: ${t.join(" ")}`), console.error("Run `taskless help` for available commands."), process.exitCode = 1);
|
|
6453
6466
|
}
|
|
6454
6467
|
};
|
|
@@ -6478,7 +6491,7 @@ async function un(s) {
|
|
|
6478
6491
|
`Invalid spec version "${n.version}" in .taskless/taskless.json. Expected YYYY-MM-DD format.`
|
|
6479
6492
|
);
|
|
6480
6493
|
let i;
|
|
6481
|
-
for (const r of Object.values(
|
|
6494
|
+
for (const r of Object.values(_t))
|
|
6482
6495
|
(i === void 0 || r < i) && (i = r);
|
|
6483
6496
|
if (i && n.version < i)
|
|
6484
6497
|
throw new Error(
|
|
@@ -6490,9 +6503,9 @@ async function un(s) {
|
|
|
6490
6503
|
repositoryUrl: typeof n.repositoryUrl == "string" ? n.repositoryUrl : void 0
|
|
6491
6504
|
};
|
|
6492
6505
|
}
|
|
6493
|
-
function
|
|
6506
|
+
function ro(s) {
|
|
6494
6507
|
if (!Ss("rules create", s.version)) {
|
|
6495
|
-
const e =
|
|
6508
|
+
const e = _t["rules create"];
|
|
6496
6509
|
return {
|
|
6497
6510
|
valid: !1,
|
|
6498
6511
|
error: `Scaffold version ${s.version} is below the minimum ${e} required for 'taskless rules create'. Run \`taskless update-engine\` to update.`
|
|
@@ -6506,7 +6519,7 @@ function so(s) {
|
|
|
6506
6519
|
error: 'Missing "repositoryUrl" in .taskless/taskless.json. This field is required for rule generation.'
|
|
6507
6520
|
} : { valid: !0 };
|
|
6508
6521
|
}
|
|
6509
|
-
class
|
|
6522
|
+
class oo {
|
|
6510
6523
|
async submitRule(e, t) {
|
|
6511
6524
|
const n = ne(), i = await fetch(`${n}/api/rule`, {
|
|
6512
6525
|
method: "POST",
|
|
@@ -6550,14 +6563,14 @@ class no {
|
|
|
6550
6563
|
return await i.json();
|
|
6551
6564
|
}
|
|
6552
6565
|
}
|
|
6553
|
-
const
|
|
6554
|
-
async function
|
|
6566
|
+
const as = new oo();
|
|
6567
|
+
async function ao(s, e) {
|
|
6555
6568
|
const t = C(s, ".taskless", "rules");
|
|
6556
6569
|
await _e(t, { recursive: !0 });
|
|
6557
6570
|
const n = C(t, `${e.id}.yml`);
|
|
6558
6571
|
return await Ce(n, on(e.content, { lineWidth: 0 }), "utf8"), n;
|
|
6559
6572
|
}
|
|
6560
|
-
async function
|
|
6573
|
+
async function lo(s, e, t) {
|
|
6561
6574
|
const n = C(s, ".taskless", "rule-tests");
|
|
6562
6575
|
await _e(n, { recursive: !0 });
|
|
6563
6576
|
const i = C(n, `${e.id}-${t}-test.yml`), r = {
|
|
@@ -6567,7 +6580,7 @@ async function ro(s, e, t) {
|
|
|
6567
6580
|
};
|
|
6568
6581
|
return await Ce(i, on(r, { lineWidth: 0 }), "utf8"), i;
|
|
6569
6582
|
}
|
|
6570
|
-
async function
|
|
6583
|
+
async function co(s, e) {
|
|
6571
6584
|
const t = C(s, ".taskless", "rules"), n = C(t, `${e}.yml`);
|
|
6572
6585
|
let i = !1;
|
|
6573
6586
|
try {
|
|
@@ -6588,11 +6601,11 @@ async function oo(s, e) {
|
|
|
6588
6601
|
}
|
|
6589
6602
|
return i;
|
|
6590
6603
|
}
|
|
6591
|
-
function
|
|
6604
|
+
function uo() {
|
|
6592
6605
|
const s = /* @__PURE__ */ new Date(), e = String(s.getFullYear()), t = String(s.getMonth() + 1).padStart(2, "0"), n = String(s.getDate()).padStart(2, "0");
|
|
6593
6606
|
return `${e}${t}${n}`;
|
|
6594
6607
|
}
|
|
6595
|
-
const
|
|
6608
|
+
const fo = 15e3, ho = {
|
|
6596
6609
|
meta: {
|
|
6597
6610
|
name: "create",
|
|
6598
6611
|
description: "Create a new rule from a JSON file (use --from to specify the input file)"
|
|
@@ -6615,12 +6628,12 @@ const lo = 15e3, co = {
|
|
|
6615
6628
|
}
|
|
6616
6629
|
},
|
|
6617
6630
|
async run({ args: s }) {
|
|
6618
|
-
const e =
|
|
6631
|
+
const e = H(s.dir ?? process.cwd());
|
|
6619
6632
|
s.from || (console.error(
|
|
6620
6633
|
`Error: --from is required. Provide a path to a JSON file.
|
|
6621
6634
|
Example: taskless rules create --from request.json`
|
|
6622
6635
|
), process.exit(1));
|
|
6623
|
-
const t =
|
|
6636
|
+
const t = H(e, s.from);
|
|
6624
6637
|
let n;
|
|
6625
6638
|
try {
|
|
6626
6639
|
n = await Ee(t, "utf8");
|
|
@@ -6644,7 +6657,7 @@ const lo = 15e3, co = {
|
|
|
6644
6657
|
`Error: ${c instanceof Error ? c.message : String(c)}`
|
|
6645
6658
|
), process.exit(1);
|
|
6646
6659
|
}
|
|
6647
|
-
const o =
|
|
6660
|
+
const o = ro(r);
|
|
6648
6661
|
o.valid || (console.error(`Error: ${o.error}`), process.exit(1));
|
|
6649
6662
|
const a = await Ge();
|
|
6650
6663
|
a || (console.error(
|
|
@@ -6652,7 +6665,7 @@ const lo = 15e3, co = {
|
|
|
6652
6665
|
), process.exit(1));
|
|
6653
6666
|
let l;
|
|
6654
6667
|
try {
|
|
6655
|
-
l = (await
|
|
6668
|
+
l = (await as.submitRule(a, {
|
|
6656
6669
|
orgId: r.orgId,
|
|
6657
6670
|
repositoryUrl: r.repositoryUrl,
|
|
6658
6671
|
prompt: i.prompt,
|
|
@@ -6666,13 +6679,13 @@ const lo = 15e3, co = {
|
|
|
6666
6679
|
), process.exit(1);
|
|
6667
6680
|
}
|
|
6668
6681
|
for (console.error(`Rule submitted (${l}). Waiting for generation...`); ; ) {
|
|
6669
|
-
await new Promise((
|
|
6682
|
+
await new Promise((u) => setTimeout(u, fo));
|
|
6670
6683
|
let c;
|
|
6671
6684
|
try {
|
|
6672
|
-
c = await
|
|
6673
|
-
} catch (
|
|
6685
|
+
c = await as.pollRuleStatus(a, l);
|
|
6686
|
+
} catch (u) {
|
|
6674
6687
|
console.error(
|
|
6675
|
-
`Error: ${
|
|
6688
|
+
`Error: ${u instanceof Error ? u.message : String(u)}`
|
|
6676
6689
|
), process.exit(1);
|
|
6677
6690
|
}
|
|
6678
6691
|
switch (c.status) {
|
|
@@ -6689,12 +6702,12 @@ const lo = 15e3, co = {
|
|
|
6689
6702
|
break;
|
|
6690
6703
|
}
|
|
6691
6704
|
case "generated": {
|
|
6692
|
-
const
|
|
6693
|
-
for (const
|
|
6694
|
-
const p = await
|
|
6695
|
-
if (
|
|
6696
|
-
const g = await
|
|
6697
|
-
|
|
6705
|
+
const u = uo(), f = [];
|
|
6706
|
+
for (const d of c.rules) {
|
|
6707
|
+
const p = await ao(e, d);
|
|
6708
|
+
if (f.push(p), d.tests) {
|
|
6709
|
+
const g = await lo(e, d, u);
|
|
6710
|
+
f.push(g);
|
|
6698
6711
|
}
|
|
6699
6712
|
}
|
|
6700
6713
|
if (s.json)
|
|
@@ -6702,15 +6715,15 @@ const lo = 15e3, co = {
|
|
|
6702
6715
|
JSON.stringify({
|
|
6703
6716
|
success: !0,
|
|
6704
6717
|
ruleId: l,
|
|
6705
|
-
rules: c.rules.map((
|
|
6706
|
-
files:
|
|
6718
|
+
rules: c.rules.map((d) => d.id),
|
|
6719
|
+
files: f
|
|
6707
6720
|
})
|
|
6708
6721
|
);
|
|
6709
6722
|
else {
|
|
6710
6723
|
console.log(`Generated ${String(c.rules.length)} rule(s):
|
|
6711
6724
|
`);
|
|
6712
|
-
for (const
|
|
6713
|
-
console.log(` ${
|
|
6725
|
+
for (const d of f)
|
|
6726
|
+
console.log(` ${d}`);
|
|
6714
6727
|
}
|
|
6715
6728
|
return;
|
|
6716
6729
|
}
|
|
@@ -6723,7 +6736,7 @@ const lo = 15e3, co = {
|
|
|
6723
6736
|
}
|
|
6724
6737
|
}
|
|
6725
6738
|
}
|
|
6726
|
-
},
|
|
6739
|
+
}, po = {
|
|
6727
6740
|
meta: {
|
|
6728
6741
|
name: "delete",
|
|
6729
6742
|
description: "Delete a rule and its test files"
|
|
@@ -6741,22 +6754,22 @@ const lo = 15e3, co = {
|
|
|
6741
6754
|
}
|
|
6742
6755
|
},
|
|
6743
6756
|
async run({ args: s }) {
|
|
6744
|
-
const e =
|
|
6745
|
-
await
|
|
6757
|
+
const e = H(s.dir ?? process.cwd()), t = s.id;
|
|
6758
|
+
await co(e, t) ? console.log(`Deleted rule "${t}" and associated test files.`) : (console.error(
|
|
6746
6759
|
`Error: Rule "${t}" not found in .taskless/rules/${t}.yml`
|
|
6747
6760
|
), process.exit(1));
|
|
6748
6761
|
}
|
|
6749
|
-
},
|
|
6762
|
+
}, mo = {
|
|
6750
6763
|
meta: {
|
|
6751
6764
|
name: "rules",
|
|
6752
6765
|
description: "Manage Taskless rules"
|
|
6753
6766
|
},
|
|
6754
6767
|
subCommands: {
|
|
6755
|
-
create:
|
|
6756
|
-
delete:
|
|
6768
|
+
create: ho,
|
|
6769
|
+
delete: po
|
|
6757
6770
|
}
|
|
6758
6771
|
};
|
|
6759
|
-
class
|
|
6772
|
+
class go {
|
|
6760
6773
|
async submitUpdate(e, t) {
|
|
6761
6774
|
const n = ne(), i = await fetch(`${n}/api/update-engine`, {
|
|
6762
6775
|
method: "POST",
|
|
@@ -6804,7 +6817,7 @@ class ho {
|
|
|
6804
6817
|
return await i.json();
|
|
6805
6818
|
}
|
|
6806
6819
|
}
|
|
6807
|
-
const
|
|
6820
|
+
const ls = new go(), yo = 5e3, ko = {
|
|
6808
6821
|
meta: {
|
|
6809
6822
|
name: "update-engine",
|
|
6810
6823
|
description: "Request a scaffold upgrade PR to update the .taskless/ engine directory"
|
|
@@ -6822,7 +6835,7 @@ const as = new ho(), po = 5e3, mo = {
|
|
|
6822
6835
|
}
|
|
6823
6836
|
},
|
|
6824
6837
|
async run({ args: s }) {
|
|
6825
|
-
const e =
|
|
6838
|
+
const e = H(s.dir ?? process.cwd());
|
|
6826
6839
|
let t;
|
|
6827
6840
|
try {
|
|
6828
6841
|
t = await un(e);
|
|
@@ -6846,7 +6859,7 @@ const as = new ho(), po = 5e3, mo = {
|
|
|
6846
6859
|
}
|
|
6847
6860
|
let i;
|
|
6848
6861
|
try {
|
|
6849
|
-
i = await
|
|
6862
|
+
i = await ls.submitUpdate(n, {
|
|
6850
6863
|
orgId: t.orgId,
|
|
6851
6864
|
repositoryUrl: t.repositoryUrl,
|
|
6852
6865
|
version: t.version
|
|
@@ -6874,10 +6887,10 @@ Review and merge it to complete the upgrade.`
|
|
|
6874
6887
|
}
|
|
6875
6888
|
const { requestId: r } = i;
|
|
6876
6889
|
for (console.error("Update request accepted. Waiting for PR creation..."); ; ) {
|
|
6877
|
-
await new Promise((a) => setTimeout(a,
|
|
6890
|
+
await new Promise((a) => setTimeout(a, yo));
|
|
6878
6891
|
let o;
|
|
6879
6892
|
try {
|
|
6880
|
-
o = await
|
|
6893
|
+
o = await ls.pollStatus(n, r);
|
|
6881
6894
|
} catch (a) {
|
|
6882
6895
|
const l = a instanceof Error ? a.message : String(a);
|
|
6883
6896
|
s.json ? console.log(JSON.stringify({ error: l })) : console.error(`Error: ${l}`), process.exit(1);
|
|
@@ -6917,17 +6930,17 @@ Re-run \`taskless update-engine\` to create a new one.`
|
|
|
6917
6930
|
}
|
|
6918
6931
|
}
|
|
6919
6932
|
}
|
|
6920
|
-
},
|
|
6921
|
-
init:
|
|
6922
|
-
info:
|
|
6923
|
-
check:
|
|
6924
|
-
auth:
|
|
6925
|
-
rules:
|
|
6926
|
-
"update-engine":
|
|
6927
|
-
},
|
|
6933
|
+
}, cs = {
|
|
6934
|
+
init: qr,
|
|
6935
|
+
info: Fr,
|
|
6936
|
+
check: ci,
|
|
6937
|
+
auth: ni,
|
|
6938
|
+
rules: mo,
|
|
6939
|
+
"update-engine": ko
|
|
6940
|
+
}, wo = {
|
|
6928
6941
|
meta: {
|
|
6929
6942
|
name: "taskless",
|
|
6930
|
-
version: "0.1.
|
|
6943
|
+
version: "0.1.3",
|
|
6931
6944
|
description: "Taskless CLI"
|
|
6932
6945
|
},
|
|
6933
6946
|
args: {
|
|
@@ -6943,11 +6956,11 @@ Re-run \`taskless update-engine\` to create a new one.`
|
|
|
6943
6956
|
}
|
|
6944
6957
|
},
|
|
6945
6958
|
subCommands: {
|
|
6946
|
-
...
|
|
6947
|
-
help:
|
|
6959
|
+
...cs,
|
|
6960
|
+
help: io(cs)
|
|
6948
6961
|
},
|
|
6949
6962
|
async run({ rawArgs: s, cmd: e }) {
|
|
6950
6963
|
s.some((t) => !t.startsWith("-")) || await ws(e);
|
|
6951
6964
|
}
|
|
6952
6965
|
};
|
|
6953
|
-
|
|
6966
|
+
Hn(wo);
|