monomind 2.1.5 → 2.1.6
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monomind",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"description": "Open-source CLI extension for Claude Code. Adds an MCP server with a codebase knowledge graph, persistent memory, multi-agent coordination, and reusable slash commands. MIT licensed, runs locally, no data leaves your machine.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -45,9 +45,13 @@ module.exports = {
|
|
|
45
45
|
}
|
|
46
46
|
} catch (e) { /* @monomind/hooks not available or not built — skip */ }
|
|
47
47
|
|
|
48
|
-
// Stale helper
|
|
49
|
-
//
|
|
50
|
-
//
|
|
48
|
+
// Stale helper self-heal — silently refresh project helpers that drift from
|
|
49
|
+
// the bundled npm copy, so a `npm i -g monomind@latest` (or npx picking up a
|
|
50
|
+
// new version) takes effect on the very next session instead of requiring a
|
|
51
|
+
// manual `doctor --fix` / `init upgrade`. Skip when running inside the
|
|
52
|
+
// monomind dev repo itself: local helpers ARE the source of truth there, so
|
|
53
|
+
// any diff vs. the npm global install is expected (and would self-clobber
|
|
54
|
+
// in-progress edits).
|
|
51
55
|
try {
|
|
52
56
|
var _isDevRepo = fs.existsSync(path.join(CWD, 'packages', '@monomind', 'cli', 'package.json'));
|
|
53
57
|
if (!_isDevRepo) {
|
|
@@ -76,24 +80,60 @@ module.exports = {
|
|
|
76
80
|
return null;
|
|
77
81
|
}
|
|
78
82
|
|
|
83
|
+
function _hashFile(p) {
|
|
84
|
+
try { return crypto.createHash('sha256').update(fs.readFileSync(p)).digest('hex'); }
|
|
85
|
+
catch (_) { return null; }
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Copy `bundledF` -> `localF` iff their contents differ (or local is missing).
|
|
89
|
+
// Atomic copy-via-rename so a partial write can never leave a broken hook.
|
|
90
|
+
function _healIfStale(localF, bundledF) {
|
|
91
|
+
if (!fs.existsSync(bundledF)) return null;
|
|
92
|
+
var hashB = _hashFile(bundledF);
|
|
93
|
+
var hashL = fs.existsSync(localF) ? _hashFile(localF) : null;
|
|
94
|
+
if (hashL === hashB) return null;
|
|
95
|
+
try {
|
|
96
|
+
var tmp = localF + '.' + process.pid + '.tmp';
|
|
97
|
+
fs.mkdirSync(path.dirname(localF), { recursive: true });
|
|
98
|
+
fs.copyFileSync(bundledF, tmp);
|
|
99
|
+
try { fs.chmodSync(tmp, 0o755); } catch (_) {}
|
|
100
|
+
fs.renameSync(tmp, localF);
|
|
101
|
+
return path.relative(path.join(CWD, '.claude', 'helpers'), localF);
|
|
102
|
+
} catch (_) { return null; }
|
|
103
|
+
}
|
|
104
|
+
|
|
79
105
|
var bundledDir = _findBundledHelpers();
|
|
80
106
|
if (bundledDir) {
|
|
81
|
-
var
|
|
82
|
-
|
|
107
|
+
var healed = [];
|
|
108
|
+
// Top-level critical files — mirrors executor.ts's `criticalHelpers` list.
|
|
109
|
+
var helpersToCheck = ['hook-handler.cjs', 'statusline.cjs', 'router.cjs', 'graphify-freshen.cjs', 'intelligence.cjs', 'auto-memory-hook.mjs'];
|
|
83
110
|
for (var hi = 0; hi < helpersToCheck.length; hi++) {
|
|
84
111
|
var hName = helpersToCheck[hi];
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
112
|
+
var healedName = _healIfStale(
|
|
113
|
+
path.join(CWD, '.claude', 'helpers', hName),
|
|
114
|
+
path.join(bundledDir, hName)
|
|
115
|
+
);
|
|
116
|
+
if (healedName) healed.push(healedName);
|
|
117
|
+
}
|
|
118
|
+
// handlers/ and utils/ subdirectories — where most real hook-behavior
|
|
119
|
+
// fixes actually live (capture-handler.cjs, gates-handler.cjs, etc.).
|
|
120
|
+
var subdirs = ['handlers', 'utils'];
|
|
121
|
+
for (var si = 0; si < subdirs.length; si++) {
|
|
122
|
+
var bundledSub = path.join(bundledDir, subdirs[si]);
|
|
123
|
+
if (!fs.existsSync(bundledSub)) continue;
|
|
124
|
+
var files;
|
|
125
|
+
try { files = fs.readdirSync(bundledSub).filter(function(f) { return !f.startsWith('._') && !fs.statSync(path.join(bundledSub, f)).isDirectory(); }); }
|
|
126
|
+
catch (_) { files = []; }
|
|
127
|
+
for (var fi = 0; fi < files.length; fi++) {
|
|
128
|
+
var healedName2 = _healIfStale(
|
|
129
|
+
path.join(CWD, '.claude', 'helpers', subdirs[si], files[fi]),
|
|
130
|
+
path.join(bundledSub, files[fi])
|
|
131
|
+
);
|
|
132
|
+
if (healedName2) healed.push(healedName2);
|
|
133
|
+
}
|
|
93
134
|
}
|
|
94
|
-
if (
|
|
95
|
-
console.log('[STALE_HELPERS]
|
|
96
|
-
console.log(' Run `npx monomind@latest init upgrade` to refresh and pick up the latest features.');
|
|
135
|
+
if (healed.length > 0) {
|
|
136
|
+
console.log('[STALE_HELPERS] Refreshed ' + healed.length + ' helper(s) from bundled version: ' + healed.join(', '));
|
|
97
137
|
}
|
|
98
138
|
}
|
|
99
139
|
}
|
|
@@ -574,7 +574,7 @@ export async function executeUpgrade(targetDir, upgradeSettings = false) {
|
|
|
574
574
|
if (sourceHelpersForUpgrade) {
|
|
575
575
|
const destHelpersDir = path.join(targetDir, '.claude', 'helpers');
|
|
576
576
|
// Copy top-level critical files atomically
|
|
577
|
-
const criticalHelpers = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'graphify-freshen.cjs'];
|
|
577
|
+
const criticalHelpers = ['auto-memory-hook.mjs', 'hook-handler.cjs', 'intelligence.cjs', 'statusline.cjs', 'graphify-freshen.cjs', 'router.cjs'];
|
|
578
578
|
// Generated fallback for any critical helper missing from the source dir itself
|
|
579
579
|
// (e.g. the published npm template lacking auto-memory-hook.mjs).
|
|
580
580
|
const criticalGenerators = {
|
|
@@ -630,6 +630,7 @@ export async function executeUpgrade(targetDir, upgradeSettings = false) {
|
|
|
630
630
|
'hook-handler.cjs': generateHookHandler(),
|
|
631
631
|
'intelligence.cjs': generateIntelligenceStub(),
|
|
632
632
|
'auto-memory-hook.mjs': generateAutoMemoryHook(),
|
|
633
|
+
'router.cjs': generateAgentRouter(),
|
|
633
634
|
};
|
|
634
635
|
for (const [helperName, content] of Object.entries(generatedCritical)) {
|
|
635
636
|
const targetPath = path.join(targetDir, '.claude', 'helpers', helperName);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monomindcli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI engine for Monomind — an open-source MCP server that extends Claude Code with a codebase knowledge graph (tree-sitter + SQLite), persistent memory, multi-agent task coordination, and session hooks. MIT licensed, fully local.",
|
|
6
6
|
"main": "dist/src/index.js",
|