@paulduvall/claude-dev-toolkit 0.0.1-alpha.14 → 0.0.1-alpha.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/hooks/README.md CHANGED
@@ -100,7 +100,7 @@ The following hooks provide logging, validation, and cleanup at various Claude C
100
100
  | `pre-commit-test-runner.sh` | PreToolUse (Bash) | Auto-detects test framework, blocks commits on failure |
101
101
  | `pre-write-security.sh` | PreToolUse (Write) | Security scan before file writes |
102
102
  | `verify-before-edit.sh` | PreToolUse (Edit/Write) | Warns about fabricated references (non-blocking) |
103
- | `on-error-debug.sh` | OnError | Debug context capture on errors |
103
+ | `on-error-debug.sh` | Manual invocation | Debug context capture on errors |
104
104
  | `subagent-trigger.sh` | PostToolUse (*) | Triggers subagent workflows |
105
105
  | `subagent-trigger-simple.sh` | PostToolUse (*) | Simplified subagent trigger |
106
106
 
@@ -11,7 +11,7 @@ set -uo pipefail
11
11
  _ARGUMENT_PARSER_LOADED=1
12
12
 
13
13
  # Source required modules
14
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
15
  source "$SCRIPT_DIR/config-constants.sh"
16
16
  source "$SCRIPT_DIR/error-handler.sh"
17
17
 
@@ -11,7 +11,7 @@ set -uo pipefail
11
11
  _CONTEXT_MANAGER_LOADED=1
12
12
 
13
13
  # Source required modules
14
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
15
  source "$SCRIPT_DIR/config-constants.sh"
16
16
  source "$SCRIPT_DIR/file-utils.sh"
17
17
  source "$SCRIPT_DIR/error-handler.sh"
@@ -11,7 +11,7 @@ set -uo pipefail
11
11
  _ERROR_HANDLER_LOADED=1
12
12
 
13
13
  # Source required modules
14
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
15
  source "$SCRIPT_DIR/config-constants.sh"
16
16
  source "$SCRIPT_DIR/file-utils.sh"
17
17
 
@@ -40,7 +40,7 @@ log_message() {
40
40
 
41
41
  log_info() {
42
42
  local message="$1"
43
- log_message "INFO" "$message"
43
+ log_message "INFO" "$message" >&2
44
44
  }
45
45
 
46
46
  log_warning() {
@@ -11,7 +11,7 @@ set -uo pipefail
11
11
  _EXECUTION_ENGINE_LOADED=1
12
12
 
13
13
  # Source required modules
14
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
15
  source "$SCRIPT_DIR/config-constants.sh"
16
16
  source "$SCRIPT_DIR/file-utils.sh"
17
17
  source "$SCRIPT_DIR/error-handler.sh"
@@ -12,7 +12,7 @@ set -uo pipefail
12
12
  _EXECUTION_RESULTS_LOADED=1
13
13
 
14
14
  # Source required modules
15
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
15
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
16
  source "$SCRIPT_DIR/config-constants.sh"
17
17
  source "$SCRIPT_DIR/file-utils.sh"
18
18
  source "$SCRIPT_DIR/error-handler.sh"
@@ -11,7 +11,7 @@ set -uo pipefail
11
11
  _EXECUTION_SIMULATION_LOADED=1
12
12
 
13
13
  # Source required modules
14
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
15
  source "$SCRIPT_DIR/config-constants.sh"
16
16
  source "$SCRIPT_DIR/file-utils.sh"
17
17
  source "$SCRIPT_DIR/error-handler.sh"
@@ -12,7 +12,7 @@ set -uo pipefail
12
12
  _FIELD_VALIDATORS_LOADED=1
13
13
 
14
14
  # Source required modules
15
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
15
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
16
  source "$SCRIPT_DIR/config-constants.sh"
17
17
  source "$SCRIPT_DIR/error-handler.sh"
18
18
 
@@ -11,7 +11,7 @@ set -uo pipefail
11
11
  _FILE_UTILS_LOADED=1
12
12
 
13
13
  # Source required modules
14
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
15
  source "$SCRIPT_DIR/config-constants.sh"
16
16
 
17
17
  ##################################
@@ -11,7 +11,7 @@ set -uo pipefail
11
11
  _SUBAGENT_DISCOVERY_LOADED=1
12
12
 
13
13
  # Source required modules
14
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
15
  source "$SCRIPT_DIR/config-constants.sh"
16
16
  source "$SCRIPT_DIR/file-utils.sh"
17
17
  source "$SCRIPT_DIR/error-handler.sh"
@@ -11,7 +11,7 @@ set -uo pipefail
11
11
  _SUBAGENT_VALIDATOR_LOADED=1
12
12
 
13
13
  # Source required modules
14
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
14
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
15
  source "$SCRIPT_DIR/config-constants.sh"
16
16
  source "$SCRIPT_DIR/file-utils.sh"
17
17
  source "$SCRIPT_DIR/error-handler.sh"
@@ -12,7 +12,7 @@ set -uo pipefail
12
12
  _VALIDATION_REPORTER_LOADED=1
13
13
 
14
14
  # Source required modules
15
- SCRIPT_DIR="${SCRIPT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
15
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
16
16
  source "$SCRIPT_DIR/config-constants.sh"
17
17
  source "$SCRIPT_DIR/error-handler.sh"
18
18
 
@@ -4,7 +4,7 @@ set -euo pipefail
4
4
  # Claude Code Hook: Error Handling Trigger
5
5
  #
6
6
  # Purpose: Lightweight trigger for automatic debugging assistance on errors
7
- # Trigger: OnError events or manual invocation during debugging sessions
7
+ # Trigger: Manual invocation or PostToolUse (no OnError hook event exists in Claude Code)
8
8
  # Approach: Capture error context and delegate to debug-specialist subagent
9
9
  #
10
10
  # This hook provides immediate debugging help by gathering error context
@@ -51,7 +51,7 @@ is_commit_command() {
51
51
  # Framework Detection
52
52
  ##################################
53
53
  detect_framework() {
54
- if [[ -f "pytest.ini" ]] || [[ -f "pyproject.toml" ]] && grep -q '\[tool.pytest' pyproject.toml 2>/dev/null; then
54
+ if [[ -f "pytest.ini" ]] || { [[ -f "pyproject.toml" ]] && grep -q '\[tool.pytest' pyproject.toml 2>/dev/null; }; then
55
55
  echo "pytest"
56
56
  elif [[ -f "package.json" ]] && grep -q '"test"' package.json 2>/dev/null; then
57
57
  if grep -qE '"(jest|vitest)' package.json 2>/dev/null; then
@@ -134,27 +134,31 @@ scan_file_content() {
134
134
  return 0
135
135
  fi
136
136
 
137
- log "Scanning file: $file_path"
138
-
137
+ # Redirect log output to stderr so it doesn't pollute stdout
138
+ # (callers capture stdout via command substitution for the violation count)
139
+ log "Scanning file: $file_path" >&2
140
+
139
141
  # Check each credential pattern
140
142
  for pattern_name in "${!CREDENTIAL_PATTERNS[@]}"; do
141
143
  local pattern="${CREDENTIAL_PATTERNS[$pattern_name]}"
142
-
143
- if echo "$content" | grep -qiP "$pattern"; then
144
- log_violation "$pattern_name detected in $file_path"
144
+
145
+ if echo "$content" | grep -qiP -e "$pattern"; then
146
+ log_violation "$pattern_name detected in $file_path" >&2
145
147
  violations+=("$pattern_name")
146
-
148
+
147
149
  # Extract the matched content for logging (but redact it)
148
- local matched_line=$(echo "$content" | grep -iP "$pattern" | head -1)
149
- local redacted_line=$(echo "$matched_line" | sed 's/[a-zA-Z0-9+/=]\{10,\}/[REDACTED]/g')
150
-
151
- log_violation "Pattern: $pattern_name, Line: $redacted_line"
152
-
150
+ local matched_line
151
+ matched_line=$(echo "$content" | grep -iP -e "$pattern" | head -1)
152
+ local redacted_line
153
+ redacted_line=$(echo "$matched_line" | sed 's/[a-zA-Z0-9+/=]\{10,\}/[REDACTED]/g')
154
+
155
+ log_violation "Pattern: $pattern_name, Line: $redacted_line" >&2
156
+
153
157
  # Notify security team
154
158
  notify_security_team "$pattern_name" "$file_path" "$redacted_line"
155
159
  fi
156
160
  done
157
-
161
+
158
162
  # Return violation count
159
163
  echo "${#violations[@]}"
160
164
  }
@@ -165,13 +169,13 @@ check_environment_leakage() {
165
169
 
166
170
  # Check for environment variable exposure patterns
167
171
  if echo "$content" | grep -qiP 'process\.env\.[A-Z_]*(?:KEY|SECRET|PASSWORD|TOKEN)'; then
168
- log_violation "Environment variable credential exposure detected"
172
+ log_violation "Environment variable credential exposure detected" >&2
169
173
  ((violations++))
170
174
  fi
171
-
175
+
172
176
  # Check for hardcoded production URLs with credentials
173
177
  if echo "$content" | grep -qiP 'https?://[^:]+:[^@]+@[^/]+'; then
174
- log_violation "URL with embedded credentials detected"
178
+ log_violation "URL with embedded credentials detected" >&2
175
179
  ((violations++))
176
180
  fi
177
181
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paulduvall/claude-dev-toolkit",
3
- "version": "0.0.1-alpha.14",
3
+ "version": "0.0.1-alpha.16",
4
4
  "description": "Custom commands toolkit for Claude Code - streamline your development workflow",
5
5
  "author": "Paul Duvall",
6
6
  "license": "MIT",
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: debug-specialist
2
3
  description: "Specialized debugging assistant with expertise in root cause analysis, error interpretation, and systematic troubleshooting"
3
4
  tags: ["debugging", "error-analysis", "troubleshooting", "performance"]
4
5
  tools: ["Read", "Bash", "Grep", "Edit", "Glob"]
@@ -1,22 +1,14 @@
1
1
  {
2
- "// Basic Claude Code settings.json template": "Copy to ~/.claude/settings.json",
3
- "// Based on official Claude Code documentation": "https://docs.anthropic.com/en/docs/claude-code/settings",
4
-
5
- "// Core tool permissions (replaces invalid 'allowedTools')": "",
6
2
  "permissions": {
7
3
  "allow": [
8
- "Edit(*)",
9
4
  "Bash(*)",
10
5
  "Read(*)",
6
+ "Edit(*)",
11
7
  "Write(*)",
12
- "MultiEdit(*)",
13
8
  "Glob(*)",
14
- "Grep(*)",
15
- "LS(*)"
9
+ "Grep(*)"
16
10
  ]
17
11
  },
18
-
19
- "// Basic hooks configuration": "",
20
12
  "hooks": {
21
13
  "PreToolUse": [
22
14
  {
@@ -30,15 +22,9 @@
30
22
  }
31
23
  ]
32
24
  },
33
-
34
- "// Standard Claude Code environment variables": "",
35
25
  "env": {
36
26
  "DISABLE_TELEMETRY": "1"
37
27
  },
38
-
39
- "// Optional: Include Claude co-authorship in git commits": "",
40
28
  "includeCoAuthoredBy": true,
41
-
42
- "// Optional: Custom retention for chat transcripts (days)": "",
43
29
  "cleanupPeriodDays": 30
44
- }
30
+ }
@@ -1,25 +1,15 @@
1
1
  {
2
- "// Comprehensive Claude Code settings.json template": "Copy to ~/.claude/settings.json",
3
- "// Based on official Claude Code documentation": "https://docs.anthropic.com/en/docs/claude-code/settings",
4
- "// Includes all advanced features and hook events": "",
5
-
6
- "// Comprehensive tool permissions": "",
7
2
  "permissions": {
8
3
  "allow": [
9
- "Edit(*)",
10
4
  "Bash(*)",
11
5
  "Read(*)",
6
+ "Edit(*)",
12
7
  "Write(*)",
13
- "MultiEdit(*)",
14
8
  "Glob(*)",
15
9
  "Grep(*)",
16
- "LS(*)",
17
- "Task(*)",
18
10
  "WebFetch(*)",
19
11
  "WebSearch(*)",
20
- "NotebookEdit(*)",
21
- "BashOutput(*)",
22
- "KillBash(*)"
12
+ "NotebookEdit(*)"
23
13
  ],
24
14
  "ask": [
25
15
  "Bash(sudo *)",
@@ -34,12 +24,10 @@
34
24
  "Edit(/etc/passwd)"
35
25
  ]
36
26
  },
37
-
38
- "// Comprehensive hooks covering all supported events": "",
39
27
  "hooks": {
40
28
  "PreToolUse": [
41
29
  {
42
- "matcher": "Edit|Write|MultiEdit",
30
+ "matcher": "Edit|Write",
43
31
  "hooks": [
44
32
  {
45
33
  "type": "command",
@@ -63,41 +51,12 @@
63
51
  ],
64
52
  "PostToolUse": []
65
53
  },
66
-
67
- "// Standard Claude Code environment variables": "",
68
54
  "env": {
69
- "// DO NOT commit real API keys. Set via: export ANTHROPIC_API_KEY=sk-ant-...": "",
70
- "ANTHROPIC_API_KEY": "${ANTHROPIC_API_KEY}",
71
55
  "DISABLE_TELEMETRY": "1",
72
- "ANTHROPIC_LOG": "info",
73
- "CLAUDE_PROJECT_DIR": "."
56
+ "ANTHROPIC_LOG": "info"
74
57
  },
75
-
76
- "// Advanced Claude Code configuration": "",
77
58
  "includeCoAuthoredBy": true,
78
59
  "cleanupPeriodDays": 30,
79
- "// Model options: claude-sonnet-4-6 (default), claude-opus-4-6 (most capable), claude-haiku-4-5-20251001 (fastest)": "",
80
60
  "model": "claude-sonnet-4-6",
81
-
82
- "// MCP server configuration": "",
83
- "enableAllProjectMcpServers": false,
84
- "enabledMcpjsonServers": [
85
- "approved-server-1",
86
- "approved-server-2"
87
- ],
88
- "disabledMcpjsonServers": [
89
- "blocked-server-1"
90
- ],
91
-
92
- "// Optional: Custom API key helper script": "",
93
- "apiKeyHelper": "~/.claude/scripts/get-api-key.sh",
94
-
95
- "// Optional: Force specific login method": "",
96
- "forceLoginMethod": "api-key",
97
-
98
- "// Optional: Custom status line configuration": "",
99
- "statusLine": {
100
- "enabled": true,
101
- "format": "Claude Code - Project: {project} | Model: {model} | Tools: {tools_count}"
102
- }
103
- }
61
+ "enableAllProjectMcpServers": false
62
+ }
@@ -28,12 +28,11 @@ hooks_configuration:
28
28
  blocking: false
29
29
  description: "Log file modifications"
30
30
 
31
- OnError:
32
- - hooks:
33
- - command: "~/.claude/hooks/on-error-debug.sh"
34
- blocking: false
35
- description: "Automatic debugging via debug-specialist subagent"
36
-
31
+ # NOTE: There is no "OnError" hook event in Claude Code's schema.
32
+ # Valid hook events: PreToolUse, PostToolUse, Notification, Stop,
33
+ # SubagentStop, UserPromptSubmit, PreCompact, SessionStart, SessionEnd.
34
+ # Use on-error-debug.sh via manual invocation or PostToolUse instead.
35
+
37
36
  custom:
38
37
  pre-commit:
39
38
  command: "~/.claude/hooks/pre-commit-quality.sh"
@@ -1,9 +1,4 @@
1
1
  {
2
- "// Security-focused Claude Code settings.json template": "Copy to ~/.claude/settings.json",
3
- "// Based on official Claude Code documentation": "https://docs.anthropic.com/en/docs/claude-code/settings",
4
- "// Includes comprehensive security controls and governance": "",
5
-
6
- "// Restrictive tool permissions for security": "",
7
2
  "permissions": {
8
3
  "allow": [
9
4
  "Read(*)",
@@ -16,7 +11,8 @@
16
11
  "Bash(npm run *)",
17
12
  "Bash(python -m *)",
18
13
  "Bash(node *)",
19
- "MultiEdit(*)"
14
+ "Glob(*)",
15
+ "Grep(*)"
20
16
  ],
21
17
  "deny": [
22
18
  "Bash(curl *)",
@@ -35,12 +31,10 @@
35
31
  "Read(~/.ssh/id_*)"
36
32
  ]
37
33
  },
38
-
39
- "// Comprehensive security hooks": "",
40
34
  "hooks": {
41
35
  "PreToolUse": [
42
36
  {
43
- "matcher": "Edit|Write|MultiEdit",
37
+ "matcher": "Edit|Write",
44
38
  "hooks": [
45
39
  {
46
40
  "type": "command",
@@ -63,17 +57,11 @@
63
57
  }
64
58
  ]
65
59
  },
66
-
67
- "// Standard Claude Code environment variables": "",
68
60
  "env": {
69
61
  "DISABLE_TELEMETRY": "1",
70
62
  "ANTHROPIC_LOG": "error"
71
63
  },
72
-
73
- "// Security-focused settings": "",
74
64
  "includeCoAuthoredBy": false,
75
65
  "cleanupPeriodDays": 7,
76
-
77
- "// Disable auto-approval of MCP servers for security": "",
78
66
  "enableAllProjectMcpServers": false
79
- }
67
+ }