Commit 4bcaab9
authored
fix(init): remove JSON minification that breaks edit-based codemods (#719)
## Summary
Removes JSON minification (`JSON.stringify(JSON.parse())`) from
`readSingleFile` and `preReadCommonFiles`. This was causing all
`package.json` edit-based codemods to fail.
### Root cause
The server's codemod-planner agent saw minified JSON (all whitespace
stripped) and generated `oldString`/`newString` edits based on it. But
`applyEdits` reads the actual file from disk (pretty-printed with
indentation). The fuzzy replacer chain can't bridge minified vs
pretty-printed JSON — it's structurally too different.
### Evidence
All three reference projects (opencode, gemini-cli, cline) read files
**raw without any content transformation**. The model always sees
exactly what's on disk. Our minification was an outlier that broke when
we switched from full-content replacement to edit-based codemods.
Fixes failures on node-express and remix test projects:
```
Applying changes failed after 4 attempts: Edit #1 failed on "package.json":
Could not find oldString in the file.
```
## Test plan
- [x] All 68 local-ops tests pass
- [x] Typecheck clean
- [x] Lint clean
Made with [Cursor](https://cursor.com)1 parent ca16b2f commit 4bcaab9
1 file changed
Lines changed: 1 addition & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | 83 | | |
93 | 84 | | |
94 | 85 | | |
| |||
400 | 391 | | |
401 | 392 | | |
402 | 393 | | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
| 394 | + | |
407 | 395 | | |
408 | 396 | | |
409 | 397 | | |
| |||
549 | 537 | | |
550 | 538 | | |
551 | 539 | | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | 540 | | |
557 | 541 | | |
558 | 542 | | |
| |||
0 commit comments