wolverine-ai 3.8.1 → 3.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wolverine-ai",
3
- "version": "3.8.1",
3
+ "version": "3.8.2",
4
4
  "description": "Self-healing Node.js server framework powered by AI. Catches crashes, diagnoses errors, generates fixes, verifies, and restarts — automatically.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -487,8 +487,11 @@ async function tryOperationalFix(parsed, cwd, logger) {
487
487
  }
488
488
  }
489
489
 
490
- // Pattern 2: ENOENT on config/data files the server expects
491
- const enoent = msg.match(/ENOENT.*?'([^']+)'/);
490
+ // Pattern 2: Missing files — ENOENT or error messages mentioning missing file paths
491
+ const enoent = msg.match(/ENOENT.*?'([^']+)'/)
492
+ || msg.match(/[Mm]issing\s+(?:required\s+)?(?:config\s+)?file:\s*([^\s,."]+\.\w+)/)
493
+ || msg.match(/no such file.*?'([^']+)'/)
494
+ || msg.match(/cannot find.*?'([^']+\.\w+)'/i);
492
495
  if (enoent) {
493
496
  const missingFile = enoent[1];
494
497
  const fs = require("fs");
@@ -501,10 +504,31 @@ async function tryOperationalFix(parsed, cwd, logger) {
501
504
  fs.mkdirSync(path.dirname(missingFile), { recursive: true });
502
505
  const ext = path.extname(missingFile).toLowerCase();
503
506
 
504
- // For JSON config files, try to infer expected structure from the code that loads them
507
+ // For JSON config files, try to infer expected structure from the code or error message
505
508
  let content = "";
506
509
  if (ext === ".json") {
507
- content = _inferJsonConfig(missingFile, cwd, parsed) || "{}";
510
+ content = _inferJsonConfig(missingFile, cwd, parsed);
511
+ // Also try to extract fields from the error message: "Expected JSON with { field1, field2 }"
512
+ if (!content) {
513
+ const fieldsMatch = msg.match(/(?:expected|with|fields?)[:\s]*\{\s*([^}]+)\}/i);
514
+ if (fieldsMatch) {
515
+ const fields = fieldsMatch[1].split(/[,\s]+/).filter(f => /^[a-zA-Z_]\w*$/.test(f.trim()));
516
+ if (fields.length > 0) {
517
+ const config = {};
518
+ for (const f of fields) {
519
+ const lower = f.toLowerCase();
520
+ if (/url|endpoint|host|uri/.test(lower)) config[f] = "http://localhost:3000";
521
+ else if (/timeout|delay/.test(lower)) config[f] = 5000;
522
+ else if (/port/.test(lower)) config[f] = 3000;
523
+ else if (/enabled|active/.test(lower)) config[f] = true;
524
+ else config[f] = "";
525
+ }
526
+ console.log(chalk.gray(` 🔍 Inferred ${fields.length} fields from error message: ${fields.join(", ")}`));
527
+ content = JSON.stringify(config, null, 2);
528
+ }
529
+ }
530
+ }
531
+ content = content || "{}";
508
532
  } else {
509
533
  const defaults = { ".yaml": "", ".yml": "", ".log": "", ".txt": "", ".csv": "", ".env": "" };
510
534
  content = defaults[ext] || "";