claude-code-templates 1.24.14 → 1.24.16
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.
|
@@ -132,14 +132,6 @@ function saveFilesToDirectory(files: { path: string; content: string }[], baseDi
|
|
|
132
132
|
fs.mkdirSync(baseDir, { recursive: true });
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
console.log('');
|
|
136
|
-
printSeparator();
|
|
137
|
-
console.log(`${colors.bright}💾 DOWNLOADING FILES${colors.reset}`);
|
|
138
|
-
printSeparator();
|
|
139
|
-
console.log('');
|
|
140
|
-
console.log(`${colors.cyan}Output directory:${colors.reset} ${baseDir}`);
|
|
141
|
-
console.log('');
|
|
142
|
-
|
|
143
135
|
files.forEach(file => {
|
|
144
136
|
const fullPath = path.join(baseDir, file.path);
|
|
145
137
|
const dir = path.dirname(fullPath);
|
|
@@ -151,7 +143,7 @@ function saveFilesToDirectory(files: { path: string; content: string }[], baseDi
|
|
|
151
143
|
|
|
152
144
|
// Write file
|
|
153
145
|
fs.writeFileSync(fullPath, file.content, 'utf-8');
|
|
154
|
-
log(
|
|
146
|
+
log(`✓ ${file.path}`, 'success');
|
|
155
147
|
});
|
|
156
148
|
|
|
157
149
|
console.log('');
|
|
@@ -232,39 +224,21 @@ Requirements:
|
|
|
232
224
|
- Do NOT include any explanations, ONLY code blocks with filenames`
|
|
233
225
|
: config.prompt;
|
|
234
226
|
|
|
235
|
-
// TEMPORARY SOLUTION: Load agent content manually and pass as systemPrompt
|
|
236
|
-
//
|
|
237
|
-
// NOTE: This is a workaround because the current version of @anthropic-ai/claude-agent-sdk
|
|
238
|
-
// does not properly support `settingSources: ['project']` for loading agents from .claude/
|
|
239
|
-
//
|
|
240
|
-
// FUTURE: Once the SDK properly supports settingSources, we should use:
|
|
241
|
-
// settingSources: ['project']
|
|
242
|
-
// instead of manually loading and passing the agent content.
|
|
243
|
-
//
|
|
244
|
-
// The SDK version ^0.1.0 is the latest available but seems to have issues with
|
|
245
|
-
// automatic agent loading. We need to revisit this in future SDK updates.
|
|
246
|
-
let agentSystemPrompt = '';
|
|
247
|
-
if (agents.length > 0) {
|
|
248
|
-
const agentPath = path.join(process.cwd(), '.claude', 'agents', `${agents[0].replace(/\//g, '-')}.md`);
|
|
249
|
-
if (fs.existsSync(agentPath)) {
|
|
250
|
-
agentSystemPrompt = fs.readFileSync(agentPath, 'utf-8');
|
|
251
|
-
log(`Loaded agent from: ${agentPath}`);
|
|
252
|
-
} else {
|
|
253
|
-
log(`Agent file not found: ${agentPath}`, 'warning');
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
227
|
// Configure Claude Agent SDK options
|
|
228
|
+
// Using settingSources: ['project'] to automatically load agents from .claude/ directory
|
|
229
|
+
// This is supported in SDK version ^0.1.23 and later
|
|
258
230
|
const options: ClaudeAgentOptions = {
|
|
259
231
|
model: 'claude-sonnet-4-5',
|
|
260
232
|
apiKey: config.anthropicApiKey,
|
|
261
|
-
|
|
262
|
-
//
|
|
263
|
-
|
|
264
|
-
? { type: 'text', text: agentSystemPrompt }
|
|
265
|
-
: { type: 'preset', preset: 'claude_code' },
|
|
233
|
+
systemPrompt: { type: 'preset', preset: 'claude_code' },
|
|
234
|
+
// Automatically load agents, settings, and configurations from .claude/ directory
|
|
235
|
+
settingSources: ['project'],
|
|
266
236
|
};
|
|
267
237
|
|
|
238
|
+
if (agents.length > 0) {
|
|
239
|
+
log(`Using agents from .claude/agents/ directory via settingSources`, 'success');
|
|
240
|
+
}
|
|
241
|
+
|
|
268
242
|
// Collect the full response
|
|
269
243
|
let generatedCode = '';
|
|
270
244
|
|
|
@@ -388,39 +362,17 @@ async function installAgents(agents: string[]): Promise<void> {
|
|
|
388
362
|
|
|
389
363
|
function displayResults(result: ExecutionResult, targetDir?: string) {
|
|
390
364
|
console.log('');
|
|
391
|
-
printSeparator();
|
|
392
|
-
console.log(`${colors.bright}📊 EXECUTION RESULTS${colors.reset}`);
|
|
393
|
-
printSeparator();
|
|
394
|
-
console.log('');
|
|
395
|
-
|
|
396
|
-
console.log(`${colors.cyan}Question:${colors.reset} ${result.question}`);
|
|
397
|
-
console.log('');
|
|
398
|
-
|
|
399
|
-
console.log(`${colors.cyan}Generated Code:${colors.reset}`);
|
|
400
|
-
printSeparator('-');
|
|
401
|
-
console.log(result.code);
|
|
402
|
-
printSeparator('-');
|
|
403
|
-
console.log('');
|
|
404
|
-
|
|
405
|
-
if (result.output) {
|
|
406
|
-
console.log(`${colors.cyan}Output:${colors.reset}`);
|
|
407
|
-
console.log(result.output);
|
|
408
|
-
console.log('');
|
|
409
|
-
}
|
|
410
365
|
|
|
411
366
|
if (result.error) {
|
|
412
|
-
console.log(`${colors.red}Error:${colors.reset}`);
|
|
413
|
-
console.log(result.error);
|
|
367
|
+
console.log(`${colors.red}❌ Error:${colors.reset} ${result.error}`);
|
|
414
368
|
console.log('');
|
|
369
|
+
return;
|
|
415
370
|
}
|
|
416
371
|
|
|
417
372
|
if (result.sandboxId) {
|
|
418
|
-
|
|
373
|
+
log(`Sandbox ID: ${result.sandboxId}`);
|
|
419
374
|
}
|
|
420
375
|
|
|
421
|
-
console.log(`${colors.green}Status:${colors.reset} ${result.success ? 'Success ✓' : 'Failed ✗'}`);
|
|
422
|
-
printSeparator();
|
|
423
|
-
|
|
424
376
|
// Extract and save files
|
|
425
377
|
const files = extractFilesFromCode(result.code);
|
|
426
378
|
if (files.length > 0) {
|
|
@@ -428,6 +380,11 @@ function displayResults(result: ExecutionResult, targetDir?: string) {
|
|
|
428
380
|
const timestamp = Date.now().toString(36);
|
|
429
381
|
const baseDir = targetDir || process.cwd();
|
|
430
382
|
const outputDir = path.join(baseDir, `cloudflare-${timestamp}`);
|
|
383
|
+
|
|
384
|
+
console.log('');
|
|
385
|
+
printSeparator();
|
|
386
|
+
log(`Downloading ${files.length} file(s)...`);
|
|
387
|
+
console.log('');
|
|
431
388
|
saveFilesToDirectory(files, outputDir);
|
|
432
389
|
}
|
|
433
390
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-templates",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.16",
|
|
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": {
|