interactive

package
v1.233.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package interactive decides whether Atmos authentication flows may show an interactive prompt (identity selector, MFA token, credential input).

The prompts are rendered with huh, which reads keystrokes from stdin and draws the form on stderr. A prompt is therefore only usable when BOTH streams are terminals. When stderr is captured (for example by the AWS CLI running a credential_process helper) the form is invisible and the process would hang waiting for input nobody can see, so the check must fail closed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() bool

Available reports whether interactive prompts can be shown in the current process. It is the single predicate every authentication prompt gate must use.

Types

type Environment

type Environment struct {
	// TTY reports which standard streams are terminals. It already honors
	// --force-tty / ATMOS_FORCE_TTY when it is the default detector.
	TTY term.TTYDetector
	// Enabled reports whether interactive mode is enabled (--interactive / ATMOS_INTERACTIVE).
	Enabled func() bool
	// CI reports whether the process runs in a CI environment.
	CI func() bool
}

Environment bundles the inputs of the interactivity decision so tests can inject them without a real terminal.

func Default

func Default() Environment

Default returns the Environment backed by the real terminal, viper, and CI detection.

func (Environment) Available

func (e Environment) Available() bool

Available reports whether interactive prompts can be shown. It requires:

  1. Interactive mode is enabled (--interactive flag or ATMOS_INTERACTIVE, default true).
  2. Stdin is a terminal (the prompt reads keystrokes from it).
  3. Stderr is a terminal (the prompt is drawn on it).
  4. The process does not run in CI.

Prompts degrade to actionable errors in pipelines, scripts, CI, and when a parent process captures stderr.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL