Repository navigation
feat: add config import/export with preview and merge modes - #427
Merged
sirmalloc merged 13 commits intoJul 25, 2026
Merged
Conversation
Contributor
Author
|
I use claude code cli on multiple machines and do make changes regularly to the status line based on what I am working on. It would be nice to export/import configurations.
|
harishkarthiktk
force-pushed
the
feat/import-export-config
branch
from
June 17, 2026 06:56
fa16c52 to
8114033
Compare
|
manually copied my configs, can we merge this @sirmalloc ? |
Pass the current in-memory Settings object into exportConfig instead of reloading settings.json from disk. This ensures unsaved TUI edits are included in exported files and keeps the export callback synchronized with current React state. Add a regression test with intentionally stale on-disk data to verify the provided configuration is exported, along with the exporter version metadata.
Record the keys that were actually present in the validated import payload before schema defaults obscure their absence. Pass that key set through the TUI import flow and restrict merge mode to explicitly supplied settings. Replace mode continues to receive a fully validated settings object, while merge mode no longer resets lines, width behavior, thresholds, or other customizations omitted from a partial import. Add a regression test covering a partial current-version payload.
Restore the current installation metadata after filtering machine-local fields from imported configuration. Replace All can now replace user-facing settings without erasing pinned or self-managed install classification used by update and version-mismatch safeguards. Add regression coverage showing that imported installation metadata is ignored and the active local pinned metadata survives while ordinary imported settings are still applied.
Build import-preview keys from the union of current and validated imported settings rather than only the current configuration. Optional values such as separators, padding, and color overrides are now displayed when an import introduces them. Extract the key selection into a focused helper and add regression coverage for multiple imported-only optional settings while continuing to filter machine-local metadata.
Render diff rows inside a normal column Box instead of Ink Static. Canceling, applying, or reopening an import now allows Ink to erase and replace the preview rather than permanently committing stale rows above the active interface. Add a structural regression test asserting that the preview row region uses the dynamic Box component.
Apply imported settings in the user-event handler, update the module-wide Chalk level from the resulting configuration, and then publish the same settings object to React state. Imported color capability changes now affect previews and color UI immediately, including No Color mode. Keep the side effect outside the React state updater and add regression coverage that verifies both the imported setting and Chalk global state change together.
Build the import preview from applyImport using the currently highlighted action. Merge previews now preserve values omitted from partial payloads instead of presenting schema defaults as changes, while Replace All continues to show the fully validated replacement result. Track Replace All and Merge selection changes in the dialog so the displayed diff always matches the action Enter will apply. Add focused coverage for omitted merge fields and an Ink interaction regression test that verifies the preview updates when Merge is highlighted.
Check an imported config's declared version before migration or current-schema parsing. Files produced by a newer ccstatusline release now return an explicit validation error instead of having unknown settings stripped and missing values replaced with this release's defaults. Add regression coverage with a future-version payload containing an unsupported field, asserting that validation fails with both the imported and supported schema versions in the diagnostic.
Owner
|
@harishkarthiktk @qazi0 I had to make a good bit of changes to this PR to accommodate several edge cases but I have it merged and just released it in v2.2.27. Thanks for the contribution. |
Thank you! |
tahodev
pushed a commit
to tahodev/ccstatusline
that referenced
this pull request
Oct 20, 2026
…c#427) * feat: add config import/export with preview and merge modes * feat: add config import/export with preview and merge modes * Temp personal configurations addeed. * fix(config): export live TUI settings Pass the current in-memory Settings object into exportConfig instead of reloading settings.json from disk. This ensures unsaved TUI edits are included in exported files and keeps the export callback synchronized with current React state. Add a regression test with intentionally stale on-disk data to verify the provided configuration is exported, along with the exporter version metadata. * fix(config): preserve omitted settings during merge import Record the keys that were actually present in the validated import payload before schema defaults obscure their absence. Pass that key set through the TUI import flow and restrict merge mode to explicitly supplied settings. Replace mode continues to receive a fully validated settings object, while merge mode no longer resets lines, width behavior, thresholds, or other customizations omitted from a partial import. Add a regression test covering a partial current-version payload. * fix(config): retain installation metadata on replace import Restore the current installation metadata after filtering machine-local fields from imported configuration. Replace All can now replace user-facing settings without erasing pinned or self-managed install classification used by update and version-mismatch safeguards. Add regression coverage showing that imported installation metadata is ignored and the active local pinned metadata survives while ordinary imported settings are still applied. * fix(tui): preview settings added by imports Build import-preview keys from the union of current and validated imported settings rather than only the current configuration. Optional values such as separators, padding, and color overrides are now displayed when an import introduces them. Extract the key selection into a focused helper and add regression coverage for multiple imported-only optional settings while continuing to filter machine-local metadata. * fix(tui): keep import preview in dynamic output Render diff rows inside a normal column Box instead of Ink Static. Canceling, applying, or reopening an import now allows Ink to erase and replace the preview rather than permanently committing stale rows above the active interface. Add a structural regression test asserting that the preview row region uses the dynamic Box component. * fix(tui): synchronize Chalk after config import Apply imported settings in the user-event handler, update the module-wide Chalk level from the resulting configuration, and then publish the same settings object to React state. Imported color capability changes now affect previews and color UI immediately, including No Color mode. Keep the side effect outside the React state updater and add regression coverage that verifies both the imported setting and Chalk global state change together. * fix(tui): preview effective merge settings Build the import preview from applyImport using the currently highlighted action. Merge previews now preserve values omitted from partial payloads instead of presenting schema defaults as changes, while Replace All continues to show the fully validated replacement result. Track Replace All and Merge selection changes in the dialog so the displayed diff always matches the action Enter will apply. Add focused coverage for omitted merge fields and an Ink interaction regression test that verifies the preview updates when Merge is highlighted. * fix(config): reject imports from newer schemas Check an imported config's declared version before migration or current-schema parsing. Files produced by a newer ccstatusline release now return an explicit validation error instead of having unknown settings stripped and missing values replaced with this release's defaults. Add regression coverage with a future-version payload containing an unsupported field, asserting that validation fails with both the imported and supported schema versions in the diagnostic. --------- Co-authored-by: Matthew Breedlove <sirmalloc@gmail.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.
Adds configuration import/export functionality with three new dialog components for exporting to JSON, importing from JSON with validation, and previewing changes before applying. Supports both replace and merge import modes with excluded key filtering.