Bootstrapping updates

This commit is contained in:
gamer147
2026-05-25 01:28:52 -04:00
parent c14408ba06
commit d067f8a64a
3 changed files with 19 additions and 26 deletions

File diff suppressed because one or more lines are too long

View File

@@ -88,7 +88,6 @@ public static class Program
private static BootstrapOptions? ParseArgs(string[] args)
{
string? dataDir = null;
string? cards = null;
string? captures = null;
string? referenceDataDir = null;
@@ -103,7 +102,6 @@ public static class Program
string a = args[i];
switch (a)
{
case "--data-dir": dataDir = NextArg(args, ref i); break;
case "--cards": cards = NextArg(args, ref i); break;
case "--captures": captures = NextArg(args, ref i); break;
case "--reference-data-dir": referenceDataDir = NextArg(args, ref i); break;
@@ -120,28 +118,16 @@ public static class Program
}
}
// Resolution order:
// --cards beats --data-dir/cards.json beats legacy positional;
// --captures beats --data-dir/prod-captures beats Bootstrap/Data/prod-captures (shipped default);
// --reference-data-dir beats shipped Bootstrap/Data (the CSVs always ship next to the binary).
// All bootstrap inputs ship in-project under SVSim.Bootstrap/Data/, copied next to the
// binary on build. The --cards/--captures/--reference-data-dir flags are ad-hoc overrides
// (e.g. point at a fresh loader dump before promoting it into the project).
string baseDir = AppContext.BaseDirectory;
string shippedDataDir = Path.Combine(baseDir, "Data");
string shippedCaptures = Path.Combine(shippedDataDir, "prod-captures");
string shippedCardsFile = Path.Combine(shippedDataDir, "cards.json");
string cardsFile = cards
?? (dataDir is not null ? Path.Combine(dataDir, "cards.json") : null)
?? positionalCards
?? "data_dumps/cards.json";
// Resolve captures dir, falling back to the shipped copy if the data-dir path is unset
// OR points at a missing folder. (Common case: user has cards.json in data_dumps/ but
// hasn't copied prod-captures/ there — the shipped snapshot is the source of truth.)
string? capturesCandidate = captures
?? (dataDir is not null ? Path.Combine(dataDir, "prod-captures") : null);
string capturesDir = capturesCandidate is not null && Directory.Exists(capturesCandidate)
? capturesCandidate
: shippedCaptures;
string cardsFile = cards ?? positionalCards ?? shippedCardsFile;
string capturesDir = captures ?? shippedCaptures;
string refDir = referenceDataDir ?? shippedDataDir;
string connStr = connection
@@ -166,13 +152,14 @@ public static class Program
Console.Error.WriteLine(
"Usage: svsim-bootstrap [options]\n" +
"\n" +
" --data-dir <path> Directory containing cards.json and prod-captures/\n" +
" (default: ./data_dumps relative to working dir)\n" +
" --cards <file> Override path to cards.json\n" +
" All inputs default to the in-project SVSim.Bootstrap/Data/ folder, copied next to\n" +
" the binary at build time. Override flags below take ad-hoc paths (e.g. a fresh\n" +
" loader dump) — promote into Data/ when you're ready to make it permanent.\n" +
"\n" +
" --cards <file> Override path to cards.json (default: shipped Data/cards.json)\n" +
" --captures <dir> Override path to prod-captures directory\n" +
" (default: shipped Data/prod-captures next to the binary)\n" +
" --reference-data-dir <dir> Override reference CSV directory\n" +
" (default: shipped Data/ next to the binary)\n" +
" (default: shipped Data/prod-captures)\n" +
" --reference-data-dir <dir> Override reference CSV directory (default: shipped Data/)\n" +
" --connection-string <conn> Postgres connection (or NPGSQL_CONNECTION env var,\n" +
$" then \"{DefaultConnectionString}\")\n" +
" --skip-reference Skip reference-data import (classes, sleeves, ranks, ...)\n" +

View File

@@ -16,6 +16,11 @@
<Content Include="Data\*.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<!-- cards.json is the loader-captured card master (~30 MB). Lives in-project so the
bootstrapper is self-contained; refresh by copying a newer dump over the file. -->
<Content Include="Data\cards.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>