@taskless/cli 0.1.3 → 0.1.4
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 +835 -736
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import * as
|
|
3
|
-
import { readFileSync as fn, existsSync as
|
|
4
|
-
import { join as C, resolve as H, dirname as
|
|
5
|
-
import { homedir as
|
|
6
|
-
import { readFile as Ee, rm as
|
|
2
|
+
import * as rt from "node:tty";
|
|
3
|
+
import { readFileSync as fn, existsSync as hn } from "node:fs";
|
|
4
|
+
import { join as C, resolve as H, dirname as Nt, basename as fs } from "node:path";
|
|
5
|
+
import { homedir as dn } from "node:os";
|
|
6
|
+
import { readFile as Ee, rm as We, mkdir as _e, writeFile as Ce, stat as hs, readdir as Ot } from "node:fs/promises";
|
|
7
7
|
import { createRequire as pn } from "node:module";
|
|
8
8
|
import { spawn as mn } from "node:child_process";
|
|
9
9
|
import { createInterface as gn } from "node:readline";
|
|
10
10
|
import { fileURLToPath as yn } from "node:url";
|
|
11
|
-
const
|
|
11
|
+
const U = {
|
|
12
12
|
fatal: 0,
|
|
13
13
|
error: 0,
|
|
14
14
|
warn: 1,
|
|
@@ -19,73 +19,73 @@ const x = {
|
|
|
19
19
|
debug: 4,
|
|
20
20
|
trace: 5,
|
|
21
21
|
verbose: Number.POSITIVE_INFINITY
|
|
22
|
-
},
|
|
22
|
+
}, Vt = {
|
|
23
23
|
// Silent
|
|
24
24
|
silent: {
|
|
25
25
|
level: -1
|
|
26
26
|
},
|
|
27
27
|
// Level 0
|
|
28
28
|
fatal: {
|
|
29
|
-
level:
|
|
29
|
+
level: U.fatal
|
|
30
30
|
},
|
|
31
31
|
error: {
|
|
32
|
-
level:
|
|
32
|
+
level: U.error
|
|
33
33
|
},
|
|
34
34
|
// Level 1
|
|
35
35
|
warn: {
|
|
36
|
-
level:
|
|
36
|
+
level: U.warn
|
|
37
37
|
},
|
|
38
38
|
// Level 2
|
|
39
39
|
log: {
|
|
40
|
-
level:
|
|
40
|
+
level: U.log
|
|
41
41
|
},
|
|
42
42
|
// Level 3
|
|
43
43
|
info: {
|
|
44
|
-
level:
|
|
44
|
+
level: U.info
|
|
45
45
|
},
|
|
46
46
|
success: {
|
|
47
|
-
level:
|
|
47
|
+
level: U.success
|
|
48
48
|
},
|
|
49
49
|
fail: {
|
|
50
|
-
level:
|
|
50
|
+
level: U.fail
|
|
51
51
|
},
|
|
52
52
|
ready: {
|
|
53
|
-
level:
|
|
53
|
+
level: U.info
|
|
54
54
|
},
|
|
55
55
|
start: {
|
|
56
|
-
level:
|
|
56
|
+
level: U.info
|
|
57
57
|
},
|
|
58
58
|
box: {
|
|
59
|
-
level:
|
|
59
|
+
level: U.info
|
|
60
60
|
},
|
|
61
61
|
// Level 4
|
|
62
62
|
debug: {
|
|
63
|
-
level:
|
|
63
|
+
level: U.debug
|
|
64
64
|
},
|
|
65
65
|
// Level 5
|
|
66
66
|
trace: {
|
|
67
|
-
level:
|
|
67
|
+
level: U.trace
|
|
68
68
|
},
|
|
69
69
|
// Verbose
|
|
70
70
|
verbose: {
|
|
71
|
-
level:
|
|
71
|
+
level: U.verbose
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
function
|
|
74
|
+
function ot(s) {
|
|
75
75
|
if (s === null || typeof s != "object")
|
|
76
76
|
return !1;
|
|
77
77
|
const e = Object.getPrototypeOf(s);
|
|
78
78
|
return e !== null && e !== Object.prototype && Object.getPrototypeOf(e) !== null || Symbol.iterator in s ? !1 : Symbol.toStringTag in s ? Object.prototype.toString.call(s) === "[object Module]" : !0;
|
|
79
79
|
}
|
|
80
80
|
function yt(s, e, t = ".", n) {
|
|
81
|
-
if (!
|
|
81
|
+
if (!ot(e))
|
|
82
82
|
return yt(s, {}, t);
|
|
83
83
|
const i = Object.assign({}, e);
|
|
84
84
|
for (const r in s) {
|
|
85
85
|
if (r === "__proto__" || r === "constructor")
|
|
86
86
|
continue;
|
|
87
87
|
const o = s[r];
|
|
88
|
-
o != null && (Array.isArray(o) && Array.isArray(i[r]) ? i[r] = [...o, ...i[r]] :
|
|
88
|
+
o != null && (Array.isArray(o) && Array.isArray(i[r]) ? i[r] = [...o, ...i[r]] : ot(o) && ot(i[r]) ? i[r] = yt(
|
|
89
89
|
o,
|
|
90
90
|
i[r],
|
|
91
91
|
(t ? `${t}.` : "") + r.toString()
|
|
@@ -106,8 +106,8 @@ function bn(s) {
|
|
|
106
106
|
function Sn(s) {
|
|
107
107
|
return !(!bn(s) || !s.message && !s.args || s.stack);
|
|
108
108
|
}
|
|
109
|
-
let
|
|
110
|
-
const
|
|
109
|
+
let at = !1;
|
|
110
|
+
const Wt = [];
|
|
111
111
|
class R {
|
|
112
112
|
options;
|
|
113
113
|
_lastLog;
|
|
@@ -118,16 +118,16 @@ class R {
|
|
|
118
118
|
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
119
119
|
*/
|
|
120
120
|
constructor(e = {}) {
|
|
121
|
-
const t = e.types ||
|
|
121
|
+
const t = e.types || Vt;
|
|
122
122
|
this.options = wn(
|
|
123
123
|
{
|
|
124
124
|
...e,
|
|
125
125
|
defaults: { ...e.defaults },
|
|
126
|
-
level:
|
|
126
|
+
level: lt(e.level, t),
|
|
127
127
|
reporters: [...e.reporters || []]
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
|
-
types:
|
|
130
|
+
types: Vt,
|
|
131
131
|
throttle: 1e3,
|
|
132
132
|
throttleMin: 5,
|
|
133
133
|
formatOptions: {
|
|
@@ -164,7 +164,7 @@ class R {
|
|
|
164
164
|
* @param {number} level - The new log level to set.
|
|
165
165
|
*/
|
|
166
166
|
set level(e) {
|
|
167
|
-
this.options.level =
|
|
167
|
+
this.options.level = lt(
|
|
168
168
|
e,
|
|
169
169
|
this.options.types,
|
|
170
170
|
this.options.level
|
|
@@ -302,14 +302,14 @@ class R {
|
|
|
302
302
|
* Pauses logging, queues incoming logs until resumed.
|
|
303
303
|
*/
|
|
304
304
|
pauseLogs() {
|
|
305
|
-
|
|
305
|
+
at = !0;
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
308
|
* Resumes logging, processing any queued logs.
|
|
309
309
|
*/
|
|
310
310
|
resumeLogs() {
|
|
311
|
-
|
|
312
|
-
const e =
|
|
311
|
+
at = !1;
|
|
312
|
+
const e = Wt.splice(0);
|
|
313
313
|
for (const t of e)
|
|
314
314
|
t[0]._logFn(t[1], t[2]);
|
|
315
315
|
}
|
|
@@ -326,8 +326,8 @@ class R {
|
|
|
326
326
|
}
|
|
327
327
|
_wrapLogFn(e, t) {
|
|
328
328
|
return (...n) => {
|
|
329
|
-
if (
|
|
330
|
-
|
|
329
|
+
if (at) {
|
|
330
|
+
Wt.push([this, e, n, t]);
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
return this._logFn(e, n, t);
|
|
@@ -340,7 +340,7 @@ class R {
|
|
|
340
340
|
date: /* @__PURE__ */ new Date(),
|
|
341
341
|
args: [],
|
|
342
342
|
...e,
|
|
343
|
-
level:
|
|
343
|
+
level: lt(e.level, this.options.types)
|
|
344
344
|
};
|
|
345
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(`
|
|
346
346
|
`)), i.args.push(`
|
|
@@ -381,7 +381,7 @@ class R {
|
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function lt(s, e = {}, t = 3) {
|
|
385
385
|
return s === void 0 ? t : typeof s == "number" ? s : e[s] && e[s].level !== void 0 ? e[s].level : t;
|
|
386
386
|
}
|
|
387
387
|
R.prototype.add = R.prototype.addReporter;
|
|
@@ -394,7 +394,7 @@ R.prototype.resume = R.prototype.resumeLogs;
|
|
|
394
394
|
function vn(s = {}) {
|
|
395
395
|
return new R(s);
|
|
396
396
|
}
|
|
397
|
-
class
|
|
397
|
+
class Tn {
|
|
398
398
|
options;
|
|
399
399
|
defaultColor;
|
|
400
400
|
levelColorMap;
|
|
@@ -434,7 +434,7 @@ class Nn {
|
|
|
434
434
|
}
|
|
435
435
|
function In(s = {}) {
|
|
436
436
|
return vn({
|
|
437
|
-
reporters: s.reporters || [new
|
|
437
|
+
reporters: s.reporters || [new Tn({})],
|
|
438
438
|
prompt(t, n = {}) {
|
|
439
439
|
return n.type === "confirm" ? Promise.resolve(confirm(t)) : Promise.resolve(prompt(t));
|
|
440
440
|
},
|
|
@@ -443,9 +443,9 @@ function In(s = {}) {
|
|
|
443
443
|
}
|
|
444
444
|
const Ie = In(), {
|
|
445
445
|
env: X = {},
|
|
446
|
-
argv:
|
|
447
|
-
platform:
|
|
448
|
-
} = typeof process > "u" ? {} : process, On = "NO_COLOR" in X ||
|
|
446
|
+
argv: ds = [],
|
|
447
|
+
platform: Nn = ""
|
|
448
|
+
} = typeof process > "u" ? {} : process, On = "NO_COLOR" in X || ds.includes("--no-color"), _n = "FORCE_COLOR" in X || ds.includes("--color"), Cn = Nn === "win32", ps = X.TERM === "dumb", An = rt && rt.isatty && rt.isatty(1) && X.TERM && !ps, Ln = "CI" in X && ("GITHUB_ACTIONS" in X || "GITLAB_CI" in X || "CIRCLECI" in X), En = !On && (_n || Cn && !ps || An || Ln);
|
|
449
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)) {
|
|
450
450
|
return i + (o < 0 ? r : ms(o, r, t, n));
|
|
451
451
|
}
|
|
@@ -461,60 +461,60 @@ function jn(s, e, t = s, n = s.length + 1) {
|
|
|
461
461
|
t
|
|
462
462
|
) : "";
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function N(s, e, t) {
|
|
465
465
|
return jn(`\x1B[${s}m`, `\x1B[${e}m`, t);
|
|
466
466
|
}
|
|
467
|
-
const
|
|
468
|
-
reset:
|
|
469
|
-
bold:
|
|
470
|
-
dim:
|
|
471
|
-
italic:
|
|
472
|
-
underline:
|
|
473
|
-
inverse:
|
|
474
|
-
hidden:
|
|
475
|
-
strikethrough:
|
|
476
|
-
black:
|
|
477
|
-
red:
|
|
478
|
-
green:
|
|
479
|
-
yellow:
|
|
480
|
-
blue:
|
|
481
|
-
magenta:
|
|
482
|
-
cyan:
|
|
483
|
-
white:
|
|
484
|
-
gray:
|
|
485
|
-
bgBlack:
|
|
486
|
-
bgRed:
|
|
487
|
-
bgGreen:
|
|
488
|
-
bgYellow:
|
|
489
|
-
bgBlue:
|
|
490
|
-
bgMagenta:
|
|
491
|
-
bgCyan:
|
|
492
|
-
bgWhite:
|
|
493
|
-
blackBright:
|
|
494
|
-
redBright:
|
|
495
|
-
greenBright:
|
|
496
|
-
yellowBright:
|
|
497
|
-
blueBright:
|
|
498
|
-
magentaBright:
|
|
499
|
-
cyanBright:
|
|
500
|
-
whiteBright:
|
|
501
|
-
bgBlackBright:
|
|
502
|
-
bgRedBright:
|
|
503
|
-
bgGreenBright:
|
|
504
|
-
bgYellowBright:
|
|
505
|
-
bgBlueBright:
|
|
506
|
-
bgMagentaBright:
|
|
507
|
-
bgCyanBright:
|
|
508
|
-
bgWhiteBright:
|
|
467
|
+
const Yt = {
|
|
468
|
+
reset: N(0, 0),
|
|
469
|
+
bold: N(1, 22, "\x1B[22m\x1B[1m"),
|
|
470
|
+
dim: N(2, 22, "\x1B[22m\x1B[2m"),
|
|
471
|
+
italic: N(3, 23),
|
|
472
|
+
underline: N(4, 24),
|
|
473
|
+
inverse: N(7, 27),
|
|
474
|
+
hidden: N(8, 28),
|
|
475
|
+
strikethrough: N(9, 29),
|
|
476
|
+
black: N(30, 39),
|
|
477
|
+
red: N(31, 39),
|
|
478
|
+
green: N(32, 39),
|
|
479
|
+
yellow: N(33, 39),
|
|
480
|
+
blue: N(34, 39),
|
|
481
|
+
magenta: N(35, 39),
|
|
482
|
+
cyan: N(36, 39),
|
|
483
|
+
white: N(37, 39),
|
|
484
|
+
gray: N(90, 39),
|
|
485
|
+
bgBlack: N(40, 49),
|
|
486
|
+
bgRed: N(41, 49),
|
|
487
|
+
bgGreen: N(42, 49),
|
|
488
|
+
bgYellow: N(43, 49),
|
|
489
|
+
bgBlue: N(44, 49),
|
|
490
|
+
bgMagenta: N(45, 49),
|
|
491
|
+
bgCyan: N(46, 49),
|
|
492
|
+
bgWhite: N(47, 49),
|
|
493
|
+
blackBright: N(90, 39),
|
|
494
|
+
redBright: N(91, 39),
|
|
495
|
+
greenBright: N(92, 39),
|
|
496
|
+
yellowBright: N(93, 39),
|
|
497
|
+
blueBright: N(94, 39),
|
|
498
|
+
magentaBright: N(95, 39),
|
|
499
|
+
cyanBright: N(96, 39),
|
|
500
|
+
whiteBright: N(97, 39),
|
|
501
|
+
bgBlackBright: N(100, 49),
|
|
502
|
+
bgRedBright: N(101, 49),
|
|
503
|
+
bgGreenBright: N(102, 49),
|
|
504
|
+
bgYellowBright: N(103, 49),
|
|
505
|
+
bgBlueBright: N(104, 49),
|
|
506
|
+
bgMagentaBright: N(105, 49),
|
|
507
|
+
bgCyanBright: N(106, 49),
|
|
508
|
+
bgWhiteBright: N(107, 49)
|
|
509
509
|
};
|
|
510
510
|
function Rn(s = En) {
|
|
511
|
-
return s ?
|
|
511
|
+
return s ? Yt : Object.fromEntries(Object.keys(Yt).map((e) => [e, String]));
|
|
512
512
|
}
|
|
513
513
|
const V = Rn();
|
|
514
|
-
function
|
|
514
|
+
function xn(s) {
|
|
515
515
|
return Array.isArray(s) ? s : s === void 0 ? [] : [s];
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function ct(s, e = "") {
|
|
518
518
|
const t = [];
|
|
519
519
|
for (const n of s)
|
|
520
520
|
for (const [i, r] of n.entries())
|
|
@@ -534,13 +534,13 @@ class pe extends Error {
|
|
|
534
534
|
super(e), this.code = t, this.name = "CLIError";
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
const
|
|
537
|
+
const Pn = /\d/, Un = ["-", "_", "/", "."];
|
|
538
538
|
function Mn(s = "") {
|
|
539
|
-
if (!
|
|
539
|
+
if (!Pn.test(s))
|
|
540
540
|
return s !== s.toLowerCase();
|
|
541
541
|
}
|
|
542
542
|
function gs(s, e) {
|
|
543
|
-
const t =
|
|
543
|
+
const t = Un, n = [];
|
|
544
544
|
if (!s || typeof s != "string")
|
|
545
545
|
return n;
|
|
546
546
|
let i = "", r, o;
|
|
@@ -581,7 +581,7 @@ function Kn(s, e) {
|
|
|
581
581
|
function Fn(s, e) {
|
|
582
582
|
return s ? (Array.isArray(s) ? s : gs(s)).map((t) => t.toLowerCase()).join("-") : "";
|
|
583
583
|
}
|
|
584
|
-
function
|
|
584
|
+
function ut(s) {
|
|
585
585
|
return s == null ? [] : Array.isArray(s) ? s : [s];
|
|
586
586
|
}
|
|
587
587
|
function Jn(s, e, t, n) {
|
|
@@ -593,10 +593,10 @@ function Vn(s = [], e = {}) {
|
|
|
593
593
|
let t, n, i, r, o;
|
|
594
594
|
const a = { _: [] };
|
|
595
595
|
let l = 0, c = 0, u = 0;
|
|
596
|
-
const f = s.length,
|
|
597
|
-
if (e.alias = e.alias || {}, e.string =
|
|
596
|
+
const f = s.length, h = e.alias !== void 0, p = e.unknown !== void 0, g = e.default !== void 0;
|
|
597
|
+
if (e.alias = e.alias || {}, e.string = ut(e.string), e.boolean = ut(e.boolean), h)
|
|
598
598
|
for (t in e.alias)
|
|
599
|
-
for (n = e.alias[t] =
|
|
599
|
+
for (n = e.alias[t] = ut(e.alias[t]), l = 0; l < n.length; l++)
|
|
600
600
|
(e.alias[n[l]] = n.concat(t)).splice(l, 1);
|
|
601
601
|
for (l = e.boolean.length; l-- > 0; )
|
|
602
602
|
for (n = e.alias[e.boolean[l]] || [], c = n.length; c-- > 0; )
|
|
@@ -610,7 +610,7 @@ function Vn(s = [], e = {}) {
|
|
|
610
610
|
for (e[r].push(t), l = 0; l < n.length; l++)
|
|
611
611
|
e[r].push(n[l]);
|
|
612
612
|
}
|
|
613
|
-
const
|
|
613
|
+
const d = p ? Object.keys(e.alias) : [];
|
|
614
614
|
for (l = 0; l < f; l++) {
|
|
615
615
|
if (i = s[l], i === "--") {
|
|
616
616
|
a._ = a._.concat(s.slice(++l));
|
|
@@ -621,14 +621,14 @@ function Vn(s = [], e = {}) {
|
|
|
621
621
|
if (c === 0)
|
|
622
622
|
a._.push(i);
|
|
623
623
|
else if (i.substring(c, c + 3) === "no-") {
|
|
624
|
-
if (r = i.slice(Math.max(0, c + 3)), p && !~
|
|
624
|
+
if (r = i.slice(Math.max(0, c + 3)), p && !~d.indexOf(r))
|
|
625
625
|
return e.unknown(i);
|
|
626
626
|
a[r] = !1;
|
|
627
627
|
} else {
|
|
628
628
|
for (u = c + 1; u < i.length && i.charCodeAt(u) !== 61; u++)
|
|
629
629
|
;
|
|
630
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 && !~
|
|
631
|
+
if (r = n[u], p && !~d.indexOf(r))
|
|
632
632
|
return e.unknown("-".repeat(c) + r);
|
|
633
633
|
Jn(a, r, u + 1 < n.length || o, e);
|
|
634
634
|
}
|
|
@@ -637,7 +637,7 @@ function Vn(s = [], e = {}) {
|
|
|
637
637
|
if (g)
|
|
638
638
|
for (t in e.default)
|
|
639
639
|
a[t] === void 0 && (a[t] = e.default[t]);
|
|
640
|
-
if (
|
|
640
|
+
if (h)
|
|
641
641
|
for (t in a)
|
|
642
642
|
for (n = e.alias[t] || []; n.length > 0; )
|
|
643
643
|
a[n.shift()] = a[t];
|
|
@@ -681,7 +681,7 @@ function ys(s) {
|
|
|
681
681
|
e.push({
|
|
682
682
|
...n,
|
|
683
683
|
name: t,
|
|
684
|
-
alias:
|
|
684
|
+
alias: xn(n.alias)
|
|
685
685
|
});
|
|
686
686
|
return e;
|
|
687
687
|
}
|
|
@@ -744,29 +744,29 @@ async function Yn(s, e) {
|
|
|
744
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 = [];
|
|
745
745
|
for (const p of n)
|
|
746
746
|
if (p.type === "positional") {
|
|
747
|
-
const g = p.name.toUpperCase(),
|
|
747
|
+
const g = p.name.toUpperCase(), d = p.required !== !1 && p.default === void 0, m = p.default ? `="${p.default}"` : "";
|
|
748
748
|
a.push([
|
|
749
749
|
"`" + g + m + "`",
|
|
750
750
|
p.description || "",
|
|
751
751
|
p.valueHint ? `<${p.valueHint}>` : ""
|
|
752
|
-
]), c.push(
|
|
752
|
+
]), c.push(d ? `<${g}>` : `[${g}]`);
|
|
753
753
|
} else {
|
|
754
|
-
const g = p.required === !0 && p.default === void 0,
|
|
754
|
+
const g = p.required === !0 && p.default === void 0, d = (p.type === "boolean" && p.default === !0 ? [
|
|
755
755
|
...(p.alias || []).map((m) => `--no-${m}`),
|
|
756
756
|
`--no-${p.name}`
|
|
757
757
|
].join(", ") : [...(p.alias || []).map((m) => `-${m}`), `--${p.name}`].join(
|
|
758
758
|
", "
|
|
759
759
|
)) + (p.type === "string" && (p.valueHint || p.default) ? `=${p.valueHint ? `<${p.valueHint}>` : `"${p.default || ""}"`}` : "");
|
|
760
760
|
o.push([
|
|
761
|
-
"`" +
|
|
761
|
+
"`" + d + (g ? " (required)" : "") + "`",
|
|
762
762
|
p.description || ""
|
|
763
|
-
]), g && c.push(
|
|
763
|
+
]), g && c.push(d);
|
|
764
764
|
}
|
|
765
765
|
if (s.subCommands) {
|
|
766
766
|
const p = [], g = await K(s.subCommands);
|
|
767
|
-
for (const [
|
|
767
|
+
for (const [d, m] of Object.entries(g)) {
|
|
768
768
|
const k = await K(m), w = await K(k?.meta);
|
|
769
|
-
l.push([`\`${
|
|
769
|
+
l.push([`\`${d}\``, w?.description || ""]), p.push(d);
|
|
770
770
|
}
|
|
771
771
|
c.push(p.join("|"));
|
|
772
772
|
}
|
|
@@ -777,11 +777,11 @@ async function Yn(s, e) {
|
|
|
777
777
|
),
|
|
778
778
|
""
|
|
779
779
|
);
|
|
780
|
-
const
|
|
780
|
+
const h = o.length > 0 || a.length > 0;
|
|
781
781
|
return u.push(
|
|
782
|
-
`${V.underline(V.bold("USAGE"))} \`${r}${
|
|
782
|
+
`${V.underline(V.bold("USAGE"))} \`${r}${h ? " [OPTIONS]" : ""} ${c.join(" ")}\``,
|
|
783
783
|
""
|
|
784
|
-
), a.length > 0 && (u.push(V.underline(V.bold("ARGUMENTS")), ""), u.push(
|
|
784
|
+
), a.length > 0 && (u.push(V.underline(V.bold("ARGUMENTS")), ""), u.push(ct(a, " ")), u.push("")), o.length > 0 && (u.push(V.underline(V.bold("OPTIONS")), ""), u.push(ct(o, " ")), u.push("")), l.length > 0 && (u.push(V.underline(V.bold("COMMANDS")), ""), u.push(ct(l, " ")), u.push(
|
|
785
785
|
"",
|
|
786
786
|
`Use \`${r} <command> --help\` for more information about a command.`
|
|
787
787
|
)), u.filter((p) => typeof p == "string").join(`
|
|
@@ -805,25 +805,25 @@ async function Hn(s, e = {}) {
|
|
|
805
805
|
`), r && await n(...await kt(s, t)), Ie.error(i.message), process.exit(1);
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
|
-
const
|
|
809
|
-
function
|
|
810
|
-
const s = process.env.XDG_CONFIG_HOME ?? C(
|
|
808
|
+
const _t = "auth.json";
|
|
809
|
+
function Ge() {
|
|
810
|
+
const s = process.env.XDG_CONFIG_HOME ?? C(dn(), ".config");
|
|
811
811
|
return C(s, "taskless");
|
|
812
812
|
}
|
|
813
|
-
async function
|
|
813
|
+
async function ze() {
|
|
814
814
|
const s = process.env.TASKLESS_TOKEN;
|
|
815
815
|
if (s) return s;
|
|
816
816
|
try {
|
|
817
|
-
const e = C(
|
|
817
|
+
const e = C(Ge(), _t), t = await Ee(e, "utf8");
|
|
818
818
|
return JSON.parse(t).access_token;
|
|
819
819
|
} catch {
|
|
820
820
|
return;
|
|
821
821
|
}
|
|
822
822
|
}
|
|
823
823
|
async function Gn(s) {
|
|
824
|
-
const e =
|
|
824
|
+
const e = Ge();
|
|
825
825
|
await _e(e, { recursive: !0 });
|
|
826
|
-
const t = C(e,
|
|
826
|
+
const t = C(e, _t);
|
|
827
827
|
await Ce(t, JSON.stringify(s, null, 2) + `
|
|
828
828
|
`, {
|
|
829
829
|
mode: 384
|
|
@@ -831,8 +831,8 @@ async function Gn(s) {
|
|
|
831
831
|
}
|
|
832
832
|
async function zn() {
|
|
833
833
|
try {
|
|
834
|
-
const s = C(
|
|
835
|
-
return await
|
|
834
|
+
const s = C(Ge(), _t);
|
|
835
|
+
return await We(s), !0;
|
|
836
836
|
} catch {
|
|
837
837
|
return !1;
|
|
838
838
|
}
|
|
@@ -840,7 +840,7 @@ async function zn() {
|
|
|
840
840
|
const Qn = "https://app.taskless.io/cli", Xn = "config.json";
|
|
841
841
|
function Zn() {
|
|
842
842
|
try {
|
|
843
|
-
const s = C(
|
|
843
|
+
const s = C(Ge(), Xn), e = fn(s, "utf8");
|
|
844
844
|
return JSON.parse(e);
|
|
845
845
|
} catch {
|
|
846
846
|
return;
|
|
@@ -851,13 +851,13 @@ function ne() {
|
|
|
851
851
|
const s = Zn();
|
|
852
852
|
return s?.apiUrl ? s.apiUrl : Qn;
|
|
853
853
|
}
|
|
854
|
-
const
|
|
854
|
+
const Ht = "taskless-cli";
|
|
855
855
|
class ei {
|
|
856
856
|
async requestDeviceCode() {
|
|
857
857
|
const e = ne(), t = await fetch(`${e}/auth/device`, {
|
|
858
858
|
method: "POST",
|
|
859
859
|
headers: { "Content-Type": "application/json" },
|
|
860
|
-
body: JSON.stringify({ client_id:
|
|
860
|
+
body: JSON.stringify({ client_id: Ht })
|
|
861
861
|
});
|
|
862
862
|
if (!t.ok) {
|
|
863
863
|
const n = await t.text().catch(() => "");
|
|
@@ -874,7 +874,7 @@ class ei {
|
|
|
874
874
|
body: JSON.stringify({
|
|
875
875
|
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
876
876
|
device_code: e,
|
|
877
|
-
client_id:
|
|
877
|
+
client_id: Ht
|
|
878
878
|
})
|
|
879
879
|
});
|
|
880
880
|
if (!n.ok) {
|
|
@@ -903,18 +903,18 @@ class ei {
|
|
|
903
903
|
};
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
const
|
|
906
|
+
const Gt = new ei(), ti = {
|
|
907
907
|
meta: {
|
|
908
908
|
name: "login",
|
|
909
909
|
description: "Authenticate with taskless.io"
|
|
910
910
|
},
|
|
911
911
|
async run() {
|
|
912
|
-
if (await
|
|
912
|
+
if (await ze()) {
|
|
913
913
|
console.log("You are already logged in."), console.log("Run `taskless auth logout` first to re-authenticate.");
|
|
914
914
|
return;
|
|
915
915
|
}
|
|
916
916
|
try {
|
|
917
|
-
const e = await
|
|
917
|
+
const e = await Gt.requestDeviceCode();
|
|
918
918
|
console.log(`
|
|
919
919
|
Open this URL in your browser:
|
|
920
920
|
`), console.log(
|
|
@@ -926,7 +926,7 @@ Open this URL in your browser:
|
|
|
926
926
|
let i = t;
|
|
927
927
|
for (; Date.now() < n; ) {
|
|
928
928
|
await new Promise((o) => setTimeout(o, i));
|
|
929
|
-
const r = await
|
|
929
|
+
const r = await Gt.pollForToken(
|
|
930
930
|
e.device_code
|
|
931
931
|
);
|
|
932
932
|
switch (r.status) {
|
|
@@ -993,7 +993,7 @@ function ii(s) {
|
|
|
993
993
|
};
|
|
994
994
|
}
|
|
995
995
|
function ri() {
|
|
996
|
-
const s =
|
|
996
|
+
const s = Nt(yn(import.meta.url)), e = H(s, "..", "node_modules", ".bin"), t = process.platform === "win32" ? ";" : ":";
|
|
997
997
|
return `${e}${t}${process.env.PATH ?? ""}`;
|
|
998
998
|
}
|
|
999
999
|
function oi() {
|
|
@@ -1001,8 +1001,8 @@ function oi() {
|
|
|
1001
1001
|
process.platform === "linux" ? s.push("gnu") : process.platform === "win32" && s.push("msvc");
|
|
1002
1002
|
const e = `@ast-grep/cli-${s.join("-")}`, t = process.platform === "win32" ? "ast-grep.exe" : "ast-grep";
|
|
1003
1003
|
try {
|
|
1004
|
-
const i = pn(import.meta.url).resolve(`${e}/package.json`), r = H(
|
|
1005
|
-
if (
|
|
1004
|
+
const i = pn(import.meta.url).resolve(`${e}/package.json`), r = H(Nt(i), t);
|
|
1005
|
+
if (hn(r))
|
|
1006
1006
|
return r;
|
|
1007
1007
|
} catch {
|
|
1008
1008
|
}
|
|
@@ -1091,12 +1091,12 @@ function bs(s) {
|
|
|
1091
1091
|
const t = Number(e[2]), n = Number(e[3]);
|
|
1092
1092
|
return t >= 1 && t <= 12 && n >= 1 && n <= 31;
|
|
1093
1093
|
}
|
|
1094
|
-
const
|
|
1094
|
+
const Ct = {
|
|
1095
1095
|
"rules create": "2026-03-02",
|
|
1096
1096
|
check: "2026-02-18"
|
|
1097
1097
|
};
|
|
1098
1098
|
function Ss(s, e) {
|
|
1099
|
-
const t =
|
|
1099
|
+
const t = Ct[s];
|
|
1100
1100
|
return t ? e >= t : !0;
|
|
1101
1101
|
}
|
|
1102
1102
|
const ci = {
|
|
@@ -1118,7 +1118,7 @@ const ci = {
|
|
|
1118
1118
|
},
|
|
1119
1119
|
async run({ args: s }) {
|
|
1120
1120
|
const e = H(s.dir ?? process.cwd()), t = C(e, ".taskless", "taskless.json");
|
|
1121
|
-
if (!await
|
|
1121
|
+
if (!await hs(t).then((a) => a.isFile()).catch(() => !1)) {
|
|
1122
1122
|
const a = "Error: .taskless/taskless.json not found. Run `taskless init` to set up your project.";
|
|
1123
1123
|
s.json ? console.log(z([], { success: !1, error: a })) : console.error(a), process.exit(1);
|
|
1124
1124
|
}
|
|
@@ -1148,7 +1148,7 @@ const ci = {
|
|
|
1148
1148
|
const r = C(e, ".taskless", "rules");
|
|
1149
1149
|
let o = [];
|
|
1150
1150
|
try {
|
|
1151
|
-
o = (await
|
|
1151
|
+
o = (await Ot(r)).filter((l) => l.endsWith(".yml"));
|
|
1152
1152
|
} catch {
|
|
1153
1153
|
}
|
|
1154
1154
|
o.length === 0 && (s.json ? console.log(z([], { success: !0 })) : (console.warn(
|
|
@@ -1167,11 +1167,11 @@ const ci = {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
}
|
|
1169
1169
|
}, ui = `---
|
|
1170
|
-
name: taskless-check
|
|
1170
|
+
name: use-taskless-check
|
|
1171
1171
|
description: Checks a repository using the Taskless rules via the CLI. Use when the user wants to run a check, test rules, or validate code against taskless rules. Trigger on "check my code", "run taskless check", "test my rules", or "validate with taskless".
|
|
1172
1172
|
metadata:
|
|
1173
1173
|
author: taskless
|
|
1174
|
-
version: 0.1.
|
|
1174
|
+
version: 0.1.4
|
|
1175
1175
|
commandName: taskless:check
|
|
1176
1176
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1177
1177
|
---
|
|
@@ -1190,11 +1190,11 @@ When this skill is invoked, perform a check of the codebase using the Taskless C
|
|
|
1190
1190
|
|
|
1191
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.
|
|
1192
1192
|
`, fi = `---
|
|
1193
|
-
name: taskless-info
|
|
1193
|
+
name: use-taskless-info
|
|
1194
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".
|
|
1195
1195
|
metadata:
|
|
1196
1196
|
author: taskless
|
|
1197
|
-
version: 0.1.
|
|
1197
|
+
version: 0.1.4
|
|
1198
1198
|
commandName: taskless:info
|
|
1199
1199
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1200
1200
|
---
|
|
@@ -1239,12 +1239,12 @@ When this skill is invoked, verify that the Taskless CLI is reachable and report
|
|
|
1239
1239
|
Taskless skills plugin is installed and working.
|
|
1240
1240
|
CLI version: 0.0.1
|
|
1241
1241
|
\`\`\`
|
|
1242
|
-
`,
|
|
1243
|
-
name: taskless-login
|
|
1242
|
+
`, hi = `---
|
|
1243
|
+
name: use-taskless-login
|
|
1244
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".
|
|
1245
1245
|
metadata:
|
|
1246
1246
|
author: taskless
|
|
1247
|
-
version: 0.1.
|
|
1247
|
+
version: 0.1.4
|
|
1248
1248
|
commandName: taskless:login
|
|
1249
1249
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1250
1250
|
---
|
|
@@ -1260,12 +1260,12 @@ When this skill is invoked, explain the authentication process and provide the C
|
|
|
1260
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.
|
|
1261
1261
|
|
|
1262
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).
|
|
1263
|
-
`,
|
|
1264
|
-
name: taskless-logout
|
|
1263
|
+
`, di = `---
|
|
1264
|
+
name: use-taskless-logout
|
|
1265
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".
|
|
1266
1266
|
metadata:
|
|
1267
1267
|
author: taskless
|
|
1268
|
-
version: 0.1.
|
|
1268
|
+
version: 0.1.4
|
|
1269
1269
|
commandName: taskless:logout
|
|
1270
1270
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1271
1271
|
---
|
|
@@ -1282,18 +1282,20 @@ When this skill is invoked, explain how to remove saved authentication and provi
|
|
|
1282
1282
|
|
|
1283
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).
|
|
1284
1284
|
`, pi = `---
|
|
1285
|
-
name: taskless-rule-create
|
|
1285
|
+
name: use-taskless-rule-create
|
|
1286
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".
|
|
1287
1287
|
metadata:
|
|
1288
1288
|
author: taskless
|
|
1289
|
-
version: 0.1.
|
|
1289
|
+
version: 0.1.4
|
|
1290
1290
|
commandName: taskless:rule
|
|
1291
1291
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1292
1292
|
---
|
|
1293
1293
|
|
|
1294
1294
|
# Taskless Rule Create
|
|
1295
1295
|
|
|
1296
|
-
When this skill is invoked,
|
|
1296
|
+
When this skill is invoked, work with the user to build a comprehensive rule request, then write a JSON file and run the CLI to generate a rule.
|
|
1297
|
+
|
|
1298
|
+
Your goal is to produce the best possible rule by enriching the user's initial description with concrete examples, edge cases, and exclusions — not just pass their request through verbatim.
|
|
1297
1299
|
|
|
1298
1300
|
## Instructions
|
|
1299
1301
|
|
|
@@ -1301,29 +1303,69 @@ When this skill is invoked, gather the necessary information from the user, writ
|
|
|
1301
1303
|
|
|
1302
1304
|
2. **Gather the rule description.** Ask the user what pattern they want to detect. This becomes the \`prompt\` field (required).
|
|
1303
1305
|
|
|
1304
|
-
3. **
|
|
1306
|
+
3. **Enrich the request.** After receiving the initial description, actively work with the user to strengthen the rule. Do all of the following:
|
|
1307
|
+
|
|
1308
|
+
a. **Search the codebase for real examples.** Proactively scan the codebase for instances of the pattern they want to detect. Show them what you found and ask:
|
|
1309
|
+
- "I found N instances of this pattern in your codebase. Should I include some as examples in the rule request?"
|
|
1310
|
+
- If you find variations of the pattern, highlight them as potential edge cases.
|
|
1311
|
+
|
|
1312
|
+
b. **Ask for success and failure cases.** Even if the user provided examples, ask if there are other cases to consider:
|
|
1313
|
+
- "Are there edge cases or variations of this pattern that should also be caught?"
|
|
1314
|
+
- "Can you show me an example of the _correct_ way to write this code?"
|
|
1315
|
+
- Use any examples the user provided in their description as a starting point, but look for more.
|
|
1316
|
+
|
|
1317
|
+
c. **Collect default ignores from the project.** Before asking the user about exclusions, check the project for existing ignore patterns that inform what files the rule should skip. Look at:
|
|
1318
|
+
- \`.gitignore\` — files already excluded from version control (e.g., \`node_modules/\`, \`dist/\`, build artifacts)
|
|
1319
|
+
- Linter configs (e.g., \`eslint.config.js\`, \`.eslintignore\`) — files or directories already excluded from linting
|
|
1320
|
+
- \`tsconfig.json\` \`exclude\` field — files excluded from type checking
|
|
1321
|
+
- Any other relevant config that signals "these files are not authored source code"
|
|
1305
1322
|
|
|
1306
|
-
|
|
1323
|
+
Use these to build a baseline set of ignores. Present them to the user as defaults that will be included in the rule prompt.
|
|
1307
1324
|
|
|
1308
|
-
|
|
1325
|
+
d. **Ask about additional exclusions.** Beyond the defaults, ask the user if there are files, directories, or contexts where the pattern is acceptable:
|
|
1326
|
+
- "Are there any files or directories where this pattern should be allowed? (e.g., \`.d.ts\` files, test files, generated code)"
|
|
1327
|
+
- Incorporate both the default ignores and user-specified exclusions into the \`prompt\` field so the rule generator understands the boundaries.
|
|
1309
1328
|
|
|
1310
|
-
|
|
1329
|
+
e. **Infer the language.** Detect the language from the codebase or the user's examples. Confirm your assumption with the user.
|
|
1311
1330
|
|
|
1312
|
-
|
|
1331
|
+
4. **Confirm the enriched request.** Before submitting, present a summary of what you'll send to the API:
|
|
1332
|
+
- The full prompt (including any exclusion notes)
|
|
1333
|
+
- The language
|
|
1334
|
+
- The success case(s)
|
|
1335
|
+
- The failure case(s)
|
|
1313
1336
|
|
|
1314
|
-
|
|
1337
|
+
Ask the user to confirm or adjust before proceeding.
|
|
1315
1338
|
|
|
1316
|
-
|
|
1339
|
+
5. **Write the JSON payload to a file.** Build a JSON object with the gathered fields. Write the JSON to \`.taskless/.tmp-rule-request.json\`.
|
|
1340
|
+
|
|
1341
|
+
**Multiple examples:** The \`successCase\` and \`failureCase\` fields are single strings. When you have multiple examples, concatenate them into one string using fenced code blocks separated by blank lines:
|
|
1342
|
+
|
|
1343
|
+
\`\`\`\`json
|
|
1344
|
+
{
|
|
1345
|
+
"prompt": "...",
|
|
1346
|
+
"language": "typescript",
|
|
1347
|
+
"failureCase": "\`\`\`typescript\\n/// <reference types=\\"@cloudflare/workers-types\\" />\\nexport class MyWorker { ... }\\n\`\`\`\\n\\n\`\`\`typescript\\n/// <reference types=\\"vite/client\\" />\\nconst x = import.meta.env.FOO;\\n\`\`\`",
|
|
1348
|
+
"successCase": "\`\`\`typescript\\nimport type { DurableObjectState } from 'cloudflare:workers';\\nexport class MyWorker { ... }\\n\`\`\`\\n\\n\`\`\`typescript\\n// .d.ts files are exempt — triple-slash is idiomatic there\\n/// <reference types=\\"@cloudflare/workers-types\\" />\\n\`\`\`"
|
|
1349
|
+
}
|
|
1350
|
+
\`\`\`\`
|
|
1351
|
+
|
|
1352
|
+
6. **Invoke the CLI.** Run \`pnpm dlx @taskless/cli@latest rules create --from .taskless/.tmp-rule-request.json --json\`. The command may take 30-60 seconds as it polls the API.
|
|
1353
|
+
|
|
1354
|
+
7. **Clean up.** After the command completes (success or failure), delete the \`.taskless/.tmp-rule-request.json\` file.
|
|
1355
|
+
|
|
1356
|
+
8. **Report the results.** When the CLI completes, show the generated file paths and suggest running \`taskless check\` to test the new rule.
|
|
1357
|
+
|
|
1358
|
+
9. **Handle errors.** If the CLI fails:
|
|
1317
1359
|
- **Authentication required**: Suggest running \`taskless auth login\` first.
|
|
1318
1360
|
- **Missing config**: Suggest running \`taskless init\` to set up the project.
|
|
1319
1361
|
- **Stale scaffold version**: Suggest running \`taskless update-engine\` to update the \`.taskless/\` engine directory.
|
|
1320
1362
|
- **API errors**: Report the error message and suggest trying again.
|
|
1321
1363
|
`, mi = `---
|
|
1322
|
-
name: taskless-rule-delete
|
|
1364
|
+
name: use-taskless-rule-delete
|
|
1323
1365
|
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".
|
|
1324
1366
|
metadata:
|
|
1325
1367
|
author: taskless
|
|
1326
|
-
version: 0.1.
|
|
1368
|
+
version: 0.1.4
|
|
1327
1369
|
commandName: "-"
|
|
1328
1370
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1329
1371
|
---
|
|
@@ -1354,11 +1396,11 @@ When this skill is invoked, help the user identify which rule to delete, confirm
|
|
|
1354
1396
|
|
|
1355
1397
|
7. **Handle errors.** If the CLI reports the rule was not found, inform the user and suggest checking the rule ID.
|
|
1356
1398
|
`, gi = `---
|
|
1357
|
-
name: taskless-update-engine
|
|
1399
|
+
name: use-taskless-update-engine
|
|
1358
1400
|
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".
|
|
1359
1401
|
metadata:
|
|
1360
1402
|
author: taskless
|
|
1361
|
-
version: 0.1.
|
|
1403
|
+
version: 0.1.4
|
|
1362
1404
|
commandName: taskless:update-engine
|
|
1363
1405
|
compatibility: Designed for Agents implementing the Agent Skills specification.
|
|
1364
1406
|
---
|
|
@@ -1398,7 +1440,7 @@ tags:
|
|
|
1398
1440
|
- taskless
|
|
1399
1441
|
metadata:
|
|
1400
1442
|
author: taskless
|
|
1401
|
-
version: 0.1.
|
|
1443
|
+
version: 0.1.4
|
|
1402
1444
|
commandName: taskless:check
|
|
1403
1445
|
---
|
|
1404
1446
|
|
|
@@ -1423,7 +1465,7 @@ tags:
|
|
|
1423
1465
|
- taskless
|
|
1424
1466
|
metadata:
|
|
1425
1467
|
author: taskless
|
|
1426
|
-
version: 0.1.
|
|
1468
|
+
version: 0.1.4
|
|
1427
1469
|
commandName: taskless:info
|
|
1428
1470
|
---
|
|
1429
1471
|
|
|
@@ -1475,7 +1517,7 @@ tags:
|
|
|
1475
1517
|
- taskless
|
|
1476
1518
|
metadata:
|
|
1477
1519
|
author: taskless
|
|
1478
|
-
version: 0.1.
|
|
1520
|
+
version: 0.1.4
|
|
1479
1521
|
commandName: taskless:login
|
|
1480
1522
|
---
|
|
1481
1523
|
|
|
@@ -1498,7 +1540,7 @@ tags:
|
|
|
1498
1540
|
- taskless
|
|
1499
1541
|
metadata:
|
|
1500
1542
|
author: taskless
|
|
1501
|
-
version: 0.1.
|
|
1543
|
+
version: 0.1.4
|
|
1502
1544
|
commandName: taskless:logout
|
|
1503
1545
|
---
|
|
1504
1546
|
|
|
@@ -1521,13 +1563,15 @@ tags:
|
|
|
1521
1563
|
- taskless
|
|
1522
1564
|
metadata:
|
|
1523
1565
|
author: taskless
|
|
1524
|
-
version: 0.1.
|
|
1566
|
+
version: 0.1.4
|
|
1525
1567
|
commandName: taskless:rule
|
|
1526
1568
|
---
|
|
1527
1569
|
|
|
1528
1570
|
# Taskless Rule Create
|
|
1529
1571
|
|
|
1530
|
-
When this skill is invoked,
|
|
1572
|
+
When this skill is invoked, work with the user to build a comprehensive rule request, then write a JSON file and run the CLI to generate a rule.
|
|
1573
|
+
|
|
1574
|
+
Your goal is to produce the best possible rule by enriching the user's initial description with concrete examples, edge cases, and exclusions — not just pass their request through verbatim.
|
|
1531
1575
|
|
|
1532
1576
|
## Instructions
|
|
1533
1577
|
|
|
@@ -1535,19 +1579,59 @@ When this skill is invoked, gather the necessary information from the user, writ
|
|
|
1535
1579
|
|
|
1536
1580
|
2. **Gather the rule description.** Ask the user what pattern they want to detect. This becomes the \`prompt\` field (required).
|
|
1537
1581
|
|
|
1538
|
-
3. **
|
|
1582
|
+
3. **Enrich the request.** After receiving the initial description, actively work with the user to strengthen the rule. Do all of the following:
|
|
1539
1583
|
|
|
1540
|
-
|
|
1584
|
+
a. **Search the codebase for real examples.** Proactively scan the codebase for instances of the pattern they want to detect. Show them what you found and ask:
|
|
1585
|
+
- "I found N instances of this pattern in your codebase. Should I include some as examples in the rule request?"
|
|
1586
|
+
- If you find variations of the pattern, highlight them as potential edge cases.
|
|
1541
1587
|
|
|
1542
|
-
|
|
1588
|
+
b. **Ask for success and failure cases.** Even if the user provided examples, ask if there are other cases to consider:
|
|
1589
|
+
- "Are there edge cases or variations of this pattern that should also be caught?"
|
|
1590
|
+
- "Can you show me an example of the _correct_ way to write this code?"
|
|
1591
|
+
- Use any examples the user provided in their description as a starting point, but look for more.
|
|
1543
1592
|
|
|
1544
|
-
|
|
1593
|
+
c. **Collect default ignores from the project.** Before asking the user about exclusions, check the project for existing ignore patterns that inform what files the rule should skip. Look at:
|
|
1594
|
+
- \`.gitignore\` — files already excluded from version control (e.g., \`node_modules/\`, \`dist/\`, build artifacts)
|
|
1595
|
+
- Linter configs (e.g., \`eslint.config.js\`, \`.eslintignore\`) — files or directories already excluded from linting
|
|
1596
|
+
- \`tsconfig.json\` \`exclude\` field — files excluded from type checking
|
|
1597
|
+
- Any other relevant config that signals "these files are not authored source code"
|
|
1545
1598
|
|
|
1546
|
-
|
|
1599
|
+
Use these to build a baseline set of ignores. Present them to the user as defaults that will be included in the rule prompt.
|
|
1547
1600
|
|
|
1548
|
-
|
|
1601
|
+
d. **Ask about additional exclusions.** Beyond the defaults, ask the user if there are files, directories, or contexts where the pattern is acceptable:
|
|
1602
|
+
- "Are there any files or directories where this pattern should be allowed? (e.g., \`.d.ts\` files, test files, generated code)"
|
|
1603
|
+
- Incorporate both the default ignores and user-specified exclusions into the \`prompt\` field so the rule generator understands the boundaries.
|
|
1549
1604
|
|
|
1550
|
-
|
|
1605
|
+
e. **Infer the language.** Detect the language from the codebase or the user's examples. Confirm your assumption with the user.
|
|
1606
|
+
|
|
1607
|
+
4. **Confirm the enriched request.** Before submitting, present a summary of what you'll send to the API:
|
|
1608
|
+
- The full prompt (including any exclusion notes)
|
|
1609
|
+
- The language
|
|
1610
|
+
- The success case(s)
|
|
1611
|
+
- The failure case(s)
|
|
1612
|
+
|
|
1613
|
+
Ask the user to confirm or adjust before proceeding.
|
|
1614
|
+
|
|
1615
|
+
5. **Write the JSON payload to a file.** Build a JSON object with the gathered fields. Write the JSON to \`.taskless/.tmp-rule-request.json\`.
|
|
1616
|
+
|
|
1617
|
+
**Multiple examples:** The \`successCase\` and \`failureCase\` fields are single strings. When you have multiple examples, concatenate them into one string using fenced code blocks separated by blank lines:
|
|
1618
|
+
|
|
1619
|
+
\`\`\`\`json
|
|
1620
|
+
{
|
|
1621
|
+
"prompt": "...",
|
|
1622
|
+
"language": "typescript",
|
|
1623
|
+
"failureCase": "\`\`\`typescript\\n/// <reference types=\\"@cloudflare/workers-types\\" />\\nexport class MyWorker { ... }\\n\`\`\`\\n\\n\`\`\`typescript\\n/// <reference types=\\"vite/client\\" />\\nconst x = import.meta.env.FOO;\\n\`\`\`",
|
|
1624
|
+
"successCase": "\`\`\`typescript\\nimport type { DurableObjectState } from 'cloudflare:workers';\\nexport class MyWorker { ... }\\n\`\`\`\\n\\n\`\`\`typescript\\n// .d.ts files are exempt — triple-slash is idiomatic there\\n/// <reference types=\\"@cloudflare/workers-types\\" />\\n\`\`\`"
|
|
1625
|
+
}
|
|
1626
|
+
\`\`\`\`
|
|
1627
|
+
|
|
1628
|
+
6. **Invoke the CLI.** Run \`pnpm dlx @taskless/cli@latest rules create --from .taskless/.tmp-rule-request.json --json\`. The command may take 30-60 seconds as it polls the API.
|
|
1629
|
+
|
|
1630
|
+
7. **Clean up.** After the command completes (success or failure), delete the \`.taskless/.tmp-rule-request.json\` file.
|
|
1631
|
+
|
|
1632
|
+
8. **Report the results.** When the CLI completes, show the generated file paths and suggest running \`taskless check\` to test the new rule.
|
|
1633
|
+
|
|
1634
|
+
9. **Handle errors.** If the CLI fails:
|
|
1551
1635
|
- **Authentication required**: Suggest running \`taskless auth login\` first.
|
|
1552
1636
|
- **Missing config**: Suggest running \`taskless init\` to set up the project.
|
|
1553
1637
|
- **Stale scaffold version**: Suggest running \`taskless update-engine\` to update the \`.taskless/\` engine directory.
|
|
@@ -1560,7 +1644,7 @@ tags:
|
|
|
1560
1644
|
- taskless
|
|
1561
1645
|
metadata:
|
|
1562
1646
|
author: taskless
|
|
1563
|
-
version: 0.1.
|
|
1647
|
+
version: 0.1.4
|
|
1564
1648
|
commandName: taskless:update-engine
|
|
1565
1649
|
---
|
|
1566
1650
|
|
|
@@ -1591,8 +1675,8 @@ When this skill is invoked, run the update-engine CLI command to request a scaff
|
|
|
1591
1675
|
- **Authentication required**: Suggest running \`taskless auth login\` first.
|
|
1592
1676
|
- **Missing config**: Suggest running \`taskless init\` to set up the project.
|
|
1593
1677
|
- **API errors**: Report the error message and suggest trying again.
|
|
1594
|
-
`,
|
|
1595
|
-
function
|
|
1678
|
+
`, At = /* @__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] === At, $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;
|
|
1679
|
+
function A(s) {
|
|
1596
1680
|
if (s && typeof s == "object")
|
|
1597
1681
|
switch (s[B]) {
|
|
1598
1682
|
case Z:
|
|
@@ -1601,10 +1685,10 @@ function L(s) {
|
|
|
1601
1685
|
}
|
|
1602
1686
|
return !1;
|
|
1603
1687
|
}
|
|
1604
|
-
function
|
|
1688
|
+
function L(s) {
|
|
1605
1689
|
if (s && typeof s == "object")
|
|
1606
1690
|
switch (s[B]) {
|
|
1607
|
-
case
|
|
1691
|
+
case At:
|
|
1608
1692
|
case Z:
|
|
1609
1693
|
case J:
|
|
1610
1694
|
case ye:
|
|
@@ -1612,20 +1696,20 @@ function A(s) {
|
|
|
1612
1696
|
}
|
|
1613
1697
|
return !1;
|
|
1614
1698
|
}
|
|
1615
|
-
const
|
|
1699
|
+
const Ts = (s) => (_(s) || A(s)) && !!s.anchor, ee = /* @__PURE__ */ Symbol("break visit"), Ti = /* @__PURE__ */ Symbol("skip children"), Ne = /* @__PURE__ */ Symbol("remove node");
|
|
1616
1700
|
function ke(s, e) {
|
|
1617
1701
|
const t = Ii(e);
|
|
1618
|
-
$e(s) ? ce(null, s.contents, t, Object.freeze([s])) ===
|
|
1702
|
+
$e(s) ? ce(null, s.contents, t, Object.freeze([s])) === Ne && (s.contents = null) : ce(null, s, t, Object.freeze([]));
|
|
1619
1703
|
}
|
|
1620
1704
|
ke.BREAK = ee;
|
|
1621
|
-
ke.SKIP =
|
|
1622
|
-
ke.REMOVE =
|
|
1705
|
+
ke.SKIP = Ti;
|
|
1706
|
+
ke.REMOVE = Ne;
|
|
1623
1707
|
function ce(s, e, t, n) {
|
|
1624
|
-
const i =
|
|
1625
|
-
if (
|
|
1708
|
+
const i = Ni(s, e, t, n);
|
|
1709
|
+
if (L(i) || E(i))
|
|
1626
1710
|
return Oi(s, n, i), ce(s, i, t, n);
|
|
1627
1711
|
if (typeof i != "symbol") {
|
|
1628
|
-
if (
|
|
1712
|
+
if (A(e)) {
|
|
1629
1713
|
n = Object.freeze(n.concat(e));
|
|
1630
1714
|
for (let r = 0; r < e.items.length; ++r) {
|
|
1631
1715
|
const o = ce(r, e.items[r], t, n);
|
|
@@ -1634,7 +1718,7 @@ function ce(s, e, t, n) {
|
|
|
1634
1718
|
else {
|
|
1635
1719
|
if (o === ee)
|
|
1636
1720
|
return ee;
|
|
1637
|
-
o ===
|
|
1721
|
+
o === Ne && (e.items.splice(r, 1), r -= 1);
|
|
1638
1722
|
}
|
|
1639
1723
|
}
|
|
1640
1724
|
} else if (E(e)) {
|
|
@@ -1642,11 +1726,11 @@ function ce(s, e, t, n) {
|
|
|
1642
1726
|
const r = ce("key", e.key, t, n);
|
|
1643
1727
|
if (r === ee)
|
|
1644
1728
|
return ee;
|
|
1645
|
-
r ===
|
|
1729
|
+
r === Ne && (e.key = null);
|
|
1646
1730
|
const o = ce("value", e.value, t, n);
|
|
1647
1731
|
if (o === ee)
|
|
1648
1732
|
return ee;
|
|
1649
|
-
o ===
|
|
1733
|
+
o === Ne && (e.value = null);
|
|
1650
1734
|
}
|
|
1651
1735
|
}
|
|
1652
1736
|
return i;
|
|
@@ -1666,7 +1750,7 @@ function Ii(s) {
|
|
|
1666
1750
|
Seq: s.Collection
|
|
1667
1751
|
}, s) : s;
|
|
1668
1752
|
}
|
|
1669
|
-
function
|
|
1753
|
+
function Ni(s, e, t, n) {
|
|
1670
1754
|
if (typeof t == "function")
|
|
1671
1755
|
return t(s, e, n);
|
|
1672
1756
|
if (je(e))
|
|
@@ -1682,7 +1766,7 @@ function Ti(s, e, t, n) {
|
|
|
1682
1766
|
}
|
|
1683
1767
|
function Oi(s, e, t) {
|
|
1684
1768
|
const n = e[e.length - 1];
|
|
1685
|
-
if (
|
|
1769
|
+
if (A(n))
|
|
1686
1770
|
n.items[s] = t;
|
|
1687
1771
|
else if (E(n))
|
|
1688
1772
|
s === "key" ? n.key = t : n.value = t;
|
|
@@ -1701,12 +1785,12 @@ const _i = {
|
|
|
1701
1785
|
"{": "%7B",
|
|
1702
1786
|
"}": "%7D"
|
|
1703
1787
|
}, Ci = (s) => s.replace(/[!,[\]{}]/g, (e) => _i[e]);
|
|
1704
|
-
class
|
|
1788
|
+
class x {
|
|
1705
1789
|
constructor(e, t) {
|
|
1706
|
-
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({},
|
|
1790
|
+
this.docStart = null, this.docEnd = !1, this.yaml = Object.assign({}, x.defaultYaml, e), this.tags = Object.assign({}, x.defaultTags, t);
|
|
1707
1791
|
}
|
|
1708
1792
|
clone() {
|
|
1709
|
-
const e = new
|
|
1793
|
+
const e = new x(this.yaml, this.tags);
|
|
1710
1794
|
return e.docStart = this.docStart, e;
|
|
1711
1795
|
}
|
|
1712
1796
|
/**
|
|
@@ -1714,16 +1798,16 @@ class P {
|
|
|
1714
1798
|
* update the stream state according to the current version's spec.
|
|
1715
1799
|
*/
|
|
1716
1800
|
atDocument() {
|
|
1717
|
-
const e = new
|
|
1801
|
+
const e = new x(this.yaml, this.tags);
|
|
1718
1802
|
switch (this.yaml.version) {
|
|
1719
1803
|
case "1.1":
|
|
1720
1804
|
this.atNextDocument = !0;
|
|
1721
1805
|
break;
|
|
1722
1806
|
case "1.2":
|
|
1723
1807
|
this.atNextDocument = !1, this.yaml = {
|
|
1724
|
-
explicit:
|
|
1808
|
+
explicit: x.defaultYaml.explicit,
|
|
1725
1809
|
version: "1.2"
|
|
1726
|
-
}, this.tags = Object.assign({},
|
|
1810
|
+
}, this.tags = Object.assign({}, x.defaultTags);
|
|
1727
1811
|
break;
|
|
1728
1812
|
}
|
|
1729
1813
|
return e;
|
|
@@ -1733,7 +1817,7 @@ class P {
|
|
|
1733
1817
|
* @returns `true` on success
|
|
1734
1818
|
*/
|
|
1735
1819
|
add(e, t) {
|
|
1736
|
-
this.atNextDocument && (this.yaml = { explicit:
|
|
1820
|
+
this.atNextDocument && (this.yaml = { explicit: x.defaultYaml.explicit, version: "1.1" }, this.tags = Object.assign({}, x.defaultTags), this.atNextDocument = !1);
|
|
1737
1821
|
const n = e.trim().split(/[ \t]+/), i = n.shift();
|
|
1738
1822
|
switch (i) {
|
|
1739
1823
|
case "%TAG": {
|
|
@@ -1796,10 +1880,10 @@ class P {
|
|
|
1796
1880
|
toString(e) {
|
|
1797
1881
|
const t = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [], n = Object.entries(this.tags);
|
|
1798
1882
|
let i;
|
|
1799
|
-
if (e && n.length > 0 &&
|
|
1883
|
+
if (e && n.length > 0 && L(e.contents)) {
|
|
1800
1884
|
const r = {};
|
|
1801
1885
|
ke(e.contents, (o, a) => {
|
|
1802
|
-
|
|
1886
|
+
L(a) && a.tag && (r[a.tag] = !0);
|
|
1803
1887
|
}), i = Object.keys(r);
|
|
1804
1888
|
} else
|
|
1805
1889
|
i = [];
|
|
@@ -1809,8 +1893,8 @@ class P {
|
|
|
1809
1893
|
`);
|
|
1810
1894
|
}
|
|
1811
1895
|
}
|
|
1812
|
-
|
|
1813
|
-
|
|
1896
|
+
x.defaultYaml = { explicit: !1, version: "1.2" };
|
|
1897
|
+
x.defaultTags = { "!!": "tag:yaml.org,2002:" };
|
|
1814
1898
|
function Is(s) {
|
|
1815
1899
|
if (/[\x00-\x19\s,[\]{}]/.test(s)) {
|
|
1816
1900
|
const t = `Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;
|
|
@@ -1818,7 +1902,7 @@ function Is(s) {
|
|
|
1818
1902
|
}
|
|
1819
1903
|
return !0;
|
|
1820
1904
|
}
|
|
1821
|
-
function
|
|
1905
|
+
function Ns(s) {
|
|
1822
1906
|
const e = /* @__PURE__ */ new Set();
|
|
1823
1907
|
return ke(s, {
|
|
1824
1908
|
Value(t, n) {
|
|
@@ -1833,12 +1917,12 @@ function Os(s, e) {
|
|
|
1833
1917
|
return n;
|
|
1834
1918
|
}
|
|
1835
1919
|
}
|
|
1836
|
-
function
|
|
1920
|
+
function Ai(s, e) {
|
|
1837
1921
|
const t = [], n = /* @__PURE__ */ new Map();
|
|
1838
1922
|
let i = null;
|
|
1839
1923
|
return {
|
|
1840
1924
|
onAnchor: (r) => {
|
|
1841
|
-
t.push(r), i ?? (i =
|
|
1925
|
+
t.push(r), i ?? (i = Ns(s));
|
|
1842
1926
|
const o = Os(e, i);
|
|
1843
1927
|
return i.add(o), o;
|
|
1844
1928
|
},
|
|
@@ -1850,7 +1934,7 @@ function Li(s, e) {
|
|
|
1850
1934
|
setAnchors: () => {
|
|
1851
1935
|
for (const r of t) {
|
|
1852
1936
|
const o = n.get(r);
|
|
1853
|
-
if (typeof o == "object" && o.anchor && (_(o.node) ||
|
|
1937
|
+
if (typeof o == "object" && o.anchor && (_(o.node) || A(o.node)))
|
|
1854
1938
|
o.node.anchor = o.anchor;
|
|
1855
1939
|
else {
|
|
1856
1940
|
const a = new Error("Failed to resolve repeated object (this should not happen)");
|
|
@@ -1889,7 +1973,7 @@ function D(s, e, t) {
|
|
|
1889
1973
|
if (Array.isArray(s))
|
|
1890
1974
|
return s.map((n, i) => D(n, String(i), t));
|
|
1891
1975
|
if (s && typeof s.toJSON == "function") {
|
|
1892
|
-
if (!t || !
|
|
1976
|
+
if (!t || !Ts(s))
|
|
1893
1977
|
return s.toJSON(e, t);
|
|
1894
1978
|
const n = { aliasCount: 0, count: 1, res: void 0 };
|
|
1895
1979
|
t.anchors.set(s, n), t.onCreate = (r) => {
|
|
@@ -1927,9 +2011,9 @@ class Lt {
|
|
|
1927
2011
|
return typeof r == "function" ? ue(r, { "": a }, "", a) : a;
|
|
1928
2012
|
}
|
|
1929
2013
|
}
|
|
1930
|
-
class
|
|
2014
|
+
class Et extends Lt {
|
|
1931
2015
|
constructor(e) {
|
|
1932
|
-
super(
|
|
2016
|
+
super(At), this.source = e, Object.defineProperty(this, "tag", {
|
|
1933
2017
|
set() {
|
|
1934
2018
|
throw new Error("Alias nodes cannot have tags");
|
|
1935
2019
|
}
|
|
@@ -1943,7 +2027,7 @@ class At extends Lt {
|
|
|
1943
2027
|
let n;
|
|
1944
2028
|
t?.aliasResolveCache ? n = t.aliasResolveCache : (n = [], ke(e, {
|
|
1945
2029
|
Node: (r, o) => {
|
|
1946
|
-
(re(o) ||
|
|
2030
|
+
(re(o) || Ts(o)) && n.push(o);
|
|
1947
2031
|
}
|
|
1948
2032
|
}), t && (t.aliasResolveCache = n));
|
|
1949
2033
|
let i;
|
|
@@ -1990,7 +2074,7 @@ function Fe(s, e, t) {
|
|
|
1990
2074
|
if (re(e)) {
|
|
1991
2075
|
const n = e.resolve(s), i = t && n && t.get(n);
|
|
1992
2076
|
return i ? i.count * i.aliasCount : 0;
|
|
1993
|
-
} else if (
|
|
2077
|
+
} else if (A(e)) {
|
|
1994
2078
|
let n = 0;
|
|
1995
2079
|
for (const i of e.items) {
|
|
1996
2080
|
const r = Fe(s, i, t);
|
|
@@ -2004,7 +2088,7 @@ function Fe(s, e, t) {
|
|
|
2004
2088
|
return 1;
|
|
2005
2089
|
}
|
|
2006
2090
|
const _s = (s) => !s || typeof s != "function" && typeof s != "object";
|
|
2007
|
-
class
|
|
2091
|
+
class T extends Lt {
|
|
2008
2092
|
constructor(e) {
|
|
2009
2093
|
super(J), this.value = e;
|
|
2010
2094
|
}
|
|
@@ -2015,12 +2099,12 @@ class N extends Lt {
|
|
|
2015
2099
|
return String(this.value);
|
|
2016
2100
|
}
|
|
2017
2101
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
const
|
|
2102
|
+
T.BLOCK_FOLDED = "BLOCK_FOLDED";
|
|
2103
|
+
T.BLOCK_LITERAL = "BLOCK_LITERAL";
|
|
2104
|
+
T.PLAIN = "PLAIN";
|
|
2105
|
+
T.QUOTE_DOUBLE = "QUOTE_DOUBLE";
|
|
2106
|
+
T.QUOTE_SINGLE = "QUOTE_SINGLE";
|
|
2107
|
+
const Li = "tag:yaml.org,2002:";
|
|
2024
2108
|
function Ei(s, e, t) {
|
|
2025
2109
|
if (e) {
|
|
2026
2110
|
const n = t.filter((r) => r.tag === e), i = n.find((r) => !r.format) ?? n[0];
|
|
@@ -2030,8 +2114,8 @@ function Ei(s, e, t) {
|
|
|
2030
2114
|
}
|
|
2031
2115
|
return t.find((n) => n.identify?.(s) && !n.format);
|
|
2032
2116
|
}
|
|
2033
|
-
function
|
|
2034
|
-
if ($e(s) && (s = s.contents),
|
|
2117
|
+
function Ae(s, e, t) {
|
|
2118
|
+
if ($e(s) && (s = s.contents), L(s))
|
|
2035
2119
|
return s;
|
|
2036
2120
|
if (E(s)) {
|
|
2037
2121
|
const f = t.schema[Z].createNode?.(t.schema, null, t);
|
|
@@ -2042,23 +2126,23 @@ function Le(s, e, t) {
|
|
|
2042
2126
|
let l;
|
|
2043
2127
|
if (n && s && typeof s == "object") {
|
|
2044
2128
|
if (l = a.get(s), l)
|
|
2045
|
-
return l.anchor ?? (l.anchor = i(s)), new
|
|
2129
|
+
return l.anchor ?? (l.anchor = i(s)), new Et(l.anchor);
|
|
2046
2130
|
l = { anchor: null, node: null }, a.set(s, l);
|
|
2047
2131
|
}
|
|
2048
|
-
e?.startsWith("!!") && (e =
|
|
2132
|
+
e?.startsWith("!!") && (e = Li + e.slice(2));
|
|
2049
2133
|
let c = Ei(s, e, o.tags);
|
|
2050
2134
|
if (!c) {
|
|
2051
2135
|
if (s && typeof s.toJSON == "function" && (s = s.toJSON()), !s || typeof s != "object") {
|
|
2052
|
-
const f = new
|
|
2136
|
+
const f = new T(s);
|
|
2053
2137
|
return l && (l.node = f), f;
|
|
2054
2138
|
}
|
|
2055
2139
|
c = s instanceof Map ? o[Z] : Symbol.iterator in Object(s) ? o[ye] : o[Z];
|
|
2056
2140
|
}
|
|
2057
2141
|
r && (r(c), delete t.onTagObj);
|
|
2058
|
-
const u = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new
|
|
2142
|
+
const u = c?.createNode ? c.createNode(t.schema, s, t) : typeof c?.nodeClass?.from == "function" ? c.nodeClass.from(t.schema, s, t) : new T(s);
|
|
2059
2143
|
return e ? u.tag = e : c.default || (u.tag = c.tag), l && (l.node = u), u;
|
|
2060
2144
|
}
|
|
2061
|
-
function
|
|
2145
|
+
function Ye(s, e, t) {
|
|
2062
2146
|
let n = t;
|
|
2063
2147
|
for (let i = e.length - 1; i >= 0; --i) {
|
|
2064
2148
|
const r = e[i];
|
|
@@ -2068,7 +2152,7 @@ function We(s, e, t) {
|
|
|
2068
2152
|
} else
|
|
2069
2153
|
n = /* @__PURE__ */ new Map([[r, n]]);
|
|
2070
2154
|
}
|
|
2071
|
-
return
|
|
2155
|
+
return Ae(n, void 0, {
|
|
2072
2156
|
aliasDuplicateObjects: !1,
|
|
2073
2157
|
keepUndefined: !1,
|
|
2074
2158
|
onAnchor: () => {
|
|
@@ -2095,7 +2179,7 @@ class Cs extends Lt {
|
|
|
2095
2179
|
*/
|
|
2096
2180
|
clone(e) {
|
|
2097
2181
|
const t = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
2098
|
-
return e && (t.schema = e), t.items = t.items.map((n) =>
|
|
2182
|
+
return e && (t.schema = e), t.items = t.items.map((n) => L(n) || E(n) ? n.clone(e) : n), this.range && (t.range = this.range.slice()), t;
|
|
2099
2183
|
}
|
|
2100
2184
|
/**
|
|
2101
2185
|
* Adds a value to the collection. For `!!map` and `!!omap` the value must
|
|
@@ -2107,10 +2191,10 @@ class Cs extends Lt {
|
|
|
2107
2191
|
this.add(t);
|
|
2108
2192
|
else {
|
|
2109
2193
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
2110
|
-
if (
|
|
2194
|
+
if (A(r))
|
|
2111
2195
|
r.addIn(i, t);
|
|
2112
2196
|
else if (r === void 0 && this.schema)
|
|
2113
|
-
this.set(n,
|
|
2197
|
+
this.set(n, Ye(this.schema, i, t));
|
|
2114
2198
|
else
|
|
2115
2199
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
2116
2200
|
}
|
|
@@ -2124,7 +2208,7 @@ class Cs extends Lt {
|
|
|
2124
2208
|
if (n.length === 0)
|
|
2125
2209
|
return this.delete(t);
|
|
2126
2210
|
const i = this.get(t, !0);
|
|
2127
|
-
if (
|
|
2211
|
+
if (A(i))
|
|
2128
2212
|
return i.deleteIn(n);
|
|
2129
2213
|
throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`);
|
|
2130
2214
|
}
|
|
@@ -2135,7 +2219,7 @@ class Cs extends Lt {
|
|
|
2135
2219
|
*/
|
|
2136
2220
|
getIn(e, t) {
|
|
2137
2221
|
const [n, ...i] = e, r = this.get(n, !0);
|
|
2138
|
-
return i.length === 0 ? !t && _(r) ? r.value : r :
|
|
2222
|
+
return i.length === 0 ? !t && _(r) ? r.value : r : A(r) ? r.getIn(i, t) : void 0;
|
|
2139
2223
|
}
|
|
2140
2224
|
hasAllNullValues(e) {
|
|
2141
2225
|
return this.items.every((t) => {
|
|
@@ -2153,7 +2237,7 @@ class Cs extends Lt {
|
|
|
2153
2237
|
if (n.length === 0)
|
|
2154
2238
|
return this.has(t);
|
|
2155
2239
|
const i = this.get(t, !0);
|
|
2156
|
-
return
|
|
2240
|
+
return A(i) ? i.hasIn(n) : !1;
|
|
2157
2241
|
}
|
|
2158
2242
|
/**
|
|
2159
2243
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -2165,10 +2249,10 @@ class Cs extends Lt {
|
|
|
2165
2249
|
this.set(n, t);
|
|
2166
2250
|
else {
|
|
2167
2251
|
const r = this.get(n, !0);
|
|
2168
|
-
if (
|
|
2252
|
+
if (A(r))
|
|
2169
2253
|
r.setIn(i, t);
|
|
2170
2254
|
else if (r === void 0 && this.schema)
|
|
2171
|
-
this.set(n,
|
|
2255
|
+
this.set(n, Ye(this.schema, i, t));
|
|
2172
2256
|
else
|
|
2173
2257
|
throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);
|
|
2174
2258
|
}
|
|
@@ -2181,8 +2265,8 @@ function W(s, e) {
|
|
|
2181
2265
|
const te = (s, e, t) => s.endsWith(`
|
|
2182
2266
|
`) ? W(t, e) : t.includes(`
|
|
2183
2267
|
`) ? `
|
|
2184
|
-
` + W(t, e) : (s.endsWith(" ") ? "" : " ") + t,
|
|
2185
|
-
function
|
|
2268
|
+
` + W(t, e) : (s.endsWith(" ") ? "" : " ") + t, As = "flow", bt = "block", Je = "quoted";
|
|
2269
|
+
function Qe(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentWidth: r = 20, onFold: o, onOverflow: a } = {}) {
|
|
2186
2270
|
if (!i || i < 0)
|
|
2187
2271
|
return s;
|
|
2188
2272
|
i < r && (r = 0);
|
|
@@ -2192,45 +2276,45 @@ function ze(s, e, t = "flow", { indentAtStart: n, lineWidth: i = 80, minContentW
|
|
|
2192
2276
|
const c = [], u = {};
|
|
2193
2277
|
let f = i - e.length;
|
|
2194
2278
|
typeof n == "number" && (n > i - Math.max(2, r) ? c.push(0) : f = i - n);
|
|
2195
|
-
let
|
|
2196
|
-
t === bt && (
|
|
2197
|
-
for (let b; b = s[
|
|
2279
|
+
let h, p, g = !1, d = -1, m = -1, k = -1;
|
|
2280
|
+
t === bt && (d = zt(s, d, e.length), d !== -1 && (f = d + l));
|
|
2281
|
+
for (let b; b = s[d += 1]; ) {
|
|
2198
2282
|
if (t === Je && b === "\\") {
|
|
2199
|
-
switch (m =
|
|
2283
|
+
switch (m = d, s[d + 1]) {
|
|
2200
2284
|
case "x":
|
|
2201
|
-
|
|
2285
|
+
d += 3;
|
|
2202
2286
|
break;
|
|
2203
2287
|
case "u":
|
|
2204
|
-
|
|
2288
|
+
d += 5;
|
|
2205
2289
|
break;
|
|
2206
2290
|
case "U":
|
|
2207
|
-
|
|
2291
|
+
d += 9;
|
|
2208
2292
|
break;
|
|
2209
2293
|
default:
|
|
2210
|
-
|
|
2294
|
+
d += 1;
|
|
2211
2295
|
}
|
|
2212
|
-
k =
|
|
2296
|
+
k = d;
|
|
2213
2297
|
}
|
|
2214
2298
|
if (b === `
|
|
2215
2299
|
`)
|
|
2216
|
-
t === bt && (
|
|
2300
|
+
t === bt && (d = zt(s, d, e.length)), f = d + e.length + l, h = void 0;
|
|
2217
2301
|
else {
|
|
2218
2302
|
if (b === " " && p && p !== " " && p !== `
|
|
2219
2303
|
` && p !== " ") {
|
|
2220
|
-
const S = s[
|
|
2304
|
+
const S = s[d + 1];
|
|
2221
2305
|
S && S !== " " && S !== `
|
|
2222
|
-
` && S !== " " && (
|
|
2306
|
+
` && S !== " " && (h = d);
|
|
2223
2307
|
}
|
|
2224
|
-
if (
|
|
2225
|
-
if (
|
|
2226
|
-
c.push(
|
|
2308
|
+
if (d >= f)
|
|
2309
|
+
if (h)
|
|
2310
|
+
c.push(h), f = h + l, h = void 0;
|
|
2227
2311
|
else if (t === Je) {
|
|
2228
2312
|
for (; p === " " || p === " "; )
|
|
2229
|
-
p = b, b = s[
|
|
2230
|
-
const S =
|
|
2313
|
+
p = b, b = s[d += 1], g = !0;
|
|
2314
|
+
const S = d > k + 1 ? d - 2 : m - 1;
|
|
2231
2315
|
if (u[S])
|
|
2232
2316
|
return s;
|
|
2233
|
-
c.push(S), u[S] = !0, f = S + l,
|
|
2317
|
+
c.push(S), u[S] = !0, f = S + l, h = void 0;
|
|
2234
2318
|
} else
|
|
2235
2319
|
g = !0;
|
|
2236
2320
|
}
|
|
@@ -2248,7 +2332,7 @@ ${e}${s.slice(S + 1, v)}`);
|
|
|
2248
2332
|
}
|
|
2249
2333
|
return w;
|
|
2250
2334
|
}
|
|
2251
|
-
function
|
|
2335
|
+
function zt(s, e, t) {
|
|
2252
2336
|
let n = e, i = e + 1, r = s[i];
|
|
2253
2337
|
for (; r === " " || r === " "; )
|
|
2254
2338
|
if (e < i + t)
|
|
@@ -2262,11 +2346,11 @@ function Gt(s, e, t) {
|
|
|
2262
2346
|
}
|
|
2263
2347
|
return n;
|
|
2264
2348
|
}
|
|
2265
|
-
const
|
|
2349
|
+
const Xe = (s, e) => ({
|
|
2266
2350
|
indentAtStart: e ? s.indent.length : s.indentAtStart,
|
|
2267
2351
|
lineWidth: s.options.lineWidth,
|
|
2268
2352
|
minContentWidth: s.options.minContentWidth
|
|
2269
|
-
}),
|
|
2353
|
+
}), Ze = (s) => /^(%|---|\.\.\.)/m.test(s);
|
|
2270
2354
|
function ji(s, e, t) {
|
|
2271
2355
|
if (!e || e < 0)
|
|
2272
2356
|
return !1;
|
|
@@ -2287,7 +2371,7 @@ function Oe(s, e) {
|
|
|
2287
2371
|
const t = JSON.stringify(s);
|
|
2288
2372
|
if (e.options.doubleQuotedAsJSON)
|
|
2289
2373
|
return t;
|
|
2290
|
-
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (
|
|
2374
|
+
const { implicitKey: n } = e, i = e.options.doubleQuotedMinMultiLineLength, r = e.indent || (Ze(s) ? " " : "");
|
|
2291
2375
|
let o = "", a = 0;
|
|
2292
2376
|
for (let l = 0, c = t[l]; c; c = t[++l])
|
|
2293
2377
|
if (c === " " && t[l + 1] === "\\" && t[l + 2] === "n" && (o += t.slice(a, l) + "\\ ", l += 1, a = l, c = "\\"), c === "\\")
|
|
@@ -2342,15 +2426,15 @@ function Oe(s, e) {
|
|
|
2342
2426
|
default:
|
|
2343
2427
|
l += 1;
|
|
2344
2428
|
}
|
|
2345
|
-
return o = a ? o + t.slice(a) : t, n ? o :
|
|
2429
|
+
return o = a ? o + t.slice(a) : t, n ? o : Qe(o, r, Je, Xe(e, !1));
|
|
2346
2430
|
}
|
|
2347
2431
|
function St(s, e) {
|
|
2348
2432
|
if (e.options.singleQuote === !1 || e.implicitKey && s.includes(`
|
|
2349
2433
|
`) || /[ \t]\n|\n[ \t]/.test(s))
|
|
2350
2434
|
return Oe(s, e);
|
|
2351
|
-
const t = e.indent || (
|
|
2435
|
+
const t = e.indent || (Ze(s) ? " " : ""), n = "'" + s.replace(/'/g, "''").replace(/\n+/g, `$&
|
|
2352
2436
|
${t}`) + "'";
|
|
2353
|
-
return e.implicitKey ? n :
|
|
2437
|
+
return e.implicitKey ? n : Qe(n, t, As, Xe(e, !1));
|
|
2354
2438
|
}
|
|
2355
2439
|
function fe(s, e) {
|
|
2356
2440
|
const { singleQuote: t } = e.options;
|
|
@@ -2376,28 +2460,28 @@ function Ve({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
2376
2460
|
const { blockQuote: o, commentString: a, lineWidth: l } = n.options;
|
|
2377
2461
|
if (!o || /\n[\t ]+$/.test(t))
|
|
2378
2462
|
return fe(t, n);
|
|
2379
|
-
const c = n.indent || (n.forceBlockIndent ||
|
|
2463
|
+
const c = n.indent || (n.forceBlockIndent || Ze(t) ? " " : ""), u = o === "literal" ? !0 : o === "folded" || e === T.BLOCK_FOLDED ? !1 : e === T.BLOCK_LITERAL ? !0 : !ji(t, l, c.length);
|
|
2380
2464
|
if (!t)
|
|
2381
2465
|
return u ? `|
|
|
2382
2466
|
` : `>
|
|
2383
2467
|
`;
|
|
2384
|
-
let f,
|
|
2385
|
-
for (
|
|
2386
|
-
const v = t[
|
|
2468
|
+
let f, h;
|
|
2469
|
+
for (h = t.length; h > 0; --h) {
|
|
2470
|
+
const v = t[h - 1];
|
|
2387
2471
|
if (v !== `
|
|
2388
2472
|
` && v !== " " && v !== " ")
|
|
2389
2473
|
break;
|
|
2390
2474
|
}
|
|
2391
|
-
let p = t.substring(
|
|
2475
|
+
let p = t.substring(h);
|
|
2392
2476
|
const g = p.indexOf(`
|
|
2393
2477
|
`);
|
|
2394
2478
|
g === -1 ? f = "-" : t === p || g !== p.length - 1 ? (f = "+", r && r()) : f = "", p && (t = t.slice(0, -p.length), p[p.length - 1] === `
|
|
2395
2479
|
` && (p = p.slice(0, -1)), p = p.replace(vt, `$&${c}`));
|
|
2396
|
-
let
|
|
2480
|
+
let d = !1, m, k = -1;
|
|
2397
2481
|
for (m = 0; m < t.length; ++m) {
|
|
2398
2482
|
const v = t[m];
|
|
2399
2483
|
if (v === " ")
|
|
2400
|
-
|
|
2484
|
+
d = !0;
|
|
2401
2485
|
else if (v === `
|
|
2402
2486
|
`)
|
|
2403
2487
|
k = m;
|
|
@@ -2406,16 +2490,16 @@ function Ve({ comment: s, type: e, value: t }, n, i, r) {
|
|
|
2406
2490
|
}
|
|
2407
2491
|
let w = t.substring(0, k < m ? k + 1 : m);
|
|
2408
2492
|
w && (t = t.substring(w.length), w = w.replace(/\n+/g, `$&${c}`));
|
|
2409
|
-
let S = (
|
|
2493
|
+
let S = (d ? c ? "2" : "1" : "") + f;
|
|
2410
2494
|
if (s && (S += " " + a(s.replace(/ ?[\r\n]+/g, " ")), i && i()), !u) {
|
|
2411
2495
|
const v = t.replace(/\n+/g, `
|
|
2412
2496
|
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${c}`);
|
|
2413
2497
|
let I = !1;
|
|
2414
|
-
const O =
|
|
2415
|
-
o !== "folded" && e !==
|
|
2498
|
+
const O = Xe(n, !0);
|
|
2499
|
+
o !== "folded" && e !== T.BLOCK_FOLDED && (O.onOverflow = () => {
|
|
2416
2500
|
I = !0;
|
|
2417
2501
|
});
|
|
2418
|
-
const y =
|
|
2502
|
+
const y = Qe(`${w}${v}${p}`, c, bt, O);
|
|
2419
2503
|
if (!I)
|
|
2420
2504
|
return `>${S}
|
|
2421
2505
|
${c}${y}`;
|
|
@@ -2431,10 +2515,10 @@ function Ri(s, e, t, n) {
|
|
|
2431
2515
|
if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))
|
|
2432
2516
|
return a || u || !r.includes(`
|
|
2433
2517
|
`) ? fe(r, e) : Ve(s, e, t, n);
|
|
2434
|
-
if (!a && !u && i !==
|
|
2518
|
+
if (!a && !u && i !== T.PLAIN && r.includes(`
|
|
2435
2519
|
`))
|
|
2436
2520
|
return Ve(s, e, t, n);
|
|
2437
|
-
if (
|
|
2521
|
+
if (Ze(r)) {
|
|
2438
2522
|
if (l === "")
|
|
2439
2523
|
return e.forceBlockIndent = !0, Ve(s, e, t, n);
|
|
2440
2524
|
if (a && l === c)
|
|
@@ -2443,26 +2527,26 @@ function Ri(s, e, t, n) {
|
|
|
2443
2527
|
const f = r.replace(/\n+/g, `$&
|
|
2444
2528
|
${l}`);
|
|
2445
2529
|
if (o) {
|
|
2446
|
-
const
|
|
2447
|
-
if (g.some(
|
|
2530
|
+
const h = (d) => d.default && d.tag !== "tag:yaml.org,2002:str" && d.test?.test(f), { compat: p, tags: g } = e.doc.schema;
|
|
2531
|
+
if (g.some(h) || p?.some(h))
|
|
2448
2532
|
return fe(r, e);
|
|
2449
2533
|
}
|
|
2450
|
-
return a ? f :
|
|
2534
|
+
return a ? f : Qe(f, l, As, Xe(e, !1));
|
|
2451
2535
|
}
|
|
2452
|
-
function
|
|
2536
|
+
function $t(s, e, t, n) {
|
|
2453
2537
|
const { implicitKey: i, inFlow: r } = e, o = typeof s.value == "string" ? s : Object.assign({}, s, { value: String(s.value) });
|
|
2454
2538
|
let { type: a } = s;
|
|
2455
|
-
a !==
|
|
2539
|
+
a !== T.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value) && (a = T.QUOTE_DOUBLE);
|
|
2456
2540
|
const l = (u) => {
|
|
2457
2541
|
switch (u) {
|
|
2458
|
-
case
|
|
2459
|
-
case
|
|
2542
|
+
case T.BLOCK_FOLDED:
|
|
2543
|
+
case T.BLOCK_LITERAL:
|
|
2460
2544
|
return i || r ? fe(o.value, e) : Ve(o, e, t, n);
|
|
2461
|
-
case
|
|
2545
|
+
case T.QUOTE_DOUBLE:
|
|
2462
2546
|
return Oe(o.value, e);
|
|
2463
|
-
case
|
|
2547
|
+
case T.QUOTE_SINGLE:
|
|
2464
2548
|
return St(o.value, e);
|
|
2465
|
-
case
|
|
2549
|
+
case T.PLAIN:
|
|
2466
2550
|
return Ri(o, e, t, n);
|
|
2467
2551
|
default:
|
|
2468
2552
|
return null;
|
|
@@ -2470,13 +2554,13 @@ function Et(s, e, t, n) {
|
|
|
2470
2554
|
};
|
|
2471
2555
|
let c = l(a);
|
|
2472
2556
|
if (c === null) {
|
|
2473
|
-
const { defaultKeyType: u, defaultStringType: f } = e.options,
|
|
2474
|
-
if (c = l(
|
|
2475
|
-
throw new Error(`Unsupported default string type ${
|
|
2557
|
+
const { defaultKeyType: u, defaultStringType: f } = e.options, h = i && u || f;
|
|
2558
|
+
if (c = l(h), c === null)
|
|
2559
|
+
throw new Error(`Unsupported default string type ${h}`);
|
|
2476
2560
|
}
|
|
2477
2561
|
return c;
|
|
2478
2562
|
}
|
|
2479
|
-
function
|
|
2563
|
+
function Ls(s, e) {
|
|
2480
2564
|
const t = Object.assign({
|
|
2481
2565
|
blockQuote: !0,
|
|
2482
2566
|
commentString: $i,
|
|
@@ -2517,7 +2601,7 @@ function As(s, e) {
|
|
|
2517
2601
|
options: t
|
|
2518
2602
|
};
|
|
2519
2603
|
}
|
|
2520
|
-
function
|
|
2604
|
+
function xi(s, e) {
|
|
2521
2605
|
if (e.tag) {
|
|
2522
2606
|
const i = s.filter((r) => r.tag === e.tag);
|
|
2523
2607
|
if (i.length > 0)
|
|
@@ -2540,10 +2624,10 @@ function Pi(s, e) {
|
|
|
2540
2624
|
}
|
|
2541
2625
|
return t;
|
|
2542
2626
|
}
|
|
2543
|
-
function
|
|
2627
|
+
function Pi(s, e, { anchors: t, doc: n }) {
|
|
2544
2628
|
if (!n.directives)
|
|
2545
2629
|
return "";
|
|
2546
|
-
const i = [], r = (_(s) ||
|
|
2630
|
+
const i = [], r = (_(s) || A(s)) && s.anchor;
|
|
2547
2631
|
r && Is(r) && (t.add(r), i.push(`&${r}`));
|
|
2548
2632
|
const o = s.tag ?? (e.default ? null : e.tag);
|
|
2549
2633
|
return o && i.push(n.directives.tagString(o)), i.join(" ");
|
|
@@ -2559,32 +2643,32 @@ function me(s, e, t, n) {
|
|
|
2559
2643
|
e.resolvedAliases ? e.resolvedAliases.add(s) : e.resolvedAliases = /* @__PURE__ */ new Set([s]), s = s.resolve(e.doc);
|
|
2560
2644
|
}
|
|
2561
2645
|
let i;
|
|
2562
|
-
const r =
|
|
2563
|
-
i ?? (i =
|
|
2564
|
-
const o =
|
|
2646
|
+
const r = L(s) ? s : e.doc.createNode(s, { onTagObj: (l) => i = l });
|
|
2647
|
+
i ?? (i = xi(e.doc.schema.tags, r));
|
|
2648
|
+
const o = Pi(r, i, e);
|
|
2565
2649
|
o.length > 0 && (e.indentAtStart = (e.indentAtStart ?? 0) + o.length + 1);
|
|
2566
|
-
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : _(r) ?
|
|
2650
|
+
const a = typeof i.stringify == "function" ? i.stringify(r, e, t, n) : _(r) ? $t(r, e, t, n) : r.toString(e, t, n);
|
|
2567
2651
|
return o ? _(r) || a[0] === "{" || a[0] === "[" ? `${o} ${a}` : `${o}
|
|
2568
2652
|
${e.indent}${a}` : a;
|
|
2569
2653
|
}
|
|
2570
|
-
function
|
|
2654
|
+
function Ui({ key: s, value: e }, t, n, i) {
|
|
2571
2655
|
const { allNullValues: r, doc: o, indent: a, indentStep: l, options: { commentString: c, indentSeq: u, simpleKeys: f } } = t;
|
|
2572
|
-
let
|
|
2656
|
+
let h = L(s) && s.comment || null;
|
|
2573
2657
|
if (f) {
|
|
2574
|
-
if (
|
|
2658
|
+
if (h)
|
|
2575
2659
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
2576
|
-
if (
|
|
2660
|
+
if (A(s) || !L(s) && typeof s == "object") {
|
|
2577
2661
|
const O = "With simple keys, collection cannot be used as a key value";
|
|
2578
2662
|
throw new Error(O);
|
|
2579
2663
|
}
|
|
2580
2664
|
}
|
|
2581
|
-
let p = !f && (!s ||
|
|
2665
|
+
let p = !f && (!s || h && e == null && !t.inFlow || A(s) || (_(s) ? s.type === T.BLOCK_FOLDED || s.type === T.BLOCK_LITERAL : typeof s == "object"));
|
|
2582
2666
|
t = Object.assign({}, t, {
|
|
2583
2667
|
allNullValues: !1,
|
|
2584
2668
|
implicitKey: !p && (f || !r),
|
|
2585
2669
|
indent: a + l
|
|
2586
2670
|
});
|
|
2587
|
-
let g = !1,
|
|
2671
|
+
let g = !1, d = !1, m = me(s, t, () => g = !0, () => d = !0);
|
|
2588
2672
|
if (!p && !t.inFlow && m.length > 1024) {
|
|
2589
2673
|
if (f)
|
|
2590
2674
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
@@ -2594,15 +2678,15 @@ function xi({ key: s, value: e }, t, n, i) {
|
|
|
2594
2678
|
if (r || e == null)
|
|
2595
2679
|
return g && n && n(), m === "" ? "?" : p ? `? ${m}` : m;
|
|
2596
2680
|
} else if (r && !f || e == null && p)
|
|
2597
|
-
return m = `? ${m}`,
|
|
2598
|
-
g && (
|
|
2599
|
-
${a}:`) : (m = `${m}:`,
|
|
2681
|
+
return m = `? ${m}`, h && !g ? m += te(m, t.indent, c(h)) : d && i && i(), m;
|
|
2682
|
+
g && (h = null), p ? (h && (m += te(m, t.indent, c(h))), m = `? ${m}
|
|
2683
|
+
${a}:`) : (m = `${m}:`, h && (m += te(m, t.indent, c(h))));
|
|
2600
2684
|
let k, w, b;
|
|
2601
|
-
|
|
2685
|
+
L(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 && !h && _(e) && (t.indentAtStart = m.length + 1), d = !1, !u && l.length >= 2 && !t.inFlow && !p && Re(e) && !e.flow && !e.tag && !e.anchor && (t.indent = t.indent.substring(2));
|
|
2602
2686
|
let S = !1;
|
|
2603
|
-
const v = me(e, t, () => S = !0, () =>
|
|
2687
|
+
const v = me(e, t, () => S = !0, () => d = !0);
|
|
2604
2688
|
let I = " ";
|
|
2605
|
-
if (
|
|
2689
|
+
if (h || k || w) {
|
|
2606
2690
|
if (I = k ? `
|
|
2607
2691
|
` : "", w) {
|
|
2608
2692
|
const O = c(w);
|
|
@@ -2614,7 +2698,7 @@ ${W(O, t.indent)}`;
|
|
|
2614
2698
|
|
|
2615
2699
|
`) : I += `
|
|
2616
2700
|
${t.indent}`;
|
|
2617
|
-
} else if (!p &&
|
|
2701
|
+
} else if (!p && A(e)) {
|
|
2618
2702
|
const O = v[0], y = v.indexOf(`
|
|
2619
2703
|
`), $ = y !== -1, G = t.inFlow ?? e.flow ?? e.items.length === 0;
|
|
2620
2704
|
if ($ || !G) {
|
|
@@ -2628,7 +2712,7 @@ ${t.indent}`);
|
|
|
2628
2712
|
}
|
|
2629
2713
|
} else (v === "" || v[0] === `
|
|
2630
2714
|
`) && (I = "");
|
|
2631
|
-
return m += I + v, t.inFlow ? S && n && n() : b && !S ? m += te(m, t.indent, c(b)) :
|
|
2715
|
+
return m += I + v, t.inFlow ? S && n && n() : b && !S ? m += te(m, t.indent, c(b)) : d && i && i(), m;
|
|
2632
2716
|
}
|
|
2633
2717
|
function Es(s, e) {
|
|
2634
2718
|
(s === "debug" || s === "warn") && console.warn(e);
|
|
@@ -2638,22 +2722,22 @@ const Me = "<<", Y = {
|
|
|
2638
2722
|
default: "key",
|
|
2639
2723
|
tag: "tag:yaml.org,2002:merge",
|
|
2640
2724
|
test: /^<<$/,
|
|
2641
|
-
resolve: () => Object.assign(new
|
|
2725
|
+
resolve: () => Object.assign(new T(Symbol(Me)), {
|
|
2642
2726
|
addToJSMap: $s
|
|
2643
2727
|
}),
|
|
2644
2728
|
stringify: () => Me
|
|
2645
|
-
}, Mi = (s, e) => (Y.identify(e) || _(e) && (!e.type || e.type ===
|
|
2729
|
+
}, Mi = (s, e) => (Y.identify(e) || _(e) && (!e.type || e.type === T.PLAIN) && Y.identify(e.value)) && s?.doc.schema.tags.some((t) => t.tag === Y.tag && t.default);
|
|
2646
2730
|
function $s(s, e, t) {
|
|
2647
2731
|
if (t = s && re(t) ? t.resolve(s.doc) : t, Re(t))
|
|
2648
2732
|
for (const n of t.items)
|
|
2649
|
-
|
|
2733
|
+
ft(s, e, n);
|
|
2650
2734
|
else if (Array.isArray(t))
|
|
2651
2735
|
for (const n of t)
|
|
2652
|
-
|
|
2736
|
+
ft(s, e, n);
|
|
2653
2737
|
else
|
|
2654
|
-
|
|
2738
|
+
ft(s, e, t);
|
|
2655
2739
|
}
|
|
2656
|
-
function
|
|
2740
|
+
function ft(s, e, t) {
|
|
2657
2741
|
const n = s && re(t) ? t.resolve(s.doc) : t;
|
|
2658
2742
|
if (!je(n))
|
|
2659
2743
|
throw new Error("Merge sources must be maps or map aliases");
|
|
@@ -2668,7 +2752,7 @@ function ut(s, e, t) {
|
|
|
2668
2752
|
return e;
|
|
2669
2753
|
}
|
|
2670
2754
|
function js(s, e, { key: t, value: n }) {
|
|
2671
|
-
if (
|
|
2755
|
+
if (L(t) && t.addToJSMap)
|
|
2672
2756
|
t.addToJSMap(s, e, n);
|
|
2673
2757
|
else if (Mi(s, t))
|
|
2674
2758
|
$s(s, e, n);
|
|
@@ -2695,8 +2779,8 @@ function Di(s, e, t) {
|
|
|
2695
2779
|
return "";
|
|
2696
2780
|
if (typeof e != "object")
|
|
2697
2781
|
return String(e);
|
|
2698
|
-
if (
|
|
2699
|
-
const n =
|
|
2782
|
+
if (L(s) && t?.doc) {
|
|
2783
|
+
const n = Ls(t.doc, {});
|
|
2700
2784
|
n.anchors = /* @__PURE__ */ new Set();
|
|
2701
2785
|
for (const r of t.anchors.keys())
|
|
2702
2786
|
n.anchors.add(r.anchor);
|
|
@@ -2710,24 +2794,24 @@ function Di(s, e, t) {
|
|
|
2710
2794
|
}
|
|
2711
2795
|
return JSON.stringify(e);
|
|
2712
2796
|
}
|
|
2713
|
-
function
|
|
2714
|
-
const n =
|
|
2715
|
-
return new
|
|
2797
|
+
function jt(s, e, t) {
|
|
2798
|
+
const n = Ae(s, void 0, t), i = Ae(e, void 0, t);
|
|
2799
|
+
return new P(n, i);
|
|
2716
2800
|
}
|
|
2717
|
-
class
|
|
2801
|
+
class P {
|
|
2718
2802
|
constructor(e, t = null) {
|
|
2719
2803
|
Object.defineProperty(this, B, { value: vs }), this.key = e, this.value = t;
|
|
2720
2804
|
}
|
|
2721
2805
|
clone(e) {
|
|
2722
2806
|
let { key: t, value: n } = this;
|
|
2723
|
-
return
|
|
2807
|
+
return L(t) && (t = t.clone(e)), L(n) && (n = n.clone(e)), new P(t, n);
|
|
2724
2808
|
}
|
|
2725
2809
|
toJSON(e, t) {
|
|
2726
2810
|
const n = t?.mapAsMap ? /* @__PURE__ */ new Map() : {};
|
|
2727
2811
|
return js(t, n, this);
|
|
2728
2812
|
}
|
|
2729
2813
|
toString(e, t, n) {
|
|
2730
|
-
return e?.doc ?
|
|
2814
|
+
return e?.doc ? Ui(this, e, t, n) : JSON.stringify(this);
|
|
2731
2815
|
}
|
|
2732
2816
|
}
|
|
2733
2817
|
function Rs(s, e, t) {
|
|
@@ -2736,29 +2820,29 @@ function Rs(s, e, t) {
|
|
|
2736
2820
|
function Bi({ comment: s, items: e }, t, { blockItemPrefix: n, flowChars: i, itemIndent: r, onChompKeep: o, onComment: a }) {
|
|
2737
2821
|
const { indent: l, options: { commentString: c } } = t, u = Object.assign({}, t, { indent: r, type: null });
|
|
2738
2822
|
let f = !1;
|
|
2739
|
-
const
|
|
2823
|
+
const h = [];
|
|
2740
2824
|
for (let g = 0; g < e.length; ++g) {
|
|
2741
|
-
const
|
|
2825
|
+
const d = e[g];
|
|
2742
2826
|
let m = null;
|
|
2743
|
-
if (
|
|
2744
|
-
!f &&
|
|
2745
|
-
else if (E(
|
|
2746
|
-
const w =
|
|
2747
|
-
w && (!f && w.spaceBefore &&
|
|
2827
|
+
if (L(d))
|
|
2828
|
+
!f && d.spaceBefore && h.push(""), He(t, h, d.commentBefore, f), d.comment && (m = d.comment);
|
|
2829
|
+
else if (E(d)) {
|
|
2830
|
+
const w = L(d.key) ? d.key : null;
|
|
2831
|
+
w && (!f && w.spaceBefore && h.push(""), He(t, h, w.commentBefore, f));
|
|
2748
2832
|
}
|
|
2749
2833
|
f = !1;
|
|
2750
|
-
let k = me(
|
|
2751
|
-
m && (k += te(k, r, c(m))), f && m && (f = !1),
|
|
2834
|
+
let k = me(d, u, () => m = null, () => f = !0);
|
|
2835
|
+
m && (k += te(k, r, c(m))), f && m && (f = !1), h.push(n + k);
|
|
2752
2836
|
}
|
|
2753
2837
|
let p;
|
|
2754
|
-
if (
|
|
2838
|
+
if (h.length === 0)
|
|
2755
2839
|
p = i.start + i.end;
|
|
2756
2840
|
else {
|
|
2757
|
-
p =
|
|
2758
|
-
for (let g = 1; g <
|
|
2759
|
-
const
|
|
2760
|
-
p +=
|
|
2761
|
-
${l}${
|
|
2841
|
+
p = h[0];
|
|
2842
|
+
for (let g = 1; g < h.length; ++g) {
|
|
2843
|
+
const d = h[g];
|
|
2844
|
+
p += d ? `
|
|
2845
|
+
${l}${d}` : `
|
|
2762
2846
|
`;
|
|
2763
2847
|
}
|
|
2764
2848
|
}
|
|
@@ -2776,40 +2860,40 @@ function qi({ items: s }, e, { flowChars: t, itemIndent: n }) {
|
|
|
2776
2860
|
let c = !1, u = 0;
|
|
2777
2861
|
const f = [];
|
|
2778
2862
|
for (let g = 0; g < s.length; ++g) {
|
|
2779
|
-
const
|
|
2863
|
+
const d = s[g];
|
|
2780
2864
|
let m = null;
|
|
2781
|
-
if (
|
|
2782
|
-
|
|
2783
|
-
else if (E(
|
|
2784
|
-
const w =
|
|
2785
|
-
w && (w.spaceBefore && f.push(""),
|
|
2786
|
-
const b =
|
|
2787
|
-
b ? (b.comment && (m = b.comment), b.commentBefore && (c = !0)) :
|
|
2865
|
+
if (L(d))
|
|
2866
|
+
d.spaceBefore && f.push(""), He(e, f, d.commentBefore, !1), d.comment && (m = d.comment);
|
|
2867
|
+
else if (E(d)) {
|
|
2868
|
+
const w = L(d.key) ? d.key : null;
|
|
2869
|
+
w && (w.spaceBefore && f.push(""), He(e, f, w.commentBefore, !1), w.comment && (c = !0));
|
|
2870
|
+
const b = L(d.value) ? d.value : null;
|
|
2871
|
+
b ? (b.comment && (m = b.comment), b.commentBefore && (c = !0)) : d.value == null && w?.comment && (m = w.comment);
|
|
2788
2872
|
}
|
|
2789
2873
|
m && (c = !0);
|
|
2790
|
-
let k = me(
|
|
2874
|
+
let k = me(d, l, () => m = null);
|
|
2791
2875
|
g < s.length - 1 && (k += ","), m && (k += te(k, n, a(m))), !c && (f.length > u || k.includes(`
|
|
2792
2876
|
`)) && (c = !0), f.push(k), u = f.length;
|
|
2793
2877
|
}
|
|
2794
|
-
const { start:
|
|
2878
|
+
const { start: h, end: p } = t;
|
|
2795
2879
|
if (f.length === 0)
|
|
2796
|
-
return
|
|
2880
|
+
return h + p;
|
|
2797
2881
|
if (!c) {
|
|
2798
|
-
const g = f.reduce((
|
|
2882
|
+
const g = f.reduce((d, m) => d + m.length + 2, 2);
|
|
2799
2883
|
c = e.options.lineWidth > 0 && g > e.options.lineWidth;
|
|
2800
2884
|
}
|
|
2801
2885
|
if (c) {
|
|
2802
|
-
let g =
|
|
2803
|
-
for (const
|
|
2804
|
-
g +=
|
|
2805
|
-
${r}${i}${
|
|
2886
|
+
let g = h;
|
|
2887
|
+
for (const d of f)
|
|
2888
|
+
g += d ? `
|
|
2889
|
+
${r}${i}${d}` : `
|
|
2806
2890
|
`;
|
|
2807
2891
|
return `${g}
|
|
2808
2892
|
${i}${p}`;
|
|
2809
2893
|
} else
|
|
2810
|
-
return `${
|
|
2894
|
+
return `${h}${o}${f.join(" ")}${o}${p}`;
|
|
2811
2895
|
}
|
|
2812
|
-
function
|
|
2896
|
+
function He({ indent: s, options: { commentString: e } }, t, n, i) {
|
|
2813
2897
|
if (n && i && (n = n.replace(/^\n+/, "")), n) {
|
|
2814
2898
|
const r = W(e(n), s);
|
|
2815
2899
|
t.push(r.trimStart());
|
|
@@ -2838,7 +2922,7 @@ class M extends Cs {
|
|
|
2838
2922
|
c = r.call(t, l, c);
|
|
2839
2923
|
else if (Array.isArray(r) && !r.includes(l))
|
|
2840
2924
|
return;
|
|
2841
|
-
(c !== void 0 || i) && o.items.push(
|
|
2925
|
+
(c !== void 0 || i) && o.items.push(jt(l, c, n));
|
|
2842
2926
|
};
|
|
2843
2927
|
if (t instanceof Map)
|
|
2844
2928
|
for (const [l, c] of t)
|
|
@@ -2856,7 +2940,7 @@ class M extends Cs {
|
|
|
2856
2940
|
*/
|
|
2857
2941
|
add(e, t) {
|
|
2858
2942
|
let n;
|
|
2859
|
-
E(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new
|
|
2943
|
+
E(e) ? n = e : !e || typeof e != "object" || !("key" in e) ? n = new P(e, e?.value) : n = new P(e.key, e.value);
|
|
2860
2944
|
const i = se(this.items, n.key), r = this.schema?.sortMapEntries;
|
|
2861
2945
|
if (i) {
|
|
2862
2946
|
if (!t)
|
|
@@ -2880,7 +2964,7 @@ class M extends Cs {
|
|
|
2880
2964
|
return !!se(this.items, e);
|
|
2881
2965
|
}
|
|
2882
2966
|
set(e, t) {
|
|
2883
|
-
this.add(new
|
|
2967
|
+
this.add(new P(e, t), !0);
|
|
2884
2968
|
}
|
|
2885
2969
|
/**
|
|
2886
2970
|
* @param ctx - Conversion context, originally set in Document#toJS()
|
|
@@ -2998,7 +3082,7 @@ class ie extends Cs {
|
|
|
2998
3082
|
const l = t instanceof Set ? a : String(o++);
|
|
2999
3083
|
a = i.call(t, l, a);
|
|
3000
3084
|
}
|
|
3001
|
-
r.items.push(
|
|
3085
|
+
r.items.push(Ae(a, void 0, n));
|
|
3002
3086
|
}
|
|
3003
3087
|
}
|
|
3004
3088
|
return r;
|
|
@@ -3017,30 +3101,30 @@ const be = {
|
|
|
3017
3101
|
return Re(s) || e("Expected a sequence for this tag"), s;
|
|
3018
3102
|
},
|
|
3019
3103
|
createNode: (s, e, t) => ie.from(s, e, t)
|
|
3020
|
-
},
|
|
3104
|
+
}, et = {
|
|
3021
3105
|
identify: (s) => typeof s == "string",
|
|
3022
3106
|
default: !0,
|
|
3023
3107
|
tag: "tag:yaml.org,2002:str",
|
|
3024
3108
|
resolve: (s) => s,
|
|
3025
3109
|
stringify(s, e, t, n) {
|
|
3026
|
-
return e = Object.assign({ actualString: !0 }, e),
|
|
3110
|
+
return e = Object.assign({ actualString: !0 }, e), $t(s, e, t, n);
|
|
3027
3111
|
}
|
|
3028
|
-
},
|
|
3112
|
+
}, tt = {
|
|
3029
3113
|
identify: (s) => s == null,
|
|
3030
|
-
createNode: () => new
|
|
3114
|
+
createNode: () => new T(null),
|
|
3031
3115
|
default: !0,
|
|
3032
3116
|
tag: "tag:yaml.org,2002:null",
|
|
3033
3117
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
3034
|
-
resolve: () => new
|
|
3035
|
-
stringify: ({ source: s }, e) => typeof s == "string" &&
|
|
3036
|
-
},
|
|
3118
|
+
resolve: () => new T(null),
|
|
3119
|
+
stringify: ({ source: s }, e) => typeof s == "string" && tt.test.test(s) ? s : e.options.nullStr
|
|
3120
|
+
}, Rt = {
|
|
3037
3121
|
identify: (s) => typeof s == "boolean",
|
|
3038
3122
|
default: !0,
|
|
3039
3123
|
tag: "tag:yaml.org,2002:bool",
|
|
3040
3124
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
3041
|
-
resolve: (s) => new
|
|
3125
|
+
resolve: (s) => new T(s[0] === "t" || s[0] === "T"),
|
|
3042
3126
|
stringify({ source: s, value: e }, t) {
|
|
3043
|
-
if (s &&
|
|
3127
|
+
if (s && Rt.test.test(s)) {
|
|
3044
3128
|
const n = s[0] === "t" || s[0] === "T";
|
|
3045
3129
|
if (e === n)
|
|
3046
3130
|
return s;
|
|
@@ -3064,14 +3148,14 @@ function F({ format: s, minFractionDigits: e, tag: t, value: n }) {
|
|
|
3064
3148
|
}
|
|
3065
3149
|
return r;
|
|
3066
3150
|
}
|
|
3067
|
-
const
|
|
3151
|
+
const xs = {
|
|
3068
3152
|
identify: (s) => typeof s == "number",
|
|
3069
3153
|
default: !0,
|
|
3070
3154
|
tag: "tag:yaml.org,2002:float",
|
|
3071
3155
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
3072
3156
|
resolve: (s) => s.slice(-3).toLowerCase() === "nan" ? NaN : s[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
3073
3157
|
stringify: F
|
|
3074
|
-
},
|
|
3158
|
+
}, Ps = {
|
|
3075
3159
|
identify: (s) => typeof s == "number",
|
|
3076
3160
|
default: !0,
|
|
3077
3161
|
tag: "tag:yaml.org,2002:float",
|
|
@@ -3082,58 +3166,58 @@ const Ps = {
|
|
|
3082
3166
|
const e = Number(s.value);
|
|
3083
3167
|
return isFinite(e) ? e.toExponential() : F(s);
|
|
3084
3168
|
}
|
|
3085
|
-
},
|
|
3169
|
+
}, Us = {
|
|
3086
3170
|
identify: (s) => typeof s == "number",
|
|
3087
3171
|
default: !0,
|
|
3088
3172
|
tag: "tag:yaml.org,2002:float",
|
|
3089
3173
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
3090
3174
|
resolve(s) {
|
|
3091
|
-
const e = new
|
|
3175
|
+
const e = new T(parseFloat(s)), t = s.indexOf(".");
|
|
3092
3176
|
return t !== -1 && s[s.length - 1] === "0" && (e.minFractionDigits = s.length - t - 1), e;
|
|
3093
3177
|
},
|
|
3094
3178
|
stringify: F
|
|
3095
|
-
},
|
|
3179
|
+
}, st = (s) => typeof s == "bigint" || Number.isInteger(s), xt = (s, e, t, { intAsBigInt: n }) => n ? BigInt(s) : parseInt(s.substring(e), t);
|
|
3096
3180
|
function Ms(s, e, t) {
|
|
3097
3181
|
const { value: n } = s;
|
|
3098
|
-
return
|
|
3182
|
+
return st(n) && n >= 0 ? t + n.toString(e) : F(s);
|
|
3099
3183
|
}
|
|
3100
3184
|
const Ds = {
|
|
3101
|
-
identify: (s) =>
|
|
3185
|
+
identify: (s) => st(s) && s >= 0,
|
|
3102
3186
|
default: !0,
|
|
3103
3187
|
tag: "tag:yaml.org,2002:int",
|
|
3104
3188
|
format: "OCT",
|
|
3105
3189
|
test: /^0o[0-7]+$/,
|
|
3106
|
-
resolve: (s, e, t) =>
|
|
3190
|
+
resolve: (s, e, t) => xt(s, 2, 8, t),
|
|
3107
3191
|
stringify: (s) => Ms(s, 8, "0o")
|
|
3108
3192
|
}, Bs = {
|
|
3109
|
-
identify:
|
|
3193
|
+
identify: st,
|
|
3110
3194
|
default: !0,
|
|
3111
3195
|
tag: "tag:yaml.org,2002:int",
|
|
3112
3196
|
test: /^[-+]?[0-9]+$/,
|
|
3113
|
-
resolve: (s, e, t) =>
|
|
3197
|
+
resolve: (s, e, t) => xt(s, 0, 10, t),
|
|
3114
3198
|
stringify: F
|
|
3115
3199
|
}, qs = {
|
|
3116
|
-
identify: (s) =>
|
|
3200
|
+
identify: (s) => st(s) && s >= 0,
|
|
3117
3201
|
default: !0,
|
|
3118
3202
|
tag: "tag:yaml.org,2002:int",
|
|
3119
3203
|
format: "HEX",
|
|
3120
3204
|
test: /^0x[0-9a-fA-F]+$/,
|
|
3121
|
-
resolve: (s, e, t) =>
|
|
3205
|
+
resolve: (s, e, t) => xt(s, 2, 16, t),
|
|
3122
3206
|
stringify: (s) => Ms(s, 16, "0x")
|
|
3123
3207
|
}, Ki = [
|
|
3124
3208
|
we,
|
|
3125
3209
|
be,
|
|
3126
|
-
Ze,
|
|
3127
3210
|
et,
|
|
3128
|
-
|
|
3211
|
+
tt,
|
|
3212
|
+
Rt,
|
|
3129
3213
|
Ds,
|
|
3130
3214
|
Bs,
|
|
3131
3215
|
qs,
|
|
3216
|
+
xs,
|
|
3132
3217
|
Ps,
|
|
3133
|
-
Us
|
|
3134
|
-
xs
|
|
3218
|
+
Us
|
|
3135
3219
|
];
|
|
3136
|
-
function
|
|
3220
|
+
function Qt(s) {
|
|
3137
3221
|
return typeof s == "bigint" || Number.isInteger(s);
|
|
3138
3222
|
}
|
|
3139
3223
|
const Be = ({ value: s }) => JSON.stringify(s), Fi = [
|
|
@@ -3146,7 +3230,7 @@ const Be = ({ value: s }) => JSON.stringify(s), Fi = [
|
|
|
3146
3230
|
},
|
|
3147
3231
|
{
|
|
3148
3232
|
identify: (s) => s == null,
|
|
3149
|
-
createNode: () => new
|
|
3233
|
+
createNode: () => new T(null),
|
|
3150
3234
|
default: !0,
|
|
3151
3235
|
tag: "tag:yaml.org,2002:null",
|
|
3152
3236
|
test: /^null$/,
|
|
@@ -3162,12 +3246,12 @@ const Be = ({ value: s }) => JSON.stringify(s), Fi = [
|
|
|
3162
3246
|
stringify: Be
|
|
3163
3247
|
},
|
|
3164
3248
|
{
|
|
3165
|
-
identify:
|
|
3249
|
+
identify: Qt,
|
|
3166
3250
|
default: !0,
|
|
3167
3251
|
tag: "tag:yaml.org,2002:int",
|
|
3168
3252
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
3169
3253
|
resolve: (s, e, { intAsBigInt: t }) => t ? BigInt(s) : parseInt(s, 10),
|
|
3170
|
-
stringify: ({ value: s }) =>
|
|
3254
|
+
stringify: ({ value: s }) => Qt(s) ? s.toString() : JSON.stringify(s)
|
|
3171
3255
|
},
|
|
3172
3256
|
{
|
|
3173
3257
|
identify: (s) => typeof s == "number",
|
|
@@ -3218,14 +3302,14 @@ const Be = ({ value: s }) => JSON.stringify(s), Fi = [
|
|
|
3218
3302
|
a = btoa(l);
|
|
3219
3303
|
} else
|
|
3220
3304
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
3221
|
-
if (e ?? (e =
|
|
3305
|
+
if (e ?? (e = T.BLOCK_LITERAL), e !== T.QUOTE_DOUBLE) {
|
|
3222
3306
|
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,
|
|
3224
|
-
u[f] = a.substr(
|
|
3225
|
-
a = u.join(e ===
|
|
3307
|
+
for (let f = 0, h = 0; f < c; ++f, h += l)
|
|
3308
|
+
u[f] = a.substr(h, l);
|
|
3309
|
+
a = u.join(e === T.BLOCK_LITERAL ? `
|
|
3226
3310
|
` : " ");
|
|
3227
3311
|
}
|
|
3228
|
-
return
|
|
3312
|
+
return $t({ comment: s, type: e, value: a }, n, i, r);
|
|
3229
3313
|
}
|
|
3230
3314
|
};
|
|
3231
3315
|
function Ks(s, e) {
|
|
@@ -3235,7 +3319,7 @@ function Ks(s, e) {
|
|
|
3235
3319
|
if (!E(n)) {
|
|
3236
3320
|
if (je(n)) {
|
|
3237
3321
|
n.items.length > 1 && e("Each pair must have its own sequence indicator");
|
|
3238
|
-
const i = n.items[0] || new
|
|
3322
|
+
const i = n.items[0] || new P(new T(null));
|
|
3239
3323
|
if (n.commentBefore && (i.key.commentBefore = i.key.commentBefore ? `${n.commentBefore}
|
|
3240
3324
|
${i.key.commentBefore}` : n.commentBefore), n.comment) {
|
|
3241
3325
|
const r = i.value ?? i.key;
|
|
@@ -3244,7 +3328,7 @@ ${r.comment}` : n.comment;
|
|
|
3244
3328
|
}
|
|
3245
3329
|
n = i;
|
|
3246
3330
|
}
|
|
3247
|
-
s.items[t] = E(n) ? n : new
|
|
3331
|
+
s.items[t] = E(n) ? n : new P(n);
|
|
3248
3332
|
}
|
|
3249
3333
|
}
|
|
3250
3334
|
else
|
|
@@ -3272,7 +3356,7 @@ function Fs(s, e, t) {
|
|
|
3272
3356
|
throw new TypeError(`Expected tuple with one key, not ${c.length} keys`);
|
|
3273
3357
|
} else
|
|
3274
3358
|
a = o;
|
|
3275
|
-
i.items.push(
|
|
3359
|
+
i.items.push(jt(a, l, t));
|
|
3276
3360
|
}
|
|
3277
3361
|
return i;
|
|
3278
3362
|
}
|
|
@@ -3283,9 +3367,9 @@ const Ut = {
|
|
|
3283
3367
|
resolve: Ks,
|
|
3284
3368
|
createNode: Fs
|
|
3285
3369
|
};
|
|
3286
|
-
class
|
|
3370
|
+
class he extends ie {
|
|
3287
3371
|
constructor() {
|
|
3288
|
-
super(), this.add = M.prototype.add.bind(this), this.delete = M.prototype.delete.bind(this), this.get = M.prototype.get.bind(this), this.has = M.prototype.has.bind(this), this.set = M.prototype.set.bind(this), this.tag =
|
|
3372
|
+
super(), this.add = M.prototype.add.bind(this), this.delete = M.prototype.delete.bind(this), this.get = M.prototype.get.bind(this), this.has = M.prototype.has.bind(this), this.set = M.prototype.set.bind(this), this.tag = he.tag;
|
|
3289
3373
|
}
|
|
3290
3374
|
/**
|
|
3291
3375
|
* If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
|
|
@@ -3309,20 +3393,20 @@ class de extends ie {
|
|
|
3309
3393
|
return r.items = i.items, r;
|
|
3310
3394
|
}
|
|
3311
3395
|
}
|
|
3312
|
-
|
|
3313
|
-
const
|
|
3396
|
+
he.tag = "tag:yaml.org,2002:omap";
|
|
3397
|
+
const Mt = {
|
|
3314
3398
|
collection: "seq",
|
|
3315
3399
|
identify: (s) => s instanceof Map,
|
|
3316
|
-
nodeClass:
|
|
3400
|
+
nodeClass: he,
|
|
3317
3401
|
default: !1,
|
|
3318
3402
|
tag: "tag:yaml.org,2002:omap",
|
|
3319
3403
|
resolve(s, e) {
|
|
3320
3404
|
const t = Ks(s, e), n = [];
|
|
3321
3405
|
for (const { key: i } of t.items)
|
|
3322
3406
|
_(i) && (n.includes(i.value) ? e(`Ordered maps must not include duplicate keys: ${i.value}`) : n.push(i.value));
|
|
3323
|
-
return Object.assign(new
|
|
3407
|
+
return Object.assign(new he(), t);
|
|
3324
3408
|
},
|
|
3325
|
-
createNode: (s, e, t) =>
|
|
3409
|
+
createNode: (s, e, t) => he.from(s, e, t)
|
|
3326
3410
|
};
|
|
3327
3411
|
function Js({ value: s, source: e }, t) {
|
|
3328
3412
|
return e && (s ? Vs : Ws).test.test(e) ? e : s ? t.options.trueStr : t.options.falseStr;
|
|
@@ -3332,14 +3416,14 @@ const Vs = {
|
|
|
3332
3416
|
default: !0,
|
|
3333
3417
|
tag: "tag:yaml.org,2002:bool",
|
|
3334
3418
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
3335
|
-
resolve: () => new
|
|
3419
|
+
resolve: () => new T(!0),
|
|
3336
3420
|
stringify: Js
|
|
3337
3421
|
}, Ws = {
|
|
3338
3422
|
identify: (s) => s === !1,
|
|
3339
3423
|
default: !0,
|
|
3340
3424
|
tag: "tag:yaml.org,2002:bool",
|
|
3341
3425
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
|
|
3342
|
-
resolve: () => new
|
|
3426
|
+
resolve: () => new T(!1),
|
|
3343
3427
|
stringify: Js
|
|
3344
3428
|
}, Wi = {
|
|
3345
3429
|
identify: (s) => typeof s == "number",
|
|
@@ -3365,7 +3449,7 @@ const Vs = {
|
|
|
3365
3449
|
tag: "tag:yaml.org,2002:float",
|
|
3366
3450
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
3367
3451
|
resolve(s) {
|
|
3368
|
-
const e = new
|
|
3452
|
+
const e = new T(parseFloat(s.replace(/_/g, ""))), t = s.indexOf(".");
|
|
3369
3453
|
if (t !== -1) {
|
|
3370
3454
|
const n = s.substring(t + 1).replace(/_/g, "");
|
|
3371
3455
|
n[n.length - 1] === "0" && (e.minFractionDigits = n.length);
|
|
@@ -3373,8 +3457,8 @@ const Vs = {
|
|
|
3373
3457
|
return e;
|
|
3374
3458
|
},
|
|
3375
3459
|
stringify: F
|
|
3376
|
-
},
|
|
3377
|
-
function
|
|
3460
|
+
}, xe = (s) => typeof s == "bigint" || Number.isInteger(s);
|
|
3461
|
+
function nt(s, e, t, { intAsBigInt: n }) {
|
|
3378
3462
|
const i = s[0];
|
|
3379
3463
|
if ((i === "-" || i === "+") && (e += 1), s = s.substring(e).replace(/_/g, ""), n) {
|
|
3380
3464
|
switch (t) {
|
|
@@ -3394,53 +3478,53 @@ function st(s, e, t, { intAsBigInt: n }) {
|
|
|
3394
3478
|
const r = parseInt(s, t);
|
|
3395
3479
|
return i === "-" ? -1 * r : r;
|
|
3396
3480
|
}
|
|
3397
|
-
function
|
|
3481
|
+
function Dt(s, e, t) {
|
|
3398
3482
|
const { value: n } = s;
|
|
3399
|
-
if (
|
|
3483
|
+
if (xe(n)) {
|
|
3400
3484
|
const i = n.toString(e);
|
|
3401
3485
|
return n < 0 ? "-" + t + i.substr(1) : t + i;
|
|
3402
3486
|
}
|
|
3403
3487
|
return F(s);
|
|
3404
3488
|
}
|
|
3405
3489
|
const Gi = {
|
|
3406
|
-
identify:
|
|
3490
|
+
identify: xe,
|
|
3407
3491
|
default: !0,
|
|
3408
3492
|
tag: "tag:yaml.org,2002:int",
|
|
3409
3493
|
format: "BIN",
|
|
3410
3494
|
test: /^[-+]?0b[0-1_]+$/,
|
|
3411
|
-
resolve: (s, e, t) =>
|
|
3412
|
-
stringify: (s) =>
|
|
3495
|
+
resolve: (s, e, t) => nt(s, 2, 2, t),
|
|
3496
|
+
stringify: (s) => Dt(s, 2, "0b")
|
|
3413
3497
|
}, zi = {
|
|
3414
|
-
identify:
|
|
3498
|
+
identify: xe,
|
|
3415
3499
|
default: !0,
|
|
3416
3500
|
tag: "tag:yaml.org,2002:int",
|
|
3417
3501
|
format: "OCT",
|
|
3418
3502
|
test: /^[-+]?0[0-7_]+$/,
|
|
3419
|
-
resolve: (s, e, t) =>
|
|
3420
|
-
stringify: (s) =>
|
|
3503
|
+
resolve: (s, e, t) => nt(s, 1, 8, t),
|
|
3504
|
+
stringify: (s) => Dt(s, 8, "0")
|
|
3421
3505
|
}, Qi = {
|
|
3422
|
-
identify:
|
|
3506
|
+
identify: xe,
|
|
3423
3507
|
default: !0,
|
|
3424
3508
|
tag: "tag:yaml.org,2002:int",
|
|
3425
3509
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
3426
|
-
resolve: (s, e, t) =>
|
|
3510
|
+
resolve: (s, e, t) => nt(s, 0, 10, t),
|
|
3427
3511
|
stringify: F
|
|
3428
3512
|
}, Xi = {
|
|
3429
|
-
identify:
|
|
3513
|
+
identify: xe,
|
|
3430
3514
|
default: !0,
|
|
3431
3515
|
tag: "tag:yaml.org,2002:int",
|
|
3432
3516
|
format: "HEX",
|
|
3433
3517
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
3434
|
-
resolve: (s, e, t) =>
|
|
3435
|
-
stringify: (s) =>
|
|
3518
|
+
resolve: (s, e, t) => nt(s, 2, 16, t),
|
|
3519
|
+
stringify: (s) => Dt(s, 16, "0x")
|
|
3436
3520
|
};
|
|
3437
|
-
class
|
|
3521
|
+
class de extends M {
|
|
3438
3522
|
constructor(e) {
|
|
3439
|
-
super(e), this.tag =
|
|
3523
|
+
super(e), this.tag = de.tag;
|
|
3440
3524
|
}
|
|
3441
3525
|
add(e) {
|
|
3442
3526
|
let t;
|
|
3443
|
-
E(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new
|
|
3527
|
+
E(e) ? t = e : e && typeof e == "object" && "key" in e && "value" in e && e.value === null ? t = new P(e.key, null) : t = new P(e, null), se(this.items, t.key) || this.items.push(t);
|
|
3444
3528
|
}
|
|
3445
3529
|
/**
|
|
3446
3530
|
* If `keepPair` is `true`, returns the Pair matching `key`.
|
|
@@ -3454,7 +3538,7 @@ class he extends M {
|
|
|
3454
3538
|
if (typeof t != "boolean")
|
|
3455
3539
|
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);
|
|
3456
3540
|
const n = se(this.items, e);
|
|
3457
|
-
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new
|
|
3541
|
+
n && !t ? this.items.splice(this.items.indexOf(n), 1) : !n && t && this.items.push(new P(e));
|
|
3458
3542
|
}
|
|
3459
3543
|
toJSON(e, t) {
|
|
3460
3544
|
return super.toJSON(e, t, Set);
|
|
@@ -3470,29 +3554,29 @@ class he extends M {
|
|
|
3470
3554
|
const { replacer: i } = n, r = new this(e);
|
|
3471
3555
|
if (t && Symbol.iterator in Object(t))
|
|
3472
3556
|
for (let o of t)
|
|
3473
|
-
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(
|
|
3557
|
+
typeof i == "function" && (o = i.call(t, o, o)), r.items.push(jt(o, null, n));
|
|
3474
3558
|
return r;
|
|
3475
3559
|
}
|
|
3476
3560
|
}
|
|
3477
|
-
|
|
3478
|
-
const
|
|
3561
|
+
de.tag = "tag:yaml.org,2002:set";
|
|
3562
|
+
const Bt = {
|
|
3479
3563
|
collection: "map",
|
|
3480
3564
|
identify: (s) => s instanceof Set,
|
|
3481
|
-
nodeClass:
|
|
3565
|
+
nodeClass: de,
|
|
3482
3566
|
default: !1,
|
|
3483
3567
|
tag: "tag:yaml.org,2002:set",
|
|
3484
|
-
createNode: (s, e, t) =>
|
|
3568
|
+
createNode: (s, e, t) => de.from(s, e, t),
|
|
3485
3569
|
resolve(s, e) {
|
|
3486
3570
|
if (je(s)) {
|
|
3487
3571
|
if (s.hasAllNullValues(!0))
|
|
3488
|
-
return Object.assign(new
|
|
3572
|
+
return Object.assign(new de(), s);
|
|
3489
3573
|
e("Set items must all have null values");
|
|
3490
3574
|
} else
|
|
3491
3575
|
e("Expected a mapping for this tag");
|
|
3492
3576
|
return s;
|
|
3493
3577
|
}
|
|
3494
3578
|
};
|
|
3495
|
-
function
|
|
3579
|
+
function qt(s, e) {
|
|
3496
3580
|
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));
|
|
3497
3581
|
return t === "-" ? i(-1) * r : r;
|
|
3498
3582
|
}
|
|
@@ -3513,7 +3597,7 @@ const Hs = {
|
|
|
3513
3597
|
tag: "tag:yaml.org,2002:int",
|
|
3514
3598
|
format: "TIME",
|
|
3515
3599
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
3516
|
-
resolve: (s, e, { intAsBigInt: t }) =>
|
|
3600
|
+
resolve: (s, e, { intAsBigInt: t }) => qt(s, t),
|
|
3517
3601
|
stringify: Ys
|
|
3518
3602
|
}, Gs = {
|
|
3519
3603
|
identify: (s) => typeof s == "number",
|
|
@@ -3521,9 +3605,9 @@ const Hs = {
|
|
|
3521
3605
|
tag: "tag:yaml.org,2002:float",
|
|
3522
3606
|
format: "TIME",
|
|
3523
3607
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
3524
|
-
resolve: (s) =>
|
|
3608
|
+
resolve: (s) => qt(s, !1),
|
|
3525
3609
|
stringify: Ys
|
|
3526
|
-
},
|
|
3610
|
+
}, it = {
|
|
3527
3611
|
identify: (s) => s instanceof Date,
|
|
3528
3612
|
default: !0,
|
|
3529
3613
|
tag: "tag:yaml.org,2002:timestamp",
|
|
@@ -3532,24 +3616,24 @@ const Hs = {
|
|
|
3532
3616
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
3533
3617
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
3534
3618
|
resolve(s) {
|
|
3535
|
-
const e = s.match(
|
|
3619
|
+
const e = s.match(it.test);
|
|
3536
3620
|
if (!e)
|
|
3537
3621
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
3538
3622
|
const [, t, n, i, r, o, a] = e.map(Number), l = e[7] ? Number((e[7] + "00").substr(1, 3)) : 0;
|
|
3539
3623
|
let c = Date.UTC(t, n - 1, i, r || 0, o || 0, a || 0, l);
|
|
3540
3624
|
const u = e[8];
|
|
3541
3625
|
if (u && u !== "Z") {
|
|
3542
|
-
let f =
|
|
3626
|
+
let f = qt(u, !1);
|
|
3543
3627
|
Math.abs(f) < 30 && (f *= 60), c -= 6e4 * f;
|
|
3544
3628
|
}
|
|
3545
3629
|
return new Date(c);
|
|
3546
3630
|
},
|
|
3547
3631
|
stringify: ({ value: s }) => s?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
3548
|
-
},
|
|
3632
|
+
}, Xt = [
|
|
3549
3633
|
we,
|
|
3550
3634
|
be,
|
|
3551
|
-
Ze,
|
|
3552
3635
|
et,
|
|
3636
|
+
tt,
|
|
3553
3637
|
Vs,
|
|
3554
3638
|
Ws,
|
|
3555
3639
|
Gi,
|
|
@@ -3561,24 +3645,24 @@ const Hs = {
|
|
|
3561
3645
|
Hi,
|
|
3562
3646
|
Pt,
|
|
3563
3647
|
Y,
|
|
3564
|
-
|
|
3648
|
+
Mt,
|
|
3565
3649
|
Ut,
|
|
3566
|
-
|
|
3650
|
+
Bt,
|
|
3567
3651
|
Hs,
|
|
3568
3652
|
Gs,
|
|
3569
|
-
|
|
3570
|
-
],
|
|
3653
|
+
it
|
|
3654
|
+
], Zt = /* @__PURE__ */ new Map([
|
|
3571
3655
|
["core", Ki],
|
|
3572
|
-
["failsafe", [we, be,
|
|
3656
|
+
["failsafe", [we, be, et]],
|
|
3573
3657
|
["json", Vi],
|
|
3574
|
-
["yaml11",
|
|
3575
|
-
["yaml-1.1",
|
|
3576
|
-
]),
|
|
3658
|
+
["yaml11", Xt],
|
|
3659
|
+
["yaml-1.1", Xt]
|
|
3660
|
+
]), es = {
|
|
3577
3661
|
binary: Pt,
|
|
3578
|
-
bool:
|
|
3579
|
-
float:
|
|
3580
|
-
floatExp:
|
|
3581
|
-
floatNaN:
|
|
3662
|
+
bool: Rt,
|
|
3663
|
+
float: Us,
|
|
3664
|
+
floatExp: Ps,
|
|
3665
|
+
floatNaN: xs,
|
|
3582
3666
|
floatTime: Gs,
|
|
3583
3667
|
int: Bs,
|
|
3584
3668
|
intHex: qs,
|
|
@@ -3586,22 +3670,22 @@ const Hs = {
|
|
|
3586
3670
|
intTime: Hs,
|
|
3587
3671
|
map: we,
|
|
3588
3672
|
merge: Y,
|
|
3589
|
-
null:
|
|
3590
|
-
omap:
|
|
3673
|
+
null: tt,
|
|
3674
|
+
omap: Mt,
|
|
3591
3675
|
pairs: Ut,
|
|
3592
3676
|
seq: be,
|
|
3593
|
-
set:
|
|
3594
|
-
timestamp:
|
|
3677
|
+
set: Bt,
|
|
3678
|
+
timestamp: it
|
|
3595
3679
|
}, Zi = {
|
|
3596
3680
|
"tag:yaml.org,2002:binary": Pt,
|
|
3597
3681
|
"tag:yaml.org,2002:merge": Y,
|
|
3598
|
-
"tag:yaml.org,2002:omap":
|
|
3682
|
+
"tag:yaml.org,2002:omap": Mt,
|
|
3599
3683
|
"tag:yaml.org,2002:pairs": Ut,
|
|
3600
|
-
"tag:yaml.org,2002:set":
|
|
3601
|
-
"tag:yaml.org,2002:timestamp":
|
|
3684
|
+
"tag:yaml.org,2002:set": Bt,
|
|
3685
|
+
"tag:yaml.org,2002:timestamp": it
|
|
3602
3686
|
};
|
|
3603
|
-
function
|
|
3604
|
-
const n =
|
|
3687
|
+
function ht(s, e, t) {
|
|
3688
|
+
const n = Zt.get(e);
|
|
3605
3689
|
if (n && !s)
|
|
3606
3690
|
return t && !n.includes(Y) ? n.concat(Y) : n.slice();
|
|
3607
3691
|
let i = n;
|
|
@@ -3609,7 +3693,7 @@ function ft(s, e, t) {
|
|
|
3609
3693
|
if (Array.isArray(s))
|
|
3610
3694
|
i = [];
|
|
3611
3695
|
else {
|
|
3612
|
-
const r = Array.from(
|
|
3696
|
+
const r = Array.from(Zt.keys()).filter((o) => o !== "yaml11").map((o) => JSON.stringify(o)).join(", ");
|
|
3613
3697
|
throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`);
|
|
3614
3698
|
}
|
|
3615
3699
|
if (Array.isArray(s))
|
|
@@ -3617,21 +3701,21 @@ function ft(s, e, t) {
|
|
|
3617
3701
|
i = i.concat(r);
|
|
3618
3702
|
else typeof s == "function" && (i = s(i.slice()));
|
|
3619
3703
|
return t && (i = i.concat(Y)), i.reduce((r, o) => {
|
|
3620
|
-
const a = typeof o == "string" ?
|
|
3704
|
+
const a = typeof o == "string" ? es[o] : o;
|
|
3621
3705
|
if (!a) {
|
|
3622
|
-
const l = JSON.stringify(o), c = Object.keys(
|
|
3706
|
+
const l = JSON.stringify(o), c = Object.keys(es).map((u) => JSON.stringify(u)).join(", ");
|
|
3623
3707
|
throw new Error(`Unknown custom tag ${l}; use one of ${c}`);
|
|
3624
3708
|
}
|
|
3625
3709
|
return r.includes(a) || r.push(a), r;
|
|
3626
3710
|
}, []);
|
|
3627
3711
|
}
|
|
3628
3712
|
const er = (s, e) => s.key < e.key ? -1 : s.key > e.key ? 1 : 0;
|
|
3629
|
-
class
|
|
3713
|
+
class Kt {
|
|
3630
3714
|
constructor({ compat: e, customTags: t, merge: n, resolveKnownTags: i, schema: r, sortMapEntries: o, toStringDefaults: a }) {
|
|
3631
|
-
this.compat = Array.isArray(e) ?
|
|
3715
|
+
this.compat = Array.isArray(e) ? ht(e, "compat") : e ? ht(null, e) : null, this.name = typeof r == "string" && r || "core", this.knownTags = i ? Zi : {}, this.tags = ht(t, this.name, n), this.toStringOptions = a ?? null, Object.defineProperty(this, Z, { value: we }), Object.defineProperty(this, J, { value: et }), Object.defineProperty(this, ye, { value: be }), this.sortMapEntries = typeof o == "function" ? o : o === !0 ? er : null;
|
|
3632
3716
|
}
|
|
3633
3717
|
clone() {
|
|
3634
|
-
const e = Object.create(
|
|
3718
|
+
const e = Object.create(Kt.prototype, Object.getOwnPropertyDescriptors(this));
|
|
3635
3719
|
return e.tags = this.tags.slice(), e;
|
|
3636
3720
|
}
|
|
3637
3721
|
}
|
|
@@ -3643,7 +3727,7 @@ function tr(s, e) {
|
|
|
3643
3727
|
l ? (t.push(l), n = !0) : s.directives.docStart && (n = !0);
|
|
3644
3728
|
}
|
|
3645
3729
|
n && t.push("---");
|
|
3646
|
-
const i =
|
|
3730
|
+
const i = Ls(s, e), { commentString: r } = i.options;
|
|
3647
3731
|
if (s.commentBefore) {
|
|
3648
3732
|
t.length !== 1 && t.unshift("");
|
|
3649
3733
|
const l = r(s.commentBefore);
|
|
@@ -3651,7 +3735,7 @@ function tr(s, e) {
|
|
|
3651
3735
|
}
|
|
3652
3736
|
let o = !1, a = null;
|
|
3653
3737
|
if (s.contents) {
|
|
3654
|
-
if (
|
|
3738
|
+
if (L(s.contents)) {
|
|
3655
3739
|
if (s.contents.spaceBefore && n && t.push(""), s.contents.commentBefore) {
|
|
3656
3740
|
const u = r(s.contents.commentBefore);
|
|
3657
3741
|
t.push(W(u, ""));
|
|
@@ -3678,7 +3762,7 @@ function tr(s, e) {
|
|
|
3678
3762
|
`) + `
|
|
3679
3763
|
`;
|
|
3680
3764
|
}
|
|
3681
|
-
class
|
|
3765
|
+
class Pe {
|
|
3682
3766
|
constructor(e, t, n) {
|
|
3683
3767
|
this.commentBefore = null, this.comment = null, this.errors = [], this.warnings = [], Object.defineProperty(this, B, { value: wt });
|
|
3684
3768
|
let i = null;
|
|
@@ -3695,7 +3779,7 @@ class Ue {
|
|
|
3695
3779
|
}, n);
|
|
3696
3780
|
this.options = r;
|
|
3697
3781
|
let { version: o } = r;
|
|
3698
|
-
n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new
|
|
3782
|
+
n?._directives ? (this.directives = n._directives.atDocument(), this.directives.yaml.explicit && (o = this.directives.yaml.version)) : this.directives = new x({ version: o }), this.setSchema(o, n), this.contents = e === void 0 ? null : this.createNode(e, i, n);
|
|
3699
3783
|
}
|
|
3700
3784
|
/**
|
|
3701
3785
|
* Create a deep copy of this Document and its contents.
|
|
@@ -3703,10 +3787,10 @@ class Ue {
|
|
|
3703
3787
|
* Custom Node values that inherit from `Object` still refer to their original instances.
|
|
3704
3788
|
*/
|
|
3705
3789
|
clone() {
|
|
3706
|
-
const e = Object.create(
|
|
3790
|
+
const e = Object.create(Pe.prototype, {
|
|
3707
3791
|
[B]: { value: wt }
|
|
3708
3792
|
});
|
|
3709
|
-
return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents =
|
|
3793
|
+
return e.commentBefore = this.commentBefore, e.comment = this.comment, e.errors = this.errors.slice(), e.warnings = this.warnings.slice(), e.options = Object.assign({}, this.options), this.directives && (e.directives = this.directives.clone()), e.schema = this.schema.clone(), e.contents = L(this.contents) ? this.contents.clone(e.schema) : this.contents, this.range && (e.range = this.range.slice()), e;
|
|
3710
3794
|
}
|
|
3711
3795
|
/** Adds a value to the document. */
|
|
3712
3796
|
add(e) {
|
|
@@ -3727,11 +3811,11 @@ class Ue {
|
|
|
3727
3811
|
*/
|
|
3728
3812
|
createAlias(e, t) {
|
|
3729
3813
|
if (!e.anchor) {
|
|
3730
|
-
const n =
|
|
3814
|
+
const n = Ns(this);
|
|
3731
3815
|
e.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
3732
3816
|
!t || n.has(t) ? Os(t || "a", n) : t;
|
|
3733
3817
|
}
|
|
3734
|
-
return new
|
|
3818
|
+
return new Et(e.anchor);
|
|
3735
3819
|
}
|
|
3736
3820
|
createNode(e, t, n) {
|
|
3737
3821
|
let i;
|
|
@@ -3741,7 +3825,7 @@ class Ue {
|
|
|
3741
3825
|
const m = (w) => typeof w == "number" || w instanceof String || w instanceof Number, k = t.filter(m).map(String);
|
|
3742
3826
|
k.length > 0 && (t = t.concat(k)), i = t;
|
|
3743
3827
|
} else n === void 0 && t && (n = t, t = void 0);
|
|
3744
|
-
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: u } = n ?? {}, { onAnchor: f, setAnchors:
|
|
3828
|
+
const { aliasDuplicateObjects: r, anchorPrefix: o, flow: a, keepUndefined: l, onTagObj: c, tag: u } = n ?? {}, { onAnchor: f, setAnchors: h, sourceObjects: p } = Ai(
|
|
3745
3829
|
this,
|
|
3746
3830
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
3747
3831
|
o || "a"
|
|
@@ -3753,8 +3837,8 @@ class Ue {
|
|
|
3753
3837
|
replacer: i,
|
|
3754
3838
|
schema: this.schema,
|
|
3755
3839
|
sourceObjects: p
|
|
3756
|
-
},
|
|
3757
|
-
return a &&
|
|
3840
|
+
}, d = Ae(e, u, g);
|
|
3841
|
+
return a && A(d) && (d.flow = !0), h(), d;
|
|
3758
3842
|
}
|
|
3759
3843
|
/**
|
|
3760
3844
|
* Convert a key and a value into a `Pair` using the current schema,
|
|
@@ -3762,7 +3846,7 @@ class Ue {
|
|
|
3762
3846
|
*/
|
|
3763
3847
|
createPair(e, t, n = {}) {
|
|
3764
3848
|
const i = this.createNode(e, null, n), r = this.createNode(t, null, n);
|
|
3765
|
-
return new
|
|
3849
|
+
return new P(i, r);
|
|
3766
3850
|
}
|
|
3767
3851
|
/**
|
|
3768
3852
|
* Removes a value from the document.
|
|
@@ -3784,7 +3868,7 @@ class Ue {
|
|
|
3784
3868
|
* `true` (collections are always returned intact).
|
|
3785
3869
|
*/
|
|
3786
3870
|
get(e, t) {
|
|
3787
|
-
return
|
|
3871
|
+
return A(this.contents) ? this.contents.get(e, t) : void 0;
|
|
3788
3872
|
}
|
|
3789
3873
|
/**
|
|
3790
3874
|
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
@@ -3792,33 +3876,33 @@ class Ue {
|
|
|
3792
3876
|
* `true` (collections are always returned intact).
|
|
3793
3877
|
*/
|
|
3794
3878
|
getIn(e, t) {
|
|
3795
|
-
return ve(e) ? !t && _(this.contents) ? this.contents.value : this.contents :
|
|
3879
|
+
return ve(e) ? !t && _(this.contents) ? this.contents.value : this.contents : A(this.contents) ? this.contents.getIn(e, t) : void 0;
|
|
3796
3880
|
}
|
|
3797
3881
|
/**
|
|
3798
3882
|
* Checks if the document includes a value with the key `key`.
|
|
3799
3883
|
*/
|
|
3800
3884
|
has(e) {
|
|
3801
|
-
return
|
|
3885
|
+
return A(this.contents) ? this.contents.has(e) : !1;
|
|
3802
3886
|
}
|
|
3803
3887
|
/**
|
|
3804
3888
|
* Checks if the document includes a value at `path`.
|
|
3805
3889
|
*/
|
|
3806
3890
|
hasIn(e) {
|
|
3807
|
-
return ve(e) ? this.contents !== void 0 :
|
|
3891
|
+
return ve(e) ? this.contents !== void 0 : A(this.contents) ? this.contents.hasIn(e) : !1;
|
|
3808
3892
|
}
|
|
3809
3893
|
/**
|
|
3810
3894
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3811
3895
|
* boolean to add/remove the item from the set.
|
|
3812
3896
|
*/
|
|
3813
3897
|
set(e, t) {
|
|
3814
|
-
this.contents == null ? this.contents =
|
|
3898
|
+
this.contents == null ? this.contents = Ye(this.schema, [e], t) : ae(this.contents) && this.contents.set(e, t);
|
|
3815
3899
|
}
|
|
3816
3900
|
/**
|
|
3817
3901
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3818
3902
|
* boolean to add/remove the item from the set.
|
|
3819
3903
|
*/
|
|
3820
3904
|
setIn(e, t) {
|
|
3821
|
-
ve(e) ? this.contents = t : this.contents == null ? this.contents =
|
|
3905
|
+
ve(e) ? this.contents = t : this.contents == null ? this.contents = Ye(this.schema, Array.from(e), t) : ae(this.contents) && this.contents.setIn(e, t);
|
|
3822
3906
|
}
|
|
3823
3907
|
/**
|
|
3824
3908
|
* Change the YAML version and schema used by the document.
|
|
@@ -3832,11 +3916,11 @@ class Ue {
|
|
|
3832
3916
|
let n;
|
|
3833
3917
|
switch (e) {
|
|
3834
3918
|
case "1.1":
|
|
3835
|
-
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new
|
|
3919
|
+
this.directives ? this.directives.yaml.version = "1.1" : this.directives = new x({ version: "1.1" }), n = { resolveKnownTags: !1, schema: "yaml-1.1" };
|
|
3836
3920
|
break;
|
|
3837
3921
|
case "1.2":
|
|
3838
3922
|
case "next":
|
|
3839
|
-
this.directives ? this.directives.yaml.version = e : this.directives = new
|
|
3923
|
+
this.directives ? this.directives.yaml.version = e : this.directives = new x({ version: e }), n = { resolveKnownTags: !0, schema: "core" };
|
|
3840
3924
|
break;
|
|
3841
3925
|
case null:
|
|
3842
3926
|
this.directives && delete this.directives, n = null;
|
|
@@ -3849,7 +3933,7 @@ class Ue {
|
|
|
3849
3933
|
if (t.schema instanceof Object)
|
|
3850
3934
|
this.schema = t.schema;
|
|
3851
3935
|
else if (n)
|
|
3852
|
-
this.schema = new
|
|
3936
|
+
this.schema = new Kt(Object.assign(n, t));
|
|
3853
3937
|
else
|
|
3854
3938
|
throw new Error("With a null YAML version, the { schema: Schema } option is required");
|
|
3855
3939
|
}
|
|
@@ -3889,7 +3973,7 @@ class Ue {
|
|
|
3889
3973
|
}
|
|
3890
3974
|
}
|
|
3891
3975
|
function ae(s) {
|
|
3892
|
-
if (
|
|
3976
|
+
if (A(s))
|
|
3893
3977
|
return !0;
|
|
3894
3978
|
throw new Error("Expected a YAML collection as document contents");
|
|
3895
3979
|
}
|
|
@@ -3898,7 +3982,7 @@ class zs extends Error {
|
|
|
3898
3982
|
super(), this.name = e, this.code = n, this.message = i, this.pos = t;
|
|
3899
3983
|
}
|
|
3900
3984
|
}
|
|
3901
|
-
class
|
|
3985
|
+
class Te extends zs {
|
|
3902
3986
|
constructor(e, t, n) {
|
|
3903
3987
|
super("YAMLParseError", e, t, n);
|
|
3904
3988
|
}
|
|
@@ -3908,7 +3992,7 @@ class sr extends zs {
|
|
|
3908
3992
|
super("YAMLWarning", e, t, n);
|
|
3909
3993
|
}
|
|
3910
3994
|
}
|
|
3911
|
-
const
|
|
3995
|
+
const ts = (s, e) => (t) => {
|
|
3912
3996
|
if (t.pos[0] === -1)
|
|
3913
3997
|
return;
|
|
3914
3998
|
t.linePos = t.pos.map((a) => e.linePos(a));
|
|
@@ -3937,20 +4021,20 @@ ${c}
|
|
|
3937
4021
|
}
|
|
3938
4022
|
};
|
|
3939
4023
|
function ge(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIndent: o, startOnNewline: a }) {
|
|
3940
|
-
let l = !1, c = a, u = a, f = "",
|
|
4024
|
+
let l = !1, c = a, u = a, f = "", h = "", p = !1, g = !1, d = null, m = null, k = null, w = null, b = null, S = null, v = null;
|
|
3941
4025
|
for (const y of s)
|
|
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),
|
|
4026
|
+
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), d && (c && y.type !== "comment" && y.type !== "newline" && r(d, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), d = null), y.type) {
|
|
3943
4027
|
case "space":
|
|
3944
|
-
!e && (t !== "doc-start" || n?.type !== "flow-collection") && y.source.includes(" ") && (
|
|
4028
|
+
!e && (t !== "doc-start" || n?.type !== "flow-collection") && y.source.includes(" ") && (d = y), u = !0;
|
|
3945
4029
|
break;
|
|
3946
4030
|
case "comment": {
|
|
3947
4031
|
u || r(y, "MISSING_CHAR", "Comments must be separated from other tokens by white space characters");
|
|
3948
4032
|
const $ = y.source.substring(1) || " ";
|
|
3949
|
-
f ? f +=
|
|
4033
|
+
f ? f += h + $ : f = $, h = "", c = !1;
|
|
3950
4034
|
break;
|
|
3951
4035
|
}
|
|
3952
4036
|
case "newline":
|
|
3953
|
-
c ? f ? f += y.source : (!S || t !== "seq-item-ind") && (l = !0) :
|
|
4037
|
+
c ? f ? f += y.source : (!S || t !== "seq-item-ind") && (l = !0) : h += y.source, c = !0, p = !0, (m || k) && (w = y), u = !0;
|
|
3954
4038
|
break;
|
|
3955
4039
|
case "anchor":
|
|
3956
4040
|
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;
|
|
@@ -3972,7 +4056,7 @@ function ge(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
|
|
|
3972
4056
|
r(y, "UNEXPECTED_TOKEN", `Unexpected ${y.type} token`), c = !1, u = !1;
|
|
3973
4057
|
}
|
|
3974
4058
|
const I = s[s.length - 1], O = I ? I.offset + I.source.length : i;
|
|
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"),
|
|
4059
|
+
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"), d && (c && d.indent <= o || n?.type === "block-map" || n?.type === "block-seq") && r(d, "TAB_AS_INDENT", "Tabs are not allowed as indentation"), {
|
|
3976
4060
|
comma: b,
|
|
3977
4061
|
found: S,
|
|
3978
4062
|
spaceBefore: l,
|
|
@@ -3985,7 +4069,7 @@ function ge(s, { flow: e, indicator: t, next: n, offset: i, onError: r, parentIn
|
|
|
3985
4069
|
start: v ?? O
|
|
3986
4070
|
};
|
|
3987
4071
|
}
|
|
3988
|
-
function
|
|
4072
|
+
function Le(s) {
|
|
3989
4073
|
if (!s)
|
|
3990
4074
|
return null;
|
|
3991
4075
|
switch (s.type) {
|
|
@@ -4012,7 +4096,7 @@ function Ae(s) {
|
|
|
4012
4096
|
if (t.type === "newline")
|
|
4013
4097
|
return !0;
|
|
4014
4098
|
}
|
|
4015
|
-
if (
|
|
4099
|
+
if (Le(e.key) || Le(e.value))
|
|
4016
4100
|
return !0;
|
|
4017
4101
|
}
|
|
4018
4102
|
return !1;
|
|
@@ -4020,10 +4104,10 @@ function Ae(s) {
|
|
|
4020
4104
|
return !0;
|
|
4021
4105
|
}
|
|
4022
4106
|
}
|
|
4023
|
-
function
|
|
4107
|
+
function Tt(s, e, t) {
|
|
4024
4108
|
if (e?.type === "flow-collection") {
|
|
4025
4109
|
const n = e.end[0];
|
|
4026
|
-
n.indent === s && (n.source === "]" || n.source === "}") &&
|
|
4110
|
+
n.indent === s && (n.source === "]" || n.source === "}") && Le(e) && t(n, "BAD_INDENT", "Flow end indicator should be more indented than parent", !0);
|
|
4027
4111
|
}
|
|
4028
4112
|
}
|
|
4029
4113
|
function Qs(s, e, t) {
|
|
@@ -4033,49 +4117,49 @@ function Qs(s, e, t) {
|
|
|
4033
4117
|
const i = typeof n == "function" ? n : (r, o) => r === o || _(r) && _(o) && r.value === o.value;
|
|
4034
4118
|
return e.some((r) => i(r.key, t));
|
|
4035
4119
|
}
|
|
4036
|
-
const
|
|
4120
|
+
const ss = "All mapping items must start at the same column";
|
|
4037
4121
|
function nr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
4038
4122
|
const o = r?.nodeClass ?? M, a = new o(t.schema);
|
|
4039
4123
|
t.atRoot && (t.atRoot = !1);
|
|
4040
4124
|
let l = n.offset, c = null;
|
|
4041
4125
|
for (const u of n.items) {
|
|
4042
|
-
const { start: f, key:
|
|
4126
|
+
const { start: f, key: h, sep: p, value: g } = u, d = ge(f, {
|
|
4043
4127
|
indicator: "explicit-key-ind",
|
|
4044
|
-
next:
|
|
4128
|
+
next: h ?? p?.[0],
|
|
4045
4129
|
offset: l,
|
|
4046
4130
|
onError: i,
|
|
4047
4131
|
parentIndent: n.indent,
|
|
4048
4132
|
startOnNewline: !0
|
|
4049
|
-
}), m = !
|
|
4133
|
+
}), m = !d.found;
|
|
4050
4134
|
if (m) {
|
|
4051
|
-
if (
|
|
4052
|
-
c =
|
|
4053
|
-
` +
|
|
4135
|
+
if (h && (h.type === "block-seq" ? i(l, "BLOCK_AS_IMPLICIT_KEY", "A block sequence may not be used as an implicit map key") : "indent" in h && h.indent !== n.indent && i(l, "BAD_INDENT", ss)), !d.anchor && !d.tag && !p) {
|
|
4136
|
+
c = d.end, d.comment && (a.comment ? a.comment += `
|
|
4137
|
+
` + d.comment : a.comment = d.comment);
|
|
4054
4138
|
continue;
|
|
4055
4139
|
}
|
|
4056
|
-
(
|
|
4057
|
-
} else
|
|
4140
|
+
(d.newlineAfterProp || Le(h)) && i(h ?? f[f.length - 1], "MULTILINE_IMPLICIT_KEY", "Implicit keys need to be on a single line");
|
|
4141
|
+
} else d.found?.indent !== n.indent && i(l, "BAD_INDENT", ss);
|
|
4058
4142
|
t.atKey = !0;
|
|
4059
|
-
const k =
|
|
4060
|
-
t.schema.compat &&
|
|
4143
|
+
const k = d.end, w = h ? s(t, h, d, i) : e(t, k, f, null, d, i);
|
|
4144
|
+
t.schema.compat && Tt(n.indent, h, i), t.atKey = !1, Qs(t, a.items, w) && i(k, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4061
4145
|
const b = ge(p ?? [], {
|
|
4062
4146
|
indicator: "map-value-ind",
|
|
4063
4147
|
next: g,
|
|
4064
4148
|
offset: w.range[2],
|
|
4065
4149
|
onError: i,
|
|
4066
4150
|
parentIndent: n.indent,
|
|
4067
|
-
startOnNewline: !
|
|
4151
|
+
startOnNewline: !h || h.type === "block-scalar"
|
|
4068
4152
|
});
|
|
4069
4153
|
if (l = b.end, b.found) {
|
|
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 &&
|
|
4154
|
+
m && (g?.type === "block-map" && !b.hasNewline && i(l, "BLOCK_AS_IMPLICIT_KEY", "Nested mappings are not allowed in compact mappings"), t.options.strict && d.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"));
|
|
4071
4155
|
const S = g ? s(t, g, b, i) : e(t, l, p, null, b, i);
|
|
4072
|
-
t.schema.compat &&
|
|
4073
|
-
const v = new
|
|
4156
|
+
t.schema.compat && Tt(n.indent, g, i), l = S.range[2];
|
|
4157
|
+
const v = new P(w, S);
|
|
4074
4158
|
t.options.keepSourceTokens && (v.srcToken = u), a.items.push(v);
|
|
4075
4159
|
} else {
|
|
4076
4160
|
m && i(w.range, "MISSING_CHAR", "Implicit map keys need to be followed by map values"), b.comment && (w.comment ? w.comment += `
|
|
4077
4161
|
` + b.comment : w.comment = b.comment);
|
|
4078
|
-
const S = new
|
|
4162
|
+
const S = new P(w);
|
|
4079
4163
|
t.options.keepSourceTokens && (S.srcToken = u), a.items.push(S);
|
|
4080
4164
|
}
|
|
4081
4165
|
}
|
|
@@ -4086,7 +4170,7 @@ function ir({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4086
4170
|
t.atRoot && (t.atRoot = !1), t.atKey && (t.atKey = !1);
|
|
4087
4171
|
let l = n.offset, c = null;
|
|
4088
4172
|
for (const { start: u, value: f } of n.items) {
|
|
4089
|
-
const
|
|
4173
|
+
const h = ge(u, {
|
|
4090
4174
|
indicator: "seq-item-ind",
|
|
4091
4175
|
next: f,
|
|
4092
4176
|
offset: l,
|
|
@@ -4094,19 +4178,19 @@ function ir({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4094
4178
|
parentIndent: n.indent,
|
|
4095
4179
|
startOnNewline: !0
|
|
4096
4180
|
});
|
|
4097
|
-
if (!
|
|
4098
|
-
if (
|
|
4099
|
-
f?.type === "block-seq" ? i(
|
|
4181
|
+
if (!h.found)
|
|
4182
|
+
if (h.anchor || h.tag || f)
|
|
4183
|
+
f?.type === "block-seq" ? i(h.end, "BAD_INDENT", "All sequence items must start at the same column") : i(l, "MISSING_CHAR", "Sequence item without - indicator");
|
|
4100
4184
|
else {
|
|
4101
|
-
c =
|
|
4185
|
+
c = h.end, h.comment && (a.comment = h.comment);
|
|
4102
4186
|
continue;
|
|
4103
4187
|
}
|
|
4104
|
-
const p = f ? s(t, f,
|
|
4105
|
-
t.schema.compat &&
|
|
4188
|
+
const p = f ? s(t, f, h, i) : e(t, h.end, u, null, h, i);
|
|
4189
|
+
t.schema.compat && Tt(n.indent, f, i), l = p.range[2], a.items.push(p);
|
|
4106
4190
|
}
|
|
4107
4191
|
return a.range = [n.offset, l, c ?? l], a;
|
|
4108
4192
|
}
|
|
4109
|
-
function
|
|
4193
|
+
function Ue(s, e, t, n) {
|
|
4110
4194
|
let i = "";
|
|
4111
4195
|
if (s) {
|
|
4112
4196
|
let r = !1, o = "";
|
|
@@ -4133,7 +4217,7 @@ function xe(s, e, t, n) {
|
|
|
4133
4217
|
}
|
|
4134
4218
|
return { comment: i, offset: e };
|
|
4135
4219
|
}
|
|
4136
|
-
const dt = "Block collections are not allowed within flow collections",
|
|
4220
|
+
const dt = "Block collections are not allowed within flow collections", pt = (s) => s && (s.type === "block-map" || s.type === "block-seq");
|
|
4137
4221
|
function rr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
4138
4222
|
const o = n.start.source === "{", a = o ? "flow map" : "flow sequence", l = r?.nodeClass ?? (o ? M : ie), c = new l(t.schema);
|
|
4139
4223
|
c.flow = !0;
|
|
@@ -4156,7 +4240,7 @@ function rr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4156
4240
|
` + I.comment : c.comment = I.comment), f = I.end;
|
|
4157
4241
|
continue;
|
|
4158
4242
|
}
|
|
4159
|
-
!o && t.options.strict &&
|
|
4243
|
+
!o && t.options.strict && Le(b) && i(
|
|
4160
4244
|
b,
|
|
4161
4245
|
// checked by containsNewline()
|
|
4162
4246
|
"MULTILINE_IMPLICIT_KEY",
|
|
@@ -4186,11 +4270,11 @@ function rr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4186
4270
|
}
|
|
4187
4271
|
if (!o && !S && !I.found) {
|
|
4188
4272
|
const O = v ? s(t, v, I, i) : e(t, I.end, S, null, I, i);
|
|
4189
|
-
c.items.push(O), f = O.range[2],
|
|
4273
|
+
c.items.push(O), f = O.range[2], pt(v) && i(O.range, "BLOCK_IN_FLOW", dt);
|
|
4190
4274
|
} else {
|
|
4191
4275
|
t.atKey = !0;
|
|
4192
4276
|
const O = I.end, y = b ? s(t, b, I, i) : e(t, O, w, null, I, i);
|
|
4193
|
-
|
|
4277
|
+
pt(b) && i(y.range, "BLOCK_IN_FLOW", dt), t.atKey = !1;
|
|
4194
4278
|
const $ = ge(S ?? [], {
|
|
4195
4279
|
flow: a,
|
|
4196
4280
|
indicator: "map-value-ind",
|
|
@@ -4215,123 +4299,123 @@ function rr({ composeNode: s, composeEmptyNode: e }, t, n, i, r) {
|
|
|
4215
4299
|
}
|
|
4216
4300
|
} 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`));
|
|
4217
4301
|
const G = v ? s(t, v, $, i) : $.found ? e(t, $.end, S, null, $, i) : null;
|
|
4218
|
-
G ?
|
|
4302
|
+
G ? pt(v) && i(G.range, "BLOCK_IN_FLOW", dt) : $.comment && (y.comment ? y.comment += `
|
|
4219
4303
|
` + $.comment : y.comment = $.comment);
|
|
4220
|
-
const oe = new
|
|
4304
|
+
const oe = new P(y, G);
|
|
4221
4305
|
if (t.options.keepSourceTokens && (oe.srcToken = k), o) {
|
|
4222
4306
|
const j = c;
|
|
4223
4307
|
Qs(t, j.items, y) && i(O, "DUPLICATE_KEY", "Map keys must be unique"), j.items.push(oe);
|
|
4224
4308
|
} else {
|
|
4225
4309
|
const j = new M(t.schema);
|
|
4226
4310
|
j.flow = !0, j.items.push(oe);
|
|
4227
|
-
const
|
|
4228
|
-
j.range = [y.range[0],
|
|
4311
|
+
const Jt = (G ?? y).range;
|
|
4312
|
+
j.range = [y.range[0], Jt[1], Jt[2]], c.items.push(j);
|
|
4229
4313
|
}
|
|
4230
4314
|
f = G ? G.range[2] : $.end;
|
|
4231
4315
|
}
|
|
4232
4316
|
}
|
|
4233
|
-
const
|
|
4234
|
-
let
|
|
4235
|
-
if (p?.source ===
|
|
4236
|
-
|
|
4317
|
+
const h = o ? "}" : "]", [p, ...g] = n.end;
|
|
4318
|
+
let d = f;
|
|
4319
|
+
if (p?.source === h)
|
|
4320
|
+
d = p.offset + p.source.length;
|
|
4237
4321
|
else {
|
|
4238
|
-
const m = a[0].toUpperCase() + a.substring(1), k = u ? `${m} must end with a ${
|
|
4322
|
+
const m = a[0].toUpperCase() + a.substring(1), k = u ? `${m} must end with a ${h}` : `${m} in block collection must be sufficiently indented and end with a ${h}`;
|
|
4239
4323
|
i(f, u ? "MISSING_CHAR" : "BAD_INDENT", k), p && p.source.length !== 1 && g.unshift(p);
|
|
4240
4324
|
}
|
|
4241
4325
|
if (g.length > 0) {
|
|
4242
|
-
const m =
|
|
4326
|
+
const m = Ue(g, d, t.options.strict, i);
|
|
4243
4327
|
m.comment && (c.comment ? c.comment += `
|
|
4244
|
-
` + m.comment : c.comment = m.comment), c.range = [n.offset,
|
|
4328
|
+
` + m.comment : c.comment = m.comment), c.range = [n.offset, d, m.offset];
|
|
4245
4329
|
} else
|
|
4246
|
-
c.range = [n.offset,
|
|
4330
|
+
c.range = [n.offset, d, d];
|
|
4247
4331
|
return c;
|
|
4248
4332
|
}
|
|
4249
|
-
function
|
|
4333
|
+
function mt(s, e, t, n, i, r) {
|
|
4250
4334
|
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;
|
|
4251
4335
|
return i === "!" || i === a.tagName ? (o.tag = a.tagName, o) : (i && (o.tag = i), o);
|
|
4252
4336
|
}
|
|
4253
4337
|
function or(s, e, t, n, i) {
|
|
4254
|
-
const r = n.tag, o = r ? e.directives.tagName(r.source, (
|
|
4338
|
+
const r = n.tag, o = r ? e.directives.tagName(r.source, (h) => i(r, "TAG_RESOLVE_FAILED", h)) : null;
|
|
4255
4339
|
if (t.type === "block-seq") {
|
|
4256
|
-
const { anchor:
|
|
4340
|
+
const { anchor: h, newlineAfterProp: p } = n, g = h && r ? h.offset > r.offset ? h : r : h ?? r;
|
|
4257
4341
|
g && (!p || p.offset < g.offset) && i(g, "MISSING_CHAR", "Missing newline after block sequence props");
|
|
4258
4342
|
}
|
|
4259
4343
|
const a = t.type === "block-map" ? "map" : t.type === "block-seq" ? "seq" : t.start.source === "{" ? "map" : "seq";
|
|
4260
4344
|
if (!r || !o || o === "!" || o === M.tagName && a === "map" || o === ie.tagName && a === "seq")
|
|
4261
|
-
return
|
|
4262
|
-
let l = e.schema.tags.find((
|
|
4345
|
+
return mt(s, e, t, i, o);
|
|
4346
|
+
let l = e.schema.tags.find((h) => h.tag === o && h.collection === a);
|
|
4263
4347
|
if (!l) {
|
|
4264
|
-
const
|
|
4265
|
-
if (
|
|
4266
|
-
e.schema.tags.push(Object.assign({},
|
|
4348
|
+
const h = e.schema.knownTags[o];
|
|
4349
|
+
if (h?.collection === a)
|
|
4350
|
+
e.schema.tags.push(Object.assign({}, h, { default: !1 })), l = h;
|
|
4267
4351
|
else
|
|
4268
|
-
return
|
|
4352
|
+
return h ? i(r, "BAD_COLLECTION_TYPE", `${h.tag} used for ${a} collection, but expects ${h.collection ?? "scalar"}`, !0) : i(r, "TAG_RESOLVE_FAILED", `Unresolved tag: ${o}`, !0), mt(s, e, t, i, o);
|
|
4269
4353
|
}
|
|
4270
|
-
const c =
|
|
4354
|
+
const c = mt(s, e, t, i, o, l), u = l.resolve?.(c, (h) => i(r, "TAG_RESOLVE_FAILED", h), e.options) ?? c, f = L(u) ? u : new T(u);
|
|
4271
4355
|
return f.range = c.range, f.tag = o, l?.format && (f.format = l.format), f;
|
|
4272
4356
|
}
|
|
4273
4357
|
function ar(s, e, t) {
|
|
4274
4358
|
const n = e.offset, i = lr(e, s.options.strict, t);
|
|
4275
4359
|
if (!i)
|
|
4276
4360
|
return { value: "", type: null, comment: "", range: [n, n, n] };
|
|
4277
|
-
const r = i.mode === ">" ?
|
|
4361
|
+
const r = i.mode === ">" ? T.BLOCK_FOLDED : T.BLOCK_LITERAL, o = e.source ? cr(e.source) : [];
|
|
4278
4362
|
let a = o.length;
|
|
4279
|
-
for (let
|
|
4280
|
-
const m = o[
|
|
4363
|
+
for (let d = o.length - 1; d >= 0; --d) {
|
|
4364
|
+
const m = o[d][1];
|
|
4281
4365
|
if (m === "" || m === "\r")
|
|
4282
|
-
a =
|
|
4366
|
+
a = d;
|
|
4283
4367
|
else
|
|
4284
4368
|
break;
|
|
4285
4369
|
}
|
|
4286
4370
|
if (a === 0) {
|
|
4287
|
-
const
|
|
4371
|
+
const d = i.chomp === "+" && o.length > 0 ? `
|
|
4288
4372
|
`.repeat(Math.max(1, o.length - 1)) : "";
|
|
4289
4373
|
let m = n + i.length;
|
|
4290
|
-
return e.source && (m += e.source.length), { value:
|
|
4374
|
+
return e.source && (m += e.source.length), { value: d, type: r, comment: i.comment, range: [n, m, m] };
|
|
4291
4375
|
}
|
|
4292
4376
|
let l = e.indent + i.indent, c = e.offset + i.length, u = 0;
|
|
4293
|
-
for (let
|
|
4294
|
-
const [m, k] = o[
|
|
4377
|
+
for (let d = 0; d < a; ++d) {
|
|
4378
|
+
const [m, k] = o[d];
|
|
4295
4379
|
if (k === "" || k === "\r")
|
|
4296
4380
|
i.indent === 0 && m.length > l && (l = m.length);
|
|
4297
4381
|
else {
|
|
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 =
|
|
4382
|
+
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 = d, l === 0 && !s.atRoot && t(c, "BAD_INDENT", "Block scalar values in collections must be indented");
|
|
4299
4383
|
break;
|
|
4300
4384
|
}
|
|
4301
4385
|
c += m.length + k.length + 1;
|
|
4302
4386
|
}
|
|
4303
|
-
for (let
|
|
4304
|
-
o[
|
|
4305
|
-
let f = "",
|
|
4306
|
-
for (let
|
|
4307
|
-
f += o[
|
|
4387
|
+
for (let d = o.length - 1; d >= a; --d)
|
|
4388
|
+
o[d][0].length > l && (a = d + 1);
|
|
4389
|
+
let f = "", h = "", p = !1;
|
|
4390
|
+
for (let d = 0; d < u; ++d)
|
|
4391
|
+
f += o[d][0].slice(l) + `
|
|
4308
4392
|
`;
|
|
4309
|
-
for (let
|
|
4310
|
-
let [m, k] = o[
|
|
4393
|
+
for (let d = u; d < a; ++d) {
|
|
4394
|
+
let [m, k] = o[d];
|
|
4311
4395
|
c += m.length + k.length + 1;
|
|
4312
4396
|
const w = k[k.length - 1] === "\r";
|
|
4313
4397
|
if (w && (k = k.slice(0, -1)), k && m.length < l) {
|
|
4314
4398
|
const S = `Block scalar lines must not be less indented than their ${i.indent ? "explicit indentation indicator" : "first line"}`;
|
|
4315
4399
|
t(c - k.length - (w ? 2 : 1), "BAD_INDENT", S), m = "";
|
|
4316
4400
|
}
|
|
4317
|
-
r ===
|
|
4318
|
-
`) : m.length > l || k[0] === " " ? (
|
|
4319
|
-
` : !p &&
|
|
4320
|
-
` && (
|
|
4401
|
+
r === T.BLOCK_LITERAL ? (f += h + m.slice(l) + k, h = `
|
|
4402
|
+
`) : m.length > l || k[0] === " " ? (h === " " ? h = `
|
|
4403
|
+
` : !p && h === `
|
|
4404
|
+
` && (h = `
|
|
4321
4405
|
|
|
4322
|
-
`), f +=
|
|
4323
|
-
`, p = !0) : k === "" ?
|
|
4406
|
+
`), f += h + m.slice(l) + k, h = `
|
|
4407
|
+
`, p = !0) : k === "" ? h === `
|
|
4324
4408
|
` ? f += `
|
|
4325
|
-
` :
|
|
4326
|
-
` : (f +=
|
|
4409
|
+
` : h = `
|
|
4410
|
+
` : (f += h + k, h = " ", p = !1);
|
|
4327
4411
|
}
|
|
4328
4412
|
switch (i.chomp) {
|
|
4329
4413
|
case "-":
|
|
4330
4414
|
break;
|
|
4331
4415
|
case "+":
|
|
4332
|
-
for (let
|
|
4416
|
+
for (let d = a; d < o.length; ++d)
|
|
4333
4417
|
f += `
|
|
4334
|
-
` + o[
|
|
4418
|
+
` + o[d][0].slice(l);
|
|
4335
4419
|
f[f.length - 1] !== `
|
|
4336
4420
|
` && (f += `
|
|
4337
4421
|
`);
|
|
@@ -4348,19 +4432,19 @@ function lr({ offset: s, props: e }, t, n) {
|
|
|
4348
4432
|
return n(e[0], "IMPOSSIBLE", "Block scalar header not found"), null;
|
|
4349
4433
|
const { source: i } = e[0], r = i[0];
|
|
4350
4434
|
let o = 0, a = "", l = -1;
|
|
4351
|
-
for (let
|
|
4352
|
-
const p = i[
|
|
4435
|
+
for (let h = 1; h < i.length; ++h) {
|
|
4436
|
+
const p = i[h];
|
|
4353
4437
|
if (!a && (p === "-" || p === "+"))
|
|
4354
4438
|
a = p;
|
|
4355
4439
|
else {
|
|
4356
4440
|
const g = Number(p);
|
|
4357
|
-
!o && g ? o = g : l === -1 && (l = s +
|
|
4441
|
+
!o && g ? o = g : l === -1 && (l = s + h);
|
|
4358
4442
|
}
|
|
4359
4443
|
}
|
|
4360
4444
|
l !== -1 && n(l, "UNEXPECTED_TOKEN", `Block scalar header includes extra characters: ${i}`);
|
|
4361
4445
|
let c = !1, u = "", f = i.length;
|
|
4362
|
-
for (let
|
|
4363
|
-
const p = e[
|
|
4446
|
+
for (let h = 1; h < e.length; ++h) {
|
|
4447
|
+
const p = e[h];
|
|
4364
4448
|
switch (p.type) {
|
|
4365
4449
|
case "space":
|
|
4366
4450
|
c = !0;
|
|
@@ -4378,8 +4462,8 @@ function lr({ offset: s, props: e }, t, n) {
|
|
|
4378
4462
|
default: {
|
|
4379
4463
|
const g = `Unexpected token in block scalar header: ${p.type}`;
|
|
4380
4464
|
n(p, "UNEXPECTED_TOKEN", g);
|
|
4381
|
-
const
|
|
4382
|
-
|
|
4465
|
+
const d = p.source;
|
|
4466
|
+
d && typeof d == "string" && (f += d.length);
|
|
4383
4467
|
}
|
|
4384
4468
|
}
|
|
4385
4469
|
}
|
|
@@ -4394,16 +4478,16 @@ function cr(s) {
|
|
|
4394
4478
|
function ur(s, e, t) {
|
|
4395
4479
|
const { offset: n, type: i, source: r, end: o } = s;
|
|
4396
4480
|
let a, l;
|
|
4397
|
-
const c = (
|
|
4481
|
+
const c = (h, p, g) => t(n + h, p, g);
|
|
4398
4482
|
switch (i) {
|
|
4399
4483
|
case "scalar":
|
|
4400
|
-
a =
|
|
4484
|
+
a = T.PLAIN, l = fr(r, c);
|
|
4401
4485
|
break;
|
|
4402
4486
|
case "single-quoted-scalar":
|
|
4403
|
-
a =
|
|
4487
|
+
a = T.QUOTE_SINGLE, l = hr(r, c);
|
|
4404
4488
|
break;
|
|
4405
4489
|
case "double-quoted-scalar":
|
|
4406
|
-
a =
|
|
4490
|
+
a = T.QUOTE_DOUBLE, l = dr(r, c);
|
|
4407
4491
|
break;
|
|
4408
4492
|
/* istanbul ignore next should not happen */
|
|
4409
4493
|
default:
|
|
@@ -4414,7 +4498,7 @@ function ur(s, e, t) {
|
|
|
4414
4498
|
range: [n, n + r.length, n + r.length]
|
|
4415
4499
|
};
|
|
4416
4500
|
}
|
|
4417
|
-
const u = n + r.length, f =
|
|
4501
|
+
const u = n + r.length, f = Ue(o, u, e, t);
|
|
4418
4502
|
return {
|
|
4419
4503
|
value: l,
|
|
4420
4504
|
type: a,
|
|
@@ -4448,7 +4532,7 @@ function fr(s, e) {
|
|
|
4448
4532
|
}
|
|
4449
4533
|
return t && e(0, "BAD_SCALAR_START", `Plain value cannot start with ${t}`), Xs(s);
|
|
4450
4534
|
}
|
|
4451
|
-
function
|
|
4535
|
+
function hr(s, e) {
|
|
4452
4536
|
return (s[s.length - 1] !== "'" || s.length === 1) && e(s.length, "MISSING_CHAR", "Missing closing 'quote"), Xs(s.slice(1, -1)).replace(/''/g, "'");
|
|
4453
4537
|
}
|
|
4454
4538
|
function Xs(s) {
|
|
@@ -4471,7 +4555,7 @@ function Xs(s) {
|
|
|
4471
4555
|
const a = /[ \t]*(.*)/sy;
|
|
4472
4556
|
return a.lastIndex = o, n = a.exec(s), i + r + (n?.[1] ?? "");
|
|
4473
4557
|
}
|
|
4474
|
-
function
|
|
4558
|
+
function dr(s, e) {
|
|
4475
4559
|
let t = "";
|
|
4476
4560
|
for (let n = 1; n < s.length - 1; ++n) {
|
|
4477
4561
|
const i = s[n];
|
|
@@ -4572,11 +4656,11 @@ function Zs(s, e, t, n) {
|
|
|
4572
4656
|
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
4657
|
let u;
|
|
4574
4658
|
try {
|
|
4575
|
-
const f = c.resolve(i, (
|
|
4576
|
-
u = _(f) ? f : new
|
|
4659
|
+
const f = c.resolve(i, (h) => n(t ?? e, "TAG_RESOLVE_FAILED", h), s.options);
|
|
4660
|
+
u = _(f) ? f : new T(f);
|
|
4577
4661
|
} catch (f) {
|
|
4578
|
-
const
|
|
4579
|
-
n(t ?? e, "TAG_RESOLVE_FAILED",
|
|
4662
|
+
const h = f instanceof Error ? f.message : String(f);
|
|
4663
|
+
n(t ?? e, "TAG_RESOLVE_FAILED", h), u = new T(i);
|
|
4580
4664
|
}
|
|
4581
4665
|
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;
|
|
4582
4666
|
}
|
|
@@ -4626,7 +4710,7 @@ function wr(s, e, t) {
|
|
|
4626
4710
|
}
|
|
4627
4711
|
return s;
|
|
4628
4712
|
}
|
|
4629
|
-
const br = { composeNode: en, composeEmptyNode:
|
|
4713
|
+
const br = { composeNode: en, composeEmptyNode: Ft };
|
|
4630
4714
|
function en(s, e, t, n) {
|
|
4631
4715
|
const i = s.atKey, { spaceBefore: r, comment: o, anchor: a, tag: l } = t;
|
|
4632
4716
|
let c, u = !0;
|
|
@@ -4647,12 +4731,12 @@ function en(s, e, t, n) {
|
|
|
4647
4731
|
break;
|
|
4648
4732
|
default: {
|
|
4649
4733
|
const f = e.type === "error" ? e.message : `Unsupported token (type: ${e.type})`;
|
|
4650
|
-
n(e, "UNEXPECTED_TOKEN", f), c =
|
|
4734
|
+
n(e, "UNEXPECTED_TOKEN", f), c = Ft(s, e.offset, void 0, null, t, n), u = !1;
|
|
4651
4735
|
}
|
|
4652
4736
|
}
|
|
4653
4737
|
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;
|
|
4654
4738
|
}
|
|
4655
|
-
function
|
|
4739
|
+
function Ft(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: a, end: l }, c) {
|
|
4656
4740
|
const u = {
|
|
4657
4741
|
type: "scalar",
|
|
4658
4742
|
offset: wr(e, t, n),
|
|
@@ -4662,13 +4746,13 @@ function Kt(s, e, t, n, { spaceBefore: i, comment: r, anchor: o, tag: a, end: l
|
|
|
4662
4746
|
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;
|
|
4663
4747
|
}
|
|
4664
4748
|
function Sr({ options: s }, { offset: e, source: t, end: n }, i) {
|
|
4665
|
-
const r = new
|
|
4749
|
+
const r = new Et(t.substring(1));
|
|
4666
4750
|
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);
|
|
4667
|
-
const o = e + t.length, a =
|
|
4751
|
+
const o = e + t.length, a = Ue(n, o, s.strict, i);
|
|
4668
4752
|
return r.range = [e, o, a.offset], a.comment && (r.comment = a.comment), r;
|
|
4669
4753
|
}
|
|
4670
4754
|
function vr(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
4671
|
-
const a = Object.assign({ _directives: e }, s), l = new
|
|
4755
|
+
const a = Object.assign({ _directives: e }, s), l = new Pe(void 0, a), c = {
|
|
4672
4756
|
atKey: !1,
|
|
4673
4757
|
atRoot: !0,
|
|
4674
4758
|
directives: l.directives,
|
|
@@ -4682,9 +4766,9 @@ function vr(s, e, { offset: t, start: n, value: i, end: r }, o) {
|
|
|
4682
4766
|
parentIndent: 0,
|
|
4683
4767
|
startOnNewline: !0
|
|
4684
4768
|
});
|
|
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) :
|
|
4686
|
-
const f = l.contents.range[2],
|
|
4687
|
-
return
|
|
4769
|
+
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) : Ft(c, u.end, n, null, u, o);
|
|
4770
|
+
const f = l.contents.range[2], h = Ue(r, f, !1, o);
|
|
4771
|
+
return h.comment && (l.comment = h.comment), l.range = [t, f, h.offset], l;
|
|
4688
4772
|
}
|
|
4689
4773
|
function Se(s) {
|
|
4690
4774
|
if (typeof s == "number")
|
|
@@ -4694,7 +4778,7 @@ function Se(s) {
|
|
|
4694
4778
|
const { offset: e, source: t } = s;
|
|
4695
4779
|
return [e, e + (typeof t == "string" ? t.length : 1)];
|
|
4696
4780
|
}
|
|
4697
|
-
function
|
|
4781
|
+
function ns(s) {
|
|
4698
4782
|
let e = "", t = !1, n = !1;
|
|
4699
4783
|
for (let i = 0; i < s.length; ++i) {
|
|
4700
4784
|
const r = s[i];
|
|
@@ -4714,15 +4798,15 @@ function ss(s) {
|
|
|
4714
4798
|
}
|
|
4715
4799
|
return { comment: e, afterEmptyLine: n };
|
|
4716
4800
|
}
|
|
4717
|
-
class
|
|
4801
|
+
class Tr {
|
|
4718
4802
|
constructor(e = {}) {
|
|
4719
4803
|
this.doc = null, this.atDirectives = !1, this.prelude = [], this.errors = [], this.warnings = [], this.onError = (t, n, i, r) => {
|
|
4720
4804
|
const o = Se(t);
|
|
4721
|
-
r ? this.warnings.push(new sr(o, n, i)) : this.errors.push(new
|
|
4722
|
-
}, this.directives = new
|
|
4805
|
+
r ? this.warnings.push(new sr(o, n, i)) : this.errors.push(new Te(o, n, i));
|
|
4806
|
+
}, this.directives = new x({ version: e.version || "1.2" }), this.options = e;
|
|
4723
4807
|
}
|
|
4724
4808
|
decorate(e, t) {
|
|
4725
|
-
const { comment: n, afterEmptyLine: i } =
|
|
4809
|
+
const { comment: n, afterEmptyLine: i } = ns(this.prelude);
|
|
4726
4810
|
if (n) {
|
|
4727
4811
|
const r = e.contents;
|
|
4728
4812
|
if (t)
|
|
@@ -4730,7 +4814,7 @@ class Nr {
|
|
|
4730
4814
|
${n}` : n;
|
|
4731
4815
|
else if (i || e.directives.docStart || !r)
|
|
4732
4816
|
e.commentBefore = n;
|
|
4733
|
-
else if (
|
|
4817
|
+
else if (A(r) && !r.flow && r.items.length > 0) {
|
|
4734
4818
|
let o = r.items[0];
|
|
4735
4819
|
E(o) && (o = o.key);
|
|
4736
4820
|
const a = o.commentBefore;
|
|
@@ -4751,7 +4835,7 @@ ${o}` : n;
|
|
|
4751
4835
|
*/
|
|
4752
4836
|
streamInfo() {
|
|
4753
4837
|
return {
|
|
4754
|
-
comment:
|
|
4838
|
+
comment: ns(this.prelude).comment,
|
|
4755
4839
|
directives: this.directives,
|
|
4756
4840
|
errors: this.errors,
|
|
4757
4841
|
warnings: this.warnings
|
|
@@ -4790,18 +4874,18 @@ ${o}` : n;
|
|
|
4790
4874
|
this.prelude.push(e.source);
|
|
4791
4875
|
break;
|
|
4792
4876
|
case "error": {
|
|
4793
|
-
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new
|
|
4877
|
+
const t = e.source ? `${e.message}: ${JSON.stringify(e.source)}` : e.message, n = new Te(Se(e), "UNEXPECTED_TOKEN", t);
|
|
4794
4878
|
this.atDirectives || !this.doc ? this.errors.push(n) : this.doc.errors.push(n);
|
|
4795
4879
|
break;
|
|
4796
4880
|
}
|
|
4797
4881
|
case "doc-end": {
|
|
4798
4882
|
if (!this.doc) {
|
|
4799
4883
|
const n = "Unexpected doc-end without preceding document";
|
|
4800
|
-
this.errors.push(new
|
|
4884
|
+
this.errors.push(new Te(Se(e), "UNEXPECTED_TOKEN", n));
|
|
4801
4885
|
break;
|
|
4802
4886
|
}
|
|
4803
4887
|
this.doc.directives.docEnd = !0;
|
|
4804
|
-
const t =
|
|
4888
|
+
const t = Ue(e.end, e.offset + e.source.length, this.doc.options.strict, this.onError);
|
|
4805
4889
|
if (this.decorate(this.doc, !0), t.comment) {
|
|
4806
4890
|
const n = this.doc.comment;
|
|
4807
4891
|
this.doc.comment = n ? `${n}
|
|
@@ -4811,7 +4895,7 @@ ${t.comment}` : t.comment;
|
|
|
4811
4895
|
break;
|
|
4812
4896
|
}
|
|
4813
4897
|
default:
|
|
4814
|
-
this.errors.push(new
|
|
4898
|
+
this.errors.push(new Te(Se(e), "UNEXPECTED_TOKEN", `Unsupported token ${e.type}`));
|
|
4815
4899
|
}
|
|
4816
4900
|
}
|
|
4817
4901
|
/**
|
|
@@ -4824,7 +4908,7 @@ ${t.comment}` : t.comment;
|
|
|
4824
4908
|
if (this.doc)
|
|
4825
4909
|
this.decorate(this.doc, !0), yield this.doc, this.doc = null;
|
|
4826
4910
|
else if (e) {
|
|
4827
|
-
const n = Object.assign({ _directives: this.directives }, this.options), i = new
|
|
4911
|
+
const n = Object.assign({ _directives: this.directives }, this.options), i = new Pe(void 0, n);
|
|
4828
4912
|
this.atDirectives && this.onError(t, "MISSING_CHAR", "Missing directives-end indicator line"), i.range = [0, t, t], this.decorate(i, !1), yield i;
|
|
4829
4913
|
}
|
|
4830
4914
|
}
|
|
@@ -4904,8 +4988,8 @@ function q(s) {
|
|
|
4904
4988
|
return !1;
|
|
4905
4989
|
}
|
|
4906
4990
|
}
|
|
4907
|
-
const
|
|
4908
|
-
\r `),
|
|
4991
|
+
const is = new Set("0123456789ABCDEFabcdef"), Nr = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"), qe = new Set(",[]{}"), Or = new Set(` ,[]{}
|
|
4992
|
+
\r `), gt = (s) => !s || Or.has(s);
|
|
4909
4993
|
class _r {
|
|
4910
4994
|
constructor() {
|
|
4911
4995
|
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;
|
|
@@ -5066,7 +5150,7 @@ class _r {
|
|
|
5066
5150
|
case "]":
|
|
5067
5151
|
return yield* this.pushCount(1), "doc";
|
|
5068
5152
|
case "*":
|
|
5069
|
-
return yield* this.pushUntil(
|
|
5153
|
+
return yield* this.pushUntil(gt), "doc";
|
|
5070
5154
|
case '"':
|
|
5071
5155
|
case "'":
|
|
5072
5156
|
return yield* this.parseQuotedScalar();
|
|
@@ -5102,7 +5186,7 @@ class _r {
|
|
|
5102
5186
|
case "]":
|
|
5103
5187
|
return yield* this.pushCount(1), this.flowKey = !0, this.flowLevel -= 1, this.flowLevel ? "flow" : "doc";
|
|
5104
5188
|
case "*":
|
|
5105
|
-
return yield* this.pushUntil(
|
|
5189
|
+
return yield* this.pushUntil(gt), "flow";
|
|
5106
5190
|
case '"':
|
|
5107
5191
|
case "'":
|
|
5108
5192
|
return this.flowKey = !0, yield* this.parseQuotedScalar();
|
|
@@ -5269,7 +5353,7 @@ class _r {
|
|
|
5269
5353
|
case "!":
|
|
5270
5354
|
return (yield* this.pushTag()) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
5271
5355
|
case "&":
|
|
5272
|
-
return (yield* this.pushUntil(
|
|
5356
|
+
return (yield* this.pushUntil(gt)) + (yield* this.pushSpaces(!0)) + (yield* this.pushIndicators());
|
|
5273
5357
|
case "-":
|
|
5274
5358
|
// this is an error
|
|
5275
5359
|
case "?":
|
|
@@ -5291,9 +5375,9 @@ class _r {
|
|
|
5291
5375
|
} else {
|
|
5292
5376
|
let e = this.pos + 1, t = this.buffer[e];
|
|
5293
5377
|
for (; t; )
|
|
5294
|
-
if (
|
|
5378
|
+
if (Nr.has(t))
|
|
5295
5379
|
t = this.buffer[++e];
|
|
5296
|
-
else if (t === "%" &&
|
|
5380
|
+
else if (t === "%" && is.has(this.buffer[e + 1]) && is.has(this.buffer[e + 2]))
|
|
5297
5381
|
t = this.buffer[e += 3];
|
|
5298
5382
|
else
|
|
5299
5383
|
break;
|
|
@@ -5344,7 +5428,7 @@ function Q(s, e) {
|
|
|
5344
5428
|
return !0;
|
|
5345
5429
|
return !1;
|
|
5346
5430
|
}
|
|
5347
|
-
function
|
|
5431
|
+
function rs(s) {
|
|
5348
5432
|
for (let e = 0; e < s.length; ++e)
|
|
5349
5433
|
switch (s[e].type) {
|
|
5350
5434
|
case "space":
|
|
@@ -5400,12 +5484,12 @@ function le(s) {
|
|
|
5400
5484
|
;
|
|
5401
5485
|
return s.splice(e, s.length);
|
|
5402
5486
|
}
|
|
5403
|
-
function
|
|
5487
|
+
function os(s) {
|
|
5404
5488
|
if (s.start.type === "flow-seq-start")
|
|
5405
5489
|
for (const e of s.items)
|
|
5406
5490
|
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);
|
|
5407
5491
|
}
|
|
5408
|
-
class
|
|
5492
|
+
class Ar {
|
|
5409
5493
|
/**
|
|
5410
5494
|
* @param onNewLine - If defined, called separately with the start position of
|
|
5411
5495
|
* each new line (in `parse()`, including the start of input).
|
|
@@ -5524,7 +5608,7 @@ class Lr {
|
|
|
5524
5608
|
yield t;
|
|
5525
5609
|
else {
|
|
5526
5610
|
const n = this.peek(1);
|
|
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" &&
|
|
5611
|
+
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" && os(t), n.type) {
|
|
5528
5612
|
case "document":
|
|
5529
5613
|
n.value = t;
|
|
5530
5614
|
break;
|
|
@@ -5560,7 +5644,7 @@ class Lr {
|
|
|
5560
5644
|
}
|
|
5561
5645
|
if ((n.type === "document" || n.type === "block-map" || n.type === "block-seq") && (t.type === "block-map" || t.type === "block-seq")) {
|
|
5562
5646
|
const i = t.items[t.items.length - 1];
|
|
5563
|
-
i && !i.sep && !i.value && i.start.length > 0 &&
|
|
5647
|
+
i && !i.sep && !i.value && i.start.length > 0 && rs(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));
|
|
5564
5648
|
}
|
|
5565
5649
|
}
|
|
5566
5650
|
}
|
|
@@ -5598,7 +5682,7 @@ class Lr {
|
|
|
5598
5682
|
return yield* this.lineEnd(e);
|
|
5599
5683
|
switch (this.type) {
|
|
5600
5684
|
case "doc-start": {
|
|
5601
|
-
|
|
5685
|
+
rs(e.start) !== -1 ? (yield* this.pop(), yield* this.step()) : e.start.push(this.sourceToken);
|
|
5602
5686
|
return;
|
|
5603
5687
|
}
|
|
5604
5688
|
case "anchor":
|
|
@@ -5877,7 +5961,7 @@ class Lr {
|
|
|
5877
5961
|
yield* this.pop(), yield* this.step();
|
|
5878
5962
|
else if (this.type === "map-value-ind" && n.type !== "flow-collection") {
|
|
5879
5963
|
const i = Ke(n), r = le(i);
|
|
5880
|
-
|
|
5964
|
+
os(e);
|
|
5881
5965
|
const o = e.end.splice(1, e.end.length);
|
|
5882
5966
|
o.push(this.sourceToken);
|
|
5883
5967
|
const a = {
|
|
@@ -5984,21 +6068,21 @@ class Lr {
|
|
|
5984
6068
|
}
|
|
5985
6069
|
}
|
|
5986
6070
|
}
|
|
5987
|
-
function
|
|
6071
|
+
function Lr(s) {
|
|
5988
6072
|
const e = s.prettyErrors !== !1;
|
|
5989
6073
|
return { lineCounter: s.lineCounter || e && new Cr() || null, prettyErrors: e };
|
|
5990
6074
|
}
|
|
5991
6075
|
function Er(s, e = {}) {
|
|
5992
|
-
const { lineCounter: t, prettyErrors: n } =
|
|
6076
|
+
const { lineCounter: t, prettyErrors: n } = Lr(e), i = new Ar(t?.addNewLine), r = new Tr(e);
|
|
5993
6077
|
let o = null;
|
|
5994
6078
|
for (const a of r.compose(i.parse(s), !0, s.length))
|
|
5995
6079
|
if (!o)
|
|
5996
6080
|
o = a;
|
|
5997
6081
|
else if (o.options.logLevel !== "silent") {
|
|
5998
|
-
o.errors.push(new
|
|
6082
|
+
o.errors.push(new Te(a.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
5999
6083
|
break;
|
|
6000
6084
|
}
|
|
6001
|
-
return n && t && (o.errors.forEach(
|
|
6085
|
+
return n && t && (o.errors.forEach(ts(s, t)), o.warnings.forEach(ts(s, t))), o;
|
|
6002
6086
|
}
|
|
6003
6087
|
function $r(s, e, t) {
|
|
6004
6088
|
let n;
|
|
@@ -6023,7 +6107,7 @@ function on(s, e, t) {
|
|
|
6023
6107
|
if (!i)
|
|
6024
6108
|
return;
|
|
6025
6109
|
}
|
|
6026
|
-
return $e(s) && !n ? s.toString(t) : new
|
|
6110
|
+
return $e(s) && !n ? s.toString(t) : new Pe(s, n, t).toString(t);
|
|
6027
6111
|
}
|
|
6028
6112
|
const jr = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/;
|
|
6029
6113
|
function an(s) {
|
|
@@ -6034,21 +6118,21 @@ function an(s) {
|
|
|
6034
6118
|
} : { data: {}, content: s };
|
|
6035
6119
|
}
|
|
6036
6120
|
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":
|
|
6040
|
-
"../../../../skills/taskless-logout/SKILL.md":
|
|
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
|
-
}),
|
|
6121
|
+
"../../../../skills/use-taskless-check/SKILL.md": ui,
|
|
6122
|
+
"../../../../skills/use-taskless-info/SKILL.md": fi,
|
|
6123
|
+
"../../../../skills/use-taskless-login/SKILL.md": hi,
|
|
6124
|
+
"../../../../skills/use-taskless-logout/SKILL.md": di,
|
|
6125
|
+
"../../../../skills/use-taskless-rule-create/SKILL.md": pi,
|
|
6126
|
+
"../../../../skills/use-taskless-rule-delete/SKILL.md": mi,
|
|
6127
|
+
"../../../../skills/use-taskless-update-engine/SKILL.md": gi
|
|
6128
|
+
}), xr = /* @__PURE__ */ Object.assign({
|
|
6045
6129
|
"../../../../commands/taskless/check.md": yi,
|
|
6046
6130
|
"../../../../commands/taskless/info.md": ki,
|
|
6047
6131
|
"../../../../commands/taskless/login.md": wi,
|
|
6048
6132
|
"../../../../commands/taskless/logout.md": bi,
|
|
6049
6133
|
"../../../../commands/taskless/rule.md": Si,
|
|
6050
6134
|
"../../../../commands/taskless/update-engine.md": vi
|
|
6051
|
-
}),
|
|
6135
|
+
}), Pr = [
|
|
6052
6136
|
{
|
|
6053
6137
|
name: "Claude Code",
|
|
6054
6138
|
dir: ".claude",
|
|
@@ -6062,14 +6146,14 @@ const Rr = /* @__PURE__ */ Object.assign({
|
|
|
6062
6146
|
];
|
|
6063
6147
|
async function ln(s) {
|
|
6064
6148
|
return (await Promise.all(
|
|
6065
|
-
|
|
6149
|
+
Pr.map(async (t) => await hs(C(s, t.dir)).then((i) => i.isDirectory()).catch(() => !1) ? t : void 0)
|
|
6066
6150
|
)).filter((t) => t !== void 0);
|
|
6067
6151
|
}
|
|
6068
6152
|
function cn() {
|
|
6069
6153
|
return Object.entries(Rr).map(([s, e]) => {
|
|
6070
6154
|
const t = an(e), n = t.data;
|
|
6071
6155
|
return {
|
|
6072
|
-
name: n.name ??
|
|
6156
|
+
name: n.name ?? fs(Nt(s)),
|
|
6073
6157
|
description: n.description ?? "",
|
|
6074
6158
|
content: e,
|
|
6075
6159
|
body: t.content,
|
|
@@ -6077,14 +6161,29 @@ function cn() {
|
|
|
6077
6161
|
};
|
|
6078
6162
|
});
|
|
6079
6163
|
}
|
|
6080
|
-
function
|
|
6081
|
-
return Object.entries(
|
|
6082
|
-
filename:
|
|
6164
|
+
function Ur() {
|
|
6165
|
+
return Object.entries(xr).map(([s, e]) => ({
|
|
6166
|
+
filename: fs(s),
|
|
6083
6167
|
content: e
|
|
6084
6168
|
}));
|
|
6085
6169
|
}
|
|
6086
|
-
async function Mr(s, e
|
|
6170
|
+
async function Mr(s, e) {
|
|
6171
|
+
const t = C(s, e.dir, e.skills.path);
|
|
6172
|
+
let n;
|
|
6173
|
+
try {
|
|
6174
|
+
n = await Ot(t);
|
|
6175
|
+
} catch {
|
|
6176
|
+
return;
|
|
6177
|
+
}
|
|
6178
|
+
const i = n.filter(
|
|
6179
|
+
(r) => r.startsWith("taskless-") && !r.startsWith("use-taskless-")
|
|
6180
|
+
);
|
|
6181
|
+
for (const r of i)
|
|
6182
|
+
await We(C(t, r), { recursive: !0, force: !0 });
|
|
6183
|
+
}
|
|
6184
|
+
async function Dr(s, e, t, n) {
|
|
6087
6185
|
const i = [], r = [];
|
|
6186
|
+
await Mr(s, e);
|
|
6088
6187
|
for (const o of t) {
|
|
6089
6188
|
const a = C(s, e.dir, e.skills.path, o.name);
|
|
6090
6189
|
await _e(a, { recursive: !0 }), await Ce(C(a, "SKILL.md"), o.content, "utf8"), i.push(o.name);
|
|
@@ -6101,7 +6200,7 @@ async function Mr(s, e, t, n) {
|
|
|
6101
6200
|
}
|
|
6102
6201
|
return { skills: i, commands: r };
|
|
6103
6202
|
}
|
|
6104
|
-
async function
|
|
6203
|
+
async function Br(s) {
|
|
6105
6204
|
try {
|
|
6106
6205
|
const e = await Ee(s, "utf8");
|
|
6107
6206
|
return an(e).data.metadata?.version;
|
|
@@ -6109,7 +6208,7 @@ async function Dr(s) {
|
|
|
6109
6208
|
return;
|
|
6110
6209
|
}
|
|
6111
6210
|
}
|
|
6112
|
-
async function
|
|
6211
|
+
async function qr(s) {
|
|
6113
6212
|
const e = cn(), t = await ln(s), n = [];
|
|
6114
6213
|
for (const i of t) {
|
|
6115
6214
|
const r = [];
|
|
@@ -6120,7 +6219,7 @@ async function Br(s) {
|
|
|
6120
6219
|
i.skills.path,
|
|
6121
6220
|
o.name,
|
|
6122
6221
|
"SKILL.md"
|
|
6123
|
-
), l = await
|
|
6222
|
+
), l = await Br(a), c = o.metadata.version ?? "unknown";
|
|
6124
6223
|
r.push({
|
|
6125
6224
|
name: o.name,
|
|
6126
6225
|
installedVersion: l,
|
|
@@ -6132,7 +6231,7 @@ async function Br(s) {
|
|
|
6132
6231
|
}
|
|
6133
6232
|
return n;
|
|
6134
6233
|
}
|
|
6135
|
-
const
|
|
6234
|
+
const Kr = {
|
|
6136
6235
|
meta: {
|
|
6137
6236
|
name: "init",
|
|
6138
6237
|
description: "Install or update Taskless skills"
|
|
@@ -6145,7 +6244,7 @@ const qr = {
|
|
|
6145
6244
|
}
|
|
6146
6245
|
},
|
|
6147
6246
|
async run({ args: s }) {
|
|
6148
|
-
const e = H(s.dir ?? process.cwd()), t = cn(), n =
|
|
6247
|
+
const e = H(s.dir ?? process.cwd()), t = cn(), n = Ur(), i = await ln(e);
|
|
6149
6248
|
if (i.length === 0) {
|
|
6150
6249
|
console.log(
|
|
6151
6250
|
`No supported tool directories detected.
|
|
@@ -6157,7 +6256,7 @@ Alternative installation methods:
|
|
|
6157
6256
|
return;
|
|
6158
6257
|
}
|
|
6159
6258
|
for (const r of i) {
|
|
6160
|
-
const o = await
|
|
6259
|
+
const o = await Dr(e, r, t, n);
|
|
6161
6260
|
console.log(
|
|
6162
6261
|
`${r.name}: installed ${String(o.skills.length)} skill(s)`
|
|
6163
6262
|
);
|
|
@@ -6169,7 +6268,7 @@ Alternative installation methods:
|
|
|
6169
6268
|
}
|
|
6170
6269
|
}
|
|
6171
6270
|
};
|
|
6172
|
-
async function
|
|
6271
|
+
async function Fr(s) {
|
|
6173
6272
|
try {
|
|
6174
6273
|
const e = ne(), t = await fetch(`${e}/api/whoami`, {
|
|
6175
6274
|
headers: { Authorization: `Bearer ${s}` }
|
|
@@ -6179,7 +6278,7 @@ async function Kr(s) {
|
|
|
6179
6278
|
return;
|
|
6180
6279
|
}
|
|
6181
6280
|
}
|
|
6182
|
-
const
|
|
6281
|
+
const Jr = {
|
|
6183
6282
|
meta: {
|
|
6184
6283
|
name: "info",
|
|
6185
6284
|
description: "Show Taskless CLI information"
|
|
@@ -6192,10 +6291,10 @@ const Fr = {
|
|
|
6192
6291
|
}
|
|
6193
6292
|
},
|
|
6194
6293
|
async run({ args: s }) {
|
|
6195
|
-
const e = H(s.dir ?? process.cwd()), [t, n] = await Promise.all([
|
|
6294
|
+
const e = H(s.dir ?? process.cwd()), [t, n] = await Promise.all([qr(e), ze()]);
|
|
6196
6295
|
let i;
|
|
6197
6296
|
if (n) {
|
|
6198
|
-
const r = await
|
|
6297
|
+
const r = await Fr(n);
|
|
6199
6298
|
r && (i = {
|
|
6200
6299
|
user: r.user,
|
|
6201
6300
|
email: r.email,
|
|
@@ -6205,14 +6304,14 @@ const Fr = {
|
|
|
6205
6304
|
console.log(
|
|
6206
6305
|
JSON.stringify({
|
|
6207
6306
|
success: !0,
|
|
6208
|
-
version: "0.1.
|
|
6307
|
+
version: "0.1.4",
|
|
6209
6308
|
tools: t,
|
|
6210
6309
|
loggedIn: n !== void 0,
|
|
6211
6310
|
auth: i
|
|
6212
6311
|
})
|
|
6213
6312
|
);
|
|
6214
6313
|
}
|
|
6215
|
-
},
|
|
6314
|
+
}, Vr = `Authenticate with taskless.io
|
|
6216
6315
|
|
|
6217
6316
|
Starts a device authorization flow. The CLI displays a URL and a one-time
|
|
6218
6317
|
code. Open the URL in a browser, enter the code, and authorize access.
|
|
@@ -6229,7 +6328,7 @@ Environment Variable:
|
|
|
6229
6328
|
|
|
6230
6329
|
Examples:
|
|
6231
6330
|
taskless auth login
|
|
6232
|
-
`,
|
|
6331
|
+
`, Wr = `Remove saved authentication
|
|
6233
6332
|
|
|
6234
6333
|
Deletes the locally saved authentication token. If using the
|
|
6235
6334
|
TASKLESS_TOKEN environment variable, unset it separately.
|
|
@@ -6242,14 +6341,14 @@ Credential Storage:
|
|
|
6242
6341
|
|
|
6243
6342
|
Examples:
|
|
6244
6343
|
taskless auth logout
|
|
6245
|
-
`,
|
|
6344
|
+
`, Yr = `Manage authentication with taskless.io
|
|
6246
6345
|
|
|
6247
6346
|
Commands:
|
|
6248
6347
|
login Authenticate via device flow
|
|
6249
6348
|
logout Remove saved credentials
|
|
6250
6349
|
|
|
6251
6350
|
Run \`taskless help auth <command>\` for details on a specific command.
|
|
6252
|
-
`,
|
|
6351
|
+
`, Hr = `Run Taskless rules against your codebase
|
|
6253
6352
|
|
|
6254
6353
|
Scans your project using ast-grep rules defined in .taskless/rules/.
|
|
6255
6354
|
|
|
@@ -6276,7 +6375,7 @@ Examples:
|
|
|
6276
6375
|
taskless check
|
|
6277
6376
|
taskless check -d ./my-project
|
|
6278
6377
|
taskless check --json
|
|
6279
|
-
`,
|
|
6378
|
+
`, Gr = `Show Taskless CLI information
|
|
6280
6379
|
|
|
6281
6380
|
Outputs a JSON object with the CLI version, installed tool/skill status,
|
|
6282
6381
|
and authentication state.
|
|
@@ -6297,7 +6396,7 @@ Output:
|
|
|
6297
6396
|
Examples:
|
|
6298
6397
|
taskless info
|
|
6299
6398
|
taskless info -d ./my-project
|
|
6300
|
-
`,
|
|
6399
|
+
`, zr = `Install Taskless skills
|
|
6301
6400
|
|
|
6302
6401
|
Detects supported coding agent tools in your project and installs
|
|
6303
6402
|
Taskless skills and commands for each one. Currently supports Claude Code.
|
|
@@ -6321,7 +6420,7 @@ Alternative Installation:
|
|
|
6321
6420
|
Examples:
|
|
6322
6421
|
taskless init
|
|
6323
6422
|
taskless init -d ./my-project
|
|
6324
|
-
`,
|
|
6423
|
+
`, Qr = `Create a new rule from a JSON file
|
|
6325
6424
|
|
|
6326
6425
|
Reads a JSON file describing the desired rule, submits it to the Taskless
|
|
6327
6426
|
API for generation, and writes the resulting rule and test files to
|
|
@@ -6351,7 +6450,7 @@ Output:
|
|
|
6351
6450
|
Examples:
|
|
6352
6451
|
taskless rules create --from request.json
|
|
6353
6452
|
taskless rules create --from .taskless/.tmp-rule-request.json --json
|
|
6354
|
-
`,
|
|
6453
|
+
`, Xr = `Delete a rule and its test files
|
|
6355
6454
|
|
|
6356
6455
|
Removes a rule YAML file and any associated test files from the project.
|
|
6357
6456
|
|
|
@@ -6371,14 +6470,14 @@ Exit Codes:
|
|
|
6371
6470
|
Examples:
|
|
6372
6471
|
taskless rules delete no-console-log
|
|
6373
6472
|
taskless rules delete detect-innerhtml -d ./my-project
|
|
6374
|
-
`,
|
|
6473
|
+
`, Zr = `Manage Taskless rules
|
|
6375
6474
|
|
|
6376
6475
|
Commands:
|
|
6377
6476
|
create Create a new rule from a description
|
|
6378
6477
|
delete Delete a rule and its test files
|
|
6379
6478
|
|
|
6380
6479
|
Run \`taskless help rules <command>\` for details on a specific command.
|
|
6381
|
-
`,
|
|
6480
|
+
`, eo = `Request a scaffold upgrade for the .taskless/ engine directory
|
|
6382
6481
|
|
|
6383
6482
|
Sends your project's current scaffold version to the Taskless backend,
|
|
6384
6483
|
which creates a pull request to upgrade the .taskless/ directory. The
|
|
@@ -6406,35 +6505,35 @@ Examples:
|
|
|
6406
6505
|
taskless update-engine
|
|
6407
6506
|
taskless update-engine --json
|
|
6408
6507
|
taskless update-engine -d ./my-project
|
|
6409
|
-
`,
|
|
6410
|
-
"../help/auth-login.txt":
|
|
6411
|
-
"../help/auth-logout.txt":
|
|
6412
|
-
"../help/auth.txt":
|
|
6413
|
-
"../help/check.txt":
|
|
6414
|
-
"../help/info.txt":
|
|
6415
|
-
"../help/init.txt":
|
|
6416
|
-
"../help/rules-create.txt":
|
|
6417
|
-
"../help/rules-delete.txt":
|
|
6418
|
-
"../help/rules.txt":
|
|
6419
|
-
"../help/update-engine.txt":
|
|
6508
|
+
`, to = /* @__PURE__ */ Object.assign({
|
|
6509
|
+
"../help/auth-login.txt": Vr,
|
|
6510
|
+
"../help/auth-logout.txt": Wr,
|
|
6511
|
+
"../help/auth.txt": Yr,
|
|
6512
|
+
"../help/check.txt": Hr,
|
|
6513
|
+
"../help/info.txt": Gr,
|
|
6514
|
+
"../help/init.txt": zr,
|
|
6515
|
+
"../help/rules-create.txt": Qr,
|
|
6516
|
+
"../help/rules-delete.txt": Xr,
|
|
6517
|
+
"../help/rules.txt": Zr,
|
|
6518
|
+
"../help/update-engine.txt": eo
|
|
6420
6519
|
});
|
|
6421
|
-
function
|
|
6520
|
+
function so() {
|
|
6422
6521
|
const s = /* @__PURE__ */ new Map();
|
|
6423
|
-
for (const [e, t] of Object.entries(
|
|
6522
|
+
for (const [e, t] of Object.entries(to)) {
|
|
6424
6523
|
const n = e.split("/").pop()?.replace(/\.txt$/, "");
|
|
6425
6524
|
n && s.set(n, t);
|
|
6426
6525
|
}
|
|
6427
6526
|
return s;
|
|
6428
6527
|
}
|
|
6429
|
-
const
|
|
6430
|
-
async function
|
|
6528
|
+
const no = so();
|
|
6529
|
+
async function as(s) {
|
|
6431
6530
|
return typeof s == "function" ? s() : s;
|
|
6432
6531
|
}
|
|
6433
|
-
async function
|
|
6434
|
-
const e = await
|
|
6435
|
-
return (e.meta ? await
|
|
6532
|
+
async function io(s) {
|
|
6533
|
+
const e = await as(s);
|
|
6534
|
+
return (e.meta ? await as(e.meta) : void 0)?.description ?? "";
|
|
6436
6535
|
}
|
|
6437
|
-
function
|
|
6536
|
+
function ro(s) {
|
|
6438
6537
|
return {
|
|
6439
6538
|
meta: {
|
|
6440
6539
|
name: "help",
|
|
@@ -6450,7 +6549,7 @@ function io(s) {
|
|
|
6450
6549
|
const r = [];
|
|
6451
6550
|
for (const [a, l] of Object.entries(s)) {
|
|
6452
6551
|
if (a === "help") continue;
|
|
6453
|
-
const c = await
|
|
6552
|
+
const c = await io(l);
|
|
6454
6553
|
r.push([a, c]);
|
|
6455
6554
|
}
|
|
6456
6555
|
const o = Math.max(...r.map(([a]) => a.length));
|
|
@@ -6461,7 +6560,7 @@ function io(s) {
|
|
|
6461
6560
|
);
|
|
6462
6561
|
return;
|
|
6463
6562
|
}
|
|
6464
|
-
const n = t.join("-"), i =
|
|
6563
|
+
const n = t.join("-"), i = no.get(n);
|
|
6465
6564
|
i ? console.log(i.trimEnd()) : (console.error(`Unknown command: ${t.join(" ")}`), console.error("Run `taskless help` for available commands."), process.exitCode = 1);
|
|
6466
6565
|
}
|
|
6467
6566
|
};
|
|
@@ -6491,7 +6590,7 @@ async function un(s) {
|
|
|
6491
6590
|
`Invalid spec version "${n.version}" in .taskless/taskless.json. Expected YYYY-MM-DD format.`
|
|
6492
6591
|
);
|
|
6493
6592
|
let i;
|
|
6494
|
-
for (const r of Object.values(
|
|
6593
|
+
for (const r of Object.values(Ct))
|
|
6495
6594
|
(i === void 0 || r < i) && (i = r);
|
|
6496
6595
|
if (i && n.version < i)
|
|
6497
6596
|
throw new Error(
|
|
@@ -6503,9 +6602,9 @@ async function un(s) {
|
|
|
6503
6602
|
repositoryUrl: typeof n.repositoryUrl == "string" ? n.repositoryUrl : void 0
|
|
6504
6603
|
};
|
|
6505
6604
|
}
|
|
6506
|
-
function
|
|
6605
|
+
function oo(s) {
|
|
6507
6606
|
if (!Ss("rules create", s.version)) {
|
|
6508
|
-
const e =
|
|
6607
|
+
const e = Ct["rules create"];
|
|
6509
6608
|
return {
|
|
6510
6609
|
valid: !1,
|
|
6511
6610
|
error: `Scaffold version ${s.version} is below the minimum ${e} required for 'taskless rules create'. Run \`taskless update-engine\` to update.`
|
|
@@ -6519,7 +6618,7 @@ function ro(s) {
|
|
|
6519
6618
|
error: 'Missing "repositoryUrl" in .taskless/taskless.json. This field is required for rule generation.'
|
|
6520
6619
|
} : { valid: !0 };
|
|
6521
6620
|
}
|
|
6522
|
-
class
|
|
6621
|
+
class ao {
|
|
6523
6622
|
async submitRule(e, t) {
|
|
6524
6623
|
const n = ne(), i = await fetch(`${n}/api/rule`, {
|
|
6525
6624
|
method: "POST",
|
|
@@ -6563,14 +6662,14 @@ class oo {
|
|
|
6563
6662
|
return await i.json();
|
|
6564
6663
|
}
|
|
6565
6664
|
}
|
|
6566
|
-
const
|
|
6567
|
-
async function
|
|
6665
|
+
const ls = new ao();
|
|
6666
|
+
async function lo(s, e) {
|
|
6568
6667
|
const t = C(s, ".taskless", "rules");
|
|
6569
6668
|
await _e(t, { recursive: !0 });
|
|
6570
6669
|
const n = C(t, `${e.id}.yml`);
|
|
6571
6670
|
return await Ce(n, on(e.content, { lineWidth: 0 }), "utf8"), n;
|
|
6572
6671
|
}
|
|
6573
|
-
async function
|
|
6672
|
+
async function co(s, e, t) {
|
|
6574
6673
|
const n = C(s, ".taskless", "rule-tests");
|
|
6575
6674
|
await _e(n, { recursive: !0 });
|
|
6576
6675
|
const i = C(n, `${e.id}-${t}-test.yml`), r = {
|
|
@@ -6580,32 +6679,32 @@ async function lo(s, e, t) {
|
|
|
6580
6679
|
};
|
|
6581
6680
|
return await Ce(i, on(r, { lineWidth: 0 }), "utf8"), i;
|
|
6582
6681
|
}
|
|
6583
|
-
async function
|
|
6682
|
+
async function uo(s, e) {
|
|
6584
6683
|
const t = C(s, ".taskless", "rules"), n = C(t, `${e}.yml`);
|
|
6585
6684
|
let i = !1;
|
|
6586
6685
|
try {
|
|
6587
|
-
await
|
|
6686
|
+
await We(n), i = !0;
|
|
6588
6687
|
} catch {
|
|
6589
6688
|
return !1;
|
|
6590
6689
|
}
|
|
6591
6690
|
const r = C(s, ".taskless", "rule-tests");
|
|
6592
6691
|
try {
|
|
6593
|
-
const a = (await
|
|
6692
|
+
const a = (await Ot(r)).filter(
|
|
6594
6693
|
(l) => l.startsWith(`${e}-`) && l.endsWith("-test.yml")
|
|
6595
6694
|
);
|
|
6596
6695
|
await Promise.all(
|
|
6597
|
-
a.map((l) =>
|
|
6696
|
+
a.map((l) => We(C(r, l)).catch(() => {
|
|
6598
6697
|
}))
|
|
6599
6698
|
);
|
|
6600
6699
|
} catch {
|
|
6601
6700
|
}
|
|
6602
6701
|
return i;
|
|
6603
6702
|
}
|
|
6604
|
-
function
|
|
6703
|
+
function fo() {
|
|
6605
6704
|
const s = /* @__PURE__ */ new Date(), e = String(s.getFullYear()), t = String(s.getMonth() + 1).padStart(2, "0"), n = String(s.getDate()).padStart(2, "0");
|
|
6606
6705
|
return `${e}${t}${n}`;
|
|
6607
6706
|
}
|
|
6608
|
-
const
|
|
6707
|
+
const ho = 15e3, po = {
|
|
6609
6708
|
meta: {
|
|
6610
6709
|
name: "create",
|
|
6611
6710
|
description: "Create a new rule from a JSON file (use --from to specify the input file)"
|
|
@@ -6657,15 +6756,15 @@ const fo = 15e3, ho = {
|
|
|
6657
6756
|
`Error: ${c instanceof Error ? c.message : String(c)}`
|
|
6658
6757
|
), process.exit(1);
|
|
6659
6758
|
}
|
|
6660
|
-
const o =
|
|
6759
|
+
const o = oo(r);
|
|
6661
6760
|
o.valid || (console.error(`Error: ${o.error}`), process.exit(1));
|
|
6662
|
-
const a = await
|
|
6761
|
+
const a = await ze();
|
|
6663
6762
|
a || (console.error(
|
|
6664
6763
|
"Error: Authentication required. Run `taskless auth login` first."
|
|
6665
6764
|
), process.exit(1));
|
|
6666
6765
|
let l;
|
|
6667
6766
|
try {
|
|
6668
|
-
l = (await
|
|
6767
|
+
l = (await ls.submitRule(a, {
|
|
6669
6768
|
orgId: r.orgId,
|
|
6670
6769
|
repositoryUrl: r.repositoryUrl,
|
|
6671
6770
|
prompt: i.prompt,
|
|
@@ -6679,10 +6778,10 @@ const fo = 15e3, ho = {
|
|
|
6679
6778
|
), process.exit(1);
|
|
6680
6779
|
}
|
|
6681
6780
|
for (console.error(`Rule submitted (${l}). Waiting for generation...`); ; ) {
|
|
6682
|
-
await new Promise((u) => setTimeout(u,
|
|
6781
|
+
await new Promise((u) => setTimeout(u, ho));
|
|
6683
6782
|
let c;
|
|
6684
6783
|
try {
|
|
6685
|
-
c = await
|
|
6784
|
+
c = await ls.pollRuleStatus(a, l);
|
|
6686
6785
|
} catch (u) {
|
|
6687
6786
|
console.error(
|
|
6688
6787
|
`Error: ${u instanceof Error ? u.message : String(u)}`
|
|
@@ -6702,11 +6801,11 @@ const fo = 15e3, ho = {
|
|
|
6702
6801
|
break;
|
|
6703
6802
|
}
|
|
6704
6803
|
case "generated": {
|
|
6705
|
-
const u =
|
|
6706
|
-
for (const
|
|
6707
|
-
const p = await
|
|
6708
|
-
if (f.push(p),
|
|
6709
|
-
const g = await
|
|
6804
|
+
const u = fo(), f = [];
|
|
6805
|
+
for (const h of c.rules) {
|
|
6806
|
+
const p = await lo(e, h);
|
|
6807
|
+
if (f.push(p), h.tests) {
|
|
6808
|
+
const g = await co(e, h, u);
|
|
6710
6809
|
f.push(g);
|
|
6711
6810
|
}
|
|
6712
6811
|
}
|
|
@@ -6715,15 +6814,15 @@ const fo = 15e3, ho = {
|
|
|
6715
6814
|
JSON.stringify({
|
|
6716
6815
|
success: !0,
|
|
6717
6816
|
ruleId: l,
|
|
6718
|
-
rules: c.rules.map((
|
|
6817
|
+
rules: c.rules.map((h) => h.id),
|
|
6719
6818
|
files: f
|
|
6720
6819
|
})
|
|
6721
6820
|
);
|
|
6722
6821
|
else {
|
|
6723
6822
|
console.log(`Generated ${String(c.rules.length)} rule(s):
|
|
6724
6823
|
`);
|
|
6725
|
-
for (const
|
|
6726
|
-
console.log(` ${
|
|
6824
|
+
for (const h of f)
|
|
6825
|
+
console.log(` ${h}`);
|
|
6727
6826
|
}
|
|
6728
6827
|
return;
|
|
6729
6828
|
}
|
|
@@ -6736,7 +6835,7 @@ const fo = 15e3, ho = {
|
|
|
6736
6835
|
}
|
|
6737
6836
|
}
|
|
6738
6837
|
}
|
|
6739
|
-
},
|
|
6838
|
+
}, mo = {
|
|
6740
6839
|
meta: {
|
|
6741
6840
|
name: "delete",
|
|
6742
6841
|
description: "Delete a rule and its test files"
|
|
@@ -6755,21 +6854,21 @@ const fo = 15e3, ho = {
|
|
|
6755
6854
|
},
|
|
6756
6855
|
async run({ args: s }) {
|
|
6757
6856
|
const e = H(s.dir ?? process.cwd()), t = s.id;
|
|
6758
|
-
await
|
|
6857
|
+
await uo(e, t) ? console.log(`Deleted rule "${t}" and associated test files.`) : (console.error(
|
|
6759
6858
|
`Error: Rule "${t}" not found in .taskless/rules/${t}.yml`
|
|
6760
6859
|
), process.exit(1));
|
|
6761
6860
|
}
|
|
6762
|
-
},
|
|
6861
|
+
}, go = {
|
|
6763
6862
|
meta: {
|
|
6764
6863
|
name: "rules",
|
|
6765
6864
|
description: "Manage Taskless rules"
|
|
6766
6865
|
},
|
|
6767
6866
|
subCommands: {
|
|
6768
|
-
create:
|
|
6769
|
-
delete:
|
|
6867
|
+
create: po,
|
|
6868
|
+
delete: mo
|
|
6770
6869
|
}
|
|
6771
6870
|
};
|
|
6772
|
-
class
|
|
6871
|
+
class yo {
|
|
6773
6872
|
async submitUpdate(e, t) {
|
|
6774
6873
|
const n = ne(), i = await fetch(`${n}/api/update-engine`, {
|
|
6775
6874
|
method: "POST",
|
|
@@ -6817,7 +6916,7 @@ class go {
|
|
|
6817
6916
|
return await i.json();
|
|
6818
6917
|
}
|
|
6819
6918
|
}
|
|
6820
|
-
const
|
|
6919
|
+
const cs = new yo(), ko = 5e3, wo = {
|
|
6821
6920
|
meta: {
|
|
6822
6921
|
name: "update-engine",
|
|
6823
6922
|
description: "Request a scaffold upgrade PR to update the .taskless/ engine directory"
|
|
@@ -6852,14 +6951,14 @@ const ls = new go(), yo = 5e3, ko = {
|
|
|
6852
6951
|
const o = 'Missing "orgId" or "repositoryUrl" in .taskless/taskless.json. Run `taskless init` to set up your project.';
|
|
6853
6952
|
s.json ? console.log(JSON.stringify({ error: o })) : console.error(`Error: ${o}`), process.exit(1);
|
|
6854
6953
|
}
|
|
6855
|
-
const n = await
|
|
6954
|
+
const n = await ze();
|
|
6856
6955
|
if (!n) {
|
|
6857
6956
|
const o = "Authentication required. Run `taskless auth login` first.";
|
|
6858
6957
|
s.json ? console.log(JSON.stringify({ error: o })) : console.error(`Error: ${o}`), process.exit(1);
|
|
6859
6958
|
}
|
|
6860
6959
|
let i;
|
|
6861
6960
|
try {
|
|
6862
|
-
i = await
|
|
6961
|
+
i = await cs.submitUpdate(n, {
|
|
6863
6962
|
orgId: t.orgId,
|
|
6864
6963
|
repositoryUrl: t.repositoryUrl,
|
|
6865
6964
|
version: t.version
|
|
@@ -6887,10 +6986,10 @@ Review and merge it to complete the upgrade.`
|
|
|
6887
6986
|
}
|
|
6888
6987
|
const { requestId: r } = i;
|
|
6889
6988
|
for (console.error("Update request accepted. Waiting for PR creation..."); ; ) {
|
|
6890
|
-
await new Promise((a) => setTimeout(a,
|
|
6989
|
+
await new Promise((a) => setTimeout(a, ko));
|
|
6891
6990
|
let o;
|
|
6892
6991
|
try {
|
|
6893
|
-
o = await
|
|
6992
|
+
o = await cs.pollStatus(n, r);
|
|
6894
6993
|
} catch (a) {
|
|
6895
6994
|
const l = a instanceof Error ? a.message : String(a);
|
|
6896
6995
|
s.json ? console.log(JSON.stringify({ error: l })) : console.error(`Error: ${l}`), process.exit(1);
|
|
@@ -6930,17 +7029,17 @@ Re-run \`taskless update-engine\` to create a new one.`
|
|
|
6930
7029
|
}
|
|
6931
7030
|
}
|
|
6932
7031
|
}
|
|
6933
|
-
},
|
|
6934
|
-
init:
|
|
6935
|
-
info:
|
|
7032
|
+
}, us = {
|
|
7033
|
+
init: Kr,
|
|
7034
|
+
info: Jr,
|
|
6936
7035
|
check: ci,
|
|
6937
7036
|
auth: ni,
|
|
6938
|
-
rules:
|
|
6939
|
-
"update-engine":
|
|
6940
|
-
},
|
|
7037
|
+
rules: go,
|
|
7038
|
+
"update-engine": wo
|
|
7039
|
+
}, bo = {
|
|
6941
7040
|
meta: {
|
|
6942
7041
|
name: "taskless",
|
|
6943
|
-
version: "0.1.
|
|
7042
|
+
version: "0.1.4",
|
|
6944
7043
|
description: "Taskless CLI"
|
|
6945
7044
|
},
|
|
6946
7045
|
args: {
|
|
@@ -6956,11 +7055,11 @@ Re-run \`taskless update-engine\` to create a new one.`
|
|
|
6956
7055
|
}
|
|
6957
7056
|
},
|
|
6958
7057
|
subCommands: {
|
|
6959
|
-
...
|
|
6960
|
-
help:
|
|
7058
|
+
...us,
|
|
7059
|
+
help: ro(us)
|
|
6961
7060
|
},
|
|
6962
7061
|
async run({ rawArgs: s, cmd: e }) {
|
|
6963
7062
|
s.some((t) => !t.startsWith("-")) || await ws(e);
|
|
6964
7063
|
}
|
|
6965
7064
|
};
|
|
6966
|
-
Hn(
|
|
7065
|
+
Hn(bo);
|