# User Configuration Specification

## Purpose

Store and manage user preferences and settings.

## Requirements

### Requirement: Key-Value Storage

The system SHALL store user configuration as JSONB key-value pairs.

#### Scenario: Store preferences
- GIVEN an authenticated user
- WHEN they update their settings
- THEN the configuration is stored in the UserConfig model

### Requirement: Supported Config Keys

The system SHALL support specific configuration keys.

#### Scenario: Supported keys
- GIVEN the configuration system
- THEN these keys SHALL be supported:
  - `default_editor`: Preferred code editor
  - `theme`: UI theme preference
  - `git_user_name`: Git commit author name
  - `git_user_email`: Git commit author email

### Requirement: Config Retrieval

The system SHALL return user configuration.

#### Scenario: Get config
- GIVEN an authenticated user
- WHEN they access settings
- THEN their current configuration is returned

### Requirement: Config Updates

The system SHALL support partial configuration updates.

#### Scenario: Update single key
- GIVEN an authenticated user with existing config
- WHEN they update just the theme
- THEN only that key is modified
- AND other keys remain unchanged

### Requirement: Frontend Integration

The system SHALL apply configuration in the frontend.

#### Scenario: Apply theme
- GIVEN a user with theme preference set
- WHEN they load the application
- THEN the selected theme is applied

## Dependencies

- Database models: UserConfig, User
- auth-oauth (authenticated users)

## Quality Gates

- `pytest` must pass
- `mypy .` must pass
- `ruff check .` must pass
- `npm run typecheck` must pass
- `npm run lint` must pass
