Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Atmos CLI: Add Support for Custom Base Path and Config Paths #1091

Open
wants to merge 97 commits into
base: main
Choose a base branch
from

Conversation

haitham911
Copy link
Collaborator

@haitham911 haitham911 commented Feb 25, 2025

what

  • Add global command-line flags (--base-path, --config, and --config-path) to the Atmos CLI tool.
  • Add embedded config

why

The changes allow users to specify:

  • Base path for the Atmos project (--base-path).
  • Specific configuration files (--config).
  • Specific Configuration directories (--config-path).

references

Summary by CodeRabbit

  • New Features

    • Added persistent CLI flags (--base-path, --config, and --config-path) to allow users to specify a custom project base path and define multiple configuration files and directories.
    • Introduced an embedded configuration file for flexible log management.
  • Documentation

    • Updated help outputs and configuration guides to reflect the new flags and explain the configuration load order.

@mergify mergify bot removed the conflict This PR has conflicts label Mar 18, 2025
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

Attention: Patch coverage is 62.50000% with 57 lines in your changes missing coverage. Please review.

Project coverage is 25.96%. Comparing base (5b58700) to head (d3195a0).

Files with missing lines Patch % Lines
pkg/config/load_config_args.go 63.20% 31 Missing and 8 partials ⚠️
internal/exec/utils.go 25.00% 6 Missing and 3 partials ⚠️
pkg/config/load.go 70.00% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1091      +/-   ##
==========================================
+ Coverage   25.74%   25.96%   +0.22%     
==========================================
  Files         179      180       +1     
  Lines       20591    20730     +139     
==========================================
+ Hits         5301     5383      +82     
- Misses      14443    14491      +48     
- Partials      847      856       +9     
Flag Coverage Δ
unittests 25.96% <62.50%> (+0.22%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Base automatically changed from atmos-import-config to main March 21, 2025 20:51
@aknysh aknysh requested a review from a team as a code owner March 21, 2025 20:51
Copy link

mergify bot commented Mar 21, 2025

💥 This pull request now has conflicts. Could you fix it @haitham911? 🙏

@mergify mergify bot added the conflict This PR has conflicts label Mar 21, 2025
Copy link
Contributor

coderabbitai bot commented Mar 21, 2025

📝 Walkthrough

Walkthrough

This PR introduces three new persistent CLI flags—--base-path, --config, and --config-path—across multiple command and test files to improve configurability. It updates flag descriptions and adjusts command-line argument processing, including modifications to the configuration loading process. An embedded default configuration (atmos.yaml) is added along with new functions to merge configurations from embedded data and CLI args. Schema definitions are updated with new fields for CLI configuration, and documentation is enhanced to explain the new flags and load order.

Changes

File(s) Changes Summary
cmd/root.go, internal/exec/utils.go, internal/exec/vendor_utils_test.go, internal/exec/workflow_test.go, tests/snapshots/* Added new persistent flags (--base-path, --config, --config-path) and updated flag descriptions to ensure these options appear and work consistently across all Atmos CLI commands.
pkg/config/atmos.yaml, pkg/config/const.go, pkg/config/load.go, pkg/config/load_config_args.go, pkg/config/load_config_test.go, pkg/schema/schema.go, website/docs/cli/configuration/configuration.mdx Introduced an embedded default configuration file, enhanced configuration loading and merging logic (including error handling), and added new schema fields and documentation for supporting CLI configuration sources.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant FlagParser
  participant ConfigLoader
  participant Viper

  User->>CLI: Run command with flags (--base-path, --config, --config-path)
  CLI->>FlagParser: Parse persistent flags
  FlagParser->>ConfigLoader: Pass flag values
  ConfigLoader->>Viper: Load embedded default config (from atmos.yaml)
  Viper-->>ConfigLoader: Return merged embedded config
  ConfigLoader->>Viper: Merge CLI-specified config files and directories
  Viper-->>ConfigLoader: Return complete configuration
  ConfigLoader->>CLI: Provide merged configuration
  CLI->>User: Execute command with loaded configuration
Loading

Assessment against linked issues

Objective Addressed Explanation
Fix Atmos --base-path flag not working for terraform plan [DEV-2790]
Enable CLI-based specification of configuration paths (ATMOS_CLI_CONFIG_PATH equivalent) New --config and --config-path flags address this requirement.

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (18)
tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden (1)

108-108: Consider escaping angle brackets in example.

Based on previous feedback for Atmos CLI, angle brackets in command examples should be escaped using HTML entities (e.g., &lt;component-name&gt;) rather than using raw angle brackets.

-  $ atmos terraform [subcommand] <component-name> -s <stack-name>
+  $ atmos terraform [subcommand] &lt;component-name&gt; -s &lt;stack-name&gt;
.golangci.yml (1)

120-120: Remove duplicate "path" entry in allowStrs list.

The string "path" appears twice in the allowStrs list, which is redundant and could cause confusion.

-            allowStrs: '"","image","error","path","import","path","%w","%s"'
+            allowStrs: '"","image","error","path","import","%w","%s"'
tests/fixtures/scenarios/atmos-cli-imports/atmos.yaml (1)

7-7: Consider adding version pinning for remote configuration

While importing from a main branch is common, for production environments you might want to consider importing from a specific tag or commit hash for better version control and stability.

- "https://raw.githubusercontent.com/cloudposse/atmos/refs/heads/main/atmos.yaml"  # Load from a remote URL
+ "https://raw.githubusercontent.com/cloudposse/atmos/refs/tags/v1.x.x/atmos.yaml"  # Load from a specific version
pkg/config/default.go (1)

40-40: Consider making AppendUserAgent more configurable.

The AppendUserAgent value is hardcoded with a direct reference to version.Version. Consider making this more flexible by allowing for customization via environment variables or config settings.

- AppendUserAgent:         fmt.Sprintf("Atmos/%s (Cloud Posse; +https://atmos.tools)", version.Version),
+ AppendUserAgent:         fmt.Sprintf("Atmos/%s (Cloud Posse; +https://atmos.tools)", version.Version), // Allow override via ATMOS_COMPONENTS_TERRAFORM_APPEND_USER_AGENT
website/docs/cli/configuration/configuration.mdx (1)

38-38: Fix grammatical error in the Configuration Load Order section.

The sentence is missing the word "are" or "is" before "not specified".

-If --config and --config-path not specified in command
+If --config and --config-path are not specified in command
🧰 Tools
🪛 LanguageTool

[uncategorized] ~38-~38: You might be missing the article “the” here.
Context: ...nfig and --config-path not specified in command The CLI config is loaded from the follo...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

pkg/config/import_test.go (2)

60-60: Remove commented code fragment.

There appears to be an unintended code fragment in a comment within the test case.

-		"config/**/*.yaml",       // recursive/**/*.yaml", // Recursive directory with specific pattern extension
+		"config/**/*.yaml",       // Recursive directory with specific pattern extension

67-68: Missing Step 4 in the step numbering comments.

The comments jump from Step 3 to Step 5, skipping Step 4. This creates a small inconsistency in the documentation.

-	// Step 5: Run the processImports method
+	// Step 4: Run the processImports method
pkg/config/load_config_test.go (1)

14-73: Improve error handling in test function.

The test uses if/t.Fatalf for error handling which can be replaced with require.NoError for better readability and consistency with the rest of the tests.

Here's an example of how to improve the error handling:

-	if err != nil {
-		t.Fatalf("Failed to create temp directory: %v", err)
-	}
+	require.NoError(t, err, "Failed to create temp directory")

Apply this pattern throughout the test function for consistent error handling.

internal/exec/vendor_utils_test.go (1)

108-110: Consider refactoring flag creation to remove duplication.

The new flags are repeated from lines 51-53. You could unify flag initialization in a helper to simplify ongoing maintenance.

pkg/config/config.go (2)

20-24: Keep track of TODO.

These comments clarify the pending pointer refactor and suppression. Let’s revisit after the bigger refactor is feasible.


117-142: Well-structured configuration pipeline.

This sequence of loading, schema processing, environment variables, CLI args, and store config is clear. Nice modular approach.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 127-128: pkg/config/config.go#L127-L128
Added lines #L127 - L128 were not covered by tests


[warning] 133-133: pkg/config/config.go#L133
Added line #L133 was not covered by tests


[warning] 139-140: pkg/config/config.go#L139-L140
Added lines #L139 - L140 were not covered by tests

pkg/config/load_config_args.go (3)

84-115: Merging configs from directories is consistent.

Falls back to .atmos.yaml if atmos.yaml is not found. This approach is logical. A single helper for both could reduce duplication.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 93-98: pkg/config/load_config_args.go#L93-L98
Added lines #L93 - L98 were not covered by tests


[warning] 106-112: pkg/config/load_config_args.go#L106-L112
Added lines #L106 - L112 were not covered by tests


132-145: Typo in debug statement.

Line 140 says “found directors” instead of “found directory.” Fix for clarity.

- log.Debug("--config expected file found directors", "path", filePath)
+ log.Debug("--config expected file found directory", "path", filePath)
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 140-142: pkg/config/load_config_args.go#L140-L142
Added lines #L140 - L142 were not covered by tests


147-156: Simple path concatenation.

Consider using strings.Join(paths, ";") for conciseness.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 149-150: pkg/config/load_config_args.go#L149-L150
Added lines #L149 - L150 were not covered by tests

pkg/config/imports.go (3)

44-49: Expand test coverage for nil input checks
Lines 48-49 show an early return when either the source or dst is nil, but these lines are not covered by tests according to the static analysis hints. Consider adding a test that calls processConfigImports with a nil source or dst to confirm proper error handling.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 48-49: pkg/config/imports.go#L48-L49
Added lines #L48 - L49 were not covered by tests


82-86: Check for proper error handling of basePath and tempDir
These lines guard against empty basePath or missing tempDir. Including a negative test (where basePath or tempDir is invalid) would confirm the behavior and improve coverage.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 82-83: pkg/config/imports.go#L82-L83
Added lines #L82 - L83 were not covered by tests


[warning] 85-86: pkg/config/imports.go#L85-L86
Added lines #L85 - L86 were not covered by tests


128-172: Validate remote import recursion and certificate checks

  1. This function downloads remote config and supports nested imports. The maximum import depth approach prevents infinite loops, but it does not detect cycles explicitly. Consider tracking visited imports to fail fast on cyclical references.
  2. For additional security, evaluate certificate verification or restricting plain HTTP.
🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 132-134: pkg/config/imports.go#L132-L134
Added lines #L132 - L134 were not covered by tests


[warning] 138-140: pkg/config/imports.go#L138-L140
Added lines #L138 - L140 were not covered by tests


[warning] 165-167: pkg/config/imports.go#L165-L167
Added lines #L165 - L167 were not covered by tests

pkg/config/load.go (1)

218-243: Add tests to verify recursive imports in merged config
Merging config from multiple directories and .atmos.d/ subfolders may lead to complex outcomes. A specialized test ensures correct import layering, especially for edge cases.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b58700 and 9534bd4.

📒 Files selected for processing (62)
  • .golangci.yml (2 hunks)
  • cmd/root.go (1 hunks)
  • internal/exec/utils.go (1 hunks)
  • internal/exec/vendor_utils_test.go (2 hunks)
  • internal/exec/workflow_test.go (1 hunks)
  • pkg/config/README.md (1 hunks)
  • pkg/config/atmos.yaml (1 hunks)
  • pkg/config/config.go (3 hunks)
  • pkg/config/const.go (1 hunks)
  • pkg/config/default.go (1 hunks)
  • pkg/config/import_test.go (1 hunks)
  • pkg/config/imports.go (1 hunks)
  • pkg/config/load.go (1 hunks)
  • pkg/config/load_config_args.go (1 hunks)
  • pkg/config/load_config_test.go (1 hunks)
  • pkg/schema/schema.go (2 hunks)
  • tests/cli_test.go (1 hunks)
  • tests/fixtures/scenarios/atmos-cli-imports/atmos.yaml (1 hunks)
  • tests/fixtures/scenarios/atmos-cli-imports/configs.d/commands.yaml (1 hunks)
  • tests/fixtures/scenarios/atmos-cli-imports/configs.d/tools/stack.yml (1 hunks)
  • tests/fixtures/scenarios/atmos-cli-imports/configs.d/tools/terraform.yaml (1 hunks)
  • tests/fixtures/scenarios/atmos-cli-imports/configs.d/vendor.yaml (1 hunks)
  • tests/fixtures/scenarios/atmos-cli-imports/logs.yaml (1 hunks)
  • tests/fixtures/scenarios/atmos-configuration/atmos.d/commands.yaml (1 hunks)
  • tests/fixtures/scenarios/atmos-configuration/atmos.d/logs.yaml (1 hunks)
  • tests/fixtures/scenarios/atmos-configuration/atmos.d/tools/helmfile.yml (1 hunks)
  • tests/fixtures/scenarios/atmos-configuration/atmos.d/tools/stack.yaml (1 hunks)
  • tests/fixtures/scenarios/atmos-configuration/atmos.d/tools/terraform.yaml (1 hunks)
  • tests/fixtures/scenarios/atmos-configuration/atmos.yaml (1 hunks)
  • tests/snapshots/TestCLICommands_Valid_Log_Level_in_Config_File.stderr.golden (1 hunks)
  • tests/snapshots/TestCLICommands_Valid_Log_Level_in_Environment_Variable.stderr.golden (1 hunks)
  • tests/snapshots/TestCLICommands_Valid_log_file_in_env_should_be_priortized_over_config.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_Valid_log_file_in_flag_should_be_priortized_over_env_and_config.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_Valid_log_level_in_env_should_be_priortized_over_config.stderr.golden (1 hunks)
  • tests/snapshots/TestCLICommands_Valid_log_level_in_flag_should_be_priortized_over_env_and_config.stderr.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_about_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_describe_config_imports.stderr.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_describe_configuration.stderr.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_helmfile_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_helmfile_help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden (1 hunks)
  • tests/test-cases/atmos-cli-imports.yaml (1 hunks)
  • website/docs/cli/configuration/configuration.mdx (2 hunks)
🧰 Additional context used
🧠 Learnings (16)
tests/snapshots/TestCLICommands_Valid_log_file_in_env_should_be_priortized_over_config.stdout.golden (2)
Learnt from: Listener430
PR: cloudposse/atmos#1061
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:8-8
Timestamp: 2025-03-20T16:30:34.659Z
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.
Learnt from: Listener430
PR: cloudposse/atmos#1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-20T16:30:44.601Z
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.
tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden (1)
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/snapshots/TestCLICommands_atmos_describe_config_imports.stderr.golden (2)
Learnt from: Listener430
PR: cloudposse/atmos#1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-20T16:30:44.601Z
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.
Learnt from: Listener430
PR: cloudposse/atmos#1061
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:8-8
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden (1)
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden (3)
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-03-20T16:30:34.659Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `&lt;component&gt;`) rather than converted to backticks or other markdown formatting.
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden (1)
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden (1)
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/snapshots/TestCLICommands_Valid_log_file_in_flag_should_be_priortized_over_env_and_config.stdout.golden (2)
Learnt from: Listener430
PR: cloudposse/atmos#1061
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:8-8
Timestamp: 2025-03-20T16:30:34.659Z
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.
Learnt from: Listener430
PR: cloudposse/atmos#1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-20T16:30:44.601Z
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.
tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden (3)
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-03-20T16:30:34.659Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `&lt;component&gt;`) rather than converted to backticks or other markdown formatting.
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden (1)
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
tests/snapshots/TestCLICommands_atmos_--help.stdout.golden (1)
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/snapshots/TestCLICommands_atmos_describe_configuration.stderr.golden (1)
Learnt from: Listener430
PR: cloudposse/atmos#1149
File: tests/snapshots/TestCLICommands_atmos_vendor_pull_ssh.stderr.golden:7-7
Timestamp: 2025-03-20T16:30:44.601Z
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.
tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden (1)
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden (3)
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-03-20T16:30:34.659Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `&lt;component&gt;`) rather than converted to backticks or other markdown formatting.
tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden (1)
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/fixtures/scenarios/atmos-configuration/atmos.d/tools/helmfile.yml (1)
Learnt from: osterman
PR: cloudposse/atmos#808
File: examples/demo-atmos.d/atmos.d/tools/helmfile.yml:10-10
Timestamp: 2025-03-20T16:30:44.601Z
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.
🧬 Code Definitions (2)
pkg/config/config.go (3)
pkg/schema/schema.go (4) (4)
  • ConfigAndStacksInfo (357-423)
  • AtmosConfiguration (13-45)
  • Stacks (278-284)
  • Components (273-276)
pkg/config/load.go (2) (2)
  • atmosConfig (35-35)
  • LoadConfig (33-84)
pkg/config/utils.go (3) (3)
  • processEnvVars (186-383)
  • processCommandLineArgs (405-432)
  • processStoreConfig (554-564)
pkg/config/load_config_args.go (1)
pkg/config/const.go (2) (2)
  • CliConfigFileName (4-4)
  • DotCliConfigFileName (5-5)
🪛 GitHub Check: codecov/patch
internal/exec/utils.go

[warning] 210-211: internal/exec/utils.go#L210-L211
Added lines #L210 - L211 were not covered by tests


[warning] 214-215: internal/exec/utils.go#L214-L215
Added lines #L214 - L215 were not covered by tests


[warning] 218-219: internal/exec/utils.go#L218-L219
Added lines #L218 - L219 were not covered by tests

pkg/config/default.go

[warning] 110-111: pkg/config/default.go#L110-L111
Added lines #L110 - L111 were not covered by tests

pkg/config/config.go

[warning] 53-53: pkg/config/config.go#L53
Added line #L53 was not covered by tests


[warning] 127-128: pkg/config/config.go#L127-L128
Added lines #L127 - L128 were not covered by tests


[warning] 133-133: pkg/config/config.go#L133
Added line #L133 was not covered by tests


[warning] 139-140: pkg/config/config.go#L139-L140
Added lines #L139 - L140 were not covered by tests


[warning] 150-151: pkg/config/config.go#L150-L151
Added lines #L150 - L151 were not covered by tests


[warning] 157-158: pkg/config/config.go#L157-L158
Added lines #L157 - L158 were not covered by tests


[warning] 164-165: pkg/config/config.go#L164-L165
Added lines #L164 - L165 were not covered by tests


[warning] 172-173: pkg/config/config.go#L172-L173
Added lines #L172 - L173 were not covered by tests


[warning] 180-181: pkg/config/config.go#L180-L181
Added lines #L180 - L181 were not covered by tests


[warning] 187-197: pkg/config/config.go#L187-L197
Added lines #L187 - L197 were not covered by tests


[warning] 199-200: pkg/config/config.go#L199-L200
Added lines #L199 - L200 were not covered by tests


[warning] 202-202: pkg/config/config.go#L202
Added line #L202 was not covered by tests


[warning] 204-207: pkg/config/config.go#L204-L207
Added lines #L204 - L207 were not covered by tests


[warning] 210-220: pkg/config/config.go#L210-L220
Added lines #L210 - L220 were not covered by tests


[warning] 223-223: pkg/config/config.go#L223
Added line #L223 was not covered by tests

pkg/config/load_config_args.go

[warning] 49-51: pkg/config/load_config_args.go#L49-L51
Added lines #L49 - L51 were not covered by tests


[warning] 54-55: pkg/config/load_config_args.go#L54-L55
Added lines #L54 - L55 were not covered by tests


[warning] 70-72: pkg/config/load_config_args.go#L70-L72
Added lines #L70 - L72 were not covered by tests


[warning] 78-79: pkg/config/load_config_args.go#L78-L79
Added lines #L78 - L79 were not covered by tests


[warning] 93-98: pkg/config/load_config_args.go#L93-L98
Added lines #L93 - L98 were not covered by tests


[warning] 106-112: pkg/config/load_config_args.go#L106-L112
Added lines #L106 - L112 were not covered by tests


[warning] 125-127: pkg/config/load_config_args.go#L125-L127
Added lines #L125 - L127 were not covered by tests


[warning] 140-142: pkg/config/load_config_args.go#L140-L142
Added lines #L140 - L142 were not covered by tests


[warning] 149-150: pkg/config/load_config_args.go#L149-L150
Added lines #L149 - L150 were not covered by tests

pkg/config/load.go

[warning] 41-42: pkg/config/load.go#L41-L42
Added lines #L41 - L42 were not covered by tests


[warning] 186-186: pkg/config/load.go#L186
Added line #L186 was not covered by tests


[warning] 205-205: pkg/config/load.go#L205
Added line #L205 was not covered by tests


[warning] 407-408: pkg/config/load.go#L407-L408
Added lines #L407 - L408 were not covered by tests

pkg/config/imports.go

[warning] 48-49: pkg/config/imports.go#L48-L49
Added lines #L48 - L49 were not covered by tests


[warning] 53-66: pkg/config/imports.go#L53-L66
Added lines #L53 - L66 were not covered by tests


[warning] 68-72: pkg/config/imports.go#L68-L72
Added lines #L68 - L72 were not covered by tests


[warning] 74-74: pkg/config/imports.go#L74
Added line #L74 was not covered by tests


[warning] 77-77: pkg/config/imports.go#L77
Added line #L77 was not covered by tests


[warning] 82-83: pkg/config/imports.go#L82-L83
Added lines #L82 - L83 were not covered by tests


[warning] 85-86: pkg/config/imports.go#L85-L86
Added lines #L85 - L86 were not covered by tests


[warning] 92-94: pkg/config/imports.go#L92-L94
Added lines #L92 - L94 were not covered by tests


[warning] 132-134: pkg/config/imports.go#L132-L134
Added lines #L132 - L134 were not covered by tests


[warning] 138-140: pkg/config/imports.go#L138-L140
Added lines #L138 - L140 were not covered by tests


[warning] 165-167: pkg/config/imports.go#L165-L167
Added lines #L165 - L167 were not covered by tests

🪛 LanguageTool
website/docs/cli/configuration/configuration.mdx

[uncategorized] ~38-~38: You might be missing the article “the” here.
Context: ...nfig and --config-path not specified in command The CLI config is loaded from the follo...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[grammar] ~161-~161: Did you mean “is” or “can be”?
Context: ... supported (unlike stacks). :::warning Be Careful with Remote Imports - Always us...

(BE_IS)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (92)
tests/snapshots/TestCLICommands_Valid_Log_Level_in_Config_File.stderr.golden (1)

2-3: Debug messages enhance configuration path discovery observability.

These new debug log entries properly document the configuration file discovery process, showing that Atmos now attempts to search in both atmos.d and .atmos.d directories. This improved logging aligns well with the PR's objective of supporting custom configuration paths by making the discovery process more transparent to users.

tests/fixtures/scenarios/atmos-configuration/atmos.d/logs.yaml (1)

1-4: Configuration appears correct and well-structured.

The logging configuration is properly formatted with the appropriate target output and debug level. This aligns with the PR's goal of enhancing configuration flexibility in the Atmos CLI.

tests/fixtures/scenarios/atmos-cli-imports/configs.d/vendor.yaml (1)

1-10: Good structure with helpful commented examples.

The vendor configuration is well-organized and includes useful commented examples showing alternative configuration options. This effectively demonstrates the flexibility introduced by the new base path capabilities.

tests/snapshots/TestCLICommands_Valid_log_file_in_flag_should_be_priortized_over_env_and_config.stdout.golden (2)

2-3: Debug log entries for configuration search properly added.

These debug log entries appropriately document the configuration file search process, showing that the system correctly looks in multiple locations and reports when files aren't found.


7-7: Platform update in test output.

The platform reference has been updated from darwin/arm64 to linux/amd64, which is consistent with the test environment change.

tests/snapshots/TestCLICommands_Valid_Log_Level_in_Environment_Variable.stderr.golden (1)

2-3: Configuration file search debug logs properly added.

These additional debug entries effectively document the configuration search process, matching the improvements throughout the PR. This creates consistency in the logging across different scenarios.

tests/fixtures/scenarios/atmos-cli-imports/configs.d/tools/stack.yml (1)

1-7: Looks good - configuration structure aligns with stack management requirements.

The stack configuration provides a clear structure for managing stack files with appropriate path inclusions and exclusions. The base_path, included_paths, excluded_paths, and name_pattern elements are all properly defined.

pkg/config/const.go (1)

4-5: Good addition of DotCliConfigFileName constant for hidden configuration support.

This constant addition enhances config flexibility by supporting both visible (atmos) and hidden (.atmos) configuration files, which aligns with the PR objectives.

tests/fixtures/scenarios/atmos-cli-imports/configs.d/tools/terraform.yaml (1)

1-7: Good Terraform component configuration structure.

The configuration properly defines the Terraform components section with appropriate base path and operation flags. This configuration aligns well with the enhanced configuration capabilities introduced in this PR.

tests/snapshots/TestCLICommands_atmos_describe_configuration.stderr.golden (1)

1-15: Snapshot test output looks good for configuration detection and merging.

This test snapshot correctly captures the expected debug output when testing the configuration file detection and merging process. The output shows both failure cases (not finding files in certain paths) and success cases (merging configurations from various files), which effectively tests the enhanced configuration capabilities.

tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden (1)

81-86: New global flags added to enhance CLI configurability.

These new flags align well with the PR objectives to support custom base path and config paths. The implementation properly documents the purpose and default values for each flag.

.golangci.yml (1)

130-130: Changed comment-spacings exclude list to empty array.

This change from [""] to [] means no comments will be excluded from spacing checks. Confirm this is the intended behavior as it might lead to more linting errors.

tests/fixtures/scenarios/atmos-configuration/atmos.yaml (1)

1-3: New configuration file with base path setting.

This creates the foundation for the base path configuration, supporting the new --base-path flag. The description comments clearly explain the purpose of the file and how imports work.

tests/fixtures/scenarios/atmos-cli-imports/configs.d/commands.yaml (1)

1-6: Well-structured test command definition.

This test fixture appropriately defines a command to help validate the import functionality. The command is simple and focused on testing the configuration system.

tests/fixtures/scenarios/atmos-configuration/atmos.d/commands.yaml (1)

1-6: Configuration looks good for test command.

The custom CLI command definition is structured correctly with proper indentation, name, description, and steps. This aligns with the PR objective of enhancing Atmos CLI configuration flexibility.

tests/snapshots/TestCLICommands_atmos_describe_config_-f_yaml.stdout.golden (1)

47-47: New import field correctly implemented.

The addition of import: [] as an empty array in the configuration is consistent with the PR's goal of supporting imports in Atmos CLI configurations. The placement after the validation section follows logical structure.

tests/fixtures/scenarios/atmos-cli-imports/logs.yaml (1)

1-3: Logging configuration correctly structured.

The logs configuration sets appropriate debug level output to stderr, which is helpful for testing and development. This supports the PR's enhancement of configuration management.

tests/snapshots/TestCLICommands_atmos_describe_config.stdout.golden (1)

142-143: Import field correctly added to JSON configuration.

The addition of "import": null to the JSON configuration is consistent with the YAML configuration update. The comma after the previous field is properly included, maintaining valid JSON syntax.

tests/fixtures/scenarios/atmos-cli-imports/atmos.yaml (1)

1-9: Well-structured import configuration with clear documentation

The new import configuration file is well organized with clear comments that explain its purpose and operation. The use of different import methods (URL, directory pattern, and specific file) demonstrates a comprehensive approach to configuration management.

This implementation aligns well with the PR's goal of enhancing Atmos CLI's configuration flexibility.

tests/snapshots/TestCLICommands_Valid_log_file_in_env_should_be_priortized_over_config.stdout.golden (2)

2-3: Debug logs properly document configuration file search paths

These added debug logs accurately report the failed attempts to find configuration files in the expected default locations. The detailed error messaging helps users understand the configuration loading process.


7-7: Test platform update reflects cross-platform testing

The platform change from darwin/arm64 to linux/amd64 in the test output helps ensure the CLI works across different environments.

tests/snapshots/TestCLICommands_Valid_log_level_in_flag_should_be_priortized_over_env_and_config.stderr.golden (1)

2-3: Consistent debug messaging improves diagnostics

These added debug logs match the pattern shown in the other test files, providing consistent error reporting when configuration files aren't found. This consistency makes logs easier to parse and understand.

tests/snapshots/TestCLICommands_Valid_log_level_in_env_should_be_priortized_over_config.stderr.golden (1)

2-3: Debug logs consistently report configuration file search failures

These debug logs maintain the same format and messaging as the other test files, ensuring a consistent approach to error reporting across the CLI.

tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden (2)

57-60: New CLI flags added for customizing project configuration

The addition of --base-path and --config-path flags directly fulfills the PR objective of enhancing the Atmos CLI with more flexible configuration options. These global flags will allow users to specify custom locations for their Atmos project and configuration directories.


62-76: Logging flags maintained with consistent positioning

The existing logging flags have been properly maintained while ensuring they're positioned consistently after the new configuration flags. This maintains backward compatibility while adding new functionality.

pkg/config/atmos.yaml (1)

1-8: Well-structured default logging configuration

This new configuration file provides clear defaults for logging with helpful comments explaining:

  • How settings can be overridden via environment variables or command-line arguments
  • The available destinations for log output
  • Supported log levels

The file follows YAML best practices with clean formatting and thorough documentation.

tests/fixtures/scenarios/atmos-configuration/atmos.d/tools/stack.yaml (1)

1-7: Clean stack configuration with well-defined paths

This fixture file provides a good test case for the configuration paths feature with:

  • A defined base path for stacks
  • Clear included and excluded path patterns
  • A name pattern for standardization

The structure aligns well with the PR's goal of allowing customizable configuration paths.

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

24-30: Comprehensive flag additions for configuration customization

All three flags have been properly added to the Atlantis help output:

  • --base-path for specifying the Atmos project location
  • --config for pointing to specific configuration files
  • --config-path for specifying configuration directories

This implementation provides a complete set of options for customizing configuration paths.


31-45: Logging flags maintained with consistent formatting

The existing logging flags have been preserved with their full documentation, ensuring backward compatibility while maintaining a clean, organized help output.

tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden (1)

24-45: New global flags properly implemented

The addition of the new global flags (--base-path, --config, and --config-path) aligns perfectly with the PR objectives. These flags will provide users with more flexibility in specifying project locations and configuration files.

tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden (1)

76-97: Consistent flag implementation across commands

The implementation of global flags here matches the pattern established in other commands, maintaining a consistent CLI experience. The flags will enable users to specify custom project locations and configuration sources when working with Terraform commands.

tests/snapshots/TestCLICommands_atmos_about_--help.stdout.golden (1)

16-37: Global flags properly implemented

The global flags (--base-path, --config, and --config-path) have been correctly added to the about command. This ensures consistent functionality across the entire CLI.

tests/snapshots/TestCLICommands_atmos_describe_config_imports.stderr.golden (1)

1-20: Snapshot file looks correct for configuration imports testing.

The snapshot captures the debug logs showing the expected behavior of the new configuration import functionality, including attempts to find config files and successful merges from multiple sources (remote and local).

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

37-60: New CLI flags properly implemented in the help text.

The new global flags --base-path, --config, and --config-path have been added to the help output with clear descriptions, consistent with the PR objectives to enhance Atmos CLI configurability.

tests/cli_test.go (1)

332-339: Good additions to sanitizeOutput for test reliability.

The new functionality handles two important cases:

  1. Normalizing URLs by collapsing extra slashes (lines 332-336)
  2. Standardizing random file paths for imported configs (lines 337-339)

These changes will make test snapshots more deterministic by removing variable elements from test outputs.

tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden (1)

76-97: Global flags consistently added to terraform subcommand help.

The new flags (--base-path, --config, and --config-path) have been properly added to the global flags section, maintaining consistency with the main command help text.

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

35-40: Good addition of CLI flags for improved configuration flexibility.

These new global flags provide users with greater control over their Atmos projects by allowing custom specification of base paths and configuration locations. The changes align perfectly with the PR objectives of enhancing the Atmos CLI tool's flexibility.


42-56: Proper formatting maintained for existing flags.

The existing logging flags have been properly maintained with consistent formatting after adding the new configuration flags.

pkg/config/README.md (1)

1-44: Excellent documentation addition with clear flowchart.

The Mermaid diagram provides a comprehensive visual explanation of the configuration loading process, effectively documenting how imports are processed (remote URLs, specific paths, wildcard globs) and how configurations are recursively loaded and merged. This documentation enhancement significantly improves understanding of the new import functionality.

tests/test-cases/atmos-cli-imports.yaml (1)

1-28: Good test coverage for the new configuration features.

The two test cases appropriately verify both the import configuration functionality and the general configuration processing. Both tests use proper fixtures and expect successful execution.

internal/exec/utils.go (1)

819-828: Consider consistent error handling pattern for flag values.

The error handling pattern used for the new CLI flags on lines 208-219 is consistent with this existing pattern. This is good practice.

tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden (2)

17-22: New CLI flags look good.

The addition of these three global flags (--base-path, --config, --config-path) matches the PR's objective to enhance configuration flexibility. The descriptions are clear and concise.


40-46: Command separator documentation is helpful.

Good addition of the double-dash separator documentation, which helps users understand how to separate Atmos-specific options from command-specific arguments.

tests/snapshots/TestCLICommands_atmos_helmfile_help.stdout.golden (1)

35-40: New global flags implemented consistently.

The same three global flags (--base-path, --config, --config-path) have been consistently added across CLI help texts, maintaining a uniform interface.

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

27-32: Global flags consistently implemented.

The global flags match those added to other commands, ensuring a consistent CLI experience for users across different Atmos functions.


50-52: Command separator helps clarify usage.

The double-dash separator documentation provides clarity on how to properly structure complex command lines.

tests/fixtures/scenarios/atmos-configuration/atmos.d/tools/terraform.yaml (2)

1-15: Well-structured Terraform configuration with clear documentation.

The configuration provides multiple ways to specify the Terraform command and base path, with helpful examples and clear explanations of alternative configuration methods (ENV vars, CLI args).


16-23: Good configuration of Terraform behavior flags.

Each boolean flag is well-documented with its corresponding environment variable and command-line alternatives, following a consistent pattern that makes the configuration easy to understand.

tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden (2)

28-33: New global flags added to support flexible configuration.

The addition of these flags aligns perfectly with the PR objectives, providing users with more control over their Atmos project paths and configuration files. This enhancement gives users the flexibility to specify custom base paths and configuration locations.


37-38: Improved clarity with properly quoted file descriptors.

Using single quotes around file descriptors makes the help text more readable and consistent.

tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden (1)

17-46: Consistent implementation of global flags across commands.

The global flags have been consistently added across different commands, maintaining the same format and descriptions. This ensures a unified user experience when working with different Atmos tools.

tests/fixtures/scenarios/atmos-configuration/atmos.d/tools/helmfile.yml (1)

1-14: Well-structured Helmfile configuration with clear documentation.

This new configuration file is well organized and includes helpful comments that explain how each setting can be overridden through environment variables or command-line arguments. The configuration patterns for AWS profiles and cluster names follow a consistent format using placeholder variables.

tests/snapshots/TestCLICommands_atmos_describe_config_imports.stdout.golden (3)

1-141: Comprehensive configuration snapshot with robust settings structure.

The configuration snapshot provides a complete example of Atmos settings, including components, stacks, workflows, logs, commands, integrations, schemas, templates, and other settings. The structure is logical and well-organized.


144-150: Absolute paths properly configured for test environment.

The absolute paths are correctly structured using placeholder values appropriate for test fixtures. This ensures tests can run consistently in different environments.


162-165: Import functionality implemented to support external configurations.

The import section demonstrates how external configurations can be included from different sources, including GitHub URLs and local files. This implementation supports the PR objective of enhancing configuration management and providing greater flexibility.

internal/exec/workflow_test.go (1)

58-60: Good addition of new CLI flags to support the configuration path features.

These new flags align well with the PR objectives to enhance Atmos CLI with custom base path and config path support. The implementation uses PersistentFlags() correctly to ensure these settings persist across commands.

pkg/schema/schema.go (2)

44-44: Good implementation of the Import field to support configuration imports.

The new Import field is properly tagged for serialization with YAML, JSON, and mapstructure, keeping consistent with the rest of the struct fields.


421-422: Appropriate schema additions to support the new CLI flags.

These fields correctly store paths to configuration files and directories that will be passed via the new command-line arguments, supporting the core feature this PR aims to deliver.

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

28-33: Help documentation correctly reflects the new CLI options.

The help text clearly describes the purpose of each new flag. The formatting is consistent with other flags in the help output.


37-38: Minor formatting improvement for file descriptors.

Enclosing file descriptors in single quotes improves readability and clarity.

tests/snapshots/TestCLICommands_atmos_describe_configuration.stdout.golden (2)

60-60: Configuration output properly includes the new import field.

The import field is correctly included in the configuration output and initialized as an empty array, providing the foundation for the import functionality.


1-59: Comprehensive golden file added for configuration testing.

This golden file thoroughly covers all aspects of the Atmos configuration, providing a robust test case for the configuration describe command. The structure follows best practices for YAML formatting.

tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden (1)

58-89: Global flags implementation looks good.

The addition of the new global flags --base-path, --config, and --config-path aligns perfectly with the PR objectives. These flags provide greater flexibility for users in specifying custom paths for their Atmos projects and configurations.

tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden (1)

27-52: Global flags properly implemented in generate help command.

The new flags match the implementation in other commands, ensuring consistency across the CLI interface. The help text is clear and descriptive.

tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden (1)

58-89: Global flags implementation consistent with other command help outputs.

The implementation of the global flags is consistent with the other command help outputs, which is crucial for providing a uniform user experience across the Atmos CLI. The descriptions are clear and informative.

cmd/root.go (1)

193-196: Flag implementation looks good.

The changes to line 193 properly standardize quotation formats, while lines 194-196 add the new global flags for base path and configuration paths as specified in the PR objectives. These changes appropriately set up the command flags that are reflected in the help text snapshots.

pkg/config/default.go (2)

15-19: Effective error message with helpful guidance.

The error message clearly explains the issue and provides a URL to a sample configuration that users can adapt. This is excellent for user experience.


20-102: Well-structured default configuration with comprehensive settings.

The defaultCliConfig covers all necessary defaults with sensible values, providing a solid foundation for the CLI application. The organization follows a logical hierarchy and makes good use of the schema structure.

website/docs/cli/configuration/configuration.mdx (1)

134-167: Excellent documentation on imports functionality.

The imports section provides clear explanations on how imports work, with good examples and security warnings. The pro-tip about POSIX-style greedy Globs is particularly helpful.

🧰 Tools
🪛 LanguageTool

[grammar] ~161-~161: Did you mean “is” or “can be”?
Context: ... supported (unlike stacks). :::warning Be Careful with Remote Imports - Always us...

(BE_IS)

pkg/config/import_test.go (3)

14-18: Clean helper function implementation.

The setupTestFile function is concise and handles file creation effectively.


57-65: Comprehensive test cases for import processing.

The test covers a wide range of scenarios including remote URLs, recursive directories, and invalid paths. This ensures robust handling of various import types.


93-162: Thorough tests for nested imports.

The test cases for nested imports cover all relevant scenarios including local files, remote URLs, and depth limits. This ensures that the import functionality works correctly with nested configurations.

pkg/config/load_config_test.go (2)

75-147: Well-structured test cases with clear expectations.

The TestLoadConfigFromCLIArgs function uses a table-driven approach to test various scenarios. Each test case clearly defines the inputs and expected outcomes, making the tests easy to understand and maintain.


88-126: Comprehensive test coverage for configuration loading.

The test cases cover a wide range of scenarios including valid and invalid paths, ensuring robust error handling in the configuration loading process.

internal/exec/vendor_utils_test.go (1)

51-53: Smooth addition of new flags.

These flags align with the PR objectives of supporting a custom base path and config paths. The help text is short and clear.

pkg/config/config.go (6)

9-14: New imports look consistent.

All imported packages match their usage below. No concerns.


26-26: Pointer usage is correct.

Confirm that modifying configAndStacksInfo inside processAtmosConfigs is intended.


47-47: Absolute paths logic call is fine.

Ensures consistent path resolution. Looks good for cross-platform usage.


53-53: Stack configs processing.

This flow is well integrated. Ensure coverage in tests to validate the new code path.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 53-53: pkg/config/config.go#L53
Added line #L53 was not covered by tests


144-185: Path conversion approach is straightforward.

No issues with the usage of filepath.Abs. Good practice to handle path resolution early.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 150-151: pkg/config/config.go#L150-L151
Added lines #L150 - L151 were not covered by tests


[warning] 157-158: pkg/config/config.go#L157-L158
Added lines #L157 - L158 were not covered by tests


[warning] 164-165: pkg/config/config.go#L164-L165
Added lines #L164 - L165 were not covered by tests


[warning] 172-173: pkg/config/config.go#L172-L173
Added lines #L172 - L173 were not covered by tests


[warning] 180-181: pkg/config/config.go#L180-L181
Added lines #L180 - L181 were not covered by tests


187-224: Stack config path checks seem correct.

The logic for missing stacks is explicit, and error messages help guide users. Consider adding or validating test coverage here.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 187-197: pkg/config/config.go#L187-L197
Added lines #L187 - L197 were not covered by tests


[warning] 199-200: pkg/config/config.go#L199-L200
Added lines #L199 - L200 were not covered by tests


[warning] 202-202: pkg/config/config.go#L202
Added line #L202 was not covered by tests


[warning] 204-207: pkg/config/config.go#L204-L207
Added lines #L204 - L207 were not covered by tests


[warning] 210-220: pkg/config/config.go#L210-L220
Added lines #L210 - L220 were not covered by tests


[warning] 223-223: pkg/config/config.go#L223
Added line #L223 was not covered by tests

pkg/config/load_config_args.go (4)

1-12: Imports and package structure look good.

All dependencies are relevant, no red flags here.


14-20: Helpful custom errors.

They provide clarity for missing files or directories. Error naming is consistent.


22-59: Command-line config loading is well-handled.

Merging file and directory paths in configPaths is systematic. Tests confirming no config leads to error would be beneficial.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 49-51: pkg/config/load_config_args.go#L49-L51
Added lines #L49 - L51 were not covered by tests


[warning] 54-55: pkg/config/load_config_args.go#L54-L55
Added lines #L54 - L55 were not covered by tests


117-130: Valid directory check is straightforward.

No issues. The function’s name and usage are clear.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 125-127: pkg/config/load_config_args.go#L125-L127
Added lines #L125 - L127 were not covered by tests

pkg/config/imports.go (3)

53-66: Include a test scenario for temp-dir creation and cleanup
This block generates and removes a temporary directory, but it remains uncovered by tests. Covering this path can ensure the code handles directory creation errors and cleanup tasks properly.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 53-66: pkg/config/imports.go#L53-L66
Added lines #L53 - L66 were not covered by tests


68-75: Capture failures when merging imported config
The loop that calls mergeConfigFile can fail silently if an error occurs, proceeding to the next import. Ensure a dedicated test exists for this scenario, validating that the log message on line 71 is reachable and the subsequent imports proceed correctly.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 68-72: pkg/config/imports.go#L68-L72
Added lines #L68 - L72 were not covered by tests


[warning] 74-74: pkg/config/imports.go#L74
Added line #L74 was not covered by tests


174-228: Test local import error-handling paths
The function logs and continues on parse errors for local imports. It also warns if the import path resides outside the base directory. Adding tests for these scenarios—especially lines 165-167 flagged as uncovered—ensures robustness of local import logic.

pkg/config/load.go (4)

40-42: Test coverage for embedded config loading
Lines 41-42 load the embedded atmos.yaml but remain uncovered. A unit test simulating embedded data loading could verify that errors are handled (e.g., if the embedded data is unreadable).

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 41-42: pkg/config/load.go#L41-L42
Added lines #L41 - L42 were not covered by tests


86-94: Ensure default configurations are valid
These defaults set essential keys like components.helmfile.use_eks. Confirm they match project requirements, and consider a basic test to confirm these default values load without being overridden unintentionally.


186-186: Consider coverage for ENV path merges
Line 186 and 205 remain untested. Tests covering ATMOS_CLI_CONFIG_PATH usage and reading from a custom CLI config path would ensure the environment variable or CLI flag merges config correctly.

Also applies to: 205-205

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 186-186: pkg/config/load.go#L186
Added line #L186 was not covered by tests


407-408: Test embedded config merge errors
Check the scenario where merging embedded config data fails. Although uncommon, verifying error handling (lines 407-408) ensures resilience.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 407-408: pkg/config/load.go#L407-L408
Added lines #L407 - L408 were not covered by tests

Comment on lines +57 to +76
--base-path string Base path for Atmos project

--config-path stringSlice Path to configuration directory (default
[])

--logs-file string The file to write Atmos logs to. Logs can
be written to any file or any standard file
descriptor, including '/dev/stdout',
'/dev/stderr' and '/dev/null' (default
/dev/stderr)

--logs-level string Logs level. Supported log levels are Trace,
Debug, Info, Warning, Off. If the log level
is set to Off, Atmos will not log any
messages (default Info)

--redirect-stderr string File descriptor to redirect stderr to.
Errors can be redirected to any file or any
standard file descriptor (including
/dev/null)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing --config flag in global flags section

While the --base-path and --config-path flags are present, the --config flag that appears in other commands is missing from this command's global flags section. This inconsistency should be addressed to maintain uniform CLI behavior across all commands.

Comment on lines +208 to +219
configAndStacksInfo.BasePath, err = cmd.Flags().GetString("base-path")
if err != nil {
return configAndStacksInfo, err
}
configAndStacksInfo.AtmosConfigFilesFromArg, err = cmd.Flags().GetStringSlice("config")
if err != nil {
return configAndStacksInfo, err
}
configAndStacksInfo.AtmosConfigDirsFromArg, err = cmd.Flags().GetStringSlice("config-path")
if err != nil {
return configAndStacksInfo, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Implemented CLI flags for configuration but missing test coverage.

The implementation properly retrieves the new CLI flags (--base-path, --config, and --config-path) and handles potential errors. This aligns with the PR objectives of enhancing configuration flexibility.

However, the error handling code for these flags (lines 210-211, 214-215, 218-219) lacks test coverage according to static analysis.


🏁 Script executed:

#!/bin/bash
# Check if there are tests for the new flag handling

echo "Searching for tests of these new CLI flags..."
rg -A 10 "GetString.*base-path" --glob "**/*_test.go"
rg -A 10 "GetStringSlice.*config" --glob "**/*_test.go"
rg -A 10 "GetStringSlice.*config-path" --glob "**/*_test.go"

echo -e "\nChecking test coverage for ProcessCommandLineArgs function..."
rg -A 3 -B 3 "func TestProcessCommandLineArgs" --glob "**/*_test.go"

Length of output: 487


Action: Add missing tests for CLI flag error handling in internal/exec/utils.go

The implementation for retrieving the CLI flags (--base-path, --config, and --config-path) is correctly handling error conditions. However, our investigation didn't reveal any tests covering the error paths in the code (lines 208–219). Please add test cases simulating error scenarios for GetString() and GetStringSlice() to ensure that these branches are properly exercised.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 210-211: internal/exec/utils.go#L210-L211
Added lines #L210 - L211 were not covered by tests


[warning] 214-215: internal/exec/utils.go#L214-L215
Added lines #L214 - L215 were not covered by tests


[warning] 218-219: internal/exec/utils.go#L218-L219
Added lines #L218 - L219 were not covered by tests

Comment on lines 105 to 114
// mergeDefaultConfig merges the contents of defaultCliConfig into the
// current Viper instance if no other configuration file was located.
func mergeDefaultConfig(v *viper.Viper) error {
j, err := json.Marshal(defaultCliConfig)
if err != nil {
return err
}
reader := bytes.NewReader(j)
return v.MergeConfig(reader)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

Add test coverage for mergeDefaultConfig error handling.

The error handling in the mergeDefaultConfig function (lines 110-111) isn't covered by tests according to static analysis. Consider adding test cases that exercise this error path.


🏁 Script executed:

#!/bin/bash
# Check if there are any tests for the mergeDefaultConfig function
cd pkg/config
grep -r "TestMergeDefaultConfig" .

Length of output: 50


Based on the absence of any test cases referencing mergeDefaultConfig (which we rechecked in pkg/config), it appears that the error-handling paths—specifically when json.Marshal fails—aren’t exercised by the current test suite.

Action Required: Add Test Coverage for mergeDefaultConfig Error Handling

  • Location: pkg/config/default.go, lines 105–114
  • Suggested Tests:
    • Simulate conditions where json.Marshal returns an error.
    • Simulate failure scenarios for v.MergeConfig (if applicable).
    • Assert that the function returns the expected error.

Please update the test suite accordingly.


🏁 Script executed:

#!/bin/bash
# Re-run search for any test files referencing mergeDefaultConfig in the repository.
grep -R "mergeDefaultConfig" --include="*_test.go" .

Length of output: 52


Action Required: Add Tests for mergeDefaultConfig Error Handling

Our recent scan didn't reveal any tests for the mergeDefaultConfig function. Please add test cases to simulate the failure cases—in particular, when json.Marshal fails (and, if possible, when v.MergeConfig fails). This will ensure that the error handling in lines 110–111 is properly covered.

  • Location: pkg/config/default.go, lines 105–114
  • Suggested Tests:
    • Create a scenario where json.Marshal returns an error.
    • Simulate a failure in v.MergeConfig if applicable.

Updating the test suite to cover these conditions will help secure robust error handling.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 110-111: pkg/config/default.go#L110-L111
Added lines #L110 - L111 were not covered by tests

Comment on lines +29 to +36
The --config flag allows you to specify a relative or absolute path to a valid configuration file. Only the configuration files specified by this flag will be loaded.
The --config-path flag designates a directory containing Atmos configuration files (atmos, .atmos). Only files from the specified directory will be loaded.
You can use both --config and --config-path multiple times in a single command. Configurations will be deep-merged in the order provided,
with the first specified config having the lowest priority and the last one having the highest. This allows later configurations to override settings from earlier ones.
For example, to load multiple configuration files, you would run:
```bash
atmos --config /path/to/config1.yaml --config /path/to/config2.yaml --config-path /path/first/config/ -config-path /path/second/config/ ...
```
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Comprehensive documentation for new CLI flags.

The documentation clearly explains the --config and --config-path flags and how they can be used together. However, there's a typo in line 35.

-    atmos --config /path/to/config1.yaml --config /path/to/config2.yaml --config-path /path/first/config/ -config-path /path/second/config/ ...
+    atmos --config /path/to/config1.yaml --config /path/to/config2.yaml --config-path /path/first/config/ --config-path /path/second/config/ ...
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
The --config flag allows you to specify a relative or absolute path to a valid configuration file. Only the configuration files specified by this flag will be loaded.
The --config-path flag designates a directory containing Atmos configuration files (atmos, .atmos). Only files from the specified directory will be loaded.
You can use both --config and --config-path multiple times in a single command. Configurations will be deep-merged in the order provided,
with the first specified config having the lowest priority and the last one having the highest. This allows later configurations to override settings from earlier ones.
For example, to load multiple configuration files, you would run:
```bash
atmos --config /path/to/config1.yaml --config /path/to/config2.yaml --config-path /path/first/config/ -config-path /path/second/config/ ...
```
The --config flag allows you to specify a relative or absolute path to a valid configuration file. Only the configuration files specified by this flag will be loaded.
The --config-path flag designates a directory containing Atmos configuration files (atmos, .atmos). Only files from the specified directory will be loaded.
You can use both --config and --config-path multiple times in a single command. Configurations will be deep-merged in the order provided,
with the first specified config having the lowest priority and the last one having the highest. This allows later configurations to override settings from earlier ones.
For example, to load multiple configuration files, you would run:

Comment on lines +61 to +82
// mergeFiles merges config files from the provided paths.
func mergeFiles(v *viper.Viper, configFilePaths []string) error {
err := validatedIsFiles(configFilePaths)
if err != nil {
return err
}
for _, configPath := range configFilePaths {
err := mergeConfigFile(configPath, v)
if err != nil {
log.Debug("error loading config file", "path", configPath, "error", err)
return err
}
log.Debug("config file merged", "path", configPath)
if err := mergeDefaultImports(configPath, v); err != nil {
log.Debug("error process imports", "path", configPath, "error", err)
}
if err := mergeImports(v); err != nil {
log.Debug("error process imports", "file", configPath, "error", err)
}
}
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Merge files with partial error handling.

Errors in mergeDefaultImports and mergeImports only log a debug message. Consider returning errors if a partial merge is not acceptable.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 70-72: pkg/config/load_config_args.go#L70-L72
Added lines #L70 - L72 were not covered by tests


[warning] 78-79: pkg/config/load_config_args.go#L78-L79
Added lines #L78 - L79 were not covered by tests

Comment on lines 101 to 109
if isRemoteImport(importPath) {
// Handle remote imports
paths, err := processRemoteImport(basePath, importPath, tempDir, currentDepth, maxDepth)
if err != nil {
log.Debug("failed to process remote import", "path", importPath, "error", err)
continue
}
resolvedPaths = append(resolvedPaths, paths...)
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Insecure remote import allowance
Import paths are allowed to start with “http://”, which can lead to insecure downloads. Consider restricting to “https://” or adding user-configurable validation to reduce potential security risks.

Copy link

Warning

This PR is blocked from merging because a required semver label is missing.

major, minor, patch, no-release

You'll need to add one before this PR can be merged.

@mergify mergify bot removed the conflict This PR has conflicts label Mar 22, 2025
Copy link

mergify bot commented Mar 22, 2025

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.com/stretchr/testify/require"
)

// test configuration with flags --config and --config-path with multiple files and directories merge

Check failure

Code scanning / golangci-lint

Comment should end in a period Error test

Comment should end in a period
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
website/docs/cli/configuration/configuration.mdx (1)

29-36: ⚠️ Potential issue

Fix typo in CLI flag documentation.

The documentation for the new flags is clear and informative, but there's a typo on line 35. One of the --config-path flags is incorrectly written as -config-path (missing a dash).

-    atmos --config /path/to/config1.yaml --config /path/to/config2.yaml --config-path /path/first/config/ -config-path /path/second/config/ ...
+    atmos --config /path/to/config1.yaml --config /path/to/config2.yaml --config-path /path/first/config/ --config-path /path/second/config/ ...
🧹 Nitpick comments (5)
tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden (1)

122-122: Consider escaping angle brackets in examples.

Based on previous feedback, angle brackets in examples should be escaped using HTML entities for consistency.

-  $ atmos terraform [subcommand] <component-name> -s <stack-name>
+  $ atmos terraform [subcommand] &lt;component-name&gt; -s &lt;stack-name&gt;
tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden (1)

79-79: Escape angle brackets in example.

For consistency with established guidelines, angle brackets should be escaped in command examples.

-  $ atmos terraform apply <component-name> -s <stack-name>
+  $ atmos terraform apply &lt;component-name&gt; -s &lt;stack-name&gt;
tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden (1)

117-117: Escape angle brackets in example.

Consistent with established guidelines, escape the angle brackets in command examples using HTML entities.

-  $ atmos terraform [subcommand] <component-name> -s <stack-name>
+  $ atmos terraform [subcommand] &lt;component-name&gt; -s &lt;stack-name&gt;
tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden (1)

79-79: Escape angle brackets in example.

To maintain consistency with established guidelines, modify the example to use HTML entities for angle brackets.

-  $ atmos terraform apply <component-name> -s <stack-name>
+  $ atmos terraform apply &lt;component-name&gt; -s &lt;stack-name&gt;
website/docs/cli/configuration/configuration.mdx (1)

37-39: Grammar issue in Configuration Load Order heading.

The heading for the configuration load order section is missing article "the" before "command".

-Configuration Load Order
-If --config and --config-path not specified in command
+Configuration Load Order
+If --config and --config-path are not specified in the command
🧰 Tools
🪛 LanguageTool

[uncategorized] ~38-~38: You might be missing the article “the” here.
Context: ...nfig and --config-path not specified in command The CLI config is loaded from the follo...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9534bd4 and d3195a0.

📒 Files selected for processing (10)
  • internal/exec/utils.go (1 hunks)
  • pkg/config/const.go (1 hunks)
  • pkg/config/load.go (12 hunks)
  • pkg/schema/schema.go (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden (1 hunks)
  • tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden (1 hunks)
  • website/docs/cli/configuration/configuration.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden
  • pkg/schema/schema.go
  • pkg/config/const.go
🧰 Additional context used
🧠 Learnings (4)
tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden (3)
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-03-20T16:30:34.659Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `&lt;component&gt;`) rather than converted to backticks or other markdown formatting.
tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden (3)
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-03-20T16:30:34.659Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `&lt;component&gt;`) rather than converted to backticks or other markdown formatting.
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden (1)
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden (3)
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
Learning: Backtick formatting should only be applied to flag descriptions in Go source files, not in golden test files (test snapshots) as they are meant to capture the raw command output.
Learnt from: samtholiya
PR: cloudposse/atmos#1068
File: tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden:59-64
Timestamp: 2025-03-20T16:30:34.659Z
Learning: For Atmos CLI help text, angle brackets in command examples and flag descriptions should be escaped using HTML entities (e.g., `&lt;component&gt;`) rather than converted to backticks or other markdown formatting.
Learnt from: samtholiya
PR: cloudposse/atmos#955
File: tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden:0-0
Timestamp: 2025-03-20T16:30:34.659Z
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.
🪛 LanguageTool
website/docs/cli/configuration/configuration.mdx

[uncategorized] ~38-~38: You might be missing the article “the” here.
Context: ...nfig and --config-path not specified in command The CLI config is loaded from the follo...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Summary
🔇 Additional comments (11)
tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden (1)

95-111: New global flags added successfully.

The addition of the three new flags (--base-path, --config, and --config-path) aligns perfectly with the PR objectives to enhance CLI flexibility. These flags will provide users with greater control over managing their Atmos projects.

tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden (2)

28-34: Global flags consistently added.

The three new flags (--base-path, --config, and --config-path) have been consistently added to this command's help output, improving command-line configurability.


37-38: File descriptor formatting improved.

Adding single quotes around file descriptors improves clarity and readability.

tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden (1)

90-111: Global flags successfully added.

The three new global flags have been properly integrated into the help output, maintaining consistent descriptions and formatting across all commands.

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

28-34: New global flags correctly implemented.

The implementation of the three new flags (--base-path, --config, and --config-path) is consistent with other command help outputs, enhancing the CLI's flexibility.


37-38: Improved formatting for file descriptors.

Adding single quotes around file descriptors enhances clarity and maintains formatting consistency throughout the help documentation.

internal/exec/utils.go (1)

211-222:

❓ Verification inconclusive

Enhanced CLI configurability with new command-line flags.

This implementation adds three new flags to the command-line interface:

  1. --base-path: Specifies the base path for the Atmos project
  2. --config: Allows selection of specific configuration files
  3. --config-path: Points to directories containing Atmos configurations

The error handling is solid, returning immediately if any flag retrieval fails. This matches the PR objectives of enhancing CLI configurability.

Let's confirm our test coverage for these error paths:


🏁 Script executed:

#!/bin/bash
# Check test coverage for these new flags
echo "Checking for tests covering flag error handling scenarios:"
rg -A 5 "GetString.*base-path.*error" --glob "**/*_test.go"
rg -A 5 "GetStringSlice.*config.*error" --glob "**/*_test.go"
rg -A 5 "GetStringSlice.*config-path.*error" --glob "**/*_test.go"

Length of output: 321


CLI Flags Error Handling: Confirm Test Coverage for Error Paths

The code changes in internal/exec/utils.go (lines 211–222) correctly add the new flags (--base-path, --config, and --config-path) with solid error handling that returns immediately when flag retrieval fails. This aligns with our goal of enhancing CLI configurability.

However, our initial search didn’t reveal any tests covering these error paths. Please manually verify that tests exist for these scenarios—or consider adding tests to ensure that error conditions are properly handled during flag retrieval.

pkg/config/load.go (4)

5-6: Well-implemented embedded configuration support.

Adding embedded configuration is a solid enhancement that ensures a default configuration is always available, even when no external configuration files are found. The use of the Go embed package is appropriate here.

Also applies to: 20-21


39-49: Logical flow for configuration loading.

The implementation follows a clear precedence:

  1. First load embedded default configuration
  2. If CLI flags specify configs, use only those
  3. Otherwise fall back to the standard config location search

This approach maintains backward compatibility while adding new flexibility through CLI flags.


220-223: Improved function signature for better flexibility.

Modifying mergeConfig to accept a fileName parameter rather than using a hardcoded value makes the function more reusable and adaptable to different configuration file names.


403-414: Clean implementation of embedded config loading.

The loadEmbeddedConfig function is well-structured with:

  • Clear purpose and responsibility
  • Proper error handling with descriptive messages
  • Efficient use of memory through byte readers

This is a robust implementation that provides a good fallback configuration mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/xl triage Needs triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants