codesavant 1.2.7 → 1.2.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 +452 -217
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ CodeSavant is a powerful AI coding assistant that runs directly in your terminal
|
|
|
31
31
|
- **Privacy First**: Run locally with Ollama, or use any cloud provider
|
|
32
32
|
- **Full Tooling**: Read, write, edit files, run commands, search codebases
|
|
33
33
|
- **Session Persistence**: Continue conversations across terminal sessions
|
|
34
|
+
- **Extensible**: Custom skills, MCP servers, and subagents
|
|
34
35
|
|
|
35
36
|
---
|
|
36
37
|
|
|
@@ -41,17 +42,24 @@ CodeSavant is a powerful AI coding assistant that runs directly in your terminal
|
|
|
41
42
|
- [Supported Providers](#supported-providers)
|
|
42
43
|
- [Usage](#usage)
|
|
43
44
|
- [Interactive Mode](#interactive-mode)
|
|
44
|
-
- [Commands](#commands)
|
|
45
|
+
- [REPL Commands](#repl-commands)
|
|
45
46
|
- [Multi-line Input](#multi-line-input)
|
|
46
|
-
- [
|
|
47
|
-
- [Project Memory (SAVANT.md)](#project-memory-savantmd)
|
|
47
|
+
- [Keyboard Shortcuts](#keyboard-shortcuts)
|
|
48
48
|
- [Tools](#tools)
|
|
49
|
+
- [Subagents](#subagents)
|
|
50
|
+
- [Skills System](#skills-system)
|
|
49
51
|
- [Permission System](#permission-system)
|
|
50
|
-
- [
|
|
52
|
+
- [Session Management](#session-management)
|
|
53
|
+
- [Configuration](#configuration)
|
|
54
|
+
- [Project Memory (SAVANT.md)](#project-memory-savantmd)
|
|
51
55
|
- [MCP Integration](#mcp-integration)
|
|
52
|
-
- [
|
|
56
|
+
- [Live Preview](#live-preview)
|
|
57
|
+
- [CI/CD Fix Mode](#cicd-fix-mode)
|
|
58
|
+
- [Checkpoints & Recovery](#checkpoints--recovery)
|
|
59
|
+
- [Enterprise Features](#enterprise-features)
|
|
60
|
+
- [Debug & Troubleshooting](#debug--troubleshooting)
|
|
61
|
+
- [CLI Reference](#cli-reference)
|
|
53
62
|
- [Environment Variables](#environment-variables)
|
|
54
|
-
- [Troubleshooting](#troubleshooting)
|
|
55
63
|
- [License](#license)
|
|
56
64
|
|
|
57
65
|
---
|
|
@@ -62,6 +70,7 @@ CodeSavant is a powerful AI coding assistant that runs directly in your terminal
|
|
|
62
70
|
|
|
63
71
|
- Node.js 18.0.0 or higher
|
|
64
72
|
- At least one AI provider API key (or Ollama installed locally)
|
|
73
|
+
- [ripgrep](https://github.com/BurntSushi/ripgrep) (recommended for fast code search)
|
|
65
74
|
|
|
66
75
|
### Install via npm
|
|
67
76
|
|
|
@@ -73,6 +82,7 @@ npm install -g codesavant
|
|
|
73
82
|
|
|
74
83
|
```bash
|
|
75
84
|
codesavant --version
|
|
85
|
+
codesavant doctor # Run diagnostic checks
|
|
76
86
|
```
|
|
77
87
|
|
|
78
88
|
---
|
|
@@ -90,7 +100,7 @@ export DEEPSEEK_API_KEY="your-api-key"
|
|
|
90
100
|
# Groq (Fastest response times)
|
|
91
101
|
export GROQ_API_KEY="your-api-key"
|
|
92
102
|
|
|
93
|
-
# Google Gemini (Large context window)
|
|
103
|
+
# Google Gemini (Large context window - 1M tokens)
|
|
94
104
|
export GEMINI_API_KEY="your-api-key"
|
|
95
105
|
|
|
96
106
|
# OpenAI
|
|
@@ -172,9 +182,12 @@ codesavant --provider groq
|
|
|
172
182
|
|
|
173
183
|
# Use a specific model
|
|
174
184
|
codesavant --model gpt-4o
|
|
185
|
+
|
|
186
|
+
# Use classic terminal UI (no Ink)
|
|
187
|
+
codesavant --classic
|
|
175
188
|
```
|
|
176
189
|
|
|
177
|
-
### Commands
|
|
190
|
+
### REPL Commands
|
|
178
191
|
|
|
179
192
|
Inside the CodeSavant REPL, use these slash commands:
|
|
180
193
|
|
|
@@ -188,11 +201,14 @@ Inside the CodeSavant REPL, use these slash commands:
|
|
|
188
201
|
| `/providers` | Show available AI providers |
|
|
189
202
|
| `/stats` | Show token usage and cost statistics |
|
|
190
203
|
| `/compact` | Manually compact conversation context |
|
|
191
|
-
| `/export` | Export conversation
|
|
204
|
+
| `/export [format]` | Export conversation (markdown, json, html) |
|
|
192
205
|
| `/config` | Show current configuration |
|
|
193
206
|
| `/doctor` | Diagnose configuration issues |
|
|
194
207
|
| `/init` | Initialize CodeSavant in current project |
|
|
195
|
-
| `/
|
|
208
|
+
| `/preview` | Manage live preview servers |
|
|
209
|
+
| `/status` | Show session status and statistics |
|
|
210
|
+
| `/debug` | Debug logging controls |
|
|
211
|
+
| `/exit` or `Ctrl+D` | Exit CodeSavant |
|
|
196
212
|
|
|
197
213
|
### Multi-line Input
|
|
198
214
|
|
|
@@ -210,367 +226,585 @@ Create a React component that:
|
|
|
210
226
|
|
|
211
227
|
Press Enter after the closing `"""` to submit.
|
|
212
228
|
|
|
229
|
+
### Keyboard Shortcuts
|
|
230
|
+
|
|
231
|
+
| Shortcut | Action |
|
|
232
|
+
|----------|--------|
|
|
233
|
+
| `Tab` | Autocomplete commands |
|
|
234
|
+
| `↑/↓` | Navigate command history |
|
|
235
|
+
| `Ctrl+R` | Search command history |
|
|
236
|
+
| `Ctrl+C` | Cancel current operation |
|
|
237
|
+
| `Ctrl+D` | Exit CodeSavant |
|
|
238
|
+
| `Shift+Tab` | Cycle permission modes |
|
|
239
|
+
| `Esc Esc` | Rewind to last checkpoint |
|
|
240
|
+
| `"""` | Enter multi-line mode |
|
|
241
|
+
|
|
213
242
|
---
|
|
214
243
|
|
|
215
|
-
##
|
|
244
|
+
## Tools
|
|
216
245
|
|
|
217
|
-
|
|
246
|
+
CodeSavant has 17 built-in tools that the AI can use:
|
|
218
247
|
|
|
219
|
-
|
|
248
|
+
### File Operations
|
|
220
249
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
"mode": "default",
|
|
229
|
-
"allowedPaths": ["."],
|
|
230
|
-
"deniedPaths": ["node_modules", ".git", ".env"]
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
```
|
|
250
|
+
| Tool | Description |
|
|
251
|
+
|------|-------------|
|
|
252
|
+
| **read_file** | Read file contents with line numbers |
|
|
253
|
+
| **write_file** | Create or overwrite files |
|
|
254
|
+
| **edit_file** | Make precise edits with search/replace |
|
|
255
|
+
| **multi_edit** | Apply multiple atomic edits across files |
|
|
256
|
+
| **list_directory** | List directory contents |
|
|
234
257
|
|
|
235
|
-
###
|
|
258
|
+
### Search Operations
|
|
236
259
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
260
|
+
| Tool | Description |
|
|
261
|
+
|------|-------------|
|
|
262
|
+
| **glob** | Find files using glob patterns |
|
|
263
|
+
| **grep** | Search file contents with regex (ripgrep) |
|
|
240
264
|
|
|
241
|
-
|
|
242
|
-
codesavant config get provider
|
|
265
|
+
### System Operations
|
|
243
266
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
267
|
+
| Tool | Description |
|
|
268
|
+
|------|-------------|
|
|
269
|
+
| **bash** | Execute shell commands (120s timeout) |
|
|
270
|
+
| **notebook_edit** | Edit Jupyter notebooks (.ipynb) |
|
|
271
|
+
| **screenshot** | Capture screen screenshots |
|
|
272
|
+
| **computer_use** | Control mouse and keyboard |
|
|
273
|
+
| **preview** | Manage live preview of web projects |
|
|
247
274
|
|
|
248
|
-
|
|
249
|
-
codesavant config --providers
|
|
250
|
-
```
|
|
275
|
+
### Network Operations
|
|
251
276
|
|
|
252
|
-
|
|
277
|
+
| Tool | Description |
|
|
278
|
+
|------|-------------|
|
|
279
|
+
| **web_fetch** | Fetch URLs and convert HTML to Markdown |
|
|
280
|
+
| **web_search** | Search the web |
|
|
281
|
+
|
|
282
|
+
### AI Operations
|
|
283
|
+
|
|
284
|
+
| Tool | Description |
|
|
285
|
+
|------|-------------|
|
|
286
|
+
| **spawn_subagent** | Delegate tasks to specialized agents |
|
|
287
|
+
| **todo_write** | Manage structured task lists |
|
|
288
|
+
| **ask_user_question** | Ask user questions with choices |
|
|
289
|
+
|
|
290
|
+
### Examples
|
|
253
291
|
|
|
254
292
|
```
|
|
255
|
-
|
|
256
|
-
├── config.json # Global configuration
|
|
257
|
-
├── sessions/ # Saved conversation sessions
|
|
258
|
-
├── skills/ # Custom skills
|
|
259
|
-
└── SAVANT.md # Global project memory
|
|
260
|
-
```
|
|
293
|
+
> Read the package.json file
|
|
261
294
|
|
|
262
|
-
|
|
295
|
+
> Find all TypeScript files in src/
|
|
263
296
|
|
|
264
|
-
|
|
297
|
+
> Search for "TODO" comments in the codebase
|
|
265
298
|
|
|
266
|
-
|
|
299
|
+
> Run npm test
|
|
267
300
|
|
|
268
|
-
|
|
301
|
+
> Create a new component at src/components/Button.tsx
|
|
302
|
+
```
|
|
269
303
|
|
|
270
|
-
|
|
271
|
-
# Project: MyApp
|
|
304
|
+
---
|
|
272
305
|
|
|
273
|
-
##
|
|
274
|
-
E-commerce platform built with Next.js and PostgreSQL.
|
|
306
|
+
## Subagents
|
|
275
307
|
|
|
276
|
-
|
|
277
|
-
- Frontend: Next.js 14, React 18, TailwindCSS
|
|
278
|
-
- Backend: Node.js, Express, Prisma ORM
|
|
279
|
-
- Database: PostgreSQL
|
|
280
|
-
- Testing: Jest, Playwright
|
|
308
|
+
Specialized AI agents that can be spawned for focused tasks:
|
|
281
309
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
-
|
|
310
|
+
| Subagent | Description | Best For |
|
|
311
|
+
|----------|-------------|----------|
|
|
312
|
+
| **explore** | Codebase exploration specialist | Understanding code structure, finding patterns |
|
|
313
|
+
| **plan** | Research and planning agent | Creating implementation plans, architecture |
|
|
314
|
+
| **bash** | Command execution specialist | Git operations, system tasks |
|
|
315
|
+
| **general-purpose** | Multi-tool agent | Complex multi-step tasks |
|
|
316
|
+
| **test-runner** | Test execution specialist | Running and analyzing tests |
|
|
317
|
+
| **build-validator** | Build verification | Fixing compilation errors |
|
|
318
|
+
| **code-guide** | Documentation lookup | CodeSavant feature help |
|
|
288
319
|
|
|
289
|
-
|
|
290
|
-
- Use TypeScript strict mode
|
|
291
|
-
- Prefer functional components with hooks
|
|
292
|
-
- Use async/await over promises
|
|
293
|
-
- Run `npm run lint` before committing
|
|
320
|
+
### Using Subagents
|
|
294
321
|
|
|
295
|
-
|
|
296
|
-
- `npm run dev` - Start development server
|
|
297
|
-
- `npm run build` - Build for production
|
|
298
|
-
- `npm run test` - Run test suite
|
|
299
|
-
- `npm run db:migrate` - Run database migrations
|
|
322
|
+
The AI automatically uses subagents for appropriate tasks, or you can request them:
|
|
300
323
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
324
|
+
```
|
|
325
|
+
> Explore this codebase and explain the architecture
|
|
326
|
+
|
|
327
|
+
> Plan how to implement user authentication
|
|
328
|
+
|
|
329
|
+
> Run the tests and fix any failures
|
|
305
330
|
```
|
|
306
331
|
|
|
307
332
|
---
|
|
308
333
|
|
|
309
|
-
##
|
|
334
|
+
## Skills System
|
|
310
335
|
|
|
311
|
-
|
|
336
|
+
Skills are pre-built or custom AI behaviors for common tasks.
|
|
312
337
|
|
|
313
|
-
###
|
|
338
|
+
### Built-in Skills
|
|
314
339
|
|
|
315
|
-
|
|
|
316
|
-
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
|
|
|
320
|
-
|
|
|
321
|
-
|
|
|
340
|
+
| Skill | Description |
|
|
341
|
+
|-------|-------------|
|
|
342
|
+
| `/commit` | Generate a git commit message |
|
|
343
|
+
| `/review` | Review code for issues |
|
|
344
|
+
| `/test` | Generate tests for code |
|
|
345
|
+
| `/explain` | Explain how code works |
|
|
346
|
+
| `/fix` | Debug and fix issues |
|
|
322
347
|
|
|
323
|
-
###
|
|
348
|
+
### Using Skills
|
|
324
349
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
| **Bash** | Execute shell commands |
|
|
328
|
-
| **ListDir** | List directory contents |
|
|
350
|
+
```
|
|
351
|
+
> /commit
|
|
329
352
|
|
|
330
|
-
|
|
353
|
+
> /review src/auth.ts
|
|
331
354
|
|
|
355
|
+
> /test src/utils/validation.ts
|
|
332
356
|
```
|
|
333
|
-
> Read the package.json file
|
|
334
357
|
|
|
335
|
-
|
|
358
|
+
### Creating Custom Skills
|
|
336
359
|
|
|
337
|
-
|
|
360
|
+
Create a `SKILL.md` file in `~/.codesavant/skills/` or `.codesavant/skills/`:
|
|
338
361
|
|
|
339
|
-
|
|
362
|
+
```yaml
|
|
363
|
+
---
|
|
364
|
+
name: document
|
|
365
|
+
description: Generate documentation for code
|
|
366
|
+
triggers: ['document', 'docs', 'jsdoc']
|
|
367
|
+
allowedTools: ['read_file', 'write_file', 'edit_file']
|
|
368
|
+
permissionMode: acceptEdits
|
|
369
|
+
maxTurns: 10
|
|
370
|
+
author: Your Name
|
|
371
|
+
version: 1.0
|
|
372
|
+
---
|
|
340
373
|
|
|
341
|
-
|
|
374
|
+
# Documentation Generator
|
|
375
|
+
|
|
376
|
+
Generate comprehensive documentation for the specified code...
|
|
342
377
|
```
|
|
343
378
|
|
|
344
379
|
---
|
|
345
380
|
|
|
346
381
|
## Permission System
|
|
347
382
|
|
|
348
|
-
CodeSavant
|
|
383
|
+
CodeSavant protects your system with a granular permission system.
|
|
349
384
|
|
|
350
385
|
### Permission Modes
|
|
351
386
|
|
|
352
387
|
| Mode | Description |
|
|
353
388
|
|------|-------------|
|
|
354
389
|
| `default` | Ask for dangerous operations, auto-allow safe ones |
|
|
355
|
-
| `
|
|
356
|
-
| `
|
|
390
|
+
| `plan` | Read-only mode, no file modifications |
|
|
391
|
+
| `acceptEdits` | Auto-approve file edits |
|
|
392
|
+
| `strict` | Ask for all operations |
|
|
393
|
+
| `yolo` | Auto-approve everything (dangerous!) |
|
|
394
|
+
|
|
395
|
+
### Cycling Modes
|
|
357
396
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
397
|
+
Press `Shift+Tab` in the REPL to cycle through permission modes, or use:
|
|
398
|
+
|
|
399
|
+
```bash
|
|
400
|
+
codesavant --mode plan
|
|
401
|
+
codesavant --mode strict
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Interactive Prompts
|
|
405
|
+
|
|
406
|
+
When prompted for permission:
|
|
407
|
+
- `y` or `1` - Allow this once
|
|
408
|
+
- `n` or `2` - Deny this once
|
|
409
|
+
- `a` or `3` - Always allow (this session)
|
|
410
|
+
- `v` or `4` - Never allow (this session)
|
|
363
411
|
|
|
364
412
|
### Auto-Denied Operations
|
|
413
|
+
|
|
365
414
|
- `rm -rf /` and similar destructive commands
|
|
366
415
|
- `sudo` commands
|
|
367
416
|
- Writing to `.env` files
|
|
368
|
-
-
|
|
417
|
+
- Fork bombs and shell injection
|
|
369
418
|
|
|
370
|
-
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
## Session Management
|
|
422
|
+
|
|
423
|
+
Sessions persist conversations across terminal sessions.
|
|
424
|
+
|
|
425
|
+
### Session Commands
|
|
426
|
+
|
|
427
|
+
```bash
|
|
428
|
+
# List all sessions
|
|
429
|
+
codesavant sessions -l
|
|
430
|
+
|
|
431
|
+
# Delete a session
|
|
432
|
+
codesavant sessions -d <session-id>
|
|
433
|
+
|
|
434
|
+
# Clean up old sessions (default: 30 days)
|
|
435
|
+
codesavant sessions --cleanup [days]
|
|
436
|
+
|
|
437
|
+
# Continue most recent session
|
|
438
|
+
codesavant -c
|
|
439
|
+
|
|
440
|
+
# Resume specific session
|
|
441
|
+
codesavant -r <session-id>
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Session Features
|
|
371
445
|
|
|
372
|
-
|
|
373
|
-
-
|
|
374
|
-
-
|
|
375
|
-
-
|
|
376
|
-
- `never` - Deny for this session
|
|
446
|
+
- **Atomic Writes**: Prevents data corruption
|
|
447
|
+
- **Cost Tracking**: Per-message token usage and cost
|
|
448
|
+
- **Checkpoints**: Save/restore conversation state
|
|
449
|
+
- **Export**: Export to Markdown, JSON, or HTML
|
|
377
450
|
|
|
378
451
|
---
|
|
379
452
|
|
|
380
|
-
##
|
|
453
|
+
## Configuration
|
|
381
454
|
|
|
382
|
-
|
|
455
|
+
### Configuration File
|
|
383
456
|
|
|
384
|
-
|
|
385
|
-
|-------|-------------|
|
|
386
|
-
| `/commit` | Generate a git commit message |
|
|
387
|
-
| `/review` | Review code for issues |
|
|
388
|
-
| `/test` | Generate tests for code |
|
|
389
|
-
| `/explain` | Explain how code works |
|
|
390
|
-
| `/refactor` | Suggest refactoring improvements |
|
|
457
|
+
Location: `~/.codesavant/config.json`
|
|
391
458
|
|
|
392
|
-
|
|
459
|
+
```json
|
|
460
|
+
{
|
|
461
|
+
"defaultProvider": "deepseek",
|
|
462
|
+
"maxTokens": 8192,
|
|
463
|
+
"routingStrategy": "auto",
|
|
464
|
+
"providers": [
|
|
465
|
+
{
|
|
466
|
+
"name": "deepseek",
|
|
467
|
+
"model": "deepseek-chat",
|
|
468
|
+
"apiKey": "sk-...",
|
|
469
|
+
"costPerMToken": {"input": 0.14, "output": 0.28}
|
|
470
|
+
}
|
|
471
|
+
],
|
|
472
|
+
"permissions": []
|
|
473
|
+
}
|
|
474
|
+
```
|
|
393
475
|
|
|
476
|
+
### Configuration Commands
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
# View all configuration
|
|
480
|
+
codesavant config --show
|
|
481
|
+
|
|
482
|
+
# View available providers
|
|
483
|
+
codesavant config --providers
|
|
484
|
+
|
|
485
|
+
# Set a value
|
|
486
|
+
codesavant config set defaultProvider deepseek
|
|
394
487
|
```
|
|
395
|
-
> /commit
|
|
396
488
|
|
|
397
|
-
|
|
489
|
+
### Directory Structure
|
|
398
490
|
|
|
399
|
-
|
|
491
|
+
```
|
|
492
|
+
~/.codesavant/
|
|
493
|
+
├── config.json # Global configuration
|
|
494
|
+
├── mcp.json # MCP server configurations
|
|
495
|
+
├── SAVANT.md # Global memory
|
|
496
|
+
├── sessions/ # Saved sessions
|
|
497
|
+
├── checkpoints/ # Conversation checkpoints
|
|
498
|
+
├── audit/ # Permission audit logs
|
|
499
|
+
└── skills/ # Custom skills
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
## Project Memory (SAVANT.md)
|
|
505
|
+
|
|
506
|
+
CodeSavant uses a three-level memory hierarchy:
|
|
507
|
+
|
|
508
|
+
| Level | File | Purpose |
|
|
509
|
+
|-------|------|---------|
|
|
510
|
+
| **User** | `~/.codesavant/SAVANT.md` | Global preferences |
|
|
511
|
+
| **Project** | `./SAVANT.md` | Project-specific context |
|
|
512
|
+
| **Local** | `./SAVANT.local.md` | Personal overrides (gitignored) |
|
|
513
|
+
|
|
514
|
+
### Example SAVANT.md
|
|
515
|
+
|
|
516
|
+
```markdown
|
|
517
|
+
# Project: MyApp
|
|
518
|
+
|
|
519
|
+
## Overview
|
|
520
|
+
E-commerce platform built with Next.js and PostgreSQL.
|
|
521
|
+
|
|
522
|
+
## Tech Stack
|
|
523
|
+
- Frontend: Next.js 14, React 18, TailwindCSS
|
|
524
|
+
- Backend: Node.js, Express, Prisma ORM
|
|
525
|
+
- Database: PostgreSQL
|
|
526
|
+
- Testing: Jest, Playwright
|
|
527
|
+
|
|
528
|
+
## Project Structure
|
|
529
|
+
- `/src/app` - Next.js app router pages
|
|
530
|
+
- `/src/components` - Reusable React components
|
|
531
|
+
- `/src/lib` - Utility functions
|
|
532
|
+
- `/prisma` - Database schema
|
|
533
|
+
|
|
534
|
+
## Coding Conventions
|
|
535
|
+
- Use TypeScript strict mode
|
|
536
|
+
- Prefer functional components
|
|
537
|
+
- Run `npm run lint` before committing
|
|
538
|
+
|
|
539
|
+
## Common Commands
|
|
540
|
+
- `npm run dev` - Start dev server
|
|
541
|
+
- `npm run build` - Build for production
|
|
542
|
+
- `npm run test` - Run tests
|
|
400
543
|
```
|
|
401
544
|
|
|
402
545
|
---
|
|
403
546
|
|
|
404
547
|
## MCP Integration
|
|
405
548
|
|
|
406
|
-
CodeSavant supports the Model Context Protocol (MCP) for extending functionality
|
|
549
|
+
CodeSavant supports the Model Context Protocol (MCP) for extending functionality.
|
|
407
550
|
|
|
408
551
|
### Configure MCP Servers
|
|
409
552
|
|
|
410
|
-
Create
|
|
553
|
+
Create `~/.codesavant/mcp.json`:
|
|
411
554
|
|
|
412
555
|
```json
|
|
413
556
|
{
|
|
414
557
|
"servers": {
|
|
415
558
|
"filesystem": {
|
|
559
|
+
"transport": "stdio",
|
|
416
560
|
"command": "npx",
|
|
417
|
-
"args": ["-y", "@anthropic/mcp-server-filesystem", "/path/to/
|
|
561
|
+
"args": ["-y", "@anthropic/mcp-server-filesystem", "/path/to/dir"]
|
|
418
562
|
},
|
|
419
563
|
"github": {
|
|
564
|
+
"transport": "stdio",
|
|
420
565
|
"command": "npx",
|
|
421
566
|
"args": ["-y", "@anthropic/mcp-server-github"],
|
|
422
567
|
"env": {
|
|
423
568
|
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
|
|
424
569
|
}
|
|
425
570
|
}
|
|
571
|
+
},
|
|
572
|
+
"settings": {
|
|
573
|
+
"defaultTimeout": 30000,
|
|
574
|
+
"maxConcurrent": 5
|
|
426
575
|
}
|
|
427
576
|
}
|
|
428
577
|
```
|
|
429
578
|
|
|
430
|
-
###
|
|
579
|
+
### MCP Commands
|
|
431
580
|
|
|
432
581
|
```bash
|
|
433
|
-
codesavant mcp
|
|
582
|
+
codesavant mcp --list # List configured servers
|
|
583
|
+
codesavant mcp add name "command" # Add a server
|
|
584
|
+
codesavant mcp remove name # Remove a server
|
|
434
585
|
```
|
|
435
586
|
|
|
587
|
+
### Supported Transports
|
|
588
|
+
|
|
589
|
+
- **stdio** - Standard input/output (local processes)
|
|
590
|
+
- **http** - HTTP/HTTPS endpoints
|
|
591
|
+
- **sse** - Server-Sent Events
|
|
592
|
+
|
|
436
593
|
---
|
|
437
594
|
|
|
438
|
-
##
|
|
595
|
+
## Live Preview
|
|
439
596
|
|
|
440
|
-
|
|
597
|
+
Manage development server for web projects:
|
|
441
598
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
599
|
+
```
|
|
600
|
+
> /preview start # Start dev server
|
|
601
|
+
> /preview start --port 3000 # Specify port
|
|
602
|
+
> /preview stop # Stop server
|
|
603
|
+
> /preview status # Show status
|
|
604
|
+
> /preview open # Open in browser
|
|
605
|
+
> /preview list # List running servers
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
### Supported Frameworks
|
|
609
|
+
|
|
610
|
+
- Next.js
|
|
611
|
+
- Vite (React, Vue, Svelte)
|
|
612
|
+
- Create React App
|
|
613
|
+
- Angular
|
|
614
|
+
- Nuxt
|
|
615
|
+
- Astro
|
|
616
|
+
- Gatsby
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
## CI/CD Fix Mode
|
|
448
621
|
|
|
449
|
-
|
|
622
|
+
Automatically fix build and test failures:
|
|
450
623
|
|
|
451
624
|
```bash
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
625
|
+
# Auto-fix until CI passes (max 10 attempts)
|
|
626
|
+
codesavant --fix-ci
|
|
627
|
+
|
|
628
|
+
# Custom max attempts
|
|
629
|
+
codesavant --fix-ci --fix-ci-max-attempts 5
|
|
630
|
+
|
|
631
|
+
# Specify CI commands
|
|
632
|
+
codesavant --fix-ci --fix-ci-commands "npm test,npm run build"
|
|
455
633
|
```
|
|
456
634
|
|
|
457
|
-
|
|
635
|
+
CodeSavant will:
|
|
636
|
+
1. Run CI commands
|
|
637
|
+
2. Analyze failures
|
|
638
|
+
3. Apply fixes
|
|
639
|
+
4. Repeat until passing or max attempts reached
|
|
458
640
|
|
|
459
641
|
---
|
|
460
642
|
|
|
461
|
-
##
|
|
643
|
+
## Checkpoints & Recovery
|
|
462
644
|
|
|
463
|
-
###
|
|
645
|
+
### Automatic Checkpoints
|
|
464
646
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
| `GEMINI_API_KEY` | Google Gemini API key |
|
|
470
|
-
| `OPENAI_API_KEY` | OpenAI API key |
|
|
471
|
-
| `ANTHROPIC_API_KEY` | Anthropic API key |
|
|
472
|
-
| `GOOGLE_APPLICATION_CREDENTIALS` | Path to GCP credentials for Vertex AI |
|
|
647
|
+
CodeSavant automatically creates checkpoints:
|
|
648
|
+
- Before file modifications
|
|
649
|
+
- Periodically during long sessions
|
|
650
|
+
- On graceful shutdown
|
|
473
651
|
|
|
474
|
-
###
|
|
652
|
+
### Rewind to Checkpoint
|
|
475
653
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
| `CODESAVANT_MODEL` | Default model to use |
|
|
480
|
-
| `CODESAVANT_CONFIG_PATH` | Custom config file path |
|
|
654
|
+
Press `Esc Esc` (double escape) to rewind to the last checkpoint, restoring:
|
|
655
|
+
- Conversation state
|
|
656
|
+
- Modified files
|
|
481
657
|
|
|
482
|
-
###
|
|
658
|
+
### Session Recovery
|
|
483
659
|
|
|
484
|
-
|
|
660
|
+
If a session crashes, CodeSavant can recover:
|
|
661
|
+
- Detect crashed sessions
|
|
662
|
+
- Restore conversation state
|
|
663
|
+
- Retry failed operations
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
## Enterprise Features
|
|
668
|
+
|
|
669
|
+
CodeSavant includes enterprise-grade features:
|
|
670
|
+
|
|
671
|
+
| Feature | Description |
|
|
672
|
+
|---------|-------------|
|
|
673
|
+
| **Managed Policies** | Organization-wide tool/provider restrictions |
|
|
674
|
+
| **SSO/SAML** | OAuth2 and SAML 2.0 authentication |
|
|
675
|
+
| **Audit Logging** | Complete audit trail of all operations |
|
|
676
|
+
| **Team Sharing** | Share sessions and workspaces |
|
|
677
|
+
| **Budget Controls** | Token and cost limits per user/team |
|
|
678
|
+
| **Admin Console** | Organization and user management |
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## Debug & Troubleshooting
|
|
683
|
+
|
|
684
|
+
### Debug Logging
|
|
485
685
|
|
|
486
686
|
```bash
|
|
487
|
-
#
|
|
488
|
-
|
|
687
|
+
# Enable specific debug categories
|
|
688
|
+
codesavant --debug api,mcp,tool
|
|
489
689
|
|
|
490
|
-
#
|
|
491
|
-
|
|
492
|
-
|
|
690
|
+
# Enable all except MCP
|
|
691
|
+
codesavant --debug all,!mcp
|
|
692
|
+
|
|
693
|
+
# MCP protocol debugging
|
|
694
|
+
codesavant --mcp-debug
|
|
695
|
+
|
|
696
|
+
# Verbose output
|
|
697
|
+
codesavant --verbose
|
|
493
698
|
```
|
|
494
699
|
|
|
495
|
-
|
|
700
|
+
### Debug Categories
|
|
701
|
+
|
|
702
|
+
`api`, `mcp`, `tool`, `provider`, `stream`, `session`, `context`, `permission`, `checkpoint`, `error`, `all`
|
|
703
|
+
|
|
704
|
+
### Doctor Command
|
|
496
705
|
|
|
497
|
-
|
|
706
|
+
```bash
|
|
707
|
+
codesavant doctor
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
Checks:
|
|
711
|
+
- Node.js version
|
|
712
|
+
- Provider configurations
|
|
713
|
+
- API key validity
|
|
714
|
+
- ripgrep installation
|
|
715
|
+
- File permissions
|
|
498
716
|
|
|
499
717
|
### Common Issues
|
|
500
718
|
|
|
501
719
|
#### "No AI providers available"
|
|
502
720
|
|
|
503
721
|
```bash
|
|
504
|
-
# Check which providers are configured
|
|
505
722
|
codesavant config --providers
|
|
506
|
-
|
|
507
|
-
# Verify API key is set
|
|
508
723
|
echo $DEEPSEEK_API_KEY
|
|
509
724
|
```
|
|
510
725
|
|
|
511
|
-
####
|
|
726
|
+
#### npm permission errors
|
|
512
727
|
|
|
513
728
|
```bash
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
# Check file permissions
|
|
518
|
-
ls -la ~/.codesavant/
|
|
729
|
+
sudo chown -R $(whoami) ~/.npm
|
|
730
|
+
npm cache clean --force
|
|
519
731
|
```
|
|
520
732
|
|
|
521
733
|
#### Session not persisting
|
|
522
734
|
|
|
523
735
|
```bash
|
|
524
|
-
# Check sessions directory exists
|
|
525
736
|
ls ~/.codesavant/sessions/
|
|
526
|
-
|
|
527
|
-
# List available sessions
|
|
528
|
-
codesavant --list-sessions
|
|
737
|
+
codesavant sessions -l
|
|
529
738
|
```
|
|
530
739
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
- Try a faster provider like Groq
|
|
534
|
-
- Reduce `maxTokens` in config
|
|
535
|
-
- Use `/compact` to reduce context size
|
|
740
|
+
---
|
|
536
741
|
|
|
537
|
-
|
|
742
|
+
## CLI Reference
|
|
538
743
|
|
|
539
|
-
```bash
|
|
540
|
-
# Run with verbose logging
|
|
541
|
-
DEBUG=codesavant* codesavant
|
|
542
744
|
```
|
|
745
|
+
Usage: codesavant [options] [command] [prompt]
|
|
543
746
|
|
|
544
|
-
|
|
747
|
+
Options:
|
|
748
|
+
-V, --version Output version number
|
|
749
|
+
--verbose Enable verbose logging
|
|
750
|
+
--debug <categories> Enable debug logging (api,mcp,tool,...)
|
|
751
|
+
--mcp-debug Enable MCP protocol debugging
|
|
752
|
+
-p, --print Non-interactive print mode
|
|
753
|
+
-c, --continue Continue last session
|
|
754
|
+
-r, --resume <sessionId> Resume specific session
|
|
755
|
+
--provider <provider> Select provider (deepseek, groq, etc.)
|
|
756
|
+
--max-tokens <tokens> Maximum tokens in response
|
|
757
|
+
-m, --mode <mode> Permission mode (default, plan, strict)
|
|
758
|
+
-o, --output-format <format> Output format (text, json, stream-json)
|
|
759
|
+
--system-prompt <prompt> Override system prompt
|
|
760
|
+
--append-system-prompt <text> Append to system prompt
|
|
761
|
+
--allowed-tools <tools> Restrict to specific tools
|
|
762
|
+
--disallowed-tools <tools> Block specific tools
|
|
763
|
+
--input-format <format> Input format (text, stream-json)
|
|
764
|
+
--fix-ci CI/CD fix mode
|
|
765
|
+
--fix-ci-max-attempts <n> Max fix attempts (default: 10)
|
|
766
|
+
--fix-ci-commands <commands> CI commands to run
|
|
767
|
+
--max-turns <turns> Maximum conversation turns
|
|
768
|
+
--dangerously-skip-permissions Skip all permission checks
|
|
769
|
+
--no-mcp Disable MCP servers
|
|
770
|
+
--model <model> Specific model to use
|
|
771
|
+
--classic Use classic terminal UI
|
|
772
|
+
-h, --help Display help
|
|
545
773
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
774
|
+
Commands:
|
|
775
|
+
config Manage configuration
|
|
776
|
+
sessions List and manage sessions
|
|
777
|
+
mcp Manage MCP servers
|
|
778
|
+
doctor Run diagnostic checks
|
|
779
|
+
upgrade Check for updates
|
|
550
780
|
```
|
|
551
781
|
|
|
552
782
|
---
|
|
553
783
|
|
|
554
|
-
##
|
|
784
|
+
## Environment Variables
|
|
555
785
|
|
|
556
|
-
|
|
557
|
-
Usage: codesavant [options] [prompt]
|
|
786
|
+
### API Keys
|
|
558
787
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
-h, --help Display help
|
|
788
|
+
| Variable | Description |
|
|
789
|
+
|----------|-------------|
|
|
790
|
+
| `DEEPSEEK_API_KEY` | DeepSeek API key |
|
|
791
|
+
| `GROQ_API_KEY` | Groq API key |
|
|
792
|
+
| `GEMINI_API_KEY` | Google Gemini API key |
|
|
793
|
+
| `OPENAI_API_KEY` | OpenAI API key |
|
|
794
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key |
|
|
795
|
+
| `GOOGLE_APPLICATION_CREDENTIALS` | Path to GCP credentials |
|
|
568
796
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
797
|
+
### Shell Configuration
|
|
798
|
+
|
|
799
|
+
Add to your `~/.bashrc` or `~/.zshrc`:
|
|
800
|
+
|
|
801
|
+
```bash
|
|
802
|
+
# API Keys
|
|
803
|
+
export DEEPSEEK_API_KEY="your-key-here"
|
|
804
|
+
|
|
805
|
+
# Aliases
|
|
806
|
+
alias cs="codesavant"
|
|
807
|
+
alias csc="codesavant -c"
|
|
574
808
|
```
|
|
575
809
|
|
|
576
810
|
---
|
|
@@ -596,8 +830,9 @@ MIT License - see the [LICENSE](LICENSE) file for details.
|
|
|
596
830
|
## Acknowledgments
|
|
597
831
|
|
|
598
832
|
- Built with [Commander.js](https://github.com/tj/commander.js/)
|
|
599
|
-
- Terminal UI powered by [
|
|
600
|
-
- AI integrations via [OpenAI SDK](https://github.com/openai/openai-node)
|
|
833
|
+
- Terminal UI powered by [Ink](https://github.com/vadimdemedes/ink) and [Chalk](https://github.com/chalk/chalk)
|
|
834
|
+
- AI integrations via [OpenAI SDK](https://github.com/openai/openai-node)
|
|
835
|
+
- Fast search with [ripgrep](https://github.com/BurntSushi/ripgrep)
|
|
601
836
|
|
|
602
837
|
---
|
|
603
838
|
|
|
@@ -605,6 +840,6 @@ MIT License - see the [LICENSE](LICENSE) file for details.
|
|
|
605
840
|
|
|
606
841
|
**Made with love by [Vishal Aggarwal](https://github.com/burnisback)**
|
|
607
842
|
|
|
608
|
-
[Report Bug](https://github.com/burnisback/
|
|
843
|
+
[Report Bug](https://github.com/burnisback/codesavant/issues) · [Request Feature](https://github.com/burnisback/codesavant/issues)
|
|
609
844
|
|
|
610
845
|
</div>
|