Repository navigation
Conversation
On Windows, every map open ran two PowerShell checks on the bridge's token, and each one flashed a console window and could pull focus away from Dungeondraft. The token now lasts for the whole Dungeondraft session, so the checks run once at startup and later map opens show nothing. import_image places a PNG from your computer as an object, the way dragging it into Dungeondraft does. The image is stored inside the map file, so it survives moving or deleting the original. From battlemap-mcp#16 and #17. Co-authored-by: thekannen <thekannengieser@gmail.com>
The console fix and image import are @arhidavid's work, from pull requests #16 and #17: thank you, David. - On Windows, opening a map no longer flashes a console window or steals focus; the token check runs once per Dungeondraft session. - Place a PNG from your computer on the map, stored inside the map. - With Moulk's Soft Shadows, your assistant can add, adjust and undo soft shadows on objects, walls and paths, and copies keep them. - With Moulk's Sketch Tool, your sketch notes stay out of exports. - Redo survives taking a screenshot or saving. - Elements kept for undo are freed when another map opens. - The README lists the mods the assistant supports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A narrated walk-through on YouTube installs battlemap-mcp from nothing with the Claude desktop app: the extension, the Dungeondraft mod, a connection check and a first room. It's linked beside the documentation and in Get started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Carry forward the pack-builder half of upstream #17 on top of 1.4.2. Publish with O_CREAT|O_EXCL into Dungeondraft's configured asset folder only, add one companion tool (no Assets.UpdateTree refresh), and cover no-clobber and path limits in offline tests. Co-authored-by: arhidavid <arhidavid@users.noreply.github.com>
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.
Problem and behavior
Follow-up to thekannen/battlemap-mcp#17:
import_imagealready shipped in upstream 1.4.2. This PR is the pack-builder half only, based on current upstreammain/ 1.4.2.create_image_pack(filename, name, images, pack_id="", author="")builds a native.dungeondraft_packof named, tagged PNG objects. The archive includes the root registration manifest and innerpack.json, plus native tags/sets. Existing files are never overwritten. Writes are limited to Dungeondraft’s configured asset folder.Workflow after create: restart Dungeondraft (verified live) — or rescan packs in the Assets window (unverified without restart) →
prepare_map_with_packswith the returned id →list_assets/search_pack_contents/place_object.search_pack_contentscan already see the new archive on disk before a rescan/restart.Design choice (tool count)
Adds one companion tool:
create_image_pack.import_image(embed-in-map vs library pack are different jobs).prepare_map_with_packs(that tool rewrites map headers; packing PNGs does not belong there).refresh_asset_packs(see note 3 below).Addressing thekannen’s #17 notes
No-clobber / portable publish. Replaced
os.linkwithO_CREAT | O_EXCLopen of the final destination, then write +fsync. That works on exFAT, FAT32, and network shares where hard links fail. A competing writer that claims the name first surfaces as “already exists”; this call only unlinks a file it created.Where packs may be written.
filenameis a bare name (same style asprepare_map_with_packs). The destination is resolved underpack_contents.assets_directory()only (config.inicustom_assets_directoryorBATTLEMAP_MCP_ASSETS_DIR). Absolute/outside paths are refused.refresh_asset_packs/Assets.UpdateTree— deferred. The #17 live notes reported a native read error and editor exit when an invalid early test archive was moved during cleanup while Dungeondraft was running; that “do not move mounted packs” restriction remains documented. Neither our cloud environment nor our live pass isolatedUpdateTree, and this PR does not expose refresh. Safe path: ask the user to restart Dungeondraft (or rescan in the Assets window), then callprepare_map_with_packs. If a later live session clearly shows refresh-only is safe, that can be a small follow-up.Fewer new tools. One new tool instead of three (
import_imagealready upstream; refresh omitted).Implementation
server/battlemap_mcp/image_import.pywith pack building (reuses PNG validation).create_image_packas a companion tool inbridge_client.py.docs/image-pack.md; PROTOCOL / docs README updated.import_image.Validation
Offline CI/checks:
python server/tools/gate.pypassed (format, lint, bridge/contract/lifecycle/engine, skills, agent docs, types, tests).tools/release.py checkpassed.server/tests/test_image_import.py: pack round-trip, root manifest, no-clobber race, asset-folder path limit, reserved Colorable tag, corrupt PNG refusal.Live Windows + Dungeondraft check on
a61209d(running the PR’s 1.4.2-matched bridge source hash):python server/tools/gate.pypassed on Windows with a fresh temporary folder.create_image_packrefused an outside path (../…), wrote a two-PNG.dungeondraft_packinside Dungeondraft’s configured asset folder, and refused to overwrite it (file hash stayed identical);search_pack_contentsfound both tags on disk immediately.list_asset_packssaw the pack,prepare_map_with_packsadded it to a scratch map copy, both tagged objects were discoverable and placeable, and both survived save and reopen; pixel checks confirmed transparent centers in the DD2VTT export.Documentation pages needing maintainer update
AI assistance
Code and PR text were written with AI assistance (Cursor / Codex).
Note for Mike
Opened on arhidavid/battlemap-mcp for your review first (currently private). Not opened against thekannen/battlemap-mcp; no upstream comments or pushes. When you are ready to submit upstream, make the fork public (or export the branch) and reuse this description against #17’s pack-builder follow-up request.