@@ -1,182 +0,0 @@
1−# Crush Configuration Schema Generator
3−This tool automatically generates a JSON Schema for the Crush configuration file by using Go reflection to analyze the configuration structs. The schema provides validation, autocompletion, and documentation for configuration files.
7−- **Automated Generation**: Uses reflection to automatically generate schemas from Go structs
8−- **Always Up-to-Date**: Schema stays in sync with code changes automatically
9−- **Comprehensive**: Includes all configuration options, types, and validation rules
10−- **Enhanced**: Adds provider enums, model lists, and custom descriptions
11−- **Extensible**: Easy to add new fields and modify existing ones
17−go run cmd/schema/main.go > crush-schema.json
19−# Or use the task runner
27−1. **Reflects on Config Structs**: Analyzes the `config.Config` struct and all related types
28−2. **Generates Base Schema**: Creates JSON Schema definitions for all struct fields
29−3. **Enhances with Runtime Data**: Adds provider lists, model enums, and tool lists from the actual codebase
30−4. **Adds Custom Descriptions**: Provides meaningful descriptions for configuration options
31−5. **Sets Default Values**: Includes appropriate defaults for optional fields
35−The generated schema includes:
37−- **Type Safety**: Proper type definitions for all configuration fields
38−- **Validation**: Required fields, enum constraints, and format validation
39−- **Documentation**: Descriptions for all configuration options
40−- **Defaults**: Default values for optional settings
41−- **Provider Enums**: Current list of supported providers
42−- **Model Enums**: Available models from all configured providers
43−- **Tool Lists**: Valid tool names for agent configurations
44−- **Cross-References**: Proper relationships between different config sections
46−## Adding New Configuration Fields
48−To add new configuration options:
50−1. **Add to Config Structs**: Add the field to the appropriate struct in `internal/config/`
51−2. **Add JSON Tags**: Include proper JSON tags with field names
52−3. **Regenerate Schema**: Run the schema generator to update the JSON schema
53−4. **Update Validation**: Add any custom validation logic if needed
58− // ... existing fields ...
60− // New field with JSON tag and description
61− NewFeature bool `json:"new_feature,omitempty"`
65−The schema generator will automatically:
66−- Detect the new field
67−- Generate appropriate JSON schema
68−- Add type information
69−- Include in validation
73−### Editor Integration
75−Most modern editors support JSON Schema:
77−**VS Code**: Add to your workspace settings:
82− "fileMatch": ["crush.json", ".crush.json"],
83− "url": "./crush-schema.json"
89−**JetBrains IDEs**: Configure in Settings → Languages & Frameworks → Schemas and DTDs → JSON Schema Mappings
94−# Using jsonschema (Python)
95−pip install jsonschema
96−jsonschema -i crush.json crush-schema.json
98−# Using ajv-cli (Node.js)
99−npm install -g ajv-cli
100−ajv validate -s crush-schema.json -d crush.json
103−### Configuration Example
109− "model_id": "claude-3-5-sonnet-20241022",
110− "provider": "anthropic",
111− "reasoning_effort": "medium",
115− "model_id": "claude-3-5-haiku-20241022",
116− "provider": "anthropic"
122− "provider_type": "anthropic",
123− "api_key": "your-api-key",
135− "id": "custom-agent",
136− "name": "Custom Agent",
137− "description": "A custom agent for specific tasks",
139− "allowed_tools": ["glob", "grep", "view"],
141− "filesystem": ["read", "write"]
147− "command": "mcp-filesystem",
148− "args": ["--root", "/workspace"],
154− "command": "typescript-language-server",
155− "args": ["--stdio"],
165− "data_directory": ".crush",
168− "compact_mode": false
176−The schema generator is designed to be maintenance-free. As long as:
178−- Configuration structs have proper JSON tags
179−- New enums are added to the enhancement functions
180−- The generator is run after significant config changes
182−The schema will stay current with the codebase automatically.