claude-code-templates 1.14.1 → 1.15.0
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/package.json +1 -1
- package/src/index.js +47 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-templates",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "CLI tool to setup Claude Code configurations with framework-specific commands, automation hooks and MCP Servers for your projects",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
package/src/index.js
CHANGED
|
@@ -305,27 +305,24 @@ async function installIndividualAgent(agentName, targetDir, options) {
|
|
|
305
305
|
console.log(chalk.blue(`🤖 Installing agent: ${agentName}`));
|
|
306
306
|
|
|
307
307
|
try {
|
|
308
|
-
//
|
|
309
|
-
const
|
|
310
|
-
|
|
308
|
+
// Download agent directly from GitHub
|
|
309
|
+
const githubUrl = `https://raw.githubusercontent.com/davila7/claude-code-templates/main/cli-tool/components/agents/${agentName}.md`;
|
|
310
|
+
console.log(chalk.gray(`📥 Downloading from GitHub (main branch)...`));
|
|
311
311
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
const agents = await fs.readdir(componentsPath);
|
|
319
|
-
agents.filter(f => f.endsWith('.md')).forEach(agent => {
|
|
320
|
-
console.log(chalk.cyan(` - ${agent.replace('.md', '')}`));
|
|
321
|
-
});
|
|
312
|
+
const response = await fetch(githubUrl);
|
|
313
|
+
if (!response.ok) {
|
|
314
|
+
if (response.status === 404) {
|
|
315
|
+
console.log(chalk.red(`❌ Agent "${agentName}" not found`));
|
|
316
|
+
console.log(chalk.yellow('Available agents: api-security-audit, database-optimization, react-performance-optimization'));
|
|
317
|
+
return;
|
|
322
318
|
}
|
|
323
|
-
|
|
319
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
324
320
|
}
|
|
325
321
|
|
|
322
|
+
const agentContent = await response.text();
|
|
323
|
+
|
|
326
324
|
// For agents, they are typically part of templates, so we need to determine
|
|
327
325
|
// the appropriate language/framework and install the complete template
|
|
328
|
-
const agentContent = await fs.readFile(agentFile, 'utf8');
|
|
329
326
|
const language = extractLanguageFromAgent(agentContent, agentName);
|
|
330
327
|
const framework = extractFrameworkFromAgent(agentContent, agentName);
|
|
331
328
|
|
|
@@ -345,13 +342,15 @@ async function installIndividualAgent(agentName, targetDir, options) {
|
|
|
345
342
|
await createClaudeConfig(setupOptions);
|
|
346
343
|
|
|
347
344
|
console.log(chalk.green(`✅ Agent "${agentName}" installed successfully!`));
|
|
345
|
+
console.log(chalk.cyan(`📦 Downloaded from: ${githubUrl}`));
|
|
348
346
|
|
|
349
347
|
// Track successful agent installation
|
|
350
348
|
trackingService.trackDownload('agent', agentName, {
|
|
351
349
|
language: language,
|
|
352
350
|
framework: framework,
|
|
353
351
|
installation_type: 'individual_agent',
|
|
354
|
-
template_installed: true
|
|
352
|
+
template_installed: true,
|
|
353
|
+
source: 'github_main'
|
|
355
354
|
});
|
|
356
355
|
|
|
357
356
|
} catch (error) {
|
|
@@ -363,39 +362,39 @@ async function installIndividualCommand(commandName, targetDir, options) {
|
|
|
363
362
|
console.log(chalk.blue(`⚡ Installing command: ${commandName}`));
|
|
364
363
|
|
|
365
364
|
try {
|
|
366
|
-
//
|
|
367
|
-
const
|
|
368
|
-
|
|
365
|
+
// Download command directly from GitHub
|
|
366
|
+
const githubUrl = `https://raw.githubusercontent.com/davila7/claude-code-templates/main/cli-tool/components/commands/${commandName}.md`;
|
|
367
|
+
console.log(chalk.gray(`📥 Downloading from GitHub (main branch)...`));
|
|
369
368
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
const commands = await fs.readdir(componentsPath);
|
|
377
|
-
commands.filter(f => f.endsWith('.md')).forEach(command => {
|
|
378
|
-
console.log(chalk.cyan(` - ${command.replace('.md', '')}`));
|
|
379
|
-
});
|
|
369
|
+
const response = await fetch(githubUrl);
|
|
370
|
+
if (!response.ok) {
|
|
371
|
+
if (response.status === 404) {
|
|
372
|
+
console.log(chalk.red(`❌ Command "${commandName}" not found`));
|
|
373
|
+
console.log(chalk.yellow('Available commands: check-file, generate-tests'));
|
|
374
|
+
return;
|
|
380
375
|
}
|
|
381
|
-
|
|
376
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
382
377
|
}
|
|
383
378
|
|
|
379
|
+
const commandContent = await response.text();
|
|
380
|
+
|
|
384
381
|
// Create .claude/commands directory if it doesn't exist
|
|
385
382
|
const commandsDir = path.join(targetDir, '.claude', 'commands');
|
|
386
383
|
await fs.ensureDir(commandsDir);
|
|
387
384
|
|
|
388
|
-
//
|
|
385
|
+
// Write the command file
|
|
389
386
|
const targetFile = path.join(commandsDir, `${commandName}.md`);
|
|
390
|
-
await fs.
|
|
387
|
+
await fs.writeFile(targetFile, commandContent, 'utf8');
|
|
391
388
|
|
|
392
389
|
console.log(chalk.green(`✅ Command "${commandName}" installed successfully!`));
|
|
393
390
|
console.log(chalk.cyan(`📁 Installed to: ${path.relative(targetDir, targetFile)}`));
|
|
391
|
+
console.log(chalk.cyan(`📦 Downloaded from: ${githubUrl}`));
|
|
394
392
|
|
|
395
393
|
// Track successful command installation
|
|
396
394
|
trackingService.trackDownload('command', commandName, {
|
|
397
395
|
installation_type: 'individual_command',
|
|
398
|
-
target_directory: path.relative(process.cwd(), targetDir)
|
|
396
|
+
target_directory: path.relative(process.cwd(), targetDir),
|
|
397
|
+
source: 'github_main'
|
|
399
398
|
});
|
|
400
399
|
|
|
401
400
|
} catch (error) {
|
|
@@ -407,26 +406,22 @@ async function installIndividualMCP(mcpName, targetDir, options) {
|
|
|
407
406
|
console.log(chalk.blue(`🔌 Installing MCP: ${mcpName}`));
|
|
408
407
|
|
|
409
408
|
try {
|
|
410
|
-
//
|
|
411
|
-
const
|
|
412
|
-
|
|
409
|
+
// Download MCP directly from GitHub
|
|
410
|
+
const githubUrl = `https://raw.githubusercontent.com/davila7/claude-code-templates/main/cli-tool/components/mcps/${mcpName}.json`;
|
|
411
|
+
console.log(chalk.gray(`📥 Downloading from GitHub (main branch)...`));
|
|
413
412
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
const mcps = await fs.readdir(componentsPath);
|
|
421
|
-
mcps.filter(f => f.endsWith('.json')).forEach(mcp => {
|
|
422
|
-
console.log(chalk.cyan(` - ${mcp.replace('.json', '')}`));
|
|
423
|
-
});
|
|
413
|
+
const response = await fetch(githubUrl);
|
|
414
|
+
if (!response.ok) {
|
|
415
|
+
if (response.status === 404) {
|
|
416
|
+
console.log(chalk.red(`❌ MCP "${mcpName}" not found`));
|
|
417
|
+
console.log(chalk.yellow('Available MCPs: web-fetch, filesystem-access, github-integration, memory-integration, mysql-integration, postgresql-integration, deepgraph-react, deepgraph-nextjs, deepgraph-typescript, deepgraph-vue'));
|
|
418
|
+
return;
|
|
424
419
|
}
|
|
425
|
-
|
|
420
|
+
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
426
421
|
}
|
|
427
422
|
|
|
428
|
-
|
|
429
|
-
const mcpConfig =
|
|
423
|
+
const mcpConfigText = await response.text();
|
|
424
|
+
const mcpConfig = JSON.parse(mcpConfigText);
|
|
430
425
|
|
|
431
426
|
// Check if .mcp.json exists in target directory
|
|
432
427
|
const targetMcpFile = path.join(targetDir, '.mcp.json');
|
|
@@ -448,12 +443,14 @@ async function installIndividualMCP(mcpName, targetDir, options) {
|
|
|
448
443
|
|
|
449
444
|
console.log(chalk.green(`✅ MCP "${mcpName}" installed successfully!`));
|
|
450
445
|
console.log(chalk.cyan(`📁 Configuration merged into: ${path.relative(targetDir, targetMcpFile)}`));
|
|
446
|
+
console.log(chalk.cyan(`📦 Downloaded from: ${githubUrl}`));
|
|
451
447
|
|
|
452
448
|
// Track successful MCP installation
|
|
453
449
|
trackingService.trackDownload('mcp', mcpName, {
|
|
454
450
|
installation_type: 'individual_mcp',
|
|
455
451
|
merged_with_existing: existingConfig !== null,
|
|
456
|
-
servers_count: Object.keys(mergedConfig.mcpServers || {}).length
|
|
452
|
+
servers_count: Object.keys(mergedConfig.mcpServers || {}).length,
|
|
453
|
+
source: 'github_main'
|
|
457
454
|
});
|
|
458
455
|
|
|
459
456
|
} catch (error) {
|