wolverine-ai 6.2.1 → 6.2.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 +1 -1
- package/src/claw/setup.js +70 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wolverine-ai",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.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": {
|
package/src/claw/setup.js
CHANGED
|
@@ -247,19 +247,41 @@ function detectWolverine(cwd) {
|
|
|
247
247
|
brainExists: fs.existsSync(path.join(cwd, ".wolverine", "brain")),
|
|
248
248
|
};
|
|
249
249
|
|
|
250
|
+
// Check if we're inside the wolverine repo itself
|
|
250
251
|
try {
|
|
251
252
|
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf-8"));
|
|
252
|
-
if (pkg.name === "wolverine-ai"
|
|
253
|
+
if (pkg.name === "wolverine-ai") {
|
|
253
254
|
result.installed = true;
|
|
254
|
-
result.version = pkg.version
|
|
255
|
+
result.version = pkg.version;
|
|
256
|
+
return result;
|
|
255
257
|
}
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
+
// Check if wolverine-ai is a dependency
|
|
259
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies, ...pkg.optionalDependencies };
|
|
260
|
+
if (deps["wolverine-ai"]) {
|
|
258
261
|
result.installed = true;
|
|
259
|
-
result.version =
|
|
262
|
+
result.version = deps["wolverine-ai"];
|
|
260
263
|
}
|
|
261
264
|
} catch {}
|
|
262
265
|
|
|
266
|
+
// Check if wolverine.js exists in src/ (repo checkout)
|
|
267
|
+
if (fs.existsSync(path.join(cwd, "src", "core", "wolverine.js"))) {
|
|
268
|
+
result.installed = true;
|
|
269
|
+
try {
|
|
270
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(cwd, "package.json"), "utf-8"));
|
|
271
|
+
result.version = pkg.version;
|
|
272
|
+
} catch {}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Check node_modules
|
|
276
|
+
if (!result.installed) {
|
|
277
|
+
try {
|
|
278
|
+
const pkgPath = require.resolve("wolverine-ai/package.json", { paths: [cwd] });
|
|
279
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
280
|
+
result.installed = true;
|
|
281
|
+
result.version = pkg.version;
|
|
282
|
+
} catch {}
|
|
283
|
+
}
|
|
284
|
+
|
|
263
285
|
return result;
|
|
264
286
|
}
|
|
265
287
|
|
|
@@ -325,13 +347,48 @@ function mergeConfig(openclawConfig, defaults) {
|
|
|
325
347
|
|
|
326
348
|
// ── Scaffolding ─────────────────────────────────────────────────
|
|
327
349
|
|
|
350
|
+
/**
|
|
351
|
+
* Find the wolverine-ai template directory.
|
|
352
|
+
* Works whether wolverine is the project root OR installed in node_modules.
|
|
353
|
+
*/
|
|
354
|
+
function _findTemplateDir() {
|
|
355
|
+
// 1. Relative to this file (we're in src/claw/setup.js → ../../wolverine-claw/)
|
|
356
|
+
const fromSrc = path.join(__dirname, "..", "..", "wolverine-claw");
|
|
357
|
+
if (fs.existsSync(path.join(fromSrc, "index.js"))) return fromSrc;
|
|
358
|
+
|
|
359
|
+
// 2. Via require.resolve (works when wolverine-ai is a node_modules dep)
|
|
360
|
+
try {
|
|
361
|
+
const pkgPath = require.resolve("wolverine-ai/package.json");
|
|
362
|
+
const pkgDir = path.dirname(pkgPath);
|
|
363
|
+
const fromPkg = path.join(pkgDir, "wolverine-claw");
|
|
364
|
+
if (fs.existsSync(path.join(fromPkg, "index.js"))) return fromPkg;
|
|
365
|
+
} catch {}
|
|
366
|
+
|
|
367
|
+
// 3. Check common node_modules locations
|
|
368
|
+
const candidates = [
|
|
369
|
+
path.join(process.cwd(), "node_modules", "wolverine-ai", "wolverine-claw"),
|
|
370
|
+
path.join(os.homedir(), "node_modules", "wolverine-ai", "wolverine-claw"),
|
|
371
|
+
];
|
|
372
|
+
for (const c of candidates) {
|
|
373
|
+
if (fs.existsSync(path.join(c, "index.js"))) return c;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
|
|
328
379
|
/**
|
|
329
380
|
* Scaffold the wolverine-claw directory from template + merged config.
|
|
330
381
|
*/
|
|
331
382
|
function scaffold(cwd, mergedConfig, env) {
|
|
332
383
|
const clawDir = path.join(cwd, "wolverine-claw");
|
|
384
|
+
const templateDir = _findTemplateDir();
|
|
333
385
|
const results = { created: [], skipped: [], errors: [] };
|
|
334
386
|
|
|
387
|
+
if (!templateDir) {
|
|
388
|
+
results.errors.push("Could not find wolverine-ai templates. Is wolverine-ai installed?");
|
|
389
|
+
return results;
|
|
390
|
+
}
|
|
391
|
+
|
|
335
392
|
// Create directories
|
|
336
393
|
const dirs = ["config", "plugins", "workspace", "skills"];
|
|
337
394
|
for (const d of dirs) {
|
|
@@ -352,12 +409,11 @@ function scaffold(cwd, mergedConfig, env) {
|
|
|
352
409
|
}
|
|
353
410
|
|
|
354
411
|
// Copy index.js from template
|
|
355
|
-
const
|
|
356
|
-
if (!fs.existsSync(
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
fs.copyFileSync(templateIndex, indexSrc);
|
|
412
|
+
const indexDest = path.join(clawDir, "index.js");
|
|
413
|
+
if (!fs.existsSync(indexDest)) {
|
|
414
|
+
const indexSrc = path.join(templateDir, "index.js");
|
|
415
|
+
if (fs.existsSync(indexSrc)) {
|
|
416
|
+
fs.copyFileSync(indexSrc, indexDest);
|
|
361
417
|
results.created.push("index.js");
|
|
362
418
|
}
|
|
363
419
|
} else {
|
|
@@ -367,15 +423,10 @@ function scaffold(cwd, mergedConfig, env) {
|
|
|
367
423
|
// Copy plugin
|
|
368
424
|
const pluginDest = path.join(clawDir, "plugins", "wolverine-integration.js");
|
|
369
425
|
if (!fs.existsSync(pluginDest)) {
|
|
370
|
-
const pluginSrc = path.join(
|
|
426
|
+
const pluginSrc = path.join(templateDir, "plugins", "wolverine-integration.js");
|
|
371
427
|
if (fs.existsSync(pluginSrc)) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
const templatePlugin = path.join(__dirname, "..", "..", "wolverine-claw", "plugins", "wolverine-integration.js");
|
|
375
|
-
if (fs.existsSync(templatePlugin)) {
|
|
376
|
-
fs.copyFileSync(templatePlugin, pluginDest);
|
|
377
|
-
results.created.push("plugins/wolverine-integration.js");
|
|
378
|
-
}
|
|
428
|
+
fs.copyFileSync(pluginSrc, pluginDest);
|
|
429
|
+
results.created.push("plugins/wolverine-integration.js");
|
|
379
430
|
}
|
|
380
431
|
} else {
|
|
381
432
|
results.skipped.push("plugins/wolverine-integration.js (already exists)");
|