feat(format): Add --diff option to format command to display file diffs; pass flag through CLI and show formatter diffs. Bump @git.zone/tsdoc to ^1.11.0.

This commit is contained in:
2025-12-15 12:00:10 +00:00
parent 08f56ae0a4
commit 3ebf072bfb
6 changed files with 101 additions and 11 deletions

View File

@@ -29,6 +29,7 @@ export let run = async (
interactive?: boolean;
parallel?: boolean;
verbose?: boolean;
diff?: boolean; // Show file diffs
} = {},
): Promise<any> => {
// Set verbose mode if requested
@@ -132,6 +133,21 @@ export let run = async (
return;
}
// Show diffs if requested (works in both dry-run and write modes)
if (options.diff) {
logger.log('info', 'Showing file diffs:');
console.log('');
for (const formatter of activeFormatters) {
const checkResult = await formatter.check();
if (checkResult.hasDiff) {
logger.log('info', `[${formatter.name}]`);
formatter.displayAllDiffs(checkResult);
console.log('');
}
}
}
// Dry-run mode (default behavior)
if (!shouldWrite) {
logger.log('info', 'Dry-run mode - use --write (-w) to apply changes');