-
Notifications
You must be signed in to change notification settings - Fork 33
feat(config): use EditableJson for non-destructive config saving #997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment @cursor review or bugbot run to trigger another review on this PR
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
Comment @cursor review or bugbot run to trigger another review on this PR
Use EditableJson for preserving existing properties and key order when updating config values. This prevents overwriting unrelated config properties during partial updates. - Add standalone EditableJson implementation in src/utils/editable-json.mts - Update config.mts to use EditableJson for config file writes - Fix socketAppDataPath usage to include config.json filename - Add resetConfigForTesting() helper for test isolation - Update tests to use Node.js built-in fs functions
- Preserve JSON formatting by using editor's indent/newline symbols - Handle deleted config keys explicitly (editor.update only merges) - Capture config snapshot at write time, not schedule time - Fix load method create parameter to actually create empty state
- Fix symbol index type errors with type assertions - Remove unused getDefaultFormatting function - Add null check for match[1] in detectIndent - Remove unused contentWithoutImport variable
- Fix import sort order in config.test.mts (promises as fs sorted by alias name) - Add no-await-in-loop eslint-disable comments for retry loops in editable-json.mts - Remove unused eslint-disable directive
841193a to
ed75ea2
Compare
Summary
Port of commit 3eace89 to v1.x. Use EditableJson for preserving existing properties and key order when updating config values.
Details
Note
Introduces non-destructive config writes and corrects file handling.
.../config.json(base64-encoded) and preserve formatting/key order viaEditableJsonsocketAppDataPath/config.json); improve debug/log pathsresetConfigForTesting()and update tests (usermSync, minor import adjustments)src/utils/editable-json.mts: standaloneEditableJsonimplementation (format detection, non-destructive updates)Written by Cursor Bugbot for commit 67afc9b. Configure here.