@thebros/create-benjamin 1.0.7 → 1.0.9

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 (2) hide show
  1. package/bin/index.js +15 -15
  2. package/package.json +1 -1
package/bin/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+
2
3
  import "dotenv/config";
3
4
  import fs from "fs-extra";
4
5
  import path from "path";
@@ -7,25 +8,24 @@ import inquirer from "inquirer";
7
8
  import ora from "ora";
8
9
  import OpenAI from "openai";
9
10
 
11
+ let apiKey = process.env.OPENAI_API_KEY;
10
12
 
13
+ if (!apiKey) {
14
+ const answer = await inquirer.prompt([
15
+ {
16
+ type: "password",
17
+ name: "key",
18
+ message: "Enter OpenAI API Key (or press enter to skip):",
19
+ },
20
+ ]);
11
21
 
22
+ apiKey = answer.key;
12
23
 
13
- const apiKey = process.env.OPENAI_API_KEY;
14
-
15
- let openai = null;
16
-
17
- if (apiKey) {
18
- openai = new OpenAI({ apiKey });
19
- } else {
20
- console.error(chalk.red("Error: OPENAI_API_KEY is not set in .env file"));
21
- process.exit(1);
24
+ if (!apiKey) {
25
+ console.log("⚠️ Running in template mode (no AI)");
26
+ process.exit(0);
27
+ }
22
28
  }
23
-
24
-
25
- const openai = new OpenAI({
26
- apiKey: process.env.OPENAI_API_KEY,
27
- });
28
-
29
29
  async function main() {
30
30
  console.log(chalk.cyan("\n🤖 Create Benjamin AI Project Generator\n"));
31
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thebros/create-benjamin",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-benjamin": "./bin/index.js"