@defai.digital/automatosx 12.8.7 → 13.1.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.
- package/LICENSE +1 -1
- package/dist/bin.d.ts +8 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +16 -0
- package/dist/bin.js.map +1 -0
- package/dist/index.d.ts +8 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -74239
- package/dist/index.js.map +1 -0
- package/package.json +35 -160
- package/.github/assets/ax-cli.png +0 -0
- package/.github/assets/axlogo.png +0 -0
- package/CHANGELOG.md +0 -81
- package/README.md +0 -790
- package/SECURITY.md +0 -173
- package/dist/mcp/index.d.ts +0 -2
- package/dist/mcp/index.js +0 -43627
- package/examples/AGENTS_INFO.md +0 -187
- package/examples/README.md +0 -434
- package/examples/abilities/accessibility.md +0 -115
- package/examples/abilities/api-design.md +0 -168
- package/examples/abilities/best-practices.md +0 -102
- package/examples/abilities/caching-strategy.md +0 -165
- package/examples/abilities/ci-cd.md +0 -61
- package/examples/abilities/clean-code.md +0 -398
- package/examples/abilities/code-generation.md +0 -333
- package/examples/abilities/code-review.md +0 -51
- package/examples/abilities/component-architecture.md +0 -112
- package/examples/abilities/content-creation.md +0 -97
- package/examples/abilities/data-modeling.md +0 -171
- package/examples/abilities/data-validation.md +0 -50
- package/examples/abilities/db-modeling.md +0 -167
- package/examples/abilities/debugging.md +0 -52
- package/examples/abilities/design-patterns.md +0 -437
- package/examples/abilities/design-system-implementation.md +0 -126
- package/examples/abilities/documentation.md +0 -54
- package/examples/abilities/etl-pipelines.md +0 -44
- package/examples/abilities/feasibility-study.md +0 -20
- package/examples/abilities/general-assistance.md +0 -26
- package/examples/abilities/idea-evaluation.md +0 -21
- package/examples/abilities/infra-as-code.md +0 -57
- package/examples/abilities/job-orchestration.md +0 -44
- package/examples/abilities/literature-review.md +0 -19
- package/examples/abilities/longform-report.md +0 -25
- package/examples/abilities/mathematical-reasoning.md +0 -170
- package/examples/abilities/observability.md +0 -61
- package/examples/abilities/orbital-mechanics.md +0 -50
- package/examples/abilities/our-architecture-decisions.md +0 -180
- package/examples/abilities/our-code-review-checklist.md +0 -149
- package/examples/abilities/our-coding-standards.md +0 -369
- package/examples/abilities/our-project-structure.md +0 -183
- package/examples/abilities/performance.md +0 -89
- package/examples/abilities/problem-solving.md +0 -50
- package/examples/abilities/propulsion-systems.md +0 -50
- package/examples/abilities/quantum-algorithm-design.md +0 -54
- package/examples/abilities/quantum-error-correction.md +0 -56
- package/examples/abilities/quantum-frameworks-transpilation.md +0 -53
- package/examples/abilities/quantum-noise-modeling.md +0 -58
- package/examples/abilities/refactoring.md +0 -223
- package/examples/abilities/release-strategy.md +0 -58
- package/examples/abilities/secrets-policy.md +0 -61
- package/examples/abilities/secure-coding-review.md +0 -60
- package/examples/abilities/software-architecture.md +0 -394
- package/examples/abilities/solid-principles.md +0 -341
- package/examples/abilities/sql-optimization.md +0 -84
- package/examples/abilities/state-management.md +0 -96
- package/examples/abilities/task-planning.md +0 -65
- package/examples/abilities/technical-writing.md +0 -77
- package/examples/abilities/telemetry-diagnostics.md +0 -51
- package/examples/abilities/testing.md +0 -56
- package/examples/abilities/threat-modeling.md +0 -58
- package/examples/abilities/troubleshooting.md +0 -80
- package/examples/abilities/typescript-zod-validation.md +0 -830
- package/examples/agents/AGENTS_INTEGRATION.md +0 -99
- package/examples/agents/aerospace-scientist.yaml +0 -159
- package/examples/agents/architecture.yaml +0 -244
- package/examples/agents/automatosx.config.json +0 -286
- package/examples/agents/backend.yaml +0 -141
- package/examples/agents/ceo.yaml +0 -105
- package/examples/agents/creative-marketer.yaml +0 -173
- package/examples/agents/cto.yaml +0 -118
- package/examples/agents/data-scientist.yaml +0 -200
- package/examples/agents/data.yaml +0 -106
- package/examples/agents/design.yaml +0 -115
- package/examples/agents/devops.yaml +0 -124
- package/examples/agents/frontend.yaml +0 -171
- package/examples/agents/fullstack.yaml +0 -172
- package/examples/agents/mobile.yaml +0 -185
- package/examples/agents/product.yaml +0 -103
- package/examples/agents/quality.yaml +0 -117
- package/examples/agents/quantum-engineer.yaml +0 -166
- package/examples/agents/researcher.yaml +0 -122
- package/examples/agents/security.yaml +0 -115
- package/examples/agents/standard.yaml +0 -214
- package/examples/agents/writer.yaml +0 -122
- package/examples/providers/README.md +0 -117
- package/examples/providers/claude/CLAUDE_INTEGRATION.md +0 -302
- package/examples/providers/claude/mcp/automatosx.json +0 -244
- package/examples/providers/codex/CODEX_INTEGRATION.md +0 -593
- package/examples/providers/codex/README.md +0 -349
- package/examples/providers/codex/usage-examples.ts +0 -421
- package/examples/providers/gemini/GEMINI_INTEGRATION.md +0 -236
- package/examples/providers/gemini/README.md +0 -76
- package/examples/providers/openai-codex-example.ts +0 -421
- package/examples/pytorch_resnet50_training.py +0 -289
- package/examples/specs/automatosx-release.ax.yaml +0 -380
- package/examples/specs/enterprise.ax.yaml +0 -121
- package/examples/specs/enterprise.yaml.mustache +0 -121
- package/examples/specs/government.ax.yaml +0 -148
- package/examples/specs/government.yaml.mustache +0 -148
- package/examples/specs/minimal.ax.yaml +0 -21
- package/examples/specs/minimal.yaml.mustache +0 -21
- package/examples/teams/business.yaml +0 -56
- package/examples/teams/core.yaml +0 -60
- package/examples/teams/design.yaml +0 -58
- package/examples/teams/engineering.yaml +0 -69
- package/examples/teams/research.yaml +0 -56
- package/examples/use-cases/01-web-app-development.md +0 -374
- package/examples/workflows/analyst.yaml +0 -60
- package/examples/workflows/assistant.yaml +0 -48
- package/examples/workflows/basic-agent.yaml +0 -28
- package/examples/workflows/code-reviewer.yaml +0 -52
- package/examples/workflows/debugger.yaml +0 -63
- package/examples/workflows/designer.yaml +0 -69
- package/examples/workflows/developer.yaml +0 -60
- package/examples/workflows/fullstack-developer.yaml +0 -395
- package/examples/workflows/qa-specialist.yaml +0 -71
- package/schema/ability-metadata.json +0 -21
- package/schema/config.json +0 -703
- package/schema/spec-schema.json +0 -608
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Codex CLI CLI Integration - Usage Examples
|
|
3
|
-
*
|
|
4
|
-
* This file demonstrates various ways to use the Codex CLI integration
|
|
5
|
-
* with AutomatosX, including basic execution, MCP server management, and
|
|
6
|
-
* advanced patterns.
|
|
7
|
-
*
|
|
8
|
-
* @see docs/integrations/openai-codex.md for complete documentation
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
CodexBridge,
|
|
13
|
-
CodexCLI,
|
|
14
|
-
CodexMCPManager,
|
|
15
|
-
CodexError,
|
|
16
|
-
CodexErrorType,
|
|
17
|
-
getDefaultBridge,
|
|
18
|
-
getDefaultCLI,
|
|
19
|
-
getDefaultMCPManager,
|
|
20
|
-
} from '../../src/integrations/openai-codex/index.js';
|
|
21
|
-
|
|
22
|
-
// ========================================
|
|
23
|
-
// Example 1: Basic CLI Execution
|
|
24
|
-
// ========================================
|
|
25
|
-
|
|
26
|
-
async function example1_basicExecution() {
|
|
27
|
-
console.log('\n=== Example 1: Basic CLI Execution ===\n');
|
|
28
|
-
|
|
29
|
-
const cli = new CodexCLI({
|
|
30
|
-
command: 'codex',
|
|
31
|
-
sandboxMode: 'workspace-write',
|
|
32
|
-
timeout: 60000,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
// Check if codex CLI is available
|
|
37
|
-
const available = await cli.isAvailable();
|
|
38
|
-
if (!available) {
|
|
39
|
-
console.error('Codex CLI not found. Install with: npm i -g @openai/codex');
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Get CLI version
|
|
44
|
-
const version = await cli.getVersion();
|
|
45
|
-
console.log(`Using Codex CLI version: ${version}`);
|
|
46
|
-
|
|
47
|
-
// Execute a simple prompt
|
|
48
|
-
const result = await cli.execute({
|
|
49
|
-
prompt: 'Explain the benefits of TypeScript in 3 sentences',
|
|
50
|
-
temperature: 0.7,
|
|
51
|
-
maxTokens: 200,
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
console.log('\nResponse:');
|
|
55
|
-
console.log(result.content);
|
|
56
|
-
console.log(`\nDuration: ${result.duration}ms`);
|
|
57
|
-
console.log(`Token count: ${result.tokenCount ?? 'N/A'}`);
|
|
58
|
-
} catch (error) {
|
|
59
|
-
if (error instanceof CodexError) {
|
|
60
|
-
console.error(`Codex error [${error.type}]:`, error.message);
|
|
61
|
-
if (error.context) {
|
|
62
|
-
console.error('Context:', error.context);
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
console.error('Unexpected error:', error);
|
|
66
|
-
}
|
|
67
|
-
} finally {
|
|
68
|
-
await cli.cleanup();
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// ========================================
|
|
73
|
-
// Example 2: Streaming Execution
|
|
74
|
-
// ========================================
|
|
75
|
-
|
|
76
|
-
async function example2_streamingExecution() {
|
|
77
|
-
console.log('\n=== Example 2: Streaming Execution ===\n');
|
|
78
|
-
|
|
79
|
-
const cli = new CodexCLI({
|
|
80
|
-
command: 'codex',
|
|
81
|
-
sandboxMode: 'workspace-write',
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
const result = await cli.execute({
|
|
86
|
-
prompt: 'Write a short poem about programming',
|
|
87
|
-
streaming: true,
|
|
88
|
-
temperature: 0.9,
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
console.log('Streamed response:');
|
|
92
|
-
console.log(result.content);
|
|
93
|
-
} catch (error) {
|
|
94
|
-
console.error('Error:', error instanceof CodexError ? error.message : error);
|
|
95
|
-
} finally {
|
|
96
|
-
await cli.cleanup();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ========================================
|
|
101
|
-
// Example 3: MCP Server Management
|
|
102
|
-
// ========================================
|
|
103
|
-
|
|
104
|
-
async function example3_mcpServer() {
|
|
105
|
-
console.log('\n=== Example 3: MCP Server Management ===\n');
|
|
106
|
-
|
|
107
|
-
const mcpManager = new CodexMCPManager({
|
|
108
|
-
enabled: true,
|
|
109
|
-
command: 'codex',
|
|
110
|
-
transport: 'stdio',
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
try {
|
|
114
|
-
// Start MCP server
|
|
115
|
-
console.log('Starting MCP server...');
|
|
116
|
-
const startStatus = await mcpManager.startServer();
|
|
117
|
-
console.log(`MCP server started (PID: ${startStatus.pid})`);
|
|
118
|
-
|
|
119
|
-
// Check server status
|
|
120
|
-
const status = await mcpManager.getStatus();
|
|
121
|
-
console.log('\nServer Status:');
|
|
122
|
-
console.log(` Running: ${status.running}`);
|
|
123
|
-
console.log(` PID: ${status.pid}`);
|
|
124
|
-
console.log(` Uptime: ${status.uptime ? `${status.uptime}ms` : 'N/A'}`);
|
|
125
|
-
|
|
126
|
-
// Health check
|
|
127
|
-
const healthy = await mcpManager.isHealthy();
|
|
128
|
-
console.log(` Healthy: ${healthy}`);
|
|
129
|
-
|
|
130
|
-
// Wait a bit
|
|
131
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
132
|
-
|
|
133
|
-
// Stop server
|
|
134
|
-
console.log('\nStopping MCP server...');
|
|
135
|
-
await mcpManager.stopServer();
|
|
136
|
-
console.log('MCP server stopped');
|
|
137
|
-
} catch (error) {
|
|
138
|
-
if (error instanceof CodexError) {
|
|
139
|
-
console.error(`MCP error [${error.type}]:`, error.message);
|
|
140
|
-
} else {
|
|
141
|
-
console.error('Error:', error);
|
|
142
|
-
}
|
|
143
|
-
} finally {
|
|
144
|
-
await mcpManager.cleanup();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// ========================================
|
|
149
|
-
// Example 4: Full Integration with Bridge
|
|
150
|
-
// ========================================
|
|
151
|
-
|
|
152
|
-
async function example4_fullIntegration() {
|
|
153
|
-
console.log('\n=== Example 4: Full Integration with Bridge ===\n');
|
|
154
|
-
|
|
155
|
-
const bridge = new CodexBridge(
|
|
156
|
-
{
|
|
157
|
-
command: 'codex',
|
|
158
|
-
sandboxMode: 'workspace-write',
|
|
159
|
-
timeout: 120000,
|
|
160
|
-
temperature: 0.7,
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
enabled: true,
|
|
164
|
-
command: 'codex',
|
|
165
|
-
transport: 'stdio',
|
|
166
|
-
autoStart: false, // Manual start for this example
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
// Initialize bridge (checks CLI availability)
|
|
172
|
-
console.log('Initializing Codex bridge...');
|
|
173
|
-
const initStatus = await bridge.initialize();
|
|
174
|
-
|
|
175
|
-
console.log('\nIntegration Status:');
|
|
176
|
-
console.log(` CLI Available: ${initStatus.cliAvailable}`);
|
|
177
|
-
console.log(` CLI Version: ${initStatus.version}`);
|
|
178
|
-
console.log(` Initialized: ${initStatus.initialized}`);
|
|
179
|
-
|
|
180
|
-
// Execute a prompt
|
|
181
|
-
console.log('\nExecuting prompt via bridge...');
|
|
182
|
-
const result = await bridge.execute({
|
|
183
|
-
prompt: 'What are the key principles of clean code?',
|
|
184
|
-
maxTokens: 300,
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
console.log('\nResponse:');
|
|
188
|
-
console.log(result.content.substring(0, 200) + '...');
|
|
189
|
-
console.log(`Duration: ${result.duration}ms`);
|
|
190
|
-
|
|
191
|
-
// Start MCP server if needed
|
|
192
|
-
console.log('\nStarting MCP server...');
|
|
193
|
-
await bridge.startMCPServer();
|
|
194
|
-
|
|
195
|
-
const mcpHealthy = await bridge.isMCPServerHealthy();
|
|
196
|
-
console.log(`MCP Server healthy: ${mcpHealthy}`);
|
|
197
|
-
|
|
198
|
-
// Execute another prompt (with MCP server running)
|
|
199
|
-
const result2 = await bridge.execute({
|
|
200
|
-
prompt: 'List 5 design patterns',
|
|
201
|
-
maxTokens: 200,
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
console.log('\nSecond response:');
|
|
205
|
-
console.log(result2.content);
|
|
206
|
-
|
|
207
|
-
// Stop MCP server
|
|
208
|
-
await bridge.stopMCPServer();
|
|
209
|
-
console.log('\nMCP server stopped');
|
|
210
|
-
} catch (error) {
|
|
211
|
-
if (error instanceof CodexError) {
|
|
212
|
-
console.error(`\nError [${error.type}]:`, error.message);
|
|
213
|
-
} else {
|
|
214
|
-
console.error('\nError:', error);
|
|
215
|
-
}
|
|
216
|
-
} finally {
|
|
217
|
-
await bridge.cleanup();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// ========================================
|
|
222
|
-
// Example 5: Error Handling Patterns
|
|
223
|
-
// ========================================
|
|
224
|
-
|
|
225
|
-
async function example5_errorHandling() {
|
|
226
|
-
console.log('\n=== Example 5: Error Handling Patterns ===\n');
|
|
227
|
-
|
|
228
|
-
const cli = new CodexCLI({ command: 'codex' });
|
|
229
|
-
|
|
230
|
-
// Pattern 1: Type-specific error handling
|
|
231
|
-
try {
|
|
232
|
-
await cli.execute({ prompt: 'test' });
|
|
233
|
-
} catch (error) {
|
|
234
|
-
if (error instanceof CodexError) {
|
|
235
|
-
switch (error.type) {
|
|
236
|
-
case CodexErrorType.CLI_NOT_FOUND:
|
|
237
|
-
console.error('Install codex: npm i -g @openai/codex');
|
|
238
|
-
break;
|
|
239
|
-
case CodexErrorType.TIMEOUT:
|
|
240
|
-
console.error('Request timed out, try increasing timeout');
|
|
241
|
-
break;
|
|
242
|
-
case CodexErrorType.EXECUTION_FAILED:
|
|
243
|
-
console.error('Execution failed:', error.context);
|
|
244
|
-
break;
|
|
245
|
-
default:
|
|
246
|
-
console.error('Codex error:', error.message);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
} finally {
|
|
250
|
-
await cli.cleanup();
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Pattern 2: Retry with backoff
|
|
254
|
-
async function executeWithRetry(prompt: string, maxRetries = 3) {
|
|
255
|
-
let attempt = 0;
|
|
256
|
-
while (attempt < maxRetries) {
|
|
257
|
-
try {
|
|
258
|
-
return await cli.execute({ prompt });
|
|
259
|
-
} catch (error) {
|
|
260
|
-
attempt++;
|
|
261
|
-
if (attempt >= maxRetries) throw error;
|
|
262
|
-
|
|
263
|
-
const delay = 1000 * Math.pow(2, attempt);
|
|
264
|
-
console.log(`Retry ${attempt}/${maxRetries} after ${delay}ms...`);
|
|
265
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
try {
|
|
271
|
-
const result = await executeWithRetry('Generate a haiku');
|
|
272
|
-
console.log('Success after retries:', result.content);
|
|
273
|
-
} catch (error) {
|
|
274
|
-
console.error('All retries failed');
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// ========================================
|
|
279
|
-
// Example 6: Using Default Instances
|
|
280
|
-
// ========================================
|
|
281
|
-
|
|
282
|
-
async function example6_defaultInstances() {
|
|
283
|
-
console.log('\n=== Example 6: Using Default Instances ===\n');
|
|
284
|
-
|
|
285
|
-
// Get default CLI instance (shared across calls)
|
|
286
|
-
const cli = getDefaultCLI();
|
|
287
|
-
|
|
288
|
-
try {
|
|
289
|
-
const result = await cli.execute({
|
|
290
|
-
prompt: 'What is dependency injection?',
|
|
291
|
-
maxTokens: 150,
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
console.log('Response:', result.content);
|
|
295
|
-
} finally {
|
|
296
|
-
await cli.cleanup();
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// Get default bridge instance
|
|
300
|
-
const bridge = getDefaultBridge(
|
|
301
|
-
{ command: 'codex', sandboxMode: 'workspace-write' },
|
|
302
|
-
{ enabled: false } // MCP disabled
|
|
303
|
-
);
|
|
304
|
-
|
|
305
|
-
try {
|
|
306
|
-
await bridge.initialize();
|
|
307
|
-
const result = await bridge.execute({
|
|
308
|
-
prompt: 'Explain SOLID principles in one sentence each',
|
|
309
|
-
});
|
|
310
|
-
console.log('\nSOLID principles:', result.content);
|
|
311
|
-
} finally {
|
|
312
|
-
await bridge.cleanup();
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
// ========================================
|
|
317
|
-
// Example 7: Advanced Configuration
|
|
318
|
-
// ========================================
|
|
319
|
-
|
|
320
|
-
async function example7_advancedConfiguration() {
|
|
321
|
-
console.log('\n=== Example 7: Advanced Configuration ===\n');
|
|
322
|
-
|
|
323
|
-
// Different sandbox modes
|
|
324
|
-
const modes = ['workspace-write', 'full', 'none'] as const;
|
|
325
|
-
|
|
326
|
-
for (const mode of modes) {
|
|
327
|
-
const cli = new CodexCLI({
|
|
328
|
-
command: 'codex',
|
|
329
|
-
sandboxMode: mode,
|
|
330
|
-
timeout: 30000,
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
try {
|
|
334
|
-
console.log(`\nTesting sandbox mode: ${mode}`);
|
|
335
|
-
const result = await cli.execute({
|
|
336
|
-
prompt: 'Describe file system access in sandbox mode',
|
|
337
|
-
maxTokens: 100,
|
|
338
|
-
});
|
|
339
|
-
console.log(`Response: ${result.content.substring(0, 100)}...`);
|
|
340
|
-
} catch (error) {
|
|
341
|
-
console.error(`Error in ${mode} mode:`, error);
|
|
342
|
-
} finally {
|
|
343
|
-
await cli.cleanup();
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// MCP with config overrides
|
|
348
|
-
const mcpManager = new CodexMCPManager({
|
|
349
|
-
enabled: true,
|
|
350
|
-
command: 'codex',
|
|
351
|
-
transport: 'stdio',
|
|
352
|
-
configOverrides: {
|
|
353
|
-
timeout: 60000,
|
|
354
|
-
retries: 3,
|
|
355
|
-
},
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
try {
|
|
359
|
-
console.log('\nStarting MCP with custom config...');
|
|
360
|
-
await mcpManager.startServer();
|
|
361
|
-
console.log('MCP server started with custom configuration');
|
|
362
|
-
await mcpManager.stopServer();
|
|
363
|
-
} catch (error) {
|
|
364
|
-
console.error('MCP error:', error);
|
|
365
|
-
} finally {
|
|
366
|
-
await mcpManager.cleanup();
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// ========================================
|
|
371
|
-
// Main Entry Point
|
|
372
|
-
// ========================================
|
|
373
|
-
|
|
374
|
-
async function main() {
|
|
375
|
-
console.log('Codex CLI Integration - Usage Examples');
|
|
376
|
-
console.log('==========================================\n');
|
|
377
|
-
|
|
378
|
-
const examples = [
|
|
379
|
-
{ name: 'Basic Execution', fn: example1_basicExecution },
|
|
380
|
-
{ name: 'Streaming Execution', fn: example2_streamingExecution },
|
|
381
|
-
{ name: 'MCP Server Management', fn: example3_mcpServer },
|
|
382
|
-
{ name: 'Full Integration', fn: example4_fullIntegration },
|
|
383
|
-
{ name: 'Error Handling', fn: example5_errorHandling },
|
|
384
|
-
{ name: 'Default Instances', fn: example6_defaultInstances },
|
|
385
|
-
{ name: 'Advanced Configuration', fn: example7_advancedConfiguration },
|
|
386
|
-
];
|
|
387
|
-
|
|
388
|
-
// Run examples (comment out ones you don't want to run)
|
|
389
|
-
for (const { name, fn } of examples) {
|
|
390
|
-
console.log(`\n${'='.repeat(60)}`);
|
|
391
|
-
console.log(`Running: ${name}`);
|
|
392
|
-
console.log('='.repeat(60));
|
|
393
|
-
|
|
394
|
-
try {
|
|
395
|
-
await fn();
|
|
396
|
-
} catch (error) {
|
|
397
|
-
console.error(`\nExample failed: ${error}`);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// Wait between examples
|
|
401
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
console.log('\n\nAll examples completed!');
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// Run if executed directly
|
|
408
|
-
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
409
|
-
main().catch(console.error);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// Export examples for use in other files
|
|
413
|
-
export {
|
|
414
|
-
example1_basicExecution,
|
|
415
|
-
example2_streamingExecution,
|
|
416
|
-
example3_mcpServer,
|
|
417
|
-
example4_fullIntegration,
|
|
418
|
-
example5_errorHandling,
|
|
419
|
-
example6_defaultInstances,
|
|
420
|
-
example7_advancedConfiguration,
|
|
421
|
-
};
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
# AutomatosX Integration for Gemini CLI
|
|
2
|
-
|
|
3
|
-
**IMPORTANT**: For the complete AutomatosX integration guide, **please read [AX-Integration.md](../AX-Integration.md)**.
|
|
4
|
-
|
|
5
|
-
This file provides Gemini CLI-specific tips and quick reference. For comprehensive documentation including all agents, commands, memory features, workflows, and troubleshooting, see [AX-Integration.md](../AX-Integration.md).
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Quick Start for Gemini CLI Users
|
|
10
|
-
|
|
11
|
-
### Natural Language Integration
|
|
12
|
-
|
|
13
|
-
Gemini CLI can invoke AutomatosX agents using natural language:
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
"Please use the ax backend agent to implement user authentication"
|
|
17
|
-
"Ask the ax security agent to audit this code for vulnerabilities"
|
|
18
|
-
"Have the ax quality agent write tests for this feature"
|
|
19
|
-
"Work with ax agent product to design this new feature"
|
|
20
|
-
"Use ax agent devops to set up the deployment pipeline"
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Gemini CLI will understand your intent and invoke the appropriate AutomatosX agent for you. Just describe what you need in natural language - no special commands required!
|
|
24
|
-
|
|
25
|
-
### Essential Commands
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# List all available agents
|
|
29
|
-
ax list agents
|
|
30
|
-
|
|
31
|
-
# Run an agent with a task
|
|
32
|
-
ax run backend "create a REST API for user management"
|
|
33
|
-
|
|
34
|
-
# Search memory for past conversations
|
|
35
|
-
ax memory search "authentication"
|
|
36
|
-
|
|
37
|
-
# View system status
|
|
38
|
-
ax status
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
---
|
|
42
|
-
|
|
43
|
-
## Gemini CLI-Specific Tips
|
|
44
|
-
|
|
45
|
-
### 1. Natural Language is Best
|
|
46
|
-
|
|
47
|
-
Custom slash commands have been removed. Instead, talk naturally to Gemini CLI:
|
|
48
|
-
|
|
49
|
-
**Natural Language Examples**:
|
|
50
|
-
```
|
|
51
|
-
"Use ax agent backend to create a REST API for authentication"
|
|
52
|
-
"Ask ax agent frontend to build a responsive navbar"
|
|
53
|
-
"Have ax agent security audit this code for vulnerabilities"
|
|
54
|
-
"Work with ax agent quality to write unit tests"
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### 2. Direct CLI Access
|
|
58
|
-
|
|
59
|
-
For direct terminal usage:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
# Run agents directly
|
|
63
|
-
ax run backend "task"
|
|
64
|
-
|
|
65
|
-
# Search memory
|
|
66
|
-
ax memory search "keyword"
|
|
67
|
-
|
|
68
|
-
# Check status
|
|
69
|
-
ax status
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### 3. Workspace Conventions
|
|
73
|
-
|
|
74
|
-
AutomatosX uses specific directories:
|
|
75
|
-
|
|
76
|
-
- **`automatosx/PRD/`** - Design specs and planning documents
|
|
77
|
-
- **`automatosx/tmp/`** - Temporary files and scratch work
|
|
78
|
-
|
|
79
|
-
**Usage in Gemini CLI** (natural language):
|
|
80
|
-
```
|
|
81
|
-
"Use ax product agent to save the design to automatosx/PRD/auth-design.md"
|
|
82
|
-
"Have ax backend agent put the draft in automatosx/tmp/auth-draft.ts"
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### 4. Provider Configuration
|
|
86
|
-
|
|
87
|
-
Gemini is typically configured with high priority for Gemini CLI users:
|
|
88
|
-
|
|
89
|
-
```json
|
|
90
|
-
{
|
|
91
|
-
"providers": {
|
|
92
|
-
"gemini-cli": {
|
|
93
|
-
"enabled": true,
|
|
94
|
-
"priority": 1,
|
|
95
|
-
"command": "gemini"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Edit `ax.config.json` to customize.
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
## Available Agents
|
|
106
|
-
|
|
107
|
-
Quick reference (for full list, see [AX-Integration.md](../AX-Integration.md)):
|
|
108
|
-
|
|
109
|
-
- **backend** (Bob) - Backend development
|
|
110
|
-
- **frontend** (Frank) - Frontend development
|
|
111
|
-
- **fullstack** (Felix) - Full-stack development
|
|
112
|
-
- **mobile** (Maya) - Mobile development
|
|
113
|
-
- **devops** (Oliver) - DevOps and infrastructure
|
|
114
|
-
- **security** (Steve) - Security auditing
|
|
115
|
-
- **quality** (Queenie) - QA and testing
|
|
116
|
-
- **architecture** (Avery) - System architecture
|
|
117
|
-
- **data** (Daisy) - Data engineering
|
|
118
|
-
- **design** (Debbee) - UX/UI design
|
|
119
|
-
- **product** (Paris) - Product management
|
|
120
|
-
- **writer** (Wendy) - Technical writing
|
|
121
|
-
|
|
122
|
-
**Full list**: `ax list agents --format json`
|
|
123
|
-
|
|
124
|
-
---
|
|
125
|
-
|
|
126
|
-
## Memory System
|
|
127
|
-
|
|
128
|
-
AutomatosX automatically saves all agent conversations:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
# Search memory
|
|
132
|
-
ax memory search "authentication"
|
|
133
|
-
|
|
134
|
-
# List recent memories
|
|
135
|
-
ax memory list --limit 10
|
|
136
|
-
|
|
137
|
-
# Export for backup
|
|
138
|
-
ax memory export > backup.json
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**In Gemini CLI** (natural language):
|
|
142
|
-
```
|
|
143
|
-
"Search AutomatosX memory for authentication"
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
**Details**: Fast SQLite FTS5 search (< 1ms), 100% local, $0 API costs.
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## Multi-Agent Collaboration
|
|
151
|
-
|
|
152
|
-
Agents can delegate tasks automatically:
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
ax run product "Build a complete user authentication feature"
|
|
156
|
-
# → Product designs system
|
|
157
|
-
# → Delegates to backend for implementation
|
|
158
|
-
# → Delegates to security for audit
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
**Gemini CLI Example**:
|
|
162
|
-
```
|
|
163
|
-
"Use ax product agent to build a complete user authentication feature"
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## Troubleshooting
|
|
169
|
-
|
|
170
|
-
### Common Issues
|
|
171
|
-
|
|
172
|
-
**"Agent not found"**
|
|
173
|
-
```bash
|
|
174
|
-
ax list agents # Case-sensitive names
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
**"Provider not available"**
|
|
178
|
-
```bash
|
|
179
|
-
ax status
|
|
180
|
-
ax doctor
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
**"Gemini CLI not found"**
|
|
184
|
-
```bash
|
|
185
|
-
npm install -g @google/gemini-cli
|
|
186
|
-
gemini --version
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Getting Help
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
# Command help
|
|
193
|
-
ax --help
|
|
194
|
-
ax run --help
|
|
195
|
-
|
|
196
|
-
# Debug mode
|
|
197
|
-
ax --debug run backend "task"
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
**In Gemini CLI** (natural language):
|
|
201
|
-
```
|
|
202
|
-
"Check AutomatosX system status"
|
|
203
|
-
"List all available agents"
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
## Advanced Features
|
|
209
|
-
|
|
210
|
-
For advanced usage, see [AX-Integration.md](../AX-Integration.md):
|
|
211
|
-
|
|
212
|
-
- **Spec-Driven Workflows** - YAML-based task definitions
|
|
213
|
-
- **Parallel Execution** - Run multiple agents concurrently
|
|
214
|
-
- **Resumable Runs** - Checkpoint and resume long tasks
|
|
215
|
-
- **Streaming Output** - Real-time AI responses
|
|
216
|
-
- **Provider Routing** - Intelligent multi-provider selection
|
|
217
|
-
- **Cost Optimization** - Free-tier prioritization
|
|
218
|
-
- **Custom Agents** - Create your own specialized agents
|
|
219
|
-
|
|
220
|
-
---
|
|
221
|
-
|
|
222
|
-
## Documentation
|
|
223
|
-
|
|
224
|
-
- **Complete Guide**: [AX-Integration.md](../AX-Integration.md) ← **Read this!**
|
|
225
|
-
- **GitHub**: https://github.com/defai-digital/automatosx
|
|
226
|
-
- **Agent Profiles**: `.automatosx/agents/`
|
|
227
|
-
- **Configuration**: `ax.config.json`
|
|
228
|
-
|
|
229
|
-
## Support
|
|
230
|
-
|
|
231
|
-
- **Issues**: https://github.com/defai-digital/automatosx/issues
|
|
232
|
-
- **NPM**: https://www.npmjs.com/package/@defai.digital/automatosx
|
|
233
|
-
|
|
234
|
-
---
|
|
235
|
-
|
|
236
|
-
**For complete AutomatosX documentation**, see [AX-Integration.md](../AX-Integration.md).
|