Skip to content

feat: add --no-tty flag to run and shell commands#5

Merged
pilat merged 1 commit intomainfrom
feature/tty-control
Oct 1, 2025
Merged

feat: add --no-tty flag to run and shell commands#5
pilat merged 1 commit intomainfrom
feature/tty-control

Conversation

@pilat
Copy link
Copy Markdown
Owner

@pilat pilat commented Oct 1, 2025

  • Add --no-tty/-t flag to 'run' command to disable pseudo-TTY allocation
  • Add --no-tty/-t flag to 'shell' command to disable pseudo-TTY allocation
  • Update Tty field default behavior to auto-detect when not specified
  • Add isTTYAvailable() helper function for TTY detection

Summary by CodeRabbit

  • New Features

    • Added a --no-tty flag to explicitly disable TTY for run and shell commands.
    • Commands now auto-detect TTY availability and enable it only when supported, improving behavior in non-interactive environments (e.g., CI).
  • Refactor

    • TTY decision flow now prioritizes the new flag, then scenario settings, then auto-detection.
  • Documentation

    • Clarified that TTY defaults to auto-detect in configuration comments.

@pilat pilat self-assigned this Oct 1, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 1, 2025

Warning

Rate limit exceeded

@pilat has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 40 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 81b5178 and 87c27f3.

📒 Files selected for processing (3)
  • cmd/devbox/run.go (3 hunks)
  • cmd/devbox/shell.go (5 hunks)
  • internal/project/config.go (1 hunks)

Walkthrough

Adds a --no-tty flag to run and shell commands, threads the flag into runRun and runShell signatures, and updates TTY selection: flag overrides, run uses scenario.Tty when set then auto-detect, shell falls back to auto-detect. Updates ScenarioConfig.Tty comment to “default: auto-detect.”

Changes

Cohort / File(s) Summary
CLI: run command
cmd/devbox/run.go
Adds --no-tty flag handling; changes runRun signature to accept noTtyFlag bool; TTY decision order: if noTtyFlag then false, else if scenario.Tty set then use it, else call isTTYAvailable().
CLI: shell command
cmd/devbox/shell.go
Adds --no-tty / -t flag; extends runShell signature to accept noTtyFlag bool; if noTtyFlag then Tty=false, otherwise Tty = isTTYAvailable(); adds isTTYAvailable() helper and imports os.
Config docs update
internal/project/config.go
Updates ScenarioConfig.Tty comment from “default: true” to “default: auto-detect”; no structural or behavioral changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant CLI as devbox CLI
  participant Cmd as run/shell handler
  participant Cfg as ScenarioConfig (run)
  participant TTY as TTY Detector

  User->>CLI: devbox run|shell [--no-tty]
  CLI->>Cmd: parse flags, call runRun/runShell(..., noTtyFlag)
  alt noTtyFlag == true
    Cmd->>Cmd: set Tty = false
  else noTtyFlag == false
    opt run path
      Cmd->>Cfg: read scenario.Tty
      alt scenario.Tty is set
        Cmd->>Cmd: set Tty = scenario.Tty
      else
        Cmd->>TTY: isTTYAvailable()
        TTY-->>Cmd: bool
        Cmd->>Cmd: set Tty = result
      end
    end
    opt shell path
      Cmd->>TTY: isTTYAvailable()
      TTY-->>Cmd: bool
      Cmd->>Cmd: set Tty = result
    end
  end
  Cmd-->>User: execute with selected TTY mode
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I twitch my whiskers at a flag so spry,
No-tty hops in — hello, text-only sky.
If not set, I listen to streams that gleam,
Or read the config’s quiet dream.
A rabbit's nod — the CLI's new scheme 🐇✨

Pre-merge checks and finishing touches and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely summarizes the primary change by indicating the addition of the --no-tty flag to both the run and shell commands, which aligns directly with the pull request objectives and the code changes described in the diff.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pilat pilat force-pushed the feature/tty-control branch 9 times, most recently from 77431d5 to 4a3b967 Compare October 1, 2025 00:29
@pilat pilat force-pushed the feature/tty-control branch from 4a3b967 to 87c27f3 Compare October 1, 2025 00:34
@pilat pilat merged commit f822770 into main Oct 1, 2025
1 check 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