wicked-brain 0.15.0 → 0.15.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/package.json
CHANGED
|
@@ -244,7 +244,15 @@ async function ensureServer(brainPath, opts) {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
log(`starting wicked-brain-server (brain=${brainPath} port=${port})`);
|
|
247
|
-
|
|
247
|
+
let sourcePath = sourceOverride || meta.source_path;
|
|
248
|
+
// Per-project brains are keyed on basename(cwd). Configs written before
|
|
249
|
+
// source_path persistence lack the field — derive it from cwd (only when
|
|
250
|
+
// the basename convention confirms cwd is the project root) so the server
|
|
251
|
+
// roots LSP at the project and persists source_path for port-resolution
|
|
252
|
+
// consumers (wicked-garden hooks match configs by source_path).
|
|
253
|
+
if (!sourcePath && basename(brainPath) === basename(process.cwd())) {
|
|
254
|
+
sourcePath = process.cwd();
|
|
255
|
+
}
|
|
248
256
|
const argv = [SERVER_BIN, "--brain", brainPath, "--port", String(port)];
|
|
249
257
|
if (sourcePath) argv.push("--source", sourcePath);
|
|
250
258
|
|
|
@@ -465,18 +473,19 @@ Examples:
|
|
|
465
473
|
if (args.flags.version) {
|
|
466
474
|
const pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf-8"));
|
|
467
475
|
process.stdout.write(pkg.version + "\n");
|
|
468
|
-
|
|
476
|
+
return;
|
|
469
477
|
}
|
|
470
478
|
|
|
471
479
|
if (args.flags.help) {
|
|
472
480
|
process.stdout.write(HELP);
|
|
473
|
-
|
|
481
|
+
return;
|
|
474
482
|
}
|
|
475
483
|
|
|
476
484
|
const noModeFlag = !args.flags.start && !args.flags.stop && !args.flags.status;
|
|
477
485
|
if (noModeFlag && args.positional.length === 0) {
|
|
478
486
|
process.stderr.write(HELP);
|
|
479
|
-
process.
|
|
487
|
+
process.exitCode = 1;
|
|
488
|
+
return;
|
|
480
489
|
}
|
|
481
490
|
|
|
482
491
|
const log = (msg) => process.stderr.write(`[wicked-brain-call] ${msg}\n`);
|
|
@@ -32,7 +32,7 @@ function getArg(name) {
|
|
|
32
32
|
if (args.includes("--version") || args.includes("-v")) {
|
|
33
33
|
const pkgUrl = new URL("../../package.json", import.meta.url);
|
|
34
34
|
const pkg = JSON.parse(readFileSync(pkgUrl, "utf-8"));
|
|
35
|
-
|
|
35
|
+
process.stdout.write(pkg.version + "\n");
|
|
36
36
|
exit(0);
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -120,7 +120,7 @@ let memorySubscriber = null;
|
|
|
120
120
|
|
|
121
121
|
// Graceful shutdown
|
|
122
122
|
async function shutdown() {
|
|
123
|
-
|
|
123
|
+
process.stdout.write("Shutting down...\n");
|
|
124
124
|
try { unlinkSync(pidPath); } catch {}
|
|
125
125
|
watcher.stop();
|
|
126
126
|
if (memorySubscriber) {
|
|
@@ -398,12 +398,16 @@ try {
|
|
|
398
398
|
let metaConfig = {};
|
|
399
399
|
try { metaConfig = JSON.parse(readFileSync(metaConfigPath, "utf-8")); } catch {}
|
|
400
400
|
metaConfig.server_port = port;
|
|
401
|
+
// Persist the source root alongside the port: external port resolution
|
|
402
|
+
// (wicked-garden hooks) matches per-project configs by source_path, and
|
|
403
|
+
// configs created before this field existed would otherwise never gain it.
|
|
404
|
+
if (sourcePath) metaConfig.source_path = sourcePath;
|
|
401
405
|
writeFileSync(metaConfigPath, JSON.stringify(metaConfig, null, 2) + "\n");
|
|
402
406
|
} catch (err) {
|
|
403
407
|
console.error(`Warning: could not write port to config: ${err.message}`);
|
|
404
408
|
}
|
|
405
409
|
|
|
406
|
-
|
|
410
|
+
process.stdout.write(`wicked-brain-server running on port ${port} (brain: ${brainId}, pid: ${pid})\n`);
|
|
407
411
|
watcher.start();
|
|
408
412
|
const busReady = await waitForBus();
|
|
409
413
|
emitEvent("wicked.server.started", "brain.system", {
|
package/server/package.json
CHANGED
|
@@ -101,6 +101,7 @@ Brain search/query results include `source_type` and `path` fields:
|
|
|
101
101
|
### Rules (follow strictly)
|
|
102
102
|
|
|
103
103
|
- **ALWAYS check the brain BEFORE using Grep, Glob, Read, or Agent(Explore)** — for any find, search, explore, explain, or "what is/how does" request
|
|
104
|
+
- The server auto-starts on any `wicked-brain-call` / skill invocation — a "server not running" notice is NEVER a reason to skip the brain; just call the skill
|
|
104
105
|
- Use `wicked-brain:search` for finding content ("find X", "where is Y", "look for Z", "show me W")
|
|
105
106
|
- Use `wicked-brain:query` for questions ("what does X do", "how does Y work", "explain Z")
|
|
106
107
|
- Use `wicked-brain:agent` (context) when starting a new topic or unfamiliar area
|