refactor: Fix yargs typings and factor out cleanup function
refactor: Fix yargs typings and factor out cleanup function

stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila