spawnpack 0.1.22 → 0.1.25
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 +0 -1
- package/dist/spawnpack.js +153 -461
- package/package.json +1 -2
- package/templates/AGENTS.md +1 -2
- package/templates/CLAUDE.md +0 -52
package/README.md
CHANGED
package/dist/spawnpack.js
CHANGED
|
@@ -19,13 +19,15 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
return cached;
|
|
20
20
|
}
|
|
21
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
|
+
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
24
|
+
for (let key of __getOwnPropNames(mod))
|
|
25
|
+
if (!__hasOwnProp.call(to, key))
|
|
26
|
+
__defProp(to, key, {
|
|
27
|
+
get: __accessProp.bind(mod, key),
|
|
28
|
+
enumerable: true
|
|
29
|
+
});
|
|
30
|
+
}
|
|
29
31
|
if (canCache)
|
|
30
32
|
cache.set(mod, to);
|
|
31
33
|
return to;
|
|
@@ -33,51 +35,51 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
33
35
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
36
|
|
|
35
37
|
// node_modules/sisteransi/src/index.js
|
|
36
|
-
var require_src = __commonJS((exports, module)
|
|
37
|
-
var
|
|
38
|
-
var
|
|
38
|
+
var require_src = __commonJS(function(exports, module) {
|
|
39
|
+
var ESC = "\x1B";
|
|
40
|
+
var CSI = `${ESC}[`;
|
|
39
41
|
var beep = "\x07";
|
|
40
42
|
var cursor = {
|
|
41
43
|
to(x, y) {
|
|
42
44
|
if (!y)
|
|
43
|
-
return `${
|
|
44
|
-
return `${
|
|
45
|
+
return `${CSI}${x + 1}G`;
|
|
46
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
45
47
|
},
|
|
46
48
|
move(x, y) {
|
|
47
49
|
let ret = "";
|
|
48
50
|
if (x < 0)
|
|
49
|
-
ret += `${
|
|
51
|
+
ret += `${CSI}${-x}D`;
|
|
50
52
|
else if (x > 0)
|
|
51
|
-
ret += `${
|
|
53
|
+
ret += `${CSI}${x}C`;
|
|
52
54
|
if (y < 0)
|
|
53
|
-
ret += `${
|
|
55
|
+
ret += `${CSI}${-y}A`;
|
|
54
56
|
else if (y > 0)
|
|
55
|
-
ret += `${
|
|
57
|
+
ret += `${CSI}${y}B`;
|
|
56
58
|
return ret;
|
|
57
59
|
},
|
|
58
|
-
up: (count = 1) => `${
|
|
59
|
-
down: (count = 1) => `${
|
|
60
|
-
forward: (count = 1) => `${
|
|
61
|
-
backward: (count = 1) => `${
|
|
62
|
-
nextLine: (count = 1) => `${
|
|
63
|
-
prevLine: (count = 1) => `${
|
|
64
|
-
left: `${
|
|
65
|
-
hide: `${
|
|
66
|
-
show: `${
|
|
67
|
-
save: `${
|
|
68
|
-
restore: `${
|
|
60
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
61
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
62
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
63
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
64
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
65
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
66
|
+
left: `${CSI}G`,
|
|
67
|
+
hide: `${CSI}?25l`,
|
|
68
|
+
show: `${CSI}?25h`,
|
|
69
|
+
save: `${ESC}7`,
|
|
70
|
+
restore: `${ESC}8`
|
|
69
71
|
};
|
|
70
72
|
var scroll = {
|
|
71
|
-
up: (count = 1) => `${
|
|
72
|
-
down: (count = 1) => `${
|
|
73
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
74
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
73
75
|
};
|
|
74
76
|
var erase = {
|
|
75
|
-
screen: `${
|
|
76
|
-
up: (count = 1) => `${
|
|
77
|
-
down: (count = 1) => `${
|
|
78
|
-
line: `${
|
|
79
|
-
lineEnd: `${
|
|
80
|
-
lineStart: `${
|
|
77
|
+
screen: `${CSI}2J`,
|
|
78
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
79
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
80
|
+
line: `${CSI}2K`,
|
|
81
|
+
lineEnd: `${CSI}K`,
|
|
82
|
+
lineStart: `${CSI}1K`,
|
|
81
83
|
lines(count) {
|
|
82
84
|
let clear = "";
|
|
83
85
|
for (let i = 0;i < count; i++)
|
|
@@ -91,11 +93,11 @@ var require_src = __commonJS((exports, module) => {
|
|
|
91
93
|
});
|
|
92
94
|
|
|
93
95
|
// node_modules/picocolors/picocolors.js
|
|
94
|
-
var require_picocolors = __commonJS((exports, module)
|
|
95
|
-
var
|
|
96
|
-
var argv =
|
|
97
|
-
var env =
|
|
98
|
-
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") ||
|
|
96
|
+
var require_picocolors = __commonJS(function(exports, module) {
|
|
97
|
+
var p = process || {};
|
|
98
|
+
var argv = p.argv || [];
|
|
99
|
+
var env = p.env || {};
|
|
100
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
99
101
|
var formatter = (open, close, replace = open) => (input) => {
|
|
100
102
|
let string = "" + input, index = string.indexOf(close, open.length);
|
|
101
103
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
@@ -746,86 +748,6 @@ var p = class {
|
|
|
746
748
|
}
|
|
747
749
|
}
|
|
748
750
|
};
|
|
749
|
-
function W(r, t) {
|
|
750
|
-
if (r === undefined || t.length === 0)
|
|
751
|
-
return 0;
|
|
752
|
-
const e = t.findIndex((s) => s.value === r);
|
|
753
|
-
return e !== -1 ? e : 0;
|
|
754
|
-
}
|
|
755
|
-
function B(r, t) {
|
|
756
|
-
return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
|
|
757
|
-
}
|
|
758
|
-
function J(r, t) {
|
|
759
|
-
if (t)
|
|
760
|
-
return r ? t : t[0];
|
|
761
|
-
}
|
|
762
|
-
var H = class extends p {
|
|
763
|
-
filteredOptions;
|
|
764
|
-
multiple;
|
|
765
|
-
isNavigating = false;
|
|
766
|
-
selectedValues = [];
|
|
767
|
-
focusedValue;
|
|
768
|
-
#e = 0;
|
|
769
|
-
#o = "";
|
|
770
|
-
#t;
|
|
771
|
-
#n;
|
|
772
|
-
#a;
|
|
773
|
-
get cursor() {
|
|
774
|
-
return this.#e;
|
|
775
|
-
}
|
|
776
|
-
get userInputWithCursor() {
|
|
777
|
-
if (!this.userInput)
|
|
778
|
-
return y(["inverse", "hidden"], "_");
|
|
779
|
-
if (this._cursor >= this.userInput.length)
|
|
780
|
-
return `${this.userInput}\u2588`;
|
|
781
|
-
const t = this.userInput.slice(0, this._cursor), [e, ...s] = this.userInput.slice(this._cursor);
|
|
782
|
-
return `${t}${y("inverse", e)}${s.join("")}`;
|
|
783
|
-
}
|
|
784
|
-
get options() {
|
|
785
|
-
return typeof this.#n == "function" ? this.#n() : this.#n;
|
|
786
|
-
}
|
|
787
|
-
constructor(t) {
|
|
788
|
-
super(t), this.#n = t.options, this.#a = t.placeholder;
|
|
789
|
-
const e = this.options;
|
|
790
|
-
this.filteredOptions = [...e], this.multiple = t.multiple === true, this.#t = typeof t.options == "function" ? t.filter : t.filter ?? B;
|
|
791
|
-
let s;
|
|
792
|
-
if (t.initialValue && Array.isArray(t.initialValue) ? this.multiple ? s = t.initialValue : s = t.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (s = [this.options[0].value]), s)
|
|
793
|
-
for (const i of s) {
|
|
794
|
-
const n = e.findIndex((o) => o.value === i);
|
|
795
|
-
n !== -1 && (this.toggleSelected(i), this.#e = n);
|
|
796
|
-
}
|
|
797
|
-
this.focusedValue = this.options[this.#e]?.value, this.on("key", (i, n) => this.#s(i, n)), this.on("userInput", (i) => this.#i(i));
|
|
798
|
-
}
|
|
799
|
-
_isActionKey(t, e) {
|
|
800
|
-
return t === "\t" || this.multiple && this.isNavigating && e.name === "space" && t !== undefined && t !== "";
|
|
801
|
-
}
|
|
802
|
-
#s(t, e) {
|
|
803
|
-
const s = e.name === "up", i = e.name === "down", n = e.name === "return", o = this.userInput === "" || this.userInput === "\t", a = this.#a, h = this.options, l = a !== undefined && a !== "" && h.some((f) => !f.disabled && (this.#t ? this.#t(a, f) : true));
|
|
804
|
-
if (e.name === "tab" && o && l) {
|
|
805
|
-
this.userInput === "\t" && this._clearUserInput(), this._setUserInput(a, true), this.isNavigating = false;
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
s || i ? (this.#e = d(this.#e, s ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = J(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (e.name === "tab" || this.isNavigating && e.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
|
|
809
|
-
}
|
|
810
|
-
deselectAll() {
|
|
811
|
-
this.selectedValues = [];
|
|
812
|
-
}
|
|
813
|
-
toggleSelected(t) {
|
|
814
|
-
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(t) ? this.selectedValues = this.selectedValues.filter((e) => e !== t) : this.selectedValues = [...this.selectedValues, t] : this.selectedValues = [t]);
|
|
815
|
-
}
|
|
816
|
-
#i(t) {
|
|
817
|
-
if (t !== this.#o) {
|
|
818
|
-
this.#o = t;
|
|
819
|
-
const e = this.options;
|
|
820
|
-
t && this.#t ? this.filteredOptions = e.filter((n) => this.#t?.(t, n)) : this.filteredOptions = [...e];
|
|
821
|
-
const s = W(this.focusedValue, this.filteredOptions);
|
|
822
|
-
this.#e = d(s, 0, this.filteredOptions);
|
|
823
|
-
const i = this.filteredOptions[this.#e];
|
|
824
|
-
i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
};
|
|
828
|
-
|
|
829
751
|
class Q extends p {
|
|
830
752
|
get cursor() {
|
|
831
753
|
return this.value ? 0 : 1;
|
|
@@ -843,236 +765,6 @@ class Q extends p {
|
|
|
843
765
|
});
|
|
844
766
|
}
|
|
845
767
|
}
|
|
846
|
-
var X = { Y: { type: "year", len: 4 }, M: { type: "month", len: 2 }, D: { type: "day", len: 2 } };
|
|
847
|
-
function L(r) {
|
|
848
|
-
return [...r].map((t) => X[t]);
|
|
849
|
-
}
|
|
850
|
-
function Z(r) {
|
|
851
|
-
const t = new Intl.DateTimeFormat(r, { year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(2000, 0, 15)), e = [];
|
|
852
|
-
let s = "/";
|
|
853
|
-
for (const i of t)
|
|
854
|
-
i.type === "literal" ? s = i.value.trim() || i.value : (i.type === "year" || i.type === "month" || i.type === "day") && e.push({ type: i.type, len: i.type === "year" ? 4 : 2 });
|
|
855
|
-
return { segments: e, separator: s };
|
|
856
|
-
}
|
|
857
|
-
function k(r) {
|
|
858
|
-
return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
|
|
859
|
-
}
|
|
860
|
-
function I(r) {
|
|
861
|
-
return { year: k(r.year), month: k(r.month), day: k(r.day) };
|
|
862
|
-
}
|
|
863
|
-
function T(r, t) {
|
|
864
|
-
return new Date(r || 2001, t || 1, 0).getDate();
|
|
865
|
-
}
|
|
866
|
-
function F(r) {
|
|
867
|
-
const { year: t, month: e, day: s } = I(r);
|
|
868
|
-
if (!t || t < 0 || t > 9999 || !e || e < 1 || e > 12 || !s || s < 1)
|
|
869
|
-
return;
|
|
870
|
-
const i = new Date(Date.UTC(t, e - 1, s));
|
|
871
|
-
if (!(i.getUTCFullYear() !== t || i.getUTCMonth() !== e - 1 || i.getUTCDate() !== s))
|
|
872
|
-
return { year: t, month: e, day: s };
|
|
873
|
-
}
|
|
874
|
-
function N(r) {
|
|
875
|
-
const t = F(r);
|
|
876
|
-
return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : undefined;
|
|
877
|
-
}
|
|
878
|
-
function tt(r, t, e, s) {
|
|
879
|
-
const i = e ? { year: e.getUTCFullYear(), month: e.getUTCMonth() + 1, day: e.getUTCDate() } : null, n = s ? { year: s.getUTCFullYear(), month: s.getUTCMonth() + 1, day: s.getUTCDate() } : null;
|
|
880
|
-
return r === "year" ? { min: i?.year ?? 1, max: n?.year ?? 9999 } : r === "month" ? { min: i && t.year === i.year ? i.month : 1, max: n && t.year === n.year ? n.month : 12 } : { min: i && t.year === i.year && t.month === i.month ? i.day : 1, max: n && t.year === n.year && t.month === n.month ? n.day : T(t.year, t.month) };
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
class et extends p {
|
|
884
|
-
#e;
|
|
885
|
-
#o;
|
|
886
|
-
#t;
|
|
887
|
-
#n;
|
|
888
|
-
#a;
|
|
889
|
-
#s = { segmentIndex: 0, positionInSegment: 0 };
|
|
890
|
-
#i = true;
|
|
891
|
-
#r = null;
|
|
892
|
-
inlineError = "";
|
|
893
|
-
get segmentCursor() {
|
|
894
|
-
return { ...this.#s };
|
|
895
|
-
}
|
|
896
|
-
get segmentValues() {
|
|
897
|
-
return { ...this.#t };
|
|
898
|
-
}
|
|
899
|
-
get segments() {
|
|
900
|
-
return this.#e;
|
|
901
|
-
}
|
|
902
|
-
get separator() {
|
|
903
|
-
return this.#o;
|
|
904
|
-
}
|
|
905
|
-
get formattedValue() {
|
|
906
|
-
return this.#c(this.#t);
|
|
907
|
-
}
|
|
908
|
-
#c(t) {
|
|
909
|
-
return this.#e.map((e) => t[e.type]).join(this.#o);
|
|
910
|
-
}
|
|
911
|
-
#h() {
|
|
912
|
-
this._setUserInput(this.#c(this.#t)), this._setValue(N(this.#t) ?? undefined);
|
|
913
|
-
}
|
|
914
|
-
constructor(t) {
|
|
915
|
-
const e = t.format ? { segments: L(t.format), separator: t.separator ?? "/" } : Z(t.locale), s = t.separator ?? e.separator, i = t.format ? L(t.format) : e.segments, n = t.initialValue ?? t.defaultValue, o = n ? { year: String(n.getUTCFullYear()).padStart(4, "0"), month: String(n.getUTCMonth() + 1).padStart(2, "0"), day: String(n.getUTCDate()).padStart(2, "0") } : { year: "____", month: "__", day: "__" }, a = i.map((h) => o[h.type]).join(s);
|
|
916
|
-
super({ ...t, initialUserInput: a }, false), this.#e = i, this.#o = s, this.#t = o, this.#n = t.minDate, this.#a = t.maxDate, this.#h(), this.on("cursor", (h) => this.#d(h)), this.on("key", (h, l) => this.#f(h, l)), this.on("finalize", () => this.#g(t));
|
|
917
|
-
}
|
|
918
|
-
#u() {
|
|
919
|
-
const t = Math.max(0, Math.min(this.#s.segmentIndex, this.#e.length - 1)), e = this.#e[t];
|
|
920
|
-
if (e)
|
|
921
|
-
return this.#s.positionInSegment = Math.max(0, Math.min(this.#s.positionInSegment, e.len - 1)), { segment: e, index: t };
|
|
922
|
-
}
|
|
923
|
-
#l(t) {
|
|
924
|
-
this.inlineError = "", this.#r = null;
|
|
925
|
-
const e = this.#u();
|
|
926
|
-
e && (this.#s.segmentIndex = Math.max(0, Math.min(this.#e.length - 1, e.index + t)), this.#s.positionInSegment = 0, this.#i = true);
|
|
927
|
-
}
|
|
928
|
-
#p(t) {
|
|
929
|
-
const e = this.#u();
|
|
930
|
-
if (!e)
|
|
931
|
-
return;
|
|
932
|
-
const { segment: s } = e, i = this.#t[s.type], n = !i || i.replace(/_/g, "") === "", o = Number.parseInt((i || "0").replace(/_/g, "0"), 10) || 0, a = tt(s.type, I(this.#t), this.#n, this.#a);
|
|
933
|
-
let h;
|
|
934
|
-
n ? h = t === 1 ? a.min : a.max : h = Math.max(Math.min(a.max, o + t), a.min), this.#t = { ...this.#t, [s.type]: h.toString().padStart(s.len, "0") }, this.#i = true, this.#r = null, this.#h();
|
|
935
|
-
}
|
|
936
|
-
#d(t) {
|
|
937
|
-
if (t)
|
|
938
|
-
switch (t) {
|
|
939
|
-
case "right":
|
|
940
|
-
return this.#l(1);
|
|
941
|
-
case "left":
|
|
942
|
-
return this.#l(-1);
|
|
943
|
-
case "up":
|
|
944
|
-
return this.#p(1);
|
|
945
|
-
case "down":
|
|
946
|
-
return this.#p(-1);
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
#f(t, e) {
|
|
950
|
-
if (e?.name === "backspace" || e?.sequence === "\x7F" || e?.sequence === "\b" || t === "\x7F" || t === "\b") {
|
|
951
|
-
this.inlineError = "";
|
|
952
|
-
const s = this.#u();
|
|
953
|
-
if (!s)
|
|
954
|
-
return;
|
|
955
|
-
if (!this.#t[s.segment.type].replace(/_/g, "")) {
|
|
956
|
-
this.#l(-1);
|
|
957
|
-
return;
|
|
958
|
-
}
|
|
959
|
-
this.#t[s.segment.type] = "_".repeat(s.segment.len), this.#i = true, this.#s.positionInSegment = 0, this.#h();
|
|
960
|
-
return;
|
|
961
|
-
}
|
|
962
|
-
if (e?.name === "tab") {
|
|
963
|
-
this.inlineError = "";
|
|
964
|
-
const s = this.#u();
|
|
965
|
-
if (!s)
|
|
966
|
-
return;
|
|
967
|
-
const i = e.shift ? -1 : 1, n = s.index + i;
|
|
968
|
-
n >= 0 && n < this.#e.length && (this.#s.segmentIndex = n, this.#s.positionInSegment = 0, this.#i = true);
|
|
969
|
-
return;
|
|
970
|
-
}
|
|
971
|
-
if (t && /^[0-9]$/.test(t)) {
|
|
972
|
-
const s = this.#u();
|
|
973
|
-
if (!s)
|
|
974
|
-
return;
|
|
975
|
-
const { segment: i } = s, n = !this.#t[i.type].replace(/_/g, "");
|
|
976
|
-
if (this.#i && this.#r !== null && !n) {
|
|
977
|
-
const m = this.#r + t, g = { ...this.#t, [i.type]: m }, b = this.#m(g, i);
|
|
978
|
-
if (b) {
|
|
979
|
-
this.inlineError = b, this.#r = null, this.#i = false;
|
|
980
|
-
return;
|
|
981
|
-
}
|
|
982
|
-
this.inlineError = "", this.#t[i.type] = m, this.#r = null, this.#i = false, this.#h(), s.index < this.#e.length - 1 && (this.#s.segmentIndex = s.index + 1, this.#s.positionInSegment = 0, this.#i = true);
|
|
983
|
-
return;
|
|
984
|
-
}
|
|
985
|
-
this.#i && !n && (this.#t[i.type] = "_".repeat(i.len), this.#s.positionInSegment = 0), this.#i = false, this.#r = null;
|
|
986
|
-
const o = this.#t[i.type], a = o.indexOf("_"), h = a >= 0 ? a : Math.min(this.#s.positionInSegment, i.len - 1);
|
|
987
|
-
if (h < 0 || h >= i.len)
|
|
988
|
-
return;
|
|
989
|
-
let l = o.slice(0, h) + t + o.slice(h + 1), f = false;
|
|
990
|
-
if (h === 0 && o === "__" && (i.type === "month" || i.type === "day")) {
|
|
991
|
-
const m = Number.parseInt(t, 10);
|
|
992
|
-
l = `0${t}`, f = m <= (i.type === "month" ? 1 : 2);
|
|
993
|
-
}
|
|
994
|
-
if (i.type === "year" && (l = (o.replace(/_/g, "") + t).padStart(i.len, "_")), !l.includes("_")) {
|
|
995
|
-
const m = { ...this.#t, [i.type]: l }, g = this.#m(m, i);
|
|
996
|
-
if (g) {
|
|
997
|
-
this.inlineError = g;
|
|
998
|
-
return;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
this.inlineError = "", this.#t[i.type] = l;
|
|
1002
|
-
const v = l.includes("_") ? undefined : F(this.#t);
|
|
1003
|
-
if (v) {
|
|
1004
|
-
const { year: m, month: g } = v, b = T(m, g);
|
|
1005
|
-
this.#t = { year: String(Math.max(0, Math.min(9999, m))).padStart(4, "0"), month: String(Math.max(1, Math.min(12, g))).padStart(2, "0"), day: String(Math.max(1, Math.min(b, v.day))).padStart(2, "0") };
|
|
1006
|
-
}
|
|
1007
|
-
this.#h();
|
|
1008
|
-
const U = l.indexOf("_");
|
|
1009
|
-
f ? (this.#i = true, this.#r = t) : U >= 0 ? this.#s.positionInSegment = U : a >= 0 && s.index < this.#e.length - 1 ? (this.#s.segmentIndex = s.index + 1, this.#s.positionInSegment = 0, this.#i = true) : this.#s.positionInSegment = Math.min(h + 1, i.len - 1);
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
#m(t, e) {
|
|
1013
|
-
const { month: s, day: i } = I(t);
|
|
1014
|
-
if (e.type === "month" && (s < 0 || s > 12))
|
|
1015
|
-
return u.date.messages.invalidMonth;
|
|
1016
|
-
if (e.type === "day" && (i < 0 || i > 31))
|
|
1017
|
-
return u.date.messages.invalidDay(31, "any month");
|
|
1018
|
-
}
|
|
1019
|
-
#g(t) {
|
|
1020
|
-
const { year: e, month: s, day: i } = I(this.#t);
|
|
1021
|
-
if (e && s && i) {
|
|
1022
|
-
const n = T(e, s);
|
|
1023
|
-
this.#t = { ...this.#t, day: String(Math.min(i, n)).padStart(2, "0") };
|
|
1024
|
-
}
|
|
1025
|
-
this.value = N(this.#t) ?? t.defaultValue ?? undefined;
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
class st extends p {
|
|
1030
|
-
options;
|
|
1031
|
-
cursor = 0;
|
|
1032
|
-
#e;
|
|
1033
|
-
getGroupItems(t) {
|
|
1034
|
-
return this.options.filter((e) => e.group === t);
|
|
1035
|
-
}
|
|
1036
|
-
isGroupSelected(t) {
|
|
1037
|
-
const e = this.getGroupItems(t), s = this.value;
|
|
1038
|
-
return s === undefined ? false : e.every((i) => s.includes(i.value));
|
|
1039
|
-
}
|
|
1040
|
-
toggleValue() {
|
|
1041
|
-
const t = this.options[this.cursor];
|
|
1042
|
-
if (this.value === undefined && (this.value = []), t.group === true) {
|
|
1043
|
-
const e = t.value, s = this.getGroupItems(e);
|
|
1044
|
-
this.isGroupSelected(e) ? this.value = this.value.filter((i) => s.findIndex((n) => n.value === i) === -1) : this.value = [...this.value, ...s.map((i) => i.value)], this.value = Array.from(new Set(this.value));
|
|
1045
|
-
} else {
|
|
1046
|
-
const e = this.value.includes(t.value);
|
|
1047
|
-
this.value = e ? this.value.filter((s) => s !== t.value) : [...this.value, t.value];
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
constructor(t) {
|
|
1051
|
-
super(t, false);
|
|
1052
|
-
const { options: e } = t;
|
|
1053
|
-
this.#e = t.selectableGroups !== false, this.options = Object.entries(e).flatMap(([s, i]) => [{ value: s, group: true, label: s }, ...i.map((n) => ({ ...n, group: s }))]), this.value = [...t.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: s }) => s === t.cursorAt), this.#e ? 0 : 1), this.on("cursor", (s) => {
|
|
1054
|
-
switch (s) {
|
|
1055
|
-
case "left":
|
|
1056
|
-
case "up": {
|
|
1057
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1058
|
-
const i = this.options[this.cursor]?.group === true;
|
|
1059
|
-
!this.#e && i && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
1060
|
-
break;
|
|
1061
|
-
}
|
|
1062
|
-
case "down":
|
|
1063
|
-
case "right": {
|
|
1064
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1065
|
-
const i = this.options[this.cursor]?.group === true;
|
|
1066
|
-
!this.#e && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
1067
|
-
break;
|
|
1068
|
-
}
|
|
1069
|
-
case "space":
|
|
1070
|
-
this.toggleValue();
|
|
1071
|
-
break;
|
|
1072
|
-
}
|
|
1073
|
-
});
|
|
1074
|
-
}
|
|
1075
|
-
}
|
|
1076
768
|
var it = class extends p {
|
|
1077
769
|
options;
|
|
1078
770
|
cursor = 0;
|
|
@@ -1182,7 +874,7 @@ var w2 = (e, i) => ee ? e : i;
|
|
|
1182
874
|
var _e = w2("\u25C6", "*");
|
|
1183
875
|
var oe = w2("\u25A0", "x");
|
|
1184
876
|
var ue = w2("\u25B2", "x");
|
|
1185
|
-
var
|
|
877
|
+
var F = w2("\u25C7", "o");
|
|
1186
878
|
var le = w2("\u250C", "T");
|
|
1187
879
|
var d2 = w2("\u2502", "|");
|
|
1188
880
|
var E2 = w2("\u2514", "\u2014");
|
|
@@ -1192,7 +884,7 @@ var z2 = w2("\u25CF", ">");
|
|
|
1192
884
|
var H2 = w2("\u25CB", " ");
|
|
1193
885
|
var te = w2("\u25FB", "[\u2022]");
|
|
1194
886
|
var U = w2("\u25FC", "[+]");
|
|
1195
|
-
var
|
|
887
|
+
var J = w2("\u25FB", "[ ]");
|
|
1196
888
|
var xe = w2("\u25AA", "\u2022");
|
|
1197
889
|
var se = w2("\u2500", "-");
|
|
1198
890
|
var ce = w2("\u256E", "+");
|
|
@@ -1214,7 +906,7 @@ var V2 = (e) => {
|
|
|
1214
906
|
case "error":
|
|
1215
907
|
return t("yellow", ue);
|
|
1216
908
|
case "submit":
|
|
1217
|
-
return t("green",
|
|
909
|
+
return t("green", F);
|
|
1218
910
|
}
|
|
1219
911
|
};
|
|
1220
912
|
var ye = (e) => {
|
|
@@ -1232,77 +924,77 @@ var ye = (e) => {
|
|
|
1232
924
|
};
|
|
1233
925
|
var et2 = (e, i, s, r, u2) => {
|
|
1234
926
|
let n = i, o = 0;
|
|
1235
|
-
for (let
|
|
1236
|
-
const a = e[
|
|
927
|
+
for (let c = s;c < r; c++) {
|
|
928
|
+
const a = e[c];
|
|
1237
929
|
if (n = n - a.length, o++, n <= u2)
|
|
1238
930
|
break;
|
|
1239
931
|
}
|
|
1240
932
|
return { lineCount: n, removals: o };
|
|
1241
933
|
};
|
|
1242
934
|
var Y2 = ({ cursor: e, options: i, style: s, output: r = process.stdout, maxItems: u2 = Number.POSITIVE_INFINITY, columnPadding: n = 0, rowPadding: o = 4 }) => {
|
|
1243
|
-
const
|
|
1244
|
-
let
|
|
1245
|
-
e >=
|
|
1246
|
-
let m =
|
|
1247
|
-
const
|
|
935
|
+
const c = O(r) - n, a = A(r), l = t("dim", "..."), $ = Math.max(a - o, 0), y = Math.max(Math.min(u2, $), 5);
|
|
936
|
+
let p = 0;
|
|
937
|
+
e >= y - 3 && (p = Math.max(Math.min(e - y + 3, i.length - y), 0));
|
|
938
|
+
let m = y < i.length && p > 0, g = y < i.length && p + y < i.length;
|
|
939
|
+
const S = Math.min(p + y, i.length), h = [];
|
|
1248
940
|
let f = 0;
|
|
1249
941
|
m && f++, g && f++;
|
|
1250
|
-
const v =
|
|
1251
|
-
for (let b = v;b <
|
|
1252
|
-
const x = wrapAnsi(s(i[b], b === e),
|
|
942
|
+
const v = p + (m ? 1 : 0), T = S - (g ? 1 : 0);
|
|
943
|
+
for (let b = v;b < T; b++) {
|
|
944
|
+
const x = wrapAnsi(s(i[b], b === e), c, { hard: true, trim: false }).split(`
|
|
1253
945
|
`);
|
|
1254
946
|
h.push(x), f += x.length;
|
|
1255
947
|
}
|
|
1256
|
-
if (f > $
|
|
1257
|
-
let b = 0, x = 0,
|
|
1258
|
-
const
|
|
1259
|
-
m ? ({ lineCount:
|
|
948
|
+
if (f > $) {
|
|
949
|
+
let b = 0, x = 0, G = f;
|
|
950
|
+
const M = e - v, R = (j, D) => et2(h, G, j, D, $);
|
|
951
|
+
m ? ({ lineCount: G, removals: b } = R(0, M), G > $ && ({ lineCount: G, removals: x } = R(M + 1, h.length))) : ({ lineCount: G, removals: x } = R(M + 1, h.length), G > $ && ({ lineCount: G, removals: b } = R(0, M))), b > 0 && (m = true, h.splice(0, b)), x > 0 && (g = true, h.splice(h.length - x, x));
|
|
1260
952
|
}
|
|
1261
|
-
const
|
|
1262
|
-
m &&
|
|
953
|
+
const C = [];
|
|
954
|
+
m && C.push(l);
|
|
1263
955
|
for (const b of h)
|
|
1264
956
|
for (const x of b)
|
|
1265
|
-
|
|
1266
|
-
return g &&
|
|
957
|
+
C.push(x);
|
|
958
|
+
return g && C.push(l), C;
|
|
1267
959
|
};
|
|
1268
960
|
var ot2 = (e) => {
|
|
1269
961
|
const i = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1270
962
|
return new Q({ active: i, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
|
|
1271
|
-
const r = e.withGuide ?? u.withGuide, u2 = `${V2(this.state)} `, n = r ? `${t("gray", d2)} ` : "", o = R(e.output, e.message, n, u2),
|
|
963
|
+
const r = e.withGuide ?? u.withGuide, u2 = `${V2(this.state)} `, n = r ? `${t("gray", d2)} ` : "", o = R(e.output, e.message, n, u2), c = `${r ? `${t("gray", d2)}
|
|
1272
964
|
` : ""}${o}
|
|
1273
965
|
`, a = this.value ? i : s;
|
|
1274
966
|
switch (this.state) {
|
|
1275
967
|
case "submit": {
|
|
1276
968
|
const l = r ? `${t("gray", d2)} ` : "";
|
|
1277
|
-
return `${
|
|
969
|
+
return `${c}${l}${t("dim", a)}`;
|
|
1278
970
|
}
|
|
1279
971
|
case "cancel": {
|
|
1280
972
|
const l = r ? `${t("gray", d2)} ` : "";
|
|
1281
|
-
return `${
|
|
973
|
+
return `${c}${l}${t(["strikethrough", "dim"], a)}${r ? `
|
|
1282
974
|
${t("gray", d2)}` : ""}`;
|
|
1283
975
|
}
|
|
1284
976
|
default: {
|
|
1285
|
-
const l = r ? `${t("cyan", d2)} ` : "", $
|
|
1286
|
-
return `${
|
|
977
|
+
const l = r ? `${t("cyan", d2)} ` : "", $ = r ? t("cyan", E2) : "";
|
|
978
|
+
return `${c}${l}${this.value ? `${t("green", z2)} ${i}` : `${t("dim", H2)} ${t("dim", i)}`}${e.vertical ? r ? `
|
|
1287
979
|
${t("cyan", d2)} ` : `
|
|
1288
980
|
` : ` ${t("dim", "/")} `}${this.value ? `${t("dim", H2)} ${t("dim", s)}` : `${t("green", z2)} ${s}`}
|
|
1289
|
-
${$
|
|
981
|
+
${$}
|
|
1290
982
|
`;
|
|
1291
983
|
}
|
|
1292
984
|
}
|
|
1293
985
|
} }).prompt();
|
|
1294
986
|
};
|
|
1295
987
|
var O2 = { message: (e = [], { symbol: i = t("gray", d2), secondarySymbol: s = t("gray", d2), output: r = process.stdout, spacing: u2 = 1, withGuide: n } = {}) => {
|
|
1296
|
-
const o = [],
|
|
1297
|
-
for (let
|
|
988
|
+
const o = [], c = n ?? u.withGuide, a = c ? s : "", l = c ? `${i} ` : "", $ = c ? `${s} ` : "";
|
|
989
|
+
for (let p = 0;p < u2; p++)
|
|
1298
990
|
o.push(a);
|
|
1299
|
-
const
|
|
991
|
+
const y = Array.isArray(e) ? e : e.split(`
|
|
1300
992
|
`);
|
|
1301
|
-
if (
|
|
1302
|
-
const [
|
|
1303
|
-
|
|
993
|
+
if (y.length > 0) {
|
|
994
|
+
const [p, ...m] = y;
|
|
995
|
+
p.length > 0 ? o.push(`${l}${p}`) : o.push(c ? i : "");
|
|
1304
996
|
for (const g of m)
|
|
1305
|
-
g.length > 0 ? o.push(`${$
|
|
997
|
+
g.length > 0 ? o.push(`${$}${g}`) : o.push(c ? s : "");
|
|
1306
998
|
}
|
|
1307
999
|
r.write(`${o.join(`
|
|
1308
1000
|
`)}
|
|
@@ -1312,7 +1004,7 @@ var O2 = { message: (e = [], { symbol: i = t("gray", d2), secondarySymbol: s = t
|
|
|
1312
1004
|
}, success: (e, i) => {
|
|
1313
1005
|
O2.message(e, { ...i, symbol: t("green", pe) });
|
|
1314
1006
|
}, step: (e, i) => {
|
|
1315
|
-
O2.message(e, { ...i, symbol: t("green",
|
|
1007
|
+
O2.message(e, { ...i, symbol: t("green", F) });
|
|
1316
1008
|
}, warn: (e, i) => {
|
|
1317
1009
|
O2.message(e, { ...i, symbol: t("yellow", me) });
|
|
1318
1010
|
}, warning: (e, i) => {
|
|
@@ -1344,7 +1036,7 @@ var Q2 = (e, i) => e.split(`
|
|
|
1344
1036
|
var yt = (e) => {
|
|
1345
1037
|
const i = (r, u2) => {
|
|
1346
1038
|
const n = r.label ?? String(r.value);
|
|
1347
|
-
return u2 === "disabled" ? `${t("gray",
|
|
1039
|
+
return u2 === "disabled" ? `${t("gray", J)} ${Q2(n, (o) => t(["strikethrough", "gray"], o))}${r.hint ? ` ${t("dim", `(${r.hint ?? "disabled"})`)}` : ""}` : u2 === "active" ? `${t("cyan", te)} ${n}${r.hint ? ` ${t("dim", `(${r.hint})`)}` : ""}` : u2 === "selected" ? `${t("green", U)} ${Q2(n, (o) => t("dim", o))}${r.hint ? ` ${t("dim", `(${r.hint})`)}` : ""}` : u2 === "cancelled" ? `${Q2(n, (o) => t(["strikethrough", "dim"], o))}` : u2 === "active-selected" ? `${t("green", U)} ${n}${r.hint ? ` ${t("dim", `(${r.hint})`)}` : ""}` : u2 === "submitted" ? `${Q2(n, (o) => t("dim", o))}` : `${t("dim", J)} ${Q2(n, (o) => t("dim", o))}`;
|
|
1348
1040
|
}, s = e.required ?? true;
|
|
1349
1041
|
return new it({ options: e.options, signal: e.signal, input: e.input, output: e.output, initialValues: e.initialValues, required: s, cursorAt: e.cursorAt, validate(r) {
|
|
1350
1042
|
if (s && (r === undefined || r.length === 0))
|
|
@@ -1353,19 +1045,19 @@ ${t("reset", t("dim", `Press ${t(["gray", "bgWhite", "inverse"], " space ")} to
|
|
|
1353
1045
|
}, render() {
|
|
1354
1046
|
const r = e.withGuide ?? u.withGuide, u2 = R(e.output, e.message, r ? `${ye(this.state)} ` : "", `${V2(this.state)} `), n = `${r ? `${t("gray", d2)}
|
|
1355
1047
|
` : ""}${u2}
|
|
1356
|
-
`, o = this.value ?? [],
|
|
1048
|
+
`, o = this.value ?? [], c = (a, l) => {
|
|
1357
1049
|
if (a.disabled)
|
|
1358
1050
|
return i(a, "disabled");
|
|
1359
|
-
const $
|
|
1360
|
-
return l && $
|
|
1051
|
+
const $ = o.includes(a.value);
|
|
1052
|
+
return l && $ ? i(a, "active-selected") : $ ? i(a, "selected") : i(a, l ? "active" : "inactive");
|
|
1361
1053
|
};
|
|
1362
1054
|
switch (this.state) {
|
|
1363
1055
|
case "submit": {
|
|
1364
|
-
const a = this.options.filter(({ value: $
|
|
1056
|
+
const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "submitted")).join(t("dim", ", ")) || t("dim", "none"), l = R(e.output, a, r ? `${t("gray", d2)} ` : "");
|
|
1365
1057
|
return `${n}${l}`;
|
|
1366
1058
|
}
|
|
1367
1059
|
case "cancel": {
|
|
1368
|
-
const a = this.options.filter(({ value: $
|
|
1060
|
+
const a = this.options.filter(({ value: $ }) => o.includes($)).map(($) => i($, "cancelled")).join(t("dim", ", "));
|
|
1369
1061
|
if (a.trim() === "")
|
|
1370
1062
|
return `${n}${t("gray", d2)}`;
|
|
1371
1063
|
const l = R(e.output, a, r ? `${t("gray", d2)} ` : "");
|
|
@@ -1374,19 +1066,19 @@ ${t("gray", d2)}` : ""}`;
|
|
|
1374
1066
|
}
|
|
1375
1067
|
case "error": {
|
|
1376
1068
|
const a = r ? `${t("yellow", d2)} ` : "", l = this.error.split(`
|
|
1377
|
-
`).map((
|
|
1378
|
-
`), $
|
|
1379
|
-
`).length,
|
|
1069
|
+
`).map((p, m) => m === 0 ? `${r ? `${t("yellow", E2)} ` : ""}${t("yellow", p)}` : ` ${p}`).join(`
|
|
1070
|
+
`), $ = n.split(`
|
|
1071
|
+
`).length, y = l.split(`
|
|
1380
1072
|
`).length + 1;
|
|
1381
|
-
return `${n}${a}${Y2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: a.length, rowPadding: $
|
|
1073
|
+
return `${n}${a}${Y2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: a.length, rowPadding: $ + y, style: c }).join(`
|
|
1382
1074
|
${a}`)}
|
|
1383
1075
|
${l}
|
|
1384
1076
|
`;
|
|
1385
1077
|
}
|
|
1386
1078
|
default: {
|
|
1387
1079
|
const a = r ? `${t("cyan", d2)} ` : "", l = n.split(`
|
|
1388
|
-
`).length, $
|
|
1389
|
-
return `${n}${a}${Y2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: a.length, rowPadding: l +
|
|
1080
|
+
`).length, $ = r ? 2 : 1;
|
|
1081
|
+
return `${n}${a}${Y2({ output: e.output, options: this.options, cursor: this.cursor, maxItems: e.maxItems, columnPadding: a.length, rowPadding: l + $, style: c }).join(`
|
|
1390
1082
|
${a}`)}
|
|
1391
1083
|
${r ? t("cyan", E2) : ""}
|
|
1392
1084
|
`;
|
|
@@ -1395,60 +1087,60 @@ ${r ? t("cyan", E2) : ""}
|
|
|
1395
1087
|
} }).prompt();
|
|
1396
1088
|
};
|
|
1397
1089
|
var Ct = (e) => t("magenta", e);
|
|
1398
|
-
var fe = ({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u2, frames: n = ee ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: o = ee ? 80 : 120, signal:
|
|
1090
|
+
var fe = ({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u2, frames: n = ee ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: o = ee ? 80 : 120, signal: c, ...a } = {}) => {
|
|
1399
1091
|
const l = ae();
|
|
1400
|
-
let
|
|
1401
|
-
const f = O(s), v = a?.styleFrame ?? Ct,
|
|
1402
|
-
const
|
|
1403
|
-
m =
|
|
1404
|
-
},
|
|
1405
|
-
process.on("uncaughtExceptionMonitor",
|
|
1406
|
-
},
|
|
1407
|
-
process.removeListener("uncaughtExceptionMonitor",
|
|
1408
|
-
},
|
|
1409
|
-
if (
|
|
1092
|
+
let $, y, p = false, m = false, g = "", S, h = performance.now();
|
|
1093
|
+
const f = O(s), v = a?.styleFrame ?? Ct, T = (_) => {
|
|
1094
|
+
const A = _ > 1 ? u2 ?? u.messages.error : r ?? u.messages.cancel;
|
|
1095
|
+
m = _ === 1, p && (W(A, _), m && typeof i == "function" && i());
|
|
1096
|
+
}, C = () => T(2), b = () => T(1), x = () => {
|
|
1097
|
+
process.on("uncaughtExceptionMonitor", C), process.on("unhandledRejection", C), process.on("SIGINT", b), process.on("SIGTERM", b), process.on("exit", T), c && c.addEventListener("abort", b);
|
|
1098
|
+
}, G = () => {
|
|
1099
|
+
process.removeListener("uncaughtExceptionMonitor", C), process.removeListener("unhandledRejection", C), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", T), c && c.removeEventListener("abort", b);
|
|
1100
|
+
}, M = () => {
|
|
1101
|
+
if (S === undefined)
|
|
1410
1102
|
return;
|
|
1411
1103
|
l && s.write(`
|
|
1412
1104
|
`);
|
|
1413
|
-
const
|
|
1105
|
+
const _ = wrapAnsi(S, f, { hard: true, trim: false }).split(`
|
|
1414
1106
|
`);
|
|
1415
|
-
|
|
1416
|
-
},
|
|
1417
|
-
const
|
|
1418
|
-
return
|
|
1419
|
-
},
|
|
1420
|
-
|
|
1107
|
+
_.length > 1 && s.write(import_sisteransi2.cursor.up(_.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
|
|
1108
|
+
}, R = (_) => _.replace(/\.+$/, ""), j = (_) => {
|
|
1109
|
+
const A = (performance.now() - _) / 1000, k = Math.floor(A / 60), L = Math.floor(A % 60);
|
|
1110
|
+
return k > 0 ? `[${k}m ${L}s]` : `[${L}s]`;
|
|
1111
|
+
}, D = a.withGuide ?? u.withGuide, ie = (_ = "") => {
|
|
1112
|
+
p = true, $ = z({ output: s }), g = R(_), h = performance.now(), D && s.write(`${t("gray", d2)}
|
|
1421
1113
|
`);
|
|
1422
|
-
let
|
|
1423
|
-
x(),
|
|
1424
|
-
if (l && g ===
|
|
1114
|
+
let A = 0, k = 0;
|
|
1115
|
+
x(), y = setInterval(() => {
|
|
1116
|
+
if (l && g === S)
|
|
1425
1117
|
return;
|
|
1426
|
-
|
|
1427
|
-
const
|
|
1428
|
-
let
|
|
1118
|
+
M(), S = g;
|
|
1119
|
+
const L = v(n[A]);
|
|
1120
|
+
let Z;
|
|
1429
1121
|
if (l)
|
|
1430
|
-
|
|
1122
|
+
Z = `${L} ${g}...`;
|
|
1431
1123
|
else if (e === "timer")
|
|
1432
|
-
|
|
1124
|
+
Z = `${L} ${g} ${j(h)}`;
|
|
1433
1125
|
else {
|
|
1434
|
-
const Be = ".".repeat(Math.floor(
|
|
1435
|
-
|
|
1126
|
+
const Be = ".".repeat(Math.floor(k)).slice(0, 3);
|
|
1127
|
+
Z = `${L} ${g}${Be}`;
|
|
1436
1128
|
}
|
|
1437
|
-
const Ne = wrapAnsi(
|
|
1438
|
-
s.write(Ne),
|
|
1129
|
+
const Ne = wrapAnsi(Z, f, { hard: true, trim: false });
|
|
1130
|
+
s.write(Ne), A = A + 1 < n.length ? A + 1 : 0, k = k < 4 ? k + 0.125 : 0;
|
|
1439
1131
|
}, o);
|
|
1440
|
-
},
|
|
1441
|
-
if (!
|
|
1132
|
+
}, W = (_ = "", A = 0, k = false) => {
|
|
1133
|
+
if (!p)
|
|
1442
1134
|
return;
|
|
1443
|
-
|
|
1444
|
-
const
|
|
1445
|
-
g =
|
|
1446
|
-
`) : s.write(`${
|
|
1447
|
-
`)),
|
|
1135
|
+
p = false, clearInterval(y), M();
|
|
1136
|
+
const L = A === 0 ? t("green", F) : A === 1 ? t("red", oe) : t("red", ue);
|
|
1137
|
+
g = _ ?? g, k || (e === "timer" ? s.write(`${L} ${g} ${j(h)}
|
|
1138
|
+
`) : s.write(`${L} ${g}
|
|
1139
|
+
`)), G(), $();
|
|
1448
1140
|
};
|
|
1449
|
-
return { start: ie, stop: (
|
|
1450
|
-
g =
|
|
1451
|
-
}, cancel: (
|
|
1141
|
+
return { start: ie, stop: (_ = "") => W(_, 0), message: (_ = "") => {
|
|
1142
|
+
g = R(_ ?? g);
|
|
1143
|
+
}, cancel: (_ = "") => W(_, 1), error: (_ = "") => W(_, 2), clear: () => W("", 0, true), get isCancelled() {
|
|
1452
1144
|
return m;
|
|
1453
1145
|
} };
|
|
1454
1146
|
};
|
|
@@ -1479,19 +1171,19 @@ var _t = (e) => {
|
|
|
1479
1171
|
`;
|
|
1480
1172
|
switch (this.state) {
|
|
1481
1173
|
case "submit": {
|
|
1482
|
-
const
|
|
1174
|
+
const c = s ? `${t("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "selected"), c);
|
|
1483
1175
|
return `${o}${a}`;
|
|
1484
1176
|
}
|
|
1485
1177
|
case "cancel": {
|
|
1486
|
-
const
|
|
1178
|
+
const c = s ? `${t("gray", d2)} ` : "", a = R(e.output, i(this.options[this.cursor], "cancelled"), c);
|
|
1487
1179
|
return `${o}${a}${s ? `
|
|
1488
1180
|
${t("gray", d2)}` : ""}`;
|
|
1489
1181
|
}
|
|
1490
1182
|
default: {
|
|
1491
|
-
const
|
|
1492
|
-
`).length, $
|
|
1493
|
-
return `${o}${
|
|
1494
|
-
${
|
|
1183
|
+
const c = s ? `${t("cyan", d2)} ` : "", a = s ? t("cyan", E2) : "", l = o.split(`
|
|
1184
|
+
`).length, $ = s ? 2 : 1;
|
|
1185
|
+
return `${o}${c}${Y2({ output: e.output, cursor: this.cursor, options: this.options, maxItems: e.maxItems, columnPadding: c.length, rowPadding: l + $, style: (y, p) => i(y, y.disabled ? "disabled" : p ? "active" : "inactive") }).join(`
|
|
1186
|
+
${c}`)}
|
|
1495
1187
|
${a}
|
|
1496
1188
|
`;
|
|
1497
1189
|
}
|
|
@@ -1505,25 +1197,25 @@ var Ot = (e) => new at({ validate: e.validate, placeholder: e.placeholder, defau
|
|
|
1505
1197
|
`, r = e.placeholder ? t("inverse", e.placeholder[0]) + t("dim", e.placeholder.slice(1)) : t(["inverse", "hidden"], "_"), u2 = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
|
|
1506
1198
|
switch (this.state) {
|
|
1507
1199
|
case "error": {
|
|
1508
|
-
const o = this.error ? ` ${t("yellow", this.error)}` : "",
|
|
1200
|
+
const o = this.error ? ` ${t("yellow", this.error)}` : "", c = i ? `${t("yellow", d2)} ` : "", a = i ? t("yellow", E2) : "";
|
|
1509
1201
|
return `${s.trim()}
|
|
1510
|
-
${
|
|
1202
|
+
${c}${u2}
|
|
1511
1203
|
${a}${o}
|
|
1512
1204
|
`;
|
|
1513
1205
|
}
|
|
1514
1206
|
case "submit": {
|
|
1515
|
-
const o = n ? ` ${t("dim", n)}` : "",
|
|
1516
|
-
return `${s}${
|
|
1207
|
+
const o = n ? ` ${t("dim", n)}` : "", c = i ? t("gray", d2) : "";
|
|
1208
|
+
return `${s}${c}${o}`;
|
|
1517
1209
|
}
|
|
1518
1210
|
case "cancel": {
|
|
1519
|
-
const o = n ? ` ${t(["strikethrough", "dim"], n)}` : "",
|
|
1520
|
-
return `${s}${
|
|
1521
|
-
${
|
|
1211
|
+
const o = n ? ` ${t(["strikethrough", "dim"], n)}` : "", c = i ? t("gray", d2) : "";
|
|
1212
|
+
return `${s}${c}${o}${n.trim() ? `
|
|
1213
|
+
${c}` : ""}`;
|
|
1522
1214
|
}
|
|
1523
1215
|
default: {
|
|
1524
|
-
const o = i ? `${t("cyan", d2)} ` : "",
|
|
1216
|
+
const o = i ? `${t("cyan", d2)} ` : "", c = i ? t("cyan", E2) : "";
|
|
1525
1217
|
return `${s}${o}${u2}
|
|
1526
|
-
${
|
|
1218
|
+
${c}
|
|
1527
1219
|
`;
|
|
1528
1220
|
}
|
|
1529
1221
|
}
|
|
@@ -2286,14 +1978,14 @@ var AI_EXCLUDE_LINES = [
|
|
|
2286
1978
|
"/opencode.json",
|
|
2287
1979
|
"/.claude/"
|
|
2288
1980
|
];
|
|
2289
|
-
function getTemplateUrls(
|
|
1981
|
+
function getTemplateUrls() {
|
|
2290
1982
|
return [
|
|
2291
|
-
new URL(
|
|
2292
|
-
new URL(
|
|
1983
|
+
new URL("../templates/AGENTS.md", import.meta.url),
|
|
1984
|
+
new URL("../../templates/AGENTS.md", import.meta.url)
|
|
2293
1985
|
];
|
|
2294
1986
|
}
|
|
2295
|
-
async function createAiDocContent(
|
|
2296
|
-
const templateUrls = getTemplateUrls(
|
|
1987
|
+
async function createAiDocContent() {
|
|
1988
|
+
const templateUrls = getTemplateUrls();
|
|
2297
1989
|
for (const templateUrl of templateUrls) {
|
|
2298
1990
|
const templateFile = Bun.file(templateUrl);
|
|
2299
1991
|
const exists = await templateFile.exists().then((value) => value, () => false);
|
|
@@ -2309,7 +2001,7 @@ async function generateAiDoc(projectPath, aiSetup) {
|
|
|
2309
2001
|
return;
|
|
2310
2002
|
}
|
|
2311
2003
|
const outputPath = join3(projectPath, filename);
|
|
2312
|
-
const content = await createAiDocContent(
|
|
2004
|
+
const content = await createAiDocContent();
|
|
2313
2005
|
await Bun.write(outputPath, content).then(() => {
|
|
2314
2006
|
return;
|
|
2315
2007
|
}, () => {
|
|
@@ -2841,11 +2533,11 @@ async function runWizard() {
|
|
|
2841
2533
|
}
|
|
2842
2534
|
useRgl = rglChoice;
|
|
2843
2535
|
}
|
|
2844
|
-
const
|
|
2536
|
+
const installRockide = await ot2({
|
|
2845
2537
|
message: `${import_picocolors2.default.bold("Install Rockide?")} ${import_picocolors2.default.dim("VSCode extension for Bedrock JSON autocompletion")}`,
|
|
2846
2538
|
initialValue: true
|
|
2847
2539
|
});
|
|
2848
|
-
if (q(
|
|
2540
|
+
if (q(installRockide)) {
|
|
2849
2541
|
return abortWizard();
|
|
2850
2542
|
}
|
|
2851
2543
|
const aiSetup = await _t({
|
|
@@ -2882,7 +2574,7 @@ async function runWizard() {
|
|
|
2882
2574
|
useMarketplaceStructure,
|
|
2883
2575
|
useRgl: scripting === "none" ? false : useRgl,
|
|
2884
2576
|
aiSetup,
|
|
2885
|
-
installRockide
|
|
2577
|
+
installRockide,
|
|
2886
2578
|
installPonytail
|
|
2887
2579
|
};
|
|
2888
2580
|
showReview(config);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spawnpack",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "Minecraft Bedrock addon project generator — scaffold your BP+RP in seconds",
|
|
5
5
|
"author": "veedy-dev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"bin/spawnpack.js",
|
|
13
13
|
"dist/spawnpack.js",
|
|
14
|
-
"templates/CLAUDE.md",
|
|
15
14
|
"templates/AGENTS.md",
|
|
16
15
|
"templates/filters/typegen/main.js",
|
|
17
16
|
"README.md",
|
package/templates/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Documentation lookup
|
|
2
2
|
|
|
3
|
-
- Before
|
|
3
|
+
- Before relying on version-sensitive or unfamiliar Minecraft Bedrock behavior, verify the relevant current documentation for the project's target Minecraft and Script API versions and stable/preview status. This includes Script API, BP/RP JSON formats, components, events, schemas, MoLang, manifests, commands, animations, and pack behavior.
|
|
4
4
|
- Prefer Exa MCP for documentation and web research. If Exa is unavailable, use built-in web search or browsing. Use Context7 only as a last resort because its indexed documentation may lag behind current releases.
|
|
5
5
|
- Prefer current Microsoft Creator documentation and versioned references on `bedrock.dev`. For Script API, also use `https://jaylydev.github.io/scriptapi-docs/latest/`. Use `wiki.bedrock.dev` for established concepts and proven implementation patterns. Confirm stable versus preview status and the target Minecraft version.
|
|
6
6
|
- For other external libraries, frameworks, SDKs, APIs, and CLI tools, verify current official documentation before relying on unfamiliar or version-sensitive behavior.
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
- Before adding `system.runInterval` polling, check the project's Script API version and current documentation for a matching event. Prefer the event when it provides the required data and timing, such as `PlayerInventoryItemChangeAfterEventSignal` instead of repeatedly scanning every player's inventory or hotbar for item changes. Poll only when no suitable event exists or the event cannot represent the required behavior; then minimize the polling frequency, players, slots, and work performed.
|
|
37
37
|
- In hot loops, iterate maps directly with `for (const value of map.values())`. Do not spread maps into temporary arrays or iterate entry pairs when values or keys are enough.
|
|
38
38
|
- Cache stable configuration in memory and persist only when values actually change.
|
|
39
|
-
- Guard invalid states with conditions before they reach the API — unloaded chunks or locations, invalid or despawned entities, etc so Minecraft Bedrock does not throw. Guards are required wherever a state check is possible. Prefer guards over `try-catch`; `try-catch` is allowed only for documented or observed unguardable failures, and must perform meaningful recovery — never rely on it as routine control flow or swallow errors.
|
|
40
39
|
|
|
41
40
|
## Repository hygiene
|
|
42
41
|
|
package/templates/CLAUDE.md
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
## Documentation lookup
|
|
2
|
-
|
|
3
|
-
- Before planning or implementing any Minecraft Bedrock change, verify the current relevant documentation. This includes Script API and BP/RP JSON formats, components, events, schemas, MoLang, manifests, commands, animations, and pack behavior.
|
|
4
|
-
- Prefer Exa MCP for documentation and web research. If Exa is unavailable, use built-in web search or browsing. Use Context7 only as a last resort because its indexed documentation may lag behind current releases.
|
|
5
|
-
- Prefer current Microsoft Creator documentation and versioned references on `bedrock.dev`. For Script API, also use `https://jaylydev.github.io/scriptapi-docs/latest/`. Use `wiki.bedrock.dev` for established concepts and proven implementation patterns. Confirm stable versus preview status and the target Minecraft version.
|
|
6
|
-
- For other external libraries, frameworks, SDKs, APIs, and CLI tools, verify current official documentation before relying on unfamiliar or version-sensitive behavior.
|
|
7
|
-
|
|
8
|
-
## Technical judgment
|
|
9
|
-
|
|
10
|
-
- Do not assume the user or the agent is correct. Before implementing, verify assumptions against current documentation, repository evidence, established patterns, or a working project sample.
|
|
11
|
-
- If those sources do not resolve a choice that materially affects the result, ask the user for a reference, pattern, or sample project.
|
|
12
|
-
- If evidence shows the requested approach is incorrect, unsafe, incompatible, unnecessarily complex, or slower than a supported alternative, explain why and recommend the better implementation. Follow the user's final choice unless it violates safety or repository constraints.
|
|
13
|
-
|
|
14
|
-
## Verification
|
|
15
|
-
|
|
16
|
-
- After TypeScript changes, run `tsc --noEmit`.
|
|
17
|
-
- For JavaScript, run the project's configured `npm run typecheck` or `npm run check` script when present.
|
|
18
|
-
- Do not create or run tests unless the user asks or an existing repository policy explicitly requires them.
|
|
19
|
-
- If the relevant command is unavailable or fails for a pre-existing reason, state that plainly.
|
|
20
|
-
|
|
21
|
-
## Code rules
|
|
22
|
-
|
|
23
|
-
- Do not write comments in code. Use clear naming and straightforward structure so the code is self-explanatory.
|
|
24
|
-
- Validate predictable invalid states before calling an API. Use `try-catch` only for a documented or observed unguardable failure when the catch performs meaningful recovery, cleanup, translation, or contextual rethrow. Keep the `try` block narrow; never silently swallow errors.
|
|
25
|
-
|
|
26
|
-
## Minecraft Bedrock conventions
|
|
27
|
-
|
|
28
|
-
- Guard before Script API calls that can throw: check `entity.isValid` (players are valid only while loaded) before `getComponent`/`getComponents`; confirm the chunk is loaded before `dimension.getBlock`/`spawnEntity`; and use containers only after re-fetching them from a current block or entity rather than holding a stale reference. Defer world-mutating work from read-only or early-execution callbacks with `system.run`. Reserve `try-catch` for calls whose validity cannot be checked in advance, such as `runCommand` throwing `CommandError`.
|
|
29
|
-
- Prefer `@minecraft/vanilla-data` typed identifiers over raw component, entity, block, item, and effect strings.
|
|
30
|
-
- Check `@minecraft/math` before writing vector, matrix, clamp, lerp, or similar math helpers.
|
|
31
|
-
- Validate changed BP/RP JSON against the project's configured Bedrock schemas when available.
|
|
32
|
-
- In Regolith projects, inspect compilation output through `.regolith/tmp` without resolving its symlinks.
|
|
33
|
-
|
|
34
|
-
## Performance preferences
|
|
35
|
-
|
|
36
|
-
- Before adding `system.runInterval` polling, check the project's Script API version and current documentation for a matching event. Prefer the event when it provides the required data and timing, such as `PlayerInventoryItemChangeAfterEventSignal` instead of repeatedly scanning every player's inventory or hotbar for item changes. Poll only when no suitable event exists or the event cannot represent the required behavior; then minimize the polling frequency, players, slots, and work performed.
|
|
37
|
-
- In hot loops, iterate maps directly with `for (const value of map.values())`. Do not spread maps into temporary arrays or iterate entry pairs when values or keys are enough.
|
|
38
|
-
- Cache stable configuration in memory and persist only when values actually change.
|
|
39
|
-
- Guard invalid states with conditions before they reach the API — unloaded chunks or locations, invalid or despawned entities, etc so Minecraft Bedrock does not throw. Guards are required wherever a state check is possible. Prefer guards over `try-catch`; `try-catch` is allowed only for documented or observed unguardable failures, and must perform meaningful recovery — never rely on it as routine control flow or swallow errors.
|
|
40
|
-
|
|
41
|
-
## Repository hygiene
|
|
42
|
-
|
|
43
|
-
- Never discard, overwrite, or revert unrelated user changes.
|
|
44
|
-
- Do not create repository files for agent memory, lessons, session notes, plans, or debugging logs.
|
|
45
|
-
- Do not create or update documentation, changelogs, or generated artifacts unless requested or required by the changed contract.
|
|
46
|
-
- Do not commit, push, publish, or delete unrelated files unless explicitly requested.
|
|
47
|
-
- Commit messages, when requested, use short natural subjects without Conventional Commit prefixes, AI/tool attribution, or structured report trailers. Split unrelated logical changes into separate commits.
|
|
48
|
-
|
|
49
|
-
## Communication
|
|
50
|
-
|
|
51
|
-
- Be direct and concise. State assumptions only when they materially affect the implementation.
|
|
52
|
-
- After changes, report what changed, the verification evidence, and any real blocker or residual risk. Do not add ritual sections for untouched files.
|