fix(34): WR-11 accept an inline plugins list in plugin:add again

The comment-keeping summer.yaml edit refused a flow-style plugins list
(plugins: [{id: a, module: b}]) that plugin:add used to handle with a
full rewrite. The edit now replaces an inline list, over one or several
lines, with a block list of its items plus the new ones and keeps every
other line. A list it cannot edit in place (a tagged one, say) falls
back to the full SaveManifest rewrite with a note that the comments were
not kept. plugin:install gets the same behaviour.
This commit is contained in:
Jakub Zych
2026-10-29 22:15:09 +01:00
parent 754ab5423a
commit e6b3aa2222
7 changed files with 168 additions and 39 deletions

View File

@@ -733,9 +733,13 @@ func ApplyInstall(ctx context.Context, plan *InstallPlan, out io.Writer) error {
return fail(err)
}
}
if err := appendManifestPlugins(filepath.Join(plan.AppDir, manifestName), entries); err != nil {
rewrote, err := appendManifestPlugins(filepath.Join(plan.AppDir, manifestName), entries)
if err != nil {
return fail(err)
}
if rewrote {
fmt.Fprintf(out, "note: %s had an inline plugins list summer could not edit in place; it was written again and its comments were not kept\n", manifestName)
}
ids := make([]string, len(plan.Steps))
for i, s := range plan.Steps {
ids[i] = s.ID + "@" + displayRef(s.Version)