Skip to content

Commit a176679

Browse files
davila7claude
andcommitted
feat: integrate Claude Code SDK with global agents functionality
🌍 Major new feature: Global AI Agents powered by Claude Code SDK ## New Features - **Global Agent Creation**: `--create-agent <agent-name>` - **Agent Management**: `--list-agents`, `--update-agent`, `--remove-agent` - **Zero Configuration**: Agents install to /usr/local/bin (immediately available) - **Auto Context Detection**: Smart project type detection and file context - **Universal Access**: Works from any directory, in scripts, CI/CD, npm tasks ## Technical Implementation - New global-agent-manager.js module with complete agent lifecycle - Automatic PATH management across shell environments - Executable script generation with Claude Code SDK integration - Real-time loading indicators during AI processing - Robust error handling and fallback mechanisms ## Frontend Integration - Enhanced agent modals with Global Agent installation options - New CSS styles for global agent sections - Copy-to-clipboard functionality for all commands - Usage examples and feature highlights ## User Experience Before: Traditional project-based agent installation After: `cct --create-agent security-auditor` → `security-auditor "prompt"` (anywhere) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 786982f commit a176679

File tree

8 files changed

+784
-4
lines changed

8 files changed

+784
-4
lines changed

cli-tool/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ npx claude-code-templates@latest --health-check
2828
- **📊 Real-time Analytics** - Monitor Claude Code sessions with live state detection and performance metrics
2929
- **🔍 Health Check** - Comprehensive system validation with actionable recommendations
3030
- **🧩 Individual Components** - Install specialized agents, commands, and MCPs individually
31+
- **🌍 Global Agents** - Create AI agents accessible from anywhere using Claude Code SDK
3132

3233
## 🎯 What You Get
3334

@@ -49,6 +50,51 @@ npx claude-code-templates@latest --health-check
4950
| **Go** | Gin, Echo, Fiber | 🚧 Coming Soon |
5051
| **Rust** | Axum, Warp, Actix | 🚧 Coming Soon |
5152

53+
## 🌍 Global Agents (Claude Code SDK Integration)
54+
55+
Create AI agents that can be executed from anywhere using the Claude Code SDK:
56+
57+
```bash
58+
# Create a global agent (one-time setup)
59+
npx claude-code-templates@latest --create-agent customer-support
60+
61+
# Use the agent from anywhere
62+
customer-support "Help me with ticket #12345"
63+
sre-logs "Analyze error patterns in app.log"
64+
code-reviewer "Review this PR for security issues"
65+
```
66+
67+
### Available Global Agents
68+
69+
| Agent | Usage | Description |
70+
|-------|-------|-------------|
71+
| `customer-support` | `customer-support "query"` | AI customer support specialist |
72+
| `api-security-audit` | `api-security-audit "analyze endpoints"` | Security auditing for APIs |
73+
| `react-performance-optimization` | `react-performance-optimization "optimize components"` | React performance expert |
74+
| `database-optimization` | `database-optimization "improve queries"` | Database performance tuning |
75+
76+
### Global Agent Management
77+
78+
```bash
79+
# List installed global agents
80+
npx claude-code-templates@latest --list-agents
81+
82+
# Update an agent to latest version
83+
npx claude-code-templates@latest --update-agent customer-support
84+
85+
# Remove an agent
86+
npx claude-code-templates@latest --remove-agent customer-support
87+
```
88+
89+
### How It Works
90+
91+
1. **Download Agent**: Fetches the latest agent from GitHub
92+
2. **Generate Executable**: Creates a Node.js script that calls Claude Code SDK
93+
3. **Add to PATH**: Makes the agent available globally in your shell
94+
4. **Ready to Use**: Execute `agent-name "your prompt"` from any directory
95+
96+
The agents use the Claude Code SDK internally to provide specialized AI assistance with domain-specific knowledge and best practices.
97+
5298
## 📖 Documentation
5399

54100
**[📚 Complete Documentation](https://docs.aitmpl.com/)** - Comprehensive guides, examples, and API reference

cli-tool/bin/create-claude-config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ console.log(
4141

4242
program
4343
.name('create-claude-config')
44-
.description('Setup Claude Code configurations for different programming languages')
44+
.description('Setup Claude Code configurations and create global AI agents powered by Claude Code SDK')
4545
.version(require('../package.json').version)
4646
.option('-l, --language <language>', 'specify programming language (deprecated, use --template)')
4747
.option('-f, --framework <framework>', 'specify framework (deprecated, use --template)')
@@ -66,6 +66,10 @@ program
6666
.option('--hook <hook>', 'install specific hook component (supports comma-separated values)')
6767
.option('--workflow <workflow>', 'install workflow from hash (#hash) OR workflow YAML (base64 encoded) when used with --agent/--command/--mcp')
6868
.option('--prompt <prompt>', 'execute the provided prompt in Claude Code after installation')
69+
.option('--create-agent <agent>', 'create a global agent accessible from anywhere (e.g., customer-support)')
70+
.option('--list-agents', 'list all installed global agents')
71+
.option('--remove-agent <agent>', 'remove a global agent')
72+
.option('--update-agent <agent>', 'update a global agent to the latest version')
6973
.action(async (options) => {
7074
try {
7175
await createClaudeConfig(options);

cli-tool/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli-tool/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "claude-code-templates",
3-
"version": "1.19.0",
3+
"version": "1.19.1",
44
"description": "CLI tool to setup Claude Code configurations with framework-specific commands, automation hooks and MCP Servers for your projects",
55
"main": "src/index.js",
66
"bin": {

cli-tool/src/index.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const { runAnalytics } = require('./analytics');
1616
const { startChatsMobile } = require('./chats-mobile');
1717
const { runHealthCheck } = require('./health-check');
1818
const { trackingService } = require('./tracking-service');
19+
const { createGlobalAgent, listGlobalAgents, removeGlobalAgent, updateGlobalAgent } = require('./sdk/global-agent-manager');
1920

2021
async function showMainMenu() {
2122
console.log('');
@@ -130,6 +131,30 @@ async function createClaudeConfig(options = {}) {
130131
return;
131132
}
132133

134+
// Handle global agent creation
135+
if (options.createAgent) {
136+
await createGlobalAgent(options.createAgent, options);
137+
return;
138+
}
139+
140+
// Handle global agent listing
141+
if (options.listAgents) {
142+
await listGlobalAgents(options);
143+
return;
144+
}
145+
146+
// Handle global agent removal
147+
if (options.removeAgent) {
148+
await removeGlobalAgent(options.removeAgent, options);
149+
return;
150+
}
151+
152+
// Handle global agent update
153+
if (options.updateAgent) {
154+
await updateGlobalAgent(options.updateAgent, options);
155+
return;
156+
}
157+
133158
// Handle command stats analysis (both singular and plural)
134159
if (options.commandStats || options.commandsStats) {
135160
await runCommandStats(options);

0 commit comments

Comments
 (0)