Skip to content

Conversation

@aknysh
Copy link
Member

@aknysh aknysh commented Oct 19, 2025

what

  • Move format validation before GitHub API calls in atmos version list command
  • Rename text format to table in atmos version list
  • Implement fail-fast validation pattern for input parameters
  • Add tests
  • Add docs

why

  • Validation fix: The command was validating the --format parameter AFTER making GitHub API calls, causing tests to fail with GitHub rate limit errors instead of proper format validation errors
  • Format rename: The output is specifically a table format (using lipgloss/table), not generic text, so table is a more accurate name
  • Users now get instant feedback on invalid input without waiting for API calls
  • Tests are no longer flaky or dependent on external GitHub API availability

references

  • Fixes test failure in TestListCommand_FormatValidation
  • Follows the fail-fast validation pattern already used for --limit and --offset parameters
  • Improves clarity of format naming to match actual output type

Summary by CodeRabbit

  • Bug Fixes

    • Improved format validation for version list/show so unsupported formats fail fast and return clearer errors.
    • Standardized supported output formats to table, json, and yaml; default changed from text to table.
  • Tests

    • Updated tests and test labels to reflect the new default format and validation behavior.
  • Documentation

    • Added detailed docs for version list/show, updated CLI docs and links, added a version command category, and refreshed help/demo entries.

@aknysh aknysh added the patch A minor, backward compatible change label Oct 19, 2025
@aknysh aknysh requested a review from a team as a code owner October 19, 2025 23:57
@github-actions github-actions bot added the size/xs Extra small size PR label Oct 19, 2025
@aknysh aknysh self-assigned this Oct 19, 2025
@aknysh aknysh requested a review from osterman October 19, 2025 23:59
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 20, 2025

Warning

Rate limit exceeded

@aknysh has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 48 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 5a77799 and 7dded23.

📒 Files selected for processing (2)
  • cmd/version/list_test.go (2 hunks)
  • cmd/version/show_test.go (2 hunks)
📝 Walkthrough

Walkthrough

Adds early normalization and validation of the output format for the version list/show commands, switches supported formats to table, json, yaml, changes the default format to table, updates tests, and adds/adjusts CLI documentation pages and navigation targets.

Changes

Cohort / File(s) Summary
CLI commands
cmd/version/list.go, cmd/version/show.go
Normalize --format to lowercase early, validate against supported formats (table, json, yaml) and return on unsupported values; change default format flag from "text" to "table" and update help/error text.
Tests
cmd/version/list_test.go, cmd/version/show_test.go
Update test names/inputs and defaults to use "table" instead of "text".
Documentation & site structure
website/docs/cli/commands/version/usage.mdx, website/docs/cli/commands/version/list.mdx, website/docs/cli/commands/version/show.mdx, website/docs/cli/commands/version/_category_.json, website/docs/cli/cli.mdx, website/docs/cli/commands/help.mdx, website/docs/cheatsheets/commands.mdx, website/docs/cli/global-flags.mdx
Add new version command docs (list, show, usage), add category file, update internal links to /cli/commands/version/usage, render Subcommands via DocCardList, and add version help lines to demo screengrabs.
Demo
demo/screengrabs/demo-stacks.txt
Add help lines for atmos version, atmos version list, and atmos version show.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI as "atmos version list/show"
    participant Validator as "Format Validator"
    participant Parser as "Date Parser"
    participant Fetcher as "Version Fetcher"
    participant Formatter as "Output Formatter"

    User->>CLI: run command with `--format`
    CLI->>Validator: normalize & validate format
    alt invalid format
        Validator-->>CLI: unsupported format error
        CLI-->>User: print error & exit
    else valid format
        Validator-->>CLI: ok
        CLI->>Parser: parse date flags
        Parser-->>CLI: parsed dates
        CLI->>Fetcher: fetch versions
        Fetcher-->>CLI: return versions
        CLI->>Formatter: format output (table/json/yaml)
        Formatter-->>User: render output
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

major

Suggested reviewers

  • osterman

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Update atmos version list command. Add docs" directly refers to real, significant changes present in the changeset. It identifies the specific command being updated (not a vague term) and mentions the documentation additions. The primary objective of the PR centers on fixing and improving the list command by moving format validation before API calls and renaming the "text" format to "table," which the title appropriately captures at a high level. While the changeset also includes related updates to the show command and multiple documentation files, the title effectively summarizes the main focal point without claiming to cover every detail.

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 (1)
cmd/version/list.go (1)

183-191: Efficient reuse of normalized format.

Switching on normalizedFormat avoids redundant strings.ToLower() calls. The default case (lines 190-191) is now unreachable since validation happens upfront, but keeping it as defensive code is fine.

If you prefer to remove dead code, you could drop the default case entirely:

 	switch normalizedFormat {
 	case "text":
 		return formatReleaseListText(releases)
 	case "json":
 		return formatReleaseListJSON(releases)
 	case "yaml":
 		return formatReleaseListYAML(releases)
-	default:
-		return fmt.Errorf("%w: %s (supported: text, json, yaml)", errUtils.ErrUnsupportedOutputFormat, listFormat)
 	}

But keeping it doesn't hurt.

📜 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 95432ea and a760e06.

📒 Files selected for processing (1)
  • cmd/version/list.go (2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
cmd/**/*.go

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

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

cmd/**/*.go: Follow Cobra command pattern: one command per file; load examples via //go:embed and render via utils.PrintfMarkdown in RunE.
Telemetry for new commands is automatic via RootCmd.ExecuteC(); for non-standard paths use telemetry.CaptureCmd or telemetry.CaptureCmdString.

Files:

  • cmd/version/list.go
**/*.go

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

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

**/*.go: All comments must end with periods; enforced by golangci-lint godot across all Go comments.
Organize imports into three groups (stdlib, third-party, Atmos) separated by blank lines and sorted alphabetically within each group; keep existing aliases.
All errors must be wrapped using static errors defined in errors/errors.go; prefer errors.Join for multiple, fmt.Errorf with %w for context, and errors.Is for checks; never rely on string comparisons.
Prefer cross-platform implementations: use SDKs over external binaries; use filepath/os facilities; gate OS-specific logic with runtime.GOOS or build tags.

Files:

  • cmd/version/list.go
**/!(*_test).go

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

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

Files:

  • cmd/version/list.go
{cmd,internal,pkg}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

{cmd,internal,pkg}/**/*.go: Add defer perf.Track() to all public functions and critical private ones, include a blank line after it, and use package-qualified names (e.g., "exec.ProcessComponent"). Use atmosConfig if available, else nil.
Always bind environment variables with viper.BindEnv; every var must have an ATMOS_ alternative and prefer ATMOS_ over external names.
Distinguish structured logging from UI output: UI prompts/errors/status to stderr; data/results to stdout; logging for system/debug only; no UI via logging.
Most text UI must go to stderr (via utils.PrintfMessageToTUI or fmt.Fprintf(os.Stderr,...)); only data/results to stdout.

Files:

  • cmd/version/list.go
{pkg,internal,cmd}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Always use mockgen for interface mocks; never write manual mocks with many stub methods.

Files:

  • cmd/version/list.go
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Target minimum 80% coverage on new/changed lines; exclude mock files from coverage: **/mock_.go, mock_.go, **/mock/*.go.

Files:

  • cmd/version/list.go
🧬 Code graph analysis (1)
cmd/version/list.go (1)
errors/errors.go (1)
  • ErrUnsupportedOutputFormat (49-49)
⏰ 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). (7)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary
🔇 Additional comments (1)
cmd/version/list.go (1)

152-156: Solid fail-fast validation!

This achieves exactly what the PR set out to do—validating format before hitting GitHub's API. The early return prevents unnecessary network calls and gives users immediate feedback. Nice alignment with the limit/offset validation pattern above.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 20, 2025
@codecov
Copy link

codecov bot commented Oct 20, 2025

Codecov Report

❌ Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.30%. Comparing base (95432ea) to head (7dded23).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/version/show.go 33.33% 2 Missing ⚠️
cmd/version/list.go 87.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1672      +/-   ##
==========================================
- Coverage   66.30%   66.30%   -0.01%     
==========================================
  Files         350      350              
  Lines       39670    39674       +4     
==========================================
  Hits        26305    26305              
- Misses      11360    11364       +4     
  Partials     2005     2005              
Flag Coverage Δ
unittests 66.30% <72.72%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
cmd/version/list.go 66.37% <87.50%> (-0.59%) ⬇️
cmd/version/show.go 46.15% <33.33%> (ø)

... and 3 files with indirect coverage changes

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

- Update format validation in both list and show commands
- Change default format value from 'text' to 'table'
- Update all tests to expect 'table' format
- Update flag descriptions to reflect new format name

This change improves clarity as the output is specifically
a table format, not generic text.

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

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added size/s Small size PR and removed size/xs Extra small size PR labels Oct 20, 2025
@aknysh aknysh requested a review from osterman October 20, 2025 00:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
cmd/version/list.go (1)

183-192: Prior feedback to use “table” instead of “text” is addressed. Nice.

This resolves the earlier review thread about naming.

Also applies to: 201-201

🧹 Nitpick comments (6)
cmd/version/show.go (2)

157-170: Switch to “table” looks good; add fail-fast validation before GitHub calls.

Behavior matches list.go. To avoid unnecessary API/spinner work on invalid formats, validate/normalize up-front and switch on the normalized value.

Suggested change:

   RunE: func(cmd *cobra.Command, args []string) error {
     defer perf.Track(atmosConfigPtr, "version.show.RunE")()

     // Default to latest if no version specified.
     versionArg := "latest"
     if len(args) > 0 {
       versionArg = args[0]
     }

+    // Validate/normalize format early (fail-fast).
+    normalizedFormat := strings.ToLower(showFormat)
+    if normalizedFormat != "table" && normalizedFormat != "json" && normalizedFormat != "yaml" {
+      return fmt.Errorf("%w: %s (supported: table, json, yaml)", errUtils.ErrUnsupportedOutputFormat, showFormat)
+    }
+
     // Create GitHub client.
     client := &RealGitHubClient{}

     // Fetch release (with or without spinner depending on TTY).
     release, err := fetchReleaseWithSpinner(client, versionArg)
     if err != nil {
       return err
     }

     // Format output.
-    switch strings.ToLower(showFormat) {
+    switch normalizedFormat {
     case "table":
       if err := formatReleaseDetailText(release); err != nil {
         return err
       }
       return nil
     case "json":
       return formatReleaseDetailJSON(release)
     case "yaml":
       return formatReleaseDetailYAML(release)
     default:
       return fmt.Errorf("%w: %s (supported: table, json, yaml)", errUtils.ErrUnsupportedOutputFormat, showFormat)
     }
   },

175-176: Default “table” is consistent; bind flag/env via Viper for config parity.

Bind the flag and ATMOS_ env to follow CLI config conventions.

 import (
   _ "embed"
   "fmt"
   "os"
   "strings"

   "github.com/charmbracelet/bubbles/spinner"
   tea "github.com/charmbracelet/bubbletea"
   "github.com/google/go-github/v59/github"
   "github.com/mattn/go-isatty"
   "github.com/spf13/cobra"
+  "github.com/spf13/viper"

   errUtils "github.com/cloudposse/atmos/errors"
   "github.com/cloudposse/atmos/pkg/perf"
 )
@@
 func init() {
   showCmd.Flags().StringVar(&showFormat, "format", "table", "Output format: table, json, yaml")
+  _ = viper.BindEnv("version.show.format", "ATMOS_VERSION_SHOW_FORMAT")
+  _ = viper.BindPFlag("version.show.format", showCmd.Flags().Lookup("format"))
   versionCmd.AddCommand(showCmd)
 }
cmd/version/show_test.go (1)

16-16: Flag default assertion updated to “table” — LGTM.

Once show adds early format validation, mirror list’s format-validation test cases here.

cmd/version/list.go (2)

152-157: Great fail-fast validation and normalization.

This fixes flakiness and aligns with other flag validations. To avoid duplication with show.go, consider a small helper:

func normalizeAndValidateFormat(s string) (string, error) {
  f := strings.ToLower(s)
  switch f {
  case "table", "json", "yaml":
    return f, nil
  default:
    return "", fmt.Errorf("%w: %s (supported: table, json, yaml)", errUtils.ErrUnsupportedOutputFormat, s)
  }
}

Then call it here and in show.RunE.


201-201: Default “table” is consistent; bind flag/env with Viper to honor config precedence.

Add Viper bindings so users can set ATMOS_VERSION_LIST_FORMAT or config files.

 import (
   _ "embed"
   "fmt"
   "os"
   "strings"
   "time"

   "github.com/charmbracelet/bubbles/spinner"
   tea "github.com/charmbracelet/bubbletea"
   "github.com/google/go-github/v59/github"
   "github.com/mattn/go-isatty"
   "github.com/spf13/cobra"
+  "github.com/spf13/viper"

   errUtils "github.com/cloudposse/atmos/errors"
   "github.com/cloudposse/atmos/pkg/perf"
 )
@@
 func init() {
   listCmd.Flags().IntVar(&listLimit, "limit", listDefaultLimit, "Maximum number of releases to display (1-100)")
   listCmd.Flags().IntVar(&listOffset, "offset", 0, "Number of releases to skip")
   listCmd.Flags().StringVar(&listSince, "since", "", "Only show releases published after this date (ISO 8601 format: YYYY-MM-DD)")
   listCmd.Flags().BoolVar(&listIncludePrereleases, "include-prereleases", false, "Include pre-release versions")
   listCmd.Flags().StringVar(&listFormat, "format", "table", "Output format: table, json, yaml")
+  _ = viper.BindEnv("version.list.format", "ATMOS_VERSION_LIST_FORMAT")
+  _ = viper.BindPFlag("version.list.format", listCmd.Flags().Lookup("format"))

   versionCmd.AddCommand(listCmd)
 }
cmd/version/list_test.go (1)

340-342: Updated test case to “valid format table” — LGTM.

Optional: consider a command-level GitHub client factory you can override in tests to avoid any network when exercising RunE.

📜 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 a760e06 and 5901601.

📒 Files selected for processing (4)
  • cmd/version/list.go (3 hunks)
  • cmd/version/list_test.go (1 hunks)
  • cmd/version/show.go (2 hunks)
  • cmd/version/show_test.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
cmd/**/*.go

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

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

cmd/**/*.go: Follow Cobra command pattern: one command per file; load examples via //go:embed and render via utils.PrintfMarkdown in RunE.
Telemetry for new commands is automatic via RootCmd.ExecuteC(); for non-standard paths use telemetry.CaptureCmd or telemetry.CaptureCmdString.

Files:

  • cmd/version/show.go
  • cmd/version/list.go
  • cmd/version/list_test.go
  • cmd/version/show_test.go
**/*.go

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

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

**/*.go: All comments must end with periods; enforced by golangci-lint godot across all Go comments.
Organize imports into three groups (stdlib, third-party, Atmos) separated by blank lines and sorted alphabetically within each group; keep existing aliases.
All errors must be wrapped using static errors defined in errors/errors.go; prefer errors.Join for multiple, fmt.Errorf with %w for context, and errors.Is for checks; never rely on string comparisons.
Prefer cross-platform implementations: use SDKs over external binaries; use filepath/os facilities; gate OS-specific logic with runtime.GOOS or build tags.

Files:

  • cmd/version/show.go
  • cmd/version/list.go
  • cmd/version/list_test.go
  • cmd/version/show_test.go
**/!(*_test).go

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

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

Files:

  • cmd/version/show.go
  • cmd/version/list.go
{cmd,internal,pkg}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

{cmd,internal,pkg}/**/*.go: Add defer perf.Track() to all public functions and critical private ones, include a blank line after it, and use package-qualified names (e.g., "exec.ProcessComponent"). Use atmosConfig if available, else nil.
Always bind environment variables with viper.BindEnv; every var must have an ATMOS_ alternative and prefer ATMOS_ over external names.
Distinguish structured logging from UI output: UI prompts/errors/status to stderr; data/results to stdout; logging for system/debug only; no UI via logging.
Most text UI must go to stderr (via utils.PrintfMessageToTUI or fmt.Fprintf(os.Stderr,...)); only data/results to stdout.

Files:

  • cmd/version/show.go
  • cmd/version/list.go
  • cmd/version/list_test.go
  • cmd/version/show_test.go
{pkg,internal,cmd}/**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

Always use mockgen for interface mocks; never write manual mocks with many stub methods.

Files:

  • cmd/version/show.go
  • cmd/version/list.go
  • cmd/version/list_test.go
  • cmd/version/show_test.go
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Target minimum 80% coverage on new/changed lines; exclude mock files from coverage: **/mock_.go, mock_.go, **/mock/*.go.

Files:

  • cmd/version/show.go
  • cmd/version/list.go
  • cmd/version/list_test.go
  • cmd/version/show_test.go
**/*_test.go

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

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

**/*_test.go: Unit tests should be table-driven where appropriate and focus on pure functions; target >80% coverage with emphasis on pkg/ and internal/exec/.
Test behavior, not implementation; avoid tautological or stub-only tests; use dependency injection to make code testable; remove always-skipped tests; table-driven tests must use realistic scenarios.
Place //go:generate mockgen directives for mocks at the top of test files; for internal interfaces use -source=$GOFILE -destination=mock_$GOFILE -package=$GOPACKAGE.
Tests must call production code paths (do not duplicate production logic within tests).
Always use t.Skipf with a reason (never t.Skip or Skipf without context).
Test files should mirror implementation structure and be co-located with source files (foo.go ↔ foo_test.go).
Use precondition-based test skipping helpers from tests/test_preconditions.go (e.g., RequireAWSProfile, RequireGitHubAccess).

Files:

  • cmd/version/list_test.go
  • cmd/version/show_test.go
cmd/**/*_test.go

📄 CodeRabbit inference engine (CLAUDE.md)

cmd/**/*_test.go: Always use cmd.NewTestKit(t) in ALL cmd package tests, including subtests, to snapshot and restore RootCmd state.
Command tests live under cmd/ and must use temporary binaries when needed; TestMain must call os.Exit(m.Run()) to propagate exit code.

Files:

  • cmd/version/list_test.go
  • cmd/version/show_test.go
🧬 Code graph analysis (2)
cmd/version/show.go (1)
errors/errors.go (1)
  • ErrUnsupportedOutputFormat (49-49)
cmd/version/list.go (1)
errors/errors.go (1)
  • ErrUnsupportedOutputFormat (49-49)
⏰ 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). (4)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Analyze (go)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary
🔇 Additional comments (1)
cmd/version/list.go (1)

183-192: Switching on normalizedFormat is correct and consistent.

This prevents case-sensitivity pitfalls and keeps error paths clean.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 20, 2025
osterman
osterman previously approved these changes Oct 20, 2025
@osterman
Copy link
Member

Update the docs

- Create version/ subdirectory following Atmos documentation structure
- Add usage.mdx as the main version command landing page
- Add list.mdx with full documentation for `atmos version list`
- Add show.mdx with full documentation for `atmos version show`
- Update all broken links to point to new documentation location
- Remove old version.mdx file

Documentation includes:
- Usage examples and syntax
- Flag descriptions using definition lists
- GitHub API rate limit information
- Feature highlights
- Use cases and examples

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

Co-Authored-By: Claude <noreply@anthropic.com>
@aknysh aknysh dismissed stale reviews from osterman and coderabbitai[bot] via 0fc3e0a October 20, 2025 01:22
@github-actions github-actions bot added size/m Medium size PR and removed size/s Small size PR labels Oct 20, 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)
website/docs/cli/commands/version/list.mdx (1)

127-127: Consider rephrasing passive voice for style consistency.

Line 127 uses passive voice: "No special scopes are needed for accessing public repositories." You could rephrase as "No special scopes are required" or "You need no special scopes" for a more active tone.

website/docs/cli/commands/version/show.mdx (1)

104-104: Consider rephrasing passive voice for style consistency.

Line 104 uses passive voice: "No special scopes are needed for accessing public repositories." You could rephrase as "No special scopes are required" or "You need no special scopes" for a more active tone. (Same note applies to list.mdx line 127.)

📜 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 5901601 and 0fc3e0a.

📒 Files selected for processing (8)
  • website/docs/cheatsheets/commands.mdx (1 hunks)
  • website/docs/cli/cli.mdx (1 hunks)
  • website/docs/cli/commands/help.mdx (1 hunks)
  • website/docs/cli/commands/version/_category_.json (1 hunks)
  • website/docs/cli/commands/version/list.mdx (1 hunks)
  • website/docs/cli/commands/version/show.mdx (1 hunks)
  • website/docs/cli/commands/version/usage.mdx (2 hunks)
  • website/docs/cli/global-flags.mdx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • website/docs/cli/commands/help.mdx
  • website/docs/cli/global-flags.mdx
🧰 Additional context used
📓 Path-based instructions (3)
website/**

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

website/**: Update website documentation in website/ when adding features
Ensure consistency between CLI help text and website documentation
Follow the website's documentation structure and style
Keep website code in website/ and follow its architecture/style; test changes locally
Keep CLI and website documentation in sync; document new features with examples and use cases

Always build the website (cd website && npm run build) after modifying docs, images, sidebars, or site components to catch broken links/formatting.

Files:

  • website/docs/cli/cli.mdx
  • website/docs/cli/commands/version/_category_.json
  • website/docs/cli/commands/version/usage.mdx
  • website/docs/cheatsheets/commands.mdx
  • website/docs/cli/commands/version/list.mdx
  • website/docs/cli/commands/version/show.mdx
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Target minimum 80% coverage on new/changed lines; exclude mock files from coverage: **/mock_.go, mock_.go, **/mock/*.go.

Files:

  • website/docs/cli/cli.mdx
  • website/docs/cli/commands/version/_category_.json
  • website/docs/cli/commands/version/usage.mdx
  • website/docs/cheatsheets/commands.mdx
  • website/docs/cli/commands/version/list.mdx
  • website/docs/cli/commands/version/show.mdx
website/docs/cli/commands/**/**/*.mdx

📄 CodeRabbit inference engine (CLAUDE.md)

All new commands/flags/parameters must be documented in Docusaurus MDX under website/docs/cli/commands//.mdx using definition lists (

) for arguments and flags and the provided frontmatter/template.

Files:

  • website/docs/cli/commands/version/usage.mdx
  • website/docs/cli/commands/version/list.mdx
  • website/docs/cli/commands/version/show.mdx
🧠 Learnings (4)
📚 Learning: 2025-10-14T01:54:48.410Z
Learnt from: osterman
PR: cloudposse/atmos#1498
File: website/src/components/Screengrabs/atmos-completion--help.html:2-7
Timestamp: 2025-10-14T01:54:48.410Z
Learning: Screengrab HTML files in website/src/components/Screengrabs/ are generated from actual Atmos CLI output converted to HTML. The ANSI-art headers and formatting in these files are intentional and reflect the real CLI user experience, so they should not be suggested for removal or modification.

Applied to files:

  • website/docs/cli/commands/version/usage.mdx
📚 Learning: 2025-10-19T22:59:32.304Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.304Z
Learning: Applies to cmd/markdown/*_usage.md : Store CLI example usage in embedded markdown files named atmos_<command>_<subcommand>_usage.md.

Applied to files:

  • website/docs/cheatsheets/commands.mdx
📚 Learning: 2024-10-27T16:59:26.187Z
Learnt from: osterman
PR: cloudposse/atmos#729
File: internal/exec/help.go:48-51
Timestamp: 2024-10-27T16:59:26.187Z
Learning: In the Atmos CLI help messages, when providing examples that include the version number, use the actual version variable (e.g., `version.Version`) instead of placeholders like `<version>`.

Applied to files:

  • website/docs/cheatsheets/commands.mdx
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
PR: cloudposse/atmos#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/commands/version/list.mdx
🪛 LanguageTool
website/docs/cli/commands/version/list.mdx

[style] ~127-~127: To elevate your writing, try using a synonym like ‘required’ here. Or, to avoid using the passive voice, try replacing the past participle ‘needed’ with an adjective.
Context: ...xxxxxxxxxxx" ``` No special scopes are needed for accessing public repositories. ## ...

(IS_NEEDED_NECESSARY)

website/docs/cli/commands/version/show.mdx

[style] ~104-~104: To elevate your writing, try using a synonym like ‘required’ here. Or, to avoid using the passive voice, try replacing the past participle ‘needed’ with an adjective.
Context: ...xxxxxxxxxxx" ``` No special scopes are needed for accessing public repositories. ## ...

(IS_NEEDED_NECESSARY)

⏰ 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). (6)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Build (macos-latest, macos)
  • GitHub Check: Analyze (go)
  • GitHub Check: website-deploy-preview
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary
🔇 Additional comments (9)
website/docs/cli/cli.mdx (1)

27-27: Link target updated to new version usage page.

The link correctly points to the new documentation structure where the version command usage is the entry point to subcommands.

website/docs/cheatsheets/commands.mdx (1)

34-34: Consistent link update across cheatsheet.

The Card url matches the link update in cli.mdx, maintaining consistency in the documentation navigation structure.

website/docs/cli/commands/version/usage.mdx (2)

9-9: DocCardList import properly added.

The import enables automatic rendering of subcommand cards in the Subcommands section, connecting to list and show pages.


81-84: Subcommands section properly structured.

The DocCardList component will automatically render navigation cards for the list and show subcommands, enabling easy discovery.

website/docs/cli/commands/version/_category_.json (1)

1-11: Category configuration properly defined.

The JSON structure correctly creates a collapsible version command category with the usage page as the entry point, enabling the sidebar to render subcommands under a parent category.

website/docs/cli/commands/version/list.mdx (2)

1-80: Comprehensive documentation for version list command.

The page covers usage, examples, flags, and features clearly. The format options (table, json, yaml) and pagination examples are practical and well-organized.


15-15: Verify screengrab slug exists.

The Screengrab component references slug "atmos-version-list--help". Ensure the corresponding HTML file exists at website/src/components/Screengrabs/atmos-version-list--help.html.

website/docs/cli/commands/version/show.mdx (2)

1-103: Comprehensive documentation for version show command.

The page well documents the show command with clear argument descriptions, examples, and format options. Structure mirrors list.mdx effectively.


15-15: Verify screengrab slug exists.

The Screengrab component references slug "atmos-version-show--help". Ensure the corresponding HTML file exists at website/src/components/Screengrabs/atmos-version-show--help.html.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 20, 2025
- Fix unclosed <dd> tag by keeping content on single line
- Resolves MDX compilation error

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

Co-Authored-By: Claude <noreply@anthropic.com>
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 (1)
website/docs/cli/commands/version/show.mdx (1)

88-105: Consider tightening passive voice in rate limits section.

Minor writing suggestion (optional): Line 105 uses passive voice ("are needed"). Consider rephrasing to active voice for clarity: "No special scopes are required" or "You don't need special scopes to access public repositories."

📜 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 0fc3e0a and ea79b11.

📒 Files selected for processing (2)
  • website/docs/cli/commands/version/show.mdx (1 hunks)
  • website/docs/cli/commands/version/usage.mdx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
website/**

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

website/**: Update website documentation in website/ when adding features
Ensure consistency between CLI help text and website documentation
Follow the website's documentation structure and style
Keep website code in website/ and follow its architecture/style; test changes locally
Keep CLI and website documentation in sync; document new features with examples and use cases

Always build the website (cd website && npm run build) after modifying docs, images, sidebars, or site components to catch broken links/formatting.

Files:

  • website/docs/cli/commands/version/usage.mdx
  • website/docs/cli/commands/version/show.mdx
website/docs/cli/commands/**/**/*.mdx

📄 CodeRabbit inference engine (CLAUDE.md)

All new commands/flags/parameters must be documented in Docusaurus MDX under website/docs/cli/commands//.mdx using definition lists (

) for arguments and flags and the provided frontmatter/template.

Files:

  • website/docs/cli/commands/version/usage.mdx
  • website/docs/cli/commands/version/show.mdx
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Target minimum 80% coverage on new/changed lines; exclude mock files from coverage: **/mock_.go, mock_.go, **/mock/*.go.

Files:

  • website/docs/cli/commands/version/usage.mdx
  • website/docs/cli/commands/version/show.mdx
🧠 Learnings (2)
📚 Learning: 2025-10-19T22:59:32.304Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-19T22:59:32.304Z
Learning: Applies to website/docs/cli/commands/**/**/*.mdx : All new commands/flags/parameters must be documented in Docusaurus MDX under website/docs/cli/commands/<command>/<subcommand>.mdx using definition lists (<dl>) for arguments and flags and the provided frontmatter/template.

Applied to files:

  • website/docs/cli/commands/version/usage.mdx
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
PR: cloudposse/atmos#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/commands/version/usage.mdx
🪛 LanguageTool
website/docs/cli/commands/version/show.mdx

[style] ~105-~105: To elevate your writing, try using a synonym like ‘required’ here. Or, to avoid using the passive voice, try replacing the past participle ‘needed’ with an adjective.
Context: ...xxxxxxxxxxx" ``` No special scopes are needed for accessing public repositories. ## ...

(IS_NEEDED_NECESSARY)

⏰ 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). (5)
  • GitHub Check: Run pre-commit hooks
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (go)
  • GitHub Check: website-deploy-preview
  • GitHub Check: Summary
🔇 Additional comments (4)
website/docs/cli/commands/version/usage.mdx (2)

81-83: Good structure with subcommand aggregation.

The new "Subcommands" section with DocCardList properly delegates to dedicated documentation pages for list and show subcommands. This keeps the main version page clean and maintainable.

After merging, run cd website && npm run build to verify no broken links or formatting issues in the docs site.


68-69: The documentation is accurate—no changes needed.

The base atmos version command and the atmos version show subcommand support different formats. Verification of the implementation confirms:

  • Base command (atmos version): supports only json and yaml formats (internal/exec/version.go line 148-155)
  • Subcommand (atmos version show): supports table, json, and yaml formats

The usage.mdx documentation correctly reflects the base command's capabilities, and show.mdx correctly reflects the show subcommand's capabilities. These are separate commands with separate format support, so the documentation is appropriately different and accurate.

Likely an incorrect or invalid review comment.

website/docs/cli/commands/version/show.mdx (2)

1-78: Well-structured documentation for version show subcommand.

The new documentation page is comprehensive and properly formatted. Good coverage of arguments, examples, flags, rate limits, and use cases. The format flag correctly documents the updated formats (table, json, yaml) with table as default, which aligns with the PR objectives.


1-139: Manual build verification still required.

The structural analysis looks good—components exist, imports are valid, MDX syntax is clean, and sidebar auto-discovery will pick up the new file. However, the sandbox can't run the full npm install && npm run build pipeline.

Per the coding guidelines, please build locally to catch any edge cases:

cd website && npm run build

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 20, 2025
…eengrabs

- Add note that ATMOS_GITHUB_TOKEN takes precedence over GITHUB_TOKEN
- Update both list.mdx and show.mdx documentation files
- Add version --help, version list --help, version show --help to demo-stacks.txt

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

Co-Authored-By: Claude <noreply@anthropic.com>
@aknysh aknysh changed the title Fix atmos version list Update atmos version list Oct 20, 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)
website/docs/cli/commands/version/list.mdx (1)

109-109: Consider rewording passive voice for clarity. Lines 109 and 131 use "No special scopes are needed" which reads as passive. Try "Special scopes aren't required" or "You don't need special scopes" for more active phrasing and better readability.

Also applies to: 131-131

website/docs/cli/commands/version/show.mdx (1)

73-109: Format defaults and supported values match PR objectives. Documentation accurately reflects the switch to table as default and the supported formats (table, json, yaml). Examples clearly show both version argument variations and all output formats.

One style note at line 109: same as in list.mdx, "No special scopes are needed" could use more active phrasing like "Special scopes aren't required."

📜 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 ea79b11 and 5a77799.

📒 Files selected for processing (3)
  • demo/screengrabs/demo-stacks.txt (1 hunks)
  • website/docs/cli/commands/version/list.mdx (1 hunks)
  • website/docs/cli/commands/version/show.mdx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*

📄 CodeRabbit inference engine (CLAUDE.md)

Target minimum 80% coverage on new/changed lines; exclude mock files from coverage: **/mock_.go, mock_.go, **/mock/*.go.

Files:

  • demo/screengrabs/demo-stacks.txt
  • website/docs/cli/commands/version/list.mdx
  • website/docs/cli/commands/version/show.mdx
website/**

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

website/**: Update website documentation in website/ when adding features
Ensure consistency between CLI help text and website documentation
Follow the website's documentation structure and style
Keep website code in website/ and follow its architecture/style; test changes locally
Keep CLI and website documentation in sync; document new features with examples and use cases

Always build the website (cd website && npm run build) after modifying docs, images, sidebars, or site components to catch broken links/formatting.

Files:

  • website/docs/cli/commands/version/list.mdx
  • website/docs/cli/commands/version/show.mdx
website/docs/cli/commands/**/**/*.mdx

📄 CodeRabbit inference engine (CLAUDE.md)

All new commands/flags/parameters must be documented in Docusaurus MDX under website/docs/cli/commands//.mdx using definition lists (

) for arguments and flags and the provided frontmatter/template.

Files:

  • website/docs/cli/commands/version/list.mdx
  • website/docs/cli/commands/version/show.mdx
🧠 Learnings (2)
📚 Learning: 2025-01-19T15:49:15.593Z
Learnt from: samtholiya
PR: cloudposse/atmos#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:

  • demo/screengrabs/demo-stacks.txt
📚 Learning: 2025-09-13T16:39:20.007Z
Learnt from: samtholiya
PR: cloudposse/atmos#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/commands/version/list.mdx
🪛 LanguageTool
website/docs/cli/commands/version/list.mdx

[style] ~131-~131: To elevate your writing, try using a synonym like ‘required’ here. Or, to avoid using the passive voice, try replacing the past participle ‘needed’ with an adjective.
Context: ...THUB_TOKEN`. ::: No special scopes are needed for accessing public repositories. ## ...

(IS_NEEDED_NECESSARY)

website/docs/cli/commands/version/show.mdx

[style] ~109-~109: To elevate your writing, try using a synonym like ‘required’ here. Or, to avoid using the passive voice, try replacing the past participle ‘needed’ with an adjective.
Context: ...THUB_TOKEN`. ::: No special scopes are needed for accessing public repositories. ## ...

(IS_NEEDED_NECESSARY)

⏰ 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). (6)
  • GitHub Check: Build (macos-latest, macos)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Analyze (go)
  • GitHub Check: website-deploy-preview
  • GitHub Check: Summary
🔇 Additional comments (2)
demo/screengrabs/demo-stacks.txt (1)

53-55: Good. These additions align with the version command refactoring and are necessary to document the new help topics in the demo flow.

website/docs/cli/commands/version/list.mdx (1)

1-98: Format validation and defaults align with PR objectives. The documentation correctly reflects the format validation moved before API calls and the table default (renamed from text). Examples are comprehensive and cover pagination, filtering, and all supported formats. Definition list structure for flags follows doc conventions.

coderabbitai[bot]
coderabbitai bot previously approved these changes Oct 20, 2025
@aknysh aknysh changed the title Update atmos version list Update atmos version list command. Add docs Oct 20, 2025
- Add comprehensive format validation tests for show command
- Test all three valid formats (table, json, yaml) and invalid format
- Improve list command test to properly assert errors
- Increase test coverage from 72.73% to 77.0%

Coverage improvements:
- show.go: Added tests for all format switch cases
- list.go: Added proper error assertions for invalid format

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

Co-Authored-By: Claude <noreply@anthropic.com>
@aknysh aknysh merged commit d2dd4a0 into main Oct 20, 2025
54 checks passed
@aknysh aknysh deleted the fix-version-list branch October 20, 2025 02:10
@github-actions
Copy link

These changes were released in v1.195.0.

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

Labels

patch A minor, backward compatible change size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants