Open
Conversation
…command functionality - Added new `agenthooks.go` file to manage hooks for AI agents (Claude, Cursor, Windsurf, Factory Droid, Gemini). - Introduced unified event handlers for agent idle states, tool calls, file writes, and user prompts. - Updated `hooks.go` to include management commands for agent hooks and integrated hidden dispatch commands for routing. - Updated `go.mod` and `go.sum` to include new dependencies and version upgrades for existing packages.
- Added new MCP command to start a Model Context Protocol server for AI assistant integration. - Implemented shell and prompt guard tools to check commands and scan for secrets, respectively. - Updated `agenthooks.go` to utilize the new guardrail functions. - Modified `go.mod` and `go.sum` to include new dependencies for MCP functionality.
- Updated comments and command descriptions to reflect that the hook functionality is specific to the Cursor agent. - Removed unused agent installation functions for Claude, Windsurf, and Factory Droid, streamlining the installation process to only configure Cursor hooks. - Adjusted the hook dispatch commands to exclusively handle Cursor events, enhancing clarity and maintainability.
…ulti-agent support Moves guardrail logic (shell guard, secret scanning, MCP server) out of ast-cli into the shared ast-cx-hooks library, and expands hook support from Cursor-only to Claude Code, Cursor, Windsurf, Factory Droid, and Gemini CLI. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the agent hooks feature to delegate guardrail logic (shell guard, secret scanning, MCP server) to the shared
ast-cx-hookslibrary, and expands agent support from Cursor-only to five AI coding agents.Changes
Agent Support Expansion
Guardrail Delegation
CheckShellCommand) and secret scanning (ScanForSecrets) were implemented directly inagenthooks.go;registerGuardrails()/registerPassThrough()lived here toogithub.com/CheckmarxDev/ast-cx-hooks/cx;agenthooks.gocallscxhooks.RegisterGuardrails()/cxhooks.RegisterPassThrough()MCP Server
internal/commands/mcp/usinggithub.com/mark3labs/mcp-gointernal/commands/mcp/package deleted; MCP server fromgithub.com/CheckmarxDev/ast-cx-hooks/mcpused instead (backed by the officialmodelcontextprotocol/go-sdk)Install Command
cx hooks agenthooks installpatched only~/.cursor/hooks.jsoninstall claude,install cursor, etc.) delegate tocxhooks.Installers[agent]Dependencies (
go.mod)github.com/mark3labs/mcp-gogithub.com/modelcontextprotocol/go-sdk(indirect),github.com/segmentio/asm,github.com/segmentio/encodinggolang-jwt/jwt/v5v5.2.2 → v5.3.1, variousgolang.org/x/*packagesFlow Diagram
Before
After
Testing
internal/commands/cover hook dispatch routingast-cx-hookslibrary./internal/commands/.scripts/up.shfor local unit tests