wolverine-ai 6.0.1 → 6.0.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/bin/wolverine.js CHANGED
@@ -246,12 +246,15 @@ if (args.includes("--backups")) {
246
246
  const scriptPath = args.find(a => !a.startsWith("--")) || "server/index.js";
247
247
 
248
248
  // Initialize server/ from template if it doesn't exist (first run)
249
- const { initServer, ensureX402Deps } = require("../src/core/init-server");
249
+ const { initServer, ensureX402Deps, securityAudit } = require("../src/core/init-server");
250
250
  initServer(process.cwd(), scriptPath);
251
251
 
252
252
  // Ensure x402 payment deps are installed (if vault exists)
253
253
  ensureX402Deps(process.cwd());
254
254
 
255
+ // Security audit — detect and auto-fix CVEs on startup
256
+ securityAudit(process.cwd());
257
+
255
258
  // System detection (for analytics + dashboard, NOT for forking)
256
259
  // Wolverine runs as a single process manager. If users want clustering,
257
260
  // they handle it inside their server (e.g. @fastify/cluster, pm2 cluster mode).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wolverine-ai",
3
- "version": "6.0.1",
3
+ "version": "6.0.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": {
@@ -89,4 +89,47 @@ function ensureX402Deps(cwd) {
89
89
  }
90
90
  }
91
91
 
92
- module.exports = { initServer, ensureX402Deps };
92
+ /**
93
+ * Run security audit on startup — detect and auto-fix CVEs.
94
+ * Only runs if node_modules exists. Non-blocking (doesn't prevent startup).
95
+ */
96
+ function securityAudit(cwd) {
97
+ if (!fs.existsSync(path.join(cwd, "node_modules"))) return;
98
+
99
+ try {
100
+ const { audit } = require("../skills/deps");
101
+ const result = audit(cwd);
102
+
103
+ if (result.vulnerabilities === 0) return;
104
+
105
+ const severity = result.critical > 0 ? "critical" : result.high > 0 ? "high" : "moderate";
106
+ console.log(chalk.yellow(` 🛡️ Security: ${result.vulnerabilities} vulnerabilities (${result.critical} critical, ${result.high} high, ${result.moderate} moderate)`));
107
+
108
+ // Auto-fix if possible (non-breaking only)
109
+ if (result.critical > 0 || result.high > 0) {
110
+ console.log(chalk.blue(" 🛡️ Running npm audit fix..."));
111
+ try {
112
+ const { execSync } = require("child_process");
113
+ const output = execSync("npm audit fix 2>&1", { cwd, encoding: "utf-8", timeout: 60000 });
114
+ const changed = output.match(/changed (\d+) package/);
115
+ if (changed) {
116
+ console.log(chalk.green(` ✅ Fixed: ${changed[0]}`));
117
+ } else {
118
+ console.log(chalk.gray(" 🛡️ No auto-fixable vulnerabilities (may need --force or manual update)"));
119
+ }
120
+ } catch (e) {
121
+ console.log(chalk.gray(` 🛡️ npm audit fix: ${e.message?.slice(0, 80)}`));
122
+ }
123
+
124
+ // Re-check
125
+ const after = audit(cwd);
126
+ if (after.vulnerabilities < result.vulnerabilities) {
127
+ console.log(chalk.green(` ✅ Reduced from ${result.vulnerabilities} to ${after.vulnerabilities} vulnerabilities`));
128
+ } else if (after.critical > 0 || after.high > 0) {
129
+ console.log(chalk.yellow(` ⚠️ ${after.critical + after.high} critical/high vulnerabilities remain — run 'npm audit' for details`));
130
+ }
131
+ }
132
+ } catch {}
133
+ }
134
+
135
+ module.exports = { initServer, ensureX402Deps, securityAudit };