bfi-cli 0.1.99 → 0.1.100
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/README.md +117 -5
- package/dist/THIRD-PARTY-LICENSES.md.gz +0 -0
- package/dist/_chunks/agents.mjs +1 -1
- package/dist/_chunks/agents2.mjs +4 -1
- package/dist/_chunks/client.mjs +107 -0
- package/dist/_chunks/command.mjs +698 -0
- package/dist/_chunks/digest.mjs +132 -0
- package/dist/_chunks/files.mjs +89 -0
- package/dist/_chunks/{registry-client.mjs → intent.mjs} +163 -13
- package/dist/_chunks/libs/@clack/core.mjs +63 -58
- package/dist/_chunks/libs/@clack/prompts.mjs +46 -45
- package/dist/_chunks/libs/@kwsites/file-exists.mjs +10 -9
- package/dist/_chunks/libs/simple-git.mjs +4 -2
- package/dist/_chunks/manager.mjs +436 -0
- package/dist/_chunks/mcp.mjs +559 -0
- package/dist/_chunks/model.mjs +124 -0
- package/dist/_chunks/ownership.mjs +7 -0
- package/dist/_chunks/package-plugin.mjs +473 -36
- package/dist/_chunks/receipt.mjs +166 -0
- package/dist/_chunks/rolldown-runtime.mjs +1 -1
- package/dist/_chunks/skills.mjs +6 -3
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +254 -221
- package/dist/mcp-codesearch/main.d.mts +1 -1
- package/dist/mcp-db/main.d.mts +1 -1
- package/dist/mcp-weknora/main.d.mts +1 -1
- package/package.json +4 -2
- package/dist/THIRD-PARTY-LICENSES.md +0 -293
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { __commonJSMin } from "../../rolldown-runtime.mjs";
|
|
2
2
|
import "node:util";
|
|
3
3
|
import { stdin, stdout } from "node:process";
|
|
4
|
-
import * as l from "node:readline";
|
|
5
|
-
import l__default from "node:readline";
|
|
4
|
+
import l__default, * as l from "node:readline";
|
|
6
5
|
import { ReadStream } from "node:tty";
|
|
7
6
|
const getCodePointsLength = (() => {
|
|
8
7
|
const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
@@ -359,6 +358,7 @@ const settings = {
|
|
|
359
358
|
error: "Something went wrong"
|
|
360
359
|
},
|
|
361
360
|
withGuide: true,
|
|
361
|
+
accessible: void 0,
|
|
362
362
|
date: {
|
|
363
363
|
monthNames: [...[
|
|
364
364
|
"January",
|
|
@@ -383,6 +383,12 @@ const settings = {
|
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
};
|
|
386
|
+
function isAccessible(n) {
|
|
387
|
+
if (n !== void 0) return n;
|
|
388
|
+
if (settings.accessible !== void 0) return settings.accessible;
|
|
389
|
+
const e = process.env.ACCESSIBLE;
|
|
390
|
+
return e !== void 0 && e !== "" && e !== "0" && e !== "false";
|
|
391
|
+
}
|
|
386
392
|
function isActionKey(n, e) {
|
|
387
393
|
if (typeof n == "string") return settings.aliases.get(n) === e;
|
|
388
394
|
for (const s of n) if (s !== void 0 && isActionKey(s, e)) return true;
|
|
@@ -410,7 +416,7 @@ function setRawMode(e, r) {
|
|
|
410
416
|
const o = e;
|
|
411
417
|
o.isTTY && o.setRawMode(r);
|
|
412
418
|
}
|
|
413
|
-
function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hideCursor:
|
|
419
|
+
function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hideCursor: n = true } = {}) {
|
|
414
420
|
const s = l.createInterface({
|
|
415
421
|
input: e,
|
|
416
422
|
output: r,
|
|
@@ -418,49 +424,48 @@ function block({ input: e = stdin, output: r = stdout, overwrite: o = true, hide
|
|
|
418
424
|
tabSize: 1
|
|
419
425
|
});
|
|
420
426
|
l.emitKeypressEvents(e, s), e instanceof ReadStream && e.isTTY && e.setRawMode(true);
|
|
421
|
-
const
|
|
427
|
+
const t = (f, { name: a, sequence: w }) => {
|
|
422
428
|
if (isActionKey([
|
|
423
429
|
String(f),
|
|
424
430
|
a,
|
|
425
|
-
|
|
431
|
+
w
|
|
426
432
|
], "cancel")) {
|
|
427
|
-
|
|
433
|
+
n && r.write(import_src.cursor.show), process.exit(0);
|
|
428
434
|
return;
|
|
429
435
|
}
|
|
430
436
|
if (!o) return;
|
|
431
437
|
const i = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
|
|
432
438
|
l.moveCursor(r, i, m, () => {
|
|
433
439
|
l.clearLine(r, 1, () => {
|
|
434
|
-
e.once("keypress",
|
|
440
|
+
e.once("keypress", t);
|
|
435
441
|
});
|
|
436
442
|
});
|
|
437
443
|
};
|
|
438
|
-
return
|
|
439
|
-
e.off("keypress",
|
|
444
|
+
return n && r.write(import_src.cursor.hide), e.once("keypress", t), () => {
|
|
445
|
+
e.off("keypress", t), n && r.write(import_src.cursor.show), e instanceof ReadStream && e.isTTY && !R && e.setRawMode(false), s.terminal = false, s.close();
|
|
440
446
|
};
|
|
441
447
|
}
|
|
442
448
|
const getColumns = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80;
|
|
443
449
|
const getRows = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
444
|
-
function wrapTextWithPrefix(e, r, o,
|
|
450
|
+
function wrapTextWithPrefix(e, r, o, n = o, s = o, t) {
|
|
445
451
|
return wrapAnsi(r, getColumns(e ?? stdout) - o.length, {
|
|
446
452
|
hard: true,
|
|
447
453
|
trim: false
|
|
448
454
|
}).split(`
|
|
449
455
|
`).map((c, i, m) => {
|
|
450
|
-
const d =
|
|
451
|
-
return i === 0 ? `${
|
|
456
|
+
const d = t ? t(c, i) : c;
|
|
457
|
+
return i === 0 ? `${n}${d}` : i === m.length - 1 ? `${s}${d}` : `${o}${d}`;
|
|
452
458
|
}).join(`
|
|
453
459
|
`);
|
|
454
460
|
}
|
|
455
|
-
function runValidation(e,
|
|
461
|
+
function runValidation(e, a) {
|
|
456
462
|
if ("~standard" in e) {
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
return a.issues?.at(0)?.message;
|
|
463
|
+
const n = e["~standard"].validate(a);
|
|
464
|
+
return n instanceof Promise ? n.then((r) => r.issues?.at(0)?.message) : n.issues?.at(0)?.message;
|
|
460
465
|
}
|
|
461
|
-
return e(
|
|
466
|
+
return e(a);
|
|
462
467
|
}
|
|
463
|
-
var
|
|
468
|
+
var y = class {
|
|
464
469
|
input;
|
|
465
470
|
output;
|
|
466
471
|
_abortSignal;
|
|
@@ -475,9 +480,12 @@ var V = class {
|
|
|
475
480
|
error = "";
|
|
476
481
|
value;
|
|
477
482
|
userInput = "";
|
|
483
|
+
get accessible() {
|
|
484
|
+
return isAccessible(this.opts.accessible);
|
|
485
|
+
}
|
|
478
486
|
constructor(t, e = true) {
|
|
479
|
-
const { input: i = stdin, output:
|
|
480
|
-
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render =
|
|
487
|
+
const { input: i = stdin, output: s = stdout, render: r, signal: n, ...o } = t;
|
|
488
|
+
this.opts = o, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = r.bind(this), this._track = e, this._abortSignal = n, this.input = i, this.output = s;
|
|
481
489
|
}
|
|
482
490
|
unsubscribe() {
|
|
483
491
|
this._subscribers.clear();
|
|
@@ -496,9 +504,9 @@ var V = class {
|
|
|
496
504
|
});
|
|
497
505
|
}
|
|
498
506
|
emit(t, ...e) {
|
|
499
|
-
const i = this._subscribers.get(t) ?? [],
|
|
500
|
-
for (const
|
|
501
|
-
for (const
|
|
507
|
+
const i = this._subscribers.get(t) ?? [], s = [];
|
|
508
|
+
for (const r of i) r.cb(...e), r.once && s.push(() => i.splice(i.indexOf(r), 1));
|
|
509
|
+
for (const r of s) r();
|
|
502
510
|
}
|
|
503
511
|
prompt() {
|
|
504
512
|
return new Promise((t) => {
|
|
@@ -539,22 +547,25 @@ var V = class {
|
|
|
539
547
|
name: "u"
|
|
540
548
|
}), this._setUserInput("");
|
|
541
549
|
}
|
|
542
|
-
onKeypress(t, e) {
|
|
543
|
-
if (this.
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
+
async onKeypress(t, e) {
|
|
551
|
+
if (this.state !== "validating") {
|
|
552
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, {
|
|
553
|
+
ctrl: true,
|
|
554
|
+
name: "h"
|
|
555
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && settings.aliases.has(e.name) && this.emit("cursor", settings.aliases.get(e.name)), settings.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t, e), e?.name === "return" && this._shouldSubmit(t, e)) {
|
|
556
|
+
if (this.opts.validate) {
|
|
557
|
+
const i = runValidation(this.opts.validate, this.value);
|
|
558
|
+
let s;
|
|
559
|
+
i instanceof Promise ? (this.state = "validating", this.render(), s = await i) : s = i, s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
560
|
+
}
|
|
561
|
+
this.state !== "error" && (this.state = "submit");
|
|
550
562
|
}
|
|
551
|
-
|
|
563
|
+
isActionKey([
|
|
564
|
+
t,
|
|
565
|
+
e?.name,
|
|
566
|
+
e?.sequence
|
|
567
|
+
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
552
568
|
}
|
|
553
|
-
isActionKey([
|
|
554
|
-
t,
|
|
555
|
-
e?.name,
|
|
556
|
-
e?.sequence
|
|
557
|
-
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
558
569
|
}
|
|
559
570
|
close() {
|
|
560
571
|
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
@@ -578,27 +589,27 @@ var V = class {
|
|
|
578
589
|
else {
|
|
579
590
|
const e = diffLines(this._prevFrame, t), i = getRows(this.output);
|
|
580
591
|
if (this.restoreCursor(), e) {
|
|
581
|
-
const
|
|
582
|
-
let
|
|
583
|
-
if (
|
|
592
|
+
const s = Math.max(0, e.numLinesAfter - i), r = Math.max(0, e.numLinesBefore - i);
|
|
593
|
+
let n = e.lines.find((o) => o >= s);
|
|
594
|
+
if (n === void 0) {
|
|
584
595
|
this._prevFrame = t;
|
|
585
596
|
return;
|
|
586
597
|
}
|
|
587
598
|
if (e.lines.length === 1) {
|
|
588
|
-
this.output.write(import_src.cursor.move(0,
|
|
599
|
+
this.output.write(import_src.cursor.move(0, n - r)), this.output.write(import_src.erase.lines(1));
|
|
589
600
|
const o = t.split(`
|
|
590
601
|
`);
|
|
591
|
-
this.output.write(o[
|
|
602
|
+
this.output.write(o[n]), this._prevFrame = t, this.output.write(import_src.cursor.move(0, o.length - n - 1));
|
|
592
603
|
return;
|
|
593
604
|
} else if (e.lines.length > 1) {
|
|
594
|
-
if (
|
|
605
|
+
if (s < r) n = s;
|
|
595
606
|
else {
|
|
596
|
-
const h =
|
|
607
|
+
const h = n - r;
|
|
597
608
|
h > 0 && this.output.write(import_src.cursor.move(0, h));
|
|
598
609
|
}
|
|
599
610
|
this.output.write(import_src.erase.down());
|
|
600
611
|
const f = t.split(`
|
|
601
|
-
`).slice(
|
|
612
|
+
`).slice(n);
|
|
602
613
|
this.output.write(f.join(`
|
|
603
614
|
`)), this._prevFrame = t;
|
|
604
615
|
return;
|
|
@@ -610,7 +621,7 @@ var V = class {
|
|
|
610
621
|
}
|
|
611
622
|
}
|
|
612
623
|
};
|
|
613
|
-
var r = class extends
|
|
624
|
+
var r = class extends y {
|
|
614
625
|
get cursor() {
|
|
615
626
|
return this.value ? 0 : 1;
|
|
616
627
|
}
|
|
@@ -627,7 +638,7 @@ var r = class extends V {
|
|
|
627
638
|
});
|
|
628
639
|
}
|
|
629
640
|
};
|
|
630
|
-
let u$2 = class u extends
|
|
641
|
+
let u$2 = class u extends y {
|
|
631
642
|
options;
|
|
632
643
|
cursor = 0;
|
|
633
644
|
#t;
|
|
@@ -674,14 +685,12 @@ let u$2 = class u extends V {
|
|
|
674
685
|
!this.#t && s && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
675
686
|
break;
|
|
676
687
|
}
|
|
677
|
-
case "space":
|
|
678
|
-
this.toggleValue();
|
|
679
|
-
break;
|
|
688
|
+
case "space": this.toggleValue();
|
|
680
689
|
}
|
|
681
690
|
});
|
|
682
691
|
}
|
|
683
692
|
};
|
|
684
|
-
var a = class extends
|
|
693
|
+
var a = class extends y {
|
|
685
694
|
options;
|
|
686
695
|
cursor = 0;
|
|
687
696
|
get _value() {
|
|
@@ -720,14 +729,12 @@ var a = class extends V {
|
|
|
720
729
|
case "right":
|
|
721
730
|
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
722
731
|
break;
|
|
723
|
-
case "space":
|
|
724
|
-
this.toggleValue();
|
|
725
|
-
break;
|
|
732
|
+
case "space": this.toggleValue();
|
|
726
733
|
}
|
|
727
734
|
});
|
|
728
735
|
}
|
|
729
736
|
};
|
|
730
|
-
let n$1 = class n extends
|
|
737
|
+
let n$1 = class n extends y {
|
|
731
738
|
options;
|
|
732
739
|
cursor = 0;
|
|
733
740
|
get _selectedValue() {
|
|
@@ -747,9 +754,7 @@ let n$1 = class n extends V {
|
|
|
747
754
|
this.cursor = findCursor(this.cursor, -1, this.options);
|
|
748
755
|
break;
|
|
749
756
|
case "down":
|
|
750
|
-
case "right":
|
|
751
|
-
this.cursor = findCursor(this.cursor, 1, this.options);
|
|
752
|
-
break;
|
|
757
|
+
case "right": this.cursor = findCursor(this.cursor, 1, this.options);
|
|
753
758
|
}
|
|
754
759
|
this.changeValue();
|
|
755
760
|
});
|
|
@@ -82,6 +82,7 @@ const symbol = (o) => {
|
|
|
82
82
|
case "cancel": return styleText("red", S_STEP_CANCEL);
|
|
83
83
|
case "error": return styleText("yellow", S_STEP_ERROR);
|
|
84
84
|
case "submit": return styleText("green", S_STEP_SUBMIT);
|
|
85
|
+
case "validating": return styleText("dim", S_STEP_ACTIVE);
|
|
85
86
|
}
|
|
86
87
|
};
|
|
87
88
|
const symbolBar = (o) => {
|
|
@@ -122,7 +123,7 @@ const limitOptions = ({ cursor: l, options: e, style: w, output: p = process.std
|
|
|
122
123
|
d && g++, c && g++;
|
|
123
124
|
const T = f + (d ? 1 : 0), y = W - (c ? 1 : 0);
|
|
124
125
|
for (let t = T; t < y; t++) {
|
|
125
|
-
const n = e[t],
|
|
126
|
+
const n = e[t], o = n ? w(n, t === l) : "", h = wrapAnsi(o, i, {
|
|
126
127
|
hard: true,
|
|
127
128
|
trim: false
|
|
128
129
|
}).split(`
|
|
@@ -141,28 +142,28 @@ const limitOptions = ({ cursor: l, options: e, style: w, output: p = process.std
|
|
|
141
142
|
for (const t of s) for (const n of t) x.push(n);
|
|
142
143
|
return c && x.push(M), x;
|
|
143
144
|
};
|
|
144
|
-
const confirm = (
|
|
145
|
-
const a =
|
|
145
|
+
const confirm = (e) => {
|
|
146
|
+
const a = e.active ?? "Yes", o = e.inactive ?? "No";
|
|
146
147
|
return new r({
|
|
147
148
|
active: a,
|
|
148
|
-
inactive:
|
|
149
|
-
signal:
|
|
150
|
-
input:
|
|
151
|
-
output:
|
|
152
|
-
initialValue:
|
|
149
|
+
inactive: o,
|
|
150
|
+
signal: e.signal,
|
|
151
|
+
input: e.input,
|
|
152
|
+
output: e.output,
|
|
153
|
+
initialValue: e.initialValue ?? true,
|
|
153
154
|
render() {
|
|
154
|
-
const
|
|
155
|
+
const i = e.withGuide ?? settings.withGuide, u = `${symbol(this.state)} `, l = i ? `${styleText("gray", S_BAR)} ` : "", f = wrapTextWithPrefix(e.output, e.message, l, u), s = `${i ? `${styleText("gray", S_BAR)}
|
|
155
156
|
` : ""}${f}
|
|
156
|
-
`, c = this.value ? a :
|
|
157
|
+
`, c = this.value ? a : o;
|
|
157
158
|
switch (this.state) {
|
|
158
|
-
case "submit": return `${
|
|
159
|
-
case "cancel": return `${
|
|
159
|
+
case "submit": return `${s}${i ? `${styleText("gray", S_BAR)} ` : ""}${styleText("dim", c)}`;
|
|
160
|
+
case "cancel": return `${s}${i ? `${styleText("gray", S_BAR)} ` : ""}${styleText(["strikethrough", "dim"], c)}${i ? `
|
|
160
161
|
${styleText("gray", S_BAR)}` : ""}`;
|
|
161
162
|
default: {
|
|
162
|
-
const r =
|
|
163
|
-
return `${
|
|
163
|
+
const r = i ? `${styleText("cyan", S_BAR)} ` : "", g = i ? styleText("cyan", S_BAR_END) : "";
|
|
164
|
+
return `${s}${r}${this.value ? `${styleText("green", S_RADIO_ACTIVE)} ${a}` : `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", a)}`}${e.vertical ? i ? `
|
|
164
165
|
${styleText("cyan", S_BAR)} ` : `
|
|
165
|
-
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim",
|
|
166
|
+
` : ` ${styleText("dim", "/")} `}${this.value ? `${styleText("dim", S_RADIO_INACTIVE)} ${styleText("dim", o)}` : `${styleText("green", S_RADIO_ACTIVE)} ${o}`}
|
|
166
167
|
${g}
|
|
167
168
|
`;
|
|
168
169
|
}
|
|
@@ -182,7 +183,7 @@ const multiselect = (i) => {
|
|
|
182
183
|
const u = (t, a) => {
|
|
183
184
|
const r = t.label ?? String(t.value);
|
|
184
185
|
return a === "disabled" ? `${styleText("gray", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText(["strikethrough", "gray"], o))}${t.hint ? ` ${styleText("dim", `(${t.hint ?? "disabled"})`)}` : ""}` : a === "active" ? `${styleText("cyan", S_CHECKBOX_ACTIVE)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${m(r, (o) => styleText("dim", o))}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "cancelled" ? `${m(r, (o) => styleText(["strikethrough", "dim"], o))}` : a === "active-selected" ? `${styleText("green", S_CHECKBOX_SELECTED)} ${r}${t.hint ? ` ${styleText("dim", `(${t.hint})`)}` : ""}` : a === "submitted" ? `${m(r, (o) => styleText("dim", o))}` : `${styleText("dim", S_CHECKBOX_INACTIVE)} ${m(r, (o) => styleText("dim", o))}`;
|
|
185
|
-
}, d = i.required ?? true,
|
|
186
|
+
}, d = i.required ?? true, x = i.showInstructions ?? true;
|
|
186
187
|
return new a({
|
|
187
188
|
options: i.options,
|
|
188
189
|
signal: i.signal,
|
|
@@ -202,7 +203,7 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
|
|
|
202
203
|
render() {
|
|
203
204
|
const t = i.withGuide ?? settings.withGuide, a = wrapTextWithPrefix(i.output, i.message, t ? `${symbolBar(this.state)} ` : "", `${symbol(this.state)} `), r = `${t ? `${styleText("gray", S_BAR)}
|
|
204
205
|
` : ""}${a}
|
|
205
|
-
`, o = this.value ?? [],
|
|
206
|
+
`, o = this.value ?? [], g = (n, l) => {
|
|
206
207
|
if (n.disabled) return u(n, "disabled");
|
|
207
208
|
const s = o.includes(n.value);
|
|
208
209
|
return l && s ? u(n, "active-selected") : s ? u(n, "selected") : u(n, l ? "active" : "inactive");
|
|
@@ -220,7 +221,7 @@ ${styleText("gray", S_BAR)}` : ""}`;
|
|
|
220
221
|
}
|
|
221
222
|
case "error": {
|
|
222
223
|
const n = t ? `${styleText("yellow", S_BAR)} ` : "", l = this.error.split(`
|
|
223
|
-
`).map(($,
|
|
224
|
+
`).map(($, v) => v === 0 ? `${t ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", $)}` : ` ${$}`).join(`
|
|
224
225
|
`), s = r.split(`
|
|
225
226
|
`).length, h = l.split(`
|
|
226
227
|
`).length + 1;
|
|
@@ -231,7 +232,7 @@ ${styleText("gray", S_BAR)}` : ""}`;
|
|
|
231
232
|
maxItems: i.maxItems,
|
|
232
233
|
columnPadding: n.length,
|
|
233
234
|
rowPadding: s + h,
|
|
234
|
-
style:
|
|
235
|
+
style: g
|
|
235
236
|
}).join(`
|
|
236
237
|
${n}`)}
|
|
237
238
|
${l}
|
|
@@ -239,7 +240,7 @@ ${l}
|
|
|
239
240
|
}
|
|
240
241
|
default: {
|
|
241
242
|
const n = t ? `${styleText("cyan", S_BAR)} ` : "", l = r.split(`
|
|
242
|
-
`).length, s =
|
|
243
|
+
`).length, s = x ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, t) : t ? [styleText("cyan", S_BAR_END)] : [], h = s.join(`
|
|
243
244
|
`), $ = s.length + 1;
|
|
244
245
|
return `${r}${n}${limitOptions({
|
|
245
246
|
output: i.output,
|
|
@@ -248,7 +249,7 @@ ${l}
|
|
|
248
249
|
maxItems: i.maxItems,
|
|
249
250
|
columnPadding: n.length,
|
|
250
251
|
rowPadding: l + $,
|
|
251
|
-
style:
|
|
252
|
+
style: g
|
|
252
253
|
}).join(`
|
|
253
254
|
${n}`)}
|
|
254
255
|
${h}
|
|
@@ -259,25 +260,25 @@ ${h}
|
|
|
259
260
|
}).prompt();
|
|
260
261
|
};
|
|
261
262
|
const groupMultiselect = (o) => {
|
|
262
|
-
const { selectableGroups:
|
|
263
|
-
const a = n.label ?? String(n.value), t = typeof n.group == "string", s = t && (
|
|
263
|
+
const { selectableGroups: f = true, groupSpacing: x = 0 } = o, d = (n, l, p = []) => {
|
|
264
|
+
const a = n.label ?? String(n.value), t = typeof n.group == "string", s = t && (p[p.indexOf(n) + 1] ?? { group: true }), u = t && s && s.group === true;
|
|
264
265
|
let r = "", c = "";
|
|
265
|
-
t && (
|
|
266
|
+
t && (f ? (r = u ? `${S_BAR_END} ` : `${S_BAR} `, c = u ? " " : `${S_BAR} `) : r = " ");
|
|
266
267
|
let i = "";
|
|
267
268
|
if (x > 0 && !t && (i = `
|
|
268
269
|
`.repeat(x)), l === "active") return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${styleText("cyan", S_CHECKBOX_ACTIVE)} `, `${i}${styleText("dim", c)} `);
|
|
269
|
-
if (l === "group-active") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("cyan", S_CHECKBOX_ACTIVE)} `, `${i}${c} `, (
|
|
270
|
-
if (l === "group-active-selected") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("green", S_CHECKBOX_SELECTED)} `, `${i}${c} `, (
|
|
270
|
+
if (l === "group-active") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("cyan", S_CHECKBOX_ACTIVE)} `, `${i}${c} `, (m) => styleText("dim", m));
|
|
271
|
+
if (l === "group-active-selected") return wrapTextWithPrefix(o.output, a, `${i}${r} `, `${i}${r}${styleText("green", S_CHECKBOX_SELECTED)} `, `${i}${c} `, (m) => styleText("dim", m));
|
|
271
272
|
if (l === "selected") {
|
|
272
|
-
const
|
|
273
|
-
return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` (${n.hint})` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${
|
|
273
|
+
const m = t || f ? styleText("green", S_CHECKBOX_SELECTED) : "";
|
|
274
|
+
return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` (${n.hint})` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${m} `, `${i}${styleText("dim", c)} `, (I) => styleText("dim", I));
|
|
274
275
|
}
|
|
275
276
|
if (l === "cancelled") return `${styleText(["strikethrough", "dim"], a)}`;
|
|
276
277
|
if (l === "active-selected") return wrapTextWithPrefix(o.output, `${a}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${styleText("green", S_CHECKBOX_SELECTED)} `, `${i}${styleText("dim", c)} `);
|
|
277
278
|
if (l === "submitted") return `${styleText("dim", a)}`;
|
|
278
|
-
const
|
|
279
|
-
return wrapTextWithPrefix(o.output, a, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${
|
|
280
|
-
}, y = o.required ?? true,
|
|
279
|
+
const h = t || f ? styleText("dim", S_CHECKBOX_INACTIVE) : "";
|
|
280
|
+
return wrapTextWithPrefix(o.output, a, `${i}${styleText("dim", r)} `, `${i}${styleText("dim", r)}${h} `, `${i}${styleText("dim", c)} `, (m) => styleText("dim", m));
|
|
281
|
+
}, y = o.required ?? true, S = o.showInstructions ?? true;
|
|
281
282
|
return new u$2({
|
|
282
283
|
options: o.options,
|
|
283
284
|
signal: o.signal,
|
|
@@ -286,7 +287,7 @@ const groupMultiselect = (o) => {
|
|
|
286
287
|
initialValues: o.initialValues,
|
|
287
288
|
required: y,
|
|
288
289
|
cursorAt: o.cursorAt,
|
|
289
|
-
selectableGroups:
|
|
290
|
+
selectableGroups: f,
|
|
290
291
|
validate(n) {
|
|
291
292
|
if (y && (n === void 0 || n.length === 0)) return `Please select at least one option.
|
|
292
293
|
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
@@ -298,23 +299,23 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
|
|
|
298
299
|
render() {
|
|
299
300
|
const n = o.withGuide ?? settings.withGuide, l = `${n ? `${styleText("gray", S_BAR)}
|
|
300
301
|
` : ""}${symbol(this.state)} ${o.message}
|
|
301
|
-
`,
|
|
302
|
-
const u = this.options, r =
|
|
303
|
-
return !s && typeof t.group == "string" && this.options[this.cursor]?.value === t.group ?
|
|
302
|
+
`, p = this.value ?? [], a = (t, s) => {
|
|
303
|
+
const u = this.options, r = p.includes(t.value) || t.group === true && this.isGroupSelected(`${t.value}`);
|
|
304
|
+
return !s && typeof t.group == "string" && this.options[this.cursor]?.value === t.group ? d(t, r ? "group-active-selected" : "group-active", u) : s && r ? d(t, "active-selected", u) : r ? d(t, "selected", u) : d(t, s ? "active" : "inactive", u);
|
|
304
305
|
};
|
|
305
306
|
switch (this.state) {
|
|
306
307
|
case "submit": {
|
|
307
|
-
const t = this.options.filter(({ value: u }) =>
|
|
308
|
+
const t = this.options.filter(({ value: u }) => p.includes(u)).map((u) => d(u, "submitted")), s = t.length === 0 ? "" : ` ${t.join(styleText("dim", ", "))}`;
|
|
308
309
|
return `${l}${n ? styleText("gray", S_BAR) : ""}${s}`;
|
|
309
310
|
}
|
|
310
311
|
case "cancel": {
|
|
311
|
-
const t = this.options.filter(({ value: s }) =>
|
|
312
|
+
const t = this.options.filter(({ value: s }) => p.includes(s)).map((s) => d(s, "cancelled")).join(styleText("dim", ", "));
|
|
312
313
|
return `${l}${n ? `${styleText("gray", S_BAR)} ` : ""}${t.trim() ? `${t}${n ? `
|
|
313
314
|
${styleText("gray", S_BAR)}` : ""}` : ""}`;
|
|
314
315
|
}
|
|
315
316
|
case "error": {
|
|
316
317
|
const t = n ? `${styleText("yellow", S_BAR)} ` : "", s = this.error.split(`
|
|
317
|
-
`).map((i,
|
|
318
|
+
`).map((i, h) => h === 0 ? `${n ? `${styleText("yellow", S_BAR_END)} ` : ""}${styleText("yellow", i)}` : ` ${i}`).join(`
|
|
318
319
|
`), u = l.split(`
|
|
319
320
|
`).length, r = s.split(`
|
|
320
321
|
`).length + 1;
|
|
@@ -333,7 +334,7 @@ ${s}
|
|
|
333
334
|
}
|
|
334
335
|
default: {
|
|
335
336
|
const t = n ? `${styleText("cyan", S_BAR)} ` : "", s = l.split(`
|
|
336
|
-
`).length, u =
|
|
337
|
+
`).length, u = S ? formatInstructionFooter(MULTISELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], r = u.join(`
|
|
337
338
|
`), c = u.length + 1;
|
|
338
339
|
return `${l}${t}${limitOptions({
|
|
339
340
|
output: o.output,
|
|
@@ -425,8 +426,8 @@ const C = (o, e, s) => {
|
|
|
425
426
|
hard: true,
|
|
426
427
|
trim: false
|
|
427
428
|
}, i = wrapAnsi(o, e, a).split(`
|
|
428
|
-
`), c = i.reduce((n, t) => Math.max(fastStringWidth(t), n), 0);
|
|
429
|
-
return wrapAnsi(o,
|
|
429
|
+
`), c = i.reduce((n, t) => Math.max(fastStringWidth(t), n), 0), g = e - (i.map(s).reduce((n, t) => Math.max(fastStringWidth(t), n), 0) - c);
|
|
430
|
+
return wrapAnsi(o, g, a);
|
|
430
431
|
};
|
|
431
432
|
const note = (o = "", e = "", s) => {
|
|
432
433
|
const a = s?.output ?? process$1.stdout, i = s?.withGuide ?? settings.withGuide, c = s?.format ?? W$1, g = [
|
|
@@ -561,19 +562,19 @@ ${styleText("gray", S_BAR)}` : ""}`;
|
|
|
561
562
|
}
|
|
562
563
|
default: {
|
|
563
564
|
const r = n ? `${styleText("cyan", S_BAR)} ` : "", a = u.split(`
|
|
564
|
-
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [],
|
|
565
|
-
`),
|
|
565
|
+
`).length, p = d ? formatInstructionFooter(SELECT_INSTRUCTIONS, n) : n ? [styleText("cyan", S_BAR_END)] : [], f = p.join(`
|
|
566
|
+
`), b = p.length + 1;
|
|
566
567
|
return `${u}${r}${limitOptions({
|
|
567
568
|
output: t.output,
|
|
568
569
|
cursor: this.cursor,
|
|
569
570
|
options: this.options,
|
|
570
571
|
maxItems: t.maxItems,
|
|
571
572
|
columnPadding: r.length,
|
|
572
|
-
rowPadding: a +
|
|
573
|
+
rowPadding: a + b,
|
|
573
574
|
style: (g, x) => o(g, g.disabled ? "disabled" : x ? "active" : "inactive")
|
|
574
575
|
}).join(`
|
|
575
576
|
${r}`)}
|
|
576
|
-
${
|
|
577
|
+
${f}
|
|
577
578
|
`;
|
|
578
579
|
}
|
|
579
580
|
}
|
|
@@ -173,15 +173,16 @@ var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
173
173
|
let templateIndex = 0;
|
|
174
174
|
let starIndex = -1;
|
|
175
175
|
let matchIndex = 0;
|
|
176
|
-
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*"))
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
176
|
+
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
|
|
177
|
+
if (template[templateIndex] === "*") {
|
|
178
|
+
starIndex = templateIndex;
|
|
179
|
+
matchIndex = searchIndex;
|
|
180
|
+
templateIndex++;
|
|
181
|
+
} else {
|
|
182
|
+
searchIndex++;
|
|
183
|
+
templateIndex++;
|
|
184
|
+
}
|
|
185
|
+
} else if (starIndex !== -1) {
|
|
185
186
|
templateIndex = starIndex + 1;
|
|
186
187
|
matchIndex++;
|
|
187
188
|
searchIndex = matchIndex;
|
|
@@ -3404,8 +3404,10 @@ function isBadArgument(arg) {
|
|
|
3404
3404
|
}
|
|
3405
3405
|
function toBinaryConfig(input, allowUnsafe) {
|
|
3406
3406
|
if (input.length < 1 || input.length > 2) throw new GitPluginError(void 0, "binary", WRONG_NUMBER_ERR);
|
|
3407
|
-
if (input.some(isBadArgument))
|
|
3408
|
-
|
|
3407
|
+
if (input.some(isBadArgument)) {
|
|
3408
|
+
if (allowUnsafe) console.warn(WRONG_CHARS_ERR);
|
|
3409
|
+
else throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR);
|
|
3410
|
+
}
|
|
3409
3411
|
const [binary, prefix] = input;
|
|
3410
3412
|
return {
|
|
3411
3413
|
binary,
|