# Content Scripts Migration Plan

## Overview
After migrating from meta.toml + frontmatter to frontmatter-only approach, these scripts need updates:

## ✅ COMPLETED SCRIPTS
- ✅ `build-localized-content-updated.nu` - New frontmatter-only version
- ✅ `migrate-frontmatter.sh` - One-time migration script (completed)
- ✅ `organize-frontmatter.sh` - One-time organization script (completed)
- ✅ `verify-clean-structure.sh` - Verification script (updated)

## 🔄 SCRIPTS TO UPDATE

### 1. `validate-content.nu` 
**Issues:**
- Still expects meta.toml files
- Validation rules need frontmatter-only updates

**Required Changes:**
- Remove meta.toml validation
- Add frontmatter structure validation
- Update required field checks

### 2. `content-manager.nu`
**Issues:** 
- May create/expect meta.toml files
- Content creation templates need updates

**Required Changes:**
- Update content templates to frontmatter-only
- Remove meta.toml creation logic
- Update content validation rules

### 3. `generate-content.nu`
**Issues:**
- Content generation may use old structure
- Template generation for meta.toml

**Required Changes:**
- Update content templates
- Generate frontmatter-only markdown
- Remove meta.toml generation

### 4. `sync-translations.nu`
**Issues:**
- Translation sync may expect meta.toml
- Field mapping needs updates

**Required Changes:**
- Update to work with frontmatter fields only
- Sync category/tag translations in frontmatter
- Remove meta.toml translation logic

### 5. `validate-content-consistency.nu` 
**Issues:**
- Consistency checks between meta.toml and frontmatter
- Now redundant checks

**Required Changes:**
- Remove meta.toml consistency checks
- Add frontmatter internal consistency checks
- Validate required frontmatter fields

### 6. `validate-id-consistency.nu`
**Issues:**
- May check ID consistency across meta.toml and markdown

**Required Changes:**
- Focus only on frontmatter ID validation
- Remove meta.toml references
- Validate slug/ID consistency in frontmatter

## 🔧 HOT-RELOAD SYSTEM UPDATES

### Build System Integration
**Files to update:**
- `crates/tools/src/build/build_tasks/content_processing.rs`
- `crates/server/src/content/watcher.rs` 
- Hot-reload detection logic

**Changes needed:**
- Remove meta.toml file watching
- Update content change detection
- Ensure generated files go to correct location

### Development Workflow
**Commands to update:**
- `just dev` - Hot-reload with new structure
- `just content-build` - Use updated scripts
- Development file watching

## 📋 IMPLEMENTATION PRIORITY

### Phase 1: Critical Scripts (Immediate)
1. Replace `build-localized-content.nu` with `build-localized-content-updated.nu`
2. Update `validate-content.nu` for frontmatter-only
3. Update `content-manager.nu` for new content creation

### Phase 2: Content Management (Next)
4. Update `generate-content.nu`
5. Update `sync-translations.nu`
6. Update consistency validation scripts

### Phase 3: Development Integration (Final)
7. Update hot-reload system
8. Update build system integration
9. Update development commands

## 🎯 SUCCESS CRITERIA

- ✅ All scripts work with frontmatter-only content
- ✅ No references to meta.toml files
- ✅ Generated content only in public/static-content
- ✅ Hot-reload works with clean structure
- ✅ Content validation covers all frontmatter fields
- ✅ New content creation follows standard format

## 🚀 QUICK START

Replace the main build script immediately:
```bash
# Backup current script
mv scripts/content/build-localized-content.nu scripts/content/build-localized-content-old.nu

# Use updated version
mv scripts/content/build-localized-content-updated.nu scripts/content/build-localized-content.nu

# Make executable
chmod +x scripts/content/build-localized-content.nu
```
