Add --non-interactive flag and improve TTY detection by tashian · Pull Request #1553 · smallstep/cli

@tashian @claude

Add support for non-interactive environments by:
- Adding --non-interactive global flag (also STEP_NON_INTERACTIVE env var)
- Checking for terminal availability before prompting for passwords
- Returning helpful error messages when prompts fail in CI/systemd/Docker

This change requires smallstep/cli-utils#210 which adds:
- ui.CanPrompt() for TTY detection
- errs.RequiredInputError for descriptive error messages

Fixes #674

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@github-actions bot added the needs triage

Waiting for discussion / prioritization by team

label

Jan 22, 2026

hslatman

@tashian

Address review feedback: different commands use different password
flags (--password-file, --provisioner-password-file, --admin-password-file,
etc.), so don't suggest a specific flag. Instead, guide users to check
--help for the correct flag for their command.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a Before hook that sets STEP_NON_INTERACTIVE=1 when the
--non-interactive flag is used, allowing ui.CanPrompt() to detect
the flag without needing access to the cli context.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@tashian

@tashian

@tashian

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>