Skip to content

refactor: move toolchain from root to pkg/toolchain - #2041

Merged
Andriy Knysh (aknysh) merged 2 commits into
mainfrom
osterman/toolchain-root-issue
Jan 30, 2026
Merged

Andriy Knysh (aknysh) merged 2 commits into
mainfrom
osterman/toolchain-root-issue

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Jan 29, 2026 •

Copy link
Copy Markdown
Member

what

  • Move toolchain package from repository root to pkg/toolchain to 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.

@github-actions github-actions Bot added the size/m Medium size PR label Jan 29, 2026
@osterman Erik Osterman (Cloud Posse) (osterman) added the no-release Do not create a new release (wait for additional code changes) label Jan 29, 2026
@github-actions

github-actions Bot commented Jan 29, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

Move the toolchain package from the repository root to pkg/toolchain to align with project architecture guidelines. All business logic belongs in pkg/ - no packages should exist at the repo root level.

Changes:
- Move 94 Go files from toolchain/ to pkg/toolchain/ (preserves git history)
- Update 90 import statements across 145 files to reference github.com/cloudposse/atmos/pkg/toolchain
- Regenerate mocks with updated import paths
- Update documentation references

This ensures consistency with other business logic packages (config, stack, component, store, git, auth, etc.).

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@codecov

codecov Bot commented Jan 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.55%. Comparing base (fb80cbe) to head (cefb2d2).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2041   +/-   ##
=======================================
  Coverage   75.55%   75.55%           
=======================================
  Files         793      793           
  Lines       73718    73718           
=======================================
+ Hits        55698    55699    +1     
+ Misses      14526    14524    -2     
- Partials     3494     3495    +1     
Flag Coverage Δ
unittests 75.55% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/root.go 68.17% <ø> (ø)
cmd/toolchain/add.go 90.90% <ø> (ø)
cmd/toolchain/clean.go 54.54% <ø> (ø)
cmd/toolchain/du.go 88.88% <ø> (ø)
cmd/toolchain/env.go 80.00% <ø> (ø)
cmd/toolchain/exec.go 60.00% <ø> (ø)
cmd/toolchain/get.go 62.50% <ø> (ø)
cmd/toolchain/info.go 69.23% <ø> (ø)
cmd/toolchain/install.go 57.14% <ø> (ø)
cmd/toolchain/list.go 80.00% <ø> (ø)
... and 61 more

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR updates import paths across the codebase, moving all toolchain package imports from github.com/cloudposse/atmos/toolchain to github.com/cloudposse/atmos/pkg/toolchain and its subpackages. This is a mechanical refactoring with no functional logic changes.

Changes

Cohort / File(s) Summary
Command Layer - Toolchain Root
cmd/root.go, cmd/toolchain/toolchain.go, cmd/toolchain/toolchain_test.go
Updated toolchain package import paths to new pkg location.
Command Layer - Toolchain Operations
cmd/toolchain/add.go, cmd/toolchain/add_test.go, cmd/toolchain/clean.go, cmd/toolchain/du.go, cmd/toolchain/env.go, cmd/toolchain/env_test.go, cmd/toolchain/exec.go, cmd/toolchain/get.go, cmd/toolchain/info.go, cmd/toolchain/install.go, cmd/toolchain/list.go, cmd/toolchain/path.go, cmd/toolchain/path_test.go, cmd/toolchain/remove.go, cmd/toolchain/set.go, cmd/toolchain/uninstall.go, cmd/toolchain/which.go
Updated all toolchain command imports to reference new pkg/toolchain path.
Command Layer - Registry
cmd/toolchain/registry/list.go, cmd/toolchain/registry/list_test.go, cmd/toolchain/registry/provider_test.go, cmd/toolchain/registry/search.go, cmd/toolchain/registry/search_output_test.go, cmd/toolchain/registry/search_test.go, cmd/toolchain/registry/test_helpers_test.go
Updated registry imports to reference pkg/toolchain/registry paths.
Command Layer - Version
cmd/version/install.go, cmd/version/list.go, cmd/version/uninstall.go
Updated version command imports to new toolchain package location.
Documentation
docs/prd/tool-dependencies-integration.md, docs/prd/toolchain-file-management-pattern.md
Updated code examples to reflect new import paths.
Internal & Package - Execution
internal/exec/terraform.go, pkg/version/reexec.go
Updated toolchain import paths in execution modules.
Package - Dependencies
pkg/dependencies/installer.go, pkg/dependencies/installer_test.go, pkg/dependencies/resolver.go, pkg/dependencies/resolver_test.go
Updated dependency resolver and installer imports to new toolchain paths.
Package - Toolchain Core
pkg/toolchain/alias_resolution_test.go, pkg/toolchain/aqua_registry.go, pkg/toolchain/atmos_registry.go, pkg/toolchain/errors.go, pkg/toolchain/exec_test.go, pkg/toolchain/filemanager/toolversions.go, pkg/toolchain/info.go, pkg/toolchain/info_helpers.go, pkg/toolchain/info_test.go, pkg/toolchain/mock_install_locator_test.go, pkg/toolchain/mock_registry_test.go, pkg/toolchain/set_test.go, pkg/toolchain/template_data_test.go, pkg/toolchain/types.go
Updated core toolchain package imports and registry references to new paths; includes mock generation updates.
Package - Toolchain Installer
pkg/toolchain/installer/asset.go, pkg/toolchain/installer/asset_test.go, pkg/toolchain/installer/download.go, pkg/toolchain/installer/errors.go, pkg/toolchain/installer/extract.go, pkg/toolchain/installer/extract_test.go, pkg/toolchain/installer/installer.go, pkg/toolchain/installer/installer_test.go, pkg/toolchain/installer/override.go, pkg/toolchain/installer/override_test.go, pkg/toolchain/installer/platform.go, pkg/toolchain/installer/platform_test.go
Updated installer subpackage registry imports to pkg/toolchain/registry paths.
Package - Toolchain Registry
pkg/toolchain/registry/aqua/aqua.go, pkg/toolchain/registry/aqua/aqua_test.go, pkg/toolchain/registry/aqua/search.go, pkg/toolchain/registry/aqua/version.go, pkg/toolchain/registry/atmos/atmos.go, pkg/toolchain/registry/atmos/atmos_test.go, pkg/toolchain/registry/atmos/template_integration_test.go, pkg/toolchain/registry/mock_registry_test.go, pkg/toolchain/registry/registry.go
Updated registry and provider subpackage imports; includes mockgen directive updates.
Tests
tests/toolchain_aqua_tools_test.go, tests/toolchain_custom_commands_test.go
Updated integration test imports to new toolchain installer paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • #1686: Introduced and reorganized the toolchain package structure into pkg/toolchain, which this PR directly updates imports to reference.

Suggested reviewers

  • osterman
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'refactor: move toolchain from root to pkg/toolchain' clearly and concisely describes the primary change: relocating the toolchain package from the repository root to pkg/toolchain for architectural consistency.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch osterman/toolchain-root-issue

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aknysh
Andriy Knysh (aknysh) merged commit d72e3e8 into main Jan 30, 2026
57 of 58 checks passed
@aknysh
Andriy Knysh (aknysh) deleted the osterman/toolchain-root-issue branch January 30, 2026 02:35
@github-actions

github-actions Bot commented Feb 1, 2026

Copy link
Copy Markdown

These changes were released in v1.205.1-rc.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants