mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-08-08 00:08:36 +02:00
Internal accuracy pass against v2.1.220 — no missing upstream features, but broken example code, disagreeing counts, and metadata drift.
Functional fixes: pre-commit.sh now exits 2 so it actually blocks; dependency-check.sh reads file_path from stdin JSON instead of $1; database-mcp.json uses ${DATABASE_URL}; broken fences repaired; three command templates had invalid skill names.
Factual corrections: /fork and /subtask unswapped and /subtask added; /fewer-permission-prompts; permissions.defaultMode; dontAsk/auto unreversed; 31 hook events verified name-by-name; subagent depth 3; skill precedence enterprise > project > personal; /output-style removed not deprecated; permissionDecision gained defer.
Follow-up review fixed defects the pass left behind: zh/vi headers claiming 31 events above 25-name lists, a surviving hardcoded DB credential in the MCP README examples, an unbalanced fence swallowing a metadata footer, and non-canonical tool names. All four translated CATALOG summary tables were recounted so their arithmetic holds.
Full detail in CHANGELOG.md under v2.1.220-r2.
32 lines
929 B
Bash
32 lines
929 B
Bash
#!/bin/bash
|
|
# Log all bash commands
|
|
# Hook: PostToolUse (matcher: Bash)
|
|
#
|
|
# Reads the executed command from stdin JSON and logs it to a file.
|
|
#
|
|
# Compatible with: macOS, Linux, Windows (Git Bash)
|
|
|
|
# Read JSON input from stdin (Claude Code hook protocol)
|
|
INPUT=$(cat)
|
|
|
|
# Extract the bash command from tool_input
|
|
# Note: sed [^"]* stops at escaped quotes in JSON; for commands with double-quoted
|
|
# strings, only the portion up to the first \" will be captured — this is a known
|
|
# limitation of sed-based JSON parsing and is acceptable for logging purposes.
|
|
COMMAND=$(echo "$INPUT" | sed -n 's/.*"command"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)
|
|
|
|
if [ -z "$COMMAND" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
TIMESTAMP=$(date "+%Y-%m-%d %H:%M:%S")
|
|
LOGFILE="$HOME/.claude/bash-commands.log"
|
|
|
|
# Create log directory if it doesn't exist
|
|
mkdir -p "$(dirname "$LOGFILE")"
|
|
|
|
# Log the command
|
|
echo "[$TIMESTAMP] $COMMAND" >> "$LOGFILE"
|
|
|
|
exit 0
|