Currently, the KtlintModule defines Commands and keeps the core functionality of running ktlint private. This makes it challenging to use ktlint in tasks (with proper caching and whatnot) without reimplementing a chunk of what KtlintModule already does.
See also #6917 (comment)