@frostbridge/imdl 0.1.10 → 0.1.11

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.
Files changed (2) hide show
  1. package/dist/index.js +21 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1228,11 +1228,10 @@ var AGENTS = [
1228
1228
  name: "Claude Code",
1229
1229
  dir: join6(homedir4(), ".claude"),
1230
1230
  mode: "hooks",
1231
- hooksFile: join6(homedir4(), ".claude", "hooks.json"),
1231
+ hooksFile: join6(homedir4(), ".claude", "settings.json"),
1232
1232
  hooks: {
1233
- user_prompt_submit: [{ command: "imdl hook prompt", timeout: 2e3 }],
1234
- pre_tool_use: [{ command: "imdl hook pre-tool", timeout: 2e3 }],
1235
- post_tool_use: [{ command: "imdl hook post-tool", timeout: 1e3 }]
1233
+ PreToolUse: [{ matcher: "*", hooks: [{ type: "command", command: "imdl hook pre-tool", timeout: 5 }] }],
1234
+ PostToolUse: [{ matcher: "*", hooks: [{ type: "command", command: "imdl hook post-tool", timeout: 5 }] }]
1236
1235
  }
1237
1236
  },
1238
1237
  {
@@ -1436,10 +1435,24 @@ function mergeHooks(existing, imdl) {
1436
1435
  if (!result.hooks[event]) {
1437
1436
  result.hooks[event] = imdlHooks;
1438
1437
  } else {
1439
- const existingCommands = result.hooks[event].map((h) => h.command);
1440
- for (const hook of imdlHooks) {
1441
- if (!existingCommands.includes(hook.command)) {
1442
- result.hooks[event].push(hook);
1438
+ for (const newEntry of imdlHooks) {
1439
+ if (newEntry.matcher && newEntry.hooks) {
1440
+ const existingEntry = result.hooks[event].find((e) => e.matcher === newEntry.matcher);
1441
+ if (existingEntry && existingEntry.hooks) {
1442
+ const existingCommands = existingEntry.hooks.map((h) => h.command);
1443
+ for (const hook of newEntry.hooks) {
1444
+ if (!existingCommands.includes(hook.command)) {
1445
+ existingEntry.hooks.push(hook);
1446
+ }
1447
+ }
1448
+ } else {
1449
+ result.hooks[event].push(newEntry);
1450
+ }
1451
+ } else {
1452
+ const existingCommands = result.hooks[event].map((h) => h.command);
1453
+ if (!existingCommands.includes(newEntry.command)) {
1454
+ result.hooks[event].push(newEntry);
1455
+ }
1443
1456
  }
1444
1457
  }
1445
1458
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "restricted"
5
5
  },
6
- "version": "0.1.10",
6
+ "version": "0.1.11",
7
7
  "description": "IMDL — Intelligent Mediation & Detection Layer. AI agent security CLI.",
8
8
  "files": [
9
9
  "dist"