UNPKG

@vfarcic/dot-ai

Version:

AI-powered development productivity platform that enhances software development workflows through intelligent automation and AI-driven assistance

184 lines 5.59 kB
/** * Kubernetes Discovery Module * * Handles cluster connection, resource discovery, and capability detection */ export interface ClusterInfo { type: string; version: string; capabilities: string[]; } export interface ResourceMap { resources: EnhancedResource[]; custom: EnhancedCRD[]; } export interface EnhancedCRD { name: string; group: string; version: string; kind: string; scope: 'Namespaced' | 'Cluster'; resourcePlural: string; versions: Array<{ name: string; served: boolean; storage: boolean; schema?: Record<string, unknown>; additionalPrinterColumns?: Array<{ name: string; type: string; jsonPath: string; description?: string; priority?: number; }>; }>; schema?: Record<string, unknown>; } export interface EnhancedResource { name: string; namespaced: boolean; kind: string; shortNames: string[]; apiVersion: string; group: string; } export interface ResourceExplanation { kind: string; version: string; group: string; description: string; fields: Array<{ name: string; type: string; description: string; required: boolean; }>; } export interface ClusterFingerprint { version: string; platform: string; nodeCount: number; namespaceCount: number; crdCount: number; capabilities: string[]; features: { deployments: number; services: number; pods: number; configMaps: number; secrets: number; }; networking: { cni: string; serviceSubnet: string; podSubnet: string; dnsProvider: string; }; security: { rbacEnabled: boolean; podSecurityPolicy: boolean; networkPolicies: boolean; admissionControllers: string[]; }; storage: { storageClasses: string[]; persistentVolumes: number; csiDrivers: string[]; }; } /** * PRD #343: KubernetesDiscovery simplified - all K8s operations go through plugin * PRD #359: Uses unified plugin registry for all operations * No longer uses @kubernetes/client-node or kubeconfig directly. */ export declare class KubernetesDiscovery { /** * Test connection to the cluster with detailed result * PRD #359: Uses unified plugin registry */ testConnection(): Promise<{ connected: boolean; version?: string; error?: string; errorType?: string; }>; getClusterInfo(): Promise<ClusterInfo>; /** * PRD #343: Simplified cluster type detection * Returns 'in-cluster' when running in K8s, 'vanilla-k8s' otherwise */ private detectClusterType; private detectCapabilities; discoverResources(): Promise<ResourceMap>; /** * Execute kubectl command via plugin * PRD #359: Uses unified plugin registry */ executeKubectl(args: string[]): Promise<string>; /** * Parse a raw CRD object into EnhancedCRD format */ private parseCRDItem; /** * Fetch a single CRD by name with all metadata including printer columns * This is the single source of truth for CRD data - used by both full and targeted scans */ getCRDData(crdName: string): Promise<EnhancedCRD>; discoverCRDs(options?: { group?: string; }): Promise<EnhancedCRD[]>; getAPIResources(options?: { group?: string; }): Promise<EnhancedResource[]>; explainResource(resource: string, options?: { field?: string; }): Promise<string>; /** * Get CRD definition with cleaned-up YAML (removes massive annotations and unnecessary fields) * @param crdName - Name of the CRD (e.g., 'workflows.argoproj.io') * @returns Cleaned YAML string suitable for AI prompts */ getCRDDefinition(crdName: string): Promise<string>; /** * Get printer columns for a resource type via plugin * PRD #343: Uses kubectl_get_printer_columns plugin tool instead of direct API calls * * @param resourcePlural - Plural name of the resource (e.g., 'deployments', 'pods', 'sqls') * @param apiVersion - Full API version (e.g., 'apps/v1', 'v1', 'devopstoolkit.live/v1beta1') * @returns Array of printer column definitions (may be empty if resource has no custom columns) * @throws Error on API/auth failures */ getPrinterColumns(resourcePlural: string, apiVersion: string): Promise<Array<{ name: string; type: string; jsonPath: string; description?: string; priority?: number; }>>; fingerprintCluster(): Promise<ClusterFingerprint>; private getResourceCounts; private getNetworkingInfo; private getSecurityInfo; private getStorageInfo; private extractSubnet; getResourceSchema(_kind: string, _apiVersion: string): Promise<Record<string, unknown>>; getNamespaces(): Promise<string[]>; namespaceExists(namespace: string): Promise<boolean>; /** * Discover what capabilities a CRD provides by analyzing related resources */ private discoverCRDCapabilities; /** * Find Compositions associated with this CRD */ private discoverAssociatedCompositions; /** * Analyze what resources a Composition creates */ private analyzeCompositionCapabilities; /** * Build an enhanced description that includes discovered capabilities */ private buildEnhancedDescription; } //# sourceMappingURL=discovery.d.ts.map