lumina-code-agent 1.6.7 → 1.6.8

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/dist/index.js +35 -46
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -34,38 +34,21 @@ async function onboarding() {
34
34
  saveConfig({ openrouterKey: apiKey.trim(), userName: name.trim() || 'User' });
35
35
  console.log(' ✓ Ready!\n');
36
36
  }
37
- // ── Extract files from complete model output ────────────────────────
38
37
  function extractFiles(text) {
39
38
  const files = [];
40
- // Match FILENAME: path\n...content...END FILE
41
39
  const fileRegex = /FILENAME:\s*([^\n]+)\n([\s\S]*?)END FILE/g;
42
40
  let match;
43
41
  while ((match = fileRegex.exec(text)) !== null) {
44
42
  const rawPath = match[1].trim();
45
43
  const content = match[2].trim();
46
- // Skip if it's a directory path (no extension or ends with /)
47
44
  if (!rawPath || rawPath.endsWith('/') || !extname(rawPath))
48
45
  continue;
49
- // Skip if path contains invalid chars
50
46
  if (rawPath.includes('<') || rawPath.includes('>') || rawPath.includes('"'))
51
47
  continue;
52
48
  files.push({ path: rawPath, content });
53
49
  }
54
- // Also match ```filename ... ``` code blocks
55
- const blockRegex = /```([\w./\-_]+)\n([\s\S]*?)```/g;
56
- while ((match = blockRegex.exec(text)) !== null) {
57
- const rawPath = match[1].trim();
58
- const content = match[2].trim();
59
- if (!rawPath || rawPath.endsWith('/') || !extname(rawPath))
60
- continue;
61
- // Skip common non-file patterns
62
- if (rawPath.startsWith('http') || rawPath.includes('node_modules'))
63
- continue;
64
- files.push({ path: rawPath, content });
65
- }
66
50
  return files;
67
51
  }
68
- // ── Chat Loop ───────────────────────────────────────────────────────
69
52
  async function chat(config) {
70
53
  console.log(' Type what you want to build. I\'ll handle the rest.');
71
54
  console.log(' Commands: /help /clear /files /exit\n');
@@ -97,9 +80,9 @@ async function chat(config) {
97
80
  console.log(' /help /clear /files /exit\n');
98
81
  continue;
99
82
  }
100
- const systemPrompt = `You are LUMINA CODE. You create COMPLETE production-grade websites.
83
+ const systemPrompt = `You are LUMINA CODE. Create COMPLETE production-grade websites.
101
84
 
102
- MANDATORY OUTPUT FORMAT — You MUST use this for EVERY file:
85
+ OUTPUT FORMAT — Use this EXACT format for EVERY file:
103
86
 
104
87
  FILENAME: index.html
105
88
  <!DOCTYPE html>
@@ -111,33 +94,34 @@ FILENAME: index.html
111
94
  <link rel="stylesheet" href="style.css">
112
95
  </head>
113
96
  <body>
114
- <!-- Complete HTML -->
97
+ <!-- Complete HTML here -->
98
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
115
99
  <script src="script.js"></script>
116
100
  </body>
117
101
  </html>
118
102
  END FILE
119
103
 
120
104
  FILENAME: style.css
121
- /* Complete CSS */
105
+ /* Complete CSS here */
122
106
  END FILE
123
107
 
124
108
  FILENAME: script.js
125
- // Complete JavaScript
109
+ // Complete JavaScript here
126
110
  END FILE
127
111
 
128
- CRITICAL RULES:
129
- 1. ALWAYS start with FILENAME: index.html
130
- 2. Output COMPLETE files — every line, no truncation
131
- 3. Do NOT describe what you will do — JUST DO IT
132
- 4. Do NOT output any text before FILENAME:
133
- 5. Do NOT use markdown code blocks — ONLY FILENAME: ... END FILE
134
- 6. Create ALL files needed for a complete working project
135
- 7. Use Three.js from CDN: https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js
136
- 8. Use modern CSS (grid, flexbox, custom properties)
137
- 9. No placeholders, no TODOs, no lorem ipsum
112
+ RULES:
113
+ - Start IMMEDIATELY with FILENAME: index.html
114
+ - Output COMPLETE files — every line, no truncation
115
+ - Do NOT describe what you will do — JUST DO IT
116
+ - Do NOT output any text before FILENAME:
117
+ - Do NOT use markdown code blocks
118
+ - Create ALL files needed for a complete working project
119
+ - Use Three.js from CDN for 3D
120
+ - No placeholders, no TODOs, no lorem ipsum
138
121
 
139
122
  Working directory: ${process.cwd()}`;
140
- console.log(' ⏳ Generating...\n');
123
+ console.log('');
124
+ console.log(' ⏳ Sending to AI...');
141
125
  try {
142
126
  const controller = new AbortController();
143
127
  const timeout = setTimeout(() => controller.abort(), 300000);
@@ -166,26 +150,30 @@ Working directory: ${process.cwd()}`;
166
150
  const err = await res.text().catch(() => '');
167
151
  throw new Error(`API error ${res.status}: ${err.slice(0, 200)}`);
168
152
  }
153
+ console.log(' ⏳ AI is thinking...');
169
154
  const data = await res.json();
170
155
  const content = data.choices?.[0]?.message?.content || '';
171
156
  if (!content) {
172
157
  console.log(' ⚠ No response from model.\n');
173
158
  continue;
174
159
  }
175
- // Show the raw output for debugging
176
- console.log(' 📝 Model output preview:');
177
- console.log(' ' + content.slice(0, 200).replace(/\n/g, '\n '));
178
- console.log('');
179
- // Extract and create files
160
+ console.log(' ✓ AI responded! Parsing files...\n');
180
161
  const files = extractFiles(content);
181
162
  if (files.length === 0) {
182
- console.log(' ⚠ No files detected in output. The model may not have used FILENAME: format.');
183
- console.log(' Here is the full output:\n');
184
- console.log(content);
185
- console.log('');
163
+ console.log(' ⚠ No files detected. Full output:\n');
164
+ console.log(' ──────────────────────────────────────');
165
+ // Print first 100 lines
166
+ const lines = content.split('\n').slice(0, 100);
167
+ for (const line of lines) {
168
+ console.log(' ' + line);
169
+ }
170
+ if (content.split('\n').length > 100) {
171
+ console.log(' ... (truncated)');
172
+ }
173
+ console.log(' ──────────────────────────────────────\n');
186
174
  continue;
187
175
  }
188
- console.log(` 📁 Creating ${files.length} file(s)...\n`);
176
+ console.log(` 📁 Found ${files.length} file(s):\n`);
189
177
  for (const file of files) {
190
178
  try {
191
179
  const filePath = join(process.cwd(), file.path);
@@ -194,13 +182,14 @@ Working directory: ${process.cwd()}`;
194
182
  mkdirSync(dir, { recursive: true });
195
183
  writeFileSync(filePath, file.content, 'utf-8');
196
184
  createdFiles.add(file.path);
197
- console.log(` ${file.path} (${file.content.length} chars)`);
185
+ console.log(` ${file.path} (${file.content.length} chars)`);
198
186
  }
199
187
  catch (e) {
200
- console.log(` ${file.path}: ${e.message}`);
188
+ console.log(` ${file.path}: ${e.message}`);
201
189
  }
202
190
  }
203
- console.log(`\n 📊 Total files: ${createdFiles.size}\n`);
191
+ console.log(`\n 📊 Total files created: ${createdFiles.size}`);
192
+ console.log('');
204
193
  }
205
194
  catch (e) {
206
195
  console.log(` ⚠ Error: ${e.message}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lumina-code-agent",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
4
4
  "description": "Lumina Code - AI coding agent",
5
5
  "license": "MIT",
6
6
  "type": "module",