UNPKG

deepsource-mcp-server

Version:
98 lines (97 loc) 4.33 kB
import { MetricShortcode, MetricKey } from '../types/metrics.js'; import { BaseHandlerDeps, HandlerFactory } from './base/handler.interface.js'; import { Logger } from '../utils/logging/logger.js'; import { IQualityMetricsRepository } from '../domain/aggregates/quality-metrics/quality-metrics.repository.js'; /** * Interface for parameters for fetching quality metrics * @public */ export interface DeepsourceQualityMetricsParams { /** DeepSource project key to fetch quality metrics for */ projectKey: string; /** Optional filter for specific metric shortcodes */ shortcodeIn?: MetricShortcode[]; } /** * Interface for parameters for updating a metric threshold * @public */ export interface DeepsourceUpdateMetricThresholdParams { /** DeepSource project key to identify the project */ projectKey: string; /** Repository GraphQL ID */ repositoryId: string; /** Code for the metric to update */ metricShortcode: MetricShortcode; /** Context key for the metric */ metricKey: MetricKey; /** New threshold value, or null to remove */ thresholdValue?: number | null; } /** * Interface for parameters for updating metric settings * @public */ export interface DeepsourceUpdateMetricSettingParams { /** DeepSource project key to identify the project */ projectKey: string; /** Repository GraphQL ID */ repositoryId: string; /** Code for the metric to update */ metricShortcode: MetricShortcode; /** Whether the metric should be reported */ isReported: boolean; /** Whether the threshold should be enforced */ isThresholdEnforced: boolean; } /** * Extended dependencies interface for quality metrics handler */ interface QualityMetricsHandlerDeps { qualityMetricsRepository: IQualityMetricsRepository; logger: Logger; } /** * Creates a quality metrics handler with injected dependencies * @param deps - The dependencies for the handler * @returns The configured handler function */ export declare function createQualityMetricsHandlerWithRepo(deps: QualityMetricsHandlerDeps): (params: DeepsourceQualityMetricsParams) => Promise<import("../models/common.js").ApiResponse>; export declare const createQualityMetricsHandler: HandlerFactory<BaseHandlerDeps, DeepsourceQualityMetricsParams>; /** * Fetches and returns quality metrics from a specified DeepSource project using domain aggregates * @param params - Parameters for fetching metrics, including project key and optional filters * @returns A response containing the metrics data with their values and thresholds * @throws Error if the DEEPSOURCE_API_KEY environment variable is not set or if API call fails * @public */ export declare function handleDeepsourceQualityMetrics(params: DeepsourceQualityMetricsParams): Promise<import("../models/common.js").ApiResponse>; /** * Creates an update metric threshold handler with injected dependencies * @param deps - The dependencies for the handler * @returns The configured handler factory */ export declare const createUpdateMetricThresholdHandler: HandlerFactory<BaseHandlerDeps, DeepsourceUpdateMetricThresholdParams>; /** * Updates the threshold for a specific metric in a project * @param params - Parameters for updating the threshold * @returns A response indicating whether the update was successful * @throws Error if the DEEPSOURCE_API_KEY environment variable is not set * @public */ export declare function handleDeepsourceUpdateMetricThreshold(params: DeepsourceUpdateMetricThresholdParams): Promise<import("../models/common.js").ApiResponse>; /** * Creates an update metric setting handler with injected dependencies * @param deps - The dependencies for the handler * @returns The configured handler factory */ export declare const createUpdateMetricSettingHandler: HandlerFactory<BaseHandlerDeps, DeepsourceUpdateMetricSettingParams>; /** * Updates the settings for a specific metric in a project * @param params - Parameters for updating the metric settings * @returns A response indicating whether the update was successful * @throws Error if the DEEPSOURCE_API_KEY environment variable is not set * @public */ export declare function handleDeepsourceUpdateMetricSetting(params: DeepsourceUpdateMetricSettingParams): Promise<import("../models/common.js").ApiResponse>; export {};