GCodeClean takes a little step v1.0.3 
This release was supposed to be about preparatory steps towards injecting blank lines before significant actions, and file splitting from the ‘road map’ above. But, of course, other things came along …
The workflow has been split into more ‘phases’ of processing, although there’s still three ‘main’ phases.
There’s now an additional PreAndPostamblePhase that handles injecting the preamble and postamble contexts and file demarcations. As well as a ReassembleLines phase that does the final conversion of the Lines into GCode text.
There’s also a dedup pass to remove redundant context statements (this does not include redundant movement commands although they are obviously part of the current state or context of the machine).
Along the way I also found an oversight in how GCodeClean handles negative Z values. If there’s a negative Z value, but the movement command is G0 then it should really be converted to G1, at least as a first best guess. And this is what is now done.
And of course a new test, and changes to an existing test to cover the above changes.
Release v1.0.3 - Dedup Context, and fix for -ve Z with G0 => G1 · md8n/GCodeClean (github.com)