First-run UX: dpub doctor, dpub setup, auto-discovery, scripts/build.sh#30
Merged
Conversation
Closes the rough edges between `git clone` and a fully-working
`dpub convert --transcribe ...`. Tier A + B from the approved
plan in .claude/plans/can-you-look-at-quirky-allen.md.
What's new
* `dpub doctor` — diagnostic showing build state (version + GPU
acceleration), every runtime prerequisite (epubcheck, ace,
ffmpeg), and Whisper model cache contents. Pretty output by
default; --json for CI/pipeline use.
* `dpub setup --whisper-model <size>` — downloads any of tiny,
base, small, medium, large-v3 from huggingface.co/ggerganov/
whisper.cpp into ~/.cache/dpub/models/ (or %LOCALAPPDATA% on
Windows) with SHA256 verification. Atomic .partial rename;
skips re-download when an existing file's hash matches.
* `scripts/build.sh` — host-aware release build wrapper.
Auto-picks --features metal on Apple Silicon, --features cuda
on Linux+nvcc, CPU-only fallback. Pre-flights `cmake` with a
platform-specific install hint.
* `dpub convert --transcribe nl` (no --whisper-model) now
auto-discovers the most-recently-modified ggml-*.bin in the
cache. On a TTY with no cached model, prompts to download
ggml-medium.bin instead of failing. Suppressed by
DPUB_NONINTERACTIVE=1 or non-TTY stdin/stderr.
* `dpub doctor --install` — opt-in best-effort installer that
invokes brew (macOS) or apt-get / dnf (Linux) for each
missing tool, with per-tool consent unless --yes is given.
Never tries to install Java. Windows prints commands only.
Implementation
* New crates/dpub-cli/src/doctor.rs — Tool/Status/Report types,
one detector per tool, JSON serialisation.
* New crates/dpub-cli/src/setup.rs — model URL+SHA table, cache
dir helper, streaming download with hashing, progress bar.
* New crates/dpub-cli/src/install.rs — platform-branched
installer plan + runner with consent gate.
* dpub-meta gains a public `agent()` and `download_to_writer`
helper, reusing the existing ureq machinery for whisper
model downloads.
* Workspace adds sha2 (for verification) and walkdir (already
pinned) — no new heavy deps.
Verification
* cargo test --workspace --no-fail-fast — all 25 suites green
(existing 22 + 8 new tests across doctor.rs, setup.rs,
install.rs).
* cargo clippy --all-targets -- -D warnings — clean.
* Manual smoke: dpub doctor reports honest state on the
maintainer's Mac. dpub setup --whisper-model tiny downloads
+ verifies in ~10s; doctor flips to ✓.
* EPUBCheck baseline preserved — no edits to the conversion
pipeline; reference book still 0/0/0.
README "First-time setup" section guides a fresh user from clone
to working binary in five commands.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the rough edges between `git clone` and a fully-working `dpub convert --transcribe ...`. Tier A + B from the approved plan.
Three new pieces, plus auto-discovery + an interactive prompt that ties them together:
Why
A first-time clone today requires the user to discover `cmake`, `epubcheck`, `ffmpeg`, `ace`, plus a Whisper GGML model, plus the `--features metal` build flag. Each missing piece either fails the build with a confusing error or fails a runtime command after the user has already typed the wrong thing. This PR makes every step proactive: `dpub doctor` shows the state, `dpub setup` fetches what's missing, `scripts/build.sh` handles the GPU flag automatically.
What stays unchanged
File-by-file
No new crates. No new heavy deps.
Test plan
Out of scope (filed separately if needed)