Skip to content

Commit dc35bba

Browse files
karanpargalgane5h
andauthored
feat: API Key Mask | Update 001 Template (#70)
* feat: API Key Mask | Update 001 Temp * fix: Mask API Key * add default name --------- Co-authored-by: Ganesh Swami <[email protected]>
1 parent 1374815 commit dc35bba

File tree

3 files changed

+690
-30
lines changed

3 files changed

+690
-30
lines changed

packages/create-zee-app/src/index.ts

+40-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
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";
210
import fs from "fs/promises";
311
import { pastel } from "gradient-string";
412
import path from "path";
@@ -16,16 +24,43 @@ const banner = [
1624

1725
console.log(pastel(banner.join("\n")));
1826

19-
const { green, red } = picocolors;
27+
const { green, red, gray } = picocolors;
2028

2129
const __dirname = path.dirname(new URL(import.meta.url).pathname);
2230
const TEMPLATES_DIR = path.resolve(__dirname, "..", "templates");
2331

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+
2458
async function main() {
2559
intro("Build autonomous AI agents for the Zero-Employee Enterprise (ZEE).");
2660

2761
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`,
2964
validate: (value) => {
3065
if (value.length === 0) return "Project name is required";
3166
if (!/^[a-z0-9-]+$/.test(value))
@@ -39,13 +74,8 @@ async function main() {
3974
process.exit(0);
4075
}
4176

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]")}`,
4979
});
5080

5181
if (isCancel(openaiApiKey)) {

0 commit comments

Comments
 (0)