Skip to content

Commit 0952d98

Browse files
authored
Add non-blocking playback controller (#15)
* Add non-blocking playback controller
1 parent 60b581a commit 0952d98

6 files changed

Lines changed: 1111 additions & 45 deletions

File tree

AGENTS.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,16 @@ This is `reed`, a convenient CLI for text-to-speech using piper-tts.
1616
- Windows: `powershell`/`ffplay` for audio, `powershell Get-Clipboard` for clipboard
1717
- Rich (terminal UI library for styled output)
1818
- Voice models stored in `~/.local/share/reed/` (Linux/macOS) or `%LOCALAPPDATA%\reed\` (Windows)
19+
- `prompt_toolkit` (interactive prompt with history and autocomplete)
1920

2021
## Structure
2122

2223
- `reed.py` — single-file CLI module, installed as console script via pyproject.toml
24+
- `test_reed.py` — comprehensive test suite (TDD approach)
25+
- `ARCHITECTURE.md` — detailed system design, component diagrams, and data flow
26+
- `ROADMAP.md` — feature roadmap with priorities and dependencies
27+
28+
Start here: Read `ARCHITECTURE.md` before implementing features that touch playback, interactive mode, or file processing.
2329

2430
## Commands
2531

@@ -41,6 +47,13 @@ This is `reed`, a convenient CLI for text-to-speech using piper-tts.
4147
- Tests use dependency injection (fake `run`, `stdin`, `print_fn`) to avoid real subprocess calls
4248
- The `reed` module is imported directly (`import reed as _reed`)
4349
- Run full test suite before and after every change: `uv run pytest -v`
50+
- New components: Add tests for `PlaybackController` state transitions, thread safety, and signal handling
51+
52+
## Workflow
53+
54+
- Plan first: Before implementing any feature or fix, outline your approach and identify affected components
55+
- Always run tests after code changes: Verify changes don't break existing functionality
56+
- Use a subagent for running tests to avoid polluting the main conversation context with verbose output
4457

4558
## Conventions
4659

@@ -49,6 +62,9 @@ This is `reed`, a convenient CLI for text-to-speech using piper-tts.
4962
- Use `subprocess` to invoke piper and platform audio player
5063
- Default model auto-downloaded to `_data_dir()` on first run
5164
- `ReedConfig` dataclass for core configuration
65+
- Thread safety: Use `threading.Lock` for shared state in `PlaybackController`
66+
- Non-blocking playback: Interactive mode uses `PlaybackController`; file/output modes use blocking `subprocess.run()`
67+
- Platform checks: Use `os.name == "posix"` for Unix-specific behavior (SIGSTOP/SIGCONT)
5268

5369
## UI Development
5470

@@ -58,3 +74,4 @@ This is `reed`, a convenient CLI for text-to-speech using piper-tts.
5874
- Commands available in interactive mode: `/quit`, `/exit`, `/help`, `/clear`, `/replay`
5975
- Tab autocomplete available for commands
6076
- Include `print_fn` parameter for testability with dependency injection
77+
- Playback state: Future `/pause`, `/play`, `/stop` commands will wire to `PlaybackController` methods

0 commit comments

Comments
 (0)