Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare build and packages for publishing #175

Merged
merged 35 commits into from
Dec 7, 2024
Merged

Prepare build and packages for publishing #175

merged 35 commits into from
Dec 7, 2024

Conversation

tomlm
Copy link
Collaborator

@tomlm tomlm commented Dec 5, 2024

This is to implement #169 and #172

  • Added Icon.png to each package
  • Added Readme.txt to each package
  • Consolidated GuiCS into Consolonia.Platform package so there isn't a standalone GuiCS package
  • Added github actions for publishing packages to nuget

tomlm added 4 commits December 4, 2024 17:44
 **PublishNuget**
- builds release and publishes nuget and symbol nuget for the current checked in version

 **PublishIncrementNuget**
- Bumps incremental build number (11.2.X)
- builds release and publishes nuget and symbol nuget for the
- Checks in updated build number

NOTE: This needs a NUGET_KEY secret added
@tomlm tomlm requested a review from jinek December 5, 2024 07:31
Copy link
Contributor

coderabbitai bot commented Dec 5, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

This pull request introduces significant changes across multiple files, primarily focusing on the addition of new GitHub Actions workflows for publishing NuGet packages. Two new workflow files, PublishIncrementalNuget.yml and PublishNuget.yml, are created to automate the process of publishing NuGet releases, triggered manually via the workflow_dispatch event. The workflows include steps for checking out the repository, setting up the .NET environment, restoring dependencies, building the solution, packing it into NuGet packages, and publishing these packages to a NuGet repository.

Additionally, the project file Directory.Build.props is updated to reflect a new version prefix and the inclusion of a package icon. Several README files are added or modified to provide documentation for the Consolonia project and its components. Other changes include the removal of certain attributes and properties in existing classes, updates to namespaces, and modifications to various controls and their associated styles in the theme files.

Suggested reviewers

  • jinek: Suggested as a reviewer for this pull request due to their familiarity with the project and its workflows.

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 12

🧹 Outside diff range and nitpick comments (15)
src/Consolonia.GuiCS/Consolonia.GuiCS.csproj (1)

1-1: Remove BOM character from project file

The file starts with a BOM (Byte Order Mark) character. While this doesn't affect functionality, it's best practice to avoid BOM in project files for consistency.

-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
.github/workflows/PublishNuget.yml (1)

28-34: Enhance package publishing security and reliability

Consider these improvements for the package publishing step:

  1. Add condition to prevent publishing if build fails
  2. Upload packages as artifacts for audit trail
  3. Add package signature verification
+      - name: Upload packages as artifacts
+        uses: actions/upload-artifact@v4
+        with:
+          name: nuget-packages
+          path: packages/
+          retention-days: 30
+
       - name: Publish NuGet and symbols
+        if: success()
         id: nuget-push
         uses: edumserrano/nuget-push@v1
         with:
           api-key: '${{ secrets.NUGET_KEY }}' 
           working-directory: 'packages'
           fail-if-exists: false
🧰 Tools
🪛 yamllint (1.35.1)

[error] 32-32: trailing spaces

(trailing-spaces)

src/Consolonia.Core/Consolonia.Core.csproj (1)

Line range hint 5-12: Consider standardizing package version references

While not directly related to the packaging changes, it would be good practice to move common package versions to a central location.

Consider moving version numbers for packages like CommunityToolkit.Mvvm, SkiaSharp, Unicode.net, etc., to the Directory.Build.props file, similar to how $(AvaloniaVersion) is handled.

src/Tools/Avalonia.PreviewHost/Avalonia.PreviewHost.csproj (1)

Line range hint 16-24: Consider moving debug-only package reference to a conditional ItemGroup

For better organization, consider moving debug-only package references to a separate conditional ItemGroup.

     <ItemGroup>
         <PackageReference Include="Avalonia" Version="$(AvaloniaVersion)" />
         <PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
         <PackageReference Include="Avalonia.Themes.Fluent" Version="$(AvaloniaVersion)" />
         <PackageReference Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" />
         <PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
         <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
+    </ItemGroup>
 
-        <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
-        <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
+    <ItemGroup Condition="'$(Configuration)' == 'Debug'">
+        <PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
     </ItemGroup>
.github/workflows/PublishIncrementalNuget.yml (2)

18-24: Consider adding version bump validation

The automatic version bumping could cause conflicts if multiple PRs are merged in quick succession.

Consider:

  1. Adding a validation step to ensure the version hasn't been bumped by another PR
  2. Using semantic versioning with major.minor.patch format
  3. Adding a manual input parameter to specify the version bump type (patch/minor/major)

32-34: Add package validation step

Consider validating the NuGet packages before publishing.

Add a validation step:

      - name: Validate packages
        run: |
          for package in packages/*.nupkg; do
            dotnet nuget verify $package
          done
🧰 Tools
🪛 yamllint (1.35.1)

[error] 32-32: trailing spaces

(trailing-spaces)

src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj (1)

25-32: Consider adding package validation for copied assets

The custom target for copying project references looks good, but consider adding validation.

Add a validation target:

<Target Name="ValidatePackageAssets" AfterTargets="CopyProjectReferencesToPackage">
  <Error Condition="!Exists('$(OutputPath)Consolonia.GuiCS.dll')"
         Text="Required asset Consolonia.GuiCS.dll was not found in the output directory." />
</Target>
src/Consolonia.NUnit/README.md (3)

7-7: Fix grammar in project status note

The project status note is missing an article.

-> Project is in proof of concept state and is looking for collaboration.
+> The project is in a proof of concept state and is looking for collaboration.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~7-~7: A determiner appears to be missing. Consider inserting it.
Context: ... styling and the rest from Avalonia. > Project is in proof of concept state and is loo...

(AI_EN_LECTOR_MISSING_DETERMINER)


12-12: Format bare URL as a proper markdown link

Convert the bare URL to a proper markdown link for better readability and maintainability.

-Example of usage: https://github.com/jinek/ToolUI
+Example of usage: [ToolUI Repository](https://github.com/jinek/ToolUI)
🧰 Tools
🪛 Markdownlint (0.35.0)

12-12: null
Bare URL used

(MD034, no-bare-urls)


14-14: Improve reference to additional documentation

The reference to additional documentation is vague and could be more helpful to users.

-Solution contains one more readme file with coding information.
+For detailed development guidelines, see [Coding Guidelines](../docs/coding-guidelines.md).
src/Consolonia.Themes.TurboVision/README.md (2)

1-5: Enhance the introduction section with more details

While the introduction provides a good overview, it could be more informative by:

  • Adding a brief description of what TurboVision theme specifically offers
  • Including installation instructions or package information
  • Mentioning key features specific to this theme
 # Consolonia UI

-TUI (Text User Interface) (GUI Framework) implementation for [Avalonia UI](https://github.com/AvaloniaUI)
+TUI (Text User Interface) implementation for [Avalonia UI](https://github.com/AvaloniaUI), featuring a TurboVision-inspired theme.
 
-Supports XAML, data bindings, animation, styling and the rest from Avalonia.
+## Features
+- Full Avalonia UI support including XAML, data bindings, animations, and styling
+- Classic TurboVision-style appearance
+
+## Installation
+```bash
+dotnet add package Consolonia.Themes.TurboVision
+```

7-7: Improve the project status notice

The current status notice could be more informative about what kind of collaboration is needed.

-> Project is in proof of concept state and is looking for collaboration.
+> ⚠️ This project is in a proof-of-concept state. We welcome contributions in the following areas:
+> - Bug reports and fixes
+> - Feature implementations
+> - Documentation improvements
+> - Testing and feedback
🧰 Tools
🪛 LanguageTool

[uncategorized] ~7-~7: Possible missing article found.
Context: ... styling and the rest from Avalonia. > Project is in proof of concept state and is loo...

(AI_HYDRA_LEO_MISSING_THE)

src/Consolonia.Blazor/README.md (3)

7-7: Improve grammar in project status note

Consider revising the project status note for better clarity.

-> Project is in proof of concept state and is looking for collaboration.
+> This project is in a proof-of-concept state and is looking for collaboration.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~7-~7: Possible missing article found.
Context: ... styling and the rest from Avalonia. > Project is in proof of concept state and is loo...

(AI_HYDRA_LEO_MISSING_THE)


12-12: Format bare URL as a proper markdown link

Use proper markdown link syntax for better readability and compliance with markdown best practices.

-Example of usage: https://github.com/jinek/ToolUI
+Example of usage: [ToolUI Repository](https://github.com/jinek/ToolUI)
🧰 Tools
🪛 Markdownlint (0.35.0)

12-12: null
Bare URL used

(MD034, no-bare-urls)


14-14: Clarify documentation reference

The reference to another readme file is vague. Consider specifying the location or purpose of the additional documentation.

-Solution contains one more readme file with coding information.
+For development and coding guidelines, please refer to the [Developer Documentation](../README.md).
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b0a8224 and 31611eb.

📒 Files selected for processing (20)
  • .github/workflows/PublishIncrementalNuget.yml (1 hunks)
  • .github/workflows/PublishNuget.yml (1 hunks)
  • Directory.Build.props (1 hunks)
  • foo.cmd (1 hunks)
  • src/Consolonia.Blazor/README.md (1 hunks)
  • src/Consolonia.Core/Consolonia.Core.csproj (1 hunks)
  • src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs (0 hunks)
  • src/Consolonia.Core/README.md (1 hunks)
  • src/Consolonia.Designer/Consolonia.Designer.csproj (1 hunks)
  • src/Consolonia.Designer/README.md (1 hunks)
  • src/Consolonia.GuiCS/Consolonia.GuiCS.csproj (1 hunks)
  • src/Consolonia.GuiCS/readme.md (0 hunks)
  • src/Consolonia.NUnit/Consolonia.NUnit.csproj (1 hunks)
  • src/Consolonia.NUnit/README.md (1 hunks)
  • src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj (1 hunks)
  • src/Consolonia.PlatformSupport/README.md (1 hunks)
  • src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj (1 hunks)
  • src/Consolonia.Themes.TurboVision/README.md (1 hunks)
  • src/Tools/Avalonia.PreviewHost/Avalonia.PreviewHost.csproj (1 hunks)
  • src/Tools/Consolonia.PreviewHost/Consolonia.PreviewHost.csproj (1 hunks)
💤 Files with no reviewable changes (2)
  • src/Consolonia.GuiCS/readme.md
  • src/Consolonia.Core/Infrastructure/ConsoloniaNotSupportedException.cs
✅ Files skipped from review due to trivial changes (5)
  • Directory.Build.props
  • src/Consolonia.Designer/README.md
  • src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj
  • src/Consolonia.Core/README.md
  • foo.cmd
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/PublishNuget.yml

14-14: the runner of "actions/setup-dotnet@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

.github/workflows/PublishIncrementalNuget.yml

14-14: the runner of "actions/setup-dotnet@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)
.github/workflows/PublishNuget.yml

[error] 10-10: trailing spaces

(trailing-spaces)


[error] 12-12: trailing spaces

(trailing-spaces)


[error] 17-17: trailing spaces

(trailing-spaces)


[error] 22-22: trailing spaces

(trailing-spaces)


[error] 23-23: trailing spaces

(trailing-spaces)


[error] 24-24: trailing spaces

(trailing-spaces)


[error] 32-32: trailing spaces

(trailing-spaces)


[error] 35-35: trailing spaces

(trailing-spaces)

.github/workflows/PublishIncrementalNuget.yml

[error] 10-10: trailing spaces

(trailing-spaces)


[error] 12-12: trailing spaces

(trailing-spaces)


[error] 17-17: trailing spaces

(trailing-spaces)


[error] 25-25: trailing spaces

(trailing-spaces)


[error] 30-30: trailing spaces

(trailing-spaces)


[error] 31-31: trailing spaces

(trailing-spaces)


[error] 32-32: trailing spaces

(trailing-spaces)


[error] 40-40: trailing spaces

(trailing-spaces)


[error] 43-43: trailing spaces

(trailing-spaces)

🪛 LanguageTool
src/Consolonia.Blazor/README.md

[uncategorized] ~7-~7: Possible missing article found.
Context: ... styling and the rest from Avalonia. > Project is in proof of concept state and is loo...

(AI_HYDRA_LEO_MISSING_THE)

src/Consolonia.NUnit/README.md

[uncategorized] ~7-~7: A determiner appears to be missing. Consider inserting it.
Context: ... styling and the rest from Avalonia. > Project is in proof of concept state and is loo...

(AI_EN_LECTOR_MISSING_DETERMINER)

src/Consolonia.PlatformSupport/README.md

[uncategorized] ~7-~7: Possible missing article found.
Context: ... styling and the rest from Avalonia. > Project is in proof of concept state and is loo...

(AI_HYDRA_LEO_MISSING_THE)

src/Consolonia.Themes.TurboVision/README.md

[uncategorized] ~7-~7: Possible missing article found.
Context: ... styling and the rest from Avalonia. > Project is in proof of concept state and is loo...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~13-~13: A determiner appears to be missing. Consider inserting it.
Context: ...usage: https://github.com/jinek/ToolUI Solution contains one more readme file with codi...

(AI_EN_LECTOR_MISSING_DETERMINER)

🪛 Markdownlint (0.35.0)
src/Consolonia.Blazor/README.md

12-12: null
Bare URL used

(MD034, no-bare-urls)

src/Consolonia.NUnit/README.md

12-12: null
Bare URL used

(MD034, no-bare-urls)

src/Consolonia.PlatformSupport/README.md

12-12: null
Bare URL used

(MD034, no-bare-urls)

src/Consolonia.Themes.TurboVision/README.md

12-12: null
Bare URL used

(MD034, no-bare-urls)

🔇 Additional comments (5)
src/Consolonia.Designer/Consolonia.Designer.csproj (1)

14-16: LGTM! Project references are well organized

The project references are properly formatted and the conditional reference for PreviewHost in Debug configuration is appropriate.

src/Tools/Avalonia.PreviewHost/Avalonia.PreviewHost.csproj (1)

8-8: LGTM! Appropriate packaging configuration

Setting IsPackable to false is correct for this tool project, as it's not intended for distribution via NuGet. This aligns with the PR's objective of organizing package publishing.

src/Tools/Consolonia.PreviewHost/Consolonia.PreviewHost.csproj (1)

26-26: LGTM: Package reference and metadata changes look good!

The addition of the Avalonia.Markup.Xaml.Loader package and the handling of package metadata through ItemGroup entries follow best practices.

src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj (1)

6-9: Verify GuiCS consolidation impact

The GuiCS consolidation looks correct, but we should verify its impact on dependent packages.

✅ Verification successful

GuiCS consolidation is correctly isolated

The GuiCS project reference exists only in PlatformSupport.csproj, confirming that the consolidation is properly contained and won't impact other packages directly. The PrivateAssets="All" configuration ensures the dependency remains internal to the platform package.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any direct references to Consolonia.GuiCS in other projects
rg -l "Include=\".*Consolonia\.GuiCS\.csproj\"" --type csproj

Length of output: 92


Script:

#!/bin/bash
# Find all csproj files and check for GuiCS references
fd '\.csproj$' | xargs grep -l "Consolonia\.GuiCS\.csproj"

Length of output: 125

src/Consolonia.Themes.TurboVision/README.md (1)

9-10: LGTM! Well-structured showcase section

The showcase section effectively uses a clickable image linking to a video demonstration, which is a good practice for documentation.

src/Consolonia.GuiCS/Consolonia.GuiCS.csproj Show resolved Hide resolved
src/Consolonia.NUnit/Consolonia.NUnit.csproj Outdated Show resolved Hide resolved
.github/workflows/PublishNuget.yml Show resolved Hide resolved
.github/workflows/PublishNuget.yml Show resolved Hide resolved
src/Consolonia.Core/Consolonia.Core.csproj Outdated Show resolved Hide resolved
.github/workflows/PublishIncrementalNuget.yml Show resolved Hide resolved
src/Consolonia.NUnit/README.md Outdated Show resolved Hide resolved
src/Consolonia.Themes.TurboVision/README.md Outdated Show resolved Hide resolved
src/Consolonia.Themes.TurboVision/README.md Outdated Show resolved Hide resolved
src/Consolonia.PlatformSupport/README.md Outdated Show resolved Hide resolved
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: 6

🧹 Outside diff range and nitpick comments (21)
src/Tests/Consolonia.Core.Tests/MiscTests.cs (2)

13-13: Fix typo in test method name

The method name contains a typo: "TestExectpionRequest" should be "TestExceptionRequest"

-        public void TestExectpionRequest()
+        public void TestExceptionRequest()

1-5: Remove unused imports

The following imports appear to be unused in this test file:

  • Avalonia.Media
  • Consolonia.Core.Drawing.PixelBufferImplementation
 using System;
-using Avalonia.Media;
-using Consolonia.Core.Drawing.PixelBufferImplementation;
 using Consolonia.Core.Infrastructure;
 using NUnit.Framework;
src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj (1)

25-32: LGTM! Custom build target implementation is solid.

The target correctly handles project reference copying while preserving the package structure. Consider documenting this target in the repository's build documentation for future maintainers.

To improve maintainability:

  1. Consider adding this as a reusable target in Directory.Build.targets if other projects need similar functionality
  2. Document the target's purpose and usage in the build documentation
src/Consolonia.Themes.TurboVision/Themes/TurboVisionTheme.cs (1)

Line range hint 10-24: Consider documenting the constructor choices

The class now has three constructors with different initialization paths. Consider adding XML documentation to explain when to use each constructor variant.

Add documentation like this:

+        /// <summary>
+        /// Initializes a new instance with the default TurboVision theme URI.
+        /// </summary>
         public TurboVisionTheme() : base(Uri)
         {
         }

+        /// <summary>
+        /// Initializes a new instance with a custom base URI.
+        /// </summary>
+        /// <param name="baseUri">The custom URI to use for resource loading.</param>
         public TurboVisionTheme(Uri baseUri) : base(baseUri)
         {
         }

+        /// <summary>
+        /// Initializes a new instance with a service provider for dependency injection.
+        /// </summary>
+        /// <param name="serviceProvider">The service provider for resolving dependencies.</param>
         public TurboVisionTheme(IServiceProvider serviceProvider) : base(serviceProvider)
         {
         }
src/Consolonia.Designer/Extensions.cs (1)

Line range hint 13-17: Update documentation to reflect new behavior

The XML documentation states "In release mode it will load consolonia, removing the dependency on the desktop avalonia subsystem." This is no longer accurate since the design mode check is now performed in all builds, not just debug builds.

-    ///     In Design mode it will load up avalonia instead of consolonia so that avalonia
-    ///     previewer will attempt to render it. This mostly only works for text layout.
-    ///     In release mode it will load consolonia, removing the dependency on the desktop avalonia subsystem.
-    ///     NOTE: The package references for
+    ///     When in design mode, it loads Avalonia for preview rendering (primarily supporting text layout).
+    ///     Otherwise, it loads Consolonia for normal operation.
+    ///     This check occurs in all build configurations.
src/Example/Program.cs (1)

17-21: Consider documenting configuration options

The BuildAvaloniaApp method improves testability by extracting configuration. Consider adding XML documentation to explain available options and their effects.

+        /// <summary>
+        /// Configures and builds the Avalonia application with Consolonia support.
+        /// </summary>
+        /// <returns>Configured AppBuilder instance</returns>
         public static AppBuilder BuildAvaloniaApp()
src/Example/App.cs (2)

12-15: Remove or document commented theme options

Consider either:

  1. Removing the commented theme options if they're not needed
  2. Converting them into configurable options if they represent valid alternatives
  3. Adding a comment explaining why they're kept for reference

8-8: Consider making theme selection configurable

The MaterialTheme is hardcoded. Consider making theme selection configurable through app settings or environment variables to improve flexibility.

Also applies to: 16-16

src/Consolonia.Themes.TurboVision/Themes/FluentTheme.cs (1)

10-12: Consider reducing URI duplication

The same URI is specified in both the constructor and the Uri property. Consider centralizing this to a single constant to improve maintainability.

     public class FluentTheme : ResourceIncludeBase
     {
+        private static readonly Uri ThemeUri = new("avares://Consolonia.Themes.TurboVision/Themes/Fluent/Fluent.axaml");
-        public FluentTheme() : base(new Uri("avares://Consolonia.Themes.TurboVision/Themes/Fluent/Fluent.axaml"))
+        public FluentTheme() : base(ThemeUri)
         {
         }
         // ... other constructors ...

-        protected override Uri Uri =>
-            new("avares://Consolonia.Themes.TurboVision/Themes/Fluent/Fluent.axaml");
+        protected override Uri Uri => ThemeUri;

Also applies to: 21-22

src/Consolonia.Themes.TurboVision/Themes/TurboVisionDarkTheme.cs (1)

7-7: Standardize comment style

The ReSharper suppression comment uses inline style while other files use attribute style. Consider standardizing across all theme files.

-    // ReSharper disable once UnusedType.Global
+    [SuppressMessage("ReSharper", "UnusedType.Global")]
     public class TurboVisionDarkTheme : ResourceIncludeBase
src/Consolonia.Themes.TurboVision/Themes/TurboVisionBlackTheme.cs (1)

10-12: Consider a base theme implementation

Given the identical pattern across all theme classes, consider introducing a base theme class to handle common initialization logic.

Example implementation:

public abstract class ConsoloniaThemeBase : ResourceIncludeBase
{
    private readonly string _themeUri;

    protected ConsoloniaThemeBase(string themeUri)
    {
        _themeUri = themeUri;
    }

    protected override Uri Uri => new(_themeUri);
}

public class TurboVisionBlackTheme : ConsoloniaThemeBase
{
    private const string ThemeUri = "avares://Consolonia.Themes.TurboVision/Themes/TurboVisionBlack/TurboVisionBlack.axaml";

    public TurboVisionBlackTheme() : base(ThemeUri) { }
    
    // Other constructors...
}

Also applies to: 21-22

src/Consolonia.PlatformSupport/README.md (2)

2-2: Fix macOS spelling

Change "MacOS" to "macOS" to follow Apple's official naming convention.

-This package provides Consolonia IConsole platform support for adapting to consoles on Windows, Linux and MacOS environments.
+This package provides Consolonia IConsole platform support for adapting to consoles on Windows, Linux and macOS environments.
🧰 Tools
🪛 LanguageTool

[grammar] ~2-~2: The operating system from Apple is written “macOS”.
Context: ...pting to consoles on Windows, Linux and MacOS environments. ## Background Consolonia...

(MAC_OS)


12-20: Enhance usage documentation

The usage section could benefit from:

  1. Prerequisites or installation instructions
  2. Explanation of the configuration options (UseConsolonia() and UseAutoDetectedConsole())
  3. Platform-specific considerations for Windows, Linux, and macOS

Would you like me to help expand this section with more detailed documentation?

src/Consolonia.Designer/README.md (1)

9-9: Improve experimental warning formatting

The experimental warning should be more prominent and better formatted.

-This package **EXPERIMENTAL** Consolonia support for design time previews.
+> ⚠️ **EXPERIMENTAL**: This package provides Consolonia support for design time previews.
src/Consolonia.Themes.TurboVision/README.md (2)

6-6: Fix heading hierarchy

Maintain consistent heading levels throughout the document.

-# Showcase (click picture to see video)
+## Showcase (click picture to see video)

-# Usage
+## Usage

Also applies to: 16-16


9-14: Add theme previews

Consider adding screenshots or ASCII art examples for each theme to help users visualize the differences between themes.

Would you like me to help create a theme preview section with example screenshots or ASCII art representations?

src/Consolonia.NUnit/README.md (1)

13-13: Improve readability with proper punctuation and articles

Consider these grammatical improvements:

  • Line 13: Add a comma: "...against your consolonia application, your test class..."
  • Line 15: Add articles: "...by passing a size parameter to the base class."
-To create a unit test against your consolonia application your test class should derive from ConsoloniaAppTestBase&lt;App$gt;.
+To create a unit test against your consolonia application, your test class should derive from ConsoloniaAppTestBase&lt;App$gt;.

-You can define the size of your console by passing size parameter to base class.
+You can define the size of your console by passing a size parameter to the base class.

Also applies to: 15-15

🧰 Tools
🪛 LanguageTool

[uncategorized] ~13-~13: A comma might be missing here.
Context: ...ate a unit test against your consolonia application your test class should derive from Cons...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)

src/Consolonia.Core/README.md (1)

30-39: Enhance code example with additional documentation

Consider adding more comments to explain:

  • The purpose of ConsoloniaApplication<T>
  • Why MaterialTheme is being used
  • What other theme options are available
 // use HelloWorldWindow as the MainWindow for the application
 public class HelloWorldApp : ConsoloniaApplication<HelloWorldWindow>
 {
     public override void Initialize()
     {
-        // set the theme
+        // Set the MaterialTheme for consistent UI styling
+        // Other available themes can be found in Consolonia.Themes.TurboVision
         Styles.Add(new MaterialTheme());
     }
 }
src/Tools/Consolonia.PreviewHost/App.cs (2)

Line range hint 89-124: Remove or document commented-out code

The file contains a large block of commented-out event handling code. If this code is no longer needed, it should be removed. If it's kept for future reference, it should be properly documented with the reason for keeping it.


Line range hint 11-15: Document culture setting in static constructor

The static constructor sets the culture to InvariantCulture without explaining why this is necessary.

 static App()
 {
-    // we want tests and UI to be executed with same culture
+    // Set InvariantCulture for consistent formatting and parsing across different system locales
+    // This ensures that tests and UI behave consistently regardless of the user's system settings
     Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
 }
src/Consolonia.Gallery/App.cs (1)

20-22: Remove commented-out theme code for clarity

The application now uses MaterialTheme for styling, while TurboVisionTheme and FluentTheme are commented out. Consider removing the commented-out theme code if it's no longer needed to enhance code readability and maintainability.

Apply this diff to remove the unnecessary code:

-// Styles.Add(new TurboVisionTheme());
 Styles.Add(new MaterialTheme());
-// Styles.Add(new FluentTheme());
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 31611eb and 135fd58.

📒 Files selected for processing (30)
  • Directory.Build.props (1 hunks)
  • src/Consolonia.Core/Consolonia.Core.csproj (1 hunks)
  • src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs (2 hunks)
  • src/Consolonia.Core/README.md (1 hunks)
  • src/Consolonia.Designer/ConsolePreview.cs (0 hunks)
  • src/Consolonia.Designer/Consolonia.Designer.csproj (2 hunks)
  • src/Consolonia.Designer/Extensions.cs (1 hunks)
  • src/Consolonia.Designer/README.md (1 hunks)
  • src/Consolonia.Gallery/App.cs (2 hunks)
  • src/Consolonia.NUnit/Consolonia.NUnit.csproj (1 hunks)
  • src/Consolonia.NUnit/README.md (1 hunks)
  • src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj (1 hunks)
  • src/Consolonia.PlatformSupport/README.md (1 hunks)
  • src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj (1 hunks)
  • src/Consolonia.Themes.TurboVision/README.md (1 hunks)
  • src/Consolonia.Themes.TurboVision/Themes/FluentTheme.cs (1 hunks)
  • src/Consolonia.Themes.TurboVision/Themes/MaterialTheme.cs (1 hunks)
  • src/Consolonia.Themes.TurboVision/Themes/TurboVisionBlackTheme.cs (1 hunks)
  • src/Consolonia.Themes.TurboVision/Themes/TurboVisionDarkTheme.cs (1 hunks)
  • src/Consolonia.Themes.TurboVision/Themes/TurboVisionTheme.cs (1 hunks)
  • src/Example/App.axaml (0 hunks)
  • src/Example/App.axaml.cs (0 hunks)
  • src/Example/App.cs (1 hunks)
  • src/Example/Program.cs (1 hunks)
  • src/Tests/Consolonia.Core.Tests/MiscTests.cs (1 hunks)
  • src/Tests/Consolonia.Gallery.Tests/Base/GalleryTestsBaseBase.cs (1 hunks)
  • src/Tools/Consolonia.PreviewHost/App.axaml (0 hunks)
  • src/Tools/Consolonia.PreviewHost/App.cs (2 hunks)
  • src/Tools/Consolonia.PreviewHost/Consolonia.PreviewHost.csproj (2 hunks)
  • src/Tools/Consolonia.PreviewHost/readme.md (1 hunks)
💤 Files with no reviewable changes (4)
  • src/Tools/Consolonia.PreviewHost/App.axaml
  • src/Example/App.axaml.cs
  • src/Example/App.axaml
  • src/Consolonia.Designer/ConsolePreview.cs
✅ Files skipped from review due to trivial changes (1)
  • src/Tools/Consolonia.PreviewHost/readme.md
🚧 Files skipped from review as they are similar to previous changes (6)
  • Directory.Build.props
  • src/Consolonia.Designer/Consolonia.Designer.csproj
  • src/Consolonia.Core/Consolonia.Core.csproj
  • src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj
  • src/Tools/Consolonia.PreviewHost/Consolonia.PreviewHost.csproj
  • src/Consolonia.NUnit/Consolonia.NUnit.csproj
🧰 Additional context used
📓 Learnings (1)
src/Consolonia.Designer/README.md (1)
Learnt from: tomlm
PR: jinek/Consolonia#150
File: src/Consolonia.Designer/Consolonia.Designer.csproj:14-15
Timestamp: 2024-11-19T07:19:33.261Z
Learning: In the Consolonia project, circular dependencies between `Consolonia.Designer` and `Consolonia.PreviewHost` are intentional and by design. The `ConsolePreview` control consumes `Consolonia.PreviewHost`, and `Avalonia.PreviewHost` consumes `ConsolePreview` control in the designer.
🪛 LanguageTool
src/Consolonia.Themes.TurboVision/README.md

[uncategorized] ~16-~16: Possible missing preposition found.
Context: ...me** - TurboVision Black theme # Usage Define an application with a theme ## Define...

(AI_HYDRA_LEO_MISSING_TO)

src/Consolonia.PlatformSupport/README.md

[grammar] ~2-~2: The operating system from Apple is written “macOS”.
Context: ...pting to consoles on Windows, Linux and MacOS environments. ## Background Consolonia...

(MAC_OS)

src/Consolonia.NUnit/README.md

[uncategorized] ~13-~13: A comma might be missing here.
Context: ...ate a unit test against your consolonia application your test class should derive from Cons...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~15-~15: You might be missing the article “a” here.
Context: ...ine the size of your console by passing size parameter to base class. Then you can ...

(AI_EN_LECTOR_MISSING_DETERMINER_A)


[uncategorized] ~15-~15: You might be missing the article “the” here.
Context: ...ur console by passing size parameter to base class. Then you can use UITest to inte...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

src/Consolonia.Core/README.md

[uncategorized] ~12-~12: Possible missing preposition found.
Context: ...(https://youtu.be/ttgZmbruk3Y) # Usage Define an application with a theme (See Consol...

(AI_HYDRA_LEO_MISSING_TO)

🔇 Additional comments (19)
src/Tests/Consolonia.Core.Tests/MiscTests.cs (2)

15-23: LGTM: Exception property validation

The test correctly validates that the Request property of the exception maintains the reference to the original request object.


12-24: Consider adding serialization tests

Given that the [Serializable] attribute was removed from ConsoloniaNotSupportedException, we should verify if this change was intentional and if we need additional tests to validate the new behavior.

src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj (3)

17-23: LGTM! Well-documented build configuration.

The PropertyGroup configuration correctly sets up the custom target for package building, and the included documentation link is helpful for future maintenance.


12-15: Verify the existence of package assets.

The package asset configuration looks good, but let's ensure the referenced files exist.

✅ Verification successful

Package assets are correctly configured and present

Both Icon.png and README.md files exist at their specified locations, confirming that the package asset configuration is valid.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if Icon.png exists in repository root
if [ -f "Icon.png" ]; then
    echo "✓ Icon.png exists"
else
    echo "✗ Icon.png missing"
fi

# Check if README.md exists in package directory
if [ -f "src/Consolonia.PlatformSupport/README.md" ]; then
    echo "✓ README.md exists"
else
    echo "✗ README.md missing"
fi

Length of output: 167


6-9: LGTM! Project reference configuration looks correct.

The configuration properly embeds GuiCS.dll while preventing it from becoming a package dependency, which aligns with the consolidation objective.

Let's verify no other GuiCS references exist:

✅ Verification successful

Project reference configuration is correctly isolated to PlatformSupport

The verification confirms that Consolonia.GuiCS is only referenced in Consolonia.PlatformSupport.csproj with the correct private assets configuration. No other project references exist that would need similar treatment.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any other GuiCS package references that might need similar treatment
rg -g "*.csproj" "Consolonia\.GuiCS" --type xml

Length of output: 496

src/Consolonia.Themes.TurboVision/Themes/TurboVisionTheme.cs (1)

5-5: Verify namespace change impact across the codebase

The class has been moved from Consolonia.Themes.TurboVision.Templates to Consolonia.Themes. While this change improves organization, we should verify that all references to this class have been updated.

✅ Verification successful

No impact from namespace change - references are properly scoped

The namespace change from Consolonia.Themes.TurboVision.Templates to Consolonia.Themes appears safe because:

  • All references to the old namespace are only in XAML files and are specifically for the Controls.Helpers namespace, not for TurboVisionTheme class
  • All usages of TurboVisionTheme found in the codebase are either:
    • Documentation references in README.md
    • Commented out code in App.cs files
    • The class definition itself
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining references to the old namespace
# and verify all usages of TurboVisionTheme have been updated

# Check for old namespace references
echo "Checking for old namespace references..."
rg "Consolonia\.Themes\.TurboVision\.Templates"

# Check all usages of TurboVisionTheme
echo "Checking TurboVisionTheme usages..."
rg "TurboVisionTheme" -A 2 -B 2

Length of output: 9336

src/Consolonia.Designer/Extensions.cs (1)

22-26: Verify performance impact of unconditional design mode checks

The removal of DEBUG conditional compilation means Design.IsDesignMode is now checked in all builds, including production. While this simplifies the code, we should verify that this doesn't impact production performance.

src/Example/Program.cs (2)

9-9: LGTM: Visibility change aligns with package goals

The change from internal to public and updated method signature align well with the PR's objective of preparing for package publishing.

Also applies to: 11-11


13-14: Verify error handling in console lifetime

While the configuration looks correct, ensure proper error handling exists when starting with console lifetime.

✅ Verification successful

Let me check the implementation of error handling in the console lifetime by looking at the core implementation.


Let me try a different approach to check the implementation.


Let me check one more thing about the ConsoloniaLifetime implementation since it's the actual class handling the lifetime.


Based on the implementation review, I can now provide the final response:

Error handling is properly implemented in the console lifetime

The console lifetime implementation inherits from ClassicDesktopStyleApplicationLifetime and includes proper error propagation:

  • The StartWithConsoleLifetime method returns an integer status code from lifetime.Start()
  • The ConsoloniaLifetime class includes proper cancellation token handling and task-based asynchronous operations
  • Error conditions are properly propagated through the standard Avalonia lifetime mechanisms
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for error handling patterns in console lifetime implementation
rg -A 5 "StartWithConsoleLifetime" 

Length of output: 2189


Script:

#!/bin/bash
# Check the implementation of CreateLifetime and related error handling
ast-grep --pattern 'CreateLifetime($_) { $$$ }'

# Also check if there's any try-catch blocks around StartWithConsoleLifetime
ast-grep --pattern 'try { $$$ StartWithConsoleLifetime($$$) $$$ } catch'

# Look for error handling in lifetime.Start implementation
ast-grep --pattern 'Start($_) { $$$ }'

Length of output: 165


Script:

#!/bin/bash
# Check the content of ApplicationStartup.cs which contains the StartWithConsoleLifetime implementation
cat src/Consolonia.Core/ApplicationStartup.cs

# Also check if there are any error handling patterns in the codebase
rg -A 3 "try\s*{.*StartWithConsoleLifetime" 

Length of output: 3096


Script:

#!/bin/bash
# Check the implementation of ConsoloniaLifetime
rg -l "class ConsoloniaLifetime"
cat $(rg -l "class ConsoloniaLifetime")

Length of output: 1416

src/Consolonia.Themes.TurboVision/Themes/FluentTheme.cs (2)

5-5: LGTM: Namespace simplification

The namespace simplification from Consolonia.Themes.TurboVision.Themes.Fluent to Consolonia.Themes improves organization and usability.


10-10: Verify resource path resolution

The hardcoded URI path assumes a specific package structure. Ensure this works correctly across different deployment scenarios and package versions.

Also applies to: 21-21

✅ Verification successful

Let me verify if the resource files exist at the specified paths.


Resource path resolution is correctly configured

The avares:// URI scheme is consistently used across all theme implementations, and the resource files exist at their expected locations. The Fluent.axaml file is present at the specified path src/Consolonia.Themes.TurboVision/Themes/Fluent/, and the project follows a consistent structure for all themes (Fluent, Material, TurboVision variants). Additionally, the theme class provides an overloaded constructor that accepts a custom URI, allowing for deployment flexibility if needed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for resource handling and path resolution patterns
rg -A 5 "avares://"

Length of output: 9983


Script:

#!/bin/bash
# Check if the Fluent theme files exist
fd -t f "Fluent.axaml" src/Consolonia.Themes.TurboVision/Themes/Fluent/

# List all .axaml files in the themes directory to verify structure
fd -t f ".axaml$" src/Consolonia.Themes.TurboVision/Themes/

Length of output: 1034

src/Consolonia.Themes.TurboVision/Themes/MaterialTheme.cs (1)

5-5: Verify impact of namespace change

The namespace has been simplified from Consolonia.Themes.TurboVision.Themes.Material to Consolonia.Themes. While this improves organization, it could break existing consumers.

✅ Verification successful

Namespace change appears safe to proceed

The namespace simplification from Consolonia.Themes.TurboVision.Themes.Material to Consolonia.Themes appears safe as:

  • All current usages of MaterialTheme are through direct instantiation (new MaterialTheme())
  • No explicit namespace references or qualified names were found in the codebase
  • The file exists in the default branch and the change only affects its internal organization
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any existing references to the old namespace
rg "Consolonia\.Themes\.TurboVision\.Themes\.Material"

Length of output: 56


Script:

#!/bin/bash
# Let's try a broader search to find any references to MaterialTheme class
rg "MaterialTheme" -l

# Also check git history for the file to see if this is a new file or modified
git log --oneline -- src/Consolonia.Themes.TurboVision/Themes/MaterialTheme.cs

# Search for any using statements or type references that might be affected
rg "using.*Consolonia\.Themes\.TurboVision\.Themes" 
rg "using.*Consolonia\.Themes\.TurboVision"

Length of output: 342


Script:

#!/bin/bash
# Let's check the actual content of files that reference MaterialTheme to see how they use it
rg "MaterialTheme" -C 2 src/Example/App.cs
rg "MaterialTheme" -C 2 src/Tools/Consolonia.PreviewHost/App.cs
rg "MaterialTheme" -C 2 src/Consolonia.Gallery/App.cs

# Check if this is a new file by looking for its presence in the default branch
git ls-tree -r HEAD | grep MaterialTheme.cs

Length of output: 731

src/Consolonia.Themes.TurboVision/Themes/TurboVisionDarkTheme.cs (1)

9-11: 🛠️ Refactor suggestion

Eliminate URI string duplication and verify resource

Similar to MaterialTheme, the URI string is duplicated. Additionally, let's verify the existence of the theme resource file.

Also applies to: 21-22

✅ Verification successful

Resource file exists, but URI constant pattern needs implementation

The theme resource file TurboVisionDark.axaml exists at the correct location. However, looking at both MaterialTheme and TurboVisionDarkTheme, neither currently implements a constant pattern for URIs. Suggest implementing a constant for both themes:

private const string ThemeUri = "avares://Consolonia.Themes.TurboVision/Themes/TurboVisionDark/TurboVisionDark.axaml";
public TurboVisionDarkTheme() : base(new Uri(ThemeUri))
{
}
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the existence of the theme resource file
fd -e axaml "TurboVisionDark.axaml$"

# Suggest using a constant for the URI
echo "Apply the same URI constant pattern as suggested for MaterialTheme"

Length of output: 260


Script:

#!/bin/bash
# Check if MaterialTheme has a constant pattern for URI
rg -A 5 "class MaterialTheme" 

Length of output: 579

src/Consolonia.Themes.TurboVision/Themes/TurboVisionBlackTheme.cs (1)

5-5: Document theme usage in README

Since this PR focuses on package publishing, ensure the README includes clear documentation about available themes and their usage.

src/Consolonia.NUnit/README.md (1)

1-41: Consider creating a central README with component-specific extensions

The identical README content across multiple components could lead to maintenance challenges. Consider:

  1. Creating a central README in the repository root with common information
  2. Having component-specific READMEs that focus on their unique features
🧰 Tools
🪛 LanguageTool

[uncategorized] ~13-~13: A comma might be missing here.
Context: ...ate a unit test against your consolonia application your test class should derive from Cons...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[uncategorized] ~15-~15: You might be missing the article “a” here.
Context: ...ine the size of your console by passing size parameter to base class. Then you can ...

(AI_EN_LECTOR_MISSING_DETERMINER_A)


[uncategorized] ~15-~15: You might be missing the article “the” here.
Context: ...ur console by passing size parameter to base class. Then you can use UITest to inte...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

src/Consolonia.Gallery/App.cs (2)

6-6: Import statement necessary for theme usage

The addition of using Consolonia.Themes; is required to access the MaterialTheme class utilized in the application.


10-10: Ensure correct initialization with generic application class

By inheriting from ConsoloniaApplication<ControlsListView>, the application delegates the main window initialization to the generic base class. Verify that ControlsListView is the intended main window for the application and that all necessary initialization logic is appropriately managed by the base class.

src/Tests/Consolonia.Gallery.Tests/Base/GalleryTestsBaseBase.cs (1)

12-12: Confirm intention to make GalleryTestsBaseBase non-abstract

The GalleryTestsBaseBase class is now declared as internal instead of internal abstract, allowing it to be instantiated. If the class is not meant to be instantiated directly and is intended to serve solely as a base class for other tests, consider keeping it abstract to prevent direct instantiation.

src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs (1)

1-1: Necessary imports added for new functionality

The addition of using System; and using Avalonia.Controls.ApplicationLifetimes; is required for implementing the generic application class and managing application lifetimes.

Also applies to: 4-4

src/Consolonia.Themes.TurboVision/Themes/MaterialTheme.cs Outdated Show resolved Hide resolved
src/Consolonia.Designer/README.md Outdated Show resolved Hide resolved
src/Consolonia.Themes.TurboVision/README.md Outdated Show resolved Hide resolved
src/Consolonia.Core/README.md Outdated Show resolved Hide resolved
@tomlm tomlm marked this pull request as draft December 5, 2024 19:01
tomlm and others added 3 commits December 5, 2024 11:03
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.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: 1

🧹 Outside diff range and nitpick comments (1)
src/Consolonia.Gallery/View/ControlsListView.axaml.cs (1)

95-123: Refactor theme change event handlers to reduce code duplication

The methods MaterialTheme_Click, FluentTheme_Click, TurboVisionTheme_Click, etc., contain duplicated code patterns. Consider refactoring these methods into a single method to improve maintainability and reduce redundancy.

For example, you could create a method that accepts the selected theme as a parameter:

private void ChangeTheme(Themes theme, Styles style)
{
    Model.SelectedTheme = theme;
    this.Styles[0] = style;
}

And update the event handlers:

private void MaterialTheme_Click(object sender, Avalonia.Interactivity.RoutedEventArgs e)
{
    ChangeTheme(Themes.Material, new MaterialTheme());
}

// Repeat for other themes
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 135fd58 and 3756fec.

📒 Files selected for processing (7)
  • src/Consolonia.Gallery/App.cs (1 hunks)
  • src/Consolonia.Gallery/Gallery/GalleryViews/GalleryMenu.axaml (1 hunks)
  • src/Consolonia.Gallery/View/ControlsListView.axaml (1 hunks)
  • src/Consolonia.Gallery/View/ControlsListView.axaml.cs (4 hunks)
  • src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj (1 hunks)
  • src/Example/App.cs (1 hunks)
  • src/Tools/Consolonia.PreviewHost/App.cs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Example/App.cs
  • src/Consolonia.Themes.TurboVision/Consolonia.Themes.TurboVision.csproj
🔇 Additional comments (4)
src/Consolonia.Gallery/App.cs (1)

10-10: Ensure application initialization is consistent with new inheritance

The App class now inherits from ConsoloniaApplication<ControlsListView>, and the OnFrameworkInitializationCompleted method has been removed. Verify that the application initializes correctly and that the main window is properly set to ControlsListView as expected.

src/Consolonia.Gallery/View/ControlsListView.axaml (1)

13-24: LGTM!

The addition of the menu for theme selection is well-implemented, and the bindings correspond correctly with the ViewModel properties.

src/Tools/Consolonia.PreviewHost/App.cs (1)

6-6: Verify application components initialize correctly without InitializeComponent()

The InitializeComponent() method, which loads XAML components, has been removed from the constructor. Ensure that all necessary components, styles, and resources are properly initialized when the application starts, and that there are no runtime issues due to this change.

Also applies to: 20-20

src/Consolonia.Gallery/Gallery/GalleryViews/GalleryMenu.axaml (1)

40-42: Verify the use of IsChecked with ToggleType="None"

The MenuItem with ToggleType="None" has IsChecked="True". Since ToggleType="None" indicates that the menu item is neither checkable nor radio, the IsChecked property may have no effect. Confirm that this is intended and that the menu item behaves as expected.

src/Consolonia.Gallery/View/ControlsListView.axaml.cs Outdated Show resolved Hide resolved
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: 6

🧹 Outside diff range and nitpick comments (5)
src/Consolonia.Core/README.md (3)

1-8: Consider adding version and prerequisites information.

The introduction provides a good overview, but consider adding:

  • Supported .NET versions
  • Prerequisites for development
  • Link to full documentation

9-10: Consider using relative path for the showcase image.

The image URL points to a user-content URL which might not be permanent. Consider:

  1. Including the image in the repository
  2. Using a relative path to reference it

59-61: Consider expanding the requirements section.

The notes section could be more prominent and detailed:

  1. Move it higher in the document, possibly after the Background section
  2. Add version requirements for each package
  3. Explain why each package is needed
  4. Add links to the package repositories or documentation
src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs (1)

65-75: Consider documenting migration path for existing applications

This new generic application class introduces a structured way to initialize windows, which is good. However, since this is a core infrastructure change, consider:

  1. Documenting the migration path for existing applications
  2. Adding XML documentation comments to explain the purpose and usage of this class
  3. Creating examples of proper usage in the README
src/Consolonia.Gallery/View/ControlsListView.axaml.cs (1)

Line range hint 1-1: Enable nullable reference type annotations

The code uses nullable reference type annotations but the nullable context is not enabled.

Add the following directive at the top of the file:

+ #nullable enable
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 3756fec and 2e25cad.

📒 Files selected for processing (5)
  • src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs (2 hunks)
  • src/Consolonia.Core/README.md (1 hunks)
  • src/Consolonia.Designer/Consolonia.Designer.csproj (2 hunks)
  • src/Consolonia.Gallery/View/ControlsListView.axaml (1 hunks)
  • src/Consolonia.Gallery/View/ControlsListView.axaml.cs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Consolonia.Gallery/View/ControlsListView.axaml
  • src/Consolonia.Designer/Consolonia.Designer.csproj
🧰 Additional context used
🪛 GitHub Check: build
src/Consolonia.Gallery/View/ControlsListView.axaml.cs

[warning] 95-95:
The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.


[warning] 95-95:
The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.


[warning] 95-95:
The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

🔇 Additional comments (4)
src/Consolonia.Core/README.md (1)

17-23: LGTM! The XAML syntax is correct.

The window definition example is clear and follows proper XAML syntax.

src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs (2)

4-4: LGTM: Required using directive added

The added using directive is necessary for the IClassicDesktopStyleApplicationLifetime type and is correctly placed.


65-66: LGTM: Constraints implemented as suggested

The new() constraint has been correctly added alongside the Window constraint, ensuring type safety at compile-time.

src/Consolonia.Gallery/View/ControlsListView.axaml.cs (1)

7-24: LGTM: Clean enum definition with proper imports

The imports and enum definition are well-organized and follow C# naming conventions.

src/Consolonia.Core/README.md Outdated Show resolved Hide resolved
src/Consolonia.Gallery/View/ControlsListView.axaml.cs Outdated Show resolved Hide resolved
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
Copy link
Owner

Choose a reason for hiding this comment

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

Can we extract repeated things to somewhere? Would be nice to re-use same things in different workflows

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have no idea. I created these a long time ago and I just keep copy-pasta'ing them everywhere because they work! :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can we do this for a later checkin? I want to work more in themes area and this delta renamed everything...

@jinek
Copy link
Owner

jinek commented Dec 5, 2024

Just small clarification. Directory.Build.props is automatically included to all projects. Directory.Core.Build.props must be included manually to projects where needed.

foo.cmd Outdated Show resolved Hide resolved
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: 1

🧹 Outside diff range and nitpick comments (2)
Directory.Build.props (1)

Line range hint 3-3: Consider addressing the mono TODO before publishing

There's an existing TODO comment about adding mono support. Since this PR is preparing for package publishing, it might be worth addressing cross-platform support requirements first.

Would you like me to help create an issue to track the mono support requirement?

src/Consolonia.Themes/Fluent/FluentTheme.axaml (1)

5-7: Consider removing empty Design.PreviewWith section.

The empty Design.PreviewWith section doesn't serve any purpose and could be removed to improve code cleanliness.

-    <Design.PreviewWith>
-
-    </Design.PreviewWith>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2df0c54 and fec0387.

📒 Files selected for processing (19)
  • Directory.Build.props (1 hunks)
  • src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs (2 hunks)
  • src/Consolonia.Designer/Consolonia.Designer.csproj (2 hunks)
  • src/Consolonia.Gallery/Program.cs (0 hunks)
  • src/Consolonia.Gallery/View/ControlsListView.axaml.cs (4 hunks)
  • src/Consolonia.NUnit/Consolonia.NUnit.csproj (1 hunks)
  • src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj (1 hunks)
  • src/Consolonia.Themes/Fluent/FluentTheme.axaml (1 hunks)
  • src/Consolonia.Themes/FluentTheme.cs (1 hunks)
  • src/Consolonia.Themes/Material/MaterialTheme.axaml (1 hunks)
  • src/Consolonia.Themes/MaterialTheme.cs (1 hunks)
  • src/Consolonia.Themes/TurboVisionBlack/Controls/Button.axaml (1 hunks)
  • src/Consolonia.Themes/TurboVisionBlack/TurboVisionBlackTheme.axaml (1 hunks)
  • src/Consolonia.Themes/TurboVisionBlackTheme.cs (1 hunks)
  • src/Consolonia.Themes/TurboVisionDark/TurboVisionDarkTheme.axaml (1 hunks)
  • src/Consolonia.Themes/TurboVisionDarkTheme.cs (1 hunks)
  • src/Consolonia.Themes/TurboVisionTheme.cs (1 hunks)
  • src/Consolonia/Consolonia.csproj (1 hunks)
  • src/Tools/Consolonia.PreviewHost/Consolonia.PreviewHost.csproj (1 hunks)
💤 Files with no reviewable changes (1)
  • src/Consolonia.Gallery/Program.cs
✅ Files skipped from review due to trivial changes (3)
  • src/Consolonia.Themes/FluentTheme.cs
  • src/Consolonia.Themes/MaterialTheme.cs
  • src/Consolonia.Themes/TurboVisionBlackTheme.cs
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/Consolonia.NUnit/Consolonia.NUnit.csproj
  • src/Consolonia.Core/Infrastructure/ConsoloniaApplication.cs
  • src/Consolonia/Consolonia.csproj
  • src/Consolonia.Designer/Consolonia.Designer.csproj
  • src/Tools/Consolonia.PreviewHost/Consolonia.PreviewHost.csproj
  • src/Consolonia.PlatformSupport/Consolonia.PlatformSupport.csproj
  • src/Consolonia.Gallery/View/ControlsListView.axaml.cs
🧰 Additional context used
📓 Learnings (3)
src/Consolonia.Themes/TurboVisionDarkTheme.cs (1)
Learnt from: tomlm
PR: jinek/Consolonia#122
File: src/Consolonia.Themes.TurboVision/Themes/TurboVisionDark/TurboVisionDarkColors.axaml:5-28
Timestamp: 2024-11-12T04:11:38.190Z
Learning: In the project, using `Mode="Shaded"` in `ConsoleBrush` within theme files is intentional and does not cause runtime issues.
src/Consolonia.Themes/TurboVisionDark/TurboVisionDarkTheme.axaml (1)
Learnt from: tomlm
PR: jinek/Consolonia#122
File: src/Consolonia.Themes.TurboVision/Themes/TurboVisionDark/TurboVisionDarkColors.axaml:5-28
Timestamp: 2024-11-12T04:11:38.190Z
Learning: In the project, using `Mode="Shaded"` in `ConsoleBrush` within theme files is intentional and does not cause runtime issues.
src/Consolonia.Themes/TurboVisionBlack/TurboVisionBlackTheme.axaml (1)
Learnt from: tomlm
PR: jinek/Consolonia#122
File: src/Consolonia.Themes.TurboVision/Themes/TurboVisionDark/TurboVisionDarkColors.axaml:5-28
Timestamp: 2024-11-12T04:11:38.190Z
Learning: In the project, using `Mode="Shaded"` in `ConsoleBrush` within theme files is intentional and does not cause runtime issues.
🔇 Additional comments (13)
src/Consolonia.Themes/TurboVisionBlack/Controls/Button.axaml (2)

3-3: LGTM: Namespace consolidation aligns with PR objectives.

The namespace change from Consolonia.Themes.TurboVision.Templates.Controls.Helpers to Consolonia.Themes.Templates.Controls.Helpers reflects the intended consolidation of components mentioned in the PR objectives.


3-3: Verify assembly reference updates across the codebase.

The assembly reference has changed from Consolonia.Themes.TurboVision to Consolonia.Themes. Let's verify that all related references have been updated consistently.

✅ Verification successful

Based on the analysis of the XAML files, I can now generate the final response:

Assembly reference update is consistent across the codebase

The change from Consolonia.Themes.TurboVision to Consolonia.Themes is consistent. All helper namespace references in the XAML files are correctly using clr-namespace:Consolonia.Themes.Templates.Controls.Helpers;assembly=Consolonia.Themes. No instances of the old assembly reference were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining references to the old assembly name
# and verify the new assembly reference is used consistently.

echo "Checking for old assembly references..."
rg -l "assembly=Consolonia\.Themes\.TurboVision" --type xml

echo "Verifying new assembly references..."
rg -l "assembly=Consolonia\.Themes" --type xml

echo "Checking for any potential missed helper namespace references..."
rg -l "Consolonia\.Themes\.TurboVision\.Templates\.Controls\.Helpers" --type xml

Length of output: 951


Script:

#!/bin/bash
# Let's first find all XAML files in the repository
echo "Finding all XAML files..."
fd -e axaml -e xaml

# Then let's check for assembly references in these files
echo -e "\nChecking assembly references in XAML files..."
fd -e axaml -e xaml -x cat {} \; -x echo -e "\n---\n"

Length of output: 67376

Directory.Build.props (2)

12-12: Verify Icon.png existence and format

The PackageIcon property has been added, which aligns with the PR objectives.

Let's verify the icon file:

✅ Verification successful

Icon files are present and properly tracked

The verification confirms that:

  • Both Icon.png (10KB) and Icon.ico (107KB) exist in the root directory
  • Both files are properly tracked in git
  • The files have appropriate read permissions
  • The Icon.png referenced in PackageIcon property is present at the correct location
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify icon file existence and format

# Check if Icon.png exists in the expected location
if [ -f "Icon.png" ]; then
    file Icon.png
    echo "Icon exists in root"
fi

# Check for any other icon files that might conflict
fd -e png -e ico --type f icon -i

Length of output: 235


Script:

#!/bin/bash
# Let's verify the size and basic properties of the icon files
ls -l Icon.png Icon.ico

# Check if the PNG file is a valid image by looking at its header bytes
hexdump -n 8 -C Icon.png

# Check if these icons are tracked in git
git ls-files Icon.png Icon.ico

Length of output: 321


8-8: Verify version bump impact

The version change to 11.2.1 aligns with Avalonia's version, which is good. However, this appears to be a significant version bump from 11.0.9.

Let's verify the changelog and dependency changes:

Also applies to: 16-16

✅ Verification successful

Version update is aligned with dependencies

The version bump to 11.2.1 is consistent throughout the codebase:

  • The VersionPrefix and AvaloniaVersion are both set to 11.2.1 in Directory.Build.props
  • All project files reference Avalonia packages using the $(AvaloniaVersion) variable
  • The version change ensures alignment with the Avalonia framework version

This is a coordinated version update that maintains consistency across the solution and its Avalonia dependencies. No breaking changes or version mismatches were found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for breaking changes in version history and dependency updates

# Check git history for breaking changes
git log --oneline | grep -i "break"

# Look for version references in solution
rg "11\.0\.9|11\.2\.1" --type xml

Length of output: 184


Script:

#!/bin/bash
# Let's try a more comprehensive search for version-related changes

# Search for any version references in XML files
fd -e props -e csproj | xargs cat

# Check recent commits for version-related changes
git log -n 20 --oneline

# Look for CHANGELOG or similar files
fd -i changelog

Length of output: 13439

src/Consolonia.Themes/TurboVisionTheme.cs (1)

5-5: Verify namespace change impact across the codebase

The namespace has been simplified from Consolonia.Themes.TurboVision.Templates to Consolonia.Themes. While this aligns with the PR's consolidation goals, we should verify all references to this theme are updated.

✅ Verification successful

Namespace change is consistent with other themes and properly referenced

The namespace simplification from Consolonia.Themes.TurboVision.Templates to Consolonia.Themes is correct as:

  • All other theme implementations (FluentTheme, MaterialTheme, etc.) are in the same Consolonia.Themes namespace
  • All references to TurboVisionTheme in the codebase are either commented out or using the correct namespace
  • The theme is properly referenced in ControlsListView.axaml.cs and template files
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to the old namespace
rg "Consolonia\.Themes\.TurboVision\.Templates" 

# Search for references to TurboVisionTheme to ensure they're using the new namespace
rg "using.*Consolonia\.Themes.*TurboVisionTheme"

Length of output: 100


Script:

#!/bin/bash
# Let's try a broader search to find any references to TurboVisionTheme
rg "TurboVisionTheme" -A 2

# Also search for any files that might be using this theme
fd ".*\.cs$" --exec grep -l "TurboVisionTheme"

# Check if there are any other theme implementations to understand the namespace pattern
fd "Theme\.cs$"

Length of output: 2616

src/Consolonia.Themes/TurboVisionDarkTheme.cs (1)

5-5: LGTM! Namespace change aligns with project restructuring

The namespace simplification is consistent with the changes in TurboVisionTheme.cs and aligns with the PR's goal of consolidating packages.

src/Consolonia.Themes/TurboVisionBlack/TurboVisionBlackTheme.axaml (2)

3-3: LGTM! Class declaration update aligns with namespace restructuring

The simplified class declaration is consistent with the namespace consolidation effort across the theme files.


7-7: Verify resource paths after prefix removal

The paths have been simplified by removing the redundant Themes/TurboVisionBlack prefix. Let's verify these resources exist at the new locations.

Also applies to: 12-12

✅ Verification successful

Resource paths are correctly referenced after prefix removal

The verification confirms that:

  • TurboVisionBlackColors.axaml exists at the correct location in src/Consolonia.Themes/TurboVisionBlack/
  • No other theme files are using the old path pattern with /Themes/TurboVisionBlack/ prefix

The simplified paths in the resource includes are valid and consistent with the actual file structure.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the referenced resource files exist
fd -e axaml "TurboVisionBlackColors.axaml|Button.axaml" src/Consolonia.Themes/TurboVisionBlack

# Verify no other theme files still use the old path pattern
rg "/Themes/TurboVisionBlack/" -g "*.axaml"

Length of output: 269

src/Consolonia.Themes/Material/MaterialTheme.axaml (2)

7-7: Verify resource resolution for simplified paths.

Resource paths have been simplified:

  • /Material/MaterialColors.axaml
  • /TurboVisionBlack/Controls/Button.axaml

While this improves maintainability, we should verify the resource resolution still works correctly.

Also applies to: 13-13

✅ Verification successful

Let me verify the resource resolution by checking the actual content and references in these files.


Resource paths are correctly resolved and functional

The simplified paths are working correctly as:

  • /Material/MaterialColors.axaml resolves to the file in the same directory, which exists and contains valid resource definitions
  • /TurboVisionBlack/Controls/Button.axaml exists at the correct location with valid style definitions

Both files are properly structured XAML resources that can be included in the theme. The simplified paths are relative to the themes root and maintain correct resolution.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the referenced files exist at the new locations
fd -e axaml "MaterialColors.axaml|Button.axaml" --full-path

Length of output: 667


Script:

#!/bin/bash
# Check the content of MaterialTheme.axaml to see all resource includes
cat "src/Consolonia.Themes/Material/MaterialTheme.axaml"

# Check if MaterialColors.axaml exists in the same directory
cat "src/Consolonia.Themes/Material/MaterialColors.axaml"

# Check if Button.axaml exists in TurboVisionBlack
cat "src/Consolonia.Themes/TurboVisionBlack/Controls/Button.axaml"

Length of output: 3405


3-3: Verify namespace change impact across the codebase.

The namespace has been simplified from Consolonia.Themes.TurboVision.Themes.Material.MaterialTheme to Consolonia.Themes.MaterialTheme. While this improves clarity, we should ensure all references are updated.

✅ Verification successful

Namespace change is correctly implemented across the codebase

The namespace simplification from Consolonia.Themes.TurboVision.Themes.Material.MaterialTheme to Consolonia.Themes.MaterialTheme is properly reflected throughout the codebase. All references to MaterialTheme use the new simplified namespace, and there are no lingering references to the old namespace structure. The change appears to be part of a clean namespace reorganization.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to the old namespace
rg "Consolonia\.Themes\.TurboVision\.Themes\.Material\.MaterialTheme" -t cs -t xaml

Length of output: 114


Script:

#!/bin/bash
# Search for any remaining references to the old namespace pattern, without file type restrictions
rg "Consolonia\.Themes\.TurboVision\.Themes\.Material\.MaterialTheme"

# Also search for references to the new namespace to verify the change
rg "Consolonia\.Themes\.MaterialTheme"

# List all .axaml files to understand the theme structure
fd "\.axaml$"

Length of output: 5581


Script:

#!/bin/bash
# Search for any references to MaterialTheme in C# files
rg "MaterialTheme" -t cs

# Check for any theme-related using statements or references in C# files
rg "using.*Consolonia\.Themes" -t cs

Length of output: 928

src/Consolonia.Themes/Fluent/FluentTheme.axaml (1)

3-3: LGTM! Consistent with MaterialTheme changes.

The namespace simplification and path modifications follow the same pattern as MaterialTheme.axaml, maintaining consistency across theme files.

Also applies to: 10-10, 16-16

src/Consolonia.Themes/TurboVisionDark/TurboVisionDarkTheme.axaml (2)

13-14: LGTM! Consistent path structure for control styles.

The paths for Button.axaml and DialogWindow.axaml follow the established pattern, maintaining consistency with other theme files.


7-7: Verify the use of MergeResourceInclude vs ResourceInclude.

This file uses MergeResourceInclude while other theme files use ResourceInclude. Please verify if this difference is intentional and necessary.

✅ Verification successful

Based on the output, I can now generate the final response as the verification is complete. The shell script results show that MergeResourceInclude is consistently used across different theme files when including color resources within ResourceDictionary.MergedDictionaries. Here are the relevant examples from the output:

  • TurboVisionBlackTheme.axaml: <MergeResourceInclude Source="/TurboVisionBlack/TurboVisionBlackColors.axaml" />
  • TurboVisionDarkTheme.axaml: <MergeResourceInclude Source="/TurboVisionDark/TurboVisionDarkColors.axaml" />
  • TurboVisionTheme.axaml: <MergeResourceInclude Source="/Templates/TurboVisionDefaultColors.axaml" />

The use of MergeResourceInclude is correct and consistent with other theme files.

The codebase shows a clear pattern where MergeResourceInclude is used specifically for merging color resources within ResourceDictionary.MergedDictionaries, while StyleInclude (not ResourceInclude) is used for including control styles.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check usage patterns of different resource include types
rg -A 1 "<(Resource|MergeResource)Include" -t xaml

Length of output: 81


Script:

#!/bin/bash
# Search for files with .axaml extension and then look for resource include patterns
fd -e axaml -x rg -l "(Resource|MergeResource)Include"

# Then get the content of these files to analyze the usage
fd -e axaml -x cat {} \;

Length of output: 67838

Directory.Build.props Show resolved Hide resolved
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

🧹 Outside diff range and nitpick comments (3)
src/Consolonia.Gallery/Gallery/GalleryViews/GalleryButton.axaml (1)

17-17: Consider using theme resources instead of hard-coded colors

While the high-contrast combination of dark blue and yellow is visible, consider:

  1. Using theme resources to maintain consistency and support theme switching:
-<Button Background="DarkBlue" Foreground="Yellow">Custom Colors</Button>
+<Button Background="{DynamicResource SystemAccentColorDark1}" 
+        Foreground="{DynamicResource SystemAccentColorLight1}">Custom Colors</Button>
  1. Ensuring the color contrast meets accessibility standards for all users.
src/Consolonia/Assembly.cs (1)

6-6: Address CLS compliance decision before publishing

Given that this PR prepares the packages for publishing to NuGet, CLS compliance is an important consideration. CLS compliance ensures your library can be consumed from any .NET language, but it comes with some restrictions:

  • No unsigned types (byte, ushort, uint, ulong)
  • No unsafe code or pointers
  • No overloaded operators
  • No non-CLS compliant types in public APIs

Consider the following factors for your decision:

  1. If your library needs to be consumed from other .NET languages (F#, VB.NET), enable CLS compliance
  2. If you use unsigned types or operator overloading in public APIs, you may need to disable it
  3. If you're unsure, run a static analyzer to check for CLS compliance violations before making the decision

Would you like me to help analyze the codebase for potential CLS compliance violations?

src/Consolonia.Themes/Fluent/FluentColors.axaml (1)

13-18: Consider consolidating duplicate Communication Blue definitions

Both ThemeChooserBackgroundBrush and ThemeActionBackgroundBrush use the same Communication Blue color (#0078D4). Consider creating a base color resource that both can reference to improve maintainability.

Example refactor:

+ <!-- Fluent: Communication Blue Base -->
+ <drawing:ConsoleBrush x:Key="ThemeCommunicationBlueBrush" Color="#0078D4" />

- <!-- Fluent: Communication Blue -->
  <drawing:ConsoleBrush x:Key="ThemeChooserBackgroundBrush"
-                       Color="#0078D4" />
+                       Color="{StaticResource ThemeCommunicationBlueBrush}" />

- <!-- Fluent: Communication Blue -->
  <drawing:ConsoleBrush x:Key="ThemeActionBackgroundBrush"
-                       Color="#0078D4" />
+                       Color="{StaticResource ThemeCommunicationBlueBrush}" />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fec0387 and 0f597fe.

📒 Files selected for processing (4)
  • src/Consolonia.Gallery/Gallery/GalleryViews/GalleryButton.axaml (1 hunks)
  • src/Consolonia.Themes/Fluent/FluentColors.axaml (1 hunks)
  • src/Consolonia.Themes/Fluent/FluentTheme.axaml (1 hunks)
  • src/Consolonia/Assembly.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Consolonia.Themes/Fluent/FluentTheme.axaml
🔇 Additional comments (3)
src/Consolonia/Assembly.cs (1)

1-4: LGTM! Test assembly access is properly configured.

The InternalsVisibleTo attribute is correctly set up to allow test access to internal members.

src/Consolonia.Themes/Fluent/FluentColors.axaml (2)

7-44: Well-structured color scheme implementation

The color definitions follow Fluent Design guidelines with clear documentation and appropriate usage of transparency where needed. The organization of colors by their semantic meaning (e.g., error, warning, borders) makes the theme maintainable and consistent.


3-5: Verify the FontSizeNormal value

A font size value of 1 seems unusually small. Please confirm if this is intentional or if it should be using a different scale.

Let's check how this value is used across the codebase:

✅ Verification successful

Based on the evidence gathered, I can now provide a final response:

FontSizeNormal=1 is the correct value for this console-based UI framework

The value of 1 for FontSizeNormal is intentional and correct. This is a console-based UI framework where text rendering is done using console characters, and the font size of 1 represents the base unit for console character cells. This is evident from:

  1. The DrawingContextImplTests which shows text being rendered in console character cells with unit-based positioning
  2. The FontManagerImpl which implements a console-specific font system
  3. The consistent usage of FontSizeNormal=1 across all theme files (Fluent, Material, TurboVision)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for FontSizeNormal usage to understand the context
rg -l "FontSizeNormal" 

# Search for other font size resources to compare scales
ast-grep --pattern 'FontSize[A-Za-z]*'

Length of output: 414


Script:

#!/bin/bash
# Let's check the actual usage of FontSizeNormal in these files
rg "FontSizeNormal" -B2 -A2

# Let's also check if there are any scaling or multiplication of this value
rg "FontSize.*\*" 

Length of output: 3651


Script:

#!/bin/bash
# Let's check the Window control template for any font size scaling or transformations
cat "src/Consolonia.Themes/Templates/Controls/Window.axaml"

# Let's also check if there are any font-related utilities or scaling factors
rg -l "Font" --type cs

Length of output: 3335


Script:

#!/bin/bash
# Let's check the font-related implementation in Core to understand the scaling
cat "src/Consolonia.Core/Text/FontManagerImpl.cs"

# Also check if there are any font-related tests that might reveal the expected behavior
cat "src/Tests/Consolonia.Core.Tests/DrawingContextImplTests.cs"

Length of output: 28772

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

🧹 Outside diff range and nitpick comments (1)
src/Tests/Consolonia.Gallery.Tests/ButtonTests.cs (1)

Line range hint 13-24: Consider enhancing test coverage for custom button properties.

The test verifies the presence of the "Custom" button but doesn't validate its visual properties (DarkBlue background and Yellow foreground).

Consider adding assertions to verify the button's custom colors:

 public async Task PerformSingleTest()
 {
     await UITest.KeyInput(Key.Tab);
     await UITest.KeyInput(Key.Enter);
     await UITest.AssertHasText("Standard _?XAML Button",
         "Custom",
         "Disabled",
         "Toggle Button",
         "IsTabStop=False");
+    // Verify custom button properties
+    var customButton = await UITest.FindControl<Button>("CustomButton");
+    Assert.That(customButton.Background.ToString(), Is.EqualTo("DarkBlue"));
+    Assert.That(customButton.Foreground.ToString(), Is.EqualTo("Yellow"));
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0f597fe and 5f9eda2.

📒 Files selected for processing (1)
  • src/Tests/Consolonia.Gallery.Tests/ButtonTests.cs (1 hunks)
🔇 Additional comments (1)
src/Tests/Consolonia.Gallery.Tests/ButtonTests.cs (1)

18-18: LGTM! Text assertion updated to match UI changes.

The change correctly reflects the replacement of the "Foreground" button with "Custom" in the UI.

tomlm and others added 3 commits December 5, 2024 17:35
Co-authored-by:  <+@users.noreply.github.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

🧹 Outside diff range and nitpick comments (1)
src/Tools/Consolonia.PreviewHost/App.cs (1)

Line range hint 89-122: Remove or document the commented-out event handlers

There's a significant block of commented-out code containing window event handlers with important cleanup logic for file watchers. If this code is:

  • No longer needed: Remove it entirely
  • For future use: Move it to a separate branch or issue
  • Still relevant: Uncomment and integrate it properly

This will improve code maintainability and prevent confusion for other developers.

Would you like me to help create an issue to track the proper handling of this code?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 09da113 and a30d316.

📒 Files selected for processing (5)
  • Directory.Build.props (1 hunks)
  • src/Consolonia.Designer/ConsolePreview.cs (2 hunks)
  • src/Consolonia.Designer/Extensions.cs (2 hunks)
  • src/Consolonia.Themes/Fluent/FluentColors.axaml (1 hunks)
  • src/Tools/Consolonia.PreviewHost/App.cs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/Consolonia.Designer/Extensions.cs
  • src/Consolonia.Themes/Fluent/FluentColors.axaml
  • src/Consolonia.Designer/ConsolePreview.cs
  • Directory.Build.props
🔇 Additional comments (2)
src/Tools/Consolonia.PreviewHost/App.cs (2)

6-6: LGTM: Import changes align with the new theming approach

The addition of Consolonia.Themes import and removal of Avalonia.Markup.Xaml aligns well with the transition from XAML-based initialization to programmatic theming.


20-20: Verify the impact of removing XAML-based initialization

The transition to programmatic theming looks good, but let's verify:

  1. That no XAML-based theme configurations are being used elsewhere
  2. That MaterialTheme is the intended default theme for all use cases
✅ Verification successful

MaterialTheme is consistently used as the default theme, and XAML initialization is properly maintained

The verification shows that:

  1. MaterialTheme is consistently used as the default theme across multiple files (src/Tools/Consolonia.PreviewHost/App.cs, src/Consolonia.Gallery/View/ControlsListView.axaml.cs, src/Example/App.cs)
  2. The removal of InitializeComponent() from App.cs is safe because:
    • App.cs typically handles theme initialization separately from XAML
    • All UI components (windows, controls) still maintain their InitializeComponent() calls
    • The XAML-based theme configurations in .axaml files are properly structured with theme resources and styles
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any XAML theme configurations that might be affected

# Look for any .axaml or .xaml files that might contain theme configurations
rg -t xaml "Theme|Style|ResourceDictionary" 

# Check for any programmatic theme usage in other files
ast-grep --pattern 'new MaterialTheme()'

Length of output: 493


Script:

#!/bin/bash
# Let's check for .axaml files first since rg didn't recognize xaml extension
fd -e axaml -x cat {} \; | grep -i "Theme\|Style\|ResourceDictionary"

# Also check for any other theme types being used
ast-grep --pattern 'new $_Theme()'

# Let's also check if there are any XAML-related initialization calls
ast-grep --pattern 'InitializeComponent()'

Length of output: 50200

@tomlm tomlm marked this pull request as ready for review December 6, 2024 04:58
@tomlm tomlm enabled auto-merge (squash) December 6, 2024 04:59
@jinek jinek linked an issue Dec 6, 2024 that may be closed by this pull request
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

🧹 Outside diff range and nitpick comments (4)
src/Experimental/Consolonia.Designer/Extensions.cs (1)

Line range hint 9-19: Complete the incomplete documentation note

The XML documentation has an unfinished note about package references:

NOTE: The package references for

Please complete this documentation to provide clear guidance about package dependencies.

src/Experimental/Consolonia.Designer/ConsolePreview.cs (3)

42-44: Consider making the typeface configurable.

While "Cascadia Mono" is a good default choice, consider making it configurable to support different environments and user preferences.

-        private readonly Typeface _typeface = new("Cascadia Mono");
+        private static readonly string DefaultTypeface = "Cascadia Mono";
+        public static readonly StyledProperty<string> TypefaceProperty =
+            AvaloniaProperty.Register<ConsolePreview, string>(nameof(Typeface), DefaultTypeface);
+        private Typeface _typeface => new(GetValue(TypefaceProperty));

Line range hint 234-267: Address potential race condition in ListenForChanges.

The async loop in ListenForChanges might continue after disposal. Consider using a cancellation token to properly handle shutdown.

-        private void ListenForChanges()
+        private CancellationTokenSource? _listenCancellation;
+        private void ListenForChanges()
         {
+            _listenCancellation?.Cancel();
+            _listenCancellation = new CancellationTokenSource();
+            var token = _listenCancellation.Token;
             Task.Run(async () =>
             {
                 while (true)
                 {
+                    if (token.IsCancellationRequested)
+                        return;
                     if (_process == null || _process.HasExited)
                         return;

                     string? line = await _process!.StandardOutput.ReadLineAsync().ConfigureAwait(false);
                     if (string.IsNullOrEmpty(line)) continue;

Also update the Dispose method:

                     if (disposing)
                     {
-                        // TODO: dispose managed state (managed objects)
+                        _listenCancellation?.Cancel();
+                        _listenCancellation?.Dispose();
+                        _listenCancellation = null;

Line range hint 255-267: Improve error handling in ListenForChanges.

The catch block for JsonException should log more details about the error and notify the UI about the failure.

                     catch (JsonException ex)
                     {
-                        // process was probably shut down, we continue to check the proces.
-                        Debug.WriteLine($"Error deserializing pixel buffer: {ex.Message}");
+                        Debug.WriteLine($"Error deserializing pixel buffer: {ex}");
+                        Dispatcher.UIThread.Invoke(() => 
+                            Content = new TextBlock 
+                            { 
+                                Text = $"Preview error: {ex.Message}", 
+                                Foreground = Brushes.Red 
+                            });
                         if (_process == null) continue;
                         if (!_process.HasExited) _process.Kill();
                         _process.Dispose();
                         _process = null;
                         return;
                     }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0ae607d and 56652c7.

⛔ Files ignored due to path filters (1)
  • src/Experimental/Avalonia.PreviewHost/Assets/consolonia-logo.ico is excluded by !**/*.ico
📒 Files selected for processing (7)
  • src/Consolonia.Gallery/Consolonia.Gallery.csproj (1 hunks)
  • src/Consolonia.sln (4 hunks)
  • src/Experimental/Avalonia.PreviewHost/Avalonia.PreviewHost.csproj (2 hunks)
  • src/Experimental/Consolonia.Designer/ConsolePreview.cs (2 hunks)
  • src/Experimental/Consolonia.Designer/Consolonia.Designer.csproj (2 hunks)
  • src/Experimental/Consolonia.Designer/Extensions.cs (2 hunks)
  • src/Experimental/Consolonia.Designer/README.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/Experimental/Consolonia.Designer/README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Consolonia.Gallery/Consolonia.Gallery.csproj
  • src/Consolonia.sln
🧰 Additional context used
📓 Learnings (1)
src/Experimental/Consolonia.Designer/ConsolePreview.cs (1)
Learnt from: tomlm
PR: jinek/Consolonia#150
File: src/Consolonia.Designer/Consolonia.Designer.csproj:14-15
Timestamp: 2024-11-19T07:19:33.261Z
Learning: In the Consolonia project, circular dependencies between `Consolonia.Designer` and `Consolonia.PreviewHost` are intentional and by design. The `ConsolePreview` control consumes `Consolonia.PreviewHost`, and `Avalonia.PreviewHost` consumes `ConsolePreview` control in the designer.
🔇 Additional comments (9)
src/Experimental/Consolonia.Designer/Extensions.cs (1)

4-5: Verify namespace change impact

The namespace has been changed from Consolonia.Designer to Consolonia. While this aligns with the package consolidation objective, we should verify all references are updated.

✅ Verification successful

Let me verify if these references are properly handled by checking the changes in the PR.


Let me check if there are any other files in the PR that might be affected by this namespace change.


Let me check the content of the other files in the Designer directory to verify if they are also being updated with the new namespace.


Based on the analysis, I can now provide the final response:

Namespace change is properly managed

The namespace change from Consolonia.Designer to Consolonia appears in Extensions.cs with a deliberate // ReSharper disable CheckNamespace directive. The remaining references to Consolonia.Designer are correctly maintained:

  • In ConsolePreview.cs where the type is defined
  • In App.axaml.cs which uses the ConsolePreview type
  • In Assembly.cs of Core project which declares internal visibility

The namespace change is intentionally limited to the Extensions class to make it more accessible while preserving the original namespace for other components.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to the old namespace
rg "Consolonia\.Designer" --type cs

Length of output: 286


Script:

#!/bin/bash
# Check the content of ConsolePreview.cs to see if it's also being updated
cat src/Experimental/Consolonia.Designer/ConsolePreview.cs

# Check App.axaml.cs to see how the Designer type is used
cat src/Experimental/Avalonia.PreviewHost/App.axaml.cs

Length of output: 17739


Script:

#!/bin/bash
# Get the list of changed files in the PR
git diff --name-only

# Check if there are any other files in the Designer directory
fd . src/Experimental/Consolonia.Designer/

Length of output: 333


Script:

#!/bin/bash
# Check the content of Assembly.cs
cat src/Experimental/Consolonia.Designer/Assembly.cs

# Check if Extensions.cs has any other content beyond the namespace declaration
cat src/Experimental/Consolonia.Designer/Extensions.cs

Length of output: 1249

src/Experimental/Consolonia.Designer/Consolonia.Designer.csproj (2)

18-19: Verify project reference availability

The project references have been updated to use ../../ paths. Ensure these projects exist at the new locations:

  • ../../Consolonia.Core/Consolonia.Core.csproj
  • ../../Tools/Consolonia.PreviewHost/Consolonia.PreviewHost.csproj
✅ Verification successful

Project references are correctly configured

Both referenced projects exist at the expected locations relative to the repository root:

  • src/Consolonia.Core/Consolonia.Core.csproj
  • src/Tools/Consolonia.PreviewHost/Consolonia.PreviewHost.csproj

The relative paths ../../ in the project references are correct since the file under review is at src/Experimental/Consolonia.Designer/Consolonia.Designer.csproj.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if referenced projects exist
fd -p "Consolonia\.Core\.csproj|Consolonia\.PreviewHost\.csproj" --type f

Length of output: 181


3-3: Verify Directory.Core.Build.props import path

The import path uses $(MSBuildThisFileDirectory)../ but project references now use ../../. Ensure this path is still correct with the new project structure.

✅ Verification successful

Import path for Directory.Core.Build.props is correct

The import path $(MSBuildThisFileDirectory)../ is correct because:

  • Directory.Core.Build.props exists at the repository root
  • Consolonia.Designer.csproj is located at src/Experimental/Consolonia.Designer/
  • Going up one level from the csproj location (src/Experimental/Consolonia.Designer/ -> src/Experimental/) and then using MSBuild's GetPathOfFileAbove will correctly locate the props file at the root
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if Directory.Core.Build.props exists at the expected location
fd -p "Directory.Core.Build.props" --type f

Length of output: 70


Script:

#!/bin/bash
# Let's check the location of the csproj file relative to Directory.Core.Build.props
fd -p "Consolonia.Designer.csproj" --type f

Length of output: 107

src/Experimental/Avalonia.PreviewHost/Avalonia.PreviewHost.csproj (3)

8-9: LGTM: Consistent packaging configuration

The IsPackable=false setting is consistent with other experimental components and aligns with the PR's packaging strategy.


29-29: Verify Designer project reference path

The project reference to Consolonia.Designer has been updated. Ensure it's correctly pointing to the new location.

✅ Verification successful

Project reference path is valid and correctly configured

The project reference path ..\Consolonia.Designer\Consolonia.Designer.csproj in Avalonia.PreviewHost.csproj is correctly pointing to an existing project at src/Experimental/Consolonia.Designer/Consolonia.Designer.csproj.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the Designer project exists at the referenced location
if [ -f "src/Experimental/Consolonia.Designer/Consolonia.Designer.csproj" ]; then
    echo "Designer project found at expected location"
else
    echo "Designer project not found at expected location"
fi

Length of output: 173


Line range hint 16-24: Verify Avalonia package version consistency

Multiple Avalonia packages are referenced. Ensure $(AvaloniaVersion) is defined consistently across the solution.

✅ Verification successful

Avalonia package version consistency verified

The verification shows that:

  • AvaloniaVersion is properly defined in Directory.Build.props as 11.2.1
  • All examined .csproj files consistently use $(AvaloniaVersion) variable for Avalonia packages
  • No hardcoded Avalonia package versions were found
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for AvaloniaVersion property definition
fd "Directory\..*\.props" --type f --exec grep -l "AvaloniaVersion"

Length of output: 91


Script:

#!/bin/bash
# Check the content of Directory.Build.props for AvaloniaVersion
cat Directory.Build.props

# Search for any other potential Avalonia version references in .csproj files
fd "\.csproj$" --type f --exec grep -l "AvaloniaVersion"

# Also check for any hardcoded Avalonia package versions that might not use the variable
rg --type csproj "Include=\"Avalonia[^\"]*\" Version=\"[^$][^\"]+" 

Length of output: 1523


Script:

#!/bin/bash
# Check for any hardcoded Avalonia package versions without the variable
rg "Include=\"Avalonia[^\"]*\" Version=\"[^$][^\"]+" --type xml

# Let's also check the content of some of the .csproj files that reference AvaloniaVersion
cat "./src/Experimental/Avalonia.PreviewHost/Avalonia.PreviewHost.csproj"
cat "./src/Consolonia.Core/Consolonia.Core.csproj"

Length of output: 2674

src/Experimental/Consolonia.Designer/ConsolePreview.cs (3)

8-15: LGTM! Imports are well-organized and necessary.

The imports correctly support the control's functionality as a console XAML previewer.


Line range hint 107-124: LGTM! Proper implementation of the dispose pattern.

The dispose pattern is correctly implemented with proper process cleanup.


48-48: Verify process cleanup in all scenarios.

The _process field is now always available, which is good for consistency. However, ensure proper cleanup in all scenarios.

✅ Verification successful

Let me search for more context about process handling and cleanup.


Let me try a different approach to find process cleanup patterns.


Let me check for the complete Dispose pattern implementation since we see _disposedValue field.


Let me try one final search to find any IDisposable implementation or cleanup methods.


Process cleanup is properly implemented

The code implements proper process cleanup through:

  • A dispose pattern with both Dispose() and Dispose(bool) methods
  • Consistent cleanup of _process by calling Kill() and Dispose() in all scenarios
  • Setting _process = null after cleanup to prevent reuse
  • Using a _disposedValue flag to prevent multiple disposals
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for potential process leaks in error handling
rg -A 5 "Process\." src/Experimental/Consolonia.Designer/ConsolePreview.cs

Length of output: 321


Script:

#!/bin/bash
# Check for process cleanup and disposal patterns
ast-grep --pattern 'class ConsolePreview {
  $$$
  _process$$$
  $$$
}'

Length of output: 73


Script:

#!/bin/bash
# Search for dispose or cleanup related code
rg -U "(?s)class ConsolePreview.*?}$" src/Experimental/Consolonia.Designer/ConsolePreview.cs

# Also check for any Kill or Dispose calls
rg "(_process.*?(Kill|Dispose)|Dispose.*?_process)" src/Experimental/Consolonia.Designer/ConsolePreview.cs

Length of output: 1684


Script:

#!/bin/bash
# Search for the Dispose implementation
rg -A 10 "protected override void Dispose" src/Experimental/Consolonia.Designer/ConsolePreview.cs

Length of output: 99


Script:

#!/bin/bash
# Search for any dispose or cleanup methods
rg -A 10 "(Dispose\(|protected.*Dispose|IDisposable)" src/Experimental/Consolonia.Designer/ConsolePreview.cs

# Also check for any finalizer
rg "~ConsolePreview" src/Experimental/Consolonia.Designer/ConsolePreview.cs

Length of output: 1864

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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2521677 and d6b99e8.

📒 Files selected for processing (1)
  • src/Experimental/Consolonia.Designer/Consolonia.Designer.csproj (1 hunks)
🧰 Additional context used
📓 Learnings (1)
src/Experimental/Consolonia.Designer/Consolonia.Designer.csproj (1)
Learnt from: tomlm
PR: jinek/Consolonia#150
File: src/Consolonia.Designer/Consolonia.Designer.csproj:14-15
Timestamp: 2024-11-19T07:19:33.261Z
Learning: In the Consolonia project, circular dependencies between `Consolonia.Designer` and `Consolonia.PreviewHost` are intentional and by design. The `ConsolePreview` control consumes `Consolonia.PreviewHost`, and `Avalonia.PreviewHost` consumes `ConsolePreview` control in the designer.
🔇 Additional comments (3)
src/Experimental/Consolonia.Designer/Consolonia.Designer.csproj (3)

11-14: Project references look good

The circular dependency between Designer and PreviewHost is intentional and by design, as confirmed by previous learnings. The ConsolePreview control and Avalonia.PreviewHost are designed to consume each other.

✅ Verification successful

Project references are correctly configured

The project references in Consolonia.Designer.csproj are valid and point to existing project files. The circular dependency between Designer and PreviewHost is intentional by design, as confirmed by previous learnings.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify project reference paths exist
test -f "src/Consolonia.Core/Consolonia.Core.csproj" && \
test -f "src/Tools/Consolonia.PreviewHost/Consolonia.PreviewHost.csproj" && \
echo "Project references exist" || echo "Missing project references"

Length of output: 184


8-8: Verify Newtonsoft.Json version security

Check if version 13.0.3 of Newtonsoft.Json has any known security vulnerabilities.

✅ Verification successful

Newtonsoft.Json 13.0.3 is secure and free from known vulnerabilities

The current version (13.0.3) is higher than the patched version (13.0.1) that addressed the last known high-severity vulnerability from 2022. No security issues have been reported for versions >= 13.0.1.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for security advisories for Newtonsoft.Json
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NUGET, package: "Newtonsoft.Json") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

Length of output: 823


4-8: Verify Avalonia version variable definition

The project uses $(AvaloniaVersion) for Avalonia packages. Ensure this variable is defined in a parent Directory.Build.props or similar file.

✅ Verification successful

$(AvaloniaVersion) is properly defined and matches package versions

The AvaloniaVersion property is correctly defined in Directory.Build.props with value 11.2.1, which aligns with the project's version prefix. The variable usage in package references is valid and follows good practices for version management.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for AvaloniaVersion definition in props files
fd -e props | xargs grep -l "AvaloniaVersion"

Length of output: 67


Script:

#!/bin/bash
# Check the content of Directory.Build.props to verify AvaloniaVersion definition
cat Directory.Build.props

Length of output: 936

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

🧹 Outside diff range and nitpick comments (4)
src/Experimental/Avalonia.PreviewHost/README.md (4)

4-8: Enhance installation instructions with additional details.

The installation section could be more comprehensive. Consider adding:

  1. Specify the language in the code block
  2. Add version information
  3. Include a verification command
 ## Installation
 To install the tool, you can use the following command:
-```
+```shell
 dotnet tool install -g Consolonia.PreviewHost

+To verify the installation:
+shell +Consolonia.PreviewHost --version +


<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 Markdownlint (0.35.0)</summary>

6-6: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

---

`22-26`: **Fix grammar and enhance the note about single file mode.**

Add missing articles and improve the note's clarity.

```diff
-Run following command to monitor a given .axaml file. 
+Run the following command to monitor a given .axaml file:

-> NOTE: In single file mode the tool will exit when you hit escape key
+> NOTE: In single file mode, the tool will exit when you hit the escape key.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~22-~22: You might be missing the article “the” here.
Context: ...ath-to-project-file-or-folder> ``` Run following command to monitor a given .axaml file....

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~26-~26: You might be missing the article “the” here.
Context: ...le mode the tool will exit when you hit escape key ### Running inside Visual Studio 1...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


28-39: Standardize IDE integration instructions and add troubleshooting.

The IDE integration sections could be more consistent and comprehensive.

 ### Running inside Visual Studio
 1. Open the solution in Visual Studio.
 1. Open a Terminal (View -> Terminal).
-3. run the following command
-``` Consolonia.PreviewHost . ```
+3. Run the following command:
+```shell
+Consolonia.PreviewHost .
+```
 
 ### Running inside Visual Studio Code
-To integrate the tool with Visual Studio Code, you can use the following steps:
 1. Open the project directory in Visual Studio Code.
-2. Open a terminal inside of visual studio code
-3. run the following command
-``` Consolonia.PreviewHost . ```
+2. Open a Terminal (View -> Terminal).
+3. Run the following command:
+```shell
+Consolonia.PreviewHost .
+```
+
+### Troubleshooting
+If you encounter any issues:
+1. Ensure the tool is installed globally
+2. Verify the terminal is running from the correct directory
+3. Check if the project contains valid AXAML files

1-2: Add an introduction explaining Consolonia and the preview tool's purpose.

Consider adding a brief introduction that explains:

  1. What Consolonia is
  2. What problem this preview tool solves
  3. Key features and benefits
 # Consolonia.PreviewHost
-This is a tool which enables a live view of a consolonia axaml file, or a consolonia project. 
+Consolonia.PreviewHost is a development tool for the Consolonia framework, a TUI (Text User Interface) implementation of Avalonia UI. This tool provides:
+
+- Live preview of Consolonia AXAML files as you edit
+- Real-time updates for both single files and entire projects
+- Seamless integration with popular IDEs
+- Instant feedback for UI changes without rebuilding
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d6b99e8 and 78e6d52.

📒 Files selected for processing (1)
  • src/Experimental/Avalonia.PreviewHost/README.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
src/Experimental/Avalonia.PreviewHost/README.md

[uncategorized] ~22-~22: You might be missing the article “the” here.
Context: ...ath-to-project-file-or-folder> ``` Run following command to monitor a given .axaml file....

(AI_EN_LECTOR_MISSING_DETERMINER_THE)


[uncategorized] ~26-~26: You might be missing the article “the” here.
Context: ...le mode the tool will exit when you hit escape key ### Running inside Visual Studio 1...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

🪛 Markdownlint (0.35.0)
src/Experimental/Avalonia.PreviewHost/README.md

6-6: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


12-12: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[assembly: InternalsVisibleTo("Consolonia.Core.Tests")]

[assembly: CLSCompliant(true)] //todo: should we make it compliant?
Copy link
Owner

Choose a reason for hiding this comment

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

Btw, why do we need to make it CLS compliant?

@tomlm tomlm merged commit a256342 into main Dec 7, 2024
3 checks passed
@tomlm tomlm deleted the tomlm/packages branch December 7, 2024 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avalonia.PreviewHost is reserved
2 participants