import { type ApiClient } from './api-client'; import { resolveRegistryRoot, validateRegistryInstall } from './pack-registry'; import { calculateSourceStatus } from './source-tracker'; import { loadEnvironmentDescriptor, loadWorkspaceManifest, validateWorkspaceManifest } from './workspace-contract'; export type HealthStatus = 'healthy' | 'warning' | 'error' | 'skipped'; export interface HealthCheckContext { workspaceRoot: string; environmentName?: string; workspaceId?: string; verbose?: boolean; } export interface HealthCheckResult { dimensionName: string; status: HealthStatus; errors: string[]; warnings: string[]; metadata?: Record; skipped?: boolean; skipReason?: string; } export interface HealthReportSummary { totalErrors: number; totalWarnings: number; healthyDimensions: number; warningDimensions: number; errorDimensions: number; skippedDimensions: number; } export interface HealthReport { timestamp: string; workspaceRoot: string; environmentName?: string; workspaceId?: string; overallStatus: Exclude | 'partial'; blocking?: { development: boolean; candidate: boolean; reasons: string[]; }; dimensions: HealthCheckResult[]; errors: string[]; warnings: string[]; summary: HealthReportSummary; } export interface AuditTrail { timestamp: string; workspaceRoot: string; environmentName?: string; workspaceId?: string; overallStatus: Exclude | 'partial'; dimensions: Array<{ dimensionName: string; status: HealthStatus; skipped: boolean; errors: string[]; warnings: string[]; }>; summary: HealthReportSummary; } export interface HealthCheckProvider { readonly dimensionName: string; check(context: HealthCheckContext): Promise; } export interface WorkspaceHealthServiceOptions { now?: () => Date; apiClientFactory?: () => ApiClient; } interface ManifestValidatorProviderDeps { loadWorkspaceManifest: typeof loadWorkspaceManifest; validateWorkspaceManifest: typeof validateWorkspaceManifest; } interface PackageDriftDetectorProviderDeps { loadWorkspaceManifest: typeof loadWorkspaceManifest; resolveRegistryRoot: typeof resolveRegistryRoot; validateRegistryInstall: typeof validateRegistryInstall; apiClientFactory: () => Pick; } interface SourceDriftDetectorProviderDeps { calculateSourceStatus: typeof calculateSourceStatus; apiClientFactory: () => Pick; } interface EnvironmentStackAnalyzerProviderDeps { loadEnvironmentDescriptor: typeof loadEnvironmentDescriptor; } export interface SourceHealthCounts { synced: number; 'local-new': number; 'local-changed': number; 'local-delete': number; 'remote-new': number; 'remote-changed': number; 'remote-delete': number; conflict: number; drifted: number; 'baseline-missing': number; } export interface HealthFormatterColors { healthy: (value: string) => string; warning: (value: string) => string; error: (value: string) => string; skipped: (value: string) => string; } export interface FormatHealthReportOptions { verbose?: boolean; colors?: HealthFormatterColors; } export declare class WorkspaceHealthService { private readonly providers; private readonly now; constructor(options?: WorkspaceHealthServiceOptions); registerProvider(provider: HealthCheckProvider): void; getProviders(): HealthCheckProvider[]; checkHealth(context: HealthCheckContext): Promise; aggregateResults(context: HealthCheckContext, dimensionResults: HealthCheckResult[]): HealthReport; createAuditTrail(report: HealthReport): AuditTrail; } export declare function computeOverallHealthStatus(dimensionResults: Array & Partial>>): Exclude; export declare class ManifestValidatorProvider implements HealthCheckProvider { readonly dimensionName = "manifest"; private readonly deps; constructor(deps?: Partial); check(context: HealthCheckContext): Promise; } export declare class PackageDriftDetectorProvider implements HealthCheckProvider { readonly dimensionName = "package-drift"; private readonly deps; constructor(deps?: Partial); check(context: HealthCheckContext): Promise; } export declare class SourceDriftDetectorProvider implements HealthCheckProvider { readonly dimensionName = "source-drift"; private readonly deps; constructor(deps?: Partial); check(context: HealthCheckContext): Promise; } export declare class EnvironmentStackAnalyzerProvider implements HealthCheckProvider { readonly dimensionName = "environment-stack"; private readonly deps; constructor(deps?: Partial); check(context: HealthCheckContext): Promise; } export declare function createWorkspaceHealthService(options?: WorkspaceHealthServiceOptions): WorkspaceHealthService; export declare function formatHealthReportAsJson(report: HealthReport): string; export declare function formatHealthReport(report: HealthReport, options?: FormatHealthReportOptions): string; export declare function persistAuditTrail(auditTrail: AuditTrail, workspaceRoot: string): string; export {};