sdd-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +256 -0
- package/dist/__tests__/setup.d.ts +44 -0
- package/dist/__tests__/setup.js +178 -0
- package/dist/__tests__/setup.js.map +1 -0
- package/dist/__tests__/test-helpers/mock-factories.d.ts +26 -0
- package/dist/__tests__/test-helpers/mock-factories.js +466 -0
- package/dist/__tests__/test-helpers/mock-factories.js.map +1 -0
- package/dist/adapters/cli/SDDToolAdapter.d.ts +26 -0
- package/dist/adapters/cli/SDDToolAdapter.js +273 -0
- package/dist/adapters/cli/SDDToolAdapter.js.map +1 -0
- package/dist/application/services/CodebaseAnalysisService.d.ts +38 -0
- package/dist/application/services/CodebaseAnalysisService.js +737 -0
- package/dist/application/services/CodebaseAnalysisService.js.map +1 -0
- package/dist/application/services/LocalizationService.d.ts +184 -0
- package/dist/application/services/LocalizationService.js +536 -0
- package/dist/application/services/LocalizationService.js.map +1 -0
- package/dist/application/services/ProjectContextService.d.ts +61 -0
- package/dist/application/services/ProjectContextService.js +550 -0
- package/dist/application/services/ProjectContextService.js.map +1 -0
- package/dist/application/services/ProjectInitializationService.d.ts +57 -0
- package/dist/application/services/ProjectInitializationService.js +485 -0
- package/dist/application/services/ProjectInitializationService.js.map +1 -0
- package/dist/application/services/ProjectService.d.ts +19 -0
- package/dist/application/services/ProjectService.js +159 -0
- package/dist/application/services/ProjectService.js.map +1 -0
- package/dist/application/services/QualityGateService.d.ts +62 -0
- package/dist/application/services/QualityGateService.js +428 -0
- package/dist/application/services/QualityGateService.js.map +1 -0
- package/dist/application/services/QualityService.d.ts +43 -0
- package/dist/application/services/QualityService.js +245 -0
- package/dist/application/services/QualityService.js.map +1 -0
- package/dist/application/services/SteeringDocumentService.d.ts +62 -0
- package/dist/application/services/SteeringDocumentService.js +694 -0
- package/dist/application/services/SteeringDocumentService.js.map +1 -0
- package/dist/application/services/TemplateService.d.ts +47 -0
- package/dist/application/services/TemplateService.js +438 -0
- package/dist/application/services/TemplateService.js.map +1 -0
- package/dist/application/services/WorkflowEngineService.d.ts +56 -0
- package/dist/application/services/WorkflowEngineService.js +348 -0
- package/dist/application/services/WorkflowEngineService.js.map +1 -0
- package/dist/application/services/WorkflowService.d.ts +22 -0
- package/dist/application/services/WorkflowService.js +147 -0
- package/dist/application/services/WorkflowService.js.map +1 -0
- package/dist/application/services/WorkflowValidationService.d.ts +51 -0
- package/dist/application/services/WorkflowValidationService.js +665 -0
- package/dist/application/services/WorkflowValidationService.js.map +1 -0
- package/dist/domain/context/ProjectContext.d.ts +350 -0
- package/dist/domain/context/ProjectContext.js +138 -0
- package/dist/domain/context/ProjectContext.js.map +1 -0
- package/dist/domain/i18n/index.d.ts +286 -0
- package/dist/domain/i18n/index.js +97 -0
- package/dist/domain/i18n/index.js.map +1 -0
- package/dist/domain/plugins/index.d.ts +498 -0
- package/dist/domain/plugins/index.js +157 -0
- package/dist/domain/plugins/index.js.map +1 -0
- package/dist/domain/ports.d.ts +54 -0
- package/dist/domain/ports.js +3 -0
- package/dist/domain/ports.js.map +1 -0
- package/dist/domain/quality/index.d.ts +361 -0
- package/dist/domain/quality/index.js +113 -0
- package/dist/domain/quality/index.js.map +1 -0
- package/dist/domain/services/DomainService.d.ts +18 -0
- package/dist/domain/services/DomainService.js +71 -0
- package/dist/domain/services/DomainService.js.map +1 -0
- package/dist/domain/templates/index.d.ts +158 -0
- package/dist/domain/templates/index.js +22 -0
- package/dist/domain/templates/index.js.map +1 -0
- package/dist/domain/types.d.ts +115 -0
- package/dist/domain/types.js +37 -0
- package/dist/domain/types.js.map +1 -0
- package/dist/domain/workflow/WorkflowStateMachine.d.ts +62 -0
- package/dist/domain/workflow/WorkflowStateMachine.js +286 -0
- package/dist/domain/workflow/WorkflowStateMachine.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +97 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/adapters/AjvValidationAdapter.d.ts +7 -0
- package/dist/infrastructure/adapters/AjvValidationAdapter.js +37 -0
- package/dist/infrastructure/adapters/AjvValidationAdapter.js.map +1 -0
- package/dist/infrastructure/adapters/ConsoleLoggerAdapter.d.ts +8 -0
- package/dist/infrastructure/adapters/ConsoleLoggerAdapter.js +41 -0
- package/dist/infrastructure/adapters/ConsoleLoggerAdapter.js.map +1 -0
- package/dist/infrastructure/adapters/FileBasedTaskTracker.d.ts +9 -0
- package/dist/infrastructure/adapters/FileBasedTaskTracker.js +41 -0
- package/dist/infrastructure/adapters/FileBasedTaskTracker.js.map +1 -0
- package/dist/infrastructure/adapters/HandlebarsTemplateEngine.d.ts +8 -0
- package/dist/infrastructure/adapters/HandlebarsTemplateEngine.js +38 -0
- package/dist/infrastructure/adapters/HandlebarsTemplateEngine.js.map +1 -0
- package/dist/infrastructure/adapters/JsonConfigurationAdapter.d.ts +7 -0
- package/dist/infrastructure/adapters/JsonConfigurationAdapter.js +24 -0
- package/dist/infrastructure/adapters/JsonConfigurationAdapter.js.map +1 -0
- package/dist/infrastructure/adapters/LinusQualityAnalyzer.d.ts +9 -0
- package/dist/infrastructure/adapters/LinusQualityAnalyzer.js +75 -0
- package/dist/infrastructure/adapters/LinusQualityAnalyzer.js.map +1 -0
- package/dist/infrastructure/adapters/NodeFileSystemAdapter.d.ts +12 -0
- package/dist/infrastructure/adapters/NodeFileSystemAdapter.js +39 -0
- package/dist/infrastructure/adapters/NodeFileSystemAdapter.js.map +1 -0
- package/dist/infrastructure/di/container.d.ts +3 -0
- package/dist/infrastructure/di/container.js +98 -0
- package/dist/infrastructure/di/container.js.map +1 -0
- package/dist/infrastructure/di/types.d.ts +39 -0
- package/dist/infrastructure/di/types.js +45 -0
- package/dist/infrastructure/di/types.js.map +1 -0
- package/dist/infrastructure/i18n/I18nextService.d.ts +27 -0
- package/dist/infrastructure/i18n/I18nextService.js +357 -0
- package/dist/infrastructure/i18n/I18nextService.js.map +1 -0
- package/dist/infrastructure/mcp/CapabilityNegotiator.d.ts +21 -0
- package/dist/infrastructure/mcp/CapabilityNegotiator.js +75 -0
- package/dist/infrastructure/mcp/CapabilityNegotiator.js.map +1 -0
- package/dist/infrastructure/mcp/ErrorHandler.d.ts +29 -0
- package/dist/infrastructure/mcp/ErrorHandler.js +101 -0
- package/dist/infrastructure/mcp/ErrorHandler.js.map +1 -0
- package/dist/infrastructure/mcp/MCPServer.d.ts +25 -0
- package/dist/infrastructure/mcp/MCPServer.js +246 -0
- package/dist/infrastructure/mcp/MCPServer.js.map +1 -0
- package/dist/infrastructure/mcp/PromptManager.d.ts +18 -0
- package/dist/infrastructure/mcp/PromptManager.js +373 -0
- package/dist/infrastructure/mcp/PromptManager.js.map +1 -0
- package/dist/infrastructure/mcp/ResourceManager.d.ts +15 -0
- package/dist/infrastructure/mcp/ResourceManager.js +229 -0
- package/dist/infrastructure/mcp/ResourceManager.js.map +1 -0
- package/dist/infrastructure/mcp/SessionManager.d.ts +64 -0
- package/dist/infrastructure/mcp/SessionManager.js +221 -0
- package/dist/infrastructure/mcp/SessionManager.js.map +1 -0
- package/dist/infrastructure/mcp/ToolRegistry.d.ts +48 -0
- package/dist/infrastructure/mcp/ToolRegistry.js +235 -0
- package/dist/infrastructure/mcp/ToolRegistry.js.map +1 -0
- package/dist/infrastructure/platform/PlatformAdapter.d.ts +46 -0
- package/dist/infrastructure/platform/PlatformAdapter.js +355 -0
- package/dist/infrastructure/platform/PlatformAdapter.js.map +1 -0
- package/dist/infrastructure/plugins/HookSystem.d.ts +40 -0
- package/dist/infrastructure/plugins/HookSystem.js +415 -0
- package/dist/infrastructure/plugins/HookSystem.js.map +1 -0
- package/dist/infrastructure/plugins/PluginManager.d.ts +51 -0
- package/dist/infrastructure/plugins/PluginManager.js +650 -0
- package/dist/infrastructure/plugins/PluginManager.js.map +1 -0
- package/dist/infrastructure/plugins/PluginSteeringRegistry.d.ts +63 -0
- package/dist/infrastructure/plugins/PluginSteeringRegistry.js +439 -0
- package/dist/infrastructure/plugins/PluginSteeringRegistry.js.map +1 -0
- package/dist/infrastructure/plugins/PluginToolRegistry.d.ts +54 -0
- package/dist/infrastructure/plugins/PluginToolRegistry.js +490 -0
- package/dist/infrastructure/plugins/PluginToolRegistry.js.map +1 -0
- package/dist/infrastructure/quality/ASTAnalyzer.d.ts +65 -0
- package/dist/infrastructure/quality/ASTAnalyzer.js +439 -0
- package/dist/infrastructure/quality/ASTAnalyzer.js.map +1 -0
- package/dist/infrastructure/quality/LinusCodeReviewer.d.ts +52 -0
- package/dist/infrastructure/quality/LinusCodeReviewer.js +551 -0
- package/dist/infrastructure/quality/LinusCodeReviewer.js.map +1 -0
- package/dist/infrastructure/repositories/InMemoryProjectRepository.d.ts +10 -0
- package/dist/infrastructure/repositories/InMemoryProjectRepository.js +35 -0
- package/dist/infrastructure/repositories/InMemoryProjectRepository.js.map +1 -0
- package/dist/infrastructure/schemas/project.schema.d.ts +192 -0
- package/dist/infrastructure/schemas/project.schema.js +114 -0
- package/dist/infrastructure/schemas/project.schema.js.map +1 -0
- package/dist/infrastructure/templates/FileGenerator.d.ts +15 -0
- package/dist/infrastructure/templates/FileGenerator.js +385 -0
- package/dist/infrastructure/templates/FileGenerator.js.map +1 -0
- package/dist/infrastructure/templates/HandlebarsRenderer.d.ts +16 -0
- package/dist/infrastructure/templates/HandlebarsRenderer.js +252 -0
- package/dist/infrastructure/templates/HandlebarsRenderer.js.map +1 -0
- package/dist/infrastructure/templates/TemplateManager.d.ts +36 -0
- package/dist/infrastructure/templates/TemplateManager.js +777 -0
- package/dist/infrastructure/templates/TemplateManager.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Project, QualityReport, Task } from './types.js';
|
|
2
|
+
export interface ProjectRepository {
|
|
3
|
+
save(project: Project): Promise<void>;
|
|
4
|
+
findById(id: string): Promise<Project | null>;
|
|
5
|
+
findByPath(path: string): Promise<Project | null>;
|
|
6
|
+
list(): Promise<Project[]>;
|
|
7
|
+
delete(id: string): Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export interface FileSystemPort {
|
|
10
|
+
readFile(path: string): Promise<string>;
|
|
11
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
12
|
+
exists(path: string): Promise<boolean>;
|
|
13
|
+
mkdir(path: string): Promise<void>;
|
|
14
|
+
readdir(path: string): Promise<string[]>;
|
|
15
|
+
stat(path: string): Promise<{
|
|
16
|
+
isFile(): boolean;
|
|
17
|
+
isDirectory(): boolean;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export interface TemplateEngine {
|
|
21
|
+
compile(template: string): Promise<TemplateFunction>;
|
|
22
|
+
render(template: string, data: Record<string, unknown>): Promise<string>;
|
|
23
|
+
registerHelper(name: string, helper: (...args: unknown[]) => string): void;
|
|
24
|
+
}
|
|
25
|
+
export interface TemplateFunction {
|
|
26
|
+
(data: Record<string, unknown>): string;
|
|
27
|
+
}
|
|
28
|
+
export interface ConfigurationPort {
|
|
29
|
+
get<T>(key: string): T | undefined;
|
|
30
|
+
set<T>(key: string, value: T): void;
|
|
31
|
+
has(key: string): boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface LoggerPort {
|
|
34
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
35
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
36
|
+
error(message: string, error?: Error, meta?: Record<string, unknown>): void;
|
|
37
|
+
debug(message: string, meta?: Record<string, unknown>): void;
|
|
38
|
+
}
|
|
39
|
+
export interface ValidationPort {
|
|
40
|
+
validate<T>(data: unknown, schema: object): Promise<T>;
|
|
41
|
+
createSchema(schemaDefinition: object): object;
|
|
42
|
+
}
|
|
43
|
+
export interface QualityAnalyzer {
|
|
44
|
+
analyzeCode(code: string, language: string): Promise<QualityReport>;
|
|
45
|
+
analyzeDataStructure(structure: object): Promise<QualityReport>;
|
|
46
|
+
checkComplexity(code: string): Promise<number>;
|
|
47
|
+
detectSpecialCases(code: string): Promise<string[]>;
|
|
48
|
+
}
|
|
49
|
+
export interface TaskTracker {
|
|
50
|
+
getTasks(projectId: string): Promise<Task[]>;
|
|
51
|
+
updateTask(projectId: string, taskId: string, completed: boolean): Promise<void>;
|
|
52
|
+
addTask(projectId: string, task: Omit<Task, 'id'>): Promise<Task>;
|
|
53
|
+
removeTask(projectId: string, taskId: string): Promise<void>;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/domain/ports.ts"],"names":[],"mappings":"AAAA,yCAAyC"}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
export interface CodeAnalysisResult {
|
|
2
|
+
readonly filePath: string;
|
|
3
|
+
readonly language: ProgrammingLanguage;
|
|
4
|
+
readonly overallScore: QualityScore;
|
|
5
|
+
readonly tasteAnalysis: TasteAnalysis;
|
|
6
|
+
readonly complexityAnalysis: ComplexityAnalysis;
|
|
7
|
+
readonly specialCaseAnalysis: SpecialCaseAnalysis;
|
|
8
|
+
readonly dataStructureAnalysis: DataStructureAnalysis;
|
|
9
|
+
readonly organizationAnalysis: OrganizationAnalysis;
|
|
10
|
+
readonly violations: QualityViolation[];
|
|
11
|
+
readonly suggestions: QualityImprovement[];
|
|
12
|
+
readonly metrics: CodeMetrics;
|
|
13
|
+
readonly analyzedAt: Date;
|
|
14
|
+
}
|
|
15
|
+
export interface TasteAnalysis {
|
|
16
|
+
readonly score: TasteScore;
|
|
17
|
+
readonly reasoning: string;
|
|
18
|
+
readonly elegance: number;
|
|
19
|
+
readonly simplicity: number;
|
|
20
|
+
readonly intuition: number;
|
|
21
|
+
readonly readability: number;
|
|
22
|
+
readonly examples: TasteExample[];
|
|
23
|
+
}
|
|
24
|
+
export interface ComplexityAnalysis {
|
|
25
|
+
readonly cyclomaticComplexity: number;
|
|
26
|
+
readonly cognitiveComplexity: number;
|
|
27
|
+
readonly nestingDepth: number;
|
|
28
|
+
readonly lineCount: number;
|
|
29
|
+
readonly functionCount: number;
|
|
30
|
+
readonly classCount: number;
|
|
31
|
+
readonly score: number;
|
|
32
|
+
readonly hotspots: ComplexityHotspot[];
|
|
33
|
+
readonly recommendations: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface SpecialCaseAnalysis {
|
|
36
|
+
readonly specialCases: SpecialCase[];
|
|
37
|
+
readonly score: number;
|
|
38
|
+
readonly generalizations: GeneralizationSuggestion[];
|
|
39
|
+
readonly magicNumbers: MagicNumber[];
|
|
40
|
+
readonly hardcodedValues: HardcodedValue[];
|
|
41
|
+
}
|
|
42
|
+
export interface DataStructureAnalysis {
|
|
43
|
+
readonly appropriateness: number;
|
|
44
|
+
readonly efficiency: number;
|
|
45
|
+
readonly memoryUsage: MemoryAnalysis;
|
|
46
|
+
readonly accessPatterns: AccessPatternAnalysis[];
|
|
47
|
+
readonly suggestions: DataStructureSuggestion[];
|
|
48
|
+
}
|
|
49
|
+
export interface OrganizationAnalysis {
|
|
50
|
+
readonly singleResponsibility: number;
|
|
51
|
+
readonly separationOfConcerns: number;
|
|
52
|
+
readonly naming: NamingAnalysis;
|
|
53
|
+
readonly structure: StructureAnalysis;
|
|
54
|
+
readonly dependencies: DependencyAnalysis;
|
|
55
|
+
readonly cohesion: number;
|
|
56
|
+
readonly coupling: number;
|
|
57
|
+
}
|
|
58
|
+
export interface QualityViolation {
|
|
59
|
+
readonly type: ViolationType;
|
|
60
|
+
readonly severity: ViolationSeverity;
|
|
61
|
+
readonly line: number;
|
|
62
|
+
readonly column?: number;
|
|
63
|
+
readonly message: string;
|
|
64
|
+
readonly rule: string;
|
|
65
|
+
readonly suggestion: string;
|
|
66
|
+
readonly example?: string;
|
|
67
|
+
}
|
|
68
|
+
export interface QualityImprovement {
|
|
69
|
+
readonly type: ImprovementType;
|
|
70
|
+
readonly priority: ImprovementPriority;
|
|
71
|
+
readonly description: string;
|
|
72
|
+
readonly before: string;
|
|
73
|
+
readonly after: string;
|
|
74
|
+
readonly benefit: string;
|
|
75
|
+
readonly effort: EffortEstimate;
|
|
76
|
+
}
|
|
77
|
+
export interface TasteExample {
|
|
78
|
+
readonly category: TasteCategory;
|
|
79
|
+
readonly code: string;
|
|
80
|
+
readonly issue: string;
|
|
81
|
+
readonly improvement: string;
|
|
82
|
+
readonly impact: TasteImpact;
|
|
83
|
+
}
|
|
84
|
+
export interface ComplexityHotspot {
|
|
85
|
+
readonly functionName: string;
|
|
86
|
+
readonly line: number;
|
|
87
|
+
readonly complexity: number;
|
|
88
|
+
readonly type: ComplexityType;
|
|
89
|
+
readonly reason: string;
|
|
90
|
+
readonly suggestion: string;
|
|
91
|
+
}
|
|
92
|
+
export interface SpecialCase {
|
|
93
|
+
readonly line: number;
|
|
94
|
+
readonly type: SpecialCaseType;
|
|
95
|
+
readonly description: string;
|
|
96
|
+
readonly generalization: string;
|
|
97
|
+
readonly confidence: number;
|
|
98
|
+
}
|
|
99
|
+
export interface GeneralizationSuggestion {
|
|
100
|
+
readonly description: string;
|
|
101
|
+
readonly impact: string;
|
|
102
|
+
readonly effort: EffortEstimate;
|
|
103
|
+
readonly examples: string[];
|
|
104
|
+
}
|
|
105
|
+
export interface MagicNumber {
|
|
106
|
+
readonly value: number | string;
|
|
107
|
+
readonly line: number;
|
|
108
|
+
readonly context: string;
|
|
109
|
+
readonly suggestedConstant: string;
|
|
110
|
+
}
|
|
111
|
+
export interface HardcodedValue {
|
|
112
|
+
readonly value: string;
|
|
113
|
+
readonly line: number;
|
|
114
|
+
readonly type: HardcodedType;
|
|
115
|
+
readonly suggestion: string;
|
|
116
|
+
}
|
|
117
|
+
export interface MemoryAnalysis {
|
|
118
|
+
readonly usage: MemoryUsage;
|
|
119
|
+
readonly efficiency: number;
|
|
120
|
+
readonly leaks: MemoryLeak[];
|
|
121
|
+
readonly optimizations: MemoryOptimization[];
|
|
122
|
+
}
|
|
123
|
+
export interface AccessPatternAnalysis {
|
|
124
|
+
readonly pattern: AccessPattern;
|
|
125
|
+
readonly frequency: number;
|
|
126
|
+
readonly efficiency: number;
|
|
127
|
+
readonly suggestion?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface DataStructureSuggestion {
|
|
130
|
+
readonly current: string;
|
|
131
|
+
readonly suggested: string;
|
|
132
|
+
readonly reason: string;
|
|
133
|
+
readonly benefit: string;
|
|
134
|
+
readonly tradeoffs: string[];
|
|
135
|
+
}
|
|
136
|
+
export interface NamingAnalysis {
|
|
137
|
+
readonly consistency: number;
|
|
138
|
+
readonly clarity: number;
|
|
139
|
+
readonly conventions: ConventionCompliance[];
|
|
140
|
+
readonly suggestions: NamingSuggestion[];
|
|
141
|
+
}
|
|
142
|
+
export interface StructureAnalysis {
|
|
143
|
+
readonly logicalFlow: number;
|
|
144
|
+
readonly layering: number;
|
|
145
|
+
readonly modularity: number;
|
|
146
|
+
readonly issues: StructuralIssue[];
|
|
147
|
+
}
|
|
148
|
+
export interface DependencyAnalysis {
|
|
149
|
+
readonly count: number;
|
|
150
|
+
readonly depth: number;
|
|
151
|
+
readonly circular: CircularDependency[];
|
|
152
|
+
readonly unnecessary: UnnecessaryDependency[];
|
|
153
|
+
readonly suggestions: DependencyImprovement[];
|
|
154
|
+
}
|
|
155
|
+
export interface CodeMetrics {
|
|
156
|
+
readonly linesOfCode: number;
|
|
157
|
+
readonly linesOfComments: number;
|
|
158
|
+
readonly commentRatio: number;
|
|
159
|
+
readonly testCoverage?: number;
|
|
160
|
+
readonly maintainabilityIndex: number;
|
|
161
|
+
readonly technicalDebt: TechnicalDebtAnalysis;
|
|
162
|
+
}
|
|
163
|
+
export interface TechnicalDebtAnalysis {
|
|
164
|
+
readonly totalHours: number;
|
|
165
|
+
readonly categories: DebtCategory[];
|
|
166
|
+
readonly priority: DebtPriority[];
|
|
167
|
+
readonly trends: DebtTrend[];
|
|
168
|
+
}
|
|
169
|
+
export declare enum ProgrammingLanguage {
|
|
170
|
+
TYPESCRIPT = "typescript",
|
|
171
|
+
JAVASCRIPT = "javascript",
|
|
172
|
+
PYTHON = "python",
|
|
173
|
+
JAVA = "java",
|
|
174
|
+
GO = "go",
|
|
175
|
+
RUST = "rust",
|
|
176
|
+
CPP = "cpp",
|
|
177
|
+
CSHARP = "csharp"
|
|
178
|
+
}
|
|
179
|
+
export declare enum QualityScore {
|
|
180
|
+
GOOD = "good",
|
|
181
|
+
PASSABLE = "passable",
|
|
182
|
+
GARBAGE = "garbage"
|
|
183
|
+
}
|
|
184
|
+
export declare enum TasteScore {
|
|
185
|
+
GOOD = "good",
|
|
186
|
+
PASSABLE = "passable",
|
|
187
|
+
GARBAGE = "garbage"
|
|
188
|
+
}
|
|
189
|
+
export declare enum ViolationType {
|
|
190
|
+
TASTE = "taste",
|
|
191
|
+
COMPLEXITY = "complexity",
|
|
192
|
+
SPECIAL_CASE = "special-case",
|
|
193
|
+
DATA_STRUCTURE = "data-structure",
|
|
194
|
+
ORGANIZATION = "organization",
|
|
195
|
+
SECURITY = "security",
|
|
196
|
+
PERFORMANCE = "performance"
|
|
197
|
+
}
|
|
198
|
+
export declare enum ViolationSeverity {
|
|
199
|
+
CRITICAL = "critical",
|
|
200
|
+
MAJOR = "major",
|
|
201
|
+
MINOR = "minor",
|
|
202
|
+
SUGGESTION = "suggestion"
|
|
203
|
+
}
|
|
204
|
+
export declare enum ImprovementType {
|
|
205
|
+
REFACTOR = "refactor",
|
|
206
|
+
OPTIMIZE = "optimize",
|
|
207
|
+
SIMPLIFY = "simplify",
|
|
208
|
+
REORGANIZE = "reorganize",
|
|
209
|
+
MODERNIZE = "modernize"
|
|
210
|
+
}
|
|
211
|
+
export declare enum ImprovementPriority {
|
|
212
|
+
HIGH = "high",
|
|
213
|
+
MEDIUM = "medium",
|
|
214
|
+
LOW = "low"
|
|
215
|
+
}
|
|
216
|
+
export declare enum EffortEstimate {
|
|
217
|
+
TRIVIAL = "trivial",// < 1 hour
|
|
218
|
+
SMALL = "small",// 1-4 hours
|
|
219
|
+
MEDIUM = "medium",// 4-16 hours
|
|
220
|
+
LARGE = "large",// 16-40 hours
|
|
221
|
+
MASSIVE = "massive"
|
|
222
|
+
}
|
|
223
|
+
export declare enum TasteCategory {
|
|
224
|
+
ELEGANCE = "elegance",
|
|
225
|
+
SIMPLICITY = "simplicity",
|
|
226
|
+
CLARITY = "clarity",
|
|
227
|
+
CONSISTENCY = "consistency"
|
|
228
|
+
}
|
|
229
|
+
export declare enum TasteImpact {
|
|
230
|
+
LOW = "low",
|
|
231
|
+
MEDIUM = "medium",
|
|
232
|
+
HIGH = "high"
|
|
233
|
+
}
|
|
234
|
+
export declare enum ComplexityType {
|
|
235
|
+
CYCLOMATIC = "cyclomatic",
|
|
236
|
+
COGNITIVE = "cognitive",
|
|
237
|
+
NESTING = "nesting",
|
|
238
|
+
LENGTH = "length"
|
|
239
|
+
}
|
|
240
|
+
export declare enum SpecialCaseType {
|
|
241
|
+
CONDITIONAL = "conditional",
|
|
242
|
+
EXCEPTION = "exception",
|
|
243
|
+
EDGE_CASE = "edge-case",
|
|
244
|
+
WORKAROUND = "workaround"
|
|
245
|
+
}
|
|
246
|
+
export declare enum HardcodedType {
|
|
247
|
+
STRING = "string",
|
|
248
|
+
NUMBER = "number",
|
|
249
|
+
URL = "url",
|
|
250
|
+
PATH = "path",
|
|
251
|
+
CONFIG = "config"
|
|
252
|
+
}
|
|
253
|
+
export declare enum MemoryUsage {
|
|
254
|
+
EFFICIENT = "efficient",
|
|
255
|
+
MODERATE = "moderate",
|
|
256
|
+
WASTEFUL = "wasteful"
|
|
257
|
+
}
|
|
258
|
+
export declare enum AccessPattern {
|
|
259
|
+
SEQUENTIAL = "sequential",
|
|
260
|
+
RANDOM = "random",
|
|
261
|
+
BULK = "bulk",
|
|
262
|
+
SPARSE = "sparse"
|
|
263
|
+
}
|
|
264
|
+
export interface MemoryLeak {
|
|
265
|
+
readonly line: number;
|
|
266
|
+
readonly type: string;
|
|
267
|
+
readonly description: string;
|
|
268
|
+
readonly severity: ViolationSeverity;
|
|
269
|
+
}
|
|
270
|
+
export interface MemoryOptimization {
|
|
271
|
+
readonly description: string;
|
|
272
|
+
readonly impact: string;
|
|
273
|
+
readonly effort: EffortEstimate;
|
|
274
|
+
}
|
|
275
|
+
export interface ConventionCompliance {
|
|
276
|
+
readonly convention: string;
|
|
277
|
+
readonly compliance: number;
|
|
278
|
+
readonly violations: string[];
|
|
279
|
+
}
|
|
280
|
+
export interface NamingSuggestion {
|
|
281
|
+
readonly current: string;
|
|
282
|
+
readonly suggested: string;
|
|
283
|
+
readonly reason: string;
|
|
284
|
+
readonly line: number;
|
|
285
|
+
}
|
|
286
|
+
export interface StructuralIssue {
|
|
287
|
+
readonly type: string;
|
|
288
|
+
readonly description: string;
|
|
289
|
+
readonly impact: string;
|
|
290
|
+
readonly suggestion: string;
|
|
291
|
+
}
|
|
292
|
+
export interface CircularDependency {
|
|
293
|
+
readonly cycle: string[];
|
|
294
|
+
readonly impact: string;
|
|
295
|
+
readonly suggestion: string;
|
|
296
|
+
}
|
|
297
|
+
export interface UnnecessaryDependency {
|
|
298
|
+
readonly dependency: string;
|
|
299
|
+
readonly reason: string;
|
|
300
|
+
readonly suggestion: string;
|
|
301
|
+
}
|
|
302
|
+
export interface DependencyImprovement {
|
|
303
|
+
readonly description: string;
|
|
304
|
+
readonly benefit: string;
|
|
305
|
+
readonly effort: EffortEstimate;
|
|
306
|
+
}
|
|
307
|
+
export interface DebtCategory {
|
|
308
|
+
readonly name: string;
|
|
309
|
+
readonly hours: number;
|
|
310
|
+
readonly percentage: number;
|
|
311
|
+
}
|
|
312
|
+
export interface DebtPriority {
|
|
313
|
+
readonly issue: string;
|
|
314
|
+
readonly hours: number;
|
|
315
|
+
readonly impact: string;
|
|
316
|
+
readonly urgency: number;
|
|
317
|
+
}
|
|
318
|
+
export interface DebtTrend {
|
|
319
|
+
readonly period: string;
|
|
320
|
+
readonly change: number;
|
|
321
|
+
readonly direction: 'increasing' | 'decreasing' | 'stable';
|
|
322
|
+
}
|
|
323
|
+
export interface CodeQualityAnalyzerPort {
|
|
324
|
+
analyzeFile(filePath: string, content: string): Promise<CodeAnalysisResult>;
|
|
325
|
+
analyzeBatch(files: Array<{
|
|
326
|
+
path: string;
|
|
327
|
+
content: string;
|
|
328
|
+
}>): Promise<CodeAnalysisResult[]>;
|
|
329
|
+
getQualityReport(results: CodeAnalysisResult[]): Promise<QualityReport>;
|
|
330
|
+
}
|
|
331
|
+
export interface QualityReport {
|
|
332
|
+
readonly overall: QualityScore;
|
|
333
|
+
readonly summary: QualitySummary;
|
|
334
|
+
readonly files: CodeAnalysisResult[];
|
|
335
|
+
readonly trends: QualityTrend[];
|
|
336
|
+
readonly recommendations: QualityRecommendation[];
|
|
337
|
+
readonly generatedAt: Date;
|
|
338
|
+
}
|
|
339
|
+
export interface QualitySummary {
|
|
340
|
+
readonly totalFiles: number;
|
|
341
|
+
readonly goodFiles: number;
|
|
342
|
+
readonly passableFiles: number;
|
|
343
|
+
readonly garbageFiles: number;
|
|
344
|
+
readonly averageScore: number;
|
|
345
|
+
readonly topIssues: string[];
|
|
346
|
+
readonly technicalDebt: number;
|
|
347
|
+
}
|
|
348
|
+
export interface QualityTrend {
|
|
349
|
+
readonly metric: string;
|
|
350
|
+
readonly current: number;
|
|
351
|
+
readonly previous: number;
|
|
352
|
+
readonly change: number;
|
|
353
|
+
readonly direction: 'improving' | 'degrading' | 'stable';
|
|
354
|
+
}
|
|
355
|
+
export interface QualityRecommendation {
|
|
356
|
+
readonly priority: ImprovementPriority;
|
|
357
|
+
readonly description: string;
|
|
358
|
+
readonly impact: string;
|
|
359
|
+
readonly effort: EffortEstimate;
|
|
360
|
+
readonly files: string[];
|
|
361
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Domain models and interfaces for code quality analysis
|
|
2
|
+
// Enums and types
|
|
3
|
+
export var ProgrammingLanguage;
|
|
4
|
+
(function (ProgrammingLanguage) {
|
|
5
|
+
ProgrammingLanguage["TYPESCRIPT"] = "typescript";
|
|
6
|
+
ProgrammingLanguage["JAVASCRIPT"] = "javascript";
|
|
7
|
+
ProgrammingLanguage["PYTHON"] = "python";
|
|
8
|
+
ProgrammingLanguage["JAVA"] = "java";
|
|
9
|
+
ProgrammingLanguage["GO"] = "go";
|
|
10
|
+
ProgrammingLanguage["RUST"] = "rust";
|
|
11
|
+
ProgrammingLanguage["CPP"] = "cpp";
|
|
12
|
+
ProgrammingLanguage["CSHARP"] = "csharp";
|
|
13
|
+
})(ProgrammingLanguage || (ProgrammingLanguage = {}));
|
|
14
|
+
export var QualityScore;
|
|
15
|
+
(function (QualityScore) {
|
|
16
|
+
QualityScore["GOOD"] = "good";
|
|
17
|
+
QualityScore["PASSABLE"] = "passable";
|
|
18
|
+
QualityScore["GARBAGE"] = "garbage";
|
|
19
|
+
})(QualityScore || (QualityScore = {}));
|
|
20
|
+
export var TasteScore;
|
|
21
|
+
(function (TasteScore) {
|
|
22
|
+
TasteScore["GOOD"] = "good";
|
|
23
|
+
TasteScore["PASSABLE"] = "passable";
|
|
24
|
+
TasteScore["GARBAGE"] = "garbage";
|
|
25
|
+
})(TasteScore || (TasteScore = {}));
|
|
26
|
+
export var ViolationType;
|
|
27
|
+
(function (ViolationType) {
|
|
28
|
+
ViolationType["TASTE"] = "taste";
|
|
29
|
+
ViolationType["COMPLEXITY"] = "complexity";
|
|
30
|
+
ViolationType["SPECIAL_CASE"] = "special-case";
|
|
31
|
+
ViolationType["DATA_STRUCTURE"] = "data-structure";
|
|
32
|
+
ViolationType["ORGANIZATION"] = "organization";
|
|
33
|
+
ViolationType["SECURITY"] = "security";
|
|
34
|
+
ViolationType["PERFORMANCE"] = "performance";
|
|
35
|
+
})(ViolationType || (ViolationType = {}));
|
|
36
|
+
export var ViolationSeverity;
|
|
37
|
+
(function (ViolationSeverity) {
|
|
38
|
+
ViolationSeverity["CRITICAL"] = "critical";
|
|
39
|
+
ViolationSeverity["MAJOR"] = "major";
|
|
40
|
+
ViolationSeverity["MINOR"] = "minor";
|
|
41
|
+
ViolationSeverity["SUGGESTION"] = "suggestion";
|
|
42
|
+
})(ViolationSeverity || (ViolationSeverity = {}));
|
|
43
|
+
export var ImprovementType;
|
|
44
|
+
(function (ImprovementType) {
|
|
45
|
+
ImprovementType["REFACTOR"] = "refactor";
|
|
46
|
+
ImprovementType["OPTIMIZE"] = "optimize";
|
|
47
|
+
ImprovementType["SIMPLIFY"] = "simplify";
|
|
48
|
+
ImprovementType["REORGANIZE"] = "reorganize";
|
|
49
|
+
ImprovementType["MODERNIZE"] = "modernize";
|
|
50
|
+
})(ImprovementType || (ImprovementType = {}));
|
|
51
|
+
export var ImprovementPriority;
|
|
52
|
+
(function (ImprovementPriority) {
|
|
53
|
+
ImprovementPriority["HIGH"] = "high";
|
|
54
|
+
ImprovementPriority["MEDIUM"] = "medium";
|
|
55
|
+
ImprovementPriority["LOW"] = "low";
|
|
56
|
+
})(ImprovementPriority || (ImprovementPriority = {}));
|
|
57
|
+
export var EffortEstimate;
|
|
58
|
+
(function (EffortEstimate) {
|
|
59
|
+
EffortEstimate["TRIVIAL"] = "trivial";
|
|
60
|
+
EffortEstimate["SMALL"] = "small";
|
|
61
|
+
EffortEstimate["MEDIUM"] = "medium";
|
|
62
|
+
EffortEstimate["LARGE"] = "large";
|
|
63
|
+
EffortEstimate["MASSIVE"] = "massive"; // > 40 hours
|
|
64
|
+
})(EffortEstimate || (EffortEstimate = {}));
|
|
65
|
+
export var TasteCategory;
|
|
66
|
+
(function (TasteCategory) {
|
|
67
|
+
TasteCategory["ELEGANCE"] = "elegance";
|
|
68
|
+
TasteCategory["SIMPLICITY"] = "simplicity";
|
|
69
|
+
TasteCategory["CLARITY"] = "clarity";
|
|
70
|
+
TasteCategory["CONSISTENCY"] = "consistency";
|
|
71
|
+
})(TasteCategory || (TasteCategory = {}));
|
|
72
|
+
export var TasteImpact;
|
|
73
|
+
(function (TasteImpact) {
|
|
74
|
+
TasteImpact["LOW"] = "low";
|
|
75
|
+
TasteImpact["MEDIUM"] = "medium";
|
|
76
|
+
TasteImpact["HIGH"] = "high";
|
|
77
|
+
})(TasteImpact || (TasteImpact = {}));
|
|
78
|
+
export var ComplexityType;
|
|
79
|
+
(function (ComplexityType) {
|
|
80
|
+
ComplexityType["CYCLOMATIC"] = "cyclomatic";
|
|
81
|
+
ComplexityType["COGNITIVE"] = "cognitive";
|
|
82
|
+
ComplexityType["NESTING"] = "nesting";
|
|
83
|
+
ComplexityType["LENGTH"] = "length";
|
|
84
|
+
})(ComplexityType || (ComplexityType = {}));
|
|
85
|
+
export var SpecialCaseType;
|
|
86
|
+
(function (SpecialCaseType) {
|
|
87
|
+
SpecialCaseType["CONDITIONAL"] = "conditional";
|
|
88
|
+
SpecialCaseType["EXCEPTION"] = "exception";
|
|
89
|
+
SpecialCaseType["EDGE_CASE"] = "edge-case";
|
|
90
|
+
SpecialCaseType["WORKAROUND"] = "workaround";
|
|
91
|
+
})(SpecialCaseType || (SpecialCaseType = {}));
|
|
92
|
+
export var HardcodedType;
|
|
93
|
+
(function (HardcodedType) {
|
|
94
|
+
HardcodedType["STRING"] = "string";
|
|
95
|
+
HardcodedType["NUMBER"] = "number";
|
|
96
|
+
HardcodedType["URL"] = "url";
|
|
97
|
+
HardcodedType["PATH"] = "path";
|
|
98
|
+
HardcodedType["CONFIG"] = "config";
|
|
99
|
+
})(HardcodedType || (HardcodedType = {}));
|
|
100
|
+
export var MemoryUsage;
|
|
101
|
+
(function (MemoryUsage) {
|
|
102
|
+
MemoryUsage["EFFICIENT"] = "efficient";
|
|
103
|
+
MemoryUsage["MODERATE"] = "moderate";
|
|
104
|
+
MemoryUsage["WASTEFUL"] = "wasteful";
|
|
105
|
+
})(MemoryUsage || (MemoryUsage = {}));
|
|
106
|
+
export var AccessPattern;
|
|
107
|
+
(function (AccessPattern) {
|
|
108
|
+
AccessPattern["SEQUENTIAL"] = "sequential";
|
|
109
|
+
AccessPattern["RANDOM"] = "random";
|
|
110
|
+
AccessPattern["BULK"] = "bulk";
|
|
111
|
+
AccessPattern["SPARSE"] = "sparse";
|
|
112
|
+
})(AccessPattern || (AccessPattern = {}));
|
|
113
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/domain/quality/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AAgMzD,kBAAkB;AAClB,MAAM,CAAN,IAAY,mBASX;AATD,WAAY,mBAAmB;IAC7B,gDAAyB,CAAA;IACzB,gDAAyB,CAAA;IACzB,wCAAiB,CAAA;IACjB,oCAAa,CAAA;IACb,gCAAS,CAAA;IACT,oCAAa,CAAA;IACb,kCAAW,CAAA;IACX,wCAAiB,CAAA;AACnB,CAAC,EATW,mBAAmB,KAAnB,mBAAmB,QAS9B;AAED,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,qCAAqB,CAAA;IACrB,mCAAmB,CAAA;AACrB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,2BAAa,CAAA;IACb,mCAAqB,CAAA;IACrB,iCAAmB,CAAA;AACrB,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAED,MAAM,CAAN,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,0CAAyB,CAAA;IACzB,8CAA6B,CAAA;IAC7B,kDAAiC,CAAA;IACjC,8CAA6B,CAAA;IAC7B,sCAAqB,CAAA;IACrB,4CAA2B,CAAA;AAC7B,CAAC,EARW,aAAa,KAAb,aAAa,QAQxB;AAED,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC3B,0CAAqB,CAAA;IACrB,oCAAe,CAAA;IACf,oCAAe,CAAA;IACf,8CAAyB,CAAA;AAC3B,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AAED,MAAM,CAAN,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,wCAAqB,CAAA;IACrB,wCAAqB,CAAA;IACrB,wCAAqB,CAAA;IACrB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A;AACnB,CAAC,EANW,aAAa,KAAb,aAAa,QAMxB;AAED,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,sCAAuB,CAAA;IACvB,oCAAqB,CAAA;IACrB,oCAAqB,CAAA;AACvB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,0CAAyB,CAAA;IACzB,kCAAiB,CAAA;IACjB,8BAAa,CAAA;IACb,kCAAiB,CAAA;AACnB,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Project, WorkflowPhase, Task } from '../types.js';
|
|
2
|
+
export declare class WorkflowDomainService {
|
|
3
|
+
static canTransitionToPhase(project: Project, targetPhase: WorkflowPhase): boolean;
|
|
4
|
+
static isReadyForImplementation(project: Project): boolean;
|
|
5
|
+
static getRequiredApprovals(project: Project, targetPhase: WorkflowPhase): string[];
|
|
6
|
+
}
|
|
7
|
+
export declare class TaskDomainService {
|
|
8
|
+
static calculateProgress(tasks: Task[]): {
|
|
9
|
+
completed: number;
|
|
10
|
+
total: number;
|
|
11
|
+
percentage: number;
|
|
12
|
+
};
|
|
13
|
+
static getBlockingTasks(tasks: Task[]): Task[];
|
|
14
|
+
static validateTaskCompletion(task: Task): {
|
|
15
|
+
isValid: boolean;
|
|
16
|
+
reason?: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Domain services contain business logic that doesn't naturally fit within entities
|
|
2
|
+
import { WorkflowPhase } from '../types.js';
|
|
3
|
+
export class WorkflowDomainService {
|
|
4
|
+
static canTransitionToPhase(project, targetPhase) {
|
|
5
|
+
const { phase, metadata } = project;
|
|
6
|
+
const { approvals } = metadata;
|
|
7
|
+
switch (targetPhase) {
|
|
8
|
+
case WorkflowPhase.INIT:
|
|
9
|
+
return true; // Can always go back to init
|
|
10
|
+
case WorkflowPhase.REQUIREMENTS:
|
|
11
|
+
return phase === WorkflowPhase.INIT;
|
|
12
|
+
case WorkflowPhase.DESIGN:
|
|
13
|
+
return approvals.requirements.generated && approvals.requirements.approved;
|
|
14
|
+
case WorkflowPhase.TASKS:
|
|
15
|
+
return approvals.design.generated && approvals.design.approved;
|
|
16
|
+
case WorkflowPhase.IMPLEMENTATION:
|
|
17
|
+
return approvals.tasks.generated && approvals.tasks.approved;
|
|
18
|
+
default:
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
static isReadyForImplementation(project) {
|
|
23
|
+
const { approvals } = project.metadata;
|
|
24
|
+
return approvals.requirements.approved &&
|
|
25
|
+
approvals.design.approved &&
|
|
26
|
+
approvals.tasks.approved;
|
|
27
|
+
}
|
|
28
|
+
static getRequiredApprovals(project, targetPhase) {
|
|
29
|
+
const missing = [];
|
|
30
|
+
if (targetPhase === WorkflowPhase.DESIGN) {
|
|
31
|
+
if (!project.metadata.approvals.requirements.approved) {
|
|
32
|
+
missing.push('requirements');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (targetPhase === WorkflowPhase.TASKS) {
|
|
36
|
+
if (!project.metadata.approvals.design.approved) {
|
|
37
|
+
missing.push('design');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (targetPhase === WorkflowPhase.IMPLEMENTATION) {
|
|
41
|
+
if (!project.metadata.approvals.tasks.approved) {
|
|
42
|
+
missing.push('tasks');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return missing;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export class TaskDomainService {
|
|
49
|
+
static calculateProgress(tasks) {
|
|
50
|
+
const total = tasks.length;
|
|
51
|
+
const completed = tasks.filter(task => task.completed).length;
|
|
52
|
+
const percentage = total > 0 ? Math.round((completed / total) * 100) : 0;
|
|
53
|
+
return { completed, total, percentage };
|
|
54
|
+
}
|
|
55
|
+
static getBlockingTasks(tasks) {
|
|
56
|
+
return tasks.filter(task => !task.completed);
|
|
57
|
+
}
|
|
58
|
+
static validateTaskCompletion(task) {
|
|
59
|
+
if (!task.title.trim()) {
|
|
60
|
+
return { isValid: false, reason: 'Task title cannot be empty' };
|
|
61
|
+
}
|
|
62
|
+
if (!task.description.trim()) {
|
|
63
|
+
return { isValid: false, reason: 'Task description cannot be empty' };
|
|
64
|
+
}
|
|
65
|
+
if (task.requirements.length === 0) {
|
|
66
|
+
return { isValid: false, reason: 'Task must be linked to at least one requirement' };
|
|
67
|
+
}
|
|
68
|
+
return { isValid: true };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=DomainService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomainService.js","sourceRoot":"","sources":["../../../src/domain/services/DomainService.ts"],"names":[],"mappings":"AAAA,oFAAoF;AAEpF,OAAO,EAAW,aAAa,EAAQ,MAAM,aAAa,CAAC;AAE3D,MAAM,OAAO,qBAAqB;IAChC,MAAM,CAAC,oBAAoB,CAAC,OAAgB,EAAE,WAA0B;QACtE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QACpC,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;QAE/B,QAAQ,WAAW,EAAE,CAAC;YACpB,KAAK,aAAa,CAAC,IAAI;gBACrB,OAAO,IAAI,CAAC,CAAC,6BAA6B;YAE5C,KAAK,aAAa,CAAC,YAAY;gBAC7B,OAAO,KAAK,KAAK,aAAa,CAAC,IAAI,CAAC;YAEtC,KAAK,aAAa,CAAC,MAAM;gBACvB,OAAO,SAAS,CAAC,YAAY,CAAC,SAAS,IAAI,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC;YAE7E,KAAK,aAAa,CAAC,KAAK;gBACtB,OAAO,SAAS,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC;YAEjE,KAAK,aAAa,CAAC,cAA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