1{
  2  "$schema": "https://json-schema.org/draft/2020-12/schema",
  3  "$id": "https://github.com/charmbracelet/crush/internal/config/config",
  4  "$ref": "#/$defs/Config",
  5  "$defs": {
  6    "Config": {
  7      "properties": {
  8        "$schema": {
  9          "type": "string"
 10        },
 11        "models": {
 12          "additionalProperties": {
 13            "$ref": "#/$defs/SelectedModel"
 14          },
 15          "type": "object",
 16          "description": "Model configurations for different model types"
 17        },
 18        "providers": {
 19          "additionalProperties": {
 20            "$ref": "#/$defs/ProviderConfig"
 21          },
 22          "type": "object",
 23          "description": "AI provider configurations"
 24        },
 25        "mcp": {
 26          "$ref": "#/$defs/MCPs",
 27          "description": "Model Context Protocol server configurations"
 28        },
 29        "lsp": {
 30          "$ref": "#/$defs/LSPs",
 31          "description": "Language Server Protocol configurations"
 32        },
 33        "options": {
 34          "$ref": "#/$defs/Options",
 35          "description": "General application options"
 36        },
 37        "permissions": {
 38          "$ref": "#/$defs/Permissions",
 39          "description": "Permission settings for tool usage"
 40        }
 41      },
 42      "additionalProperties": false,
 43      "type": "object"
 44    },
 45    "LSPConfig": {
 46      "properties": {
 47        "enabled": {
 48          "type": "boolean",
 49          "description": "Whether this LSP server is disabled",
 50          "default": false
 51        },
 52        "command": {
 53          "type": "string",
 54          "description": "Command to execute for the LSP server",
 55          "examples": [
 56            "gopls"
 57          ]
 58        },
 59        "args": {
 60          "items": {
 61            "type": "string"
 62          },
 63          "type": "array",
 64          "description": "Arguments to pass to the LSP server command"
 65        },
 66        "env": {
 67          "additionalProperties": {
 68            "type": "string"
 69          },
 70          "type": "object",
 71          "description": "Environment variables to set to the LSP server command"
 72        },
 73        "options": {
 74          "description": "LSP server-specific configuration options"
 75        },
 76        "filetypes": {
 77          "items": {
 78            "type": "string",
 79            "examples": [
 80              "go",
 81              "mod",
 82              "rs",
 83              "c",
 84              "js",
 85              "ts"
 86            ]
 87          },
 88          "type": "array",
 89          "description": "File types this LSP server handles"
 90        }
 91      },
 92      "additionalProperties": false,
 93      "type": "object",
 94      "required": [
 95        "command"
 96      ]
 97    },
 98    "LSPs": {
 99      "additionalProperties": {
100        "$ref": "#/$defs/LSPConfig"
101      },
102      "type": "object"
103    },
104    "MCPConfig": {
105      "properties": {
106        "command": {
107          "type": "string",
108          "description": "Command to execute for stdio MCP servers",
109          "examples": [
110            "npx"
111          ]
112        },
113        "env": {
114          "additionalProperties": {
115            "type": "string"
116          },
117          "type": "object",
118          "description": "Environment variables to set for the MCP server"
119        },
120        "args": {
121          "items": {
122            "type": "string"
123          },
124          "type": "array",
125          "description": "Arguments to pass to the MCP server command"
126        },
127        "type": {
128          "type": "string",
129          "enum": [
130            "stdio",
131            "sse",
132            "http"
133          ],
134          "description": "Type of MCP connection",
135          "default": "stdio"
136        },
137        "url": {
138          "type": "string",
139          "format": "uri",
140          "description": "URL for HTTP or SSE MCP servers",
141          "examples": [
142            "http://localhost:3000/mcp"
143          ]
144        },
145        "disabled": {
146          "type": "boolean",
147          "description": "Whether this MCP server is disabled",
148          "default": false
149        },
150        "timeout": {
151          "type": "integer",
152          "description": "Timeout in seconds for MCP server connections",
153          "default": 15,
154          "examples": [
155            30,
156            60,
157            120
158          ]
159        },
160        "headers": {
161          "additionalProperties": {
162            "type": "string"
163          },
164          "type": "object",
165          "description": "HTTP headers for HTTP/SSE MCP servers"
166        }
167      },
168      "additionalProperties": false,
169      "type": "object",
170      "required": [
171        "type"
172      ]
173    },
174    "MCPs": {
175      "additionalProperties": {
176        "$ref": "#/$defs/MCPConfig"
177      },
178      "type": "object"
179    },
180    "Model": {
181      "properties": {
182        "id": {
183          "type": "string"
184        },
185        "name": {
186          "type": "string"
187        },
188        "cost_per_1m_in": {
189          "type": "number"
190        },
191        "cost_per_1m_out": {
192          "type": "number"
193        },
194        "cost_per_1m_in_cached": {
195          "type": "number"
196        },
197        "cost_per_1m_out_cached": {
198          "type": "number"
199        },
200        "context_window": {
201          "type": "integer"
202        },
203        "default_max_tokens": {
204          "type": "integer"
205        },
206        "can_reason": {
207          "type": "boolean"
208        },
209        "has_reasoning_efforts": {
210          "type": "boolean"
211        },
212        "default_reasoning_effort": {
213          "type": "string"
214        },
215        "supports_attachments": {
216          "type": "boolean"
217        }
218      },
219      "additionalProperties": false,
220      "type": "object",
221      "required": [
222        "id",
223        "name",
224        "cost_per_1m_in",
225        "cost_per_1m_out",
226        "cost_per_1m_in_cached",
227        "cost_per_1m_out_cached",
228        "context_window",
229        "default_max_tokens",
230        "can_reason",
231        "has_reasoning_efforts",
232        "supports_attachments"
233      ]
234    },
235    "Options": {
236      "properties": {
237        "context_paths": {
238          "items": {
239            "type": "string",
240            "examples": [
241              ".cursorrules",
242              "CRUSH.md"
243            ]
244          },
245          "type": "array",
246          "description": "Paths to files containing context information for the AI"
247        },
248        "tui": {
249          "$ref": "#/$defs/TUIOptions",
250          "description": "Terminal user interface options"
251        },
252        "debug": {
253          "type": "boolean",
254          "description": "Enable debug logging",
255          "default": false
256        },
257        "debug_lsp": {
258          "type": "boolean",
259          "description": "Enable debug logging for LSP servers",
260          "default": false
261        },
262        "disable_auto_summarize": {
263          "type": "boolean",
264          "description": "Disable automatic conversation summarization",
265          "default": false
266        },
267        "data_directory": {
268          "type": "string",
269          "description": "Directory for storing application data (relative to working directory)",
270          "default": ".crush",
271          "examples": [
272            ".crush"
273          ]
274        },
275        "disabled_tools": {
276          "items": {
277            "type": "string"
278          },
279          "type": "array",
280          "description": "Tools to disable"
281        }
282      },
283      "additionalProperties": false,
284      "type": "object",
285      "required": [
286        "disabled_tools"
287      ]
288    },
289    "Permissions": {
290      "properties": {
291        "allowed_tools": {
292          "items": {
293            "type": "string",
294            "examples": [
295              "bash",
296              "view"
297            ]
298          },
299          "type": "array",
300          "description": "List of tools that don't require permission prompts"
301        }
302      },
303      "additionalProperties": false,
304      "type": "object"
305    },
306    "ProviderConfig": {
307      "properties": {
308        "id": {
309          "type": "string",
310          "description": "Unique identifier for the provider",
311          "examples": [
312            "openai"
313          ]
314        },
315        "name": {
316          "type": "string",
317          "description": "Human-readable name for the provider",
318          "examples": [
319            "OpenAI"
320          ]
321        },
322        "base_url": {
323          "type": "string",
324          "format": "uri",
325          "description": "Base URL for the provider's API",
326          "examples": [
327            "https://api.openai.com/v1"
328          ]
329        },
330        "type": {
331          "type": "string",
332          "enum": [
333            "openai",
334            "anthropic",
335            "gemini",
336            "azure",
337            "vertexai"
338          ],
339          "description": "Provider type that determines the API format",
340          "default": "openai"
341        },
342        "api_key": {
343          "type": "string",
344          "description": "API key for authentication with the provider",
345          "examples": [
346            "$OPENAI_API_KEY"
347          ]
348        },
349        "disable": {
350          "type": "boolean",
351          "description": "Whether this provider is disabled",
352          "default": false
353        },
354        "system_prompt_prefix": {
355          "type": "string",
356          "description": "Custom prefix to add to system prompts for this provider"
357        },
358        "extra_headers": {
359          "additionalProperties": {
360            "type": "string"
361          },
362          "type": "object",
363          "description": "Additional HTTP headers to send with requests"
364        },
365        "extra_body": {
366          "type": "object",
367          "description": "Additional fields to include in request bodies"
368        },
369        "models": {
370          "items": {
371            "$ref": "#/$defs/Model"
372          },
373          "type": "array",
374          "description": "List of models available from this provider"
375        }
376      },
377      "additionalProperties": false,
378      "type": "object"
379    },
380    "SelectedModel": {
381      "properties": {
382        "model": {
383          "type": "string",
384          "description": "The model ID as used by the provider API",
385          "examples": [
386            "gpt-4o"
387          ]
388        },
389        "provider": {
390          "type": "string",
391          "description": "The model provider ID that matches a key in the providers config",
392          "examples": [
393            "openai"
394          ]
395        },
396        "reasoning_effort": {
397          "type": "string",
398          "enum": [
399            "low",
400            "medium",
401            "high"
402          ],
403          "description": "Reasoning effort level for OpenAI models that support it"
404        },
405        "max_tokens": {
406          "type": "integer",
407          "maximum": 200000,
408          "minimum": 1,
409          "description": "Maximum number of tokens for model responses",
410          "examples": [
411            4096
412          ]
413        },
414        "think": {
415          "type": "boolean",
416          "description": "Enable thinking mode for Anthropic models that support reasoning"
417        }
418      },
419      "additionalProperties": false,
420      "type": "object",
421      "required": [
422        "model",
423        "provider"
424      ]
425    },
426    "TUIOptions": {
427      "properties": {
428        "compact_mode": {
429          "type": "boolean",
430          "description": "Enable compact mode for the TUI interface",
431          "default": false
432        },
433        "diff_mode": {
434          "type": "string",
435          "enum": [
436            "unified",
437            "split"
438          ],
439          "description": "Diff mode for the TUI interface"
440        }
441      },
442      "additionalProperties": false,
443      "type": "object"
444    }
445  }
446}