shivam-cli-generator 1.0.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.
Files changed (4) hide show
  1. package/.env +5 -0
  2. package/ai.js +42 -0
  3. package/cli.js +3 -0
  4. package/package.json +24 -0
package/.env ADDED
@@ -0,0 +1,5 @@
1
+ GROQ_API_KEY=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
2
+
3
+
4
+
5
+ # token=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
package/ai.js ADDED
@@ -0,0 +1,42 @@
1
+ import Groq from "groq-sdk";
2
+ import fs from "fs";
3
+ import readline from "readline-sync";
4
+ import dotenv from "dotenv";
5
+
6
+ dotenv.config();
7
+
8
+ const client = new Groq({ apiKey: process.env.GROQ_API_KEY });
9
+
10
+ const inputURL = process.argv[2] || readline.question("Enter URL: ");
11
+
12
+ console.log("\nšŸ”— URL received:", inputURL);
13
+ console.log("šŸ’” Ask anything to AI. Type 'exit' to quit.\n");
14
+
15
+ async function main() {
16
+ while (true) {
17
+ const question = readline.question("AI > ");
18
+
19
+ if (question.toLowerCase() === "exit") break;
20
+
21
+ console.log("ā³ Generating...");
22
+
23
+ const response = await client.chat.completions.create({
24
+ model: "llama-3.1-8b-instant", // āœ… NEW WORKING MODEL
25
+ messages: [
26
+ { role: "system", content: "You generate clean code. No extra text." },
27
+ { role: "user", content: question }
28
+ ]
29
+ });
30
+
31
+ const output = response.choices[0].message.content;
32
+
33
+ if (!fs.existsSync("generated")) fs.mkdirSync("generated");
34
+
35
+ const fileName = `generated/output_${Date.now()}.txt`;
36
+ fs.writeFileSync(fileName, output);
37
+
38
+ console.log(`\nāœ… File generated: ${fileName}\n`);
39
+ }
40
+ }
41
+
42
+ main();
package/cli.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import './ai.js';
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "shivam-cli-generator",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "ai.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "shivam-ai": "./cli.js"
9
+ },
10
+ "scripts": {
11
+ "start": "node ai.js"
12
+ },
13
+ "keywords": [],
14
+ "author": "",
15
+ "license": "ISC",
16
+ "dependencies": {
17
+ "dotenv": "^17.2.3",
18
+ "groq-sdk": "^0.37.0",
19
+ "openai": "^6.16.0",
20
+ "readline-sync": "^1.4.10"
21
+ }
22
+
23
+
24
+ }