refactor: move toolchain from root to pkg/toolchain @osterman (#2041)
## what- Move toolchain package from repository root to
pkg/toolchainto align with project architecture guidelines - Update 90 import statements across 145 files to reference
github.com/cloudposse/atmos/pkg/toolchain - Regenerate mocks with updated import paths
- Update documentation references in PRD files
why
The toolchain package was incorrectly placed at the repository root in PR #1686. Project architecture guidelines (CLAUDE.md) specify that all business logic packages belong in pkg/. Moving toolchain to pkg/toolchain ensures consistency with other business logic packages like config, stack, component, store, git, and auth.
references
Aligns with project architecture guidelines in CLAUDE.md: All business logic belongs in pkg/ packages, not at the repository root.
Summary by CodeRabbit
- Chores
- Internal package reorganization for improved code structure and maintainability. No user-facing functionality changes or behavioral impact.
✏️ Tip: You can customize this high-level summary in your review settings.
🚀 Enhancements
feat: register terraform compound subcommands in Cobra command tree @aknysh (#2044)
## what- Register terraform compound subcommands (
state,providers,workspace) as proper Cobra child commands - Register per-subcommand compat flags for all 15 compound terraform subcommands
- Add dedicated documentation pages for all compound subcommands with detailed "Native Terraform Flags" sections
- Update screengrabs for all CLI commands
- Fix quoted compound terraform subcommands like
"providers lock" - Add compound subcommand argument parsing (
parseCompoundSubcommand,processTerraformCompoundSubcommand) - Add website documentation updates (templates defaults, stores, hooks)
why
Terraform compound subcommands registered in Cobra command tree (#2018)
Previously, compound terraform subcommands (state list, providers lock, workspace select, etc.) were handled entirely by argument parsing in processArgsAndFlags. This had several limitations:
- Tab completion didn't work for subcommands
- Help text didn't show subcommands with
[command]suffix - Quoted forms like
"providers lock"weren't supported
Fix (Part 1 — argument parsing): Added modular helper functions (parseCompoundSubcommand, parseQuotedCompoundSubcommand, parseSeparateCompoundSubcommand, processTerraformCompoundSubcommand) with configurable subcommand lists for workspace, state, providers, and write commands. Supports both quoted ("providers lock") and separate (providers lock) forms.
Fix (Part 2 — Cobra command tree registration): Registered compound subcommands as proper Cobra child commands:
cmd/terraform/state.go—list,mv,pull,push,replace-provider,rm,showas children ofstateCmdcmd/terraform/providers.go—lock,mirror,schemaas children ofprovidersCmdcmd/terraform/workspace.go—list,select,new,delete,showas children ofworkspaceCmdcmd/terraform/utils.go—newTerraformPassthroughSubcommand()helper creates Cobra child commands that delegate to the parent command's execution flow
The legacy compound subcommand parsing in processArgsAndFlags is retained as a fallback for the interactive UI path (which bypasses Cobra) and backward compatibility.
Files: internal/exec/cli_utils.go, internal/exec/cli_utils_test.go, cmd/terraform/utils.go, cmd/terraform/state.go, cmd/terraform/providers.go, cmd/terraform/workspace.go, cmd/terraform/subcommands_test.go
Per-subcommand compat flags for compound terraform subcommands
Added per-subcommand compat flag definitions for all 15 compound terraform subcommands, registered them with the command registry, and documented them in the website docs.
Compat flags registered per subcommand:
| Subcommand | Native Terraform Flags |
|---|---|
state list
| -state, -id
|
state mv
| -lock, -lock-timeout, -ignore-remote-version
|
state pull
| (none) |
state push
| -force, -lock, -lock-timeout, -ignore-remote-version
|
state replace-provider
| -auto-approve, -lock, -lock-timeout, -ignore-remote-version
|
state rm
| -lock, -lock-timeout, -ignore-remote-version
|
state show
| -state
|
providers lock
| -platform, -fs-mirror, -net-mirror, -enable-plugin-cache
|
providers mirror
| -platform
|
providers schema
| -json
|
workspace list
| (none) |
workspace select
| -or-create
|
workspace new
| -lock, -lock-timeout, -state
|
workspace delete
| -force, -lock, -lock-timeout
|
workspace show
| (none) |
Note: Terraform's
-dry-runonstate mv/state rmis intentionally excluded to avoid conflict with Atmos's--dry-runflag.
Files: cmd/terraform/compat_flags.go, cmd/terraform/state.go, cmd/terraform/providers.go, cmd/terraform/workspace.go, cmd/terraform/subcommands_test.go
Website documentation for compound subcommands
Added dedicated documentation pages for 15 terraform compound subcommands across 3 command families, each with detailed "Native Terraform Flags" sections documenting all supported terraform flags per subcommand:
providers/—lock,mirror,schemastate/—list,mv,pull,push,replace-provider,rm,showworkspace/—list,select,new,delete,show
Each page follows the existing documentation pattern with frontmatter, Intro component, Screengrab, Usage, Examples, Arguments, Flags, Native Terraform Flags, and See Also sections.
Updated screengrabs
Regenerated all CLI command screengrabs to reflect current help text including the new compound subcommand [command] suffixes.
references
- Closes #2018