fix(hooks): correct hooks format - string matcher, hooks wrapper

Format fixes based on Claude Code validation:
- matcher: string regex (e.g., "Edit|Write|MultiEdit") not object
- SessionStart/Stop: require { hooks: [...] } wrapper

Bumps to v0.1.42

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rUv 2025-12-30 17:23:37 +00:00
parent af1a362d04
commit ae928f0002
3 changed files with 21 additions and 13 deletions

View file

@ -48,13 +48,13 @@
"hooks": {
"PreToolUse": [
{
"matcher": { "tools": ["Edit", "Write", "MultiEdit"] },
"matcher": "Edit|Write|MultiEdit",
"hooks": [
{ "type": "command", "command": "npx ruvector hooks pre-edit \"$TOOL_INPUT_file_path\"" }
]
},
{
"matcher": { "tools": ["Bash"] },
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "npx ruvector hooks pre-command \"$TOOL_INPUT_command\"" }
]
@ -62,23 +62,31 @@
],
"PostToolUse": [
{
"matcher": { "tools": ["Edit", "Write", "MultiEdit"] },
"matcher": "Edit|Write|MultiEdit",
"hooks": [
{ "type": "command", "command": "npx ruvector hooks post-edit \"$TOOL_INPUT_file_path\"" }
]
},
{
"matcher": { "tools": ["Bash"] },
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "npx ruvector hooks post-command \"$TOOL_INPUT_command\"" }
]
}
],
"SessionStart": [
{ "type": "command", "command": "npx ruvector hooks session-start" }
{
"hooks": [
{ "type": "command", "command": "npx ruvector hooks session-start" }
]
}
],
"Stop": [
{ "type": "command", "command": "npx ruvector hooks session-end" }
{
"hooks": [
{ "type": "command", "command": "npx ruvector hooks session-end" }
]
}
],
"PreCompact": [
{

View file

@ -2277,15 +2277,15 @@ hooksCmd.command('init').description('Initialize hooks in current project').opti
}
settings.hooks = settings.hooks || {};
settings.hooks.PreToolUse = [
{ matcher: { tools: ['Edit', 'Write', 'MultiEdit'] }, hooks: [{ type: 'command', command: 'npx ruvector hooks pre-edit "$TOOL_INPUT_file_path"' }] },
{ matcher: { tools: ['Bash'] }, hooks: [{ type: 'command', command: 'npx ruvector hooks pre-command "$TOOL_INPUT_command"' }] }
{ matcher: 'Edit|Write|MultiEdit', hooks: [{ type: 'command', command: 'npx ruvector hooks pre-edit "$TOOL_INPUT_file_path"' }] },
{ matcher: 'Bash', hooks: [{ type: 'command', command: 'npx ruvector hooks pre-command "$TOOL_INPUT_command"' }] }
];
settings.hooks.PostToolUse = [
{ matcher: { tools: ['Edit', 'Write', 'MultiEdit'] }, hooks: [{ type: 'command', command: 'npx ruvector hooks post-edit "$TOOL_INPUT_file_path"' }] },
{ matcher: { tools: ['Bash'] }, hooks: [{ type: 'command', command: 'npx ruvector hooks post-command "$TOOL_INPUT_command"' }] }
{ matcher: 'Edit|Write|MultiEdit', hooks: [{ type: 'command', command: 'npx ruvector hooks post-edit "$TOOL_INPUT_file_path"' }] },
{ matcher: 'Bash', hooks: [{ type: 'command', command: 'npx ruvector hooks post-command "$TOOL_INPUT_command"' }] }
];
settings.hooks.SessionStart = [{ type: 'command', command: 'npx ruvector hooks session-start' }];
settings.hooks.Stop = [{ type: 'command', command: 'npx ruvector hooks session-end' }];
settings.hooks.SessionStart = [{ hooks: [{ type: 'command', command: 'npx ruvector hooks session-start' }] }];
settings.hooks.Stop = [{ hooks: [{ type: 'command', command: 'npx ruvector hooks session-end' }] }];
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
console.log(chalk.green('✅ Hooks initialized in .claude/settings.json'));
});

View file

@ -1,6 +1,6 @@
{
"name": "ruvector",
"version": "0.1.41",
"version": "0.1.42",
"description": "High-performance vector database for Node.js with automatic native/WASM fallback",
"main": "dist/index.js",
"types": "dist/index.d.ts",