mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-03-30 21:53:28 +08:00
* fix: auto-start development servers in tmux instead of blocking Replace blocking PreToolUse hook that used process.exit(2) with an auto-transform hook that: - Detects development server commands - Wraps them in tmux with directory-based session names - Runs server detached so Claude Code is not blocked - Provides confirmation message with log viewing instructions Benefits: - Development servers no longer block Claude Code execution - Each project gets its own tmux session (allows multiple projects) - Logs remain accessible via 'tmux capture-pane -t <session>' - Non-blocking: if tmux unavailable, command still runs (graceful fallback) Implementation: - Created scripts/hooks/auto-tmux-dev.js with transform logic - Updated hooks.json to reference the script instead of inline node command - Applied same fix to cached plugin version (1.4.1) for immediate effect * fix: resolve PR #344 code review issues in auto-tmux-dev.js Critical fixes: - Fix variable scope: declare 'input' before try block, not inside - Fix shell injection: sanitize sessionName and escape cmd for shell - Replace unused execFileSync import with spawnSync Improvements: - Add real Windows support using cmd /k window launcher - Add tmux availability check with graceful fallback - Update header comment to accurately describe platform support Test coverage: - Valid JSON input: transforms command for respective platform - Invalid JSON: passes through raw data unchanged - Unsupported tools: gracefully falls back to original command - Shell metacharacters: sanitized in sessionName, escaped in cmd * fix: correct cmd.exe escape sequence for double quotes on Windows Use double-quote doubling ('""') instead of backslash-escape ('\\\") for cmd.exe syntax. Backslash escaping is Unix convention and not recognized by cmd.exe. This fixes quoted arguments in dev server commands on Windows (e.g., 'npm run dev --filter="my-app"').
232 lines
9.0 KiB
JSON
232 lines
9.0 KiB
JSON
{
|
|
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
"hooks": {
|
|
"PreToolUse": [
|
|
{
|
|
"matcher": "Bash",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/auto-tmux-dev.js\""
|
|
}
|
|
],
|
|
"description": "Auto-start dev servers in tmux with directory-based session names"
|
|
},
|
|
{
|
|
"matcher": "Bash",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"pre:bash:tmux-reminder\" \"scripts/hooks/pre-bash-tmux-reminder.js\" \"strict\""
|
|
}
|
|
],
|
|
"description": "Reminder to use tmux for long-running commands"
|
|
},
|
|
{
|
|
"matcher": "Bash",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"pre:bash:git-push-reminder\" \"scripts/hooks/pre-bash-git-push-reminder.js\" \"strict\""
|
|
}
|
|
],
|
|
"description": "Reminder before git push to review changes"
|
|
},
|
|
{
|
|
"matcher": "Write",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"pre:write:doc-file-warning\" \"scripts/hooks/doc-file-warning.js\" \"standard,strict\""
|
|
}
|
|
],
|
|
"description": "Doc file warning: warn about non-standard documentation files (exit code 0; warns only)"
|
|
},
|
|
{
|
|
"matcher": "Edit|Write",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"pre:edit-write:suggest-compact\" \"scripts/hooks/suggest-compact.js\" \"standard,strict\""
|
|
}
|
|
],
|
|
"description": "Suggest manual compaction at logical intervals"
|
|
},
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags-shell.sh\" \"pre:observe\" \"skills/continuous-learning-v2/hooks/observe.sh\" \"standard,strict\"",
|
|
"async": true,
|
|
"timeout": 10
|
|
}
|
|
],
|
|
"description": "Capture tool use observations for continuous learning"
|
|
}
|
|
],
|
|
"PreCompact": [
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"pre:compact\" \"scripts/hooks/pre-compact.js\" \"standard,strict\""
|
|
}
|
|
],
|
|
"description": "Save state before context compaction"
|
|
}
|
|
],
|
|
"SessionStart": [
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "bash -lc 'input=$(cat); for root in \"${CLAUDE_PLUGIN_ROOT:-}\" \"$HOME/.claude/plugins/everything-claude-code\" \"$HOME/.claude/plugins/everything-claude-code@everything-claude-code\" \"$HOME/.claude/plugins/marketplace/everything-claude-code\"; do if [ -n \"$root\" ] && [ -f \"$root/scripts/hooks/run-with-flags.js\" ]; then printf \"%s\" \"$input\" | node \"$root/scripts/hooks/run-with-flags.js\" \"session:start\" \"scripts/hooks/session-start.js\" \"minimal,standard,strict\"; exit $?; fi; done; for parent in \"$HOME/.claude/plugins\" \"$HOME/.claude/plugins/marketplace\"; do if [ -d \"$parent\" ]; then candidate=$(find \"$parent\" -maxdepth 2 -type f -path \"*/scripts/hooks/run-with-flags.js\" 2>/dev/null | head -n 1); if [ -n \"$candidate\" ]; then root=$(dirname \"$(dirname \"$(dirname \"$candidate\")\")\"); printf \"%s\" \"$input\" | node \"$root/scripts/hooks/run-with-flags.js\" \"session:start\" \"scripts/hooks/session-start.js\" \"minimal,standard,strict\"; exit $?; fi; fi; done; echo \"[SessionStart] WARNING: could not resolve ECC plugin root; skipping session-start hook\" >&2; printf \"%s\" \"$input\"; exit 0'"
|
|
}
|
|
],
|
|
"description": "Load previous context and detect package manager on new session"
|
|
}
|
|
],
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "Bash",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"post:bash:pr-created\" \"scripts/hooks/post-bash-pr-created.js\" \"standard,strict\""
|
|
}
|
|
],
|
|
"description": "Log PR URL and provide review command after PR creation"
|
|
},
|
|
{
|
|
"matcher": "Bash",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"post:bash:build-complete\" \"scripts/hooks/post-bash-build-complete.js\" \"standard,strict\"",
|
|
"async": true,
|
|
"timeout": 30
|
|
}
|
|
],
|
|
"description": "Example: async hook for build analysis (runs in background without blocking)"
|
|
},
|
|
{
|
|
"matcher": "Edit|Write|MultiEdit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"post:quality-gate\" \"scripts/hooks/quality-gate.js\" \"standard,strict\"",
|
|
"async": true,
|
|
"timeout": 30
|
|
}
|
|
],
|
|
"description": "Run quality gate checks after file edits"
|
|
},
|
|
{
|
|
"matcher": "Edit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"post:edit:format\" \"scripts/hooks/post-edit-format.js\" \"standard,strict\""
|
|
}
|
|
],
|
|
"description": "Auto-format JS/TS files after edits (auto-detects Biome or Prettier)"
|
|
},
|
|
{
|
|
"matcher": "Edit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"post:edit:typecheck\" \"scripts/hooks/post-edit-typecheck.js\" \"standard,strict\""
|
|
}
|
|
],
|
|
"description": "TypeScript check after editing .ts/.tsx files"
|
|
},
|
|
{
|
|
"matcher": "Edit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"post:edit:console-warn\" \"scripts/hooks/post-edit-console-warn.js\" \"standard,strict\""
|
|
}
|
|
],
|
|
"description": "Warn about console.log statements after edits"
|
|
},
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags-shell.sh\" \"post:observe\" \"skills/continuous-learning-v2/hooks/observe.sh\" \"standard,strict\"",
|
|
"async": true,
|
|
"timeout": 10
|
|
}
|
|
],
|
|
"description": "Capture tool use results for continuous learning"
|
|
}
|
|
],
|
|
"Stop": [
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"stop:check-console-log\" \"scripts/hooks/check-console-log.js\" \"standard,strict\""
|
|
}
|
|
],
|
|
"description": "Check for console.log in modified files after each response"
|
|
},
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"stop:session-end\" \"scripts/hooks/session-end.js\" \"minimal,standard,strict\"",
|
|
"async": true,
|
|
"timeout": 10
|
|
}
|
|
],
|
|
"description": "Persist session state after each response (Stop carries transcript_path)"
|
|
},
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"stop:evaluate-session\" \"scripts/hooks/evaluate-session.js\" \"minimal,standard,strict\"",
|
|
"async": true,
|
|
"timeout": 10
|
|
}
|
|
],
|
|
"description": "Evaluate session for extractable patterns"
|
|
},
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"stop:cost-tracker\" \"scripts/hooks/cost-tracker.js\" \"minimal,standard,strict\"",
|
|
"async": true,
|
|
"timeout": 10
|
|
}
|
|
],
|
|
"description": "Track token and cost metrics per session"
|
|
}
|
|
],
|
|
"SessionEnd": [
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"session:end:marker\" \"scripts/hooks/session-end-marker.js\" \"minimal,standard,strict\""
|
|
}
|
|
],
|
|
"description": "Session end lifecycle marker (non-blocking)"
|
|
}
|
|
]
|
|
}
|
|
}
|