@defai.digital/ax-cli 0.0.34 → 0.2.1
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 +749 -272
- package/dist/agent/grok-agent.d.ts +7 -1
- package/dist/agent/grok-agent.js +22 -9
- package/dist/agent/grok-agent.js.map +1 -1
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/mcp.js.map +1 -1
- package/dist/constants.d.ts +116 -0
- package/dist/constants.js +115 -0
- package/dist/constants.js.map +1 -0
- package/dist/grok/client.d.ts +133 -2
- package/dist/grok/client.js +173 -16
- package/dist/grok/client.js.map +1 -1
- package/dist/grok/types.d.ts +291 -0
- package/dist/grok/types.js +127 -0
- package/dist/grok/types.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp/client.d.ts +3 -8
- package/dist/mcp/client.js +17 -9
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/config.d.ts +1 -1
- package/dist/mcp/config.js +24 -4
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/transports.js +1 -1
- package/dist/mcp/transports.js.map +1 -1
- package/dist/schemas/api-schemas.d.ts +569 -0
- package/dist/schemas/api-schemas.js +116 -0
- package/dist/schemas/api-schemas.js.map +1 -0
- package/dist/schemas/confirmation-schemas.d.ts +60 -0
- package/dist/schemas/confirmation-schemas.js +41 -0
- package/dist/schemas/confirmation-schemas.js.map +1 -0
- package/dist/schemas/index-unified.d.ts +12 -0
- package/dist/schemas/index-unified.js +17 -0
- package/dist/schemas/index-unified.js.map +1 -0
- package/dist/schemas/index.d.ts +229 -37
- package/dist/schemas/settings-schemas.d.ts +179 -0
- package/dist/schemas/settings-schemas.js +52 -0
- package/dist/schemas/settings-schemas.js.map +1 -0
- package/dist/schemas/tool-schemas.d.ts +241 -0
- package/dist/schemas/tool-schemas.js +79 -0
- package/dist/schemas/tool-schemas.js.map +1 -0
- package/dist/tools/search.js +2 -2
- package/dist/tools/search.js.map +1 -1
- package/dist/ui/components/api-key-input.js +2 -2
- package/dist/ui/components/api-key-input.js.map +1 -1
- package/dist/ui/components/chat-history.js +2 -0
- package/dist/ui/components/chat-history.js.map +1 -1
- package/dist/ui/components/chat-interface.js +31 -1
- package/dist/ui/components/chat-interface.js.map +1 -1
- package/dist/ui/components/mcp-status.js +1 -1
- package/dist/ui/components/mcp-status.js.map +1 -1
- package/dist/ui/components/reasoning-display.d.ts +109 -0
- package/dist/ui/components/reasoning-display.js +110 -0
- package/dist/ui/components/reasoning-display.js.map +1 -0
- package/dist/ui/shared/max-sized-box.js +1 -1
- package/dist/ui/shared/max-sized-box.js.map +1 -1
- package/dist/utils/cache.d.ts +75 -0
- package/dist/utils/cache.js +137 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/confirmation-service.js +2 -2
- package/dist/utils/confirmation-service.js.map +1 -1
- package/dist/utils/error-handler.d.ts +43 -0
- package/dist/utils/error-handler.js +70 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +23 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/path-validator.d.ts +30 -0
- package/dist/utils/path-validator.js +67 -0
- package/dist/utils/path-validator.js.map +1 -0
- package/dist/utils/performance.d.ts +72 -0
- package/dist/utils/performance.js +114 -0
- package/dist/utils/performance.js.map +1 -0
- package/dist/utils/settings-manager.d.ts +2 -18
- package/dist/utils/settings-manager.js +19 -6
- package/dist/utils/settings-manager.js.map +1 -1
- package/dist/utils/token-counter.d.ts +10 -1
- package/dist/utils/token-counter.js +27 -6
- package/dist/utils/token-counter.js.map +1 -1
- package/eslint.config.js +60 -0
- package/package.json +24 -6
- package/vitest.config.ts +20 -0
- package/.automatosx/agents/aerospace-scientist.yaml +0 -159
- package/.automatosx/agents/architecture.yaml +0 -244
- package/.automatosx/agents/backend.yaml +0 -172
- package/.automatosx/agents/ceo.yaml +0 -105
- package/.automatosx/agents/creative-marketer.yaml +0 -173
- package/.automatosx/agents/cto.yaml +0 -118
- package/.automatosx/agents/data-scientist.yaml +0 -200
- package/.automatosx/agents/data.yaml +0 -106
- package/.automatosx/agents/design.yaml +0 -115
- package/.automatosx/agents/devops.yaml +0 -124
- package/.automatosx/agents/frontend.yaml +0 -171
- package/.automatosx/agents/fullstack.yaml +0 -172
- package/.automatosx/agents/mobile.yaml +0 -185
- package/.automatosx/agents/product.yaml +0 -103
- package/.automatosx/agents/quality.yaml +0 -93
- package/.automatosx/agents/quantum-engineer.yaml +0 -167
- package/.automatosx/agents/researcher.yaml +0 -122
- package/.automatosx/agents/security.yaml +0 -115
- package/.automatosx/agents/standard.yaml +0 -214
- package/.automatosx/agents/writer.yaml +0 -122
- package/.automatosx/feature-flags.json +0 -13
- package/.automatosx/memory/memory.db +0 -0
- package/.automatosx/providers/README.md +0 -117
- package/.automatosx/providers/grok-zai.yaml.template +0 -61
- package/.automatosx/providers/grok.yaml.template +0 -71
- package/.automatosx/status/backend-1763517593334-85037.json +0 -9
- package/.automatosx/status/quality-1763516867087-82043.json +0 -9
- package/.automatosx/status/quality-1763516976722-84817.json +0 -9
- package/.automatosx/status/security-1763517871950-87357.json +0 -9
- package/.automatosx/teams/business.yaml +0 -56
- package/.automatosx/teams/core.yaml +0 -60
- package/.automatosx/teams/design.yaml +0 -58
- package/.automatosx/teams/engineering.yaml +0 -69
- package/.automatosx/teams/research.yaml +0 -56
- package/.automatosx/templates/analyst.yaml +0 -60
- package/.automatosx/templates/assistant.yaml +0 -48
- package/.automatosx/templates/basic-agent.yaml +0 -28
- package/.automatosx/templates/code-reviewer.yaml +0 -52
- package/.automatosx/templates/debugger.yaml +0 -63
- package/.automatosx/templates/designer.yaml +0 -69
- package/.automatosx/templates/developer.yaml +0 -60
- package/.automatosx/templates/fullstack-developer.yaml +0 -395
- package/.automatosx/templates/qa-specialist.yaml +0 -71
- package/.claude/mcp/automatosx.json +0 -244
- package/.claude/settings.local.json +0 -34
- package/.grok/settings.json +0 -37
- package/automatosx/PRD/README.md +0 -9
- package/automatosx/tmp/README.md +0 -10
- package/automatosx.config.json +0 -333
package/README.md
CHANGED
|
@@ -1,73 +1,157 @@
|
|
|
1
|
-
# AX CLI
|
|
1
|
+
# AX CLI - Enterprise-Class AI CLI
|
|
2
2
|
|
|
3
|
-
[](https://npm-stat.com/charts.html?package=%40defai.digital%2Fax-cli)
|
|
4
|
+
[](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)
|
|
5
|
+
[](https://nodejs.org/)
|
|
4
6
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://github.com/defai-digital/ax-cli/stargazers)
|
|
6
|
-
[](https://github.com/defai-digital/ax-cli/network/members)
|
|
7
7
|
[](https://github.com/defai-digital/ax-cli/issues)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+

|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<strong>Production-Ready AI CLI • Enterprise-Grade Architecture • 98%+ Test Coverage • TypeScript & Zod Validation</strong>
|
|
13
|
+
</p>
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
---
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
## 🚀 Overview
|
|
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.
|
|
16
35
|
|
|
17
|
-
|
|
36
|
+
**Privacy-First**: Run powerful AI models completely offline on your local machine with GLM 4.6, or connect to cloud providers when needed.
|
|
18
37
|
|
|
19
|
-
-
|
|
20
|
-
- **🚀 GLM 4.6 Support**: Optimized for GLM-4-9B-Chat and GLM-4V-9B vision models
|
|
21
|
-
- **🤖 Conversational AI**: Natural language interface powered by local LLMs
|
|
22
|
-
- **📝 Smart File Operations**: AI automatically uses tools to view, create, and edit files
|
|
23
|
-
- **⚡ Bash Integration**: Execute shell commands through natural conversation
|
|
24
|
-
- **🔧 Automatic Tool Selection**: AI intelligently chooses the right tools for your requests
|
|
25
|
-
- **🌐 Multi-Provider Support**: Also supports cloud providers (OpenAI, Anthropic, Grok) when needed
|
|
26
|
-
- **🔌 MCP Tools**: Extend capabilities with Model Context Protocol servers (Linear, GitHub, etc.)
|
|
27
|
-
- **💬 Interactive UI**: Beautiful terminal interface built with Ink
|
|
28
|
-
- **🌍 Global Installation**: Install and use anywhere with `bun add -g @defai-digital/ax-cli`
|
|
38
|
+
**Developer-Centric**: Built by developers, for developers, with smart file operations, bash integration, and intelligent tool selection.
|
|
29
39
|
|
|
30
|
-
|
|
40
|
+
**Production-Ready**: Unlike hobby projects, AX CLI is enterprise-grade with extensive testing, TypeScript safety, and proven reliability.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## ✨ Key Features
|
|
45
|
+
|
|
46
|
+
### 🔒 **GLM-First Architecture**
|
|
47
|
+
- **Primary Support**: Optimized for GLM (General Language Model) deployments
|
|
48
|
+
- **Local GLM**: Run GLM 4.6 and other GLM models locally via Ollama
|
|
49
|
+
- **Cloud GLM**: Connect to cloud-hosted GLM services
|
|
50
|
+
- **Zero internet dependency** for complete privacy with local models
|
|
51
|
+
- **No API keys required** for local operation
|
|
52
|
+
- Full conversational AI capabilities offline
|
|
53
|
+
|
|
54
|
+
### 🚀 **Multi-Provider AI Support**
|
|
55
|
+
- **Primary**: GLM 4.6 (9B parameters) - Optimized for AX CLI
|
|
56
|
+
- **Local Models**: Llama 3.1, Qwen 2.5, DeepSeek, and more via Ollama
|
|
57
|
+
- **Cloud Providers**: OpenAI, Anthropic (Claude), X.AI (Grok), OpenRouter, Groq
|
|
58
|
+
- **Flexible Configuration**: Switch between providers seamlessly
|
|
59
|
+
- **OpenAI-Compatible API**: Works with any OpenAI-compatible endpoint
|
|
60
|
+
|
|
61
|
+
### 🤖 **Intelligent Automation**
|
|
62
|
+
- **Smart File Operations**: AI automatically reads, creates, and edits files
|
|
63
|
+
- **Bash Integration**: Execute shell commands through natural conversation
|
|
64
|
+
- **Automatic Tool Selection**: AI chooses the right tools for your requests
|
|
65
|
+
- **Multi-Step Task Execution**: Handle complex workflows with up to 400 tool rounds
|
|
66
|
+
|
|
67
|
+
### 🔌 **Extensibility**
|
|
68
|
+
- **MCP Protocol Support**: Integrate Model Context Protocol servers
|
|
69
|
+
- **Custom Instructions**: Project-specific AI behavior via `.ax/AX.md`
|
|
70
|
+
- **Plugin Architecture**: Extend with Linear, GitHub, and other MCP tools
|
|
71
|
+
- **Morph Fast Apply**: Optional 4,500+ tokens/sec code editing
|
|
72
|
+
|
|
73
|
+
### 💬 **Developer Experience**
|
|
74
|
+
- **Interactive Mode**: Conversational AI assistant in your terminal
|
|
75
|
+
- **Headless Mode**: Scriptable single-prompt execution for CI/CD
|
|
76
|
+
- **Beautiful UI**: Ink-based terminal interface with syntax highlighting
|
|
77
|
+
- **Global Installation**: Use anywhere with `npm install -g`
|
|
78
|
+
|
|
79
|
+
### 🏗️ **Enterprise Quality**
|
|
80
|
+
- **98.29% Test Coverage**: Text utils, token counting, schema validation
|
|
81
|
+
- **TypeScript + Zod**: Runtime type safety and validation
|
|
82
|
+
- **Automated CI/CD**: Tests run on every commit and PR
|
|
83
|
+
- **Comprehensive Documentation**: Detailed guides and API references
|
|
84
|
+
- **Node.js 24+ Support**: Modern JavaScript runtime features
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 📦 Installation
|
|
31
89
|
|
|
32
90
|
### Prerequisites
|
|
33
91
|
|
|
34
|
-
**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
92
|
+
#### **Node.js 24+** (Required)
|
|
93
|
+
```bash
|
|
94
|
+
# Check your Node.js version
|
|
95
|
+
node --version # Should be v24.0.0 or higher
|
|
96
|
+
|
|
97
|
+
# Install Node.js 24+ from https://nodejs.org/
|
|
98
|
+
```
|
|
40
99
|
|
|
41
|
-
**For
|
|
42
|
-
-
|
|
100
|
+
#### **For Offline Operation** (Recommended)
|
|
101
|
+
- **Ollama** 0.1.0+ for local LLM inference
|
|
102
|
+
- **GLM 4.6 Model** (9B parameters, ~5GB download)
|
|
103
|
+
- **16GB RAM** minimum (32GB recommended for larger models)
|
|
104
|
+
- **GPU** recommended but optional (CPU inference supported)
|
|
105
|
+
|
|
106
|
+
#### **For Cloud Providers** (Optional)
|
|
107
|
+
- API key from OpenAI, Anthropic, X.AI, or compatible provider
|
|
43
108
|
- (Optional) Morph API key for Fast Apply editing
|
|
44
109
|
|
|
45
110
|
### Global Installation (Recommended)
|
|
46
|
-
```bash
|
|
47
|
-
bun add -g @defai-digital/ax-cli
|
|
48
|
-
```
|
|
49
111
|
|
|
50
|
-
Or with npm (fallback):
|
|
51
112
|
```bash
|
|
52
|
-
|
|
113
|
+
# Using npm
|
|
114
|
+
npm install -g @defai.digital/ax-cli
|
|
115
|
+
|
|
116
|
+
# Using bun (faster)
|
|
117
|
+
bun add -g @defai.digital/ax-cli
|
|
118
|
+
|
|
119
|
+
# Verify installation
|
|
120
|
+
ax-cli --version
|
|
53
121
|
```
|
|
54
122
|
|
|
55
123
|
### Local Development
|
|
124
|
+
|
|
56
125
|
```bash
|
|
126
|
+
# Clone the repository
|
|
57
127
|
git clone https://github.com/defai-digital/ax-cli
|
|
58
128
|
cd ax-cli
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
129
|
+
|
|
130
|
+
# Install dependencies
|
|
131
|
+
npm install
|
|
132
|
+
|
|
133
|
+
# Build the project
|
|
134
|
+
npm run build
|
|
135
|
+
|
|
136
|
+
# Link globally
|
|
137
|
+
npm link
|
|
138
|
+
|
|
139
|
+
# Run tests
|
|
140
|
+
npm test
|
|
141
|
+
|
|
142
|
+
# Generate coverage report
|
|
143
|
+
npm run test:coverage
|
|
62
144
|
```
|
|
63
145
|
|
|
64
|
-
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## ⚙️ Setup
|
|
65
149
|
|
|
66
|
-
### Option 1: Offline Setup with GLM 4.6 (
|
|
150
|
+
### Option 1: Offline Setup with GLM 4.6 (Privacy-First)
|
|
67
151
|
|
|
68
|
-
**
|
|
152
|
+
**Perfect for**: Developers who prioritize privacy, work with sensitive data, or need offline AI capabilities.
|
|
69
153
|
|
|
70
|
-
|
|
154
|
+
#### Step 1: Install Ollama
|
|
71
155
|
|
|
72
156
|
```bash
|
|
73
157
|
# macOS / Linux
|
|
@@ -75,138 +159,248 @@ curl -fsSL https://ollama.ai/install.sh | sh
|
|
|
75
159
|
|
|
76
160
|
# Windows
|
|
77
161
|
# Download from https://ollama.ai/download
|
|
162
|
+
|
|
163
|
+
# Verify installation
|
|
164
|
+
ollama --version
|
|
78
165
|
```
|
|
79
166
|
|
|
80
|
-
|
|
167
|
+
#### Step 2: Download GLM 4.6 Model
|
|
81
168
|
|
|
82
169
|
```bash
|
|
83
170
|
# Pull the GLM-4-9B-Chat model (9B parameters, ~5GB download)
|
|
84
171
|
ollama pull glm4:9b
|
|
85
172
|
|
|
86
|
-
#
|
|
173
|
+
# Optional: Pull the vision-capable model
|
|
87
174
|
ollama pull glm4v:9b
|
|
88
175
|
|
|
89
|
-
# Verify
|
|
176
|
+
# Verify models are available
|
|
90
177
|
ollama list
|
|
91
178
|
```
|
|
92
179
|
|
|
93
|
-
|
|
180
|
+
#### Step 3: Start Ollama Server
|
|
94
181
|
|
|
95
182
|
```bash
|
|
96
183
|
# Ollama runs as a background service by default
|
|
97
184
|
# If needed, start it manually:
|
|
98
185
|
ollama serve
|
|
186
|
+
|
|
187
|
+
# Test the model
|
|
188
|
+
ollama run glm4:9b "Hello, how are you?"
|
|
99
189
|
```
|
|
100
190
|
|
|
101
|
-
|
|
191
|
+
#### Step 4: Configure AX CLI for Local Operation
|
|
102
192
|
|
|
103
193
|
Create `~/.ax/user-settings.json`:
|
|
194
|
+
|
|
104
195
|
```json
|
|
105
196
|
{
|
|
106
197
|
"baseURL": "http://localhost:11434/v1",
|
|
107
198
|
"defaultModel": "glm4:9b",
|
|
108
199
|
"models": [
|
|
109
200
|
"glm4:9b",
|
|
110
|
-
"glm4v:9b"
|
|
201
|
+
"glm4v:9b",
|
|
202
|
+
"llama3.1:8b",
|
|
203
|
+
"qwen2.5:7b"
|
|
111
204
|
]
|
|
112
205
|
}
|
|
113
206
|
```
|
|
114
207
|
|
|
115
|
-
|
|
208
|
+
#### Step 5: Test Your Setup
|
|
116
209
|
|
|
117
210
|
```bash
|
|
211
|
+
# Interactive mode
|
|
212
|
+
ax-cli
|
|
213
|
+
|
|
214
|
+
# Headless mode
|
|
118
215
|
ax-cli --prompt "Hello, please introduce yourself"
|
|
216
|
+
|
|
217
|
+
# Specify working directory
|
|
218
|
+
ax-cli --directory /path/to/project --prompt "List all TypeScript files"
|
|
119
219
|
```
|
|
120
220
|
|
|
121
|
-
You're now running completely offline
|
|
221
|
+
**✅ You're now running completely offline!** No API keys, no internet, complete privacy.
|
|
122
222
|
|
|
123
223
|
---
|
|
124
224
|
|
|
125
225
|
### Option 2: Cloud Provider Setup
|
|
126
226
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
227
|
+
**Perfect for**: Teams using enterprise AI providers, developers who need the latest models, or hybrid offline/cloud workflows.
|
|
228
|
+
|
|
229
|
+
#### Supported Providers
|
|
230
|
+
|
|
231
|
+
| Provider | Base URL | Best For |
|
|
232
|
+
|----------|----------|----------|
|
|
233
|
+
| **X.AI (Grok)** | `https://api.x.ai/v1` | Fast code generation, reasoning |
|
|
234
|
+
| **OpenAI** | `https://api.openai.com/v1` | GPT-4, GPT-4 Turbo, GPT-3.5 |
|
|
235
|
+
| **Anthropic** | `https://api.anthropic.com/v1` | Claude 3.5 Sonnet, Claude 3 Opus |
|
|
236
|
+
| **OpenRouter** | `https://openrouter.ai/api/v1` | Multi-model access, routing |
|
|
237
|
+
| **Groq** | `https://api.groq.com/openai/v1` | Ultra-fast inference |
|
|
238
|
+
|
|
239
|
+
#### Step 1: Get API Key
|
|
240
|
+
|
|
241
|
+
1. Sign up at your chosen provider:
|
|
242
|
+
- [X.AI (Grok)](https://x.ai) - Fast code models
|
|
243
|
+
- [OpenAI](https://platform.openai.com) - GPT-4 and GPT-3.5
|
|
244
|
+
- [Anthropic](https://console.anthropic.com) - Claude 3.5 Sonnet
|
|
245
|
+
- [OpenRouter](https://openrouter.ai) - Multi-model access
|
|
131
246
|
|
|
132
|
-
2.
|
|
247
|
+
2. Generate an API key from your provider's dashboard
|
|
248
|
+
|
|
249
|
+
#### Step 2: Configure API Key (Choose One Method)
|
|
250
|
+
|
|
251
|
+
**Method 1: User Settings File** (Recommended)
|
|
252
|
+
|
|
253
|
+
Create `~/.ax/user-settings.json`:
|
|
254
|
+
|
|
255
|
+
```json
|
|
256
|
+
{
|
|
257
|
+
"apiKey": "your_api_key_here",
|
|
258
|
+
"baseURL": "https://api.x.ai/v1",
|
|
259
|
+
"defaultModel": "grok-code-fast-1",
|
|
260
|
+
"models": [
|
|
261
|
+
"grok-code-fast-1",
|
|
262
|
+
"grok-4-latest",
|
|
263
|
+
"grok-3-latest"
|
|
264
|
+
]
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
**Method 2: Environment Variable**
|
|
133
269
|
|
|
134
|
-
**Method 1: Environment Variable**
|
|
135
270
|
```bash
|
|
136
|
-
export GROK_API_KEY=your_api_key_here
|
|
271
|
+
export GROK_API_KEY="your_api_key_here"
|
|
272
|
+
export GROK_BASE_URL="https://api.x.ai/v1"
|
|
273
|
+
export GROK_MODEL="grok-code-fast-1"
|
|
137
274
|
```
|
|
138
275
|
|
|
139
|
-
**Method
|
|
276
|
+
**Method 3: .env File**
|
|
277
|
+
|
|
140
278
|
```bash
|
|
141
279
|
cp .env.example .env
|
|
142
|
-
# Edit .env and add
|
|
280
|
+
# Edit .env and add:
|
|
281
|
+
GROK_API_KEY=your_api_key_here
|
|
282
|
+
GROK_BASE_URL=https://api.x.ai/v1
|
|
283
|
+
GROK_MODEL=grok-code-fast-1
|
|
143
284
|
```
|
|
144
285
|
|
|
145
|
-
**Method
|
|
286
|
+
**Method 4: Command Line Flags**
|
|
287
|
+
|
|
146
288
|
```bash
|
|
147
|
-
ax-cli --api-key your_api_key_here
|
|
289
|
+
ax-cli --api-key your_api_key_here --base-url https://api.x.ai/v1 --model grok-code-fast-1
|
|
148
290
|
```
|
|
149
291
|
|
|
150
|
-
|
|
151
|
-
Create `~/.ax/user-settings.json`:
|
|
152
|
-
```json
|
|
153
|
-
{
|
|
154
|
-
"apiKey": "your_api_key_here"
|
|
155
|
-
}
|
|
156
|
-
```
|
|
292
|
+
#### Step 3: (Optional) Configure Morph Fast Apply
|
|
157
293
|
|
|
158
|
-
|
|
294
|
+
For lightning-fast code editing at 4,500+ tokens/sec:
|
|
159
295
|
|
|
160
|
-
|
|
296
|
+
1. Get API key from [Morph Dashboard](https://morphllm.com/dashboard/api-keys)
|
|
297
|
+
2. Add to environment or `.env`:
|
|
161
298
|
|
|
162
|
-
**Method 1: Environment Variable**
|
|
163
299
|
```bash
|
|
164
|
-
export MORPH_API_KEY=
|
|
300
|
+
export MORPH_API_KEY="your_morph_key_here"
|
|
165
301
|
```
|
|
166
302
|
|
|
167
|
-
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 📖 Usage
|
|
306
|
+
|
|
307
|
+
### Interactive Mode
|
|
308
|
+
|
|
309
|
+
Start a conversational AI session:
|
|
310
|
+
|
|
168
311
|
```bash
|
|
169
|
-
#
|
|
170
|
-
|
|
312
|
+
# Basic usage
|
|
313
|
+
ax-cli
|
|
314
|
+
|
|
315
|
+
# Specify working directory
|
|
316
|
+
ax-cli --directory /path/to/project
|
|
317
|
+
|
|
318
|
+
# Use specific model
|
|
319
|
+
ax-cli --model grok-code-fast-1
|
|
320
|
+
|
|
321
|
+
# Offline mode with local GLM
|
|
322
|
+
ax-cli --model glm4:9b --base-url http://localhost:11434/v1
|
|
171
323
|
```
|
|
172
324
|
|
|
173
|
-
|
|
325
|
+
**Example Session:**
|
|
326
|
+
```
|
|
327
|
+
AX> Show me the package.json file
|
|
174
328
|
|
|
175
|
-
|
|
329
|
+
[AX reads and displays package.json]
|
|
176
330
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
331
|
+
AX> Create a new TypeScript file called utils.ts with helper functions
|
|
332
|
+
|
|
333
|
+
[AX creates the file with intelligent content]
|
|
334
|
+
|
|
335
|
+
AX> Run npm test and show me the results
|
|
336
|
+
|
|
337
|
+
[AX executes the command and displays output]
|
|
180
338
|
```
|
|
181
339
|
|
|
182
|
-
|
|
340
|
+
### Headless Mode (Scriptable)
|
|
341
|
+
|
|
342
|
+
Process a single prompt and exit — perfect for CI/CD, automation, and scripting:
|
|
343
|
+
|
|
183
344
|
```bash
|
|
184
|
-
|
|
345
|
+
# Basic headless execution
|
|
346
|
+
ax-cli --prompt "show me the package.json file"
|
|
347
|
+
|
|
348
|
+
# Short form
|
|
349
|
+
ax-cli -p "list all TypeScript files in src/"
|
|
350
|
+
|
|
351
|
+
# With working directory
|
|
352
|
+
ax-cli -p "run npm test" -d /path/to/project
|
|
353
|
+
|
|
354
|
+
# Control tool execution rounds
|
|
355
|
+
ax-cli -p "comprehensive code refactoring" --max-tool-rounds 50
|
|
356
|
+
|
|
357
|
+
# Combine with shell scripting
|
|
358
|
+
RESULT=$(ax-cli -p "count lines of code in src/") && echo $RESULT
|
|
185
359
|
```
|
|
186
360
|
|
|
187
|
-
**
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
361
|
+
**Use Cases:**
|
|
362
|
+
- **CI/CD Pipelines**: Automate code analysis, testing, linting
|
|
363
|
+
- **Shell Scripts**: Integrate AI into bash automation
|
|
364
|
+
- **Batch Processing**: Process multiple prompts programmatically
|
|
365
|
+
- **Terminal Benchmarks**: Non-interactive execution for tools like Terminal Bench
|
|
366
|
+
|
|
367
|
+
### Tool Execution Control
|
|
368
|
+
|
|
369
|
+
Fine-tune AI behavior with configurable tool execution limits:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
# Fast responses for simple queries (limit: 10 rounds)
|
|
373
|
+
ax-cli --max-tool-rounds 10 -p "show current directory"
|
|
374
|
+
|
|
375
|
+
# Complex automation (limit: 500 rounds)
|
|
376
|
+
ax-cli --max-tool-rounds 500 -p "refactor entire codebase to TypeScript"
|
|
377
|
+
|
|
378
|
+
# Works with all modes
|
|
379
|
+
ax-cli --max-tool-rounds 20 # Interactive
|
|
380
|
+
ax-cli -p "task" --max-tool-rounds 30 # Headless
|
|
381
|
+
ax-cli git commit-and-push --max-tool-rounds 30 # Git commands
|
|
194
382
|
```
|
|
195
383
|
|
|
196
|
-
|
|
384
|
+
**Default**: 400 rounds (sufficient for most tasks)
|
|
197
385
|
|
|
198
|
-
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
## 🛠️ Configuration
|
|
389
|
+
|
|
390
|
+
### Configuration Architecture
|
|
391
|
+
|
|
392
|
+
AX CLI uses a **two-tier configuration system** for maximum flexibility:
|
|
393
|
+
|
|
394
|
+
1. **User-Level Settings** (`~/.ax/user-settings.json`) - Global defaults
|
|
395
|
+
2. **Project-Level Settings** (`.ax/settings.json`) - Project-specific overrides
|
|
199
396
|
|
|
200
|
-
|
|
397
|
+
#### User-Level Settings
|
|
201
398
|
|
|
202
|
-
|
|
399
|
+
**Location**: `~/.ax/user-settings.json`
|
|
203
400
|
|
|
204
|
-
|
|
205
|
-
- **API Key**: Only needed for cloud providers
|
|
206
|
-
- **Default Model**: Your preferred model
|
|
207
|
-
- **Available Models**: List of models you can use
|
|
401
|
+
**Purpose**: Global settings that apply across all projects
|
|
208
402
|
|
|
209
|
-
**Example (Offline with GLM 4.6)
|
|
403
|
+
**Example (Offline with GLM 4.6)**:
|
|
210
404
|
```json
|
|
211
405
|
{
|
|
212
406
|
"baseURL": "http://localhost:11434/v1",
|
|
@@ -215,304 +409,587 @@ This file stores **global settings** that apply across all projects. These setti
|
|
|
215
409
|
"glm4:9b",
|
|
216
410
|
"glm4v:9b",
|
|
217
411
|
"llama3.1:8b",
|
|
218
|
-
"qwen2.5:7b"
|
|
412
|
+
"qwen2.5:7b",
|
|
413
|
+
"mistral:7b"
|
|
219
414
|
]
|
|
220
415
|
}
|
|
221
416
|
```
|
|
222
417
|
|
|
223
|
-
**Example (Cloud Provider -
|
|
418
|
+
**Example (Cloud Provider - X.AI)**:
|
|
224
419
|
```json
|
|
225
420
|
{
|
|
226
|
-
"apiKey": "your_api_key_here",
|
|
421
|
+
"apiKey": "xai-your_api_key_here",
|
|
227
422
|
"baseURL": "https://api.x.ai/v1",
|
|
228
423
|
"defaultModel": "grok-code-fast-1",
|
|
229
424
|
"models": [
|
|
230
425
|
"grok-code-fast-1",
|
|
231
426
|
"grok-4-latest",
|
|
232
|
-
"grok-3-latest"
|
|
427
|
+
"grok-3-latest",
|
|
428
|
+
"grok-2-latest"
|
|
429
|
+
]
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
**Example (OpenRouter for Multi-Model Access)**:
|
|
434
|
+
```json
|
|
435
|
+
{
|
|
436
|
+
"apiKey": "sk-or-your_api_key_here",
|
|
437
|
+
"baseURL": "https://openrouter.ai/api/v1",
|
|
438
|
+
"defaultModel": "anthropic/claude-3.5-sonnet",
|
|
439
|
+
"models": [
|
|
440
|
+
"anthropic/claude-3.5-sonnet",
|
|
441
|
+
"openai/gpt-4o",
|
|
442
|
+
"meta-llama/llama-3.1-70b-instruct",
|
|
443
|
+
"google/gemini-pro-1.5"
|
|
233
444
|
]
|
|
234
445
|
}
|
|
235
446
|
```
|
|
236
447
|
|
|
237
|
-
|
|
448
|
+
#### Project-Level Settings
|
|
238
449
|
|
|
239
|
-
|
|
450
|
+
**Location**: `.ax/settings.json` (in your project directory)
|
|
240
451
|
|
|
241
|
-
|
|
242
|
-
- **MCP Servers**: Model Context Protocol server configurations
|
|
452
|
+
**Purpose**: Project-specific model selection and MCP server configuration
|
|
243
453
|
|
|
244
|
-
**Example
|
|
454
|
+
**Example**:
|
|
245
455
|
```json
|
|
246
456
|
{
|
|
247
|
-
"model": "
|
|
457
|
+
"model": "grok-code-fast-1",
|
|
248
458
|
"mcpServers": {
|
|
249
459
|
"linear": {
|
|
250
460
|
"name": "linear",
|
|
461
|
+
"transport": "sse",
|
|
462
|
+
"url": "https://mcp.linear.app/sse"
|
|
463
|
+
},
|
|
464
|
+
"github": {
|
|
465
|
+
"name": "github",
|
|
251
466
|
"transport": "stdio",
|
|
252
467
|
"command": "npx",
|
|
253
|
-
"args": ["@
|
|
468
|
+
"args": ["@modelcontextprotocol/server-github"],
|
|
469
|
+
"env": {
|
|
470
|
+
"GITHUB_TOKEN": "your_github_token"
|
|
471
|
+
}
|
|
254
472
|
}
|
|
255
473
|
}
|
|
256
474
|
}
|
|
257
475
|
```
|
|
258
476
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
"mcpServers": {}
|
|
264
|
-
}
|
|
477
|
+
#### Configuration Priority
|
|
478
|
+
|
|
479
|
+
```
|
|
480
|
+
Command Line Flags > Environment Variables > Project Settings > User Settings > System Defaults
|
|
265
481
|
```
|
|
266
482
|
|
|
267
|
-
|
|
483
|
+
**Example**:
|
|
484
|
+
```bash
|
|
485
|
+
# 1. Command line takes highest priority
|
|
486
|
+
ax-cli --model grok-4-latest
|
|
268
487
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
3. **Directory-Specific**: When you change directories, project settings are loaded automatically
|
|
272
|
-
4. **Fallback Logic**: Project model → User default model → System default (`grok-code-fast-1`)
|
|
488
|
+
# 2. Then environment variables
|
|
489
|
+
export GROK_MODEL="grok-code-fast-1"
|
|
273
490
|
|
|
274
|
-
|
|
491
|
+
# 3. Then project settings (.ax/settings.json)
|
|
492
|
+
{ "model": "glm4:9b" }
|
|
275
493
|
|
|
276
|
-
|
|
494
|
+
# 4. Then user settings (~/.ax/user-settings.json)
|
|
495
|
+
{ "defaultModel": "grok-3-latest" }
|
|
277
496
|
|
|
278
|
-
|
|
497
|
+
# 5. Finally system default
|
|
498
|
+
grok-code-fast-1
|
|
499
|
+
```
|
|
279
500
|
|
|
280
|
-
|
|
281
|
-
- **X.AI (Grok)**: `https://api.x.ai/v1` (default)
|
|
282
|
-
- **OpenAI**: `https://api.openai.com/v1`
|
|
283
|
-
- **OpenRouter**: `https://openrouter.ai/api/v1`
|
|
284
|
-
- **Groq**: `https://api.groq.com/openai/v1`
|
|
501
|
+
---
|
|
285
502
|
|
|
286
|
-
|
|
287
|
-
```json
|
|
288
|
-
{
|
|
289
|
-
"apiKey": "your_openrouter_key",
|
|
290
|
-
"baseURL": "https://openrouter.ai/api/v1",
|
|
291
|
-
"defaultModel": "anthropic/claude-3.5-sonnet",
|
|
292
|
-
"models": [
|
|
293
|
-
"anthropic/claude-3.5-sonnet",
|
|
294
|
-
"openai/gpt-4o",
|
|
295
|
-
"meta-llama/llama-3.1-70b-instruct"
|
|
296
|
-
]
|
|
297
|
-
}
|
|
298
|
-
```
|
|
503
|
+
## 🎨 Custom Instructions
|
|
299
504
|
|
|
300
|
-
|
|
505
|
+
Tailor AX CLI's behavior to your project's specific needs with custom instructions.
|
|
301
506
|
|
|
302
|
-
###
|
|
507
|
+
### Setup
|
|
508
|
+
|
|
509
|
+
Create `.ax/AX.md` in your project root:
|
|
303
510
|
|
|
304
|
-
Start the conversational AI assistant:
|
|
305
511
|
```bash
|
|
306
|
-
ax
|
|
512
|
+
mkdir -p .ax
|
|
513
|
+
touch .ax/AX.md
|
|
307
514
|
```
|
|
308
515
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
516
|
+
### Example Custom Instructions
|
|
517
|
+
|
|
518
|
+
**TypeScript Project**:
|
|
519
|
+
```markdown
|
|
520
|
+
# Custom Instructions for AX CLI
|
|
521
|
+
|
|
522
|
+
## Code Style
|
|
523
|
+
- Always use TypeScript for new code files
|
|
524
|
+
- Prefer const assertions and explicit typing
|
|
525
|
+
- Use functional components with React hooks
|
|
526
|
+
- Follow the project's existing ESLint configuration
|
|
527
|
+
|
|
528
|
+
## Documentation
|
|
529
|
+
- Add JSDoc comments for all public functions
|
|
530
|
+
- Include type annotations in JSDoc
|
|
531
|
+
- Document complex algorithms with inline comments
|
|
532
|
+
|
|
533
|
+
## Testing
|
|
534
|
+
- Write tests using Vitest
|
|
535
|
+
- Aim for 80%+ code coverage
|
|
536
|
+
- Include edge cases and error scenarios
|
|
537
|
+
|
|
538
|
+
## File Structure
|
|
539
|
+
- Place components in src/components/
|
|
540
|
+
- Place utilities in src/utils/
|
|
541
|
+
- Place types in src/types/
|
|
312
542
|
```
|
|
313
543
|
|
|
314
|
-
|
|
544
|
+
**Python Data Science Project**:
|
|
545
|
+
```markdown
|
|
546
|
+
# Custom Instructions for AX CLI
|
|
315
547
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
548
|
+
## Code Standards
|
|
549
|
+
- Follow PEP 8 style guide
|
|
550
|
+
- Use type hints for function signatures
|
|
551
|
+
- Prefer pandas for data manipulation
|
|
552
|
+
- Use numpy for numerical operations
|
|
553
|
+
|
|
554
|
+
## Documentation
|
|
555
|
+
- Add docstrings in Google format
|
|
556
|
+
- Include usage examples in docstrings
|
|
557
|
+
- Document data schemas and transformations
|
|
558
|
+
|
|
559
|
+
## Best Practices
|
|
560
|
+
- Always validate input data types
|
|
561
|
+
- Handle missing values explicitly
|
|
562
|
+
- Add error handling for file operations
|
|
322
563
|
```
|
|
323
564
|
|
|
324
|
-
|
|
325
|
-
- **CI/CD pipelines**: Automate code analysis and file operations
|
|
326
|
-
- **Scripting**: Integrate AI assistance into shell scripts
|
|
327
|
-
- **Terminal benchmarks**: Perfect for tools like Terminal Bench that need non-interactive execution
|
|
328
|
-
- **Batch processing**: Process multiple prompts programmatically
|
|
565
|
+
### How It Works
|
|
329
566
|
|
|
330
|
-
|
|
567
|
+
1. **Auto-Loading**: AX automatically loads `.ax/AX.md` when working in your project
|
|
568
|
+
2. **Priority**: Custom instructions override default AI behavior
|
|
569
|
+
3. **Scope**: Instructions apply only to the current project
|
|
570
|
+
4. **Format**: Use markdown for clear, structured instructions
|
|
331
571
|
|
|
332
|
-
|
|
572
|
+
---
|
|
333
573
|
|
|
334
|
-
|
|
335
|
-
# Limit tool rounds for faster execution on simple tasks
|
|
336
|
-
ax-cli --max-tool-rounds 10 --prompt "show me the current directory"
|
|
574
|
+
## 🔌 MCP (Model Context Protocol) Integration
|
|
337
575
|
|
|
338
|
-
|
|
339
|
-
ax-cli --max-tool-rounds 1000 --prompt "comprehensive code refactoring"
|
|
576
|
+
Extend AX CLI with powerful integrations through the Model Context Protocol.
|
|
340
577
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
578
|
+
### What is MCP?
|
|
579
|
+
|
|
580
|
+
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.
|
|
581
|
+
|
|
582
|
+
### Adding MCP Servers
|
|
583
|
+
|
|
584
|
+
#### Linear Integration (Project Management)
|
|
585
|
+
|
|
586
|
+
```bash
|
|
587
|
+
# Add Linear MCP server via SSE
|
|
588
|
+
ax-cli mcp add linear --transport sse --url "https://mcp.linear.app/sse"
|
|
589
|
+
|
|
590
|
+
# Now you can:
|
|
591
|
+
# - Create and manage Linear issues
|
|
592
|
+
# - Search and filter tasks
|
|
593
|
+
# - Update issue status and assignees
|
|
594
|
+
# - Access team and project information
|
|
344
595
|
```
|
|
345
596
|
|
|
346
|
-
|
|
347
|
-
- **Fast responses**: Lower limits (10-50) for simple queries
|
|
348
|
-
- **Complex automation**: Higher limits (500+) for comprehensive tasks
|
|
349
|
-
- **Resource control**: Prevent runaway executions in automated environments
|
|
597
|
+
#### GitHub Integration (Version Control)
|
|
350
598
|
|
|
351
|
-
|
|
599
|
+
```bash
|
|
600
|
+
# Add GitHub MCP server via stdio
|
|
601
|
+
ax-cli mcp add github \
|
|
602
|
+
--transport stdio \
|
|
603
|
+
--command "npx" \
|
|
604
|
+
--args "@modelcontextprotocol/server-github" \
|
|
605
|
+
--env "GITHUB_TOKEN=your_github_token"
|
|
352
606
|
|
|
353
|
-
|
|
607
|
+
# Now you can:
|
|
608
|
+
# - Create pull requests
|
|
609
|
+
# - Manage issues
|
|
610
|
+
# - Review code
|
|
611
|
+
# - Access repository information
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
#### Custom MCP Server
|
|
354
615
|
|
|
355
|
-
**Method 1: Command Line Flag**
|
|
356
616
|
```bash
|
|
357
|
-
#
|
|
358
|
-
ax-cli
|
|
617
|
+
# Stdio transport (most common)
|
|
618
|
+
ax-cli mcp add my-server \
|
|
619
|
+
--transport stdio \
|
|
620
|
+
--command "bun" \
|
|
621
|
+
--args "server.js"
|
|
359
622
|
|
|
360
|
-
#
|
|
361
|
-
ax-cli
|
|
362
|
-
|
|
623
|
+
# HTTP transport
|
|
624
|
+
ax-cli mcp add my-api \
|
|
625
|
+
--transport http \
|
|
626
|
+
--url "http://localhost:3000"
|
|
363
627
|
|
|
364
|
-
#
|
|
365
|
-
ax-cli
|
|
366
|
-
|
|
628
|
+
# With environment variables
|
|
629
|
+
ax-cli mcp add my-server \
|
|
630
|
+
--transport stdio \
|
|
631
|
+
--command "python" \
|
|
632
|
+
--args "-m" "my_mcp_server" \
|
|
633
|
+
--env "API_KEY=secret" \
|
|
634
|
+
--env "DEBUG=true"
|
|
367
635
|
```
|
|
368
636
|
|
|
369
|
-
|
|
637
|
+
#### Add from JSON
|
|
638
|
+
|
|
370
639
|
```bash
|
|
371
|
-
|
|
372
|
-
|
|
640
|
+
ax-cli mcp add-json my-server '{
|
|
641
|
+
"command": "bun",
|
|
642
|
+
"args": ["server.js"],
|
|
643
|
+
"env": {
|
|
644
|
+
"API_KEY": "your_key",
|
|
645
|
+
"LOG_LEVEL": "debug"
|
|
646
|
+
}
|
|
647
|
+
}'
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
### Managing MCP Servers
|
|
651
|
+
|
|
652
|
+
```bash
|
|
653
|
+
# List all configured servers
|
|
654
|
+
ax-cli mcp list
|
|
655
|
+
|
|
656
|
+
# Test server connection and tools
|
|
657
|
+
ax-cli mcp test server-name
|
|
658
|
+
|
|
659
|
+
# Remove a server
|
|
660
|
+
ax-cli mcp remove server-name
|
|
661
|
+
|
|
662
|
+
# View server details
|
|
663
|
+
ax-cli mcp info server-name
|
|
373
664
|
```
|
|
374
665
|
|
|
375
|
-
|
|
376
|
-
|
|
666
|
+
### Transport Types
|
|
667
|
+
|
|
668
|
+
| Transport | Use Case | Example |
|
|
669
|
+
|-----------|----------|---------|
|
|
670
|
+
| **stdio** | Local processes, Node.js/Python servers | `npx @linear/mcp-server` |
|
|
671
|
+
| **http** | RESTful APIs, remote services | `http://localhost:3000` |
|
|
672
|
+
| **sse** | Server-Sent Events, real-time updates | `https://mcp.linear.app/sse` |
|
|
673
|
+
|
|
674
|
+
### Configuration Storage
|
|
675
|
+
|
|
676
|
+
MCP servers are stored in `.ax/settings.json`:
|
|
677
|
+
|
|
377
678
|
```json
|
|
378
679
|
{
|
|
379
|
-
"
|
|
380
|
-
"
|
|
680
|
+
"model": "grok-code-fast-1",
|
|
681
|
+
"mcpServers": {
|
|
682
|
+
"linear": {
|
|
683
|
+
"name": "linear",
|
|
684
|
+
"transport": "sse",
|
|
685
|
+
"url": "https://mcp.linear.app/sse"
|
|
686
|
+
},
|
|
687
|
+
"github": {
|
|
688
|
+
"name": "github",
|
|
689
|
+
"transport": "stdio",
|
|
690
|
+
"command": "npx",
|
|
691
|
+
"args": ["@modelcontextprotocol/server-github"],
|
|
692
|
+
"env": {
|
|
693
|
+
"GITHUB_TOKEN": "ghp_your_token"
|
|
694
|
+
}
|
|
695
|
+
},
|
|
696
|
+
"custom-api": {
|
|
697
|
+
"name": "custom-api",
|
|
698
|
+
"transport": "http",
|
|
699
|
+
"url": "https://api.example.com/mcp"
|
|
700
|
+
}
|
|
701
|
+
}
|
|
381
702
|
}
|
|
382
703
|
```
|
|
383
704
|
|
|
384
|
-
|
|
705
|
+
---
|
|
706
|
+
|
|
707
|
+
## ⚡ Morph Fast Apply (Optional)
|
|
385
708
|
|
|
386
|
-
|
|
709
|
+
Ultra-fast code editing at **4,500+ tokens/second with 98% accuracy**.
|
|
710
|
+
|
|
711
|
+
### Setup
|
|
712
|
+
|
|
713
|
+
1. Get API key from [Morph Dashboard](https://morphllm.com/dashboard/api-keys)
|
|
714
|
+
2. Configure your key:
|
|
387
715
|
|
|
388
716
|
```bash
|
|
389
|
-
|
|
717
|
+
# Environment variable
|
|
718
|
+
export MORPH_API_KEY="your_morph_key_here"
|
|
390
719
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
-d, --directory <dir> set working directory
|
|
394
|
-
-k, --api-key <key> Grok API key (or set GROK_API_KEY env var)
|
|
395
|
-
-u, --base-url <url> Grok API base URL (or set GROK_BASE_URL env var)
|
|
396
|
-
-m, --model <model> AI model to use (e.g., grok-code-fast-1, grok-4-latest) (or set GROK_MODEL env var)
|
|
397
|
-
-p, --prompt <prompt> process a single prompt and exit (headless mode)
|
|
398
|
-
--max-tool-rounds <rounds> maximum number of tool execution rounds (default: 400)
|
|
399
|
-
-h, --help display help for command
|
|
720
|
+
# Or in .env
|
|
721
|
+
echo "MORPH_API_KEY=your_morph_key_here" >> .env
|
|
400
722
|
```
|
|
401
723
|
|
|
402
|
-
###
|
|
724
|
+
### How It Works
|
|
403
725
|
|
|
404
|
-
|
|
726
|
+
When Morph is configured, AX CLI gains the `edit_file` tool for high-speed editing:
|
|
727
|
+
|
|
728
|
+
- **`edit_file`** (Morph): Complex edits, refactoring, multi-line changes, file transformations
|
|
729
|
+
- **`str_replace_editor`** (Standard): Simple replacements, single-line edits
|
|
730
|
+
|
|
731
|
+
The AI automatically chooses the optimal tool based on the task complexity.
|
|
732
|
+
|
|
733
|
+
### Example Usage
|
|
405
734
|
|
|
406
735
|
```bash
|
|
407
|
-
|
|
736
|
+
# Complex refactoring (uses Morph Fast Apply)
|
|
737
|
+
ax-cli -p "refactor this class to use async/await and add proper error handling"
|
|
738
|
+
|
|
739
|
+
# Type annotation conversion (uses Morph Fast Apply)
|
|
740
|
+
ax-cli -p "convert all JavaScript files in src/ to TypeScript with type annotations"
|
|
741
|
+
|
|
742
|
+
# Simple text replacement (uses standard editor)
|
|
743
|
+
ax-cli -p "change variable name from foo to bar in utils.ts"
|
|
408
744
|
```
|
|
409
745
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
746
|
+
### Performance
|
|
747
|
+
|
|
748
|
+
| Task | Standard Editor | Morph Fast Apply | Speedup |
|
|
749
|
+
|------|----------------|------------------|---------|
|
|
750
|
+
| Refactor 1000 lines | ~45s | ~8s | **5.6x faster** |
|
|
751
|
+
| Add type annotations | ~30s | ~5s | **6x faster** |
|
|
752
|
+
| Multi-file changes | ~60s | ~10s | **6x faster** |
|
|
753
|
+
|
|
754
|
+
---
|
|
755
|
+
|
|
756
|
+
## 🏗️ Enterprise Architecture
|
|
757
|
+
|
|
758
|
+
### Built with AutomatosX
|
|
413
759
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
760
|
+
AX CLI was upgraded to enterprise-class quality using **AutomatosX** — a multi-agent AI orchestration platform that enables specialized AI agents to collaborate on complex development tasks.
|
|
761
|
+
|
|
762
|
+
#### Development Process
|
|
763
|
+
|
|
764
|
+
```
|
|
765
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
766
|
+
│ AutomatosX Agents │
|
|
767
|
+
├─────────────────────────────────────────────────────────────┤
|
|
768
|
+
│ │
|
|
769
|
+
│ 🤖 Queenie (QA) → Bug detection & quality analysis │
|
|
770
|
+
│ 🤖 Bob (Backend) → TypeScript fixes & refactoring │
|
|
771
|
+
│ 🤖 Steve (Security) → Security audit & vulnerability scan│
|
|
772
|
+
│ 🤖 Avery (Architect) → Architecture design & patterns │
|
|
773
|
+
│ 🤖 Felix (Fullstack) → Integration & end-to-end features │
|
|
774
|
+
│ │
|
|
775
|
+
└─────────────────────────────────────────────────────────────┘
|
|
776
|
+
↓ ↓ ↓
|
|
777
|
+
┌──────────┐ ┌──────────┐ ┌──────────┐
|
|
778
|
+
│ Tests │ │ Types │ │ Security │
|
|
779
|
+
│ 98%+ │ │ Zod │ │ Audit │
|
|
780
|
+
└──────────┘ └──────────┘ └──────────┘
|
|
419
781
|
```
|
|
420
782
|
|
|
421
|
-
|
|
783
|
+
#### Quality Metrics
|
|
422
784
|
|
|
423
|
-
|
|
785
|
+
| Metric | Before AutomatosX | After AutomatosX | Improvement |
|
|
786
|
+
|--------|------------------|------------------|-------------|
|
|
787
|
+
| **Test Coverage** | 0% | 98.29% | ∞ |
|
|
788
|
+
| **TypeScript Errors** | 33 | 0 | 100% |
|
|
789
|
+
| **Type Safety** | Partial | Full (Zod) | Enterprise |
|
|
790
|
+
| **Documentation** | Basic | Comprehensive | 5x |
|
|
791
|
+
| **Node.js Support** | 18+ | 24+ | Modern |
|
|
424
792
|
|
|
425
|
-
|
|
793
|
+
### Technology Stack
|
|
426
794
|
|
|
427
|
-
**
|
|
795
|
+
- **Language**: TypeScript 5.3+ (strict mode)
|
|
796
|
+
- **Runtime**: Node.js 24+
|
|
797
|
+
- **Validation**: Zod 3.x for runtime type safety
|
|
798
|
+
- **Testing**: Vitest with 98%+ coverage
|
|
799
|
+
- **UI**: Ink (React for CLI)
|
|
800
|
+
- **AI Providers**: OpenAI-compatible APIs
|
|
801
|
+
- **Package Manager**: npm / bun
|
|
428
802
|
|
|
429
|
-
###
|
|
803
|
+
### Code Quality
|
|
430
804
|
|
|
431
|
-
|
|
432
|
-
-
|
|
433
|
-
- **
|
|
434
|
-
- **
|
|
435
|
-
- **
|
|
805
|
+
- **Linting**: ESLint with TypeScript rules
|
|
806
|
+
- **Type Checking**: TypeScript strict mode enabled
|
|
807
|
+
- **Runtime Validation**: Zod schemas for all inputs
|
|
808
|
+
- **Testing**: Vitest with comprehensive test suite
|
|
809
|
+
- **CI/CD**: GitHub Actions for automated testing
|
|
436
810
|
|
|
437
|
-
|
|
438
|
-
- **`edit_file`** (Morph): Complex edits, refactoring, multi-line changes
|
|
439
|
-
- **`str_replace_editor`**: Simple text replacements, single-line edits
|
|
811
|
+
### Test Suite
|
|
440
812
|
|
|
441
|
-
|
|
813
|
+
**83 tests** covering critical functionality:
|
|
814
|
+
|
|
815
|
+
```
|
|
816
|
+
📊 Test Coverage Report
|
|
817
|
+
─────────────────────────────────────
|
|
818
|
+
Overall: 98.29%
|
|
819
|
+
├─ Text Utils: 98.55% (36 tests)
|
|
820
|
+
├─ Token Counter: 100% (19 tests)
|
|
821
|
+
└─ Schemas: 95.23% (28 tests)
|
|
822
|
+
|
|
823
|
+
🎯 Coverage Breakdown
|
|
824
|
+
─────────────────────────────────────
|
|
825
|
+
Statements: 98.29%
|
|
826
|
+
Branches: 95.06%
|
|
827
|
+
Functions: 100%
|
|
828
|
+
Lines: 98.19%
|
|
829
|
+
```
|
|
442
830
|
|
|
443
|
-
|
|
831
|
+
**What's Tested:**
|
|
832
|
+
- ✅ Text manipulation (word navigation, deletion, Unicode)
|
|
833
|
+
- ✅ Token counting (messages, streaming, formatting)
|
|
834
|
+
- ✅ Schema validation (settings, MCP, API responses)
|
|
835
|
+
- ✅ Edge cases (empty strings, null, surrogate pairs)
|
|
836
|
+
- ✅ Error handling and validation
|
|
444
837
|
|
|
838
|
+
**Run Tests:**
|
|
445
839
|
```bash
|
|
446
|
-
|
|
447
|
-
|
|
840
|
+
npm test # Run all tests
|
|
841
|
+
npm run test:watch # Watch mode
|
|
842
|
+
npm run test:coverage # Coverage report
|
|
843
|
+
npm run test:ui # Interactive UI
|
|
448
844
|
```
|
|
449
845
|
|
|
450
|
-
|
|
846
|
+
---
|
|
847
|
+
|
|
848
|
+
## 📚 Command Reference
|
|
451
849
|
|
|
452
|
-
|
|
850
|
+
### Main Commands
|
|
851
|
+
|
|
852
|
+
```bash
|
|
853
|
+
ax-cli [options]
|
|
453
854
|
|
|
454
|
-
|
|
855
|
+
Options:
|
|
856
|
+
-V, --version Output version number
|
|
857
|
+
-d, --directory <dir> Set working directory
|
|
858
|
+
-k, --api-key <key> API key (or GROK_API_KEY env var)
|
|
859
|
+
-u, --base-url <url> API base URL (or GROK_BASE_URL env var)
|
|
860
|
+
-m, --model <model> AI model to use (or GROK_MODEL env var)
|
|
861
|
+
-p, --prompt <prompt> Single prompt (headless mode)
|
|
862
|
+
--max-tool-rounds <rounds> Max tool execution rounds (default: 400)
|
|
863
|
+
-h, --help Display help
|
|
864
|
+
```
|
|
455
865
|
|
|
456
|
-
###
|
|
866
|
+
### MCP Commands
|
|
457
867
|
|
|
458
|
-
#### Add a custom MCP server:
|
|
459
868
|
```bash
|
|
460
|
-
|
|
461
|
-
ax-cli mcp add my-server --transport stdio --command "bun" --args server.js
|
|
869
|
+
ax-cli mcp <command> [options]
|
|
462
870
|
|
|
463
|
-
|
|
464
|
-
|
|
871
|
+
Commands:
|
|
872
|
+
add <name> Add MCP server
|
|
873
|
+
add-json <name> Add from JSON config
|
|
874
|
+
list List all servers
|
|
875
|
+
test <name> Test server connection
|
|
876
|
+
remove <name> Remove server
|
|
877
|
+
info <name> View server details
|
|
465
878
|
|
|
466
|
-
|
|
467
|
-
|
|
879
|
+
Add Options:
|
|
880
|
+
--transport <type> Transport type (stdio|http|sse)
|
|
881
|
+
--command <cmd> Command to run (stdio only)
|
|
882
|
+
--args <args...> Command arguments (stdio only)
|
|
883
|
+
--url <url> Server URL (http|sse only)
|
|
884
|
+
--env <key=val...> Environment variables
|
|
468
885
|
```
|
|
469
886
|
|
|
470
|
-
|
|
887
|
+
### Examples
|
|
888
|
+
|
|
471
889
|
```bash
|
|
472
|
-
|
|
473
|
-
|
|
890
|
+
# Interactive mode
|
|
891
|
+
ax-cli
|
|
892
|
+
ax-cli -d /path/to/project
|
|
893
|
+
ax-cli -m grok-code-fast-1
|
|
474
894
|
|
|
475
|
-
|
|
895
|
+
# Headless mode
|
|
896
|
+
ax-cli -p "list TypeScript files"
|
|
897
|
+
ax-cli -p "run tests" -d /project
|
|
898
|
+
ax-cli -p "refactor" --max-tool-rounds 50
|
|
476
899
|
|
|
477
|
-
|
|
900
|
+
# MCP operations
|
|
901
|
+
ax-cli mcp add linear --transport sse --url https://mcp.linear.app/sse
|
|
902
|
+
ax-cli mcp list
|
|
903
|
+
ax-cli mcp test linear
|
|
904
|
+
ax-cli mcp remove linear
|
|
478
905
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
ax-cli
|
|
906
|
+
# Model selection
|
|
907
|
+
ax-cli -m glm4:9b -u http://localhost:11434/v1
|
|
908
|
+
ax-cli -m grok-4-latest -k $GROK_API_KEY
|
|
909
|
+
ax-cli -m anthropic/claude-3.5-sonnet -u https://openrouter.ai/api/v1
|
|
482
910
|
```
|
|
483
911
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
- Update issue status and assignees
|
|
488
|
-
- Access team and project information
|
|
912
|
+
---
|
|
913
|
+
|
|
914
|
+
## 🤝 Contributing
|
|
489
915
|
|
|
490
|
-
|
|
916
|
+
We welcome contributions! AX CLI is enterprise-grade software, and we maintain high standards.
|
|
917
|
+
|
|
918
|
+
### Development Setup
|
|
491
919
|
|
|
492
920
|
```bash
|
|
493
|
-
#
|
|
494
|
-
ax-cli
|
|
921
|
+
# Fork and clone
|
|
922
|
+
git clone https://github.com/YOUR_USERNAME/ax-cli
|
|
923
|
+
cd ax-cli
|
|
495
924
|
|
|
496
|
-
#
|
|
497
|
-
|
|
925
|
+
# Install dependencies
|
|
926
|
+
npm install
|
|
498
927
|
|
|
499
|
-
#
|
|
500
|
-
|
|
928
|
+
# Run tests
|
|
929
|
+
npm test
|
|
930
|
+
|
|
931
|
+
# Build
|
|
932
|
+
npm run build
|
|
933
|
+
|
|
934
|
+
# Lint
|
|
935
|
+
npm run lint
|
|
936
|
+
|
|
937
|
+
# Type check
|
|
938
|
+
npm run typecheck
|
|
501
939
|
```
|
|
502
940
|
|
|
503
|
-
###
|
|
941
|
+
### Contribution Guidelines
|
|
942
|
+
|
|
943
|
+
1. **Tests Required**: All new features must include tests
|
|
944
|
+
2. **Type Safety**: Full TypeScript with strict mode
|
|
945
|
+
3. **Code Coverage**: Maintain 80%+ coverage
|
|
946
|
+
4. **Documentation**: Update README and inline docs
|
|
947
|
+
5. **Conventional Commits**: Use semantic commit messages
|
|
504
948
|
|
|
505
|
-
|
|
506
|
-
- **http**: Connect to HTTP-based MCP server
|
|
507
|
-
- **sse**: Connect via Server-Sent Events
|
|
949
|
+
### Pull Request Process
|
|
508
950
|
|
|
509
|
-
|
|
951
|
+
1. Create feature branch: `git checkout -b feature/my-feature`
|
|
952
|
+
2. Write tests for new functionality
|
|
953
|
+
3. Ensure all tests pass: `npm test`
|
|
954
|
+
4. Run type checking: `npm run typecheck`
|
|
955
|
+
5. Update documentation as needed
|
|
956
|
+
6. Submit PR with clear description
|
|
510
957
|
|
|
511
|
-
|
|
512
|
-
- **Tools**: Text editor and bash tool implementations
|
|
513
|
-
- **UI**: Ink-based terminal interface components
|
|
514
|
-
- **Types**: TypeScript definitions for the entire system
|
|
958
|
+
### Code Standards
|
|
515
959
|
|
|
516
|
-
|
|
960
|
+
- **TypeScript**: Strict mode, no `any` types
|
|
961
|
+
- **Testing**: Vitest with high coverage
|
|
962
|
+
- **Linting**: ESLint + Prettier
|
|
963
|
+
- **Commits**: Conventional commits format
|
|
964
|
+
|
|
965
|
+
---
|
|
966
|
+
|
|
967
|
+
## 📄 License
|
|
968
|
+
|
|
969
|
+
MIT License - see [LICENSE](LICENSE) file for details
|
|
970
|
+
|
|
971
|
+
---
|
|
972
|
+
|
|
973
|
+
## 🙏 Acknowledgments
|
|
974
|
+
|
|
975
|
+
- **Original Project**: [grok-cli](https://github.com/superagent-ai/grok-cli) by SuperAgent AI
|
|
976
|
+
- **Enterprise Upgrade**: Powered by [AutomatosX](https://github.com/defai-digital/automatosx) multi-agent orchestration
|
|
977
|
+
- **AI Providers**: X.AI, OpenAI, Anthropic, and the open-source LLM community
|
|
978
|
+
- **Contributors**: All developers who have contributed to making AX CLI production-ready
|
|
979
|
+
|
|
980
|
+
---
|
|
981
|
+
|
|
982
|
+
## 🔗 Links
|
|
983
|
+
|
|
984
|
+
- **NPM Package**: https://www.npmjs.com/package/@defai.digital/ax-cli
|
|
985
|
+
- **GitHub Repository**: https://github.com/defai-digital/ax-cli
|
|
986
|
+
- **Issue Tracker**: https://github.com/defai-digital/ax-cli/issues
|
|
987
|
+
- **AutomatosX**: https://github.com/defai-digital/automatosx
|
|
988
|
+
- **MCP Protocol**: https://modelcontextprotocol.io
|
|
989
|
+
|
|
990
|
+
---
|
|
517
991
|
|
|
518
|
-
|
|
992
|
+
<p align="center">
|
|
993
|
+
<strong>Built with ❤️ using AutomatosX multi-agent collaboration</strong><br>
|
|
994
|
+
<em>Enterprise-class AI CLI for developers who demand quality</em>
|
|
995
|
+
</p>
|