@defai.digital/ax-cli 0.0.34

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 (181) hide show
  1. package/.automatosx/agents/aerospace-scientist.yaml +159 -0
  2. package/.automatosx/agents/architecture.yaml +244 -0
  3. package/.automatosx/agents/backend.yaml +172 -0
  4. package/.automatosx/agents/ceo.yaml +105 -0
  5. package/.automatosx/agents/creative-marketer.yaml +173 -0
  6. package/.automatosx/agents/cto.yaml +118 -0
  7. package/.automatosx/agents/data-scientist.yaml +200 -0
  8. package/.automatosx/agents/data.yaml +106 -0
  9. package/.automatosx/agents/design.yaml +115 -0
  10. package/.automatosx/agents/devops.yaml +124 -0
  11. package/.automatosx/agents/frontend.yaml +171 -0
  12. package/.automatosx/agents/fullstack.yaml +172 -0
  13. package/.automatosx/agents/mobile.yaml +185 -0
  14. package/.automatosx/agents/product.yaml +103 -0
  15. package/.automatosx/agents/quality.yaml +93 -0
  16. package/.automatosx/agents/quantum-engineer.yaml +167 -0
  17. package/.automatosx/agents/researcher.yaml +122 -0
  18. package/.automatosx/agents/security.yaml +115 -0
  19. package/.automatosx/agents/standard.yaml +214 -0
  20. package/.automatosx/agents/writer.yaml +122 -0
  21. package/.automatosx/feature-flags.json +13 -0
  22. package/.automatosx/memory/memory.db +0 -0
  23. package/.automatosx/providers/README.md +117 -0
  24. package/.automatosx/providers/grok-zai.yaml.template +61 -0
  25. package/.automatosx/providers/grok.yaml.template +71 -0
  26. package/.automatosx/status/backend-1763517593334-85037.json +9 -0
  27. package/.automatosx/status/quality-1763516867087-82043.json +9 -0
  28. package/.automatosx/status/quality-1763516976722-84817.json +9 -0
  29. package/.automatosx/status/security-1763517871950-87357.json +9 -0
  30. package/.automatosx/teams/business.yaml +56 -0
  31. package/.automatosx/teams/core.yaml +60 -0
  32. package/.automatosx/teams/design.yaml +58 -0
  33. package/.automatosx/teams/engineering.yaml +69 -0
  34. package/.automatosx/teams/research.yaml +56 -0
  35. package/.automatosx/templates/analyst.yaml +60 -0
  36. package/.automatosx/templates/assistant.yaml +48 -0
  37. package/.automatosx/templates/basic-agent.yaml +28 -0
  38. package/.automatosx/templates/code-reviewer.yaml +52 -0
  39. package/.automatosx/templates/debugger.yaml +63 -0
  40. package/.automatosx/templates/designer.yaml +69 -0
  41. package/.automatosx/templates/developer.yaml +60 -0
  42. package/.automatosx/templates/fullstack-developer.yaml +395 -0
  43. package/.automatosx/templates/qa-specialist.yaml +71 -0
  44. package/.claude/mcp/automatosx.json +244 -0
  45. package/.claude/settings.local.json +34 -0
  46. package/.grok/settings.json +37 -0
  47. package/LICENSE +26 -0
  48. package/README.md +518 -0
  49. package/automatosx/PRD/README.md +9 -0
  50. package/automatosx/tmp/README.md +10 -0
  51. package/automatosx.config.json +333 -0
  52. package/dist/agent/grok-agent.d.ts +52 -0
  53. package/dist/agent/grok-agent.js +627 -0
  54. package/dist/agent/grok-agent.js.map +1 -0
  55. package/dist/agent/index.d.ts +14 -0
  56. package/dist/agent/index.js +136 -0
  57. package/dist/agent/index.js.map +1 -0
  58. package/dist/commands/mcp.d.ts +2 -0
  59. package/dist/commands/mcp.js +239 -0
  60. package/dist/commands/mcp.js.map +1 -0
  61. package/dist/grok/client.d.ts +49 -0
  62. package/dist/grok/client.js +80 -0
  63. package/dist/grok/client.js.map +1 -0
  64. package/dist/grok/tools.d.ts +8 -0
  65. package/dist/grok/tools.js +349 -0
  66. package/dist/grok/tools.js.map +1 -0
  67. package/dist/hooks/use-enhanced-input.d.ts +37 -0
  68. package/dist/hooks/use-enhanced-input.js +214 -0
  69. package/dist/hooks/use-enhanced-input.js.map +1 -0
  70. package/dist/hooks/use-input-handler.d.ts +34 -0
  71. package/dist/hooks/use-input-handler.js +608 -0
  72. package/dist/hooks/use-input-handler.js.map +1 -0
  73. package/dist/hooks/use-input-history.d.ts +9 -0
  74. package/dist/hooks/use-input-history.js +69 -0
  75. package/dist/hooks/use-input-history.js.map +1 -0
  76. package/dist/index.d.ts +2 -0
  77. package/dist/index.js +339 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/mcp/client.d.ts +31 -0
  80. package/dist/mcp/client.js +152 -0
  81. package/dist/mcp/client.js.map +1 -0
  82. package/dist/mcp/config.d.ts +13 -0
  83. package/dist/mcp/config.js +43 -0
  84. package/dist/mcp/config.js.map +1 -0
  85. package/dist/mcp/transports.d.ts +48 -0
  86. package/dist/mcp/transports.js +217 -0
  87. package/dist/mcp/transports.js.map +1 -0
  88. package/dist/schemas/index.d.ts +102 -0
  89. package/dist/schemas/index.js +105 -0
  90. package/dist/schemas/index.js.map +1 -0
  91. package/dist/tools/bash.d.ts +10 -0
  92. package/dist/tools/bash.js +82 -0
  93. package/dist/tools/bash.js.map +1 -0
  94. package/dist/tools/confirmation-tool.d.ts +16 -0
  95. package/dist/tools/confirmation-tool.js +72 -0
  96. package/dist/tools/confirmation-tool.js.map +1 -0
  97. package/dist/tools/index.d.ts +6 -0
  98. package/dist/tools/index.js +7 -0
  99. package/dist/tools/index.js.map +1 -0
  100. package/dist/tools/morph-editor.d.ts +36 -0
  101. package/dist/tools/morph-editor.js +308 -0
  102. package/dist/tools/morph-editor.js.map +1 -0
  103. package/dist/tools/search.d.ts +68 -0
  104. package/dist/tools/search.js +300 -0
  105. package/dist/tools/search.js.map +1 -0
  106. package/dist/tools/text-editor.d.ts +16 -0
  107. package/dist/tools/text-editor.js +526 -0
  108. package/dist/tools/text-editor.js.map +1 -0
  109. package/dist/tools/todo-tool.d.ts +20 -0
  110. package/dist/tools/todo-tool.js +129 -0
  111. package/dist/tools/todo-tool.js.map +1 -0
  112. package/dist/types/index.d.ts +30 -0
  113. package/dist/types/index.js +2 -0
  114. package/dist/types/index.js.map +1 -0
  115. package/dist/ui/app.d.ts +7 -0
  116. package/dist/ui/app.js +99 -0
  117. package/dist/ui/app.js.map +1 -0
  118. package/dist/ui/components/api-key-input.d.ts +7 -0
  119. package/dist/ui/components/api-key-input.js +80 -0
  120. package/dist/ui/components/api-key-input.js.map +1 -0
  121. package/dist/ui/components/chat-history.d.ts +8 -0
  122. package/dist/ui/components/chat-history.js +157 -0
  123. package/dist/ui/components/chat-history.js.map +1 -0
  124. package/dist/ui/components/chat-input.d.ts +9 -0
  125. package/dist/ui/components/chat-input.js +67 -0
  126. package/dist/ui/components/chat-input.js.map +1 -0
  127. package/dist/ui/components/chat-interface.d.ts +8 -0
  128. package/dist/ui/components/chat-interface.js +272 -0
  129. package/dist/ui/components/chat-interface.js.map +1 -0
  130. package/dist/ui/components/command-suggestions.d.ts +17 -0
  131. package/dist/ui/components/command-suggestions.js +22 -0
  132. package/dist/ui/components/command-suggestions.js.map +1 -0
  133. package/dist/ui/components/confirmation-dialog.d.ts +11 -0
  134. package/dist/ui/components/confirmation-dialog.js +105 -0
  135. package/dist/ui/components/confirmation-dialog.js.map +1 -0
  136. package/dist/ui/components/diff-renderer.d.ts +13 -0
  137. package/dist/ui/components/diff-renderer.js +186 -0
  138. package/dist/ui/components/diff-renderer.js.map +1 -0
  139. package/dist/ui/components/loading-spinner.d.ts +8 -0
  140. package/dist/ui/components/loading-spinner.js +59 -0
  141. package/dist/ui/components/loading-spinner.js.map +1 -0
  142. package/dist/ui/components/mcp-status.d.ts +5 -0
  143. package/dist/ui/components/mcp-status.js +36 -0
  144. package/dist/ui/components/mcp-status.js.map +1 -0
  145. package/dist/ui/components/model-selection.d.ts +12 -0
  146. package/dist/ui/components/model-selection.js +17 -0
  147. package/dist/ui/components/model-selection.js.map +1 -0
  148. package/dist/ui/shared/max-sized-box.d.ts +8 -0
  149. package/dist/ui/shared/max-sized-box.js +6 -0
  150. package/dist/ui/shared/max-sized-box.js.map +1 -0
  151. package/dist/ui/utils/code-colorizer.d.ts +2 -0
  152. package/dist/ui/utils/code-colorizer.js +7 -0
  153. package/dist/ui/utils/code-colorizer.js.map +1 -0
  154. package/dist/ui/utils/colors.d.ts +14 -0
  155. package/dist/ui/utils/colors.js +15 -0
  156. package/dist/ui/utils/colors.js.map +1 -0
  157. package/dist/ui/utils/markdown-renderer.d.ts +4 -0
  158. package/dist/ui/utils/markdown-renderer.js +23 -0
  159. package/dist/ui/utils/markdown-renderer.js.map +1 -0
  160. package/dist/utils/confirmation-service.d.ts +32 -0
  161. package/dist/utils/confirmation-service.js +109 -0
  162. package/dist/utils/confirmation-service.js.map +1 -0
  163. package/dist/utils/custom-instructions.d.ts +1 -0
  164. package/dist/utils/custom-instructions.js +17 -0
  165. package/dist/utils/custom-instructions.js.map +1 -0
  166. package/dist/utils/model-config.d.ts +28 -0
  167. package/dist/utils/model-config.js +42 -0
  168. package/dist/utils/model-config.js.map +1 -0
  169. package/dist/utils/settings-manager.d.ts +94 -0
  170. package/dist/utils/settings-manager.js +240 -0
  171. package/dist/utils/settings-manager.js.map +1 -0
  172. package/dist/utils/settings.d.ts +1 -0
  173. package/dist/utils/settings.js +4 -0
  174. package/dist/utils/settings.js.map +1 -0
  175. package/dist/utils/text-utils.d.ts +80 -0
  176. package/dist/utils/text-utils.js +182 -0
  177. package/dist/utils/text-utils.js.map +1 -0
  178. package/dist/utils/token-counter.d.ts +33 -0
  179. package/dist/utils/token-counter.js +78 -0
  180. package/dist/utils/token-counter.js.map +1 -0
  181. package/package.json +70 -0
package/README.md ADDED
@@ -0,0 +1,518 @@
1
+ # AX CLI
2
+
3
+ [![npm version](https://badge.fury.io/js/%40defai.digital%2Fax-cli.svg)](https://www.npmjs.com/package/@defai.digital/ax-cli)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![GitHub stars](https://img.shields.io/github/stars/defai-digital/ax-cli?style=social)](https://github.com/defai-digital/ax-cli/stargazers)
6
+ [![GitHub forks](https://img.shields.io/github/forks/defai-digital/ax-cli?style=social)](https://github.com/defai-digital/ax-cli/network/members)
7
+ [![GitHub issues](https://img.shields.io/github/issues/defai-digital/ax-cli)](https://github.com/defai-digital/ax-cli/issues)
8
+
9
+ > **Note**: This project is a fork of [grok-cli](https://github.com/superagent-ai/grok-cli), reimagined for offline-first LLM support.
10
+
11
+ **An offline-first AI CLI tool powered by local LLM models with intelligent text editor capabilities and multi-agent orchestration.**
12
+
13
+ Primary focus: **GLM 4.6** - Run powerful AI assistance completely offline on your local machine.
14
+
15
+ ![AX CLI Logo](.github/assets/ax-cli.png)
16
+
17
+ ## Features
18
+
19
+ - **🔒 Offline-First**: Run GLM 4.6 and other LLM models locally - no internet required, complete privacy
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`
29
+
30
+ ## Installation
31
+
32
+ ### Prerequisites
33
+
34
+ **For Offline LLM (GLM 4.6):**
35
+ - Bun 1.0+ (or Node.js 18+ as fallback)
36
+ - [Ollama](https://ollama.ai) or [llama.cpp](https://github.com/ggerganov/llama.cpp) for running local models
37
+ - GLM-4-9B-Chat model (download via Ollama: `ollama pull glm4:9b`)
38
+ - Minimum 16GB RAM recommended for optimal performance
39
+ - GPU recommended but not required (CPU inference supported)
40
+
41
+ **For Cloud Providers (Optional):**
42
+ - API key from your preferred provider (OpenAI, Anthropic, X.AI, etc.)
43
+ - (Optional) Morph API key for Fast Apply editing
44
+
45
+ ### Global Installation (Recommended)
46
+ ```bash
47
+ bun add -g @defai-digital/ax-cli
48
+ ```
49
+
50
+ Or with npm (fallback):
51
+ ```bash
52
+ npm install -g @defai-digital/ax-cli
53
+ ```
54
+
55
+ ### Local Development
56
+ ```bash
57
+ git clone https://github.com/defai-digital/ax-cli
58
+ cd ax-cli
59
+ bun install
60
+ bun run build
61
+ bun link
62
+ ```
63
+
64
+ ## Setup
65
+
66
+ ### Option 1: Offline Setup with GLM 4.6 (Recommended)
67
+
68
+ **Step 1: Install Ollama**
69
+
70
+ Download and install Ollama from [ollama.ai](https://ollama.ai):
71
+
72
+ ```bash
73
+ # macOS / Linux
74
+ curl -fsSL https://ollama.ai/install.sh | sh
75
+
76
+ # Windows
77
+ # Download from https://ollama.ai/download
78
+ ```
79
+
80
+ **Step 2: Download GLM 4.6 Model**
81
+
82
+ ```bash
83
+ # Pull the GLM-4-9B-Chat model (9B parameters, ~5GB download)
84
+ ollama pull glm4:9b
85
+
86
+ # Or for the vision-capable model
87
+ ollama pull glm4v:9b
88
+
89
+ # Verify the model is available
90
+ ollama list
91
+ ```
92
+
93
+ **Step 3: Start Ollama Server**
94
+
95
+ ```bash
96
+ # Ollama runs as a background service by default
97
+ # If needed, start it manually:
98
+ ollama serve
99
+ ```
100
+
101
+ **Step 4: Configure AX CLI for Local GLM**
102
+
103
+ Create `~/.ax/user-settings.json`:
104
+ ```json
105
+ {
106
+ "baseURL": "http://localhost:11434/v1",
107
+ "defaultModel": "glm4:9b",
108
+ "models": [
109
+ "glm4:9b",
110
+ "glm4v:9b"
111
+ ]
112
+ }
113
+ ```
114
+
115
+ **Step 5: Test Your Setup**
116
+
117
+ ```bash
118
+ ax-cli --prompt "Hello, please introduce yourself"
119
+ ```
120
+
121
+ You're now running completely offline! No API keys required, no internet connection needed, complete privacy.
122
+
123
+ ---
124
+
125
+ ### Option 2: Cloud Provider Setup
126
+
127
+ 1. Get your API key from your preferred provider:
128
+ - [X.AI (Grok)](https://x.ai)
129
+ - [OpenAI](https://platform.openai.com)
130
+ - [Anthropic (Claude)](https://console.anthropic.com)
131
+
132
+ 2. Set up your API key (choose one method):
133
+
134
+ **Method 1: Environment Variable**
135
+ ```bash
136
+ export GROK_API_KEY=your_api_key_here
137
+ ```
138
+
139
+ **Method 2: .env File**
140
+ ```bash
141
+ cp .env.example .env
142
+ # Edit .env and add your API key
143
+ ```
144
+
145
+ **Method 3: Command Line Flag**
146
+ ```bash
147
+ ax-cli --api-key your_api_key_here
148
+ ```
149
+
150
+ **Method 4: User Settings File**
151
+ Create `~/.ax/user-settings.json`:
152
+ ```json
153
+ {
154
+ "apiKey": "your_api_key_here"
155
+ }
156
+ ```
157
+
158
+ 3. (Optional, Recommended) Get your Morph API key from [Morph Dashboard](https://morphllm.com/dashboard/api-keys)
159
+
160
+ 4. Set up your Morph API key for Fast Apply editing (choose one method):
161
+
162
+ **Method 1: Environment Variable**
163
+ ```bash
164
+ export MORPH_API_KEY=your_morph_api_key_here
165
+ ```
166
+
167
+ **Method 2: .env File**
168
+ ```bash
169
+ # Add to your .env file
170
+ MORPH_API_KEY=your_morph_api_key_here
171
+ ```
172
+
173
+ ### Custom Base URL (Optional)
174
+
175
+ By default, the CLI uses `https://api.x.ai/v1` as the Grok API endpoint. You can configure a custom endpoint if needed (choose one method):
176
+
177
+ **Method 1: Environment Variable**
178
+ ```bash
179
+ export GROK_BASE_URL=https://your-custom-endpoint.com/v1
180
+ ```
181
+
182
+ **Method 2: Command Line Flag**
183
+ ```bash
184
+ ax-cli --api-key your_api_key_here --base-url https://your-custom-endpoint.com/v1
185
+ ```
186
+
187
+ **Method 3: User Settings File**
188
+ Add to `~/.ax/user-settings.json`:
189
+ ```json
190
+ {
191
+ "apiKey": "your_api_key_here",
192
+ "baseURL": "https://your-custom-endpoint.com/v1"
193
+ }
194
+ ```
195
+
196
+ ## Configuration Files
197
+
198
+ AX CLI uses two types of configuration files to manage settings:
199
+
200
+ ### User-Level Settings (`~/.ax/user-settings.json`)
201
+
202
+ This file stores **global settings** that apply across all projects. These settings rarely change and include:
203
+
204
+ - **Base URL**: API endpoint (local Ollama or cloud provider)
205
+ - **API Key**: Only needed for cloud providers
206
+ - **Default Model**: Your preferred model
207
+ - **Available Models**: List of models you can use
208
+
209
+ **Example (Offline with GLM 4.6):**
210
+ ```json
211
+ {
212
+ "baseURL": "http://localhost:11434/v1",
213
+ "defaultModel": "glm4:9b",
214
+ "models": [
215
+ "glm4:9b",
216
+ "glm4v:9b",
217
+ "llama3.1:8b",
218
+ "qwen2.5:7b"
219
+ ]
220
+ }
221
+ ```
222
+
223
+ **Example (Cloud Provider - Grok):**
224
+ ```json
225
+ {
226
+ "apiKey": "your_api_key_here",
227
+ "baseURL": "https://api.x.ai/v1",
228
+ "defaultModel": "grok-code-fast-1",
229
+ "models": [
230
+ "grok-code-fast-1",
231
+ "grok-4-latest",
232
+ "grok-3-latest"
233
+ ]
234
+ }
235
+ ```
236
+
237
+ ### Project-Level Settings (`.ax/settings.json`)
238
+
239
+ This file stores **project-specific settings** in your current working directory. It includes:
240
+
241
+ - **Current Model**: The model currently in use for this project
242
+ - **MCP Servers**: Model Context Protocol server configurations
243
+
244
+ **Example (Offline GLM):**
245
+ ```json
246
+ {
247
+ "model": "glm4:9b",
248
+ "mcpServers": {
249
+ "linear": {
250
+ "name": "linear",
251
+ "transport": "stdio",
252
+ "command": "npx",
253
+ "args": ["@linear/mcp-server"]
254
+ }
255
+ }
256
+ }
257
+ ```
258
+
259
+ **Example (Cloud Provider):**
260
+ ```json
261
+ {
262
+ "model": "grok-3-fast",
263
+ "mcpServers": {}
264
+ }
265
+ ```
266
+
267
+ ### How It Works
268
+
269
+ 1. **Global Defaults**: User-level settings provide your default preferences
270
+ 2. **Project Override**: Project-level settings override defaults for specific projects
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`)
273
+
274
+ This means you can have different models for different projects while maintaining consistent global settings like your API key.
275
+
276
+ ### Using Other API Providers
277
+
278
+ **Important**: AX CLI uses **OpenAI-compatible APIs**. You can use any provider that implements the OpenAI chat completions standard.
279
+
280
+ **Popular Providers**:
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`
285
+
286
+ **Example with OpenRouter**:
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
+ ```
299
+
300
+ ## Usage
301
+
302
+ ### Interactive Mode
303
+
304
+ Start the conversational AI assistant:
305
+ ```bash
306
+ ax-cli
307
+ ```
308
+
309
+ Or specify a working directory:
310
+ ```bash
311
+ ax-cli -d /path/to/project
312
+ ```
313
+
314
+ ### Headless Mode
315
+
316
+ Process a single prompt and exit (useful for scripting and automation):
317
+ ```bash
318
+ ax-cli --prompt "show me the package.json file"
319
+ ax-cli -p "create a new file called example.js with a hello world function"
320
+ ax-cli --prompt "run bun test and show me the results" --directory /path/to/project
321
+ ax-cli --prompt "complex task" --max-tool-rounds 50 # Limit tool usage for faster execution
322
+ ```
323
+
324
+ This mode is particularly useful for:
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
329
+
330
+ ### Tool Execution Control
331
+
332
+ By default, AX CLI allows up to 400 tool execution rounds to handle complex multi-step tasks. You can control this behavior:
333
+
334
+ ```bash
335
+ # Limit tool rounds for faster execution on simple tasks
336
+ ax-cli --max-tool-rounds 10 --prompt "show me the current directory"
337
+
338
+ # Increase limit for very complex tasks (use with caution)
339
+ ax-cli --max-tool-rounds 1000 --prompt "comprehensive code refactoring"
340
+
341
+ # Works with all modes
342
+ ax-cli --max-tool-rounds 20 # Interactive mode
343
+ ax-cli git commit-and-push --max-tool-rounds 30 # Git commands
344
+ ```
345
+
346
+ **Use Cases**:
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
350
+
351
+ ### Model Selection
352
+
353
+ You can specify which AI model to use with the `--model` parameter or `GROK_MODEL` environment variable:
354
+
355
+ **Method 1: Command Line Flag**
356
+ ```bash
357
+ # GLM 4.6
358
+ ax-cli --model glm-4.6 --base-url https://api.z.ai/api/coding/paas/v4
359
+
360
+ # Use Grok models
361
+ ax-cli --model grok-code-fast-1
362
+ ax-cli --model grok-4-latest
363
+
364
+ # Use other models (with appropriate API endpoint)
365
+ ax-cli --model gemini-3.0-pro --base-url https://api-endpoint.com/v1
366
+ ax-cli --model claude-sonnet-4-20250514 --base-url https://api-endpoint.com/v1
367
+ ```
368
+
369
+ **Method 2: Environment Variable**
370
+ ```bash
371
+ export GROK_MODEL=grok-code-fast-1
372
+ ax-cli
373
+ ```
374
+
375
+ **Method 3: User Settings File**
376
+ Add to `~/.ax/user-settings.json`:
377
+ ```json
378
+ {
379
+ "apiKey": "your_api_key_here",
380
+ "defaultModel": "grok-code-fast-1"
381
+ }
382
+ ```
383
+
384
+ **Model Priority**: `--model` flag > `GROK_MODEL` environment variable > user default model > system default (grok-code-fast-1)
385
+
386
+ ### Command Line Options
387
+
388
+ ```bash
389
+ ax-cli [options]
390
+
391
+ Options:
392
+ -V, --version output the version number
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
400
+ ```
401
+
402
+ ### Custom Instructions
403
+
404
+ You can provide custom instructions to tailor AX's behavior to your project by creating a `.ax/AX.md` file in your project directory:
405
+
406
+ ```bash
407
+ mkdir .ax
408
+ ```
409
+
410
+ Create `.ax/AX.md` with your custom instructions:
411
+ ```markdown
412
+ # Custom Instructions for AX CLI
413
+
414
+ Always use TypeScript for any new code files.
415
+ When creating React components, use functional components with hooks.
416
+ Prefer const assertions and explicit typing over inference where it improves clarity.
417
+ Always add JSDoc comments for public functions and interfaces.
418
+ Follow the existing code style and patterns in this project.
419
+ ```
420
+
421
+ AX will automatically load and follow these instructions when working in your project directory. The custom instructions are added to AX's system prompt and take priority over default behavior.
422
+
423
+ ## Morph Fast Apply (Optional)
424
+
425
+ AX CLI supports Morph's Fast Apply model for high-speed code editing at **4,500+ tokens/sec with 98% accuracy**. This is an optional feature that provides lightning-fast file editing capabilities.
426
+
427
+ **Setup**: Configure your Morph API key following the [setup instructions](#setup) above.
428
+
429
+ ### How It Works
430
+
431
+ When `MORPH_API_KEY` is configured:
432
+ - **`edit_file` tool becomes available** alongside the standard `str_replace_editor`
433
+ - **Optimized for complex edits**: Use for multi-line changes, refactoring, and large modifications
434
+ - **Intelligent editing**: Uses abbreviated edit format with `// ... existing code ...` comments
435
+ - **Fallback support**: Standard tools remain available if Morph is unavailable
436
+
437
+ **When to use each tool:**
438
+ - **`edit_file`** (Morph): Complex edits, refactoring, multi-line changes
439
+ - **`str_replace_editor`**: Simple text replacements, single-line edits
440
+
441
+ ### Example Usage
442
+
443
+ With Morph Fast Apply configured, you can request complex code changes:
444
+
445
+ ```bash
446
+ ax-cli --prompt "refactor this function to use async/await and add error handling"
447
+ ax-cli -p "convert this class to TypeScript and add proper type annotations"
448
+ ```
449
+
450
+ The AI will automatically choose between `edit_file` (Morph) for complex changes or `str_replace_editor` for simple replacements.
451
+
452
+ ## MCP Tools
453
+
454
+ AX CLI supports MCP (Model Context Protocol) servers, allowing you to extend the AI assistant with additional tools and capabilities.
455
+
456
+ ### Adding MCP Tools
457
+
458
+ #### Add a custom MCP server:
459
+ ```bash
460
+ # Add an stdio-based MCP server
461
+ ax-cli mcp add my-server --transport stdio --command "bun" --args server.js
462
+
463
+ # Add an HTTP-based MCP server
464
+ ax-cli mcp add my-server --transport http --url "http://localhost:3000"
465
+
466
+ # Add with environment variables
467
+ ax-cli mcp add my-server --transport stdio --command "python" --args "-m" "my_mcp_server" --env "API_KEY=your_key"
468
+ ```
469
+
470
+ #### Add from JSON configuration:
471
+ ```bash
472
+ ax-cli mcp add-json my-server '{"command": "bun", "args": ["server.js"], "env": {"API_KEY": "your_key"}}'
473
+ ```
474
+
475
+ ### Linear Integration Example
476
+
477
+ To add Linear MCP tools for project management:
478
+
479
+ ```bash
480
+ # Add Linear MCP server
481
+ ax-cli mcp add linear --transport sse --url "https://mcp.linear.app/sse"
482
+ ```
483
+
484
+ This enables Linear tools like:
485
+ - Create and manage Linear issues
486
+ - Search and filter issues
487
+ - Update issue status and assignees
488
+ - Access team and project information
489
+
490
+ ### Managing MCP Servers
491
+
492
+ ```bash
493
+ # List all configured servers
494
+ ax-cli mcp list
495
+
496
+ # Test server connection
497
+ ax-cli mcp test server-name
498
+
499
+ # Remove a server
500
+ ax-cli mcp remove server-name
501
+ ```
502
+
503
+ ### Available Transport Types
504
+
505
+ - **stdio**: Run MCP server as a subprocess (most common)
506
+ - **http**: Connect to HTTP-based MCP server
507
+ - **sse**: Connect via Server-Sent Events
508
+
509
+ ## Architecture
510
+
511
+ - **Agent**: Core command processing and execution logic
512
+ - **Tools**: Text editor and bash tool implementations
513
+ - **UI**: Ink-based terminal interface components
514
+ - **Types**: TypeScript definitions for the entire system
515
+
516
+ ## License
517
+
518
+ MIT
@@ -0,0 +1,9 @@
1
+ # Product Requirements Documents
2
+
3
+ This directory contains:
4
+ - Architecture designs
5
+ - Feature specifications
6
+ - Technical requirements
7
+ - Planning documents
8
+
9
+ Created by AutomatosX for organized project documentation.
@@ -0,0 +1,10 @@
1
+ # Temporary Files
2
+
3
+ This directory contains:
4
+ - Draft code
5
+ - Test outputs
6
+ - Temporary analysis
7
+ - Intermediate work
8
+
9
+ Files here may be auto-cleaned periodically.
10
+ Created by AutomatosX for organized scratch work.