@hot-updater/cli-tools 0.35.7 → 0.35.8

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.
Files changed (3) hide show
  1. package/dist/index.d.mts +742 -37
  2. package/dist/index.mjs +1969 -1311
  3. package/package.json +7 -7
package/dist/index.d.mts CHANGED
@@ -422,7 +422,7 @@ declare function promoteBundle({
422
422
  targetChannel
423
423
  }: PromoteBundleInput, deps: PromoteBundleDependencies): Promise<Bundle>;
424
424
  //#endregion
425
- //#region ../../node_modules/.pnpm/@clack+core@1.0.1/node_modules/@clack/core/dist/index.d.mts
425
+ //#region ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.d.mts
426
426
  declare const actions: readonly ["up", "down", "left", "right", "space", "enter", "cancel"];
427
427
  type Action = (typeof actions)[number];
428
428
  /** Global settings for Clack programs, stored in memory */
@@ -434,6 +434,16 @@ interface InternalClackSettings {
434
434
  error: string;
435
435
  };
436
436
  withGuide: boolean;
437
+ date: {
438
+ monthNames: string[];
439
+ messages: {
440
+ invalidMonth: string;
441
+ required: string;
442
+ invalidDay: (days: number, month: string) => string;
443
+ afterMin: (min: Date) => string;
444
+ beforeMax: (max: Date) => string;
445
+ };
446
+ };
437
447
  }
438
448
  declare const settings: InternalClackSettings;
439
449
  interface ClackSettings {
@@ -461,6 +471,19 @@ interface ClackSettings {
461
471
  error?: string;
462
472
  };
463
473
  withGuide?: boolean;
474
+ /**
475
+ * Date prompt localization
476
+ */
477
+ date?: {
478
+ /** Month names for validation messages (January, February, ...) */monthNames?: string[];
479
+ messages?: {
480
+ /** Shown when date is missing */required?: string; /** Shown when month > 12 */
481
+ invalidMonth?: string; /** (days, monthName) => message for invalid day */
482
+ invalidDay?: (days: number, month: string) => string; /** (min) => message when date is before minDate */
483
+ afterMin?: (min: Date) => string; /** (max) => message when date is after maxDate */
484
+ beforeMax?: (max: Date) => string;
485
+ };
486
+ };
464
487
  }
465
488
  declare function updateSettings(updates: ClackSettings): void;
466
489
  /**
@@ -484,14 +507,116 @@ interface ClackEvents<TValue> {
484
507
  finalize: () => void;
485
508
  beforePrompt: () => void;
486
509
  }
510
+ /** The Standard Schema interface. */
511
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
512
+ /** The Standard Schema properties. */
513
+ readonly '~standard': StandardSchemaV1.Props<Input, Output>;
514
+ }
515
+ declare namespace StandardSchemaV1 {
516
+ /** The Standard Schema properties interface. */
517
+ interface Props<Input = unknown, Output = Input> {
518
+ /** The version number of the standard. */
519
+ readonly version: 1;
520
+ /** The vendor name of the schema library. */
521
+ readonly vendor: string;
522
+ /** Validates unknown input values. */
523
+ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
524
+ /** Inferred types associated with the schema. */
525
+ readonly types?: Types<Input, Output> | undefined;
526
+ }
527
+ /** The result interface of the validate function. */
528
+ type Result<Output> = SuccessResult<Output> | FailureResult;
529
+ /** The result interface if validation succeeds. */
530
+ interface SuccessResult<Output> {
531
+ /** The typed output value. */
532
+ readonly value: Output;
533
+ /** A falsy value for `issues` indicates success. */
534
+ readonly issues?: undefined;
535
+ }
536
+ interface Options {
537
+ /** Explicit support for additional vendor-specific parameters, if needed. */
538
+ readonly libraryOptions?: Record<string, unknown> | undefined;
539
+ }
540
+ /** The result interface if validation fails. */
541
+ interface FailureResult {
542
+ /** The issues of failed validation. */
543
+ readonly issues: ReadonlyArray<Issue>;
544
+ }
545
+ /** The issue interface of the failure output. */
546
+ interface Issue {
547
+ /** The error message of the issue. */
548
+ readonly message: string;
549
+ /** The path of the issue, if any. */
550
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
551
+ }
552
+ /** The path segment interface of the issue. */
553
+ interface PathSegment {
554
+ /** The key representing a path segment. */
555
+ readonly key: PropertyKey;
556
+ }
557
+ /** The Standard Schema types interface. */
558
+ interface Types<Input = unknown, Output = Input> {
559
+ /** The input type of the schema. */
560
+ readonly input: Input;
561
+ /** The output type of the schema. */
562
+ readonly output: Output;
563
+ }
564
+ /** Infers the input type of a Standard Schema. */
565
+ type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
566
+ /** Infers the output type of a Standard Schema. */
567
+ type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
568
+ }
569
+ /**
570
+ * A function or [Standard Schema](https://github.com/standard-schema/standard-schema)
571
+ * that validates user input. If a custom function is given, you should return a
572
+ * `string` or `Error` to show as a validation error, or `undefined` to accept the result.
573
+ *
574
+ * @example Using arktype
575
+ * ```ts
576
+ * import { text } from '@clack/prompts';
577
+ * import { type } from 'arktype';
578
+ *
579
+ * const name = await text({
580
+ * message: 'Enter your name (letters only)',
581
+ * validate: type('string.alpha').describe('Name can only contain letters'),
582
+ * });
583
+ * ```
584
+ *
585
+ * @example Custom validator
586
+ * ```ts
587
+ * import { text } from '@clack/prompts';
588
+ *
589
+ * const age = await text({
590
+ * message: 'Enter your age:',
591
+ * validate(value) {
592
+ * if (!value) return 'Please enter a value';
593
+ * const num = parseInt(value);
594
+ * if (isNaN(num)) return 'Please enter a valid number';
595
+ * if (num < 0 || num > 120) return 'Age must be between 0 and 120';
596
+ * return undefined;
597
+ * },
598
+ * });
599
+ * ```
600
+ */
601
+ type Validate<TValue> = ((value: TValue | undefined) => string | Error | undefined) | StandardSchemaV1<TValue | undefined, unknown>;
602
+ /**
603
+ * Runs the `validate()` option and normalizes the result
604
+ * @param validate - The validate option
605
+ * @param value - The user input
606
+ * @returns the validation result
607
+ */
487
608
  interface PromptOptions<TValue, Self extends Prompt<TValue>> {
488
609
  render(this: Omit<Self, 'prompt'>): string | undefined;
489
610
  initialValue?: any;
490
611
  initialUserInput?: string;
491
- validate?: ((value: TValue | undefined) => string | Error | undefined) | undefined;
612
+ /**
613
+ * A function or a [Standard Schema](https://github.com/standard-schema/standard-schema)
614
+ * that validates user input. If a custom function is given, you should return a `string` or `Error`
615
+ * to show as a validation error, or `undefined` to accept the result.
616
+ */
617
+ validate?: Validate<TValue> | undefined;
492
618
  input?: Readable$1;
493
619
  output?: Writable;
494
- debug?: boolean;
495
620
  signal?: AbortSignal;
496
621
  }
497
622
  declare class Prompt<TValue> {
@@ -539,6 +664,7 @@ declare class Prompt<TValue> {
539
664
  emit<T extends keyof ClackEvents<TValue>>(event: T, ...data: Parameters<ClackEvents<TValue>[T]>): void;
540
665
  prompt(): Promise<symbol | TValue | undefined>;
541
666
  protected _isActionKey(char: string | undefined, _key: Key$1): boolean;
667
+ protected _shouldSubmit(_char: string | undefined, _key: Key$1): boolean;
542
668
  protected _setValue(value: TValue | undefined): void;
543
669
  protected _setUserInput(value: string | undefined, write?: boolean): void;
544
670
  protected _clearUserInput(): void;
@@ -557,6 +683,13 @@ interface AutocompleteOptions$1<T extends OptionLike$1> extends PromptOptions<T[
557
683
  options: T[] | ((this: AutocompletePrompt<T>) => T[]);
558
684
  filter?: FilterFunction<T>;
559
685
  multiple?: boolean;
686
+ /**
687
+ * When set (non-empty), pressing Tab with no input fills the field with this value
688
+ * and runs the normal filter/selection logic so the user can confirm with Enter.
689
+ * Tab only fills the input when the placeholder matches at least one option under
690
+ * the prompt's filter (so the value remains selectable).
691
+ */
692
+ placeholder?: string;
560
693
  }
561
694
  declare class AutocompletePrompt<T extends OptionLike$1> extends Prompt<T['value'] | T['value'][]> {
562
695
  #private;
@@ -573,9 +706,10 @@ declare class AutocompletePrompt<T extends OptionLike$1> extends Prompt<T['value
573
706
  deselectAll(): void;
574
707
  toggleSelected(value: T['value']): void;
575
708
  }
709
+ type DateFormat = 'YMD' | 'MDY' | 'DMY';
576
710
  declare function isCancel(value: unknown): value is symbol;
577
711
  declare namespace index_d_exports {
578
- export { AutocompleteMultiSelectOptions, AutocompleteOptions, BoxAlignment, BoxOptions, ClackSettings, CommonOptions, ConfirmOptions, GroupMultiSelectOptions, LimitOptionsParams, LogMessageOptions, MultiSelectOptions, NoteOptions, Option, PasswordOptions, PathOptions, ProgressOptions, ProgressResult, PromptGroup, PromptGroupAwaitedReturn, PromptGroupOptions, S_BAR, S_BAR_END, S_BAR_END_RIGHT, S_BAR_H, S_BAR_START, S_BAR_START_RIGHT, S_CHECKBOX_ACTIVE, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, S_CONNECT_LEFT, S_CORNER_BOTTOM_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_TOP_LEFT, S_CORNER_TOP_RIGHT, S_ERROR, S_INFO, S_PASSWORD_MASK, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_SUCCESS, S_WARN, SelectKeyOptions, SelectOptions, SpinnerOptions, SpinnerResult, Task, TaskLogCompletionOptions, TaskLogMessageOptions, TaskLogOptions, TextOptions, autocomplete, autocompleteMultiselect, box, cancel, confirm, group, groupMultiselect, intro, isCI, isCancel, isTTY, limitOptions, log$1 as log, multiselect, note, outro, password, path, progress, select, selectKey, settings, spinner, stream, symbol, symbolBar, taskLog, tasks, text, unicode, unicodeOr, updateSettings };
712
+ export { AutocompleteMultiSelectOptions, AutocompleteOptions, BoxAlignment, BoxOptions, ClackSettings, CommonOptions, ConfirmOptions, DateFormat, DateOptions, GroupMultiSelectOptions, LimitOptionsParams, LogMessageOptions, MULTISELECT_INSTRUCTIONS, MultiLineOptions, MultiSelectOptions, NoteOptions, Option, PasswordOptions, PathOptions, ProgressOptions, ProgressResult, PromptGroup, PromptGroupAwaitedReturn, PromptGroupOptions, SELECT_INSTRUCTIONS, S_BAR, S_BAR_END, S_BAR_END_RIGHT, S_BAR_H, S_BAR_START, S_BAR_START_RIGHT, S_CHECKBOX_ACTIVE, S_CHECKBOX_INACTIVE, S_CHECKBOX_SELECTED, S_CONNECT_LEFT, S_CORNER_BOTTOM_LEFT, S_CORNER_BOTTOM_RIGHT, S_CORNER_TOP_LEFT, S_CORNER_TOP_RIGHT, S_ERROR, S_INFO, S_PASSWORD_MASK, S_RADIO_ACTIVE, S_RADIO_INACTIVE, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_ERROR, S_STEP_SUBMIT, S_SUCCESS, S_WARN, SelectKeyOptions, SelectOptions, SpinnerOptions, SpinnerResult, Task, TaskLogCompletionOptions, TaskLogMessageOptions, TaskLogOptions, TextOptions, autocomplete, autocompleteMultiselect, box, cancel, confirm, date, formatInstructionFooter, group, groupMultiselect, intro, isCI, isCancel, isTTY, limitOptions, log$1 as log, multiline, multiselect, note, outro, password, path, progress, select, selectKey, settings, spinner, stream, symbol, symbolBar, taskLog, tasks, text, unicode, unicodeOr, updateSettings };
579
713
  }
580
714
  declare const unicode: boolean;
581
715
  declare const isCI: () => boolean;
@@ -614,6 +748,8 @@ interface CommonOptions {
614
748
  signal?: AbortSignal;
615
749
  withGuide?: boolean;
616
750
  }
751
+ declare function formatInstructionFooter(instructions: string[], hasGuide: boolean): string[];
752
+ declare const SELECT_INSTRUCTIONS: string[];
617
753
  type Primitive = Readonly<string | boolean | number>;
618
754
  type Option<Value> = Value extends Primitive ? {
619
755
  /**
@@ -669,117 +805,487 @@ interface SelectOptions<Value> extends CommonOptions {
669
805
  options: Option<Value>[];
670
806
  initialValue?: Value;
671
807
  maxItems?: number;
808
+ /**
809
+ * Show keyboard instructions below the option list.
810
+ * @default true
811
+ */
812
+ showInstructions?: boolean;
672
813
  }
673
814
  declare const select: <Value>(opts: SelectOptions<Value>) => Promise<Value | symbol>;
815
+ /**
816
+ * Options for the {@link autocomplete} prompt.
817
+ */
674
818
  interface AutocompleteSharedOptions<Value> extends CommonOptions {
675
819
  /**
676
- * The message to display to the user.
820
+ * The message or question shown to the user above the input.
677
821
  */
678
822
  message: string;
679
823
  /**
680
- * Available options for the autocomplete prompt.
824
+ * The options to present, or a function that returns the options to present
825
+ * allowing for custom search/filtering.
826
+ *
827
+ * @see https://bomb.sh/docs/clack/packages/prompts/#dynamic-options-getter
681
828
  */
682
829
  options: Option<Value>[] | ((this: AutocompletePrompt<Option<Value>>) => Option<Value>[]);
683
830
  /**
684
- * Maximum number of items to display at once.
831
+ * The maximum number of items/options to display in the autocomplete list at once.
685
832
  */
686
833
  maxItems?: number;
687
834
  /**
688
- * Placeholder text to display when no input is provided.
835
+ * Placeholder text displayed when the search field is empty. When set, pressing
836
+ * tab copies the placeholder into the input.
689
837
  */
690
838
  placeholder?: string;
691
839
  /**
692
- * Validates the value
840
+ * A function or a [Standard Schema](https://github.com/standard-schema/standard-schema)
841
+ * that validates user input. If a custom function is given, you should return a `string` or `Error`
842
+ * to show as a validation error, or `undefined` to accept the result.
693
843
  */
694
- validate?: (value: Value | Value[] | undefined) => string | Error | undefined;
844
+ validate?: Validate<Value | Value[]>;
695
845
  /**
696
- * Custom filter function to match options against search input.
697
- * If not provided, a default filter that matches label, hint, and value is used.
846
+ * Custom filter function to match options against the search input.
698
847
  */
699
848
  filter?: (search: string, option: Option<Value>) => boolean;
700
849
  }
701
850
  interface AutocompleteOptions<Value> extends AutocompleteSharedOptions<Value> {
702
851
  /**
703
- * The initial selected value.
852
+ * The initially selected option from the list.
704
853
  */
705
854
  initialValue?: Value;
706
855
  /**
707
- * The initial user input
856
+ * The starting value shown in the users input box.
708
857
  */
709
858
  initialUserInput?: string;
710
859
  }
860
+ /**
861
+ * The `autocomplete` prompt combines a text input with a searchable list of options.
862
+ * It's perfect for when you have a large list of options and want to help users
863
+ * find what they're looking for quickly.
864
+ *
865
+ * @see https://bomb.sh/docs/clack/packages/prompts/#autocomplete
866
+ *
867
+ * @example
868
+ * ```ts
869
+ * import { autocomplete } from '@clack/prompts';
870
+ *
871
+ * const framework = await autocomplete({
872
+ * message: 'Search for a framework',
873
+ * options: [
874
+ * { value: 'next', label: 'Next.js', hint: 'React framework' },
875
+ * { value: 'astro', label: 'Astro', hint: 'Content-focused' },
876
+ * { value: 'svelte', label: 'SvelteKit', hint: 'Compile-time framework' },
877
+ * { value: 'remix', label: 'Remix', hint: 'Full stack framework' },
878
+ * { value: 'nuxt', label: 'Nuxt', hint: 'Vue framework' },
879
+ * ],
880
+ * placeholder: 'Type to search...',
881
+ * maxItems: 5,
882
+ * });
883
+ * ```
884
+ */
711
885
  declare const autocomplete: <Value>(opts: AutocompleteOptions<Value>) => Promise<Value | symbol>;
886
+ /**
887
+ * Options for the {@link autocompleteMultiselect} prompt
888
+ */
712
889
  interface AutocompleteMultiSelectOptions<Value> extends AutocompleteSharedOptions<Value> {
713
890
  /**
714
- * The initial selected values
891
+ * The initially selected option(s) from the list.
715
892
  */
716
893
  initialValues?: Value[];
717
894
  /**
718
- * If true, at least one option must be selected
895
+ * When `true` at least one option must be selected.
896
+ * @default false
719
897
  */
720
898
  required?: boolean;
721
899
  }
722
900
  /**
723
- * Integrated autocomplete multiselect - combines type-ahead filtering with multiselect in one UI
901
+ * The `autocompleteMultiselect` prompt combines the search functionality of autocomplete
902
+ * with the ability to select multiple options.
903
+ *
904
+ * @see https://bomb.sh/docs/clack/packages/prompts/#autocomplete-multiselect
905
+ *
906
+ * @example
907
+ * ```ts
908
+ * import { autocompleteMultiselect } from '@clack/prompts';
909
+ *
910
+ * const frameworks = await autocompleteMultiselect({
911
+ * message: 'Select frameworks',
912
+ * options: [
913
+ * { value: 'next', label: 'Next.js', hint: 'React framework' },
914
+ * { value: 'astro', label: 'Astro', hint: 'Content-focused' },
915
+ * { value: 'svelte', label: 'SvelteKit', hint: 'Compile-time framework' },
916
+ * { value: 'remix', label: 'Remix', hint: 'Full stack framework' },
917
+ * { value: 'nuxt', label: 'Nuxt', hint: 'Vue framework' },
918
+ * ],
919
+ * placeholder: 'Type to search...',
920
+ * maxItems: 5,
921
+ * });
922
+ * ```
724
923
  */
725
924
  declare const autocompleteMultiselect: <Value>(opts: AutocompleteMultiSelectOptions<Value>) => Promise<Value[] | symbol>;
925
+ /**
926
+ * Alignment for content or titles within the box.
927
+ */
726
928
  type BoxAlignment = 'left' | 'center' | 'right';
929
+ /**
930
+ * Options for the {@link box} prompt.
931
+ */
727
932
  interface BoxOptions extends CommonOptions {
933
+ /**
934
+ * Alignment of the content (`'left'`, `'center'`, or `'right'`).
935
+ * @default 'left'
936
+ */
728
937
  contentAlign?: BoxAlignment;
938
+ /**
939
+ * Alignment of the title (`'left'`, `'center'`, or `'right'`).
940
+ * @default 'left'
941
+ */
729
942
  titleAlign?: BoxAlignment;
943
+ /**
944
+ * The width of the box, either `'auto'` to fit the content or a number for a fixed width.
945
+ * @default 'auto'
946
+ */
730
947
  width?: number | 'auto';
948
+ /**
949
+ * Padding around the title.
950
+ * @default 1
951
+ */
731
952
  titlePadding?: number;
953
+ /**
954
+ * Padding around the content.
955
+ * @default 2
956
+ */
732
957
  contentPadding?: number;
958
+ /**
959
+ * Use rounded corners when `true`, square corners when `false`.
960
+ * @default true
961
+ */
733
962
  rounded?: boolean;
963
+ /**
964
+ * Custom function to style the border characters.
965
+ */
734
966
  formatBorder?: (text: string) => string;
735
967
  }
968
+ /**
969
+ * Renders a customizable box around text content. It's similar to {@link note} but offers
970
+ * more styling options.
971
+ *
972
+ * @see https://bomb.sh/docs/clack/packages/prompts/#box
973
+ *
974
+ * @param message - The content to display inside the box.
975
+ * @param title - The title to display in the top border of the box.
976
+ * @param opts - Optional configuration for the box styling and behavior.
977
+ *
978
+ * @example
979
+ * ```ts
980
+ * import { box } from '@clack/prompts';
981
+ *
982
+ * box('This is the content of the box', 'Box Title', {
983
+ * contentAlign: 'center',
984
+ * titleAlign: 'center',
985
+ * width: 'auto',
986
+ * rounded: true,
987
+ * });
988
+ * ```
989
+ */
736
990
  declare const box: (message?: string, title?: string, opts?: BoxOptions) => void;
991
+ /**
992
+ * Options for the {@link confirm} prompt.
993
+ */
737
994
  interface ConfirmOptions extends CommonOptions {
995
+ /**
996
+ * The message or question shown to the user above the input.
997
+ */
738
998
  message: string;
999
+ /**
1000
+ * The label to use for the active (true) option.
1001
+ * @default 'Yes'
1002
+ */
739
1003
  active?: string;
1004
+ /**
1005
+ * The label to use for the inactive (false) option.
1006
+ * @default 'No'
1007
+ */
740
1008
  inactive?: string;
1009
+ /**
1010
+ * The initial selected value (true or false).
1011
+ * @default true
1012
+ */
741
1013
  initialValue?: boolean;
1014
+ /**
1015
+ * Whether to render the options vertically instead of horizontally.
1016
+ * @default false
1017
+ */
742
1018
  vertical?: boolean;
743
1019
  }
1020
+ /**
1021
+ * The `confirm` prompt accepts a yes or no choice, returning a boolean value
1022
+ * corresponding to the user's selection.
1023
+ *
1024
+ * @see https://bomb.sh/docs/clack/packages/prompts/#confirmation
1025
+ *
1026
+ * @example
1027
+ * ```ts
1028
+ * import { confirm } from '@clack/prompts';
1029
+ *
1030
+ * const shouldProceed = await confirm({
1031
+ * message: 'Do you want to continue?',
1032
+ * });
1033
+ * ```
1034
+ */
744
1035
  declare const confirm: (opts: ConfirmOptions) => Promise<boolean | symbol>;
1036
+ /**
1037
+ * Options for the {@link date} prompt.
1038
+ */
1039
+ interface DateOptions extends CommonOptions {
1040
+ /**
1041
+ * The message or question shown to the user above the input.
1042
+ */
1043
+ message: string;
1044
+ /**
1045
+ * The date format for the input segments.
1046
+ * @deafult based on locale
1047
+ */
1048
+ format?: DateFormat;
1049
+ /**
1050
+ * The BCP 47 language tag to use for formatting
1051
+ * @see https://developer.mozilla.org/en-US/docs/Glossary/BCP_47_language_tag
1052
+ * @example "en-GB"
1053
+ */
1054
+ locale?: string;
1055
+ /**
1056
+ * The default value returned when the user doesn't select a date.
1057
+ */
1058
+ defaultValue?: Date;
1059
+ /**
1060
+ * The starting date shown when the prompt first renders.
1061
+ * Users can edit this value before submitting.
1062
+ */
1063
+ initialValue?: Date;
1064
+ /**
1065
+ * The minimum allowed date for validation.
1066
+ */
1067
+ minDate?: Date;
1068
+ /**
1069
+ * The maximum allowed date for validation.
1070
+ */
1071
+ maxDate?: Date;
1072
+ /**
1073
+ * A function or a [Standard Schema](https://github.com/standard-schema/standard-schema)
1074
+ * that validates user input. If a custom function is given, you should return a `string` or `Error`
1075
+ * to show as a validation error, or `undefined` to accept the result.
1076
+ */
1077
+ validate?: Validate<Date>;
1078
+ }
1079
+ /**
1080
+ * The `date` prompt provides an interactive date picker, allowing users
1081
+ * to navigate between year, month, and day segments and
1082
+ * increment/decrement values using keyboard controls.
1083
+ *
1084
+ * @see https://bomb.sh/docs/clack/packages/prompts/#date-input
1085
+ *
1086
+ * @example
1087
+ * ```ts
1088
+ * import { date } from '@clack/prompts';
1089
+ *
1090
+ * const birthday = await date({
1091
+ * message: 'Pick your birthday',
1092
+ * minDate: new Date('1900-01-01'),
1093
+ * initialValue: new Date(),
1094
+ * maxDate: new Date(),
1095
+ * });
1096
+ * ```
1097
+ */
1098
+ declare const date: (opts: DateOptions) => Promise<Date | symbol>;
745
1099
  type Prettify<T> = { [P in keyof T]: T[P] } & {};
1100
+ /**
1101
+ * The return type of a {@link PromptGroup}.
1102
+ * Resolves all prompt results, excluding the cancel symbol.
1103
+ */
746
1104
  type PromptGroupAwaitedReturn<T> = { [P in keyof T]: Exclude<Awaited<T[P]>, symbol> };
1105
+ /**
1106
+ * Options for the {@link group} utility.
1107
+ */
747
1108
  interface PromptGroupOptions<T> {
748
1109
  /**
749
- * Control how the group can be canceled
750
- * if one of the prompts is canceled.
1110
+ * Called when any one of the prompts is canceled.
751
1111
  */
752
1112
  onCancel?: (opts: {
753
1113
  results: Prettify<Partial<PromptGroupAwaitedReturn<T>>>;
754
1114
  }) => void;
755
1115
  }
1116
+ /**
1117
+ * A group of prompts to be displayed sequentially, with each prompt receiving
1118
+ * the results of all previous prompts in the group.
1119
+ */
756
1120
  type PromptGroup<T> = { [P in keyof T]: (opts: {
757
1121
  results: Prettify<Partial<PromptGroupAwaitedReturn<Omit<T, P>>>>;
758
1122
  }) => undefined | Promise<T[P] | undefined> };
759
1123
  /**
760
- * Define a group of prompts to be displayed
761
- * and return a results of objects within the group
1124
+ * The `group` utility provides a consistent way to combine a series of prompts,
1125
+ * combining each answer into one object. Each prompt receives the results of
1126
+ * all previously completed prompts, and are displayed sequentially.
1127
+ *
1128
+ * @see https://bomb.sh/docs/clack/packages/prompts/#group
1129
+ *
1130
+ * @example
1131
+ * ```ts
1132
+ * import { group, text, password } from '@clack/prompts';
1133
+ *
1134
+ * const account = await group({
1135
+ * email: () => text({
1136
+ * message: 'What is your email address?',
1137
+ * }),
1138
+ * username: ({ results }) => text({
1139
+ * message: 'What is your username?',
1140
+ * placeholder: results.email?.replace(/@.+$/, '').toLowerCase() ?? '',
1141
+ * }),
1142
+ * password: () => password({
1143
+ * message: 'Define your password',
1144
+ * }),
1145
+ * });
1146
+ * ```
762
1147
  */
763
1148
  declare const group: <T>(prompts: PromptGroup<T>, opts?: PromptGroupOptions<T>) => Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
1149
+ /**
1150
+ * Options for the {@link groupMultiselect} prompt.
1151
+ */
764
1152
  interface GroupMultiSelectOptions<Value> extends CommonOptions {
1153
+ /**
1154
+ * The message or question shown to the user above the input.
1155
+ */
765
1156
  message: string;
1157
+ /**
1158
+ * Grouped options to display. Each key is a group label, and each value is an array of options.
1159
+ */
766
1160
  options: Record<string, Option<Value>[]>;
1161
+ /**
1162
+ * The initially selected option(s).
1163
+ */
767
1164
  initialValues?: Value[];
1165
+ /**
1166
+ * The maximum number of items/options to display at once.
1167
+ */
1168
+ maxItems?: number;
1169
+ /**
1170
+ * When `true` at least one option must be selected.
1171
+ * @default true
1172
+ */
768
1173
  required?: boolean;
1174
+ /**
1175
+ * The value the cursor should be positioned at initially.
1176
+ */
769
1177
  cursorAt?: Value;
1178
+ /**
1179
+ * Whether entire groups can be selected at once.
1180
+ * @default true
1181
+ */
770
1182
  selectableGroups?: boolean;
1183
+ /**
1184
+ * Number of blank lines between groups.
1185
+ * @default 0
1186
+ */
771
1187
  groupSpacing?: number;
1188
+ /**
1189
+ * Show keyboard instructions below the option list.
1190
+ * @default true
1191
+ */
1192
+ showInstructions?: boolean;
772
1193
  }
1194
+ /**
1195
+ * The `groupMultiselect` prompt extends the {@link multiselect} prompt to allow
1196
+ * arranging distinct Multi-Selects, whilst keeping all of them interactive.
1197
+ *
1198
+ * @see https://bomb.sh/docs/clack/packages/prompts/#group-multiselect
1199
+ *
1200
+ * @example
1201
+ * ```ts
1202
+ * import { groupMultiselect } from '@clack/prompts';
1203
+ *
1204
+ * const result = await groupMultiselect({
1205
+ * message: 'Define your project',
1206
+ * options: {
1207
+ * 'Testing': [
1208
+ * { value: 'Jest', hint: 'JavaScript testing framework' },
1209
+ * { value: 'Playwright', hint: 'End-to-end testing' },
1210
+ * ],
1211
+ * 'Language': [
1212
+ * { value: 'js', label: 'JavaScript', hint: 'Dynamic typing' },
1213
+ * { value: 'ts', label: 'TypeScript', hint: 'Static typing' },
1214
+ * ],
1215
+ * },
1216
+ * });
1217
+ * ```
1218
+ *
1219
+ * @param opts The options for the group multiselect prompt
1220
+ */
773
1221
  declare const groupMultiselect: <Value>(opts: GroupMultiSelectOptions<Value>) => Promise<Value[] | symbol>;
1222
+ /**
1223
+ * Options for the {@link limitOptions} function.
1224
+ */
774
1225
  interface LimitOptionsParams<TOption> extends CommonOptions {
1226
+ /**
1227
+ * The list of options to display.
1228
+ */
775
1229
  options: TOption[];
776
- maxItems: number | undefined;
1230
+ /**
1231
+ * The index of the currently active/selected option.
1232
+ */
777
1233
  cursor: number;
1234
+ /**
1235
+ * A function that styles the given option string.
1236
+ *
1237
+ * @param option - The option string to style.
1238
+ * @param active - Whether the option is currently selected.
1239
+ */
778
1240
  style: (option: TOption, active: boolean) => string;
1241
+ /**
1242
+ * Maximum number of options to display at once.
1243
+ * @default Infinity
1244
+ */
1245
+ maxItems?: number;
1246
+ /**
1247
+ * Number of columns to reserve for padding.
1248
+ * @default 0
1249
+ */
779
1250
  columnPadding?: number;
1251
+ /**
1252
+ * Number of rows to reserve for padding.
1253
+ * @default 4
1254
+ */
780
1255
  rowPadding?: number;
781
1256
  }
782
- declare const limitOptions: <TOption>(params: LimitOptionsParams<TOption>) => string[];
1257
+ /**
1258
+ * Trims an option list to what fits the terminal, while keeping the active
1259
+ * option (cursor) visible using a Clack style sliding window.
1260
+ *
1261
+ * @returns The lines to render.
1262
+ *
1263
+ * @see https://bomb.sh/docs/clack/packages/prompts/#limitoptions
1264
+ *
1265
+ * @example
1266
+ * ```ts
1267
+ * import { limitOptions } from '@clack/prompts';
1268
+ * import { styleText } from 'node:util';
1269
+ *
1270
+ * const options = ['apple', 'banana', 'cherry', 'date'];
1271
+ * const lines = limitOptions({
1272
+ * options,
1273
+ * cursor: 2,
1274
+ * maxItems: 8,
1275
+ * style: (opt, active) =>
1276
+ * active ? styleText('cyan', opt) : styleText('dim', opt),
1277
+ * });
1278
+ * ```
1279
+ */
1280
+ declare const limitOptions: <TOption>({
1281
+ cursor,
1282
+ options,
1283
+ style,
1284
+ output,
1285
+ maxItems,
1286
+ columnPadding,
1287
+ rowPadding
1288
+ }: LimitOptionsParams<TOption>) => string[];
783
1289
  interface LogMessageOptions extends CommonOptions {
784
1290
  symbol?: string;
785
1291
  spacing?: number;
@@ -800,9 +1306,136 @@ declare const log$1: {
800
1306
  warning: (message: string, opts?: LogMessageOptions) => void;
801
1307
  error: (message: string, opts?: LogMessageOptions) => void;
802
1308
  };
1309
+ /**
1310
+ * The `cancel` function defines an interruption of an interaction
1311
+ * and therefore its end.
1312
+ *
1313
+ * @param title Optional closing message to be displayed.
1314
+ * @param opts Additional configuration options.
1315
+ *
1316
+ * @see https://bomb.sh/docs/clack/packages/prompts/#cancel
1317
+ *
1318
+ * @example
1319
+ * ```ts
1320
+ * import { cancel } from '@clack/prompts';
1321
+ * import process from 'node:process';
1322
+ *
1323
+ * cancel('Installation canceled');
1324
+ * process.exit(1);
1325
+ * ```
1326
+ */
803
1327
  declare const cancel: (message?: string, opts?: CommonOptions) => void;
1328
+ /**
1329
+ * The `intro` function defines the beginning of an interaction.
1330
+ *
1331
+ * @param title Optional title to be displayed.
1332
+ * @param opts Additional configuration options.
1333
+ *
1334
+ * @see https://bomb.sh/docs/clack/packages/prompts/#intro
1335
+ *
1336
+ * @example
1337
+ * ```ts
1338
+ * import { intro } from '@clack/prompts';
1339
+ *
1340
+ * intro('Welcome to clack');
1341
+ * ```
1342
+ */
804
1343
  declare const intro: (title?: string, opts?: CommonOptions) => void;
1344
+ /**
1345
+ * The `outro` function defines the end of an interaction.
1346
+ *
1347
+ * @param title Optional closing message to be displayed.
1348
+ * @param opts Additional configuration options.
1349
+ *
1350
+ * @see https://bomb.sh/docs/clack/packages/prompts/#outro
1351
+ *
1352
+ * @example
1353
+ * ```ts
1354
+ * import { outro } from '@clack/prompts';
1355
+ *
1356
+ * outro('All operations are finished');
1357
+ * ```
1358
+ */
805
1359
  declare const outro: (message?: string, opts?: CommonOptions) => void;
1360
+ /**
1361
+ * Options for the {@link text} prompt
1362
+ */
1363
+ interface TextOptions extends CommonOptions {
1364
+ /**
1365
+ * The prompt message or question shown to the user above the input.
1366
+ */
1367
+ message: string;
1368
+ /**
1369
+ * A visual hint shown when the field has no content.
1370
+ */
1371
+ placeholder?: string;
1372
+ /**
1373
+ * A fallback value returned when the user provides nothing (empty input).
1374
+ */
1375
+ defaultValue?: string;
1376
+ /**
1377
+ * The starting value shown when the prompt first renders.
1378
+ * Users can edit this value before submitting.
1379
+ */
1380
+ initialValue?: string;
1381
+ /**
1382
+ * A function or a [Standard Schema](https://github.com/standard-schema/standard-schema)
1383
+ * that validates user input. If a custom function is given, you should return a `string` or `Error`
1384
+ * to show as a validation error, or `undefined` to accept the result.
1385
+ */
1386
+ validate?: Validate<string>;
1387
+ }
1388
+ /**
1389
+ * The text prompt accepts a single line of text.
1390
+ *
1391
+ * @see https://bomb.sh/docs/clack/packages/prompts/#text-input
1392
+ *
1393
+ * @example
1394
+ * ```ts
1395
+ * import { text } from '@clack/prompts';
1396
+ *
1397
+ * const name = await text({
1398
+ * message: 'What is your name?',
1399
+ * placeholder: 'John Doe',
1400
+ * validate: (value) => {
1401
+ * if (!value || value.length < 2) return 'Name must be at least 2 characters';
1402
+ * return undefined;
1403
+ * },
1404
+ * });
1405
+ * ```
1406
+ */
1407
+ declare const text: (opts: TextOptions) => Promise<string | symbol>;
1408
+ /**
1409
+ * Options for the {@link multiline} prompt
1410
+ */
1411
+ interface MultiLineOptions extends TextOptions {
1412
+ /**
1413
+ * When enabled it shows a `[ submit ]` button that can be focused with tab.
1414
+ * By default, pressing `Enter` twice submits the input
1415
+ *
1416
+ * @default false
1417
+ */
1418
+ showSubmit?: boolean;
1419
+ }
1420
+ /**
1421
+ * The multi-line prompt accepts multiple lines of text input.
1422
+ * By default, pressing `Enter` twice submits the input.
1423
+ *
1424
+ * @see https://bomb.sh/docs/clack/packages/prompts/#multi-line-text
1425
+ *
1426
+ * @example
1427
+ * ```ts
1428
+ * import { multiline } from '@clack/prompts';
1429
+ *
1430
+ * const bio = await multiline({
1431
+ * message: 'Enter your bio',
1432
+ * placeholder: 'Tell us about yourself...',
1433
+ * showSubmit: true,
1434
+ * });
1435
+ * ```
1436
+ */
1437
+ declare const multiline: (opts: MultiLineOptions) => Promise<string | symbol>;
1438
+ declare const MULTISELECT_INSTRUCTIONS: string[];
806
1439
  interface MultiSelectOptions<Value> extends CommonOptions {
807
1440
  message: string;
808
1441
  options: Option<Value>[];
@@ -810,6 +1443,11 @@ interface MultiSelectOptions<Value> extends CommonOptions {
810
1443
  maxItems?: number;
811
1444
  required?: boolean;
812
1445
  cursorAt?: Value;
1446
+ /**
1447
+ * Show keyboard instructions below the option list.
1448
+ * @default true
1449
+ */
1450
+ showInstructions?: boolean;
813
1451
  }
814
1452
  declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<Value[] | symbol>;
815
1453
  type FormatFn = (line: string) => string;
@@ -817,20 +1455,94 @@ interface NoteOptions extends CommonOptions {
817
1455
  format?: FormatFn;
818
1456
  }
819
1457
  declare const note: (message?: string, title?: string, opts?: NoteOptions) => void;
1458
+ /**
1459
+ * Options for the {@link password} prompt
1460
+ */
820
1461
  interface PasswordOptions extends CommonOptions {
1462
+ /**
1463
+ * The prompt message or question shown to the user above the input.
1464
+ */
821
1465
  message: string;
1466
+ /**
1467
+ * Character to use for masking input.
1468
+ * @default ▪/•
1469
+ */
822
1470
  mask?: string;
823
- validate?: (value: string | undefined) => string | Error | undefined;
1471
+ /**
1472
+ * A function or a [Standard Schema](https://github.com/standard-schema/standard-schema)
1473
+ * that validates user input. If a custom function is given, you should return a `string` or `Error`
1474
+ * to show as a validation error, or `undefined` to accept the result.
1475
+ */
1476
+ validate?: Validate<string>;
1477
+ /**
1478
+ * When enabled it causes the input to be cleared if/when validation fails.
1479
+ * @default false
1480
+ */
824
1481
  clearOnError?: boolean;
825
1482
  }
1483
+ /**
1484
+ * The password prompt behaves like the {@link text} prompt, but the input is masked.
1485
+ *
1486
+ * @see https://bomb.sh/docs/clack/packages/prompts/#password-input
1487
+ *
1488
+ * @example
1489
+ * ```ts
1490
+ * import { password } from '@clack/prompts';
1491
+ *
1492
+ * const result = await password({
1493
+ * message: 'Enter your password',
1494
+ * });
1495
+ * ```
1496
+ */
826
1497
  declare const password: (opts: PasswordOptions) => Promise<string | symbol>;
1498
+ /**
1499
+ * Options for the {@link path} prompt.
1500
+ */
827
1501
  interface PathOptions extends CommonOptions {
1502
+ /**
1503
+ * The message or question shown to the user above the input.
1504
+ */
1505
+ message: string;
1506
+ /**
1507
+ * The starting directory for path suggestions (defaults to current working directory).
1508
+ */
828
1509
  root?: string;
1510
+ /**
1511
+ * When `true` only **directories** appear in suggestions while you navigate.
1512
+ */
829
1513
  directory?: boolean;
1514
+ /**
1515
+ * The starting path shown when the prompt first renders, which users can edit
1516
+ * before submitting. If not provided it will fall back to the given `root`,
1517
+ * or the current working directory.
1518
+ *
1519
+ * In `directory` mode, if the initial value points to a directory that exists,
1520
+ * pressing enter will submit the input instead of jumping to the first child.
1521
+ */
830
1522
  initialValue?: string;
831
- message: string;
832
- validate?: (value: string | undefined) => string | Error | undefined;
1523
+ /**
1524
+ * A function or a [Standard Schema](https://github.com/standard-schema/standard-schema)
1525
+ * that validates user input. If a custom function is given, you should return a `string` or `Error`
1526
+ * to show as a validation error, or `undefined` to accept the result.
1527
+ */
1528
+ validate?: Validate<string>;
833
1529
  }
1530
+ /**
1531
+ * The `path` prompt extends `autocomplete` to provide file and directory suggestions.
1532
+ *
1533
+ * @see https://bomb.sh/docs/clack/packages/prompts/#path-selection
1534
+ *
1535
+ * @example
1536
+ * ```ts
1537
+ * import { path } from '@clack/prompts';
1538
+ *
1539
+ * const result = await path({
1540
+ * message: 'Select a file:',
1541
+ * root: process.cwd(),
1542
+ * directory: false,
1543
+ * });
1544
+ * ```
1545
+ */
834
1546
  declare const path: (opts: PathOptions) => Promise<string | symbol>;
835
1547
  interface SpinnerOptions extends CommonOptions {
836
1548
  indicator?: 'dots' | 'timer';
@@ -936,18 +1648,11 @@ declare const taskLog: (opts: TaskLogOptions) => {
936
1648
  error(message: string, opts?: TaskLogCompletionOptions): void;
937
1649
  success(message: string, opts?: TaskLogCompletionOptions): void;
938
1650
  };
939
- interface TextOptions extends CommonOptions {
940
- message: string;
941
- placeholder?: string;
942
- defaultValue?: string;
943
- initialValue?: string;
944
- validate?: (value: string | undefined) => string | Error | undefined;
945
- }
946
- declare const text: (opts: TextOptions) => Promise<string | symbol>;
947
1651
  //#endregion
948
1652
  //#region src/prompts.d.ts
949
- type PromptProgress = ReturnType<typeof progress>;
950
- type PromptSpinner = ReturnType<typeof spinner>;
1653
+ declare const p: typeof index_d_exports;
1654
+ type PromptProgress = ReturnType<typeof p.progress>;
1655
+ type PromptSpinner = ReturnType<typeof p.spinner>;
951
1656
  //#endregion
952
1657
  //#region src/readPackageUp.d.ts
953
1658
  interface ReadPackageUpResult<T = unknown> {
@@ -982,4 +1687,4 @@ type TransformTemplateArgs<T extends string> = { [Key in ExtractPlaceholders<T>]
982
1687
  */
983
1688
  declare function transformTemplate<T extends string>(templateString: T, values: TransformTemplateArgs<T>): string;
984
1689
  //#endregion
985
- export { BuildLogger, BuildLoggerConfig, BuildType, ConfigBuilder, ConfigBuilderScaffold, ConfigResponse, CreateHotUpdaterConfigScaffoldFromBuilderOptions, CreateHotUpdaterConfigScaffoldOptions, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdateDirUtil, HotUpdaterConfigOptions, HotUpdaterConfigScaffold, HotUpdaterLogWriter, IConfigBuilder, ImportInfo, LEGACY_BUNDLE_ERROR, ManagedHelperStatement, ManagedHelperStrategy, PromoteBundleDependencies, PromoteBundleInput, PromptProgress, PromptSpinner, ProviderConfig, ReactNativeMetadata, ReadPackageUpResult, WriteHotUpdaterConfigResult, banner, typedColors as colors, copyDirToTmp, createCopiedBundleArchive, createHotUpdaterConfigScaffold, createHotUpdaterConfigScaffoldFromBuilder, createLogWriter, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, encryptJson, ensureInstallPackages, getAndroidSdkPath, getCwd, getPackageManager, getReactNativeMetadatas, link, loadConfig, log, makeEnv, index_d_exports as p, printBanner, promoteBundle, readPackageUp, renderImportStatements, resolveHotUpdaterServerVersion, resolvePackageVersion, stripAnsi, transformEnv, transformTemplate, writeHotUpdaterConfig };
1690
+ export { BuildLogger, BuildLoggerConfig, BuildType, ConfigBuilder, ConfigBuilderScaffold, ConfigResponse, CreateHotUpdaterConfigScaffoldFromBuilderOptions, CreateHotUpdaterConfigScaffoldOptions, HOT_UPDATER_SERVER_PACKAGE_VERSION_ENV, HotUpdateDirUtil, HotUpdaterConfigOptions, HotUpdaterConfigScaffold, HotUpdaterLogWriter, IConfigBuilder, ImportInfo, LEGACY_BUNDLE_ERROR, ManagedHelperStatement, ManagedHelperStrategy, PromoteBundleDependencies, PromoteBundleInput, PromptProgress, PromptSpinner, ProviderConfig, ReactNativeMetadata, ReadPackageUpResult, WriteHotUpdaterConfigResult, banner, typedColors as colors, copyDirToTmp, createCopiedBundleArchive, createHotUpdaterConfigScaffold, createHotUpdaterConfigScaffoldFromBuilder, createLogWriter, createTarBr, createTarBrTargetFiles, createTarGz, createTarGzTargetFiles, createZip, createZipTargetFiles, decryptJson, encryptJson, ensureInstallPackages, getAndroidSdkPath, getCwd, getPackageManager, getReactNativeMetadatas, link, loadConfig, log, makeEnv, p, printBanner, promoteBundle, readPackageUp, renderImportStatements, resolveHotUpdaterServerVersion, resolvePackageVersion, stripAnsi, transformEnv, transformTemplate, writeHotUpdaterConfig };