claude-code-templates 1.4.3 → 1.5.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.
- package/bin/create-claude-config.js +4 -1
- package/package.json +10 -3
- package/src/analytics.js +739 -0
- package/src/hook-stats.js +258 -0
- package/src/index.js +23 -2
- package/src/mcp-stats.js +321 -0
- package/README.md +0 -436
package/README.md
DELETED
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
# Claude Code Templates Installer
|
|
2
|
-
|
|
3
|
-
A CLI tool to quickly setup Claude Code configurations for different programming languages and frameworks. No installation required - just use `npx`!
|
|
4
|
-
|
|
5
|
-
## 📋 How to Use
|
|
6
|
-
|
|
7
|
-
### Step 1: Navigate to Your Project
|
|
8
|
-
```bash
|
|
9
|
-
cd your-project-directory
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
### Step 2: Run the Installer
|
|
13
|
-
```bash
|
|
14
|
-
npx claude-code-templates
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Step 3: Follow the Interactive Setup
|
|
18
|
-
The installer will:
|
|
19
|
-
1. 🔍 **Auto-detect** your project type (JavaScript, Python, etc.)
|
|
20
|
-
2. 🎯 **Ask about frameworks** (React, Django, Flask, etc.)
|
|
21
|
-
3. 📋 **Let you choose commands** (testing, linting, debugging)
|
|
22
|
-
4. 🔧 **Let you select automation hooks** (formatting, type checking, etc.)
|
|
23
|
-
5. ✅ **Confirm before installing**
|
|
24
|
-
|
|
25
|
-
### Step 4: Start Using Claude Code
|
|
26
|
-
```bash
|
|
27
|
-
claude
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## 💡 Usage Examples
|
|
31
|
-
|
|
32
|
-
### Interactive Setup (Recommended)
|
|
33
|
-
```bash
|
|
34
|
-
cd my-react-app
|
|
35
|
-
npx claude-code-templates
|
|
36
|
-
# Follow the prompts - it will detect React automatically!
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Quick Setup for Specific Languages
|
|
40
|
-
```bash
|
|
41
|
-
# React project
|
|
42
|
-
cd my-react-app
|
|
43
|
-
npx claude-code-templates --language javascript-typescript --framework react
|
|
44
|
-
|
|
45
|
-
# Python Django project
|
|
46
|
-
cd my-django-app
|
|
47
|
-
npx claude-code-templates --language python --framework django
|
|
48
|
-
|
|
49
|
-
# Node.js API
|
|
50
|
-
cd my-api
|
|
51
|
-
npx claude-code-templates --language javascript-typescript --framework node
|
|
52
|
-
|
|
53
|
-
# Generic Python project
|
|
54
|
-
cd my-python-project
|
|
55
|
-
npx claude-code-templates --language python
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Advanced Options
|
|
59
|
-
```bash
|
|
60
|
-
# Skip all prompts and use defaults
|
|
61
|
-
npx claude-code-templates --yes
|
|
62
|
-
|
|
63
|
-
# See what would be installed without actually installing
|
|
64
|
-
npx claude-code-templates --dry-run
|
|
65
|
-
|
|
66
|
-
# Install to a different directory
|
|
67
|
-
npx claude-code-templates --directory /path/to/project
|
|
68
|
-
|
|
69
|
-
# Get help
|
|
70
|
-
npx claude-code-templates --help
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## 🔄 Alternative Commands
|
|
74
|
-
|
|
75
|
-
All these commands work exactly the same way:
|
|
76
|
-
```bash
|
|
77
|
-
npx claude-code-templates # ✅ Recommended (package name)
|
|
78
|
-
npx claude-code-template # Singular alias
|
|
79
|
-
npx create-claude-config # Create-style command
|
|
80
|
-
npx claude-init # Short alias
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## ⚡ No Installation Required
|
|
84
|
-
|
|
85
|
-
**Why use `npx`?**
|
|
86
|
-
- ✅ Always gets the latest version
|
|
87
|
-
- ✅ No global installation needed
|
|
88
|
-
- ✅ Works on any machine with Node.js
|
|
89
|
-
- ✅ Follows npm best practices
|
|
90
|
-
|
|
91
|
-
If you prefer global installation:
|
|
92
|
-
```bash
|
|
93
|
-
npm install -g claude-code-templates
|
|
94
|
-
create-claude-config
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Supported Languages
|
|
98
|
-
|
|
99
|
-
- **Common** - Universal configuration for any project
|
|
100
|
-
- **JavaScript/TypeScript** - Modern JS/TS development with frameworks
|
|
101
|
-
- **Python** - Python development with popular frameworks
|
|
102
|
-
- **Rust** - Rust development with Cargo and clippy
|
|
103
|
-
- **Go** - Go development with modules and testing
|
|
104
|
-
|
|
105
|
-
## Supported Frameworks
|
|
106
|
-
|
|
107
|
-
### JavaScript/TypeScript
|
|
108
|
-
- React
|
|
109
|
-
- Vue.js
|
|
110
|
-
- Angular
|
|
111
|
-
- Node.js
|
|
112
|
-
|
|
113
|
-
### Python
|
|
114
|
-
- Django
|
|
115
|
-
- Flask
|
|
116
|
-
- FastAPI
|
|
117
|
-
|
|
118
|
-
## Features
|
|
119
|
-
|
|
120
|
-
- 🔍 **Auto-detection** - Automatically detects your project type
|
|
121
|
-
- 🎯 **Framework-specific** - Includes framework-specific commands and configurations
|
|
122
|
-
- 🔧 **Selective automation hooks** - Choose which automation features to enable
|
|
123
|
-
- 💾 **Backup existing files** - Safely backs up existing CLAUDE.md and .claude directories
|
|
124
|
-
- ⚙️ **Customizable** - Interactive prompts for command and hook selection
|
|
125
|
-
- 🚀 **Quick setup** - Get started with Claude Code in seconds
|
|
126
|
-
- 🤖 **Post-installation validation** - Claude Code automatically reviews your setup
|
|
127
|
-
|
|
128
|
-
## 🔧 Automation Hooks
|
|
129
|
-
|
|
130
|
-
The CLI allows you to selectively enable automation hooks that enhance your development workflow:
|
|
131
|
-
|
|
132
|
-
### JavaScript/TypeScript Hooks
|
|
133
|
-
- **Console.log Detection** - Prevents committing debug statements
|
|
134
|
-
- **Prettier Auto-formatting** - Automatically formats code on save
|
|
135
|
-
- **TypeScript Type Checking** - Validates types after each edit
|
|
136
|
-
- **Import Validation** - Warns about performance-impacting wildcard imports
|
|
137
|
-
- **Auto-testing** - Runs relevant tests when files change
|
|
138
|
-
- **ESLint Integration** - Lints code before session ends
|
|
139
|
-
|
|
140
|
-
### Python Hooks
|
|
141
|
-
- **Print Statement Detection** - Warns about debug print statements
|
|
142
|
-
- **Black Auto-formatting** - Formats Python code automatically
|
|
143
|
-
- **Import Sorting** - Organizes imports with isort
|
|
144
|
-
- **Flake8 Linting** - Checks code quality standards
|
|
145
|
-
- **MyPy Type Checking** - Validates type hints
|
|
146
|
-
- **Security Auditing** - Scans for vulnerabilities with bandit
|
|
147
|
-
|
|
148
|
-
### Go Hooks
|
|
149
|
-
- **Print Statement Detection** - Warns about fmt.Print statements
|
|
150
|
-
- **Auto-formatting** - Formats code with gofmt and goimports
|
|
151
|
-
- **Go Vet Analysis** - Runs static analysis checks
|
|
152
|
-
- **Dependency Checking** - Lists and validates dependencies
|
|
153
|
-
- **Auto-testing** - Runs tests for modified files
|
|
154
|
-
|
|
155
|
-
### Rust Hooks
|
|
156
|
-
- **Print Macro Detection** - Warns about println! statements
|
|
157
|
-
- **Rustfmt Formatting** - Automatically formats Rust code
|
|
158
|
-
- **Cargo Check** - Validates code compilation
|
|
159
|
-
- **Clippy Linting** - Runs Rust's built-in linter
|
|
160
|
-
- **Security Auditing** - Checks for vulnerable dependencies
|
|
161
|
-
|
|
162
|
-
## What Gets Installed
|
|
163
|
-
|
|
164
|
-
### Core Files
|
|
165
|
-
- `CLAUDE.md` - Main configuration file for Claude Code
|
|
166
|
-
- `.claude/settings.json` - Language-specific settings with selected automation hooks
|
|
167
|
-
- `.claude/commands/` - Custom commands for common tasks
|
|
168
|
-
- `.mcp.json` - Model Context Protocol server configurations
|
|
169
|
-
|
|
170
|
-
### Automation Hooks
|
|
171
|
-
Each language template includes selectable automation hooks for:
|
|
172
|
-
- **PreToolUse**: Code quality checks before actions (e.g., detecting console.log statements)
|
|
173
|
-
- **PostToolUse**: Automatic formatting and validation after edits (e.g., Prettier, ESLint, type checking)
|
|
174
|
-
- **Stop**: Final checks before session ends (e.g., linting changed files, bundle analysis)
|
|
175
|
-
- **Notification**: Logging and monitoring of Claude Code activities
|
|
176
|
-
|
|
177
|
-
### MCP Servers (Model Context Protocol)
|
|
178
|
-
Configure external tools and services to extend Claude's capabilities:
|
|
179
|
-
- **IDE Integration** - VS Code language diagnostics and Jupyter kernel execution
|
|
180
|
-
- **Web Search** - Real-time web search for up-to-date information and documentation
|
|
181
|
-
- **Filesystem Tools** - Advanced file operations, monitoring, and directory management
|
|
182
|
-
- **Database Tools** - Database connections, schema inspection, and query execution
|
|
183
|
-
|
|
184
|
-
MCP servers are configured in `.mcp.json` and enable Claude to:
|
|
185
|
-
- Execute code in VS Code or Jupyter environments
|
|
186
|
-
- Search the web for current information
|
|
187
|
-
- Perform advanced file system operations
|
|
188
|
-
- Connect to databases and run queries
|
|
189
|
-
|
|
190
|
-
### Language-Specific Commands
|
|
191
|
-
Each language template includes optimized commands for:
|
|
192
|
-
- Testing (Jest, pytest, Cargo test, Go test)
|
|
193
|
-
- Linting and formatting (ESLint/Prettier, Black/flake8, clippy/rustfmt, gofmt/go vet)
|
|
194
|
-
- Building and deployment
|
|
195
|
-
- Debugging
|
|
196
|
-
- Framework-specific operations
|
|
197
|
-
|
|
198
|
-
## 📱 What Happens During Setup
|
|
199
|
-
|
|
200
|
-
### Interactive Experience
|
|
201
|
-
```bash
|
|
202
|
-
$ npx claude-code-templates
|
|
203
|
-
|
|
204
|
-
🚀 Setting up Claude Code configuration...
|
|
205
|
-
Target directory: /path/to/your/project
|
|
206
|
-
✔ Project detection complete
|
|
207
|
-
🔤 Select your programming language: (Use arrow keys)
|
|
208
|
-
❯ JavaScript/TypeScript
|
|
209
|
-
Python
|
|
210
|
-
Common (Language-agnostic)
|
|
211
|
-
Rust (Coming Soon)
|
|
212
|
-
Go (Coming Soon)
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Step-by-Step Walkthrough
|
|
216
|
-
|
|
217
|
-
1. **Project Detection** 📡
|
|
218
|
-
```
|
|
219
|
-
✔ Project detection complete
|
|
220
|
-
```
|
|
221
|
-
- Scans your project for `package.json`, `requirements.txt`, etc.
|
|
222
|
-
- Auto-suggests the best language template
|
|
223
|
-
|
|
224
|
-
2. **Language Selection** 🔤
|
|
225
|
-
```
|
|
226
|
-
🔤 Select your programming language: JavaScript/TypeScript
|
|
227
|
-
```
|
|
228
|
-
- Choose from available languages
|
|
229
|
-
- Auto-selected based on detection
|
|
230
|
-
|
|
231
|
-
3. **Framework Selection** 🎯
|
|
232
|
-
```
|
|
233
|
-
🎯 Select your framework (optional): React
|
|
234
|
-
```
|
|
235
|
-
- Shows relevant frameworks for your language
|
|
236
|
-
- Auto-detected from dependencies
|
|
237
|
-
|
|
238
|
-
4. **Command Selection** 📋
|
|
239
|
-
```
|
|
240
|
-
📋 Select commands to include (use space to select):
|
|
241
|
-
◉ Enhanced testing commands
|
|
242
|
-
◉ Code linting and formatting
|
|
243
|
-
◯ Git hooks integration
|
|
244
|
-
◯ Debugging helpers
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
5. **Hook Selection** 🔧
|
|
248
|
-
```
|
|
249
|
-
🔧 Select automation hooks to include (use space to select):
|
|
250
|
-
◉ PreToolUse: Block files containing console.log statements
|
|
251
|
-
◉ PostToolUse: Auto-format JavaScript/TypeScript files with Prettier
|
|
252
|
-
◉ PostToolUse: Run TypeScript type checking after edits
|
|
253
|
-
◯ PostToolUse: Run tests automatically for modified files
|
|
254
|
-
◉ Stop: Run ESLint on changed files before stopping
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
6. **MCP Server Selection** 🔧
|
|
258
|
-
```
|
|
259
|
-
🔧 Select MCP servers to include (use space to select):
|
|
260
|
-
◉ IDE Integration - VS Code language diagnostics and code execution
|
|
261
|
-
◉ Web Search - Search the web for up-to-date information
|
|
262
|
-
◯ Filesystem Tools - Advanced file operations and monitoring
|
|
263
|
-
◯ Database Tools - Database connection and query capabilities
|
|
264
|
-
```
|
|
265
|
-
- Choose Model Context Protocol servers to extend Claude's capabilities
|
|
266
|
-
- IDE Integration provides VS Code diagnostics and Jupyter kernel execution
|
|
267
|
-
- Web Search enables real-time web searches within Claude conversations
|
|
268
|
-
- Additional tools for filesystem operations and database management
|
|
269
|
-
|
|
270
|
-
7. **Final Confirmation** 🚀
|
|
271
|
-
```
|
|
272
|
-
🚀 Setup Claude Code for javascript-typescript with react (5 commands) (9 hooks) (4 MCP)? (Y/n)
|
|
273
|
-
```
|
|
274
|
-
- Review your choices including selected commands, hooks, and MCP servers
|
|
275
|
-
- Shows total count of each component being installed
|
|
276
|
-
- Type 'n' to cancel, 'y' or Enter to proceed
|
|
277
|
-
|
|
278
|
-
8. **Installation** 📁
|
|
279
|
-
```
|
|
280
|
-
📋 Existing CLAUDE.md backed up to CLAUDE.md.backup
|
|
281
|
-
✓ Copied javascript-typescript/CLAUDE.md → CLAUDE.md
|
|
282
|
-
✓ Copied base configuration and commands javascript-typescript/.claude → .claude
|
|
283
|
-
✓ Copied javascript-typescript/.mcp.json → .mcp.json (with selected MCPs)
|
|
284
|
-
✓ Copied framework commands javascript-typescript/examples/react-app/.claude/commands → .claude/commands
|
|
285
|
-
🔧 Installed 9 automation hooks
|
|
286
|
-
🔧 Installed 4 MCP servers
|
|
287
|
-
✅ Claude Code configuration setup complete!
|
|
288
|
-
📚 Next steps:
|
|
289
|
-
1. Review the generated CLAUDE.md file
|
|
290
|
-
2. Customize the configuration for your project
|
|
291
|
-
3. Start using Claude Code with: claude
|
|
292
|
-
💡 Language-specific features for javascript-typescript have been configured
|
|
293
|
-
🎯 Framework-specific commands for react are available
|
|
294
|
-
🔧 9 automation hooks have been configured
|
|
295
|
-
🔧 4 MCP servers have been configured
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
9. **Configuration Validation** 🤖
|
|
299
|
-
```
|
|
300
|
-
🔍 Post-Installation Validation
|
|
301
|
-
Claude Code can now review the installed configuration to ensure everything is properly set up.
|
|
302
|
-
🤖 Would you like Claude Code to review and validate the installation? (Y/n)
|
|
303
|
-
```
|
|
304
|
-
- **Automatic validation**: Claude Code offers to review your installation
|
|
305
|
-
- **Smart analysis**: Checks CLAUDE.md, settings.json, commands, and MCP configuration
|
|
306
|
-
- **Project-specific**: Validates settings match your language and framework
|
|
307
|
-
- **Optional**: You can skip and run `claude` manually later
|
|
308
|
-
- **Helpful suggestions**: Provides optimization recommendations for your setup
|
|
309
|
-
|
|
310
|
-
## 🛡️ Safe Installation
|
|
311
|
-
|
|
312
|
-
- **Backup Protection**: Existing files are safely backed up
|
|
313
|
-
- **Confirmation Required**: Always asks before making changes
|
|
314
|
-
- **Dry Run Option**: Preview changes with `--dry-run`
|
|
315
|
-
- **Cancel Anytime**: Press Ctrl+C or answer 'No' to cancel
|
|
316
|
-
|
|
317
|
-
## CLI Options
|
|
318
|
-
|
|
319
|
-
| Option | Description | Example |
|
|
320
|
-
|--------|-------------|---------|
|
|
321
|
-
| `-l, --language` | Specify programming language | `--language python` |
|
|
322
|
-
| `-f, --framework` | Specify framework | `--framework react` |
|
|
323
|
-
| `-d, --directory` | Target directory | `--directory /path/to/project` |
|
|
324
|
-
| `-y, --yes` | Skip prompts and use defaults | `--yes` |
|
|
325
|
-
| `--dry-run` | Show what would be copied | `--dry-run` |
|
|
326
|
-
| `--help` | Show help information | `--help` |
|
|
327
|
-
|
|
328
|
-
## Development
|
|
329
|
-
|
|
330
|
-
### Setup for Contributing
|
|
331
|
-
```bash
|
|
332
|
-
git clone https://github.com/davila7/claude-code-templates.git
|
|
333
|
-
cd claude-code-templates/cli-tool
|
|
334
|
-
npm install
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
### Local Development
|
|
338
|
-
```bash
|
|
339
|
-
# Link the package for local testing
|
|
340
|
-
npm link
|
|
341
|
-
|
|
342
|
-
# Test locally (will use your local changes)
|
|
343
|
-
claude-code-templates
|
|
344
|
-
|
|
345
|
-
# Test with specific options
|
|
346
|
-
claude-code-templates --language python --framework django
|
|
347
|
-
|
|
348
|
-
# Run test suite
|
|
349
|
-
npm test
|
|
350
|
-
|
|
351
|
-
# Unlink when done
|
|
352
|
-
npm unlink -g claude-code-templates
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
### Testing Changes
|
|
356
|
-
```bash
|
|
357
|
-
# Run the comprehensive test suite
|
|
358
|
-
npm test
|
|
359
|
-
|
|
360
|
-
# Test specific scenarios manually
|
|
361
|
-
npm start -- --dry-run --language javascript-typescript --framework react
|
|
362
|
-
npm start -- --dry-run --language python --framework django
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
### Project Structure
|
|
366
|
-
```
|
|
367
|
-
cli-tool/
|
|
368
|
-
├── src/ # Source code
|
|
369
|
-
│ ├── command-scanner.js # Scans and loads commands
|
|
370
|
-
│ ├── file-operations.js # Handles file copying
|
|
371
|
-
│ ├── hook-scanner.js # Manages automation hooks
|
|
372
|
-
│ ├── index.js # Main entry point
|
|
373
|
-
│ ├── prompts.js # Interactive CLI prompts
|
|
374
|
-
│ ├── templates.js # Template configuration
|
|
375
|
-
│ └── utils.js # Utility functions
|
|
376
|
-
├── templates/ # Language and framework templates
|
|
377
|
-
│ ├── common/
|
|
378
|
-
│ ├── javascript-typescript/
|
|
379
|
-
│ ├── python/
|
|
380
|
-
│ ├── go/
|
|
381
|
-
│ └── rust/
|
|
382
|
-
└── bin/ # Executable scripts
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
## Contributing
|
|
386
|
-
|
|
387
|
-
We welcome contributions! Here's how to get started:
|
|
388
|
-
|
|
389
|
-
### 1. Fork & Clone
|
|
390
|
-
```bash
|
|
391
|
-
# Fork the repository on GitHub, then:
|
|
392
|
-
git clone https://github.com/your-username/claude-code-templates.git
|
|
393
|
-
cd claude-code-templates
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
### 2. Create a Feature Branch
|
|
397
|
-
```bash
|
|
398
|
-
git checkout -b feature/your-feature-name
|
|
399
|
-
# or
|
|
400
|
-
git checkout -b fix/issue-description
|
|
401
|
-
```
|
|
402
|
-
|
|
403
|
-
### 3. Make Your Changes
|
|
404
|
-
- Add new language templates in `templates/`
|
|
405
|
-
- Add new framework examples in `templates/language/examples/`
|
|
406
|
-
- Update commands, hooks, or core functionality
|
|
407
|
-
- Follow existing code patterns
|
|
408
|
-
|
|
409
|
-
### 4. Test Thoroughly
|
|
410
|
-
```bash
|
|
411
|
-
cd cli-tool
|
|
412
|
-
npm test # Run test suite
|
|
413
|
-
npm start -- --dry-run # Manual testing
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
### 5. Submit a Pull Request
|
|
417
|
-
- Commit with clear, descriptive messages
|
|
418
|
-
- Push to your fork
|
|
419
|
-
- Open a PR with description of changes
|
|
420
|
-
- Link any related issues
|
|
421
|
-
|
|
422
|
-
### Adding New Languages
|
|
423
|
-
1. Create `templates/your-language/` directory
|
|
424
|
-
2. Add `CLAUDE.md`, `.claude/settings.json`, and `.mcp.json`
|
|
425
|
-
3. Create commands in `.claude/commands/`
|
|
426
|
-
4. Add framework examples in `examples/`
|
|
427
|
-
5. Update `src/templates.js` configuration
|
|
428
|
-
|
|
429
|
-
### Adding New Frameworks
|
|
430
|
-
1. Create `templates/language/examples/framework-name/`
|
|
431
|
-
2. Add framework-specific commands and CLAUDE.md
|
|
432
|
-
3. Update the framework detection logic if needed
|
|
433
|
-
|
|
434
|
-
## License
|
|
435
|
-
|
|
436
|
-
MIT License
|