Structure Migration
Migrate from legacy scattered structure to consolidated Astro content collections.
Frontmatter
yaml
context: main allowed-tools: Read, Write, Edit, Bash, Glob, Grep
Prerequisites
- •Existing class folders with
scripts.jscontainingwindow.NARRATION_SCRIPTS - •Existing presentations in
src/pages/class-{n}-{topic}/ - •Audio files in
class-{n}-{topic}/audio/orpublic/audio/class-{n}/
Instructions
Phase 1: Create Content Collection Structure
- •Create
src/content/config.tswith collection schemas - •Create
src/content/classes/directory
Phase 2: Convert Narration Scripts
For each class with a scripts.js:
- •Read
class-{n}-{topic}/scripts.js - •Parse
window.NARRATION_SCRIPTSobject - •Generate
narration.jsonwith structure:
json
{
"classNumber": 4,
"topic": "competitive-positioning",
"voice": "Rachel",
"model": "eleven_multilingual_v2",
"slides": {
"1": {
"ssml": "Welcome to Class 4...",
"plainText": "Welcome to Class 4...",
"estimatedDuration": null
}
}
}
- •Write to
src/content/classes/{n}-{topic}/narration.json
Phase 3: Generate Audio Manifests
For each class:
- •Find all existing audio files
- •Hash the corresponding narration text
- •Extract slide signature from presentation
- •Generate
audio-manifest.json:
json
{
"generatedAt": "2024-01-20T14:30:00Z",
"voiceId": "Rachel",
"sourceNarrationHash": "abc123",
"slides": {
"1": {
"audioFile": "slide-01.mp3",
"narrationTextHash": "def456",
"slideSignature": {
"number": 1,
"title": "Introduction",
"type": "slide-title"
},
"status": "current"
}
}
}
Phase 4: Move Spec Files
For each class:
- •Move
class-{n}-{topic}/lesson-plan-{topic}.md→src/content/classes/{n}-{topic}/lesson-plan.md - •Move
class-{n}-{topic}/presentation-spec-{topic}.md→src/content/classes/{n}-{topic}/presentation-spec.md - •If
class-{n}-{topic}/script.mdexists, archive tosrc/content/classes/{n}-{topic}/script.md.archive
Phase 5: Consolidate Audio
- •If audio in
class-{n}-{topic}/audio/, move topublic/audio/class-{n}/ - •Ensure consistent naming:
slide-01.mp3,slide-02.mp3, etc.
Phase 6: Handle Visualization Scripts
For each class with D3 visualizations in scripts.js:
- •Extract non-narration JS (D3 code, etc.)
- •Create
src/scripts/visualizations/class-{n}/index.ts - •Update presentation.astro imports
Phase 7: Cleanup
- •Delete redundant
public/class-{n}-{topic}/scripts.js - •Delete empty legacy
class-{n}-{topic}/folders (after confirming migration) - •Update
.gitignoreif needed
Output Files
| File | Location | Purpose |
|---|---|---|
config.ts | src/content/ | Collection schemas |
narration.json | src/content/classes/{n}-{topic}/ | Slide narration text |
audio-manifest.json | src/content/classes/{n}-{topic}/ | Audio sync tracking |
lesson-plan.md | src/content/classes/{n}-{topic}/ | Instructional design |
presentation-spec.md | src/content/classes/{n}-{topic}/ | Slide specifications |
Rollback
If migration fails:
- •Content collection files are additive (don't delete originals until verified)
- •Git history preserves all original files
- •Run
/artifact-statusto verify completeness before cleanup
Post-Migration Verification
Run /artifact-status which will check:
- •All classes have content in new location
- •All narration.json files are valid
- •All audio-manifest.json files exist
- •Audio sync status for each slide