1
- import { cancel , intro , isCancel , outro , select , text } from "@clack/prompts" ;
1
+ import {
2
+ cancel ,
3
+ intro ,
4
+ isCancel ,
5
+ outro ,
6
+ password ,
7
+ select ,
8
+ text ,
9
+ } from "@clack/prompts" ;
2
10
import fs from "fs/promises" ;
3
11
import { pastel } from "gradient-string" ;
4
12
import path from "path" ;
@@ -16,16 +24,43 @@ const banner = [
16
24
17
25
console . log ( pastel ( banner . join ( "\n" ) ) ) ;
18
26
19
- const { green, red } = picocolors ;
27
+ const { green, red, gray } = picocolors ;
20
28
21
29
const __dirname = path . dirname ( new URL ( import . meta. url ) . pathname ) ;
22
30
const TEMPLATES_DIR = path . resolve ( __dirname , ".." , "templates" ) ;
23
31
32
+ const ADJECTIVES = [
33
+ "adorable" ,
34
+ "beautiful" ,
35
+ "bright" ,
36
+ "calm" ,
37
+ "delightful" ,
38
+ "enchanting" ,
39
+ "friendly" ,
40
+ "gorgeous" ,
41
+ "glorious" ,
42
+ "lovely" ,
43
+ "perfect" ,
44
+ "precious" ,
45
+ "shiny" ,
46
+ "sparkling" ,
47
+ "super" ,
48
+ "wicked" ,
49
+ ] ;
50
+
51
+ const generateAdjective = ( ) => {
52
+ const n : string = ADJECTIVES [
53
+ Math . floor ( Math . random ( ) * ADJECTIVES . length )
54
+ ] as string ;
55
+ return n ;
56
+ } ;
57
+
24
58
async function main ( ) {
25
59
intro ( "Build autonomous AI agents for the Zero-Employee Enterprise (ZEE)." ) ;
26
60
27
61
const projectName = await text ( {
28
- message : "What is the name of your project?" ,
62
+ message : `What is the name of your project? ${ gray ( "[required]" ) } ` ,
63
+ initialValue : `my-${ generateAdjective ( ) } -zee` ,
29
64
validate : ( value ) => {
30
65
if ( value . length === 0 ) return "Project name is required" ;
31
66
if ( ! / ^ [ a - z 0 - 9 - ] + $ / . test ( value ) )
@@ -39,13 +74,8 @@ async function main() {
39
74
process . exit ( 0 ) ;
40
75
}
41
76
42
- const openaiApiKey = await text ( {
43
- message :
44
- "Please input your OpenAI API key (will be stored in .env file)" ,
45
- validate : ( value ) => {
46
- if ( value . length === 0 ) return "OpenAI API key is required" ;
47
- return ;
48
- } ,
77
+ const openaiApiKey = await password ( {
78
+ message : `Please input your OpenAI API key (will be stored in .env file) ${ gray ( "[optional]" ) } ` ,
49
79
} ) ;
50
80
51
81
if ( isCancel ( openaiApiKey ) ) {
0 commit comments