Add WitcherScriptMerger.Headless: a Linux-capable CLI/MCP-only host - #8
Merged
Conversation
New project (net10.0, no -windows suffix, references Core only) that wires up just the merge CLI verb and mcp server mode - no WinForms, no GUI fallback. Always uses DiffPlexMergeEngine (Core, no external binary), since KDiff3MergeEngine needs Win32 P/Invoke that stays host-only. Getting this actually working on Linux (verified via WSL2, not just a cross-compile check) surfaced and fixed real bugs in shared Core code: - ModFile.GetModNameFromPath hardcoded '\' to find a path segment, crashing every flat-file merge on Linux (Path.Combine uses '/' there). Fixed to use Path.DirectorySeparatorChar. - WsmMcpTools.MergeConflicts normalized client-supplied paths toward a hardcoded '\' too, silently breaking relativePaths/orderOverrides matching on Linux. Same fix. - QuickBms.GetBundleContentPaths returned null when QuickBMS wasn't found, which ModFileIndex.BuildAsync and FileMerger.GetUnpackedFiles both enumerated directly - unreachable on the WinForms host (always gated behind the combined Paths.ValidateDependencyPaths()) but a real NullReferenceException once WitcherScriptMerger.Headless legitimately scans without QuickBMS/wcc_lite configured. Returns Array.Empty<string>() instead now. - FileMerger.GetUnpackedFiles's vanilla-bundle search also threw DirectoryNotFoundException on a missing content/DLC folder (a scratch/ incomplete game tree) - now degrades to "no vanilla bundle found" instead. Split Paths.ValidateDependencyPaths() into ValidateTextMergeDependencies() and ValidateBundleDependencies() so a host without QuickBMS/wcc_lite can still scan/merge flat-file conflicts; bundle-category conflicts fail gracefully per-conflict instead (ModFileIndex.BuildAsync prints one clear message per scan and skips bundle checking rather than crashing or being noisy per-bundle). This also relaxes WsmMcpTools's MCP-tool gating for the WinForms host's own mcp verb, not just the new host - documented in CLAUDE.md. Verified: full build, existing test suite, and dotnet format whitespace all pass. Self-contained single-file win-x64 and linux-x64 publishes both succeed. Actually ran the published linux-x64 binary under WSL2 (real Linux kernel) for both the merge and mcp verbs against synthetic scratch mods, including the bundle-graceful-degradation path - not just a cross-compile check. Added matching win-x64/linux-x64 publish commands to CLAUDE.md (no existing .pubxml convention to follow). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GXAuGMLB44T5Zv5o5ZzKah
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-opened against the correct repo (the original PR was mistakenly opened against upstream
AnotherSymbiote/WitcherScriptMergerand has been closed there).See the branch's commits for full details: adds
WitcherScriptMerger.Headless, a slim GUI-free host (net10.0, no WinForms) wiring up just themergeCLI verb andmcpserver mode viaDiffPlexMergeEngine, plus Core changes so bundle-category conflicts degrade gracefully without QuickBMS/wcc_lite. Verified via actual runtime execution on Linux (WSL2), not just cross-compilation — this caught and fixed two real hardcoded-backslash path-separator bugs that only manifest on Linux. Full verification details are in the commit messages.AI-assisted (Claude Code) per this repo's CONTRIBUTING.md disclosure convention.