|
| 1 | +# CodingBuddy Configuration Schema |
| 2 | + |
| 3 | +This document describes the configuration schema for CodingBuddy. The configuration file provides project context to AI assistants without overriding `.ai-rules`. |
| 4 | + |
| 5 | +## Quick Start |
| 6 | + |
| 7 | +Create a `codingbuddy.config.js` file in your project root: |
| 8 | + |
| 9 | +```javascript |
| 10 | +module.exports = { |
| 11 | + language: 'ko', |
| 12 | + projectName: 'my-awesome-app', |
| 13 | + techStack: { |
| 14 | + frontend: ['React', 'TypeScript'], |
| 15 | + backend: ['NestJS'], |
| 16 | + }, |
| 17 | +}; |
| 18 | +``` |
| 19 | + |
| 20 | +## Configuration File Formats |
| 21 | + |
| 22 | +CodingBuddy supports multiple configuration file formats (in priority order): |
| 23 | + |
| 24 | +1. `codingbuddy.config.js` - JavaScript (recommended, supports dynamic values) |
| 25 | +2. `codingbuddy.config.json` - JSON |
| 26 | +3. `.codingbuddyrc` - RC file format |
| 27 | + |
| 28 | +## Schema Reference |
| 29 | + |
| 30 | +### Basic Settings |
| 31 | + |
| 32 | +| Field | Type | Description | Example | |
| 33 | +|-------|------|-------------|---------| |
| 34 | +| `language` | `string` | Response language for AI | `'ko'`, `'en'`, `'ja'` | |
| 35 | +| `projectName` | `string` | Project name | `'my-app'` | |
| 36 | +| `description` | `string` | Project description | `'E-commerce platform'` | |
| 37 | +| `repository` | `string` | Repository URL | `'https://github.com/...'` | |
| 38 | + |
| 39 | +### Tech Stack (`techStack`) |
| 40 | + |
| 41 | +Configure your project's technology stack: |
| 42 | + |
| 43 | +```javascript |
| 44 | +techStack: { |
| 45 | + // Basic (Nested) |
| 46 | + languages: ['TypeScript', 'Python'], |
| 47 | + frontend: ['React', 'Next.js', 'Tailwind CSS'], |
| 48 | + backend: ['NestJS', 'Express'], |
| 49 | + database: ['PostgreSQL', 'Redis'], |
| 50 | + infrastructure: ['Docker', 'AWS', 'Kubernetes'], |
| 51 | + tools: ['ESLint', 'Prettier', 'Husky'], |
| 52 | + |
| 53 | + // Deep (Optional) - detailed tech info |
| 54 | + details: { |
| 55 | + 'TypeScript': { |
| 56 | + version: '5.x', |
| 57 | + notes: 'Strict mode enabled' |
| 58 | + } |
| 59 | + } |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +| Field | Type | Description | |
| 64 | +|-------|------|-------------| |
| 65 | +| `languages` | `string[]` | Programming languages | |
| 66 | +| `frontend` | `string[]` | Frontend frameworks/libraries | |
| 67 | +| `backend` | `string[]` | Backend frameworks/libraries | |
| 68 | +| `database` | `string[]` | Databases and data stores | |
| 69 | +| `infrastructure` | `string[]` | Infrastructure/DevOps tools | |
| 70 | +| `tools` | `string[]` | Development tools | |
| 71 | +| `details` | `Record<string, TechDetail>` | (Deep) Detailed tech info | |
| 72 | + |
| 73 | +### Architecture (`architecture`) |
| 74 | + |
| 75 | +Define your project's architecture: |
| 76 | + |
| 77 | +```javascript |
| 78 | +architecture: { |
| 79 | + // Basic (Nested) |
| 80 | + pattern: 'feature-sliced', |
| 81 | + structure: ['src/', 'app/', 'features/', 'entities/', 'shared/'], |
| 82 | + componentStyle: 'feature-based', |
| 83 | + |
| 84 | + // Deep (Optional) - layer definitions |
| 85 | + layers: [ |
| 86 | + { name: 'app', path: 'src/app', description: 'Application layer' }, |
| 87 | + { name: 'features', path: 'src/features', dependencies: ['entities', 'shared'] } |
| 88 | + ] |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +| Field | Type | Description | |
| 93 | +|-------|------|-------------| |
| 94 | +| `pattern` | `string` | Architecture pattern (`'layered'`, `'hexagonal'`, `'clean'`, `'feature-sliced'`, etc.) | |
| 95 | +| `structure` | `string[]` | Key directory paths | |
| 96 | +| `componentStyle` | `string` | Component organization (`'flat'`, `'grouped'`, `'feature-based'`) | |
| 97 | +| `layers` | `ArchitectureLayer[]` | (Deep) Layer definitions | |
| 98 | + |
| 99 | +### Conventions (`conventions`) |
| 100 | + |
| 101 | +Specify coding conventions: |
| 102 | + |
| 103 | +```javascript |
| 104 | +conventions: { |
| 105 | + // Basic (Nested) |
| 106 | + style: 'airbnb', |
| 107 | + naming: { |
| 108 | + files: 'kebab-case', |
| 109 | + components: 'PascalCase', |
| 110 | + functions: 'camelCase', |
| 111 | + variables: 'camelCase', |
| 112 | + constants: 'UPPER_SNAKE_CASE' |
| 113 | + }, |
| 114 | + importOrder: ['react', '@/', '~/', '.'], |
| 115 | + maxLineLength: 100, |
| 116 | + semicolons: true, |
| 117 | + quotes: 'single', |
| 118 | + |
| 119 | + // Deep (Optional) - custom rules |
| 120 | + rules: { |
| 121 | + 'no-console': 'warn' |
| 122 | + } |
| 123 | +} |
| 124 | +``` |
| 125 | + |
| 126 | +| Field | Type | Description | |
| 127 | +|-------|------|-------------| |
| 128 | +| `style` | `string` | Style guide (`'airbnb'`, `'google'`, `'standard'`, `'prettier'`) | |
| 129 | +| `naming` | `NamingConvention` | Naming convention rules | |
| 130 | +| `importOrder` | `string[]` | Import ordering preference | |
| 131 | +| `maxLineLength` | `number` | Maximum line length | |
| 132 | +| `semicolons` | `boolean` | Use semicolons | |
| 133 | +| `quotes` | `string` | Quote style (`'single'`, `'double'`) | |
| 134 | +| `rules` | `Record<string, unknown>` | (Deep) Custom linting rules | |
| 135 | + |
| 136 | +### Test Strategy (`testStrategy`) |
| 137 | + |
| 138 | +Configure testing approach: |
| 139 | + |
| 140 | +```javascript |
| 141 | +testStrategy: { |
| 142 | + approach: 'tdd', |
| 143 | + frameworks: ['vitest', 'playwright'], |
| 144 | + coverage: 80, |
| 145 | + unitTestPattern: 'colocated', |
| 146 | + e2eDirectory: 'e2e/', |
| 147 | + mockingStrategy: 'minimal' |
| 148 | +} |
| 149 | +``` |
| 150 | + |
| 151 | +| Field | Type | Description | |
| 152 | +|-------|------|-------------| |
| 153 | +| `approach` | `string` | Testing approach (`'tdd'`, `'bdd'`, `'test-after'`, `'mixed'`) | |
| 154 | +| `frameworks` | `string[]` | Test frameworks | |
| 155 | +| `coverage` | `number` | Target coverage percentage (0-100) | |
| 156 | +| `unitTestPattern` | `string` | Unit test location (`'colocated'`, `'separate'`) | |
| 157 | +| `e2eDirectory` | `string` | E2E test directory | |
| 158 | +| `mockingStrategy` | `string` | Mocking approach (`'minimal'`, `'extensive'`, `'no-mocks'`) | |
| 159 | + |
| 160 | +### Additional Context |
| 161 | + |
| 162 | +```javascript |
| 163 | +// Key files AI should be aware of |
| 164 | +keyFiles: [ |
| 165 | + 'src/core/types.ts', |
| 166 | + 'docs/architecture.md', |
| 167 | + 'CONTRIBUTING.md' |
| 168 | +], |
| 169 | + |
| 170 | +// Topics or areas to avoid |
| 171 | +avoid: [ |
| 172 | + 'legacy-api', |
| 173 | + 'deprecated-module' |
| 174 | +], |
| 175 | + |
| 176 | +// Custom freeform context |
| 177 | +custom: { |
| 178 | + team: 'Platform Team', |
| 179 | + domain: 'E-commerce' |
| 180 | +} |
| 181 | +``` |
| 182 | + |
| 183 | +## Complete Example |
| 184 | + |
| 185 | +```javascript |
| 186 | +// codingbuddy.config.js |
| 187 | +module.exports = { |
| 188 | + // Basic |
| 189 | + language: 'ko', |
| 190 | + projectName: 'wishket-platform', |
| 191 | + description: 'Freelancer marketplace platform', |
| 192 | + repository: 'https://github.com/example/wishket-platform', |
| 193 | + |
| 194 | + // Tech Stack |
| 195 | + techStack: { |
| 196 | + languages: ['TypeScript'], |
| 197 | + frontend: ['React', 'Next.js', 'Tailwind CSS', 'React Query'], |
| 198 | + backend: ['NestJS', 'TypeORM'], |
| 199 | + database: ['PostgreSQL', 'Redis'], |
| 200 | + infrastructure: ['Docker', 'AWS ECS', 'GitHub Actions'], |
| 201 | + }, |
| 202 | + |
| 203 | + // Architecture |
| 204 | + architecture: { |
| 205 | + pattern: 'feature-sliced', |
| 206 | + structure: ['src/app', 'src/features', 'src/entities', 'src/shared'], |
| 207 | + componentStyle: 'feature-based', |
| 208 | + }, |
| 209 | + |
| 210 | + // Conventions |
| 211 | + conventions: { |
| 212 | + style: 'airbnb', |
| 213 | + naming: { |
| 214 | + files: 'kebab-case', |
| 215 | + components: 'PascalCase', |
| 216 | + functions: 'camelCase', |
| 217 | + }, |
| 218 | + quotes: 'single', |
| 219 | + semicolons: true, |
| 220 | + }, |
| 221 | + |
| 222 | + // Test Strategy |
| 223 | + testStrategy: { |
| 224 | + approach: 'tdd', |
| 225 | + frameworks: ['vitest', 'playwright'], |
| 226 | + coverage: 80, |
| 227 | + unitTestPattern: 'colocated', |
| 228 | + mockingStrategy: 'minimal', |
| 229 | + }, |
| 230 | + |
| 231 | + // Additional |
| 232 | + keyFiles: ['src/shared/types/index.ts', 'docs/api.md'], |
| 233 | + avoid: ['legacy-v1-api'], |
| 234 | +}; |
| 235 | +``` |
| 236 | + |
| 237 | +## TypeScript Types |
| 238 | + |
| 239 | +Import types for type-safe configuration: |
| 240 | + |
| 241 | +```typescript |
| 242 | +import type { CodingBuddyConfig } from 'codingbuddy/config'; |
| 243 | + |
| 244 | +const config: CodingBuddyConfig = { |
| 245 | + language: 'en', |
| 246 | + // ... IDE autocomplete works here |
| 247 | +}; |
| 248 | + |
| 249 | +module.exports = config; |
| 250 | +``` |
| 251 | + |
| 252 | +## Validation |
| 253 | + |
| 254 | +The configuration is validated at runtime using Zod schemas. Invalid configurations will produce clear error messages: |
| 255 | + |
| 256 | +``` |
| 257 | +Error: Invalid configuration |
| 258 | + - techStack.coverage: Expected number, received string |
| 259 | + - conventions.quotes: Invalid enum value. Expected 'single' | 'double' |
| 260 | +``` |
| 261 | + |
| 262 | +## Notes |
| 263 | + |
| 264 | +- **All fields are optional** - start with what you need |
| 265 | +- **No rule override** - this config provides context only; `.ai-rules` rules remain unchanged |
| 266 | +- **AI context only** - this information helps AI understand your project better |
0 commit comments