@coding-agent-fabric/plugin-cursor-hooks
v0.1.3
Published
Plugin for managing Cursor hooks
Maintainers
Readme
@coding-agent-fabric/plugin-cursor-hooks
Plugin for managing Cursor IDE hooks.
Overview
This plugin enables installation and management of hooks for Cursor IDE, which execute shell commands in response to IDE events.
Supported Agents
cursor
Hook Types
Cursor supports various hook types:
onSave: Executed when a file is savedonCommit: Executed before a git commitonFileOpen: Executed when a file is openedonProjectOpen: Executed when a project is opened
Hook Configuration Format
Hooks are defined in JSON format:
{
"hookType": "onSave",
"filePattern": "**/*.ts",
"command": "trunk fmt ${FILE_PATH}",
"description": "Auto-format TypeScript files on save"
}Fields
hookType(required): The event type that triggers this hookcommand(required): Shell command to executefilePattern(optional): Glob pattern for files this hook applies todescription(optional): Human-readable description
Installation Paths
- Global:
~/.cursor/hooks/ - Project:
./.cursor/hooks/
Usage
# Install a hook
caf install local:./path/to/hooks --type cursor-hooks --agent cursor
# List installed hooks
caf list --type cursor-hooks
# Remove a hook
caf remove hook-name --type cursor-hooksExample Hooks
Auto-format on Save
{
"hookType": "onSave",
"filePattern": "**/*.{ts,tsx,js,jsx}",
"command": "trunk fmt ${FILE_PATH}",
"description": "Auto-format JavaScript/TypeScript files on save"
}Lint on Commit
{
"hookType": "onCommit",
"command": "trunk check --fix",
"description": "Run linter before commits"
}Welcome Message
{
"hookType": "onProjectOpen",
"command": "echo 'Welcome to the project!'",
"description": "Display welcome message when project opens"
}