diff --git a/README.md b/README.md index 5bd15d0..d2f8583 100644 --- a/README.md +++ b/README.md @@ -136,9 +136,17 @@ codi --provider runpod --endpoint-id your-endpoint-id | `-p, --provider ` | Provider: `anthropic`, `openai`, `ollama`, `ollama-cloud`, `runpod`, or `auto` | `auto` | | `-m, --model ` | Model name to use | Provider default | | `--base-url ` | Custom API base URL | Provider default | +| `--endpoint-id ` | Endpoint ID for RunPod serverless | - | | `-y, --yes` | Auto-approve all tool operations | Prompt | +| `--no-tools` | Disable tool use (for models that don't support it) | Tools enabled | | `-s, --session ` | Load a saved session on startup | - | | `-c, --compress` | Enable context compression | Disabled | +| `--context-window ` | Context window size before compaction | Model default | +| `--summarize-model ` | Model for context summarization | Primary model | +| `--summarize-provider ` | Provider for summarization model | Primary provider | +| `--mcp-server` | Run as MCP server (stdio transport) | - | +| `--no-mcp` | Disable MCP server connections | MCP enabled | +| `--audit` | Enable audit logging to ~/.codi/audit/ | Disabled | | `--verbose` | Show tool inputs/outputs with timing | - | | `--debug` | Show API details and context info | - | | `--trace` | Show full request/response payloads | - | @@ -232,13 +240,14 @@ codi --provider runpod --endpoint-id your-endpoint-id
⚙️ Model & Config -| Command | Description | -|---------|-------------| -| `/models [provider]` | List available models with pricing | -| `/switch [model]` | Switch provider/model mid-session | -| `/config` | Show workspace configuration | -| `/modelmap` | Show model map configuration | -| `/pipeline ` | Execute multi-model pipeline | +| Command | Aliases | Description | +|---------|---------|-------------| +| `/init [--config\|--modelmap\|--context]` | - | Initialize Codi config files in project | +| `/models [provider]` | - | List available models with pricing | +| `/switch [model]` | `/use` | Switch provider/model mid-session | +| `/config [show\|init\|example]` | `/cfg` | View or create workspace configuration | +| `/modelmap` | `/mm` | Show model map configuration | +| `/pipeline [name] [input]` | `/pipe` | Execute or list multi-model pipelines |
@@ -271,6 +280,59 @@ The symbol index enables IDE-like code navigation for the AI. +
+📊 Usage & Cost Tracking + +| Command | Aliases | Description | +|---------|---------|-------------| +| `/usage` | `/cost`, `/tokens` | Show current session usage | +| `/usage today` | - | Show today's usage | +| `/usage week` | - | Show last 7 days usage | +| `/usage month` | - | Show last 30 days usage | +| `/usage all` | - | Show all-time usage | +| `/usage reset` | - | Reset session usage | + +
+ +
+📝 Planning + +| Command | Aliases | Description | +|---------|---------|-------------| +| `/plan ` | `/p` | Create a step-by-step plan for a task | +| `/plans` | - | List saved plans | +| `/plans show ` | - | Show a specific plan | +| `/plans delete ` | - | Delete a plan | + +
+ +
+🔍 RAG (Semantic Search) + +| Command | Aliases | Description | +|---------|---------|-------------| +| `/index` | `/reindex` | Build or rebuild the RAG code index | +| `/index --clear` | - | Clear and rebuild index from scratch | +| `/index --status` | - | Show indexing status | +| `/rag search ` | - | Search indexed code semantically | +| `/rag stats` | - | Show RAG index statistics | +| `/rag config` | - | Show RAG configuration | + +
+ +
+✅ Approvals + +| Command | Aliases | Description | +|---------|---------|-------------| +| `/approvals` | `/approved` | List approved command patterns | +| `/approvals add pattern ` | - | Add an approved pattern | +| `/approvals add category ` | - | Add an approved category | +| `/approvals remove pattern ` | - | Remove a pattern | +| `/approvals categories` | - | List available categories | + +
+ --- ## Tools @@ -282,9 +344,12 @@ The AI has access to these tools for interacting with your codebase: | `read_file` | Read file contents with optional line range | | `write_file` | Create or overwrite files | | `edit_file` | Make targeted search/replace edits | +| `insert_line` | Insert text at a specific line number | | `patch_file` | Apply unified diff patches | | `glob` | Find files by pattern (e.g., `src/**/*.ts`) | | `grep` | Search file contents with regex | +| `list_directory` | List files and directories with sizes | +| `print_tree` | Print tree-like directory structure | | `bash` | Execute shell commands (with safety checks) | | `analyze_image` | Analyze images using vision models | | `run_tests` | Auto-detect and run project tests | @@ -336,22 +401,68 @@ Codi automatically detects your project type and adapts its responses: ## Workspace Configuration -Create a `.codi.json` in your project root: +Create a `.codi.json` in your project root (or use `/init --config`): ```json { "provider": "anthropic", "model": "claude-sonnet-4-20250514", - "autoApprove": ["read_file", "glob", "grep"], + "baseUrl": "https://api.example.com", + "autoApprove": ["read_file", "glob", "grep", "list_directory"], + "approvedCategories": ["read-only", "navigation"], + "dangerousPatterns": ["custom-pattern-.*"], "systemPromptAdditions": "Always use TypeScript strict mode.", "projectContext": "This is a React app using Next.js 14.", "commandAliases": { "t": "/test src/", "b": "/build" + }, + "defaultSession": "my-project", + "enableCompression": false, + "maxContextTokens": 100000, + "models": { + "summarize": { + "provider": "ollama", + "model": "llama3.2" + } + }, + "rag": { + "enabled": true, + "excludePatterns": ["**/node_modules/**", "**/.git/**"], + "maxChunkSize": 1000, + "maxResults": 5 + }, + "tools": { + "disabled": ["web_search"], + "defaults": { + "bash": { "timeout": 30000 } + } } } ``` +### Configuration Options + +| Option | Description | +|--------|-------------| +| `provider` | Default provider: `anthropic`, `openai`, `ollama`, `ollama-cloud`, `runpod` | +| `model` | Default model name | +| `baseUrl` | Custom API base URL | +| `autoApprove` | Array of tools to auto-approve (skip confirmation) | +| `approvedCategories` | Bash command categories to auto-approve | +| `dangerousPatterns` | Custom regex patterns to flag as dangerous | +| `systemPromptAdditions` | Text appended to system prompt | +| `projectContext` | Project description for AI context | +| `commandAliases` | Custom command shortcuts | +| `defaultSession` | Session to load on startup | +| `enableCompression` | Enable entity-based context compression | +| `maxContextTokens` | Context window override | +| `models.summarize` | Secondary model for summarization | +| `rag.enabled` | Enable/disable RAG semantic search | +| `rag.excludePatterns` | Glob patterns to exclude from indexing | +| `tools.disabled` | Array of tools to disable | +| `tools.defaults` | Default parameters for tools | + --- ## Model Map (Multi-Model Orchestration) diff --git a/src/commands/config-commands.ts b/src/commands/config-commands.ts index 44b2e10..8033965 100644 --- a/src/commands/config-commands.ts +++ b/src/commands/config-commands.ts @@ -81,7 +81,6 @@ export const configCommand: Command = { */ export const initCommand: Command = { name: 'init', - aliases: ['setup'], description: 'Initialize Codi in the current project', usage: '/init [--config] [--modelmap] [--context] [--all]', taskType: 'fast', diff --git a/tests/rag-embeddings.test.ts b/tests/rag-embeddings.test.ts index b501d28..4a8250b 100644 --- a/tests/rag-embeddings.test.ts +++ b/tests/rag-embeddings.test.ts @@ -255,7 +255,8 @@ describe('Embedding Providers', () => { }); it('defaults to Ollama for auto mode (free/local)', () => { - // Even with OpenAI key available, auto mode prefers Ollama + // Auto mode always defaults to Ollama because it's free and local + // Users can explicitly set embeddingProvider: 'openai' if they prefer OpenAI process.env.OPENAI_API_KEY = 'test-key'; const provider = createEmbeddingProvider({ @@ -267,6 +268,7 @@ describe('Embedding Providers', () => { }); it('defaults to Ollama without any API key', () => { + // Ollama is preferred for auto mode because it's free delete process.env.OPENAI_API_KEY; const provider = createEmbeddingProvider({