All files provider.ts

100% Statements 6/6
50% Branches 2/4
100% Functions 3/3
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                                    1x         1x       1x                       1x   1x           1x                      
import {
  ToolProvider,
  ToolName,
  SpokeOutput,
  ScanOptions,
  ToolScoringOutput,
  AnalysisResult,
  SpokeOutputSchema,
} from '@aiready/core';
import { analyzeChangeAmplification } from './analyzer';
import {
  ChangeAmplificationOptions,
  FileChangeAmplificationResult,
} from './types';
 
/**
 * Change Amplification Tool Provider
 */
export const ChangeAmplificationProvider: ToolProvider = {
  id: ToolName.ChangeAmplification,
  alias: ['change-amp', 'change-amplification', 'coupling'],
 
  async analyze(options: ScanOptions): Promise<SpokeOutput> {
    const report = await analyzeChangeAmplification(
      options as ChangeAmplificationOptions
    );
 
    return SpokeOutputSchema.parse({
      results: report.results as AnalysisResult[],
      summary: report.summary,
      metadata: {
        toolName: ToolName.ChangeAmplification,
        version: '0.9.5',
        timestamp: new Date().toISOString(),
      },
    });
  },
 
  score(output: SpokeOutput, options: ScanOptions): ToolScoringOutput {
    const summary = output.summary as any;
 
    return {
      toolName: ToolName.ChangeAmplification,
      score: summary.score || 0,
      rawMetrics: summary,
      factors: [],
      recommendations: (summary.recommendations || []).map(
        (action: string) => ({
          action,
          estimatedImpact: 5,
          priority: 'medium',
        })
      ),
    };
  },
 
  defaultWeight: 8,
};