Conversation
…uce package types
… package handling
We need a fallback for headless terminals. This is probably handled by charmbracelet as well. We might just not be using it. |
📝 Walkthrough📝 WalkthroughWalkthroughThis pull request introduces a comprehensive enhancement to the Atmos vendoring system, focusing on improving the Changes
Assessment against linked issues
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🧰 Additional context used📓 Learnings (2)📓 Common learningsexamples/quick-start-advanced/Dockerfile (2)🔇 Additional comments (2)examples/quick-start-advanced/Dockerfile (1)
The update of website/docs/integrations/atlantis.mdx (1)
The Atmos version update in the GitHub Actions example maintains consistency with the version specified in the Dockerfile. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Outside diff range and nitpick comments (9)
internal/exec/vendor_model.go (1)
148-148: Add missing space in completion messageThere's a missing space after the period in the string "Vendored %d components.Failed to vendor %d components.\n", which causes the message to read incorrectly. Adding a space will improve readability.
Apply this diff to fix the formatting:
return doneStyle.Render(fmt.Sprintf("Vendored %d components.Failed to vendor %d components.\n", n-m.failedPkg, m.failedPkg)) +return doneStyle.Render(fmt.Sprintf("Vendored %d components. Failed to vendor %d components.\n", n-m.failedPkg, m.failedPkg))internal/exec/vendor_model_component.go (5)
23-34: ExportpkgComponentVendorstructIf there's a possibility of using
pkgComponentVendoroutside this package in the future, consider exporting it by capitalizing the struct name. Adding comments to structs and fields will also enhance code readability.
135-137: Add missing space in status messageThere's a missing space after the period in the status message. This will improve the readability of the output.
-return doneStyle.Render(fmt.Sprintf("Vendored %d components.Failed to vendor %d components.\n", n-m.failedPkg, m.failedPkg)) +return doneStyle.Render(fmt.Sprintf("Vendored %d components. Failed to vendor %d components.\n", n-m.failedPkg, m.failedPkg))
166-199: Refactor to eliminate duplicate code indownloadComponentAndInstallThe function
downloadComponentAndInstallcontains similar code blocks for handling components and mixins. Refactoring can reduce duplication and simplify maintenance.Here's a possible refactor:
func downloadComponentAndInstall(p pkgComponentVendor, dryRun bool, cliConfig schema.CliConfiguration) tea.Cmd { return func() tea.Msg { if dryRun { time.Sleep(100 * time.Millisecond) return installedPkgMsg{ err: nil, name: p.name, } } - if p.IsComponent { - err := installComponent(p, cliConfig) - if err != nil { - return installedPkgMsg{ - err: err, - name: p.name, - } - } - return installedPkgMsg{ - err: nil, - name: p.name, - } - } - if p.IsMixins { - err := installMixin(p, cliConfig) - if err != nil { - return installedPkgMsg{ - err: err, - name: p.name, - } - } - return installedPkgMsg{ - err: nil, - name: p.name, - } - } + var err error + if p.IsComponent { + err = installComponent(p, cliConfig) + } else if p.IsMixins { + err = installMixin(p, cliConfig) + } else { + err = fmt.Errorf("unknown install operation") + } return installedPkgMsg{ err: err, name: p.name, } } }
258-259: Include package type in error messageAdding the package type to the error message will help in debugging unknown package types.
-return fmt.Errorf("unknown package type") +return fmt.Errorf("unknown package type: %v", p.pkgType)
297-298: Include package type in error messageSimilarly, in
installMixin, include the package type in the error message for better clarity.-return fmt.Errorf("unknown package type") +return fmt.Errorf("unknown package type: %v", p.pkgType)internal/exec/vendor_component_utils.go (3)
96-105: ImplementExecuteStackVendorInternalfunctionThe
ExecuteStackVendorInternalfunction currently returns a "not supported yet" error. Consider implementing the necessary logic or providing a more detailed message.Would you like assistance in drafting the implementation or creating a GitHub issue to track this task?
343-343: Wrap error with%wfor proper error handlingTo enable error unwrapping, replace
%vwith%wwhen formatting errors.Apply this diff:
- return fmt.Errorf("error initializing model: %v", err) + return fmt.Errorf("error initializing model: %w", err)
341-345: Handle errors from the TUI runEnsure that errors from
tea.NewProgram(model).Run()are properly handled to maintain robustness.Apply this diff:
if _, err := tea.NewProgram(model).Run(); err != nil { - return fmt.Errorf("running download error: %w", err) + return fmt.Errorf("error running TUI program: %w", err) }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (5)
go.mod(1 hunks)internal/exec/vendor_component_utils.go(4 hunks)internal/exec/vendor_model.go(1 hunks)internal/exec/vendor_model_component.go(1 hunks)internal/exec/vendor_utils.go(5 hunks)
🔇 Additional comments (10)
go.mod (1)
96-96: LGTM! Clean dependency addition for TUI animations.
The addition of github.com/charmbracelet/harmonica aligns perfectly with implementing an improved vendor pull interface using Bubble Tea. This indirect dependency will provide smooth animation capabilities for the TUI.
Let's verify the harmonica package usage in the codebase:
internal/exec/vendor_utils.go (8)
10-10: Importing Bubble Tea library for TUI functionality
The addition of the tea import integrates the Bubble Tea library, enabling the new TUI enhancements.
178-179: Calling logInitialMessage to enhance user feedback
Incorporating logInitialMessage improves the user experience by logging initial processing information.
Line range hint 250-309: Refactoring source processing into modular functions
The introduction of shouldSkipSource and validateSourceFields enhances code readability and maintainability by encapsulating specific logic.
271-280: Clarifying source type determination logic
The determineSourceType function cleanly separates the logic for source type determination, improving code clarity.
311-321: Implementing TUI for package processing
Introducing the TUI enhances the user interface during package processing with Bubble Tea.
372-379: Defining logInitialMessage function
Centralizing initial logging supports better code organization and reduces redundancy.
380-392: Duplicate issue: Modifying a value receiver in validateSourceFields
As mentioned earlier, modifying s.File won't affect the original struct since s is passed by value.
435-491: Generating skip function for file copying
The generateSkipFunction effectively handles inclusion and exclusion patterns, enhancing modularity and reusability.
internal/exec/vendor_component_utils.go (1)
15-15: Bubble Tea import added for TUI integration
The addition of the Bubble Tea package is appropriate for implementing TUI features, aligning with the PR objectives.
|
looks like this broke the parsing: when sources:
- source: 'git::https://x-access-token:{{env "GITHUB_TOKEN"}}@github.com...... |

what
interactive shell for atmos vendor pull --everything
atmos vendor pull --everything </dev/null |& cat > atmos_vendor_pull.logscreenshots
example for process with error


example for process successfully done
why
Build an interface for a package manager using bubbletea
references
atmos vendor pull --tags ... --dry-rundoesn't do a full run #792atmos vendor pull --all#301Summary by CodeRabbit
New Features
--everythingflag for thevendor pullcommand, allowing users to vendor all components at once.Bug Fixes
Documentation
--everythingflag and its usage.vendor-manifestdocumentation regarding vendoring from OCI registries.Chores