Skip to content

Conversation

@koh-sh
Copy link
Owner

@koh-sh koh-sh commented Oct 18, 2025

resolve #28

Add TTY (terminal) detection to prevent interactive prompts from hanging in non-interactive environments such as CI/CD pipelines, scripts, and AI agents. This ensures commands fail gracefully with helpful error messages instead of blocking indefinitely.

Changes:

  • Add CheckTTY() function to verify stdin is a terminal
  • Extend Prompter interface with CheckTTY() method
  • Update init command to check TTY before interactive prompts
    • Require all flags (--region, --app, --profile, --env) if no TTY
  • Update get command to check TTY before confirmation prompt
    • Suggest --yes flag to skip confirmation if no TTY
  • Add comprehensive tests for TTY error handling
  • Update documentation (CLAUDE.md, llms.md, README.md)
    • Add TTY requirements section for AI assistants
    • Document non-interactive usage patterns

This change improves the developer experience when using apcdeploy in automated environments by providing clear, actionable error messages.

🤖 Generated with Claude Code

Add TTY (terminal) detection to prevent interactive prompts from hanging
in non-interactive environments such as CI/CD pipelines, scripts, and AI
agents. This ensures commands fail gracefully with helpful error messages
instead of blocking indefinitely.

Changes:
- Add CheckTTY() function to verify stdin is a terminal
- Extend Prompter interface with CheckTTY() method
- Update init command to check TTY before interactive prompts
  - Require all flags (--region, --app, --profile, --env) if no TTY
- Update get command to check TTY before confirmation prompt
  - Suggest --yes flag to skip confirmation if no TTY
- Add comprehensive tests for TTY error handling
- Update documentation (CLAUDE.md, llms.md, README.md)
  - Add TTY requirements section for AI assistants
  - Document non-interactive usage patterns

This change improves the developer experience when using apcdeploy in
automated environments by providing clear, actionable error messages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link

Code Metrics Report

main (59be4eb) #33 (70b9809) +/-
Coverage 90.3% 90.3% -0.1%
Code to Test Ratio 1:3.9 1:3.9 +0.0
Test Execution Time 8s 8s 0s
Details
  |                     | main (59be4eb) | #33 (70b9809) |  +/-  |
  |---------------------|----------------|---------------|-------|
- | Coverage            |          90.3% |         90.3% | -0.1% |
  |   Files             |             39 |            40 |    +1 |
  |   Lines             |           1207 |          1225 |   +18 |
+ |   Covered           |           1091 |          1107 |   +16 |
+ | Code to Test Ratio  |          1:3.9 |         1:3.9 |  +0.0 |
  |   Code              |           2969 |          3015 |   +46 |
+ |   Test              |          11843 |         12037 |  +194 |
  | Test Execution Time |             8s |            8s |    0s |

Code coverage of files in pull request scope (72.6% → 75.2%)

Files Coverage +/- Status
internal/get/executor.go 93.9% +0.3% modified
internal/init/executor.go 91.6% +4.1% modified
internal/init/workflow.go 87.2% +2.6% modified
internal/prompt/huh.go 0.0% 0.0% modified
internal/prompt/tty.go 66.6% +66.6% added

Reported by octocov

@koh-sh koh-sh merged commit fea3b9e into main Oct 18, 2025
5 checks passed
@koh-sh koh-sh deleted the feat/add-tty-detection-for-non-interactive-environments branch October 18, 2025 06:15
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.

check TTY for interactive init

2 participants