fix(cli): install venv in non-interactive terminals instead of crashing#11
Merged
Conversation
When stdin is not a TTY (piped input, CI, coding agents) and neither --yes nor --no-sync is passed, the venv/uv confirmation prompts called beaupy.select, which raises `termios.error: (25, 'Inappropriate ioctl for device')`. That error fell through to the generic handler and the run failed with "Unexpected error" and exit code 1, leaving no venv. confirm() now detects a non-interactive stdin and returns the prompt's default (Yes) instead of invoking beaupy, so a non-TTY run installs uv if missing and runs `uv sync` unattended. --yes and --no-sync behavior is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
In a non-TTY run the final "Next steps" line now tells the agent to use the bundled skills in .agents/skills/ instead of "open your coding agent and tell it what to build", which assumes a human at an interactive terminal. Interactive runs are unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bjoaquinc
force-pushed
the
fix/non-tty-venv-install
branch
from
July 9, 2026 10:55
bdc05ab to
1c09ba1
Compare
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
Two related non-interactive (non-TTY) fixes: piped stdin, CI, and coding agents.
1. Install the venv instead of crashing. Without
--yesor--no-sync, the venv/uv prompts calledbeaupy.select, which needs a terminal and raisedtermios.error: (25, 'Inappropriate ioctl for device'). That fell through to the generic handler, so the run died withUnexpected errorand exit code 1 — files scaffolded, but no venv.confirm()now detects a non-interactive stdin and returns the prompt's default (Yes) instead of callingbeaupy. Both prompts default toTrue, so a non-TTY run installsuvif missing and runsuv syncunattended. Fixing it at the prompt layer covers everyconfirm().--yes(bypass) and--no-sync(skip) are unchanged.Note: piping into
dlthub-initwithout--yesnow runs network installs unattended — the intended behavior.2. Point "Next steps" at the bundled skills. In a non-TTY run the final step said "Open your coding agent … and tell it what to build", which assumes a human at a terminal. It now points at the skills shipped in
.agents/skills/so the agent already running the command knows to use them. Interactive runs are unchanged.Changes
src/dlthub_init/prompts.py:confirm()returns the default when stdin isn't a TTY, viastdin_is_interactive().src/dlthub_init/display.py+strings.py:print_next_steps()swaps the final step for a skills-oriented one when non-interactive and skills are present.src/dlthub_init/cli.py: passinteractive/skills_availableintoprint_next_steps.NonInteractiveConfirmTest(prompts) and threeNextStepsTestcases (display) covering both paths.Testing
make test✅ (107 passed)make workspace(runs the CLI non-TTY): auto-selects● Yes, prints✓ Installed dependencies into .venv, exit 0,.venvcreated, and the final step reads "This workspace ships dltHub skills in .agents/skills/ …". Was exit 1 with no venv before.🤖 Generated with Claude Code