opentology 0.2.2 → 0.2.3
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/commands/context.js +16 -6
- package/package.json +1 -1
package/dist/commands/context.js
CHANGED
|
@@ -177,9 +177,16 @@ export function registerContext(program) {
|
|
|
177
177
|
const sessionStartCmd = 'node .opentology/hooks/session-start.mjs';
|
|
178
178
|
if (!hooks.SessionStart)
|
|
179
179
|
hooks.SessionStart = [];
|
|
180
|
-
const hasSessionHook = hooks.SessionStart.some((h) =>
|
|
180
|
+
const hasSessionHook = hooks.SessionStart.some((h) => {
|
|
181
|
+
const entry = h;
|
|
182
|
+
const entryHooks = entry.hooks;
|
|
183
|
+
return entryHooks?.some((hook) => hook.command === sessionStartCmd);
|
|
184
|
+
});
|
|
181
185
|
if (!hasSessionHook) {
|
|
182
|
-
hooks.SessionStart.push({
|
|
186
|
+
hooks.SessionStart.push({
|
|
187
|
+
matcher: '',
|
|
188
|
+
hooks: [{ type: 'command', command: sessionStartCmd }],
|
|
189
|
+
});
|
|
183
190
|
console.log(pc.green(' Registered SessionStart hook in .claude/settings.json'));
|
|
184
191
|
}
|
|
185
192
|
// Ask about PreToolUse impact hook
|
|
@@ -191,12 +198,15 @@ export function registerContext(program) {
|
|
|
191
198
|
const preEditCmd = 'node .opentology/hooks/pre-edit.mjs';
|
|
192
199
|
if (!hooks.PreToolUse)
|
|
193
200
|
hooks.PreToolUse = [];
|
|
194
|
-
const hasPreEditHook = hooks.PreToolUse.some((h) =>
|
|
201
|
+
const hasPreEditHook = hooks.PreToolUse.some((h) => {
|
|
202
|
+
const entry = h;
|
|
203
|
+
const entryHooks = entry.hooks;
|
|
204
|
+
return entryHooks?.some((hook) => hook.command === preEditCmd);
|
|
205
|
+
});
|
|
195
206
|
if (!hasPreEditHook) {
|
|
196
207
|
hooks.PreToolUse.push({
|
|
197
|
-
|
|
198
|
-
command: preEditCmd,
|
|
199
|
-
matcher: { tool_name: 'Edit|Write' },
|
|
208
|
+
matcher: 'Edit|Write',
|
|
209
|
+
hooks: [{ type: 'command', command: preEditCmd }],
|
|
200
210
|
});
|
|
201
211
|
}
|
|
202
212
|
console.log(pc.green(' Registered PreToolUse impact hook in .claude/settings.json'));
|