emrg: bundle vendor scripts in GUI package — fix packaged Markdown fallback - #612
Conversation
…llback (rant 2026-08-10T11:03:51) Packaged GUI rendered Markdown as plain text because electron-builder 'files' whitelist omitted vendor/**, so marked/DOMPurify/highlight were excluded from the installer while dev mode worked (local files present). - package.json: add 'vendor/**' to build.files whitelist - markdown.js: console.warn when marked is missing (diagnose, don't silently degrade to plain text) - build-config.test.js: 3 regression tests pinning the whitelist entry, vendored script presence, and the diagnostic fallback - README/Agent/README.cn: GUI test count 107 -> 110 (+3 build-config)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
Verified locally:
- Root cause confirmed: electron-builder
fileswhitelist omittedvendor/**; the fix adds it alongside existing entries (main.js/preload.js/renderer//daemon_client.js/scripts/). vendor/dir ships all runtime scripts (marked.min.js, dompurify.min.js, highlight.custom.js, highlight.github-dark.css).- Fallback path now logs
console.warninstead of degrading silently — good diagnostics. - New guard tests pass (3/3) and full GUI suite is 110/110.
- Doc counts synced (107→110) and parse correctly in tests/test_doc_counts.py (29+22+31+15+7+3+3=110).
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260810-111552
Diff re-verified this cycle: one-line vendor/** addition to electron-builder files whitelist + diagnostic console.warn fallback + 3 build-config regression tests + doc count sync (107→110). Full suite green locally (674 pytest incl. doc-count guard, 110/110 npm test). Acceptance items from the rant map cleanly: packaged Markdown renders (vendor bundled), copy button works (hljs+marked present), source mode untouched, tests added.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 20260810-111831 (3rd consecutive ✅)
Third independent review this cycle: diff unchanged and clean (vendor/** whitelist entry, diagnostic console.warn fallback, 3 build-config regression tests, doc counts synced). CI test ✅ (run 31352025434). Acceptance criteria from rant 11:03:51 all satisfied by the code: packaged Markdown renders (vendor bundled), copy button works (hljs+marked present), source mode untouched, regression tests added. Merge condition met (3 consecutive ✅, no ❌ in between).
…or bundling entries (#613) Merged feature PRs #610 (cmd launchers ASCII-only REM comments, CP936 mojibake) and #612 (GUI packaged vendor bundling — electron-builder files whitelist vendor/** + diagnostic markdown fallback) were merged without quick-ref entries. Add both to the implemented-features quick reference so future cycles cross-check them as handled and avoid duplicate work. - 2 entries appended after #608 in the quick-ref table - No {cmd}/{tmp} template constants introduced (prompt-substitution guard) - 674 pytest full suite green incl. test_build_prompt_all_variables_substituted + doc-count guard Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Fix packaged GUI Markdown not rendering (rant 2026-08-10T11:03:51).
Root cause:
emrg/gui/package.jsonelectron-builderfileswhitelist omittedvendor/**→ marked/DOMPurify/highlight.custom.js were excluded from the installer. Dev mode worked (local files present); only the packaged app degraded to plain text via the!window.markedescape fallback.Changes:
emrg/gui/package.json: add"vendor/**"tobuild.fileswhitelist (minimal one-line fix)emrg/gui/renderer/js/markdown.js:renderMarkdownnowconsole.warn("markdown vendor missing (marked not loaded)")when marked is absent — future packaging regressions are diagnosable instead of silently degradingemrg/gui/test/build-config.test.js(new, 3 tests): pins the whitelist entry, verifies all 3 vendored scripts exist non-empty, and asserts the diagnostic fallback — direct regression guard against removingvendor/**Verification:
npm test110/110 pass; pytest 674 pass (incl. doc-count guard #511); import +emrg --helpOK.Acceptance mapping: packaged Markdown renders (vendor now bundled) · code-block copy works (hljs+marked present) · source mode untouched · regression tests added.