Schema-driven UI and worker dispatch by converter id - #3
Closed
fedyunin wants to merge 1 commit into
Closed
Conversation
UI and worker now talk to the registry instead of the legacy convert.js
engine directly. Adding a converter is one folder under
src/core/converters/ — the desktop app auto-renders its options panel
from the option schema; no UI changes required to surface it.
Renderer
- New "Converter" card with a dropdown of registered converters and a
per-converter description line.
- "Options" card rendered dynamically from the selected converter's
options[] schema (boolean -> checkbox, enum -> select, number ->
number input, string -> text). Saved per-converter so switching
direction keeps each one's last values.
- Drop-zone and file picker now filter by the current converter's
inputs.extensions (e.g. .mif/.mid for mif-to-xlsx, .kml/.kmz for
kml-to-mif).
- Removed all converter-specific HTML/JS for the Excel exporter; the
same form generator handles both shipped converters.
Worker / IPC
- worker.js dispatches converters.get(id).run({inputs, output, options},
ctx) and runs converters.validateOptions() before invoking run.
- main.js: new IPC channel converters:list returns a serializable lean
view of the registry (id, name, description, io extensions, options).
selectFiles accepts the current converter's allowed extensions.
- preload.js exposes listConverters() and the extension-aware
selectFiles(options).
- convert:start payload moved from the legacy {inputMode, inputFolder,
selectedFiles, recursive, paintRows, ...} bag to the new
{converterId, inputs, output, options} contract.
Settings
- New format v2: shared top-level (language, inputMode, inputFolder,
outputFolder, selectedFiles), plus converterId and converterOptions
keyed by converter id.
- migrate() lifts legacy flat option keys (paintRows, skipBlack,
combineIntoOneWorkbook, etc.) into converterOptions['mif-to-xlsx']
so existing users see identical behavior on first launch.
- saveSettings stamps the version on every write so future migrations
can branch on it.
i18n
- New shared keys: section.converter, field.converter,
hint.optionsEmpty. Subtitle and drop hint reworded to be
format-agnostic. English / Russian / Kazakh updated.
- Per-option labels currently come from the schema (English). Future
PR can add optional i18nKey on options without touching the
renderer.
Tests: 81 passing (75 + 6 settings migration). Renderer is browser-only
JS so it is not unit-tested here; verified via node --check.
Manual smoke (run by maintainer): `npm run dev`, pick "MapInfo -> Excel/CSV",
confirm the same form as 1.0.4 renders and conversion behavior is
unchanged; switch to "KML/KMZ -> MapInfo MIF/MID", confirm the new
options (flat, charset, recursive) render and a real KMZ converts.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 19, 2026
Owner
Author
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.
Summary
Stops the UI from knowing about individual converters. Worker dispatches by
converterIdto whatever is in the registry; the renderer builds its options form from each converter's declarativeoptions[]schema. Adding a new format is now: one folder undersrc/core/converters/, one test fixture, one entry in the registry — and it appears in the desktop app automatically.Stacked on top of #2.
What changed
Renderer
boolean→ checkbox,enum→ select,number→ number input,string→ text). Saved per converter — switching direction keeps each one's last values.inputs.extensions(e.g..mif/.midfor mif-to-xlsx,.kml/.kmzfor kml-to-mif).Worker / IPC
worker.jsnow dispatchesconverters.get(id).run({inputs, output, options}, ctx). Runsconverters.validateOptions()before invocation; surfaces option errors as a fatal error message.main.jsexposesconverters:listreturning a lean serializable view of the registry.selectFilesaccepts the current converter's allowed extensions for native dialog filters.preload.jsexposeslistConverters()and the extension-awareselectFiles(options).convert:startpayload moved from{inputMode, inputFolder, selectedFiles, recursive, paintRows, ...}to the contract-aligned{converterId, inputs, output, options}.Settings (v2 with migration)
{ "version": 2, "language": "en", "inputMode": "folder", "inputFolder": "...", "outputFolder": "...", "selectedFiles": [], "converterId": "kml-to-mif", "converterOptions": { "mif-to-xlsx": { "paintRows": true, "skipBlack": true, /* ... */ }, "kml-to-mif": { "flat": false, "charset": "WindowsCyrillic" } } }migrate()lifts legacy flat option keys intoconverterOptions['mif-to-xlsx']so existing 1.0.x users see no behavior change after the upgrade.saveSettingsalways stamps the current version so future migrations can branch on it.i18n
New shared keys (
section.converter,field.converter,hint.optionsEmpty); the subtitle and drop hint are now format-agnostic. EN / RU / KK updated. Per-option labels currently come straight from the schema (English) — a follow-up PR can add an optionali18nKeyon options without touching the renderer.Tests
81 passing (75 from #2 + 6 new settings migration tests):
converterOptions['mif-to-xlsx']Renderer is browser-only JS — validated by
node --check. Real smoke test is manual:Test plan
npm testis green (81)node --checkon every JS fileapp.getPath('userData')loads with identical behaviorFollow-ups
feat/cli—bin/mifkit convert <id> <input> <output> --flag=valueover the same registry. Schema validation already covers CLI flag parsing.feat/i18n-options— optionali18nKeyon option definitions so option labels can be translated without renderer changes.feat/mif-to-kml— reverse direction (MapInfo → Google Earth).🤖 Generated with Claude Code