claude-code-templates 1.2.0 → 1.2.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/hook-scanner.js +123 -50
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-templates",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "CLI tool to setup Claude Code configurations with selective automation hooks for different programming languages",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -110,56 +110,129 @@ function getHooksFromSettings(settingsPath) {
110
110
  function getHookDescription(hook, matcher, type) {
111
111
  const command = hook.command || '';
112
112
 
113
- // Pre-defined descriptions for common hooks
114
- const descriptions = {
115
- // PreToolUse hooks
116
- 'jq -r': 'Log Bash commands to ~/.claude/bash-command-log.txt',
117
- 'console\\.log': 'Block files containing console.log statements',
118
- 'print(': 'Block Python files containing print statements',
119
- 'fmt.Print': 'Block Go files containing fmt.Print statements',
120
- 'println!': 'Block Rust files containing println! statements',
121
- 'npm audit': 'Check for vulnerable dependencies when modifying package.json',
122
- 'pip-audit': 'Check for vulnerable Python dependencies',
123
- 'cargo audit': 'Check for vulnerable Rust dependencies',
124
- 'go list': 'Check Go dependencies',
125
-
126
- // PostToolUse hooks
127
- 'prettier --write': 'Auto-format JavaScript/TypeScript files with Prettier',
128
- 'black': 'Auto-format Python files with Black',
129
- 'isort': 'Sort Python imports with isort',
130
- 'gofmt': 'Auto-format Go files with gofmt',
131
- 'goimports': 'Auto-format Go imports with goimports',
132
- 'rustfmt': 'Auto-format Rust files with rustfmt',
133
- 'tsc --noEmit': 'Run TypeScript type checking after edits',
134
- 'flake8': 'Run Python code quality checks with flake8',
135
- 'mypy': 'Run Python type checking with mypy',
136
- 'go vet': 'Run Go code analysis with go vet',
137
- 'cargo check': 'Run Rust code checking with cargo check',
138
- 'cargo clippy': 'Run Rust linting with clippy',
139
- 'import \\* from': 'Warn about wildcard imports (bad for tree-shaking)',
140
- 'npx jest': 'Run JavaScript/TypeScript tests automatically',
141
- 'pytest': 'Run Python tests automatically',
142
- 'go test': 'Run Go tests automatically',
143
- 'cargo test': 'Run Rust tests automatically',
144
-
145
- // Stop hooks
146
- 'eslint': 'Run ESLint on changed files before stopping',
147
- 'flake8.*git diff': 'Run Python linting on changed files',
148
- 'bandit': 'Run Python security analysis',
149
- 'go vet.*git diff': 'Run Go analysis on changed files',
150
- 'staticcheck': 'Run Go static analysis',
151
- 'cargo clippy.*git diff': 'Run Rust linting on changed files',
152
- 'bundlesize': 'Analyze bundle size impact of changes',
153
-
154
- // Notification hooks
155
- 'notifications.log': 'Log Claude Code notifications'
156
- };
157
-
158
- // Try to match command with known descriptions
159
- for (const [pattern, description] of Object.entries(descriptions)) {
160
- if (command.includes(pattern)) {
161
- return description;
162
- }
113
+ // Extract key patterns for more specific descriptions
114
+ if (command.includes('jq -r') && command.includes('bash-command-log')) {
115
+ return 'Log all Bash commands for debugging';
116
+ }
117
+
118
+ if (command.includes('console\\.log')) {
119
+ return 'Block console.log statements in JS/TS files';
120
+ }
121
+
122
+ if (command.includes('print(') && command.includes('py$')) {
123
+ return 'Block print() statements in Python files';
124
+ }
125
+
126
+ if (command.includes('fmt.Print') && command.includes('go$')) {
127
+ return 'Block fmt.Print statements in Go files';
128
+ }
129
+
130
+ if (command.includes('println!') && command.includes('rs$')) {
131
+ return 'Block println! macros in Rust files';
132
+ }
133
+
134
+ if (command.includes('npm audit') || command.includes('pip-audit') || command.includes('cargo audit')) {
135
+ return 'Security audit for dependencies';
136
+ }
137
+
138
+ if (command.includes('prettier --write')) {
139
+ return 'Auto-format JS/TS files with Prettier';
140
+ }
141
+
142
+ if (command.includes('black') && command.includes('py$')) {
143
+ return 'Auto-format Python files with Black';
144
+ }
145
+
146
+ if (command.includes('isort') && command.includes('py$')) {
147
+ return 'Auto-sort Python imports with isort';
148
+ }
149
+
150
+ if (command.includes('gofmt') && command.includes('go$')) {
151
+ return 'Auto-format Go files with gofmt';
152
+ }
153
+
154
+ if (command.includes('goimports')) {
155
+ return 'Auto-format Go imports with goimports';
156
+ }
157
+
158
+ if (command.includes('rustfmt') && command.includes('rs$')) {
159
+ return 'Auto-format Rust files with rustfmt';
160
+ }
161
+
162
+ if (command.includes('tsc --noEmit')) {
163
+ return 'Run TypeScript type checking';
164
+ }
165
+
166
+ if (command.includes('flake8') && !command.includes('git diff')) {
167
+ return 'Run Python linting with flake8';
168
+ }
169
+
170
+ if (command.includes('mypy')) {
171
+ return 'Run Python type checking with mypy';
172
+ }
173
+
174
+ if (command.includes('go vet') && !command.includes('git diff')) {
175
+ return 'Run Go static analysis with go vet';
176
+ }
177
+
178
+ if (command.includes('cargo check')) {
179
+ return 'Run Rust compilation checks';
180
+ }
181
+
182
+ if (command.includes('cargo clippy') && !command.includes('git diff')) {
183
+ return 'Run Rust linting with clippy';
184
+ }
185
+
186
+ if (command.includes('import \\* from')) {
187
+ return 'Warn about wildcard imports';
188
+ }
189
+
190
+ if (command.includes('jest') || command.includes('vitest')) {
191
+ return 'Auto-run tests for modified files';
192
+ }
193
+
194
+ if (command.includes('pytest')) {
195
+ return 'Auto-run Python tests for modified files';
196
+ }
197
+
198
+ if (command.includes('go test')) {
199
+ return 'Auto-run Go tests for modified files';
200
+ }
201
+
202
+ if (command.includes('cargo test')) {
203
+ return 'Auto-run Rust tests for modified files';
204
+ }
205
+
206
+ if (command.includes('eslint') && command.includes('git diff')) {
207
+ return 'Run ESLint on changed files';
208
+ }
209
+
210
+ if (command.includes('flake8') && command.includes('git diff')) {
211
+ return 'Run Python linting on changed files';
212
+ }
213
+
214
+ if (command.includes('bandit')) {
215
+ return 'Run Python security analysis';
216
+ }
217
+
218
+ if (command.includes('go vet') && command.includes('git diff')) {
219
+ return 'Run Go analysis on changed files';
220
+ }
221
+
222
+ if (command.includes('staticcheck')) {
223
+ return 'Run Go static analysis on changed files';
224
+ }
225
+
226
+ if (command.includes('cargo clippy') && command.includes('git diff')) {
227
+ return 'Run Rust linting on changed files';
228
+ }
229
+
230
+ if (command.includes('bundlesize') || command.includes('webpack-bundle-analyzer')) {
231
+ return 'Analyze bundle size impact';
232
+ }
233
+
234
+ if (command.includes('notifications.log')) {
235
+ return 'Log Claude Code notifications';
163
236
  }
164
237
 
165
238
  // Generate description based on command analysis