Skip to content

feat(assets): upload images to an MDU Asset Server and check its links in lint - #238

Merged
capjan merged 1 commit into
mainfrom
feat/assets-integration
Nov 15, 2026
Merged

capjan merged 1 commit into
mainfrom
feat/assets-integration

Conversation

@capjan

@capjan capjan commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Milestone M10 of mdu-assets: MDU learns about the site's asset server.

assets in mdu.yml (CLI-01)

  • assets.server (web interface and API), assets.public (public image links; defaults to the server), assets.project (default project).
  • The token only from MDU_ASSETS_TOKEN, never from the file. mdu render/serve stop on an address that is not http(s); a project without a server is an error.

mdu assets upload <file>… (CLI-02, CLI-04)

  • Files or - for standard input; --project, --tag (repeatable), --alt, --name, --format markdown|url|html, --root.
  • One snippet per image on stdout, messages on stderr; exit code 1 when an image failed, the others are still uploaded.
  • Uploads with duplicates=reject and prints the existing image's snippet when the project already has the content.
  • Sends the token only over https, or to a server on the same machine; explains a missing token, server or project, and refusals from problem details.

Lint rule MDU032 BrokenAssetLink (CLI-03; MDU029 from the plan is taken)

  • Links and images on the public host go to the server's public check endpoint in batches of 100, without a token. Unknown, deleted and trashed images are errors on their line; an unreachable server or refusal is one warning on mdu.yml.
  • mdu lint --offline skips the check; without assets.server nothing is sent.

HttpClient only, JSON via JsonDocument/Utf8JsonWriter (no reflection). Docs: new Usage/assets.md, assets in the configuration reference, MDU032 in the rules, --offline in lint.

Tests: 20 new in AssetsTest with a fake HTTP handler (settings, upload, stdin, duplicate, refusal and continue, missing token/server/project, no token over plain http, MDU032 errors, warning when unreachable, offline). Full suite green except ServeCommandIntegrationTest.ReloadsExternalGlossaryChangesAndConfigurationPathChanges, which timed out once under load and passes alone.

Tried for real: mdu lint against a running asset server reported a made-up link as MDU032 and let a real one pass; --offline skipped it. mdu assets upload against a local asset server uploaded a file with tag and alt text, printed the existing link for a duplicate, read standard input, and explained a missing token.

Closes capjan/mdu-assets#52
Closes capjan/mdu-assets#53
Closes capjan/mdu-assets#54

…s in lint

Adds the assets section to mdu.yml (server, public, project; the token only from MDU_ASSETS_TOKEN), mdu assets upload, which uploads files or standard input and prints one snippet per image, and lint rule MDU032, which reports links and images on the server's public host whose image is unknown, deleted or in the trash. Network problems are warnings, and mdu lint --offline skips the check. HTTP uses HttpClient only.
@capjan
capjan merged commit c8129ef into main Nov 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Report broken asset links in mdu lint Add mdu assets upload Add the assets section to mdu.yml

1 participant