Remove hooks from compounding-engineering plugin

Hooks add complexity and potential conflicts for users. The plugin provides more value through its specialized agents and commands without automated hooks.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Kieran Klaassen
2025-10-09 13:43:21 -07:00
parent 77de729c0b
commit a07fb0b72d
4 changed files with 2 additions and 126 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "compounding-engineering",
"version": "1.0.0",
"description": "AI-powered development tools that get smarter with every use. Make each unit of engineering work easier than the last. Includes 15 specialized agents, 6 commands, and automated hooks.",
"description": "AI-powered development tools that get smarter with every use. Make each unit of engineering work easier than the last. Includes 15 specialized agents and 6 commands.",
"author": {
"name": "Kieran Klaassen",
"url": "https://github.com/kieranklaassen"
@@ -31,7 +31,7 @@
"components": {
"agents": 15,
"commands": 6,
"hooks": 2
"hooks": 0
},
"agents": {
"reviewers": [
@@ -132,22 +132,6 @@
"resolve_todo_parallel"
]
},
"hooks": {
"pre_tool_use": [
{
"name": "block-main-push",
"description": "Prevents accidental pushes to main branch",
"matcher": "Bash",
"command": "hooks/block-main-push.rb"
},
{
"name": "run-linter",
"description": "Runs linter before certain operations",
"matcher": "Bash",
"command": "hooks/run-linter.rb"
}
]
},
"settings": {
"permissions": {
"bash_commands": [

View File

@@ -87,10 +87,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `/workflows/watch` - Monitor changes
- `/workflows/work` - Guided development workflow
#### Hooks (2 total)
- `block-main-push.rb` - Prevents accidental main branch pushes
- `run-linter.rb` - Automated linter execution
#### Plugin Infrastructure
- Complete plugin.json manifest with metadata
- Comprehensive README with usage examples

View File

@@ -1,71 +0,0 @@
#!/usr/bin/env ruby
require "json"
begin
input_data = JSON.parse(STDIN.read)
rescue JSON::ParserError => e
warn "Error: Invalid JSON input: #{e.message}"
exit 1
end
tool_name = input_data["tool_name"]
exit 0 unless tool_name == "Bash"
tool_input = input_data["tool_input"] || {}
command = tool_input["command"] || ""
exit 0 if command.empty?
# Extract just the git command part, ignoring commit messages in heredocs
# This prevents false positives when commit messages contain "main"
command_parts = command.strip.split("\n")[0] || command
normalized_command = command_parts.strip.downcase
# Only check for git push commands targeting the main branch
# More precise patterns to avoid false positives with branch names containing "main"
dangerous_patterns = [
/^git\s+push\s+\S+\s+main$/, # git push origin main
/^git\s+push\s+\S+\s+\S+:main$/, # git push origin feature:main
/^git\s+push\s+\S+\s+main\s+/, # git push origin main --force
/^git\s+push\s+.*\s+main:main/, # git push origin main:main
/^git\s+push\s+.*\bHEAD:main\b/, # git push origin HEAD:main
/^git\s+push\s+(-u|--set-upstream)\s+\S+\s+main/, # git push -u origin main
/^git\s+push\s+(-f|--force)\s+\S+\s+main/, # git push -f origin main
/^git\s+push\s+\S+\s+(-f|--force)\s+main/, # git push origin -f main
/^git\s+push\s+.*--all/ # git push --all (pushes all branches)
]
dangerous_command = dangerous_patterns.any? { |pattern| normalized_command.match?(pattern) }
if dangerous_command
warn <<~ERROR
This is blocked to prevent accidental commits to the main branch.
Please push to a feature branch instead.
ERROR
# Exit code 2 blocks the tool call and shows stderr to Claude
exit 2
end
if normalized_command.match?(/^git\s+push\s*$/) || normalized_command.match?(/^git\s+push\s+origin\s*$/)
project_dir = ENV["CLAUDE_PROJECT_DIR"] || input_data["cwd"] || Dir.pwd
current_branch = begin
`cd "#{project_dir}" && git branch --show-current 2>/dev/null`.strip
rescue
""
end
if current_branch.downcase == "main" || current_branch.empty?
current_branch.empty? ? "unknown/undetectable" : current_branch
warn <<~ERROR
This is blocked to prevent accidental commits to the main branch.
Please push to a feature branch instead.
ERROR
exit 2
end
end
exit 0

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env ruby
require "json"
# Read JSON input from stdin
input = JSON.parse(STDIN.read)
# Get the bash command being executed
command = input.dig("tool_input", "command") || ""
# Check if it's a git commit command
if command.match?(/\bgit\s+commit\b/i)
# Log what we're doing (visible in transcript mode)
warn "Git commit detected. Running standardrb --fix..."
# Run standardrb --fix
system("standardrb --fix")
# Run erb linter
system("erblint --lint-all --autocorrect")
# Check if standardrb succeeded
if $?.success?
warn "✓ Code formatted with standardrb"
exit 0 # Success - let the commit proceed
else
warn "⚠ standardrb --fix failed (exit code: #{$?.exitstatus})"
exit 1 # Non-blocking error - show warning but continue
end
else
# Not a git commit, just pass through
exit 0
end