refactor: improve TTY checks for non-interactive environments

refactor: improve TTY checks for non-interactive environments

Add IsInteractive() helper method to iostreams package that properly checks if the environment supports interactive prompts (stdin is TTY, stdout/stderr are TTYs, and NO_PROMPT is not set).

Changes:

  • Add IsInteractive() public method for interactive form checks
  • Keep IsOutputTTY() public for output formatting decisions
  • Rename isInteractive field to needsPrompt in mr/issue create commands for clarity (command requirement vs environment capability)

Validation improvements:

  • mr create: Use IsInteractive() for validation
  • mr update: Add validation for --fill without --yes in non-TTY mode
  • issue create: Use IsInteractive() for validation
  • release create: Add validation when notes not provided in non-TTY mode
  • project create: Default to safe behavior (no git init, no local setup) in non-TTY mode to prevent unexpected actions for AI agents

This provides consistent TTY handling across the CLI and prevents interactive prompts from failing in non-TTY environments like AI agents and CI/CD pipelines, while still supporting all interactive use cases.

Related to MR 2816 which fixed similar issues in ci view command.

Merge request reports

Loading