pptx: Add surgical mode to replace.py (safer default for partial edits) #145
+88
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
replace.pyclears ALL text shapes in a presentation, then only restores those with"paragraphs"defined in the replacement JSON. This is a footgun for partial edits.Example failure:
While this behavior is documented, it's surprising and destructive for the common use case of making targeted edits to specific slides.
Solution
Add surgical mode (now the default) that only touches shapes explicitly listed in the replacement JSON. The old "clear everything" behavior remains available via
--clear-allflag for template workflows where starting fresh is desired.Changes
replace.py:
--clear-allflag (surgical mode is default)"paragraphs"in replacement JSONshapes_skippedcounter to stats outputSKILL.md:
--clear-allflag for template workflowsBackward Compatibility
This is a breaking change in default behavior:
Users who rely on the old behavior for template workflows can add
--clear-allto preserve it. This seems like the right trade-off since partial edits are likely more common than full template replacements, and the old default was destructive.