naider 1.21.1 → 1.24.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.
package/bin/naide.js CHANGED
@@ -8,7 +8,7 @@ import { spawn } from 'child_process';
8
8
  import { createRequire } from 'module';
9
9
  const _require = createRequire(import.meta.url);
10
10
 
11
- const NAIDE_VERSION = '1.21.1';
11
+ const NAIDE_VERSION = '1.24.0';
12
12
 
13
13
  function crashReport(err, context = {}) {
14
14
  const info = [
@@ -279,28 +279,74 @@ if (files[0] === 'gen' || files[0] === '~~') {
279
279
  writeFileSync(fp, f.content, 'utf-8');
280
280
  }
281
281
  const a = result.analysis;
282
- const mode = isUpdate ? 'Updated' : 'Created';
282
+ const mode = result.action === 'removed' ? 'Removed' : isUpdate ? 'Updated' : 'Created';
283
283
  process.stderr.write(`\n ── NAIDE Agent (${mode}) ────────────────────────────────\n`);
284
- process.stderr.write(` Input: "${a.instruction}"\n`);
284
+ process.stderr.write(` Input: "${a.instruction || instruction}"\n`);
285
285
  if (a.entities.length > 0) {
286
286
  process.stderr.write(` Entities: ${a.entities.map(e => `${e.name} (${e.fieldCount} fields)`).join(', ')}\n`);
287
287
  }
288
288
  if (a.relationships && a.relationships.length > 0) {
289
289
  for (const r of a.relationships) process.stderr.write(` Relation: ${r.parent} 1→N ${r.child} (${r.fk})\n`);
290
290
  }
291
+ if (result.removed && result.removed.length > 0) {
292
+ process.stderr.write(` Removed: ${result.removed.join(', ')}\n`);
293
+ }
291
294
  if (a.added && a.added.length > 0) {
292
295
  process.stderr.write(` Added: ${a.added.join(', ')}\n`);
293
296
  }
294
297
  process.stderr.write(` Plan:\n`);
295
298
  for (const step of a.plan) process.stderr.write(` + ${step}\n`);
299
+ process.stderr.write(` Files: ${result.files.length} generated\n`);
296
300
  process.stderr.write(' ────────────────────────────────────────────────────────\n\n');
297
- console.log(` Project ${isUpdate ? 'updated' : 'created'}: ${dir}/`);
301
+ console.log(` Project ${mode.toLowerCase()}: ${dir}/`);
298
302
  for (const f of result.files) console.log(` ${f.path}`);
299
303
  if (!isUpdate) console.log(`\n cd ${dir} && npm install && npm run dev\n`);
300
304
  else console.log(`\n Files regenerated. Run: npm run dev\n`);
301
305
  process.exit(0);
302
306
  }
303
307
 
308
+ // Multi-target generation (D6)
309
+ if (flags.target && flags.target !== 'naide') {
310
+ const { generateForTarget, generateAllTargets } = await import('../src/gen.js');
311
+ if (flags.target === 'all') {
312
+ const result = await generateAllTargets(instruction);
313
+ if (!result.valid) {
314
+ process.stderr.write(` Error: generated NAIDE code is invalid\n`);
315
+ process.exit(1);
316
+ }
317
+ const succeeded = Object.entries(result.targets).filter(([, v]) => !v.error);
318
+ const failed = Object.entries(result.targets).filter(([, v]) => v.error);
319
+ process.stderr.write(`\n ── Multi-Target Generation (${succeeded.length}/${Object.keys(result.targets).length} targets) ──\n`);
320
+ for (const [t, v] of succeeded) {
321
+ if (flags.output) {
322
+ const outPath = flags.output.replace(/\.\w+$/, v.ext);
323
+ writeFileSync(outPath, v.code, 'utf-8');
324
+ console.log(` ${t}: ${outPath}`);
325
+ } else {
326
+ console.log(`\n ── ${t} (${v.ext}) ──\n`);
327
+ console.log(v.code);
328
+ }
329
+ }
330
+ if (failed.length > 0) {
331
+ process.stderr.write(` Failed: ${failed.map(([t, v]) => `${t} (${v.error.slice(0, 50)})`).join(', ')}\n`);
332
+ }
333
+ process.exit(0);
334
+ }
335
+ const result = await generateForTarget(instruction, flags.target);
336
+ if (result.compiled) {
337
+ if (flags.output) {
338
+ writeFileSync(flags.output, result.compiled, 'utf-8');
339
+ console.log(` Generated: ${flags.output} (${flags.target})`);
340
+ } else {
341
+ console.log(result.compiled);
342
+ }
343
+ } else {
344
+ process.stderr.write(` Error compiling to ${flags.target}: ${result.compileError || 'unknown'}\n`);
345
+ console.log(result.code);
346
+ }
347
+ process.exit(0);
348
+ }
349
+
304
350
  const result = generate(instruction);
305
351
 
306
352
  if (flags.output) {
package/mcp/server.js CHANGED
@@ -192,7 +192,7 @@ async function handleMessage(msg) {
192
192
  respond(msg.id, {
193
193
  protocolVersion: '2024-11-05',
194
194
  capabilities: { tools: {} },
195
- serverInfo: { name: 'naide-mcp', version: '1.21.1' }
195
+ serverInfo: { name: 'naide-mcp', version: '1.24.0' }
196
196
  });
197
197
  break;
198
198
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naider",
3
- "version": "1.21.1",
3
+ "version": "1.24.0",
4
4
  "description": "NAIDE - Simpler than Python, compiles to 15 targets. AI-specialized language with 35+ built-in functions, syntax sugar (unless/until/repeat/swap/is/isnt), and 47 features. Targets: Node.js, Python, TypeScript, C, C++, Java, Go, Rust, PHP, Ruby, Kotlin, Swift, Dart, C#, Bun.",
5
5
  "main": "src/index.js",
6
6
  "exports": {