wolverine-ai 5.4.0 → 5.4.1

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,9 +246,12 @@ 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 } = require("../src/core/init-server");
249
+ const { initServer, ensureX402Deps } = require("../src/core/init-server");
250
250
  initServer(process.cwd(), scriptPath);
251
251
 
252
+ // Ensure x402 payment deps are installed (if vault exists)
253
+ ensureX402Deps(process.cwd());
254
+
252
255
  // System detection (for analytics + dashboard, NOT for forking)
253
256
  // Wolverine runs as a single process manager. If users want clustering,
254
257
  // 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": "5.4.0",
3
+ "version": "5.4.1",
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": {
@@ -55,4 +55,38 @@ function _copyDir(src, dest) {
55
55
  }
56
56
  }
57
57
 
58
- module.exports = { initServer };
58
+ /**
59
+ * Ensure x402 payment dependencies are installed.
60
+ * Called on startup — checks if @coinbase/x402 is resolvable.
61
+ * Auto-installs if vault is initialized (user wants x402).
62
+ */
63
+ function ensureX402Deps(cwd) {
64
+ // Check if x402 packages are needed
65
+ const vaultPath = path.join(cwd, ".wolverine", "vault", "eth.vault");
66
+ const hasVault = fs.existsSync(vaultPath);
67
+ if (!hasVault) return; // No vault = no x402 needed
68
+
69
+ // Check if already installed
70
+ try {
71
+ require.resolve("@coinbase/x402");
72
+ require.resolve("x402");
73
+ return; // Already installed
74
+ } catch {}
75
+
76
+ // Auto-install x402 deps
77
+ console.log(chalk.blue(" 📦 Installing x402 payment dependencies..."));
78
+ try {
79
+ const { execSync } = require("child_process");
80
+ execSync("npm install @coinbase/x402 x402 viem --no-save --ignore-engines 2>/dev/null", {
81
+ cwd,
82
+ stdio: "pipe",
83
+ timeout: 60000,
84
+ });
85
+ console.log(chalk.green(" ✅ x402 dependencies installed"));
86
+ } catch (err) {
87
+ console.log(chalk.yellow(` ⚠️ x402 dep install failed: ${err.message?.slice(0, 80)}`));
88
+ console.log(chalk.gray(" Run manually: npm install @coinbase/x402 x402 viem"));
89
+ }
90
+ }
91
+
92
+ module.exports = { initServer, ensureX402Deps };