feat: Add multi-package support and fix toolchain add help text#1979
feat: Add multi-package support and fix toolchain add help text#1979
Conversation
- Support multiple tools in single command: `atmos toolchain add terraform@1.5.0 kubectl@1.28.0` - Default to 'latest' version when version omitted: `atmos toolchain add terraform` - Fix help examples to use @ syntax instead of space-separated (e.g. `tool@version`) - Remove phantom --file flag, document global --tool-versions flag - Add comprehensive cmd-level tests for multi-package and latest default behavior - Update CLI documentation with correct syntax and examples Fixes incorrect help text that showed space-separated syntax which didn't match actual command behavior. Improves UX by supporting multiple tools in one command and defaulting to latest version like other similar CLIs. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
Warning Release Documentation RequiredThis PR is labeled
|
📝 WalkthroughWalkthroughAdds variadic multi-tool support to Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as atmos toolchain env/path
participant Emit as EmitEnv(format, relativeFlag, outputPath)
participant PathHelpers as buildPathEntries()
participant Formatter as Formatter/formatContentForFile
participant FileSys as File System / stdout
CLI->>Emit: call(format, relativeFlag, outputPath)
Emit->>PathHelpers: buildPathEntries(relativeFlag)
PathHelpers-->>Emit: []ToolPath, finalPath
Emit->>Formatter: select formatter by format
Formatter-->>Emit: formatted content
alt outputPath provided
Emit->>FileSys: append content to outputPath (appendToFile)
else github format & GITHUB_PATH set
Emit->>FileSys: append content to $GITHUB_PATH
else
Emit->>FileSys: write content to stdout
end
FileSys-->>Emit: success / error
Emit-->>CLI: return nil / error
sequenceDiagram
participant User as User
participant CLIAdd as atmos toolchain add
participant Validator as Args Validator
participant Parser as Token Parser
participant Installer as AddToolVersion
User->>CLIAdd: add tool1 tool2@1.0 tool3
CLIAdd->>Validator: ensure >= 1 arg
Validator-->>CLIAdd: ok
loop per argument
CLIAdd->>Parser: parse "tool[`@version`]"
alt version present
Parser-->>CLIAdd: tool, version
else
Parser-->>CLIAdd: tool, "" (default to "latest")
end
CLIAdd->>Installer: AddToolVersion(tool, versionOrLatest)
Installer-->>CLIAdd: success / error
alt error
CLIAdd-->>User: return wrapped error immediately
end
end
CLIAdd-->>User: success
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (4)
🧰 Additional context used📓 Path-based instructions (7)cmd/**/*.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/*.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/*_test.go📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
**/{pkg,internal,cmd}/**/*.go📄 CodeRabbit inference engine (CLAUDE.md)
Files:
cmd/**/*_test.go📄 CodeRabbit inference engine (CLAUDE.md)
Files:
website/**📄 CodeRabbit inference engine (.cursor/rules/atmos-rules.mdc)
Files:
website/docs/cli/commands/**/*.mdx📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (25)📓 Common learnings📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2025-12-10T18:32:43.260ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2026-01-04T00:55:21.720ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
📚 Learning: 2025-01-09T22:37:01.004ZApplied to files:
📚 Learning: 2025-12-13T04:37:40.435ZApplied to files:
📚 Learning: 2025-10-10T23:51:36.597ZApplied to files:
📚 Learning: 2025-09-05T14:57:37.360ZApplied to files:
📚 Learning: 2025-12-21T04:10:29.030ZApplied to files:
📚 Learning: 2025-09-08T01:25:44.958ZApplied to files:
📚 Learning: 2025-09-13T16:39:20.007ZApplied to files:
📚 Learning: 2025-09-08T01:25:44.958ZApplied to files:
📚 Learning: 2024-10-27T16:59:26.187ZApplied to files:
📚 Learning: 2025-01-19T15:49:15.593ZApplied to files:
📚 Learning: 2025-09-08T01:25:44.958ZApplied to files:
📚 Learning: 2025-02-18T13:13:11.497ZApplied to files:
📚 Learning: 2025-12-13T04:37:25.223ZApplied to files:
📚 Learning: 2025-12-13T06:10:13.688ZApplied to files:
📚 Learning: 2025-11-24T17:35:37.209ZApplied to files:
🧬 Code graph analysis (2)cmd/toolchain/add_test.go (1)
cmd/toolchain/add.go (2)
🪛 markdownlint-cli2 (0.18.1)cmd/markdown/atmos_toolchain_add.md3-3: Dollar signs used before commands without showing output (MD014, commands-show-output) 7-7: Fenced code blocks should have a language specified (MD040, fenced-code-language) 8-8: Dollar signs used before commands without showing output (MD014, commands-show-output) 12-12: Fenced code blocks should have a language specified (MD040, fenced-code-language) 13-13: Dollar signs used before commands without showing output (MD014, commands-show-output) 17-17: Fenced code blocks should have a language specified (MD040, fenced-code-language) 18-18: Dollar signs used before commands without showing output (MD014, commands-show-output) ⏰ 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)
🔇 Additional comments (8)
✏️ Tip: You can disable this entire section by setting 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. Comment |
Add native GitHub Actions support for `atmos toolchain env` with several improvements: New features: - Add `--format github` that outputs paths one per line, compatible with GitHub Actions' $GITHUB_PATH environment file - Add `--output` flag to append output to any file instead of stdout - Auto-detect $GITHUB_PATH when using github format and write to it - Show success message when writing to file Improvements: - Fix PATH not respecting user's $PATH - use os.Getenv instead of viper - Add helpful error hints when tools aren't installed: - "Run 'atmos toolchain add'" when no .tool-versions file - "Run 'atmos toolchain install'" when tools not installed - Make `toolchain path` an alias for `toolchain env` with flag mapping Technical changes: - Refactor appendToFile to reduce cyclomatic complexity - Extract format-specific content generation into helper functions - Add constants for shell escaping to satisfy magic constant linter - Update tests to use t.Setenv for proper test isolation - Add comprehensive tests for new functionality Documentation: - Update toolchain-env.mdx with github format and --output flag - Add blog post announcing GitHub Actions support - Update roadmap with GitHub Actions integration milestone Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
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. |
Add pr: 1979 to the Native GitHub Actions PATH integration milestone and add the PR to the ci-cd initiative's prs array. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update golden snapshot for toolchain --help to reflect recent changes (add description pluralized, path description includes alias note) - Fix TestConstructFinalPath to use os.PathListSeparator instead of hardcoded ':' for Windows compatibility - Fix TestAppendToFile_FishFormat to use platform-appropriate path separator since formatFishContent splits by os.PathListSeparator - Fix TestResolveDirPath to use filepath.IsAbs() instead of checking result[0] == '/' which fails on Windows drive letters (e.g., D:\) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The test expected 5 formats but supportedFormats now includes "github" (added in commit 3b6c9c1 for GitHub Actions support). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1979 +/- ##
==========================================
+ Coverage 74.97% 75.10% +0.13%
==========================================
Files 775 777 +2
Lines 71464 71636 +172
==========================================
+ Hits 53577 53804 +227
+ Misses 14402 14345 -57
- Partials 3485 3487 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Add comprehensive tests for cmd/toolchain command providers: - command_provider_test.go: Table-driven tests for all CommandProviders - get_test.go: Flag and argument validation tests - path_test.go: Flag description tests - which_test.go: Example and argument validation tests Expand toolchain/ package tests: - path_helpers_test.go: Empty PATH fallback, edge cases, cross-platform fixes - env_output_test.go: Format helper function tests Fix pre-existing lint issues: - packer.go: Convert single-case switch to if statement - packer_output.go: Fix error string capitalization Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
💥 This pull request now has conflicts. Could you fix it @osterman? 🙏 |
…lp-fix # Conflicts: # internal/exec/packer.go # internal/exec/packer_output.go
Add retry logic with exponential backoff to handle transient network issues in CI when fetching the latest release from GitHub API: - Retry up to 3 times for transient errors (timeout, abort, DNS, reset) - Use exponential backoff (1s, 2s, 4s) between retries - Log warnings when retrying to help debug CI issues Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
cmd/env/env.go (1)
23-26: Harden env output file permissions. These files may contain secrets; using 0o644 makes newly created files world-readable. Prefer 0o600 by default.🔒 Proposed change.
- defaultFileMode = 0o644 + defaultFileMode = 0o600Also applies to: 194-199
🤖 Fix all issues with AI agents
In `@cmd/version/version.go`:
- Around line 36-38: Update the comment above the versionCmd declaration to
accurately state that the command registry will automatically apply NoArgs to
any command that does not define an Args field and does not provide a
PositionalArgsBuilder, not only to parent commands with subcommands; reference
the versionCmd symbol and mention the Args and PositionalArgsBuilder concepts so
readers know where this behavior originates.
- Add DocumentIndent constant (2 spaces) for left margin on markdown content - Add Document.Indent to glamour stylesheet for visual breathing room - Add H1 Prefix/Suffix spaces for internal padding inside colored header box - Adjust word wrap width calculation to account for document indent - Update test expected values to include the 2-space indent This fixes the `atmos about` command output where: - Content started flush against the terminal edge - H1 header text touched the blue background edges Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidates duplicate ANSI manipulation functions from across the codebase into a single, reusable pkg/ansi package: - Create pkg/ansi/ansi.go with Strip, Length, and core parsing helpers - Create pkg/ansi/trim.go with TrimRight, TrimLinesRight, and related functions - Add comprehensive tests in pkg/ansi/*_test.go - Remove ~370 lines of ANSI functions from pkg/ui/formatter.go - Update cmd/root.go and cmd/help_template.go to use new package The new package distinguishes between styled content (with background color 48;2;...) and Glamour padding (foreground-only 38;2;...) to preserve intentional suffix spaces like H1 header badges " About Atmos " while trimming unnecessary padding. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add 13 edge case tests to pkg/ansi/trim_test.go covering: - Loop iteration paths in TrimRight (consecutive resets, styled space + bare ANSI) - Early return edge cases in trimTrailingStyledSpace (just reset code, non-space before reset, plain space without ANSI, malformed ANSI without m terminator) - Malformed ANSI sequences in trimTrailingBareANSI (empty string, no terminator) - Short indent edge case in TrimTrailingWhitespace (fewer spaces than indent width) Coverage improved from 93.4% to 99.3%. The remaining 0.7% is defensive dead code in TrimLeftSpaces (break skipLoop) that cannot be reached due to preconditions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Args: cobra.MaximumNArgs(1) to workflow command to allow the optional workflow name to pass through to execution logic. This fixes a regression from commit a46962d where NoArgs was auto-applied to commands without explicit Args. The workflow command needs to accept an optional workflow name (0 or 1 args) so users get helpful contextual errors like "No workflow exists" with available workflows listed, instead of generic "Unknown command X for atmos workflow" errors. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add perf.Track to Execute function in cmd/internal/executor.go - Check flag-set errors with require.NoError in cmd/toolchain/path_test.go - Clarify comment about registry-applied Args in cmd/version/version.go - Fix pre-existing lint issues in cmd/vendor.go and cmd/vendor_pull.go Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
💥 This pull request now has conflicts. Could you fix it @osterman? 🙏 |
Update golden snapshot to match new error output format after merging main with updated error handling. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update the comment above versionCmd to explain the exact conditions under which the command registry applies cobra.NoArgs automatically: - Command does not define an Args field - CommandProvider does not return a PositionalArgsBuilder Reference the specific file (cmd/internal/registry.go) and explain how this applies to versionCmd. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Merge main branch to incorporate recent changes including: - GitHub Actions PATH integration (PR #1979) - Locals YAML functions support - Toolchain improvements - Various bug fixes and enhancements Resolved conflicts in: - website/plugins/fetch-latest-release/index.js - website/src/data/roadmap.js Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
These changes were released in v1.204.1-rc.4. |
what
atmos toolchain addcommandlatestwhen omitted (e.g.,atmos toolchain add terraform)@syntax (tool@version) instead of incorrect space-separated syntax--fileflag referenceswhy
The help text was showing incorrect space-separated syntax (
<tool-name> <version>) which didn't match the actual command behavior that uses@syntax (tool@version). Users also couldn't add multiple tools efficiently. This fix aligns the UX with other similar CLIs and improves productivity for users managing toolchains.references
Related to improving the toolchain command usability and fixing the discrepancy between documented and actual command syntax.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.