Preserve unrelated dagger.toml content during config edits
Context
dagger.toml is edited both by users and by commands such as dagger mod install and dagger ws config.
Problem
An edit can change unrelated parts of the file:
- Multiline
ignorearrays become single-line arrays. - Unsupported fields such as
modules.FOO.as-sdkdisappear. - SDK sections are removed and recreated. Some quoted or numeric keys trigger a complete rewrite.
This makes config edits hard to review and can lose information needed for migration.
Solution
Edit only the requested fields and their required dependencies. Preserve all other text exactly, including unsupported fields, comments, and formatting. An operation with no changes should leave the file identical.
Warn about unsupported fields. For recognized legacy fields, suggest dagger ws migrate. Migration should show their removal and replacement together, including conversion from modules.FOO.as-sdk to sdks.<name>.module.
Add tests that compare exact file contents after config, module, and SDK edits.
Source: dagger/dagger