mcp-adr-analysis-server
Version:
MCP server for analyzing Architectural Decision Records and project architecture
433 lines • 14.7 kB
TypeScript
/**
* Core TypeScript interfaces for MCP ADR Analysis Server
* Based on shrimp-rules.md requirements
*/
import { z } from 'zod';
/**
* Architectural Decision Record (ADR) interface
* Represents a documented architectural decision with context and consequences
*/
export interface Adr {
/** Unique identifier for the ADR */
id: string;
/** Title of the architectural decision */
title: string;
/** Current status of the decision */
status: 'proposed' | 'accepted' | 'deprecated' | 'superseded';
/** Date when the decision was made */
date: string;
/** Context and background for the decision */
context: string;
/** The architectural decision that was made */
decision: string;
/** Consequences and implications of the decision */
consequences: string;
/** Optional implementation plan */
implementationPlan?: string;
/** File path where the ADR is stored */
filePath: string;
/** Optional tags for categorization */
tags?: string[];
/** IDs of related ADRs */
relatedAdrs?: string[];
}
export declare const AdrSchema: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
status: z.ZodEnum<{
proposed: "proposed";
accepted: "accepted";
deprecated: "deprecated";
superseded: "superseded";
}>;
date: z.ZodString;
context: z.ZodString;
decision: z.ZodString;
consequences: z.ZodString;
implementationPlan: z.ZodOptional<z.ZodString>;
filePath: z.ZodString;
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
relatedAdrs: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
/**
* Represents a technology detected in the project
*/
export interface DetectedTechnology {
/** Name of the detected technology */
name: string;
/** Category of the technology */
category: 'framework' | 'library' | 'database' | 'cloud' | 'devops' | 'language' | 'tool';
/** Version of the technology (if detected) */
version?: string;
/** Confidence level of detection (0-1 scale) */
confidence: number;
/** Evidence supporting the detection */
evidence: string[];
/** File paths where the technology was detected */
filePaths: string[];
description?: string;
}
export declare const DetectedTechnologySchema: z.ZodObject<{
name: z.ZodString;
category: z.ZodEnum<{
framework: "framework";
library: "library";
database: "database";
cloud: "cloud";
devops: "devops";
language: "language";
tool: "tool";
}>;
version: z.ZodOptional<z.ZodString>;
confidence: z.ZodNumber;
evidence: z.ZodArray<z.ZodString>;
filePaths: z.ZodArray<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
/**
* Represents an architectural pattern detected in the project
*/
export interface DetectedPattern {
/** Name of the detected pattern */
name: string;
/** Type/category of the pattern */
type: 'architectural' | 'structural' | 'organizational' | 'communication' | 'testing' | 'data';
/** Confidence level of detection (0-1 scale) */
confidence: number;
/** Description of the pattern */
description: string;
/** Evidence supporting the pattern detection */
evidence: string[];
/** File paths where the pattern was detected */
filePaths: string[];
/** Whether the pattern implementation is suboptimal */
suboptimal?: boolean;
/** Recommendations for improvement */
recommendations?: string[];
}
export declare const DetectedPatternSchema: z.ZodObject<{
name: z.ZodString;
type: z.ZodEnum<{
architectural: "architectural";
structural: "structural";
organizational: "organizational";
communication: "communication";
testing: "testing";
data: "data";
}>;
confidence: z.ZodNumber;
description: z.ZodString;
evidence: z.ZodArray<z.ZodString>;
filePaths: z.ZodArray<z.ZodString>;
suboptimal: z.ZodOptional<z.ZodBoolean>;
recommendations: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
/**
* Complete architectural knowledge graph for a project
* Contains all architectural decisions, technologies, patterns, and their relationships
*/
export interface ArchitecturalKnowledgeGraph {
/** Unique identifier for the project */
projectId: string;
/** Timestamp when the graph was generated */
timestamp: string;
/** All architectural decision records */
adrs: Adr[];
/** Detected technologies in the project */
technologies: DetectedTechnology[];
/** Detected architectural patterns */
patterns: DetectedPattern[];
/** Generated or defined rules */
rules: Rule[];
/** Relationships between different elements */
relationships: Relationship[];
/** Project metadata and statistics */
metadata: ProjectMetadata;
}
/**
* Represents a relationship between two architectural elements
*/
export interface Relationship {
/** Source element ID */
source: string;
/** Target element ID */
target: string;
/** Type of relationship */
type: 'implements' | 'depends_on' | 'conflicts_with' | 'supersedes' | 'relates_to';
/** Strength of the relationship (0-1 scale) */
strength: number;
/** Optional description of the relationship */
description?: string;
}
/**
* Metadata about the analyzed project
*/
export interface ProjectMetadata {
/** Project name */
name: string;
/** Project description */
description?: string;
/** Project version */
version?: string;
/** Timestamp of last analysis */
lastAnalyzed: string;
/** Version of the analysis tool used */
analysisVersion: string;
/** Total number of files in the project */
fileCount: number;
/** Total number of directories in the project */
directoryCount: number;
}
export declare const ArchitecturalKnowledgeGraphSchema: z.ZodObject<{
projectId: z.ZodString;
timestamp: z.ZodString;
adrs: z.ZodArray<z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
status: z.ZodEnum<{
proposed: "proposed";
accepted: "accepted";
deprecated: "deprecated";
superseded: "superseded";
}>;
date: z.ZodString;
context: z.ZodString;
decision: z.ZodString;
consequences: z.ZodString;
implementationPlan: z.ZodOptional<z.ZodString>;
filePath: z.ZodString;
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
relatedAdrs: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>>;
technologies: z.ZodArray<z.ZodObject<{
name: z.ZodString;
category: z.ZodEnum<{
framework: "framework";
library: "library";
database: "database";
cloud: "cloud";
devops: "devops";
language: "language";
tool: "tool";
}>;
version: z.ZodOptional<z.ZodString>;
confidence: z.ZodNumber;
evidence: z.ZodArray<z.ZodString>;
filePaths: z.ZodArray<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
patterns: z.ZodArray<z.ZodObject<{
name: z.ZodString;
type: z.ZodEnum<{
architectural: "architectural";
structural: "structural";
organizational: "organizational";
communication: "communication";
testing: "testing";
data: "data";
}>;
confidence: z.ZodNumber;
description: z.ZodString;
evidence: z.ZodArray<z.ZodString>;
filePaths: z.ZodArray<z.ZodString>;
suboptimal: z.ZodOptional<z.ZodBoolean>;
recommendations: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>>;
rules: z.ZodArray<z.ZodAny>;
relationships: z.ZodArray<z.ZodObject<{
source: z.ZodString;
target: z.ZodString;
type: z.ZodEnum<{
implements: "implements";
depends_on: "depends_on";
conflicts_with: "conflicts_with";
supersedes: "supersedes";
relates_to: "relates_to";
}>;
strength: z.ZodNumber;
description: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
metadata: z.ZodObject<{
name: z.ZodString;
description: z.ZodOptional<z.ZodString>;
version: z.ZodOptional<z.ZodString>;
lastAnalyzed: z.ZodString;
analysisVersion: z.ZodString;
fileCount: z.ZodNumber;
directoryCount: z.ZodNumber;
}, z.core.$strip>;
}, z.core.$strip>;
/**
* Represents a task derived from an ADR implementation plan
*/
export interface AdrTask {
/** Unique identifier for the task */
id: string;
/** ID of the ADR this task belongs to */
adrId: string;
/** Title of the task */
title: string;
/** Detailed description of the task */
description: string;
/** Current status of the task */
status: 'pending' | 'in_progress' | 'completed' | 'blocked';
/** Priority level of the task */
priority: 'low' | 'medium' | 'high' | 'critical';
/** Estimated effort required */
estimatedEffort?: string;
/** Person assigned to the task */
assignee?: string;
/** Due date for task completion */
dueDate?: string;
/** Other tasks this task depends on */
dependencies?: string[];
/** Criteria for verifying task completion */
verificationCriteria?: string;
/** Evidence that the task has been completed */
completionEvidence?: string[];
}
export declare const AdrTaskSchema: z.ZodObject<{
id: z.ZodString;
adrId: z.ZodString;
title: z.ZodString;
description: z.ZodString;
status: z.ZodEnum<{
pending: "pending";
completed: "completed";
in_progress: "in_progress";
blocked: "blocked";
}>;
priority: z.ZodEnum<{
medium: "medium";
low: "low";
high: "high";
critical: "critical";
}>;
estimatedEffort: z.ZodOptional<z.ZodString>;
assignee: z.ZodOptional<z.ZodString>;
dueDate: z.ZodOptional<z.ZodString>;
dependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
verificationCriteria: z.ZodOptional<z.ZodString>;
completionEvidence: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
/**
* Represents a validation or analysis rule
*/
export interface Rule {
/** Unique identifier for the rule */
id: string;
/** Human-readable name of the rule */
name: string;
/** Description of what the rule validates */
description: string;
/** Category of the rule */
type: 'architectural' | 'coding' | 'security' | 'performance' | 'documentation';
/** Severity level when rule is violated */
severity: 'info' | 'warning' | 'error' | 'critical';
/** Regex or glob pattern to match against */
pattern: string;
/** Message to display when rule is violated */
message: string;
/** Source of the rule definition */
source: 'adr' | 'inferred' | 'user_defined';
/** ID of source ADR if rule comes from an ADR */
sourceId?: string;
/** Whether the rule is currently enabled */
enabled: boolean;
/** Optional tags for categorization */
tags?: string[];
}
export declare const RuleSchema: z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
description: z.ZodString;
type: z.ZodEnum<{
performance: "performance";
architectural: "architectural";
coding: "coding";
security: "security";
documentation: "documentation";
}>;
severity: z.ZodEnum<{
error: "error";
warning: "warning";
info: "info";
critical: "critical";
}>;
pattern: z.ZodString;
message: z.ZodString;
source: z.ZodEnum<{
adr: "adr";
inferred: "inferred";
user_defined: "user_defined";
}>;
sourceId: z.ZodOptional<z.ZodString>;
enabled: z.ZodBoolean;
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
/**
* Base error class for MCP ADR Analysis Server
* Provides structured error handling with error codes and additional details
*/
export declare class McpAdrError extends Error {
/** Error code for programmatic handling */
readonly code: string;
/** Additional error details and context */
readonly details?: Record<string, unknown>;
constructor(message: string, code: string, details?: Record<string, unknown>);
}
/**
* Error thrown when data validation fails
*/
export declare class ValidationError extends McpAdrError {
constructor(message: string, details?: Record<string, unknown>);
}
/**
* Error thrown when file system operations fail
*/
export declare class FileSystemError extends McpAdrError {
constructor(message: string, details?: Record<string, unknown>);
}
/**
* Error thrown when analysis operations fail
*/
export declare class AnalysisError extends McpAdrError {
constructor(message: string, details?: Record<string, unknown>);
}
export type ConfidenceLevel = 'low' | 'medium' | 'high';
/**
* Generic wrapper for analysis results with metadata
*/
export interface AnalysisResult<T> {
/** The actual analysis data */
data: T;
/** Confidence level of the analysis (0-1) */
confidence: number;
/** Timestamp when analysis was performed */
timestamp: string;
/** Source of the analysis */
source: string;
/** Optional warnings from the analysis */
warnings?: string[];
/** Optional errors encountered during analysis */
errors?: string[];
}
/**
* Generic cache entry with TTL and metadata
*/
export interface CacheEntry<T> {
/** Cache key for retrieval */
key: string;
/** Cached data */
data: T;
/** Timestamp when entry was created */
timestamp: string;
/** Time to live in seconds */
ttl: number;
/** Optional metadata about the cached entry */
metadata?: Record<string, unknown>;
}
export type { ArchitecturalDomain, KnowledgeCategory, KnowledgeGenerationConfig, ArchitecturalContext, ProjectContext, DomainKnowledge, KnowledgeItem, KnowledgeGenerationResult, } from './knowledge-generation.js';
export type { APEConfig, GenerationStrategy, EvaluationCriterion, SelectionStrategy, PromptCandidate, OptimizationResult, ToolOptimizationConfig, EvaluationResult, PerformanceMetrics, } from './ape-framework.js';
export type { ReflexionConfig, TaskAttempt, ReflexionMemory, MemoryType, ReflectionDepth, LearningProgress, ReflexionResult, MemoryQuery, ToolReflexionConfig, SelfReflection, LearningOutcome, } from './reflexion-framework.js';
//# sourceMappingURL=index.d.ts.map