feat: enhance logging and linting functionality with detailed reports
All checks were successful
Lint / lint (pull_request) Successful in 16s

This commit is contained in:
2026-03-26 13:03:10 +01:00
parent b54a94c6d3
commit 79ea7dfc7e
8 changed files with 133 additions and 44 deletions

View File

@@ -1,6 +1,6 @@
import fs from 'fs-extra';
import yaml from 'js-yaml';
import { logStep, logInfo, logError } from '../utils/logger';
import { logStep, logSuccess, logError, logDetail } from '../utils/logger';
import type { SwaggerAnalysis } from '../types';
/** Parses an OpenAPI/Swagger file and extracts tags, paths and the full document. */
@@ -14,14 +14,15 @@ export function analyzeSwagger(swaggerFile: string): SwaggerAnalysis {
const tags = Array.isArray(swagger.tags) ? swagger.tags : [];
const paths = (swagger.paths as Record<string, unknown>) || {};
logInfo(`Found ${tags.length} tags in the API`);
logInfo(`Found ${Object.keys(paths).length} endpoints`);
logDetail('analyze', `Input: ${swaggerFile}`);
logDetail('analyze', `Found ${tags.length} tags, ${Object.keys(paths).length} endpoints`);
tags.forEach((tag: unknown) => {
const t = tag as { name: string; description?: string };
logInfo(` - ${t.name}: ${t.description || 'No description'}`);
logDetail('analyze', ` - ${t.name}: ${t.description || 'No description'}`);
});
logSuccess(`${tags.length} tags, ${Object.keys(paths).length} endpoints found`);
return { tags, paths, swagger };
} catch (error: unknown) {
const err = error as Error;