Skip to content

Stage 4 -- Export via Library with Manifest #228

@SorraTheOrc

Description

@SorraTheOrc

Summary

Promote selected candidates to the library, export WAV files organized by category subdirectories, and write a manifest JSON file alongside the exported audio.

User Story

As a game developer who has finished selecting and reviewing my sound palette in the TUI wizard, I want to export all chosen sounds as WAV files into a project-ready folder with optional category organization and a manifest file, so I can drop the output directly into my game project.

Acceptance Criteria

  • Each selected candidate is promoted to the library via promoteCandidate()
  • WAV files are exported to the user-specified output directory, organized by category subdirectories
  • A manifest.json file is written alongside the WAVs; it is valid JSON parseable by JSON.parse() and contains one entry per exported WAV with fields: recipe, seed, category, intensity, texture, tags, filename
  • The user specifies the output directory via an interactive prompt with a default suggestion (e.g. ./palette-export/)
  • The user can optionally enable or disable category subdirectory organization
  • Progress feedback is displayed during promotion and export operations
  • If a render fails during export, the error message names the recipe and seed that failed
  • Unit tests cover: promote pipeline integration, manifest.json schema validation, directory layout, error handling for failed renders

Minimal Implementation

  • Create src/tui/stages/export.ts
  • For each selection in WizardSession, call promoteCandidate() from src/explore/promote.ts
  • Call exportEntries() from src/library/export.ts with category filter matching the promoted entries
  • Generate manifest.json with full metadata for each exported entry using writeFile()
  • Use @inquirer/prompts input for output directory and confirm for category organization
  • Display success summary with file count and output path

Dependencies

  • Feature 1: TUI Foundation (TF-0MM8S0MHO0033HYE)
  • Feature 6: Stage 3 -- Review and Refine (TF-0MM8S29GD0JJ1WTC)

Deliverables

  • src/tui/stages/export.ts
  • Unit tests in src/tui/tests/

Key References

  • src/explore/promote.ts -- promoteCandidate() function
  • src/library/export.ts -- exportEntries(), ExportOptions, ExportResult
  • src/library/types.ts -- LibraryEntry type
  • demos/card-game-sounds.md -- Acts 9-12 demonstrate promote and export workflow
  • Parent epic: TF-0MM7HULM506CGSOP

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions