@visulima/cerebro 3.0.0-alpha.21 → 3.0.0-alpha.23

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/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## @visulima/cerebro [3.0.0-alpha.23](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.22...@visulima/cerebro@3.0.0-alpha.23) (2026-05-14)
2
+
3
+ ### Features
4
+
5
+ * **cerebro:** clear lint findings and resolve help command collisions ([b75f269](https://github.com/visulima/visulima/commit/b75f2693426e35c3866f7cb501a1a25ad92e6e83))
6
+
7
+ ### Bug Fixes
8
+
9
+ * **cerebro:** disambiguate flat/nested commands sharing a leaf name ([fdfe641](https://github.com/visulima/visulima/commit/fdfe64188e4d4f280d1466df6fcbcbbc6e3a891b))
10
+ * **cerebro:** rewrite formatRow as if/else to satisfy lint rules ([43140b3](https://github.com/visulima/visulima/commit/43140b391c6282f3ff335b51713e77335c46cd31))
11
+ * **cerebro:** silence unused-condition lint on resolved help command ([02b0695](https://github.com/visulima/visulima/commit/02b06957e6db41c9fdc3ff47ad5d3c9941f77214))
12
+ * **cerebro:** suppress no-confusing-arrow on content section formatRow ([847b679](https://github.com/visulima/visulima/commit/847b67932150e07e111b77e908b5bd4ee074837d))
13
+
14
+
15
+ ### Dependencies
16
+
17
+ * **@visulima/colorize:** upgraded to 2.0.0-alpha.11
18
+ * **@visulima/error:** upgraded to 6.0.0-alpha.24
19
+ * **@visulima/pail:** upgraded to 4.0.0-alpha.16
20
+
21
+ ## @visulima/cerebro [3.0.0-alpha.22](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.21...@visulima/cerebro@3.0.0-alpha.22) (2026-05-11)
22
+
23
+
24
+ ### Dependencies
25
+
26
+ * **@visulima/error:** upgraded to 6.0.0-alpha.23
27
+
1
28
  ## @visulima/cerebro [3.0.0-alpha.21](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.0.0-alpha.20...@visulima/cerebro@3.0.0-alpha.21) (2026-05-11)
2
29
 
3
30
 
package/LICENSE.md CHANGED
@@ -290,7 +290,7 @@ Repository: git+https://github.com/visulima/visulima.git
290
290
  > > > limitations under the License.
291
291
  >
292
292
  >
293
- > >
293
+ >
294
294
  > > # Licenses of bundled types
295
295
  > >
296
296
  > > The published @visulima/error artifact additionally contains code with the following licenses:
@@ -525,644 +525,6 @@ Repository: git+https://github.com/visulima/visulima.git
525
525
 
526
526
  ---------------------------------------
527
527
 
528
- ## @visulima/string
529
- License: MIT
530
- By: Daniel Bannert
531
- Repository: git+https://github.com/visulima/visulima.git
532
-
533
- > MIT License
534
- >
535
- > Copyright (c) 2026 visulima
536
- >
537
- > Permission is hereby granted, free of charge, to any person obtaining a copy
538
- > of this software and associated documentation files (the "Software"), to deal
539
- > in the Software without restriction, including without limitation the rights
540
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
541
- > copies of the Software, and to permit persons to whom the Software is
542
- > furnished to do so, subject to the following conditions:
543
- >
544
- > The above copyright notice and this permission notice shall be included in all
545
- > copies or substantial portions of the Software.
546
- >
547
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
548
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
549
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
550
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
551
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
552
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
553
- > SOFTWARE.
554
- >
555
- >
556
- >
557
- > # Licenses of bundled dependencies
558
- > The published @visulima/string artifact additionally contains code with the following licenses:
559
- > MIT
560
- >
561
- > # Bundled dependencies:
562
- > ## codsen-utils
563
- > License: MIT
564
- > By: Roy Revelt
565
- > Repository: git+https://github.com/codsen/codsen.git
566
- >
567
- > > MIT License
568
- > >
569
- > > Copyright © 2010-2025 Roy Revelt and other contributors
570
- > >
571
- > > Permission is hereby granted, free of charge, to any person obtaining
572
- > > a copy of this software and associated documentation files (the
573
- > > "Software"), to deal in the Software without restriction, including
574
- > > without limitation the rights to use, copy, modify, merge, publish,
575
- > > distribute, sublicense, and/or sell copies of the Software, and to
576
- > > permit persons to whom the Software is furnished to do so, subject to
577
- > > the following conditions:
578
- > >
579
- > > The above copyright notice and this permission notice shall be
580
- > > included in all copies or substantial portions of the Software.
581
- > >
582
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
583
- > > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
584
- > > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
585
- > > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
586
- > > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
587
- > > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
588
- > > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
589
- >
590
- > ---------------------------------------
591
- >
592
- > ## emoji-regex-xs
593
- > License: MIT
594
- > By: Steven Levithan
595
- > Repository: git+https://github.com/slevithan/emoji-regex-xs.git
596
- >
597
- > > MIT License
598
- > >
599
- > > Copyright (c) 2025 Steven Levithan
600
- > >
601
- > > Permission is hereby granted, free of charge, to any person obtaining a copy
602
- > > of this software and associated documentation files (the "Software"), to deal
603
- > > in the Software without restriction, including without limitation the rights
604
- > > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
605
- > > copies of the Software, and to permit persons to whom the Software is
606
- > > furnished to do so, subject to the following conditions:
607
- > >
608
- > > The above copyright notice and this permission notice shall be included in all
609
- > > copies or substantial portions of the Software.
610
- > >
611
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
612
- > > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
613
- > > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
614
- > > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
615
- > > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
616
- > > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
617
- > > SOFTWARE.
618
- >
619
- > ---------------------------------------
620
- >
621
- > ## fastest-levenshtein
622
- > License: MIT
623
- > By: Kasper U. Weihe
624
- > Repository: git+https://github.com/ka-weihe/fastest-levenshtein.git
625
- >
626
- > > MIT License
627
- > >
628
- > > Copyright (c) 2020 Kasper Unn Weihe
629
- > >
630
- > > Permission is hereby granted, free of charge, to any person obtaining a copy
631
- > > of this software and associated documentation files (the "Software"), to deal
632
- > > in the Software without restriction, including without limitation the rights
633
- > > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
634
- > > copies of the Software, and to permit persons to whom the Software is
635
- > > furnished to do so, subject to the following conditions:
636
- > >
637
- > > The above copyright notice and this permission notice shall be included in all
638
- > > copies or substantial portions of the Software.
639
- > >
640
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
641
- > > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
642
- > > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
643
- > > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
644
- > > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
645
- > > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
646
- > > SOFTWARE.
647
- >
648
- > ---------------------------------------
649
- >
650
- > ## get-east-asian-width
651
- > License: MIT
652
- > By: Sindre Sorhus
653
- > Repository: sindresorhus/get-east-asian-width
654
- >
655
- > > MIT License
656
- > >
657
- > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
658
- > >
659
- > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
660
- > >
661
- > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
662
- > >
663
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
664
- >
665
- > ---------------------------------------
666
- >
667
- > ## html-entities
668
- > License: MIT
669
- > By: Marat Dulin
670
- > Repository: https://github.com/mdevils/html-entities.git
671
- >
672
- > > Copyright (c) 2021 Dulin Marat
673
- > >
674
- > > Permission is hereby granted, free of charge, to any person obtaining a copy
675
- > > of this software and associated documentation files (the "Software"), to deal
676
- > > in the Software without restriction, including without limitation the rights
677
- > > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
678
- > > copies of the Software, and to permit persons to whom the Software is
679
- > > furnished to do so, subject to the following conditions:
680
- > >
681
- > > The above copyright notice and this permission notice shall be included in
682
- > > all copies or substantial portions of the Software.
683
- > >
684
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
685
- > > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
686
- > > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
687
- > > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
688
- > > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
689
- > > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
690
- > > THE SOFTWARE.
691
- >
692
- > ---------------------------------------
693
- >
694
- > ## indent-string
695
- > License: MIT
696
- > By: Sindre Sorhus
697
- > Repository: sindresorhus/indent-string
698
- >
699
- > > MIT License
700
- > >
701
- > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
702
- > >
703
- > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
704
- > >
705
- > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
706
- > >
707
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
708
- >
709
- > ---------------------------------------
710
- >
711
- > ## lodash-es
712
- > License: MIT
713
- > By: John-David Dalton, Mathias Bynens
714
- > Repository: lodash/lodash
715
- >
716
- > > Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
717
- > >
718
- > > Based on Underscore.js, copyright Jeremy Ashkenas,
719
- > > DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
720
- > >
721
- > > This software consists of voluntary contributions made by many
722
- > > individuals. For exact contribution history, see the revision history
723
- > > available at https://github.com/lodash/lodash
724
- > >
725
- > > The following license applies to all parts of this software except as
726
- > > documented below:
727
- > >
728
- > > ====
729
- > >
730
- > > Permission is hereby granted, free of charge, to any person obtaining
731
- > > a copy of this software and associated documentation files (the
732
- > > "Software"), to deal in the Software without restriction, including
733
- > > without limitation the rights to use, copy, modify, merge, publish,
734
- > > distribute, sublicense, and/or sell copies of the Software, and to
735
- > > permit persons to whom the Software is furnished to do so, subject to
736
- > > the following conditions:
737
- > >
738
- > > The above copyright notice and this permission notice shall be
739
- > > included in all copies or substantial portions of the Software.
740
- > >
741
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
742
- > > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
743
- > > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
744
- > > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
745
- > > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
746
- > > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
747
- > > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
748
- > >
749
- > > ====
750
- > >
751
- > > Copyright and related rights for sample code are waived via CC0. Sample
752
- > > code is defined as all source code displayed within the prose of the
753
- > > documentation.
754
- > >
755
- > > CC0: http://creativecommons.org/publicdomain/zero/1.0/
756
- > >
757
- > > ====
758
- > >
759
- > > Files located in the node_modules and vendor directories are externally
760
- > > maintained libraries used by this software which have their own
761
- > > licenses; we recommend you read them, as their terms may differ from the
762
- > > terms above.
763
- >
764
- > ---------------------------------------
765
- >
766
- > ## ranges-apply
767
- > License: MIT
768
- > By: Roy Revelt
769
- > Repository: git+https://github.com/codsen/codsen.git
770
- >
771
- > > MIT License
772
- > >
773
- > > Copyright © 2010-2025 Roy Revelt and other contributors
774
- > >
775
- > > Permission is hereby granted, free of charge, to any person obtaining
776
- > > a copy of this software and associated documentation files (the
777
- > > "Software"), to deal in the Software without restriction, including
778
- > > without limitation the rights to use, copy, modify, merge, publish,
779
- > > distribute, sublicense, and/or sell copies of the Software, and to
780
- > > permit persons to whom the Software is furnished to do so, subject to
781
- > > the following conditions:
782
- > >
783
- > > The above copyright notice and this permission notice shall be
784
- > > included in all copies or substantial portions of the Software.
785
- > >
786
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
787
- > > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
788
- > > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
789
- > > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
790
- > > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
791
- > > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
792
- > > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
793
- >
794
- > ---------------------------------------
795
- >
796
- > ## ranges-merge
797
- > License: MIT
798
- > By: Roy Revelt
799
- > Repository: git+https://github.com/codsen/codsen.git
800
- >
801
- > > MIT License
802
- > >
803
- > > Copyright © 2010-2025 Roy Revelt and other contributors
804
- > >
805
- > > Permission is hereby granted, free of charge, to any person obtaining
806
- > > a copy of this software and associated documentation files (the
807
- > > "Software"), to deal in the Software without restriction, including
808
- > > without limitation the rights to use, copy, modify, merge, publish,
809
- > > distribute, sublicense, and/or sell copies of the Software, and to
810
- > > permit persons to whom the Software is furnished to do so, subject to
811
- > > the following conditions:
812
- > >
813
- > > The above copyright notice and this permission notice shall be
814
- > > included in all copies or substantial portions of the Software.
815
- > >
816
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
817
- > > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
818
- > > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
819
- > > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
820
- > > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
821
- > > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
822
- > > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
823
- >
824
- > ---------------------------------------
825
- >
826
- > ## ranges-push
827
- > License: MIT
828
- > By: Roy Revelt
829
- > Repository: git+https://github.com/codsen/codsen.git
830
- >
831
- > > MIT License
832
- > >
833
- > > Copyright © 2010-2025 Roy Revelt and other contributors
834
- > >
835
- > > Permission is hereby granted, free of charge, to any person obtaining
836
- > > a copy of this software and associated documentation files (the
837
- > > "Software"), to deal in the Software without restriction, including
838
- > > without limitation the rights to use, copy, modify, merge, publish,
839
- > > distribute, sublicense, and/or sell copies of the Software, and to
840
- > > permit persons to whom the Software is furnished to do so, subject to
841
- > > the following conditions:
842
- > >
843
- > > The above copyright notice and this permission notice shall be
844
- > > included in all copies or substantial portions of the Software.
845
- > >
846
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
847
- > > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
848
- > > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
849
- > > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
850
- > > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
851
- > > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
852
- > > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
853
- >
854
- > ---------------------------------------
855
- >
856
- > ## ranges-sort
857
- > License: MIT
858
- > By: Roy Revelt
859
- > Repository: git+https://github.com/codsen/codsen.git
860
- >
861
- > > MIT License
862
- > >
863
- > > Copyright © 2010-2025 Roy Revelt and other contributors
864
- > >
865
- > > Permission is hereby granted, free of charge, to any person obtaining
866
- > > a copy of this software and associated documentation files (the
867
- > > "Software"), to deal in the Software without restriction, including
868
- > > without limitation the rights to use, copy, modify, merge, publish,
869
- > > distribute, sublicense, and/or sell copies of the Software, and to
870
- > > permit persons to whom the Software is furnished to do so, subject to
871
- > > the following conditions:
872
- > >
873
- > > The above copyright notice and this permission notice shall be
874
- > > included in all copies or substantial portions of the Software.
875
- > >
876
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
877
- > > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
878
- > > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
879
- > > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
880
- > > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
881
- > > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
882
- > > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
883
- >
884
- > ---------------------------------------
885
- >
886
- > ## redent
887
- > License: MIT
888
- > By: Sindre Sorhus
889
- > Repository: sindresorhus/redent
890
- >
891
- > > MIT License
892
- > >
893
- > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
894
- > >
895
- > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
896
- > >
897
- > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
898
- > >
899
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
900
- >
901
- > ---------------------------------------
902
- >
903
- > ## rfdc
904
- > License: MIT
905
- > By: David Mark Clements
906
- > Repository: git+https://github.com/davidmarkclements/rfdc.git
907
- >
908
- > > Copyright 2019 "David Mark Clements <david.mark.clements@gmail.com>"
909
- > >
910
- > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
911
- > > documentation files (the "Software"), to deal in the Software without restriction, including without limitation
912
- > > the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
913
- > > to permit persons to whom the Software is furnished to do so, subject to the following conditions:
914
- > >
915
- > > The above copyright notice and this permission notice shall be included in all copies or substantial portions
916
- > > of the Software.
917
- > >
918
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
919
- > > TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
920
- > > THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
921
- > > CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
922
- > > IN THE SOFTWARE.
923
- >
924
- > ---------------------------------------
925
- >
926
- > ## string-collapse-leading-whitespace
927
- > License: MIT
928
- > By: Roy Revelt
929
- > Repository: git+https://github.com/codsen/codsen.git
930
- >
931
- > > MIT License
932
- > >
933
- > > Copyright © 2010-2025 Roy Revelt and other contributors
934
- > >
935
- > > Permission is hereby granted, free of charge, to any person obtaining
936
- > > a copy of this software and associated documentation files (the
937
- > > "Software"), to deal in the Software without restriction, including
938
- > > without limitation the rights to use, copy, modify, merge, publish,
939
- > > distribute, sublicense, and/or sell copies of the Software, and to
940
- > > permit persons to whom the Software is furnished to do so, subject to
941
- > > the following conditions:
942
- > >
943
- > > The above copyright notice and this permission notice shall be
944
- > > included in all copies or substantial portions of the Software.
945
- > >
946
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
947
- > > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
948
- > > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
949
- > > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
950
- > > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
951
- > > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
952
- > > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
953
- >
954
- > ---------------------------------------
955
- >
956
- > ## string-left-right
957
- > License: MIT
958
- > By: Roy Revelt
959
- > Repository: git+https://github.com/codsen/codsen.git
960
- >
961
- > > MIT License
962
- > >
963
- > > Copyright © 2010-2025 Roy Revelt and other contributors
964
- > >
965
- > > Permission is hereby granted, free of charge, to any person obtaining
966
- > > a copy of this software and associated documentation files (the
967
- > > "Software"), to deal in the Software without restriction, including
968
- > > without limitation the rights to use, copy, modify, merge, publish,
969
- > > distribute, sublicense, and/or sell copies of the Software, and to
970
- > > permit persons to whom the Software is furnished to do so, subject to
971
- > > the following conditions:
972
- > >
973
- > > The above copyright notice and this permission notice shall be
974
- > > included in all copies or substantial portions of the Software.
975
- > >
976
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
977
- > > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
978
- > > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
979
- > > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
980
- > > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
981
- > > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
982
- > > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
983
- >
984
- > ---------------------------------------
985
- >
986
- > ## string-strip-html
987
- > License: MIT
988
- > By: Roy Revelt
989
- > Repository: git+https://github.com/codsen/codsen.git
990
- >
991
- > > MIT License
992
- > >
993
- > > Copyright © 2010-2025 Roy Revelt and other contributors
994
- > >
995
- > > Permission is hereby granted, free of charge, to any person obtaining
996
- > > a copy of this software and associated documentation files (the
997
- > > "Software"), to deal in the Software without restriction, including
998
- > > without limitation the rights to use, copy, modify, merge, publish,
999
- > > distribute, sublicense, and/or sell copies of the Software, and to
1000
- > > permit persons to whom the Software is furnished to do so, subject to
1001
- > > the following conditions:
1002
- > >
1003
- > > The above copyright notice and this permission notice shall be
1004
- > > included in all copies or substantial portions of the Software.
1005
- > >
1006
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1007
- > > EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1008
- > > MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1009
- > > NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1010
- > > LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1011
- > > OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1012
- > > WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1013
- >
1014
- > ---------------------------------------
1015
- >
1016
- > ## strip-indent
1017
- > License: MIT
1018
- > By: Sindre Sorhus
1019
- > Repository: sindresorhus/strip-indent
1020
- >
1021
- > > MIT License
1022
- > >
1023
- > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1024
- > >
1025
- > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1026
- > >
1027
- > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1028
- > >
1029
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1030
- >
1031
- > ---------------------------------------
1032
- >
1033
- > ## tiny-invariant
1034
- > License: MIT
1035
- > By: Alex Reardon
1036
- > Repository: https://github.com/alexreardon/tiny-invariant.git
1037
- >
1038
- > > MIT License
1039
- > >
1040
- > > Copyright (c) 2019 Alexander Reardon
1041
- > >
1042
- > > Permission is hereby granted, free of charge, to any person obtaining a copy
1043
- > > of this software and associated documentation files (the "Software"), to deal
1044
- > > in the Software without restriction, including without limitation the rights
1045
- > > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1046
- > > copies of the Software, and to permit persons to whom the Software is
1047
- > > furnished to do so, subject to the following conditions:
1048
- > >
1049
- > > The above copyright notice and this permission notice shall be included in all
1050
- > > copies or substantial portions of the Software.
1051
- > >
1052
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1053
- > > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1054
- > > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1055
- > > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1056
- > > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1057
- > > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1058
- > > SOFTWARE.
1059
- >
1060
- >
1061
- >
1062
- >
1063
- >
1064
- > # Licenses of bundled types
1065
- > The published @visulima/string artifact additionally contains code with the following licenses:
1066
- > MIT
1067
- >
1068
- > # Bundled types:
1069
- > ## fastest-levenshtein
1070
- > License: MIT
1071
- > By: Kasper U. Weihe
1072
- > Repository: git+https://github.com/ka-weihe/fastest-levenshtein.git
1073
- >
1074
- > > MIT License
1075
- > >
1076
- > > Copyright (c) 2020 Kasper Unn Weihe
1077
- > >
1078
- > > Permission is hereby granted, free of charge, to any person obtaining a copy
1079
- > > of this software and associated documentation files (the "Software"), to deal
1080
- > > in the Software without restriction, including without limitation the rights
1081
- > > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1082
- > > copies of the Software, and to permit persons to whom the Software is
1083
- > > furnished to do so, subject to the following conditions:
1084
- > >
1085
- > > The above copyright notice and this permission notice shall be included in all
1086
- > > copies or substantial portions of the Software.
1087
- > >
1088
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1089
- > > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1090
- > > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1091
- > > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1092
- > > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1093
- > > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1094
- > > SOFTWARE.
1095
- >
1096
- > ---------------------------------------
1097
- >
1098
- > ## get-east-asian-width
1099
- > License: MIT
1100
- > By: Sindre Sorhus
1101
- > Repository: sindresorhus/get-east-asian-width
1102
- >
1103
- > > MIT License
1104
- > >
1105
- > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1106
- > >
1107
- > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1108
- > >
1109
- > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1110
- > >
1111
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1112
- >
1113
- > ---------------------------------------
1114
- >
1115
- > ## indent-string
1116
- > License: MIT
1117
- > By: Sindre Sorhus
1118
- > Repository: sindresorhus/indent-string
1119
- >
1120
- > > MIT License
1121
- > >
1122
- > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1123
- > >
1124
- > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1125
- > >
1126
- > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1127
- > >
1128
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1129
- >
1130
- > ---------------------------------------
1131
- >
1132
- > ## redent
1133
- > License: MIT
1134
- > By: Sindre Sorhus
1135
- > Repository: sindresorhus/redent
1136
- >
1137
- > > MIT License
1138
- > >
1139
- > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1140
- > >
1141
- > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1142
- > >
1143
- > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1144
- > >
1145
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1146
- >
1147
- > ---------------------------------------
1148
- >
1149
- > ## strip-indent
1150
- > License: MIT
1151
- > By: Sindre Sorhus
1152
- > Repository: sindresorhus/strip-indent
1153
- >
1154
- > > MIT License
1155
- > >
1156
- > > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
1157
- > >
1158
- > > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1159
- > >
1160
- > > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1161
- > >
1162
- > > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1163
-
1164
- ---------------------------------------
1165
-
1166
528
  ## ci-info
1167
529
  License: MIT
1168
530
  By: Thomas Watson Steen, Sibiraj
@@ -1462,7 +824,7 @@ Repository: git+https://github.com/visulima/visulima.git
1462
824
  > > > limitations under the License.
1463
825
  >
1464
826
  > <!-- /DEPENDENCIES -->
1465
- > >
827
+ >
1466
828
  > > # Licenses of bundled types
1467
829
  > >
1468
830
  > > The published @visulima/error artifact additionally contains code with the following licenses:
@@ -1,6 +1,7 @@
1
- import { O as OptionDefinition, C as Command, T as Toolbox } from "../packem_shared/plugin-manager.d-Dz-wu1tI.js";
1
+ import { O as OptionDefinition, A as ArgumentDefinition, C as Command, T as Toolbox } from "../packem_shared/plugin-manager.d-Dz-wu1tI.js";
2
2
  import '@visulima/tabular';
3
3
  declare class HelpCommand<TLogger extends Console = Console> implements Command<OptionDefinition<string>, TLogger> {
4
+ argument: ArgumentDefinition<string>;
4
5
  name: string;
5
6
  options: OptionDefinition<string>[];
6
7
  private readonly commands;
@@ -1 +1 @@
1
- var O=Object.defineProperty;var f=(r,a)=>O(r,"name",{value:a,configurable:!0});import{green as c,inverse as p,cyan as u,yellow as g}from"@visulima/colorize";import{f as y,p as b}from"../packem_shared/index-B0BiusY7.js";const E=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}];var N=Object.defineProperty,h=f((r,a)=>N(r,"name",{value:a,configurable:!0}),"h");const $="__Other",v=h(r=>r.charAt(0).toUpperCase()+r.slice(1),"upperFirstChar"),w=h((r,a,l,o)=>{r.debug("no command given, printing general help...");let e=[...new Set(l.values())].filter(t=>!t.hidden);o&&(e=e.filter(t=>t.group===o));const i=e.reduce((t,s)=>{const n=s.group??$;return t[n]??=[],t[n].push(s),t},{}),d=h(t=>t.map(s=>{let n="";typeof s.alias=="string"?n=s.alias:Array.isArray(s.alias)&&(n=s.alias.join(", ")),n!==""&&(n=` [${n}]`);let m=s.name;return s.commandPath&&s.commandPath.length>0&&(m=`${s.commandPath.join(" ")} ${s.name}`),[`${c(m)}${n}`,s.description??""]}),"buildCommandList");(r.raw??r.log)(b([{content:`${u(a.getCliName())} ${c("<command>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},...Object.keys(i).map(t=>{const s=o?` ${v(o)}`:"";return{content:d(i[t]),header:t===$||o?p.green(` Available${s} Commands `):` ${p.green(` ${v(t)} `)}`}}),l.has("help")?{header:p.yellow(" Command Options "),optionList:l.get("help").options?.filter(t=>!t.hidden)}:void 0,{header:p.yellow(" Global Options "),optionList:a.getGlobalOptions()},{content:E.filter(t=>!t.hidden).map(t=>[t.name,t.description??""]),header:p.magenta(" Environment Variables ")},{content:`Run "${u(a.getCliName())} ${c("help <command>")}" or "${u(a.getCliName())} ${c("<command>")} ${g("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},"printGeneralHelp"),C=h((r,a)=>{const l=[];for(const o of r.values()){if(o.hidden)continue;const e=o.commandPath??[];if(e.length!==a.length)continue;let i=!0;for(const[d,t]of a.entries())if(e[d]!==t){i=!1;break}i&&l.push(o)}return l},"findChildren"),P=h((r,a,l,o)=>{const e=l.join(" "),i=[{content:`${u(a.getCliName())} ${c(e)} ${c("<subcommand>")} [positional arguments] ${g("[options]")}`,header:p.cyan(" Usage ")},{content:o.map(d=>{const t=[...d.commandPath??[],d.name].join(" ");return[c(t),d.description??""]}),header:p.green(" Subcommands ")},{header:p.yellow(" Global Options "),optionList:a.getGlobalOptions()},{content:`Run "${u(a.getCliName())} ${c(`${e} <subcommand>`)} ${g("--help")}" for help with a specific subcommand.`,raw:!0}];(r.raw??r.log)(b(i))},"printParentHelp"),A=h((r,a,l,o)=>{let e=l.get(o);if(!e)for(const n of l.values()){const m=n.commandPath?[...n.commandPath,n.name]:[n.name];if(m.at(-1)===o||m.join(" ")===o){e=n;break}}if(!e){const n=o.split(" ").filter(Boolean),m=n.length>0?C(l,n):[];if(m.length>0){P(r,a,n,m);return}r.error(`Command "${o}" not found`);return}const i=[],d=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(i.push({content:`${u(a.getCliName())} ${c(d)}${e.argument?" [positional arguments]":""}${e.options?" [options]":""}`,header:p.cyan(" Usage ")}),e.description&&i.push({content:e.description,header:p.green(" Description ")}),e.argument&&i.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&i.push({header:p.yellow(" Command Options "),optionList:e.options.filter(n=>!n.hidden)}),i.push({header:p.yellow(" Global Options "),optionList:a.getGlobalOptions()}),Array.isArray(e.env)&&e.env.length>0){const n=e.env.filter(m=>!m.hidden);n.length>0&&i.push({content:n.map(m=>[m.name,m.description??""]),header:p.magenta(" Environment Variables ")})}if(e.alias!==void 0&&e.alias.length>0){let n=e.alias;typeof e.alias=="string"&&(n=[e.alias]),i.splice(1,0,{content:n,header:"Alias(es)"})}Array.isArray(e.examples)&&e.examples.length>0&&i.push({content:e.examples,header:"Examples"});const t=[...e.commandPath??[],e.name],s=C(l,t);s.length>0&&i.push({content:s.map(n=>{const m=[...n.commandPath??[],n.name].join(" ");return[c(m),n.description??""]}),header:p.green(" Subcommands ")}),(r.raw??r.log)(b(i))},"printCommandHelp");class S{static{f(this,"x")}static{h(this,"HelpCommand")}name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(a){this.commands=a}execute(a){const{commandName:l,logger:o,options:e,runtime:i}=a,{footer:d,header:t}=i.getCommandSection();t&&(o.raw??o.log)(y(t)),l==="help"?w(o,i,this.commands,typeof e?.group=="string"?e.group:void 0):A(o,i,this.commands,l),d&&(o.raw??o.log)(y(d))}}export{S as default};
1
+ var E=Object.defineProperty;var b=(a,o)=>E(a,"name",{value:o,configurable:!0});import{green as h,inverse as p,cyan as g,yellow as f}from"@visulima/colorize";import{f as v,p as y}from"../packem_shared/index-DZdxQ8Yb.js";const N=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}];var w=Object.defineProperty,u=b((a,o)=>w(a,"name",{value:o,configurable:!0}),"f");const $="__Other",C=u(a=>a.charAt(0).toUpperCase()+a.slice(1),"upperFirstChar"),A=u((a,o,l,i)=>{a.debug("no command given, printing general help...");let m=[...new Set(l.values())].filter(n=>!n.hidden);i&&(m=m.filter(n=>n.group===i));const e=m.reduce((n,s)=>{const d=s.group??$;return n[d]??=[],n[d].push(s),n},{}),r=u(n=>n.map(s=>{let d="";typeof s.alias=="string"?d=s.alias:Array.isArray(s.alias)&&(d=s.alias.join(", ")),d!==""&&(d=` [${d}]`);let t=s.name;return s.commandPath&&s.commandPath.length>0&&(t=`${s.commandPath.join(" ")} ${s.name}`),[`${h(t)}${d}`,s.description??""]}),"buildCommandList");(a.raw??a.log)(y([{content:`${g(o.getCliName())} ${h("<command>")} [positional arguments] ${f("[options]")}`,header:p.cyan(" Usage ")},...Object.keys(e).map(n=>{const s=i?` ${C(i)}`:"";return{content:r(e[n]),header:n===$||i?p.green(` Available${s} Commands `):` ${p.green(` ${C(n)} `)}`}}),l.has("help")?{header:p.yellow(" Command Options "),optionList:l.get("help").options?.filter(n=>!n.hidden)}:void 0,{header:p.yellow(" Global Options "),optionList:o.getGlobalOptions()},{content:N.filter(n=>!n.hidden).map(n=>[n.name,n.description??""]),header:p.magenta(" Environment Variables ")},{content:`Run "${g(o.getCliName())} ${h("help <command>")}" or "${g(o.getCliName())} ${h("<command>")} ${f("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},"printGeneralHelp"),O=u((a,o)=>{const l=[];for(const i of a.values()){if(i.hidden)continue;const m=i.commandPath??[];if(m.length!==o.length)continue;let e=!0;for(const[r,n]of o.entries())if(m[r]!==n){e=!1;break}e&&l.push(i)}return l},"findChildren"),P=u((a,o,l,i)=>{const m=l.join(" "),e=[{content:`${g(o.getCliName())} ${h(m)} ${h("<subcommand>")} [positional arguments] ${f("[options]")}`,header:p.cyan(" Usage ")},{content:i.map(r=>{const n=[...r.commandPath??[],r.name].join(" ");return[h(n),r.description??""]}),header:p.green(" Subcommands ")},{header:p.yellow(" Global Options "),optionList:o.getGlobalOptions()},{content:`Run "${g(o.getCliName())} ${h(`${m} <subcommand>`)} ${f("--help")}" for help with a specific subcommand.`,raw:!0}];(a.raw??a.log)(y(e))},"printParentHelp"),j=u((a,o,l,i,m)=>{let e=m??l.get(i);if(!e)for(const t of l.values()){const c=t.commandPath?[...t.commandPath,t.name]:[t.name];if(c.at(-1)===i||c.join(" ")===i){e=t;break}}if(!e){const t=i.split(" ").filter(Boolean),c=t.length>0?O(l,t):[];if(c.length>0){P(a,o,t,c);return}a.error(`Command "${i}" not found`);return}const r=[],n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(r.push({content:`${g(o.getCliName())} ${h(n)}${e.argument?" [positional arguments]":""}${e.options?" [options]":""}`,header:p.cyan(" Usage ")}),e.description&&r.push({content:e.description,header:p.green(" Description ")}),e.argument&&r.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&r.push({header:p.yellow(" Command Options "),optionList:e.options.filter(t=>!t.hidden)}),r.push({header:p.yellow(" Global Options "),optionList:o.getGlobalOptions()}),Array.isArray(e.env)&&e.env.length>0){const t=e.env.filter(c=>!c.hidden);t.length>0&&r.push({content:t.map(c=>[c.name,c.description??""]),header:p.magenta(" Environment Variables ")})}if(e.alias!==void 0&&e.alias.length>0){let t=e.alias;typeof e.alias=="string"&&(t=[e.alias]),r.splice(1,0,{content:t,header:"Alias(es)"})}Array.isArray(e.examples)&&e.examples.length>0&&r.push({content:e.examples,header:"Examples"});const s=[...e.commandPath??[],e.name],d=O(l,s);d.length>0&&r.push({content:d.map(t=>{const c=[...t.commandPath??[],t.name].join(" ");return[h(c),t.description??""]}),header:p.green(" Subcommands ")}),(a.raw??a.log)(y(r))},"printCommandHelp");class L{static{b(this,"x")}static{u(this,"HelpCommand")}argument={description:"Command to show help for (subcommand path supported, e.g. `cli help docker build`)",name:"command",type:String};name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(o){this.commands=o}execute(o){const{argument:l,command:i,commandName:m,logger:e,options:r,runtime:n}=o,{footer:s,header:d}=n.getCommandSection();d&&(e.raw??e.log)(v(d));const t=m==="help"&&Array.isArray(l)&&l.length>0?l.join(" "):void 0;if(m==="help"&&t===void 0)A(e,n,this.commands,typeof r?.group=="string"?r.group:void 0);else{const c=t!==void 0||i===void 0||i.name==="help"?void 0:i;j(e,n,this.commands,t??m,c)}s&&(e.raw??e.log)(v(s))}}export{L as default};
@@ -1,4 +1,4 @@
1
- var O=Object.defineProperty;var f=(e,t)=>O(e,"name",{value:t,configurable:!0});import{createRequire as L}from"node:module";import U from"github-slugger";import{p as G}from"../packem_shared/index-B0BiusY7.js";import{g as F,a as M,b as W,c as z}from"../packem_shared/runtime-process-DKHFvYkv.js";const N=L(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=f(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,n]=g.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return g.getBuiltinModule(e)}return N(e)},"__cjs_getBuiltinModule"),{existsSync:v}=A("node:fs"),{readFile:T,mkdir:k,writeFile:B}=A("node:fs/promises"),{resolve:P,join:V,dirname:q}=A("node:path");var H=Object.defineProperty,c=f((e,t)=>H(e,"name",{value:t,configurable:!0}),"m");const I=new U,C=c(e=>I.slug(e),"slugify"),J=c(e=>e.filter(Boolean),"compact"),K=c((e,t)=>{const n=new Set,o=[];for(const r of e){const i=t(r);n.has(i)||(n.add(i),o.push(r))}return o},"uniqBy"),D=c((e,t)=>{const n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(e.argument){const o=e.argument.name.toUpperCase(),r=e.argument.required?o:`[${o}]`;return`${t} ${n} ${r}`}return`${t} ${n}`},"formatCommandUsage"),Q=c((e,t)=>{if(!Array.isArray(e.env)||e.env.length===0)return;const n=e.env.filter(o=>!o.hidden);n.length>0&&t.push({content:n.map(o=>[o.name,o.description??""]),header:" Environment Variables "})},"addEnvironmentVariables"),X=c((e,t)=>{const n=[],o=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" "),r=!!e.argument,i=!!e.options;if(n.push({content:`${t} ${o}${r?" [positional arguments]":""}${i?" [options]":""}`,header:" Usage "}),e.description&&n.push({content:e.description,header:" Description "}),e.argument&&n.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&n.push({header:" Command Options ",optionList:e.options.filter(a=>!a.hidden)}),Q(e,n),e.alias!==void 0&&e.alias.length>0){const a=Array.isArray(e.alias)?e.alias:[e.alias];n.splice(1,0,{content:a,header:"Alias(es)"})}return Array.isArray(e.examples)&&e.examples.length>0&&n.push({content:e.examples,header:"Examples"}),G(n)},"formatCommandHelp"),Y=c((e,t)=>{const n=e.description?.trim().split(`
1
+ var O=Object.defineProperty;var f=(e,t)=>O(e,"name",{value:t,configurable:!0});import{createRequire as L}from"node:module";import U from"github-slugger";import{p as G}from"../packem_shared/index-DZdxQ8Yb.js";import{g as F,a as M,b as W,c as z}from"../packem_shared/runtime-process-DKHFvYkv.js";const N=L(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=f(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[t,n]=g.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return g.getBuiltinModule(e)}return N(e)},"__cjs_getBuiltinModule"),{existsSync:v}=A("node:fs"),{readFile:T,mkdir:k,writeFile:B}=A("node:fs/promises"),{resolve:P,join:V,dirname:q}=A("node:path");var H=Object.defineProperty,c=f((e,t)=>H(e,"name",{value:t,configurable:!0}),"m");const I=new U,C=c(e=>I.slug(e),"slugify"),J=c(e=>e.filter(Boolean),"compact"),K=c((e,t)=>{const n=new Set,o=[];for(const r of e){const i=t(r);n.has(i)||(n.add(i),o.push(r))}return o},"uniqBy"),D=c((e,t)=>{const n=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" ");if(e.argument){const o=e.argument.name.toUpperCase(),r=e.argument.required?o:`[${o}]`;return`${t} ${n} ${r}`}return`${t} ${n}`},"formatCommandUsage"),Q=c((e,t)=>{if(!Array.isArray(e.env)||e.env.length===0)return;const n=e.env.filter(o=>!o.hidden);n.length>0&&t.push({content:n.map(o=>[o.name,o.description??""]),header:" Environment Variables "})},"addEnvironmentVariables"),X=c((e,t)=>{const n=[],o=(e.commandPath?[...e.commandPath,e.name]:[e.name]).join(" "),r=!!e.argument,i=!!e.options;if(n.push({content:`${t} ${o}${r?" [positional arguments]":""}${i?" [options]":""}`,header:" Usage "}),e.description&&n.push({content:e.description,header:" Description "}),e.argument&&n.push({header:"Command Positional Arguments",isArgument:!0,optionList:[e.argument]}),Array.isArray(e.options)&&e.options.length>0&&n.push({header:" Command Options ",optionList:e.options.filter(a=>!a.hidden)}),Q(e,n),e.alias!==void 0&&e.alias.length>0){const a=Array.isArray(e.alias)?e.alias:[e.alias];n.splice(1,0,{content:a,header:"Alias(es)"})}return Array.isArray(e.examples)&&e.examples.length>0&&n.push({content:e.examples,header:"Examples"}),G(n)},"formatCommandHelp"),Y=c((e,t)=>{const n=e.description?.trim().split(`
2
2
  `)[0]??"",o=D(e,t),r=X(e,t);return J([`## \`${o}\``,n,`\`\`\`
3
3
  ${r.trim()}
4
4
  \`\`\``]).join(`
package/dist/index.d.ts CHANGED
@@ -335,7 +335,7 @@ type CreateEnv<T extends Record<string, unknown>> = { [K in keyof T as OptionNam
335
335
  * });
336
336
  * ```
337
337
  */
338
- declare const lazyNamed: <M extends Record<string, unknown>, K extends keyof M, TContext>(load: () => Promise<M>, key: K) => (() => Promise<LazyCommandModule<TContext>>);
338
+ declare const lazyNamed: <M extends Record<string, unknown>, K extends keyof M, TContext>(load: () => Promise<M>, key: K) => () => Promise<LazyCommandModule<TContext>>;
339
339
  declare global {
340
340
  namespace Cerebro {
341
341
  /**
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var a=Object.defineProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});import{Cli as t}from"./packem_shared/Cerebro-DVWKQlmP.js";import{VERBOSITY_DEBUG as R,VERBOSITY_NORMAL as V,VERBOSITY_QUIET as b,VERBOSITY_VERBOSE as c}from"./packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{lazyNamed as n}from"./packem_shared/lazyNamed-DOmefeJM.js";import{p as S}from"./packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js";var E=Object.defineProperty,m=o((r,e)=>E(r,"name",{value:e,configurable:!0}),"t");const f=m((r,e)=>new t(r,e),"createCerebro");export{t as Cerebro,R as VERBOSITY_DEBUG,V as VERBOSITY_NORMAL,b as VERBOSITY_QUIET,c as VERBOSITY_VERBOSE,S as VisulimaError,f as createCerebro,n as lazyNamed};
1
+ var a=Object.defineProperty;var o=(r,e)=>a(r,"name",{value:e,configurable:!0});import{Cli as t}from"./packem_shared/Cerebro-Bx5ieMPF.js";import{VERBOSITY_DEBUG as R,VERBOSITY_NORMAL as V,VERBOSITY_QUIET as b,VERBOSITY_VERBOSE as c}from"./packem_shared/VERBOSITY_QUIET-XPultrIA.js";import{lazyNamed as n}from"./packem_shared/lazyNamed-DOmefeJM.js";import{p as S}from"./packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js";var E=Object.defineProperty,m=o((r,e)=>E(r,"name",{value:e,configurable:!0}),"t");const f=m((r,e)=>new t(r,e),"createCerebro");export{t as Cerebro,R as VERBOSITY_DEBUG,V as VERBOSITY_NORMAL,b as VERBOSITY_QUIET,c as VERBOSITY_VERBOSE,S as VisulimaError,f as createCerebro,n as lazyNamed};
@@ -0,0 +1,4 @@
1
+ var ct=Object.defineProperty;var h=(t,e)=>ct(t,"name",{value:e,configurable:!0});import{VERBOSITY_DEBUG as B,POSITIONALS_KEY as Z,VERBOSITY_QUIET as ut,VERBOSITY_VERBOSE as dt,VERBOSITY_NORMAL as we}from"./VERBOSITY_QUIET-XPultrIA.js";import{c as b}from"./cerebro-error-BnJTixb2.js";import{d as z,h as pe,e as G,o as ye,a as mt,i as pt,f as ft}from"./runtime-process-DKHFvYkv.js";import{distance as ht}from"fastest-levenshtein";import De from"@visulima/string/case/camel-case";const Y=[{description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];var gt=Object.defineProperty,vt=h((t,e)=>gt(t,"name",{value:e,configurable:!0}),"t$5");let T=class extends b{static{h(this,"a")}static{vt(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const o=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(o,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}};var wt=Object.defineProperty,yt=h((t,e)=>wt(t,"name",{value:e,configurable:!0}),"e$7");let Te=class extends b{static{h(this,"o")}static{yt(this,"ConflictingOptionsError")}option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}};var bt=Object.defineProperty,$t=h((t,e)=>bt(t,"name",{value:e,configurable:!0}),"e$6");let Ot=class extends b{static{h(this,"o")}static{$t(this,"PluginError")}pluginName;constructor(e,n,o){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:o,pluginName:e}),this.name="PluginError",this.pluginName=e,o&&(this.cause=o)}};var Nt=Object.defineProperty,be=h((t,e)=>Nt(t,"name",{value:e,configurable:!0}),"d$4");let At=class{static{h(this,"p")}static{be(this,"PluginManager")}logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);z().CEREBRO_OUTPUT_LEVEL===String(B)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${String(n.length)} plugin(s)...`);for(const o of n)if(typeof o.init=="function"){this.logger.debug(`initializing plugin: ${o.name}`);try{await o.init(e)}catch(a){const i=new Ot(o.name,`Failed to initialize: ${a instanceof Error?a.message:String(a)}`,a instanceof Error?a:void 0);throw this.logger.error(i.message),i}}this.initialized=!0}async executeLifecycle(e,n,o){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const a=this.getDependencyOrder();for(const i of a){const u=i[e];if(typeof u=="function"){this.logger.debug(`executing ${e} hook for plugin: ${i.name}`);try{await(e==="afterCommand"?u(n,o):u(n))}catch(r){throw this.logger.error(`Error in ${e} hook for plugin "${i.name}":`,r),r}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const o=this.getDependencyOrder();for(const a of o)if(typeof a.onError=="function"){this.logger.debug(`executing error handler for plugin: ${a.name}`);try{await a.onError(e,n)}catch(i){this.logger.error(`Error in error handler for plugin "${a.name}":`,i)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,o=new Set,a=be(i=>{if(n.has(i))return;if(o.has(i))throw new Error(`Circular dependency detected involving plugin "${i}"`);const u=this.plugins.get(i);if(!u)throw new Error(`Plugin "${i}" not found`);if(o.add(i),u.dependencies)for(const r of u.dependencies)a(r);o.delete(i),n.add(i),e.push(u)},"visit");for(const i of this.plugins.keys())a(i);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};var Pt=Object.defineProperty,Et=h((t,e)=>Pt(t,"name",{value:e,configurable:!0}),"n$8");const H=Et(t=>t.type?.name==="Boolean","optionIsBoolean");var _t=Object.defineProperty,Se=h((t,e)=>_t(t,"name",{value:e,configurable:!0}),"p$6");const Ct=Se(t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},"getTypeLabel"),$e=Se(t=>(H(t)||(t.typeLabel=t.typeLabel??Ct(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var xt=Object.defineProperty,Ue=h((t,e)=>xt(t,"name",{value:e,configurable:!0}),"e$4");const It=new RegExp(/^-([^\d-])$/),kt=new RegExp(/^--(\S+)/),Lt=new RegExp(/^-([^\d-]{2,})$/),jt=Ue(t=>It.test(t)||kt.test(t)||Lt.test(t),"isOption"),Mt=Ue((t,e)=>{const n=e[0]&&jt(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const o=new Error(`Command not recognised: ${String(n)}`);throw o.command=n,o.name="INVALID_COMMAND",o}return{argv:e,command:n}},"commandLineCommands");var Vt=Object.defineProperty,Be=h((t,e)=>Vt(t,"name",{value:e,configurable:!0}),"i$7"),Dt=Object.defineProperty,Re=Be((t,e)=>Dt(t,"name",{value:e,configurable:!0}),"i"),Tt=Object.defineProperty,ze=Re((t,e)=>Tt(t,"name",{value:e,configurable:!0}),"s"),St=Object.defineProperty,Fe=ze((t,e)=>St(t,"name",{value:e,configurable:!0}),"i"),Ut=Object.defineProperty,qe=Fe((t,e)=>Ut(t,"name",{value:e,configurable:!0}),"t");qe(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");class ee extends Error{static{h(this,"v")}static{Be(this,"g")}static{Re(this,"p")}static{ze(this,"V")}static{Fe(this,"VisulimaError")}static{qe(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:o,message:a,name:i,stack:u,title:r}){super(a,{cause:e}),this.title=r,this.name=i,this.stack=u??this.stack,this.loc=o,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}}var Bt=Object.defineProperty,We=h((t,e)=>Bt(t,"name",{value:e,configurable:!0}),"o$7"),Rt=Object.defineProperty,Ge=We((t,e)=>Rt(t,"name",{value:e,configurable:!0}),"o"),zt=Object.defineProperty,Ft=Ge((t,e)=>zt(t,"name",{value:e,configurable:!0}),"i");let qt=class He extends ee{static{h(this,"a")}static{We(this,"a")}static{Ge(this,"t")}static{Ft(this,"AlreadySetError")}optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,He.prototype)}};var Wt=Object.defineProperty,Ke=h((t,e)=>Wt(t,"name",{value:e,configurable:!0}),"t$3"),Gt=Object.defineProperty,Ye=Ke((t,e)=>Gt(t,"name",{value:e,configurable:!0}),"e"),Ht=Object.defineProperty,Kt=Ye((t,e)=>Ht(t,"name",{value:e,configurable:!0}),"e");let Oe=class Je extends ee{static{h(this,"n")}static{Ke(this,"n")}static{Ye(this,"o")}static{Kt(this,"UnknownOptionError")}optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,Je.prototype)}};var Yt=Object.defineProperty,Ze=h((t,e)=>Yt(t,"name",{value:e,configurable:!0}),"a$9"),Jt=Object.defineProperty,Qe=Ze((t,e)=>Jt(t,"name",{value:e,configurable:!0}),"a"),Zt=Object.defineProperty,Qt=Qe((t,e)=>Zt(t,"name",{value:e,configurable:!0}),"o");let Xt=class Xe extends ee{static{h(this,"n")}static{Ze(this,"o")}static{Qe(this,"e")}static{Qt(this,"UnknownValueError")}value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,Xe.prototype)}};var en=Object.defineProperty,et=h((t,e)=>en(t,"name",{value:e,configurable:!0}),"i$4"),tn=Object.defineProperty,tt=et((t,e)=>tn(t,"name",{value:e,configurable:!0}),"i"),nn=Object.defineProperty,on=tt((t,e)=>nn(t,"name",{value:e,configurable:!0}),"i");let E=class nt extends ee{static{h(this,"a")}static{et(this,"o")}static{tt(this,"e")}static{on(this,"InvalidDefinitionsError")}constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,nt.prototype)}};var an=Object.defineProperty,rn=h((t,e)=>an(t,"name",{value:e,configurable:!0}),"z"),sn=Object.defineProperty,F=rn((t,e)=>sn(t,"name",{value:e,configurable:!0}),"S"),ln=Object.defineProperty,te=F((t,e)=>ln(t,"name",{value:e,configurable:!0}),"o");const Ne=te(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),Ae=te(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Pe=te(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),cn=te((t,e)=>Array.isArray(t)?Ne(e)?t.map(Boolean):Ae(e)?t.map(Number):Pe(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:Ne(e)?!!t:Ae(e)?Number(t):Pe(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var un=Object.defineProperty,dn=F((t,e)=>un(t,"name",{value:e,configurable:!0}),"e");const P=dn((t,e,n,...o)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...o)},"debug");var mn=Object.defineProperty,V=F((t,e)=>mn(t,"name",{value:e,configurable:!0}),"h$1");const pn=/-([a-z])/g,fn=/^\d+$/,le=V(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),hn=V(t=>t.codePointAt(0)===95,"isSpecialKey"),Ee=V((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),_e=V(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Ce=V((t,e,n,o=!1)=>{t[e]===void 0?t[e]=o?[n]:n:o&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),gn=V((t,e,n,o,a)=>{let i=e.get(t)??n.get(t);if(!i&&o){const u=t.toLowerCase();i=o.get(u)??a?.get(u)}return i},"getDefinition"),vn=V((t,e,n,o)=>{const a=n.debug??!1;P(a,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),P(a,"Starting argument resolution","resolver"),P(a,"Tokens:","resolver",t),P(a,"Definitions:","resolver",e),P(a,"Processing tokens...","resolver");const i=new Map,u=new Map,r=n.caseInsensitive?new Map:void 0,m=n.caseInsensitive?new Map:void 0,s=n.camelCase?new Map:void 0,f=n.camelCase?new Map:void 0;for(const c of e)if(i.set(c.name,c),c.alias&&u.set(c.alias,c),n.caseInsensitive&&r&&(r.set(c.name.toLowerCase(),c),c.alias&&m&&m.set(c.alias.toLowerCase(),c)),n.camelCase&&s&&f){const l=c.name.replaceAll(pn,(d,p)=>p.toUpperCase());s.set(c.name,l),f.set(l,c.name)}const g={},v={},O=[],$=new Set;let L=!1;const N=e.find(c=>c.defaultOption),W=e.some(c=>c.group),x=e.some(c=>c.type===Number);for(let c=0;c<t.length;c++){const l=t[c];if(l.kind==="option-terminator"){g._unknown=o.slice(l.index),L=!0;break}if(l.kind==="option"&&l.name){let d=gn(l.name,i,u,r,m);if(!d&&l.value===void 0&&x&&fn.test(l.name)){const y=e.find(I=>I.type===Number);y&&(d=y,l.value=l.name,l.name=y.name)}const p=d?d.name:l.name,w=d?.multiple,A=d?.lazyMultiple;if(v[p]!==void 0&&!w&&!A&&!n.partial)throw new qt(p);if(!d&&n.partial){const y=l.rawName??`--${l.name}${l.value!==void 0&&l.inlineValue?`=${l.value}`:""}`;O.push({index:l.index,value:y});continue}if(!d&&n.stopAtFirstUnknown){g._unknown=o.slice(l.index);break}if(!d&&!n.partial)throw new Oe(l.name);if(l.value===void 0){const y=t[c+1],I=y?.kind==="option"&&!("name"in y)&&y.value!==void 0,_=y&&d&&!(d.type&&le(d.type))&&(y.kind==="positional"||I),lt=d&&d.defaultOption&&!d.multiple&&!d.lazyMultiple;if(_&&(!d?.defaultOption||lt))if(w){let k=c+1;const se=[];for(;k<t.length&&(t[k].kind==="positional"||t[k].kind==="option"&&!("name"in t[k])&&t[k].value!==void 0);)se.push(t[k].value),$.add(t[k].index),k++;v[p]=v[p]===void 0?se:Ee(v[p],se),c=k-1}else A?(Ce(v,p,y.value,!0),$.add(y.index),c++):(v[p]=y.value,$.add(y.index),c++);else d?.type&&le(d.type)?Ce(v,p,!0,w):v[p]=w?[]:null}else{let{value:y}=l;if(d?.type&&le(d.type))switch(y){case"":{if(n.partial)v._unknown??=[],v._unknown.push(`${l.rawName??`--${l.name}`}${l.value?`=${l.value}`:""}`),y=!0;else throw new Oe(l.name);break}case"false":{y=!1;break}case"true":{y=!0;break}default:y=!0}const I=[y];if(w){let _=c+1;for(;_<t.length&&t[_].kind==="positional";)I.push(t[_].value),$.add(t[_].index),_++;c=_-1}v[p]===void 0?v[p]=w||A?I:y:w||A?v[p]=Ee(v[p],I):v[p]=y}}else if(l.kind==="positional"&&n.stopAtFirstUnknown&&!$.has(l.index)&&!N){P(a,`Found unconsumed positional token at index ${String(l.index)}, stopping processing`,"resolver"),g._unknown=o.slice(l.index);break}}for(const[c,l]of Object.entries(v)){const d=i.get(c);d&&(d.multiple||d.lazyMultiple)&&!Array.isArray(l)&&(v[c]=[l])}let C=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!L){for(const c of t)if(c.kind==="option"&&!i.has(c.name??"")&&!u.has(c.name??"")&&(!n.caseInsensitive||!r?.has(c.name?.toLowerCase()??"")&&!m?.has(c.name?.toLowerCase()??""))){C=c.index;break}}if(N){const c=[],l=[];for(const d of t)d.kind==="positional"&&!$.has(d.index)&&d.index<C&&(c.push(d.value),l.push(d));if(c.length>0){const d=v[N.name],p=N.multiple??N.lazyMultiple;d===void 0?p?(l.forEach(w=>$.add(w.index)),v[N.name]=c):($.add(l[0].index),v[N.name]=c[0]):p&&(l.forEach(w=>$.add(w.index)),v[N.name]=Array.isArray(d)?[...c,...d]:[...c,d])}}if(!n.partial){for(const c of t)if(c.kind==="positional"&&!$.has(c.index))throw new Xt(o[c.index])}if(n.partial&&!n.stopAtFirstUnknown){const c=[...O];if(v._unknown){const l=new Map;for(const[d,p]of o.entries())l.set(p,d);for(const d of v._unknown){const p=l.get(d);p!==void 0&&c.push({index:p,value:d})}}for(const l of t)l.kind==="positional"&&!$.has(l.index)&&c.push({index:l.index,value:o[l.index]});c.length>0&&(c.sort((l,d)=>l.index-d.index),g._unknown=c.map(l=>l.value))}if(n.stopAtFirstUnknown&&!L){const c=t.findIndex(p=>p.kind==="option"&&!i.has(p.name??"")&&!u.has(p.name??"")&&(!n.caseInsensitive||!r?.has(p.name?.toLowerCase()??"")&&!m?.has(p.name?.toLowerCase()??""))),l=t.findIndex(p=>p.kind==="positional"&&!$.has(p.index));let d=-1;if(c!==-1&&l!==-1?d=Math.min(c,l):c!==-1?d=c:l!==-1&&(d=l),d>=0){const p=t[d].index;g._unknown=o.slice(p)}}else O.length>0&&!n.partial&&(g._unknown=O.map(c=>c.value));for(const[c,l]of Object.entries(v)){const d=n.camelCase?s?.get(c)??c:c,p=i.get(c);g[d]=p?.type?cn(l,p.type):l===void 0?null:l}for(const c of e){const l=n.camelCase?s?.get(c.name)??c.name:c.name;!(l in g)&&c.defaultValue!==void 0&&(c.multiple??c.lazyMultiple?g[l]=Array.isArray(c.defaultValue)?[...c.defaultValue]:[c.defaultValue]:g[l]=c.defaultValue)}if(W){const c={},l={},d={};for(const w of e)if(w.group){const A=Array.isArray(w.group)?w.group:[w.group];for(const y of A)_e(y)||(c[y]??={})}for(const w of Object.keys(g))if(!hn(w)){l[w]=g[w];let A=w;n.camelCase&&(A=f?.get(w)??w);const y=i.get(A);if(y?.group){const I=Array.isArray(y.group)?y.group:[y.group];for(const _ of I)_e(_)||c[_]&&(c[_][w]=g[w])}else d[w]=g[w]}const p={_all:l};for(const[w,A]of Object.entries(c))p[w]=A;Object.keys(d).length>0&&(p._none=d),g._unknown&&(p._unknown=g._unknown),Object.keys(g).forEach(w=>delete g[w]),Object.assign(g,p)}return P(a,"Final parsed result:","resolver",g),g},"resolveArgs");var wn=Object.defineProperty,D=F((t,e)=>wn(t,"name",{value:e,configurable:!0}),"l");const M="-".codePointAt(0),j="=",yn=j.codePointAt(0),bn="--",$n="-",On="--",it=D(t=>t.length>2&&t.startsWith(On),"hasLongOptionPrefix"),Nn=D(t=>it(t)&&!t.includes(j,3),"isLongOption"),An=D(t=>it(t)&&t.includes(j,3),"isLongOptionAndValue"),Pn=D(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==M,"hasOptionValue"),En=D(t=>{if(t.length!==2||t.codePointAt(0)!==M||t.codePointAt(1)===M)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),_n=D(t=>!(t.length<=2||t.codePointAt(0)!==M||t.codePointAt(1)===M),"isShortOptionGroup"),Cn=D(t=>{const e=[],n=[...t];let o=-1,a=0;for(;n.length>0;){const i=n.shift();if(i===void 0)break;const u=n[0];if(a>0?a--:o++,i===bn){e.push({index:o,kind:"option-terminator"});const r=n.map((m,s)=>({index:o+s+1,kind:"positional",value:m}));e.push(...r),o+=n.length;break}if(En(i)){const r=i.charAt(1);let m;a?(e.push({index:o,kind:"option",name:r,rawName:i,value:m}),a===1&&Pn(u)&&(m=n.shift(),e.push({index:o,kind:"option",value:m}))):e.push({index:o,kind:"option",name:r,rawName:i,value:m}),m!==void 0&&++o;continue}if(_n(i)&&!i.includes(j)){const r=[];let m="",s=!1;for(let f=1;f<i.length;f++){const g=i.charAt(f);s?m+=g:g.codePointAt(0)===yn?s=!0:r.push(`${$n}${g}`)}if(s)if(r.length>0){const f=r.pop();r.push(`${f}=${m}`)}else r.push(m);n.unshift(...r),a=r.length;continue}if(Nn(i)){const r=i.slice(2);e.push({index:o,kind:"option",name:r,rawName:i});continue}if(An(i)){const r=i.indexOf(j),m=i.slice(2,r),s=i.slice(r+1);e.push({index:o,inlineValue:!0,kind:"option",name:m,rawName:i,value:s});continue}if(i.length>2&&i.codePointAt(0)===M&&i.codePointAt(1)!==M&&i.includes(j)){const r=i.indexOf(j),m=i.charAt(1),s=i.slice(r+1);e.push({index:o,inlineValue:!0,kind:"option",name:m,rawName:i,value:s});continue}e.push({index:o,kind:"positional",value:i})}return e},"parseArgsTokens");var xn=Object.defineProperty,he=F((t,e)=>xn(t,"name",{value:e,configurable:!0}),"d");const In=/\d/,kn=he(t=>t!=null&&(t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean")),"isBooleanType"),Ln=he(t=>typeof t=="function","isValidCustomTypeFunction"),jn=he((t,e,n)=>{const o=n?.debug??!1;P(o,"Validating definitions:","validation",t,"caseInsensitive:",e);const a=new Set,i=new Set,u=new Set,r=new Set;let m=0;for(const s of t){if(P(o,"Checking definition:","validation",s),!s.name)throw P(o,"Validation failed: name is required","validation"),new E("Invalid option definition: name is required");if(typeof s.name!="string")throw new E("Invalid option definition: name must be a string");if(s.name.trim()==="")throw new E("Invalid option definition: name cannot be empty");const f=e?s.name.toLowerCase():"";if(a.has(s.name)||e&&u.has(f))throw new E(`Invalid option definition: duplicate name '${s.name}'`);if(i.has(s.name)||e&&r.has(f))throw new E(`Invalid option definition: name '${s.name}' conflicts with an existing alias`);if(a.add(s.name),e&&u.add(f),s.alias!==void 0){if(typeof s.alias!="string")throw new E("Invalid option definition: alias must be a string");if(s.alias.length!==1)throw new E("Invalid option definition: alias must be a single character");if(In.test(s.alias))throw new E("Invalid option definition: alias cannot be numeric");if(s.alias==="-")throw new E('Invalid option definition: alias cannot be "-"');const g=e?s.alias.toLowerCase():"";if(i.has(s.alias)||e&&r.has(g))throw new E(`Invalid option definition: duplicate alias '${s.alias}'`);if(a.has(s.alias)||e&&u.has(g))throw new E(`Invalid option definition: alias '${s.alias}' conflicts with an existing option name`);i.add(s.alias),e&&r.add(g)}if(s.defaultOption&&(m++,s.type!==void 0&&kn(s.type)))throw new E("Invalid option definition: defaultOption cannot be Boolean type");if(s.type!==void 0&&!(s.type===Boolean||s.type===Number||s.type===String||typeof s.type=="function"&&Ln(s.type)))throw new E("Invalid option definition: invalid type")}if(m>1)throw P(o,"Validation failed: multiple defaultOptions not allowed","validation"),new E("Invalid option definition: multiple defaultOptions not allowed");P(o,"Validation completed successfully","validation")},"validateDefinitions");var Mn=Object.defineProperty,Vn=F((t,e)=>Mn(t,"name",{value:e,configurable:!0}),"O");const Dn=Vn((t,e={})=>{const n=e.debug??!1;P(n,"Starting command-line-args parsing","index"),P(n,"Options:","index",e);const o={...e};o.stopAtFirstUnknown&&(o.partial=!0);const a=Array.isArray(t)?t:[t];P(n,"Normalized definitions:","index",a),jn(a,o.caseInsensitive,n?o:void 0);let{argv:i}=o;if(!i&&(i=process.argv.slice(2),process.execArgv.length>0)){const s=new Set(process.execArgv);i=i.filter(f=>!s.has(f))}P(n,"Using argv:","index",i);let u=i;o.caseInsensitive&&(u=i.map(s=>{if(s.startsWith("--")){const f=s.indexOf("="),g=(f===-1?s.slice(2):s.slice(2,f)).toLowerCase();return f===-1?`--${g}`:`--${g}${s.slice(f)}`}if(s.startsWith("-")&&!s.startsWith("--")&&s.length>1){const f=s.slice(1).split("=",2),g=f[0],v=f[1];if(!g)return s;const O=g.toLowerCase();return v===void 0?`-${O}`:`-${O}=${v}`}return s}));const r=Cn(u.map(String));P(n,"Tokenized arguments:","index",r);const m=vn(r,a,o,i);return P(n,"Command-line-args parsing completed","index"),m},"commandLineArgs");var Tn=Object.defineProperty,Sn=h((t,e)=>Tn(t,"name",{value:e,configurable:!0}),"n$4");let Un=class{static{h(this,"a")}static{Sn(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}};var Bn=Object.defineProperty,Rn=h((t,e)=>Bn(t,"name",{value:e,configurable:!0}),"n$3");let ce=class extends b{static{h(this,"i")}static{Rn(this,"CommandLoaderError")}commandName;constructor(e,n,o){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",o!==void 0&&(this.cause=o)}};var zn=Object.defineProperty,Fn=h((t,e)=>zn(t,"name",{value:e,configurable:!0}),"f$3");const qn=/^-{1,2}(\w+)(=(.+))?$/,ot=Fn((t,e,n,o)=>{const a=qn.exec(t);if(a===null)return{};const i=a[1];if(!i)return{};const u=n&&o?n.get(i)??o.get(i):e.find(r=>r.name===i||r.alias===i);return u!==void 0?{argName:u.name,argValue:a[3],option:u}:{}},"getParameterOption");var Wn=Object.defineProperty,fe=h((t,e)=>Wn(t,"name",{value:e,configurable:!0}),"e$3");const xe=fe((t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},"convertType"),Gn=new Set(["0","1","false","true"]),Hn=fe((t,e,n,o)=>{if(e.length===0||t.length===0)return{};const a=fe((i,u)=>{const{argName:r,argValue:m,option:s}=ot(u,e,n,o),{lastOption:f}=i;return s&&H(s)&&m&&r?i.partial[r]=xe(m,s):i.lastName&&f&&H(f)&&Gn.has(u)&&(i.partial[i.lastName]=xe(u,f)),{lastName:r,lastOption:s,partial:i.partial}},"getBooleanValue");return t.reduce(a,{partial:{}}).partial},"getBooleanValues");var Kn=Object.defineProperty,Ie=h((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"s$6");const Yn=new Set(["0","1","false","true"]),Jn=Ie((t,e,n,o)=>{if(e.length===0||t.length===0)return t;const a=Ie((i,u)=>{const{argValue:r,option:m}=ot(u,e,n,o),{lastOption:s}=i;if(s&&H(s)&&Yn.has(u)){const{args:f}=i;return{args:f.slice(0,-1)}}return m&&H(m)&&r?{args:i.args}:{args:[...i.args,u],lastOption:m}},"removeBooleanArguments");return t.reduce(a,{args:[]}).args},"removeBooleanValues");var Zn=Object.defineProperty,Qn=h((t,e)=>Zn(t,"name",{value:e,configurable:!0}),"o$4");const ke=Qn(t=>{const e=new Map;for(const n of t){const o=e.get(n.name);o?e.set(n.name,{...o,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var Xn=Object.defineProperty,ne=h((t,e)=>Xn(t,"name",{value:e,configurable:!0}),"o$3");const ei=ne(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),ti=ne((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return ei(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},"transformEnvValue"),ni=/_./g,ii=/^[A-Z]/,oi=ne(t=>t.toLowerCase().replaceAll(ni,e=>e[1]?.toUpperCase()??e).replace(ii,e=>e.toLowerCase()),"toCamelCase"),ai=ne(t=>{if(!t||t.length===0)return{};const e={},n=z();for(const o of t){const a=n[o.name],i=ti(o,a),u=i===void 0?o.defaultValue:i,r=oi(o.name);e[r]=u}return e},"processEnvVariables");var ri=Object.defineProperty,K=h((t,e)=>ri(t,"name",{value:e,configurable:!0}),"a$4");const si=K(t=>{const e=new Map,n=new Map;for(const o of t)if(e.set(o.name,o),o.alias){const a=Array.isArray(o.alias)?o.alias:[o.alias];for(const i of a)n.set(i,o)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),li=K(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new ce(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(o){throw new ce(t.name,o instanceof Error?o.message:String(o),o)}const n=e.default;if(typeof n!="function")throw new ce(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),ci=K((t,e,n,o)=>{const a=new Un(t.name,t),{_all:i,_unknown:u,positionals:r}=e,m=Object.keys(n).length>0?{...i,...n}:i;Z in m&&delete m[Z],a.argument=r?.[Z]??[],a.rawUnknown=[...u??[]];const s=Object.keys(o).length>0;return a.options=s?{...m,...o}:m,a.env=ai(t.env),a},"prepareToolbox"),ui=K((t,e,n)=>{const o=t.options??[],a=o.length>0;let i=ke(a?[...o,...n]:n);if(i.length>0){for(const s of i)if(s.multiple&&s.lazyMultiple)throw new Error(`Argument "${s.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:Z,type:t.argument.type,typeLabel:t.argument.typeLabel},...i]);let u,r;if(a){const{optionMapByAlias:s,optionMapByName:f}=si(o);u=Jn(e,o,f,s),r=Hn(e,o,f,s)}else u=e,r={};const m=Dn(i,{argv:u,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:r,parsedArgs:m}},"processCommandArgs"),S=K(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await li(t))(e),"executeCommand");var di=Object.defineProperty,mi=h((t,e)=>di(t,"name",{value:e,configurable:!0}),"n$2");let pi=class extends b{static{h(this,"s")}static{mi(this,"CommandValidationError")}commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}};var fi=Object.defineProperty,hi=h((t,e)=>fi(t,"name",{value:e,configurable:!0}),"t$1");const Le=hi((t,e,n=!1)=>{const o=[];for(const a of t)if(!(!n&&!a.required)&&e[a.name]===void 0){if(a.type?.name==="Boolean"){e[a.name]=!1;continue}o.push(a)}return o},"listMissingArguments");var gi=Object.defineProperty,at=h((t,e)=>gi(t,"name",{value:e,configurable:!0}),"n$1");const vi=at((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:ht(t,e)<=t.length/3,"isSimilar"),R=at((t,e)=>{const n=t.toLowerCase();return e.filter(o=>vi(o.toLowerCase(),n))},"findAlternatives");var wi=Object.defineProperty,ie=h((t,e)=>wi(t,"name",{value:e,configurable:!0}),"a$3");const yi=ie((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(o=>{const a=o.startsWith("--");let i=`Found unknown ${a?"option":"argument"} "${o}"`;if(a){const u=R(o.replace("--",""),(e.options??[]).map(r=>r.name));if(u.length>0){const[r,...m]=u.map(s=>`--${s}`);i+=m.length>0?`, did you mean ${r??""} or ${m.join(", ")}?`:`, did you mean ${r??""}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
2
+ `))},"validateUnknownOptions"),bi=ie((t,e,n)=>{const o=n.__requiredOptions__,a=o?Le(o,e,!0):Le(t,e,!1);if(a.length>0)throw new pi(n.name,a.map(i=>i.name));e._unknown&&e._unknown.length>0&&!n.argument&&yi(e,n)},"validateRequiredOptions"),$i=ie((t,e,n)=>{const o=n.__conflictingOptions__??t.filter(a=>a.conflicts!==void 0);if(o.length>0){const a=o.find(i=>Array.isArray(i.conflicts)?i.conflicts.some(u=>e[u]!==void 0)&&e[i.name]!==void 0:e[i.conflicts]!==void 0&&e[i.name]!==void 0);if(a)throw new Te(a.name,typeof a.conflicts=="string"?a.conflicts:a.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),Oi=ie(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const a of t.options){if(a.name){const i=e.get(a.name)??[];i.push(a),e.set(a.name,i)}if(typeof a.alias=="string"&&a.alias.length>0){const i=n.get(a.alias)??[];i.push(a),n.set(a.alias,i)}else if(Array.isArray(a.alias)){for(const i of a.alias)if(i.length>0){const u=n.get(i)??[];u.push(a),n.set(i,u)}}}const o=[];for(const[a,i]of e)i.length>1&&o.push(`Duplicate option name "${a}" in command "${t.name}": ${JSON.stringify(i)}`);for(const[a,i]of n)i.length>1&&o.push(`Duplicate option alias "-${a}" used by options ${i.map(u=>`"${u.name}"`).join(", ")} in command "${t.name}"`);if(o.length>0)throw new Error(o.join(`
3
+ `))},"validateDuplicateOptions");var Ni=Object.defineProperty,ge=h((t,e)=>Ni(t,"name",{value:e,configurable:!0}),"s$2");const Ai=ge((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let o;for(let a=1;a<=e.length;a+=1){const i=e[a-1];if(i===void 0||i.startsWith("-"))break;n.push(i);const u=n.join(" ");t.has(u)&&(o={commandPath:[...n],depth:a})}return o?{argv:e.slice(o.depth),commandPath:o.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),U=ge(t=>t.join(" "),"getCommandPathKey"),je=ge((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var Pi=Object.defineProperty,oe=h((t,e)=>Pi(t,"name",{value:e,configurable:!0}),"a$2");const Ei=oe(t=>{t.options?.forEach(e=>{e.__camelCaseName__=De(e.name)})},"processOptionNames"),_i=oe(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const o of t.options)e.add(o.name);const n=[];for(const o of t.options)if(o.name.startsWith("no-")){const a=o.name.replace("no-","");if(!e.has(a)){if(o.type!==Boolean)throw new Error(`Cannot add negated option "${o.name}" to command "${t.name}" because it is not a boolean.`);const i={...o,defaultValue:o.defaultValue===void 0?!0:!o.defaultValue,name:a};n.push(i),e.add(a)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),Ci=oe((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,o=new Map;for(const i of e.options)if(i.name.startsWith("no-")){const u=De(i.name);o.set(u,i)}const a=Object.keys(n).filter(i=>o.has(i));if(a.length!==0)for(const i of a){const u=i.charAt(2);if(!u)continue;const r=u.toLowerCase()+i.slice(3),m=o.get(i);m&&(m.__negated__=!0),n[r]=!n[i],Reflect.deleteProperty(n,i)}},"mapNegatableOptions"),xi=oe((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const a of e.options)a.__camelCaseName__&&a.__negated__===void 0&&a.implies!==void 0&&n.set(a.__camelCaseName__,a);if(n.size===0)return;const{options:o}=t;for(const a of Object.keys(o)){const i=n.get(a);if(i?.implies){const{implies:u}=i;for(const[r,m]of Object.entries(u))o[r]===void 0&&(o[r]=m)}}},"mapImpliedOptions");var Ii=Object.defineProperty,ae=h((t,e)=>Ii(t,"name",{value:e,configurable:!0}),"e$2");const ki=ae(()=>!!process.versions.electron,"isElectronApp"),Li=ae(()=>ki()&&!process.defaultApp,"isBundledElectronApp"),ji=ae(()=>Li()?0:1,"getProcessArgvBinIndex"),Mi=ae(t=>t.slice(ji()+1),"hideBin");var Vi=Object.defineProperty,rt=h((t,e)=>Vi(t,"name",{value:e,configurable:!0}),"e$1");const Di=" ",Ti=rt((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,o)=>n===e[o]),"equals"),Si=rt(t=>{if(typeof t=="string")return t.split(Di);const e=pe();return Ti(t,e)?Mi(t):t},"parseRawCommand");var Ui=Object.defineProperty,ue=h((t,e)=>Ui(t,"name",{value:e,configurable:!0}),"r");const Bi=ue(t=>{const e=ue(i=>{t.error(`Uncaught exception: ${i.message||i}`),i.stack&&t.error(i.stack),G(1)},"uncaughtExceptionHandler"),n=ue((i,u)=>{if(i instanceof Error)t.error(`Promise rejection: ${i.message||i}`),i.stack&&t.error(i.stack);else{let r;if(typeof i=="string")r=i;else try{r=JSON.stringify(i)}catch{r=String(i)}t.error(`Promise rejection: ${r}`)}G(1)},"unhandledRejectionHandler"),o=ye("uncaughtException",e),a=ye("unhandledRejection",n);return()=>{o(),a()}},"registerExceptionHandler");var Ri=Object.defineProperty,q=h((t,e)=>Ri(t,"name",{value:e,configurable:!0}),"e");const X=100,st=/^[a-z][\w-]*$/i,ve=q((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new b(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),Me=q((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new b(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");q((t,e)=>{if(typeof t!="function")throw new b(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const de=q((t,e)=>{if(typeof t!="object"||t===null)throw new b(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),J=q(t=>{const e=ve(t,"Command name");if(e.length>X)throw new b(`Command name is too long (maximum ${String(X)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new b(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!st.test(e))throw new b(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");q(t=>{const e=ve(t,"Plugin name");if(e.length>X)throw new b(`Plugin name is too long (maximum ${String(X)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new b(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!st.test(e))throw new b(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var zi=Object.defineProperty,re=h((t,e)=>zi(t,"name",{value:e,configurable:!0}),"s");const Fi=new Set([`
4
+ `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),qi=/^[A-Z]:/i,Wi=re(t=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error(`Argument is too long (maximum ${String(1e4)} characters)`);for(const e of t)if(Fi.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),Ve=re(t=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error(`Too many arguments (maximum ${String(100)})`);return t.map(e=>Wi(e))},"sanitizeArguments");re(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.includes("..")||e.includes("../")||e.includes("..\\"))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||qi.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class co{static{h(this,"RateLimiter")}static{re(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),o=this.attempts.get(e);return!o||n>o.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):o.count>=this.maxAttempts?!1:(o.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,o]of this.attempts.entries())e>o.resetTime&&this.attempts.delete(n)}}var Gi=Object.defineProperty,Q=h((t,e)=>Gi(t,"name",{value:e,configurable:!0}),"A");const Hi=/^-([^\d-])$/,Ki=/^--(\S+)/,Yi=/^-([^\d-]{2,})$/,me=Q(t=>Hi.test(t)||Ki.test(t)||Yi.test(t),"isOption");class uo{static{h(this,"Cli")}static{Q(this,"Cli")}#t;#e;#a;#c;#v;#u;#w;#r;#n;#i;#d;#s;#l;#m=!1;#y;#b=!1;#p;#f;#h;#g=[];#P(){return this.#p===void 0&&(this.#p=[...this.#i.keys()]),this.#p}#$(){return this.#f===void 0&&(this.#f=[...this.#n.keys()]),this.#f}#o(){return this.#h===void 0&&(this.#h=[...this.#P(),...this.#$()]),this.#h}#O(){return this.#g.length===0?Y:[...Y,...this.#g]}#E(){this.#p=void 0,this.#f=void 0,this.#h=void 0}#N(){if(this.#a===void 0){const e=Si(this.#e.argv);this.#a=Ve(e),this.#_()}return this.#a}#_(){if(!this.#a)return;const e=z();let n=!1;for(const o of this.#a){if(o==="--quiet"||o==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(ut),n=!0;break}if(o==="--verbose"||o==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(dt),n=!0;break}if(o==="--debug"||o==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(B),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(B):String(we))}#C(){this.#b||(this.#y=Bi(this.#t),this.#b=!0)}#A(e,n,o,a){this.#t.debug(`command '${a}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:u,parsedArgs:r}=ui(e,n,this.#O()),m=Object.keys(u).length>0;let s=r;m&&(s={...r,_all:{...r._all,...u}}),bi(i,s,e);const f=ci(e,r,u,o);f.runtime=this,f.argv=this.#N();const g=e.options&&e.options.length>0;if(g&&e.options){const v=e.options.filter(O=>O.name.startsWith("no-"));for(const O of v){const $=O.name.replace("no-",""),L=`--${O.name}`,N=`--${$}`,W=n.includes(L),x=n.includes(N);if(W&&x)throw new Te($,O.name)}}return g&&(Ci(f,e),xi(f,e)),$i(i,f.options,e),z().CEREBRO_OUTPUT_LEVEL===String(B)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(f.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(f.argument,null,2))),{arguments_:i,booleanValues:u,commandArgs:s,parsedArgs:r,toolbox:f}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new b("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#v=e.trim();const o=n.argv??pe(),a=n.cwd??mt();if(this.#e={...n,argv:o,cwd:a},this.#e.argv&&!Array.isArray(this.#e.argv))throw new b("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new b("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new b("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new b("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const i=z();if(i.CEREBRO_OUTPUT_LEVEL=String(we),typeof this.#e.logger=="object"){const u=["debug","error","info","log","warn"],r=[],m=this.#e.logger;for(const s of u)typeof m[s]!="function"&&r.push(s);if(r.length>0)throw new b(`Logger object is missing required methods: ${r.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:r});this.#t=this.#e.logger}else this.#t={...console,debug:Q((...u)=>{i.CEREBRO_OUTPUT_LEVEL===String(B)&&console.debug(...u)},"debug")};this.#u=this.#e.packageVersion,this.#w=this.#e.packageName,this.#c=this.#e.cwd,this.#s="help",this.#l={},this.#n=new Map,this.#i=new Map,this.#d=new Map}setCommandSection(e){return this.#l=e,this}getCommandSection(){return this.#l.header||(this.#l.header=`${this.#v}${this.#u?` v${this.#u}`:""}`),this.#l}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){de(e,"Command"),J(e.name);const n=typeof e.execute=="function",o=typeof e.loader=="function";if(n&&o)throw new b(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!o)throw new b(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?J(e.alias):Me(e.alias,"Command alias").forEach(s=>J(s))),e.argument&&de(e.argument,"Command argument"),e.options&&de(e.options,"Command options"),e.commandPath&&(Me(e.commandPath,"Command commandPath"),e.commandPath.forEach(s=>{J(s)}));const a=je(e.name,e.commandPath),i=U(a);if(this.#i.has(i))throw new b(`Command with path "${i}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const u=Array.isArray(e.commandPath)&&e.commandPath.length>0,r=this.#n.get(e.name),m=r!==void 0&&(r.commandPath===void 0||r.commandPath.length===0);if(!u&&m)throw new b(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const s of e.options)$e(s);if(Oi(e),_i(e),Ei(e),e.options&&(e.__conflictingOptions__=e.options.filter(s=>s.conflicts!==void 0),e.__requiredOptions__=e.options.filter(s=>s.required===!0)),u&&r!==void 0)this.#n.set(i,e);else{if(!u&&r!==void 0&&!m){const s=je(r.name,r.commandPath);this.#n.set(U(s),r)}this.#n.set(e.name,e)}if(this.#i.set(i,a),this.#d.set(i,e),this.#E(),e.alias!==void 0){const s=typeof e.alias=="string"?[e.alias]:e.alias;for(const f of s){if(z().CEREBRO_OUTPUT_LEVEL===String(B)&&this.#t.debug("adding alias",f),this.#n.has(f))throw new b(`Command alias "${f}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:f,commandName:e.name});this.#n.set(f,e)}}return this}addGlobalOption(e){const n=e,o=new Set(Y.map(i=>i.name)),a=new Set(Y.map(i=>i.alias).filter(Boolean));if(o.has(n.name))throw new b(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&a.has(n.alias))throw new b(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#g.map(i=>i.name)).has(n.name))throw new b(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",$e(n),this.#g.push(n),this}getGlobalOptions(){return this.#O()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#r?this.#r:(this.#r=new At(this.#t),this.#r.register({description:"Attaches the logger to the toolbox",execute:Q(e=>{e.logger=this.#t},"execute"),name:"logger"}),this.#r)}getCliName(){return this.#v}getPackageVersion(){return this.#u}getPackageName(){return this.#w}getCommands(){return this.#n}getCwd(){return this.#c}dispose(){this.#y?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:o=!0,...a}=e;if(!this.#n.has("help")){const{default:l}=await import("../commands/help-command.js");this.addCommand(new l(this.#n))}const i=this.#$(),u=this.#i;this.#C();const r=this.#N();let m,s=[...r];const f=pt(),g=ft(),v=pe();this.#t.debug(`process.execPath: ${f}`),this.#t.debug(`process.execArgv: ${g.join(" ")}`),this.#t.debug(`process.argv: ${v.join(" ")}`);const O=Ai(u,[...r]);if(O.commandPath)m=O.commandPath,s=O.argv;else{if(r.length>1&&r[0]&&r[1]&&!me(r[0])&&!me(r[1])){const d=[];let p=0;for(;p<r.length;){const A=r[p];if(!A||me(A))break;d.push(A),p+=1}const w=U(d);if(d[0]&&!i.includes(d[0])){const A=this.#o(),y=R(w,A);throw new T(w,y)}}let l;try{l=Mt([null,...i],[...r])}catch(d){if(d instanceof Error&&d.name==="INVALID_COMMAND"&&"command"in d){const p=d.command,w=this.#o(),A=R(p,w);throw new T(p,A)}throw d}l.command&&(m=[l.command],s=l.argv)}if(!m)if(this.#s)m=[this.#s];else{const l=this.#o();throw new T("",l)}const $=U(m),L=this.#i.get($);let N;if(L){if(N=this.#d.get($),!N||U(L)!==$){const l=this.#o(),d=R($,l);throw new T($,d)}}else{const l=m.at(-1);if(N=l?this.#n.get(l):void 0,!N){const d=this.#o(),p=R($,d);throw new T($,p)}}if(typeof N.execute!="function"&&typeof N.loader!="function")return this.#t.error(`Command "${N.name}" has no function to execute.`),o?G(1):void 0;const W=s;let x,C;try{({commandArgs:x,toolbox:C}=this.#A(N,W,a,$))}catch(l){if(this.#t.error(l),o)return G(1);throw l}const c=this.getPluginManager();try{!this.#m&&c.hasPlugins()&&(await c.init({cli:this,cwd:this.#c,logger:this.#t}),this.#m=!0),await c.executeLifecycle("execute",C),await c.executeLifecycle("beforeCommand",C);let l;const d=x.global;if(d?.help){const p=this.#n.get("help");if(!p)throw new b("Help command not found","COMMAND_NOT_FOUND");l=await S(p,C,x)}else if(d?.version??d?.V){const p=this.#n.get("version");if(!p)throw new b("Version command not found","COMMAND_NOT_FOUND");l=await S(p,C,x)}else l=await S(N,C,x);return await c.executeLifecycle("afterCommand",C,l),o?G(0):void 0}catch(l){throw await c.executeErrorHandlers(l,C),l}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:o=[],...a}=n;ve(e,"Command name");const i=e.split(" ").filter(Boolean),u=U(i),r=this.#i.get(u)?this.#d.get(u):this.#n.get(e);if(!r){const v=this.#o(),O=R(u||e,v);throw new T(e,O)}if(typeof r.execute!="function"&&typeof r.loader!="function")throw new b(`Command "${r.name}" has no function to execute`,"INVALID_COMMAND",{commandName:r.name});const m=[...Ve(o)];this.#t.debug(`running command '${e}' programmatically with args: ${m.join(", ")}`);const{commandArgs:s,toolbox:f}=this.#A(r,m,a,u||e),g=this.getPluginManager();try{!this.#m&&g.hasPlugins()&&(await g.init({cli:this,cwd:this.#c,logger:this.#t}),this.#m=!0),await g.executeLifecycle("execute",f),await g.executeLifecycle("beforeCommand",f);let v;const O=s.global;if(O?.help){const $=this.#n.get("help");if(!$)throw new b("Help command not found","COMMAND_NOT_FOUND");v=await S($,f,s)}else if(O?.version??O?.V){const $=this.#n.get("version");if(!$)throw new b("Version command not found","COMMAND_NOT_FOUND");v=await S($,f,s)}else v=await S(r,f,s);return await g.executeLifecycle("afterCommand",f,v),v}catch(v){throw await g.executeErrorHandlers(v,f),v}}}export{uo as Cli};
@@ -0,0 +1,6 @@
1
+ var O=Object.defineProperty;var l=(r,e)=>O(r,"name",{value:e,configurable:!0});import{createRequire as $}from"node:module";import{getStringWidth as W}from"@visulima/string";import{createTable as g}from"@visulima/tabular";import{NO_BORDER as m}from"@visulima/tabular/style";import j from"terminal-size";import _ from"@visulima/colorize/template";import{d as E}from"./runtime-process-DKHFvYkv.js";import{bold as S}from"@visulima/colorize";const A=$(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=l(r=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,t]=u.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return u.getBuiltinModule(r)}return A(r)},"__cjs_getBuiltinModule"),L=R("node:os");var N=Object.defineProperty,T=l((r,e)=>N(r,"name",{value:e,configurable:!0}),"s");const p=new Map,C=500,s=T(r=>{if(!r||r==="")return"";const e=p.get(r);if(e!==void 0)return e;const t=_(Object.assign([],{raw:[r]}));if(p.size>=C){const i=p.keys().next().value;i!==void 0&&p.delete(i)}return p.set(r,t),t},"templateFormat");var P=Object.defineProperty,M=l((r,e)=>P(r,"name",{value:e,configurable:!0}),"t$1");const y=M(()=>{const r=E().CEREBRO_TERMINAL_WIDTH;if(r===void 0)return;const e=Number.parseInt(r,10);if(!(Number.isNaN(e)||e<=0))return e},"getTerminalWidth");var B=Object.defineProperty,H=l((r,e)=>B(r,"name",{value:e,configurable:!0}),"t");class w{static{l(this,"n")}static{H(this,"BaseSection")}lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(L.EOL)}header(e){this.add(S(e)),this.lines.push("")}}var I=Object.defineProperty,v=l((r,e)=>I(r,"name",{value:e,configurable:!0}),"g");const q=v(r=>r!==void 0&&r>0?r:j().columns,"resolveTerminalWidth"),x=v((r,e,t,i)=>{if(r.length===0||r.some(c=>c.length!==2))return;let o=0;for(const c of r){const h=c[0];if(h===void 0)continue;const b=W(h);b>o&&(o=b)}if(o===0)return;const d=t+i,n=o+d,a=20+d;if(n+a>e)return;const f=e-n;return[n,f]},"computeColumnWidths");class z extends w{static{l(this,"S")}static{v(this,"ContentSection")}constructor(e){if(super(),e.header&&this.header(s(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(t=>typeof t=="string"))e.content.forEach(t=>{Array.isArray(t)?t.forEach(i=>{this.add(s(i))}):this.add(s(t))});else if(typeof e.content=="string")this.add(s(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const t=g({showHeader:!1,style:{border:m,paddingLeft:4,paddingRight:1},terminalWidth:y(),truncateOverflow:!1,wordWrap:!0});return t.addRow([s(e)]),t.toString()}if(Array.isArray(e)&&e.every(t=>typeof t=="string"||Array.isArray(t)&&t.every(i=>typeof i=="string"))){const t=q(y()),i=v(a=>Array.isArray(a)?a.map(f=>s(f)):[s(a)],"formatRow"),o=e.map(a=>i(a)),d=x(o,t,4,1),n=g({columnWidths:d,showHeader:!1,style:{border:m,paddingLeft:4,paddingRight:1},terminalWidth:t,truncateOverflow:!1,wordWrap:!0});return o.forEach(a=>{d!==void 0&&a.length===2?n.addRow([{content:a[0],wordWrap:!1},a[1]]):n.addRow(a)}),n.toString()}if(typeof e=="object"){const t=e;if(!t.options||!t.data)throw new Error(`Must have an "options" or "data" property
2
+ ${JSON.stringify(e)}`);const i=g({showHeader:!1,style:{border:m,paddingLeft:4,paddingRight:1},terminalWidth:y(),truncateOverflow:!1,wordWrap:!0});return t.data.forEach(o=>{Array.isArray(o)?i.addRow(o.map(d=>s(d))):i.addRow([s(o)])}),i.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
3
+
4
+ ${JSON.stringify(e)}`)}}var D=Object.defineProperty,J=l((r,e)=>D(r,"name",{value:e,configurable:!0}),"m");class k extends w{static{l(this,"O")}static{J(this,"OptionListSection")}constructor(e){super();let t=e.optionList??[];const i=Array.isArray(e.hide)?e.hide:[e.hide].filter(n=>typeof n=="string"),o=Array.isArray(e.group)?e.group:[e.group].filter(n=>typeof n=="string");i.length>0&&(t=t.filter(n=>!i.includes(n.name))),e.header&&this.header(s(e.header)),o.length>0&&(t=t.filter(n=>{const a=n,f=o.includes("_none")&&!a.group,c=a.group,h=this.intersect(Array.isArray(c)?c:[c],o);return f||h?n:void 0}));const d=g({showHeader:!1,style:{border:m,paddingLeft:2,paddingRight:1,...e.tableOptions?.style},terminalWidth:y()??e.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:e.tableOptions?.wordWrap??!0,...e.tableOptions});t.forEach(n=>{const a=n;d.addRow([this.getOptionNames(a,e.reverseNameOrder??!1,e.isArgument??!1),s(a.description)])}),this.add(d.toString()),this.lines.push("")}getOptionNames(e,t,i){if(!e.name)throw new TypeError("Invalid option definition, name is required.");let o=e.type?e.type.name.toLowerCase():"string";const d=e.multiple||e.lazyMultiple?"[]":"";o=s(e.typeLabel??`{underline ${o}${d}}`);let n;if(e.alias)if(e.name){const a=i?e.name:`{yellow --${e.name}}`;n=s(t?`{bold ${a}}, {bold -${e.alias}} ${o}`:`{bold -${e.alias}}, {bold ${a}} ${o}`)}else t?n=s(`{bold -${e.alias}} ${o}`):n=s(`{bold -${e.alias}} ${o}`);else n=s(`{bold ${i?e.name:`{yellow --${e.name}}`}} ${o}`);return n}intersect(e,t){return e.some(i=>t.includes(i))}}var F=Object.defineProperty,U=l((r,e)=>F(r,"name",{value:e,configurable:!0}),"o");const te=U(r=>(Array.isArray(r)?r:[r]).length===0?"":`
5
+ ${r.map(e=>e.optionList?new k(e).toString():new z(e).toString()).join(`
6
+ `)}`,"commandLineUsage");export{s as f,te as p};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/cerebro",
3
- "version": "3.0.0-alpha.21",
3
+ "version": "3.0.0-alpha.23",
4
4
  "description": "A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.",
5
5
  "keywords": [
6
6
  "ansi",
@@ -35,11 +35,6 @@
35
35
  "bugs": {
36
36
  "url": "https://github.com/visulima/visulima/issues"
37
37
  },
38
- "license": "MIT",
39
- "author": {
40
- "name": "Daniel Bannert",
41
- "email": "d.bannert@anolilab.de"
42
- },
43
38
  "repository": {
44
39
  "type": "git",
45
40
  "url": "git+https://github.com/visulima/visulima.git",
@@ -55,19 +50,13 @@
55
50
  "url": "https://anolilab.com/support"
56
51
  }
57
52
  ],
58
- "files": [
59
- "dist",
60
- "README.md",
61
- "CHANGELOG.md",
62
- "LICENSE.md"
63
- ],
64
- "os": [
65
- "darwin",
66
- "linux",
67
- "win32"
68
- ],
69
- "type": "module",
53
+ "license": "MIT",
54
+ "author": {
55
+ "name": "Daniel Bannert",
56
+ "email": "d.bannert@anolilab.de"
57
+ },
70
58
  "sideEffects": false,
59
+ "type": "module",
71
60
  "exports": {
72
61
  ".": {
73
62
  "types": "./dist/index.d.ts",
@@ -115,20 +104,24 @@
115
104
  },
116
105
  "./package.json": "./package.json"
117
106
  },
118
- "publishConfig": {
119
- "access": "public",
120
- "provenance": true
121
- },
107
+ "files": [
108
+ "dist",
109
+ "README.md",
110
+ "CHANGELOG.md",
111
+ "LICENSE.md"
112
+ ],
122
113
  "dependencies": {
123
- "@visulima/colorize": "2.0.0-alpha.10",
114
+ "@visulima/colorize": "2.0.0-alpha.11",
115
+ "@visulima/string": "3.0.0-alpha.13",
124
116
  "@visulima/tabular": "4.0.0-alpha.11",
125
- "fastest-levenshtein": "^1.0.16"
117
+ "fastest-levenshtein": "^1.0.16",
118
+ "terminal-size": "^4.0.1"
126
119
  },
127
120
  "peerDependencies": {
128
121
  "@bomb.sh/tab": "0.0.15",
129
122
  "@visulima/boxen": "3.0.0-alpha.10",
130
123
  "@visulima/find-cache-dir": "3.0.0-alpha.9",
131
- "@visulima/pail": "4.0.0-alpha.15",
124
+ "@visulima/pail": "4.0.0-alpha.16",
132
125
  "github-slugger": "2.0.0"
133
126
  },
134
127
  "peerDependenciesMeta": {
@@ -150,5 +143,14 @@
150
143
  },
151
144
  "engines": {
152
145
  "node": "^22.14.0 || >=24.10.0"
146
+ },
147
+ "os": [
148
+ "darwin",
149
+ "linux",
150
+ "win32"
151
+ ],
152
+ "publishConfig": {
153
+ "access": "public",
154
+ "provenance": true
153
155
  }
154
156
  }
@@ -1,4 +0,0 @@
1
- var Dt=Object.defineProperty;var O=(t,e)=>Dt(t,"name",{value:e,configurable:!0});import{createRequire as Rt}from"node:module";import{VERBOSITY_DEBUG as F,POSITIONALS_KEY as oe,VERBOSITY_QUIET as Wt,VERBOSITY_VERBOSE as Ft,VERBOSITY_NORMAL as je}from"./VERBOSITY_QUIET-XPultrIA.js";import{c as C}from"./cerebro-error-BnJTixb2.js";import{d as G,h as Ce,e as X,o as Le,a as qt,i as Gt,f as Ht}from"./runtime-process-DKHFvYkv.js";import{distance as Kt}from"fastest-levenshtein";const Bt=Rt(import.meta.url),J=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zt=O(t=>{if(typeof J<"u"&&J.versions&&J.versions.node){const[e,n]=J.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return J.getBuiltinModule(t)}return Bt(t)},"__cjs_getBuiltinModule"),{createRequire:Yt}=zt("node:module"),ae=[{description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];var Jt=Object.defineProperty,Qt=O((t,e)=>Jt(t,"name",{value:e,configurable:!0}),"t$9");let B=class extends C{static{O(this,"a")}static{Qt(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const i=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(i,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}};var Zt=Object.defineProperty,Xt=O((t,e)=>Zt(t,"name",{value:e,configurable:!0}),"e$7");let nt=class extends C{static{O(this,"o")}static{Xt(this,"ConflictingOptionsError")}option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}};var en=Object.defineProperty,tn=O((t,e)=>en(t,"name",{value:e,configurable:!0}),"e$6");let nn=class extends C{static{O(this,"o")}static{tn(this,"PluginError")}pluginName;constructor(e,n,i){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:i,pluginName:e}),this.name="PluginError",this.pluginName=e,i&&(this.cause=i)}};var an=Object.defineProperty,Ie=O((t,e)=>an(t,"name",{value:e,configurable:!0}),"d$7");let on=class{static{O(this,"p")}static{Ie(this,"PluginManager")}logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);G().CEREBRO_OUTPUT_LEVEL===String(F)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const n=this.getDependencyOrder();this.logger.debug(`initializing ${String(n.length)} plugin(s)...`);for(const i of n)if(typeof i.init=="function"){this.logger.debug(`initializing plugin: ${i.name}`);try{await i.init(e)}catch(r){const a=new nn(i.name,`Failed to initialize: ${r instanceof Error?r.message:String(r)}`,r instanceof Error?r:void 0);throw this.logger.error(a.message),a}}this.initialized=!0}async executeLifecycle(e,n,i){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const r=this.getDependencyOrder();for(const a of r){const c=a[e];if(typeof c=="function"){this.logger.debug(`executing ${e} hook for plugin: ${a.name}`);try{await(e==="afterCommand"?c(n,i):c(n))}catch(s){throw this.logger.error(`Error in ${e} hook for plugin "${a.name}":`,s),s}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const i=this.getDependencyOrder();for(const r of i)if(typeof r.onError=="function"){this.logger.debug(`executing error handler for plugin: ${r.name}`);try{await r.onError(e,n)}catch(a){this.logger.error(`Error in error handler for plugin "${r.name}":`,a)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,i=new Set,r=Ie(a=>{if(n.has(a))return;if(i.has(a))throw new Error(`Circular dependency detected involving plugin "${a}"`);const c=this.plugins.get(a);if(!c)throw new Error(`Plugin "${a}" not found`);if(i.add(a),c.dependencies)for(const s of c.dependencies)r(s);i.delete(a),n.add(a),e.push(c)},"visit");for(const a of this.plugins.keys())r(a);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};var rn=Object.defineProperty,sn=O((t,e)=>rn(t,"name",{value:e,configurable:!0}),"n$c");const te=sn(t=>t.type?.name==="Boolean","optionIsBoolean");var ln=Object.defineProperty,at=O((t,e)=>ln(t,"name",{value:e,configurable:!0}),"p$a");const cn=at(t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},"getTypeLabel"),Se=at(t=>(te(t)||(t.typeLabel=t.typeLabel??cn(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var un=Object.defineProperty,it=O((t,e)=>un(t,"name",{value:e,configurable:!0}),"e$4");const pn=new RegExp(/^-([^\d-])$/),fn=new RegExp(/^--(\S+)/),hn=new RegExp(/^-([^\d-]{2,})$/),dn=it(t=>pn.test(t)||fn.test(t)||hn.test(t),"isOption"),mn=it((t,e)=>{const n=e[0]&&dn(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}},"commandLineCommands");var gn=Object.defineProperty,ot=O((t,e)=>gn(t,"name",{value:e,configurable:!0}),"i$b"),vn=Object.defineProperty,rt=ot((t,e)=>vn(t,"name",{value:e,configurable:!0}),"i"),wn=Object.defineProperty,st=rt((t,e)=>wn(t,"name",{value:e,configurable:!0}),"s"),yn=Object.defineProperty,lt=st((t,e)=>yn(t,"name",{value:e,configurable:!0}),"i"),bn=Object.defineProperty,ct=lt((t,e)=>bn(t,"name",{value:e,configurable:!0}),"t");ct(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let le=class extends Error{static{O(this,"v")}static{ot(this,"g")}static{rt(this,"p")}static{st(this,"V")}static{lt(this,"VisulimaError")}static{ct(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:r,name:a,stack:c,title:s}){super(r,{cause:e}),this.title=s,this.name=a,this.stack=c??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}};var $n=Object.defineProperty,ut=O((t,e)=>$n(t,"name",{value:e,configurable:!0}),"o$b"),On=Object.defineProperty,pt=ut((t,e)=>On(t,"name",{value:e,configurable:!0}),"o"),Pn=Object.defineProperty,En=pt((t,e)=>Pn(t,"name",{value:e,configurable:!0}),"i");let An=class ft extends le{static{O(this,"a")}static{ut(this,"a")}static{pt(this,"t")}static{En(this,"AlreadySetError")}optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,ft.prototype)}};var Cn=Object.defineProperty,ht=O((t,e)=>Cn(t,"name",{value:e,configurable:!0}),"t$7"),Nn=Object.defineProperty,dt=ht((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"e"),xn=Object.defineProperty,kn=dt((t,e)=>xn(t,"name",{value:e,configurable:!0}),"e");let Me=class mt extends le{static{O(this,"n")}static{ht(this,"n")}static{dt(this,"o")}static{kn(this,"UnknownOptionError")}optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,mt.prototype)}};var _n=Object.defineProperty,gt=O((t,e)=>_n(t,"name",{value:e,configurable:!0}),"a$a"),jn=Object.defineProperty,vt=gt((t,e)=>jn(t,"name",{value:e,configurable:!0}),"a"),Ln=Object.defineProperty,In=vt((t,e)=>Ln(t,"name",{value:e,configurable:!0}),"o");let Sn=class wt extends le{static{O(this,"n")}static{gt(this,"o")}static{vt(this,"e")}static{In(this,"UnknownValueError")}value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,wt.prototype)}};var Mn=Object.defineProperty,yt=O((t,e)=>Mn(t,"name",{value:e,configurable:!0}),"i$8"),Un=Object.defineProperty,bt=yt((t,e)=>Un(t,"name",{value:e,configurable:!0}),"i"),Tn=Object.defineProperty,Vn=bt((t,e)=>Tn(t,"name",{value:e,configurable:!0}),"i");let j=class $t extends le{static{O(this,"a")}static{yt(this,"o")}static{bt(this,"e")}static{Vn(this,"InvalidDefinitionsError")}constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,$t.prototype)}};var Dn=Object.defineProperty,Rn=O((t,e)=>Dn(t,"name",{value:e,configurable:!0}),"z$1"),Bn=Object.defineProperty,K=Rn((t,e)=>Bn(t,"name",{value:e,configurable:!0}),"S"),zn=Object.defineProperty,ce=K((t,e)=>zn(t,"name",{value:e,configurable:!0}),"o");const Ue=ce(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),Te=ce(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Ve=ce(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),Wn=ce((t,e)=>Array.isArray(t)?Ue(e)?t.map(Boolean):Te(e)?t.map(Number):Ve(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:Ue(e)?!!t:Te(e)?Number(t):Ve(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var Fn=Object.defineProperty,qn=K((t,e)=>Fn(t,"name",{value:e,configurable:!0}),"e");const _=qn((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var Gn=Object.defineProperty,D=K((t,e)=>Gn(t,"name",{value:e,configurable:!0}),"h$1");const Hn=/-([a-z])/g,Kn=/^\d+$/,ve=D(t=>t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean"),"isBooleanType"),Yn=D(t=>t.codePointAt(0)===95,"isSpecialKey"),De=D((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),Re=D(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Be=D((t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),Jn=D((t,e,n,i,r)=>{let a=e.get(t)??n.get(t);if(!a&&i){const c=t.toLowerCase();a=i.get(c)??r?.get(c)}return a},"getDefinition"),Qn=D((t,e,n,i)=>{const r=n.debug??!1;_(r,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),_(r,"Starting argument resolution","resolver"),_(r,"Tokens:","resolver",t),_(r,"Definitions:","resolver",e),_(r,"Processing tokens...","resolver");const a=new Map,c=new Map,s=n.caseInsensitive?new Map:void 0,m=n.caseInsensitive?new Map:void 0,o=n.camelCase?new Map:void 0,u=n.camelCase?new Map:void 0;for(const f of e)if(a.set(f.name,f),f.alias&&c.set(f.alias,f),n.caseInsensitive&&s&&(s.set(f.name.toLowerCase(),f),f.alias&&m&&m.set(f.alias.toLowerCase(),f)),n.camelCase&&o&&u){const h=f.name.replaceAll(Hn,(v,w)=>w.toUpperCase());o.set(f.name,h),u.set(h,f.name)}const d={},l={},g=[],p=new Set;let b=!1;const $=e.find(f=>f.defaultOption),y=e.some(f=>f.group),E=e.some(f=>f.type===Number);for(let f=0;f<t.length;f++){const h=t[f];if(h.kind==="option-terminator"){d._unknown=i.slice(h.index),b=!0;break}if(h.kind==="option"&&h.name){let v=Jn(h.name,a,c,s,m);if(!v&&h.value===void 0&&E&&Kn.test(h.name)){const A=e.find(S=>S.type===Number);A&&(v=A,h.value=h.name,h.name=A.name)}const w=v?v.name:h.name,P=v?.multiple,k=v?.lazyMultiple;if(l[w]!==void 0&&!P&&!k&&!n.partial)throw new An(w);if(!v&&n.partial){const A=h.rawName??`--${h.name}${h.value!==void 0&&h.inlineValue?`=${h.value}`:""}`;g.push({index:h.index,value:A});continue}if(!v&&n.stopAtFirstUnknown){d._unknown=i.slice(h.index);break}if(!v&&!n.partial)throw new Me(h.name);if(h.value===void 0){const A=t[f+1],S=A?.kind==="option"&&!("name"in A)&&A.value!==void 0,I=A&&v&&!(v.type&&ve(v.type))&&(A.kind==="positional"||S),Vt=v&&v.defaultOption&&!v.multiple&&!v.lazyMultiple;if(I&&(!v?.defaultOption||Vt))if(P){let M=f+1;const ge=[];for(;M<t.length&&(t[M].kind==="positional"||t[M].kind==="option"&&!("name"in t[M])&&t[M].value!==void 0);)ge.push(t[M].value),p.add(t[M].index),M++;l[w]=l[w]===void 0?ge:De(l[w],ge),f=M-1}else k?(Be(l,w,A.value,!0),p.add(A.index),f++):(l[w]=A.value,p.add(A.index),f++);else v?.type&&ve(v.type)?Be(l,w,!0,P):l[w]=P?[]:null}else{let{value:A}=h;if(v?.type&&ve(v.type))switch(A){case"":{if(n.partial)l._unknown??=[],l._unknown.push(`${h.rawName??`--${h.name}`}${h.value?`=${h.value}`:""}`),A=!0;else throw new Me(h.name);break}case"false":{A=!1;break}case"true":{A=!0;break}default:A=!0}const S=[A];if(P){let I=f+1;for(;I<t.length&&t[I].kind==="positional";)S.push(t[I].value),p.add(t[I].index),I++;f=I-1}l[w]===void 0?l[w]=P||k?S:A:P||k?l[w]=De(l[w],S):l[w]=A}}else if(h.kind==="positional"&&n.stopAtFirstUnknown&&!p.has(h.index)&&!$){_(r,`Found unconsumed positional token at index ${String(h.index)}, stopping processing`,"resolver"),d._unknown=i.slice(h.index);break}}for(const[f,h]of Object.entries(l)){const v=a.get(f);v&&(v.multiple||v.lazyMultiple)&&!Array.isArray(h)&&(l[f]=[h])}let N=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!b){for(const f of t)if(f.kind==="option"&&!a.has(f.name??"")&&!c.has(f.name??"")&&(!n.caseInsensitive||!s?.has(f.name?.toLowerCase()??"")&&!m?.has(f.name?.toLowerCase()??""))){N=f.index;break}}if($){const f=[],h=[];for(const v of t)v.kind==="positional"&&!p.has(v.index)&&v.index<N&&(f.push(v.value),h.push(v));if(f.length>0){const v=l[$.name],w=$.multiple??$.lazyMultiple;v===void 0?w?(h.forEach(P=>p.add(P.index)),l[$.name]=f):(p.add(h[0].index),l[$.name]=f[0]):w&&(h.forEach(P=>p.add(P.index)),l[$.name]=Array.isArray(v)?[...f,...v]:[...f,v])}}if(!n.partial){for(const f of t)if(f.kind==="positional"&&!p.has(f.index))throw new Sn(i[f.index])}if(n.partial&&!n.stopAtFirstUnknown){const f=[...g];if(l._unknown){const h=new Map;for(const[v,w]of i.entries())h.set(w,v);for(const v of l._unknown){const w=h.get(v);w!==void 0&&f.push({index:w,value:v})}}for(const h of t)h.kind==="positional"&&!p.has(h.index)&&f.push({index:h.index,value:i[h.index]});f.length>0&&(f.sort((h,v)=>h.index-v.index),d._unknown=f.map(h=>h.value))}if(n.stopAtFirstUnknown&&!b){const f=t.findIndex(w=>w.kind==="option"&&!a.has(w.name??"")&&!c.has(w.name??"")&&(!n.caseInsensitive||!s?.has(w.name?.toLowerCase()??"")&&!m?.has(w.name?.toLowerCase()??""))),h=t.findIndex(w=>w.kind==="positional"&&!p.has(w.index));let v=-1;if(f!==-1&&h!==-1?v=Math.min(f,h):f!==-1?v=f:h!==-1&&(v=h),v>=0){const w=t[v].index;d._unknown=i.slice(w)}}else g.length>0&&!n.partial&&(d._unknown=g.map(f=>f.value));for(const[f,h]of Object.entries(l)){const v=n.camelCase?o?.get(f)??f:f,w=a.get(f);d[v]=w?.type?Wn(h,w.type):h===void 0?null:h}for(const f of e){const h=n.camelCase?o?.get(f.name)??f.name:f.name;!(h in d)&&f.defaultValue!==void 0&&(f.multiple??f.lazyMultiple?d[h]=Array.isArray(f.defaultValue)?[...f.defaultValue]:[f.defaultValue]:d[h]=f.defaultValue)}if(y){const f={},h={},v={};for(const P of e)if(P.group){const k=Array.isArray(P.group)?P.group:[P.group];for(const A of k)Re(A)||(f[A]??={})}for(const P of Object.keys(d))if(!Yn(P)){h[P]=d[P];let k=P;n.camelCase&&(k=u?.get(P)??P);const A=a.get(k);if(A?.group){const S=Array.isArray(A.group)?A.group:[A.group];for(const I of S)Re(I)||f[I]&&(f[I][P]=d[P])}else v[P]=d[P]}const w={_all:h};for(const[P,k]of Object.entries(f))w[P]=k;Object.keys(v).length>0&&(w._none=v),d._unknown&&(w._unknown=d._unknown),Object.keys(d).forEach(P=>delete d[P]),Object.assign(d,w)}return _(r,"Final parsed result:","resolver",d),d},"resolveArgs");var Zn=Object.defineProperty,R=K((t,e)=>Zn(t,"name",{value:e,configurable:!0}),"l");const V="-".codePointAt(0),T="=",Xn=T.codePointAt(0),ea="--",ta="-",na="--",Ot=R(t=>t.length>2&&t.startsWith(na),"hasLongOptionPrefix"),aa=R(t=>Ot(t)&&!t.includes(T,3),"isLongOption"),ia=R(t=>Ot(t)&&t.includes(T,3),"isLongOptionAndValue"),oa=R(t=>t!==void 0&&t.length>0&&t.codePointAt(0)!==V,"hasOptionValue"),ra=R(t=>{if(t.length!==2||t.codePointAt(0)!==V||t.codePointAt(1)===V)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),sa=R(t=>!(t.length<=2||t.codePointAt(0)!==V||t.codePointAt(1)===V),"isShortOptionGroup"),la=R(t=>{const e=[],n=[...t];let i=-1,r=0;for(;n.length>0;){const a=n.shift();if(a===void 0)break;const c=n[0];if(r>0?r--:i++,a===ea){e.push({index:i,kind:"option-terminator"});const s=n.map((m,o)=>({index:i+o+1,kind:"positional",value:m}));e.push(...s),i+=n.length;break}if(ra(a)){const s=a.charAt(1);let m;r?(e.push({index:i,kind:"option",name:s,rawName:a,value:m}),r===1&&oa(c)&&(m=n.shift(),e.push({index:i,kind:"option",value:m}))):e.push({index:i,kind:"option",name:s,rawName:a,value:m}),m!==void 0&&++i;continue}if(sa(a)&&!a.includes(T)){const s=[];let m="",o=!1;for(let u=1;u<a.length;u++){const d=a.charAt(u);o?m+=d:d.codePointAt(0)===Xn?o=!0:s.push(`${ta}${d}`)}if(o)if(s.length>0){const u=s.pop();s.push(`${u}=${m}`)}else s.push(m);n.unshift(...s),r=s.length;continue}if(aa(a)){const s=a.slice(2);e.push({index:i,kind:"option",name:s,rawName:a});continue}if(ia(a)){const s=a.indexOf(T),m=a.slice(2,s),o=a.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:m,rawName:a,value:o});continue}if(a.length>2&&a.codePointAt(0)===V&&a.codePointAt(1)!==V&&a.includes(T)){const s=a.indexOf(T),m=a.charAt(1),o=a.slice(s+1);e.push({index:i,inlineValue:!0,kind:"option",name:m,rawName:a,value:o});continue}e.push({index:i,kind:"positional",value:a})}return e},"parseArgsTokens");var ca=Object.defineProperty,xe=K((t,e)=>ca(t,"name",{value:e,configurable:!0}),"d");const ua=/\d/,pa=xe(t=>t!=null&&(t===Boolean||typeof t=="function"&&t.name.startsWith("Boolean")),"isBooleanType"),fa=xe(t=>typeof t=="function","isValidCustomTypeFunction"),ha=xe((t,e,n)=>{const i=n?.debug??!1;_(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const r=new Set,a=new Set,c=new Set,s=new Set;let m=0;for(const o of t){if(_(i,"Checking definition:","validation",o),!o.name)throw _(i,"Validation failed: name is required","validation"),new j("Invalid option definition: name is required");if(typeof o.name!="string")throw new j("Invalid option definition: name must be a string");if(o.name.trim()==="")throw new j("Invalid option definition: name cannot be empty");const u=e?o.name.toLowerCase():"";if(r.has(o.name)||e&&c.has(u))throw new j(`Invalid option definition: duplicate name '${o.name}'`);if(a.has(o.name)||e&&s.has(u))throw new j(`Invalid option definition: name '${o.name}' conflicts with an existing alias`);if(r.add(o.name),e&&c.add(u),o.alias!==void 0){if(typeof o.alias!="string")throw new j("Invalid option definition: alias must be a string");if(o.alias.length!==1)throw new j("Invalid option definition: alias must be a single character");if(ua.test(o.alias))throw new j("Invalid option definition: alias cannot be numeric");if(o.alias==="-")throw new j('Invalid option definition: alias cannot be "-"');const d=e?o.alias.toLowerCase():"";if(a.has(o.alias)||e&&s.has(d))throw new j(`Invalid option definition: duplicate alias '${o.alias}'`);if(r.has(o.alias)||e&&c.has(d))throw new j(`Invalid option definition: alias '${o.alias}' conflicts with an existing option name`);a.add(o.alias),e&&s.add(d)}if(o.defaultOption&&(m++,o.type!==void 0&&pa(o.type)))throw new j("Invalid option definition: defaultOption cannot be Boolean type");if(o.type!==void 0&&!(o.type===Boolean||o.type===Number||o.type===String||typeof o.type=="function"&&fa(o.type)))throw new j("Invalid option definition: invalid type")}if(m>1)throw _(i,"Validation failed: multiple defaultOptions not allowed","validation"),new j("Invalid option definition: multiple defaultOptions not allowed");_(i,"Validation completed successfully","validation")},"validateDefinitions");var da=Object.defineProperty,ma=K((t,e)=>da(t,"name",{value:e,configurable:!0}),"O");const ga=ma((t,e={})=>{const n=e.debug??!1;_(n,"Starting command-line-args parsing","index"),_(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const r=Array.isArray(t)?t:[t];_(n,"Normalized definitions:","index",r),ha(r,i.caseInsensitive,n?i:void 0);let{argv:a}=i;if(!a&&(a=process.argv.slice(2),process.execArgv.length>0)){const o=new Set(process.execArgv);a=a.filter(u=>!o.has(u))}_(n,"Using argv:","index",a);let c=a;i.caseInsensitive&&(c=a.map(o=>{if(o.startsWith("--")){const u=o.indexOf("="),d=(u===-1?o.slice(2):o.slice(2,u)).toLowerCase();return u===-1?`--${d}`:`--${d}${o.slice(u)}`}if(o.startsWith("-")&&!o.startsWith("--")&&o.length>1){const u=o.slice(1).split("=",2),d=u[0],l=u[1];if(!d)return o;const g=d.toLowerCase();return l===void 0?`-${g}`:`-${g}=${l}`}return o}));const s=la(c.map(String));_(n,"Tokenized arguments:","index",s);const m=Qn(s,r,i,a);return _(n,"Command-line-args parsing completed","index"),m},"commandLineArgs");var va=Object.defineProperty,wa=O((t,e)=>va(t,"name",{value:e,configurable:!0}),"n$8");let ya=class{static{O(this,"a")}static{wa(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}};var ba=Object.defineProperty,$a=O((t,e)=>ba(t,"name",{value:e,configurable:!0}),"n$7");let we=class extends C{static{O(this,"i")}static{$a(this,"CommandLoaderError")}commandName;constructor(e,n,i){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",i!==void 0&&(this.cause=i)}};var Oa=Object.defineProperty,Pa=O((t,e)=>Oa(t,"name",{value:e,configurable:!0}),"f$5");const Ea=/^-{1,2}(\w+)(=(.+))?$/,Pt=Pa((t,e,n,i)=>{const r=Ea.exec(t);if(r===null)return{};const a=r[1];if(!a)return{};const c=n&&i?n.get(a)??i.get(a):e.find(s=>s.name===a||s.alias===a);return c!==void 0?{argName:c.name,argValue:r[3],option:c}:{}},"getParameterOption");var Aa=Object.defineProperty,Ne=O((t,e)=>Aa(t,"name",{value:e,configurable:!0}),"e$3");const ze=Ne((t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},"convertType"),Ca=new Set(["0","1","false","true"]),Na=Ne((t,e,n,i)=>{if(e.length===0||t.length===0)return{};const r=Ne((a,c)=>{const{argName:s,argValue:m,option:o}=Pt(c,e,n,i),{lastOption:u}=a;return o&&te(o)&&m&&s?a.partial[s]=ze(m,o):a.lastName&&u&&te(u)&&Ca.has(c)&&(a.partial[a.lastName]=ze(c,u)),{lastName:s,lastOption:o,partial:a.partial}},"getBooleanValue");return t.reduce(r,{partial:{}}).partial},"getBooleanValues");var xa=Object.defineProperty,We=O((t,e)=>xa(t,"name",{value:e,configurable:!0}),"s$8");const ka=new Set(["0","1","false","true"]),_a=We((t,e,n,i)=>{if(e.length===0||t.length===0)return t;const r=We((a,c)=>{const{argValue:s,option:m}=Pt(c,e,n,i),{lastOption:o}=a;if(o&&te(o)&&ka.has(c)){const{args:u}=a;return{args:u.slice(0,-1)}}return m&&te(m)&&s?{args:a.args}:{args:[...a.args,c],lastOption:m}},"removeBooleanArguments");return t.reduce(r,{args:[]}).args},"removeBooleanValues");var ja=Object.defineProperty,La=O((t,e)=>ja(t,"name",{value:e,configurable:!0}),"o$8");const Fe=La(t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var Ia=Object.defineProperty,ue=O((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"o$7");const Sa=ue(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),Ma=ue((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return Sa(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},"transformEnvValue"),Ua=/_./g,Ta=/^[A-Z]/,Va=ue(t=>t.toLowerCase().replaceAll(Ua,e=>e[1]?.toUpperCase()??e).replace(Ta,e=>e.toLowerCase()),"toCamelCase"),Da=ue(t=>{if(!t||t.length===0)return{};const e={},n=G();for(const i of t){const r=n[i.name],a=Ma(i,r),c=a===void 0?i.defaultValue:a,s=Va(i.name);e[s]=c}return e},"processEnvVariables");var Ra=Object.defineProperty,ne=O((t,e)=>Ra(t,"name",{value:e,configurable:!0}),"a$5");const Ba=ne(t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const r=Array.isArray(i.alias)?i.alias:[i.alias];for(const a of r)n.set(a,i)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),za=ne(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new we(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new we(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new we(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),Wa=ne((t,e,n,i)=>{const r=new ya(t.name,t),{_all:a,_unknown:c,positionals:s}=e,m=Object.keys(n).length>0?{...a,...n}:a;oe in m&&delete m[oe],r.argument=s?.[oe]??[],r.rawUnknown=[...c??[]];const o=Object.keys(i).length>0;return r.options=o?{...m,...i}:m,r.env=Da(t.env),r},"prepareToolbox"),Fa=ne((t,e,n)=>{const i=t.options??[],r=i.length>0;let a=Fe(r?[...i,...n]:n);if(a.length>0){for(const o of a)if(o.multiple&&o.lazyMultiple)throw new Error(`Argument "${o.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(a=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:oe,type:t.argument.type,typeLabel:t.argument.typeLabel},...a]);let c,s;if(r){const{optionMapByAlias:o,optionMapByName:u}=Ba(i);c=_a(e,i,u,o),s=Na(e,i,u,o)}else c=e,s={};const m=ga(a,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:a,booleanValues:s,parsedArgs:m}},"processCommandArgs"),z=ne(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await za(t))(e),"executeCommand");var qa=Object.defineProperty,Ga=O((t,e)=>qa(t,"name",{value:e,configurable:!0}),"n$6");let Ha=class extends C{static{O(this,"s")}static{Ga(this,"CommandValidationError")}commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}};var Ka=Object.defineProperty,Ya=O((t,e)=>Ka(t,"name",{value:e,configurable:!0}),"t$5");const qe=Ya((t,e,n=!1)=>{const i=[];for(const r of t)if(!(!n&&!r.required)&&e[r.name]===void 0){if(r.type?.name==="Boolean"){e[r.name]=!1;continue}i.push(r)}return i},"listMissingArguments");var Ja=Object.defineProperty,Et=O((t,e)=>Ja(t,"name",{value:e,configurable:!0}),"n$5");const Qa=Et((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Kt(t,e)<=t.length/3,"isSimilar"),q=Et((t,e)=>{const n=t.toLowerCase();return e.filter(i=>Qa(i.toLowerCase(),n))},"findAlternatives");var Za=Object.defineProperty,pe=O((t,e)=>Za(t,"name",{value:e,configurable:!0}),"a$4");const Xa=pe((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const r=i.startsWith("--");let a=`Found unknown ${r?"option":"argument"} "${i}"`;if(r){const c=q(i.replace("--",""),(e.options??[]).map(s=>s.name));if(c.length>0){const[s,...m]=c.map(o=>`--${o}`);a+=m.length>0?`, did you mean ${s??""} or ${m.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(a)}),n.length>0)throw new Error(n.join(`
2
- `))},"validateUnknownOptions"),ei=pe((t,e,n)=>{const i=n.__requiredOptions__,r=i?qe(i,e,!0):qe(t,e,!1);if(r.length>0)throw new Ha(n.name,r.map(a=>a.name));e._unknown&&e._unknown.length>0&&!n.argument&&Xa(e,n)},"validateRequiredOptions"),ti=pe((t,e,n)=>{const i=n.__conflictingOptions__??t.filter(r=>r.conflicts!==void 0);if(i.length>0){const r=i.find(a=>Array.isArray(a.conflicts)?a.conflicts.some(c=>e[c]!==void 0)&&e[a.name]!==void 0:e[a.conflicts]!==void 0&&e[a.name]!==void 0);if(r)throw new nt(r.name,typeof r.conflicts=="string"?r.conflicts:r.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),ni=pe(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const r of t.options){if(r.name){const a=e.get(r.name)??[];a.push(r),e.set(r.name,a)}if(typeof r.alias=="string"&&r.alias.length>0){const a=n.get(r.alias)??[];a.push(r),n.set(r.alias,a)}else if(Array.isArray(r.alias)){for(const a of r.alias)if(a.length>0){const c=n.get(a)??[];c.push(r),n.set(a,c)}}}const i=[];for(const[r,a]of e)a.length>1&&i.push(`Duplicate option name "${r}" in command "${t.name}": ${JSON.stringify(a)}`);for(const[r,a]of n)a.length>1&&i.push(`Duplicate option alias "-${r}" used by options ${a.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
3
- `))},"validateDuplicateOptions");var ai=Object.defineProperty,ke=O((t,e)=>ai(t,"name",{value:e,configurable:!0}),"s$4");const ii=ke((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let r=1;r<=e.length;r+=1){const a=e[r-1];if(a===void 0||a.startsWith("-"))break;n.push(a);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:r})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),Q=ke(t=>t.join(" "),"getCommandPathKey"),oi=ke((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var ri=Object.defineProperty,si=O((t,e)=>ri(t,"name",{value:e,configurable:!0}),"p$4"),li=Object.defineProperty,At=si((t,e)=>li(t,"name",{value:e,configurable:!0}),"e"),ci=Object.defineProperty,ui=At((t,e)=>ci(t,"name",{value:e,configurable:!0}),"E");const Ct=String.raw,Ge=Ct`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,pi=ui(()=>new RegExp(Ct`\p{RI}{2}|(?![#*\d](?!\uFE0F?\u20E3))${Ge}(?:\u200D${Ge})*`,"gu"),"default");var fi=Object.defineProperty,hi=At((t,e)=>fi(t,"name",{value:e,configurable:!0}),"p");Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]]));const H=pi(),di=/[-_./\s]+/g,ee=/(\u001B\[[0-9;]*[a-z])/i,He=new RegExp("\\p{Script=Arabic}","u"),mi=new RegExp("\\p{Script=Bengali}","u"),W=new RegExp("\\p{Script=Cyrillic}","u"),gi=new RegExp("\\p{Script=Devanagari}","u"),vi=new RegExp("\\p{Script=Ethiopic}","u"),ye=new RegExp("\\p{Script=Greek}","u"),Ke=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),wi=new RegExp("\\p{Script=Gujarati}","u"),yi=new RegExp("\\p{Script=Gurmukhi}","u"),Ye=new RegExp("\\p{Script=Hangul}","u"),Je=new RegExp("\\p{Script=Hebrew}","u"),bi=new RegExp("\\p{Script=Hiragana}","u"),Qe=new RegExp("\\p{Script=Han}","u"),$i=new RegExp("\\p{Script=Kannada}","u"),Oi=new RegExp("\\p{Script=Katakana}","u"),Pi=new RegExp("\\p{Script=Khmer}","u"),Ei=new RegExp("\\p{Script=Lao}","u"),L=new RegExp("\\p{Script=Latin}","u"),Ai=new RegExp("\\p{Script=Malayalam}","u"),Ci=new RegExp("\\p{Script=Myanmar}","u"),Ni=new RegExp("\\p{Script=Oriya}","u"),xi=new RegExp("\\p{Script=Sinhala}","u"),ki=new RegExp("\\p{Script=Tamil}","u"),_i=new RegExp("\\p{Script=Telugu}","u"),ji=new RegExp("\\p{Script=Thai}","u"),Li=new RegExp("\\p{Script=Tibetan}","u"),Ze=/[\u02BB\u02BC\u0027]/u,Ii=hi(t=>t.replace(H,""),"stripEmoji");var Si=Object.defineProperty,Nt=O((t,e)=>Si(t,"name",{value:e,configurable:!0}),"i$5"),Mi=Object.defineProperty,xt=Nt((t,e)=>Mi(t,"name",{value:e,configurable:!0}),"r"),Ui=Object.defineProperty,Ti=xt((t,e)=>Ui(t,"name",{value:e,configurable:!0}),"c");let kt=class{static{O(this,"l")}static{Nt(this,"y")}static{xt(this,"s")}static{Ti(this,"LRUCache")}capacity;cache;keyOrder;constructor(e){this.capacity=e,this.cache=new Map,this.keyOrder=[]}get(e){if(this.cache.has(e))return this.keyOrder=this.keyOrder.filter(n=>n!==e),this.keyOrder.push(e),this.cache.get(e)}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.keyOrder=this.keyOrder.filter(i=>i!==e);else if(this.cache.size>=this.capacity){const i=this.keyOrder.shift();i!==void 0&&this.cache.delete(i)}this.cache.set(e,n),this.keyOrder.push(e)}delete(e){this.cache.delete(e),this.keyOrder=this.keyOrder.filter(n=>n!==e)}clear(){this.cache.clear(),this.keyOrder=[]}size(){return this.cache.size}};var Vi=Object.defineProperty,Di=O((t,e)=>Vi(t,"name",{value:e,configurable:!0}),"r$5"),Ri=Object.defineProperty,Bi=Di((t,e)=>Ri(t,"name",{value:e,configurable:!0}),"a"),zi=Object.defineProperty,Wi=Bi((t,e)=>zi(t,"name",{value:e,configurable:!0}),"s");const Fi=Wi((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var qi=Object.defineProperty,Gi=O((t,e)=>qi(t,"name",{value:e,configurable:!0}),"I"),Hi=Object.defineProperty,fe=Gi((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"W");const Ki=Yt(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yi=fe(t=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[e,n]=Z.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Z.getBuiltinModule(t)}return Ki(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Ji}=Yi("node:util");var Qi=Object.defineProperty,Zi=fe((t,e)=>Qi(t,"name",{value:e,configurable:!0}),"g");const be=new kt(1e3),Xi=/[.*+?^${}()|[\]\\]/g,eo=Zi(t=>{const e=t.join("");if(be.has(e))return be.get(e);const n=t.map(r=>r.replaceAll(Xi,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return be.set(e,i),i},"getSeparatorsRegex");var to=Object.defineProperty,no=fe((t,e)=>to(t,"name",{value:e,configurable:!0}),"t");const ao=no(t=>{const e=[];let n=0,i;for(H.lastIndex=0;(i=H.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=H.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var io=Object.defineProperty,x=fe((t,e)=>io(t,"name",{value:e,configurable:!0}),"u");const oo=/[ČŠŽĐ]/i,_t=new Uint8Array(128),jt=new Uint8Array(128),Lt=new Uint8Array(128);for(let t=0;t<128;t++)_t[t]=t>=65&&t<=90?1:0,jt[t]=t>=97&&t<=122?1:0,Lt[t]=t>=48&&t<=57?1:0;const $e=x(t=>_t[t],"isUpper"),Xe=x(t=>jt[t],"isLower"),Oe=x(t=>Lt[t],"isDigit"),U=x((t,e,n,i,r)=>{if(t.length===0)return[];let a=!1;const c=Object.values(e);for(const g of c)if(g(t[0])){a=!0;break}if(!a&&!n)return[t];const s=[...t],m=[];let o=s[0],u="other";const d=Object.entries(e);for(const g of d){const[p,b]=g;if(b(s[0])){u=p;break}}let l=n&&i?s[0]===s[0].toLocaleUpperCase(i):!1;for(let g=1;g<s.length;g++){const p=s[g];let b="other";for(const E of d){const[N,f]=E;if(f(p)){b=N;break}}const $=n&&i?p===p.toLocaleUpperCase(i):!1;let y=!1;r?y=r(u,b,l,$,p,g,s):(u!==b&&u!=="other"&&b!=="other"&&(y=!0),n&&b!=="other"&&!l&&$&&(y=!0)),y?(m.push(o),o=p):o+=p,u=b,n&&(l=$)}return o&&o.length>0&&m.push(o),m.length>0?m:[t]},"handleScriptTransitions"),ro=x((t,e,n,i)=>{if(n.size===0)return e;for(const r of n)if(t.startsWith(r,e))return i.push(r),e+r.length;return e},"detectAndProcessAcronym"),It=x((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],r=t.length;for(let a=1;a<r;a++){const c=ro(t,n,e,i);if(c!==n){n=c,a=n-1;continue}const s=t.codePointAt(a-1),m=t.codePointAt(a),o=s&&s<128&&$e(s),u=m&&m<128&&$e(m),d=s&&s<128&&Xe(s),l=s&&s<128&&Oe(s),g=m&&m<128&&Oe(m);if(d&&u){i.push(t.slice(n,a)),n=a;continue}if(l&&!g||!l&&g){i.push(t.slice(n,a)),n=a;continue}if(g&&!l){let p=!1,b=!1;if(a+1<r){const $=t.codePointAt(a+1);p=$&&$<128&&$e($),b=$&&$<128&&Oe($)}if(!b&&p){i.push(t.slice(n,a),t.slice(a,a+1)),n=a+1;continue}}if(a+1<r){const p=t.codePointAt(a+1),b=p&&p<128&&Xe(p);if(o&&u&&b){const $=t.slice(n,a+1);e.has($)||(i.push(t.slice(n,a)),n=a)}}}return n<r&&i.push(t.slice(n)),i.filter(a=>a!=="")},"splitCamelCaseFast"),St=x((t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const o=[...t],u=o.length,d=[];let l=o[0],g=o[0]===o[0].toLocaleUpperCase(e),p=g,b=g?0:-1;for(let $=1;$<u;$++){const y=o[$],E=y===y.toLocaleUpperCase(e);if(E===g)l+=y;else if(E)l&&l.length>0&&(d.push(l),l=y),p=!0,b=$;else{if(p&&$-b>1){const N=o[$-1],f=l.slice(0,-1);f&&f.length>0&&d.push(f),l=N+y}else l+=y;p=!1,b=-1}g=E}return l&&l.length>0&&d.push(l),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!W.test(t)&&!L.test(t))return[t];const o=[...t],u=o.length,d=[];let l=o[0];const g=o[0];let p;W.test(g)?p=1:L.test(g)?p=2:p=0;let b=g===g.toLocaleUpperCase(e);for(let y=1;y<u;y++){const E=o[y];let N;W.test(E)?N=1:L.test(E)?N=2:N=0;const f=E===E.toLocaleUpperCase(e);p!==N&&(p===1||p===2)&&(N===1||N===2)||N===p&&!b&&f?(d.push(l),l=E):l+=E,p=N,b=f}l&&l.length>0&&d.push(l);const $=[];for(let y=0;y<d.length;y++)y<d.length-1&&d[y].length===1&&L.test(d[y])&&W.test(d[y+1][0])?($.push(d[y]+d[y+1]),y+=1):$.push(d[y]);return $}if(e.startsWith("el")){if(!ye.test(t)&&!L.test(t))return[t];const o=[];Ke.lastIndex=0;let u;for(;(u=Ke.exec(t))!==null;)o.push(u[0]);o.length===0&&o.push(t);const d=[];if(o.length===1){const l=o[0];if(!l||!ye.test(l[0])||l.length===1)return[l??t]}for(const l of o){if(!l)continue;if(!ye.test(l[0])||l.length===1){d.push(l);continue}const g=l.length;let p=l[0],b=l[0]===l[0].toLocaleUpperCase(e);for(let $=1;$<g;$++){const y=l[$],E=y===y.toLocaleUpperCase(e);!b&&E?(d.push(p),p=y):p+=y,b=E}p&&d.push(p)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const o=e.startsWith("ja"),u=o?{hiragana:x(l=>bi.test(l),"hiragana"),kanji:x(l=>Qe.test(l),"kanji"),katakana:x(l=>Oi.test(l),"katakana"),latin:x(l=>L.test(l),"latin")}:{hangul:x(l=>Ye.test(l),"hangul"),latin:x(l=>L.test(l),"latin")},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(o){const l=U(t,u,!1,e,(p,b)=>p==="hiragana"&&b==="katakana"||p==="katakana"&&b==="hiragana"||p==="hiragana"&&b==="latin"||p==="katakana"&&b==="latin"||p==="kanji"&&b==="latin"||p==="latin"&&(b==="hiragana"||b==="katakana"||b==="kanji")),g=[];for(const p of l){const b=p;b.length===1&&d.has(b)&&g.length>0?g[g.length-1]=g.at(-1)+b:g.push(b)}return g.length>0?g:[t]}return U(t,u,!1,e,(l,g)=>l==="hangul"&&g==="latin"||l==="latin"&&g==="hangul")}if(e.startsWith("sl")){const o=[...t],u=o.length,d=[];let l=o[0],g=o[0]===o[0].toLocaleUpperCase(e);for(let p=1;p<u;p++){const b=o[p],$=b===b.toLocaleUpperCase(e),y=oo.test(b),E=p<u-1&&o[p+1]===o[p+1].toLocaleUpperCase(e);!g&&$||y&&E?(d.push(l),l=b,y&&E&&(d.push(l),l="")):l+=b,g=$}return l&&l.length>0&&d.push(l),d}if(e.startsWith("zh"))return U(t,{han:x(o=>Qe.test(o),"han"),latin:x(o=>L.test(o),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const o=x(u=>Je.test(u)||He.test(u),"isRtlChar");return U(t,{latin:x(u=>L.test(u),"latin"),rtl:x(u=>o(u),"rtl")},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const o=x(u=>gi.test(u)||mi.test(u)||wi.test(u)||yi.test(u)||$i.test(u)||ki.test(u)||_i.test(u)||Ai.test(u)||xi.test(u)||ji.test(u)||Ei.test(u)||Li.test(u)||Ci.test(u)||vi.test(u)||Pi.test(u)||Ni.test(u),"isIndicChar");return U(t,{indic:x(u=>o(u),"indic"),latin:x(u=>L.test(u),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return U(t,{cyrillic:x(o=>W.test(o),"cyrillic"),latin:x(o=>L.test(o),"latin")},!0,e);if(["ar","fa","he"].includes(e))return U(t,{latin:x(o=>L.test(o),"latin"),rtl:x(o=>Je.test(o)||He.test(o),"rtl")},!1,e);if(e.startsWith("ko"))return U(t,{hangul:x(o=>Ye.test(o),"hangul"),latin:x(o=>L.test(o),"latin")},!1,e);if(e.startsWith("uz")){if(!W.test(t)&&!L.test(t))return[t];const o=[...t],u=o.length,d=[];let l=o[0],g=o[0]===o[0].toLocaleUpperCase(e);for(let p=1;p<u;p++){const b=o[p],$=b===b.toLocaleUpperCase(e);if(Ze.test(b)||Ze.test(o[p-1])){l+=b;continue}!g&&$?(d.push(l),l=b):l+=b,g=$}return l&&l.length>0&&d.push(l),d}const r=[...t],a=r.length,c=[];let s=r[0],m=r[0]===r[0].toLocaleUpperCase(e);for(const o of n)if(t.startsWith(o)){c.push(o),s=r[o.length],m=s===s.toLocaleUpperCase(e);break}for(let o=1;o<a;o++){const u=r[o],d=u===u.toLocaleUpperCase(e);let l=0;for(const g of n)if(t.startsWith(g,o)){c.push(s,g),l=g.length,s="";const p=g.at(-1);p&&(m=p===p.toLocaleUpperCase(e));break}if(l>0){o+=l-1;continue}!m&&d?(c.push(s),s=u):s+=u,m=d}return s&&c.push(s),c},"splitCamelCaseLocale"),so=x((t,e,n)=>{const i=[],r=ee.test(t)?t.split(ee).filter(Boolean):[t];for(const a of r){const c=a;if(ee.test(c))i.push(c);else{const s=H.test(c)?ao(c).filter(Boolean):[c];for(const m of s)if(H.test(m))i.push(m);else if(e){const o=e.toLowerCase().split("-")[0];i.push(...St(m,o,n))}else i.push(...It(m,n))}}return i},"processTextWithAnsiEmoji"),lo=x((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:r=[],locale:a,normalize:c=!1,separators:s,stripAnsi:m=!1,stripEmoji:o=!1}=e,u=new Set([...r].toSorted((y,E)=>E.length-y.length));let d=t;m&&(d=Ji(d)),o&&(d=Ii(d));let l;Array.isArray(s)?l=eo(s):s instanceof RegExp?l=s:l=di;const g=[];let p=d;const b=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;p.length>0;){const y=b.exec(p);if(!y){p===".."?g.push(".."):p==="."?g.push("."):p.length>0&&g.push(p);break}const E=y.index,N=y[0],f=N.length,h=p.slice(0,E),v=p.slice(E+f);if(N.startsWith("../"))g.push(".."),p=p.slice(E+3);else if(N.startsWith("./"))g.push("."),p=p.slice(E+2);else if(E===0&&N==="..")g.push(".."),p=p.slice(2);else if(E===0&&N===".")g.push("."),p=p.slice(1);else{h.length>0&&g.push(h);let w=0;for(;(w=N.indexOf("../",w))!==-1;)g.push(".."),w+=3;for(w=0;(w=N.indexOf("./",w))!==-1;)(w===0||N[w-1]!==".")&&g.push("."),w+=2;let P=v;for(;P.startsWith("../");)g.push(".."),P=P.slice(3);for(;P.startsWith("./");)g.push("."),P=P.slice(2);if(P===".."){g.push("..");break}else if(P==="."){g.push(".");break}else p=P}b.lastIndex=0}if(g.length===0){const y=d.split(l).filter(Boolean);g.push(...y)}let $=[];for(const y of g)n||i?$.push(...so(y,a,u)):a?$.push(...St(y,a,u)):$.push(...It(y,u));return c&&($=$.map(y=>u.has(y)?y:a&&y===y.toLocaleUpperCase(a)?y[0]+y.slice(1).toLocaleLowerCase(a):y.toUpperCase()===y&&!u.has(y)?y.slice(0,1)+y.slice(1).toLowerCase():y)),$},"splitByCase");var co=Object.defineProperty,uo=O((t,e)=>co(t,"name",{value:e,configurable:!0}),"r$4"),po=Object.defineProperty,fo=uo((t,e)=>po(t,"name",{value:e,configurable:!0}),"o"),ho=Object.defineProperty,mo=fo((t,e)=>ho(t,"name",{value:e,configurable:!0}),"s");const go=mo((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var vo=Object.defineProperty,wo=O((t,e)=>vo(t,"name",{value:e,configurable:!0}),"r$3"),yo=Object.defineProperty,bo=wo((t,e)=>yo(t,"name",{value:e,configurable:!0}),"r"),$o=Object.defineProperty,Oo=bo((t,e)=>$o(t,"name",{value:e,configurable:!0}),"n");const Po=Oo((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var Eo=Object.defineProperty,Ao=O((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"i$3"),Co=Object.defineProperty,No=Ao((t,e)=>Co(t,"name",{value:e,configurable:!0}),"f"),xo=Object.defineProperty,ko=No((t,e)=>xo(t,"name",{value:e,configurable:!0}),"l");const _o=ko((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let r="",a="";for(let c=0;c<n;c++){const s=t[c];if(ee.test(s)){r?(i.push(r+a+s),r="",a=""):(i.length>0&&i.push(e),r=s);continue}r?(a&&(a+=e),a+=s):(i.length>0&&i.push(e),i.push(s))}return i.join("")},"joinSegments");var jo=Object.defineProperty,Lo=O((t,e)=>jo(t,"name",{value:e,configurable:!0}),"r$2"),Io=Object.defineProperty,So=Lo((t,e)=>Io(t,"name",{value:e,configurable:!0}),"a"),Mo=Object.defineProperty,Uo=So((t,e)=>Mo(t,"name",{value:e,configurable:!0}),"e");const To=/(?<![a-zß])SS(?![a-z])/g,Vo=Uo(t=>t.replaceAll(To,"ß"),"normalizeGermanEszett");var Do=Object.defineProperty,Ro=O((t,e)=>Do(t,"name",{value:e,configurable:!0}),"c$2"),Bo=Object.defineProperty,zo=Ro((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"c"),Wo=Object.defineProperty,Fo=zo((t,e)=>Wo(t,"name",{value:e,configurable:!0}),"o");const qo=new kt(1e3),Mt=Fo((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,i=e?.cacheStore??qo;let r;if(n&&(r=Po(t,e)),n&&r&&i.has(r))return i.get(r);let a=!0;const c=_o(lo(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>{if(e?.handleAnsi&&ee.test(s))return s;const m=e?.locale?.startsWith("de")?Vo(s):s,o=e?.locale?m.toLocaleLowerCase(e.locale):m.toLowerCase();return a?(a=!1,Fi(o,e)):go(o,e)}),"");return n&&r&&i.set(r,c),c},"camelCase");var Go=Object.defineProperty,he=O((t,e)=>Go(t,"name",{value:e,configurable:!0}),"a$2");const Ho=he(t=>{t.options?.forEach(e=>{e.__camelCaseName__=Mt(e.name)})},"processOptionNames"),Ko=he(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const r=i.name.replace("no-","");if(!e.has(r)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const a={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:r};n.push(a),e.add(r)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),Yo=he((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const a of e.options)if(a.name.startsWith("no-")){const c=Mt(a.name);i.set(c,a)}const r=Object.keys(n).filter(a=>i.has(a));if(r.length!==0)for(const a of r){const c=a.charAt(2);if(!c)continue;const s=c.toLowerCase()+a.slice(3),m=i.get(a);m&&(m.__negated__=!0),n[s]=!n[a],Reflect.deleteProperty(n,a)}},"mapNegatableOptions"),Jo=he((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const r of e.options)r.__camelCaseName__&&r.__negated__===void 0&&r.implies!==void 0&&n.set(r.__camelCaseName__,r);if(n.size===0)return;const{options:i}=t;for(const r of Object.keys(i)){const a=n.get(r);if(a?.implies){const{implies:c}=a;for(const[s,m]of Object.entries(c))i[s]===void 0&&(i[s]=m)}}},"mapImpliedOptions");var Qo=Object.defineProperty,de=O((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"e$2");const Zo=de(()=>!!process.versions.electron,"isElectronApp"),Xo=de(()=>Zo()&&!process.defaultApp,"isBundledElectronApp"),er=de(()=>Xo()?0:1,"getProcessArgvBinIndex"),tr=de(t=>t.slice(er()+1),"hideBin");var nr=Object.defineProperty,Ut=O((t,e)=>nr(t,"name",{value:e,configurable:!0}),"e$1");const ar=" ",ir=Ut((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),"equals"),or=Ut(t=>{if(typeof t=="string")return t.split(ar);const e=Ce();return ir(t,e)?tr(t):t},"parseRawCommand");var rr=Object.defineProperty,Pe=O((t,e)=>rr(t,"name",{value:e,configurable:!0}),"r");const sr=Pe(t=>{const e=Pe(a=>{t.error(`Uncaught exception: ${a.message||a}`),a.stack&&t.error(a.stack),X(1)},"uncaughtExceptionHandler"),n=Pe((a,c)=>{if(a instanceof Error)t.error(`Promise rejection: ${a.message||a}`),a.stack&&t.error(a.stack);else{let s;if(typeof a=="string")s=a;else try{s=JSON.stringify(a)}catch{s=String(a)}t.error(`Promise rejection: ${s}`)}X(1)},"unhandledRejectionHandler"),i=Le("uncaughtException",e),r=Le("unhandledRejection",n);return()=>{i(),r()}},"registerExceptionHandler");var lr=Object.defineProperty,Y=O((t,e)=>lr(t,"name",{value:e,configurable:!0}),"e");const se=100,Tt=/^[a-z][\w-]*$/i,_e=Y((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new C(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),et=Y((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new C(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");Y((t,e)=>{if(typeof t!="function")throw new C(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const Ee=Y((t,e)=>{if(typeof t!="object"||t===null)throw new C(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),ie=Y(t=>{const e=_e(t,"Command name");if(e.length>se)throw new C(`Command name is too long (maximum ${String(se)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new C(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Tt.test(e))throw new C(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");Y(t=>{const e=_e(t,"Plugin name");if(e.length>se)throw new C(`Plugin name is too long (maximum ${String(se)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new C(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!Tt.test(e))throw new C(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var cr=Object.defineProperty,me=O((t,e)=>cr(t,"name",{value:e,configurable:!0}),"s");const ur=new Set([`
4
- `,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),pr=/^[A-Z]:/i,fr=me(t=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error(`Argument is too long (maximum ${String(1e4)} characters)`);for(const e of t)if(ur.has(e))throw new Error(`Argument contains dangerous character: ${e}`);return t.trim()},"sanitizeArgument"),tt=me(t=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error(`Too many arguments (maximum ${String(100)})`);return t.map(e=>fr(e))},"sanitizeArguments");me(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.includes("..")||e.includes("../")||e.includes("..\\"))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||pr.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class Lr{static{O(this,"RateLimiter")}static{me(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),i=this.attempts.get(e);return!i||n>i.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):i.count>=this.maxAttempts?!1:(i.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,i]of this.attempts.entries())e>i.resetTime&&this.attempts.delete(n)}}var hr=Object.defineProperty,re=O((t,e)=>hr(t,"name",{value:e,configurable:!0}),"v");const dr=/^-([^\d-])$/,mr=/^--(\S+)/,gr=/^-([^\d-]{2,})$/,Ae=re(t=>dr.test(t)||mr.test(t)||gr.test(t),"isOption");class Ir{static{O(this,"Cli")}static{re(this,"Cli")}#t;#e;#o;#c;#v;#u;#w;#r;#n;#a;#p;#s;#l;#f=!1;#y;#b=!1;#h;#d;#m;#g=[];#A(){return this.#h===void 0&&(this.#h=[...this.#a.keys()]),this.#h}#$(){return this.#d===void 0&&(this.#d=[...this.#n.keys()]),this.#d}#i(){return this.#m===void 0&&(this.#m=[...this.#A(),...this.#$()]),this.#m}#O(){return this.#g.length===0?ae:[...ae,...this.#g]}#C(){this.#h=void 0,this.#d=void 0,this.#m=void 0}#P(){if(this.#o===void 0){const e=or(this.#e.argv);this.#o=tt(e),this.#N()}return this.#o}#N(){if(!this.#o)return;const e=G();let n=!1;for(const i of this.#o){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Wt),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Ft),n=!0;break}if(i==="--debug"||i==="-vvv"){e.CEREBRO_OUTPUT_LEVEL=String(F),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(F):String(je))}#x(){this.#b||(this.#y=sr(this.#t),this.#b=!0)}#E(e,n,i,r){this.#t.debug(`command '${r}' found, parsing command args: ${n.join(", ")}`);const{arguments_:a,booleanValues:c,parsedArgs:s}=Fa(e,n,this.#O()),m=Object.keys(c).length>0;let o=s;m&&(o={...s,_all:{...s._all,...c}}),ei(a,o,e);const u=Wa(e,s,c,i);u.runtime=this,u.argv=this.#P();const d=e.options&&e.options.length>0;if(d&&e.options){const l=e.options.filter(g=>g.name.startsWith("no-"));for(const g of l){const p=g.name.replace("no-",""),b=`--${g.name}`,$=`--${p}`,y=n.includes(b),E=n.includes($);if(y&&E)throw new nt(p,g.name)}}return d&&(Yo(u,e),Jo(u,e)),ti(a,u.options,e),G().CEREBRO_OUTPUT_LEVEL===String(F)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(u.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(u.argument,null,2))),{arguments_:a,booleanValues:c,commandArgs:o,parsedArgs:s,toolbox:u}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new C("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#v=e.trim();const i=n.argv??Ce(),r=n.cwd??qt();if(this.#e={...n,argv:i,cwd:r},this.#e.argv&&!Array.isArray(this.#e.argv))throw new C("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new C("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new C("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new C("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const a=G();if(a.CEREBRO_OUTPUT_LEVEL=String(je),typeof this.#e.logger=="object"){const c=["debug","error","info","log","warn"],s=[],m=this.#e.logger;for(const o of c)typeof m[o]!="function"&&s.push(o);if(s.length>0)throw new C(`Logger object is missing required methods: ${s.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:s});this.#t=this.#e.logger}else this.#t={...console,debug:re((...c)=>{a.CEREBRO_OUTPUT_LEVEL===String(F)&&console.debug(...c)},"debug")};this.#u=this.#e.packageVersion,this.#w=this.#e.packageName,this.#c=this.#e.cwd,this.#s="help",this.#l={},this.#n=new Map,this.#a=new Map,this.#p=new Map}setCommandSection(e){return this.#l=e,this}getCommandSection(){return this.#l.header||(this.#l.header=`${this.#v}${this.#u?` v${this.#u}`:""}`),this.#l}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){Ee(e,"Command"),ie(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new C(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new C(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?ie(e.alias):et(e.alias,"Command alias").forEach(c=>ie(c))),e.argument&&Ee(e.argument,"Command argument"),e.options&&Ee(e.options,"Command options"),e.commandPath&&(et(e.commandPath,"Command commandPath"),e.commandPath.forEach(c=>{ie(c)}));const r=oi(e.name,e.commandPath),a=Q(r);if(this.#a.has(a))throw new C(`Command with path "${a}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});if(this.#n.has(e.name)&&!e.commandPath)throw new C(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const c of e.options)Se(c);if(ni(e),Ko(e),Ho(e),e.options&&(e.__conflictingOptions__=e.options.filter(c=>c.conflicts!==void 0),e.__requiredOptions__=e.options.filter(c=>c.required===!0)),this.#n.set(e.name,e),this.#a.set(a,r),this.#p.set(a,e),this.#C(),e.alias!==void 0){const c=typeof e.alias=="string"?[e.alias]:e.alias;for(const s of c){if(G().CEREBRO_OUTPUT_LEVEL===String(F)&&this.#t.debug("adding alias",s),this.#n.has(s))throw new C(`Command alias "${s}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:s,commandName:e.name});this.#n.set(s,e)}}return this}addGlobalOption(e){const n=e,i=new Set(ae.map(a=>a.name)),r=new Set(ae.map(a=>a.alias).filter(Boolean));if(i.has(n.name))throw new C(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&r.has(n.alias))throw new C(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#g.map(a=>a.name)).has(n.name))throw new C(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",Se(n),this.#g.push(n),this}getGlobalOptions(){return this.#O()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#r?this.#r:(this.#r=new on(this.#t),this.#r.register({description:"Attaches the logger to the toolbox",execute:re(e=>{e.logger=this.#t},"execute"),name:"logger"}),this.#r)}getCliName(){return this.#v}getPackageVersion(){return this.#u}getPackageName(){return this.#w}getCommands(){return this.#n}getCwd(){return this.#c}dispose(){this.#y?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...r}=e;if(!this.#n.has("help")){const{default:h}=await import("../commands/help-command.js");this.addCommand(new h(this.#n))}const a=this.#$(),c=this.#a;this.#x();const s=this.#P();let m,o=[...s];const u=Gt(),d=Ht(),l=Ce();this.#t.debug(`process.execPath: ${u}`),this.#t.debug(`process.execArgv: ${d.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const g=ii(c,[...s]);if(g.commandPath)m=g.commandPath,o=g.argv;else{if(s.length>1&&s[0]&&s[1]&&!Ae(s[0])&&!Ae(s[1])){const v=[];let w=0;for(;w<s.length;){const k=s[w];if(!k||Ae(k))break;v.push(k),w+=1}const P=Q(v);if(v[0]&&!a.includes(v[0])){const k=this.#i(),A=q(P,k);throw new B(P,A)}}let h;try{h=mn([null,...a],[...s])}catch(v){if(v instanceof Error&&v.name==="INVALID_COMMAND"&&"command"in v){const w=v.command,P=this.#i(),k=q(w,P);throw new B(w,k)}throw v}h.command&&(m=[h.command],o=h.argv)}if(!m)if(this.#s)m=[this.#s];else{const h=this.#i();throw new B("",h)}const p=Q(m),b=this.#a.get(p);let $;if(b){if($=this.#p.get(p),!$||Q(b)!==p){const h=this.#i(),v=q(p,h);throw new B(p,v)}}else{const h=m.at(-1);if($=h?this.#n.get(h):void 0,!$){const v=this.#i(),w=q(p,v);throw new B(p,w)}}if(typeof $.execute!="function"&&typeof $.loader!="function")return this.#t.error(`Command "${$.name}" has no function to execute.`),i?X(1):void 0;const y=o;let E,N;try{({commandArgs:E,toolbox:N}=this.#E($,y,r,p))}catch(h){if(this.#t.error(h),i)return X(1);throw h}const f=this.getPluginManager();try{!this.#f&&f.hasPlugins()&&(await f.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await f.executeLifecycle("execute",N),await f.executeLifecycle("beforeCommand",N);let h;const v=E.global;if(v?.help){const w=this.#n.get("help");if(!w)throw new C("Help command not found","COMMAND_NOT_FOUND");h=await z(w,N,E)}else if(v?.version??v?.V){const w=this.#n.get("version");if(!w)throw new C("Version command not found","COMMAND_NOT_FOUND");h=await z(w,N,E)}else h=await z($,N,E);return await f.executeLifecycle("afterCommand",N,h),i?X(0):void 0}catch(h){throw await f.executeErrorHandlers(h,N),h}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...r}=n;_e(e,"Command name");const a=e.split(" ").filter(Boolean),c=Q(a),s=this.#a.get(c)?this.#p.get(c):this.#n.get(e);if(!s){const l=this.#i(),g=q(c||e,l);throw new B(e,g)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new C(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const m=[...tt(i)];this.#t.debug(`running command '${e}' programmatically with args: ${m.join(", ")}`);const{commandArgs:o,toolbox:u}=this.#E(s,m,r,c||e),d=this.getPluginManager();try{!this.#f&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#c,logger:this.#t}),this.#f=!0),await d.executeLifecycle("execute",u),await d.executeLifecycle("beforeCommand",u);let l;const g=o.global;if(g?.help){const p=this.#n.get("help");if(!p)throw new C("Help command not found","COMMAND_NOT_FOUND");l=await z(p,u,o)}else if(g?.version??g?.V){const p=this.#n.get("version");if(!p)throw new C("Version command not found","COMMAND_NOT_FOUND");l=await z(p,u,o)}else l=await z(s,u,o);return await d.executeLifecycle("afterCommand",u,l),l}catch(l){throw await d.executeErrorHandlers(l,u),l}}}export{Ir as Cli};
@@ -1,6 +0,0 @@
1
- var v=Object.defineProperty;var s=(r,e)=>v(r,"name",{value:e,configurable:!0});import{createRequire as w}from"node:module";import{createTable as p}from"@visulima/tabular";import{NO_BORDER as u}from"@visulima/tabular/style";import A from"@visulima/colorize/template";import{d as R}from"./runtime-process-DKHFvYkv.js";import{bold as _}from"@visulima/colorize";const O=w(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$=s(r=>{if(typeof c<"u"&&c.versions&&c.versions.node){const[e,t]=c.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return c.getBuiltinModule(r)}return O(r)},"__cjs_getBuiltinModule"),j=$("node:os");var E=Object.defineProperty,L=s((r,e)=>E(r,"name",{value:e,configurable:!0}),"s");const f=new Map,N=500,o=L(r=>{if(!r||r==="")return"";const e=f.get(r);if(e!==void 0)return e;const t=A(Object.assign([],{raw:[r]}));if(f.size>=N){const i=f.keys().next().value;i!==void 0&&f.delete(i)}return f.set(r,t),t},"templateFormat");var S=Object.defineProperty,W=s((r,e)=>S(r,"name",{value:e,configurable:!0}),"t$1");const g=W(()=>{const r=R().CEREBRO_TERMINAL_WIDTH;if(r===void 0)return;const e=Number.parseInt(r,10);if(!(Number.isNaN(e)||e<=0))return e},"getTerminalWidth");var T=Object.defineProperty,P=s((r,e)=>T(r,"name",{value:e,configurable:!0}),"t");class y{static{s(this,"n")}static{P(this,"BaseSection")}lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(j.EOL)}header(e){this.add(_(e)),this.lines.push("")}}var M=Object.defineProperty,B=s((r,e)=>M(r,"name",{value:e,configurable:!0}),"f");class C extends y{static{s(this,"l")}static{B(this,"ContentSection")}constructor(e){if(super(),e.header&&this.header(o(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(t=>typeof t=="string"))e.content.forEach(t=>{Array.isArray(t)?t.forEach(i=>{this.add(o(i))}):this.add(o(t))});else if(typeof e.content=="string")this.add(o(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const t=p({showHeader:!1,style:{border:u,paddingLeft:4,paddingRight:1},terminalWidth:g(),truncateOverflow:!1,wordWrap:!0});return t.addRow([o(e)]),t.toString()}if(Array.isArray(e)&&e.every(t=>typeof t=="string"||Array.isArray(t)&&t.every(i=>typeof i=="string"))){const t=p({showHeader:!1,style:{border:u,paddingLeft:4,paddingRight:1},terminalWidth:g(),truncateOverflow:!1,wordWrap:!0});return e.forEach(i=>{Array.isArray(i)?t.addRow(i.map(n=>o(n))):t.addRow([o(i)])}),t.toString()}if(typeof e=="object"){const t=e;if(!t.options||!t.data)throw new Error(`Must have an "options" or "data" property
2
- ${JSON.stringify(e)}`);const i=p({showHeader:!1,style:{border:u,paddingLeft:4,paddingRight:1},terminalWidth:g(),truncateOverflow:!1,wordWrap:!0});return t.data.forEach(n=>{Array.isArray(n)?i.addRow(n.map(l=>o(l))):i.addRow([o(n)])}),i.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
3
-
4
- ${JSON.stringify(e)}`)}}var H=Object.defineProperty,I=s((r,e)=>H(r,"name",{value:e,configurable:!0}),"m");class q extends y{static{s(this,"O")}static{I(this,"OptionListSection")}constructor(e){super();let t=e.optionList??[];const i=Array.isArray(e.hide)?e.hide:[e.hide].filter(a=>typeof a=="string"),n=Array.isArray(e.group)?e.group:[e.group].filter(a=>typeof a=="string");i.length>0&&(t=t.filter(a=>!i.includes(a.name))),e.header&&this.header(o(e.header)),n.length>0&&(t=t.filter(a=>{const d=a,m=n.includes("_none")&&!d.group,h=d.group,b=this.intersect(Array.isArray(h)?h:[h],n);return m||b?a:void 0}));const l=p({showHeader:!1,style:{border:u,paddingLeft:2,paddingRight:1,...e.tableOptions?.style},terminalWidth:g()??e.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:e.tableOptions?.wordWrap??!0,...e.tableOptions});t.forEach(a=>{const d=a;l.addRow([this.getOptionNames(d,e.reverseNameOrder??!1,e.isArgument??!1),o(d.description)])}),this.add(l.toString()),this.lines.push("")}getOptionNames(e,t,i){if(!e.name)throw new TypeError("Invalid option definition, name is required.");let n=e.type?e.type.name.toLowerCase():"string";const l=e.multiple||e.lazyMultiple?"[]":"";n=o(e.typeLabel??`{underline ${n}${l}}`);let a;if(e.alias)if(e.name){const d=i?e.name:`{yellow --${e.name}}`;a=o(t?`{bold ${d}}, {bold -${e.alias}} ${n}`:`{bold -${e.alias}}, {bold ${d}} ${n}`)}else t?a=o(`{bold -${e.alias}} ${n}`):a=o(`{bold -${e.alias}} ${n}`);else a=o(`{bold ${i?e.name:`{yellow --${e.name}}`}} ${n}`);return a}intersect(e,t){return e.some(i=>t.includes(i))}}var x=Object.defineProperty,z=s((r,e)=>x(r,"name",{value:e,configurable:!0}),"o");const Q=z(r=>(Array.isArray(r)?r:[r]).length===0?"":`
5
- ${r.map(e=>e.optionList?new q(e).toString():new C(e).toString()).join(`
6
- `)}`,"commandLineUsage");export{o as f,Q as p};