vineguard-types
Version:
Shared TypeScript types for VineGuard - AI-powered testing orchestration
746 lines • 19.6 kB
TypeScript
export interface VineGuardConfig {
project: ProjectConfig;
prd?: PRDConfig;
tdd: TDDConfig;
testing: TestingConfig;
ai: AIConfig;
mcp: MCPConfig;
reporting: ReportingConfig;
}
export interface ProjectConfig {
type: ProjectType;
packageManager: PackageManager;
typescript: boolean;
rootPath: string;
srcPath: string;
testPath: string;
buildPath: string;
}
export type ProjectType = "react" | "vue" | "angular" | "next" | "nuxt" | "node" | "express" | "fastify" | "monorepo-react" | "monorepo-next" | "monorepo-vue" | "monorepo-angular" | "monorepo-mixed" | "monorepo-node";
export type ProjectArchitecture = "monorepo" | "traditional" | "microservices";
export type PackageManager = "npm" | "yarn" | "pnpm" | "bun";
export interface ScriptInfo {
name: string;
command: string;
category: ScriptCategory;
framework?: string;
target?: string;
environment?: string;
description?: string;
}
export declare enum ScriptCategory {
TEST = "test",
BUILD = "build",
LINT = "lint",
FORMAT = "format",
DEV = "dev",
START = "start",
DEPLOY = "deploy",
CI = "ci",
SETUP = "setup",
OTHER = "other"
}
export interface ScriptAnalysis {
total: number;
byCategory: Record<ScriptCategory, ScriptInfo[]>;
testScripts: ScriptInfo[];
buildScripts: ScriptInfo[];
recommendations: ScriptRecommendation[];
}
export interface ScriptRecommendation {
type: "missing" | "redundant" | "improvement";
script: string;
description: string;
reason: string;
suggested?: string;
}
export interface PRDConfig {
source: string;
format: PRDFormat;
extractUserStories: boolean;
generateAcceptanceCriteria: boolean;
riskAssessment: boolean;
}
export type PRDFormat = "markdown" | "text" | "docx" | "pdf" | "html";
export interface PRDAnalysis {
document: ParsedDocument;
userStories: UserStory[];
acceptanceCriteria: AcceptanceCriteria[];
testScenarios: TestScenario[];
riskAssessment: RiskAssessment;
extractedFeatures: Feature[];
businessRules: BusinessRule[];
}
export interface UserStory {
id: string;
title: string;
description: string;
userType: string;
functionality: string;
benefit: string;
priority: Priority;
estimatedComplexity: ComplexityLevel;
acceptanceCriteria: string[];
dependencies: string[];
tags: string[];
}
export interface AcceptanceCriteria {
id: string;
userStoryId: string;
description: string;
given: string;
when: string;
then: string;
priority: Priority;
testable: boolean;
}
export interface TestScenario {
id: string;
title: string;
description: string;
userStoryId: string;
type: TestType;
priority: Priority;
preconditions: string[];
steps: TestStep[];
expectedResults: string[];
tags: string[];
}
export interface TestStep {
id: string;
description: string;
action: string;
expected: string;
data?: any;
}
export type Priority = "critical" | "high" | "medium" | "low";
export type ComplexityLevel = 1 | 2 | 3 | 5 | 8 | 13 | 21;
export type TestType = "unit" | "integration" | "e2e" | "visual" | "performance" | "accessibility";
export interface TDDConfig {
enforceTestFirst: boolean;
blockUntested: boolean;
coverageThreshold: CoverageThreshold;
allowedFilePatterns: string[];
exemptPaths: string[];
strictMode: boolean;
}
export interface CoverageThreshold {
lines: number;
branches: number;
functions: number;
statements: number;
}
export interface TDDViolation {
type: ViolationType;
file: string;
severity: Severity;
message: string;
suggestedAction: string;
line?: number;
column?: number;
}
export type ViolationType = "missing-test" | "stale-test" | "low-coverage" | "untested-implementation" | "test-after-code";
export type Severity = "error" | "warning" | "info";
export interface TestingConfig {
unit: UnitTestConfig;
integration: IntegrationTestConfig;
e2e: E2ETestConfig;
visual: VisualTestConfig;
performance: PerformanceTestConfig;
accessibility: AccessibilityTestConfig;
}
export interface UnitTestConfig {
framework: UnitTestFramework;
testMatch: string[];
coverage: boolean;
parallel: boolean;
timeout: number;
setupFiles: string[];
moduleNameMapper?: Record<string, string>;
}
export interface E2ETestConfig {
frameworks: E2EFramework[];
playwright?: PlaywrightConfig;
cypress?: CypressConfig;
baseURL: string;
parallel: boolean;
retries: number;
timeout: number;
headless: boolean;
}
export type UnitTestFramework = "jest" | "vitest" | "mocha";
export type E2EFramework = "playwright" | "cypress" | "puppeteer";
export interface AIConfig {
enabled: boolean;
providers: AIProvider[];
patterns: AIPatternType[];
autoFix: AutoFixConfig;
contextSize: ContextSize;
confidenceThreshold: number;
}
export interface AutoFixConfig {
safe: boolean;
requireConfirmation: boolean;
backupOriginal: boolean;
maxFixes: number;
}
export type AIProvider = "claude" | "openai" | "cursor" | "github-copilot";
export type AIPatternType = "all" | "missing-error-boundaries" | "unhandled-promises" | "state-management" | "performance" | "accessibility" | "security";
export type ContextSize = "file" | "directory" | "project";
export interface MCPConfig {
enabled: boolean;
port: number;
realTimeUpdates: boolean;
ideIntegration: IDEIntegrationConfig;
websocket: WebSocketConfig;
}
export interface IDEIntegrationConfig {
cursor: boolean;
claudeCode: boolean;
vscode: boolean;
}
export interface WebSocketConfig {
enabled: boolean;
port: number;
maxConnections: number;
heartbeat: number;
}
export interface ProjectScanResult {
type: ProjectType;
architecture: ProjectArchitecture;
framework: string;
packageManager: PackageManager;
testingFrameworks: string[];
structure: ProjectStructure;
dependencies: DependencyAnalysis;
ports: number[];
configuration: ConfigurationFiles;
metrics: ProjectMetrics;
scripts: ScriptAnalysis;
}
export interface ProjectStructure {
root: string;
source: DirectoryInfo;
tests: DirectoryInfo;
build: DirectoryInfo;
public: DirectoryInfo;
config: DirectoryInfo;
components: ComponentInfo[];
pages: PageInfo[];
services: ServiceInfo[];
utils: UtilityInfo[];
}
export interface DirectoryInfo {
path: string;
files: FileInfo[];
subdirectories: DirectoryInfo[];
fileCount: number;
totalSize: number;
}
export interface FileInfo {
name: string;
path: string;
extension: string;
size: number;
lastModified: Date;
type: FileType;
complexity?: ComplexityMetrics;
dependencies: string[];
exports: string[];
imports: string[];
}
export type FileType = "component" | "page" | "service" | "utility" | "test" | "config" | "asset" | "documentation";
export interface DependencyAnalysis {
production: PackageDependency[];
development: PackageDependency[];
peer: PackageDependency[];
optional: PackageDependency[];
vulnerabilities: VulnerabilityInfo[];
outdated: OutdatedPackage[];
}
export interface PackageDependency {
name: string;
version: string;
description: string;
license: string;
size: number;
dependencies: string[];
}
export interface TestPlan {
id: string;
name: string;
description: string;
unitTests: UnitTestPlan[];
integrationTests: IntegrationTestPlan[];
e2eTests: E2ETestPlan[];
visualTests: VisualTestPlan[];
performanceTests: PerformanceTestPlan[];
accessibilityTests: AccessibilityTestPlan[];
executionStrategy: ExecutionStrategy;
estimatedDuration: number;
dependencies: TestDependency[];
}
export interface UnitTestPlan {
id: string;
name: string;
framework: UnitTestFramework;
files: string[];
coverage: CoverageConfig;
mocks: MockConfig[];
fixtures: FixtureConfig[];
timeout: number;
retries: number;
priority: Priority;
}
export interface E2ETestPlan {
id: string;
name: string;
framework: E2EFramework;
userFlow: UserFlow;
browsers: BrowserConfig[];
viewport: Viewport;
testSteps: E2ETestStep[];
dependencies: string[];
priority: Priority;
estimatedDuration: number;
flakiness: FlakinessScore;
}
export interface UserFlow {
id: string;
name: string;
description: string;
userType: string;
startPage: string;
endPage: string;
criticalPath: boolean;
steps: UserFlowStep[];
}
export interface UserFlowStep {
id: string;
description: string;
action: UserAction;
target: ElementSelector;
data?: any;
expected: ExpectedResult;
screenshot?: boolean;
}
export interface ElementSelector {
strategy: SelectorStrategy;
value: string;
fallbacks: string[];
}
export type SelectorStrategy = "testid" | "role" | "text" | "css" | "xpath" | "aria-label" | "placeholder";
export interface ExecutionStrategy {
parallel: boolean;
maxWorkers: number;
retryFailedTests: boolean;
maxRetries: number;
failFast: boolean;
randomOrder: boolean;
testTimeout: number;
setupTimeout: number;
teardownTimeout: number;
}
export interface TestResults {
id: string;
testPlanId: string;
startTime: Date;
endTime: Date;
duration: number;
status: TestStatus;
summary: TestSummary;
unitResults: UnitTestResults;
integrationResults: IntegrationTestResults;
e2eResults: E2ETestResults;
visualResults: VisualTestResults;
performanceResults: PerformanceTestResults;
accessibilityResults: AccessibilityTestResults;
coverage: CoverageReport;
artifacts: TestArtifact[];
}
export interface TestSummary {
total: number;
passed: number;
failed: number;
skipped: number;
flaky: number;
passRate: number;
flakyRate: number;
}
export type TestStatus = "passed" | "failed" | "skipped" | "running" | "pending";
export interface AIAnalysisResult {
file: string;
timestamp: Date;
issues: CodeIssue[];
suggestions: CodeSuggestion[];
aiInsights: AIInsight[];
fixRecommendations: FixRecommendation[];
qualityScore: QualityScore;
patterns: DetectedPattern[];
}
export interface CodeIssue {
id: string;
type: IssueType;
severity: Severity;
line: number;
column: number;
message: string;
description: string;
rule: string;
category: IssueCategory;
autoFixable: boolean;
confidence: number;
impact: ImpactLevel;
}
export interface CodeSuggestion {
id: string;
type: SuggestionType;
message: string;
description: string;
code?: string;
line?: number;
column?: number;
confidence: number;
impact: ImpactLevel;
}
export interface FixRecommendation {
issueId: string;
type: FixType;
description: string;
code: string;
safe: boolean;
confidence: number;
impact: ImpactLevel;
preview: CodePreview;
}
export interface AIInsight {
type: InsightType;
message: string;
confidence: number;
evidence: string[];
recommendations: string[];
}
export type IssueType = "syntax-error" | "type-error" | "logic-error" | "performance" | "security" | "accessibility" | "maintainability" | "anti-pattern";
export type IssueCategory = "error" | "warning" | "style" | "suggestion" | "security" | "performance";
export type SuggestionType = "refactor" | "optimize" | "modernize" | "test-coverage" | "error-handling" | "type-safety";
export type FixType = "auto-fix" | "manual-fix" | "refactor" | "add-test" | "add-type" | "add-error-handling";
export type InsightType = "ai-generated-code" | "complexity-analysis" | "pattern-detection" | "code-quality" | "test-suggestions";
export type ImpactLevel = "low" | "medium" | "high" | "critical";
export interface ReportingConfig {
formats: ReportFormat[];
output: string;
realTime: boolean;
qualityMetrics: boolean;
trendAnalysis: boolean;
notifications: NotificationConfig;
}
export interface QualityReport {
timestamp: Date;
project: ProjectInfo;
summary: QualitySummary;
testResults: TestResults;
codeAnalysis: CodeAnalysisReport;
coverage: CoverageReport;
performance: PerformanceReport;
trends: TrendAnalysis;
recommendations: QualityRecommendation[];
}
export interface QualitySummary {
overallScore: number;
testScore: number;
codeScore: number;
coverageScore: number;
performanceScore: number;
maintainabilityScore: number;
securityScore: number;
accessibilityScore: number;
}
export type ReportFormat = "html" | "json" | "xml" | "junit" | "markdown";
export interface VineGuardEvent {
type: EventType;
timestamp: Date;
source: EventSource;
data: any;
metadata?: EventMetadata;
}
export type EventType = "test-started" | "test-completed" | "test-failed" | "code-analyzed" | "tdd-violation" | "coverage-updated" | "file-changed" | "project-scanned";
export type EventSource = "jest-runner" | "playwright-runner" | "cypress-runner" | "ai-analyzer" | "tdd-enforcer" | "project-scanner" | "mcp-server";
export interface EventMetadata {
userId?: string;
sessionId?: string;
projectId?: string;
version?: string;
environment?: string;
}
export interface ComplexityMetrics {
cyclomaticComplexity: number;
cognitiveComplexity: number;
linesOfCode: number;
maintainabilityIndex: number;
technicalDebt: TechnicalDebt;
}
export interface TechnicalDebt {
minutes: number;
rating: DebtRating;
issues: TechnicalDebtIssue[];
}
export type DebtRating = "A" | "B" | "C" | "D" | "E";
export interface Viewport {
width: number;
height: number;
name: string;
deviceScaleFactor?: number;
}
export interface BrowserConfig {
name: string;
version: string;
headless: boolean;
viewport: Viewport;
deviceEmulation?: DeviceEmulation;
}
export interface DeviceEmulation {
name: string;
userAgent: string;
viewport: Viewport;
deviceScaleFactor: number;
isMobile: boolean;
hasTouch: boolean;
}
export interface FlakinessScore {
score: number;
factors: FlakinessFactor[];
history: FlakinessHistory[];
}
export interface FlakinessFactor {
type: string;
impact: number;
description: string;
}
export interface FlakinessHistory {
date: Date;
passed: boolean;
duration: number;
environment: string;
}
export interface CoverageReport {
overall: CoverageSummary;
files: FileCoverage[];
timestamp: Date;
thresholds: CoverageThreshold;
watermarks: CoverageWatermarks;
}
export interface CoverageSummary {
lines: CoverageMetric;
branches: CoverageMetric;
functions: CoverageMetric;
statements: CoverageMetric;
}
export interface CoverageMetric {
total: number;
covered: number;
skipped: number;
pct: number;
}
export interface FileCoverage {
path: string;
summary: CoverageSummary;
lines: LineCoverage[];
branches: BranchCoverage[];
functions: FunctionCoverage[];
}
export interface LineCoverage {
line: number;
count: number;
covered: boolean;
}
export interface BranchCoverage {
line: number;
branch: number;
taken: boolean;
count: number;
}
export interface FunctionCoverage {
name: string;
line: number;
count: number;
covered: boolean;
}
export interface CoverageWatermarks {
lines: [number, number];
functions: [number, number];
branches: [number, number];
statements: [number, number];
}
export type IntegrationTestConfig = UnitTestConfig;
export type VisualTestConfig = {
enabled: boolean;
tool: string;
threshold: number;
};
export type PerformanceTestConfig = {
enabled: boolean;
thresholds: any;
scenarios: any[];
};
export type AccessibilityTestConfig = {
enabled: boolean;
standards: string[];
level: string;
};
export type PlaywrightConfig = Record<string, any>;
export type CypressConfig = Record<string, any>;
export type IntegrationTestPlan = UnitTestPlan;
export type VisualTestPlan = {
comparisons: any[];
};
export type PerformanceTestPlan = {
scenarios: any[];
};
export type AccessibilityTestPlan = {
standards: string[];
rules: string[];
};
export type TestDependency = {
type: string;
name: string;
required: boolean;
};
export type MockConfig = {
target: string;
implementation: any;
};
export type FixtureConfig = {
name: string;
data: any;
};
export type CoverageConfig = {
enabled: boolean;
threshold: CoverageThreshold;
};
export type UnitTestResults = TestResults;
export type IntegrationTestResults = TestResults;
export type E2ETestResults = TestResults;
export type VisualTestResults = TestResults;
export type PerformanceTestResults = TestResults;
export type AccessibilityTestResults = TestResults;
export type TestArtifact = {
type: string;
path: string;
metadata: any;
};
export type VulnerabilityInfo = {
severity: string;
description: string;
package: string;
};
export type OutdatedPackage = {
name: string;
current: string;
wanted: string;
latest: string;
};
export type ComponentInfo = {
name: string;
path: string;
type: string;
props: string[];
};
export type PageInfo = {
name: string;
path: string;
route: string;
components: string[];
};
export type ServiceInfo = {
name: string;
path: string;
methods: string[];
};
export type UtilityInfo = {
name: string;
path: string;
functions: string[];
};
export type ConfigurationFiles = Record<string, any>;
export type ProjectMetrics = {
complexity: number;
maintainability: number;
testability: number;
};
export type ProjectInfo = {
name: string;
version: string;
description: string;
};
export type CodeAnalysisReport = {
issues: CodeIssue[];
suggestions: CodeSuggestion[];
};
export type PerformanceReport = {
metrics: any;
issues: any[];
};
export type TrendAnalysis = {
period: string;
data: any[];
};
export type QualityRecommendation = {
type: string;
priority: Priority;
description: string;
};
export type NotificationConfig = {
enabled: boolean;
channels: string[];
threshold: string;
};
export type TechnicalDebtIssue = {
type: string;
severity: string;
effort: number;
};
export type DetectedPattern = {
name: string;
confidence: number;
location: any;
};
export type QualityScore = {
overall: number;
breakdown: Record<string, number>;
};
export type ParsedDocument = {
title: string;
sections: any[];
};
export type Feature = {
name: string;
description: string;
priority: Priority;
};
export type BusinessRule = {
id: string;
description: string;
conditions: string[];
};
export type RiskAssessment = {
level: string;
factors: any[];
};
export type E2ETestStep = {
action: string;
target: string;
expected: string;
};
export type UserAction = "click" | "type" | "hover" | "scroll" | "navigate" | "wait" | "select";
export type ExpectedResult = {
type: string;
value: any;
timeout?: number;
};
export type CodePreview = {
before: string[];
current: string;
after: string[];
line: number;
};
//# sourceMappingURL=core.d.ts.map