mycontext-cli 1.0.93 → 1.0.95
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.
- package/README.md +99 -5
- package/dist/agents/implementations/ClaudeAgentWorkflow.d.ts +110 -0
- package/dist/agents/implementations/ClaudeAgentWorkflow.d.ts.map +1 -0
- package/dist/agents/implementations/ClaudeAgentWorkflow.js +555 -0
- package/dist/agents/implementations/ClaudeAgentWorkflow.js.map +1 -0
- package/dist/agents/implementations/WorkflowAgent.d.ts +1 -0
- package/dist/agents/implementations/WorkflowAgent.d.ts.map +1 -1
- package/dist/agents/implementations/WorkflowAgent.js +8 -0
- package/dist/agents/implementations/WorkflowAgent.js.map +1 -1
- package/dist/package.json +2 -1
- package/dist/utils/claudeAgentClient.d.ts +98 -0
- package/dist/utils/claudeAgentClient.d.ts.map +1 -0
- package/dist/utils/claudeAgentClient.js +409 -0
- package/dist/utils/claudeAgentClient.js.map +1 -0
- package/dist/utils/contextManager.d.ts +86 -0
- package/dist/utils/contextManager.d.ts.map +1 -0
- package/dist/utils/contextManager.js +322 -0
- package/dist/utils/contextManager.js.map +1 -0
- package/dist/utils/hybridAIClient.d.ts +25 -1
- package/dist/utils/hybridAIClient.d.ts.map +1 -1
- package/dist/utils/hybridAIClient.js +69 -2
- package/dist/utils/hybridAIClient.js.map +1 -1
- package/dist/utils/mcpAgentIntegration.d.ts +104 -0
- package/dist/utils/mcpAgentIntegration.d.ts.map +1 -0
- package/dist/utils/mcpAgentIntegration.js +382 -0
- package/dist/utils/mcpAgentIntegration.js.map +1 -0
- package/dist/utils/toolPermissions.d.ts +105 -0
- package/dist/utils/toolPermissions.d.ts.map +1 -0
- package/dist/utils/toolPermissions.js +408 -0
- package/dist/utils/toolPermissions.js.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -44,6 +44,16 @@ mycontext generate-components all --with-tests
|
|
|
44
44
|
- **🔧 Developer-Friendly**: Built-in validation, testing, and preview capabilities
|
|
45
45
|
- **🆓 Free Tier**: Use Qwen3 Coder model for free testing, or premium X.AI/Claude for production
|
|
46
46
|
|
|
47
|
+
### 🚀 **Claude Agent SDK Integration** (NEW!)
|
|
48
|
+
|
|
49
|
+
- **🧠 Advanced Context Management**: Automatic context compaction and intelligent memory management
|
|
50
|
+
- **🔐 Fine-Grained Tool Permissions**: Granular control over AI capabilities with strict/permissive modes
|
|
51
|
+
- **🔌 MCP Integration**: Model Context Protocol support for external tools and services
|
|
52
|
+
- **⚡ Enhanced Workflows**: Intelligent agent coordination with automatic error handling and retry logic
|
|
53
|
+
- **🎯 Smart Fallbacks**: Seamless fallback to standard clients when Agent SDK isn't available
|
|
54
|
+
- **📊 Context Analytics**: Detailed context statistics and compression ratios
|
|
55
|
+
- **🛡️ Security Controls**: File size limits, directory restrictions, and tool validation
|
|
56
|
+
|
|
47
57
|
## Commands
|
|
48
58
|
|
|
49
59
|
### Project Setup
|
|
@@ -216,32 +226,45 @@ MyContext supports multiple AI providers with intelligent fallback:
|
|
|
216
226
|
|
|
217
227
|
#### **Recommended (Premium)**
|
|
218
228
|
|
|
219
|
-
1.
|
|
229
|
+
1. **🚀 Claude Agent SDK - Best for Advanced Workflows** (NEW!)
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
echo 'MYCONTEXT_CLAUDE_API_KEY=sk-ant-xxx' > .mycontext/.env
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Features:**
|
|
236
|
+
- Advanced context management and compaction
|
|
237
|
+
- Fine-grained tool permissions
|
|
238
|
+
- MCP (Model Context Protocol) integration
|
|
239
|
+
- Intelligent agent coordination
|
|
240
|
+
- Automatic error handling and retry logic
|
|
241
|
+
|
|
242
|
+
2. **X.AI (Grok) - Best for Code Generation**
|
|
220
243
|
|
|
221
244
|
```bash
|
|
222
245
|
echo 'MYCONTEXT_XAI_API_KEY=xai-xxx' > .mycontext/.env
|
|
223
246
|
```
|
|
224
247
|
|
|
225
|
-
|
|
248
|
+
3. **Claude (Anthropic) - Best for Complex Reasoning**
|
|
226
249
|
|
|
227
250
|
```bash
|
|
228
251
|
echo 'MYCONTEXT_CLAUDE_API_KEY=sk-ant-xxx' > .mycontext/.env
|
|
229
252
|
```
|
|
230
253
|
|
|
231
|
-
|
|
254
|
+
4. **OpenAI (GPT-4) - Most Versatile**
|
|
232
255
|
```bash
|
|
233
256
|
echo 'MYCONTEXT_OPENAI_API_KEY=sk-xxx' > .mycontext/.env
|
|
234
257
|
```
|
|
235
258
|
|
|
236
259
|
#### **Testing & Fallback**
|
|
237
260
|
|
|
238
|
-
|
|
261
|
+
5. **Qwen3 Coder (FREE)**
|
|
239
262
|
|
|
240
263
|
```bash
|
|
241
264
|
echo 'MYCONTEXT_QWEN_API_KEY=sk-or-xxx' > .mycontext/.env
|
|
242
265
|
```
|
|
243
266
|
|
|
244
|
-
|
|
267
|
+
6. **GitHub Models (Self-hosted)**
|
|
245
268
|
```bash
|
|
246
269
|
echo 'MYCONTEXT_GITHUB_TOKEN=ghp_xxx' > .mycontext/.env
|
|
247
270
|
```
|
|
@@ -304,6 +327,77 @@ mycontext build-strategy --compare
|
|
|
304
327
|
mycontext build-strategy --context
|
|
305
328
|
```
|
|
306
329
|
|
|
330
|
+
## 🚀 **Claude Agent SDK Features**
|
|
331
|
+
|
|
332
|
+
### **Advanced Context Management**
|
|
333
|
+
|
|
334
|
+
The Claude Agent SDK provides intelligent context management with automatic compaction:
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
# Context is automatically managed and compacted when it exceeds limits
|
|
338
|
+
mycontext build-app --description "Complex enterprise application"
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Features:**
|
|
342
|
+
|
|
343
|
+
- **Automatic Compaction**: Context is compressed when it exceeds size limits
|
|
344
|
+
- **Smart Preservation**: Recent outputs and important data are preserved
|
|
345
|
+
- **Context Analytics**: Detailed statistics on context size and compression ratios
|
|
346
|
+
- **Memory Management**: Persistent context storage across sessions
|
|
347
|
+
|
|
348
|
+
### **Fine-Grained Tool Permissions**
|
|
349
|
+
|
|
350
|
+
Control exactly what the AI can do with granular permissions:
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
# Tool permissions are automatically configured based on your project needs
|
|
354
|
+
mycontext setup
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
**Permission Modes:**
|
|
358
|
+
|
|
359
|
+
- **Strict**: Deny by default, require explicit permission
|
|
360
|
+
- **Permissive**: Allow by default, block specific tools
|
|
361
|
+
- **Custom**: Fine-grained control over individual tools
|
|
362
|
+
|
|
363
|
+
**Security Features:**
|
|
364
|
+
|
|
365
|
+
- File size limits and type restrictions
|
|
366
|
+
- Directory access controls
|
|
367
|
+
- API call rate limiting
|
|
368
|
+
- Tool validation and restrictions
|
|
369
|
+
|
|
370
|
+
### **MCP (Model Context Protocol) Integration**
|
|
371
|
+
|
|
372
|
+
Connect to external tools and services through MCP:
|
|
373
|
+
|
|
374
|
+
```bash
|
|
375
|
+
# Set up MCP integration
|
|
376
|
+
mycontext setup-mcp --provider instantdb
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**Supported Providers:**
|
|
380
|
+
|
|
381
|
+
- **InstantDB**: Real-time database integration
|
|
382
|
+
- **GitHub**: Repository and issue management
|
|
383
|
+
- **Custom**: Your own MCP servers
|
|
384
|
+
|
|
385
|
+
### **Enhanced Workflows**
|
|
386
|
+
|
|
387
|
+
Intelligent agent coordination with automatic error handling:
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
# Enhanced workflows automatically use Claude Agent SDK when available
|
|
391
|
+
mycontext build-app --interactive
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
**Workflow Features:**
|
|
395
|
+
|
|
396
|
+
- **Smart Fallbacks**: Seamless fallback to standard clients
|
|
397
|
+
- **Error Recovery**: Automatic retry logic with exponential backoff
|
|
398
|
+
- **Context Awareness**: Each step builds on previous context
|
|
399
|
+
- **Progress Tracking**: Detailed progress reporting and analytics
|
|
400
|
+
|
|
307
401
|
## Documentation
|
|
308
402
|
|
|
309
403
|
- [Full Documentation](https://mycontext.fbien.com/docs)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClaudeAgentWorkflow Implementation
|
|
3
|
+
*
|
|
4
|
+
* Enhanced workflow agent that leverages Claude Agent SDK for advanced
|
|
5
|
+
* context management, tool permissions, and MCP integration.
|
|
6
|
+
*/
|
|
7
|
+
import { SubAgent, WorkflowInput, WorkflowOutput } from "../interfaces/SubAgent";
|
|
8
|
+
export declare class ClaudeAgentWorkflow implements SubAgent<WorkflowInput, WorkflowOutput> {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
personality: string;
|
|
12
|
+
llmProvider: string;
|
|
13
|
+
expertise: string[];
|
|
14
|
+
private claudeAgentClient;
|
|
15
|
+
private contextManager;
|
|
16
|
+
private permissionManager;
|
|
17
|
+
private mcpIntegration;
|
|
18
|
+
private completedSteps;
|
|
19
|
+
private failedSteps;
|
|
20
|
+
private userInteractions;
|
|
21
|
+
private totalRetries;
|
|
22
|
+
private workflowContext;
|
|
23
|
+
constructor(workingDirectory?: string);
|
|
24
|
+
/**
|
|
25
|
+
* Check if Claude Agent SDK is available
|
|
26
|
+
*/
|
|
27
|
+
isClaudeAgentAvailable(): boolean;
|
|
28
|
+
run(input: WorkflowInput): Promise<WorkflowOutput>;
|
|
29
|
+
/**
|
|
30
|
+
* Initialize Claude Agent SDK with enhanced configuration
|
|
31
|
+
*/
|
|
32
|
+
private initializeClaudeAgent;
|
|
33
|
+
/**
|
|
34
|
+
* Prepare workflow context
|
|
35
|
+
*/
|
|
36
|
+
private prepareWorkflowContext;
|
|
37
|
+
/**
|
|
38
|
+
* Define enhanced workflow steps with Claude Agent SDK
|
|
39
|
+
*/
|
|
40
|
+
private defineEnhancedWorkflowSteps;
|
|
41
|
+
/**
|
|
42
|
+
* Execute enhanced workflow with Claude Agent SDK
|
|
43
|
+
*/
|
|
44
|
+
private executeEnhancedWorkflow;
|
|
45
|
+
/**
|
|
46
|
+
* Execute individual step using Claude Agent SDK
|
|
47
|
+
*/
|
|
48
|
+
private executeStepWithClaudeAgent;
|
|
49
|
+
/**
|
|
50
|
+
* Build step-specific prompt for Claude Agent SDK
|
|
51
|
+
*/
|
|
52
|
+
private buildStepPrompt;
|
|
53
|
+
/**
|
|
54
|
+
* Build context analysis prompt
|
|
55
|
+
*/
|
|
56
|
+
private buildContextAnalysisPrompt;
|
|
57
|
+
/**
|
|
58
|
+
* Build project setup prompt
|
|
59
|
+
*/
|
|
60
|
+
private buildProjectSetupPrompt;
|
|
61
|
+
/**
|
|
62
|
+
* Build requirement gathering prompt
|
|
63
|
+
*/
|
|
64
|
+
private buildRequirementGatheringPrompt;
|
|
65
|
+
/**
|
|
66
|
+
* Build context generation prompt
|
|
67
|
+
*/
|
|
68
|
+
private buildContextGenerationPrompt;
|
|
69
|
+
/**
|
|
70
|
+
* Build component generation prompt
|
|
71
|
+
*/
|
|
72
|
+
private buildComponentGenerationPrompt;
|
|
73
|
+
/**
|
|
74
|
+
* Build validation testing prompt
|
|
75
|
+
*/
|
|
76
|
+
private buildValidationTestingPrompt;
|
|
77
|
+
/**
|
|
78
|
+
* Process step result
|
|
79
|
+
*/
|
|
80
|
+
private processStepResult;
|
|
81
|
+
/**
|
|
82
|
+
* Process context analysis result
|
|
83
|
+
*/
|
|
84
|
+
private processContextAnalysisResult;
|
|
85
|
+
/**
|
|
86
|
+
* Process project setup result
|
|
87
|
+
*/
|
|
88
|
+
private processProjectSetupResult;
|
|
89
|
+
/**
|
|
90
|
+
* Process requirement gathering result
|
|
91
|
+
*/
|
|
92
|
+
private processRequirementGatheringResult;
|
|
93
|
+
/**
|
|
94
|
+
* Process context generation result
|
|
95
|
+
*/
|
|
96
|
+
private processContextGenerationResult;
|
|
97
|
+
/**
|
|
98
|
+
* Process component generation result
|
|
99
|
+
*/
|
|
100
|
+
private processComponentGenerationResult;
|
|
101
|
+
/**
|
|
102
|
+
* Process validation testing result
|
|
103
|
+
*/
|
|
104
|
+
private processValidationTestingResult;
|
|
105
|
+
/**
|
|
106
|
+
* Get enhanced system prompt for Claude Agent SDK
|
|
107
|
+
*/
|
|
108
|
+
private getEnhancedSystemPrompt;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=ClaudeAgentWorkflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClaudeAgentWorkflow.d.ts","sourceRoot":"","sources":["../../../src/agents/implementations/ClaudeAgentWorkflow.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,QAAQ,EACR,aAAa,EACb,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAOhC,qBAAa,mBACX,YAAW,QAAQ,CAAC,aAAa,EAAE,cAAc,CAAC;IAElD,IAAI,SAAyB;IAC7B,WAAW,SAC6F;IACxG,WAAW,SACwF;IACnG,WAAW,SAAsB;IACjC,SAAS,WAQP;IAEF,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,iBAAiB,CAAwB;IACjD,OAAO,CAAC,cAAc,CAAsB;IAE5C,OAAO,CAAC,cAAc,CAA0B;IAChD,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,eAAe,CAAsB;gBAEjC,gBAAgB,CAAC,EAAE,MAAM;IAOrC;;OAEG;IACH,sBAAsB,IAAI,OAAO;IAI3B,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAmFxD;;OAEG;YACW,qBAAqB;IAoCnC;;OAEG;YACW,sBAAsB;IAgDpC;;OAEG;IACH,OAAO,CAAC,2BAA2B;IAyGnC;;OAEG;YACW,uBAAuB;IAUrC;;OAEG;YACW,0BAA0B;IAkFxC;;OAEG;IACH,OAAO,CAAC,eAAe;IAwBvB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAgBlC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAgB/B;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAevC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAiBpC;;OAEG;IACH,OAAO,CAAC,8BAA8B;IAgBtC;;OAEG;IACH,OAAO,CAAC,4BAA4B;IAcpC;;OAEG;YACW,iBAAiB;IA2B/B;;OAEG;YACW,4BAA4B;IAK1C;;OAEG;YACW,yBAAyB;IAKvC;;OAEG;YACW,iCAAiC;IAK/C;;OAEG;YACW,8BAA8B;IAK5C;;OAEG;YACW,gCAAgC;IAK9C;;OAEG;YACW,8BAA8B;IAK5C;;OAEG;IACH,OAAO,CAAC,uBAAuB;CAoBhC"}
|