shivam-cli-generator 1.0.1 → 1.0.3

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/ai.js +12 -6
  2. package/package.json +1 -1
  3. package/.env +0 -5
package/ai.js CHANGED
@@ -1,11 +1,17 @@
1
1
  import Groq from "groq-sdk";
2
2
  import fs from "fs";
3
3
  import readline from "readline-sync";
4
- import dotenv from "dotenv";
5
4
 
6
- dotenv.config();
5
+ // ✅ Get API Key from system environment only
6
+ const apiKey = process.env.GROQ_API_KEY;
7
7
 
8
- const client = new Groq({ apiKey: process.env.GROQ_API_KEY });
8
+ if (!apiKey) {
9
+ console.error("❌ GROQ_API_KEY is missing.\n👉 Set it using:\n\nsetx GROQ_API_KEY \"your_groq_api_key_here\"\n");
10
+ process.exit(1);
11
+ }
12
+
13
+ // ✅ Correct Groq client initialization
14
+ const client = new Groq({ apiKey });
9
15
 
10
16
  const inputURL = process.argv[2] || readline.question("Enter URL: ");
11
17
 
@@ -21,14 +27,14 @@ async function main() {
21
27
  console.log("⏳ Generating...");
22
28
 
23
29
  const response = await client.chat.completions.create({
24
- model: "llama-3.1-8b-instant", // ✅ NEW WORKING MODEL
30
+ model: "llama-3.1-8b-instant",
25
31
  messages: [
26
- { role: "system", content: "You generate clean code. No extra text." },
32
+ { role: "system", content: "You generate clean code. Only code or required output." },
27
33
  { role: "user", content: question }
28
34
  ]
29
35
  });
30
36
 
31
- const output = response.choices[0].message.content;
37
+ const output = response.choices[0].message.content.trim();
32
38
 
33
39
  if (!fs.existsSync("generated")) fs.mkdirSync("generated");
34
40
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shivam-cli-generator",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "ai.js",
6
6
  "type": "module",
package/.env DELETED
@@ -1,5 +0,0 @@
1
- GROQ_API_KEY=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
2
-
3
-
4
-
5
- # token=npm set //registry.npmjs.org/:_authToken=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