opentology 0.2.6 → 0.2.7
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/mcp/server.js +16 -6
- package/package.json +1 -1
package/dist/mcp/server.js
CHANGED
|
@@ -467,20 +467,30 @@ async function handleContextInit(args) {
|
|
|
467
467
|
const sessionStartCmd = 'node .opentology/hooks/session-start.mjs';
|
|
468
468
|
if (!hooks.SessionStart)
|
|
469
469
|
hooks.SessionStart = [];
|
|
470
|
-
const hasSessionHook = hooks.SessionStart.some((h) =>
|
|
470
|
+
const hasSessionHook = hooks.SessionStart.some((h) => {
|
|
471
|
+
const entry = h;
|
|
472
|
+
const entryHooks = entry.hooks;
|
|
473
|
+
return entryHooks?.some((hook) => hook.command === sessionStartCmd);
|
|
474
|
+
});
|
|
471
475
|
if (!hasSessionHook) {
|
|
472
|
-
hooks.SessionStart.push({
|
|
476
|
+
hooks.SessionStart.push({
|
|
477
|
+
matcher: '',
|
|
478
|
+
hooks: [{ type: 'command', command: sessionStartCmd }],
|
|
479
|
+
});
|
|
473
480
|
hooksChanged = true;
|
|
474
481
|
}
|
|
475
482
|
const preEditCmd = 'node .opentology/hooks/pre-edit.mjs';
|
|
476
483
|
if (!hooks.PreToolUse)
|
|
477
484
|
hooks.PreToolUse = [];
|
|
478
|
-
const hasPreEditHook = hooks.PreToolUse.some((h) =>
|
|
485
|
+
const hasPreEditHook = hooks.PreToolUse.some((h) => {
|
|
486
|
+
const entry = h;
|
|
487
|
+
const entryHooks = entry.hooks;
|
|
488
|
+
return entryHooks?.some((hook) => hook.command === preEditCmd);
|
|
489
|
+
});
|
|
479
490
|
if (!hasPreEditHook) {
|
|
480
491
|
hooks.PreToolUse.push({
|
|
481
|
-
|
|
482
|
-
command: preEditCmd,
|
|
483
|
-
matcher: { tool_name: 'Edit|Write' },
|
|
492
|
+
matcher: 'Edit|Write',
|
|
493
|
+
hooks: [{ type: 'command', command: preEditCmd }],
|
|
484
494
|
});
|
|
485
495
|
hooksChanged = true;
|
|
486
496
|
}
|