Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added unit tests for `GitHubModSource.ListPlugins` to increase coverage for deterministic behavior.
- **JSON Source Generation (AOT Support)**: Centralized registry in `AppJsonContext.cs` for all serialized models (`AuthResponse`, `DebugLogPayload`, `RalphTaskStatus`, `AssetModMetadata`, etc.) to ensure stability in trimmed builds.
- `global.json`: Pinned .NET SDK to 9.0.313 for build reproducibility and to bypass broken preview SDKs.
- `DESIGN.md` documenting the **Terminal Core** design system (colors, typography, layout grid, component specs, forbidden patterns).
Expand Down
2 changes: 1 addition & 1 deletion build/scripts/linux/build-avalonia-packages.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
PROJECT_PATH="$REPO_ROOT/src/GregModmanager.Avalonia/GregModmanager.Avalonia.csproj"
OUTPUT_ROOT="${1:-$REPO_ROOT/artifacts/avalonia-linux}"
VERSION="${2:-1.1.0}"
Expand Down
13 changes: 6 additions & 7 deletions src/GregModmanager.Avalonia/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ public override void OnFrameworkInitializationCompleted()

var telemetry = Services.GetRequiredService<TelemetryService>();
_ = telemetry.ReportCrashesAsync();
_ = telemetry.TrackEventAsync("startup", new
{
steamActive = GregModmanager.Steam.SteamApiNativeLoader.IsLoaded,
culture = System.Globalization.CultureInfo.CurrentCulture.Name,
osDescription = System.Runtime.InteropServices.RuntimeInformation.OSDescription,
dotNetVersion = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription
});
_ = telemetry.TrackEventAsync("startup", new GregModmanager.Models.StartupEvent(
GregModmanager.Steam.SteamApiNativeLoader.IsLoaded,
System.Globalization.CultureInfo.CurrentCulture.Name,
System.Runtime.InteropServices.RuntimeInformation.OSDescription,
System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription
));

if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
Expand Down
1 change: 1 addition & 0 deletions src/GregModmanager.Core/Models/AppJsonContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace GregModmanager.Models;
[JsonSerializable(typeof(int))]
[JsonSerializable(typeof(RalphTaskStatus))]
[JsonSerializable(typeof(AssetModMetadata))]
[JsonSerializable(typeof(StartupEvent))]
public partial class AppJsonContext : JsonSerializerContext
{
}
8 changes: 8 additions & 0 deletions src/GregModmanager.Core/Models/StartupEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace GregModmanager.Models;

public sealed record StartupEvent(
bool SteamActive,
string Culture,
string OsDescription,
string DotNetVersion
);
3 changes: 2 additions & 1 deletion src/GregModmanager.Core/Services/TelemetryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public async Task TrackEventAsync(string eventName, object payload, Dictionary<s
var message = payload switch
{
SyncCollectionEvent sync => JsonSerializer.Serialize(sync, AppJsonContext.Default.SyncCollectionEvent),
_ => JsonSerializer.Serialize(payload, payload.GetType(), AppJsonContext.Default.Options)
StartupEvent start => JsonSerializer.Serialize(start, AppJsonContext.Default.StartupEvent),
_ => "{}"
};

await PushToLokiAsync(eventName, message, labels);
Expand Down
35 changes: 35 additions & 0 deletions tests/GregModmanager.Tests/GitHubModSourceTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System.Linq;
using Xunit;
using GregModmanager.Services;

namespace GregModmanager.Tests;

public class GitHubModSourceTests
{
[Fact]
public void ListPlugins_ReturnsExpectedHardcodedPlugins()
{
// Arrange
var source = new GitHubModSource();

// Act
var plugins = source.ListPlugins();

// Assert
Assert.NotNull(plugins);
Assert.Equal(4, plugins.Count);

// Verify the generated PluginIds
Assert.Equal("gregCore", plugins[0].PluginId);
Assert.Equal("gregMod.IPAM", plugins[1].PluginId);
Assert.Equal("gregMod.ResetSwitch", plugins[2].PluginId);
Assert.Equal("SteamPlugin", plugins[3].PluginId); // Mapped from "-DataCenter-ModLoader"

// Verify common properties for all returned plugins
foreach (var plugin in plugins)
{
Assert.Equal("Latest (GitHub)", plugin.Version);
Assert.Equal("github", plugin.Channel);
}
}
}
Loading