refactor: move interactive prompt helpers to a command-agnostic package
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 175
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 134
Description
## What
The interactive stack/component selection helpers (`PromptForStack`, `PromptForComponent`) currently live in `cmd/terraform/shared/`. These include flag persistence logic that writes the selected value back to the Cobra flag set so PostRunE hooks can read it.
This placement means other command types (helmfile, ansible, packer) cannot reuse the interactive selection + flag persistence without importing from `cmd/terraform/shared/` — a wrong dependency direction.
## Why
As we add interactive selection to more command types, the prompt helpers and their flag persistence behavior should be available from a command-agnostic location (e.g., `pkg/flags/` or a new `cmd/shared/`).
## Current state
- `cmd/terraform/shared/prompt.go` — `PromptForStack`, `PromptForComponent`, `HandlePromptError`, `ValidateStackExists`
- Only terraform commands use these today
- Flag persistence was centralized into `PromptForStack` in PR #2520
## Proposed
Move the prompt helpers to a command-agnostic package so helmfile, ansible, packer, and future command types can share the same interactive selection + flag write-back behavior.
## References
- PR #2520 — centralized flag persistence into `PromptForStack`
- Review discussion: https://github.com/cloudposse/atmos/pull/2520#discussion_r2111226810
Contributor guide
Assessment
This issue has not been assessed yet.