CLI tool that automates publishing 3D printable models to multiple platforms (Printables, MakerWorld, Cults3D, Thangs, MakerOnline, Patreon) using Playwright browser automation.
- .NET 10, C#
- Playwright.NET — browser automation (Brave browser, headless=false)
- System.CommandLine 2.0.3 — use
SetAction/ParseResult.GetValue(old Handler API is gone) - Spectre.Console — always wrap user-data strings with
Markup.Escape(), square brackets crash it
cd C:\Source\ModelPublisher
dotnet run --project src\ModelPublisher.Cli -- "C:\Users\chris\Downloads\Models\<model-name>\manifest.json" --platforms printables| File | Purpose |
|---|---|
src/ModelPublisher.Cli/Program.cs |
CLI entry point |
src/ModelPublisher.Core/PublishCommand.cs |
Orchestrator — reads manifest, resolves tier, runs publishers, writes results JSON |
src/ModelPublisher.Core/Platforms/IPlatformPublisher.cs |
Publisher interface |
src/ModelPublisher.Core/Platforms/PrintablesPublisher.cs |
Only fully working publisher |
src/ModelPublisher.Core/Shared/BrowserContextFactory.cs |
Launches persistent Brave context per platform |
src/ModelPublisher.Core/Shared/AuthGuard.cs |
Pauses for human login when not authenticated |
src/ModelPublisher.Core/Shared/FileUploadHelper.cs |
UploadSequentialAsync — uploads one file at a time, waits for NetworkIdle |
src/ModelPublisher.Core/Shared/MarkdownHelper.cs |
ToPlainText and ToTipTapHtml — converts markdown for platforms that need it |
src/ModelPublisher.Core/Models/ReleaseManifest.cs |
Deserializes manifest.json; GetPlatformConfig<T>() deserializes typed platform config |
src/ModelPublisher.Core/Models/PlatformConfig.cs |
Base record with Tier + PrintProfiles — all platform configs inherit from this |
src/ModelPublisher.Core/Platforms/PatreonConfig.cs |
Patreon-specific config: FreePost, AccessTierId |
src/ModelPublisher.Core/Models/PublishResult.cs |
Result record — Tier is set by orchestrator via with, not by publishers |
{
"title": "...",
"description": "... markdown ...",
"tags": [],
"license": "CC-BY-4.0",
"files": {
"models": ["./model.3mf"],
"cover": "./cover-photo.jpg",
"photos": ["./cover-photo.jpg", "./detail.jpg"]
},
"platforms": {
"printables": {
"tier": "free",
"print_profiles": ["./profiles/printables-0.2mm.3mf"]
},
"patreon": {
"tier": "premium",
"free_post": false,
"access_tier_id": "YOUR_TIER_ID"
}
}
}coveris optional. If set,PhotosOrdered(coverFirst)deduplicates and positions it.manifest.ManifestDirectoryis set after deserialization; useResolveFilePath()for all file paths.print_profilesis optional on any platform; defaults to[]. Paths are relative to manifest dir.- To read typed config in a publisher:
manifest.GetPlatformConfig<PlatformConfig>(PlatformKey)(returnsnullif platform not listed). Use a subclass (e.g.PatreonConfig) for platform-specific fields. PlatformsstaysDictionary<string, JsonElement>internally —GetPlatformConfig<T>deserializes on demand.
| Key | Platform | Status |
|---|---|---|
printables |
Printables.com | Working |
makerworld |
MakerWorld.com | Stub — needs codegen selectors |
cults3d |
Cults3D.com | Stub — needs codegen selectors |
thangs |
Thangs.com | Stub — needs codegen selectors |
makeronline |
Maker.online | Stub — needs codegen selectors |
patreon |
Patreon.com | Stub — clipboard paste approach, needs verification |
- Model input:
input[type='file'][accept*='.3mf'](also stl, obj, zip variants) - Photo input:
input[type='file'][id='photos-upload-input']— usemanifest.Files.PhotosOrdered(coverFirst: false)(Printables uses last-uploaded as cover — though this is unconfirmed, see GitHub issue #5) - Title:
GetByRole(AriaRole.Textbox, new() { Name = "Model name (required)" }) - Summary:
GetByRole(AriaRole.Textbox, new() { Name = "Summary (required)" }) - Tags:
GetByRole(AriaRole.Textbox, new() { Name = "Additional tags" })+ Enter per tag - Original model:
GetByRole(AriaRole.Radio, new() { Name = "Original model – I made it" }) - AI generated:
GetByRole(AriaRole.Radio, new() { Name = "No — fully human-made" }) - Description: inject via
EvaluateAsync—MarkdownHelper.ToTipTapHtml(manifest.Description)→ setel.innerHTML→ dispatchinput+changeevents - License:
GetByRole(AriaRole.Button, new() { Name = "License (required)" }) - Submit:
GetByRole(AriaRole.Button, new() { Name = "Save draft" })→ wait for URL**/model/** - Auth check:
[data-cy='user-menu'], .user-avatar, [aria-label='User menu']
- Printables description: uses TipTap (ProseMirror).
FillAsyncdoesn't work — useEvaluateAsyncto setinnerHTMLdirectly. - MarkdownHelper.ToPlainText: list markers replaced with
•/1.(not stripped). Lists processed before bold/italic to avoid*bullets being consumed by the bold regex. - PublishResult.Tier: init-only, set by orchestrator with
result with { Tier = tier! }. Publishers do not set it. - Spectre.Console: any string containing
[or]from user data must be wrapped inMarkup.Escape(). - System.CommandLine 2.0.3:
SetAction+ParseResult.GetValueonly — oldHandlerAPI removed.
- Installed globally:
dotnet tool install --global Slopwatch.Cmd(v0.4.0) - Baseline initialized at
.slopwatch/baseline.json(0 pre-existing issues on master) - Run after code changes:
powershell.exe -Command "cd 'C:\Source\ModelPublisher'; slopwatch analyze -d ." - Detects: disabled tests, empty catch blocks, warning suppression, arbitrary delays, NoWarn in csproj, CPM bypass
- Repo: https://github.com/TheCraftyMaker/ModelPublisher
masteris protected — PRs required, no direct pushes, enforce_admins=true- Auto-delete branches on merge is enabled
ghCLI is NOT on bash PATH — call via:powershell.exe -Command "& 'C:\Program Files\GitHub CLI\gh.exe' ..."- All commits must include:
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> - See
.claude/skills/github-modelp/SKILL.mdfor the full workflow reference
Persistent Chromium sessions stored in profiles/{platformKey}/ relative to working directory. Gitignored — contains login cookies. On first run per platform, the browser pauses for manual login.
Cloudflare detects Playwright's CDP protocol and blocks access even when a human clicks "I'm human". This affects MakerWorld and Patreon. Two mitigations are in place in BrowserContextFactory:
--disable-blink-features=AutomationControlledlaunch arg- Init script removing
navigator.webdriver, spoofing canvas/WebGL/plugins
When these aren't enough, use --profile-path to run with the real Brave profile (which has cf_clearance cookies from normal browsing). Brave must be fully closed first.
# For publishing:
dotnet run --project src\ModelPublisher.Cli -- "manifest.json" --platforms makerworld --profile-path "C:\Users\chris\AppData\Local\BraveSoftware\Brave-Browser\User Data\Profile 1"
# For codegen:
dotnet run --project src\ModelPublisher.Cli -- codegen makerworld https://makerworld.com/en/my/models/publish?type=original --profile-path "C:\Users\chris\AppData\Local\BraveSoftware\Brave-Browser\User Data\Profile 1"Google OAuth is blocked in all automated browsers (Playwright injects CDP which Google detects). Log into Cloudflare-protected platforms using email/password, not Google, during the AuthGuard pause.
npx playwright codegen does NOT work from Claude Code's bash shell (node not on PATH, GUI can't open in background). Always run codegen manually from a Windows terminal.
For sites without Cloudflare / bot detection — use the .NET playwright.ps1 (built output):
pwsh "C:\Source\ModelPublisher\src\ModelPublisher.Cli\bin\Debug\net10.0\playwright.ps1" codegen https://example.comFor sites with Cloudflare / Google auth (e.g. Patreon) — codegen won't work (Chromium is blocked). Instead: open the page in the regular Brave browser, interact with the form, and use DevTools (F12) to inspect elements. Paste HTML snippets into the conversation to extract selectors.