Skip to content

fix(cli): install venv in non-interactive terminals instead of crashing#11

Merged
bjoaquinc merged 2 commits into
develfrom
fix/non-tty-venv-install
Jul 9, 2026
Merged

fix(cli): install venv in non-interactive terminals instead of crashing#11
bjoaquinc merged 2 commits into
develfrom
fix/non-tty-venv-install

Conversation

@bjoaquinc

@bjoaquinc bjoaquinc commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two related non-interactive (non-TTY) fixes: piped stdin, CI, and coding agents.

1. Install the venv instead of crashing. Without --yes or --no-sync, the venv/uv prompts called beaupy.select, which needs a terminal and raised termios.error: (25, 'Inappropriate ioctl for device'). That fell through to the generic handler, so the run died with Unexpected error and exit code 1 — files scaffolded, but no venv. confirm() now detects a non-interactive stdin and returns the prompt's default (Yes) instead of calling beaupy. Both prompts default to True, so a non-TTY run installs uv if missing and runs uv sync unattended. Fixing it at the prompt layer covers every confirm(). --yes (bypass) and --no-sync (skip) are unchanged.

Note: piping into dlthub-init without --yes now 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, via stdin_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: pass interactive / skills_available into print_next_steps.
  • Tests: NonInteractiveConfirmTest (prompts) and three NextStepsTest cases (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, .venv created, and the final step reads "This workspace ships dltHub skills in .agents/skills/ …". Was exit 1 with no venv before.

🤖 Generated with Claude Code

bjoaquinc and others added 2 commits July 9, 2026 12:54
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
bjoaquinc force-pushed the fix/non-tty-venv-install branch from bdc05ab to 1c09ba1 Compare July 9, 2026 10:55
@bjoaquinc
bjoaquinc merged commit 9b3874f into devel Jul 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant