Skip to content

feat: implement atmos init and atmos scaffold commands - #1687

Merged
Andriy Knysh (aknysh) merged 165 commits into
mainfrom
init-experiment
Jul 19, 2026
Merged

Andriy Knysh (aknysh) merged 165 commits into
mainfrom
init-experiment

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Oct 21, 2025 •

Copy link
Copy Markdown
Member

what

  • Implement atmos init command for bootstrapping new Atmos projects from built-in templates
  • Implement atmos scaffold command with three subcommands:
    • atmos scaffold generate - Generate code from scaffold templates
    • atmos scaffold list - List available scaffold templates from atmos.yaml
    • atmos scaffold validate - Validate scaffold.yaml configuration files
  • Refactor code organization to eliminate thin wrappers and improve maintainability:
    • Rename pkg/init/ → pkg/generator/ for clearer, more generic naming
    • Move pkg/init/config/ → pkg/project/config/ for project-level operations
    • Consolidate template processing into pkg/generator/engine/
    • Move business logic from internal/exec/ directly into cmd/ packages
  • Add comprehensive documentation (PRD, blog post, CLI reference)
  • Add test coverage for new packages (76.9% for templates, 91.7% for filesystem, 95.7% for merge)

why

  • User Experience: Users can now initialize Atmos projects in seconds instead of manually creating configuration files
  • Developer Experience: Scaffolding accelerates development by generating boilerplate code from templates
  • Code Quality: Refactoring eliminates confusing package names (pkg/init vs init command) and removes unnecessary indirection
  • Maintainability: Moving logic into cmd/ packages reduces layers and makes the codebase easier to navigate
  • Extensibility: Template-based approach allows users to create custom templates for their organization

references

Summary by CodeRabbit

New Features

  • Added atmos init command to initialize Atmos projects from templates with interactive and non-interactive modes
  • Added atmos scaffold command suite with generate, list, and validate subcommands for creating code and configuration from templates
  • Template support includes variable substitution, dry-run previews, and intelligent file merging for updates

Documentation

  • Added comprehensive usage guides, examples, and Product Requirements Documents for template and scaffolding features

@mergify mergify Bot added conflict This PR has conflicts triage Needs triage labels Oct 21, 2025
@github-actions github-actions Bot added the size/xl Extra large size PR label Oct 21, 2025
@mergify mergify Bot removed the conflict This PR has conflicts label Oct 21, 2025
@mergify

mergify Bot commented Oct 21, 2025

Copy link
Copy Markdown
Contributor

Warning

This PR exceeds the recommended limit of 1,000 lines.

Large PRs are difficult to review and may be rejected due to their size.

Please verify that this PR does not address multiple issues.
Consider refactoring it into smaller, more focused PRs to facilitate a smoother review process.

@github-actions

github-actions Bot commented Nov 8, 2025 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

  • go.mod
  • website/pnpm-lock.yaml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 15

🧹 Nitpick comments (10)
tests/fixtures/scaffolds/demo-localstack/docker-compose.yml (1)

5-5: Pin LocalStack image to a specific version for reproducible tests.

Using latest can cause test flakiness if the LocalStack image receives breaking changes. Consider pinning to a specific stable version.

Apply this diff to pin the image version:

-    image: localstack/localstack:latest
+    image: localstack/localstack:3.0.2

(Adjust 3.0.2 to your target LocalStack version.)

tests/fixtures/scaffolds/editorconfig/README.md (1)

3-26: Documentation is clear and helpful.

Good job explaining EditorConfig purpose and providing concrete usage instructions. One minor style note: the linter suggests using hyphens for compound adjectives (e.g., "spaces-vs-tabs" on line 20), but this is purely stylistic and the current phrasing is acceptable.

If you prefer stricter adherence to style guidelines, apply this diff:

 - Indentation style (spaces vs tabs)
+ - Indentation style (spaces-vs-tabs)

This is optional and won't affect functionality or clarity.

go.mod (1)

39-39: Bump github.com/charmbracelet/x/term to v0.2.2 (latest).

The latest version of this package is v0.2.2, tagged Oct 31, 2025. No known vulnerabilities detected. Update to keep dependencies current.

tests/fixtures/scaffolds/gitignore/README.md (2)

7-12: Add terminal punctuation to complete the list sentences.

Lines 7–12 form a list that lacks terminal punctuation. Add a period to line 12 to complete the sentence.

  The `.gitignore` file tells Git which files and directories to ignore when tracking changes. This is essential for keeping your repository clean by excluding:
  - Build artifacts and compiled files
  - Dependencies and vendor directories
  - IDE and editor-specific files
  - Log files and temporary data
- - Sensitive configuration files
+ - Sensitive configuration files.

22-28: Add terminal punctuation to complete the list sentences.

Lines 22–28 form a list that lacks terminal punctuation. Add a period to line 28 to complete the sentence.

  This will create a `.gitignore` file in the current directory with comprehensive ignore patterns for:
  - Terraform state files and lock files
  - Provider plugins and modules
  - IDE files (VS Code, IntelliJ, etc.)
  - OS-specific files (macOS, Windows, Linux)
  - Build artifacts and temporary files
- - Log files and debugging output
+ - Log files and debugging output.
tests/fixtures/scaffolds/rich-project/README.md (1)

53-62: Consider adding language specifier to code block.

The directory structure code block could benefit from a language specifier (e.g., text or bash) for better rendering.

Apply this diff:

-```
+```text
 .
 ├── atmos.yaml              # Atmos configuration
 ├── scaffold.yaml           # Scaffold template configuration schema
pkg/generator/types/types.go (1)

6-11: Type duplication across packages may cause confusion.

The File type here differs from similar types in pkg/generator/engine/templating.go (same fields) and pkg/generator/templates/embeds.go (includes IsDirectory field). Consider consolidating to a single canonical definition to avoid conversion overhead and inconsistencies.

pkg/generator/ui/ui_test.go (2)

13-25: LGTM with optional enhancement suggestion.

The test correctly validates UI initialization. The comment about maxChanges removal provides helpful context about the architectural change.

Optionally, consider expanding this test to verify other initialized fields:

 func TestNewInitUI(t *testing.T) {
 	ui := NewInitUI()
 
 	if ui.checkmark != "✓" {
 		t.Errorf("Expected checkmark to be ✓, got %s", ui.checkmark)
 	}
 
 	if ui.xMark != "✗" {
 		t.Errorf("Expected xMark to be ✗, got %s", ui.xMark)
 	}
+
+	if ui.processor == nil {
+		t.Error("Expected processor to be initialized")
+	}
 
 	// maxChanges field has been removed - threshold is now handled by the templating processor
 }

27-55: Consider adding content verification.

The test correctly validates file creation. However, it doesn't verify the file content matches expectations.

Optionally, add content verification to strengthen the test:

 	filePath := filepath.Join(tempDir, "test.txt")
 	if _, err := os.Stat(filePath); os.IsNotExist(err) {
 		t.Error("Expected file to be created")
 	}
+
+	// Verify file content
+	content, err := os.ReadFile(filePath)
+	if err != nil {
+		t.Fatalf("Failed to read file: %v", err)
+	}
+	if string(content) != "Hello World!" {
+		t.Errorf("Expected content 'Hello World!', got '%s'", string(content))
+	}
 }
pkg/project/config/config_test.go (1)

1-448: Comprehensive test coverage for happy paths.

The test suite provides excellent coverage of scaffold config functionality including loading, saving, merging, and persistence. The TTY detection on Line 395 appropriately skips interactive tests in non-interactive environments.

Consider adding error path tests to increase robustness:

func TestLoadScaffoldConfigFromContent_InvalidYAML(t *testing.T) {
	content := `invalid: yaml: content:`
	_, err := LoadScaffoldConfigFromContent(content)
	assert.Error(t, err)
	assert.Contains(t, err.Error(), "failed to unmarshal")
}

func TestSaveUserValues_WriteFailure(t *testing.T) {
	// Test with read-only directory or invalid path
	err := SaveUserValues("/invalid/path", map[string]interface{}{})
	assert.Error(t, err)
}

These would complement the existing coverage per the coding guideline to "test both happy paths and error conditions."

Comment thread cmd/init/init.go Resolved
Comment thread cmd/scaffold/scaffold.go Resolved
Comment thread pkg/generator/engine/templating.go Resolved
Comment thread pkg/generator/filesystem/validation.go Resolved
Comment thread website/docs/cli/commands/init.mdx Resolved
@codecov

codecov Bot commented Nov 9, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.78585% with 227 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.77%. Comparing base (e6ad3a3) to head (ff0830c).

Files with missing lines Patch % Lines
cmd/scaffold/scaffold.go 84.31% 63 Missing and 25 partials ⚠️
cmd/init/init.go 81.02% 26 Missing and 11 partials ⚠️
pkg/emulator/azure_trust.go 53.84% 9 Missing and 9 partials ⚠️
pkg/generator/engine/merge_update.go 88.54% 13 Missing and 2 partials ⚠️
pkg/generator/engine/templating.go 95.80% 11 Missing and 3 partials ⚠️
main.go 0.00% 8 Missing and 1 partial ⚠️
pkg/downloader/get_git.go 77.14% 5 Missing and 3 partials ⚠️
pkg/dependencies/installer.go 50.00% 4 Missing and 2 partials ⚠️
pkg/flags/types.go 77.77% 6 Missing ⚠️
cmd/proxy.go 85.29% 4 Missing and 1 partial ⚠️
... and 8 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1687      +/-   ##
==========================================
- Coverage   81.89%   81.77%   -0.12%     
==========================================
  Files        1722     1750      +28     
  Lines      162705   167186    +4481     
==========================================
+ Hits       133249   136722    +3473     
- Misses      22176    22957     +781     
- Partials     7280     7507     +227     
Flag Coverage Δ
unittests 81.77% <85.78%> (-0.12%) ⬇️

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

Files with missing lines Coverage Δ
errors/errors.go 100.00% <ø> (ø)
pkg/condition/cel.go 92.85% <100.00%> (+0.70%) ⬆️
pkg/condition/condition.go 94.26% <ø> (ø)
pkg/emulator/target/azure.go 100.00% <100.00%> (ø)
pkg/emulator/target/gcp.go 100.00% <100.00%> (ø)
pkg/flags/options.go 96.40% <100.00%> (+0.25%) ⬆️
pkg/flags/viper_helpers.go 94.59% <100.00%> (+14.59%) ⬆️
pkg/function/context.go 100.00% <100.00%> (ø)
pkg/function/phase.go 100.00% <100.00%> (ø)
pkg/generator/filesystem/validation.go 71.42% <ø> (ø)
... and 54 more

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (4)
pkg/project/config/config.go (1)

111-116: Handle the missing scaffold config so first-run stays smooth.

Right now v.ReadInConfig() wraps the missing-file case as viper.ConfigFileNotFoundError, so on a fresh directory we still fall into the error return instead of the empty-map path. Let's guard that explicit error so atmos init boots without tripping over itself again.

@@
-import (
-	"fmt"
+import (
+	"errors"
+	"fmt"
@@
-	if err := v.ReadInConfig(); err != nil {
-		if os.IsNotExist(err) {
-			// File doesn't exist, return empty map
-			return make(map[string]interface{}), nil
-		}
+	if err := v.ReadInConfig(); err != nil {
+		var notFound viper.ConfigFileNotFoundError
+		if errors.As(err, &notFound) || os.IsNotExist(err) {
+			return make(map[string]interface{}), nil
+		}
 		return nil, fmt.Errorf("failed to read user values: %w", err)
 	}
tests/fixtures/scaffolds/simple-scaffold/scaffold/terraform/main.tf.tmpl (1)

21-27: Keep generated bucket names valid every time.

With a long project/environment pair the current expression can blow past 63 chars, and if the project slug sanitizes to empty we end up with a leading hyphen—both break S3. Let’s clamp each segment and clean the final slug.

-resource "aws_s3_bucket" "main" {
-  bucket = "{{ .Config.project_name | lower | regexReplaceAll `[^a-z0-9-]` `-` | regexReplaceAll `-+` `-` | strings.TrimPrefix `-` | strings.TrimSuffix `-` | strings.Trunc 50 }}-{{ .Config.environment | lower | regexReplaceAll `[^a-z0-9-]` `-` | regexReplaceAll `-+` `-` | strings.TrimPrefix `-` | strings.TrimSuffix `-` }}"
+resource "aws_s3_bucket" "main" {
+  bucket = "{{ printf \"%s-%s\" (.Config.project_name | lower | regexReplaceAll `[^a-z0-9-]` `-` | regexReplaceAll `-+` `-` | strings.TrimPrefix `-` | strings.TrimSuffix `-` | strings.Trunc 31) (.Config.environment | lower | regexReplaceAll `[^a-z0-9-]` `-` | regexReplaceAll `-+` `-` | strings.TrimPrefix `-` | strings.TrimSuffix `-` | strings.Trunc 31) | regexReplaceAll `^-+` `` | regexReplaceAll `-+` `-` | regexReplaceAll `-$` `` }}"
pkg/generator/ui/ui.go (2)

174-181: Remove deprecated LoadUserConfiguration call.

config.LoadUserConfiguration() is deprecated and now always returns an error, breaking templates without scaffold.yaml. For templates without scaffold config and no command-line values, proceed with empty template values rather than failing.

Replace the deprecated path:

 	// For templates without scaffold.yaml, use command-line values if provided
 	if len(cmdTemplateValues) > 0 {
 		return ui.executeWithCommandValues(embedsConfig, targetPath, force, update, cmdTemplateValues)
 	}
 
-	// Load user configuration and prompt if needed
-	userConfig, err := config.LoadUserConfiguration()
-	if err != nil {
-		return fmt.Errorf("failed to load user configuration: %w", err)
-	}
-
-	return ui.executeWithUserConfig(embedsConfig, targetPath, force, update, userConfig)
+	// For templates without scaffold.yaml and no command values, use empty values
+	return ui.executeWithCommandValues(embedsConfig, targetPath, force, update, make(map[string]interface{}))

27-35: Remove duplicate FileSkippedError type.

This local FileSkippedError duplicates engine.FileSkippedError and causes type mismatches at lines 391 and 587 where the wrong type is checked. Since engine.Processor.ProcessFile returns *engine.FileSkippedError, these assertions will always fail, treating intentional skips as hard errors.

Remove the local type and fix the assertions:

-// FileSkippedError indicates that a file was intentionally skipped
-type FileSkippedError struct {
-	Path         string
-	RenderedPath string
-}
-
-func (e *FileSkippedError) Error() string {
-	return fmt.Sprintf("file skipped: %s (rendered to: %s)", e.Path, e.RenderedPath)
-}
-

Then fix the type assertions at lines 391 and 587:

-			if skipErr, ok := err.(*FileSkippedError); ok {
+			if skipErr, ok := err.(*engine.FileSkippedError); ok {
🧹 Nitpick comments (3)
cmd/scaffold/scaffold.go (2)

172-179: Consider validating --set flags more explicitly.

Silent failures when parsing invalid --set flags (e.g., --set foo without =value) could confuse users. Consider logging a warning or returning an error for malformed flags so users know their input was ignored.


475-477: Consider extracting valid prompt types as constants.

The hardcoded prompt type validation could be more maintainable with constants or a slice defined at package level, making it easier to add new types and ensuring consistency across the codebase.

Apply this approach:

+// Valid prompt types for scaffold configuration
+var validPromptTypes = []string{"input", "select", "confirm", "multiselect"}
+
 // validateScaffoldFile validates a single scaffold.yaml file.
 func validateScaffoldFile(scaffoldPath string) error {
 	// ...
 	for i, prompt := range config.Prompts {
 		// ...
-		if prompt.Type != "input" && prompt.Type != "select" && prompt.Type != "confirm" && prompt.Type != "multiselect" {
-			return fmt.Errorf("prompt %d: invalid type '%s'", i, prompt.Type)
+		valid := false
+		for _, validType := range validPromptTypes {
+			if prompt.Type == validType {
+				valid = true
+				break
+			}
+		}
+		if !valid {
+			return fmt.Errorf("prompt %d: invalid type '%s' (must be one of: %s)", i, prompt.Type, strings.Join(validPromptTypes, ", "))
 		}
 	}
pkg/generator/ui/ui.go (1)

693-793: Consider extracting table creation logic.

The displayConfigurationTable method has complex width calculations and styling. Consider extracting the table creation into a helper method to reduce cognitive complexity and improve testability.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0c0b030 and b8e2378.

📒 Files selected for processing (12)
  • cmd/init/init.go (1 hunks)
  • cmd/scaffold/scaffold.go (1 hunks)
  • pkg/generator/engine/templating.go (1 hunks)
  • pkg/generator/ui/ui.go (1 hunks)
  • pkg/project/config/config.go (1 hunks)
  • tests/fixtures/scaffolds/path-test/{{.Config.namespace}}/config.yaml (1 hunks)
  • tests/fixtures/scaffolds/path-test/{{.Config.namespace}}/{{.Config.subdirectory}}/deep.yaml (1 hunks)
  • tests/fixtures/scaffolds/simple-scaffold/atmos.yaml (1 hunks)
  • tests/fixtures/scaffolds/simple-scaffold/scaffold/terraform/main.tf.tmpl (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden (1 hunks)
  • website/docs/cli/commands/init.mdx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • website/docs/cli/commands/init.mdx
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/fixtures/scaffolds/path-test/{{.Config.namespace}}/{{.Config.subdirectory}}/deep.yaml
  • tests/fixtures/scaffolds/path-test/{{.Config.namespace}}/config.yaml
  • tests/fixtures/scaffolds/simple-scaffold/atmos.yaml
🧰 Additional context used
📓 Path-based instructions (4)
cmd/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

cmd/**/*.go: Use Cobra's recommended command structure with a root command and subcommands
Implement each CLI command in a separate file under cmd/
Use Viper for managing configuration, environment variables, and flags in the CLI
Keep separation of concerns between CLI interface (cmd) and business logic
Use kebab-case for command-line flags
Provide comprehensive help text for all commands and flags
Include examples in Cobra command help
Use Viper for configuration management; support files, env vars, and flags with precedence flags > env > config > defaults
Follow single responsibility; separate command interface from business logic
Provide meaningful user feedback and include progress indicators for long-running operations
Provide clear error messages to users and troubleshooting hints where appropriate

Files:

  • cmd/scaffold/scaffold.go
  • cmd/init/init.go
**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments

Files:

  • cmd/scaffold/scaffold.go
  • pkg/project/config/config.go
  • pkg/generator/engine/templating.go
  • pkg/generator/ui/ui.go
  • cmd/init/init.go
**/!(*_test).go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Document all exported functions, types, and methods with Go doc comments

Files:

  • cmd/scaffold/scaffold.go
  • pkg/project/config/config.go
  • pkg/generator/engine/templating.go
  • pkg/generator/ui/ui.go
  • cmd/init/init.go
pkg/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Place business logic in pkg rather than in cmd

Files:

  • pkg/project/config/config.go
  • pkg/generator/engine/templating.go
  • pkg/generator/ui/ui.go
🧠 Learnings (41)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
📚 Learning: 2024-12-12T15:17:45.245Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2024-12-12T15:17:45.245Z
Learning: In `examples/demo-atmos.d/atmos.d/tools/helmfile.yml`, when suggesting changes to `kubeconfig_path`, ensure that the values use valid Go template syntax.

Applied to files:

  • tests/fixtures/scaffolds/simple-scaffold/scaffold/terraform/main.tf.tmpl
  • cmd/scaffold/scaffold.go
  • pkg/project/config/config.go
  • pkg/generator/engine/templating.go
  • cmd/init/init.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Use Cobra's recommended command structure with a root command and subcommands

Applied to files:

  • cmd/scaffold/scaffold.go
  • cmd/init/init.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Provide comprehensive help text for all commands and flags

Applied to files:

  • cmd/scaffold/scaffold.go
  • cmd/init/init.go
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.

Applied to files:

  • cmd/scaffold/scaffold.go
  • pkg/project/config/config.go
  • pkg/generator/engine/templating.go
📚 Learning: 2024-12-02T21:26:32.337Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.

Applied to files:

  • cmd/scaffold/scaffold.go
  • pkg/project/config/config.go
📚 Learning: 2025-11-08T19:56:18.647Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1697
File: internal/exec/oci_utils.go:0-0
Timestamp: 2025-11-08T19:56:18.647Z
Learning: In the Atmos codebase, when a function receives an `*schema.AtmosConfiguration` parameter, it should read configuration values from `atmosConfig.Settings` fields rather than using direct `os.Getenv()` or `viper.GetString()` calls. The Atmos pattern is: viper.BindEnv in cmd/root.go binds environment variables → Viper unmarshals into atmosConfig.Settings via mapstructure → business logic reads from the Settings struct. This provides centralized config management, respects precedence, and enables testability. Example: `atmosConfig.Settings.AtmosGithubToken` instead of `os.Getenv("ATMOS_GITHUB_TOKEN")` in functions like `getGHCRAuth` in internal/exec/oci_utils.go.

Applied to files:

  • cmd/scaffold/scaffold.go
  • pkg/project/config/config.go
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.

Applied to files:

  • cmd/scaffold/scaffold.go
  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.

Applied to files:

  • cmd/scaffold/scaffold.go
  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.

Applied to files:

  • cmd/scaffold/scaffold.go
  • cmd/init/init.go
📚 Learning: 2025-04-11T22:06:46.999Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1147
File: internal/exec/validate_schema.go:42-57
Timestamp: 2025-04-11T22:06:46.999Z
Learning: The "ExecuteAtmosValidateSchemaCmd" function in internal/exec/validate_schema.go has been reviewed and confirmed to have acceptable cognitive complexity despite static analysis warnings. The function uses a clean structure with only three if statements for error handling and delegates complex operations to helper methods.

Applied to files:

  • cmd/scaffold/scaffold.go
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.

Applied to files:

  • cmd/scaffold/scaffold.go
  • pkg/project/config/config.go
📚 Learning: 2024-10-20T13:12:46.499Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 736
File: pkg/config/const.go:6-6
Timestamp: 2024-10-20T13:12:46.499Z
Learning: In `cmd/cmd_utils.go`, it's acceptable to have hardcoded references to `atmos.yaml` in logs, and it's not necessary to update them to use the `CliConfigFileName` constant.

Applied to files:

  • cmd/scaffold/scaffold.go
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
📚 Learning: 2025-09-27T20:50:20.564Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1533
File: pkg/config/load.go:585-637
Timestamp: 2025-09-27T20:50:20.564Z
Learning: In the cloudposse/atmos repository, command merging prioritizes precedence over display ordering. Help commands are displayed lexicographically regardless of internal array order, so the mergeCommandArrays function focuses on ensuring the correct precedence chain (top-level file wins) rather than maintaining specific display order.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-02-14T23:12:38.030Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1061
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:8-8
Timestamp: 2025-02-14T23:12:38.030Z
Learning: Test snapshots in the Atmos project, particularly for dry run scenarios, may be updated during the development process, and temporary inconsistencies in their content should not be flagged as issues.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
📚 Learning: 2025-01-30T19:30:59.120Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/workflow.go:74-74
Timestamp: 2025-01-30T19:30:59.120Z
Learning: Error handling for `cmd.Usage()` is not required in the Atmos CLI codebase, as confirmed by the maintainer.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to website/** : Ensure consistency between CLI help text and website documentation

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
📚 Learning: 2025-01-09T22:27:25.538Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/validate_stacks.go:20-23
Timestamp: 2025-01-09T22:27:25.538Z
Learning: The validate commands in Atmos can have different help handling implementations. Specifically, validate_component.go and validate_stacks.go are designed to handle help requests differently, with validate_stacks.go including positional argument checks while validate_component.go does not.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2024-12-11T18:40:12.808Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.

Applied to files:

  • pkg/project/config/config.go
  • cmd/init/init.go
📚 Learning: 2025-04-23T15:02:50.246Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1202
File: pkg/utils/yaml_func_exec.go:104-104
Timestamp: 2025-04-23T15:02:50.246Z
Learning: In the Atmos codebase, direct calls to `os.Getenv` should be avoided. Instead, use `viper.BindEnv` for environment variable access. This provides a consistent approach to configuration management across the codebase.

Applied to files:

  • pkg/project/config/config.go
📚 Learning: 2025-04-04T02:03:23.676Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1185
File: internal/exec/yaml_func_store.go:26-26
Timestamp: 2025-04-04T02:03:23.676Z
Learning: The Atmos codebase currently uses `log.Fatal` for error handling in multiple places. The maintainers are aware this isn't an ideal pattern (should only be used in main() or init() functions) and plan to address it comprehensively in a separate PR. CodeRabbit should not flag these issues or push for immediate changes until that refactoring is complete.

Applied to files:

  • pkg/project/config/config.go
📚 Learning: 2025-08-29T20:57:35.423Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1433
File: cmd/theme_list.go:33-36
Timestamp: 2025-08-29T20:57:35.423Z
Learning: In the Atmos codebase, avoid using viper.SetEnvPrefix("ATMOS") with viper.AutomaticEnv() because canonical environment variable names are not exclusive to Atmos and could cause conflicts. Instead, use selective environment variable binding through the setEnv function in pkg/config/load.go with bindEnv(v, "config.key", "ENV_VAR_NAME") for specific environment variables.

Applied to files:

  • pkg/project/config/config.go
📚 Learning: 2025-01-07T20:38:09.618Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 896
File: cmd/editor_config.go:37-40
Timestamp: 2025-01-07T20:38:09.618Z
Learning: Error handling suggestion for `cmd.Help()` in `cmd/editor_config.go` was deferred as the code is planned for future modifications.

Applied to files:

  • pkg/project/config/config.go
  • pkg/generator/engine/templating.go
📚 Learning: 2024-10-20T13:06:20.839Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 736
File: pkg/utils/file_utils.go:177-194
Timestamp: 2024-10-20T13:06:20.839Z
Learning: In `pkg/utils/file_utils.go`, the `SearchConfigFile` function should focus on returning the file path and an `exists` boolean without returning an error.

Applied to files:

  • pkg/project/config/config.go
📚 Learning: 2024-10-22T23:00:20.627Z
Learnt from: Cerebrovinny
Repo: cloudposse/atmos PR: 737
File: internal/exec/vendor_utils.go:131-141
Timestamp: 2024-10-22T23:00:20.627Z
Learning: In the `ReadAndProcessVendorConfigFile` function in `internal/exec/vendor_utils.go`, the existence of the vendor config file is already checked, so additional file existence checks may be unnecessary.

Applied to files:

  • pkg/project/config/config.go
  • pkg/generator/ui/ui.go
📚 Learning: 2025-01-25T03:49:03.951Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: internal/exec/template_utils.go:268-271
Timestamp: 2025-01-25T03:49:03.951Z
Learning: The `ProcessTmplWithDatasourcesGomplate` function in `internal/exec/template_utils.go` is used for documentation generation purposes, where simple environment variable handling is acceptable and thread-safety concerns are not critical.

Applied to files:

  • pkg/generator/engine/templating.go
  • pkg/generator/ui/ui.go
📚 Learning: 2025-01-25T03:46:21.660Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: examples/quick-start-advanced/components/terraform/vpc/README.md.gotmpl:0-0
Timestamp: 2025-01-25T03:46:21.660Z
Learning: Template formatting and content changes in `.gotmpl` files are out of scope for review unless explicitly requested.

Applied to files:

  • pkg/generator/engine/templating.go
📚 Learning: 2025-09-30T19:03:50.738Z
Learnt from: Cerebrovinny
Repo: cloudposse/atmos PR: 1560
File: pkg/utils/string_utils.go:43-64
Timestamp: 2025-09-30T19:03:50.738Z
Learning: In the Atmos codebase, YAML tags like !terraform.output rely on positional arguments, so the SplitStringByDelimiter function in pkg/utils/string_utils.go must preserve empty strings (even after trimming quotes) to maintain the correct number of positional arguments. Filtering out empty values after trimming would collapse the array and break these function calls.

Applied to files:

  • pkg/generator/engine/templating.go
📚 Learning: 2024-10-12T18:38:28.458Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 715
File: pkg/logger/logger.go:21-32
Timestamp: 2024-10-12T18:38:28.458Z
Learning: In Go code, avoid prefixing struct names with 'I' (e.g., `IError`) as it can be confusing, suggesting an interface. Use descriptive names for structs to improve code clarity.

Applied to files:

  • pkg/generator/ui/ui.go
📚 Learning: 2024-10-20T00:41:57.135Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 731
File: internal/exec/validate_stacks.go:93-98
Timestamp: 2024-10-20T00:41:57.135Z
Learning: When downloading schema files in `internal/exec/validate_stacks.go`, use a consistent temporary file name to overwrite the file each time and avoid creating multiple temporary files.

Applied to files:

  • pkg/generator/ui/ui.go
📚 Learning: 2025-01-25T04:01:58.095Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: internal/exec/docs_generate.go:98-101
Timestamp: 2025-01-25T04:01:58.095Z
Learning: In the `generateSingleReadme` function of the docs generation feature (internal/exec/docs_generate.go), errors from `fetchAndParseYAML` should be logged and skipped rather than causing early returns. This is by design to process all inputs and collect all errors, instead of failing fast on the first error.

Applied to files:

  • pkg/generator/ui/ui.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Implement each CLI command in a separate file under cmd/

Applied to files:

  • cmd/init/init.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Use Viper for managing configuration, environment variables, and flags in the CLI

Applied to files:

  • cmd/init/init.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Keep separation of concerns between CLI interface (cmd) and business logic

Applied to files:

  • cmd/init/init.go
📚 Learning: 2024-11-10T18:37:10.032Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_component_utils.go:354-360
Timestamp: 2024-11-10T18:37:10.032Z
Learning: In the vendoring process, a TTY can exist without being interactive. If the process does not prompt the user, we should not require interactive mode to display the TUI. The `CheckTTYSupport` function should check TTY support on stdout rather than stdin.

Applied to files:

  • cmd/init/init.go
📚 Learning: 2025-10-11T19:11:58.965Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:0-0
Timestamp: 2025-10-11T19:11:58.965Z
Learning: For terraform apply interactivity checks in Atmos (internal/exec/terraform.go), use stdin TTY detection (e.g., `IsTTYSupportForStdin()` or checking `os.Stdin`) to determine if user prompts are possible. This is distinct from stdout/stderr TTY checks used for output display (like TUI rendering). User input requires stdin to be a TTY; output display requires stdout/stderr to be a TTY.

Applied to files:

  • cmd/init/init.go
📚 Learning: 2024-10-31T19:25:41.298Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform_clean.go:233-235
Timestamp: 2024-10-31T19:25:41.298Z
Learning: When specifying color values in functions like `confirmDeleteTerraformLocal` in `internal/exec/terraform_clean.go`, avoid hardcoding color values. Instead, use predefined color constants or allow customization through configuration settings to improve accessibility and user experience across different terminals and themes.

Applied to files:

  • cmd/init/init.go
📚 Learning: 2024-11-16T17:30:52.893Z
Learnt from: pkbhowmick
Repo: cloudposse/atmos PR: 786
File: internal/exec/shell_utils.go:159-162
Timestamp: 2024-11-16T17:30:52.893Z
Learning: For the `atmos terraform shell` command in `internal/exec/shell_utils.go`, input validation for the custom shell prompt is not required, as users will use this as a CLI tool and any issues will impact themselves.

Applied to files:

  • cmd/init/init.go
🧬 Code graph analysis (5)
cmd/scaffold/scaffold.go (8)
errors/errors.go (3)
  • ErrScaffoldGeneration (171-171)
  • ErrScaffoldNotFound (169-169)
  • ErrScaffoldValidation (170-170)
pkg/io/context.go (1)
  • NewContext (22-46)
pkg/io/terminal_adapter.go (1)
  • NewTerminalWriter (14-18)
pkg/terminal/terminal.go (1)
  • WithIO (192-196)
pkg/generator/ui/ui.go (1)
  • NewInitUI (91-103)
pkg/generator/templates/embeds.go (2)
  • GetAvailableConfigurations (32-55)
  • Configuration (13-20)
pkg/project/config/config.go (1)
  • ReadAtmosScaffoldSection (484-514)
pkg/ui/formatter.go (3)
  • Warning (161-168)
  • Successf (128-135)
  • Success (117-124)
pkg/project/config/config.go (2)
pkg/generator/templates/embeds.go (2)
  • HasScaffoldConfig (152-159)
  • File (23-29)
pkg/generator/types/types.go (1)
  • File (6-11)
pkg/generator/engine/templating.go (4)
pkg/generator/ui/ui.go (1)
  • FileSkippedError (28-31)
pkg/generator/merge/merge.go (2)
  • ThreeWayMerger (11-13)
  • NewThreeWayMerger (16-20)
pkg/generator/types/types.go (1)
  • File (6-11)
pkg/project/config/config.go (1)
  • ScaffoldConfig (43-50)
pkg/generator/ui/ui.go (4)
pkg/generator/engine/templating.go (4)
  • FileSkippedError (28-31)
  • Processor (38-40)
  • NewProcessor (43-47)
  • File (20-25)
pkg/generator/templates/embeds.go (3)
  • Configuration (13-20)
  • HasScaffoldConfig (152-159)
  • File (23-29)
pkg/generator/filesystem/validation.go (1)
  • ValidateTargetDirectory (10-36)
pkg/project/config/config.go (10)
  • HasScaffoldConfig (517-524)
  • ScaffoldConfigFileName (37-37)
  • LoadScaffoldConfigFromContent (69-76)
  • Config (66-66)
  • LoadUserValues (100-126)
  • ScaffoldConfig (43-50)
  • DeepMerge (163-177)
  • PromptForScaffoldConfig (191-302)
  • GetConfigurationSummary (424-454)
  • SaveUserConfig (135-160)
cmd/init/init.go (6)
errors/errors.go (2)
  • ErrInitialization (172-172)
  • ErrScaffoldNotFound (169-169)
pkg/io/context.go (1)
  • NewContext (22-46)
pkg/io/terminal_adapter.go (1)
  • NewTerminalWriter (14-18)
pkg/terminal/terminal.go (1)
  • WithIO (192-196)
pkg/generator/ui/ui.go (1)
  • NewInitUI (91-103)
pkg/generator/templates/embeds.go (2)
  • GetAvailableConfigurations (32-55)
  • Configuration (13-20)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Build (windows)
  • GitHub Check: website-deploy-preview
  • GitHub Check: Review Dependency Licenses
  • GitHub Check: Analyze (go)
  • GitHub Check: autofix
  • GitHub Check: Lint (golangci)
  • GitHub Check: Run pre-commit hooks
  • GitHub Check: Summary
🔇 Additional comments (2)
cmd/scaffold/scaffold.go (1)

219-240: LGTM - Scaffold templates properly merged.

The loading and merging of scaffold templates from atmos.yaml is well implemented. Configured templates correctly override embedded ones, and error handling for individual template failures is appropriate.

pkg/generator/engine/templating.go (1)

116-137: LGTM - Delimiter handling fixed.

The ProcessFile method now correctly handles ScaffoldConfig as both pointer and value types, plus the map fallback. This addresses the past review concern about honoring scaffold delimiters from struct inputs.

Comment thread pkg/generator/engine/templating.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
pkg/project/config/config.go (1)

110-117: Handle missing .atmos/scaffold.yaml gracefully.

The os.IsNotExist(err) check never matches viper.ConfigFileNotFoundError. Use errors.As to detect the viper-specific error type and return an empty map when the file doesn't exist.

+	"errors"
+
 	// Try to read the config file
 	if err := v.ReadInConfig(); err != nil {
-		if os.IsNotExist(err) {
+		var configNotFoundErr viper.ConfigFileNotFoundError
+		if errors.As(err, &configNotFoundErr) {
 			// File doesn't exist, return empty map
 			return make(map[string]interface{}), nil
 		}
 		return nil, fmt.Errorf("failed to read user values: %w", err)
 	}
pkg/generator/engine/templating.go (1)

218-222: Clear the IsTemplate flag before calling mergeFile.

The content at line 220 is already processed, but IsTemplate remains true. When mergeFile receives tempFile at line 222 (which then checks file.IsTemplate at line 283), it will re-process the already-rendered content with hardcoded delimiters ["{{", "}}"], corrupting output for scaffolds using custom delimiters.

Set tempFile.IsTemplate = false after line 220:

 // Create a temporary file with processed content for merging
 tempFile := file
 tempFile.Content = processedContent
+tempFile.IsTemplate = false

 if err := p.mergeFile(fullPath, tempFile, targetPath); err != nil {
🧹 Nitpick comments (3)
.claude/agents/ui-test-developer.md (1)

343-348: Minor: Add language identifier to fenced code block.

The code block at line 343 is missing a language identifier. While not critical, adding bash or similar would improve rendering.

Apply this diff:

-```
+```bash
 pkg/generator/ui/
 ├── ui.go                  # Source code
 ├── ui_test.go             # Helper: createTestUI()
 └── ui_tea_test.go         # TeaTest patterns

</blockquote></details>
<details>
<summary>pkg/generator/setup/setup_test.go (1)</summary><blockquote>

`7-51`: **Tests provide basic coverage, but consider consolidating.**

Both test functions validate the same behavior (NewGeneratorContext creates a valid context with all components initialized). The duplication doesn't add value and could be consolidated into a single comprehensive test or differentiated with additional scenarios.



Consider consolidating:

```diff
-func TestNewGeneratorContext(t *testing.T) {
+func TestNewGeneratorContext_ComponentsInitialized(t *testing.T) {
 	ctx, err := NewGeneratorContext()
 	if err != nil {
 		t.Fatalf("NewGeneratorContext() failed: %v", err)
 	}
 
 	if ctx == nil {
 		t.Fatal("NewGeneratorContext() returned nil context")
 	}
 
 	if ctx.IOContext == nil {
 		t.Error("IOContext is nil")
 	}
 
 	if ctx.Terminal == nil {
 		t.Error("Terminal is nil")
 	}
 
 	if ctx.UI == nil {
 		t.Error("UI is nil")
 	}
 }
-
-func TestNewGeneratorContext_AllComponentsInitialized(t *testing.T) {
-	ctx, err := NewGeneratorContext()
-	if err != nil {
-		t.Fatalf("NewGeneratorContext() failed: %v", err)
-	}
-
-	// Verify all components are properly initialized and connected
-	// The IOContext should be usable
-	if ctx.IOContext == nil {
-		t.Fatal("IOContext not initialized")
-	}
-
-	// The Terminal should be usable
-	if ctx.Terminal == nil {
-		t.Fatal("Terminal not initialized")
-	}
-
-	// The UI should be usable
-	if ctx.UI == nil {
-		t.Fatal("UI not initialized")
-	}
-}
pkg/flags/viper_helpers.go (1)

114-134: Consider whether perf.Track overhead is justified here.

The parseKeyValuePair helper is extremely lightweight (just a string split and trim). Adding perf.Track overhead might be counterproductive since this function is called in tight loops for every key=value pair.

Consider removing the perf.Track call:

 func parseKeyValuePair(pair string) (string, string) {
-	defer perf.Track(nil, "flags.parseKeyValuePair")()
-
 	parts := strings.SplitN(pair, "=", 2)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b8e2378 and b58c255.

📒 Files selected for processing (24)
  • .claude/agents/README.md (1 hunks)
  • .claude/agents/ui-test-developer.md (1 hunks)
  • cmd/init/init.go (1 hunks)
  • cmd/root.go (1 hunks)
  • cmd/scaffold/scaffold.go (1 hunks)
  • errors/errors.go (1 hunks)
  • go.mod (1 hunks)
  • pkg/flags/options.go (1 hunks)
  • pkg/flags/standard.go (2 hunks)
  • pkg/flags/string_map_flag_test.go (1 hunks)
  • pkg/flags/string_map_integration_test.go (1 hunks)
  • pkg/flags/types.go (1 hunks)
  • pkg/flags/viper_helpers.go (2 hunks)
  • pkg/flags/viper_helpers_test.go (1 hunks)
  • pkg/generator/engine/templating.go (1 hunks)
  • pkg/generator/engine/templating_refactor_test.go (1 hunks)
  • pkg/generator/setup/setup.go (1 hunks)
  • pkg/generator/setup/setup_test.go (1 hunks)
  • pkg/generator/ui/ui_tea_test.go (1 hunks)
  • pkg/generator/ui/ui_test.go (1 hunks)
  • pkg/project/config/config.go (1 hunks)
  • pkg/project/config/config_refactor_test.go (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • cmd/root.go
  • tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
  • cmd/init/init.go
🧰 Additional context used
📓 Path-based instructions (6)
pkg/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Place business logic in pkg rather than in cmd

Files:

  • pkg/flags/options.go
  • pkg/flags/viper_helpers_test.go
  • pkg/generator/setup/setup_test.go
  • pkg/flags/string_map_integration_test.go
  • pkg/flags/string_map_flag_test.go
  • pkg/generator/setup/setup.go
  • pkg/flags/types.go
  • pkg/flags/standard.go
  • pkg/project/config/config_refactor_test.go
  • pkg/flags/viper_helpers.go
  • pkg/project/config/config.go
  • pkg/generator/ui/ui_tea_test.go
  • pkg/generator/engine/templating_refactor_test.go
  • pkg/generator/ui/ui_test.go
  • pkg/generator/engine/templating.go
**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*.go: All code must pass golangci-lint checks
Follow Go error handling idioms and use meaningful error messages
Wrap errors with context using fmt.Errorf("context: %w", err)
Consider custom error types for domain-specific errors
Follow standard Go coding style; run gofmt and goimports
Use snake_case for environment variables
Document complex logic with inline comments

Files:

  • pkg/flags/options.go
  • pkg/flags/viper_helpers_test.go
  • pkg/generator/setup/setup_test.go
  • errors/errors.go
  • pkg/flags/string_map_integration_test.go
  • pkg/flags/string_map_flag_test.go
  • pkg/generator/setup/setup.go
  • pkg/flags/types.go
  • pkg/flags/standard.go
  • pkg/project/config/config_refactor_test.go
  • pkg/flags/viper_helpers.go
  • pkg/project/config/config.go
  • pkg/generator/ui/ui_tea_test.go
  • pkg/generator/engine/templating_refactor_test.go
  • cmd/scaffold/scaffold.go
  • pkg/generator/ui/ui_test.go
  • pkg/generator/engine/templating.go
**/!(*_test).go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

Document all exported functions, types, and methods with Go doc comments

Files:

  • pkg/flags/options.go
  • errors/errors.go
  • pkg/generator/setup/setup.go
  • pkg/flags/types.go
  • pkg/flags/standard.go
  • pkg/flags/viper_helpers.go
  • pkg/project/config/config.go
  • cmd/scaffold/scaffold.go
  • pkg/generator/engine/templating.go
**/*_test.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

**/*_test.go: Every new feature must include comprehensive unit tests
Test both happy paths and error conditions
Use table-driven tests for multiple scenarios

Files:

  • pkg/flags/viper_helpers_test.go
  • pkg/generator/setup/setup_test.go
  • pkg/flags/string_map_integration_test.go
  • pkg/flags/string_map_flag_test.go
  • pkg/project/config/config_refactor_test.go
  • pkg/generator/ui/ui_tea_test.go
  • pkg/generator/engine/templating_refactor_test.go
  • pkg/generator/ui/ui_test.go
go.{mod,sum}

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

go.{mod,sum}: Manage dependencies with Go modules
Keep dependencies up to date

Files:

  • go.mod
cmd/**/*.go

📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)

cmd/**/*.go: Use Cobra's recommended command structure with a root command and subcommands
Implement each CLI command in a separate file under cmd/
Use Viper for managing configuration, environment variables, and flags in the CLI
Keep separation of concerns between CLI interface (cmd) and business logic
Use kebab-case for command-line flags
Provide comprehensive help text for all commands and flags
Include examples in Cobra command help
Use Viper for configuration management; support files, env vars, and flags with precedence flags > env > config > defaults
Follow single responsibility; separate command interface from business logic
Provide meaningful user feedback and include progress indicators for long-running operations
Provide clear error messages to users and troubleshooting hints where appropriate

Files:

  • cmd/scaffold/scaffold.go
🧠 Learnings (55)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:206-206
Timestamp: 2025-01-17T00:18:57.769Z
Learning: For indirect dependencies with license compliance issues in the cloudposse/atmos repository, the team prefers to handle them in follow-up PRs rather than blocking the current changes, as these issues often require deeper investigation of the dependency tree.
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/http_client_test.go:3-10
Timestamp: 2025-09-10T21:17:55.273Z
Learning: In the cloudposse/atmos repository, imports should never be changed as per samtholiya's coding guidelines.
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Use Viper for configuration management; support files, env vars, and flags with precedence flags > env > config > defaults

Applied to files:

  • pkg/flags/viper_helpers_test.go
  • pkg/flags/string_map_integration_test.go
  • pkg/flags/viper_helpers.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Use Viper for managing configuration, environment variables, and flags in the CLI

Applied to files:

  • pkg/flags/viper_helpers_test.go
  • pkg/flags/string_map_integration_test.go
  • pkg/flags/viper_helpers.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Provide comprehensive help text for all commands and flags

Applied to files:

  • pkg/flags/viper_helpers_test.go
  • pkg/flags/string_map_integration_test.go
  • pkg/flags/string_map_flag_test.go
  • pkg/flags/types.go
  • cmd/scaffold/scaffold.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*_test.go : Every new feature must include comprehensive unit tests

Applied to files:

  • pkg/flags/viper_helpers_test.go
  • pkg/generator/setup/setup_test.go
  • pkg/flags/string_map_integration_test.go
  • pkg/flags/string_map_flag_test.go
  • pkg/project/config/config_refactor_test.go
  • pkg/generator/ui/ui_tea_test.go
  • pkg/generator/engine/templating_refactor_test.go
  • .claude/agents/ui-test-developer.md
  • pkg/generator/ui/ui_test.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*_test.go : Use table-driven tests for multiple scenarios

Applied to files:

  • pkg/flags/viper_helpers_test.go
  • pkg/generator/setup/setup_test.go
  • pkg/flags/string_map_integration_test.go
  • pkg/flags/string_map_flag_test.go
  • pkg/project/config/config_refactor_test.go
  • pkg/generator/ui/ui_tea_test.go
  • pkg/generator/engine/templating_refactor_test.go
  • .claude/agents/ui-test-developer.md
  • pkg/generator/ui/ui_test.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*_test.go : Test both happy paths and error conditions

Applied to files:

  • pkg/flags/viper_helpers_test.go
  • pkg/flags/string_map_integration_test.go
  • pkg/flags/string_map_flag_test.go
  • pkg/project/config/config_refactor_test.go
  • pkg/generator/ui/ui_tea_test.go
  • pkg/generator/engine/templating_refactor_test.go
  • pkg/generator/ui/ui_test.go
📚 Learning: 2025-04-26T15:54:10.506Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 1195
File: internal/exec/terraform_clean.go:99-99
Timestamp: 2025-04-26T15:54:10.506Z
Learning: The error variable `ErrRelPath` is defined in `internal/exec/terraform_clean_util.go` and is used across files in the `exec` package, including in `terraform_clean.go`. This is part of an approach to standardize error handling in the codebase.

Applied to files:

  • errors/errors.go
📚 Learning: 2025-02-18T13:18:53.146Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-18T13:18:53.146Z
Learning: Error checking is not required for cobra.Command.RegisterFlagCompletionFunc calls as these are static configurations done at init time.

Applied to files:

  • pkg/flags/string_map_integration_test.go
  • pkg/flags/standard.go
📚 Learning: 2025-06-07T19:28:21.289Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1266
File: cmd/describe_affected.go:0-0
Timestamp: 2025-06-07T19:28:21.289Z
Learning: In the Atmos codebase, using panic for unsupported flag types in flag processing functions like setDescribeAffectedFlagValueInCliArgs is the expected behavior rather than returning errors. This pattern is preferred for developer errors when unsupported types are added to the flagsKeyValue map.

Applied to files:

  • pkg/flags/string_map_integration_test.go
  • pkg/flags/standard.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/!(*_test).go : Document all exported functions, types, and methods with Go doc comments

Applied to files:

  • pkg/flags/string_map_flag_test.go
  • pkg/project/config/config_refactor_test.go
  • pkg/generator/engine/templating_refactor_test.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Use kebab-case for command-line flags

Applied to files:

  • pkg/flags/types.go
  • pkg/flags/standard.go
📚 Learning: 2025-09-29T02:20:11.636Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1540
File: internal/exec/validate_component.go:117-118
Timestamp: 2025-09-29T02:20:11.636Z
Learning: The ValidateComponent function in internal/exec/validate_component.go had its componentSection parameter type refined from `any` to `map[string]any` without adding new parameters. This is a type safety improvement, not a signature change requiring call site updates.

Applied to files:

  • pkg/flags/types.go
📚 Learning: 2025-06-23T02:14:30.937Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1327
File: cmd/terraform.go:111-117
Timestamp: 2025-06-23T02:14:30.937Z
Learning: In cmd/terraform.go, flags for the DescribeAffected function are added dynamically at runtime when info.Affected is true. This is intentional to avoid exposing internal flags like "file", "format", "verbose", "include-spacelift-admin-stacks", "include-settings", and "upload" in the terraform command interface, while still providing them for the shared DescribeAffected function used by both `atmos describe affected` and `atmos terraform apply --affected`.

Applied to files:

  • pkg/flags/types.go
📚 Learning: 2025-11-07T14:52:55.205Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1761
File: docs/prd/claude-agent-architecture.md:331-439
Timestamp: 2025-11-07T14:52:55.205Z
Learning: In the cloudposse/atmos repository, Claude agents are used as interactive tools, not in automated/headless CI/CD contexts. Agent documentation and patterns should assume synchronous human interaction.

Applied to files:

  • .claude/agents/README.md
  • .claude/agents/ui-test-developer.md
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to go.{mod,sum} : Manage dependencies with Go modules

Applied to files:

  • go.mod
📚 Learning: 2025-02-21T20:56:05.539Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1077
File: pkg/downloader/custom_github_detector.go:0-0
Timestamp: 2025-02-21T20:56:05.539Z
Learning: The `github.com/charmbracelet/log` package should be imported with the alias `log` according to the project's import alias configuration.

Applied to files:

  • go.mod
📚 Learning: 2025-02-21T20:56:20.761Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1077
File: pkg/downloader/custom_github_detector_test.go:0-0
Timestamp: 2025-02-21T20:56:20.761Z
Learning: The `github.com/charmbracelet/log` package should be imported with the alias `log`, not `clog`.

Applied to files:

  • go.mod
📚 Learning: 2025-02-07T19:21:38.028Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-07T19:21:38.028Z
Learning: The cobra.Command.RegisterFlagCompletionFunc method (as of cobra v1.8.1) never returns an error. It only initializes an internal map and stores the completion function, always returning nil. Error handling for this method call is unnecessary.

Applied to files:

  • pkg/flags/standard.go
📚 Learning: 2025-02-07T19:21:38.028Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 992
File: cmd/vendor_pull.go:31-31
Timestamp: 2025-02-07T19:21:38.028Z
Learning: The cobra.Command.RegisterFlagCompletionFunc method never returns an error as it simply stores the completion function in an internal map. Error handling for this method call is unnecessary.

Applied to files:

  • pkg/flags/standard.go
📚 Learning: 2025-04-23T15:02:50.246Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1202
File: pkg/utils/yaml_func_exec.go:104-104
Timestamp: 2025-04-23T15:02:50.246Z
Learning: In the Atmos codebase, direct calls to `os.Getenv` should be avoided. Instead, use `viper.BindEnv` for environment variable access. This provides a consistent approach to configuration management across the codebase.

Applied to files:

  • pkg/flags/viper_helpers.go
  • pkg/project/config/config.go
📚 Learning: 2025-09-29T15:47:10.908Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1540
File: internal/exec/terraform_cli_args_utils.go:64-73
Timestamp: 2025-09-29T15:47:10.908Z
Learning: In the Atmos codebase, viper.BindEnv is required for CLI commands in the cmd/ package, but internal utilities can use os.Getenv directly when parsing environment variables for business logic purposes. The requirement to use viper is specific to the CLI interface layer, not all environment variable access throughout the codebase.

Applied to files:

  • pkg/flags/viper_helpers.go
📚 Learning: 2025-11-08T19:56:18.647Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1697
File: internal/exec/oci_utils.go:0-0
Timestamp: 2025-11-08T19:56:18.647Z
Learning: In the Atmos codebase, when a function receives an `*schema.AtmosConfiguration` parameter, it should read configuration values from `atmosConfig.Settings` fields rather than using direct `os.Getenv()` or `viper.GetString()` calls. The Atmos pattern is: viper.BindEnv in cmd/root.go binds environment variables → Viper unmarshals into atmosConfig.Settings via mapstructure → business logic reads from the Settings struct. This provides centralized config management, respects precedence, and enables testability. Example: `atmosConfig.Settings.AtmosGithubToken` instead of `os.Getenv("ATMOS_GITHUB_TOKEN")` in functions like `getGHCRAuth` in internal/exec/oci_utils.go.

Applied to files:

  • pkg/project/config/config.go
  • cmd/scaffold/scaffold.go
📚 Learning: 2024-12-02T21:26:32.337Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: pkg/config/config.go:478-483
Timestamp: 2024-12-02T21:26:32.337Z
Learning: In the 'atmos' project, when reviewing Go code like `pkg/config/config.go`, avoid suggesting file size checks after downloading remote configs if such checks aren't implemented elsewhere in the codebase.

Applied to files:

  • pkg/project/config/config.go
  • pkg/generator/engine/templating_refactor_test.go
  • cmd/scaffold/scaffold.go
  • pkg/generator/engine/templating.go
📚 Learning: 2024-12-11T18:40:12.808Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.

Applied to files:

  • pkg/project/config/config.go
📚 Learning: 2025-07-05T20:59:02.914Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1363
File: internal/exec/template_utils.go:18-18
Timestamp: 2025-07-05T20:59:02.914Z
Learning: In the Atmos project, gomplate v4 is imported with a blank import (`_ "github.com/hairyhenderson/gomplate/v4"`) alongside v3 imports to resolve AWS SDK version conflicts. V3 uses older AWS SDK versions that conflict with newer AWS modules used by Atmos. A full migration to v4 requires extensive refactoring due to API changes and should be handled in a separate PR.

Applied to files:

  • pkg/project/config/config.go
  • cmd/scaffold/scaffold.go
  • pkg/generator/engine/templating.go
📚 Learning: 2024-10-23T21:36:40.262Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 740
File: cmd/cmd_utils.go:340-359
Timestamp: 2024-10-23T21:36:40.262Z
Learning: In the Go codebase for Atmos, when reviewing functions like `checkAtmosConfig` in `cmd/cmd_utils.go`, avoid suggesting refactoring to return errors instead of calling `os.Exit` if such changes would significantly increase the scope due to the need to update multiple call sites.

Applied to files:

  • pkg/project/config/config.go
  • pkg/generator/engine/templating_refactor_test.go
  • cmd/scaffold/scaffold.go
📚 Learning: 2024-12-12T15:17:45.245Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2024-12-12T15:17:45.245Z
Learning: In `examples/demo-atmos.d/atmos.d/tools/helmfile.yml`, when suggesting changes to `kubeconfig_path`, ensure that the values use valid Go template syntax.

Applied to files:

  • pkg/project/config/config.go
  • pkg/generator/engine/templating_refactor_test.go
  • cmd/scaffold/scaffold.go
  • pkg/generator/engine/templating.go
📚 Learning: 2025-04-04T02:03:23.676Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1185
File: internal/exec/yaml_func_store.go:26-26
Timestamp: 2025-04-04T02:03:23.676Z
Learning: The Atmos codebase currently uses `log.Fatal` for error handling in multiple places. The maintainers are aware this isn't an ideal pattern (should only be used in main() or init() functions) and plan to address it comprehensively in a separate PR. CodeRabbit should not flag these issues or push for immediate changes until that refactoring is complete.

Applied to files:

  • pkg/project/config/config.go
📚 Learning: 2025-08-29T20:57:35.423Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1433
File: cmd/theme_list.go:33-36
Timestamp: 2025-08-29T20:57:35.423Z
Learning: In the Atmos codebase, avoid using viper.SetEnvPrefix("ATMOS") with viper.AutomaticEnv() because canonical environment variable names are not exclusive to Atmos and could cause conflicts. Instead, use selective environment variable binding through the setEnv function in pkg/config/load.go with bindEnv(v, "config.key", "ENV_VAR_NAME") for specific environment variables.

Applied to files:

  • pkg/project/config/config.go
📚 Learning: 2025-01-07T20:38:09.618Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 896
File: cmd/editor_config.go:37-40
Timestamp: 2025-01-07T20:38:09.618Z
Learning: Error handling suggestion for `cmd.Help()` in `cmd/editor_config.go` was deferred as the code is planned for future modifications.

Applied to files:

  • pkg/project/config/config.go
  • pkg/generator/engine/templating.go
📚 Learning: 2024-10-20T13:06:20.839Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 736
File: pkg/utils/file_utils.go:177-194
Timestamp: 2024-10-20T13:06:20.839Z
Learning: In `pkg/utils/file_utils.go`, the `SearchConfigFile` function should focus on returning the file path and an `exists` boolean without returning an error.

Applied to files:

  • pkg/project/config/config.go
📚 Learning: 2024-10-22T23:00:20.627Z
Learnt from: Cerebrovinny
Repo: cloudposse/atmos PR: 737
File: internal/exec/vendor_utils.go:131-141
Timestamp: 2024-10-22T23:00:20.627Z
Learning: In the `ReadAndProcessVendorConfigFile` function in `internal/exec/vendor_utils.go`, the existence of the vendor config file is already checked, so additional file existence checks may be unnecessary.

Applied to files:

  • pkg/project/config/config.go
  • pkg/generator/engine/templating_refactor_test.go
  • pkg/generator/engine/templating.go
📚 Learning: 2025-09-13T18:06:07.674Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/list.go:39-42
Timestamp: 2025-09-13T18:06:07.674Z
Learning: In the cloudposse/atmos repository, for UI messages in the toolchain package, use utils.PrintfMessageToTUI instead of log.Error or fmt.Fprintln(os.Stderr, ...). Import pkg/utils with alias "u" to follow the established pattern.

Applied to files:

  • pkg/generator/ui/ui_tea_test.go
  • pkg/generator/ui/ui_test.go
📚 Learning: 2025-01-25T03:49:03.951Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: internal/exec/template_utils.go:268-271
Timestamp: 2025-01-25T03:49:03.951Z
Learning: The `ProcessTmplWithDatasourcesGomplate` function in `internal/exec/template_utils.go` is used for documentation generation purposes, where simple environment variable handling is acceptable and thread-safety concerns are not critical.

Applied to files:

  • pkg/generator/engine/templating_refactor_test.go
  • pkg/generator/engine/templating.go
📚 Learning: 2025-05-23T19:51:47.091Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected_test.go:15-15
Timestamp: 2025-05-23T19:51:47.091Z
Learning: The atmos codebase has a custom extension to *testing.T that provides a Chdir method, allowing test functions to call t.Chdir() to change working directories during tests. This is used consistently across test files in the codebase.

Applied to files:

  • pkg/generator/engine/templating_refactor_test.go
  • pkg/generator/ui/ui_test.go
📚 Learning: 2025-08-15T14:43:41.030Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1352
File: pkg/store/artifactory_store_test.go:108-113
Timestamp: 2025-08-15T14:43:41.030Z
Learning: In test files for the atmos project, it's acceptable to ignore errors from os.Setenv/Unsetenv operations during test environment setup and teardown, as these are controlled test scenarios.

Applied to files:

  • pkg/generator/engine/templating_refactor_test.go
📚 Learning: 2025-05-23T19:51:47.091Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1255
File: cmd/describe_affected_test.go:15-15
Timestamp: 2025-05-23T19:51:47.091Z
Learning: In the atmos codebase, t.Chdir() is a valid method call on *testing.T objects and works correctly for changing directories in tests. This is implemented through custom testing framework extensions and is used consistently throughout the test suite.

Applied to files:

  • pkg/generator/engine/templating_refactor_test.go
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to cmd/**/*.go : Use Cobra's recommended command structure with a root command and subcommands

Applied to files:

  • cmd/scaffold/scaffold.go
📚 Learning: 2024-12-07T16:16:13.038Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 825
File: internal/exec/helmfile_generate_varfile.go:28-31
Timestamp: 2024-12-07T16:16:13.038Z
Learning: In `internal/exec/helmfile_generate_varfile.go`, the `--help` command (`./atmos helmfile generate varfile --help`) works correctly without requiring stack configurations, and the only change needed was to make `ProcessCommandLineArgs` exportable by capitalizing its name.

Applied to files:

  • cmd/scaffold/scaffold.go
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-10-07T00:25:16.333Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1498
File: website/src/components/Screengrabs/atmos-terraform-metadata--help.html:25-55
Timestamp: 2025-10-07T00:25:16.333Z
Learning: In Atmos CLI, subcommands inherit flags from their parent commands via Cobra's command inheritance. For example, `atmos terraform metadata --help` shows `--affected` and related flags inherited from the parent `terraform` command (defined in cmd/terraform.go), even though the metadata subcommand doesn't explicitly define these flags. This is expected Cobra behavior and auto-generated help screengrabs accurately reflect this inheritance.

Applied to files:

  • cmd/scaffold/scaffold.go
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-10-10T23:51:36.597Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1599
File: internal/exec/terraform.go:394-402
Timestamp: 2025-10-10T23:51:36.597Z
Learning: In Atmos (internal/exec/terraform.go), when adding OpenTofu-specific flags like `--var-file` for `init`, do not gate them based on command name (e.g., checking if `info.Command == "tofu"` or `info.Command == "opentofu"`) because command names don't reliably indicate the actual binary being executed (symlinks, aliases). Instead, document the OpenTofu requirement in code comments and documentation, trusting users who enable the feature (e.g., `PassVars`) to ensure their terraform command points to an OpenTofu binary.

Applied to files:

  • cmd/scaffold/scaffold.go
📚 Learning: 2025-04-11T22:06:46.999Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1147
File: internal/exec/validate_schema.go:42-57
Timestamp: 2025-04-11T22:06:46.999Z
Learning: The "ExecuteAtmosValidateSchemaCmd" function in internal/exec/validate_schema.go has been reviewed and confirmed to have acceptable cognitive complexity despite static analysis warnings. The function uses a clean structure with only three if statements for error handling and delegates complex operations to helper methods.

Applied to files:

  • cmd/scaffold/scaffold.go
📚 Learning: 2024-10-20T13:12:46.499Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 736
File: pkg/config/const.go:6-6
Timestamp: 2024-10-20T13:12:46.499Z
Learning: In `cmd/cmd_utils.go`, it's acceptable to have hardcoded references to `atmos.yaml` in logs, and it's not necessary to update them to use the `CliConfigFileName` constant.

Applied to files:

  • cmd/scaffold/scaffold.go
📚 Learning: 2025-08-16T23:32:40.412Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:455-456
Timestamp: 2025-08-16T23:32:40.412Z
Learning: In the cloudposse/atmos Go codebase, `InitCliConfig` returns a `schema.AtmosConfiguration` value (not a pointer), while `ExecuteDescribeDependents` expects a `*schema.AtmosConfiguration` pointer parameter. Therefore, when passing the result of `InitCliConfig` to `ExecuteDescribeDependents`, use `&atmosConfig` to pass the address of the value.

Applied to files:

  • cmd/scaffold/scaffold.go
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-01-19T15:49:15.593Z
Learning: In future commits, the help text for Atmos CLI commands should be limited to only show component and stack parameters for commands that actually use them. This applies to the example usage section in command help text.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-09-27T20:50:20.564Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1533
File: pkg/config/load.go:585-637
Timestamp: 2025-09-27T20:50:20.564Z
Learning: In the cloudposse/atmos repository, command merging prioritizes precedence over display ordering. Help commands are displayed lexicographically regardless of internal array order, so the mergeCommandArrays function focuses on ensuring the correct precedence chain (top-level file wins) rather than maintaining specific display order.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-03-18T12:26:25.329Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-18T12:26:25.329Z
Learning: In the Atmos project, typos or inconsistencies in test snapshot files (such as "terrafrom" instead of "terraform") may be intentional as they capture the exact output of commands and should not be flagged as issues requiring correction.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-01-25T03:51:57.689Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-09-10T21:17:55.273Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: toolchain/http_client_test.go:3-10
Timestamp: 2025-09-10T21:17:55.273Z
Learning: In the cloudposse/atmos repository, imports should never be changed as per samtholiya's coding guidelines.

Applied to files:

  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Before submitting PRs, ensure tests pass, coverage targets met, run golangci-lint, and update documentation

Applied to files:

  • .claude/agents/ui-test-developer.md
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Target >80% code coverage for all packages

Applied to files:

  • .claude/agents/ui-test-developer.md
📚 Learning: 2025-01-25T03:46:21.660Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: examples/quick-start-advanced/components/terraform/vpc/README.md.gotmpl:0-0
Timestamp: 2025-01-25T03:46:21.660Z
Learning: Template formatting and content changes in `.gotmpl` files are out of scope for review unless explicitly requested.

Applied to files:

  • pkg/generator/engine/templating.go
📚 Learning: 2025-09-30T19:03:50.738Z
Learnt from: Cerebrovinny
Repo: cloudposse/atmos PR: 1560
File: pkg/utils/string_utils.go:43-64
Timestamp: 2025-09-30T19:03:50.738Z
Learning: In the Atmos codebase, YAML tags like !terraform.output rely on positional arguments, so the SplitStringByDelimiter function in pkg/utils/string_utils.go must preserve empty strings (even after trimming quotes) to maintain the correct number of positional arguments. Filtering out empty values after trimming would collapse the array and break these function calls.

Applied to files:

  • pkg/generator/engine/templating.go
🧬 Code graph analysis (16)
pkg/flags/options.go (2)
pkg/perf/perf.go (1)
  • Track (121-138)
pkg/flags/types.go (1)
  • StringMapFlag (301-308)
pkg/flags/viper_helpers_test.go (1)
pkg/flags/viper_helpers.go (1)
  • ParseStringMap (61-112)
pkg/generator/setup/setup_test.go (1)
pkg/generator/setup/setup.go (1)
  • NewGeneratorContext (20-39)
pkg/flags/string_map_integration_test.go (3)
pkg/flags/standard_parser.go (1)
  • NewStandardParser (34-40)
pkg/flags/options.go (4)
  • WithStringMapFlag (120-131)
  • WithEnvVars (252-275)
  • WithBoolFlag (51-62)
  • WithStringFlag (37-48)
pkg/flags/viper_helpers.go (1)
  • ParseStringMap (61-112)
pkg/flags/string_map_flag_test.go (1)
pkg/flags/types.go (2)
  • StringMapFlag (301-308)
  • Flag (11-36)
pkg/generator/setup/setup.go (4)
pkg/generator/ui/ui.go (2)
  • InitUI (78-88)
  • NewInitUI (91-103)
pkg/io/context.go (1)
  • NewContext (22-46)
pkg/io/terminal_adapter.go (1)
  • NewTerminalWriter (14-18)
pkg/terminal/terminal.go (1)
  • WithIO (192-196)
pkg/flags/types.go (1)
pkg/perf/perf.go (1)
  • Track (121-138)
pkg/flags/standard.go (2)
pkg/flags/types.go (1)
  • StringMapFlag (301-308)
pkg/perf/perf.go (1)
  • Track (121-138)
pkg/project/config/config_refactor_test.go (1)
pkg/project/config/config.go (2)
  • ScaffoldConfig (43-50)
  • FieldDefinition (53-62)
pkg/flags/viper_helpers.go (1)
pkg/perf/perf.go (1)
  • Track (121-138)
pkg/project/config/config.go (2)
pkg/generator/templates/embeds.go (2)
  • HasScaffoldConfig (152-159)
  • File (23-29)
pkg/generator/types/types.go (1)
  • File (6-11)
pkg/generator/ui/ui_tea_test.go (1)
internal/tui/templates/templater.go (1)
  • GetTerminalWidth (245-258)
pkg/generator/engine/templating_refactor_test.go (1)
pkg/generator/engine/templating.go (1)
  • NewProcessor (43-47)
cmd/scaffold/scaffold.go (8)
pkg/flags/standard_parser.go (2)
  • StandardParser (18-22)
  • NewStandardParser (34-40)
pkg/flags/viper_helpers.go (1)
  • ParseStringMap (61-112)
pkg/flags/options.go (3)
  • WithBoolFlag (51-62)
  • WithStringMapFlag (120-131)
  • WithEnvVars (252-275)
errors/errors.go (3)
  • ErrScaffoldGeneration (184-184)
  • ErrScaffoldNotFound (182-182)
  • ErrScaffoldValidation (183-183)
pkg/generator/setup/setup.go (1)
  • NewGeneratorContext (20-39)
pkg/generator/templates/embeds.go (2)
  • GetAvailableConfigurations (32-55)
  • Configuration (13-20)
pkg/project/config/config.go (1)
  • ReadAtmosScaffoldSection (497-527)
pkg/ui/formatter.go (3)
  • Warning (162-169)
  • Successf (129-136)
  • Success (118-125)
pkg/generator/ui/ui_test.go (7)
pkg/generator/ui/ui.go (2)
  • InitUI (78-88)
  • NewInitUI (91-103)
pkg/io/context.go (1)
  • NewContext (22-46)
pkg/ui/formatter.go (1)
  • InitFormatter (31-48)
pkg/io/terminal_adapter.go (1)
  • NewTerminalWriter (14-18)
pkg/terminal/terminal.go (1)
  • WithIO (192-196)
pkg/generator/engine/templating_test.go (2)
  • TestProcessFile_NewFile (486-517)
  • TestProcessFile_ExistingFile_NoFlags (520-551)
pkg/generator/engine/templating.go (1)
  • File (20-25)
pkg/generator/engine/templating.go (5)
pkg/generator/ui/ui.go (1)
  • FileSkippedError (28-31)
pkg/generator/merge/merge.go (2)
  • ThreeWayMerger (11-13)
  • NewThreeWayMerger (16-20)
internal/exec/template_funcs.go (1)
  • FuncMap (21-34)
pkg/generator/types/types.go (1)
  • File (6-11)
pkg/project/config/config.go (1)
  • ScaffoldConfig (43-50)
🪛 LanguageTool
.claude/agents/ui-test-developer.md

[grammar] ~167-~167: Please add a punctuation mark at the end of paragraph.
Context: ...atching - Test observable behavior, not implementation ### Pattern 3: Output Buffering Targe...

(PUNCTUATION_PARAGRAPH_END)


[style] ~304-~304: “Low-hanging fruit” can be a clichéd phrase in professional communication. Consider an alternative expression to make your writing more engaging and original.
Context: ...Priority Order) 1. Helper functions (Low-hanging fruit) - `generateSuggestedDirectoryWith...

(LOW_HANGING_FRUIT)

🪛 markdownlint-cli2 (0.18.1)
.claude/agents/ui-test-developer.md

343-343: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Build (windows)
  • GitHub Check: Build (macos)
  • GitHub Check: Review Dependency Licenses
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (go)
  • GitHub Check: website-deploy-preview
  • GitHub Check: Run pre-commit hooks
  • GitHub Check: autofix
  • GitHub Check: Summary
🔇 Additional comments (25)
pkg/project/config/config.go (2)

238-238: Consider centralizing accessibility configuration.

Direct os.Getenv bypasses the centralized config pattern used elsewhere in Atmos. While acceptable for local UI concerns, consider whether this should flow through the settings struct for consistency.

Based on learnings.


429-432: Return error instead of panic for unsupported field types.

Panicking in production code is fragile. Return an error to let callers handle validation failures gracefully.

-func createField(key string, field FieldDefinition, values map[string]interface{}) (huh.Field, func() interface{}) {
+func createField(key string, field FieldDefinition, values map[string]interface{}) (huh.Field, func() interface{}, error) {
 	// Get current value or default
 	currentValue := values[key]
 	if currentValue == nil {
 		currentValue = field.Default
 	}
 
 	switch field.Type {
 	case "input", "text", "string":
 		// ... implementation ...
-		return input, func() interface{} { return value }
+		return input, func() interface{} { return value }, nil
 
 	// ... other cases ...
 
 	default:
-		// Panic for unsupported field types with a helpful message
 		supportedTypes := []string{"input", "text", "string", "select", "multiselect", "confirm", "bool", "boolean"}
-		panic(fmt.Sprintf("unsupported field type '%s' for field '%s'. Supported types: %s",
-			field.Type, key, strings.Join(supportedTypes, ", ")))
+		return nil, nil, fmt.Errorf("unsupported field type '%s' for field '%s'. Supported types: %s",
+			field.Type, key, strings.Join(supportedTypes, ", "))
 	}
 }

Update createFormGroup to handle the error:

 func createFormGroup(items []fieldItem, formValues map[string]interface{}, valueGetters map[string]func() interface{}) *huh.Group {
 	var groupFields []huh.Field
 
 	for _, item := range items {
-		field, getter := createField(item.key, item.field, formValues)
+		field, getter, err := createField(item.key, item.field, formValues)
+		if err != nil {
+			// Handle error appropriately - could return error or skip field
+			continue
+		}
 		groupFields = append(groupFields, field)
 		valueGetters[item.key] = getter
 	}
⛔ Skipped due to learnings
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1266
File: cmd/describe_affected.go:0-0
Timestamp: 2025-06-07T19:28:21.289Z
Learning: In the Atmos codebase, using panic for unsupported flag types in flag processing functions like setDescribeAffectedFlagValueInCliArgs is the expected behavior rather than returning errors. This pattern is preferred for developer errors when unsupported types are added to the flagsKeyValue map.
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*.go : Consider custom error types for domain-specific errors
pkg/project/config/config_refactor_test.go (1)

1-346: Solid test coverage.

The table-driven tests comprehensively validate form value initialization, field grouping, value extraction, form construction, and group creation. Good coverage of edge cases including nil defaults, empty configs, and type conversions.

.claude/agents/README.md (1)

14-18: LGTM - Clear documentation for the new UI test agent.

The agent documentation follows the established pattern and provides clear guidance on when to invoke the ui-test-developer agent. The specialized focus on TeaTest patterns and Atmos TUI components is well-articulated.

tests/snapshots/TestCLICommands_atmos_--help.stdout.golden (2)

22-22: LGTM - Init command properly added to help output.

The init command description clearly communicates its purpose for project initialization from templates.


26-26: LGTM - Scaffold command properly added to help output.

The scaffold command description is clear and follows the established format for command help text.

.claude/agents/ui-test-developer.md (1)

1-632: Excellent comprehensive testing guide for TUI components.

This agent documentation provides thorough, actionable patterns for testing Atmos TUI components with Charmbracelet libraries. The structure is logical, examples are clear, and the coverage strategy is well-defined. The emphasis on ANSI stripping, observable behavior testing, and table-driven tests aligns perfectly with the coding guidelines.

pkg/generator/engine/templating_refactor_test.go (1)

1-459: Excellent comprehensive test suite for templating engine.

This test file demonstrates best practices:

  • Table-driven tests for all scenarios
  • Tests both happy paths and error conditions
  • Clear test case naming
  • Proper filesystem cleanup with t.TempDir()
  • Good separation of concerns with individual test functions

The coverage of delimiter extraction, path processing, directory creation, file operations, and content processing provides solid validation of the templating engine's core functionality.

go.mod (1)

39-39: LGTM - Dependency promotion for direct ANSI usage.

Promoting github.com/charmbracelet/x/ansi from indirect to direct dependency is appropriate given the new UI testing and ANSI handling requirements in the init/scaffold workflow. The version remains unchanged at v0.10.1.

pkg/flags/standard.go (2)

197-198: LGTM - StringMapFlag case added to registration flow.

The addition properly routes StringMapFlag through the new helper function, maintaining consistency with other flag type handlers.


252-273: Well-implemented StringMapFlag registration.

The approach of converting map defaults to key=value string slices is the right solution given Cobra's lack of native map support. The implementation:

  • Correctly converts map entries to slice format
  • Registers as StringSlice for Cobra compatibility
  • Properly handles required flag marking
  • Includes clear documentation explaining the design choice

The parsing of these values into a map is handled by ParseStringMap() in viper_helpers.go (as noted in comments), maintaining good separation of concerns.

pkg/flags/options.go (1)

102-131: Excellent implementation of WithStringMapFlag helper.

This function follows the established pattern perfectly:

  • Consistent signature with other flag helpers
  • Comprehensive documentation with clear examples
  • Shows usage across CLI, environment variables, and config files
  • Properly references ParseStringMap() for value retrieval
  • Includes performance tracking consistent with other helpers

The documentation is particularly helpful, showing the three different ways to provide map values (CLI repeated flags, ENV comma-separated, config YAML).

pkg/flags/string_map_flag_test.go (1)

1-255: Excellent test coverage for the new StringMapFlag type.

The test suite is comprehensive and follows the coding guidelines perfectly. It covers all interface methods, edge cases (nil, empty, single, multiple values), zero-value behavior, and real-world usage scenarios with table-driven tests.

pkg/flags/viper_helpers.go (1)

49-112: ParseStringMap implementation looks solid.

The function correctly handles all Viper source types (CLI flags, env vars, config files) with appropriate parsing and validation. The silent skipping of malformed pairs is well-documented and reasonable for user experience.

pkg/generator/setup/setup.go (2)

18-39: Nice separation of setup logic.

The constructor properly initializes all components in dependency order with good error handling.


11-16: Add Go doc comment for exported GeneratorContext type.

Per coding guidelines, all exported types must have Go doc comments.

+// GeneratorContext holds the I/O and UI components needed for generator commands.
+// It provides a centralized container for shared infrastructure required by
+// init and scaffold commands.
 type GeneratorContext struct {
 	IOContext iolib.Context
 	Terminal  terminal.Terminal
 	UI        *generatorUI.InitUI
 }

As per coding guidelines.

⛔ Skipped due to learnings
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/!(*_test).go : Document all exported functions, types, and methods with Go doc comments
Learnt from: CR
Repo: cloudposse/atmos PR: 0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*.go : Document complex logic with inline comments
pkg/generator/ui/ui_test.go (1)

1-114: Solid test coverage for UI component.

Tests cover initialization, successful file processing, and error conditions with proper assertions. The helper function follows Go test best practices.

pkg/flags/viper_helpers_test.go (1)

1-300: Outstanding test coverage for ParseStringMap functionality.

The test suite is exceptionally thorough with table-driven tests covering all input types, edge cases, and real-world scenarios. Particularly appreciate the URL, JSON, and Git URL test cases that reflect actual usage patterns.

pkg/flags/types.go (1)

290-357: Well-designed StringMapFlag type with excellent documentation.

The type correctly implements the Flag interface and includes comprehensive documentation with usage patterns. The implementation is consistent with existing flag types in the file.

errors/errors.go (1)

178-189: Clear and well-organized error sentinels.

The new error sentinels for init and scaffold functionality are appropriately named, logically grouped with a descriptive comment, and consistent with the existing error handling patterns in the codebase.

pkg/flags/string_map_integration_test.go (1)

1-461: The race detector can't run in this sandbox (CGO isn't available), but that's an environment limitation, not a code issue. The test file itself looks solid—it has table-driven tests, error scenarios, real-world use cases, and concurrent access coverage. This aligns well with the learnings for comprehensive testing.

I'll remove the unexecutable suggestion and finalize the review:


Comprehensive integration test suite.

The tests verify end-to-end functionality including registration, binding, parsing, precedence rules, and concurrent access. Table-driven tests cover multiple scenarios, error conditions are tested explicitly, and real-world use cases demonstrate practical patterns. The concurrent access test ensures thread safety at the unit level.

pkg/generator/ui/ui_tea_test.go (1)

1-709: Excellent test coverage.

The test suite is comprehensive and follows Go testing best practices. Table-driven tests cover multiple scenarios, edge cases are handled, and ANSI stripping ensures reliable assertions. The approach of verifying non-panic behavior for methods that write to external UI surfaces is pragmatic given the constraints.

pkg/generator/engine/templating.go (1)

145-173: Delimiter extraction now handles all types correctly.

The function properly extracts delimiters from *config.ScaffoldConfig, value types, and map fallback. This addresses the previous concern about missing struct support.

cmd/scaffold/scaffold.go (2)

233-260: Template loading correctly merges embedded and configured sources.

The implementation loads embedded templates first, then merges atmos.yaml templates with proper override semantics. This addresses the previous concern about missing atmos.yaml template support.


50-532: Solid command implementation following Cobra patterns.

The scaffold command structure is well-organized with clear help text, proper flag handling via StandardParser/Viper for precedence, and good error messages with troubleshooting context. The separation of concerns between CLI interface and logic is clean.

As per coding guidelines.

Comment thread pkg/generator/engine/templating.go Resolved
@mergify

mergify Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

@mergify

mergify Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏

The `atmos toolchain info` acceptance test fetches live GitHub release
data for junegunn/fzf; changed upstream release-note content shifted
the table's auto-computed column widths, going stale vs the committed
golden file and failing CI on linux/macos. Verified the two sibling
snapshots (raw-format, atmos-inline registry) already reflect the
current live-data-driven widths, confirming this is a stale golden,
not an app regression -- pkg/toolchain/info.go itself is untouched by
this branch.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…scaffold code

Addresses 33 golangci-lint findings on lines this branch's toolchain-proxy,
scaffold, and init work touched (err113, forbidigo, funlen, gocognit, godot,
gosec, lintroller, nestif, revive):

- pkg/toolchain/proxy.go, pkg/toolchain/env.go: wrap dynamic errors as
  static sentinels, replace os.Getenv with viper.BindEnv, extract helpers
  to reduce SyncProxies/RunProxy/PrepareProxyEnvironment/emitEnvOutput
  complexity, add missing perf.Track calls, named constants for repeated
  format strings and file-mode literals, justify the resolved-binary
  exec.Command call flagged by gosec.
- pkg/project/config/config.go: split into form.go/persistence.go/
  validation.go to clear the 500-line file-length limit.
- pkg/generator/ui/ui.go, pkg/generator/source/resolver.go,
  cmd/init/init.go: extract helpers to clear funlen/nestif/function-length.
- pkg/runner/step/cast.go, cast_simulate.go: capitalize two doc comments.

Verified: `atmos fix lint` reports 0 issues, `go build ./...` succeeds,
and all touched packages' tests pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Bump the transitive websocket-driver dependency (via faye-websocket,
pulled in by webpack-dev-server) from 0.7.4 to the patched 0.7.5 via a
pnpm override, addressing:

- GHSA-xv26-6w52-cph6 / CVE-2026-54466 (critical): message corruption
  via abuse of protocol length headers.
- GHSA-mp7j-qc5w-4988 / CVE-2026-54490 (medium): resource-limit bypass
  via message compression.

Patch-level bump (0.7.4 -> 0.7.5), not blocked by dependabot.yml's
major-version ignore rule. Verified: website build succeeds, patch-scoped
lint is clean (no Go files touched).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…achine contention

The hourly pr-maintenance-loop's `atmos fix coverage` step was panicking
with "test timed out after 10m0s" on internal/exec and tests -- Go's
default per-binary timeout, sized for a single package on a dedicated
runner. This branch's touched-package set includes slow acceptance
suites that finish well under 10m on CI's dedicated runners, but this
dev machine runs several Claude Code worktree sessions concurrently
(confirmed via `uptime`: load averages of 15-40 against 16 cores, plus
a second `go test` process from another worktree competing for the
same CPUs), which was enough to blow past the default timeout with no
actual test failure.

Set -timeout 55m explicitly, just under CI's own Acceptance Tests
job-level ceiling (.github/workflows/test.yml timeout-minutes: 60) --
real headroom for contention without masking a genuine deadlock
outright.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
1. Disable commit signing in throwaway git-fixture test repos. Root cause
   of the hourly loop's repeated "test timed out after Nm" panics on
   internal/exec and tests:
   TestRemoteStackImports_GitDirectoryAndSkipIfMissing alone ran 43+
   minutes before hitting the timeout wall -- not CPU contention, a hang.
   Its helper (and two other siblings with the same copy-pasted pattern,
   plus pkg/pro/commit_test.go) shells out to plain `git commit` in a temp
   fixture repo, which inherits this machine's global commit-signing
   config (1Password SSH signing). When the 1Password agent is
   slow/unresponsive under load, the commit call hangs instead of failing
   fast, consuming the whole test-run budget on one test. This exact issue
   was already identified and fixed once in pkg/stack/imports/remote_test.go
   ("flakes on dev machines whose global git config enables commit.gpgsign
   (e.g. a 1Password agent)"); this applies the same
   `git config commit.gpgsign false` guard to the other unguarded copies,
   found via a repo-wide grep for `exec.Command("git"...)` helpers that
   call "commit".

2. Give TestExclusiveLockContendsAcrossProcesses (pkg/filelock) more
   margin waiting on its helper subprocess. CI failure (Acceptance Tests
   windows, job 88112095180): "helper process did not release the lock"
   -- the test hard-codes a 1s wait for a re-exec'd subprocess to start
   and exit around a 300ms critical section. Windows process
   creation/teardown is far heavier than Unix, especially under load from
   the rest of the suite running concurrently, so 1s is too tight there.
   Bumped both waits to 5s via a named constant; the assertions themselves
   are unchanged. pkg/filelock is untouched by this branch, so this is a
   pre-existing CI reliability bug rather than something introduced here,
   fixed on direct user request after it blocked this PR's CI twice.

Verified: all five previously-flaky/hanging tests pass locally (filelock
suite full run, and each of the four commit-signing fixes individually),
`go build ./...` succeeds, and both packages lint clean.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
… paths

Patch-scoped coverage check found 1354 added-but-uncovered lines across
43 files on this branch's diff vs origin/main. Addressed the highest-value,
cleanly-testable gaps:

- pkg/project/config/persistence_test.go: pkg/project/config/persistence.go
  was entirely untested (HasScaffoldConfig/HasUserConfig/ReadScaffoldConfig/
  ReadAtmosScaffoldSection/GetConfigPath all 0%). Covers missing-file,
  mixed-case key preservation (yaml.v3 vs Viper), scaffold-section
  extraction/isolation, and ErrInvalidScaffoldSection. Package coverage
  78.1% -> 89.5%.

- pkg/manifest/load_extra_test.go: targeted uncovered branches in
  load.go/schema.go/registry.go -- the pointer-type-unwrap path in generic
  Load[S], yamlToJSONValue's parse/marshal error branches, buildValidationError's
  non-jsonschema.ValidationError fallback, and compileSchema/kindsHint error
  paths. Package coverage 86.1% -> 88.7%.

- cmd/proxy_test.go: cmd/proxy.go was entirely untested (0%). Covers
  proxyNameFromArgv, proxyConfigContextDetected, applyProxyEnvOverrides,
  proxyConfigSelection, and TryRunToolchainProxy's early-return/no-match/
  config-error branches.

Skipped with reasons (not coverage theater): a few schema-reflection error
branches in pkg/manifest that are unreachable without injecting fake
reflection failures on well-formed structs; cmd/proxy.go's successful-run
path (RunProxy is a direct package call, not DI'd, and is exercised by
pkg/toolchain's own suite); and a Windows-only .exe-suffix branch
unreachable on this runner's GOOS.

Verified: all new tests pass, `go build ./...` succeeds, patch-scoped
lint is clean.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…/scaffold skill docs

Adds dedicated doc pages for the junit, script, and workdir step types
(website/docs/workflows/workflows/workflow/steps/type/{junit,script,workdir}.mdx),
registers them in the step-type index and sidebar, and adds
TestStepDocumentationCoversRegisteredTypes (pkg/runner/step) asserting the
docs stay in sync with the step registry going forward.

Also refreshes the atmos-hooks/atmos-init/atmos-scaffold/atmos-steps
agent-skills to match, updates the init/scaffold CLI command docs and
several blog posts for accuracy, and adds a scaffoldhooks test covering
events/conditions/ordered steps together.

Verified: go build ./... succeeds, the new/touched Go tests pass,
patch-scoped lint is clean, and `npm run build` in website/ succeeds.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@atmos-pro

atmos-pro Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@github-actions

Copy link
Copy Markdown

These changes were released in v1.223.1-rc.2.

This branch was successfully deployed

No deployments
preview — ff0830c0 Deployed Jul 18, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New features that do not break anything size/xxl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants