shivam-cli-generator 1.1.1 → 1.1.2

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/ai.js +21 -10
  2. package/package.json +2 -2
package/ai.js CHANGED
@@ -1,16 +1,25 @@
1
- // Version 1.0.5
1
+ // Version 1.1.2
2
2
  import dotenv from 'dotenv';
3
3
  import { fileURLToPath } from 'url';
4
4
  import { dirname, join } from 'path';
5
5
 
6
+ import Groq from "groq-sdk";
7
+ import fs from "fs";
8
+ import readline from "readline-sync";
9
+ import { HttpsProxyAgent } from "https-proxy-agent"; // ⭐ Fixed import
10
+
6
11
  const __filename = fileURLToPath(import.meta.url);
7
12
  const __dirname = dirname(__filename);
8
13
 
9
- // Load .env from the package directory, not the current working directory
14
+ // Load .env from the package directory
10
15
  dotenv.config({ path: join(__dirname, '.env') });
11
- import Groq from "groq-sdk";
12
- import fs from "fs";
13
- import readline from "readline-sync";
16
+
17
+ // 🌐 FIREWALL BYPASS PROXY URL (change if blocked)
18
+ const proxyUrl = "http://global.freeproxy.ai:80";
19
+
20
+ // Create proxy agent
21
+ const proxyAgent = new HttpsProxyAgent(proxyUrl);
22
+
14
23
  const apiKey = process.env.GROQ_API_KEY;
15
24
 
16
25
  if (!apiKey) {
@@ -18,8 +27,12 @@ if (!apiKey) {
18
27
  process.exit(1);
19
28
  }
20
29
 
21
- // āœ… Correct Groq client initialization
22
- const client = new Groq({ apiKey });
30
+ // ⭐ Updated Groq client initialization WITH PROXY
31
+ const client = new Groq({
32
+ apiKey,
33
+ httpAgent: proxyAgent,
34
+ httpsAgent: proxyAgent
35
+ });
23
36
 
24
37
  // āœ… Use the inputURL if provided
25
38
  const inputURL = process.argv[2];
@@ -75,9 +88,7 @@ async function main() {
75
88
 
76
89
  } catch (error) {
77
90
  console.error("\nāŒ Error communicating with AI:", error.message);
78
- if (error.code === 'ECONNREFUSED' || error.code === 'ENOTFOUND') {
79
- console.error("šŸ‘‰ Check your internet connection.\n");
80
- }
91
+ console.error("šŸ‘‰ The firewall proxy may be blocked. Try changing proxy URL at the top.\n");
81
92
  }
82
93
  }
83
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shivam-cli-generator",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "main": "ai.js",
6
6
  "type": "module",
@@ -19,4 +19,4 @@
19
19
  "https-proxy-agent": "^7.0.6",
20
20
  "readline-sync": "^1.4.10"
21
21
  }
22
- }
22
+ }