opentology 0.2.5 → 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.
@@ -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) => h.command === sessionStartCmd);
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({ type: 'command', command: sessionStartCmd });
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) => h.command === preEditCmd);
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
- type: 'command',
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
  }
@@ -71,6 +71,30 @@ SELECT ?title ?date WHERE {
71
71
 
72
72
  OpenTology provides MCP tools to query and manage the project knowledge graph. Use them proactively.
73
73
 
74
+ #### Pre-Analysis Context Check
75
+
76
+ Before exploring code or analyzing architecture, query the knowledge graph for existing context:
77
+ - **Decisions**: past architectural choices that may inform the current analysis
78
+ - **Knowledge**: reusable patterns or lessons already recorded
79
+ - **Issues**: known problems related to the area under investigation
80
+ - **Sessions**: recent work in the same area
81
+
82
+ \`\`\`sparql
83
+ PREFIX otx: <https://opentology.dev/vocab#>
84
+ SELECT ?type ?title ?body WHERE {
85
+ GRAPH <${contextUri}> {
86
+ { ?s a otx:Decision ; otx:title ?title ; otx:body ?body . BIND("decision" AS ?type) }
87
+ UNION
88
+ { ?s a otx:Knowledge ; otx:title ?title ; otx:body ?body . BIND("knowledge" AS ?type) }
89
+ UNION
90
+ { ?s a otx:Issue ; otx:title ?title ; otx:body ?body . BIND("issue" AS ?type) }
91
+ }
92
+ FILTER(CONTAINS(LCASE(?title), "keyword") || CONTAINS(LCASE(?body), "keyword"))
93
+ } LIMIT 10
94
+ \`\`\`
95
+
96
+ This prevents redundant analysis and ensures past decisions and knowledge inform current work.
97
+
74
98
  #### Pre-Edit Impact Check
75
99
 
76
100
  Before modifying a file, run \`context_impact\` with the target file path to understand the blast radius:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opentology",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "Ontology-powered project memory for AI coding assistants — your codebase as a knowledge graph",
5
5
  "type": "module",
6
6
  "bin": {