@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.
- package/dist/index.js +21 -8
- 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", "
|
|
1231
|
+
hooksFile: join6(homedir4(), ".claude", "settings.json"),
|
|
1232
1232
|
hooks: {
|
|
1233
|
-
|
|
1234
|
-
|
|
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
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
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
|
}
|