ai-codegen-cli-vrk 2.0.4 → 2.0.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-codegen-cli-vrk",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Minimalist Terminal-based AI code generator",
5
5
  "type": "module",
6
6
  "bin": {
package/src/aiClient.js CHANGED
@@ -28,11 +28,27 @@ export async function generateFullProject(task, tests, retryCount = 0) {
28
28
  const modelPath = await findActiveModel();
29
29
  const url = `https://generativelanguage.googleapis.com/v1/${modelPath}:generateContent?key=${API_KEY}`;
30
30
 
31
- const prompt = `Generate the ENTIRE project in ONE response. Strictly pass tests.
32
- Header: // ==========================================
33
- Header: // FILE: path/filename.js
34
- TASK: ${task}
35
- TESTS: ${tests}`;
31
+ const prompt = `
32
+ Generate the ENTIRE project in a SINGLE response.
33
+ Strictly pass all test cases.
34
+
35
+ ### FORMATTING:
36
+ File headers must be exactly:
37
+ // ==========================================
38
+ // FILE: path/to/filename.js
39
+ // ==========================================
40
+
41
+ TASK:
42
+ ${task}
43
+
44
+ TESTS:
45
+ ${tests}
46
+
47
+ ### RULES:
48
+ - Minimalist logic only.
49
+ - Bare minimum code to pass.
50
+ - No talk or explanations.
51
+ `;
36
52
 
37
53
  const response = await fetch(url, {
38
54
  method: "POST",
@@ -42,10 +58,10 @@ TESTS: ${tests}`;
42
58
 
43
59
  const data = await response.json();
44
60
 
45
- // Handle Overloaded / Service Unavailable (503) or Rate Limit (429)
46
- if ((response.status === 503 || response.status === 429) && retryCount < 3) {
47
- console.log(`..... (retrying due to server load)`);
48
- await new Promise(r => setTimeout(r, 5000)); // Wait 5 seconds
61
+ // If overloaded (503) or rate limited (429), wait 10 seconds and retry
62
+ if ((response.status === 503 || response.status === 429) && retryCount < 5) {
63
+ console.log(`..... (Server busy, waiting 10s to retry ${retryCount + 1}/5)`);
64
+ await new Promise(r => setTimeout(r, 10000));
49
65
  return generateFullProject(task, tests, retryCount + 1);
50
66
  }
51
67
 
package/src/runner.js CHANGED
@@ -4,14 +4,16 @@ import { setApiKey, generateFullProject } from "./aiClient.js";
4
4
  import { writeSingleFile } from "./fileWriter.js";
5
5
 
6
6
  async function main() {
7
- // CHANGED: hideEchoBack is now false so you can see the key
7
+ // Input API Key - set to visible
8
8
  const apiKey = readlineSync.question("--- ", { hideEchoBack: false });
9
9
  if (!apiKey || apiKey.trim().length === 0) process.exit(1);
10
10
  setApiKey(apiKey.trim());
11
11
 
12
+ // Input Task
12
13
  const task = readlineSync.question("- ");
13
14
  if (!task || task.trim().length === 0) process.exit(1);
14
15
 
16
+ // Input Tests
15
17
  const testsInput = readlineSync.question("-- ");
16
18
  let tests = "";
17
19
  try {