mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-14 15:16:35 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
665c51b903 |
@@ -1534,7 +1534,8 @@ function hookInstalledForProvider(root, provider) {
|
|||||||
|
|
||||||
function valueHasImpeccableHookMarker(value) {
|
function valueHasImpeccableHookMarker(value) {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
return IMPECCABLE_HOOK_COMMAND_MARKERS.some(marker => value.includes(marker));
|
const normalized = value.replace(/\\/g, '/');
|
||||||
|
return IMPECCABLE_HOOK_COMMAND_MARKERS.some(marker => normalized.includes(marker));
|
||||||
}
|
}
|
||||||
if (Array.isArray(value)) return value.some(valueHasImpeccableHookMarker);
|
if (Array.isArray(value)) return value.some(valueHasImpeccableHookMarker);
|
||||||
if (value && typeof value === 'object') {
|
if (value && typeof value === 'object') {
|
||||||
|
|||||||
@@ -1649,6 +1649,35 @@ describe('hook manifest merge helpers', () => {
|
|||||||
'node .cursor/skills/impeccable/scripts/hook-before-edit.mjs',
|
'node .cursor/skills/impeccable/scripts/hook-before-edit.mjs',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('mergeHookManifests replaces legacy Windows-path Claude hooks (#604)', () => {
|
||||||
|
const legacyPath = 'C:\\Users\\alice\\.claude\\skills\\impeccable\\scripts\\hook.mjs';
|
||||||
|
const legacyCommand = `[ ! -f "${legacyPath}" ] || node "${legacyPath}"`;
|
||||||
|
const freshCommand = `node -e "guard" "${legacyPath}"`;
|
||||||
|
const merged = mergeHookManifests(
|
||||||
|
{
|
||||||
|
hooks: {
|
||||||
|
PostToolUse: [{ matcher: 'Edit|Write|MultiEdit', hooks: [
|
||||||
|
{ type: 'command', command: legacyCommand },
|
||||||
|
] }],
|
||||||
|
Stop: [{ hooks: [{ type: 'command', command: legacyCommand }] }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
hooks: {
|
||||||
|
PostToolUse: [{ matcher: 'Edit|Write|MultiEdit', hooks: [
|
||||||
|
{ type: 'command', command: freshCommand },
|
||||||
|
] }],
|
||||||
|
Stop: [{ hooks: [{ type: 'command', command: freshCommand }] }],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(merged.hooks.PostToolUse).toHaveLength(1);
|
||||||
|
expect(merged.hooks.Stop).toHaveLength(1);
|
||||||
|
expect(merged.hooks.PostToolUse[0].hooks[0].command).toBe(freshCommand);
|
||||||
|
expect(merged.hooks.Stop[0].hooks[0].command).toBe(freshCommand);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ─── Hook command path resolution (issue #399, part 1) ───────────────────────
|
// ─── Hook command path resolution (issue #399, part 1) ───────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user