- compose-test-sync: fix 3 failing tests (NOTE_TO_MIDI, DrumLoopAnalyzer mock, section name) - generate-song: CLI wrapper + RPP validator (6 structural checks) + 4 e2e tests - reascript-hybrid: ReaScriptGenerator + command protocol + CLI + 16 unit tests - 110/110 tests passing - Full SDD cycle (propose→spec→design→tasks→apply→verify) for all 3 changes
2.1 KiB
2.1 KiB
Tasks: generate-song CLI
Phase 1: Foundation — RPP Validator
- 1.1 Create
src/validator/rpp_validator.pywithvalidate_rpp_output(rpp_path: str) -> list[str] - 1.2 Implement track count check — count
<TRACKblocks, assert == 9 - 1.3 Implement audio path check — regex
<SOURCE WAVE "([^"]+)", verify files exist - 1.4 Implement MIDI note presence check — find
<ITEM>blocks with<SOURCE MIDI>, countNOTE \d+ \d+ \d+entries - 1.5 Implement arrangement duration check — find last item position + length, assert >= 52 bars × 4 beats
- 1.6 Implement send routing check — each non-return track must have
AUXRECV - 1.7 Implement plugin chain check — each non-return track must have
<FXCHAIN>withVSTentry
Phase 2: Core Implementation — CLI Wrapper
- 2.1 Create
scripts/generate.pywith argparse:--bpm(float, default 95),--key(default "Am"),--output(default "output/song.rpp"),--seed(int, default 42),--validate(flag) - 2.2 Add BPM validation — raise
ValueErrorifbpm <= 0 - 2.3 Add output directory creation —
output_path.parent.mkdir(parents=True, exist_ok=True) - 2.4 Wire
compose.main()— setsys.argvand callcompose.main()directly (not subprocess) - 2.5 Wire
--validateflag — callvalidate_rpp_output()andsys.exit(1)on errors
Phase 3: Testing
- 3.1 Write
tests/test_generate_song.py::test_generate_cli_smoke— subprocess call, assert returncode 0, file exists, size > 0 - 3.2 Write
tests/test_generate_song.py::test_validate_passes_for_valid_output— CLI with--validate, asserterrors == [] - 3.3 Write
tests/test_generate_song.py::test_validate_detects_track_count_violation— synthesize 5-track .rpp, assert "Expected 9" in errors - 3.4 Write
tests/test_generate_song.py::test_reproducibility_same_seed— run CLI twice with--seed 42, assert byte-identical output
Phase 4: Verification
- 4.1 Run full test suite —
pytest tests/— verify all 90+ tests pass (existing + new) - 4.2 Run new tests in isolation —
pytest tests/test_generate_song.py -v— confirm 4 tests pass