I've had a few cases where the external file for an @clean tree went missing. This causes the file to be empty with no recovery unless there is a backup. This makes me want to turn all of them into @file trees. But there are times I want to emit a clean file - no sentinels, etc.
Most recently this came up because I wanted to put some Leo outlines under source control (not on GitHub; on my own computer). I didn't want to also put the external files in the repo, but they were @clean files and they could end up being the wrong versions if I changed to a different changeset for the outline.
I don't want to put the external files under source control but leave the Leo outline not controlled, because I have a lot of non-file information in the outline.
I know of two ways to save clean files when their parent node is an @file node, both a little clumsy:
1. Temporarily change the tree to an @clean tree, save, then change it back.
2. Put a dummy collection node immediately under the @file node, with the actual file's tree under that. Clone that node to an @clean node and save. Then delete the @clean node.
Either way works, but it seems that there should be a better way. Am I missing something? If not, this is a feature I'd like. Something like a new command write-tree-as-clean. There is a question about what the written file should be named so as not to collide with the original, but that doesn't seem hard to solve.