detect method
Auto-detect the appropriate output format for the current process.
Returns OutputFormatKind.text when stdout is a TTY (interactive), OutputFormatKind.json when stdout is piped or redirected. This is the FR-009 non-interactive edge case: when piped, output MUST be machine-readable so pipelines compose reliably.
Pass stdout.hasTerminal (the production call site) or false in tests
to simulate a piped stdout.
Implementation
OutputFormatKind detect(bool isTty) {
return isTty ? OutputFormatKind.text : OutputFormatKind.json;
}