# Synchronization with /schemas/kogral/

This directory (`.typedialog/kogral/`) is the **source of truth** for all KOGRAL configuration schemas.

## File Mapping

| .typedialog/kogral | /schemas/kogral | Purpose |
|--------------------|-----------------|---------|
| core/contracts.ncl | contracts.ncl | Type contracts + validation |
| core/defaults.ncl | defaults.ncl | Base configuration |
| core/helpers.ncl | helpers.ncl | Utility functions |
| modes/dev.ncl | modes/dev.ncl | Development overrides |
| modes/prod.ncl | modes/prod.ncl | Production overrides |
| modes/test.ncl | modes/test.ncl | Test overrides |

## Build Integration

1. **Edit here** (`.typedialog/kogral/`)
2. **Build copies to** `/schemas/kogral/` 
3. **Rust crate uses** from `/schemas/kogral/`

### Justfile Target

```bash
just dev::sync-config   # Sync .typedialog → /schemas/
```

### Manual Sync

```bash
cp -r .typedialog/kogral/core/* schemas/kogral/
cp -r .typedialog/kogral/modes/* schemas/kogral/modes/
```

## When to Update

- **Configuration changes** → Update in `.typedialog/kogral/core/` or `.typedialog/kogral/modes/`
- **Add new mode** → Add `.typedialog/kogral/modes/new-mode.ncl`
- **New scripts** → Add to `.typedialog/kogral/scripts/`
- **Helper functions** → Update `.typedialog/kogral/core/helpers.ncl`

## Validation

```bash
# Validate all schemas
nickel export --format json .typedialog/kogral/core/contracts.ncl
nickel export --format json .typedialog/kogral/modes/dev.ncl
nickel export --format json .typedialog/kogral/modes/prod.ncl
```

## Never Edit

❌ Do NOT directly edit `/schemas/kogral/` files
✅ Always edit in `.typedialog/kogral/` instead

This ensures a single source of truth and prevents divergence.
