@xagent/one-shot 1.1.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1152 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +22089 -0
- package/dist/index.js.map +1 -0
- package/package.json +136 -0
package/README.md
ADDED
|
@@ -0,0 +1,1152 @@
|
|
|
1
|
+
<!-- Test comment for PR creation -->
|
|
2
|
+
|
|
3
|
+
## 1.1.87 – Logo Assets & NPM Publication Complete
|
|
4
|
+
|
|
5
|
+
✅ **Live on NPM**: [@xagent/one-shot](https://www.npmjs.com/package/@xagent/one-shot) - Fully published and ready for global installation
|
|
6
|
+
|
|
7
|
+
This release includes corrected logo assets and complete automated publishing pipeline.
|
|
8
|
+
|
|
9
|
+
- ✅ **Corrected Logo Design**: Updated all assets to use proper black X logo
|
|
10
|
+
- ✅ **NPM Package Live**: Full publication to npm registry with automated version management
|
|
11
|
+
- ✅ **Logo Assets Included**: All variants (standard, small, large, favicon, social preview) in distribution
|
|
12
|
+
- ✅ **Automated Publishing**: GitHub Actions pipeline fully operational with quality gates
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# X CLI
|
|
17
|
+
|
|
18
|
+
[](https://www.npmjs.com/package/@xagent/one-shot)
|
|
19
|
+
[](https://github.com/x-cli-team/x-cli/releases)
|
|
20
|
+
[](https://www.npmjs.com/package/@xagent/one-shot)
|
|
21
|
+
[](https://github.com/x-cli-team/x-cli/blob/main/LICENSE)
|
|
22
|
+
[](https://discord.com/channels/1315720379607679066/1315822328139223064)
|
|
23
|
+
|
|
24
|
+
A conversational AI CLI tool powered by x.ai with **Claude Code-level intelligence** and advanced tool capabilities.
|
|
25
|
+
|
|
26
|
+
<div align="center">
|
|
27
|
+
<img src="docs/assets/logos/x-cli-logo-large.svg" alt="X CLI Logo" width="120" />
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## 🔗 Quick Links
|
|
31
|
+
|
|
32
|
+
- **📦 [NPM Package](https://www.npmjs.com/package/@xagent/one-shot)** - Install globally with `npm install -g @xagent/one-shot`
|
|
33
|
+
- **🐙 [GitHub Repository](https://github.com/x-cli-team/x-cli)** - Source code, issues, and contributions
|
|
34
|
+
- **🎯 [Competitive Parity Analysis](./.agent/parity/)** - Strategic analysis vs Claude Code, Cursor IDE, and OpenAI Codex
|
|
35
|
+
- **💬 [xAI Community Discord](https://discord.com/channels/1315720379607679066/1315822328139223064)** - Official xAI API community support
|
|
36
|
+
- **📚 [Releases](https://github.com/x-cli-team/x-cli/releases)** - Version history and changelogs
|
|
37
|
+
|
|
38
|
+
## 🆕 What's New in v1.0+
|
|
39
|
+
|
|
40
|
+
### 🎯 **P0: Plan Mode - Claude Code Parity** (Latest)
|
|
41
|
+
|
|
42
|
+
- **🎯 Shift+Tab Twice Activation**: Exact Claude Code Plan Mode with read-only exploration
|
|
43
|
+
- **🔍 Comprehensive Codebase Analysis**: Project structure, dependencies, complexity metrics, and architecture patterns
|
|
44
|
+
- **🧠 AI-Powered Implementation Planning**: Strategic plan generation using x.ai models with risk assessment
|
|
45
|
+
- **🛡️ Read-Only Tool Execution**: Safe exploration with destructive operation blocking and simulation
|
|
46
|
+
- **📊 Progress Visualization**: Real-time exploration and planning progress with phase-specific guidance
|
|
47
|
+
- **📋 User Approval Workflow**: Complete plan review and confirmation before execution
|
|
48
|
+
- **⚡ Performance Optimized**: Fast exploration (1-15 seconds) with intelligent caching and filtering
|
|
49
|
+
|
|
50
|
+
### 🚀 **P5: Research → Recommend → Execute → Auto-Doc Workflow** (Latest)
|
|
51
|
+
|
|
52
|
+
- **🤖 Research Phase**: Intelligent context loading from `.agent/` docs with Issues/Options analysis
|
|
53
|
+
- **💡 Recommend Phase**: Structured decision framework with trade-offs, effort/risk analysis, and confidence scoring
|
|
54
|
+
- **⚡ Execute Phase**: Sequential TODO execution with adaptive recovery, real-time diffs, and safety guarantees
|
|
55
|
+
- **📝 Auto-Doc Phase**: Automatic completion documentation with lesson learning and SOP candidate detection
|
|
56
|
+
- **🛡️ Safety First**: All changes have patches, backups, and git commits; adaptive error recovery
|
|
57
|
+
- **🔄 Resilient**: Handles execution failures gracefully with re-planning capabilities
|
|
58
|
+
- **📚 Knowledge Base**: Builds institutional memory through automatic documentation accumulation
|
|
59
|
+
|
|
60
|
+
### 🎨 **P4: UX Refinement - Claude Code Feel**
|
|
61
|
+
|
|
62
|
+
- **🎭 Enhanced Welcome Banner**: Professional ASCII art with context-aware status display
|
|
63
|
+
- **🌈 Unified Color System**: Consistent Claude Code-inspired visual hierarchy across all interfaces
|
|
64
|
+
- **🔄 Contextual Spinners**: 8 operation-specific animated indicators (🧠 thinking, 🔍 search, 📂 indexing, 📝 write, etc.)
|
|
65
|
+
- **📊 Progress Indicators**: Advanced progress bars with ETA calculations and breathing pulse effects
|
|
66
|
+
- **🎛️ Background Activity**: Non-intrusive workspace awareness with file change monitoring
|
|
67
|
+
- **🎯 UI State Management**: Centralized coordination for all visual feedback and notifications
|
|
68
|
+
- **⚡ Motion Design**: 120ms smooth animations with 1.5s breathing rhythm for calm, responsive feel
|
|
69
|
+
- **🧠 Context Tooltip**: Press `Ctrl+I` for instant workspace insights (project name, git branch, file count, session state)
|
|
70
|
+
- **📈 Dynamic Status**: Real-time memory pressure, background activity, and workspace intelligence
|
|
71
|
+
- **🎨 Context Awareness Surface**: Professional bordered layouts with organized information sections
|
|
72
|
+
|
|
73
|
+
### 🧠 **P3: Code Intelligence Tools**
|
|
74
|
+
|
|
75
|
+
- **🔍 AST Parser**: Language-specific syntax tree analysis for TypeScript, JavaScript, Python
|
|
76
|
+
- **🔎 Symbol Search**: Fuzzy search across codebases with cross-references and usage analysis
|
|
77
|
+
- **📊 Dependency Analyzer**: Circular dependency detection and dependency graph generation
|
|
78
|
+
- **🎯 Code Context**: Semantic analysis with quality metrics and design pattern detection
|
|
79
|
+
- **🔧 Refactoring Assistant**: Safe rename, extract, inline operations with preview and rollback
|
|
80
|
+
|
|
81
|
+
### 🚀 **P2: Enhanced File Operations**
|
|
82
|
+
|
|
83
|
+
- **⚡ Multi-File Editor**: Atomic operations with transaction support and rollback
|
|
84
|
+
- **🔍 Advanced Search Tool**: Regex patterns with bulk replace and context-aware results
|
|
85
|
+
- **🌳 File Tree Operations**: Visual trees, bulk operations, and intelligent file organization
|
|
86
|
+
- **🧠 Code-Aware Editor**: Syntax-aware editing with smart refactoring capabilities
|
|
87
|
+
- **📚 Operation History**: Comprehensive undo/redo system with persistent history
|
|
88
|
+
|
|
89
|
+
**🎯 Result**: **Claude Code-level capabilities** with **Claude Code feel** in your terminal!
|
|
90
|
+
|
|
91
|
+
### 🛠️ **P1: Reliability & Workflow Enhancements**
|
|
92
|
+
|
|
93
|
+
- **🤖 .agent System**: AI-powered task management and documentation system for efficient workflows
|
|
94
|
+
- **🔧 Healer Script**: Automated issue detection and resolution for tool reliability
|
|
95
|
+
- **⚡ FsPort Abstraction**: Improved file system operations with Node built-ins externalization
|
|
96
|
+
- **📦 Automated Installer**: Enhanced installation UX with one-click setup options
|
|
97
|
+
- **🛡️ Tool Reliability Fixes**: Standardized imports, syntax error resolution, and fallback mechanisms
|
|
98
|
+
- **📋 Paste Text Summary**: Claude Code-style paste detection with smart summarization (`[Pasted text #1 +12 lines]`)
|
|
99
|
+
|
|
100
|
+
## ✨ Features
|
|
101
|
+
|
|
102
|
+
### 🎯 **Plan Mode - Claude Code's Signature Feature**
|
|
103
|
+
|
|
104
|
+
- **🎯 Shift+Tab Twice**: Activate read-only exploration mode (exact Claude Code parity)
|
|
105
|
+
- **🔍 Codebase Analysis**: Comprehensive project structure, dependencies, and complexity analysis
|
|
106
|
+
- **🧠 AI-Powered Planning**: Strategic implementation plans generated by x.ai models
|
|
107
|
+
- **🛡️ Read-Only Safety**: Zero file modifications during exploration with tool simulation
|
|
108
|
+
- **📊 Progress Tracking**: Real-time exploration progress with phase-specific guidance
|
|
109
|
+
- **📋 Plan Approval**: Review and approve implementation plans before execution
|
|
110
|
+
|
|
111
|
+
### 🧠 **Claude Code-Level Intelligence**
|
|
112
|
+
|
|
113
|
+
- **🔍 AST Code Analysis**: Parse TypeScript, JavaScript, Python files to extract symbols, imports, and structure
|
|
114
|
+
- **🔎 Symbol Search**: Fuzzy search for functions, classes, variables across entire codebases
|
|
115
|
+
- **📊 Dependency Analysis**: Detect circular dependencies and generate dependency graphs
|
|
116
|
+
- **🎯 Code Context**: Intelligent relationship mapping with semantic analysis and quality metrics
|
|
117
|
+
- **🔧 Safe Refactoring**: Rename, extract, inline operations with preview and rollback support
|
|
118
|
+
|
|
119
|
+
### 🚀 **Advanced File Operations**
|
|
120
|
+
|
|
121
|
+
- **⚡ MultiEdit**: Atomic operations across multiple files with transaction support
|
|
122
|
+
- **🔍 Grep/Glob**: Advanced search with regex patterns and file discovery
|
|
123
|
+
- **🌐 WebFetch/WebSearch**: Real-time web content retrieval and search capabilities
|
|
124
|
+
- **📚 Task/TodoWrite**: Specialized agent delegation and comprehensive task management
|
|
125
|
+
- **🚀 Read/Write/Edit**: Claude Code-standard file operations at high speed
|
|
126
|
+
|
|
127
|
+
🌐 **Visit [xcli.org](https://xcli.org)** for complete documentation and guides.
|
|
128
|
+
|
|
129
|
+
### 🤖 **Core AI Capabilities**
|
|
130
|
+
|
|
131
|
+
- **💬 Conversational Interface**: Natural language powered by x.ai models
|
|
132
|
+
- **🔧 Intelligent Tool Selection**: AI automatically chooses the right tools for your requests
|
|
133
|
+
- **⚡ Bash Integration**: Execute shell commands through natural conversation
|
|
134
|
+
- **🔌 MCP Extension**: Extend capabilities with Model Context Protocol servers (Linear, GitHub, etc.)
|
|
135
|
+
- **💻 Beautiful Terminal UI**: Interactive interface with Claude Code-style animations and feedback
|
|
136
|
+
- **📋 Smart Paste Detection**: Large pasted content automatically summarizes as `[Pasted text #1 +12 lines]` for clean chat history
|
|
137
|
+
|
|
138
|
+
### 🎛️ **Interactive Chat Interface**
|
|
139
|
+
|
|
140
|
+
- **Three Interaction Modes**: Chat (immediate), Balanced (smart detection), REPL (full interactive)
|
|
141
|
+
- **Balanced Mode Default**: Automatically chooses workflow based on task complexity
|
|
142
|
+
- **Research Phase**: Agent explains investigation approach with progress indicators
|
|
143
|
+
- **Options Presentation**: Clear recommendations with pros/cons for complex tasks
|
|
144
|
+
- **Confirmation Workflow**: Keyboard shortcuts (y/n/modify/cancel) for efficient decisions
|
|
145
|
+
- **State Persistence**: Settings saved to `~/.xcli/config.json` across sessions
|
|
146
|
+
|
|
147
|
+
### 🎨 **Enhanced User Experience**
|
|
148
|
+
|
|
149
|
+
- **🎭 Professional Welcome Banner**: ASCII art with dynamic context status (`Context: Dynamic │ Files: indexed │ Session: Restored`)
|
|
150
|
+
- **🔄 Contextual Visual Feedback**: 8 operation-specific spinners with smooth 120ms animations
|
|
151
|
+
- **📊 Progress Transparency**: Real-time progress bars with ETA calculations for long operations
|
|
152
|
+
- **🎛️ Background Awareness**: Subtle workspace indexing and file watching indicators
|
|
153
|
+
- **🌈 Consistent Color Language**: Claude Code-inspired visual hierarchy (info=blue, success=green, warn=orange, error=red)
|
|
154
|
+
- **⚡ Motion Design**: Breathing pulse effects and smooth transitions for calm, responsive interface
|
|
155
|
+
|
|
156
|
+
### 📚 **Documentation System**
|
|
157
|
+
|
|
158
|
+
- **🏗️ Agent Documentation**: Complete `.agent/` system for AI context optimization
|
|
159
|
+
- **📖 Interactive Commands**: `/docs` menu, `/readme` generation, `/api-docs`, `/changelog`
|
|
160
|
+
- **🔄 Smart Updates**: `/update-agent-docs` with configurable auto-triggers
|
|
161
|
+
- **🤖 Subagent Framework**: Token-optimized processing with specialized agents
|
|
162
|
+
- **🛡️ Self-Healing**: `/heal` command captures incidents and generates guardrails
|
|
163
|
+
- **📝 Code Comments**: `/comments` command for automatic code documentation
|
|
164
|
+
|
|
165
|
+
### 🌍 **Installation & Setup**
|
|
166
|
+
|
|
167
|
+
- **📦 Global Installation**: Install anywhere with `npm install -g @xagent/one-shot`
|
|
168
|
+
- **⚙️ Flexible Configuration**: Environment variables, user settings, or project-specific configs
|
|
169
|
+
- **🔄 CI/CD Ready**: Headless mode perfect for automation and scripting
|
|
170
|
+
|
|
171
|
+
## Installation
|
|
172
|
+
|
|
173
|
+
### Prerequisites
|
|
174
|
+
|
|
175
|
+
- Node.js 18+ (Node.js 20+ recommended)
|
|
176
|
+
|
|
177
|
+
### 🚀 Quick Start
|
|
178
|
+
|
|
179
|
+
#### 💎 **Try it now (no installation required!)**
|
|
180
|
+
|
|
181
|
+
<div align="center">
|
|
182
|
+
|
|
183
|
+
┌────────────────────────────────────┐
|
|
184
|
+
│ 🚀 One-Command Start │
|
|
185
|
+
├────────────────────────────────────┤
|
|
186
|
+
│ npx -y @xagent/one-shot@latest │
|
|
187
|
+
├────────────────────────────────────┤
|
|
188
|
+
│ Always latest version • Zero setup │
|
|
189
|
+
└────────────────────────────────────┘
|
|
190
|
+
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
**Option 1: Run without installing (Recommended)**
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
npx -y @xagent/one-shot@latest
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
_Always gets the latest version, no local installation needed_
|
|
200
|
+
|
|
201
|
+
**Option 2: Global installation**
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
npm install -g @xagent/one-shot@latest
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Option 3: Alternative package managers**
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Using Yarn
|
|
211
|
+
yarn global add @xagent/one-shot@latest
|
|
212
|
+
|
|
213
|
+
# Using pnpm
|
|
214
|
+
pnpm add -g @xagent/one-shot@latest
|
|
215
|
+
|
|
216
|
+
# Using bun
|
|
217
|
+
bun add -g @xagent/one-shot@latest
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### 🛠️ PATH Setup (If `xcli` command not found)
|
|
221
|
+
|
|
222
|
+
After installation, if you get "command not found", add npm's global bin to your PATH:
|
|
223
|
+
|
|
224
|
+
**macOS/Linux:**
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Add to ~/.zshrc (macOS) or ~/.bashrc (Linux)
|
|
228
|
+
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
|
|
229
|
+
source ~/.zshrc
|
|
230
|
+
|
|
231
|
+
# Or for bash users:
|
|
232
|
+
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
|
|
233
|
+
source ~/.bashrc
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
**Windows:**
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# PowerShell
|
|
240
|
+
$npmPath = npm config get prefix
|
|
241
|
+
$env:PATH += ";$npmPath"
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
**Verify installation:**
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
xcli --version # Should show current version
|
|
248
|
+
which xcli # Should show installation path
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### ⚡ Quick Start (One-liner)
|
|
252
|
+
|
|
253
|
+
**Try without installing:**
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
X_API_KEY=your_api_key_here npx -y @xagent/one-shot@latest --help
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Or install globally:**
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
npm install -g @xagent/one-shot@latest && \
|
|
263
|
+
echo 'export X_API_KEY=your_api_key_here' >> ~/.zshrc && \
|
|
264
|
+
source ~/.zshrc && \
|
|
265
|
+
xcli --help
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Local Development
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
git clone <repository>
|
|
272
|
+
cd xcli-cli
|
|
273
|
+
npm install
|
|
274
|
+
npm run build
|
|
275
|
+
npm link
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
## Setup
|
|
279
|
+
|
|
280
|
+
1. Get your x.ai API key from [X.AI](https://x.ai)
|
|
281
|
+
|
|
282
|
+
2. Set up your API key (choose one method):
|
|
283
|
+
|
|
284
|
+
**Method 1: Environment Variable**
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
export X_API_KEY=your_api_key_here
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Method 2: .env File**
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
cp .env.example .env
|
|
294
|
+
# Edit .env and add your API key
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Method 3: Command Line Flag**
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
xcli --api-key your_api_key_here
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Method 4: User Settings File**
|
|
304
|
+
Create `~/.xcli/user-settings.json`:
|
|
305
|
+
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"apiKey": "your_api_key_here"
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
3. (Optional, Recommended) Get your Morph API key from [Morph Dashboard](https://morphllm.com/dashboard/api-keys)
|
|
313
|
+
|
|
314
|
+
4. Set up your Morph API key for Fast Apply editing (choose one method):
|
|
315
|
+
|
|
316
|
+
**Method 1: Environment Variable**
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
export MORPH_API_KEY=your_morph_api_key_here
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
**Method 2: .env File**
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# Add to your .env file
|
|
326
|
+
MORPH_API_KEY=your_morph_api_key_here
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Custom Base URL (Optional)
|
|
330
|
+
|
|
331
|
+
By default, the CLI uses `https://api.x.ai/v1` as the x.ai API endpoint. You can configure a custom endpoint if needed (choose one method):
|
|
332
|
+
|
|
333
|
+
**Method 1: Environment Variable**
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
export GROK_BASE_URL=https://your-custom-endpoint.com/v1
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Method 2: Command Line Flag**
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
xcli --api-key your_api_key_here --base-url https://your-custom-endpoint.com/v1
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
**Method 3: User Settings File**
|
|
346
|
+
Add to `~/.xcli/user-settings.json`:
|
|
347
|
+
|
|
348
|
+
```json
|
|
349
|
+
{
|
|
350
|
+
"apiKey": "your_api_key_here",
|
|
351
|
+
"baseURL": "https://your-custom-endpoint.com/v1"
|
|
352
|
+
}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Configuration Files
|
|
356
|
+
|
|
357
|
+
X CLI uses two types of configuration files to manage settings:
|
|
358
|
+
|
|
359
|
+
### User-Level Settings (`~/.xcli/config.json`)
|
|
360
|
+
|
|
361
|
+
This file stores **global settings** that apply across all projects. These settings rarely change and include:
|
|
362
|
+
|
|
363
|
+
- **API Key**: Your x.ai API key
|
|
364
|
+
- **Base URL**: Custom API endpoint (if needed)
|
|
365
|
+
- **Default Model**: Your preferred model (e.g., `grok-4-fast-non-reasoning`)
|
|
366
|
+
- **Available Models**: List of models you can use
|
|
367
|
+
|
|
368
|
+
**Example:**
|
|
369
|
+
|
|
370
|
+
```json
|
|
371
|
+
{
|
|
372
|
+
"apiKey": "your_api_key_here",
|
|
373
|
+
"baseURL": "https://api.x.ai/v1",
|
|
374
|
+
"defaultModel": "grok-4-fast-non-reasoning",
|
|
375
|
+
"models": [
|
|
376
|
+
"grok-4-fast-non-reasoning",
|
|
377
|
+
"grok-4-latest",
|
|
378
|
+
"grok-3-latest",
|
|
379
|
+
"grok-3-fast",
|
|
380
|
+
"grok-3-mini-fast"
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Project-Level Settings (`.xcli/settings.json`)
|
|
386
|
+
|
|
387
|
+
This file stores **project-specific settings** in your current working directory. It includes:
|
|
388
|
+
|
|
389
|
+
- **Current Model**: The model currently in use for this project
|
|
390
|
+
- **MCP Servers**: Model Context Protocol server configurations
|
|
391
|
+
|
|
392
|
+
**Example:**
|
|
393
|
+
|
|
394
|
+
```json
|
|
395
|
+
{
|
|
396
|
+
"model": "grok-3-fast",
|
|
397
|
+
"mcpServers": {
|
|
398
|
+
"linear": {
|
|
399
|
+
"name": "linear",
|
|
400
|
+
"transport": "stdio",
|
|
401
|
+
"command": "npx",
|
|
402
|
+
"args": ["@linear/mcp-server"]
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### How It Works
|
|
409
|
+
|
|
410
|
+
1. **Global Defaults**: User-level settings provide your default preferences
|
|
411
|
+
2. **Project Override**: Project-level settings override defaults for specific projects
|
|
412
|
+
3. **Directory-Specific**: When you change directories, project settings are loaded automatically
|
|
413
|
+
4. **Fallback Logic**: Project model → User default model → System default (`grok-4-fast-non-reasoning`)
|
|
414
|
+
|
|
415
|
+
This means you can have different models for different projects while maintaining consistent global settings like your API key.
|
|
416
|
+
|
|
417
|
+
### Using Other API Providers
|
|
418
|
+
|
|
419
|
+
**Important**: X-CLI uses **OpenAI-compatible APIs**. You can use any provider that implements the OpenAI chat completions standard.
|
|
420
|
+
|
|
421
|
+
**Popular Providers**:
|
|
422
|
+
|
|
423
|
+
- **X.AI**: `https://api.x.ai/v1` (default)
|
|
424
|
+
- **OpenAI**: `https://api.openai.com/v1`
|
|
425
|
+
- **OpenRouter**: `https://openrouter.ai/api/v1`
|
|
426
|
+
- **Groq**: `https://api.groq.com/openai/v1`
|
|
427
|
+
|
|
428
|
+
**Example with OpenRouter**:
|
|
429
|
+
|
|
430
|
+
```json
|
|
431
|
+
{
|
|
432
|
+
"apiKey": "your_openrouter_key",
|
|
433
|
+
"baseURL": "https://openrouter.ai/api/v1",
|
|
434
|
+
"defaultModel": "anthropic/claude-3.5-sonnet",
|
|
435
|
+
"models": [
|
|
436
|
+
"anthropic/claude-3.5-sonnet",
|
|
437
|
+
"openai/gpt-4o",
|
|
438
|
+
"meta-llama/llama-3.1-70b-instruct"
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
## 📚 .agent Documentation System
|
|
444
|
+
|
|
445
|
+
### 🎯 **Best Feature of X CLI - AI Context Optimization**
|
|
446
|
+
|
|
447
|
+
The **`.agent` folder** is the most powerful feature of X CLI, enabling **self-documenting AI workflows** that automatically provide context to AI agents. This revolutionary approach ensures every AI interaction is informed by comprehensive project documentation, making conversations with x.ai models significantly more productive and accurate.
|
|
448
|
+
|
|
449
|
+
### 🏗️ **How It Works**
|
|
450
|
+
|
|
451
|
+
When you run `npx -y @xagent/one-shot@latest`, the CLI automatically detects and reads `.agent/` documentation:
|
|
452
|
+
|
|
453
|
+
1. **Auto-Discovery**: Scans for `.agent/` folder in current directory
|
|
454
|
+
2. **Configuration Loading**: Reads `.xcli/auto-read-config.json` (distributed) or `.agent/auto-read-config.json` (project override)
|
|
455
|
+
3. **Smart Loading**: Reads configured documentation files into chat context
|
|
456
|
+
4. **Context Enhancement**: Provides comprehensive project understanding to AI
|
|
457
|
+
|
|
458
|
+
### 📂 **Key Components**
|
|
459
|
+
|
|
460
|
+
#### **`sop/` - Standard Operating Procedures**
|
|
461
|
+
|
|
462
|
+
- **`git-workflow.md`** - Git workflow standards and smart push guidelines
|
|
463
|
+
- **`release-management.md`** - Automated release processes and version management
|
|
464
|
+
- **`automation-protection.md`** - Safeguards for automated NPM publishing
|
|
465
|
+
- **`npm-publishing-troubleshooting.md`** - NPM publication issue resolution
|
|
466
|
+
- **`documentation-workflow.md`** - Documentation maintenance procedures
|
|
467
|
+
|
|
468
|
+
#### **`system/` - System Architecture & State**
|
|
469
|
+
|
|
470
|
+
- **`architecture.md`** - Complete system design and technology stack
|
|
471
|
+
- **`critical-state.md`** - Current system capabilities and status
|
|
472
|
+
- **`api-schema.md`** - API integration specifications
|
|
473
|
+
- **`installation.md`** - Setup and deployment procedures
|
|
474
|
+
- **`auto-read-system.md`** - Documentation of this auto-loading feature!
|
|
475
|
+
|
|
476
|
+
### 🔄 **Auto-Read System Benefits**
|
|
477
|
+
|
|
478
|
+
#### **Immediate Context**
|
|
479
|
+
|
|
480
|
+
- **Zero Setup Required**: Just having `.agent/` folder provides instant AI context
|
|
481
|
+
- **Comprehensive Understanding**: AI gets complete project overview on startup
|
|
482
|
+
- **Standardized Knowledge**: Consistent documentation format across projects
|
|
483
|
+
|
|
484
|
+
#### **Self-Documenting Workflows**
|
|
485
|
+
|
|
486
|
+
- **Living Documentation**: Docs evolve with project development
|
|
487
|
+
- **AI-Assisted Maintenance**: AI can help update documentation
|
|
488
|
+
- **Version-Controlled**: All docs tracked in git with project history
|
|
489
|
+
|
|
490
|
+
#### **Quality Assurance**
|
|
491
|
+
|
|
492
|
+
- **Error Prevention**: SOPs guide AI to follow established patterns
|
|
493
|
+
- **Consistency Enforcement**: Standardized approaches across team
|
|
494
|
+
- **Knowledge Preservation**: Critical procedures documented and accessible
|
|
495
|
+
|
|
496
|
+
### 🪝 **Husky Commit Hook Integration**
|
|
497
|
+
|
|
498
|
+
**Best Practice**: Set up automatic documentation syncing with git hooks.
|
|
499
|
+
|
|
500
|
+
#### **Why Husky Integration?**
|
|
501
|
+
|
|
502
|
+
The `.agent` folder is intentionally **gitignored** (contains sensitive project-specific docs), but you want docs to sync to public repositories or team wikis. Husky commit hooks automate this process:
|
|
503
|
+
|
|
504
|
+
1. **Pre-commit Validation**: Ensure docs are up-to-date before commits
|
|
505
|
+
2. **Auto-Sync**: Push docs to Docusaurus, GitHub Wiki, or team documentation sites
|
|
506
|
+
3. **Quality Gates**: Prevent commits if critical docs are missing
|
|
507
|
+
|
|
508
|
+
#### **Setup Instructions**
|
|
509
|
+
|
|
510
|
+
1. **Initialize `.agent` system**:
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
xcli
|
|
514
|
+
/init-agent
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
2. **Install Husky**:
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
npm install --save-dev husky
|
|
521
|
+
npx husky install
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
3. **Add documentation sync hook**:
|
|
525
|
+
|
|
526
|
+
```bash
|
|
527
|
+
npx husky add .husky/pre-commit "npm run sync-docs"
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
4. **Configure sync script** (add to `package.json`):
|
|
531
|
+
|
|
532
|
+
```json
|
|
533
|
+
{
|
|
534
|
+
"scripts": {
|
|
535
|
+
"sync-docs": "xcli /update-agent-docs --sync-to-docusaurus"
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
#### **Benefits of Husky Integration**
|
|
541
|
+
|
|
542
|
+
- **Automatic Updates**: Docs sync on every commit
|
|
543
|
+
- **Team Consistency**: Everyone's local docs stay current
|
|
544
|
+
- **Quality Assurance**: Pre-commit checks ensure documentation completeness
|
|
545
|
+
- **Zero Manual Work**: Documentation maintenance becomes automatic
|
|
546
|
+
|
|
547
|
+
### 🎖️ **Why This is Revolutionary**
|
|
548
|
+
|
|
549
|
+
1. **Context-First AI**: Unlike other CLIs that start conversations from scratch, X CLI begins with complete project context
|
|
550
|
+
|
|
551
|
+
2. **Self-Improving System**: As you document procedures, AI gets better at following them
|
|
552
|
+
|
|
553
|
+
3. **Knowledge Preservation**: Critical procedures are documented where they're actually used
|
|
554
|
+
|
|
555
|
+
4. **Team Synchronization**: Everyone works with the same documented standards
|
|
556
|
+
|
|
557
|
+
5. **Future-Proof**: AI can help maintain and evolve documentation
|
|
558
|
+
|
|
559
|
+
### 🚀 **Getting Started**
|
|
560
|
+
|
|
561
|
+
1. **Initialize your project**:
|
|
562
|
+
|
|
563
|
+
```bash
|
|
564
|
+
xcli
|
|
565
|
+
/init-agent
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
2. **Customize documentation** in `.agent/` folder
|
|
569
|
+
|
|
570
|
+
3. **Set up Husky hooks** for automatic syncing
|
|
571
|
+
|
|
572
|
+
4. **Enjoy context-aware AI** that understands your project's standards and procedures!
|
|
573
|
+
|
|
574
|
+
**This feature transforms AI CLI interactions from generic conversations to informed, context-aware development sessions.**
|
|
575
|
+
|
|
576
|
+
---
|
|
577
|
+
|
|
578
|
+
## Usage
|
|
579
|
+
|
|
580
|
+
### Interactive Mode
|
|
581
|
+
|
|
582
|
+
Start the conversational AI assistant:
|
|
583
|
+
|
|
584
|
+
```bash
|
|
585
|
+
xcli
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
Or specify a working directory:
|
|
589
|
+
|
|
590
|
+
```bash
|
|
591
|
+
xcli -d /path/to/project
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
#### ⌨️ Keyboard Shortcuts
|
|
595
|
+
|
|
596
|
+
- **`Ctrl+I`** - Toggle context tooltip (workspace insights, git branch, project stats)
|
|
597
|
+
- **`Shift+Tab`** - Toggle auto-edit mode (hands-free file editing)
|
|
598
|
+
- **`Ctrl+C`** - Clear current input
|
|
599
|
+
- **`Esc`** - Interrupt current operation
|
|
600
|
+
- **`exit`** - Quit the application
|
|
601
|
+
|
|
602
|
+
### Headless Mode
|
|
603
|
+
|
|
604
|
+
Process a single prompt and exit (useful for scripting and automation):
|
|
605
|
+
|
|
606
|
+
```bash
|
|
607
|
+
xcli --prompt "show me the package.json file"
|
|
608
|
+
xcli -p "create a new file called example.js with a hello world function"
|
|
609
|
+
xcli --prompt "run bun test and show me the results" --directory /path/to/project
|
|
610
|
+
xcli --prompt "complex task" --max-tool-rounds 50 # Limit tool usage for faster execution
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
This mode is particularly useful for:
|
|
614
|
+
|
|
615
|
+
- **CI/CD pipelines**: Automate code analysis and file operations
|
|
616
|
+
- **Scripting**: Integrate AI assistance into shell scripts
|
|
617
|
+
- **Terminal benchmarks**: Perfect for tools like Terminal Bench that need non-interactive execution
|
|
618
|
+
- **Batch processing**: Process multiple prompts programmatically
|
|
619
|
+
|
|
620
|
+
### Tool Execution Control
|
|
621
|
+
|
|
622
|
+
By default, X-CLI allows up to 400 tool execution rounds to handle complex multi-step tasks. You can control this behavior:
|
|
623
|
+
|
|
624
|
+
```bash
|
|
625
|
+
# Limit tool rounds for faster execution on simple tasks
|
|
626
|
+
xcli --max-tool-rounds 10 --prompt "show me the current directory"
|
|
627
|
+
|
|
628
|
+
# Increase limit for very complex tasks (use with caution)
|
|
629
|
+
xcli --max-tool-rounds 1000 --prompt "comprehensive code refactoring"
|
|
630
|
+
|
|
631
|
+
# Works with all modes
|
|
632
|
+
xcli --max-tool-rounds 20 # Interactive mode
|
|
633
|
+
xcli git commit-and-push --max-tool-rounds 30 # Git commands
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
**Use Cases**:
|
|
637
|
+
|
|
638
|
+
- **Fast responses**: Lower limits (10-50) for simple queries
|
|
639
|
+
- **Complex automation**: Higher limits (500+) for comprehensive tasks
|
|
640
|
+
- **Resource control**: Prevent runaway executions in automated environments
|
|
641
|
+
|
|
642
|
+
### Model Selection
|
|
643
|
+
|
|
644
|
+
You can specify which AI model to use with the `--model` parameter or `GROK_MODEL` environment variable:
|
|
645
|
+
|
|
646
|
+
**Method 1: Command Line Flag**
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
# Use x.ai models
|
|
650
|
+
xcli --model grok-4-fast-non-reasoning
|
|
651
|
+
xcli --model grok-4-latest
|
|
652
|
+
xcli --model grok-3-latest
|
|
653
|
+
xcli --model grok-3-fast
|
|
654
|
+
|
|
655
|
+
# Use other models (with appropriate API endpoint)
|
|
656
|
+
xcli --model gemini-2.5-pro --base-url https://api-endpoint.com/v1
|
|
657
|
+
xcli --model claude-sonnet-4-20250514 --base-url https://api-endpoint.com/v1
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
**Method 2: Environment Variable**
|
|
661
|
+
|
|
662
|
+
```bash
|
|
663
|
+
export GROK_MODEL=grok-4-fast-non-reasoning
|
|
664
|
+
xcli
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
**Method 3: User Settings File**
|
|
668
|
+
Add to `~/.xcli/user-settings.json`:
|
|
669
|
+
|
|
670
|
+
```json
|
|
671
|
+
{
|
|
672
|
+
"apiKey": "your_api_key_here",
|
|
673
|
+
"defaultModel": "grok-4-fast-non-reasoning"
|
|
674
|
+
}
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
**Model Priority**: `--model` flag > `GROK_MODEL` environment variable > user default model > system default (grok-4-fast-non-reasoning)
|
|
678
|
+
|
|
679
|
+
### Command Line Options
|
|
680
|
+
|
|
681
|
+
```bash
|
|
682
|
+
xcli [options]
|
|
683
|
+
|
|
684
|
+
Options:
|
|
685
|
+
-V, --version output the version number
|
|
686
|
+
-d, --directory <dir> set working directory
|
|
687
|
+
-k, --api-key <key> x.ai API key (or set X_API_KEY env var)
|
|
688
|
+
-u, --base-url <url> x.ai API base URL (or set GROK_BASE_URL env var)
|
|
689
|
+
-m, --model <model> AI model to use (e.g., grok-4-fast-non-reasoning, grok-4-latest) (or set GROK_MODEL env var)
|
|
690
|
+
-p, --prompt <prompt> process a single prompt and exit (headless mode)
|
|
691
|
+
--max-tool-rounds <rounds> maximum number of tool execution rounds (default: 400)
|
|
692
|
+
-h, --help display help for command
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
### Custom Instructions
|
|
696
|
+
|
|
697
|
+
You can provide custom instructions to tailor Grok's behavior to your project by creating a `.grok/GROK.md` file in your project directory:
|
|
698
|
+
|
|
699
|
+
```bash
|
|
700
|
+
mkdir .grok
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
Create `.grok/GROK.md` with your custom instructions:
|
|
704
|
+
|
|
705
|
+
```markdown
|
|
706
|
+
# Custom Instructions for X CLI
|
|
707
|
+
|
|
708
|
+
Always use TypeScript for any new code files.
|
|
709
|
+
When creating React components, use functional components with hooks.
|
|
710
|
+
Prefer const assertions and explicit typing over inference where it improves clarity.
|
|
711
|
+
Always add JSDoc comments for public functions and interfaces.
|
|
712
|
+
Follow the existing code style and patterns in this project.
|
|
713
|
+
```
|
|
714
|
+
|
|
715
|
+
X CLI will automatically load and follow these instructions when working in your project directory. The custom instructions are added to the AI model's system prompt and take priority over default behavior.
|
|
716
|
+
|
|
717
|
+
## Morph Fast Apply (Optional)
|
|
718
|
+
|
|
719
|
+
X-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.
|
|
720
|
+
|
|
721
|
+
**Setup**: Configure your Morph API key following the [setup instructions](#setup) above.
|
|
722
|
+
|
|
723
|
+
### How It Works
|
|
724
|
+
|
|
725
|
+
When `MORPH_API_KEY` is configured:
|
|
726
|
+
|
|
727
|
+
- **`edit_file` tool becomes available** alongside the standard `str_replace_editor`
|
|
728
|
+
- **Optimized for complex edits**: Use for multi-line changes, refactoring, and large modifications
|
|
729
|
+
- **Intelligent editing**: Uses abbreviated edit format with `// ... existing code ...` comments
|
|
730
|
+
- **Fallback support**: Standard tools remain available if Morph is unavailable
|
|
731
|
+
|
|
732
|
+
**When to use each tool:**
|
|
733
|
+
|
|
734
|
+
- **`edit_file`** (Morph): Complex edits, refactoring, multi-line changes
|
|
735
|
+
- **`str_replace_editor`**: Simple text replacements, single-line edits
|
|
736
|
+
|
|
737
|
+
### Example Usage
|
|
738
|
+
|
|
739
|
+
With Morph Fast Apply configured, you can request complex code changes:
|
|
740
|
+
|
|
741
|
+
```bash
|
|
742
|
+
xcli --prompt "refactor this function to use async/await and add error handling"
|
|
743
|
+
xcli -p "convert this class to TypeScript and add proper type annotations"
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
The AI will automatically choose between `edit_file` (Morph) for complex changes or `str_replace_editor` for simple replacements.
|
|
747
|
+
|
|
748
|
+
## MCP Tools
|
|
749
|
+
|
|
750
|
+
X-CLI supports MCP (Model Context Protocol) servers, allowing you to extend the AI assistant with additional tools and capabilities.
|
|
751
|
+
|
|
752
|
+
### Adding MCP Tools
|
|
753
|
+
|
|
754
|
+
#### Add a custom MCP server:
|
|
755
|
+
|
|
756
|
+
```bash
|
|
757
|
+
# Add an stdio-based MCP server
|
|
758
|
+
xcli mcp add my-server --transport stdio --command "bun" --args server.js
|
|
759
|
+
|
|
760
|
+
# Add an HTTP-based MCP server
|
|
761
|
+
xcli mcp add my-server --transport http --url "http://localhost:3000"
|
|
762
|
+
|
|
763
|
+
# Add with environment variables
|
|
764
|
+
xcli mcp add my-server --transport stdio --command "python" --args "-m" "my_mcp_server" --env "API_KEY=your_key"
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
#### Add from JSON configuration:
|
|
768
|
+
|
|
769
|
+
```bash
|
|
770
|
+
xcli mcp add-json my-server '{"command": "bun", "args": ["server.js"], "env": {"API_KEY": "your_key"}}'
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
### Linear Integration Example
|
|
774
|
+
|
|
775
|
+
To add Linear MCP tools for project management:
|
|
776
|
+
|
|
777
|
+
```bash
|
|
778
|
+
# Add Linear MCP server
|
|
779
|
+
xcli mcp add linear --transport sse --url "https://mcp.linear.app/sse"
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
This enables Linear tools like:
|
|
783
|
+
|
|
784
|
+
- Create and manage Linear issues
|
|
785
|
+
- Search and filter issues
|
|
786
|
+
- Update issue status and assignees
|
|
787
|
+
- Access team and project information
|
|
788
|
+
|
|
789
|
+
### Managing MCP Servers
|
|
790
|
+
|
|
791
|
+
```bash
|
|
792
|
+
# List all configured servers
|
|
793
|
+
xcli mcp list
|
|
794
|
+
|
|
795
|
+
# Test server connection
|
|
796
|
+
xcli mcp test server-name
|
|
797
|
+
|
|
798
|
+
# Remove a server
|
|
799
|
+
xcli mcp remove server-name
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
### Available Transport Types
|
|
803
|
+
|
|
804
|
+
- **stdio**: Run MCP server as a subprocess (most common)
|
|
805
|
+
- **http**: Connect to HTTP-based MCP server
|
|
806
|
+
- **sse**: Connect via Server-Sent Events
|
|
807
|
+
|
|
808
|
+
## Development
|
|
809
|
+
|
|
810
|
+
```bash
|
|
811
|
+
# Install dependencies
|
|
812
|
+
npm install
|
|
813
|
+
|
|
814
|
+
# Development mode
|
|
815
|
+
bun run dev
|
|
816
|
+
|
|
817
|
+
# Build project
|
|
818
|
+
npm run build
|
|
819
|
+
|
|
820
|
+
# Run linter
|
|
821
|
+
bun run lint
|
|
822
|
+
|
|
823
|
+
# Type check
|
|
824
|
+
bun run typecheck
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
### Pre-commit Hooks
|
|
828
|
+
|
|
829
|
+
This project uses [Husky](https://typicode.github.com/husky/) and [lint-staged](https://github.com/okonet/lint-staged) to run automated checks before commits:
|
|
830
|
+
|
|
831
|
+
- **ESLint**: Automatically fixes linting issues and checks for errors
|
|
832
|
+
- **TypeScript**: Runs type checking to prevent compilation errors
|
|
833
|
+
- **Staged files only**: Only checks files that are staged for commit
|
|
834
|
+
|
|
835
|
+
The pre-commit hook runs `npx lint-staged`, which processes `*.{ts,tsx}` files with:
|
|
836
|
+
|
|
837
|
+
1. `eslint --fix` - Auto-fix linting issues where possible
|
|
838
|
+
2. `tsc --noEmit` - Type check without emitting files
|
|
839
|
+
|
|
840
|
+
If checks fail, the commit is blocked until issues are resolved.
|
|
841
|
+
|
|
842
|
+
## 🤖 Automated Release System
|
|
843
|
+
|
|
844
|
+
**Status**: ✅ **FULLY AUTOMATED** (as of 2025-10-17)
|
|
845
|
+
|
|
846
|
+
### How It Works
|
|
847
|
+
|
|
848
|
+
Every push to the `main` branch automatically:
|
|
849
|
+
|
|
850
|
+
1. **🔄 Bumps version** (patch increment: 1.0.X → 1.0.X+1)
|
|
851
|
+
2. **📝 Updates README** with new version number
|
|
852
|
+
3. **🏗️ Builds the project** with fresh dependencies
|
|
853
|
+
4. **📦 Publishes to NPM** at https://www.npmjs.com/package/@xagent/one-shot
|
|
854
|
+
5. **🏷️ Creates git tag** (e.g., `v1.0.87`)
|
|
855
|
+
|
|
856
|
+
**⏱️ Timeline**: ~3-5 minutes from push to NPM availability
|
|
857
|
+
|
|
858
|
+
### What You Need to Do
|
|
859
|
+
|
|
860
|
+
**⚠️ CRITICAL: Use Smart Push Script Only! ⚠️**
|
|
861
|
+
|
|
862
|
+
**🚨 FOR AI AGENTS: NEVER use direct git push to main!**
|
|
863
|
+
|
|
864
|
+
```bash
|
|
865
|
+
# ✅ CORRECT METHOD - Always use smart push:
|
|
866
|
+
git add .
|
|
867
|
+
git commit -m "your feature/fix"
|
|
868
|
+
npm run smart-push
|
|
869
|
+
# ✨ Automation handles quality checks + NPM publishing!
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
**🚫 NEVER DO THIS:**
|
|
873
|
+
|
|
874
|
+
```bash
|
|
875
|
+
git push origin main # ❌ Bypasses quality gates!
|
|
876
|
+
git push # ❌ Missing automation checks!
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
**💡 Why Smart Push Required:**
|
|
880
|
+
|
|
881
|
+
- Runs TypeScript & ESLint quality checks
|
|
882
|
+
- Monitors GitHub Actions workflow status
|
|
883
|
+
- Verifies NPM package publication
|
|
884
|
+
- Handles branch protection with automatic PRs
|
|
885
|
+
- Provides real-time feedback and error recovery
|
|
886
|
+
|
|
887
|
+
**📋 Complete Development Workflow:**
|
|
888
|
+
|
|
889
|
+
```bash
|
|
890
|
+
# 1. Create feature branch for development
|
|
891
|
+
git checkout -b feature/my-changes
|
|
892
|
+
# 2. Make changes and commits
|
|
893
|
+
git add . && git commit -m "implement feature"
|
|
894
|
+
# 3. Switch to main and merge
|
|
895
|
+
git checkout main
|
|
896
|
+
git merge feature/my-changes
|
|
897
|
+
# 4. Smart push to trigger NPM publish
|
|
898
|
+
npm run smart-push
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
### 🚨 Critical Dependencies
|
|
902
|
+
|
|
903
|
+
**⚠️ DO NOT MODIFY without understanding the full impact:**
|
|
904
|
+
|
|
905
|
+
#### GitHub Secrets (Required)
|
|
906
|
+
|
|
907
|
+
- **`PAT_TOKEN`**: Personal Access Token with repo permissions (for git operations)
|
|
908
|
+
- **`NPM_TOKEN`**: NPM Automation token from `xcli_cli` account (for publishing)
|
|
909
|
+
|
|
910
|
+
#### Package Configuration (Sacred Settings)
|
|
911
|
+
|
|
912
|
+
```json
|
|
913
|
+
{
|
|
914
|
+
"name": "@xagent/one-shot", // ⚠️ NEVER change - breaks publishing
|
|
915
|
+
"publishConfig": {
|
|
916
|
+
"access": "public" // ⚠️ Must NOT include registry override
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
#### Workflow File (`.github/workflows/release.yml`)
|
|
922
|
+
|
|
923
|
+
**⚠️ This took multiple attempts to get working - modify with extreme caution!**
|
|
924
|
+
|
|
925
|
+
### 🔧 Manual Release (Emergency Only)
|
|
926
|
+
|
|
927
|
+
If automation fails and you need to publish immediately:
|
|
928
|
+
|
|
929
|
+
```bash
|
|
930
|
+
# 1. Bump version locally
|
|
931
|
+
npm version patch # or minor/major
|
|
932
|
+
|
|
933
|
+
# 2. Test build
|
|
934
|
+
npm run build
|
|
935
|
+
npm run local # Test CLI locally
|
|
936
|
+
|
|
937
|
+
# 3. Manual publish
|
|
938
|
+
npm publish --access public
|
|
939
|
+
|
|
940
|
+
# 4. Push changes
|
|
941
|
+
git push origin main --follow-tags
|
|
942
|
+
|
|
943
|
+
# 5. Fix automation before next release!
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
### 📊 Monitoring
|
|
947
|
+
|
|
948
|
+
- **GitHub Actions**: https://github.com/x-cli-team/x-cli/actions
|
|
949
|
+
- **NPM Package**: https://www.npmjs.com/package/@xagent/one-shot
|
|
950
|
+
- **Release History**: Check git tags or NPM version history
|
|
951
|
+
|
|
952
|
+
### 🛠️ Troubleshooting
|
|
953
|
+
|
|
954
|
+
If automation fails:
|
|
955
|
+
|
|
956
|
+
1. **Check GitHub Actions logs** for specific errors
|
|
957
|
+
2. **Verify secrets** (`PAT_TOKEN`, `NPM_TOKEN`) haven't expired
|
|
958
|
+
3. **Confirm package.json** name hasn't been modified
|
|
959
|
+
4. **See documentation**: `.agent/sop/npm-publishing-troubleshooting.md`
|
|
960
|
+
|
|
961
|
+
**Common Issues**:
|
|
962
|
+
|
|
963
|
+
- **Build fails**: Usually Rollup dependency cache (auto-fixed with clean install)
|
|
964
|
+
- **Publish fails**: Check NPM token is valid and from correct account
|
|
965
|
+
- **Git push fails**: Verify PAT_TOKEN has repo permissions
|
|
966
|
+
|
|
967
|
+
### 📚 Related Documentation
|
|
968
|
+
|
|
969
|
+
- **📋 Release Management**: `.agent/sop/release-management.md`
|
|
970
|
+
- **🚨 Incident History**: `.agent/incidents/incident-npm-publish-failure.md`
|
|
971
|
+
- **🔧 Troubleshooting**: `.agent/sop/npm-publishing-troubleshooting.md`
|
|
972
|
+
|
|
973
|
+
---
|
|
974
|
+
|
|
975
|
+
## Architecture
|
|
976
|
+
|
|
977
|
+
- **Agent**: Core command processing and execution logic
|
|
978
|
+
- **Tools**: Text editor and bash tool implementations
|
|
979
|
+
- **UI**: Ink-based terminal interface components
|
|
980
|
+
- **Types**: TypeScript definitions for the entire system
|
|
981
|
+
|
|
982
|
+
## License
|
|
983
|
+
|
|
984
|
+
MIT
|
|
985
|
+
|
|
986
|
+
## Credits
|
|
987
|
+
|
|
988
|
+
This project is based on [xcli-cli](https://github.com/superagent-ai/xcli-cli) by [@pelaseyed](https://x.com/pelaseyed).
|
|
989
|
+
|
|
990
|
+
## Troubleshooting
|
|
991
|
+
|
|
992
|
+
### Installation Issues
|
|
993
|
+
|
|
994
|
+
**🚨 "Command not found: xcli"**
|
|
995
|
+
|
|
996
|
+
```bash
|
|
997
|
+
# Check if xcli is installed
|
|
998
|
+
npm list -g @xagent/one-shot
|
|
999
|
+
|
|
1000
|
+
# If installed but not in PATH, add npm global bin to PATH:
|
|
1001
|
+
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.zshrc
|
|
1002
|
+
source ~/.zshrc
|
|
1003
|
+
|
|
1004
|
+
# Verify it works
|
|
1005
|
+
xcli --version
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
**🚨 "Permission denied" during installation**
|
|
1009
|
+
|
|
1010
|
+
```bash
|
|
1011
|
+
# Option 1: Use npx (no installation needed)
|
|
1012
|
+
npx @xagent/one-shot@latest
|
|
1013
|
+
|
|
1014
|
+
# Option 2: Fix npm permissions (macOS/Linux)
|
|
1015
|
+
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
|
|
1016
|
+
|
|
1017
|
+
# Option 3: Configure npm to use different directory
|
|
1018
|
+
mkdir ~/.npm-global
|
|
1019
|
+
npm config set prefix '~/.npm-global'
|
|
1020
|
+
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
|
|
1021
|
+
source ~/.zshrc
|
|
1022
|
+
```
|
|
1023
|
+
|
|
1024
|
+
**🚨 "Cannot find module" errors**
|
|
1025
|
+
|
|
1026
|
+
```bash
|
|
1027
|
+
# Clear npm cache and reinstall
|
|
1028
|
+
npm cache clean --force
|
|
1029
|
+
npm uninstall -g @xagent/one-shot
|
|
1030
|
+
npm install -g @xagent/one-shot@latest
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
**🚨 Outdated version**
|
|
1034
|
+
|
|
1035
|
+
```bash
|
|
1036
|
+
# Check current version
|
|
1037
|
+
xcli --version
|
|
1038
|
+
npm view @xagent/one-shot version
|
|
1039
|
+
|
|
1040
|
+
# Update to latest
|
|
1041
|
+
npm update -g @xagent/one-shot@latest
|
|
1042
|
+
```
|
|
1043
|
+
|
|
1044
|
+
### Tool Execution Errors
|
|
1045
|
+
|
|
1046
|
+
If you encounter errors like `fs.readFile is not a function` or `fs.stat is not a function` when using file operations:
|
|
1047
|
+
|
|
1048
|
+
1. **This is a known issue** with the tool infrastructure
|
|
1049
|
+
2. **Automatic fallback**: The CLI will automatically fall back to bash commands for file operations
|
|
1050
|
+
3. **Warning messages**: You may see console warnings like "str_replace_editor tool failed, falling back to bash"
|
|
1051
|
+
4. **Functionality**: Despite the warnings, operations should still work via bash fallbacks
|
|
1052
|
+
|
|
1053
|
+
This issue is being tracked and the fallbacks ensure the CLI remains functional.
|
|
1054
|
+
|
|
1055
|
+
### Runtime Issues
|
|
1056
|
+
|
|
1057
|
+
**🚨 API Key errors**
|
|
1058
|
+
|
|
1059
|
+
```bash
|
|
1060
|
+
# Set your API key (replace with your actual key)
|
|
1061
|
+
export X_API_KEY=your_actual_api_key_here
|
|
1062
|
+
|
|
1063
|
+
# Or add to your shell profile permanently
|
|
1064
|
+
echo 'export X_API_KEY=your_actual_api_key_here' >> ~/.zshrc
|
|
1065
|
+
source ~/.zshrc
|
|
1066
|
+
|
|
1067
|
+
# Verify it's set
|
|
1068
|
+
echo $X_API_KEY
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1071
|
+
**🚨 Network/connectivity issues**
|
|
1072
|
+
|
|
1073
|
+
```bash
|
|
1074
|
+
# Test with verbose output
|
|
1075
|
+
xcli --verbose "test message"
|
|
1076
|
+
|
|
1077
|
+
# Check API endpoint connectivity
|
|
1078
|
+
curl -I https://api.x.ai/v1/models
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
### Common Issues
|
|
1082
|
+
|
|
1083
|
+
- **File operations fail**: Check that the file path exists and is accessible
|
|
1084
|
+
- **Bash commands fail**: Ensure you have the necessary permissions
|
|
1085
|
+
- **Tool timeouts**: Complex operations may take time; the spinner indicates progress
|
|
1086
|
+
- **Slow responses**: Try a different model with `xcli --model grok-4-fast-non-reasoning`
|
|
1087
|
+
|
|
1088
|
+
## 🙏 Credits
|
|
1089
|
+
|
|
1090
|
+
This project is built upon the excellent foundation of the original [X-CLI](https://github.com/superagent-ai/xcli-cli) created by [Ismail Pelaseyed](https://github.com/homanp) at [Superagent.ai](https://github.com/superagent-ai).
|
|
1091
|
+
|
|
1092
|
+
**Original Project**: [superagent-ai/xcli-cli](https://github.com/superagent-ai/xcli-cli)
|
|
1093
|
+
**Founder**: [Ismail Pelaseyed](https://github.com/homanp)
|
|
1094
|
+
**Organization**: [Superagent.ai](https://github.com/superagent-ai)
|
|
1095
|
+
|
|
1096
|
+
X CLI extends the original with advanced file operations, enhanced tool systems, and comprehensive automation while maintaining the core vision of bringing AI-powered terminal intelligence to developers.
|
|
1097
|
+
|
|
1098
|
+
**🚀 Now live on NPM**: Install globally with `npm install -g @xagent/one-shot` and start using `xcli` immediately!
|
|
1099
|
+
|
|
1100
|
+
## 👥 Contributors
|
|
1101
|
+
|
|
1102
|
+
We welcome contributions from the community! Add your details below when you contribute to the project.
|
|
1103
|
+
|
|
1104
|
+
<!--
|
|
1105
|
+
To add yourself as a contributor:
|
|
1106
|
+
1. Fork the repository
|
|
1107
|
+
2. Add your entry below following the format
|
|
1108
|
+
3. Submit a pull request
|
|
1109
|
+
-->
|
|
1110
|
+
|
|
1111
|
+
### Core Contributors
|
|
1112
|
+
|
|
1113
|
+
- **[@hinetapora](https://github.com/hinetapora)** — Fork maintainer, advanced tool systems, UX enhancements, auto-upgrade system
|
|
1114
|
+
- **[@homanp](https://github.com/homanp)** — Original X-CLI creator and foundation
|
|
1115
|
+
|
|
1116
|
+
### Community Contributors
|
|
1117
|
+
|
|
1118
|
+
<!-- Add your entry here! -->
|
|
1119
|
+
<!-- Format:
|
|
1120
|
+
- **[@yourusername](https://github.com/yourusername)** — (project link) — Brief description of your contributions
|
|
1121
|
+
-->
|
|
1122
|
+
|
|
1123
|
+
- **[@unblock-everything](https://github.com/unblock-everything)** — [x.ai](https://x.ai) — Cold-ass honkey 😎
|
|
1124
|
+
- **[@Bucko89](https://github.com/Bucko89)** — [GMA](https://getmyagencies.com) — Grinding daily
|
|
1125
|
+
- **[@base-buzz](https://github.com/base-buzz)** — [BaseBUzz](team.basebuzz.com)
|
|
1126
|
+
|
|
1127
|
+
_Want to see your name here? Check out our [Contributing Guide](CONTRIBUTING.md) and submit a pull request!_
|
|
1128
|
+
|
|
1129
|
+
### How to Contribute
|
|
1130
|
+
|
|
1131
|
+
1. **Fork** the repository on GitHub
|
|
1132
|
+
2. **Clone** your fork locally: `git clone https://github.com/yourusername/x-cli.git`
|
|
1133
|
+
3. **Create** a feature branch: `git checkout -b feature/your-feature-name`
|
|
1134
|
+
4. **Make** your changes and commit them: `git commit -m "feat: add awesome feature"`
|
|
1135
|
+
5. **Push** to your fork: `git push origin feature/your-feature-name`
|
|
1136
|
+
6. **Submit** a pull request with a clear description of your changes
|
|
1137
|
+
|
|
1138
|
+
### Types of Contributions Welcome
|
|
1139
|
+
|
|
1140
|
+
- 🐛 **Bug fixes** - Help us squash those pesky bugs
|
|
1141
|
+
- ⚡ **Performance improvements** - Make it faster and more efficient
|
|
1142
|
+
- 📖 **Documentation** - Improve our docs and examples
|
|
1143
|
+
- 🎨 **UX/UI enhancements** - Better terminal experience
|
|
1144
|
+
- 🔧 **New tools** - Add new capabilities to the tool system
|
|
1145
|
+
- 🧪 **Tests** - Help us improve our test coverage
|
|
1146
|
+
- 💡 **Feature requests** - Suggest new functionality
|
|
1147
|
+
|
|
1148
|
+
Join our growing community of AI-powered terminal enthusiasts!
|
|
1149
|
+
|
|
1150
|
+
# Test: Branch Protection Rules Test
|
|
1151
|
+
|
|
1152
|
+
# test
|