create-rstack 1.7.20 → 1.8.0

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/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { Readable } from 'node:stream';
2
+ import { Writable } from 'node:stream';
3
+
1
4
  export declare type Argv = {
2
5
  help?: boolean;
3
6
  dir?: string;
@@ -17,6 +20,13 @@ export declare function checkCancel<T>(value: unknown): T;
17
20
  */
18
21
  export declare function collectAgentsFiles(agentsMdSearchDirs: string[]): string[];
19
22
 
23
+ declare interface CommonOptions {
24
+ input?: Readable;
25
+ output?: Writable;
26
+ signal?: AbortSignal;
27
+ withGuide?: boolean;
28
+ }
29
+
20
30
  /**
21
31
  * Copy files from one folder to another.
22
32
  * @param from Source folder
@@ -89,6 +99,12 @@ declare type ExtraTool = {
89
99
  * If undefined, the tool will be displayed after built-in tools.
90
100
  */
91
101
  order?: 'pre' | 'post';
102
+ /**
103
+ * Condition to determine whether this tool should be displayed.
104
+ * If returns false, the tool will not be shown in the selection.
105
+ * @default () => true
106
+ */
107
+ when?: (templateName: string) => boolean;
92
108
  };
93
109
 
94
110
  /**
@@ -103,9 +119,9 @@ export declare function mergeAgentsFiles(agentsFiles: string[]): string;
103
119
  */
104
120
  export declare function mergePackageJson(targetPackage: string, extraPackage: string): void;
105
121
 
106
- export declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<symbol | Value[]>;
122
+ export declare const multiselect: <Value>(opts: MultiSelectOptions<Value>) => Promise<Value[] | symbol>;
107
123
 
108
- declare interface MultiSelectOptions<Value> {
124
+ declare interface MultiSelectOptions<Value> extends CommonOptions {
109
125
  message: string;
110
126
  options: Option_2<Value>[];
111
127
  initialValues?: Value[];
@@ -132,6 +148,13 @@ declare type Option_2<Value> = Value extends Primitive ? {
132
148
  * By default, no `hint` is displayed.
133
149
  */
134
150
  hint?: string;
151
+ /**
152
+ * Whether this option is disabled.
153
+ * Disabled options are visible but cannot be selected.
154
+ *
155
+ * By default, options are not disabled.
156
+ */
157
+ disabled?: boolean;
135
158
  } : {
136
159
  /**
137
160
  * Internal data for this option.
@@ -148,13 +171,20 @@ declare type Option_2<Value> = Value extends Primitive ? {
148
171
  * By default, no `hint` is displayed.
149
172
  */
150
173
  hint?: string;
174
+ /**
175
+ * Whether this option is disabled.
176
+ * Disabled options are visible but cannot be selected.
177
+ *
178
+ * By default, options are not disabled.
179
+ */
180
+ disabled?: boolean;
151
181
  };
152
182
 
153
183
  declare type Primitive = Readonly<string | boolean | number>;
154
184
 
155
- export declare const select: <Value>(opts: SelectOptions<Value>) => Promise<symbol | Value>;
185
+ export declare const select: <Value>(opts: SelectOptions<Value>) => Promise<Value | symbol>;
156
186
 
157
- declare interface SelectOptions<Value> {
187
+ declare interface SelectOptions<Value> extends CommonOptions {
158
188
  message: string;
159
189
  options: Option_2<Value>[];
160
190
  initialValue?: Value;
@@ -163,12 +193,12 @@ declare interface SelectOptions<Value> {
163
193
 
164
194
  export declare const text: (opts: TextOptions) => Promise<string | symbol>;
165
195
 
166
- declare interface TextOptions {
196
+ declare interface TextOptions extends CommonOptions {
167
197
  message: string;
168
198
  placeholder?: string;
169
199
  defaultValue?: string;
170
200
  initialValue?: string;
171
- validate?: (value: string) => string | Error | undefined;
201
+ validate?: (value: string | undefined) => string | Error | undefined;
172
202
  }
173
203
 
174
204
  export { }