mcp-adr-analysis-server
Version:
MCP server for analyzing Architectural Decision Records and project architecture
194 lines • 5.01 kB
TypeScript
/**
* Platform information detected during bootstrap
*/
export interface PlatformInfo {
type: 'kubernetes' | 'openshift' | 'docker-compose' | 'systemd' | 'unknown';
version?: string;
detectionConfidence: number;
namespace?: string;
clusterInfo?: Record<string, any>;
}
/**
* Bootstrap context references
*/
export interface BootstrapContext {
adrPath?: string;
contextPath?: string;
validatedPatternId?: string;
bootstrapId: string;
initiatedBy?: string;
}
/**
* Individual resource record
*/
export interface ResourceRecord {
type: 'namespace' | 'deployment' | 'service' | 'configmap' | 'secret' | 'ingress' | 'statefulset' | 'pod' | 'persistentvolumeclaim' | 'custom';
name: string;
namespace?: string;
uid?: string;
labels?: Record<string, string>;
annotations?: Record<string, string>;
metadata?: Record<string, any>;
created: string;
createdByTask: string;
createdByPhase?: string;
cleanupCommand: string;
cleanupOrder?: number;
}
/**
* Cleanup strategy configuration
*/
export interface CleanupStrategy {
strategy: 'label-based' | 'explicit' | 'namespace-cascade';
labelSelector?: Record<string, string>;
dryRun?: boolean;
phases: CleanupPhase[];
}
/**
* Individual cleanup phase
*/
export interface CleanupPhase {
order: number;
name: string;
description?: string;
commands: CleanupCommand[];
canParallelize?: boolean;
estimatedDuration?: string;
}
/**
* Individual cleanup command
*/
export interface CleanupCommand {
description: string;
command: string;
expectedExitCode?: number;
continueOnError?: boolean;
verificationCommand?: string;
}
/**
* State snapshot for rollback capability
*/
export interface StateSnapshot {
timestamp: string;
beforeAction: string;
resourceCount: number;
checksum: string;
}
/**
* Complete SystemCard structure
*/
export interface SystemCard {
version: string;
systemId: string;
created: string;
lastUpdated?: string;
platform: PlatformInfo;
bootstrapContext: BootstrapContext;
resources: {
namespaces?: ResourceRecord[];
deployments?: ResourceRecord[];
services?: ResourceRecord[];
configmaps?: ResourceRecord[];
secrets?: ResourceRecord[];
ingresses?: ResourceRecord[];
statefulsets?: ResourceRecord[];
pods?: ResourceRecord[];
persistentvolumeclaims?: ResourceRecord[];
custom?: ResourceRecord[];
};
cleanup: CleanupStrategy;
snapshots?: StateSnapshot[];
metadata?: {
tags?: string[];
description?: string;
owner?: string;
};
}
/**
* Options for SystemCard initialization
*/
export interface SystemCardInitOptions {
systemId: string;
created: string;
platform: PlatformInfo;
bootstrapContext: BootstrapContext;
metadata?: {
tags?: string[];
description?: string;
owner?: string;
};
}
/**
* Manages SystemCard creation, updates, and persistence
*/
export declare class SystemCardManager {
private systemCardPath;
private logger;
private currentCard;
constructor(projectPath: string);
/**
* Initialize a new SystemCard
*/
initialize(options: SystemCardInitOptions): Promise<void>;
/**
* Load existing SystemCard from disk
*/
load(): Promise<SystemCard | null>;
/**
* Save current SystemCard to disk
*/
save(): Promise<void>;
/**
* Add resources to the SystemCard
*/
addResources(resources: ResourceRecord[], context?: {
phase?: string;
taskId?: string;
}): Promise<void>;
/**
* Remove a resource from the SystemCard
*/
removeResource(type: string, name: string, namespace?: string): Promise<void>;
/**
* Generate cleanup phases from current resources
* Resources are ordered in reverse of typical deployment order
*/
generateCleanupPhases(): Promise<CleanupPhase[]>;
/**
* Create a state snapshot for rollback capability
*/
createSnapshot(beforeAction: string): Promise<StateSnapshot>;
/**
* Get all resources of a specific type
*/
getResourcesByType(type: string): ResourceRecord[];
/**
* Get all resources created by a specific task
*/
getResourcesByTask(taskId: string): ResourceRecord[];
/**
* Get total count of all resources
*/
getResourceCount(): number;
/**
* Get current SystemCard
*/
getCurrentCard(): SystemCard | null;
/**
* Check if SystemCard exists on disk
*/
exists(): Promise<boolean>;
/**
* Delete SystemCard file from disk
*/
delete(): Promise<void>;
/**
* Map resource type to storage category
*/
private getResourceCategory;
/**
* Calculate checksum for state verification
*/
private calculateChecksum;
}
//# sourceMappingURL=system-card-manager.d.ts.map