Skip to content

Commit 33a9314

Browse files
committed
yiiiiiiikkkesssb im scaredddd
1 parent e401f32 commit 33a9314

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+17817
-600
lines changed

.windsurf/workflows/prepare-update.md

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
---
2-
description: Prepare a MotelyJAML version update - bump version, clean, build all projects, AOT publish WASM, prepare npm packages, and guide user through npm publish
2+
description: Prepare a MotelyJAML version update - bump version, clean, build all projects, AOT-publish WASM, prepare npm packages, and guide user through npm publish
33
---
44

55
# Prepare Update
66

77
Bumps the MotelyVersion, cleans everything, builds all .NET projects, AOT-publishes both WASM targets, prepares both npm packages, and walks the user through publishing.
88

9-
**User provides**: the new version number — OR if not specified, read the current `<MotelyVersion>` from `Directory.Build.props` and auto-increment the patch (e.g. `2.2.1``2.2.2`).
9+
**User provides**: the new version number — OR if not specified, read the current `<MotelyVersion>` from `Directory.Packages.props` and auto-increment the patch (e.g. `2.2.1``2.2.2`).
1010

1111
---
1212

1313
## Step 1: Bump MotelyVersion
1414

15-
Edit `x:\JammySeedFinder\src\MotelyJAML\Directory.Build.props` — set `<MotelyVersion>` to the new version.
15+
Edit `x:\JammySeedFinder\src\MotelyJAML\Directory.Packages.props` — set `<MotelyVersion>` to the new version.
1616

17-
Then update **both** npm package.json files to match:
17+
Then update **all three** npm package.json files to match:
1818
- `x:\JammySeedFinder\src\MotelyJAML\Motely.npm\package.json` → set `"version"` to the new version
19+
- `x:\JammySeedFinder\src\MotelyJAML\Motely.npm.singlethread\package.json` → set `"version"` to the new version
1920
- `x:\JammySeedFinder\src\MotelyJAML\Motely.node\package.json` → set `"version"` to the new version
2021

2122
Print the version you just set so the user can confirm.
@@ -65,39 +66,48 @@ If any project fails, report the error and stop.
6566
// turbo
6667
```powershell
6768
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\Motely.npm\_framework -ErrorAction SilentlyContinue
68-
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\MotelyNode\_framework -ErrorAction SilentlyContinue
69+
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\Motely.npm\_framework_st -ErrorAction SilentlyContinue
70+
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\Motely.npm.singlethread\_framework -ErrorAction SilentlyContinue
71+
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\Motely.node\_framework -ErrorAction SilentlyContinue
6972
```
7073

7174
---
7275

7376
## Step 7: AOT Release Publish — Browser WASM (frontend)
7477

75-
This publishes `Motely.BrowserWasm` and auto-copies `_framework` into `Motely.npm/_framework/` via MSBuild target.
78+
This publishes `Motely.BrowserWasm` with browser AOT enabled at publish time and auto-copies `_framework` into `Motely.npm/_framework/` via MSBuild target. The packaged `_framework` output keeps raw `.wasm` assets only and excludes `.br` / `.gz` sidecars.
7679

7780
```powershell
78-
dotnet publish x:\JammySeedFinder\src\MotelyJAML\Motely.BrowserWasm\Motely.BrowserWasm.csproj -c Release
81+
dotnet publish x:\JammySeedFinder\src\MotelyJAML\Motely.BrowserWasm\Motely.BrowserWasm.csproj -c Release -p:RunAOTCompilation=true -p:PublishReadyToRun=false
7982
```
8083

8184
Verify the output exists:
8285
// turbo
8386
```powershell
84-
Test-Path x:\JammySeedFinder\src\MotelyJAML\Motely.npm\_framework\dotnet.native.wasm
87+
@(Get-ChildItem x:\JammySeedFinder\src\MotelyJAML\Motely.npm\_framework\dotnet.native*.wasm -ErrorAction SilentlyContinue).Count -gt 0
8588
```
8689

8790
---
8891

89-
## Step 8: AOT Release Publish — Node WASM (backend)
92+
## Step 8: AOT Release Publish — Single-thread WASM (Node + browser fallback)
9093

91-
This publishes `Motely.SingleThread` and auto-copies `_framework` into `MotelyNode/_framework/` via MSBuild target.
94+
This publishes `Motely.SingleThread` with browser AOT enabled at publish time and auto-copies `_framework` into:
95+
- `Motely.node/_framework/`
96+
- `Motely.npm/_framework_st/`
97+
- `Motely.npm.singlethread/_framework/`
98+
99+
The packaged `_framework` output keeps raw `.wasm` assets only and excludes `.br` / `.gz` sidecars.
92100

93101
```powershell
94-
dotnet publish x:\JammySeedFinder\src\MotelyJAML\Motely.SingleThread\Motely.SingleThread.csproj -c Release
102+
dotnet publish x:\JammySeedFinder\src\MotelyJAML\Motely.SingleThread\Motely.SingleThread.csproj -c Release -p:RunAOTCompilation=true -p:PublishReadyToRun=false
95103
```
96104

97-
Verify the output exists:
105+
Verify the outputs exist:
98106
// turbo
99107
```powershell
100-
Test-Path x:\JammySeedFinder\src\MotelyJAML\MotelyNode\_framework\dotnet.native.wasm
108+
@(Get-ChildItem x:\JammySeedFinder\src\MotelyJAML\Motely.node\_framework\dotnet.native*.wasm -ErrorAction SilentlyContinue).Count -gt 0
109+
@(Get-ChildItem x:\JammySeedFinder\src\MotelyJAML\Motely.npm\_framework_st\dotnet.native*.wasm -ErrorAction SilentlyContinue).Count -gt 0
110+
@(Get-ChildItem x:\JammySeedFinder\src\MotelyJAML\Motely.npm.singlethread\_framework\dotnet.native*.wasm -ErrorAction SilentlyContinue).Count -gt 0
101111
```
102112

103113
---
@@ -106,33 +116,50 @@ Test-Path x:\JammySeedFinder\src\MotelyJAML\MotelyNode\_framework\dotnet.native.
106116

107117
// turbo
108118
```powershell
109-
cd x:\JammySeedFinder\src\MotelyJAML\Motely.npm; npm install; npm run build
119+
npm --prefix x:\JammySeedFinder\src\MotelyJAML\Motely.npm install
120+
npm --prefix x:\JammySeedFinder\src\MotelyJAML\Motely.npm run build
121+
```
122+
123+
---
124+
125+
## Step 10: Prepare npm package — motely-wasm-singlethread (browser)
126+
127+
// turbo
128+
```powershell
129+
npm --prefix x:\JammySeedFinder\src\MotelyJAML\Motely.npm.singlethread install
110130
```
111131

112132
---
113133

114-
## Step 10: Prepare npm package — motely-node (backend)
134+
## Step 11: Prepare npm package — motely-node (backend)
115135

116136
// turbo
117137
```powershell
118-
cd x:\JammySeedFinder\src\MotelyJAML\Motely.node; npm install; npm run build; npm run copy-framework
138+
npm --prefix x:\JammySeedFinder\src\MotelyJAML\Motely.node install
139+
npm --prefix x:\JammySeedFinder\src\MotelyJAML\Motely.node run build
140+
npm --prefix x:\JammySeedFinder\src\MotelyJAML\Motely.node run copy-framework
119141
```
120142

121143
---
122144

123-
## Step 11: Tell user to publish
145+
## Step 12: Tell user to publish
124146

125147
Tell the user:
126148

127149
```
128-
Both npm packages are ready to publish!
150+
All npm packages are ready to publish!
129151
130152
1. Publish motely-wasm (browser frontend):
131153
cd x:\JammySeedFinder\src\MotelyJAML\Motely.npm
132154
npm login # if not already logged in
133155
npm publish
134156
135-
2. Publish motely-node (backend/Node.js):
157+
2. Publish motely-wasm-singlethread (browser fallback):
158+
cd x:\JammySeedFinder\src\MotelyJAML\Motely.npm.singlethread
159+
npm login # if not already logged in
160+
npm publish
161+
162+
3. Publish motely-node (backend/Node.js):
136163
cd x:\JammySeedFinder\src\MotelyJAML\Motely.node
137164
npm login # if not already logged in
138165
npm publish
@@ -142,23 +169,25 @@ Wait for user to confirm they published.
142169

143170
---
144171

145-
## Step 12: Cleanup _framework files
172+
## Step 13: Cleanup _framework files
146173

147174
After user confirms publish, clean up the large _framework dirs to keep the repo lean:
148175

149176
```powershell
150177
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\Motely.npm\_framework -ErrorAction SilentlyContinue
151-
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\MotelyNode\_framework -ErrorAction SilentlyContinue
178+
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\Motely.npm\_framework_st -ErrorAction SilentlyContinue
179+
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\Motely.npm.singlethread\_framework -ErrorAction SilentlyContinue
180+
Remove-Item -Recurse -Force x:\JammySeedFinder\src\MotelyJAML\Motely.node\_framework -ErrorAction SilentlyContinue
152181
```
153182

154183
---
155184

156-
## Step 13: Summary
185+
## Step 14: Summary
157186

158187
Print:
159188

160189
```
161190
✅ MotelyJAML update complete!
162191
Version: <THE_VERSION>
163-
Published: motely-wasm@<THE_VERSION>, motely-node@<THE_VERSION>
192+
Published: motely-wasm@<THE_VERSION>, motely-wasm-singlethread@<THE_VERSION>, motely-node@<THE_VERSION>
164193
```

Directory.Packages.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<Project>
22
<PropertyGroup>
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
<MotelyVersion>2.3.1</MotelyVersion>
45
</PropertyGroup>
56
<ItemGroup>
67
<!-- Node API for .NET addon: https://microsoft.github.io/node-api-dotnet/scenarios/js-dotnet-module.html (CPM requires fixed version) -->
78
<PackageVersion Include="Microsoft.JavaScript.NodeApi" Version="0.9.19" />
89
<PackageVersion Include="Microsoft.JavaScript.NodeApi.Generator" Version="0.9.19" />
10+
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
911
<PackageVersion Include="DuckDB.NET.Data.Full" Version="1.4.4" />
1012
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.3" />
1113
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.3" />

Motely.API/Program.cs

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Concurrent;
22
using System.IO;
3+
using System.Text.Json.Serialization;
34
using Motely.DistributedWorker;
45
using Motely.Filters;
56

@@ -26,6 +27,23 @@ public record SearchInfo(
2627
TimeSpan ElapsedTime
2728
);
2829

30+
public record ActiveSearchInfo(string Id, bool IsCompleted, long SeedsSearched, long Matches, string Elapsed);
31+
public record ServerStatusResponse(string Hostname, int ProcessorCount, string OS, string Runtime, string Uptime, IEnumerable<ActiveSearchInfo> ActiveSearches, int FilterCount, string PoolUrl);
32+
33+
[JsonSerializable(typeof(CreateFilterRequest))]
34+
[JsonSerializable(typeof(UpdateFilterRequest))]
35+
[JsonSerializable(typeof(FilterInfo))]
36+
[JsonSerializable(typeof(FilterInfo[]))]
37+
[JsonSerializable(typeof(IEnumerable<FilterInfo>))]
38+
[JsonSerializable(typeof(StartSearchRequest))]
39+
[JsonSerializable(typeof(SearchInfo))]
40+
[JsonSerializable(typeof(ActiveSearchInfo))]
41+
[JsonSerializable(typeof(ActiveSearchInfo[]))]
42+
[JsonSerializable(typeof(ServerStatusResponse))]
43+
internal partial class ApiJsonSerializerContext : JsonSerializerContext
44+
{
45+
}
46+
2947
public class Program
3048
{
3149
public static void Main(string[] args) => CreateHost(args).Run();
@@ -38,6 +56,11 @@ public static WebApplication CreateHost(string[] args)
3856
{
3957
var builder = WebApplication.CreateBuilder(args);
4058

59+
builder.Services.ConfigureHttpJsonOptions(options =>
60+
{
61+
options.SerializerOptions.TypeInfoResolverChain.Insert(0, ApiJsonSerializerContext.Default);
62+
});
63+
4164
builder.Services.AddEndpointsApiExplorer();
4265
builder.Services.AddSwaggerGen(c =>
4366
c.SwaggerDoc("v1", new() { Title = "Motely API", Version = "v1" }));
@@ -194,27 +217,25 @@ public static WebApplication CreateHost(string[] args)
194217
var activeSearches = searches.Select(kvp =>
195218
{
196219
var s = kvp.Value;
197-
return new
198-
{
199-
Id = kvp.Key,
200-
IsCompleted = s.IsCompleted,
201-
SeedsSearched = s.TotalSeedsSearched,
202-
Matches = s.MatchingSeeds,
203-
Elapsed = s.ElapsedTime.ToString(@"hh\:mm\:ss"),
204-
};
205-
});
206-
207-
return Results.Ok(new
208-
{
209-
Hostname = Environment.MachineName,
210-
ProcessorCount = Environment.ProcessorCount,
211-
OS = $"{System.Runtime.InteropServices.RuntimeInformation.OSDescription}",
212-
Runtime = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription,
213-
Uptime = (DateTime.UtcNow - serverStart).ToString(@"d\.hh\:mm\:ss"),
214-
ActiveSearches = activeSearches,
215-
FilterCount = Directory.GetFiles(jamlDir, "*.jaml").Length,
216-
PoolUrl = "https://www.seedfinder.app",
217-
});
220+
return new ActiveSearchInfo(
221+
kvp.Key,
222+
s.IsCompleted,
223+
s.TotalSeedsSearched,
224+
s.MatchingSeeds,
225+
s.ElapsedTime.ToString(@"hh\:mm\:ss")
226+
);
227+
}).ToArray();
228+
229+
return Results.Ok(new ServerStatusResponse(
230+
Environment.MachineName,
231+
Environment.ProcessorCount,
232+
$"{System.Runtime.InteropServices.RuntimeInformation.OSDescription}",
233+
System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription,
234+
(DateTime.UtcNow - serverStart).ToString(@"d\.hh\:mm\:ss"),
235+
activeSearches,
236+
Directory.GetFiles(jamlDir, "*.jaml").Length,
237+
"https://www.seedfinder.app"
238+
));
218239
}).WithName("GetStatus");
219240

220241
app.MapFallbackToFile("/index.html");

Motely.API/Properties/launchSettings.json

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,13 @@
44
"http": {
55
"commandName": "Project",
66
"dotnetRunMessages": true,
7-
"launchBrowser": false,
8-
"applicationUrl": "http://localhost:5030",
7+
"launchBrowser": true,
8+
"applicationUrl": "http://192.168.0.171:3141",
99
"environmentVariables": {
10-
"ASPNETCORE_ENVIRONMENT": "Development"
11-
}
12-
},
13-
"https": {
14-
"commandName": "Project",
15-
"dotnetRunMessages": true,
16-
"launchBrowser": false,
17-
"applicationUrl": "https://localhost:7213;http://localhost:5030",
18-
"environmentVariables": {
19-
"ASPNETCORE_ENVIRONMENT": "Development"
10+
"ASPNETCORE_ENVIRONMENT": "Development",
11+
"SEARCH_POOL_TOKEN": "ABCD1234",
12+
"POOL_URL": "https://www.seedfinder.app/api/search/helper"
2013
}
2114
}
2215
}
23-
}
16+
}

Motely.BrowserWasm/Motely.BrowserWasm.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
<!-- Do NOT add Content Include="wwwroot\**" - SDK includes wwwroot automatically; duplicate causes NETSDK1022 -->
33
<PropertyGroup>
44
<TargetFramework>net10.0-browser</TargetFramework>
5+
<Version>$(MotelyVersion)</Version>
56
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
67
<Nullable>enable</Nullable>
78
<ImplicitUsings>enable</ImplicitUsings>
9+
<PublishReadyToRun>false</PublishReadyToRun>
810

911
<!-- AOT & Naive Build -->
10-
<RunAOTCompilation>true</RunAOTCompilation>
11-
<WasmBuildNative>true</WasmBuildNative>
1212
<WasmEnableThreads>true</WasmEnableThreads>
1313
<WasmEnableSIMD>true</WasmEnableSIMD>
1414

@@ -54,7 +54,7 @@
5454
<ItemGroup>
5555
<_FrameworkFiles
5656
Include="$(PublishDir)wwwroot\_framework\**\*"
57-
Exclude="$(PublishDir)wwwroot\_framework\debug\**\*;$(PublishDir)wwwroot\_framework\tmp\**\*"
57+
Exclude="$(PublishDir)wwwroot\_framework\debug\**\*;$(PublishDir)wwwroot\_framework\tmp\**\*;$(PublishDir)wwwroot\_framework\**\*.br;$(PublishDir)wwwroot\_framework\**\*.gz"
5858
/>
5959
</ItemGroup>
6060

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"folders": [
3+
{
4+
"path": ".."
5+
},
6+
{
7+
"path": "../../../../v0-balatro-seed-hosting"
8+
}
9+
],
10+
"settings": {
11+
"files.associations": {
12+
"*.jaml": "yaml"
13+
},
14+
"yaml.schemas": {
15+
"jaml.schema.json": "*.jaml"
16+
},
17+
"yaml.completion": true,
18+
"json.schemaDownload.enable": true,
19+
"powershell.cwd": "v0-balatro-seed-hosting"
20+
}
21+
}

0 commit comments

Comments
 (0)