memorix 0.2.0 → 0.2.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/dist/cli/index.js +27 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2547,6 +2547,7 @@ var server_exports = {};
|
|
|
2547
2547
|
__export(server_exports, {
|
|
2548
2548
|
createMemorixServer: () => createMemorixServer
|
|
2549
2549
|
});
|
|
2550
|
+
import { watch } from "fs";
|
|
2550
2551
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2551
2552
|
import { z } from "zod";
|
|
2552
2553
|
async function createMemorixServer(cwd) {
|
|
@@ -2561,6 +2562,26 @@ async function createMemorixServer(cwd) {
|
|
|
2561
2562
|
}
|
|
2562
2563
|
console.error(`[memorix] Project: ${project.id} (${project.name})`);
|
|
2563
2564
|
console.error(`[memorix] Data dir: ${projectDir2}`);
|
|
2565
|
+
const observationsFile = projectDir2 + "/observations.json";
|
|
2566
|
+
let reloadDebounce = null;
|
|
2567
|
+
try {
|
|
2568
|
+
watch(observationsFile, () => {
|
|
2569
|
+
if (reloadDebounce) clearTimeout(reloadDebounce);
|
|
2570
|
+
reloadDebounce = setTimeout(async () => {
|
|
2571
|
+
try {
|
|
2572
|
+
await initObservations(projectDir2);
|
|
2573
|
+
const count2 = await reindexObservations();
|
|
2574
|
+
if (count2 > 0) {
|
|
2575
|
+
console.error(`[memorix] Hot-reloaded ${count2} observations (external write detected)`);
|
|
2576
|
+
}
|
|
2577
|
+
} catch {
|
|
2578
|
+
}
|
|
2579
|
+
}, 500);
|
|
2580
|
+
});
|
|
2581
|
+
console.error(`[memorix] Watching for external writes (hooks hot-reload enabled)`);
|
|
2582
|
+
} catch {
|
|
2583
|
+
console.error(`[memorix] Warning: could not watch observations file for hot-reload`);
|
|
2584
|
+
}
|
|
2564
2585
|
const server = new McpServer({
|
|
2565
2586
|
name: "memorix",
|
|
2566
2587
|
version: "0.1.0"
|
|
@@ -3730,9 +3751,12 @@ async function runHook() {
|
|
|
3730
3751
|
const { observation, output } = await handleHookEvent(input);
|
|
3731
3752
|
if (observation) {
|
|
3732
3753
|
try {
|
|
3733
|
-
const { storeObservation: storeObservation2 } = await Promise.resolve().then(() => (init_observations(), observations_exports));
|
|
3754
|
+
const { storeObservation: storeObservation2, initObservations: initObservations2 } = await Promise.resolve().then(() => (init_observations(), observations_exports));
|
|
3734
3755
|
const { detectProject: detectProject2 } = await Promise.resolve().then(() => (init_detector(), detector_exports));
|
|
3756
|
+
const { getProjectDataDir: getProjectDataDir2 } = await Promise.resolve().then(() => (init_persistence(), persistence_exports));
|
|
3735
3757
|
const project = await detectProject2(input.cwd || process.cwd());
|
|
3758
|
+
const dataDir = await getProjectDataDir2(project.id);
|
|
3759
|
+
await initObservations2(dataDir);
|
|
3736
3760
|
await storeObservation2({ ...observation, projectId: project.id });
|
|
3737
3761
|
} catch {
|
|
3738
3762
|
}
|
|
@@ -3855,7 +3879,7 @@ function getProjectConfigPath(agent, projectRoot) {
|
|
|
3855
3879
|
case "copilot":
|
|
3856
3880
|
return path5.join(projectRoot, ".github", "hooks", "memorix.json");
|
|
3857
3881
|
case "windsurf":
|
|
3858
|
-
return path5.join(projectRoot, ".windsurf", "
|
|
3882
|
+
return path5.join(projectRoot, ".windsurf", "hooks.json");
|
|
3859
3883
|
case "cursor":
|
|
3860
3884
|
return path5.join(projectRoot, ".cursor", "hooks.json");
|
|
3861
3885
|
case "kiro":
|
|
@@ -3873,7 +3897,7 @@ function getGlobalConfigPath(agent) {
|
|
|
3873
3897
|
case "copilot":
|
|
3874
3898
|
return path5.join(home, ".claude", "settings.json");
|
|
3875
3899
|
case "windsurf":
|
|
3876
|
-
return path5.join(home, ".codeium", "windsurf", "
|
|
3900
|
+
return path5.join(home, ".codeium", "windsurf", "hooks.json");
|
|
3877
3901
|
case "cursor":
|
|
3878
3902
|
return path5.join(home, ".cursor", "hooks.json");
|
|
3879
3903
|
default:
|