Phase 3: JSON config import/export (profiles, vocab, prompts) - #52
Merged
Conversation
First Phase 3 (hackability) item. Lets users back up, hand-edit, and share their OpenWhisp setup, and lays the foundation that config packs will reuse. - ConfigBundle (OpenWhispCore, Foundation-only, Codable): a versioned (schemaVersion) snapshot of profiles + vocabulary + named-command prompts. Tolerant decode (every section optional, unknown keys ignored) so partial bundles / vocab-only packs round-trip and forward-compatible fields don't break an older importer. Rejects a schemaVersion newer than the app understands; reports malformed input. Pretty/sorted/stable JSON output. Has a human-readable `summary` for confirmation + pack listings. - AppState: exportConfig()/applyConfig()/exportConfig(to:)/importConfig(from:). Import applies only the sections present (each @published setter's didSet persists), so a vocab-only file only changes vocabulary. History and secrets are intentionally excluded from export. - SettingsView: "Backup & Sharing" section (Advanced) with Export…/Import… via NSSavePanel/NSOpenPanel and friendly status/error messages (incl. version-too-new and malformed-file cases). - Tests: +13 ConfigBundleTests (full/empty/partial round-trip, tolerant decode, unknown-key tolerance, version accept/reject, malformed, summary grammar). One caught a test bug (Substitution ids are random per call) — fixed the test, not the product. 134 -> 147. - README + ROADMAP updated. swift test 147/147; ./build.sh clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
First Phase 3 (hackability) item. Lets users back up, hand-edit, and share their setup — and lays the foundation that config packs will reuse.
Changes
ConfigBundle(OpenWhispCore, Foundation-only,Codable): a versioned (schemaVersion) snapshot of profiles + vocabulary + named-command prompts.schemaVersionnewer than the app understands; reports malformed input distinctly.summaryfor import confirmation + pack listings.exportConfig()/applyConfig()/exportConfig(to:)/importConfig(from:). Import applies only the sections present (each@Publishedsetter persists via itsdidSet), so a vocab-only file only changes vocabulary. History and secrets are excluded from export.ConfigBundleTests(full/empty/partial round-trip, tolerant decode, unknown-key tolerance, version accept/reject, malformed, summary grammar). One caught a test bug (randomSubstitutionids per call) — fixed the test, not the product. 134 → 147.swift test147/147 ·./build.shclean.🤖 Generated with Claude Code