# Init: JSON Schema Deployment

> Reference for step-00-init.md — cache-based schema deployment.

## Cache-Based Deployment Logic

### Step 1: Check Deployment Cache

Cache file location: `docs/{app}/business-analyse/.schema-cache.json`

```
IF EXISTS .schema-cache.json:
  Read cache file
  IF cache.version == "{CLI_VERSION}" (from package.json):
    Display: "Schemas already deployed ({CLI_VERSION}) - skipping"
    SKIP deployment → Go to Step 9
  ELSE:
    Display: "Schema version mismatch (cache: {cache.version}, current: {CLI_VERSION})"
    Proceed to deployment
ELSE:
  Display: "Deploying schemas (first time)..."
  Proceed to deployment
```

### Step 2: Deploy Schemas (if needed)

Source: `schemas/` (relative to skill root = `~/.claude/skills/business-analyse/schemas/`)
Destination: `docs/{app}/business-analyse/schemas/`

```
docs/{app}/business-analyse/schemas/
├── feature-schema.json
├── application-schema.json
├── sections/
│   ├── metadata-schema.json
│   ├── discovery-schema.json
│   ├── analysis-schema.json
│   ├── specification-schema.json
│   ├── validation-schema.json
│   └── handoff-schema.json
└── shared/
    └── common-defs.json
```

**Total: 9 files to deploy.**

### Step 3: Write Cache File

```json
{
  "version": "{CLI_VERSION}",
  "deployedAt": "{ISO timestamp}",
  "schemas": [
    "feature-schema.json",
    "application-schema.json",
    "sections/metadata-schema.json",
    "sections/discovery-schema.json",
    "sections/analysis-schema.json",
    "sections/specification-schema.json",
    "sections/validation-schema.json",
    "sections/handoff-schema.json",
    "shared/common-defs.json"
  ]
}
```
