commit 8a3ade8edb989381b56d709aa1a554a61035b62f Author: Zhongwei Li Date: Sun Nov 30 08:57:23 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..83a03bf --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "claude-hook-advisor", + "description": "Intelligent command history tracking with automatic failure detection. Tracks all bash commands Claude runs (successful and failed) with semantic directory aliasing and command mapping.", + "version": "1.0.0", + "author": { + "name": "sirmews", + "url": "https://github.com/sirmews/claude-hook-advisor" + }, + "commands": [ + "./commands" + ], + "hooks": [ + "./hooks" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..30f245d --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# claude-hook-advisor + +Intelligent command history tracking with automatic failure detection. Tracks all bash commands Claude runs (successful and failed) with semantic directory aliasing and command mapping. diff --git a/commands/history-failures.md b/commands/history-failures.md new file mode 100644 index 0000000..92e4b18 --- /dev/null +++ b/commands/history-failures.md @@ -0,0 +1,13 @@ +--- +description: Show only failed bash commands from history +allowed-tools: Bash(claude-hook-advisor:*) +--- + +!claude-hook-advisor --history --failures --limit 20 + +The output above shows all commands that failed. Let me analyze these failures and: +1. Identify patterns in the errors +2. Suggest fixes for the failed commands +3. Explain why each command might have failed + +What would you like me to help with regarding these failures? diff --git a/commands/history-search.md b/commands/history-search.md new file mode 100644 index 0000000..47ea792 --- /dev/null +++ b/commands/history-search.md @@ -0,0 +1,10 @@ +--- +description: Search command history by pattern (usage: /history-search ) +allowed-tools: Bash(claude-hook-advisor:*) +--- + +!claude-hook-advisor --history --pattern "$ARGUMENTS" --limit 50 + +I've searched the command history for commands matching "$ARGUMENTS". The results above show all matching commands with their success/failure status. + +Let me help you understand these results or find specific commands you're looking for. diff --git a/commands/history-session.md b/commands/history-session.md new file mode 100644 index 0000000..fa7c864 --- /dev/null +++ b/commands/history-session.md @@ -0,0 +1,13 @@ +--- +description: Show command history for a specific session (usage: /history-session ) +allowed-tools: Bash(claude-hook-advisor:*) +--- + +!claude-hook-advisor --history --session "$1" --limit 100 + +The output above shows all commands from session "$1". This includes: +- All commands attempted in this session +- Success and failure status for each +- Complete timeline of command execution + +Let me analyze this session's activity and help you understand what happened. diff --git a/commands/history.md b/commands/history.md new file mode 100644 index 0000000..c14c69c --- /dev/null +++ b/commands/history.md @@ -0,0 +1,13 @@ +--- +description: Show recent bash command history (last 20 commands) +allowed-tools: Bash(claude-hook-advisor:*) +--- + +!claude-hook-advisor --history --limit 20 + +The command history above shows all recent bash commands I've executed. Each entry includes: +- ✓ for successful commands +- ✗ FAILED for commands that failed +- Timestamp, command, working directory, and session ID + +Let me analyze this history and answer any questions you have about it. diff --git a/commands/validate.md b/commands/validate.md new file mode 100644 index 0000000..d53c55b --- /dev/null +++ b/commands/validate.md @@ -0,0 +1,13 @@ +--- +description: Validate claude-hook-advisor installation and configuration +allowed-tools: Bash(claude-hook-advisor:*) +--- + +!claude-hook-advisor --validate + +The validation output above shows the health of your claude-hook-advisor installation: + +✓ = Working correctly +✗ = Needs attention + +Let me analyze any issues and suggest fixes. diff --git a/hooks/hooks.json b/hooks/hooks.json new file mode 100644 index 0000000..43d5cf2 --- /dev/null +++ b/hooks/hooks.json @@ -0,0 +1,36 @@ +{ + "hooks": { + "PreToolUse": [ + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "claude-hook-advisor --hook" + } + ] + } + ], + "PostToolUse": [ + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "claude-hook-advisor --hook" + } + ] + } + ], + "UserPromptSubmit": [ + { + "hooks": [ + { + "type": "command", + "command": "claude-hook-advisor --hook" + } + ] + } + ] + } +} diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..376269f --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,65 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:sirmews/claude-hook-advisor:plugin", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "b5cb593d6570fb2e2fcb4d129888f59818bae84e", + "treeHash": "46341b7395d5aa8c0481310a78410a2e1276a53a86c38bd94653de1bd84ad0dd", + "generatedAt": "2025-11-28T10:28:21.965367Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "claude-hook-advisor", + "description": "Intelligent command history tracking with automatic failure detection. Tracks all bash commands Claude runs (successful and failed) with semantic directory aliasing and command mapping.", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "caf2494f66df9a3ee6e345fe95c2f6815dcf5c24730f56d03a652134326b735a" + }, + { + "path": "hooks/hooks.json", + "sha256": "7179bc16f0d7c1ddbfacf6c728c448dddd2747cd4bf7d3e351f2057f6062f2d5" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "ca422c0e628d2c540fa2113b4ac7d7614a450c23e081aa0ade5c7cb0e1738d76" + }, + { + "path": "commands/history-search.md", + "sha256": "dca120651661d9e87a8e1d983010d10e8327bb8cfea1f9233653ac6914ba15fb" + }, + { + "path": "commands/history-failures.md", + "sha256": "cd917ef60e6fb51d974d3e8138003855682a4c908bd8bca30c1679efa8ff2fc2" + }, + { + "path": "commands/validate.md", + "sha256": "35cffdb2430a605e1bfd89a40729a8a4eb0ed39a291c7fdfad3e2b1c2693e1f4" + }, + { + "path": "commands/history.md", + "sha256": "589bada289d36cdaf2d46b1ddd6f48a50acd90276c9f2141d5efe43030ff58f2" + }, + { + "path": "commands/history-session.md", + "sha256": "b030381fb26d407c233e8a6366ac6b9cb627e9fdc7ca3d44879acbb861188583" + } + ], + "dirSha256": "46341b7395d5aa8c0481310a78410a2e1276a53a86c38bd94653de1bd84ad0dd" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file