Skip to content

Conversation

@osterman
Copy link
Member

@osterman osterman commented Nov 4, 2025

what

  • Add comprehensive test coverage for profile CLI commands (cmd/profile/show.go and cmd/profile/list.go)
  • Improve test coverage from 0% to 59.8% for profile command layer
  • Add 1,003 lines of table-driven tests across 2 new test files
  • Fix cross-platform compatibility issues (Windows path separators)
  • Remove unreachable dead code in existing tests
  • Correct misleading test case names to match actual behavior

why

  • CodeCov analysis identified profile CLI commands with 0% patch coverage
  • While overall project coverage is at 70.04%, new profile commands lacked any tests
  • Without tests, we cannot verify correct behavior across different scenarios
  • Cross-platform issues and misleading test names reduce code quality
  • Comprehensive test coverage ensures profile commands work reliably in production

references

  • Addresses CodeCov patch coverage gaps identified in recent commits
  • Follows Go testing best practices with table-driven tests
  • Uses testify library for assertions (assert/require)
  • Tests cover all output formats (JSON, YAML, table), error cases, and edge cases
  • Ensures cross-platform compatibility with filepath.Join for Windows support

Test Coverage Improvements

Files Added

cmd/profile/show_test.go (477 lines)

  • Format flag completion tests
  • Profile name completion tests
  • Error builder tests (profile not found, invalid format)
  • JSON rendering tests (basic profiles, profiles with metadata)
  • YAML rendering tests (basic profiles, deprecated profiles)
  • Format dispatcher tests (text/json/yaml formats, invalid formats)
  • Profile info retrieval tests (existing/non-existent profiles)
  • Edge case tests (no files, many files, nil/empty metadata)

cmd/profile/list_test.go (526 lines)

  • Format flag completion tests
  • JSON rendering tests (empty lists, single profile, multiple profiles with metadata)
  • YAML rendering tests (empty lists, single profile, multiple profiles)
  • Profile discovery error builder tests
  • Format dispatcher tests (table/json/yaml formats, invalid formats)
  • Empty profile list tests (all formats)
  • Complex profile tests (long paths, many files, rich metadata)
  • Integration test skeleton (skipped, covered in tests/ directory)

Coverage Results

  • Before: cmd/profile/show.go - 0% coverage
  • After: cmd/profile/show.go - 59.8% coverage
  • Before: cmd/profile/list.go - 0% coverage
  • After: cmd/profile/list.go - 59.8% coverage

Fixes Applied

  1. Misleading Test Name (cmd/profile/show_test.go:300)

    • Changed "empty format defaults to text" → "empty format is invalid"
    • Test validates error behavior, name now matches implementation
  2. Unreachable Dead Code (pkg/profile/list/formatter_table_test.go:234-239)

    • Removed conditional check for path length exceeding width
    • Prior assertion already guaranteed path ≤ pathWidth, making code unreachable
    • Removed unused strings import
  3. Windows Path Separator (pkg/profile/manager_test.go:607)

    • Changed hardcoded "stacks/dev.yaml" → filepath.Join("stacks", "dev.yaml")
    • Ensures tests pass on Windows (backslashes) and Unix (forward slashes)

Testing Strategy

All tests follow table-driven pattern with:

  • Descriptive test case names
  • Multiple scenarios per function
  • Validation functions for complex assertions
  • JSON/YAML unmarshaling verification
  • Error type checking with assert.ErrorIs
  • Edge cases (empty inputs, nil values, large datasets)

Tests verify:

  • ✅ Shell completion for format flags
  • ✅ JSON output (valid structure, correct field names)
  • ✅ YAML output (valid structure, correct field names)
  • ✅ Error messages and error types
  • ✅ Profile discovery and retrieval
  • ✅ Complex metadata handling
  • ✅ Cross-platform compatibility

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Configuration profiles: multi-location discovery, precedence-based composition, activate via --profile or ATMOS_PROFILE; new profile commands: list and show (table/json/yaml) and alias "atmos list profiles".
  • Documentation

    • PRDs, CLI docs, blog post, examples and test fixtures for developer/CI/production profiles and migration guidance.
  • UI/Style

    • Profile list/show renderers and a new Notice theme style for messaging.
  • User-facing errors

    • Clear, actionable errors for profile discovery, missing profiles, load/merge failures and invalid output formats.
  • Tests

    • Extensive unit and end-to-end CLI tests, snapshots, and fixtures covering profiles and help output.
  • Chores

    • Minor dependency updates.

osterman and others added 2 commits November 4, 2025 16:39
## Overview
This PRD defines the Atmos Profiles feature, which enables users to maintain
multiple configuration presets that can be activated via CLI flags or environment
variables. Profiles provide environment-specific, role-based, or context-specific
configuration overrides without modifying the base atmos.yaml.

## Key Design Decisions

### Configuration
- Top-level `profiles:` configuration key in atmos.yaml
- `profiles.base_path` for custom profile directory location
- Configurable path: `profiles.base_path: "./profiles"`

### Profile Discovery (Precedence Order)
1. `profiles.base_path` (if configured)
2. `{config_dir}/.atmos/profiles/` (project-local, hidden)
3. `$XDG_CONFIG_HOME/atmos/profiles/` (user-global, XDG-compliant)
4. `{config_dir}/profiles/` (project, non-hidden)

### Activation
- CLI flag: `--profile developer,debug` or `--profile developer --profile debug`
- Environment variable: `ATMOS_PROFILE=developer,debug`
- Multiple profiles supported with left-to-right precedence
- Profile inheritance via existing `import:` field mechanism

### Profile Management Commands
- `atmos profile list` - List all available profiles across locations
- `atmos profile show <profile>` - Display merged configuration
- Both support `--format json|yaml` for structured output
- Enhanced `atmos describe config` shows active profiles

## Use Cases
- CI/CD profiles (GitHub Actions OIDC, non-interactive, debug logging)
- Role-based defaults (Developer, Platform Engineer, Audit profiles)
- Debug profiles (trace logging, profiling, performance analysis)
- Testing profiles (isolated configurations)

## Implementation Plan
- **Phase 1 (Week 1-2)**: Core profile loading mechanism
- **Phase 2 (Week 3)**: Profile management commands via command registry
- **Phase 3 (Week 4)**: Documentation, examples, and blog post

## Future Enhancements
- `atmos profile validate <profile>` - Syntax validation without activation
- `atmos profile init` - Template-based profile generation (optional)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Use u.GetHighlightedYAML() for colorized YAML output
- Use u.GetHighlightedJSON() for colorized JSON output
- Same formatting as 'atmos describe config' for consistency
- Respects terminal color settings (--color, --no-color, NO_COLOR)
- Supports pager integration when enabled

This reuses existing formatting infrastructure instead of implementing
new output formatting, ensuring consistent UX across all commands.
@osterman osterman requested a review from a team as a code owner November 4, 2025 22:41
@github-actions github-actions bot added the size/l Large size PR label Nov 4, 2025
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

  • go.mod

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 4, 2025

📝 Walkthrough

Walkthrough

Adds a configuration-profiles subsystem: schema and CLI flag, discovery/loading/merge across multiple locations, profile list/show commands and renderers, command-alias support (two‑phase registry), new error sentinels and UI style, extensive tests/fixtures/docs, and CI snapshot updates.

Changes

Cohort / File(s) Summary
Product docs & examples
docs/prd/atmos-profiles.md, docs/prd/auth-default-settings.md, docs/prd/command-registry-pattern.md, docs/developing-atmos-commands.md, examples/config-profiles/*, website/blog/2025-11-11-atmos-profiles.mdx
Add PRDs, examples, README, and blog post describing profiles, auth-defaults, and command-alias patterns.
Schema & CLI flags
pkg/schema/schema.go, pkg/flags/global/flags.go, pkg/flags/global_builder.go, internal/exec/cli_utils.go, tests/snapshots/*_--help.stdout.golden
Add ProfilesConfig and ConfigMetadata; add ProfilesFromArg; register global --profile stringSlice (ATMOS_PROFILE); parse and thread profile args; update help snapshots.
Config loading & profiles integration
pkg/config/load.go, pkg/config/profiles.go, pkg/config/profiles_test.go, pkg/config/xdg_test_helper.go
Centralize directory-based loading (atmos.d/.atmos.d), add discover/find/loadProfiles with precedence, non-fatal optional-dir handling, and tests.
Profile API & manager
pkg/profile/profile.go, pkg/profile/manager.go, pkg/profile/list/formatter_table.go, pkg/profile/show/formatter.go, pkg/profile/*_test.go
Add ProfileInfo/ProfileLocation, ProfileManager interface and DefaultProfileManager; implement listing, retrieval, metadata parsing and renderers (table/text/json/yaml) with tests.
CLI commands & wiring
cmd/profile/profile.go, cmd/profile/list.go, cmd/profile/show.go, cmd/profile/markdown/*, cmd/root.go
Add profile command with list and show subcommands, format flags/completions, alias wiring and side-effect registration.
Command registry & aliases
cmd/internal/command.go, cmd/internal/registry.go, cmd/internal/registry_test.go, cmd/about/about.go, cmd/theme/theme.go, cmd/version/version.go
Add CommandAlias type and GetAliases() to providers; implement two-phase alias registration to create alias commands delegating to source commands; update providers and tests.
Errors & UI styles
errors/errors.go, pkg/ui/theme/styles.go
Replace/remove old output-format sentinel(s); add ErrInvalidFormat, ErrOutputFormat and multiple profile-related error sentinels; add a themed Notice style and accessor.
CLI tests, fixtures & helpers
tests/cli_profile_test.go, tests/fixtures/scenarios/config-profiles/*, internal/exec/cli_utils_test.go, internal/exec/*_test.go, pkg/config/*_test.go, pkg/config/xdg_test_helper.go
Add E2E and unit tests for profile commands, fixtures for config-profiles, XDG isolation and global-flag test helpers; adapt tests to use global-flag helper.
Snapshots, logging & CI
tests/snapshots/*, .github/workflows/test.yml
Update help and output snapshots (new --profile flag, added JSON keys profiles/metadata), add trace logs for directory loads, include config-profiles in CI matrix.
Misc (deps & tooling)
go.mod, NOTICE, pkg/config/const.go, pkg/flags/flag_parser.go, tools/lintroller/*
Bump patch deps, add AuthProfileFlag constant, add perf tracing hook, update lint exclusions and test helper utilities.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant ConfigLoader as Config Loader
  participant ProfileMgr as Profile Manager
  participant FS as FileSystem
  participant Formatter

  Note right of CLI: User runs "atmos profile list/show"
  User->>CLI: atmos profile list --profile developer --format table
  CLI->>ConfigLoader: LoadConfig(profilesFromArg)
  ConfigLoader->>ProfileMgr: discoverProfileLocations(atmosConfig)
  ProfileMgr->>FS: scan base, .atmos.d, XDG, project dirs
  FS-->>ProfileMgr: locations (precedence ordered)
  ProfileMgr->>ProfileMgr: findProfileDirectory(name, locations)
  ProfileMgr->>ConfigLoader: loadProfiles(profileNames)
  ConfigLoader->>FS: read & merge profile YAML files (left-to-right)
  FS-->>ConfigLoader: parsed files
  ConfigLoader-->>CLI: merged AtmosConfiguration
  CLI->>ProfileMgr: ListProfiles(atmosConfig)
  ProfileMgr->>FS: enumerate profile dirs & files, load metadata
  ProfileMgr-->>CLI: []ProfileInfo
  CLI->>Formatter: RenderTable(profiles)
  Formatter-->>CLI: formatted output
  CLI-->>User: display
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Points needing extra attention:

  • pkg/config/load.go & pkg/config/profiles.go: precedence ordering, merge semantics, CliConfigPath-relative resolution, and non-fatal optional-dir behavior.
  • cmd/internal/registry.go: two-phase alias registration, correct sharing/propagation of flags/completions, and edge cases (missing parent/subcommand).
  • Flag propagation: verify ProfilesFromArg is populated and honored consistently across load and CLI flows.
  • Tests & snapshots: XDG isolation helpers, fixtures and golden updates for flakiness.

Possibly related PRs

Suggested reviewers

  • osterman

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: Add configuration profiles support' accurately summarizes the primary change—implementing a comprehensive configuration profiles system with CLI commands, profile loading, discovery, and documentation.
Docstring Coverage ✅ Passed Docstring coverage is 84.68% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch atmos-profiles-design

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a4a9e29 and 274a582.

📒 Files selected for processing (5)
  • cmd/version/list_test.go (1 hunks)
  • cmd/version/show_test.go (2 hunks)
  • pkg/config/profiles.go (1 hunks)
  • website/docs/cli/configuration/configuration.mdx (1 hunks)
  • website/docs/cli/global-flags.mdx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/version/show_test.go
  • website/docs/cli/configuration/configuration.mdx
🧰 Additional context used
🧠 Learnings (29)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
📚 Learning: 2025-02-19T05:50:35.853Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-02-19T05:50:35.853Z
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.

Applied to files:

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

Applied to files:

  • cmd/version/list_test.go
  • website/docs/cli/global-flags.mdx
📚 Learning: 2025-02-03T06:00:11.419Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/describe_config.go:20-20
Timestamp: 2025-02-03T06:00:11.419Z
Learning: Commands should use `PrintErrorMarkdownAndExit` with empty title and suggestion (`"", err, ""`) for general error handling. Specific titles like "Invalid Usage" or "File Not Found" should only be used for validation or specific error scenarios.

Applied to files:

  • cmd/version/list_test.go
📚 Learning: 2025-09-10T22:38:42.212Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/identities/aws/user.go:141-145
Timestamp: 2025-09-10T22:38:42.212Z
Learning: The user confirmed that the errors package has an error string wrapping format, contradicting the previous learning about ErrWrappingFormat being invalid. The current usage of fmt.Errorf(errUtils.ErrWrappingFormat, errUtils.ErrAuthAwsFileManagerFailed, err) appears to be the correct pattern.

Applied to files:

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

Applied to files:

  • cmd/version/list_test.go
📚 Learning: 2025-09-10T22:38:42.212Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/identities/aws/user.go:141-145
Timestamp: 2025-09-10T22:38:42.212Z
Learning: ErrWrappingFormat is correctly defined as "%w: %w" in the errors package and is used throughout the codebase to wrap two error types together. The usage fmt.Errorf(errUtils.ErrWrappingFormat, errUtils.ErrAuthAwsFileManagerFailed, err) is the correct pattern when both arguments are error types.

Applied to files:

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

Applied to files:

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

Applied to files:

  • pkg/config/profiles.go
  • website/docs/cli/global-flags.mdx
📚 Learning: 2025-10-02T19:17:51.630Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1504
File: pkg/profiler/profiler.go:20-31
Timestamp: 2025-10-02T19:17:51.630Z
Learning: In pkg/profiler/profiler.go, profiler-specific errors (ErrUnsupportedProfileType, ErrStartCPUProfile, ErrStartTraceProfile, ErrCreateProfileFile) must remain local and cannot be moved to errors/errors.go due to an import cycle: pkg/profiler → errors → pkg/schema → pkg/profiler. This is a valid exception to the centralized errors policy.

Applied to files:

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

Applied to files:

  • pkg/config/profiles.go
📚 Learning: 2025-03-12T21:38:42.699Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1139
File: pkg/config/go-homedir/homedir.go:183-196
Timestamp: 2025-03-12T21:38:42.699Z
Learning: The code in pkg/config/go-homedir is a direct fork of the mitchellh/go-homedir package and was intentionally imported as-is without modifications to maintain consistency with the original source. Security concerns or other improvements may be addressed in future PRs.

Applied to files:

  • pkg/config/profiles.go
📚 Learning: 2025-09-08T01:25:44.958Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: XDG Base Directory Specification compliance implementation for atmos toolchain is complete: created toolchain/xdg_cache.go with GetXDGCacheDir() and GetXDGTempCacheDir() functions, updated toolchain/installer.go and cmd/toolchain_clean.go to use these XDG helpers, and changed all cache paths from hardcoded ~/.cache/tools-cache to XDG-compliant ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain fallback).

Applied to files:

  • pkg/config/profiles.go
📚 Learning: 2024-10-28T01:51:30.811Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform_clean.go:329-332
Timestamp: 2024-10-28T01:51:30.811Z
Learning: In the Atmos Go code, when deleting directories or handling file paths (e.g., in `terraform_clean.go`), always resolve the absolute path using `filepath.Abs` and use the logger `u.LogWarning` for logging messages instead of using `fmt.Printf`.

Applied to files:

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

Applied to files:

  • pkg/config/profiles.go
📚 Learning: 2025-09-08T01:25:44.958Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: Final XDG Base Directory Specification implementation for atmos toolchain is complete and verified: toolchain/xdg_cache.go provides GetXDGCacheDir() and GetXDGTempCacheDir() functions, all hardcoded ~/.cache/tools-cache paths have been replaced with XDG-compliant paths using ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain fallback), and tests have been updated to expect the new path structure.

Applied to files:

  • pkg/config/profiles.go
📚 Learning: 2024-11-22T12:38:33.132Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_utils.go:496-513
Timestamp: 2024-11-22T12:38:33.132Z
Learning: In the Atmos project, continue to flag path traversal issues in code reviews but acknowledge when they are expected and acceptable in specific cases.

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

  • website/docs/cli/global-flags.mdx
📚 Learning: 2025-09-07T18:07:00.549Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.

Applied to files:

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

Applied to files:

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

Applied to files:

  • website/docs/cli/global-flags.mdx
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.

Applied to files:

  • website/docs/cli/global-flags.mdx
📚 Learning: 2025-02-06T13:38:07.216Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 984
File: internal/exec/copy_glob.go:0-0
Timestamp: 2025-02-06T13:38:07.216Z
Learning: The `u.LogTrace` function in the `cloudposse/atmos` repository accepts `atmosConfig` as its first parameter, followed by the message string.

Applied to files:

  • website/docs/cli/global-flags.mdx
📚 Learning: 2025-09-10T17:34:52.568Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/providers/github/oidc.go:96-100
Timestamp: 2025-09-10T17:34:52.568Z
Learning: The ATMOS_ environment variable binding guideline applies to Atmos configuration variables, not external service-required environment variables like GitHub Actions OIDC variables (GITHUB_ACTIONS, ACTIONS_ID_TOKEN_*) which must use their standard names.

Applied to files:

  • website/docs/cli/global-flags.mdx
📚 Learning: 2025-11-11T03:47:59.576Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1686
File: toolchain/which_test.go:166-223
Timestamp: 2025-11-11T03:47:59.576Z
Learning: In the cloudposse/atmos repo, tests that manipulate environment variables should use testing.T.Setenv for automatic setup/teardown instead of os.Setenv/Unsetenv.

Applied to files:

  • website/docs/cli/global-flags.mdx
🧬 Code graph analysis (1)
pkg/config/profiles.go (5)
pkg/schema/schema.go (1)
  • AtmosConfiguration (53-94)
pkg/xdg/xdg.go (1)
  • GetXDGConfigDir (46-48)
errors/builder.go (1)
  • Build (21-23)
errors/errors.go (4)
  • ErrProfileNotFound (176-176)
  • ErrProfileDirNotExist (181-181)
  • ErrProfileDirNotAccessible (182-182)
  • ErrProfileDiscovery (178-178)
pkg/logger/log.go (1)
  • Debug (24-26)
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Acceptance Tests (windows)
  • GitHub Check: Summary
🔇 Additional comments (6)
cmd/version/list_test.go (1)

373-375: Error message validation updated correctly.

The change from checking for "unsupported" to "invalid" aligns with the broader error sentinel refactoring in this PR (ErrInvalidFormat replacing ErrUnsupportedOutputFormat). The test logic remains sound and properly validates error behavior for invalid format inputs.

website/docs/cli/global-flags.mdx (1)

135-207: Documentation is comprehensive and well-structured.

The --profile flag documentation clearly explains use cases, configuration options, and precedence rules. The examples cover both single and multiple profiles, and the profile directory structure examples are helpful for users. The environment variable documentation is consistent with other global flags.

Also applies to: 448-455

pkg/config/profiles.go (4)

83-120: Profile discovery logic is well-implemented.

The function correctly sorts by precedence, searches locations in order, and provides a comprehensive error message listing all searched paths when a profile isn't found. The hints guide users toward resolution.


122-148: Profile enumeration handles errors gracefully.

Skipping inaccessible locations (lines 130, 136) ensures the function returns partial results rather than failing completely, which is appropriate for a discovery function.


153-193: Error handling properly distinguishes directory states.

The code now correctly differentiates between "not found" (lines 158-168) and "not accessible" (lines 172-180) cases as suggested in the past review. Each scenario provides specific error messages and actionable hints.


209-274: Profile loading orchestration is robust.

The function handles errors comprehensively, enriching ErrProfileNotFound with a list of available profiles (lines 238-255) to guide users. Debug logging (lines 262-265) aids troubleshooting, and the left-to-right loading order matches the documented precedence.


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

❤️ Share

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

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

🧹 Nitpick comments (2)
docs/prd/atmos-profiles.md (2)

159-194: Add language identifiers to fenced code blocks.

Several code blocks are missing language specifiers, which violates markdownlint rule MD040 and reduces syntax highlighting quality in documentation:

  • Lines 159–194: Tree structure (use text or tree)
  • Lines 268–281: Output example (use text)
  • Lines 288–301: Output example (use text)
  • Lines 409–462: ASCII diagram (use text)
  • Lines 810–835: Error message (use text)
  • Lines 826–835: YAML error example (use yaml)
  • Lines 838–846: Warning message (use text)

Here's a sample fix for lines 159–194:

-```
+```text
 # Project-local profiles

Apply similar changes to all other blocks without language specifiers, using text for structured output/diagrams and the appropriate language (yaml, bash, json) for code examples.

Also applies to: 268-281, 288-301, 409-462, 810-835, 826-846, 838-846


32-32: Minor typographical issues.

A few sentences would benefit from punctuation adjustments:

  • Line 32: "development vs CI/CD" → "development vs. CI/CD" (period after abbreviation)
  • Line 56: "Developer vs Platform Engineer" → "Developer vs. Platform Engineer"
  • Lines 887, 890, 896: Several paragraphs lack terminal punctuation before new sections

These are minor and don't impact understanding, but fixing them improves consistency with American English style conventions.

Also applies to: 56-56, 887-887, 890-890, 896-896

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 06fe90b and 6e8238d.

📒 Files selected for processing (1)
  • docs/prd/atmos-profiles.md (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
📚 Learning: 2025-01-25T03:51:57.689Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.

Applied to files:

  • docs/prd/atmos-profiles.md
📚 Learning: 2025-09-08T01:25:44.958Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: The atmos toolchain has been updated to follow XDG Base Directory Specification with helper functions GetXDGCacheDir() and GetXDGTempCacheDir() in toolchain/xdg_cache.go, using XDG_CACHE_HOME when set and falling back to ~/.cache/atmos-toolchain, making it consistent with atmos core's XDG compliance.

Applied to files:

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

Applied to files:

  • docs/prd/atmos-profiles.md
🪛 LanguageTool
docs/prd/atmos-profiles.md

[typographical] ~32-~32: In American English, use a period after an abbreviation.
Context: ...ifferent settings for local development vs CI/CD environments 2. **Role-based conf...

(MISSING_PERIOD_AFTER_ABBREVIATION)


[typographical] ~56-~56: In American English, use a period after an abbreviation.
Context: ...ole-Based Defaults Actor: Developer vs Platform Engineer Scenario: Differe...

(MISSING_PERIOD_AFTER_ABBREVIATION)


[grammar] ~375-~375: Ensure spelling is correct
Context: ...*: Profile loading MUST complete within 100ms for typical profiles (<10 files) **TR3...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[typographical] ~729-~729: Consider using typographic quotation marks here.
Context: ... XDG profile location support: - Use pkg/xdg.GetXDGConfigDir("profiles", 0o755) for user-global profiles - ...

(EN_QUOTES)


[grammar] ~734-~734: Please add a punctuation mark at the end of paragraph.
Context: ...t profiles after .atmos.d/ but before local atmos.yaml Deliverables: - Profi...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~766-~766: Please add a punctuation mark at the end of paragraph.
Context: ...- Profile discovery and introspection logic -DiscoverAllProfiles(atmosConfig) ...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~887-~887: Please add a punctuation mark at the end of paragraph.
Context: ...ble > project-local > XDG > legacy) for predictability 2. **Should profiles support environme...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~890-~890: Please add a punctuation mark at the end of paragraph.
Context: ...only. Use wrapper scripts or aliases if needed 3. **Should profiles support condition...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~896-~896: Please add a punctuation mark at the end of paragraph.
Context: ...ide earlier), document clearly in error messages ## Design Decisions ### Profile Inher...

(PUNCTUATION_PARAGRAPH_END)


[style] ~937-~937: To form a complete sentence, be sure to include a subject.
Context: ...directories with common configurations. May not be needed if profiles are simple en...

(MISSING_IT_THERE)

🪛 markdownlint-cli2 (0.18.1)
docs/prd/atmos-profiles.md

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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Build (windows)
  • GitHub Check: Build (macos)
  • GitHub Check: Build (linux)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: autofix
  • GitHub Check: Review Dependency Licenses
  • GitHub Check: Summary
🔇 Additional comments (2)
docs/prd/atmos-profiles.md (2)

1-100: Well-structured PRD with clear scope and examples.

The document provides a thorough and well-organized specification for Atmos Profiles. The problem statement motivates the feature effectively, use cases are concrete and actionable, and requirements are specific with measurable criteria. The three-phase implementation plan is realistic and grounded in existing Atmos patterns (Viper, Cobra, .atmos.d/).

The design decisions are sound—reusing the existing import: mechanism for inheritance and leveraging XDG for user-global profiles both show good judgment about not over-engineering the solution.


336-372: Technical requirements are implementation-ready.

The technical requirements correctly identify key integration points (pkg/config/load.go, pkg/schema/schema.go, command registry pattern) and specify concrete schema changes. The performance targets (100ms for typical profiles, linear scaling) are reasonable, and testing requirements cover precedence rules, merging, and backward compatibility.

coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 4, 2025
@osterman osterman added the minor New features that do not break anything label Nov 4, 2025
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Warning

Changelog Entry Required

This PR is labeled minor or major but doesn't include a changelog entry.

Action needed: Add a new blog post in website/blog/ to announce this change.

Example filename: website/blog/2025-11-18-feature-name.mdx

Alternatively: If this change doesn't require a changelog entry, remove the minor or major label.

Replace shell-commented output examples with realistic terminal output:
- atmos profile list: Show actual lipgloss table with Unicode borders
- atmos profile show: Show clean formatted output without comment markers
- Separate command examples from output examples
- Add proper JSON output examples
- Use Charm Bracelet styling patterns consistent with existing commands

Addresses feedback that UI output should look like actual terminal output,
not shell comments.
@github-actions github-actions bot added size/xl Extra large size PR and removed size/l Large size PR labels Nov 4, 2025
@mergify
Copy link

mergify bot commented Nov 4, 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.

Add comprehensive provenance tracking requirements for profiles:

**New Functional Requirements:**
- FR5.9: atmos profile show --provenance flag
- FR5.10: atmos describe config --provenance flag (new capability)
- Updated FR5.11-FR5.13 numbering

**New Technical Requirements (TR5: Provenance Support):**
- TR5.1-TR5.14: Detailed provenance implementation requirements
- Reuse existing pkg/merge infrastructure (MergeContext pattern)
- Use p.RenderInlineProvenance() for inline annotations
- Record source paths: profiles/<name>/<file>:<line>
- Distinguish base, .atmos.d/, profile, and XDG sources
- Support (override) annotations for multiple profile precedence

**Examples Added:**
- atmos profile show developer --provenance
  Shows inline annotations with file:line for each config value
- atmos describe config --profile developer --provenance
  Shows where config values originated (base vs profile)
- Multiple profile provenance with override annotations

**Implementation Updates:**
- Phase 2 renamed to "Profile Management Commands & Provenance"
- Added provenance tasks to Phase 2 implementation plan
- Added provenance documentation to Phase 3 deliverables
- Added provenance tests to TR4.8

**Key Design Decisions:**
- Provenance uses same infrastructure as describe component
- Profile merge operations record provenance during loading
- Source paths clearly indicate profile vs base config
- XDG locations marked with (XDG) suffix for clarity

This enables users to debug profile configuration sources and
understand which profile (or base config) a value came from.
This implements the auth.defaults configuration for deterministic
identity selection, solving the CI "multiple defaults" problem.

**New PRD: Auth Default Settings (auth-default-settings.md)**

Schema Addition:
- auth.defaults.identity (string) - Selected default identity
- auth.defaults.session (SessionConfig) - Global session defaults
- auth.defaults.console (ConsoleConfig) - Global console defaults
- auth.defaults.keyring (KeyringConfig) - Global keyring defaults

Identity Selection Precedence:
1. --identity=explicit (CLI flag)
2. ATMOS_IDENTITY (env var)
3. auth.defaults.identity (selected default) ← NEW
4. identity.default: true (favorites)
5. Error: no default identity

Key Concepts:
- auth.defaults.identity = "Selected default" (single, deterministic)
- identity.default: true = "Favorites" (multiple, interactive)
- Profiles use auth.defaults.identity for deterministic behavior
- Base config can use favorites without breaking CI

**Updates to Atmos Profiles PRD:**

Dependencies Section:
- Added reference to Auth Default Settings PRD
- Added challenge #7: Identity selection in CI

CI Profile Example:
- Updated to use auth.defaults.identity
- Fixed Gomplate syntax: {{ env "GITHUB_RUN_ID" }}
- Added session duration defaults
- Documented precedence chain and CI behavior

Developer Profile Example:
- Shows combined pattern: auth.defaults.identity + identity.default: true
- Demonstrates selected default + favorites for quick switching
- Added multiple identities (sandbox + prod)
- Documented usage patterns and benefits

Integration Section:
- Added "Integration with Auth Default Settings" section
- Problem/solution comparison (with/without auth.defaults)
- Three usage patterns: CI, Developer, Base Config
- Precedence with profiles active
- Key benefits for profiles

Technical Dependencies:
- Added auth-default-settings.md as explicit dependency

**Why This Design:**

Problem: Multiple identity.default: true causes errors in CI (no TTY)
Solution: auth.defaults.identity provides deterministic selection
Benefit: Profiles can encapsulate auth config for specific environments

Use Cases:
- CI profiles: Set auth.defaults.identity for non-interactive
- Developer profiles: Combine selected default + favorites
- Base config: Use favorites only (forces profile/explicit selection in CI)

Implementation: Both PRDs will be implemented together as they are
tightly coupled - profiles need auth.defaults for CI use cases.
@mergify
Copy link

mergify bot commented Nov 4, 2025

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify bot added the needs-cloudposse Needs Cloud Posse assistance label Nov 4, 2025
This clarifies the relationship between auth.defaults.identity (new)
and identity.default: true (existing), including historical context
and environment variable mapping.

**Historical Context Added:**

Why identity.default: true exists:
- Originally designed for provider-specific default identities
- Use case: "default identity based on a given provider"
- Example: Multiple providers (aws-sso-dev, aws-sso-prod, github-oidc)
  each with their own default identity
- Problem: Works as "favorites" in TTY, but breaks in CI (multiple defaults error)

**Disambiguation Section:**

Two Types of Defaults:

1. auth.defaults.identity (NEW):
   - Purpose: Single, deterministic identity selection
   - Cardinality: One (singular)
   - Use Case: "Always use THIS identity by default"
   - Behavior: Automatic, non-interactive safe
   - CI-friendly: Works without TTY

2. identity.default: true (EXISTING):
   - Purpose: Mark identities as favorites/shortcuts
   - Cardinality: Many (multiple allowed)
   - Use Case: "These are my frequently-used identities"
   - Behavior: Interactive selection or error in CI
   - Originally: Provider-specific defaults

**Relationship:**
- auth.defaults.identity OVERRIDES identity.default: true
- When both exist, selected default wins (deterministic)
- identity.default: true only consulted if no selected default

**Environment Variable Mapping:**

New: ATMOS_DEFAULTS_IDENTITY
- Maps to auth.defaults.identity configuration
- Takes precedence over config (follows Viper pattern)
- Use cases: Temporary overrides, CI configuration, profile-specific

Complete Precedence Chain:
1. --identity=explicit (CLI flag)
2. ATMOS_IDENTITY (explicit selection)
3. ATMOS_DEFAULTS_IDENTITY (selected default via env) ← NEW
4. auth.defaults.identity (selected default via config) ← NEW
5. identity.default: true (favorites)
6. Error: no default identity

**Provider-Level Defaults Discussion:**

Open Question #4 explores provider.defaults concept:
- Background: Original intent was provider-specific defaults
- Future consideration: provider.defaults.identity
- Recommendation: Not in this PRD (defer to future)
- Rationale: Solves immediate problem first, unclear precedence,
  use case needs validation
- Alternative: Use profiles to achieve provider-specific defaults

**Benefits of This Clarity:**

- Users understand WHY two default mechanisms exist
- Clear migration path from identity.default: true to auth.defaults
- CI use cases now have deterministic solution
- Profiles can leverage auth.defaults for encapsulation
- Provider-level defaults deferred with clear rationale
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

🧹 Nitpick comments (2)
docs/prd/atmos-profiles.md (1)

165-200: Add language specification to fenced code blocks throughout.

Multiple code blocks in this PRD are missing language identifiers (e.g., ```yaml instead of ```). This improves readability in rendered markdown and enables proper syntax highlighting.

Example locations needing language specs: lines 165 (yaml), 274 (table/text), 301, 496, 581, 631, 668, 724, 816, 948, 988, 1147, 1163, 1175, 1277.

Most are YAML configuration examples and should use ```yaml or ```bash for shell commands.

Proposed fix for lines 165–200 section (Profile structure example):

-Example structure:
-```
+Example structure:
+```

Apply the same pattern throughout the document for consistency with markdown best practices.

docs/prd/auth-default-settings.md (1)

115-121: Add language specification to fenced code blocks.

Lines 115 (precedence example), 421 (environment variable example), and 439 (complete precedence chain) are missing language specs. These should be ```bash since they're shell/environment examples.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6e8238d and 2092001.

📒 Files selected for processing (2)
  • docs/prd/atmos-profiles.md (1 hunks)
  • docs/prd/auth-default-settings.md (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
📚 Learning: 2025-09-07T18:07:00.549Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.

Applied to files:

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

Applied to files:

  • docs/prd/atmos-profiles.md
📚 Learning: 2025-01-25T15:21:40.413Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos-cli-imports/atmos.yaml:8-8
Timestamp: 2025-01-25T15:21:40.413Z
Learning: In Atmos, when a directory is specified for configuration loading (e.g., in the `import` section of atmos.yaml), all files within that directory should be treated as Atmos configurations. Do not suggest restricting file extensions in directory-based glob patterns.

Applied to files:

  • docs/prd/atmos-profiles.md
🪛 LanguageTool
docs/prd/auth-default-settings.md

[typographical] ~5-~5: Consider using typographic quotation marks here.
Context: ...ected default identity. This solves the "multiple defaults" problem in non-interactive (CI) environ...

(EN_QUOTES)


[typographical] ~11-~11: Consider using a typographic opening quote here.
Context: ... default identities**. The use case: > "You might have a default identity based ...

(EN_QUOTES)


[typographical] ~11-~11: Consider using a typographic close quote here.
Context: ...ault identity based on a given provider." **Example - Multiple Providers, Multip...

(EN_QUOTES)


[typographical] ~45-~45: Consider using a typographic opening quote here.
Context: ...es) - Non-interactive (CI): Error - "multiple default identities" (breaks) *...

(EN_QUOTES)


[typographical] ~45-~45: Consider using a typographic close quote here.
Context: ...**: Error - "multiple default identities" (breaks) Current Behavior: `identi...

(EN_QUOTES)


[typographical] ~54-~54: Consider using typographic quotation marks here.
Context: ...urrent State Atmos has two concepts of "default" for identities: 1. **Identity-level `d...

(EN_QUOTES)


[typographical] ~56-~56: Consider using typographic quotation marks here.
Context: ...default: true** - Marks identities as "favorites" (multiple allowed, originally intended ...

(EN_QUOTES)


[typographical] ~64-~64: Consider using a typographic opening quote here.
Context: ...istic behavior (no TTY) - No way to say "use THIS identity by default" **Gap 2: ...

(EN_QUOTES)


[typographical] ~64-~64: Consider using a typographic close quote here.
Context: ...way to say "use THIS identity by default" **Gap 2: Ambiguous Semantics with Prof...

(EN_QUOTES)


[typographical] ~342-~342: Consider using a typographic opening quote here.
Context: ...inality:** One (singular) Use Case: "Always use THIS identity by default" **B...

(EN_QUOTES)


[typographical] ~342-~342: Consider using a typographic close quote here.
Context: ...:** "Always use THIS identity by default" Behavior: Automatic selection (no u...

(EN_QUOTES)


[typographical] ~361-~361: Consider using a typographic opening quote here.
Context: ...* Many (multiple allowed) Use Case: "These are my frequently-used identities"...

(EN_QUOTES)


[typographical] ~361-~361: Consider using a typographic close quote here.
Context: ..."These are my frequently-used identities" Behavior: Interactive selection or ...

(EN_QUOTES)


[typographical] ~378-~378: Consider using a typographic opening quote here.
Context: ...er-oriented** - Originally designed for "default identity per provider" - **Multi...

(EN_QUOTES)


[typographical] ~378-~378: Consider using a typographic close quote here.
Context: ...igned for "default identity per provider" - Multiple allowed - Creates a shor...

(EN_QUOTES)


[style] ~481-~481: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ...## Use Case 2: Developer Workstation Problem: Developers want favorites list for q...

(EN_REPEATEDWORDS_PROBLEM)


[style] ~506-~506: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ...se Case 3: Profile-Specific Defaults Problem: Different profiles need different de...

(EN_REPEATEDWORDS_PROBLEM)


[style] ~537-~537: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ... Use Case 4: Global Session Defaults Problem: All identities should have 12h sessi...

(EN_REPEATEDWORDS_PROBLEM)


[typographical] ~559-~559: Consider using typographic quotation marks here.
Context: ...onments** - CI/CD no longer errors with "multiple defaults" - auth.defaults.identity provides sin...

(EN_QUOTES)


[typographical] ~596-~596: Consider using typographic quotation marks here.
Context: ... Mitigation: - Clear documentation: "Selected default" vs "Favorites" - `auth.defaults.identit...

(EN_QUOTES)


[typographical] ~596-~596: Consider using typographic quotation marks here.
Context: ...ar documentation: "Selected default" vs "Favorites" - auth.defaults.identity always wins ...

(EN_QUOTES)


[typographical] ~615-~615: Consider using a typographic opening quote here.
Context: ...xisting pattern) - Clear error message: "auth.defaults.identity 'foo' not found" ...

(EN_QUOTES)


[typographical] ~615-~615: Consider using a typographic close quote here.
Context: ... "auth.defaults.identity 'foo' not found" - Same validation pattern as `identity....

(EN_QUOTES)


[typographical] ~642-~642: In American English, use a period after an abbreviation.
Context: ...efaults.identity` 5. Document favorites vs selected default semantics **Deliverab...

(MISSING_PERIOD_AFTER_ABBREVIATION)


[typographical] ~722-~722: Consider using typographic quotation marks here.
Context: ...endation:** No - defeats the purpose of "selected default" - Multiple favorites already support...

(EN_QUOTES)


[typographical] ~735-~735: Consider using a typographic opening quote here.
Context: ...der-specific defaults - Problem: "You might have a default identity based ...

(EN_QUOTES)


[typographical] ~735-~735: Consider using a typographic close quote here.
Context: ...fault identity based on a given provider" - Current Workaround: Use `ident...

(EN_QUOTES)


[typographical] ~757-~757: In American English, use a period after an abbreviation.
Context: ...plexity - Unclear precedence: global vs provider-level vs identity-level - U...

(MISSING_PERIOD_AFTER_ABBREVIATION)


[typographical] ~757-~757: In American English, use a period after an abbreviation.
Context: ...ar precedence: global vs provider-level vs identity-level - Use case needs vali...

(MISSING_PERIOD_AFTER_ABBREVIATION)


[typographical] ~758-~758: In American English, use a period after an abbreviation.
Context: ...tion (when would you select by provider vs by identity?) - Can be added later w...

(MISSING_PERIOD_AFTER_ABBREVIATION)


[style] ~759-~759: To form a complete sentence, be sure to include a subject.
Context: ...elect by provider vs by identity?) - Can be added later without breaking changes...

(MISSING_IT_THERE)


[grammar] ~759-~759: Please add a punctuation mark at the end of paragraph.
Context: ... - Can be added later without breaking changes Alternative: Document pattern u...

(PUNCTUATION_PARAGRAPH_END)

docs/prd/atmos-profiles.md

[typographical] ~37-~37: In American English, use a period after an abbreviation.
Context: ...ifferent settings for local development vs CI/CD environments 2. **Role-based conf...

(MISSING_PERIOD_AFTER_ABBREVIATION)


[typographical] ~62-~62: In American English, use a period after an abbreviation.
Context: ...ole-Based Defaults Actor: Developer vs Platform Engineer Scenario: Differe...

(MISSING_PERIOD_AFTER_ABBREVIATION)


[grammar] ~290-~290: Ensure spelling is correct
Context: ...`` FR5.2.1: Table styling MUST use lipgloss with: - Header row with bold styling - ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[typographical] ~335-~335: Consider using typographic quotation marks here.
Context: ... file: /dev/stderr ``` Note: The "Merged Configuration" section uses u.GetHighlightedYAML() f...

(EN_QUOTES)


[grammar] ~413-~413: Ensure spelling is correct
Context: ...*: Profile loading MUST complete within 100ms for typical profiles (<10 files) **TR3...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~443-~443: Please add a punctuation mark at the end of paragraph.
Context: ...p.RenderInlineProvenance() for inline annotations TR5.3: `atmos describe config --pr...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~445-~445: Please add a punctuation mark at the end of paragraph.
Context: ...p.RenderInlineProvenance() for inline annotations TR5.4: Provenance tracking for pro...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~449-~449: Please add a punctuation mark at the end of paragraph.
Context: ...ordProvenance()` for each configuration value TR5.6: Profile source paths MUST b...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~461-~461: Please add a punctuation mark at the end of paragraph.
Context: ....TrackProvenance = truebefore loading configuration **TR5.10**: Profile loading inpkg/co...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~463-~463: Please add a punctuation mark at the end of paragraph.
Context: ...optional mergeContext *m.MergeContext parameter TR5.11: Provenance implementation ...

(PUNCTUATION_PARAGRAPH_END)


[typographical] ~826-~826: Consider using typographic quotation marks here.
Context: ... - No identity.default: true means no "multiple defaults" errors - Profile encapsulates all CI-sp...

(EN_QUOTES)


[typographical] ~980-~980: In American English, use a period after an abbreviation.
Context: ...configurations are coming from profiles vs base config. With multiple profiles: `...

(MISSING_PERIOD_AFTER_ABBREVIATION)


[typographical] ~1054-~1054: Consider using typographic quotation marks here.
Context: ... XDG profile location support: - Use pkg/xdg.GetXDGConfigDir("profiles", 0o755) for user-global profiles - ...

(EN_QUOTES)


[grammar] ~1059-~1059: Please add a punctuation mark at the end of paragraph.
Context: ...t profiles after .atmos.d/ but before local atmos.yaml Deliverables: - Profi...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~1099-~1099: Please add a punctuation mark at the end of paragraph.
Context: ...- Profile discovery and introspection logic -DiscoverAllProfiles(atmosConfig) ...

(PUNCTUATION_PARAGRAPH_END)


[typographical] ~1294-~1294: Consider using typographic quotation marks here.
Context: ... 1. Deterministic CI behavior - No "multiple defaults" errors 2. Profile encapsulation - A...

(EN_QUOTES)


[grammar] ~1321-~1321: Please add a punctuation mark at the end of paragraph.
Context: ...ble > project-local > XDG > legacy) for predictability 2. **Should profiles support environme...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~1324-~1324: Please add a punctuation mark at the end of paragraph.
Context: ...only. Use wrapper scripts or aliases if needed 3. **Should profiles support condition...

(PUNCTUATION_PARAGRAPH_END)


[grammar] ~1330-~1330: Please add a punctuation mark at the end of paragraph.
Context: ...ide earlier), document clearly in error messages ## Design Decisions ### Profile Inher...

(PUNCTUATION_PARAGRAPH_END)


[style] ~1371-~1371: To form a complete sentence, be sure to include a subject.
Context: ...directories with common configurations. May not be needed if profiles are simple en...

(MISSING_IT_THERE)

🪛 markdownlint-cli2 (0.18.1)
docs/prd/auth-default-settings.md

61-61: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


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

(MD040, fenced-code-language)


152-152: Hard tabs
Column: 1

(MD010, no-hard-tabs)


153-153: Hard tabs
Column: 1

(MD010, no-hard-tabs)


154-154: Hard tabs
Column: 1

(MD010, no-hard-tabs)


155-155: Hard tabs
Column: 1

(MD010, no-hard-tabs)


156-156: Hard tabs
Column: 1

(MD010, no-hard-tabs)


157-157: Hard tabs
Column: 1

(MD010, no-hard-tabs)


162-162: Hard tabs
Column: 1

(MD010, no-hard-tabs)


163-163: Hard tabs
Column: 1

(MD010, no-hard-tabs)


164-164: Hard tabs
Column: 1

(MD010, no-hard-tabs)


165-165: Hard tabs
Column: 1

(MD010, no-hard-tabs)


176-176: Hard tabs
Column: 1

(MD010, no-hard-tabs)


178-178: Hard tabs
Column: 1

(MD010, no-hard-tabs)


179-179: Hard tabs
Column: 1

(MD010, no-hard-tabs)


180-180: Hard tabs
Column: 1

(MD010, no-hard-tabs)


181-181: Hard tabs
Column: 1

(MD010, no-hard-tabs)


182-182: Hard tabs
Column: 1

(MD010, no-hard-tabs)


183-183: Hard tabs
Column: 1

(MD010, no-hard-tabs)


184-184: Hard tabs
Column: 1

(MD010, no-hard-tabs)


186-186: Hard tabs
Column: 1

(MD010, no-hard-tabs)


187-187: Hard tabs
Column: 1

(MD010, no-hard-tabs)


188-188: Hard tabs
Column: 1

(MD010, no-hard-tabs)


190-190: Hard tabs
Column: 1

(MD010, no-hard-tabs)


191-191: Hard tabs
Column: 1

(MD010, no-hard-tabs)


192-192: Hard tabs
Column: 1

(MD010, no-hard-tabs)


193-193: Hard tabs
Column: 1

(MD010, no-hard-tabs)


194-194: Hard tabs
Column: 1

(MD010, no-hard-tabs)


196-196: Hard tabs
Column: 1

(MD010, no-hard-tabs)


197-197: Hard tabs
Column: 1

(MD010, no-hard-tabs)


199-199: Hard tabs
Column: 1

(MD010, no-hard-tabs)


200-200: Hard tabs
Column: 1

(MD010, no-hard-tabs)


201-201: Hard tabs
Column: 1

(MD010, no-hard-tabs)


202-202: Hard tabs
Column: 1

(MD010, no-hard-tabs)


203-203: Hard tabs
Column: 1

(MD010, no-hard-tabs)


204-204: Hard tabs
Column: 1

(MD010, no-hard-tabs)


205-205: Hard tabs
Column: 1

(MD010, no-hard-tabs)


207-207: Hard tabs
Column: 1

(MD010, no-hard-tabs)


208-208: Hard tabs
Column: 1

(MD010, no-hard-tabs)


209-209: Hard tabs
Column: 1

(MD010, no-hard-tabs)


210-210: Hard tabs
Column: 1

(MD010, no-hard-tabs)


211-211: Hard tabs
Column: 1

(MD010, no-hard-tabs)


212-212: Hard tabs
Column: 1

(MD010, no-hard-tabs)


213-213: Hard tabs
Column: 1

(MD010, no-hard-tabs)


214-214: Hard tabs
Column: 1

(MD010, no-hard-tabs)


215-215: Hard tabs
Column: 1

(MD010, no-hard-tabs)


216-216: Hard tabs
Column: 1

(MD010, no-hard-tabs)


217-217: Hard tabs
Column: 1

(MD010, no-hard-tabs)


218-218: Hard tabs
Column: 1

(MD010, no-hard-tabs)


219-219: Hard tabs
Column: 1

(MD010, no-hard-tabs)


220-220: Hard tabs
Column: 1

(MD010, no-hard-tabs)


221-221: Hard tabs
Column: 1

(MD010, no-hard-tabs)


222-222: Hard tabs
Column: 1

(MD010, no-hard-tabs)


223-223: Hard tabs
Column: 1

(MD010, no-hard-tabs)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)

docs/prd/atmos-profiles.md

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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


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

(MD040, fenced-code-language)


1237-1237: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


1246-1246: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


1259-1259: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


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

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Build (macos)
  • GitHub Check: Build (linux)
  • GitHub Check: Build (windows)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (go)
  • GitHub Check: Review Dependency Licenses
  • GitHub Check: autofix
  • GitHub Check: Run pre-commit hooks
  • GitHub Check: Summary
🔇 Additional comments (3)
docs/prd/atmos-profiles.md (3)

3-6: PRD structure and dependencies are well-documented.

The overview clearly articulates the problem, dependencies, and relationship to the Auth Default Settings PRD. The dependency declaration at lines 9–10 properly identifies auth.defaults as a prerequisite feature.


45-115: Use cases and goals are clear and comprehensive.

The four use cases (CI/CD, role-based, debug, testing) align with stated goals. The distinction between goals and non-goals is helpful. One minor note: lines 37–43 reference the Auth Default Settings PRD for deterministic CI behavior—this coupling is intentional and documented, so no action needed.


115-475: Requirements are detailed and testable.

Functional and technical requirements (FR1–FR13, TR1–TR6) are well-defined. The precedence rules (FR3) and profile discovery locations (FR1.2) are explicit. Provenance support (TR5) properly reuses existing pkg/merge and pkg/provenance infrastructure.

Minor observation: TR3.1 sets a 100ms performance target—confirm this is achievable with typical profile counts during implementation.

coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 4, 2025
@codecov
Copy link

codecov bot commented Nov 4, 2025

Codecov Report

❌ Patch coverage is 75.98566% with 201 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.48%. Comparing base (f70da2f) to head (274a582).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/profile/manager.go 72.50% 46 Missing and 9 partials ⚠️
cmd/profile/show.go 58.55% 40 Missing and 6 partials ⚠️
cmd/profile/list.go 55.68% 36 Missing and 3 partials ⚠️
pkg/config/profiles.go 82.00% 23 Missing and 4 partials ⚠️
pkg/config/load.go 53.12% 12 Missing and 3 partials ⚠️
internal/exec/cli_utils.go 33.33% 4 Missing and 2 partials ⚠️
pkg/ui/theme/styles.go 16.66% 5 Missing ⚠️
cmd/internal/registry.go 89.18% 2 Missing and 2 partials ⚠️
pkg/profile/list/formatter_table.go 97.22% 1 Missing and 1 partial ⚠️
cmd/version/list.go 50.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1752      +/-   ##
==========================================
+ Coverage   71.37%   71.48%   +0.10%     
==========================================
  Files         453      461       +8     
  Lines       42815    43631     +816     
==========================================
+ Hits        30560    31189     +629     
- Misses       9740     9897     +157     
- Partials     2515     2545      +30     
Flag Coverage Δ
unittests 71.48% <75.98%> (+0.10%) ⬆️

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

Files with missing lines Coverage Δ
cmd/about/about.go 68.42% <100.00%> (+3.71%) ⬆️
cmd/list/list.go 90.00% <100.00%> (+1.11%) ⬆️
cmd/profile/profile.go 100.00% <100.00%> (ø)
cmd/root.go 61.62% <ø> (ø)
cmd/theme/theme.go 100.00% <100.00%> (ø)
cmd/version/version.go 71.42% <100.00%> (+1.42%) ⬆️
errors/errors.go 100.00% <ø> (ø)
pkg/auth/list/formatter_table.go 94.36% <100.00%> (ø)
pkg/config/xdg_test_helper.go 100.00% <100.00%> (ø)
pkg/flags/flag_parser.go 83.33% <100.00%> (+0.14%) ⬆️
... and 16 more

... and 1 file with indirect coverage changes

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

This updates the PRD to use the existing metadata: pattern (consistent
with vendoring and stack config) and adds comprehensive tag-based
resource filtering capabilities.

**Metadata Pattern (Following Existing Atmos Conventions):**

Schema Addition:
- metadata.name (string) - Profile/config name (auto-populated)
- metadata.description (string) - Human-readable description
- metadata.version (string) - Semantic version (optional)
- metadata.tags ([]string) - Tags for filtering (optional)
- metadata.deprecated (bool) - Deprecation marker (optional)

Follows pattern from:
- Vendoring: metadata.name, metadata.description
- Stack config: metadata.name, metadata.description

Auto-Population Rules:
- Base config (atmos.yaml): metadata.name = "default" if not set
- Profile configs: metadata.name = directory basename if not set
- Example: profiles/ci/ → metadata.name = "ci"

Metadata Merge Behavior (TR2.8):
- First non-empty wins: name, description, version, deprecated
- Union (append + deduplicate): tags
- Best practice: Define in _metadata.yaml or first alphabetical file

**Tag-Based Resource Filtering (TR2a):**

Use Case: When profile is active, automatically filter resources
by matching tags to show only relevant items.

Implementation:
- Profile tags: metadata.tags: ["developer", "local"]
- Resource tags: identity.tags, component.tags, stack.tags
- Matching: OR logic (show if ANY tag matches)
- Opt-in: --filter-by-profile-tags flag or profiles.filter_by_tags config

Commands with Tag Filtering:
- atmos auth list identities --filter-by-profile-tags
- atmos list components --filter-by-profile-tags
- atmos describe stacks --filter-by-profile-tags

Example:
```yaml
# profiles/developer/_metadata.yaml
metadata:
  tags: ["developer", "local"]

# auth identities with tags
developer-sandbox: tags: ["developer"]  # Shown
platform-admin: tags: ["admin"]         # Hidden
```

Multiple Profiles:
- --profile developer,ci
- Tags unioned: ["developer", "local", "ci", "github-actions"]
- Resources matching ANY tag shown

**Examples Updated:**

All profile examples now include metadata:
- CI Profile: name, description, version, tags (ci, github-actions)
- Developer Profile: name, description, version, tags (development, local)
- Debug Profile: name, description, tags (debug, troubleshooting)
- Platform Admin: name, description, tags (admin, production)

New Section: Tag-Based Resource Filtering
- Complete example with 4 identities
- Filtered vs unfiltered output comparison
- Benefits: Reduces noise, improves UX, clear intent
- Multiple profile tag combination example

**Schema Updates:**

profiles:
  base_path: "./profiles"

metadata:
  name: default
  description: "Base Atmos configuration"
  version: "1.0.0"
  tags: []

**Benefits:**

- Consistent with existing Atmos patterns (metadata:)
- No confusion with profiles: vs profile: (single key)
- Tag filtering enables context-aware resource discovery
- Improves developer UX (only see relevant identities)
- Opt-in (backward compatible - disabled by default)
- Extensible (works with any resource with tags field)
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: 3

🧹 Nitpick comments (1)
docs/prd/atmos-profiles.md (1)

142-150: Add Windows path examples for XDG profile locations.

Lines 142–150 mention XDG Base Directory Specification and note platform awareness ("Uses ~/.config on Linux/macOS, %APPDATA% on Windows"), but all subsequent path examples use Linux/macOS format. A concrete Windows example (e.g., %APPDATA%\atmos\profiles\) would improve clarity for Windows users and help implementers correctly resolve XDG paths on all platforms.

Recommendation: Include a Windows-specific path example or a mapping table.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2092001 and 87a8809.

📒 Files selected for processing (1)
  • docs/prd/atmos-profiles.md (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1466
File: cmd/markdown/atmos_toolchain_aliases.md:2-4
Timestamp: 2025-09-13T16:39:20.007Z
Learning: In the cloudposse/atmos repository, CLI documentation files in cmd/markdown/ follow a specific format that uses " $ atmos command" (with leading space and dollar sign prompt) in code blocks. This is the established project convention and should not be changed to comply with standard markdownlint rules MD040 and MD014.
📚 Learning: 2025-01-25T03:51:57.689Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.

Applied to files:

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

Applied to files:

  • docs/prd/atmos-profiles.md
🔇 Additional comments (1)
docs/prd/atmos-profiles.md (1)

335-341: Verify that referenced utility functions and infrastructure exist in the codebase.

The PRD references several functions and modules with confidence:

  • u.GetHighlightedYAML() and u.GetHighlightedJSON() (lines 338–339)
  • p.RenderInlineProvenance() (lines 336, 536–537)
  • pkg/merge.MergeContext and pkg/merge.NewMergeContext() (lines 559–560)
  • pkg/provenance.RenderInlineProvenance() (line 561)
  • XDG utilities (implied by lines 142–145)

Before finalizing this PRD, verify that these functions/modules exist, are public/exported, and support the documented signatures and behaviors. If they don't exist, this will impact the implementation timeline and feasibility.

To verify, you can search the codebase:

Also applies to: 532-562

coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 16, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Nov 18, 2025
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

🧹 Nitpick comments (2)
errors/errors.go (2)

176-184: Profile error sentinels look solid.

The new profile errors are well-organized, consistently named, and cover the key failure modes (discovery, load, merge, directory access, metadata). The grouping with a clear comment header follows the existing pattern in the file.

Optional: Consider standardizing message prefixes. Some use "failed to" (lines 179-181) while others use present-tense descriptions (lines 177-178, 182-184). For example:

-ErrProfileNotFound         = errors.New("profile not found")
+ErrProfileNotFound         = errors.New("failed to find profile")

This is a minor stylistic point and matches the broader file's mixed style, so deferring is perfectly reasonable.


138-139: ErrInvalidFormat overlaps semantically with existing ErrUnsupportedOutputFormat; consider consolidation.

Verification confirms both errors serve the same purpose: indicating an unsupported format selection. ErrInvalidFormat (used in cmd/profile/*) validates user format input, as does ErrUnsupportedOutputFormat (used in cmd/version/*). Meanwhile, ErrOutputFormat is distinct—it captures marshaling failures (e.g., json.MarshalIndent() errors), not format validation.

If both errors will continue in the codebase, document the distinction clearly. Otherwise, consider consolidating to a single sentinel with consistent naming across subsystems.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between eb6becb and 3e91960.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • NOTICE (2 hunks)
  • cmd/root.go (1 hunks)
  • errors/errors.go (2 hunks)
  • go.mod (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • cmd/root.go
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
📚 Learning: 2025-10-02T19:17:51.630Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1504
File: pkg/profiler/profiler.go:20-31
Timestamp: 2025-10-02T19:17:51.630Z
Learning: In pkg/profiler/profiler.go, profiler-specific errors (ErrUnsupportedProfileType, ErrStartCPUProfile, ErrStartTraceProfile, ErrCreateProfileFile) must remain local and cannot be moved to errors/errors.go due to an import cycle: pkg/profiler → errors → pkg/schema → pkg/profiler. This is a valid exception to the centralized errors policy.

Applied to files:

  • errors/errors.go
📚 Learning: 2025-09-10T22:38:42.212Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/identities/aws/user.go:141-145
Timestamp: 2025-09-10T22:38:42.212Z
Learning: ErrWrappingFormat is correctly defined as "%w: %w" in the errors package and is used throughout the codebase to wrap two error types together. The usage fmt.Errorf(errUtils.ErrWrappingFormat, errUtils.ErrAuthAwsFileManagerFailed, err) is the correct pattern when both arguments are error types.

Applied to files:

  • errors/errors.go
📚 Learning: 2025-09-10T22:38:42.212Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/identities/aws/user.go:141-145
Timestamp: 2025-09-10T22:38:42.212Z
Learning: The user confirmed that the errors package has an error string wrapping format, contradicting the previous learning about ErrWrappingFormat being invalid. The current usage of fmt.Errorf(errUtils.ErrWrappingFormat, errUtils.ErrAuthAwsFileManagerFailed, err) appears to be the correct pattern.

Applied to files:

  • errors/errors.go
📚 Learning: 2025-02-03T06:00:11.419Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/describe_config.go:20-20
Timestamp: 2025-02-03T06:00:11.419Z
Learning: Commands should use `PrintErrorMarkdownAndExit` with empty title and suggestion (`"", err, ""`) for general error handling. Specific titles like "Invalid Usage" or "File Not Found" should only be used for validation or specific error scenarios.

Applied to files:

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

Applied to files:

  • errors/errors.go
📚 Learning: 2025-10-22T14:55:44.014Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1695
File: pkg/auth/manager.go:169-171
Timestamp: 2025-10-22T14:55:44.014Z
Learning: Go 1.20+ supports multiple %w verbs in fmt.Errorf, which returns an error implementing Unwrap() []error. This is valid and does not panic. Atmos uses Go 1.24.8 and configures errorlint with errorf-multi: true to validate this pattern.

Applied to files:

  • errors/errors.go
📚 Learning: 2024-11-18T13:59:10.824Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_model_component.go:3-20
Timestamp: 2024-11-18T13:59:10.824Z
Learning: When replacing significant dependencies like `go-getter` that require extensive changes, prefer to address them in separate PRs.

Applied to files:

  • NOTICE
📚 Learning: 2025-01-17T00:21:32.987Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:3-3
Timestamp: 2025-01-17T00:21:32.987Z
Learning: The project uses Go version 1.23.0 which has been confirmed by the maintainer to be working in production for months. Do not flag this as an invalid Go version.

Applied to files:

  • go.mod
📚 Learning: 2025-01-17T00:21:32.987Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 944
File: go.mod:3-3
Timestamp: 2025-01-17T00:21:32.987Z
Learning: Go version 1.23.0 was deliberately introduced by the maintainer (aknysh) in January 2025. While this might be a pre-release or development version of Go, it has been approved for use in this project.

Applied to files:

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

Applied to files:

  • go.mod
🪛 GitHub Actions: Dependency Review
NOTICE

[error] 1-1: NOTICE file is out of date. Run './scripts/generate-notice.sh' locally and commit the changes.

⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Summary
🔇 Additional comments (2)
go.mod (1)

46-55: Patch bumps for sentry-go and renameio look good

Both dependency updates are patch-level and match the corresponding NOTICE entries. This is a straightforward, low-risk refresh from the module graph point of view.

Please double-check upstream changelogs and your CI runs to confirm there are no subtle behavior changes in github.com/getsentry/sentry-go v0.38.0 or github.com/google/renameio/v2 v2.0.1 that affect how Atmos uses them.

NOTICE (1)

288-290: Run generate-notice.sh locally with Go installed

The sandbox environment lacks Go, so I can't verify the script output here. However, learnings confirm that NOTICE is programmatically generated—the file shouldn't be edited by hand.

Run the script in your local environment where Go is available:

./scripts/generate-notice.sh

Then commit the regenerated NOTICE and confirm it still reflects renameio v2.0.1 and sentry-go v0.38.0 as expected. This should resolve the CI flag.

Also applies to: 1215-1217

…rrors

## Profile Environment Variable Support

Added `ATMOS_PROFILE` environment variable support for setting active profiles:
- Added env var fallback in `internal/exec/cli_utils.go` for commands using ProcessCommandLineArgs
- Removed redundant env var handling from `cmd/root.go` (not used by most commands)
- Supports comma-separated profiles: `ATMOS_PROFILE="ci,developer"`
- Flag takes precedence over env var for consistent behavior
- Updated configuration documentation

## Linter Fixes

Fixed all lintroller and golangci-lint errors:
- Added missing `defer perf.Track()` in `pkg/flags/flag_parser.go:NormalizeShorthandWithEquals()`
- Fixed `Deprecated` field comment in `pkg/schema/schema.go` (removed colon to avoid deprecation marker)
- Removed unnecessary `os.Chdir` save/restore in `cmd/root_helpers_test.go` (tests don't change directory)
- Added `cmd/root_helpers_test.go` and `cmd/root_test.go` to lintroller exclusions for legitimate `os.Args` usage
  (these files test functions that directly read `os.Args`)

## Testing

All changes tested and verified:
- ✅ `ATMOS_PROFILE=developer` loads profile correctly
- ✅ `--profile` flag works
- ✅ Flag precedence over env var
- ✅ Comma-separated profiles work
- ✅ All unit tests pass
- ✅ All linter checks pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The link `/cli/commands/profile` doesn't exist yet. Removed the broken
link to fix website build. The link can be added back when profile
command documentation is created.

Fixes website build error:
  Broken link on source page path = /cli/configuration/:
     -> linking to /cli/commands/profile
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cmd/version/show_test.go (1)

313-337: Align invalid-format test assertion with ErrInvalidFormat.

The default branch now wraps errUtils.ErrInvalidFormat, but the test still checks for "unsupported" in the error string, which no longer matches the sentinel message ("invalid format"). This will cause the invalid-format case to fail.

Consider asserting on the sentinel instead of the string:

-			if tt.wantError {
-				require.Error(t, err, "Expected error for invalid format")
-				assert.Contains(t, err.Error(), "unsupported")
-			} else {
-				assert.NoError(t, err, "Expected no error for valid format %s", tt.format)
-			}
+			if tt.wantError {
+				require.Error(t, err, "Expected error for invalid format")
+				assert.ErrorIs(t, err, errUtils.ErrInvalidFormat)
+			} else {
+				assert.NoError(t, err, "Expected no error for valid format %s", tt.format)
+			}
🧹 Nitpick comments (4)
docs/prd/auth-default-settings.md (2)

5-5: Typographical issue: Use curly quotation marks.

Consider replacing straight quotes with typographic (curly) quotation marks for consistency with professional documentation style. Example: "multiple defaults""multiple defaults".


757-762: Fix markdown list indentation and punctuation.

The static analysis tool flagged list indentation issues (lines 758–762) and a missing punctuation mark at the end of the paragraph. Apply this diff to align indentation and add terminal punctuation:

   **Recommendation:** Not in this PRD - defer to future enhancement

   **Rationale:**
   - Current proposal solves the immediate problem (CI + profiles)
   - Provider-level defaults add significant complexity
   - Unclear precedence: global vs. provider-level vs. identity-level
   - Use case needs validation (when would you select by provider vs. by identity?)
-  - Can be added later without breaking changes
+  - Can be added later without breaking changes.

   **Alternative:** Document pattern using profiles
errors/errors.go (1)

131-139: New format/profile sentinels look good; consider wiring the unused ones.

The additions of ErrInvalidFormat / ErrOutputFormat and the profile-related errors are consistent with the existing error taxonomy. Right now ErrOutputFormat and ErrProfileDirNotAccessible don’t appear to be used in the provided changes; if you intend to classify those cases separately, it’d be worth routing the corresponding call sites through these sentinels (e.g., profile directory permission issues, generic output-format failures) to keep error handling centralized and discoverable.

Also applies to: 175-183

pkg/config/load.go (1)

543-591: Centralized directory loader for .atmos.d/ and profiles is solid and preserves optional imports.

loadAtmosConfigsFromDirectory reuses SearchAtmosConfig + mergeConfigFile, so directory-based loads (profiles and .atmos.d/) now share ordering, priority, and YAML function preprocessing. The helper:

  • Treats “no files found” as non-fatal and logs at Trace, which is appropriate for optional directories.
  • Wraps discovery/parse failures with ErrParseFile while keeping the original error in the chain, matching the existing error-wrapping pattern.
  • Is used in mergeDefaultImports with errors downgraded to Trace logs and ignored, keeping .atmos.d/ loading best-effort, which aligns with the resilient “log but don’t break config load” behavior. Based on learnings.

This looks like a good factoring with no behavior regressions.

Also applies to: 611-625

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3e91960 and a4a9e29.

📒 Files selected for processing (15)
  • cmd/root_helpers_test.go (0 hunks)
  • cmd/version/list.go (2 hunks)
  • cmd/version/show.go (1 hunks)
  • cmd/version/show_test.go (1 hunks)
  • docs/prd/auth-default-settings.md (1 hunks)
  • docs/prd/describe-commands-identity-flag.md (1 hunks)
  • errors/errors.go (2 hunks)
  • internal/exec/cli_utils.go (2 hunks)
  • pkg/config/const.go (1 hunks)
  • pkg/config/load.go (3 hunks)
  • pkg/config/profiles.go (1 hunks)
  • pkg/flags/flag_parser.go (1 hunks)
  • pkg/schema/schema.go (3 hunks)
  • tools/lintroller/rule_os_args.go (1 hunks)
  • website/docs/cli/configuration/configuration.mdx (1 hunks)
💤 Files with no reviewable changes (1)
  • cmd/root_helpers_test.go
✅ Files skipped from review due to trivial changes (1)
  • docs/prd/describe-commands-identity-flag.md
🧰 Additional context used
🧠 Learnings (49)
📓 Common learnings
Learnt from: Listener430
Repo: cloudposse/atmos PR: 934
File: tests/fixtures/scenarios/docs-generate/README.md.gotmpl:99-118
Timestamp: 2025-01-25T03:51:57.689Z
Learning: For the cloudposse/atmos repository, changes to template contents should be handled in dedicated PRs and are typically considered out of scope for PRs focused on other objectives.
📚 Learning: 2025-02-03T06:00:11.419Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 959
File: cmd/describe_config.go:20-20
Timestamp: 2025-02-03T06:00:11.419Z
Learning: Commands should use `PrintErrorMarkdownAndExit` with empty title and suggestion (`"", err, ""`) for general error handling. Specific titles like "Invalid Usage" or "File Not Found" should only be used for validation or specific error scenarios.

Applied to files:

  • cmd/version/show.go
  • errors/errors.go
📚 Learning: 2025-01-18T15:18:35.475Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` provides user feedback by showing error messages, command suggestions, and valid subcommands before terminating the program with `os.Exit(1)`. It never returns to the caller, making error handling unnecessary for calls to this function.

Applied to files:

  • cmd/version/show.go
📚 Learning: 2025-10-13T18:13:54.020Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1622
File: pkg/perf/perf.go:140-184
Timestamp: 2025-10-13T18:13:54.020Z
Learning: In pkg/perf/perf.go, the `trackWithSimpleStack` function intentionally skips ownership checks at call stack depth > 1 to avoid expensive `getGoroutineID()` calls on every nested function. This is a performance optimization for the common single-goroutine execution case (most Atmos commands), accepting the rare edge case of potential metric corruption if multi-goroutine execution occurs at depth > 1. The ~19× performance improvement justifies this trade-off.

Applied to files:

  • pkg/flags/flag_parser.go
📚 Learning: 2025-11-09T19:06:58.470Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1752
File: pkg/profile/list/formatter_table.go:27-29
Timestamp: 2025-11-09T19:06:58.470Z
Learning: In the cloudposse/atmos repository, performance tracking with `defer perf.Track()` is enforced on all functions via linting, including high-frequency utility functions, formatters, and renderers. This is a repository-wide policy to maintain consistency and avoid making case-by-case judgment calls about which functions should have profiling.

Applied to files:

  • pkg/flags/flag_parser.go
📚 Learning: 2025-09-07T18:07:00.549Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1452
File: cmd/auth_login.go:43-44
Timestamp: 2025-09-07T18:07:00.549Z
Learning: In the atmos project, the identity flag is defined as a persistent flag on the auth root command (cmd/auth.go), making it available to all auth subcommands without needing to be redefined in each individual subcommand.

Applied to files:

  • pkg/config/const.go
📚 Learning: 2025-10-22T14:55:44.014Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1695
File: pkg/auth/manager.go:169-171
Timestamp: 2025-10-22T14:55:44.014Z
Learning: Go 1.20+ supports multiple %w verbs in fmt.Errorf, which returns an error implementing Unwrap() []error. This is valid and does not panic. Atmos uses Go 1.24.8 and configures errorlint with errorf-multi: true to validate this pattern.

Applied to files:

  • cmd/version/list.go
  • cmd/version/show_test.go
  • errors/errors.go
📚 Learning: 2025-09-10T22:38:42.212Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/identities/aws/user.go:141-145
Timestamp: 2025-09-10T22:38:42.212Z
Learning: The user confirmed that the errors package has an error string wrapping format, contradicting the previous learning about ErrWrappingFormat being invalid. The current usage of fmt.Errorf(errUtils.ErrWrappingFormat, errUtils.ErrAuthAwsFileManagerFailed, err) appears to be the correct pattern.

Applied to files:

  • cmd/version/list.go
  • cmd/version/show_test.go
  • errors/errors.go
📚 Learning: 2025-06-02T14:12:02.710Z
Learnt from: milldr
Repo: cloudposse/atmos PR: 1229
File: internal/exec/workflow_test.go:0-0
Timestamp: 2025-06-02T14:12:02.710Z
Learning: In the atmos codebase, workflow error handling was refactored to use `PrintErrorMarkdown` followed by returning specific error variables (like `ErrWorkflowNoSteps`, `ErrInvalidFromStep`, `ErrInvalidWorkflowStepType`, `ErrWorkflowStepFailed`) instead of `PrintErrorMarkdownAndExit`. This pattern allows proper error testing without the function terminating the process with `os.Exit`, enabling unit tests to assert on error conditions while maintaining excellent user-facing error formatting.

Applied to files:

  • cmd/version/list.go
  • cmd/version/show_test.go
📚 Learning: 2025-09-10T17:34:52.568Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/providers/github/oidc.go:96-100
Timestamp: 2025-09-10T17:34:52.568Z
Learning: The ATMOS_ environment variable binding guideline applies to Atmos configuration variables, not external service-required environment variables like GitHub Actions OIDC variables (GITHUB_ACTIONS, ACTIONS_ID_TOKEN_*) which must use their standard names.

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

  • website/docs/cli/configuration/configuration.mdx
📚 Learning: 2024-12-11T18:40:12.808Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/helmfile.go:37-37
Timestamp: 2024-12-11T18:40:12.808Z
Learning: In the atmos project, `cliConfig` is initialized within the `cmd` package in `root.go` and can be used in other command files.

Applied to files:

  • website/docs/cli/configuration/configuration.mdx
  • internal/exec/cli_utils.go
  • pkg/schema/schema.go
  • pkg/config/load.go
  • pkg/config/profiles.go
📚 Learning: 2025-09-05T14:57:37.360Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 1448
File: cmd/ansible.go:26-28
Timestamp: 2025-09-05T14:57:37.360Z
Learning: The Atmos codebase uses a consistent pattern for commands that delegate to external tools: `PersistentFlags().Bool("", false, doubleDashHint)` where doubleDashHint provides help text about using double dashes to separate Atmos options from native command arguments. This pattern is used across terraform, packer, helmfile, atlantis, aws, and ansible commands.

Applied to files:

  • website/docs/cli/configuration/configuration.mdx
  • pkg/schema/schema.go
📚 Learning: 2024-11-25T17:17:15.703Z
Learnt from: RoseSecurity
Repo: cloudposse/atmos PR: 797
File: pkg/list/atmos.yaml:213-214
Timestamp: 2024-11-25T17:17:15.703Z
Learning: The file `pkg/list/atmos.yaml` is primarily intended for testing purposes.

Applied to files:

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

Applied to files:

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

Applied to files:

  • website/docs/cli/configuration/configuration.mdx
  • pkg/schema/schema.go
  • pkg/config/load.go
📚 Learning: 2024-12-01T00:33:20.298Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 810
File: examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml:28-32
Timestamp: 2024-12-01T00:33:20.298Z
Learning: In `examples/tests/stacks/catalog/terraform/template-functions-test2/defaults.yaml`, `!exec atmos terraform output` is used in examples to demonstrate its usage, even though `!terraform.output` is the recommended approach according to the documentation.

Applied to files:

  • website/docs/cli/configuration/configuration.mdx
📚 Learning: 2025-01-09T22:37:01.004Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 914
File: cmd/terraform_commands.go:260-265
Timestamp: 2025-01-09T22:37:01.004Z
Learning: In the terraform commands implementation (cmd/terraform_commands.go), the direct use of `os.Args[2:]` for argument handling is intentionally preserved to avoid extensive refactoring. While it could be improved to use cobra's argument parsing, such changes should be handled in a dedicated PR to maintain focus and minimize risk.

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

  • tools/lintroller/rule_os_args.go
  • internal/exec/cli_utils.go
📚 Learning: 2025-05-22T15:42:10.906Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1261
File: internal/exec/utils.go:639-640
Timestamp: 2025-05-22T15:42:10.906Z
Learning: In the Atmos codebase, when appending slices with `args := append(configAndStacksInfo.CliArgs, configAndStacksInfo.AdditionalArgsAndFlags...)`, it's intentional that the result is not stored back in the original slice. This pattern is used when the merged result serves a different purpose than the original slices, such as when creating a filtered version for component section assignments.

Applied to files:

  • tools/lintroller/rule_os_args.go
  • internal/exec/cli_utils.go
📚 Learning: 2024-12-13T15:28:13.630Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 844
File: cmd/version.go:34-44
Timestamp: 2024-12-13T15:28:13.630Z
Learning: In `cmd/version.go`, when handling the `--check` flag in the `versionCmd`, avoid using `CheckForAtmosUpdateAndPrintMessage(cliConfig)` as it updates the cache timestamp, which may not be desired in this context.

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

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

Applied to files:

  • pkg/schema/schema.go
  • pkg/config/load.go
📚 Learning: 2025-02-06T13:38:07.216Z
Learnt from: Listener430
Repo: cloudposse/atmos PR: 984
File: internal/exec/copy_glob.go:0-0
Timestamp: 2025-02-06T13:38:07.216Z
Learning: The `u.LogTrace` function in the `cloudposse/atmos` repository accepts `atmosConfig` as its first parameter, followed by the message string.

Applied to files:

  • pkg/schema/schema.go
📚 Learning: 2025-01-25T15:21:40.413Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 808
File: examples/demo-atmos-cli-imports/atmos.yaml:8-8
Timestamp: 2025-01-25T15:21:40.413Z
Learning: In Atmos, when a directory is specified for configuration loading (e.g., in the `import` section of atmos.yaml), all files within that directory should be treated as Atmos configurations. Do not suggest restricting file extensions in directory-based glob patterns.

Applied to files:

  • pkg/config/load.go
📚 Learning: 2025-02-09T18:43:53.902Z
Learnt from: haitham911
Repo: cloudposse/atmos PR: 808
File: pkg/config/loader.go:141-145
Timestamp: 2025-02-09T18:43:53.902Z
Learning: In the Atmos configuration loading process, errors during individual config file loading/merging should be logged but not propagate up to break the entire process. This design choice enables resilient partial configuration loading.

Applied to files:

  • pkg/config/load.go
📚 Learning: 2025-09-08T01:25:44.958Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: The atmos toolchain has been updated to follow XDG Base Directory Specification with helper functions GetXDGCacheDir() and GetXDGTempCacheDir() in toolchain/xdg_cache.go, using XDG_CACHE_HOME when set and falling back to ~/.cache/atmos-toolchain, making it consistent with atmos core's XDG compliance.

Applied to files:

  • pkg/config/load.go
📚 Learning: 2025-09-08T01:25:44.958Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: XDG Base Directory Specification compliance implementation for atmos toolchain is complete: created toolchain/xdg_cache.go with GetXDGCacheDir() and GetXDGTempCacheDir() functions, updated toolchain/installer.go and cmd/toolchain_clean.go to use these XDG helpers, and changed all cache paths from hardcoded ~/.cache/tools-cache to XDG-compliant ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain fallback).

Applied to files:

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

Applied to files:

  • pkg/config/load.go
  • pkg/config/profiles.go
📚 Learning: 2024-10-28T01:51:30.811Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 727
File: internal/exec/terraform_clean.go:329-332
Timestamp: 2024-10-28T01:51:30.811Z
Learning: In the Atmos Go code, when deleting directories or handling file paths (e.g., in `terraform_clean.go`), always resolve the absolute path using `filepath.Abs` and use the logger `u.LogWarning` for logging messages instead of using `fmt.Printf`.

Applied to files:

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

Applied to files:

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

Applied to files:

  • pkg/config/load.go
📚 Learning: 2025-08-16T23:33:07.477Z
Learnt from: aknysh
Repo: cloudposse/atmos PR: 1405
File: internal/exec/describe_dependents_test.go:651-652
Timestamp: 2025-08-16T23:33:07.477Z
Learning: In the cloudposse/atmos Go codebase, ExecuteDescribeDependents expects a pointer to AtmosConfiguration (*schema.AtmosConfiguration), so when calling it with a value returned by cfg.InitCliConfig (which returns schema.AtmosConfiguration), the address-of operator (&) is necessary: ExecuteDescribeDependents(&atmosConfig, ...).

Applied to files:

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

Applied to files:

  • pkg/config/load.go
📚 Learning: 2025-10-02T19:17:51.630Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1504
File: pkg/profiler/profiler.go:20-31
Timestamp: 2025-10-02T19:17:51.630Z
Learning: In pkg/profiler/profiler.go, profiler-specific errors (ErrUnsupportedProfileType, ErrStartCPUProfile, ErrStartTraceProfile, ErrCreateProfileFile) must remain local and cannot be moved to errors/errors.go due to an import cycle: pkg/profiler → errors → pkg/schema → pkg/profiler. This is a valid exception to the centralized errors policy.

Applied to files:

  • pkg/config/profiles.go
  • errors/errors.go
📚 Learning: 2025-03-12T21:38:42.699Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1139
File: pkg/config/go-homedir/homedir.go:183-196
Timestamp: 2025-03-12T21:38:42.699Z
Learning: The code in pkg/config/go-homedir is a direct fork of the mitchellh/go-homedir package and was intentionally imported as-is without modifications to maintain consistency with the original source. Security concerns or other improvements may be addressed in future PRs.

Applied to files:

  • pkg/config/profiles.go
📚 Learning: 2025-09-08T01:25:44.958Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 1466
File: website/docs/cli/commands/toolchain/usage.mdx:117-121
Timestamp: 2025-09-08T01:25:44.958Z
Learning: Final XDG Base Directory Specification implementation for atmos toolchain is complete and verified: toolchain/xdg_cache.go provides GetXDGCacheDir() and GetXDGTempCacheDir() functions, all hardcoded ~/.cache/tools-cache paths have been replaced with XDG-compliant paths using ${XDG_CACHE_HOME}/atmos-toolchain (or ~/.cache/atmos-toolchain fallback), and tests have been updated to expect the new path structure.

Applied to files:

  • pkg/config/profiles.go
📚 Learning: 2024-11-22T12:38:33.132Z
Learnt from: osterman
Repo: cloudposse/atmos PR: 768
File: internal/exec/vendor_utils.go:496-513
Timestamp: 2024-11-22T12:38:33.132Z
Learning: In the Atmos project, continue to flag path traversal issues in code reviews but acknowledge when they are expected and acceptable in specific cases.

Applied to files:

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

Applied to files:

  • pkg/config/profiles.go
📚 Learning: 2025-02-19T05:50:35.853Z
Learnt from: samtholiya
Repo: cloudposse/atmos PR: 1068
File: tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden:0-0
Timestamp: 2025-02-19T05:50:35.853Z
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.

Applied to files:

  • cmd/version/show_test.go
📚 Learning: 2025-09-10T22:38:42.212Z
Learnt from: Benbentwo
Repo: cloudposse/atmos PR: 1475
File: pkg/auth/identities/aws/user.go:141-145
Timestamp: 2025-09-10T22:38:42.212Z
Learning: ErrWrappingFormat is correctly defined as "%w: %w" in the errors package and is used throughout the codebase to wrap two error types together. The usage fmt.Errorf(errUtils.ErrWrappingFormat, errUtils.ErrAuthAwsFileManagerFailed, err) is the correct pattern when both arguments are error types.

Applied to files:

  • cmd/version/show_test.go
  • errors/errors.go
🧬 Code graph analysis (7)
cmd/version/show.go (1)
errors/errors.go (1)
  • ErrInvalidFormat (137-137)
pkg/flags/flag_parser.go (1)
pkg/perf/perf.go (1)
  • Track (121-138)
cmd/version/list.go (1)
errors/errors.go (1)
  • ErrInvalidFormat (137-137)
internal/exec/cli_utils.go (2)
pkg/config/const.go (1)
  • AuthProfileFlag (149-149)
pkg/flags/global/flags.go (1)
  • Flags (30-70)
pkg/config/load.go (4)
pkg/schema/schema.go (1)
  • AtmosConfiguration (53-94)
pkg/logger/log.go (3)
  • Debug (24-26)
  • Errorf (59-61)
  • Trace (14-16)
pkg/config/imports.go (1)
  • SearchAtmosConfig (271-294)
errors/errors.go (1)
  • ErrParseFile (12-12)
pkg/config/profiles.go (6)
pkg/schema/schema.go (1)
  • AtmosConfiguration (53-94)
pkg/xdg/xdg.go (1)
  • GetXDGConfigDir (46-48)
errors/builder.go (1)
  • Build (21-23)
errors/errors.go (3)
  • ErrProfileNotFound (176-176)
  • ErrProfileDirNotExist (181-181)
  • ErrProfileDiscovery (178-178)
errors/exit_code.go (1)
  • WithExitCode (40-48)
pkg/logger/log.go (1)
  • Debug (24-26)
cmd/version/show_test.go (1)
errors/errors.go (1)
  • ErrInvalidFormat (137-137)
🪛 GitHub Actions: Website Preview Build
website/docs/cli/configuration/configuration.mdx

[error] 1-1: Docusaurus build failed due to broken links. Broken link on source page path = /cli/configuration/ linking to /cli/commands/profile.

🪛 LanguageTool
docs/prd/auth-default-settings.md

[typographical] ~5-~5: Consider using typographic quotation marks here.
Context: ...ected default identity. This solves the "multiple defaults" problem in non-interactive (CI) environ...

(EN_QUOTES)


[typographical] ~11-~11: Consider using a typographic opening quote here.
Context: ... default identities**. The use case: > "You might have a default identity based ...

(EN_QUOTES)


[typographical] ~11-~11: Consider using a typographic close quote here.
Context: ...ault identity based on a given provider." **Example - Multiple Providers, Multip...

(EN_QUOTES)


[style] ~762-~762: To form a complete sentence, be sure to include a subject.
Context: ...lect by provider vs. by identity?) - Can be added later without breaking changes...

(MISSING_IT_THERE)


[grammar] ~762-~762: Please add a punctuation mark at the end of paragraph.
Context: ... - Can be added later without breaking changes Alternative: Document pattern u...

(PUNCTUATION_PARAGRAPH_END)

🪛 markdownlint-cli2 (0.18.1)
docs/prd/auth-default-settings.md

758-758: Unordered list indentation
Expected: 0; Actual: 3

(MD007, ul-indent)


759-759: Unordered list indentation
Expected: 0; Actual: 3

(MD007, ul-indent)


760-760: Unordered list indentation
Expected: 0; Actual: 3

(MD007, ul-indent)


761-761: Unordered list indentation
Expected: 0; Actual: 3

(MD007, ul-indent)


762-762: Unordered list indentation
Expected: 0; Actual: 3

(MD007, ul-indent)

⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Acceptance Tests (windows)
  • GitHub Check: Summary
🔇 Additional comments (13)
docs/prd/auth-default-settings.md (1)

1-770: Scope concern: This PRD may belong in a separate PR.

The PR objectives state this PR is focused on adding test coverage for profile CLI commands (cmd/profile/show.go and cmd/profile/list.go) with 1,003 lines of test code. This comprehensive PRD about authentication defaults configuration appears to be a different feature than what's outlined in the PR scope.

Per prior learnings from your team, design/documentation changes are typically handled in dedicated PRs and considered out of scope when a PR has other primary objectives. I'd recommend confirming whether this PRD should be part of this test-coverage PR or opened as a companion/prerequisite PR.

tools/lintroller/rule_os_args.go (2)

41-41: Comment update looks good.

The addition of "chdir parsing" to the comment appropriately documents why the newly excluded test files need os.Args access.


47-48: Exclusions verified as correct.

Both cmd/root_helpers_test.go and cmd/root_test.go use os.Args and properly isolate it with the save/restore pattern (originalArgs := os.Args + defer restore). The exclusions follow the documented pattern and are justified.

pkg/config/profiles.go (1)

196-257: Confirm profile loading behavior across all config-loading paths.

loadProfiles is nicely wired into LoadConfig for the standard path: it uses CliConfigPath to resolve project-local locations and merges profiles left‑to‑right via loadProfileFiles. Two edge behaviors are worth double‑checking:

  1. Config loaded via --config / --config-path: LoadConfig currently returns early when AtmosConfigFilesFromArg/AtmosConfigDirsFromArg are set, before reaching this profile-loading block. Make sure loadConfigFromCLIArgs (or another helper) also invokes loadProfiles so --profile works consistently when config comes from CLI arguments.

  2. Default embedded CLI config: When no atmos.yaml is found, CliConfigPath stays empty, so project-local locations resolve relative to the current working directory (e.g. .atmos/profiles, profiles). If the intent is to treat CWD as the project root in this case, the current behavior is fine; if you’d rather align with git-root discovery, you may want to revisit this later.

Nothing needs to change here if those behaviors are intentional, but it’s worth validating against your profiles PRD and tests.

pkg/config/load.go (1)

90-114: Profile-loading hook in LoadConfig looks correct and fixes base-dir resolution.

This block cleanly loads profiles after the base config is assembled and CliConfigPath is resolved, using a temporary unmarshal solely to feed loadProfiles. Copying CliConfigPath from atmosConfig into tempConfig ensures project-local locations are resolved against the actual atmos.yaml directory instead of the process CWD, which addresses the earlier mis-join issue. The debug log is also helpful for tracing which profiles were applied.

pkg/flags/flag_parser.go (1)

212-213: LGTM!

The performance tracking addition follows the repository-wide policy. Based on learnings, defer perf.Track() is enforced on all functions via linting to maintain consistency.

cmd/version/show.go (1)

169-169: LGTM!

The error sentinel update from ErrUnsupportedOutputFormat to ErrInvalidFormat is part of the broader error refactoring effort across the codebase. The error message format and behavior remain consistent.

pkg/config/const.go (1)

147-149: LGTM!

The new AuthProfileFlag constant follows the established naming pattern and is properly documented. It's appropriately placed in the auth flags section alongside related constants.

cmd/version/list.go (1)

155-155: LGTM!

Both error sentinel updates from ErrUnsupportedOutputFormat to ErrInvalidFormat are consistent with the error refactoring effort. The changes cover both the validation path and the defensive default case in the format switch.

Also applies to: 191-191

pkg/schema/schema.go (2)

26-32: LGTM!

The new ProfilesConfig and ConfigMetadata structs are well-designed with clear documentation. Both use proper struct tags for YAML/JSON/mapstructure serialization and follow established patterns in the codebase.

Also applies to: 34-50


92-93: LGTM!

The new fields integrate cleanly into the existing schema structures. Profiles and Metadata in AtmosConfiguration support the new profiles feature, while ProfilesFromArg in ConfigAndStacksInfo provides the data flow from CLI to config processing.

Also applies to: 698-698

internal/exec/cli_utils.go (2)

75-75: LGTM!

Adding AuthProfileFlag to commonFlags ensures the profile flag is properly filtered out before passing arguments to underlying tools. This follows the established pattern for Atmos-specific flags.


120-137: LGTM!

The profile processing logic is well-implemented with proper precedence (flag before env var) and error handling. The comma-separated parsing and whitespace trimming are good touches. The nolint comment clearly explains why os.Getenv is necessary here (profiles are processed before Viper configuration loads).

aknysh and others added 6 commits November 18, 2025 00:43
The test was expecting 'unsupported' in the error message, but the
actual error uses 'invalid format'. Updated the test to match the
actual error message.

Fixes CI test failure:
  TestListCommand_FormatValidation/invalid_format
Added comprehensive documentation for the --profile flag and ATMOS_PROFILE
environment variable to the global flags reference.

Documentation includes:
- Use cases (development, CI/CD, team collaboration, multi-environment)
- Basic usage examples with flag and environment variable
- Multiple profile activation (comma-separated)
- Precedence rules (flag overrides env var)
- Profile configuration examples (inline and separate directories)
- Note about early initialization and config override capabilities

Related to #1752
Added ATMOS_PROFILE documentation to the Core Environment Variables
section in global-flags.mdx for completeness and discoverability.

The environment variable was already documented in the --profile flag
section, but adding it to the environment variables reference makes it
easier for users to find when looking specifically at environment
variable options.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fixed TestShowCommand_FormatValidation to expect "invalid" instead of
"unsupported" in error message, matching the actual error format from
errUtils.ErrInvalidFormat.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…ories

Improved error handling in loadProfileFiles to distinguish between:
- Directory doesn't exist (ErrProfileDirNotExist)
- Directory exists but isn't accessible (ErrProfileDirNotAccessible)

This makes error diagnostics clearer for users experiencing permission
issues versus missing directories, and properly uses the
ErrProfileDirNotAccessible sentinel that was previously unused.

Implements CodeRabbit suggestion from PR review.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@aknysh aknysh merged commit 10886fe into main Nov 18, 2025
58 checks passed
@aknysh aknysh deleted the atmos-profiles-design branch November 18, 2025 07:38
@mergify mergify bot removed the needs-cloudposse Needs Cloud Posse assistance label Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New features that do not break anything size/xl Extra large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants