Commit c3659cf
authored
feat(config): use EditableJson for non-destructive config saving (#997)
* feat(config): use EditableJson for non-destructive config saving
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
* fix: address PR review feedback
- 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: TypeScript compilation errors
- 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: ESLint errors in config and editable-json
- 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
* chore: remove unused imports from config.test.mts1 parent 1de47a9 commit c3659cf
3 files changed
+463
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
101 | | - | |
| 102 | + | |
| 103 | + | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | | - | |
| 110 | + | |
109 | 111 | | |
110 | | - | |
111 | | - | |
| 112 | + | |
| 113 | + | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| |||
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
121 | | - | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
243 | 245 | | |
244 | 246 | | |
245 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
246 | 258 | | |
247 | 259 | | |
248 | 260 | | |
| |||
340 | 352 | | |
341 | 353 | | |
342 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
343 | 358 | | |
344 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
345 | 418 | | |
346 | | - | |
347 | | - | |
| 419 | + | |
| 420 | + | |
348 | 421 | | |
349 | 422 | | |
350 | 423 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
2 | 8 | | |
3 | 9 | | |
4 | 10 | | |
5 | | - | |
| 11 | + | |
6 | 12 | | |
7 | 13 | | |
8 | 14 | | |
| |||
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
83 | | - | |
| 89 | + | |
84 | 90 | | |
85 | 91 | | |
86 | 92 | | |
| |||
0 commit comments