codesavant 1.2.9 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -803
  3. package/dist/cli.js +51052 -31649
  4. package/package.json +39 -68
package/README.md CHANGED
@@ -1,845 +1,104 @@
1
1
  # CodeSavant
2
2
 
3
- <div align="center">
3
+ AI-powered coding assistant CLI with multi-provider support. A feature-complete alternative to Claude Code CLI that works with multiple LLM providers.
4
4
 
5
- ```
6
- ██████╗ ██████╗ ██████╗ ███████╗███████╗ █████╗ ██╗ ██╗ █████╗ ███╗ ██╗████████╗
7
- ██╔════╝██╔═══██╗██╔══██╗██╔════╝██╔════╝██╔══██╗██║ ██║██╔══██╗████╗ ██║╚══██╔══╝
8
- ██║ ██║ ██║██║ ██║█████╗ ███████╗███████║██║ ██║███████║██╔██╗ ██║ ██║
9
- ██║ ██║ ██║██║ ██║██╔══╝ ╚════██║██╔══██║╚██╗ ██╔╝██╔══██║██║╚██╗██║ ██║
10
- ╚██████╗╚██████╔╝██████╔╝███████╗███████║██║ ██║ ╚████╔╝ ██║ ██║██║ ╚████║ ██║
11
- ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═╝
12
- ```
13
-
14
- **Multi-Provider AI Coding Assistant for Your Terminal**
15
-
16
- [![npm version](https://badge.fury.io/js/codesavant.svg)](https://www.npmjs.com/package/codesavant)
17
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
18
- [![Node.js Version](https://img.shields.io/node/v/codesavant.svg)](https://nodejs.org)
19
-
20
- </div>
21
-
22
- ---
23
-
24
- ## What is CodeSavant?
25
-
26
- CodeSavant is a powerful AI coding assistant that runs directly in your terminal. Unlike cloud-based solutions, CodeSavant gives you the flexibility to choose from multiple AI providers (DeepSeek, Groq, Gemini, OpenAI, Anthropic, or local Ollama) while keeping your code and conversations private.
27
-
28
- **Key Benefits:**
29
- - **Cost Effective**: Use providers like DeepSeek at $0.14/1M tokens vs $15/1M for GPT-4
30
- - **Provider Choice**: Switch between 7+ AI providers based on your needs
31
- - **Privacy First**: Run locally with Ollama, or use any cloud provider
32
- - **Full Tooling**: Read, write, edit files, run commands, search codebases
33
- - **Session Persistence**: Continue conversations across terminal sessions
34
- - **Extensible**: Custom skills, MCP servers, and subagents
5
+ ## Features
35
6
 
36
- ---
37
-
38
- ## Table of Contents
39
-
40
- - [Installation](#installation)
41
- - [Quick Start](#quick-start)
42
- - [Supported Providers](#supported-providers)
43
- - [Usage](#usage)
44
- - [Interactive Mode](#interactive-mode)
45
- - [REPL Commands](#repl-commands)
46
- - [Multi-line Input](#multi-line-input)
47
- - [Keyboard Shortcuts](#keyboard-shortcuts)
48
- - [Tools](#tools)
49
- - [Subagents](#subagents)
50
- - [Skills System](#skills-system)
51
- - [Permission System](#permission-system)
52
- - [Session Management](#session-management)
53
- - [Configuration](#configuration)
54
- - [Project Memory (SAVANT.md)](#project-memory-savantmd)
55
- - [MCP Integration](#mcp-integration)
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)
62
- - [Environment Variables](#environment-variables)
63
- - [License](#license)
64
-
65
- ---
7
+ - **Multi-Provider Support**: Anthropic, OpenAI, Gemini, Bedrock, Groq, DeepSeek, Ollama
8
+ - **Full Tool Suite**: Read, Write, Edit, Bash, Glob, Grep, LSP, MultiEdit, LS, NotebookRead
9
+ - **MCP Integration**: Connect to Model Context Protocol servers
10
+ - **Hooks System**: 40+ hook events for customization
11
+ - **Session Management**: Resume previous conversations
12
+ - **Plan Mode**: Read-only exploration mode
13
+ - **Subagent System**: Spawn specialized agents for complex tasks
66
14
 
67
15
  ## Installation
68
16
 
69
- ### Prerequisites
70
-
71
- - Node.js 18.0.0 or higher
72
- - At least one AI provider API key (or Ollama installed locally)
73
- - [ripgrep](https://github.com/BurntSushi/ripgrep) (recommended for fast code search)
74
-
75
- ### Install via npm
76
-
77
17
  ```bash
78
- npm install -g codesavant
79
- ```
18
+ # Using bun (recommended)
19
+ bun add -g codesavant
80
20
 
81
- ### Verify Installation
82
-
83
- ```bash
84
- codesavant --version
85
- codesavant doctor # Run diagnostic checks
86
- ```
87
-
88
- ---
89
-
90
- ## Quick Start
91
-
92
- ### 1. Set up an API key
93
-
94
- Choose at least one provider and set the API key:
95
-
96
- ```bash
97
- # DeepSeek (Recommended - Best cost/performance ratio)
98
- export DEEPSEEK_API_KEY="your-api-key"
99
-
100
- # Groq (Fastest response times)
101
- export GROQ_API_KEY="your-api-key"
102
-
103
- # Google Gemini (Large context window - 1M tokens)
104
- export GEMINI_API_KEY="your-api-key"
105
-
106
- # OpenAI
107
- export OPENAI_API_KEY="your-api-key"
108
-
109
- # Anthropic
110
- export ANTHROPIC_API_KEY="your-api-key"
111
-
112
- # Or use Ollama locally (no API key needed)
113
- # Just ensure Ollama is running: ollama serve
114
- ```
115
-
116
- ### 2. Start CodeSavant
117
-
118
- ```bash
119
- codesavant
120
- ```
121
-
122
- ### 3. Start Coding!
123
-
124
- ```
125
- > Explain the structure of this codebase
126
-
127
- > Create a function to validate email addresses
128
-
129
- > Fix the bug in src/utils.ts
130
-
131
- > Write tests for the authentication module
21
+ # Using npm
22
+ npm install -g codesavant
132
23
  ```
133
24
 
134
- ---
135
-
136
- ## Supported Providers
137
-
138
- | Provider | Cost (per 1M tokens) | Speed | Best For | API Key Variable |
139
- |----------|---------------------|-------|----------|------------------|
140
- | **DeepSeek** | $0.14 in / $0.28 out | Medium | Primary coding tasks | `DEEPSEEK_API_KEY` |
141
- | **Groq** | $0.59 in / $0.79 out | Fastest | Quick queries, chat | `GROQ_API_KEY` |
142
- | **Gemini** | $0.15 in / $0.60 out | Fast | Large context tasks | `GEMINI_API_KEY` |
143
- | **OpenAI** | $5.00 in / $15.00 out | Medium | Complex reasoning | `OPENAI_API_KEY` |
144
- | **Anthropic** | $3.00 in / $15.00 out | Medium | Code review, analysis | `ANTHROPIC_API_KEY` |
145
- | **Vertex AI** | Varies | Medium | Enterprise/GCP users | `GOOGLE_APPLICATION_CREDENTIALS` |
146
- | **Ollama** | Free (local) | Variable | Offline, privacy | None (local) |
147
-
148
- **Estimated Monthly Cost**: $2-10 for typical individual usage with DeepSeek/Groq.
149
-
150
- ### Smart Routing
25
+ ## Requirements
151
26
 
152
- CodeSavant automatically routes requests to the best available provider based on:
153
- - Task complexity
154
- - Provider availability
155
- - Cost optimization
156
- - Response speed requirements
157
-
158
- ---
27
+ - [Bun](https://bun.sh) >= 1.0.0
159
28
 
160
29
  ## Usage
161
30
 
162
- ### Interactive Mode
163
-
164
31
  ```bash
165
- # Start a new session
32
+ # Interactive mode
166
33
  codesavant
167
34
 
168
- # Continue the last session
169
- codesavant -c
170
- codesavant --continue
171
-
172
- # Resume a specific session
173
- codesavant -r <session-id>
174
- codesavant --resume <session-id>
175
-
176
- # Start with an initial prompt
35
+ # Single prompt
177
36
  codesavant "Explain this codebase"
178
37
 
179
- # Use a specific provider
180
- codesavant --provider deepseek
181
- codesavant --provider groq
182
-
183
- # Use a specific model
184
- codesavant --model gpt-4o
185
-
186
- # Use classic terminal UI (no Ink)
187
- codesavant --classic
188
- ```
189
-
190
- ### REPL Commands
191
-
192
- Inside the CodeSavant REPL, use these slash commands:
193
-
194
- | Command | Description |
195
- |---------|-------------|
196
- | `/help` | Show all available commands |
197
- | `/clear` | Clear conversation history |
198
- | `/history` | Show conversation history |
199
- | `/session` | Show current session ID |
200
- | `/sessions` | List all saved sessions |
201
- | `/providers` | Show available AI providers |
202
- | `/stats` | Show token usage and cost statistics |
203
- | `/compact` | Manually compact conversation context |
204
- | `/export [format]` | Export conversation (markdown, json, html) |
205
- | `/config` | Show current configuration |
206
- | `/doctor` | Diagnose configuration issues |
207
- | `/init` | Initialize CodeSavant in current project |
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 |
212
-
213
- ### Multi-line Input
214
-
215
- Use triple quotes `"""` to enter multi-line input:
216
-
217
- ```
218
- > """
219
- Create a React component that:
220
- - Displays a list of users
221
- - Supports pagination
222
- - Has a search filter
223
- - Shows loading states
224
- """
225
- ```
226
-
227
- Press Enter after the closing `"""` to submit.
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
-
242
- ---
243
-
244
- ## Tools
245
-
246
- CodeSavant has 17 built-in tools that the AI can use:
247
-
248
- ### File Operations
249
-
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 |
257
-
258
- ### Search Operations
259
-
260
- | Tool | Description |
261
- |------|-------------|
262
- | **glob** | Find files using glob patterns |
263
- | **grep** | Search file contents with regex (ripgrep) |
264
-
265
- ### System Operations
266
-
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 |
274
-
275
- ### Network Operations
276
-
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
291
-
292
- ```
293
- > Read the package.json file
294
-
295
- > Find all TypeScript files in src/
296
-
297
- > Search for "TODO" comments in the codebase
298
-
299
- > Run npm test
300
-
301
- > Create a new component at src/components/Button.tsx
302
- ```
303
-
304
- ---
305
-
306
- ## Subagents
307
-
308
- Specialized AI agents that can be spawned for focused tasks:
309
-
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 |
319
-
320
- ### Using Subagents
321
-
322
- The AI automatically uses subagents for appropriate tasks, or you can request them:
323
-
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
330
- ```
331
-
332
- ---
333
-
334
- ## Skills System
335
-
336
- Skills are pre-built or custom AI behaviors for common tasks.
337
-
338
- ### Built-in Skills
339
-
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 |
347
-
348
- ### Using Skills
349
-
350
- ```
351
- > /commit
352
-
353
- > /review src/auth.ts
354
-
355
- > /test src/utils/validation.ts
356
- ```
357
-
358
- ### Creating Custom Skills
359
-
360
- Create a `SKILL.md` file in `~/.codesavant/skills/` or `.codesavant/skills/`:
361
-
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
- ---
373
-
374
- # Documentation Generator
375
-
376
- Generate comprehensive documentation for the specified code...
377
- ```
378
-
379
- ---
380
-
381
- ## Permission System
382
-
383
- CodeSavant protects your system with a granular permission system.
384
-
385
- ### Permission Modes
386
-
387
- | Mode | Description |
388
- |------|-------------|
389
- | `default` | Ask for dangerous operations, auto-allow safe ones |
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
396
-
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)
38
+ # Print mode (non-interactive)
39
+ codesavant -p "List all TypeScript files"
411
40
 
412
- ### Auto-Denied Operations
41
+ # Pipe mode
42
+ echo "Summarize this file" | codesavant --pipe
413
43
 
414
- - `rm -rf /` and similar destructive commands
415
- - `sudo` commands
416
- - Writing to `.env` files
417
- - Fork bombs and shell injection
418
-
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
44
+ # Resume session
441
45
  codesavant -r <session-id>
442
- ```
443
-
444
- ### Session Features
445
-
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
450
-
451
- ---
452
-
453
- ## Configuration
454
-
455
- ### Configuration File
456
-
457
- Location: `~/.codesavant/config.json`
458
-
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
- ```
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
487
- ```
488
-
489
- ### Directory Structure
490
-
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
543
- ```
544
-
545
- ---
546
-
547
- ## MCP Integration
548
-
549
- CodeSavant supports the Model Context Protocol (MCP) for extending functionality.
550
-
551
- ### Configure MCP Servers
552
-
553
- Create `~/.codesavant/mcp.json`:
554
-
555
- ```json
556
- {
557
- "servers": {
558
- "filesystem": {
559
- "transport": "stdio",
560
- "command": "npx",
561
- "args": ["-y", "@anthropic/mcp-server-filesystem", "/path/to/dir"]
562
- },
563
- "github": {
564
- "transport": "stdio",
565
- "command": "npx",
566
- "args": ["-y", "@anthropic/mcp-server-github"],
567
- "env": {
568
- "GITHUB_TOKEN": "${GITHUB_TOKEN}"
569
- }
570
- }
571
- },
572
- "settings": {
573
- "defaultTimeout": 30000,
574
- "maxConcurrent": 5
575
- }
576
- }
577
- ```
578
-
579
- ### MCP Commands
580
-
581
- ```bash
582
- codesavant mcp --list # List configured servers
583
- codesavant mcp add name "command" # Add a server
584
- codesavant mcp remove name # Remove a server
585
- ```
586
-
587
- ### Supported Transports
588
-
589
- - **stdio** - Standard input/output (local processes)
590
- - **http** - HTTP/HTTPS endpoints
591
- - **sse** - Server-Sent Events
592
-
593
- ---
594
-
595
- ## Live Preview
596
-
597
- Manage development server for web projects:
598
-
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
621
46
 
622
- Automatically fix build and test failures:
47
+ # Plan mode (read-only)
48
+ codesavant --plan
623
49
 
624
- ```bash
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"
50
+ # Specify provider
51
+ codesavant --provider openai --model gpt-4o
633
52
  ```
634
53
 
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
640
-
641
- ---
642
-
643
- ## Checkpoints & Recovery
644
-
645
- ### Automatic Checkpoints
646
-
647
- CodeSavant automatically creates checkpoints:
648
- - Before file modifications
649
- - Periodically during long sessions
650
- - On graceful shutdown
651
-
652
- ### Rewind to Checkpoint
653
-
654
- Press `Esc Esc` (double escape) to rewind to the last checkpoint, restoring:
655
- - Conversation state
656
- - Modified files
657
-
658
- ### Session Recovery
659
-
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
685
-
686
- ```bash
687
- # Enable specific debug categories
688
- codesavant --debug api,mcp,tool
689
-
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
698
- ```
699
-
700
- ### Debug Categories
701
-
702
- `api`, `mcp`, `tool`, `provider`, `stream`, `session`, `context`, `permission`, `checkpoint`, `error`, `all`
703
-
704
- ### Doctor Command
705
-
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
716
-
717
- ### Common Issues
718
-
719
- #### "No AI providers available"
720
-
721
- ```bash
722
- codesavant config --providers
723
- echo $DEEPSEEK_API_KEY
724
- ```
725
-
726
- #### npm permission errors
727
-
728
- ```bash
729
- sudo chown -R $(whoami) ~/.npm
730
- npm cache clean --force
731
- ```
54
+ ## Configuration
732
55
 
733
- #### Session not persisting
56
+ Set your API key for the provider you want to use:
734
57
 
735
58
  ```bash
736
- ls ~/.codesavant/sessions/
737
- codesavant sessions -l
738
- ```
739
-
740
- ---
741
-
742
- ## CLI Reference
743
-
744
- ```
745
- Usage: codesavant [options] [command] [prompt]
746
-
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
773
-
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
780
- ```
59
+ # Anthropic (default)
60
+ export ANTHROPIC_API_KEY=your-key
781
61
 
782
- ---
783
-
784
- ## Environment Variables
785
-
786
- ### API Keys
787
-
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 |
796
-
797
- ### Shell Configuration
798
-
799
- Add to your `~/.bashrc` or `~/.zshrc`:
62
+ # OpenAI
63
+ export OPENAI_API_KEY=your-key
800
64
 
801
- ```bash
802
- # API Keys
803
- export DEEPSEEK_API_KEY="your-key-here"
65
+ # Gemini
66
+ export GOOGLE_API_KEY=your-key
804
67
 
805
- # Aliases
806
- alias cs="codesavant"
807
- alias csc="codesavant -c"
68
+ # AWS Bedrock
69
+ export AWS_ACCESS_KEY_ID=your-key
70
+ export AWS_SECRET_ACCESS_KEY=your-secret
71
+ export AWS_REGION=us-east-1
808
72
  ```
809
73
 
810
- ---
74
+ ## Providers
811
75
 
812
- ## Contributing
76
+ | Provider | Models | Auth |
77
+ |----------|--------|------|
78
+ | Anthropic | claude-3-opus, claude-3-sonnet, claude-3-haiku | ANTHROPIC_API_KEY |
79
+ | OpenAI | gpt-4o, gpt-4-turbo, gpt-3.5-turbo | OPENAI_API_KEY |
80
+ | Gemini | gemini-1.5-pro, gemini-1.5-flash | GOOGLE_API_KEY |
81
+ | Bedrock | claude-3, llama-3 | AWS credentials |
82
+ | Groq | llama-3, mixtral | GROQ_API_KEY |
83
+ | DeepSeek | deepseek-chat, deepseek-coder | DEEPSEEK_API_KEY |
84
+ | Ollama | Any local model | Local server |
813
85
 
814
- Contributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
86
+ ## Tools
815
87
 
816
- 1. Fork the repository
817
- 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
818
- 3. Commit your changes (`git commit -m 'Add amazing feature'`)
819
- 4. Push to the branch (`git push origin feature/amazing-feature`)
820
- 5. Open a Pull Request
88
+ CodeSavant includes a comprehensive set of tools:
821
89
 
822
- ---
90
+ - **Read**: Read file contents
91
+ - **Write**: Create/overwrite files
92
+ - **Edit**: Make targeted edits to files
93
+ - **MultiEdit**: Batch edit multiple files atomically
94
+ - **Bash**: Execute shell commands
95
+ - **Glob**: Find files by pattern
96
+ - **Grep**: Search file contents
97
+ - **LS**: List directory contents
98
+ - **LSP**: Language server integration
99
+ - **NotebookRead**: Read Jupyter notebooks
100
+ - **Task**: Spawn subagents for complex tasks
823
101
 
824
102
  ## License
825
103
 
826
- MIT License - see the [LICENSE](LICENSE) file for details.
827
-
828
- ---
829
-
830
- ## Acknowledgments
831
-
832
- - Built with [Commander.js](https://github.com/tj/commander.js/)
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)
836
-
837
- ---
838
-
839
- <div align="center">
840
-
841
- **Made with love by [Vishal Aggarwal](https://github.com/burnisback)**
842
-
843
- [Report Bug](https://github.com/burnisback/codesavant/issues) · [Request Feature](https://github.com/burnisback/codesavant/issues)
844
-
845
- </div>
104
+ MIT