claude-code-templates 1.24.13 → 1.24.15
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.
|
@@ -232,45 +232,35 @@ Requirements:
|
|
|
232
232
|
- Do NOT include any explanations, ONLY code blocks with filenames`
|
|
233
233
|
: config.prompt;
|
|
234
234
|
|
|
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
235
|
// Configure Claude Agent SDK options
|
|
236
|
+
// Using settingSources: ['project'] to automatically load agents from .claude/ directory
|
|
237
|
+
// This is supported in SDK version ^0.1.23 and later
|
|
258
238
|
const options: ClaudeAgentOptions = {
|
|
259
239
|
model: 'claude-sonnet-4-5',
|
|
260
240
|
apiKey: config.anthropicApiKey,
|
|
261
|
-
|
|
262
|
-
//
|
|
263
|
-
|
|
264
|
-
? { type: 'text', text: agentSystemPrompt }
|
|
265
|
-
: { type: 'preset', preset: 'claude_code' },
|
|
241
|
+
systemPrompt: { type: 'preset', preset: 'claude_code' },
|
|
242
|
+
// Automatically load agents, settings, and configurations from .claude/ directory
|
|
243
|
+
settingSources: ['project'],
|
|
266
244
|
};
|
|
267
245
|
|
|
246
|
+
if (agents.length > 0) {
|
|
247
|
+
log(`Using agents from .claude/agents/ directory via settingSources`, 'success');
|
|
248
|
+
}
|
|
249
|
+
|
|
268
250
|
// Collect the full response
|
|
269
251
|
let generatedCode = '';
|
|
270
252
|
|
|
271
253
|
try {
|
|
272
254
|
for await (const message of query({ prompt: promptContent, options })) {
|
|
273
|
-
|
|
255
|
+
// The Agent SDK returns different message types:
|
|
256
|
+
// - 'system': Initialization info
|
|
257
|
+
// - 'assistant': Individual API responses
|
|
258
|
+
// - 'result': Final aggregated result (THIS is what we need!)
|
|
259
|
+
if (message.type === 'result' && message.result) {
|
|
260
|
+
generatedCode = message.result;
|
|
261
|
+
log(`Received result (${message.result.length} chars)`, 'success');
|
|
262
|
+
} else if (message.type === 'text' && message.text) {
|
|
263
|
+
// Fallback for older SDK versions
|
|
274
264
|
generatedCode += message.text;
|
|
275
265
|
}
|
|
276
266
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-templates",
|
|
3
|
-
"version": "1.24.
|
|
3
|
+
"version": "1.24.15",
|
|
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": {
|