@defai.digital/ax-cli 1.1.3 → 1.1.4

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.
Files changed (36) hide show
  1. package/README.md +91 -1264
  2. package/dist/agent/context-manager.js +5 -1
  3. package/dist/agent/context-manager.js.map +1 -1
  4. package/dist/agent/grok-agent.d.ts +5 -0
  5. package/dist/agent/grok-agent.js +23 -1
  6. package/dist/agent/grok-agent.js.map +1 -1
  7. package/dist/hooks/use-input-handler.js +103 -0
  8. package/dist/hooks/use-input-handler.js.map +1 -1
  9. package/dist/index.js +6 -6
  10. package/dist/index.js.map +1 -1
  11. package/dist/mcp/client.d.ts +4 -0
  12. package/dist/mcp/client.js +14 -1
  13. package/dist/mcp/client.js.map +1 -1
  14. package/dist/tools/text-editor.js +12 -2
  15. package/dist/tools/text-editor.js.map +1 -1
  16. package/dist/utils/confirmation-service.d.ts +1 -0
  17. package/dist/utils/confirmation-service.js +8 -7
  18. package/dist/utils/confirmation-service.js.map +1 -1
  19. package/package.json +1 -1
  20. package/automatosx.config.json +0 -333
  21. package/packages/schemas/dist/index.d.ts +0 -14
  22. package/packages/schemas/dist/index.d.ts.map +0 -1
  23. package/packages/schemas/dist/index.js +0 -19
  24. package/packages/schemas/dist/index.js.map +0 -1
  25. package/packages/schemas/dist/public/core/brand-types.d.ts +0 -308
  26. package/packages/schemas/dist/public/core/brand-types.d.ts.map +0 -1
  27. package/packages/schemas/dist/public/core/brand-types.js +0 -243
  28. package/packages/schemas/dist/public/core/brand-types.js.map +0 -1
  29. package/packages/schemas/dist/public/core/enums.d.ts +0 -227
  30. package/packages/schemas/dist/public/core/enums.d.ts.map +0 -1
  31. package/packages/schemas/dist/public/core/enums.js +0 -222
  32. package/packages/schemas/dist/public/core/enums.js.map +0 -1
  33. package/packages/schemas/dist/public/core/id-types.d.ts +0 -286
  34. package/packages/schemas/dist/public/core/id-types.d.ts.map +0 -1
  35. package/packages/schemas/dist/public/core/id-types.js +0 -136
  36. package/packages/schemas/dist/public/core/id-types.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AX CLI - Enterprise-Class AI CLI
2
2
 
3
- [![Tests](https://img.shields.io/badge/tests-124%20passing-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)
3
+ [![Tests](https://img.shields.io/badge/tests-306%20passing-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)
4
4
  [![Coverage](https://img.shields.io/badge/coverage-98.29%25-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli)
5
5
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D24.0.0-brightgreen?style=flat-square)](https://nodejs.org/)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.9%2B-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
@@ -14,1355 +14,182 @@
14
14
 
15
15
  ---
16
16
 
17
- ## 🚀 Overview
17
+ ## 🚀 Quick Start
18
18
 
19
- **AX CLI** is an **enterprise-class AI command line interface** primarily designed for **GLM (General Language Model)** with support for multiple AI providers. Combining the power of offline-first local LLM execution with cloud-based AI services, AX CLI delivers production-ready quality with comprehensive testing, robust TypeScript architecture, and enterprise-grade reliability.
20
-
21
- Originally forked from [grok-cli](https://github.com/superagent-ai/grok-cli), AX CLI has been extensively upgraded using **AutomatosX** — a multi-agent AI orchestration platform — to achieve enterprise-class standards.
22
-
23
- ### 🏆 Enterprise-Class Features
24
-
25
- - **🤖 Built with AutomatosX**: Developed using multi-agent collaboration for production-quality code
26
- - **✅ 98%+ Test Coverage**: Comprehensive test suite with 83+ tests covering critical paths
27
- - **🔒 Type-Safe Architecture**: Full TypeScript with Zod runtime validation
28
- - **🎯 Node.js 24+ Ready**: Modern JavaScript runtime support
29
- - **📊 Quality Assurance**: Automated testing, linting, and continuous integration
30
- - **🏗️ Enterprise Architecture**: Clean separation of concerns, modular design, extensible APIs
31
-
32
- ### 💡 Why AX CLI?
33
-
34
- **GLM-Optimized**: Primary support for GLM (General Language Model) with optimized performance for local and cloud GLM deployments.
35
-
36
- **Production-Ready**: AX CLI is enterprise-grade with extensive testing, TypeScript safety, and proven reliability.
37
-
38
- ---
39
-
40
- ## 🏗️ Enterprise Architecture
41
-
42
- ### Single Source of Truth (SSOT) Type System
43
-
44
- AX CLI implements a **Single Source of Truth** design pattern through the `@ax-cli/schemas` package. This ensures that **API handlers, billing modules, and MCP adapters all consume the same schema**, drastically reducing future refactoring costs.
45
-
46
- #### The Problem: Before SSOT
47
-
48
- Without centralized schemas, each module maintained its own type definitions, leading to:
49
-
50
- ```
51
- ┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
52
- │ API Handler │ │ MCP Adapter │ │ Billing Module │
53
- ├─────────────────────┤ ├─────────────────────┤ ├─────────────────────┤
54
- │ type ModelId = │ │ type ModelName = │ │ type Model = │
55
- │ string │ │ string │ │ string │
56
- │ │ │ │ │ │
57
- │ interface Message { │ │ interface Msg { │ │ interface Request { │
58
- │ role: string │ │ type: string │ │ role: string │
59
- │ content: string │ │ text: string │ │ content: string │
60
- │ } │ │ } │ │ } │
61
- └─────────────────────┘ └─────────────────────┘ └─────────────────────┘
62
- ❌ ❌ ❌
63
- Own schemas Own schemas Own schemas
64
- Duplicated logic Duplicated logic Duplicated logic
65
- Diverges over time Diverges over time Diverges over time
66
- ```
67
-
68
- **Risks**:
69
- - ❌ **Type Mismatches**: API expects `role: string` but MCP sends `type: string`
70
- - ❌ **Duplicated Validation**: Same validation logic copied across 3 modules
71
- - ❌ **Silent Failures**: Changes in one module break others at runtime
72
- - ❌ **High Refactoring Cost**: Update model schema = touch 3+ files
73
- - ❌ **No Contract Enforcement**: No guarantee modules speak the same language
74
-
75
- #### The Solution: After SSOT
76
-
77
- With `@ax-cli/schemas`, all modules import from a single source:
78
-
79
- ```
80
- ┌────────────────────────────────────┐
81
- │ @ax-cli/schemas │
82
- │ (Single Source of Truth) │
83
- ├────────────────────────────────────┤
84
- │ │
85
- │ • Brand Types (ModelId, etc.) │
86
- │ • Centralized Enums (MessageRole) │
87
- │ • Zod Schemas (runtime validation)│
88
- │ • TypeScript Types (compile-time) │
89
- │ │
90
- └──────────────┬─────────────────────┘
91
-
92
- ┌─────────────┼─────────────┐
93
- │ │ │
94
- ▼ ▼ ▼
95
- ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
96
- │ API Handler │ │ MCP Adapter │ │Billing Module│
97
- ├──────────────┤ ├──────────────┤ ├──────────────┤
98
- │ import { │ │ import { │ │ import { │
99
- │ ModelId, │ │ ModelId, │ │ ModelId, │
100
- │ Message │ │ Message │ │ Message │
101
- │ } from │ │ } from │ │ } from │
102
- │ '@ax-cli/ │ │ '@ax-cli/ │ │ '@ax-cli/ │
103
- │ schemas' │ │ schemas' │ │ schemas' │
104
- └──────────────┘ └──────────────┘ └──────────────┘
105
- ✅ ✅ ✅
106
- Same contract Same contract Same contract
107
- Same validation Same validation Same validation
108
- ```
109
-
110
- **Benefits**:
111
- - ✅ **Zero Divergence**: All modules consume identical type definitions
112
- - ✅ **Reduced Refactoring Cost**: Change once, propagate everywhere (1 file vs 3+ files)
113
- - ✅ **Compile-Time Safety**: TypeScript catches mismatches across module boundaries
114
- - ✅ **Runtime Validation**: Zod schemas ensure data validity at system boundaries
115
- - ✅ **Contract Enforcement**: Brand types prevent mixing incompatible IDs
116
-
117
- #### SSOT in Action
118
-
119
- **Example: Adding a new model**
120
-
121
- Before SSOT (3 files to update):
122
- ```typescript
123
- // File 1: src/api/handler.ts
124
- type ModelId = string; // Update here
125
-
126
- // File 2: src/mcp/adapter.ts
127
- type ModelName = string; // Update here too
128
-
129
- // File 3: src/billing/tracker.ts
130
- type Model = string; // And here
131
- ```
132
-
133
- After SSOT (1 file to update):
134
- ```typescript
135
- // File: packages/schemas/src/public/core/id-types.ts
136
- export const ModelIdSchema = z.string().brand<'ModelId'>();
137
- export type ModelId = z.infer<typeof ModelIdSchema>;
138
-
139
- // All consumers automatically get the update:
140
- // ✅ API handler
141
- // ✅ MCP adapter
142
- // ✅ Billing module
143
- ```
144
-
145
- #### Quality Metrics
146
-
147
- | Metric | Before SSOT | After SSOT | Improvement |
148
- |--------|-------------|------------|-------------|
149
- | **Schema Duplication** | 3+ copies | 1 canonical | 67% reduction |
150
- | **Refactoring Cost** | 3+ files | 1 file | 67% faster |
151
- | **Type Mismatches** | Runtime errors | Compile-time catch | 100% safer |
152
- | **Validation Consistency** | Divergent | Unified | Enterprise-grade |
153
- | **Test Coverage** | Partial | 98.29% (124 tests) | Production-ready |
154
-
155
- ### Technology Stack
156
-
157
- - **Language**: TypeScript 5.3+ (strict mode)
158
- - **Runtime**: Node.js 24+
159
- - **Validation**: Zod 3.x for runtime type safety
160
- - **Testing**: Vitest with 98%+ coverage
161
- - **UI**: Ink (React for CLI)
162
- - **AI Providers**: OpenAI-compatible APIs
163
- - **Package Manager**: npm / bun
164
-
165
- ### Code Quality
166
-
167
- - **Linting**: ESLint with TypeScript rules
168
- - **Type Checking**: TypeScript strict mode enabled
169
- - **Runtime Validation**: Zod schemas for all inputs
170
- - **Testing**: Vitest with comprehensive test suite
171
- - **CI/CD**: GitHub Actions for automated testing
172
-
173
- ### Test Suite
174
-
175
- **83 tests** covering critical functionality:
176
-
177
- ```
178
- 📊 Test Coverage Report
179
- ─────────────────────────────────────
180
- Overall: 98.29%
181
- ├─ Text Utils: 98.55% (36 tests)
182
- ├─ Token Counter: 100% (19 tests)
183
- └─ Schemas: 95.23% (28 tests)
184
-
185
- 🎯 Coverage Breakdown
186
- ─────────────────────────────────────
187
- Statements: 98.29%
188
- Branches: 95.06%
189
- Functions: 100%
190
- Lines: 98.19%
191
- ```
192
-
193
- **What's Tested:**
194
- - ✅ Text manipulation (word navigation, deletion, Unicode)
195
- - ✅ Token counting (messages, streaming, formatting)
196
- - ✅ Schema validation (settings, MCP, API responses)
197
- - ✅ Edge cases (empty strings, null, surrogate pairs)
198
- - ✅ Error handling and validation
199
-
200
- **Run Tests:**
201
19
  ```bash
202
- npm test # Run all tests
203
- npm run test:watch # Watch mode
204
- npm run test:coverage # Coverage report
205
- npm run test:ui # Interactive UI
206
- ```
207
-
208
- ---
209
-
210
- ## ✨ Key Features
211
-
212
- ### 🔒 **GLM-First Architecture**
213
- - **Primary Support**: Optimized for GLM (General Language Model) deployments
214
- - **Local GLM**: Run GLM 4.6 and other GLM models locally via Ollama
215
- - **Cloud GLM**: Connect to cloud-hosted GLM services
216
- - **Zero internet dependency** for complete privacy with local models
217
- - **No API keys required** for local operation
218
- - Full conversational AI capabilities offline
20
+ # Install globally
21
+ npm install -g @defai.digital/ax-cli
219
22
 
220
- ### 🚀 **Multi-Provider AI Support**
221
- - **Primary**: GLM 4.6 (200K context, reasoning mode) - Default model optimized for AX CLI
222
- - **Built-in GLM Models**: glm-4.6, grok-code-fast-1, glm-4-air, glm-4-airx
223
- - **Local Models**: Llama 3.1, Qwen 2.5, DeepSeek, and any Ollama-supported model
224
- - **Cloud Providers**: OpenAI (GPT-4), Anthropic (Claude), Google (Gemini), X.AI (Grok), OpenRouter, Groq
225
- - **Z.AI Platform**: Native support for z.ai GLM API server (cloud & local deployments)
226
- - **Flexible Configuration**: Switch between providers seamlessly
227
- - **OpenAI-Compatible API**: Works with ANY OpenAI-compatible endpoint
228
- - **Full Backward Compatibility**: All models from original grok-cli still supported
23
+ # Initialize your project
24
+ ax-cli init
229
25
 
230
- ### 🤖 **Intelligent Automation**
231
- - **Smart File Operations**: AI automatically reads, creates, and edits files
232
- - **Bash Integration**: Execute shell commands through natural conversation
233
- - **Automatic Tool Selection**: AI chooses the right tools for your requests
234
- - **Multi-Step Task Execution**: Handle complex workflows with up to 400 tool rounds
235
- - **Intelligent Context Management**: Automatic pruning for infinite conversation length
236
- - **Project Analysis**: Auto-detect tech stack, conventions, and structure (`ax-cli init`)
26
+ # Start interactive mode
27
+ ax-cli
237
28
 
238
- ### 🔌 **Extensibility**
239
- - **MCP Protocol Support**: Integrate Model Context Protocol servers
240
- - **Custom Instructions**: Project-specific AI behavior via `.ax-cli/CUSTOM.md`
241
- - **Plugin Architecture**: Extend with Linear, GitHub, and other MCP tools
242
- - **Morph Fast Apply**: Optional 4,500+ tokens/sec code editing
29
+ # Run headless command
30
+ ax-cli -p "list all TypeScript files"
31
+ ```
243
32
 
244
- ### 💬 **Developer Experience**
245
- - **Interactive Mode**: Conversational AI assistant in your terminal
246
- - **Headless Mode**: Scriptable single-prompt execution for CI/CD
247
- - **Beautiful UI**: Ink-based terminal interface with syntax highlighting
248
- - **Global Installation**: Use anywhere with `npm install -g`
33
+ ## Features
249
34
 
250
- ### 🏗️ **Enterprise Quality**
251
- - **98.29% Test Coverage**: Text utils, token counting, schema validation
252
- - **TypeScript + Zod**: Runtime type safety and validation
253
- - **Automated CI/CD**: Tests run on every commit and PR
254
- - **Comprehensive Documentation**: Detailed guides and API references
255
- - **Node.js 24+ Support**: Modern JavaScript runtime features
35
+ - **🤖 Multi-Provider Support**: OpenAI, Anthropic, xAI, local models (Ollama)
36
+ - **🧠 GLM 4.6 Optimized**: Primary support for General Language Model with advanced reasoning
37
+ - **🔌 MCP Integration**: Model Context Protocol for extensible tool support
38
+ - **✅ Production-Ready**: 98%+ test coverage, TypeScript strict mode, Zod validation
39
+ - **🎯 Interactive & Headless**: Chat interface or one-shot commands
40
+ - **📝 Smart Project Init**: Automatic project analysis and custom instructions
41
+ - **🔄 Auto-Update**: Built-in update checker and installer
256
42
 
257
- ---
43
+ [View all features →](docs/features.md)
258
44
 
259
45
  ## 📦 Installation
260
46
 
261
47
  ### Prerequisites
262
48
 
263
- #### **Node.js 24+** (Required)
264
- ```bash
265
- # Check your Node.js version
266
- node --version # Should be v24.0.0 or higher
267
-
268
- # Install Node.js 24+ from https://nodejs.org/
269
- ```
270
-
271
- #### **For Offline Operation** (Recommended)
272
- - **Ollama** 0.1.0+ for local LLM inference
273
- - **GLM 4.6 Model** (9B parameters, ~5GB download)
274
- - **16GB RAM** minimum (32GB recommended for larger models)
275
- - **GPU** recommended but optional (CPU inference supported)
276
-
277
- #### **For Cloud Providers** (Optional)
278
- - API key from OpenAI, Anthropic, X.AI, or compatible provider
279
- - (Optional) Morph API key for Fast Apply editing
49
+ - Node.js 24.0.0 or higher
50
+ - npm or bun package manager
280
51
 
281
52
  ### Global Installation (Recommended)
282
53
 
283
54
  ```bash
284
- # Using npm
285
55
  npm install -g @defai.digital/ax-cli
286
-
287
- # Using bun (faster)
288
- bun add -g @defai.digital/ax-cli
289
-
290
- # Verify installation
291
- ax-cli --version
292
56
  ```
293
57
 
294
58
  ### Local Development
295
59
 
296
60
  ```bash
297
- # Clone the repository
298
- git clone https://github.com/defai-digital/ax-cli
61
+ git clone https://github.com/defai-digital/ax-cli.git
299
62
  cd ax-cli
300
-
301
- # Install dependencies
302
63
  npm install
303
-
304
- # Build the project
305
64
  npm run build
306
-
307
- # Link globally
308
65
  npm link
309
-
310
- # Run tests
311
- npm test
312
-
313
- # Generate coverage report
314
- npm run test:coverage
315
66
  ```
316
67
 
317
- ---
318
-
319
- ## ⚙️ Setup
320
-
321
- ### Option 1: Offline Setup with GLM 4.6 (Privacy-First)
68
+ [Installation Guide →](docs/installation.md)
322
69
 
323
- **Perfect for**: Developers who prioritize privacy, work with sensitive data, or need offline AI capabilities.
324
-
325
- #### Step 1: Install Ollama
326
-
327
- ```bash
328
- # macOS / Linux
329
- curl -fsSL https://ollama.ai/install.sh | sh
70
+ ## ⚙️ Configuration
330
71
 
331
- # Windows
332
- # Download from https://ollama.ai/download
333
-
334
- # Verify installation
335
- ollama --version
336
- ```
337
-
338
- #### Step 2: Download GLM 4.6 Model
72
+ ### Quick Setup
339
73
 
340
74
  ```bash
341
- # Pull the GLM-4-9B-Chat model (9B parameters, ~5GB download)
342
- ollama pull glm4:9b
343
-
344
- # Optional: Pull the vision-capable model
345
- ollama pull glm4v:9b
75
+ # Set your API key (for cloud providers)
76
+ export GROK_API_KEY=your_api_key_here
346
77
 
347
- # Verify models are available
348
- ollama list
78
+ # Or configure in settings
79
+ ax-cli # Will prompt for API key on first run
349
80
  ```
350
81
 
351
- #### Step 3: Start Ollama Server
352
-
353
- ```bash
354
- # Ollama runs as a background service by default
355
- # If needed, start it manually:
356
- ollama serve
357
-
358
- # Test the model
359
- ollama run glm4:9b "Hello, how are you?"
360
- ```
82
+ ### Configuration Files
361
83
 
362
- #### Step 4: Configure AX CLI for Local Operation
84
+ - **User Settings**: `~/.ax-cli/config.json`
85
+ - **Project Settings**: `.ax-cli/settings.json`
86
+ - **Custom Instructions**: `.ax-cli/CUSTOM.md`
363
87
 
364
- Create `~/.ax/user-settings.json`:
88
+ [Configuration Guide →](docs/configuration.md)
365
89
 
366
- ```json
367
- {
368
- "baseURL": "http://localhost:11434/v1",
369
- "defaultModel": "glm4:9b",
370
- "models": [
371
- "glm4:9b",
372
- "glm4v:9b",
373
- "llama3.1:8b",
374
- "qwen2.5:7b"
375
- ]
376
- }
377
- ```
90
+ ## 🎯 Usage Examples
378
91
 
379
- #### Step 5: Test Your Setup
92
+ ### Interactive Mode
380
93
 
381
94
  ```bash
382
- # Interactive mode
95
+ # Start interactive chat
383
96
  ax-cli
384
97
 
385
- # Headless mode
386
- ax-cli --prompt "Hello, please introduce yourself"
387
-
388
- # Specify working directory
389
- ax-cli --directory /path/to/project --prompt "List all TypeScript files"
390
- ```
391
-
392
- **✅ You're now running completely offline!** No API keys, no internet, complete privacy.
393
-
394
- ---
395
-
396
- ### Option 2: Cloud Provider Setup
397
-
398
- **Perfect for**: Teams using enterprise AI providers, developers who need the latest models, or hybrid offline/cloud workflows.
399
-
400
- #### Supported Providers
401
-
402
- **AX CLI supports ANY OpenAI-compatible API endpoint**, making it universally compatible with major AI providers.
403
-
404
- | Provider | Base URL | Supported Models | Best For |
405
- |----------|----------|------------------|----------|
406
- | **Z.AI** | `https://api.z.ai/v1` | GLM-4.6, GLM-4-Air, GLM-4-AirX | GLM models (cloud & local), 200K context, reasoning mode |
407
- | **X.AI (Grok)** | `https://api.x.ai/v1` | Grok, Grok Code Fast | Fast code generation, X.AI ecosystem |
408
- | **OpenAI** | `https://api.openai.com/v1` | GPT-4, GPT-4 Turbo, GPT-3.5 | General purpose, production-ready |
409
- | **Anthropic** | `https://api.anthropic.com/v1` | Claude 3.5 Sonnet, Claude 3 Opus | Long context, advanced reasoning |
410
- | **Google** | `https://openrouter.ai/api/v1` | Gemini Pro 1.5 (via OpenRouter) | Multi-modal, Google ecosystem |
411
- | **OpenRouter** | `https://openrouter.ai/api/v1` | 100+ models from all providers | Model routing, fallback strategies |
412
- | **Groq** | `https://api.groq.com/openai/v1` | Llama, Mistral, Gemma | Ultra-fast inference (500+ tokens/sec) |
413
- | **Ollama** | `http://localhost:11434/v1` | Llama, Qwen, DeepSeek, GLM, any | Complete privacy, offline operation |
414
-
415
- #### Built-in Models
416
-
417
- AX CLI includes 4 pre-configured GLM models optimized for different use cases:
418
-
419
- | Model | Context | Max Output | Thinking Mode | Best For |
420
- |-------|---------|-----------|---------------|----------|
421
- | **glm-4.6** ⭐ | 200K | 128K | ✅ Yes | Default - Long context, reasoning tasks |
422
- | **grok-code-fast-1** | 128K | 4K | ❌ No | Fast code generation, quick responses |
423
- | **glm-4-air** | 128K | 8K | ❌ No | Balanced performance, general tasks |
424
- | **glm-4-airx** | 8K | 8K | ❌ No | Lightweight, quick interactions |
425
-
426
- ⭐ **Default Model**: glm-4.6 is the default model for AX CLI
427
-
428
- #### Step 1: Get API Key
429
-
430
- 1. Sign up at your chosen provider:
431
- - [Z.AI](https://docs.z.ai) - GLM models (recommended for GLM 4.6)
432
- - [X.AI (Grok)](https://x.ai) - Fast code models
433
- - [OpenAI](https://platform.openai.com) - GPT-4 and GPT-3.5
434
- - [Anthropic](https://console.anthropic.com) - Claude 3.5 Sonnet
435
- - [OpenRouter](https://openrouter.ai) - Multi-model access to 100+ models
436
-
437
- 2. Generate an API key from your provider's dashboard
438
-
439
- #### Step 2: Configure API Key (Choose One Method)
440
-
441
- **Method 1: User Settings File** (Recommended)
442
-
443
- Create `~/.ax/user-settings.json`:
444
-
445
- ```json
446
- {
447
- "apiKey": "your_api_key_here",
448
- "baseURL": "https://api.x.ai/v1",
449
- "defaultModel": "grok-code-fast-1",
450
- "models": [
451
- "grok-code-fast-1",
452
- "grok-4-latest",
453
- "grok-3-latest"
454
- ]
455
- }
456
- ```
457
-
458
- **Method 2: Environment Variable**
459
-
460
- ```bash
461
- export GROK_API_KEY="your_api_key_here"
462
- export GROK_BASE_URL="https://api.x.ai/v1"
463
- export GROK_MODEL="grok-code-fast-1"
464
- ```
465
-
466
- **Method 3: .env File**
467
-
468
- ```bash
469
- cp .env.example .env
470
- # Edit .env and add:
471
- GROK_API_KEY=your_api_key_here
472
- GROK_BASE_URL=https://api.x.ai/v1
473
- GROK_MODEL=grok-code-fast-1
474
- ```
475
-
476
- **Method 4: Command Line Flags**
477
-
478
- ```bash
479
- ax-cli --api-key your_api_key_here --base-url https://api.x.ai/v1 --model grok-code-fast-1
480
- ```
481
-
482
- #### Step 3: (Optional) Configure Morph Fast Apply
483
-
484
- For lightning-fast code editing at 4,500+ tokens/sec:
485
-
486
- 1. Get API key from [Morph Dashboard](https://morphllm.com/dashboard/api-keys)
487
- 2. Add to environment or `.env`:
488
-
489
- ```bash
490
- export MORPH_API_KEY="your_morph_key_here"
491
- ```
492
-
493
- ---
494
-
495
- ### Multi-Provider Usage Examples
496
-
497
- AX CLI works with ANY OpenAI-compatible API. Here are examples for popular providers:
498
-
499
- **Z.AI (GLM Models - Recommended)**
500
- ```bash
501
- # Cloud GLM 4.6 via Z.AI
502
- ax-cli --api-key YOUR_ZAI_KEY --base-url https://api.z.ai/v1 --model glm-4.6
503
-
504
- # Local Z.AI deployment
505
- ax-cli --base-url http://localhost:8000/v1 --model glm-4.6
506
- ```
507
-
508
- **OpenAI (GPT-4)**
509
- ```bash
510
- ax-cli --api-key YOUR_OPENAI_KEY --base-url https://api.openai.com/v1 --model gpt-4
511
- ```
512
-
513
- **Anthropic (Claude)**
514
- ```bash
515
- ax-cli --api-key YOUR_ANTHROPIC_KEY --base-url https://api.anthropic.com/v1 --model claude-3.5-sonnet
516
- ```
517
-
518
- **Google Gemini (via OpenRouter)**
519
- ```bash
520
- ax-cli --api-key YOUR_OPENROUTER_KEY --base-url https://openrouter.ai/api/v1 --model google/gemini-pro-1.5
521
- ```
522
-
523
- **Ollama (Local - No API Key Needed)**
524
- ```bash
525
- # Any Ollama model
526
- ax-cli --base-url http://localhost:11434/v1 --model llama3.1
527
- ax-cli --base-url http://localhost:11434/v1 --model qwen2.5
528
- ax-cli --base-url http://localhost:11434/v1 --model deepseek-coder
529
- ```
530
-
531
- **X.AI (Grok)**
532
- ```bash
533
- ax-cli --api-key YOUR_XAI_KEY --base-url https://api.x.ai/v1 --model grok-code-fast-1
98
+ # Available slash commands:
99
+ /help # Show help
100
+ /init # Initialize project
101
+ /clear # Clear chat history
102
+ /models # Switch AI model
103
+ /commit-and-push # AI-powered git commit
104
+ /exit # Exit application
534
105
  ```
535
106
 
536
- **OpenRouter (100+ Models)**
537
- ```bash
538
- ax-cli --api-key YOUR_OPENROUTER_KEY --base-url https://openrouter.ai/api/v1 --model anthropic/claude-3.5-sonnet
539
- ```
540
-
541
- ---
542
-
543
- ## 🎯 Project Initialization
544
-
545
- AX CLI can automatically analyze your project and generate optimized custom instructions for better performance and accuracy.
546
-
547
- ### Quick Setup
107
+ ### Headless Mode
548
108
 
549
109
  ```bash
550
- # Navigate to your project
551
- cd /path/to/your/project
552
-
553
- # Initialize AX CLI (one-time setup)
554
- ax-cli init
110
+ # One-shot commands
111
+ ax-cli -p "analyze this codebase"
112
+ ax-cli -p "fix TypeScript errors" -d /path/to/project
113
+ ax-cli -p "write tests for utils/" --max-tool-rounds 50
555
114
 
556
- # Start using AX CLI with project-aware intelligence
557
- ax-cli
115
+ # With specific model
116
+ ax-cli -p "refactor" --model glm-4.6
558
117
  ```
559
118
 
560
- ### What Gets Detected Automatically
561
-
562
- The `init` command intelligently analyzes your project:
563
-
564
- - ✅ **Project Type**: CLI, library, web-app, API, etc.
565
- - ✅ **Tech Stack**: React, Vue, Express, NestJS, Vitest, Jest, etc.
566
- - ✅ **Language & Conventions**: TypeScript with ESM/CJS, import extensions
567
- - ✅ **Directory Structure**: Source, tests, tools, config directories
568
- - ✅ **Build Scripts**: Test, build, lint, dev commands
569
- - ✅ **Package Manager**: npm, yarn, pnpm, or bun
570
- - ✅ **Code Conventions**: Module system, validation library, test framework
571
-
572
- ### Generated Files
573
-
574
- **`.ax-cli/CUSTOM.md`** - Project-specific custom instructions:
575
- ```markdown
576
- # Custom Instructions for AX CLI
577
-
578
- **Project**: your-project v1.0.0
579
- **Type**: cli
580
- **Language**: TypeScript
581
- **Stack**: Commander, Vitest, Zod, ESM
582
-
583
- ## Code Conventions
584
-
585
- ### TypeScript
586
- - Use explicit type annotations
587
- - **CRITICAL**: Always use `.js` extension in imports (ESM requirement)
588
-
589
- ### Validation
590
- - Use **zod** for runtime validation
591
- - Validate all external inputs
592
-
593
- ## File Structure
594
- - Commands: `src/commands/`
595
- - Utilities: `src/utils/`
596
- - Types: `src/types/`
597
- ```
598
-
599
- **`.ax-cli/index.json`** - Fast project reference for quick lookups
600
-
601
- ### Command Options
119
+ ### Project Initialization
602
120
 
603
121
  ```bash
604
- # Basic initialization
122
+ # Analyze and initialize project
605
123
  ax-cli init
606
124
 
607
- # Force regeneration (after major project changes)
125
+ # Force regeneration
608
126
  ax-cli init --force
609
127
 
610
- # Verbose output showing detection details
128
+ # Verbose output
611
129
  ax-cli init --verbose
612
-
613
- # Initialize specific directory
614
- ax-cli init --directory /path/to/project
615
130
  ```
616
131
 
617
- ### Benefits
618
-
619
- **🚀 Performance Improvements:**
620
- - **25-30% fewer tokens** - No repeated project exploration
621
- - **23% faster responses** - Direct file access using generated index
622
- - **Better accuracy** - Project conventions understood from the start
132
+ [CLI Reference →](docs/cli-reference.md) | [Usage Guide →](docs/usage.md)
623
133
 
624
- **🧠 Smart Context:**
625
- - Knows your project structure instantly
626
- - Understands your tech stack and conventions
627
- - References correct file paths automatically
628
- - Follows project-specific patterns
134
+ ## 🔌 MCP (Model Context Protocol)
629
135
 
630
- ### When to Run Init
631
-
632
- - ✅ After cloning a new repository
633
- - ✅ When starting a new project
634
- - ✅ After changing major dependencies
635
- - ✅ When migrating frameworks (e.g., Jest → Vitest)
636
- - ✅ After restructuring directories
637
-
638
- ### Team Usage
639
-
640
- **Option 1: Share Configuration**
641
- ```bash
642
- # Commit configuration to repository
643
- git add .ax-cli/
644
- git commit -m "Add AX CLI project configuration"
645
- ```
646
-
647
- **Option 2: Personal Configuration**
648
- ```bash
649
- # Add to .gitignore for personal customization
650
- echo ".ax-cli/" >> .gitignore
651
- ```
652
-
653
- ---
654
-
655
- ## 📖 Usage
656
-
657
- ### Interactive Mode
658
-
659
- Start a conversational AI session:
136
+ Extend AX CLI with MCP servers for additional capabilities:
660
137
 
661
138
  ```bash
662
- # Basic usage (uses glm-4.6 by default)
663
- ax-cli
664
-
665
- # Specify working directory
666
- ax-cli --directory /path/to/project
667
-
668
- # Use specific built-in model
669
- ax-cli --model grok-code-fast-1
670
- ax-cli --model glm-4-air
671
-
672
- # Connect to Z.AI
673
- ax-cli --base-url https://api.z.ai/v1 --model glm-4.6
674
-
675
- # Offline mode with Ollama
676
- ax-cli --model llama3.1 --base-url http://localhost:11434/v1
677
- ```
678
-
679
- **Example Session:**
680
- ```
681
- AX> Show me the package.json file
682
-
683
- [AX reads and displays package.json]
684
-
685
- AX> Create a new TypeScript file called utils.ts with helper functions
686
-
687
- [AX creates the file with intelligent content]
688
-
689
- AX> Run npm test and show me the results
690
-
691
- [AX executes the command and displays output]
692
- ```
693
-
694
- ### Headless Mode (Scriptable)
695
-
696
- Process a single prompt and exit — perfect for CI/CD, automation, and scripting:
697
-
698
- ```bash
699
- # Basic headless execution
700
- ax-cli --prompt "show me the package.json file"
701
-
702
- # Short form
703
- ax-cli -p "list all TypeScript files in src/"
704
-
705
- # With working directory
706
- ax-cli -p "run npm test" -d /path/to/project
707
-
708
- # Control tool execution rounds
709
- ax-cli -p "comprehensive code refactoring" --max-tool-rounds 50
710
-
711
- # Combine with shell scripting
712
- RESULT=$(ax-cli -p "count lines of code in src/") && echo $RESULT
713
- ```
714
-
715
- **Use Cases:**
716
- - **CI/CD Pipelines**: Automate code analysis, testing, linting
717
- - **Shell Scripts**: Integrate AI into bash automation
718
- - **Batch Processing**: Process multiple prompts programmatically
719
- - **Terminal Benchmarks**: Non-interactive execution for tools like Terminal Bench
720
-
721
- ### Tool Execution Control
722
-
723
- Fine-tune AI behavior with configurable tool execution limits:
724
-
725
- ```bash
726
- # Fast responses for simple queries (limit: 10 rounds)
727
- ax-cli --max-tool-rounds 10 -p "show current directory"
728
-
729
- # Complex automation (limit: 500 rounds)
730
- ax-cli --max-tool-rounds 500 -p "refactor entire codebase to TypeScript"
731
-
732
- # Works with all modes
733
- ax-cli --max-tool-rounds 20 # Interactive
734
- ax-cli -p "task" --max-tool-rounds 30 # Headless
735
- ax-cli git commit-and-push --max-tool-rounds 30 # Git commands
736
- ```
737
-
738
- **Default**: 400 rounds (sufficient for most tasks)
739
-
740
- ---
741
-
742
- ## 🛠️ Configuration
743
-
744
- ### Configuration Architecture
745
-
746
- AX CLI uses a **two-tier configuration system** for maximum flexibility:
747
-
748
- 1. **User-Level Settings** (`~/.ax/user-settings.json`) - Global defaults
749
- 2. **Project-Level Settings** (`.ax/settings.json`) - Project-specific overrides
750
-
751
- #### User-Level Settings
752
-
753
- **Location**: `~/.ax/user-settings.json`
754
-
755
- **Purpose**: Global settings that apply across all projects
756
-
757
- **Example (Offline with GLM 4.6)**:
758
- ```json
759
- {
760
- "baseURL": "http://localhost:11434/v1",
761
- "defaultModel": "glm4:9b",
762
- "models": [
763
- "glm4:9b",
764
- "glm4v:9b",
765
- "llama3.1:8b",
766
- "qwen2.5:7b",
767
- "mistral:7b"
768
- ]
769
- }
770
- ```
771
-
772
- **Example (Cloud Provider - X.AI)**:
773
- ```json
774
- {
775
- "apiKey": "xai-your_api_key_here",
776
- "baseURL": "https://api.x.ai/v1",
777
- "defaultModel": "grok-code-fast-1",
778
- "models": [
779
- "grok-code-fast-1",
780
- "grok-4-latest",
781
- "grok-3-latest",
782
- "grok-2-latest"
783
- ]
784
- }
785
- ```
786
-
787
- **Example (OpenRouter for Multi-Model Access)**:
788
- ```json
789
- {
790
- "apiKey": "sk-or-your_api_key_here",
791
- "baseURL": "https://openrouter.ai/api/v1",
792
- "defaultModel": "anthropic/claude-3.5-sonnet",
793
- "models": [
794
- "anthropic/claude-3.5-sonnet",
795
- "openai/gpt-4o",
796
- "meta-llama/llama-3.1-70b-instruct",
797
- "google/gemini-pro-1.5"
798
- ]
799
- }
800
- ```
801
-
802
- #### Project-Level Settings
803
-
804
- **Location**: `.ax/settings.json` (in your project directory)
805
-
806
- **Purpose**: Project-specific model selection and MCP server configuration
807
-
808
- **Example**:
809
- ```json
810
- {
811
- "model": "grok-code-fast-1",
812
- "mcpServers": {
813
- "linear": {
814
- "name": "linear",
815
- "transport": "sse",
816
- "url": "https://mcp.linear.app/sse"
817
- },
818
- "github": {
819
- "name": "github",
820
- "transport": "stdio",
821
- "command": "npx",
822
- "args": ["@modelcontextprotocol/server-github"],
823
- "env": {
824
- "GITHUB_TOKEN": "your_github_token"
825
- }
826
- }
827
- }
828
- }
829
- ```
830
-
831
- #### Configuration Priority
832
-
833
- ```
834
- Command Line Flags > Environment Variables > Project Settings > User Settings > System Defaults
835
- ```
836
-
837
- **Example**:
838
- ```bash
839
- # 1. Command line takes highest priority
840
- ax-cli --model grok-4-latest
841
-
842
- # 2. Then environment variables
843
- export GROK_MODEL="grok-code-fast-1"
844
-
845
- # 3. Then project settings (.ax/settings.json)
846
- { "model": "glm4:9b" }
847
-
848
- # 4. Then user settings (~/.ax/user-settings.json)
849
- { "defaultModel": "grok-3-latest" }
850
-
851
- # 5. Finally system default
852
- grok-code-fast-1
853
- ```
854
-
855
- ---
856
-
857
- ## 🎨 Custom Instructions
858
-
859
- Tailor AX CLI's behavior to your project's specific needs with custom instructions.
860
-
861
- ### Setup
862
-
863
- Create `.ax/AX.md` in your project root:
864
-
865
- ```bash
866
- mkdir -p .ax
867
- touch .ax/AX.md
868
- ```
869
-
870
- ### Example Custom Instructions
871
-
872
- **TypeScript Project**:
873
- ```markdown
874
- # Custom Instructions for AX CLI
875
-
876
- ## Code Style
877
- - Always use TypeScript for new code files
878
- - Prefer const assertions and explicit typing
879
- - Use functional components with React hooks
880
- - Follow the project's existing ESLint configuration
881
-
882
- ## Documentation
883
- - Add JSDoc comments for all public functions
884
- - Include type annotations in JSDoc
885
- - Document complex algorithms with inline comments
886
-
887
- ## Testing
888
- - Write tests using Vitest
889
- - Aim for 80%+ code coverage
890
- - Include edge cases and error scenarios
891
-
892
- ## File Structure
893
- - Place components in src/components/
894
- - Place utilities in src/utils/
895
- - Place types in src/types/
896
- ```
897
-
898
- **Python Data Science Project**:
899
- ```markdown
900
- # Custom Instructions for AX CLI
901
-
902
- ## Code Standards
903
- - Follow PEP 8 style guide
904
- - Use type hints for function signatures
905
- - Prefer pandas for data manipulation
906
- - Use numpy for numerical operations
907
-
908
- ## Documentation
909
- - Add docstrings in Google format
910
- - Include usage examples in docstrings
911
- - Document data schemas and transformations
912
-
913
- ## Best Practices
914
- - Always validate input data types
915
- - Handle missing values explicitly
916
- - Add error handling for file operations
917
- ```
918
-
919
- ### How It Works
920
-
921
- 1. **Auto-Loading**: AX automatically loads `.ax/AX.md` when working in your project
922
- 2. **Priority**: Custom instructions override default AI behavior
923
- 3. **Scope**: Instructions apply only to the current project
924
- 4. **Format**: Use markdown for clear, structured instructions
925
-
926
- ---
927
-
928
- ## 🔌 MCP (Model Context Protocol) Integration
929
-
930
- Extend AX CLI with powerful integrations through the Model Context Protocol.
931
-
932
- ### What is MCP?
933
-
934
- MCP enables AI models to interact with external tools and services. Think of it as "plugins for AI" — you can add capabilities like project management (Linear), version control (GitHub), databases, APIs, and more.
935
-
936
- ### Adding MCP Servers
937
-
938
- #### Linear Integration (Project Management)
939
-
940
- ```bash
941
- # Add Linear MCP server via SSE
942
- ax-cli mcp add linear --transport sse --url "https://mcp.linear.app/sse"
943
-
944
- # Now you can:
945
- # - Create and manage Linear issues
946
- # - Search and filter tasks
947
- # - Update issue status and assignees
948
- # - Access team and project information
949
- ```
950
-
951
- #### GitHub Integration (Version Control)
952
-
953
- ```bash
954
- # Add GitHub MCP server via stdio
955
- ax-cli mcp add github \
956
- --transport stdio \
957
- --command "npx" \
958
- --args "@modelcontextprotocol/server-github" \
959
- --env "GITHUB_TOKEN=your_github_token"
960
-
961
- # Now you can:
962
- # - Create pull requests
963
- # - Manage issues
964
- # - Review code
965
- # - Access repository information
966
- ```
967
-
968
- #### Custom MCP Server
969
-
970
- ```bash
971
- # Stdio transport (most common)
972
- ax-cli mcp add my-server \
973
- --transport stdio \
974
- --command "bun" \
975
- --args "server.js"
976
-
977
- # HTTP transport
978
- ax-cli mcp add my-api \
979
- --transport http \
980
- --url "http://localhost:3000"
981
-
982
- # With environment variables
983
- ax-cli mcp add my-server \
984
- --transport stdio \
985
- --command "python" \
986
- --args "-m" "my_mcp_server" \
987
- --env "API_KEY=secret" \
988
- --env "DEBUG=true"
989
- ```
990
-
991
- #### Add from JSON
992
-
993
- ```bash
994
- ax-cli mcp add-json my-server '{
995
- "command": "bun",
996
- "args": ["server.js"],
997
- "env": {
998
- "API_KEY": "your_key",
999
- "LOG_LEVEL": "debug"
1000
- }
1001
- }'
1002
- ```
1003
-
1004
- ### Managing MCP Servers
139
+ # Add MCP server
140
+ ax-cli mcp add linear --transport sse --url https://mcp.linear.app/sse
1005
141
 
1006
- ```bash
1007
- # List all configured servers
142
+ # List servers
1008
143
  ax-cli mcp list
1009
144
 
1010
- # Test server connection and tools
1011
- ax-cli mcp test server-name
1012
-
1013
- # Remove a server
1014
- ax-cli mcp remove server-name
1015
-
1016
- # View server details
1017
- ax-cli mcp info server-name
1018
- ```
1019
-
1020
- ### Transport Types
1021
-
1022
- | Transport | Use Case | Example |
1023
- |-----------|----------|---------|
1024
- | **stdio** | Local processes, Node.js/Python servers | `npx @linear/mcp-server` |
1025
- | **http** | RESTful APIs, remote services | `http://localhost:3000` |
1026
- | **sse** | Server-Sent Events, real-time updates | `https://mcp.linear.app/sse` |
1027
-
1028
- ### Configuration Storage
1029
-
1030
- MCP servers are stored in `.ax/settings.json`:
1031
-
1032
- ```json
1033
- {
1034
- "model": "grok-code-fast-1",
1035
- "mcpServers": {
1036
- "linear": {
1037
- "name": "linear",
1038
- "transport": "sse",
1039
- "url": "https://mcp.linear.app/sse"
1040
- },
1041
- "github": {
1042
- "name": "github",
1043
- "transport": "stdio",
1044
- "command": "npx",
1045
- "args": ["@modelcontextprotocol/server-github"],
1046
- "env": {
1047
- "GITHUB_TOKEN": "ghp_your_token"
1048
- }
1049
- },
1050
- "custom-api": {
1051
- "name": "custom-api",
1052
- "transport": "http",
1053
- "url": "https://api.example.com/mcp"
1054
- }
1055
- }
1056
- }
1057
- ```
1058
-
1059
- ---
1060
-
1061
- ## 🎯 Strategic Architecture: AutomatosX vs Morph
1062
-
1063
- AX CLI is built on **two complementary technologies** that solve different problems at different architectural layers:
1064
-
1065
- ### 🧠 AutomatosX: Orchestration Layer (Core Strategy)
1066
-
1067
- **AutomatosX is the strategic foundation** of AX CLI, providing enterprise-grade multi-agent orchestration:
1068
-
1069
- ```
1070
- ┌─────────────────────────────────────────────────────────────┐
1071
- │ AutomatosX Orchestration │
1072
- │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
1073
- │ │ Claude Code │ │ Gemini CLI │ │ OpenAI │ │
1074
- │ │ (Priority 3)│ │ (Priority 2)│ │ (Priority 1)│ │
1075
- │ └──────────────┘ └──────────────┘ └──────────────┘ │
1076
- │ │
1077
- │ • Multi-Agent Coordination • Health Checks │
1078
- │ • Intelligent Routing • Circuit Breakers │
1079
- │ • Session Management • Provider Fallback │
1080
- │ • Memory Persistence • Workload Distribution │
1081
- └─────────────────────────────────────────────────────────────┘
1082
-
1083
- AX CLI Execution
1084
-
1085
- ┌────────────────┼────────────────┐
1086
- ↓ ↓ ↓
1087
- ┌──────────┐ ┌──────────┐ ┌──────────┐
1088
- │ Bash │ │ Search │ │ Edit │
1089
- │ Tool │ │ Tool │ │ Tool │
1090
- └──────────┘ └──────────┘ └──────────┘
1091
- ```
1092
-
1093
- **Key Capabilities**:
1094
- - **Provider Coordination**: Routes tasks to Claude Code, Gemini CLI, OpenAI, or Grok based on availability and workload
1095
- - **Intelligent Fallback**: Automatically switches to backup providers when primary fails
1096
- - **Session/Memory**: Maintains context across multi-agent conversations
1097
- - **Health & Reliability**: Circuit breakers, health checks, retry logic
1098
-
1099
- #### 🏛️ Architecture Purity: Why AX CLI Handles LLM Integration
1100
-
1101
- **Strategic Decision**: AutomatosX remains a **pure orchestration framework** while AX CLI handles all LLM-specific integration:
1102
-
1103
- ```
1104
- ┌─────────────────────────────────────────────────────────────┐
1105
- │ AutomatosX (Pure Orchestration) │
1106
- │ • Provider-agnostic routing │
1107
- │ • Session/memory management │
1108
- │ • Health checks & circuit breakers │
1109
- │ • NO LLM-specific code │
1110
- │ • NO model integration (0 lines) │
1111
- │ • NO tree-sitter parsing │
1112
- └─────────────────────────────────────────────────────────────┘
1113
- ↓ delegates to
1114
- ┌─────────────────────────────────────────────────────────────┐
1115
- │ AX CLI (LLM Integration Layer) │
1116
- │ • GLM-4.6, Grok, OpenAI, Anthropic, Google API clients │
1117
- │ • ~30,000 lines of LLM provider integration code │
1118
- │ • Tree-sitter parsing for code intelligence │
1119
- │ • Model-specific optimizations (reasoning mode, streaming) │
1120
- │ • Tool definitions (bash, editor, search) │
1121
- └─────────────────────────────────────────────────────────────┘
1122
- ```
1123
-
1124
- **Why This Separation Matters**:
1125
-
1126
- 1. **Maintainability** 🛠️
1127
- - AutomatosX stays clean: orchestration logic only (~3K LOC)
1128
- - AX CLI absorbs complexity: LLM APIs, model quirks, provider changes
1129
- - Bug fixes isolated to appropriate layer
1130
-
1131
- 2. **Reusability** ♻️
1132
- - AutomatosX can orchestrate ANY tool/agent, not just LLM-based ones
1133
- - Same orchestration works for Python agents, Rust tools, shell scripts
1134
- - Other projects can use AutomatosX without inheriting LLM baggage
1135
-
1136
- 3. **Testing & Reliability** ✅
1137
- - AutomatosX: Pure logic testing (fast, deterministic)
1138
- - AX CLI: Integration testing against real LLM APIs
1139
- - Clear boundaries make issues easy to diagnose
1140
-
1141
- 4. **Evolution** 🚀
1142
- - LLM landscape changes rapidly (new models monthly)
1143
- - AutomatosX orchestration patterns remain stable
1144
- - AX CLI can add GPT-5, Claude 4, GLM-5 without touching AutomatosX core
1145
-
1146
- **What We Avoided**:
1147
- - ❌ Mixing 30K lines of LLM code into orchestration framework
1148
- - ❌ Coupling AutomatosX to specific model APIs
1149
- - ❌ Making every AutomatosX user depend on OpenAI/Anthropic SDKs
1150
- - ❌ Tree-sitter parser dependencies in core framework
1151
-
1152
- **The Result**: AutomatosX is a **pure, reusable orchestration platform**. AX CLI is a **specialized LLM CLI** built on top of it. Clean separation of concerns wins.
1153
-
1154
- ### ⚡ Morph Fast Apply: Execution Layer (Optional Enhancement)
1155
-
1156
- **Morph is an optional performance enhancement** for file editing, not a core architectural component:
1157
-
1158
- ```
1159
- AutomatosX decides WHAT to edit
1160
-
1161
- ┌───────────────────────────────┐
1162
- │ How should we edit files? │
1163
- ├───────────────┬───────────────┤
1164
- │ Standard │ Morph Fast │
1165
- │ Editor (✓) │ Apply (opt) │
1166
- │ │ │
1167
- │ • Free │ • 4,500+ │
1168
- │ • Built-in │ tokens/sec │
1169
- │ • Simple │ • AI-powered │
1170
- │ string │ • Complex │
1171
- │ replace │ refactors │
1172
- │ │ • Requires │
1173
- │ │ paid key │
1174
- └───────────────┴───────────────┘
1175
- ```
1176
-
1177
- **Why Keep Morph?**
1178
- - ✅ Some users value speed for complex refactoring
1179
- - ✅ Already optional - zero impact on non-users
1180
- - ✅ Low maintenance burden (392 lines, stable)
1181
- - ✅ Different problem space than AutomatosX
1182
-
1183
- **Why It's Not Core Strategy?**
1184
- - ❌ Solves only ONE execution step (file editing)
1185
- - ❌ No orchestration capabilities
1186
- - ❌ Requires paid external API
1187
- - ❌ Can be replaced by standard editor
1188
-
1189
- ### 📊 Comparison Table
1190
-
1191
- | Capability | AutomatosX | AX CLI | Morph | Standard Editor |
1192
- |------------|------------|--------|-------|-----------------|
1193
- | **Strategic Value** | ⭐⭐⭐⭐⭐ Highest | ⭐⭐⭐⭐⭐ Highest | ⭐⭐ Low | ⭐⭐⭐ Medium |
1194
- | **Architecture Layer** | Orchestration | Integration | Execution | Execution |
1195
- | **Lines of Code** | ~3K (pure) | ~30K (LLM) | 392 | ~500 |
1196
- | Multi-agent orchestration | ✅ | ❌ | ❌ | ❌ |
1197
- | Provider routing/fallback | ✅ | ❌ | ❌ | ❌ |
1198
- | Session management | ✅ | ❌ | ❌ | ❌ |
1199
- | Health checks & reliability | ✅ | ❌ | ❌ | ❌ |
1200
- | LLM API integration | ❌ | ✅ (all) | ❌ | ❌ |
1201
- | Model-specific features | ❌ | ✅ | ❌ | ❌ |
1202
- | Tree-sitter parsing | ❌ | ✅ | ❌ | ❌ |
1203
- | File editing | ❌ | ❌ | ✅ (fast) | ✅ (basic) |
1204
- | Complex code refactoring | ❌ | ❌ | ✅ | ❌ |
1205
- | Reusable framework | ✅ | ❌ | ❌ | ✅ |
1206
- | Cost | Free | Free | Paid | Free |
1207
- | Required | ✅ Core | ✅ Core | ❌ Optional | ✅ Core |
1208
-
1209
- ### 🎯 Bottom Line
1210
-
1211
- - **AutomatosX = Brain**: Pure orchestration framework - coordinates multiple agents, handles failures, manages state (reusable across any domain)
1212
- - **AX CLI = Nervous System**: LLM integration layer - connects to GLM/Grok/Claude/GPT, handles model specifics, provides tools (~30K LOC)
1213
- - **Morph = Fast Hands** (optional): Executes file edits quickly when you need performance
1214
- - **Standard Editor = Reliable Hands**: Executes file edits reliably for everyone
1215
-
1216
- **Architectural Philosophy**:
1217
- - **AutomatosX stays pure** (no LLM code) → reusable orchestration framework
1218
- - **AX CLI absorbs complexity** (30K lines of LLM integration) → keeps AutomatosX clean
1219
- - **We keep Morph** because some users find the speed valuable for refactoring
1220
-
1221
- This clean separation means AutomatosX can orchestrate Python agents, Rust tools, or any future AI models without being coupled to today's LLM APIs.
1222
-
1223
- ---
1224
-
1225
- ## ⚡ Morph Fast Apply (Optional)
1226
-
1227
- Ultra-fast code editing at **4,500+ tokens/second with 98% accuracy**.
1228
-
1229
- ### Setup
1230
-
1231
- 1. Get API key from [Morph Dashboard](https://morphllm.com/dashboard/api-keys)
1232
- 2. Configure your key:
1233
-
1234
- ```bash
1235
- # Environment variable
1236
- export MORPH_API_KEY="your_morph_key_here"
1237
-
1238
- # Or in .env
1239
- echo "MORPH_API_KEY=your_morph_key_here" >> .env
1240
- ```
1241
-
1242
- ### How It Works
1243
-
1244
- When Morph is configured, AX CLI gains the `edit_file` tool for high-speed editing:
1245
-
1246
- - **`edit_file`** (Morph): Complex edits, refactoring, multi-line changes, file transformations
1247
- - **`str_replace_editor`** (Standard): Simple replacements, single-line edits
1248
-
1249
- The AI automatically chooses the optimal tool based on the task complexity.
1250
-
1251
- ### Example Usage
1252
-
1253
- ```bash
1254
- # Complex refactoring (uses Morph Fast Apply)
1255
- ax-cli -p "refactor this class to use async/await and add proper error handling"
1256
-
1257
- # Type annotation conversion (uses Morph Fast Apply)
1258
- ax-cli -p "convert all JavaScript files in src/ to TypeScript with type annotations"
1259
-
1260
- # Simple text replacement (uses standard editor)
1261
- ax-cli -p "change variable name from foo to bar in utils.ts"
1262
- ```
1263
-
1264
- ### Performance
1265
-
1266
- | Task | Standard Editor | Morph Fast Apply | Speedup |
1267
- |------|----------------|------------------|---------|
1268
- | Refactor 1000 lines | ~45s | ~8s | **5.6x faster** |
1269
- | Add type annotations | ~30s | ~5s | **6x faster** |
1270
- | Multi-file changes | ~60s | ~10s | **6x faster** |
1271
-
1272
- ---
1273
-
1274
- ## 📚 Command Reference
1275
-
1276
- ### Main Commands
1277
-
1278
- ```bash
1279
- ax-cli [options]
1280
-
1281
- Options:
1282
- -V, --version Output version number
1283
- -d, --directory <dir> Set working directory
1284
- -k, --api-key <key> API key (or GROK_API_KEY env var)
1285
- -u, --base-url <url> API base URL (or GROK_BASE_URL env var)
1286
- -m, --model <model> AI model to use (or GROK_MODEL env var)
1287
- -p, --prompt <prompt> Single prompt (headless mode)
1288
- --max-tool-rounds <rounds> Max tool execution rounds (default: 400)
1289
- -h, --help Display help
145
+ # Remove server
146
+ ax-cli mcp remove linear
1290
147
  ```
1291
148
 
1292
- ### MCP Commands
149
+ [MCP Integration Guide →](docs/mcp.md)
1293
150
 
1294
- ```bash
1295
- ax-cli mcp <command> [options]
151
+ ## 🏗️ Architecture
1296
152
 
1297
- Commands:
1298
- add <name> Add MCP server
1299
- add-json <name> Add from JSON config
1300
- list List all servers
1301
- test <name> Test server connection
1302
- remove <name> Remove server
1303
- info <name> View server details
153
+ AX CLI implements enterprise-grade architecture with:
1304
154
 
1305
- Add Options:
1306
- --transport <type> Transport type (stdio|http|sse)
1307
- --command <cmd> Command to run (stdio only)
1308
- --args <args...> Command arguments (stdio only)
1309
- --url <url> Server URL (http|sse only)
1310
- --env <key=val...> Environment variables
1311
- ```
155
+ - **Single Source of Truth (SSOT)** type system via `@ax-cli/schemas`
156
+ - **TypeScript strict mode** with Zod runtime validation
157
+ - **98%+ test coverage** (306 tests)
158
+ - **Modular design** with clean separation of concerns
1312
159
 
1313
- ### Examples
160
+ [Architecture Documentation →](docs/architecture.md)
1314
161
 
1315
- ```bash
1316
- # Interactive mode
1317
- ax-cli
1318
- ax-cli -d /path/to/project
1319
- ax-cli -m grok-code-fast-1
162
+ ## 📚 Documentation
1320
163
 
1321
- # Headless mode
1322
- ax-cli -p "list TypeScript files"
1323
- ax-cli -p "run tests" -d /project
1324
- ax-cli -p "refactor" --max-tool-rounds 50
164
+ - [Features](docs/features.md) - Complete feature list and capabilities
165
+ - [Installation](docs/installation.md) - Detailed installation guide
166
+ - [Configuration](docs/configuration.md) - Configuration options and settings
167
+ - [Usage](docs/usage.md) - Comprehensive usage guide
168
+ - [CLI Reference](docs/cli-reference.md) - Command-line interface reference
169
+ - [MCP Integration](docs/mcp.md) - Model Context Protocol guide
170
+ - [Architecture](docs/architecture.md) - Technical architecture details
171
+ - [Development](docs/development.md) - Development and contribution guide
172
+ - [Troubleshooting](docs/troubleshooting.md) - Common issues and solutions
1325
173
 
1326
- # MCP operations
1327
- ax-cli mcp add linear --transport sse --url https://mcp.linear.app/sse
1328
- ax-cli mcp list
1329
- ax-cli mcp test linear
1330
- ax-cli mcp remove linear
174
+ ## 🤝 Contributing
1331
175
 
1332
- # Model selection
1333
- ax-cli -m glm4:9b -u http://localhost:11434/v1
1334
- ax-cli -m grok-4-latest -k $GROK_API_KEY
1335
- ax-cli -m anthropic/claude-3.5-sonnet -u https://openrouter.ai/api/v1
1336
- ```
176
+ We welcome contributions! Please see our [Development Guide](docs/development.md) for details on:
1337
177
 
1338
- ---
178
+ - Setting up your development environment
179
+ - Running tests
180
+ - Code style guidelines
181
+ - Submitting pull requests
1339
182
 
1340
183
  ## 📄 License
1341
184
 
1342
- MIT License - see [LICENSE](LICENSE) file for details
1343
-
1344
- ---
185
+ MIT License - see [LICENSE](LICENSE) for details
1345
186
 
1346
187
  ## 🙏 Acknowledgments
1347
188
 
1348
- - **Original Project**: [grok-cli](https://github.com/superagent-ai/grok-cli) by SuperAgent AI
1349
- - **Enterprise Upgrade**: Powered by [AutomatosX](https://github.com/defai-digital/automatosx) multi-agent orchestration
1350
- - **AI Providers**: X.AI, OpenAI, Anthropic, and the open-source LLM community
1351
- - **Contributors**: All developers who have contributed to making AX CLI production-ready
1352
-
1353
- ---
1354
-
1355
- ## 🔗 Links
1356
-
1357
- - **NPM Package**: https://www.npmjs.com/package/@defai.digital/ax-cli
1358
- - **GitHub Repository**: https://github.com/defai-digital/ax-cli
1359
- - **Issue Tracker**: https://github.com/defai-digital/ax-cli/issues
1360
- - **AutomatosX**: https://github.com/defai-digital/automatosx
1361
- - **MCP Protocol**: https://modelcontextprotocol.io
189
+ Originally forked from [grok-cli](https://github.com/superagent-ai/grok-cli), AX CLI has been extensively upgraded using **AutomatosX** multi-agent orchestration to achieve enterprise-class standards.
1362
190
 
1363
191
  ---
1364
192
 
1365
193
  <p align="center">
1366
- <strong>Built with ❤️ using AutomatosX multi-agent collaboration</strong><br>
1367
- <em>Enterprise-class AI CLI for developers who demand quality</em>
194
+ Made with ❤️ by <a href="https://github.com/defai-digital">DefAI Digital</a>
1368
195
  </p>