@itsflower/cli 0.2.8 → 0.2.9
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 +43 -0
- package/dist/main.js +791 -495
- package/package.json +3 -2
package/dist/main.js
CHANGED
|
@@ -593,142 +593,18 @@ var init_dist = __esm(() => {
|
|
|
593
593
|
negativePrefixRe = /^no[-A-Z]/;
|
|
594
594
|
});
|
|
595
595
|
|
|
596
|
-
// ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
597
|
-
var require_src = __commonJS((exports, module) => {
|
|
598
|
-
var ESC2 = "\x1B";
|
|
599
|
-
var CSI2 = `${ESC2}[`;
|
|
600
|
-
var beep = "\x07";
|
|
601
|
-
var cursor = {
|
|
602
|
-
to(x, y) {
|
|
603
|
-
if (!y)
|
|
604
|
-
return `${CSI2}${x + 1}G`;
|
|
605
|
-
return `${CSI2}${y + 1};${x + 1}H`;
|
|
606
|
-
},
|
|
607
|
-
move(x, y) {
|
|
608
|
-
let ret = "";
|
|
609
|
-
if (x < 0)
|
|
610
|
-
ret += `${CSI2}${-x}D`;
|
|
611
|
-
else if (x > 0)
|
|
612
|
-
ret += `${CSI2}${x}C`;
|
|
613
|
-
if (y < 0)
|
|
614
|
-
ret += `${CSI2}${-y}A`;
|
|
615
|
-
else if (y > 0)
|
|
616
|
-
ret += `${CSI2}${y}B`;
|
|
617
|
-
return ret;
|
|
618
|
-
},
|
|
619
|
-
up: (count = 1) => `${CSI2}${count}A`,
|
|
620
|
-
down: (count = 1) => `${CSI2}${count}B`,
|
|
621
|
-
forward: (count = 1) => `${CSI2}${count}C`,
|
|
622
|
-
backward: (count = 1) => `${CSI2}${count}D`,
|
|
623
|
-
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
624
|
-
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
625
|
-
left: `${CSI2}G`,
|
|
626
|
-
hide: `${CSI2}?25l`,
|
|
627
|
-
show: `${CSI2}?25h`,
|
|
628
|
-
save: `${ESC2}7`,
|
|
629
|
-
restore: `${ESC2}8`
|
|
630
|
-
};
|
|
631
|
-
var scroll = {
|
|
632
|
-
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
633
|
-
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
634
|
-
};
|
|
635
|
-
var erase = {
|
|
636
|
-
screen: `${CSI2}2J`,
|
|
637
|
-
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
638
|
-
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
639
|
-
line: `${CSI2}2K`,
|
|
640
|
-
lineEnd: `${CSI2}K`,
|
|
641
|
-
lineStart: `${CSI2}1K`,
|
|
642
|
-
lines(count) {
|
|
643
|
-
let clear = "";
|
|
644
|
-
for (let i = 0;i < count; i++)
|
|
645
|
-
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
646
|
-
if (count)
|
|
647
|
-
clear += cursor.left;
|
|
648
|
-
return clear;
|
|
649
|
-
}
|
|
650
|
-
};
|
|
651
|
-
module.exports = { cursor, scroll, erase, beep };
|
|
652
|
-
});
|
|
653
|
-
|
|
654
|
-
// package.json
|
|
655
|
-
var package_default;
|
|
656
|
-
var init_package = __esm(() => {
|
|
657
|
-
package_default = {
|
|
658
|
-
name: "@itsflower/cli",
|
|
659
|
-
version: "0.2.8",
|
|
660
|
-
description: "CLI for Flower - scaffold structured development workflows",
|
|
661
|
-
bin: {
|
|
662
|
-
flower: "./dist/main.js"
|
|
663
|
-
},
|
|
664
|
-
files: [
|
|
665
|
-
"dist"
|
|
666
|
-
],
|
|
667
|
-
type: "module",
|
|
668
|
-
scripts: {
|
|
669
|
-
build: "bun build ./src/main.ts --outdir ./dist --target node",
|
|
670
|
-
dev: "bun run ./src/main.ts",
|
|
671
|
-
typecheck: "tsc --noEmit"
|
|
672
|
-
},
|
|
673
|
-
dependencies: {
|
|
674
|
-
"@clack/prompts": "^1.2.0",
|
|
675
|
-
citty: "^0.2.2"
|
|
676
|
-
},
|
|
677
|
-
devDependencies: {
|
|
678
|
-
"@types/bun": "^1.3.12",
|
|
679
|
-
typescript: "^6.0.2"
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
});
|
|
683
|
-
|
|
684
|
-
// src/commands/version.ts
|
|
685
|
-
var exports_version = {};
|
|
686
|
-
__export(exports_version, {
|
|
687
|
-
default: () => version_default
|
|
688
|
-
});
|
|
689
|
-
var version_default;
|
|
690
|
-
var init_version = __esm(() => {
|
|
691
|
-
init_dist();
|
|
692
|
-
init_package();
|
|
693
|
-
version_default = defineCommand({
|
|
694
|
-
meta: {
|
|
695
|
-
name: "version",
|
|
696
|
-
description: "Display the current version"
|
|
697
|
-
},
|
|
698
|
-
run: () => {
|
|
699
|
-
console.log(`${package_default.name}@${package_default.version}`);
|
|
700
|
-
}
|
|
701
|
-
});
|
|
702
|
-
});
|
|
703
|
-
|
|
704
|
-
// src/main.ts
|
|
705
|
-
init_dist();
|
|
706
|
-
|
|
707
|
-
// ../../node_modules/.bun/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
708
|
-
import { styleText as y } from "node:util";
|
|
709
|
-
import { stdout as S, stdin as $ } from "node:process";
|
|
710
|
-
import P from "node:readline";
|
|
711
|
-
|
|
712
596
|
// ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
|
|
713
597
|
var isAmbiguous = (x) => {
|
|
714
598
|
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
715
|
-
}
|
|
716
|
-
var isFullWidth = (x) => {
|
|
599
|
+
}, isFullWidth = (x) => {
|
|
717
600
|
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
718
|
-
}
|
|
719
|
-
var isWide = (x) => {
|
|
601
|
+
}, isWide = (x) => {
|
|
720
602
|
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
721
603
|
};
|
|
604
|
+
var init_utils = () => {};
|
|
722
605
|
|
|
723
606
|
// ../../node_modules/.bun/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
|
|
724
|
-
var ANSI_RE =
|
|
725
|
-
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
726
|
-
var TAB_RE = /\t{1,1000}/y;
|
|
727
|
-
var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
728
|
-
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
729
|
-
var MODIFIER_RE = /\p{M}+/gu;
|
|
730
|
-
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
731
|
-
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
607
|
+
var ANSI_RE, CONTROL_RE, TAB_RE, EMOJI_RE, LATIN_RE, MODIFIER_RE, NO_TRUNCATION, getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
732
608
|
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
733
609
|
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
734
610
|
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
@@ -870,31 +746,39 @@ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {})
|
|
|
870
746
|
truncated: truncationEnabled,
|
|
871
747
|
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
872
748
|
};
|
|
873
|
-
};
|
|
874
|
-
var
|
|
749
|
+
}, dist_default;
|
|
750
|
+
var init_dist2 = __esm(() => {
|
|
751
|
+
init_utils();
|
|
752
|
+
ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
753
|
+
CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
754
|
+
TAB_RE = /\t{1,1000}/y;
|
|
755
|
+
EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
|
|
756
|
+
LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
757
|
+
MODIFIER_RE = /\p{M}+/gu;
|
|
758
|
+
NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
759
|
+
dist_default = getStringTruncatedWidth;
|
|
760
|
+
});
|
|
875
761
|
|
|
876
762
|
// ../../node_modules/.bun/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
|
|
877
|
-
var NO_TRUNCATION2 = {
|
|
878
|
-
limit: Infinity,
|
|
879
|
-
ellipsis: "",
|
|
880
|
-
ellipsisWidth: 0
|
|
881
|
-
};
|
|
882
|
-
var fastStringWidth = (input, options = {}) => {
|
|
763
|
+
var NO_TRUNCATION2, fastStringWidth = (input, options = {}) => {
|
|
883
764
|
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
884
|
-
};
|
|
885
|
-
var
|
|
765
|
+
}, dist_default2;
|
|
766
|
+
var init_dist3 = __esm(() => {
|
|
767
|
+
init_dist2();
|
|
768
|
+
NO_TRUNCATION2 = {
|
|
769
|
+
limit: Infinity,
|
|
770
|
+
ellipsis: "",
|
|
771
|
+
ellipsisWidth: 0
|
|
772
|
+
};
|
|
773
|
+
dist_default2 = fastStringWidth;
|
|
774
|
+
});
|
|
886
775
|
|
|
887
776
|
// ../../node_modules/.bun/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
var ANSI_CSI = "["
|
|
893
|
-
var ANSI_OSC = "]";
|
|
894
|
-
var ANSI_SGR_TERMINATOR = "m";
|
|
895
|
-
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
896
|
-
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
897
|
-
var getClosingCode = (openingCode) => {
|
|
777
|
+
function wrapAnsi(string, columns, options) {
|
|
778
|
+
return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
|
|
779
|
+
`);
|
|
780
|
+
}
|
|
781
|
+
var ESC = "\x1B", CSI = "", END_CODE = 39, ANSI_ESCAPE_BELL = "\x07", ANSI_CSI = "[", ANSI_OSC = "]", ANSI_SGR_TERMINATOR = "m", ANSI_ESCAPE_LINK, GROUP_REGEX, getClosingCode = (openingCode) => {
|
|
898
782
|
if (openingCode >= 30 && openingCode <= 37)
|
|
899
783
|
return 39;
|
|
900
784
|
if (openingCode >= 90 && openingCode <= 97)
|
|
@@ -918,10 +802,7 @@ var getClosingCode = (openingCode) => {
|
|
|
918
802
|
if (openingCode === 0)
|
|
919
803
|
return 0;
|
|
920
804
|
return;
|
|
921
|
-
}
|
|
922
|
-
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
923
|
-
var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
924
|
-
var wrapWord = (rows, word, columns) => {
|
|
805
|
+
}, wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`, wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`, wrapWord = (rows, word, columns) => {
|
|
925
806
|
const characters = word[Symbol.iterator]();
|
|
926
807
|
let isInsideEscape = false;
|
|
927
808
|
let isInsideLinkEscape = false;
|
|
@@ -967,8 +848,7 @@ var wrapWord = (rows, word, columns) => {
|
|
|
967
848
|
if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
|
|
968
849
|
rows[rows.length - 2] += rows.pop();
|
|
969
850
|
}
|
|
970
|
-
}
|
|
971
|
-
var stringVisibleTrimSpacesRight = (string) => {
|
|
851
|
+
}, stringVisibleTrimSpacesRight = (string) => {
|
|
972
852
|
const words = string.split(" ");
|
|
973
853
|
let last = words.length;
|
|
974
854
|
while (last) {
|
|
@@ -981,8 +861,7 @@ var stringVisibleTrimSpacesRight = (string) => {
|
|
|
981
861
|
return string;
|
|
982
862
|
}
|
|
983
863
|
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
984
|
-
}
|
|
985
|
-
var exec = (string, columns, options = {}) => {
|
|
864
|
+
}, exec = (string, columns, options = {}) => {
|
|
986
865
|
if (options.trim !== false && string.trim() === "") {
|
|
987
866
|
return "";
|
|
988
867
|
}
|
|
@@ -1086,24 +965,84 @@ var exec = (string, columns, options = {}) => {
|
|
|
1086
965
|
}
|
|
1087
966
|
}
|
|
1088
967
|
return returnValue;
|
|
1089
|
-
};
|
|
1090
|
-
var
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
`);
|
|
1094
|
-
|
|
968
|
+
}, CRLF_OR_LF;
|
|
969
|
+
var init_main = __esm(() => {
|
|
970
|
+
init_dist3();
|
|
971
|
+
ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
972
|
+
GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
973
|
+
CRLF_OR_LF = /\r?\n/;
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
// ../../node_modules/.bun/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
977
|
+
var require_src = __commonJS((exports, module) => {
|
|
978
|
+
var ESC2 = "\x1B";
|
|
979
|
+
var CSI2 = `${ESC2}[`;
|
|
980
|
+
var beep = "\x07";
|
|
981
|
+
var cursor = {
|
|
982
|
+
to(x, y) {
|
|
983
|
+
if (!y)
|
|
984
|
+
return `${CSI2}${x + 1}G`;
|
|
985
|
+
return `${CSI2}${y + 1};${x + 1}H`;
|
|
986
|
+
},
|
|
987
|
+
move(x, y) {
|
|
988
|
+
let ret = "";
|
|
989
|
+
if (x < 0)
|
|
990
|
+
ret += `${CSI2}${-x}D`;
|
|
991
|
+
else if (x > 0)
|
|
992
|
+
ret += `${CSI2}${x}C`;
|
|
993
|
+
if (y < 0)
|
|
994
|
+
ret += `${CSI2}${-y}A`;
|
|
995
|
+
else if (y > 0)
|
|
996
|
+
ret += `${CSI2}${y}B`;
|
|
997
|
+
return ret;
|
|
998
|
+
},
|
|
999
|
+
up: (count = 1) => `${CSI2}${count}A`,
|
|
1000
|
+
down: (count = 1) => `${CSI2}${count}B`,
|
|
1001
|
+
forward: (count = 1) => `${CSI2}${count}C`,
|
|
1002
|
+
backward: (count = 1) => `${CSI2}${count}D`,
|
|
1003
|
+
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
1004
|
+
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
1005
|
+
left: `${CSI2}G`,
|
|
1006
|
+
hide: `${CSI2}?25l`,
|
|
1007
|
+
show: `${CSI2}?25h`,
|
|
1008
|
+
save: `${ESC2}7`,
|
|
1009
|
+
restore: `${ESC2}8`
|
|
1010
|
+
};
|
|
1011
|
+
var scroll = {
|
|
1012
|
+
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
1013
|
+
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
1014
|
+
};
|
|
1015
|
+
var erase = {
|
|
1016
|
+
screen: `${CSI2}2J`,
|
|
1017
|
+
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
1018
|
+
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
1019
|
+
line: `${CSI2}2K`,
|
|
1020
|
+
lineEnd: `${CSI2}K`,
|
|
1021
|
+
lineStart: `${CSI2}1K`,
|
|
1022
|
+
lines(count) {
|
|
1023
|
+
let clear = "";
|
|
1024
|
+
for (let i = 0;i < count; i++)
|
|
1025
|
+
clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
1026
|
+
if (count)
|
|
1027
|
+
clear += cursor.left;
|
|
1028
|
+
return clear;
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
module.exports = { cursor, scroll, erase, beep };
|
|
1032
|
+
});
|
|
1095
1033
|
|
|
1096
1034
|
// ../../node_modules/.bun/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
1097
|
-
|
|
1035
|
+
import { styleText as y } from "node:util";
|
|
1036
|
+
import { stdout as S, stdin as $ } from "node:process";
|
|
1037
|
+
import * as _ from "node:readline";
|
|
1038
|
+
import P from "node:readline";
|
|
1039
|
+
import { ReadStream as D } from "node:tty";
|
|
1098
1040
|
function d(r, t, e) {
|
|
1099
1041
|
if (!e.some((o) => !o.disabled))
|
|
1100
1042
|
return r;
|
|
1101
1043
|
const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
|
|
1102
1044
|
return e[n].disabled ? d(n, t < 0 ? -1 : 1, e) : n;
|
|
1103
1045
|
}
|
|
1104
|
-
var E = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
1105
|
-
var G = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
1106
|
-
var u = { actions: new Set(E), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true, date: { monthNames: [...G], messages: { required: "Please enter a valid date", invalidMonth: "There are only 12 months in a year", invalidDay: (r, t) => `There are only ${r} days in ${t}`, afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}` } } };
|
|
1107
1046
|
function V(r, t) {
|
|
1108
1047
|
if (typeof r == "string")
|
|
1109
1048
|
return u.aliases.get(r) === t;
|
|
@@ -1122,14 +1061,87 @@ function j(r, t) {
|
|
|
1122
1061
|
e[o] !== s[o] && n.push(o);
|
|
1123
1062
|
return { lines: n, numLinesBefore: e.length, numLinesAfter: s.length, numLines: i };
|
|
1124
1063
|
}
|
|
1125
|
-
var Y = globalThis.process.platform.startsWith("win");
|
|
1126
|
-
var C = Symbol("clack:cancel");
|
|
1127
1064
|
function w(r, t) {
|
|
1128
1065
|
const e = r;
|
|
1129
1066
|
e.isTTY && e.setRawMode(t);
|
|
1130
1067
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1068
|
+
function z({ input: r = $, output: t = S, overwrite: e = true, hideCursor: s = true } = {}) {
|
|
1069
|
+
const i = _.createInterface({ input: r, output: t, prompt: "", tabSize: 1 });
|
|
1070
|
+
_.emitKeypressEvents(r, i), r instanceof D && r.isTTY && r.setRawMode(true);
|
|
1071
|
+
const n = (o, { name: a, sequence: h }) => {
|
|
1072
|
+
const l = String(o);
|
|
1073
|
+
if (V([l, a, h], "cancel")) {
|
|
1074
|
+
s && t.write(import_sisteransi.cursor.show), process.exit(0);
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
if (!e)
|
|
1078
|
+
return;
|
|
1079
|
+
const f = a === "return" ? 0 : -1, v = a === "return" ? -1 : 0;
|
|
1080
|
+
_.moveCursor(t, f, v, () => {
|
|
1081
|
+
_.clearLine(t, 1, () => {
|
|
1082
|
+
r.once("keypress", n);
|
|
1083
|
+
});
|
|
1084
|
+
});
|
|
1085
|
+
};
|
|
1086
|
+
return s && t.write(import_sisteransi.cursor.hide), r.once("keypress", n), () => {
|
|
1087
|
+
r.off("keypress", n), s && t.write(import_sisteransi.cursor.show), r instanceof D && r.isTTY && !Y && r.setRawMode(false), i.terminal = false, i.close();
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
function R(r, t, e, s = e) {
|
|
1091
|
+
const i = O(r ?? S);
|
|
1092
|
+
return wrapAnsi(t, i - e.length, { hard: true, trim: false }).split(`
|
|
1093
|
+
`).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
|
|
1094
|
+
`);
|
|
1095
|
+
}
|
|
1096
|
+
function W(r, t) {
|
|
1097
|
+
if (r === undefined || t.length === 0)
|
|
1098
|
+
return 0;
|
|
1099
|
+
const e = t.findIndex((s) => s.value === r);
|
|
1100
|
+
return e !== -1 ? e : 0;
|
|
1101
|
+
}
|
|
1102
|
+
function B(r, t) {
|
|
1103
|
+
return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
|
|
1104
|
+
}
|
|
1105
|
+
function J(r, t) {
|
|
1106
|
+
if (t)
|
|
1107
|
+
return r ? t : t[0];
|
|
1108
|
+
}
|
|
1109
|
+
function L(r) {
|
|
1110
|
+
return [...r].map((t) => X[t]);
|
|
1111
|
+
}
|
|
1112
|
+
function Z(r) {
|
|
1113
|
+
const t = new Intl.DateTimeFormat(r, { year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(2000, 0, 15)), e = [];
|
|
1114
|
+
let s = "/";
|
|
1115
|
+
for (const i of t)
|
|
1116
|
+
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 });
|
|
1117
|
+
return { segments: e, separator: s };
|
|
1118
|
+
}
|
|
1119
|
+
function k(r) {
|
|
1120
|
+
return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
|
|
1121
|
+
}
|
|
1122
|
+
function I(r) {
|
|
1123
|
+
return { year: k(r.year), month: k(r.month), day: k(r.day) };
|
|
1124
|
+
}
|
|
1125
|
+
function T(r, t) {
|
|
1126
|
+
return new Date(r || 2001, t || 1, 0).getDate();
|
|
1127
|
+
}
|
|
1128
|
+
function F(r) {
|
|
1129
|
+
const { year: t, month: e, day: s } = I(r);
|
|
1130
|
+
if (!t || t < 0 || t > 9999 || !e || e < 1 || e > 12 || !s || s < 1)
|
|
1131
|
+
return;
|
|
1132
|
+
const i = new Date(Date.UTC(t, e - 1, s));
|
|
1133
|
+
if (!(i.getUTCFullYear() !== t || i.getUTCMonth() !== e - 1 || i.getUTCDate() !== s))
|
|
1134
|
+
return { year: t, month: e, day: s };
|
|
1135
|
+
}
|
|
1136
|
+
function N(r) {
|
|
1137
|
+
const t = F(r);
|
|
1138
|
+
return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : undefined;
|
|
1139
|
+
}
|
|
1140
|
+
function tt(r, t, e, s) {
|
|
1141
|
+
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;
|
|
1142
|
+
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) };
|
|
1143
|
+
}
|
|
1144
|
+
var import_sisteransi, E, G, u, Y, C, O = (r) => ("columns" in r) && typeof r.columns == "number" ? r.columns : 80, A = (r) => ("rows" in r) && typeof r.rows == "number" ? r.rows : 20, p = class {
|
|
1133
1145
|
input;
|
|
1134
1146
|
output;
|
|
1135
1147
|
_abortSignal;
|
|
@@ -1255,380 +1267,664 @@ var p = class {
|
|
|
1255
1267
|
this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
|
|
1256
1268
|
}
|
|
1257
1269
|
}
|
|
1258
|
-
};
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
#t;
|
|
1281
|
-
#n;
|
|
1282
|
-
#a;
|
|
1283
|
-
get cursor() {
|
|
1284
|
-
return this.#e;
|
|
1285
|
-
}
|
|
1286
|
-
get userInputWithCursor() {
|
|
1287
|
-
if (!this.userInput)
|
|
1288
|
-
return y(["inverse", "hidden"], "_");
|
|
1289
|
-
if (this._cursor >= this.userInput.length)
|
|
1290
|
-
return `${this.userInput}█`;
|
|
1291
|
-
const t = this.userInput.slice(0, this._cursor), [e, ...s] = this.userInput.slice(this._cursor);
|
|
1292
|
-
return `${t}${y("inverse", e)}${s.join("")}`;
|
|
1293
|
-
}
|
|
1294
|
-
get options() {
|
|
1295
|
-
return typeof this.#n == "function" ? this.#n() : this.#n;
|
|
1296
|
-
}
|
|
1297
|
-
constructor(t) {
|
|
1298
|
-
super(t), this.#n = t.options, this.#a = t.placeholder;
|
|
1299
|
-
const e = this.options;
|
|
1300
|
-
this.filteredOptions = [...e], this.multiple = t.multiple === true, this.#t = typeof t.options == "function" ? t.filter : t.filter ?? B;
|
|
1301
|
-
let s;
|
|
1302
|
-
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)
|
|
1303
|
-
for (const i of s) {
|
|
1304
|
-
const n = e.findIndex((o) => o.value === i);
|
|
1305
|
-
n !== -1 && (this.toggleSelected(i), this.#e = n);
|
|
1306
|
-
}
|
|
1307
|
-
this.focusedValue = this.options[this.#e]?.value, this.on("key", (i, n) => this.#s(i, n)), this.on("userInput", (i) => this.#i(i));
|
|
1308
|
-
}
|
|
1309
|
-
_isActionKey(t, e) {
|
|
1310
|
-
return t === "\t" || this.multiple && this.isNavigating && e.name === "space" && t !== undefined && t !== "";
|
|
1311
|
-
}
|
|
1312
|
-
#s(t, e) {
|
|
1313
|
-
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));
|
|
1314
|
-
if (e.name === "tab" && o && l) {
|
|
1315
|
-
this.userInput === "\t" && this._clearUserInput(), this._setUserInput(a, true), this.isNavigating = false;
|
|
1316
|
-
return;
|
|
1270
|
+
}, H, Q, X, et, st;
|
|
1271
|
+
var init_dist4 = __esm(() => {
|
|
1272
|
+
init_main();
|
|
1273
|
+
import_sisteransi = __toESM(require_src(), 1);
|
|
1274
|
+
E = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
1275
|
+
G = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
1276
|
+
u = { actions: new Set(E), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true, date: { monthNames: [...G], messages: { required: "Please enter a valid date", invalidMonth: "There are only 12 months in a year", invalidDay: (r, t) => `There are only ${r} days in ${t}`, afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}` } } };
|
|
1277
|
+
Y = globalThis.process.platform.startsWith("win");
|
|
1278
|
+
C = Symbol("clack:cancel");
|
|
1279
|
+
H = class extends p {
|
|
1280
|
+
filteredOptions;
|
|
1281
|
+
multiple;
|
|
1282
|
+
isNavigating = false;
|
|
1283
|
+
selectedValues = [];
|
|
1284
|
+
focusedValue;
|
|
1285
|
+
#e = 0;
|
|
1286
|
+
#o = "";
|
|
1287
|
+
#t;
|
|
1288
|
+
#n;
|
|
1289
|
+
#a;
|
|
1290
|
+
get cursor() {
|
|
1291
|
+
return this.#e;
|
|
1317
1292
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1293
|
+
get userInputWithCursor() {
|
|
1294
|
+
if (!this.userInput)
|
|
1295
|
+
return y(["inverse", "hidden"], "_");
|
|
1296
|
+
if (this._cursor >= this.userInput.length)
|
|
1297
|
+
return `${this.userInput}█`;
|
|
1298
|
+
const t = this.userInput.slice(0, this._cursor), [e, ...s] = this.userInput.slice(this._cursor);
|
|
1299
|
+
return `${t}${y("inverse", e)}${s.join("")}`;
|
|
1300
|
+
}
|
|
1301
|
+
get options() {
|
|
1302
|
+
return typeof this.#n == "function" ? this.#n() : this.#n;
|
|
1303
|
+
}
|
|
1304
|
+
constructor(t) {
|
|
1305
|
+
super(t), this.#n = t.options, this.#a = t.placeholder;
|
|
1329
1306
|
const e = this.options;
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
this
|
|
1333
|
-
|
|
1334
|
-
|
|
1307
|
+
this.filteredOptions = [...e], this.multiple = t.multiple === true, this.#t = typeof t.options == "function" ? t.filter : t.filter ?? B;
|
|
1308
|
+
let s;
|
|
1309
|
+
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)
|
|
1310
|
+
for (const i of s) {
|
|
1311
|
+
const n = e.findIndex((o) => o.value === i);
|
|
1312
|
+
n !== -1 && (this.toggleSelected(i), this.#e = n);
|
|
1313
|
+
}
|
|
1314
|
+
this.focusedValue = this.options[this.#e]?.value, this.on("key", (i, n) => this.#s(i, n)), this.on("userInput", (i) => this.#i(i));
|
|
1335
1315
|
}
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
const t = new Intl.DateTimeFormat(r, { year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(2000, 0, 15)), e = [];
|
|
1344
|
-
let s = "/";
|
|
1345
|
-
for (const i of t)
|
|
1346
|
-
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 });
|
|
1347
|
-
return { segments: e, separator: s };
|
|
1348
|
-
}
|
|
1349
|
-
function k(r) {
|
|
1350
|
-
return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
|
|
1351
|
-
}
|
|
1352
|
-
function I(r) {
|
|
1353
|
-
return { year: k(r.year), month: k(r.month), day: k(r.day) };
|
|
1354
|
-
}
|
|
1355
|
-
function T(r, t) {
|
|
1356
|
-
return new Date(r || 2001, t || 1, 0).getDate();
|
|
1357
|
-
}
|
|
1358
|
-
function F(r) {
|
|
1359
|
-
const { year: t, month: e, day: s } = I(r);
|
|
1360
|
-
if (!t || t < 0 || t > 9999 || !e || e < 1 || e > 12 || !s || s < 1)
|
|
1361
|
-
return;
|
|
1362
|
-
const i = new Date(Date.UTC(t, e - 1, s));
|
|
1363
|
-
if (!(i.getUTCFullYear() !== t || i.getUTCMonth() !== e - 1 || i.getUTCDate() !== s))
|
|
1364
|
-
return { year: t, month: e, day: s };
|
|
1365
|
-
}
|
|
1366
|
-
function N(r) {
|
|
1367
|
-
const t = F(r);
|
|
1368
|
-
return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : undefined;
|
|
1369
|
-
}
|
|
1370
|
-
function tt(r, t, e, s) {
|
|
1371
|
-
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;
|
|
1372
|
-
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) };
|
|
1373
|
-
}
|
|
1374
|
-
|
|
1375
|
-
class et extends p {
|
|
1376
|
-
#e;
|
|
1377
|
-
#o;
|
|
1378
|
-
#t;
|
|
1379
|
-
#n;
|
|
1380
|
-
#a;
|
|
1381
|
-
#s = { segmentIndex: 0, positionInSegment: 0 };
|
|
1382
|
-
#i = true;
|
|
1383
|
-
#r = null;
|
|
1384
|
-
inlineError = "";
|
|
1385
|
-
get segmentCursor() {
|
|
1386
|
-
return { ...this.#s };
|
|
1387
|
-
}
|
|
1388
|
-
get segmentValues() {
|
|
1389
|
-
return { ...this.#t };
|
|
1390
|
-
}
|
|
1391
|
-
get segments() {
|
|
1392
|
-
return this.#e;
|
|
1393
|
-
}
|
|
1394
|
-
get separator() {
|
|
1395
|
-
return this.#o;
|
|
1396
|
-
}
|
|
1397
|
-
get formattedValue() {
|
|
1398
|
-
return this.#c(this.#t);
|
|
1399
|
-
}
|
|
1400
|
-
#c(t) {
|
|
1401
|
-
return this.#e.map((e) => t[e.type]).join(this.#o);
|
|
1402
|
-
}
|
|
1403
|
-
#h() {
|
|
1404
|
-
this._setUserInput(this.#c(this.#t)), this._setValue(N(this.#t) ?? undefined);
|
|
1405
|
-
}
|
|
1406
|
-
constructor(t) {
|
|
1407
|
-
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);
|
|
1408
|
-
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));
|
|
1409
|
-
}
|
|
1410
|
-
#u() {
|
|
1411
|
-
const t = Math.max(0, Math.min(this.#s.segmentIndex, this.#e.length - 1)), e = this.#e[t];
|
|
1412
|
-
if (e)
|
|
1413
|
-
return this.#s.positionInSegment = Math.max(0, Math.min(this.#s.positionInSegment, e.len - 1)), { segment: e, index: t };
|
|
1414
|
-
}
|
|
1415
|
-
#l(t) {
|
|
1416
|
-
this.inlineError = "", this.#r = null;
|
|
1417
|
-
const e = this.#u();
|
|
1418
|
-
e && (this.#s.segmentIndex = Math.max(0, Math.min(this.#e.length - 1, e.index + t)), this.#s.positionInSegment = 0, this.#i = true);
|
|
1419
|
-
}
|
|
1420
|
-
#p(t) {
|
|
1421
|
-
const e = this.#u();
|
|
1422
|
-
if (!e)
|
|
1423
|
-
return;
|
|
1424
|
-
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);
|
|
1425
|
-
let h;
|
|
1426
|
-
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();
|
|
1427
|
-
}
|
|
1428
|
-
#d(t) {
|
|
1429
|
-
if (t)
|
|
1430
|
-
switch (t) {
|
|
1431
|
-
case "right":
|
|
1432
|
-
return this.#l(1);
|
|
1433
|
-
case "left":
|
|
1434
|
-
return this.#l(-1);
|
|
1435
|
-
case "up":
|
|
1436
|
-
return this.#p(1);
|
|
1437
|
-
case "down":
|
|
1438
|
-
return this.#p(-1);
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
#f(t, e) {
|
|
1442
|
-
if (e?.name === "backspace" || e?.sequence === "" || e?.sequence === "\b" || t === "" || t === "\b") {
|
|
1443
|
-
this.inlineError = "";
|
|
1444
|
-
const s = this.#u();
|
|
1445
|
-
if (!s)
|
|
1446
|
-
return;
|
|
1447
|
-
if (!this.#t[s.segment.type].replace(/_/g, "")) {
|
|
1448
|
-
this.#l(-1);
|
|
1316
|
+
_isActionKey(t, e) {
|
|
1317
|
+
return t === "\t" || this.multiple && this.isNavigating && e.name === "space" && t !== undefined && t !== "";
|
|
1318
|
+
}
|
|
1319
|
+
#s(t, e) {
|
|
1320
|
+
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));
|
|
1321
|
+
if (e.name === "tab" && o && l) {
|
|
1322
|
+
this.userInput === "\t" && this._clearUserInput(), this._setUserInput(a, true), this.isNavigating = false;
|
|
1449
1323
|
return;
|
|
1450
1324
|
}
|
|
1451
|
-
this.#
|
|
1452
|
-
return;
|
|
1325
|
+
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);
|
|
1453
1326
|
}
|
|
1454
|
-
|
|
1455
|
-
this.
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1327
|
+
deselectAll() {
|
|
1328
|
+
this.selectedValues = [];
|
|
1329
|
+
}
|
|
1330
|
+
toggleSelected(t) {
|
|
1331
|
+
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]);
|
|
1332
|
+
}
|
|
1333
|
+
#i(t) {
|
|
1334
|
+
if (t !== this.#o) {
|
|
1335
|
+
this.#o = t;
|
|
1336
|
+
const e = this.options;
|
|
1337
|
+
t && this.#t ? this.filteredOptions = e.filter((n) => this.#t?.(t, n)) : this.filteredOptions = [...e];
|
|
1338
|
+
const s = W(this.focusedValue, this.filteredOptions);
|
|
1339
|
+
this.#e = d(s, 0, this.filteredOptions);
|
|
1340
|
+
const i = this.filteredOptions[this.#e];
|
|
1341
|
+
i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
Q = class Q extends p {
|
|
1346
|
+
get cursor() {
|
|
1347
|
+
return this.value ? 0 : 1;
|
|
1348
|
+
}
|
|
1349
|
+
get _value() {
|
|
1350
|
+
return this.cursor === 0;
|
|
1351
|
+
}
|
|
1352
|
+
constructor(t) {
|
|
1353
|
+
super(t, false), this.value = !!t.initialValue, this.on("userInput", () => {
|
|
1354
|
+
this.value = this._value;
|
|
1355
|
+
}), this.on("confirm", (e) => {
|
|
1356
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
1357
|
+
}), this.on("cursor", () => {
|
|
1358
|
+
this.value = !this.value;
|
|
1359
|
+
});
|
|
1360
|
+
}
|
|
1361
|
+
};
|
|
1362
|
+
X = { Y: { type: "year", len: 4 }, M: { type: "month", len: 2 }, D: { type: "day", len: 2 } };
|
|
1363
|
+
et = class et extends p {
|
|
1364
|
+
#e;
|
|
1365
|
+
#o;
|
|
1366
|
+
#t;
|
|
1367
|
+
#n;
|
|
1368
|
+
#a;
|
|
1369
|
+
#s = { segmentIndex: 0, positionInSegment: 0 };
|
|
1370
|
+
#i = true;
|
|
1371
|
+
#r = null;
|
|
1372
|
+
inlineError = "";
|
|
1373
|
+
get segmentCursor() {
|
|
1374
|
+
return { ...this.#s };
|
|
1375
|
+
}
|
|
1376
|
+
get segmentValues() {
|
|
1377
|
+
return { ...this.#t };
|
|
1378
|
+
}
|
|
1379
|
+
get segments() {
|
|
1380
|
+
return this.#e;
|
|
1381
|
+
}
|
|
1382
|
+
get separator() {
|
|
1383
|
+
return this.#o;
|
|
1384
|
+
}
|
|
1385
|
+
get formattedValue() {
|
|
1386
|
+
return this.#c(this.#t);
|
|
1387
|
+
}
|
|
1388
|
+
#c(t) {
|
|
1389
|
+
return this.#e.map((e) => t[e.type]).join(this.#o);
|
|
1390
|
+
}
|
|
1391
|
+
#h() {
|
|
1392
|
+
this._setUserInput(this.#c(this.#t)), this._setValue(N(this.#t) ?? undefined);
|
|
1393
|
+
}
|
|
1394
|
+
constructor(t) {
|
|
1395
|
+
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);
|
|
1396
|
+
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));
|
|
1397
|
+
}
|
|
1398
|
+
#u() {
|
|
1399
|
+
const t = Math.max(0, Math.min(this.#s.segmentIndex, this.#e.length - 1)), e = this.#e[t];
|
|
1400
|
+
if (e)
|
|
1401
|
+
return this.#s.positionInSegment = Math.max(0, Math.min(this.#s.positionInSegment, e.len - 1)), { segment: e, index: t };
|
|
1462
1402
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1403
|
+
#l(t) {
|
|
1404
|
+
this.inlineError = "", this.#r = null;
|
|
1405
|
+
const e = this.#u();
|
|
1406
|
+
e && (this.#s.segmentIndex = Math.max(0, Math.min(this.#e.length - 1, e.index + t)), this.#s.positionInSegment = 0, this.#i = true);
|
|
1407
|
+
}
|
|
1408
|
+
#p(t) {
|
|
1409
|
+
const e = this.#u();
|
|
1410
|
+
if (!e)
|
|
1466
1411
|
return;
|
|
1467
|
-
const { segment:
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1412
|
+
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);
|
|
1413
|
+
let h;
|
|
1414
|
+
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();
|
|
1415
|
+
}
|
|
1416
|
+
#d(t) {
|
|
1417
|
+
if (t)
|
|
1418
|
+
switch (t) {
|
|
1419
|
+
case "right":
|
|
1420
|
+
return this.#l(1);
|
|
1421
|
+
case "left":
|
|
1422
|
+
return this.#l(-1);
|
|
1423
|
+
case "up":
|
|
1424
|
+
return this.#p(1);
|
|
1425
|
+
case "down":
|
|
1426
|
+
return this.#p(-1);
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
#f(t, e) {
|
|
1430
|
+
if (e?.name === "backspace" || e?.sequence === "" || e?.sequence === "\b" || t === "" || t === "\b") {
|
|
1431
|
+
this.inlineError = "";
|
|
1432
|
+
const s = this.#u();
|
|
1433
|
+
if (!s)
|
|
1434
|
+
return;
|
|
1435
|
+
if (!this.#t[s.segment.type].replace(/_/g, "")) {
|
|
1436
|
+
this.#l(-1);
|
|
1472
1437
|
return;
|
|
1473
1438
|
}
|
|
1474
|
-
this
|
|
1439
|
+
this.#t[s.segment.type] = "_".repeat(s.segment.len), this.#i = true, this.#s.positionInSegment = 0, this.#h();
|
|
1475
1440
|
return;
|
|
1476
1441
|
}
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1442
|
+
if (e?.name === "tab") {
|
|
1443
|
+
this.inlineError = "";
|
|
1444
|
+
const s = this.#u();
|
|
1445
|
+
if (!s)
|
|
1446
|
+
return;
|
|
1447
|
+
const i = e.shift ? -1 : 1, n = s.index + i;
|
|
1448
|
+
n >= 0 && n < this.#e.length && (this.#s.segmentIndex = n, this.#s.positionInSegment = 0, this.#i = true);
|
|
1480
1449
|
return;
|
|
1481
|
-
let l = o.slice(0, h) + t + o.slice(h + 1), f = false;
|
|
1482
|
-
if (h === 0 && o === "__" && (i.type === "month" || i.type === "day")) {
|
|
1483
|
-
const m = Number.parseInt(t, 10);
|
|
1484
|
-
l = `0${t}`, f = m <= (i.type === "month" ? 1 : 2);
|
|
1485
1450
|
}
|
|
1486
|
-
if (
|
|
1487
|
-
const
|
|
1488
|
-
if (
|
|
1489
|
-
this.inlineError = g;
|
|
1451
|
+
if (t && /^[0-9]$/.test(t)) {
|
|
1452
|
+
const s = this.#u();
|
|
1453
|
+
if (!s)
|
|
1490
1454
|
return;
|
|
1455
|
+
const { segment: i } = s, n = !this.#t[i.type].replace(/_/g, "");
|
|
1456
|
+
if (this.#i && this.#r !== null && !n) {
|
|
1457
|
+
const m = this.#r + t, g = { ...this.#t, [i.type]: m }, b = this.#m(g, i);
|
|
1458
|
+
if (b) {
|
|
1459
|
+
this.inlineError = b, this.#r = null, this.#i = false;
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
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);
|
|
1463
|
+
return;
|
|
1464
|
+
}
|
|
1465
|
+
this.#i && !n && (this.#t[i.type] = "_".repeat(i.len), this.#s.positionInSegment = 0), this.#i = false, this.#r = null;
|
|
1466
|
+
const o = this.#t[i.type], a = o.indexOf("_"), h = a >= 0 ? a : Math.min(this.#s.positionInSegment, i.len - 1);
|
|
1467
|
+
if (h < 0 || h >= i.len)
|
|
1468
|
+
return;
|
|
1469
|
+
let l = o.slice(0, h) + t + o.slice(h + 1), f = false;
|
|
1470
|
+
if (h === 0 && o === "__" && (i.type === "month" || i.type === "day")) {
|
|
1471
|
+
const m = Number.parseInt(t, 10);
|
|
1472
|
+
l = `0${t}`, f = m <= (i.type === "month" ? 1 : 2);
|
|
1473
|
+
}
|
|
1474
|
+
if (i.type === "year" && (l = (o.replace(/_/g, "") + t).padStart(i.len, "_")), !l.includes("_")) {
|
|
1475
|
+
const m = { ...this.#t, [i.type]: l }, g = this.#m(m, i);
|
|
1476
|
+
if (g) {
|
|
1477
|
+
this.inlineError = g;
|
|
1478
|
+
return;
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
this.inlineError = "", this.#t[i.type] = l;
|
|
1482
|
+
const v = l.includes("_") ? undefined : F(this.#t);
|
|
1483
|
+
if (v) {
|
|
1484
|
+
const { year: m, month: g } = v, b = T(m, g);
|
|
1485
|
+
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") };
|
|
1491
1486
|
}
|
|
1487
|
+
this.#h();
|
|
1488
|
+
const U = l.indexOf("_");
|
|
1489
|
+
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);
|
|
1492
1490
|
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1491
|
+
}
|
|
1492
|
+
#m(t, e) {
|
|
1493
|
+
const { month: s, day: i } = I(t);
|
|
1494
|
+
if (e.type === "month" && (s < 0 || s > 12))
|
|
1495
|
+
return u.date.messages.invalidMonth;
|
|
1496
|
+
if (e.type === "day" && (i < 0 || i > 31))
|
|
1497
|
+
return u.date.messages.invalidDay(31, "any month");
|
|
1498
|
+
}
|
|
1499
|
+
#g(t) {
|
|
1500
|
+
const { year: e, month: s, day: i } = I(this.#t);
|
|
1501
|
+
if (e && s && i) {
|
|
1502
|
+
const n = T(e, s);
|
|
1503
|
+
this.#t = { ...this.#t, day: String(Math.min(i, n)).padStart(2, "0") };
|
|
1498
1504
|
}
|
|
1499
|
-
this.#
|
|
1500
|
-
const U = l.indexOf("_");
|
|
1501
|
-
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);
|
|
1505
|
+
this.value = N(this.#t) ?? t.defaultValue ?? undefined;
|
|
1502
1506
|
}
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
return
|
|
1510
|
-
}
|
|
1511
|
-
#g(t) {
|
|
1512
|
-
const { year: e, month: s, day: i } = I(this.#t);
|
|
1513
|
-
if (e && s && i) {
|
|
1514
|
-
const n = T(e, s);
|
|
1515
|
-
this.#t = { ...this.#t, day: String(Math.min(i, n)).padStart(2, "0") };
|
|
1507
|
+
};
|
|
1508
|
+
st = class st extends p {
|
|
1509
|
+
options;
|
|
1510
|
+
cursor = 0;
|
|
1511
|
+
#e;
|
|
1512
|
+
getGroupItems(t) {
|
|
1513
|
+
return this.options.filter((e) => e.group === t);
|
|
1516
1514
|
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
class st extends p {
|
|
1522
|
-
options;
|
|
1523
|
-
cursor = 0;
|
|
1524
|
-
#e;
|
|
1525
|
-
getGroupItems(t) {
|
|
1526
|
-
return this.options.filter((e) => e.group === t);
|
|
1527
|
-
}
|
|
1528
|
-
isGroupSelected(t) {
|
|
1529
|
-
const e = this.getGroupItems(t), s = this.value;
|
|
1530
|
-
return s === undefined ? false : e.every((i) => s.includes(i.value));
|
|
1531
|
-
}
|
|
1532
|
-
toggleValue() {
|
|
1533
|
-
const t = this.options[this.cursor];
|
|
1534
|
-
if (this.value === undefined && (this.value = []), t.group === true) {
|
|
1535
|
-
const e = t.value, s = this.getGroupItems(e);
|
|
1536
|
-
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));
|
|
1537
|
-
} else {
|
|
1538
|
-
const e = this.value.includes(t.value);
|
|
1539
|
-
this.value = e ? this.value.filter((s) => s !== t.value) : [...this.value, t.value];
|
|
1515
|
+
isGroupSelected(t) {
|
|
1516
|
+
const e = this.getGroupItems(t), s = this.value;
|
|
1517
|
+
return s === undefined ? false : e.every((i) => s.includes(i.value));
|
|
1540
1518
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1550
|
-
const i = this.options[this.cursor]?.group === true;
|
|
1551
|
-
!this.#e && i && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
1552
|
-
break;
|
|
1553
|
-
}
|
|
1554
|
-
case "down":
|
|
1555
|
-
case "right": {
|
|
1556
|
-
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1557
|
-
const i = this.options[this.cursor]?.group === true;
|
|
1558
|
-
!this.#e && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
1559
|
-
break;
|
|
1560
|
-
}
|
|
1561
|
-
case "space":
|
|
1562
|
-
this.toggleValue();
|
|
1563
|
-
break;
|
|
1519
|
+
toggleValue() {
|
|
1520
|
+
const t = this.options[this.cursor];
|
|
1521
|
+
if (this.value === undefined && (this.value = []), t.group === true) {
|
|
1522
|
+
const e = t.value, s = this.getGroupItems(e);
|
|
1523
|
+
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));
|
|
1524
|
+
} else {
|
|
1525
|
+
const e = this.value.includes(t.value);
|
|
1526
|
+
this.value = e ? this.value.filter((s) => s !== t.value) : [...this.value, t.value];
|
|
1564
1527
|
}
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
|
|
1528
|
+
}
|
|
1529
|
+
constructor(t) {
|
|
1530
|
+
super(t, false);
|
|
1531
|
+
const { options: e } = t;
|
|
1532
|
+
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) => {
|
|
1533
|
+
switch (s) {
|
|
1534
|
+
case "left":
|
|
1535
|
+
case "up": {
|
|
1536
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
1537
|
+
const i = this.options[this.cursor]?.group === true;
|
|
1538
|
+
!this.#e && i && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
1539
|
+
break;
|
|
1540
|
+
}
|
|
1541
|
+
case "down":
|
|
1542
|
+
case "right": {
|
|
1543
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
1544
|
+
const i = this.options[this.cursor]?.group === true;
|
|
1545
|
+
!this.#e && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
1546
|
+
break;
|
|
1547
|
+
}
|
|
1548
|
+
case "space":
|
|
1549
|
+
this.toggleValue();
|
|
1550
|
+
break;
|
|
1551
|
+
}
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
};
|
|
1555
|
+
});
|
|
1568
1556
|
|
|
1569
1557
|
// ../../node_modules/.bun/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
|
|
1570
1558
|
import { styleText as t, stripVTControlCharacters as ne } from "node:util";
|
|
1571
1559
|
import P2 from "node:process";
|
|
1572
|
-
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
1573
1560
|
function Ze() {
|
|
1574
1561
|
return P2.platform !== "win32" ? P2.env.TERM !== "linux" : !!P2.env.CI || !!P2.env.WT_SESSION || !!P2.env.TERMINUS_SUBLIME || P2.env.ConEmuTask === "{cmd::Cmder}" || P2.env.TERM_PROGRAM === "Terminus-Sublime" || P2.env.TERM_PROGRAM === "vscode" || P2.env.TERM === "xterm-256color" || P2.env.TERM === "alacritty" || P2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
1575
1562
|
}
|
|
1576
|
-
var ee =
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1563
|
+
var import_sisteransi2, ee, ae = () => process.env.CI === "true", w2 = (e, i) => ee ? e : i, _e, oe, ue, F2, le, d2, E2, Ie, Ee, z2, H2, te, U, J2, xe, se, ce, Ge, $e, de, Oe, he, pe, me, ge, V2 = (e) => {
|
|
1564
|
+
switch (e) {
|
|
1565
|
+
case "initial":
|
|
1566
|
+
case "active":
|
|
1567
|
+
return t("cyan", _e);
|
|
1568
|
+
case "cancel":
|
|
1569
|
+
return t("red", oe);
|
|
1570
|
+
case "error":
|
|
1571
|
+
return t("yellow", ue);
|
|
1572
|
+
case "submit":
|
|
1573
|
+
return t("green", F2);
|
|
1574
|
+
}
|
|
1575
|
+
}, ot2 = (e) => {
|
|
1576
|
+
const i = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1577
|
+
return new Q({ active: i, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
|
|
1578
|
+
const r = e.withGuide ?? u.withGuide, u2 = `${V2(this.state)} `, n = r ? `${t("gray", d2)} ` : "", o = R(e.output, e.message, n, u2), c2 = `${r ? `${t("gray", d2)}
|
|
1579
|
+
` : ""}${o}
|
|
1580
|
+
`, a = this.value ? i : s;
|
|
1581
|
+
switch (this.state) {
|
|
1582
|
+
case "submit": {
|
|
1583
|
+
const l = r ? `${t("gray", d2)} ` : "";
|
|
1584
|
+
return `${c2}${l}${t("dim", a)}`;
|
|
1585
|
+
}
|
|
1586
|
+
case "cancel": {
|
|
1587
|
+
const l = r ? `${t("gray", d2)} ` : "";
|
|
1588
|
+
return `${c2}${l}${t(["strikethrough", "dim"], a)}${r ? `
|
|
1589
|
+
${t("gray", d2)}` : ""}`;
|
|
1590
|
+
}
|
|
1591
|
+
default: {
|
|
1592
|
+
const l = r ? `${t("cyan", d2)} ` : "", $2 = r ? t("cyan", E2) : "";
|
|
1593
|
+
return `${c2}${l}${this.value ? `${t("green", z2)} ${i}` : `${t("dim", H2)} ${t("dim", i)}`}${e.vertical ? r ? `
|
|
1594
|
+
${t("cyan", d2)} ` : `
|
|
1595
|
+
` : ` ${t("dim", "/")} `}${this.value ? `${t("dim", H2)} ${t("dim", s)}` : `${t("green", z2)} ${s}`}
|
|
1596
|
+
${$2}
|
|
1597
|
+
`;
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
} }).prompt();
|
|
1601
|
+
}, O2, mt = (e = "", i) => {
|
|
1604
1602
|
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${t("gray", le)} ` : "";
|
|
1605
1603
|
s.write(`${r}${e}
|
|
1606
1604
|
`);
|
|
1607
|
-
}
|
|
1608
|
-
var gt = (e = "", i) => {
|
|
1605
|
+
}, gt = (e = "", i) => {
|
|
1609
1606
|
const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${t("gray", d2)}
|
|
1610
1607
|
${t("gray", E2)} ` : "";
|
|
1611
1608
|
s.write(`${r}${e}
|
|
1612
1609
|
|
|
1613
1610
|
`);
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1611
|
+
}, Ct = (e) => t("magenta", e), fe = ({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u2, frames: n = ee ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], delay: o = ee ? 80 : 120, signal: c2, ...a } = {}) => {
|
|
1612
|
+
const l = ae();
|
|
1613
|
+
let $2, y2, p2 = false, m = false, g = "", S2, h = performance.now();
|
|
1614
|
+
const f = O(s), v = a?.styleFrame ?? Ct, T2 = (_2) => {
|
|
1615
|
+
const A2 = _2 > 1 ? u2 ?? u.messages.error : r ?? u.messages.cancel;
|
|
1616
|
+
m = _2 === 1, p2 && (W2(A2, _2), m && typeof i == "function" && i());
|
|
1617
|
+
}, C2 = () => T2(2), b = () => T2(1), x = () => {
|
|
1618
|
+
process.on("uncaughtExceptionMonitor", C2), process.on("unhandledRejection", C2), process.on("SIGINT", b), process.on("SIGTERM", b), process.on("exit", T2), c2 && c2.addEventListener("abort", b);
|
|
1619
|
+
}, G2 = () => {
|
|
1620
|
+
process.removeListener("uncaughtExceptionMonitor", C2), process.removeListener("unhandledRejection", C2), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", T2), c2 && c2.removeEventListener("abort", b);
|
|
1621
|
+
}, M2 = () => {
|
|
1622
|
+
if (S2 === undefined)
|
|
1623
|
+
return;
|
|
1624
|
+
l && s.write(`
|
|
1625
|
+
`);
|
|
1626
|
+
const _2 = wrapAnsi(S2, f, { hard: true, trim: false }).split(`
|
|
1627
|
+
`);
|
|
1628
|
+
_2.length > 1 && s.write(import_sisteransi2.cursor.up(_2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
|
|
1629
|
+
}, R2 = (_2) => _2.replace(/\.+$/, ""), j2 = (_2) => {
|
|
1630
|
+
const A2 = (performance.now() - _2) / 1000, k2 = Math.floor(A2 / 60), L2 = Math.floor(A2 % 60);
|
|
1631
|
+
return k2 > 0 ? `[${k2}m ${L2}s]` : `[${L2}s]`;
|
|
1632
|
+
}, D2 = a.withGuide ?? u.withGuide, ie = (_2 = "") => {
|
|
1633
|
+
p2 = true, $2 = z({ output: s }), g = R2(_2), h = performance.now(), D2 && s.write(`${t("gray", d2)}
|
|
1634
|
+
`);
|
|
1635
|
+
let A2 = 0, k2 = 0;
|
|
1636
|
+
x(), y2 = setInterval(() => {
|
|
1637
|
+
if (l && g === S2)
|
|
1638
|
+
return;
|
|
1639
|
+
M2(), S2 = g;
|
|
1640
|
+
const L2 = v(n[A2]);
|
|
1641
|
+
let Z2;
|
|
1642
|
+
if (l)
|
|
1643
|
+
Z2 = `${L2} ${g}...`;
|
|
1644
|
+
else if (e === "timer")
|
|
1645
|
+
Z2 = `${L2} ${g} ${j2(h)}`;
|
|
1646
|
+
else {
|
|
1647
|
+
const Be = ".".repeat(Math.floor(k2)).slice(0, 3);
|
|
1648
|
+
Z2 = `${L2} ${g}${Be}`;
|
|
1649
|
+
}
|
|
1650
|
+
const Ne = wrapAnsi(Z2, f, { hard: true, trim: false });
|
|
1651
|
+
s.write(Ne), A2 = A2 + 1 < n.length ? A2 + 1 : 0, k2 = k2 < 4 ? k2 + 0.125 : 0;
|
|
1652
|
+
}, o);
|
|
1653
|
+
}, W2 = (_2 = "", A2 = 0, k2 = false) => {
|
|
1654
|
+
if (!p2)
|
|
1655
|
+
return;
|
|
1656
|
+
p2 = false, clearInterval(y2), M2();
|
|
1657
|
+
const L2 = A2 === 0 ? t("green", F2) : A2 === 1 ? t("red", oe) : t("red", ue);
|
|
1658
|
+
g = _2 ?? g, k2 || (e === "timer" ? s.write(`${L2} ${g} ${j2(h)}
|
|
1659
|
+
`) : s.write(`${L2} ${g}
|
|
1660
|
+
`)), G2(), $2();
|
|
1661
|
+
};
|
|
1662
|
+
return { start: ie, stop: (_2 = "") => W2(_2, 0), message: (_2 = "") => {
|
|
1663
|
+
g = R2(_2 ?? g);
|
|
1664
|
+
}, cancel: (_2 = "") => W2(_2, 1), error: (_2 = "") => W2(_2, 2), clear: () => W2("", 0, true), get isCancelled() {
|
|
1665
|
+
return m;
|
|
1666
|
+
} };
|
|
1667
|
+
}, Ve, je;
|
|
1668
|
+
var init_dist5 = __esm(() => {
|
|
1669
|
+
init_dist4();
|
|
1670
|
+
init_dist4();
|
|
1671
|
+
init_main();
|
|
1672
|
+
init_dist3();
|
|
1673
|
+
import_sisteransi2 = __toESM(require_src(), 1);
|
|
1674
|
+
ee = Ze();
|
|
1675
|
+
_e = w2("◆", "*");
|
|
1676
|
+
oe = w2("■", "x");
|
|
1677
|
+
ue = w2("▲", "x");
|
|
1678
|
+
F2 = w2("◇", "o");
|
|
1679
|
+
le = w2("┌", "T");
|
|
1680
|
+
d2 = w2("│", "|");
|
|
1681
|
+
E2 = w2("└", "—");
|
|
1682
|
+
Ie = w2("┐", "T");
|
|
1683
|
+
Ee = w2("┘", "—");
|
|
1684
|
+
z2 = w2("●", ">");
|
|
1685
|
+
H2 = w2("○", " ");
|
|
1686
|
+
te = w2("◻", "[•]");
|
|
1687
|
+
U = w2("◼", "[+]");
|
|
1688
|
+
J2 = w2("◻", "[ ]");
|
|
1689
|
+
xe = w2("▪", "•");
|
|
1690
|
+
se = w2("─", "-");
|
|
1691
|
+
ce = w2("╮", "+");
|
|
1692
|
+
Ge = w2("├", "+");
|
|
1693
|
+
$e = w2("╯", "+");
|
|
1694
|
+
de = w2("╰", "+");
|
|
1695
|
+
Oe = w2("╭", "+");
|
|
1696
|
+
he = w2("●", "•");
|
|
1697
|
+
pe = w2("◆", "*");
|
|
1698
|
+
me = w2("▲", "!");
|
|
1699
|
+
ge = w2("■", "x");
|
|
1700
|
+
O2 = { message: (e = [], { symbol: i = t("gray", d2), secondarySymbol: s = t("gray", d2), output: r = process.stdout, spacing: u2 = 1, withGuide: n } = {}) => {
|
|
1701
|
+
const o = [], c2 = n ?? u.withGuide, a = c2 ? s : "", l = c2 ? `${i} ` : "", $2 = c2 ? `${s} ` : "";
|
|
1702
|
+
for (let p2 = 0;p2 < u2; p2++)
|
|
1703
|
+
o.push(a);
|
|
1704
|
+
const y2 = Array.isArray(e) ? e : e.split(`
|
|
1705
|
+
`);
|
|
1706
|
+
if (y2.length > 0) {
|
|
1707
|
+
const [p2, ...m] = y2;
|
|
1708
|
+
p2.length > 0 ? o.push(`${l}${p2}`) : o.push(c2 ? i : "");
|
|
1709
|
+
for (const g of m)
|
|
1710
|
+
g.length > 0 ? o.push(`${$2}${g}`) : o.push(c2 ? s : "");
|
|
1711
|
+
}
|
|
1712
|
+
r.write(`${o.join(`
|
|
1713
|
+
`)}
|
|
1714
|
+
`);
|
|
1715
|
+
}, info: (e, i) => {
|
|
1716
|
+
O2.message(e, { ...i, symbol: t("blue", he) });
|
|
1717
|
+
}, success: (e, i) => {
|
|
1718
|
+
O2.message(e, { ...i, symbol: t("green", pe) });
|
|
1719
|
+
}, step: (e, i) => {
|
|
1720
|
+
O2.message(e, { ...i, symbol: t("green", F2) });
|
|
1721
|
+
}, warn: (e, i) => {
|
|
1722
|
+
O2.message(e, { ...i, symbol: t("yellow", me) });
|
|
1723
|
+
}, warning: (e, i) => {
|
|
1724
|
+
O2.warn(e, i);
|
|
1725
|
+
}, error: (e, i) => {
|
|
1726
|
+
O2.message(e, { ...i, symbol: t("red", ge) });
|
|
1727
|
+
} };
|
|
1728
|
+
Ve = { light: w2("─", "-"), heavy: w2("━", "="), block: w2("█", "#") };
|
|
1729
|
+
je = `${t("gray", d2)} `;
|
|
1730
|
+
});
|
|
1731
|
+
|
|
1732
|
+
// package.json
|
|
1733
|
+
var package_default;
|
|
1734
|
+
var init_package = __esm(() => {
|
|
1735
|
+
package_default = {
|
|
1736
|
+
name: "@itsflower/cli",
|
|
1737
|
+
version: "0.2.9",
|
|
1738
|
+
description: "CLI for Flower - scaffold structured development workflows",
|
|
1739
|
+
bin: {
|
|
1740
|
+
flower: "./dist/main.js"
|
|
1741
|
+
},
|
|
1742
|
+
files: [
|
|
1743
|
+
"dist",
|
|
1744
|
+
"skills"
|
|
1745
|
+
],
|
|
1746
|
+
type: "module",
|
|
1747
|
+
scripts: {
|
|
1748
|
+
build: "bun build ./src/main.ts --outdir ./dist --target node",
|
|
1749
|
+
dev: "bun run ./src/main.ts",
|
|
1750
|
+
typecheck: "tsc --noEmit"
|
|
1751
|
+
},
|
|
1752
|
+
dependencies: {
|
|
1753
|
+
"@clack/prompts": "^1.2.0",
|
|
1754
|
+
citty: "^0.2.2"
|
|
1755
|
+
},
|
|
1756
|
+
devDependencies: {
|
|
1757
|
+
"@types/bun": "^1.3.12",
|
|
1758
|
+
typescript: "^6.0.2"
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
});
|
|
1762
|
+
|
|
1763
|
+
// src/commands/version.ts
|
|
1764
|
+
var exports_version = {};
|
|
1765
|
+
__export(exports_version, {
|
|
1766
|
+
default: () => version_default
|
|
1767
|
+
});
|
|
1768
|
+
var version_default;
|
|
1769
|
+
var init_version = __esm(() => {
|
|
1770
|
+
init_dist();
|
|
1771
|
+
init_package();
|
|
1772
|
+
version_default = defineCommand({
|
|
1773
|
+
meta: {
|
|
1774
|
+
name: "version",
|
|
1775
|
+
description: "Display the current version"
|
|
1776
|
+
},
|
|
1777
|
+
run: () => {
|
|
1778
|
+
console.log(`${package_default.name}@${package_default.version}`);
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
});
|
|
1782
|
+
|
|
1783
|
+
// src/utils/fs.ts
|
|
1784
|
+
import { existsSync, readdirSync, readFileSync, statSync, cpSync } from "node:fs";
|
|
1785
|
+
import { join, relative, resolve } from "node:path";
|
|
1786
|
+
import { fileURLToPath } from "node:url";
|
|
1787
|
+
import { createHash } from "node:crypto";
|
|
1788
|
+
var SKILLS_DIR = "skills", TARGET_DIR = ".agents", EXPECTED_SKILLS, packageDir, getSkillsSourceDir = () => join(packageDir, SKILLS_DIR), getTargetSkillsDir = (cwd) => join(cwd, TARGET_DIR, SKILLS_DIR), hasContent = (dir) => existsSync(dir) && readdirSync(dir).length > 0, hashFile = (path) => createHash("sha256").update(readFileSync(path)).digest("hex"), listFiles = (dir, base = dir) => {
|
|
1789
|
+
if (!existsSync(dir))
|
|
1790
|
+
return [];
|
|
1791
|
+
return readdirSync(dir).flatMap((item) => {
|
|
1792
|
+
const path = join(dir, item);
|
|
1793
|
+
return statSync(path).isDirectory() ? listFiles(path, base) : [relative(base, path)];
|
|
1794
|
+
});
|
|
1795
|
+
}, copyDir = (src, dest) => cpSync(src, dest, { recursive: true, dereference: true });
|
|
1796
|
+
var init_fs = __esm(() => {
|
|
1797
|
+
EXPECTED_SKILLS = [
|
|
1798
|
+
"flower-design",
|
|
1799
|
+
"flower-plan",
|
|
1800
|
+
"flower-propose",
|
|
1801
|
+
"flower-review",
|
|
1802
|
+
"flower-implement",
|
|
1803
|
+
"flower-verify"
|
|
1804
|
+
];
|
|
1805
|
+
packageDir = resolve(fileURLToPath(import.meta.url), "../..");
|
|
1806
|
+
});
|
|
1807
|
+
|
|
1808
|
+
// src/commands/setup.ts
|
|
1809
|
+
var exports_setup = {};
|
|
1810
|
+
__export(exports_setup, {
|
|
1811
|
+
default: () => setup_default
|
|
1812
|
+
});
|
|
1813
|
+
var setup_default;
|
|
1814
|
+
var init_setup = __esm(() => {
|
|
1815
|
+
init_dist();
|
|
1816
|
+
init_dist5();
|
|
1817
|
+
init_fs();
|
|
1818
|
+
setup_default = defineCommand({
|
|
1819
|
+
meta: { name: "setup", description: "Set up Flower in your project" },
|
|
1820
|
+
args: {
|
|
1821
|
+
force: {
|
|
1822
|
+
type: "boolean",
|
|
1823
|
+
alias: "f",
|
|
1824
|
+
description: "Force setup even if already initialized",
|
|
1825
|
+
default: false
|
|
1826
|
+
}
|
|
1827
|
+
},
|
|
1828
|
+
run: async ({ args }) => {
|
|
1829
|
+
const targetDir = getTargetSkillsDir(process.cwd());
|
|
1830
|
+
const sourceDir = getSkillsSourceDir();
|
|
1831
|
+
mt("Flower Setup");
|
|
1832
|
+
if (!hasContent(sourceDir)) {
|
|
1833
|
+
O2.error("Skills not found. CLI installation may be corrupted.");
|
|
1834
|
+
process.exit(1);
|
|
1835
|
+
}
|
|
1836
|
+
if (hasContent(targetDir) && !args.force) {
|
|
1837
|
+
O2.warn("Flower is already set up. Use --force to overwrite.");
|
|
1838
|
+
if (!await ot2({ message: "Force overwrite?", initialValue: false })) {
|
|
1839
|
+
return gt("Setup cancelled");
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
const s = fe();
|
|
1843
|
+
s.start("Copying skills...");
|
|
1844
|
+
try {
|
|
1845
|
+
copyDir(sourceDir, targetDir);
|
|
1846
|
+
s.stop("Skills copied");
|
|
1847
|
+
} catch (e) {
|
|
1848
|
+
s.stop("Copy failed");
|
|
1849
|
+
O2.error(e instanceof Error ? e.message : String(e));
|
|
1850
|
+
process.exit(1);
|
|
1851
|
+
}
|
|
1852
|
+
O2.success(`${listFiles(targetDir).length} files → ${TARGET_DIR}/${SKILLS_DIR}/`);
|
|
1853
|
+
O2.info("Run 'flower doctor' to verify");
|
|
1854
|
+
gt("Ready!");
|
|
1855
|
+
}
|
|
1856
|
+
});
|
|
1857
|
+
});
|
|
1858
|
+
|
|
1859
|
+
// src/commands/doctor.ts
|
|
1860
|
+
var exports_doctor = {};
|
|
1861
|
+
__export(exports_doctor, {
|
|
1862
|
+
default: () => doctor_default
|
|
1863
|
+
});
|
|
1864
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
1865
|
+
import { join as join2 } from "node:path";
|
|
1866
|
+
var check = (name, status, message) => {
|
|
1867
|
+
const icons = { pass: "✓", warn: "!", fail: "✗" };
|
|
1868
|
+
const logFn = { pass: O2.success, warn: O2.warn, fail: O2.error };
|
|
1869
|
+
logFn[status](`${icons[status]} ${name}: ${message}`);
|
|
1870
|
+
return status;
|
|
1871
|
+
}, doctor_default;
|
|
1872
|
+
var init_doctor = __esm(() => {
|
|
1873
|
+
init_dist();
|
|
1874
|
+
init_dist5();
|
|
1875
|
+
init_fs();
|
|
1876
|
+
doctor_default = defineCommand({
|
|
1877
|
+
meta: { name: "doctor", description: "Check Flower setup integrity" },
|
|
1878
|
+
run: () => {
|
|
1879
|
+
const targetDir = getTargetSkillsDir(process.cwd());
|
|
1880
|
+
const sourceDir = getSkillsSourceDir();
|
|
1881
|
+
mt("Flower Doctor");
|
|
1882
|
+
if (!hasContent(sourceDir)) {
|
|
1883
|
+
O2.error("Skills not found. CLI installation may be corrupted.");
|
|
1884
|
+
process.exit(1);
|
|
1885
|
+
}
|
|
1886
|
+
const results = [];
|
|
1887
|
+
const dirExists = existsSync2(targetDir);
|
|
1888
|
+
results.push(check("Directory", dirExists ? "pass" : "fail", `${TARGET_DIR}/${SKILLS_DIR} ${dirExists ? "exists" : "not found"}`));
|
|
1889
|
+
const missing = EXPECTED_SKILLS.filter((s) => !existsSync2(join2(targetDir, s)));
|
|
1890
|
+
results.push(check("Skills", missing.length ? "fail" : "pass", missing.length ? `Missing: ${missing.join(", ")}` : "All skills present"));
|
|
1891
|
+
const missingMd = EXPECTED_SKILLS.filter((s) => !existsSync2(join2(targetDir, s, "SKILL.md")));
|
|
1892
|
+
results.push(check("SKILL.md", missingMd.length ? "fail" : "pass", missingMd.length ? `Missing in: ${missingMd.join(", ")}` : "All SKILL.md present"));
|
|
1893
|
+
const modified = listFiles(targetDir).filter((f) => {
|
|
1894
|
+
const targetPath = join2(targetDir, f);
|
|
1895
|
+
const sourcePath = join2(sourceDir, f);
|
|
1896
|
+
return !existsSync2(sourcePath) || hashFile(targetPath) !== hashFile(sourcePath);
|
|
1897
|
+
});
|
|
1898
|
+
const status = modified.length === 0 ? "pass" : modified.length <= 3 ? "warn" : "fail";
|
|
1899
|
+
const msg = modified.length === 0 ? "All files match original" : modified.length <= 3 ? `Modified: ${modified.join(", ")}` : `${modified.length} files modified`;
|
|
1900
|
+
results.push(check("Integrity", status, msg));
|
|
1901
|
+
if (results.includes("fail")) {
|
|
1902
|
+
gt("Errors found. Run 'flower setup --force' to fix.");
|
|
1903
|
+
process.exit(1);
|
|
1904
|
+
}
|
|
1905
|
+
gt(results.includes("warn") ? "Warnings found. Consider 'flower setup --force' to reset." : "All checks passed!");
|
|
1906
|
+
}
|
|
1907
|
+
});
|
|
1908
|
+
});
|
|
1617
1909
|
|
|
1618
1910
|
// src/main.ts
|
|
1911
|
+
init_dist();
|
|
1912
|
+
init_dist5();
|
|
1619
1913
|
init_package();
|
|
1620
1914
|
|
|
1621
1915
|
// src/commands/index.ts
|
|
1622
1916
|
var commands_default = {
|
|
1623
|
-
version: () => Promise.resolve().then(() => (init_version(), exports_version)).then((m) => m.default)
|
|
1917
|
+
version: () => Promise.resolve().then(() => (init_version(), exports_version)).then((m) => m.default),
|
|
1918
|
+
setup: () => Promise.resolve().then(() => (init_setup(), exports_setup)).then((m) => m.default),
|
|
1919
|
+
doctor: () => Promise.resolve().then(() => (init_doctor(), exports_doctor)).then((m) => m.default)
|
|
1624
1920
|
};
|
|
1625
1921
|
|
|
1626
1922
|
// src/main.ts
|
|
1627
1923
|
var main = defineCommand({
|
|
1628
1924
|
meta: {
|
|
1629
|
-
name:
|
|
1925
|
+
name: "flower",
|
|
1630
1926
|
version: package_default.version,
|
|
1631
|
-
description: "
|
|
1927
|
+
description: "\uD83C\uDF38 Scaffold structured development workflows in your project"
|
|
1632
1928
|
},
|
|
1633
1929
|
subCommands: commands_default,
|
|
1634
1930
|
run: () => {
|