claude-code-templates 1.21.0 → 1.21.2

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 +104 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-templates",
3
- "version": "1.21.0",
3
+ "version": "1.21.2",
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
@@ -1218,8 +1218,65 @@ function extractFrameworkFromAgent(content, agentName) {
1218
1218
  */
1219
1219
  async function getAvailableAgentsFromGitHub() {
1220
1220
  try {
1221
+ // First try to use local components.json file which has all agents cached
1222
+ const fs = require('fs');
1223
+ const path = require('path');
1224
+ const componentsPath = path.join(__dirname, '../../docs/components.json');
1225
+
1226
+ if (fs.existsSync(componentsPath)) {
1227
+ const componentsData = JSON.parse(fs.readFileSync(componentsPath, 'utf8'));
1228
+
1229
+ if (componentsData.agents && Array.isArray(componentsData.agents)) {
1230
+ const agents = [];
1231
+
1232
+ for (const agent of componentsData.agents) {
1233
+ // Extract category from path
1234
+ const pathParts = agent.path.split('/');
1235
+ const category = pathParts.length > 1 ? pathParts[0] : 'root';
1236
+ const name = pathParts[pathParts.length - 1];
1237
+
1238
+ agents.push({
1239
+ name: name,
1240
+ path: agent.path,
1241
+ category: category
1242
+ });
1243
+ }
1244
+
1245
+ console.log(chalk.green(`✅ Loaded ${agents.length} agents from local cache`));
1246
+ return agents;
1247
+ }
1248
+ }
1249
+
1250
+ // Fallback to GitHub API if local file not found
1251
+ console.log(chalk.yellow('⚠️ Local components.json not found, using GitHub API...'));
1252
+
1221
1253
  const response = await fetch('https://api.github.com/repos/davila7/claude-code-templates/contents/cli-tool/components/agents');
1222
1254
  if (!response.ok) {
1255
+ // Check for rate limit error
1256
+ if (response.status === 403) {
1257
+ const responseText = await response.text();
1258
+ if (responseText.includes('rate limit')) {
1259
+ console.log(chalk.red('❌ GitHub API rate limit exceeded'));
1260
+ console.log(chalk.yellow('💡 Install locally with: npm install -g claude-code-templates'));
1261
+
1262
+ // Return comprehensive fallback list
1263
+ return [
1264
+ { name: 'frontend-developer', path: 'development-team/frontend-developer', category: 'development-team' },
1265
+ { name: 'backend-developer', path: 'development-team/backend-developer', category: 'development-team' },
1266
+ { name: 'fullstack-developer', path: 'development-team/fullstack-developer', category: 'development-team' },
1267
+ { name: 'devops-engineer', path: 'development-team/devops-engineer', category: 'development-team' },
1268
+ { name: 'nextjs-architecture-expert', path: 'web-tools/nextjs-architecture-expert', category: 'web-tools' },
1269
+ { name: 'react-developer', path: 'web-tools/react-developer', category: 'web-tools' },
1270
+ { name: 'vue-developer', path: 'web-tools/vue-developer', category: 'web-tools' },
1271
+ { name: 'data-scientist', path: 'data-analytics/data-scientist', category: 'data-analytics' },
1272
+ { name: 'data-analyst', path: 'data-analytics/data-analyst', category: 'data-analytics' },
1273
+ { name: 'security-auditor', path: 'security/security-auditor', category: 'security' },
1274
+ { name: 'api-security-audit', path: 'api-security-audit', category: 'root' },
1275
+ { name: 'database-optimization', path: 'database-optimization', category: 'root' },
1276
+ { name: 'react-performance-optimization', path: 'react-performance-optimization', category: 'root' }
1277
+ ];
1278
+ }
1279
+ }
1223
1280
  throw new Error(`GitHub API error: ${response.status}`);
1224
1281
  }
1225
1282
 
@@ -1258,9 +1315,12 @@ async function getAvailableAgentsFromGitHub() {
1258
1315
 
1259
1316
  return agents;
1260
1317
  } catch (error) {
1261
- console.warn('Warning: Could not fetch agents from GitHub, using fallback list');
1262
- // Fallback to basic list if GitHub API fails
1318
+ console.warn('Warning: Could not fetch agents, using fallback list');
1319
+ // Comprehensive fallback list if all methods fail
1263
1320
  return [
1321
+ { name: 'frontend-developer', path: 'development-team/frontend-developer', category: 'development-team' },
1322
+ { name: 'backend-developer', path: 'development-team/backend-developer', category: 'development-team' },
1323
+ { name: 'fullstack-developer', path: 'development-team/fullstack-developer', category: 'development-team' },
1264
1324
  { name: 'api-security-audit', path: 'api-security-audit', category: 'root' },
1265
1325
  { name: 'database-optimization', path: 'database-optimization', category: 'root' },
1266
1326
  { name: 'react-performance-optimization', path: 'react-performance-optimization', category: 'root' }
@@ -2146,39 +2206,47 @@ async function executeSandbox(options, targetDir) {
2146
2206
 
2147
2207
  console.log(chalk.blue('\n🤖 Agent Selection'));
2148
2208
  console.log(chalk.cyan('═══════════════════════════════════════'));
2149
- console.log(chalk.gray('Select an agent for your task, or continue without one.\n'));
2209
+ console.log(chalk.gray('Select one or more agents for your task (use SPACE to select, ENTER to confirm).\n'));
2150
2210
 
2151
2211
  // Fetch available agents
2152
2212
  console.log(chalk.gray('⏳ Fetching available agents...'));
2153
2213
  const agents = await getAvailableAgentsFromGitHub();
2154
2214
 
2155
- // Format agents for selection
2215
+ // Format agents for selection with full path
2156
2216
  const agentChoices = agents.map(a => ({
2157
2217
  name: `${a.path} ${chalk.gray(`- ${a.category}`)}`,
2158
- value: a.path,
2218
+ value: a.path, // This already includes folder/agent-name format
2159
2219
  short: a.path
2160
2220
  }));
2161
2221
 
2162
- // Add option to continue without agent
2163
- agentChoices.unshift({
2164
- name: chalk.yellow('⚡ Continue without agent (use default Claude)'),
2165
- value: null,
2166
- short: 'No agent'
2167
- });
2168
-
2169
- const { selectedAgent } = await inquirer.prompt([{
2170
- type: 'list',
2171
- name: 'selectedAgent',
2172
- message: 'Select an agent for your task:',
2173
- choices: agentChoices,
2174
- pageSize: 15
2222
+ // First ask if they want to select agents
2223
+ const { wantAgents } = await inquirer.prompt([{
2224
+ type: 'confirm',
2225
+ name: 'wantAgents',
2226
+ message: 'Do you want to select specific agents for this task?',
2227
+ default: true
2175
2228
  }]);
2176
2229
 
2177
- if (selectedAgent) {
2178
- agent = selectedAgent;
2179
- console.log(chalk.green(`✅ Selected agent: ${chalk.cyan(agent)}`));
2230
+ if (wantAgents) {
2231
+ const { selectedAgents } = await inquirer.prompt([{
2232
+ type: 'checkbox',
2233
+ name: 'selectedAgents',
2234
+ message: 'Select agents (use SPACE to select, ENTER when done):',
2235
+ choices: agentChoices,
2236
+ pageSize: 15
2237
+ // Removed validation - allow empty selection
2238
+ }]);
2239
+
2240
+ if (selectedAgents && selectedAgents.length > 0) {
2241
+ // Join multiple agents with comma
2242
+ agent = selectedAgents.join(',');
2243
+ console.log(chalk.green(`✅ Selected agents: ${chalk.cyan(selectedAgents.join(', '))}`));
2244
+ } else {
2245
+ // User didn't select any agents but pressed Enter
2246
+ console.log(chalk.yellow('⚠️ Continuing without specific agents'));
2247
+ }
2180
2248
  } else {
2181
- console.log(chalk.yellow('⚠️ Continuing without specific agent'));
2249
+ console.log(chalk.yellow('⚠️ Continuing without specific agents'));
2182
2250
  }
2183
2251
  }
2184
2252
 
@@ -2262,7 +2330,20 @@ async function executeSandbox(options, targetDir) {
2262
2330
  // Sandbox execution confirmation
2263
2331
  console.log(chalk.blue('\n☁️ E2B Sandbox Execution'));
2264
2332
  console.log(chalk.cyan('═══════════════════════════════════════'));
2265
- console.log(chalk.white(`📋 Agent: ${chalk.yellow(agent || 'default')}`));
2333
+
2334
+ // Display agents properly (handle multiple agents)
2335
+ if (agent) {
2336
+ const agentList = agent.split(',');
2337
+ if (agentList.length > 1) {
2338
+ console.log(chalk.white(`📋 Agents (${agentList.length}):`));
2339
+ agentList.forEach(a => console.log(chalk.yellow(` • ${a.trim()}`)));
2340
+ } else {
2341
+ console.log(chalk.white(`📋 Agent: ${chalk.yellow(agent)}`));
2342
+ }
2343
+ } else {
2344
+ console.log(chalk.white(`📋 Agent: ${chalk.yellow('default')}`));
2345
+ }
2346
+
2266
2347
  const truncatedPrompt = prompt.length > 80 ? prompt.substring(0, 80) + '...' : prompt;
2267
2348
  console.log(chalk.white(`💭 Prompt: ${chalk.cyan('"' + truncatedPrompt + '"')}`));
2268
2349
  console.log(chalk.white(`🌐 Provider: ${chalk.green('E2B Cloud')}`));