- Task 1 complete: asyncio REPL entry point wiring all Phase 2 modules - Task 2: hardware acceptance checkpoint awaiting user verification on Pi+ESP32 - SUMMARY.md documents AppState pattern and TUI integration design - STATE.md updated, ROADMAP.md Phase 2 marked Complete
108 lines
4.1 KiB
Markdown
108 lines
4.1 KiB
Markdown
---
|
|
phase: 02-app-core-audio
|
|
plan: "06"
|
|
subsystem: cli
|
|
tags: [asyncio, repl, led-sync, miniaudio, aubio, sounddevice, udp, choreography]
|
|
|
|
# Dependency graph
|
|
requires:
|
|
- phase: 02-app-core-audio
|
|
provides: "AudioPlayer, BeatDetector, ChoreographyScheduler, ESP32Transport, ChoreoFile/ChoreoEvent models"
|
|
|
|
provides:
|
|
- "src/led_sync/main.py — asyncio entry point + CLI REPL wiring all Phase 2 modules (D-13/D-14)"
|
|
- "src/led_sync/__main__.py — python -m led_sync invocation support"
|
|
- "led-sync script entry point in pyproject.toml"
|
|
affects:
|
|
- "03-textual-tui — TUI phase will import AppState, handle_command, and module instances from main.py"
|
|
|
|
# Tech tracking
|
|
tech-stack:
|
|
added: []
|
|
patterns:
|
|
- "AppState container pattern for TUI-friendly module composition"
|
|
- "asyncio REPL with run_in_executor for non-blocking stdin reads"
|
|
- "Unified play/pause/resume/seek/stop dispatching to both AudioPlayer and ChoreographyScheduler"
|
|
|
|
key-files:
|
|
created:
|
|
- src/led_sync/main.py
|
|
- src/led_sync/__main__.py
|
|
modified:
|
|
- pyproject.toml
|
|
|
|
key-decisions:
|
|
- "AppState class holds all module instances — designed for Phase 3 TUI integration (reuse same objects)"
|
|
- "run_in_executor(None, input, ...) pattern for non-blocking REPL input in asyncio loop"
|
|
- "BeatDetector instance created lazily on 'beat on' command to avoid audio device allocation at startup"
|
|
|
|
patterns-established:
|
|
- "handle_command(line, state) -> bool: single async dispatcher, returns False only on quit"
|
|
- "async_main() creates transport + scheduler, runs repl(), cleans up in finally block"
|
|
|
|
requirements-completed: [AUD-01, AUD-02, AUD-03, AUD-04, CHR-04, CHR-05]
|
|
|
|
# Metrics
|
|
duration: 5min
|
|
completed: 2026-04-03
|
|
---
|
|
|
|
# Phase 02 Plan 06: Main Entry Point Summary
|
|
|
|
**asyncio REPL entry point wiring AudioPlayer + ChoreographyScheduler + BeatDetector + ESP32Transport into `python -m led_sync <ip>` CLI**
|
|
|
|
## Performance
|
|
|
|
- **Duration:** ~5 min
|
|
- **Started:** 2026-04-03T12:53:35Z
|
|
- **Completed:** 2026-04-03T12:58:00Z
|
|
- **Tasks:** 1 of 2 (Task 2 is hardware checkpoint — awaiting user verification)
|
|
- **Files modified:** 3
|
|
|
|
## Accomplishments
|
|
|
|
- Created `src/led_sync/main.py` with AppState, full D-13 REPL command set, asyncio REPL loop
|
|
- Created `src/led_sync/__main__.py` enabling `python -m led_sync` invocation
|
|
- Added `led-sync` script entry point to pyproject.toml
|
|
- `uv run python -m led_sync --help` verified working; AST validation confirmed all module imports
|
|
|
|
## Task Commits
|
|
|
|
1. **Task 1: Main entry point and asyncio REPL** - `e544d57` (feat)
|
|
|
|
**Checkpoint reached:** Task 2 (hardware acceptance test) requires user verification on Raspberry Pi + ESP32.
|
|
|
|
## Files Created/Modified
|
|
|
|
- `/home/claude/keineahnungirgendeintesthalt/src/led_sync/main.py` — Full CLI entry point: AppState, handle_command dispatcher, repl(), async_main(), main()
|
|
- `/home/claude/keineahnungirgendeintesthalt/src/led_sync/__main__.py` — Module invocation entry (delegates to main.py:main)
|
|
- `/home/claude/keineahnungirgendeintesthalt/pyproject.toml` — Added [project.scripts] led-sync entry point
|
|
|
|
## Decisions Made
|
|
|
|
- AppState class holds all module instances — structured for Phase 3 Textual TUI to import and reuse these same objects without refactoring
|
|
- BeatDetector created lazily on `beat on` command — avoids claiming audio device at startup
|
|
- `run_in_executor(None, input, "> ")` pattern for non-blocking stdin in asyncio — standard pattern for asyncio REPLs per plan research
|
|
|
|
## Deviations from Plan
|
|
|
|
None — plan executed exactly as written.
|
|
|
|
## Issues Encountered
|
|
|
|
None.
|
|
|
|
## User Setup Required
|
|
|
|
None — no external service configuration required. Hardware verification in Task 2 is a checkpoint for the user to perform on-device.
|
|
|
|
## Next Phase Readiness
|
|
|
|
- Phase 2 headless CLI is complete pending hardware acceptance in Task 2
|
|
- Phase 3 Textual TUI can import `AppState`, `handle_command`, and module instances from `main.py` directly
|
|
- All module APIs are asyncio-compatible: AudioPlayer (thread), BeatDetector (call_soon_threadsafe bridge), ChoreographyScheduler (asyncio Task), ESP32Transport (DatagramProtocol)
|
|
|
|
---
|
|
*Phase: 02-app-core-audio*
|
|
*Completed: 2026-04-03*
|