Skip to content

Load bundle files passed on the command line - #5310

Merged
Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix/5248-bundle-file-cli-argument
Aug 21, 2026
Merged

Load bundle files passed on the command line#5310
Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix/5248-bundle-file-cli-argument

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request introduces robust handling and processing of package bundle files passed as command-line arguments, including normalization, validation, and integration with the application startup process. It also adds comprehensive tests and improves the reliability of handling arguments across different application entry points.

Startup bundle argument handling and processing:

  • Added the new StartupBundleArguments class to centralize the logic for identifying, validating, and normalizing package bundle file arguments (such as .ubundle, .json, .yaml, .xml) from the command line. This includes resolving relative paths, ignoring unsupported/missing files, and skipping arguments that are flags or their values. (src/Shared/StartupBundleArguments.cs, src/Shared/StartupBundleArguments.csR1-R107)
  • Integrated StartupBundleArguments into the main application startup and single-instance logic, ensuring bundle files are correctly resolved and normalized before further processing. (src/UniGetUI.Avalonia/Infrastructure/AvaloniaAppHost.cs,

Startup argument processing and user feedback:

  • Introduced the StartupArgumentProcessor to process bundle files on startup, load them into the main window, and log warnings if bundles are ignored (e.g., in daemon mode or if the main window/view model is unavailable). (src/UniGetUI.Avalonia/Infrastructure/StartupArgumentProcessor.cs, src/UniGetUI.Avalonia/Infrastructure/StartupArgumentProcessor.csR1-R64)
  • Updated startup methods to pass command-line arguments through the new processor and handle bundles appropriately after the UI and services are initialized. (src/UniGetUI.Avalonia/App.axaml.cs,

Reliability and single-instance improvements:

  • Improved buffering and dispatch of secondary instance arguments to ensure no arguments are lost before the main window is ready. (src/UniGetUI.Avalonia/Infrastructure/AvaloniaAppHost.cs, src/UniGetUI.Avalonia/Infrastructure/AvaloniaAppHost.csL21-R56)
  • Ensured bundle loading only occurs after the application bootstrapper signals initialization, preventing race conditions. (src/UniGetUI.Avalonia/Infrastructure/AvaloniaBootstrapper.cs,

Testing and project structure:

  • Added a comprehensive test suite for StartupBundleArguments, covering supported extensions, path resolution, quoting, unsupported/missing files, and normalization logic. (src/UniGetUI.Tests/StartupBundleArgumentsTests.cs, src/UniGetUI.Tests/StartupBundleArgumentsTests.csR1-R141)
  • Updated project files to include the new shared logic in both the main application and test projects. (src/UniGetUI.Avalonia/UniGetUI.Avalonia.csproj,

View model support:

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds command-line package bundle loading to Avalonia startup and single-instance forwarding.

Changes:

  • Resolves, validates, and normalizes bundle paths.
  • Processes bundles after application initialization.
  • Adds argument-resolution tests and project links.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Shared/StartupBundleArguments.cs Implements bundle argument parsing.
src/UniGetUI.Avalonia/Infrastructure/StartupArgumentProcessor.cs Loads resolved startup bundles.
src/UniGetUI.Avalonia/Infrastructure/AvaloniaAppHost.cs Normalizes and buffers forwarded arguments.
src/UniGetUI.Avalonia/Infrastructure/AvaloniaBootstrapper.cs Exposes initialization completion.
src/UniGetUI.Avalonia/App.axaml.cs Integrates initial and secondary processing.
src/UniGetUI.Avalonia/ViewModels/MainWindowViewModel.cs Adds file-based bundle loading.
src/UniGetUI.Avalonia/UniGetUI.Avalonia.csproj Includes shared argument logic.
src/UniGetUI.Tests/StartupBundleArgumentsTests.cs Tests bundle argument handling.
src/UniGetUI.Tests/UniGetUI.Tests.csproj Includes shared logic in tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/UniGetUI.Avalonia/App.axaml.cs
Comment thread src/UniGetUI.Avalonia/Infrastructure/AvaloniaBootstrapper.cs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] <bundle-file> parameter on cmd-line ignored

3 participants