xibecode 0.2.7 โ†’ 0.3.8

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 CHANGED
@@ -1,128 +1,20 @@
1
- # XibeCode - AI Coding Assistant
2
-
3
- > **Production-ready autonomous coding agent powered by Claude AI**
4
-
5
- XibeCode is a professional CLI tool that brings autonomous AI coding capabilities to your terminal. Like Claude Code, but open-source, customizable, and with advanced context management.
6
-
7
- ## ๐Ÿ†• What's New in v0.1.8
8
-
9
- **v0.1.8:**
10
-
11
- - ๐Ÿ“š **Learn from Docs** - `/learn <name> <url>` scrapes documentation sites and auto-generates skills
12
- - ๐Ÿ•ท๏ธ **Smart Crawling** - Follows internal links, scrapes up to 25 pages, extracts clean text
13
- - ๐Ÿง  **Auto-Skill Generation** - Creates skill files in `.xibecode/skills/` from scraped docs
14
- - ๐Ÿ“Š **Progress Feedback** - Real-time progress as pages are fetched
15
-
16
- **v0.1.7:**
17
-
18
- - ๐ŸŽ“ **Skills System** - Activate specialized AI workflows with `/skill` command
19
- - ๐Ÿงน **5 Built-in Skills** - refactor-clean-code, debug-production, write-tests, security-audit, optimize-performance
20
- - ๐Ÿ“š **Custom Skills** - Create your own skills in `.xibecode/skills/` (markdown with YAML frontmatter)
21
- - ๐ŸŽฏ **Smart Skill Injection** - Active skills inject specialized instructions into AI's system prompt
22
- - ๐Ÿ“Š **Status Bar Display** - See active skill in status bar
23
-
24
- **v0.1.6:**
25
-
26
- - ๐Ÿ” **Codebase Search** - New `grep_code` tool using ripgrep (grep fallback) for lightning-fast code search across your project
27
- - ๐ŸŒ **Web Search** - New `web_search` tool powered by DuckDuckGo โ€” free, no API key required
28
- - ๐Ÿ“„ **URL Fetching** - New `fetch_url` tool to read any webpage as clean text (HTML auto-stripped)
29
- - ๐Ÿง  **Project Memory** - Persistent `.xibecode/memory.md` that saves project knowledge across sessions
30
- - ๐ŸŽฏ **Verified Edit Tool** - `verified_edit` with old content verification prevents hallucinated edits
31
- - ๐Ÿ›ก๏ธ **Safer Editing by Default** - AI uses `verified_edit` as primary editing method with smart fallbacks
32
-
33
- **Previous Updates:**
34
-
35
- - ๐Ÿงช **Test Integration** - Auto-detect & run tests (Vitest, Jest, pytest, Go test)
36
- - ๐Ÿ”€ **Git Awareness** - Create checkpoints, check status, revert changes safely
37
- - ๐Ÿ›ก๏ธ **Safety Controls** - Dry-run mode, risk assessment, command blocking
38
- - ๐Ÿ”Œ **Plugin System** - Extend XibeCode with custom tools
39
- - ๐Ÿ“ฆ **Smart Package Manager** - Prefers pnpm โ†’ bun โ†’ npm
40
- - ๐Ÿง  **Enhanced Reasoning** - Advanced problem-solving, pattern recognition, and error handling
41
- - ๐Ÿ“ก **MCP Integration** - Connect to external MCP servers for extended capabilities
42
-
43
- ## ๐ŸŽฏ Key Features
44
-
45
- ### Core Capabilities
46
-
47
- - โœ… **Autonomous Agent Loop** - AI iteratively works on tasks until completion
48
- - โœ… **Smart Context Management** - Automatically loads related files (imports, tests, configs)
49
- - โœ… **Advanced File Editing** - Search/replace, line-range edits, automatic backups
50
- - โœ… **Cross-Platform** - Works on Windows, macOS, and Linux
51
- - โœ… **Beautiful TUI** - Real-time progress, colored output, clear visualization
52
- - โœ… **Loop Detection** - Prevents infinite loops and runaway executions
53
- - โœ… **Multiple Edit Methods** - Smart edit, line-range edit, insert, revert
54
-
55
- ### ๐Ÿ†• New Features
56
-
57
- - โœ… **Web Search** - Search the web from within the AI (DuckDuckGo, free, no API key)
58
- - โœ… **Codebase Search** - Ripgrep-powered code search across your entire project
59
- - โœ… **URL Fetching** - Read any webpage as clean text for research
60
- - โœ… **Project Memory** - Persist project knowledge across sessions in `.xibecode/memory.md`
61
- - โœ… **Verified Editing** - Content-verified file edits that prevent AI mistakes
62
- - โœ… **Test Integration** - Auto-detect and run tests (Vitest, Jest, pytest, Go test)
63
- - โœ… **Git Awareness** - Check status, create checkpoints, revert changes safely
64
- - โœ… **Dry-Run Mode** - Preview changes without making them
65
- - โœ… **Safety Controls** - Risk assessment and command blocking for dangerous operations
66
- - โœ… **Plugin System** - Extend XibeCode with custom tools and workflows
67
-
68
- ### ๐ŸŽ“ Skills System
69
-
70
- XibeCode includes a **skills system** that activates specialized AI workflows for common tasks:
71
-
72
- **Built-in Skills:**
73
-
74
- - `refactor-clean-code` - Clean code principles & SOLID patterns
75
- - `debug-production` - Systematic debugging workflow
76
- - `write-tests` - Comprehensive testing with 80%+ coverage
77
- - `security-audit` - OWASP Top 10 security checks
78
- - `optimize-performance` - Performance profiling & optimization
79
-
80
- **Usage:**
81
-
82
- ```bash
83
- # In chat mode
84
- /skill list # Show all skills
85
- /skill refactor-clean-code # Activate a skill
86
- /skill off # Deactivate current skill
87
- ```
88
-
89
- When a skill is active, the AI follows specialized instructions and best practices for that domain. Create custom skills in `.xibecode/skills/` (markdown files with YAML frontmatter).
90
-
91
- ### File Operations
92
-
93
- - ๐Ÿ“– Read files (whole or partial for large files)
94
- - ๐Ÿ“ Write files (create or overwrite)
95
- - โœ๏ธ Edit files (search/replace with automatic backups)
96
- - ๐ŸŽฏ Verified edits (content verification before applying)
97
- - โœ‚๏ธ Edit specific line ranges
98
- - โ†ฉ๏ธ Revert to previous versions
99
- - ๐Ÿ” Search files with glob patterns
100
- - ๐Ÿ”Ž Grep codebase with ripgrep
101
- - ๐Ÿ“ List directories
102
- - ๐Ÿง  Get intelligent context (related files)
103
-
104
- ### Web & Research
1
+ # XibeCode
105
2
 
106
- - ๐ŸŒ Search the web (DuckDuckGo, free)
107
- - ๐Ÿ“„ Fetch and read any URL as text
108
- - ๐Ÿง  Project memory persistence
3
+ AI-powered autonomous coding assistant for your terminal.
109
4
 
110
- ### Command Execution
5
+ [![Donate](https://img.shields.io/badge/Donate-Support%20XibeCode-ff69b4?style=for-the-badge)](https://www.anishkumar.tech/donate)
111
6
 
112
- - โšก Run shell commands
113
- - ๐Ÿ”ง Cross-platform command support
114
- - ๐Ÿ“Š Capture stdout/stderr
115
- - โœ… Exit code handling
7
+ ## Overview
116
8
 
117
- ## ๐Ÿ“ฆ Installation
9
+ XibeCode is a CLI agent that can read and edit code, run commands, and iterate on tasks from your terminal using LLMs.
118
10
 
119
- ### From npm (Recommended)
11
+ ## Installation
120
12
 
121
13
  ```bash
122
14
  npm install -g xibecode
123
15
  ```
124
16
 
125
- ### From Source
17
+ From source:
126
18
 
127
19
  ```bash
128
20
  git clone https://github.com/iotserver24/xibecode
@@ -132,894 +24,109 @@ npm run build
132
24
  npm link
133
25
  ```
134
26
 
135
- ## ๐Ÿš€ Quick Start
136
-
137
- ### 1. Set up API Key
138
-
139
- ```bash
140
- # Interactive setup
141
- xibecode config
142
-
143
- # Or set directly
144
- xibecode config --set-key YOUR_ANTHROPIC_API_KEY
27
+ ## Requirements
145
28
 
146
- # Or use environment variable
147
- export ANTHROPIC_API_KEY=your_key_here
148
- ```
29
+ - Node.js 18+
30
+ - Anthropic API key (or compatible provider/base URL)
149
31
 
150
- ### 2. Run Your First Task
32
+ ## Quick Start
151
33
 
152
34
  ```bash
153
- xibecode run "Create a Python script that prints hello world"
154
- ```
155
-
156
- ### 3. Try Interactive Chat
35
+ # Configure once
36
+ xibecode config --set-key YOUR_API_KEY
157
37
 
158
- ```bash
38
+ # Interactive mode
159
39
  xibecode chat
160
- ```
161
-
162
- ## ๐Ÿ’ก Usage
163
-
164
- ### Run Command (Autonomous Mode)
165
-
166
- The main command for autonomous coding tasks:
167
-
168
- ```bash
169
- xibecode run [prompt] [options]
170
- ```
171
-
172
- **Options:**
173
-
174
- - `-f, --file <path>` - Read prompt from a file
175
- - `-m, --model <model>` - AI model to use (default: claude-sonnet-4-5-20250929)
176
- - `-b, --base-url <url>` - Custom API base URL
177
- - `-k, --api-key <key>` - API key (overrides config)
178
- - `-d, --max-iterations <number>` - Maximum iterations (default: 50)
179
- - `-v, --verbose` - Show detailed logs
180
- - `--dry-run` - Preview changes without making them
181
- - `--changed-only` - Focus only on git-changed files
182
-
183
- **Examples:**
184
-
185
- ```bash
186
- # Simple task
187
- xibecode run "Create a REST API with Express"
188
-
189
- # From file
190
- xibecode run --file task.txt
191
-
192
- # With verbose logging
193
- xibecode run "Fix the bug in app.js" --verbose
194
-
195
- # Using specific model
196
- xibecode run "Optimize this code" --model claude-opus-4-5-20251101
197
-
198
- # Custom API endpoint
199
- xibecode run "task" --base-url https://custom-api.com
200
-
201
- # New in v2.0: Dry-run mode
202
- xibecode run "Refactor authentication" --dry-run
203
-
204
- # Focus on git-changed files only
205
- xibecode run "Fix linting errors" --changed-only
206
-
207
- # Run tests after making changes
208
- xibecode run "Add validation and run tests to verify"
209
- ```
210
-
211
- ### Chat Command (Interactive Mode)
212
-
213
- For quick questions and iterative development:
214
-
215
- ```bash
216
- xibecode chat [options]
217
- ```
218
-
219
- **Options:**
220
-
221
- - `-m, --model <model>` - AI model to use
222
- - `-b, --base-url <url>` - Custom API base URL
223
- - `-k, --api-key <key>` - API key
224
-
225
- **Commands in chat:**
226
-
227
- - `tools on/off` - Toggle tool execution
228
- - `clear` - Clear screen
229
- - `exit` or `quit` - Exit chat
230
-
231
- **Example:**
232
-
233
- ```bash
234
- $ xibecode chat
235
-
236
- You: How do I implement JWT authentication?
237
- Assistant: [explains JWT auth]
238
-
239
- You: Write the code for it
240
- Assistant: [writes code using tools]
241
-
242
- You: Add it to my Express app
243
- Assistant: [modifies app.js]
244
- ```
245
-
246
- ### Config Command
247
-
248
- Manage your configuration:
249
-
250
- ```bash
251
- # Interactive setup
252
- xibecode config
253
-
254
- # Quick operations
255
- xibecode config --set-key YOUR_KEY
256
- xibecode config --set-url https://custom-api.com
257
- xibecode config --set-model claude-opus-4-5-20251101
258
- xibecode config --show
259
- xibecode config --reset
260
- ```
261
-
262
- ## ๐ŸŽจ What Makes XibeCode Different
263
-
264
- ### 1. **Smart Context Management**
265
-
266
- XibeCode automatically understands your project:
267
-
268
- ```bash
269
- xibecode run "Add error handling to userController.js"
270
- ```
271
-
272
- The AI will:
273
-
274
- - Read `userController.js`
275
- - Find and read imported files
276
- - Check for related test files
277
- - Look at config files (package.json, tsconfig.json)
278
- - Make informed edits with full context
279
-
280
- ### 2. **Advanced File Editing**
281
-
282
- Four ways to edit files, with verified_edit as the recommended default:
283
-
284
- #### Verified Edit (DEFAULT - Most Reliable) ๐ŸŽฏ
285
-
286
- ```javascript
287
- // AI reads the file first, then provides old content for verification
288
- {
289
- tool: "verified_edit",
290
- path: "app.js",
291
- start_line: 5,
292
- end_line: 5,
293
- old_content: "const port = 3000;",
294
- new_content: "const port = process.env.PORT || 3000;"
295
- }
296
- // If old_content doesn't match โ†’ edit is REJECTED and actual content is returned
297
- // AI can then re-read and retry with correct content
298
- ```
299
-
300
- #### Search/Replace (Fallback)
301
-
302
- ```javascript
303
- {
304
- tool: "edit_file",
305
- path: "app.js",
306
- search: "const port = 3000;",
307
- replace: "const port = process.env.PORT || 3000;"
308
- }
309
- ```
310
-
311
- #### Line Range (For Large Files)
312
-
313
- ```javascript
314
- {
315
- tool: "edit_lines",
316
- path: "app.js",
317
- start_line: 10,
318
- end_line: 15,
319
- new_content: "// Updated code here"
320
- }
321
- ```
322
-
323
- #### Insert (Add New Code)
324
-
325
- ```javascript
326
- {
327
- tool: "insert_at_line",
328
- path: "app.js",
329
- line: 5,
330
- content: "const express = require('express');"
331
- }
332
- ```
333
-
334
- ### 3. **Automatic Backups & Revert**
335
-
336
- Every edit creates a backup. Made a mistake?
337
-
338
- ```bash
339
- xibecode run "Revert app.js to previous version"
340
- ```
341
-
342
- ### 4. **Cross-Platform**
343
-
344
- Works identically on:
345
-
346
- - โœ… Windows (PowerShell)
347
- - โœ… macOS (bash/zsh)
348
- - โœ… Linux (bash)
349
-
350
- The AI automatically uses the right commands for your OS.
351
-
352
- ### 5. **Beautiful Real-Time UI**
353
-
354
- ```
355
- โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
356
- โ•‘ XibeCode AI Agent โ•‘
357
- โ•‘ Autonomous Coding Assistant v0.1.5 โ•‘
358
- โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
359
-
360
- ๐Ÿ“‹ Task:
361
- Create a REST API with Express
362
-
363
- โš™๏ธ Configuration:
364
- Model: claude-sonnet-4-5-20250929
365
- Max Iterations: 50
366
-
367
- โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
368
-
369
- Iteration 1/50 (2%) - 0.5s
370
- โ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘
371
-
372
- ๐Ÿ“– read_file
373
- โ†’ package.json
374
- โœ“ Success
375
- โ† 25 lines
376
-
377
- ๐Ÿ“ write_file
378
- โ†’ src/server.js
379
- โœ“ Success
380
- โ† File created (45 lines)
381
-
382
- ๐Ÿ’ฌ Assistant:
383
- I've created an Express server with the following endpoints...
384
- ```
385
-
386
- ## ๐Ÿ› ๏ธ Advanced Features
387
-
388
- ### Custom API Endpoints
389
-
390
- Use with Azure, AWS Bedrock, or custom Claude deployments:
391
-
392
- ```bash
393
- # Via config
394
- xibecode config --set-url https://your-custom-endpoint.com
395
-
396
- # Via command
397
- xibecode run "task" --base-url https://your-custom-endpoint.com
398
- ```
399
-
400
- ### Working with Large Files
401
-
402
- For files >1000 lines, read in chunks:
403
-
404
- ```bash
405
- xibecode run "Fix the bug around line 500 in large-file.js"
406
- ```
407
-
408
- The AI will:
409
-
410
- 1. Read lines 450-550 (context around the area)
411
- 2. Make targeted edit using line numbers
412
- 3. Verify the change
413
-
414
- ### Project Context Understanding
415
-
416
- ```bash
417
- xibecode run "Understand this project structure and suggest improvements"
418
- ```
419
-
420
- The AI will use `get_context` to:
421
-
422
- - Map import relationships
423
- - Find test files
424
- - Read configs
425
- - Build a mental model
426
-
427
- ### Error Recovery
428
-
429
- If something fails, the AI will:
430
-
431
- 1. Read the error message
432
- 2. Analyze what went wrong
433
- 3. Try a different approach
434
- 4. Can revert changes if needed
435
-
436
- ## ๐Ÿงช Test Integration
437
-
438
- XibeCode automatically detects and runs your project tests:
439
-
440
- ```bash
441
- # Fix failing tests
442
- xibecode run "Fix the failing tests"
443
-
444
- # Run tests after changes
445
- xibecode run "Add validation to User model and ensure all tests pass"
446
- ```
447
-
448
- **Supported test runners:**
449
-
450
- - Node.js: Vitest, Jest, Mocha, Ava
451
- - Python: pytest, unittest
452
- - Go: `go test`
453
-
454
- **Package manager detection:**
455
-
456
- - Prioritizes: pnpm โ†’ bun โ†’ npm
457
- - Detects from lock files (`pnpm-lock.yaml`, `bun.lockb`, `package-lock.json`)
458
-
459
- **Example workflow:**
460
-
461
- ```bash
462
- xibecode run "Refactor the authentication module:
463
- 1. Read the current code
464
- 2. Make improvements
465
- 3. Run tests to verify
466
- 4. Fix any test failures
467
- 5. Repeat until all tests pass"
468
- ```
469
-
470
- ## ๐Ÿ”€ Git Integration
471
-
472
- Work smarter with git-aware workflows:
473
-
474
- ### Check Repository State
475
-
476
- ```bash
477
- xibecode run "Show me the current git status"
478
- ```
479
40
 
480
- The AI will use `get_git_status` to see:
481
-
482
- - Current branch
483
- - Staged/unstaged/untracked files
484
- - Clean/dirty state
485
- - Commits ahead/behind upstream
486
-
487
- ### Focus on Changed Files
488
-
489
- ```bash
490
- xibecode run "Fix linting errors in changed files" --changed-only
491
- ```
492
-
493
- The AI will:
494
-
495
- - Get list of modified files with `get_git_changed_files`
496
- - Focus edits only on those files
497
- - More efficient for large codebases
498
-
499
- ### Create Safe Checkpoints
500
-
501
- ```bash
502
- xibecode run "Refactor the database layer (create checkpoint first)"
503
- ```
504
-
505
- The AI can:
506
-
507
- - Create checkpoints with `create_git_checkpoint`
508
- - Use git stash or commit strategy (configurable)
509
- - Revert to checkpoints if something goes wrong
510
-
511
- **Example:**
512
-
513
- ```javascript
514
- // The AI executes:
515
- create_git_checkpoint({
516
- message: "before refactoring database layer",
517
- strategy: "stash" // or "commit"
518
- })
519
-
520
- // ... makes changes ...
521
-
522
- // If needed:
523
- revert_to_git_checkpoint({
524
- checkpoint_id: "stash@{0}",
525
- checkpoint_type: "stash",
526
- confirm: true
527
- })
528
- ```
529
-
530
- ### Prepare Branches for Review
531
-
532
- ```bash
533
- xibecode run "Prepare this branch for code review:
534
- - Run tests
535
- - Fix any linting errors
536
- - Generate a summary of changes"
537
- ```
538
-
539
- ## ๐Ÿ”’ Safety Features
540
-
541
- ### Dry-Run Mode
542
-
543
- Preview changes without making them:
544
-
545
- ```bash
546
- xibecode run "Refactor the auth module" --dry-run
547
- ```
548
-
549
- In dry-run mode:
550
-
551
- - All file operations show what *would* happen
552
- - No actual changes are made
553
- - Git operations are simulated
554
- - Perfect for testing complex tasks
555
-
556
- **Example output:**
557
-
558
- ```
559
- [DRY RUN] Would replace lines 15-20 with 8 new lines
560
- [DRY RUN] Would write 150 lines to src/auth/index.ts
561
- [DRY RUN] Would create stash checkpoint: "before auth refactor"
562
- ```
563
-
564
- ### Risk Assessment
565
-
566
- XibeCode automatically assesses risk for operations:
567
-
568
- **High-risk operations** (require extra care):
569
-
570
- - Deleting files/directories
571
- - Force push to git
572
- - Destructive shell commands
573
- - Reverting to checkpoints
574
-
575
- **Blocked operations:**
576
-
577
- - Fork bombs
578
- - Deleting root/home directories
579
- - Direct disk writes
580
- - Extremely dangerous commands
581
-
582
- **Example:**
583
-
584
- ```bash
585
- $ xibecode run "Delete all test files"
586
-
587
- โš  HIGH RISK: Deletes files/directories permanently
588
- โ€ข Ensure backups exist before deletion
589
- โ€ข Suggestion: Consider using `mv` to move files to a temporary location first
590
- ```
591
-
592
- ### Safer Alternatives
593
-
594
- XibeCode suggests safer alternatives for risky commands:
595
-
596
- - `rm -rf` โ†’ "Use `mv` to move files first"
597
- - `git push --force` โ†’ "Use `git push --force-with-lease`"
598
- - `npm install` โ†’ "Use `pnpm install` or `bun install`"
599
-
600
- ## ๐Ÿ”Œ Plugin System
601
-
602
- Extend XibeCode with custom tools and domain-specific logic:
603
-
604
- ### Create a Plugin
605
-
606
- ```javascript
607
- // my-plugin.js
608
- export default {
609
- name: 'my-custom-plugin',
610
- version: '1.0.0',
611
- description: 'Adds custom tools for my workflow',
612
-
613
- registerTools() {
614
- return [
615
- {
616
- schema: {
617
- name: 'deploy_to_staging',
618
- description: 'Deploy the app to staging environment',
619
- input_schema: {
620
- type: 'object',
621
- properties: {
622
- branch: { type: 'string', description: 'Branch to deploy' }
623
- },
624
- required: ['branch']
625
- }
626
- },
627
- async handler(input) {
628
- // Your custom logic here
629
- return { success: true, deployed: true, branch: input.branch };
630
- }
631
- }
632
- ];
633
- },
634
-
635
- initialize() {
636
- console.log('My plugin loaded!');
637
- }
638
- };
639
- ```
640
-
641
- ### Load Plugins
642
-
643
- ```bash
644
- # Via config
645
- xibecode config --show
646
-
647
- # Edit ~/.xibecode/config.json
648
- {
649
- "plugins": [
650
- "/path/to/my-plugin.js",
651
- "./local-plugin.js"
652
- ]
653
- }
654
-
655
- # Or use directly
656
- xibecode run "Deploy to staging"
657
- ```
658
-
659
- The AI will automatically have access to your custom tools!
660
-
661
- ### Plugin Examples
662
-
663
- **Database migrations:**
664
-
665
- ```javascript
666
- registerTools() {
667
- return [{
668
- schema: { name: 'run_migration', ... },
669
- handler: async (input) => {
670
- // Run database migration
671
- }
672
- }];
673
- }
674
- ```
675
-
676
- **Internal APIs:**
677
-
678
- ```javascript
679
- registerTools() {
680
- return [{
681
- schema: { name: 'query_internal_api', ... },
682
- handler: async (input) => {
683
- // Call internal company API
684
- }
685
- }];
686
- }
687
- ```
688
-
689
- ## ๐Ÿ“Š Usage Examples
690
-
691
- ### Build a Feature
692
-
693
- ```bash
694
- xibecode run "Add user authentication to the Express API:
695
- - POST /auth/register
696
- - POST /auth/login
697
- - JWT token generation
698
- - Middleware to protect routes
699
- - Hash passwords with bcrypt"
700
- ```
701
-
702
- ### Fix a Bug
703
-
704
- ```bash
705
- xibecode run "The tests in test/user.test.js are failing.
706
- Debug and fix the issues." --verbose
707
- ```
708
-
709
- ### Refactor Code
710
-
711
- ```bash
712
- xibecode run "Refactor src/ to use TypeScript:
713
- - Convert all .js files to .ts
714
- - Add type annotations
715
- - Create types.ts for shared types
716
- - Update tsconfig.json"
717
- ```
718
-
719
- ### Generate Tests
720
-
721
- ```bash
722
- xibecode run "Write comprehensive tests for userController.js:
723
- - Test all endpoints
724
- - Test error cases
725
- - Use Jest
726
- - Achieve >80% coverage"
727
- ```
728
-
729
- ## โš™๏ธ Configuration
730
-
731
- XibeCode stores config in `~/.xibecode/`
732
-
733
- ### Available Settings
734
-
735
- ```javascript
736
- {
737
- "apiKey": "sk-ant-...", // Your Anthropic API key
738
- "baseUrl": "https://...", // Custom API endpoint (optional)
739
- "model": "claude-sonnet-4-5-...", // Default model
740
- "maxIterations": 50, // Default max iterations
741
- "defaultVerbose": false, // Default verbose mode
742
-
743
- // New in v2.0
744
- "preferredPackageManager": "pnpm", // Package manager: "pnpm", "bun", or "npm"
745
- "enableDryRunByDefault": false, // Enable dry-run mode by default
746
- "gitCheckpointStrategy": "stash", // Git checkpoint: "stash" or "commit"
747
- "testCommandOverride": "", // Custom test command (optional)
748
- "plugins": [], // Array of plugin paths
749
-
750
- // Latest version
751
- "mcpServers": {} // MCP server configurations (object-based)
752
- }
753
- ```
754
-
755
- ### Environment Variables
756
-
757
- ```bash
758
- ANTHROPIC_API_KEY=your_key # API key
759
- ANTHROPIC_BASE_URL=https://... # Custom endpoint
760
- XIBECODE_MODEL=claude-opus-4-... # Default model
761
- ```
762
-
763
- Config priority: CLI flags > Environment > Config file
764
-
765
- ## ๐Ÿ“ก MCP Integration (Model Context Protocol)
766
-
767
- XibeCode supports the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/), enabling connection to external servers that provide additional tools, resources, and capabilities.
768
-
769
- ### What is MCP?
770
-
771
- MCP is an open protocol that standardizes how applications provide context to LLMs. With MCP, you can:
772
-
773
- - **Extend Tools**: Add tools from external servers (databases, APIs, etc.)
774
- - **Access Resources**: Read data from external sources
775
- - **Use Prompt Templates**: Leverage pre-built prompts from servers
776
-
777
- ### Adding an MCP Server
778
-
779
- #### File-Based Configuration (Easiest - Recommended)
780
-
781
- Edit the MCP servers configuration file directly:
782
-
783
- ```bash
784
- # Show file path
785
- xibecode mcp file
786
-
787
- # Open file in your editor
788
- xibecode mcp edit
789
-
790
- # Or edit manually
791
- nano ~/.xibecode/mcp-servers.json
792
- ```
793
-
794
- **File Format** (`~/.xibecode/mcp-servers.json`):
795
-
796
- ```json
797
- {
798
- "mcpServers": {
799
- "filesystem": {
800
- "command": "mcp-server-filesystem",
801
- "args": ["--root", "/path/to/files"]
802
- },
803
- "github": {
804
- "command": "mcp-server-github",
805
- "args": ["--token", "YOUR_TOKEN"],
806
- "env": {
807
- "GITHUB_TOKEN": "your_token_here"
808
- }
809
- }
810
- }
811
- }
812
- ```
813
-
814
- > **Note:** The configuration format has been updated to use an object-based structure. If you have an existing configuration using the legacy array format with `"servers": [...]`, it will be automatically migrated to the new format when you run any MCP command.
815
-
816
- **File Management Commands:**
817
-
818
- ```bash
819
- # Create default file with examples
820
- xibecode mcp init
821
-
822
- # Reload servers from file (after editing)
823
- xibecode mcp reload
824
-
825
- # Show file path and status
826
- xibecode mcp file
827
- ```
828
-
829
- #### Commands
830
-
831
- ```bash
832
- # Open file to add/edit servers
833
- xibecode mcp add
834
- # or
835
- xibecode mcp edit
836
-
837
- # List all configured servers
838
- xibecode mcp list
839
-
840
- # Remove a server (or edit file manually)
841
- xibecode mcp remove filesystem
842
-
843
- # Show file path
844
- xibecode mcp file
845
-
846
- # Reload after editing
847
- xibecode mcp reload
41
+ # Autonomous run
42
+ xibecode run "Create an Express API with auth"
848
43
  ```
849
44
 
850
- #### Alternative Methods
45
+ ## Main Commands
851
46
 
852
- **Via config command (interactive):**
47
+ ### `xibecode run`
48
+ Autonomous coding workflow.
853
49
 
854
- ```bash
855
- xibecode config --add-mcp-server my-server
856
- # Follow interactive prompts
857
- ```
50
+ Useful options:
858
51
 
859
- **Via config menu:**
52
+ - `-f, --file <path>` prompt from file
53
+ - `-m, --model <model>` model override
54
+ - `--mode <mode>` initial agent mode
55
+ - `-b, --base-url <url>` custom API URL
56
+ - `-k, --api-key <key>` API key override
57
+ - `--provider <provider>` `anthropic` or `openai`
58
+ - `-d, --max-iterations <number>` default `150` (`0` = unlimited)
59
+ - `-v, --verbose`
60
+ - `--dry-run`
61
+ - `--changed-only`
860
62
 
861
- ```bash
862
- xibecode config
863
- # Select "๐Ÿ“ก Manage MCP Servers" โ†’ "โž• Add MCP Server"
864
- ```
63
+ ### `xibecode chat`
64
+ Interactive chat + tool use.
865
65
 
866
- ### MCP Server Configuration
66
+ Useful options:
867
67
 
868
- MCP servers support two transport types:
68
+ - `-m, --model <model>`
69
+ - `-b, --base-url <url>`
70
+ - `-k, --api-key <key>`
71
+ - `--provider <provider>`
72
+ - `--theme <theme>`
73
+ - `--session <id>`
869
74
 
870
- #### stdio Transport (Local Process)
75
+ ### `xibecode config`
76
+ Manage saved config:
871
77
 
872
- For local MCP servers that run as a subprocess. Currently only stdio transport is supported:
78
+ - `--set-key`, `--set-url`, `--set-model`
79
+ - `--show`, `--reset`
80
+ - MCP helpers: `--list-mcp-servers`, `--add-mcp-server`, `--remove-mcp-server`
873
81
 
874
- **Note:** The MCP configuration now uses a simpler object-based format. Instead of command-line flags, edit the configuration file directly:
82
+ ### `xibecode mcp`
83
+ MCP server management:
875
84
 
876
- ```bash
877
- # Open the config file
878
- xibecode mcp edit
85
+ - `add`, `list`, `remove`, `file`, `edit`, `init`, `reload`
86
+ - `search`, `install`, `login` (Smithery integration)
879
87
 
880
- # Add your server to the file using the new format:
881
- {
882
- "mcpServers": {
883
- "filesystem": {
884
- "command": "mcp-server-filesystem",
885
- "args": ["--root", "/path/to/files"]
886
- }
887
- }
888
- }
889
- ```
88
+ ## Core Features
890
89
 
891
- ### Using MCP Tools
90
+ - Autonomous multi-step agent loop
91
+ - Smart context gathering across related files
92
+ - Verified and line-based editing workflows
93
+ - Dry-run mode for safe previews
94
+ - Git-aware workflows (`--changed-only`, checkpoints/reverts)
95
+ - Test runner integration support
96
+ - MCP server integration
97
+ - Skill system (built-in + custom markdown skills)
98
+ - Session-aware chat and themed terminal UI
892
99
 
893
- Once configured, MCP tools are automatically available to XibeCode:
100
+ ## Browser Testing (Playwright)
894
101
 
895
- ```bash
896
- # In chat mode, view MCP servers and tools
897
- xibecode chat
898
- > /mcp
899
- ```
900
-
901
- MCP tools are prefixed with the server name (e.g., `filesystem::read_file`, `remote-api::query`).
902
-
903
- ### Popular MCP Servers
102
+ XibeCode includes comprehensive browser automation and testing capabilities powered by Playwright:
904
103
 
905
- - **@modelcontextprotocol/server-filesystem** - File system access
906
- - **@modelcontextprotocol/server-github** - GitHub API integration
907
- - **@modelcontextprotocol/server-postgres** - PostgreSQL database access
908
- - **@modelcontextprotocol/server-slack** - Slack integration
909
- - **Custom servers** - Build your own with the MCP SDK
910
-
911
- ### Example: Adding GitHub MCP Server
104
+ - **Screenshots** - Capture webpage screenshots
105
+ - **Console Logs** - Collect browser console output for debugging
106
+ - **Visual Regression** - Compare screenshots against baselines to detect UI changes
107
+ - **Accessibility Audits** - Check WCAG compliance (alt text, labels, heading hierarchy)
108
+ - **Performance Metrics** - Measure Core Web Vitals (FCP, LCP, CLS, TTI)
109
+ - **Responsive Testing** - Test across multiple viewports (mobile, tablet, desktop)
110
+ - **Network Monitoring** - Capture all network requests during page load
111
+ - **E2E Tests** - Execute Playwright test files
912
112
 
913
113
  ```bash
914
- # Install the GitHub MCP server
915
- npm install -g @modelcontextprotocol/server-github
916
-
917
- # Open the config file to add the server
918
- xibecode mcp edit
919
- # Edit the file and add:
920
- # {
921
- # "mcpServers": {
922
- # "github": {
923
- # "command": "mcp-server-github",
924
- # "args": ["--token", "YOUR_GITHUB_TOKEN"]
925
- # }
926
- # }
927
- # }
114
+ # Example: Test a page's performance
115
+ xibecode run "Measure the performance of http://localhost:3000"
928
116
 
929
- # Reload servers
930
- xibecode mcp reload
117
+ # Example: Check accessibility
118
+ xibecode run "Run an accessibility audit on the homepage"
931
119
 
932
- # Now XibeCode can use GitHub tools
933
- xibecode chat
934
- > Create an issue in my repo about the bug we just found
120
+ # Example: Visual regression test
121
+ xibecode run "Take a screenshot and compare against baseline"
935
122
  ```
936
123
 
937
- ## ๐Ÿง  Enhanced AI Capabilities
938
-
939
- XibeCode includes advanced reasoning capabilities that enable it to:
940
-
941
- ### Systematic Problem Solving
942
-
943
- - **Problem Decomposition**: Breaks complex tasks into manageable steps
944
- - **Hypothesis-Driven Development**: Forms and tests hypotheses systematically
945
- - **Root Cause Analysis**: Traces issues to their source, not just symptoms
946
- - **Pattern Recognition**: Identifies design patterns and anti-patterns
947
-
948
- ### Advanced Context Awareness
124
+ ## Project Docs
949
125
 
950
- - **Project Structure Understanding**: Maps dependencies and data flows
951
- - **Change Impact Analysis**: Considers downstream effects before modifications
952
- - **Historical Context**: Uses git history to understand code evolution
953
- - **Cross-File Dependencies**: Tracks relationships between files
126
+ - `CHANGELOG.md` โ€” release history
127
+ - `FEATURES.md` โ€” feature deep dive
128
+ - `PUBLISHING.md` โ€” npm release process
954
129
 
955
- ### Coding Best Practices
130
+ ## License
956
131
 
957
- - **SOLID Principles**: Applies proper software design principles
958
- - **Error Handling**: Structured error classification and recovery strategies
959
- - **Performance Optimization**: Data structure selection and algorithm analysis
960
- - **Security Best Practices**: Input validation, secure defaults, proper authentication
961
-
962
- ### Multi-Step Planning
963
-
964
- - **Task Breakdown**: Decomposes large features into atomic steps
965
- - **Dependency Mapping**: Identifies prerequisites and execution order
966
- - **Milestone Definition**: Sets intermediate validation points
967
- - **Rollback Planning**: Plans for failure scenarios and recovery
968
-
969
- ## ๐Ÿ”’ Safety Features
970
-
971
- - **Loop Detection** - Stops if AI repeats the same action 3+ times
972
- - **Max Iterations** - Hard limit on iterations (default: 50)
973
- - **Automatic Backups** - Every edit is backed up
974
- - **Revert Capability** - Can undo changes
975
- - **Error Recovery** - Handles failures gracefully
976
- - **Read-Before-Edit** - AI reads files before modifying
977
-
978
- ## ๐Ÿš€ Performance
979
-
980
- - **Startup**: <1 second
981
- - **First response**: 2-5 seconds (API latency)
982
- - **Tool execution**: Instant to seconds
983
- - **Memory**: ~50MB typical
984
- - **Context window**: 100k tokens (smart management)
985
-
986
- ## ๐Ÿ“ˆ Comparison
987
-
988
- | Feature | XibeCode | Claude Code | Aider |
989
- |---------|----------|-------------|-------|
990
- | Open Source | โœ… | โŒ | โœ… |
991
- | Custom API URL | โœ… | โŒ | โœ… |
992
- | Smart Context | โœ… | โœ… | โš ๏ธ |
993
- | File Editing | โœ… Advanced | โœ… | โœ… |
994
- | Cross-Platform | โœ… | โœ… | โœ… |
995
- | Loop Detection | โœ… | โœ… | โŒ |
996
- | Auto Backups | โœ… | โš ๏ธ | โŒ |
997
- | Beautiful TUI | โœ… | โœ… | โš ๏ธ |
998
- | Price | Free (your API) | $20/mo | Free |
999
-
1000
- ## ๐Ÿค Contributing
1001
-
1002
- Contributions welcome! Please see CONTRIBUTING.md
1003
-
1004
- ## ๐Ÿ“ License
1005
-
1006
- MIT
1007
-
1008
- ## ๐Ÿ™ Credits
1009
-
1010
- Built with:
1011
-
1012
- - [@anthropic-ai/sdk](https://www.npmjs.com/package/@anthropic-ai/sdk)
1013
- - [@modelcontextprotocol/sdk](https://github.com/modelcontextprotocol/sdk)
1014
- - [Commander.js](https://github.com/tj/commander.js/)
1015
- - [Inquirer.js](https://github.com/SBoudrias/Inquirer.js/)
1016
- - [Chalk](https://github.com/chalk/chalk)
1017
- - [fast-glob](https://github.com/mrmlnc/fast-glob)
1018
-
1019
- Inspired by [Claude Code](https://www.anthropic.com/news/claude-code) and [Aider](https://github.com/paul-gauthier/aider)
1020
-
1021
- ---
1022
-
1023
- **Made with โค๏ธ for developers who love AI-assisted coding**
1024
-
1025
- # XibeCode
132
+ Apache-2.0