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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. 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.14.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
- // Check if components directory exists
309
- const componentsPath = path.join(__dirname, '..', 'components', 'agents');
310
- const agentFile = path.join(componentsPath, `${agentName}.md`);
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
- if (!await fs.pathExists(agentFile)) {
313
- console.log(chalk.red(`❌ Agent "${agentName}" not found`));
314
- console.log(chalk.yellow('Available agents:'));
315
-
316
- // List available agents
317
- if (await fs.pathExists(componentsPath)) {
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
- return;
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
- // Check if components directory exists
367
- const componentsPath = path.join(__dirname, '..', 'components', 'commands');
368
- const commandFile = path.join(componentsPath, `${commandName}.md`);
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
- if (!await fs.pathExists(commandFile)) {
371
- console.log(chalk.red(`❌ Command "${commandName}" not found`));
372
- console.log(chalk.yellow('Available commands:'));
373
-
374
- // List available commands
375
- if (await fs.pathExists(componentsPath)) {
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
- return;
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
- // Copy the command file
385
+ // Write the command file
389
386
  const targetFile = path.join(commandsDir, `${commandName}.md`);
390
- await fs.copy(commandFile, targetFile);
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
- // Check if components directory exists
411
- const componentsPath = path.join(__dirname, '..', 'components', 'mcps');
412
- const mcpFile = path.join(componentsPath, `${mcpName}.json`);
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
- if (!await fs.pathExists(mcpFile)) {
415
- console.log(chalk.red(`❌ MCP "${mcpName}" not found`));
416
- console.log(chalk.yellow('Available MCPs:'));
417
-
418
- // List available MCPs
419
- if (await fs.pathExists(componentsPath)) {
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
- return;
420
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
426
421
  }
427
422
 
428
- // Read the MCP configuration
429
- const mcpConfig = await fs.readJson(mcpFile);
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) {