snow-flow 2.0.2 → 2.0.3
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/{.claude/mcp-config.json → .mcp.json} +13 -12
- package/.releaserc.json +47 -0
- package/README.md +6 -0
- package/package.json +1 -1
- package/.claude/claude-settings.json +0 -15
- package/.claude/commands/analysis/README.md +0 -9
- package/.claude/commands/automation/README.md +0 -9
- package/.claude/commands/github/README.md +0 -11
- package/.claude/commands/helpers/standard-checkpoint-hooks.sh +0 -179
- package/.claude/commands/hooks/README.md +0 -11
- package/.claude/commands/monitoring/README.md +0 -9
- package/.claude/commands/optimization/README.md +0 -9
- package/.claude/commands/training/README.md +0 -9
- package/.claude/commands/workflows/README.md +0 -9
- package/.claude/config.json +0 -36
- package/.claude/helpers/github-setup.sh +0 -28
- package/.claude/helpers/quick-start.sh +0 -19
- package/.claude/helpers/setup-mcp.sh +0 -18
- package/.claude/settings.json +0 -114
- package/.claude/settings.local.json +0 -33
- package/.claude-flow/metrics/agent-metrics.json +0 -1
- package/.claude-flow/metrics/performance.json +0 -9
- package/.claude-flow/metrics/system-metrics.json +0 -15986
- package/.claude-flow/metrics/task-metrics.json +0 -10
- package/.roo/README.md +0 -402
- package/.roo/mcp-list.txt +0 -257
- package/.roo/mcp.json +0 -32
- package/.roo/workflows/basic-tdd.json +0 -32
- package/.roomodes +0 -201
- package/CLAUDE.md +0 -393
- package/bin/snow-flow.js +0 -3
- package/dist/cli.js.bak +0 -2052
- package/dist/config/snow-flow-config.d.ts +0 -1492
- package/dist/config/snow-flow-config.js +0 -938
- package/scripts/create-env.js +0 -91
- package/scripts/postinstall.js +0 -30
- package/scripts/register-mcp-servers.js +0 -210
- package/scripts/reset-mcp-servers.js +0 -246
- package/scripts/setup-mcp.js +0 -106
- package/scripts/update-version.js +0 -31
- package/src/agents/README.md +0 -192
- package/src/agents/base-agent.ts +0 -251
- package/src/agents/coordinator.ts +0 -971
- package/src/agents/index.ts +0 -18
- package/src/agents/queen-403-handler.ts +0 -230
- package/src/agents/queen-agent.ts +0 -1399
- package/src/agents/script-writer-agent.ts +0 -769
- package/src/agents/security-agent.ts +0 -726
- package/src/agents/widget-creator-agent.ts +0 -568
- package/src/api/error-handling.ts +0 -1758
- package/src/api/natural-language-mapper.ts +0 -630
- package/src/api/performance-optimizer.ts +0 -891
- package/src/api/transaction-manager.ts +0 -754
- package/src/cli/deploy-artifact.ts +0 -304
- package/src/cli/snow-flow-cli-integration.ts +0 -434
- package/src/cli.ts +0 -4455
- package/src/cli.ts.bak +0 -5616
- package/src/compliance/advanced-compliance-system.ts +0 -1268
- package/src/compliance/index.ts +0 -19
- package/src/config/snow-flow-config.ts +0 -1019
- package/src/documentation/index.ts +0 -16
- package/src/documentation/self-documenting-system.ts +0 -1421
- package/src/dynamic-version.ts +0 -44
- package/src/healing/index.ts +0 -20
- package/src/healing/self-healing-system.ts +0 -1435
- package/src/health/README.md +0 -161
- package/src/health/system-health.ts +0 -995
- package/src/index.ts +0 -60
- package/src/intelligence/acl-analyzer.ts +0 -377
- package/src/intelligence/auto-resolution-engine.ts +0 -643
- package/src/intelligence/gap-analysis-engine.ts +0 -488
- package/src/intelligence/manual-instructions-generator.ts +0 -744
- package/src/intelligence/mcp-coverage-analyzer.ts +0 -708
- package/src/intelligence/multi-pass-requirements-analyzer.ts +0 -603
- package/src/intelligence/performance-recommendations-engine.ts +0 -1223
- package/src/intelligence/requirements-analyzer.ts +0 -1148
- package/src/intelligence/task-analyzer.ts +0 -628
- package/src/managers/scope-manager.ts +0 -555
- package/src/mcp/advanced/servicenow-advanced-features-mcp.ts +0 -16110
- package/src/mcp/base-mcp-server.ts +0 -660
- package/src/mcp/http-transport-wrapper.ts +0 -426
- package/src/mcp/service-discovery-client.ts +0 -312
- package/src/mcp/servicenow-automation-mcp-refactored.ts +0 -678
- package/src/mcp/servicenow-automation-mcp.ts +0 -838
- package/src/mcp/servicenow-deployment-mcp-refactored.ts +0 -1292
- package/src/mcp/servicenow-deployment-mcp.ts +0 -7244
- package/src/mcp/servicenow-graph-memory-mcp-refactored.ts +0 -721
- package/src/mcp/servicenow-graph-memory-mcp.ts +0 -832
- package/src/mcp/servicenow-integration-mcp-refactored.ts +0 -655
- package/src/mcp/servicenow-integration-mcp.ts +0 -819
- package/src/mcp/servicenow-intelligent-mcp-refactored.ts +0 -977
- package/src/mcp/servicenow-intelligent-mcp.ts +0 -4638
- package/src/mcp/servicenow-mcp-server.ts +0 -728
- package/src/mcp/servicenow-memory-mcp.ts +0 -474
- package/src/mcp/servicenow-operations-mcp-refactored.ts +0 -1995
- package/src/mcp/servicenow-operations-mcp.ts +0 -3384
- package/src/mcp/servicenow-platform-development-mcp-refactored.ts +0 -611
- package/src/mcp/servicenow-platform-development-mcp.ts +0 -970
- package/src/mcp/servicenow-progressive-indexer.ts +0 -370
- package/src/mcp/servicenow-reporting-analytics-mcp-refactored.ts +0 -695
- package/src/mcp/servicenow-reporting-analytics-mcp.ts +0 -1123
- package/src/mcp/servicenow-security-compliance-mcp-refactored.ts +0 -642
- package/src/mcp/servicenow-security-compliance-mcp.ts +0 -1157
- package/src/mcp/servicenow-update-set-mcp-refactored.ts +0 -751
- package/src/mcp/servicenow-update-set-mcp.ts +0 -811
- package/src/mcp/shared/agent-context-provider.ts +0 -365
- package/src/mcp/shared/base-mcp-server.ts +0 -2463
- package/src/mcp/shared/mcp-memory-manager.ts +0 -540
- package/src/mcp/shared/mcp-resource-manager.ts +0 -367
- package/src/mcp/snow-flow-mcp.ts +0 -911
- package/src/mcp/start-all-mcp-servers.ts +0 -102
- package/src/mcp/start-servicenow-mcp.ts +0 -67
- package/src/monitoring/enhanced-monitoring-system.ts +0 -1345
- package/src/monitoring/performance-tracker.ts +0 -777
- package/src/optimization/cost-optimization-engine.ts +0 -1125
- package/src/optimization/index.ts +0 -10
- package/src/queen/README.md +0 -403
- package/src/queen/agent-factory.ts +0 -574
- package/src/queen/index.ts +0 -94
- package/src/queen/mcp-execution-bridge.ts +0 -681
- package/src/queen/neural-learning.ts +0 -319
- package/src/queen/parallel-agent-engine.ts +0 -848
- package/src/queen/queen-memory-system.ts +0 -490
- package/src/queen/queen-memory.ts +0 -456
- package/src/queen/servicenow-queen.ts +0 -1029
- package/src/queen/types.ts +0 -87
- package/src/rollback/smart-rollback-system.ts +0 -866
- package/src/schemas/deployment.schema.json +0 -58
- package/src/schemas/flow.schema.json +0 -79
- package/src/schemas/widget.schema.json +0 -72
- package/src/snow-flow-system.ts +0 -541
- package/src/sparc/sparc-help.ts +0 -49
- package/src/sparc/team-sparc.ts +0 -88
- package/src/strategies/global-scope-strategy.ts +0 -736
- package/src/templates/base/application.template.json +0 -45
- package/src/templates/base/business_rule.template.json +0 -33
- package/src/templates/base/script_include.template.json +0 -18
- package/src/templates/base/table.template.json +0 -64
- package/src/templates/base/widget.template.json +0 -25
- package/src/templates/patterns/composite.incident-management.template.json +0 -140
- package/src/templates/patterns/widget.dashboard.template.json +0 -238
- package/src/templates/patterns/widget.datatable.template.json +0 -292
- package/src/testing/integration-test-suite.ts +0 -1276
- package/src/types/index.ts +0 -183
- package/src/types/neo4j-driver.d.ts +0 -23
- package/src/types/servicenow.types.ts +0 -307
- package/src/types/snow-flow.types.ts +0 -186
- package/src/types/todo.types.ts +0 -70
- package/src/utils/action-type-cache.ts +0 -286
- package/src/utils/agent-detector.ts +0 -573
- package/src/utils/artifact-tracker.ts +0 -379
- package/src/utils/dependency-detector.ts +0 -233
- package/src/utils/deployment-metadata-handler.ts +0 -518
- package/src/utils/error-recovery.ts +0 -680
- package/src/utils/logger.ts +0 -60
- package/src/utils/mcp-auth-middleware.ts +0 -262
- package/src/utils/mcp-config-manager.ts +0 -270
- package/src/utils/mcp-server-manager.ts +0 -446
- package/src/utils/mcp-tool-registry.ts +0 -298
- package/src/utils/migrate-snow-flow.ts +0 -98
- package/src/utils/oauth-html-templates.ts +0 -188
- package/src/utils/scope-utils.ts +0 -443
- package/src/utils/servicenow-client.ts +0 -3321
- package/src/utils/servicenow-id-generator.ts +0 -181
- package/src/utils/snow-memory-manager.ts +0 -605
- package/src/utils/snow-oauth.ts +0 -797
- package/src/utils/template-engine.ts +0 -463
- package/src/utils/theme-manager.ts +0 -295
- package/src/utils/unified-auth-store.ts +0 -222
- package/src/utils/update-set-importer.ts +0 -422
- package/src/utils/update-set-xml-packager.ts +0 -371
- package/src/utils/widget-template-generator.ts +0 -1744
- package/src/version.ts +0 -1950
|
@@ -1,603 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 🚀 BUG-006 FIX: Multi-Pass Requirements Analyzer
|
|
3
|
-
*
|
|
4
|
-
* Advanced requirements _analysis with multiple passes to ensure
|
|
5
|
-
* comprehensive coverage and no missed dependencies.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { Logger } from '../utils/logger.js';
|
|
9
|
-
import { ServiceNowRequirement, RequirementType, RequirementCategory, ObjectiveAnalysis } from './requirements-analyzer.js';
|
|
10
|
-
|
|
11
|
-
export interface MultiPassAnalysisResult extends ObjectiveAnalysis {
|
|
12
|
-
analysisPassesData: {
|
|
13
|
-
pass1_initial: PassAnalysisResult;
|
|
14
|
-
pass2_dependencies: PassAnalysisResult;
|
|
15
|
-
pass3_context: PassAnalysisResult;
|
|
16
|
-
pass4_validation: PassAnalysisResult;
|
|
17
|
-
};
|
|
18
|
-
completenessScore: number;
|
|
19
|
-
confidenceLevel: 'low' | 'medium' | 'high' | 'very_high';
|
|
20
|
-
missingRequirementsDetected: ServiceNowRequirement[];
|
|
21
|
-
implicitDependencies: string[];
|
|
22
|
-
crossDomainImpacts: string[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface PassAnalysisResult {
|
|
26
|
-
passNumber: number;
|
|
27
|
-
passName: string;
|
|
28
|
-
requirementsFound: number;
|
|
29
|
-
newRequirementsAdded: number;
|
|
30
|
-
analysisMethod: string;
|
|
31
|
-
keyFindings: string[];
|
|
32
|
-
confidence: number;
|
|
33
|
-
processingTime: number;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export class MultiPassRequirementsAnalyzer {
|
|
37
|
-
private logger: Logger;
|
|
38
|
-
|
|
39
|
-
// 🎯 Enhanced pattern matching with context awareness
|
|
40
|
-
private readonly CONTEXT_PATTERNS = {
|
|
41
|
-
// Security Context Implications
|
|
42
|
-
security_implications: {
|
|
43
|
-
triggers: ['authentication', 'login', 'secure', 'role', 'permission', 'access'],
|
|
44
|
-
additional_requirements: ['audit_rule', 'security_policy', 'acl_rule', 'encryption_context', 'session_management']
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
// Data Integration Context
|
|
48
|
-
data_integration_context: {
|
|
49
|
-
triggers: ['import', 'export', 'sync', 'api', 'external', 'integration'],
|
|
50
|
-
additional_requirements: ['error_handling', 'data_validation', 'logging', 'monitoring', 'backup_recovery']
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
// User Experience Context
|
|
54
|
-
user_experience_context: {
|
|
55
|
-
triggers: ['dashboard', 'portal', 'mobile', 'user interface', 'ui'],
|
|
56
|
-
additional_requirements: ['responsive_design', 'accessibility', 'performance_optimization', 'user_training']
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
// Process Automation Context
|
|
60
|
-
process_automation_context: {
|
|
61
|
-
triggers: ['workflow', 'approval', 'automation', 'flow', 'process'],
|
|
62
|
-
additional_requirements: ['error_recovery', 'monitoring', 'audit_trail', 'performance_tracking']
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
// Compliance Context
|
|
66
|
-
compliance_context: {
|
|
67
|
-
triggers: ['audit', 'compliance', 'gdpr', 'sox', 'hipaa', 'regulation'],
|
|
68
|
-
additional_requirements: ['data_retention', 'audit_logging', 'data_encryption', 'access_logging', 'compliance_reporting']
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
// 🔍 Dependency mapping for implicit requirements
|
|
73
|
-
private readonly DEPENDENCY_MATRIX: Record<RequirementType, RequirementType[]> = {
|
|
74
|
-
// When you create a widget, you typically also need...
|
|
75
|
-
widget: ['css_include', 'client_script', 'data_source', 'ui_policy'],
|
|
76
|
-
|
|
77
|
-
// When you create a flow, you typically also need...
|
|
78
|
-
flow: ['business_rule', 'notification', 'error_handling', 'audit_rule'],
|
|
79
|
-
|
|
80
|
-
// When you create user management, you typically also need...
|
|
81
|
-
user_role: ['acl_rule', 'group_membership', 'audit_rule', 'security_policy'],
|
|
82
|
-
|
|
83
|
-
// When you create API integration, you typically also need...
|
|
84
|
-
rest_message: ['oauth_provider', 'error_handling', 'logging', 'monitoring'],
|
|
85
|
-
|
|
86
|
-
// When you create approval process, you typically also need...
|
|
87
|
-
approval_rule: ['notification', 'email_template', 'escalation_rule', 'sla_definition'],
|
|
88
|
-
|
|
89
|
-
// When you create reporting, you typically also need...
|
|
90
|
-
report: ['data_source', 'scheduled_report', 'dashboard', 'performance_analytics'],
|
|
91
|
-
|
|
92
|
-
// Additional dependencies
|
|
93
|
-
table: ['dictionary_entry', 'acl_rule', 'ui_policy', 'client_script'],
|
|
94
|
-
import_set: ['transform_map', 'field_map', 'error_handling', 'data_validation'],
|
|
95
|
-
workflow: ['notification', 'approval_rule', 'audit_rule', 'error_recovery'],
|
|
96
|
-
dashboard: ['widget', 'data_source', 'performance_analytics', 'scheduled_refresh']
|
|
97
|
-
} as any;
|
|
98
|
-
|
|
99
|
-
// 🎯 Cross-domain impact analysis
|
|
100
|
-
private readonly CROSS_DOMAIN_IMPACTS = {
|
|
101
|
-
security_changes: {
|
|
102
|
-
affects: ['user_interface', 'data_integration', 'process_automation'],
|
|
103
|
-
considerations: ['Role updates', 'Permission cascades', 'Authentication flows']
|
|
104
|
-
},
|
|
105
|
-
data_structure_changes: {
|
|
106
|
-
affects: ['reporting_analytics', 'user_interface', 'process_automation'],
|
|
107
|
-
considerations: ['Report updates', 'Form modifications', 'Workflow adjustments']
|
|
108
|
-
},
|
|
109
|
-
process_changes: {
|
|
110
|
-
affects: ['user_interface', 'reporting_analytics', 'security_compliance'],
|
|
111
|
-
considerations: ['UI updates', 'Metrics tracking', 'Audit requirements']
|
|
112
|
-
},
|
|
113
|
-
integration_changes: {
|
|
114
|
-
affects: ['security_compliance', 'monitoring_operations', 'data_integration'],
|
|
115
|
-
considerations: ['Security protocols', 'Error monitoring', 'Data validation']
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
constructor() {
|
|
120
|
-
this.logger = new Logger('MultiPassRequirementsAnalyzer');
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* 🔍 Run comprehensive multi-pass analysis
|
|
125
|
-
*/
|
|
126
|
-
async analyzeRequirements(objective: string): Promise<MultiPassAnalysisResult> {
|
|
127
|
-
this.logger.info('🚀 BUG-006: Starting multi-pass requirements _analysis', { objective });
|
|
128
|
-
|
|
129
|
-
const startTime = Date.now();
|
|
130
|
-
const allRequirements: ServiceNowRequirement[] = [];
|
|
131
|
-
|
|
132
|
-
// PASS 1: Initial Pattern Matching
|
|
133
|
-
const pass1Start = Date.now();
|
|
134
|
-
const pass1Result = await this.pass1_InitialAnalysis(objective);
|
|
135
|
-
allRequirements.push(...pass1Result.requirements);
|
|
136
|
-
|
|
137
|
-
// PASS 2: Dependency Analysis
|
|
138
|
-
const pass2Start = Date.now();
|
|
139
|
-
const pass2Result = await this.pass2_DependencyAnalysis(objective, allRequirements);
|
|
140
|
-
allRequirements.push(...pass2Result.newRequirements);
|
|
141
|
-
|
|
142
|
-
// PASS 3: Context & Implication Analysis
|
|
143
|
-
const pass3Start = Date.now();
|
|
144
|
-
const pass3Result = await this.pass3_ContextAnalysis(objective, allRequirements);
|
|
145
|
-
allRequirements.push(...pass3Result.newRequirements);
|
|
146
|
-
|
|
147
|
-
// PASS 4: Validation & Completeness Check
|
|
148
|
-
const pass4Start = Date.now();
|
|
149
|
-
const pass4Result = await this.pass4_ValidationAnalysis(objective, allRequirements);
|
|
150
|
-
allRequirements.push(...pass4Result.newRequirements);
|
|
151
|
-
|
|
152
|
-
// Remove duplicates and finalize
|
|
153
|
-
const finalRequirements = this.deduplicateRequirements(allRequirements);
|
|
154
|
-
|
|
155
|
-
// Calculate metrics
|
|
156
|
-
const mcpCoveredCount = finalRequirements.filter(req => req.mcpCoverage).length;
|
|
157
|
-
const gapCount = finalRequirements.length - mcpCoveredCount;
|
|
158
|
-
const mcpCoveragePercentage = Math.round((mcpCoveredCount / finalRequirements.length) * 100);
|
|
159
|
-
|
|
160
|
-
// Calculate completeness score based on multi-pass findings
|
|
161
|
-
const completenessScore = this.calculateCompletenessScore(
|
|
162
|
-
pass1Result, pass2Result, pass3Result, pass4Result
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
const confidenceLevel = this.determineConfidenceLevel(completenessScore);
|
|
166
|
-
|
|
167
|
-
// Detect cross-domain impacts
|
|
168
|
-
const crossDomainImpacts = this.analyzeCrossDomainImpacts(finalRequirements);
|
|
169
|
-
|
|
170
|
-
const totalTime = Date.now() - startTime;
|
|
171
|
-
this.logger.info(`✅ Multi-pass _analysis complete in ${totalTime}ms`, {
|
|
172
|
-
totalRequirements: finalRequirements.length,
|
|
173
|
-
mcpCoverage: mcpCoveragePercentage,
|
|
174
|
-
completenessScore,
|
|
175
|
-
confidenceLevel
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
return {
|
|
179
|
-
objective,
|
|
180
|
-
requirements: finalRequirements,
|
|
181
|
-
totalRequirements: finalRequirements.length,
|
|
182
|
-
mcpCoveredCount,
|
|
183
|
-
gapCount,
|
|
184
|
-
mcpCoveragePercentage,
|
|
185
|
-
estimatedComplexity: this.calculateComplexity(finalRequirements),
|
|
186
|
-
riskAssessment: this.calculateRiskAssessment(finalRequirements),
|
|
187
|
-
categories: this.extractCategories(finalRequirements),
|
|
188
|
-
criticalPath: this.identifyCriticalPath(finalRequirements),
|
|
189
|
-
estimatedDuration: this.estimateDuration(finalRequirements),
|
|
190
|
-
|
|
191
|
-
// Multi-pass specific data
|
|
192
|
-
analysisPassesData: {
|
|
193
|
-
pass1_initial: {
|
|
194
|
-
passNumber: 1,
|
|
195
|
-
passName: 'Initial Pattern Matching',
|
|
196
|
-
requirementsFound: pass1Result.requirements.length,
|
|
197
|
-
newRequirementsAdded: pass1Result.requirements.length,
|
|
198
|
-
analysisMethod: 'Pattern matching and keyword _analysis',
|
|
199
|
-
keyFindings: pass1Result.keyFindings,
|
|
200
|
-
confidence: pass1Result.confidence,
|
|
201
|
-
processingTime: pass2Start - pass1Start
|
|
202
|
-
},
|
|
203
|
-
pass2_dependencies: {
|
|
204
|
-
passNumber: 2,
|
|
205
|
-
passName: 'Dependency Analysis',
|
|
206
|
-
requirementsFound: pass2Result.newRequirements.length,
|
|
207
|
-
newRequirementsAdded: pass2Result.newRequirements.length,
|
|
208
|
-
analysisMethod: 'Dependency matrix and prerequisite _analysis',
|
|
209
|
-
keyFindings: pass2Result.keyFindings,
|
|
210
|
-
confidence: pass2Result.confidence,
|
|
211
|
-
processingTime: pass3Start - pass2Start
|
|
212
|
-
},
|
|
213
|
-
pass3_context: {
|
|
214
|
-
passNumber: 3,
|
|
215
|
-
passName: 'Context & Implications',
|
|
216
|
-
requirementsFound: pass3Result.newRequirements.length,
|
|
217
|
-
newRequirementsAdded: pass3Result.newRequirements.length,
|
|
218
|
-
analysisMethod: 'Context pattern matching and implication _analysis',
|
|
219
|
-
keyFindings: pass3Result.keyFindings,
|
|
220
|
-
confidence: pass3Result.confidence,
|
|
221
|
-
processingTime: pass4Start - pass3Start
|
|
222
|
-
},
|
|
223
|
-
pass4_validation: {
|
|
224
|
-
passNumber: 4,
|
|
225
|
-
passName: 'Validation & Completeness',
|
|
226
|
-
requirementsFound: finalRequirements.length,
|
|
227
|
-
newRequirementsAdded: pass4Result.newRequirements.length,
|
|
228
|
-
analysisMethod: 'Gap _analysis and completeness validation',
|
|
229
|
-
keyFindings: pass4Result.keyFindings,
|
|
230
|
-
confidence: pass4Result.confidence,
|
|
231
|
-
processingTime: Date.now() - pass4Start
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
completenessScore,
|
|
235
|
-
confidenceLevel,
|
|
236
|
-
missingRequirementsDetected: pass4Result.newRequirements,
|
|
237
|
-
implicitDependencies: this.extractImplicitDependencies(finalRequirements),
|
|
238
|
-
crossDomainImpacts
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* 🎯 PASS 1: Initial Pattern Matching Analysis
|
|
244
|
-
*/
|
|
245
|
-
private async pass1_InitialAnalysis(objective: string): Promise<{
|
|
246
|
-
requirements: ServiceNowRequirement[];
|
|
247
|
-
keyFindings: string[];
|
|
248
|
-
confidence: number;
|
|
249
|
-
}> {
|
|
250
|
-
this.logger.info('🔍 Pass 1: Initial pattern matching _analysis');
|
|
251
|
-
|
|
252
|
-
const requirements: ServiceNowRequirement[] = [];
|
|
253
|
-
const keyFindings: string[] = [];
|
|
254
|
-
const objectiveLower = objective.toLowerCase();
|
|
255
|
-
|
|
256
|
-
// Basic keyword matching (existing logic enhanced)
|
|
257
|
-
const patterns = [
|
|
258
|
-
// Core Development
|
|
259
|
-
{ keywords: ['widget', 'portal', 'service portal'], type: 'widget' as RequirementType },
|
|
260
|
-
{ keywords: ['flow', 'workflow', 'process', 'automation'], type: 'flow' as RequirementType },
|
|
261
|
-
{ keywords: ['business rule', 'validation', 'server logic'], type: 'business_rule' as RequirementType },
|
|
262
|
-
{ keywords: ['script include', 'utility', 'function', 'library'], type: 'script_include' as RequirementType },
|
|
263
|
-
{ keywords: ['table', 'record', 'data structure'], type: 'table' as RequirementType },
|
|
264
|
-
|
|
265
|
-
// User Interface
|
|
266
|
-
{ keywords: ['dashboard', 'overview', 'summary'], type: 'dashboard' as RequirementType },
|
|
267
|
-
{ keywords: ['form', 'ui', 'interface'], type: 'ui_policy' as RequirementType },
|
|
268
|
-
{ keywords: ['navigation', 'menu', 'module'], type: 'navigator_module' as RequirementType },
|
|
269
|
-
|
|
270
|
-
// Security & Access
|
|
271
|
-
{ keywords: ['role', 'permission', 'access control'], type: 'user_role' as RequirementType },
|
|
272
|
-
{ keywords: ['security', 'acl', 'access list'], type: 'acl_rule' as RequirementType },
|
|
273
|
-
{ keywords: ['authentication', 'login', 'oauth'], type: 'oauth_provider' as RequirementType },
|
|
274
|
-
|
|
275
|
-
// Integration
|
|
276
|
-
{ keywords: ['api', 'rest', 'web service'], type: 'rest_message' as RequirementType },
|
|
277
|
-
{ keywords: ['import', 'csv', 'excel', 'data load'], type: 'import_set' as RequirementType },
|
|
278
|
-
{ keywords: ['email', 'notification', 'alert'], type: 'notification' as RequirementType },
|
|
279
|
-
|
|
280
|
-
// Process & Automation
|
|
281
|
-
{ keywords: ['approval', 'review', 'authorize'], type: 'approval_rule' as RequirementType },
|
|
282
|
-
{ keywords: ['schedule', 'cron', 'batch'], type: 'scheduled_job' as RequirementType },
|
|
283
|
-
{ keywords: ['sla', 'service level', 'performance'], type: 'sla_definition' as RequirementType },
|
|
284
|
-
|
|
285
|
-
// Reporting
|
|
286
|
-
{ keywords: ['report', 'analytics', 'metrics'], type: 'report' as RequirementType },
|
|
287
|
-
{ keywords: ['kpi', 'performance indicator'], type: 'kpi' as RequirementType },
|
|
288
|
-
{ keywords: ['chart', 'graph', 'visualization'], type: 'chart_configuration' as RequirementType }
|
|
289
|
-
];
|
|
290
|
-
|
|
291
|
-
for (const pattern of patterns) {
|
|
292
|
-
if (pattern.keywords.some(keyword => objectiveLower.includes(keyword))) {
|
|
293
|
-
const requirement = this.createRequirement(pattern.type, objective);
|
|
294
|
-
requirements.push(requirement);
|
|
295
|
-
keyFindings.push(`Detected ${pattern.type} requirement from keywords: ${pattern.keywords.join(', ')}`);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// Advanced pattern detection for complex scenarios
|
|
300
|
-
const complexPatterns = this.detectComplexPatterns(objective);
|
|
301
|
-
requirements.push(...complexPatterns.requirements);
|
|
302
|
-
keyFindings.push(...complexPatterns.findings);
|
|
303
|
-
|
|
304
|
-
const confidence = Math.min(0.9, 0.3 + (requirements.length * 0.1));
|
|
305
|
-
|
|
306
|
-
this.logger.info(`Pass 1 complete: ${requirements.length} requirements found`);
|
|
307
|
-
return { requirements, keyFindings, confidence };
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* 🔗 PASS 2: Dependency Analysis
|
|
312
|
-
*/
|
|
313
|
-
private async pass2_DependencyAnalysis(objective: string, existingRequirements: ServiceNowRequirement[]): Promise<{
|
|
314
|
-
newRequirements: ServiceNowRequirement[];
|
|
315
|
-
keyFindings: string[];
|
|
316
|
-
confidence: number;
|
|
317
|
-
}> {
|
|
318
|
-
this.logger.info('🔍 Pass 2: Dependency _analysis');
|
|
319
|
-
|
|
320
|
-
const newRequirements: ServiceNowRequirement[] = [];
|
|
321
|
-
const keyFindings: string[] = [];
|
|
322
|
-
const existingTypes = new Set(existingRequirements.map(req => req.type));
|
|
323
|
-
|
|
324
|
-
// Analyze dependencies for each existing requirement
|
|
325
|
-
for (const requirement of existingRequirements) {
|
|
326
|
-
const dependencies = this.DEPENDENCY_MATRIX[requirement.type] || [];
|
|
327
|
-
|
|
328
|
-
for (const depType of dependencies) {
|
|
329
|
-
if (!existingTypes.has(depType)) {
|
|
330
|
-
const depRequirement = this.createRequirement(depType, objective);
|
|
331
|
-
depRequirement.dependencies = [requirement.id];
|
|
332
|
-
depRequirement.description += ` (Required by ${requirement.name})`;
|
|
333
|
-
|
|
334
|
-
newRequirements.push(depRequirement);
|
|
335
|
-
existingTypes.add(depType);
|
|
336
|
-
keyFindings.push(`Added ${depType} as dependency of ${requirement.type}`);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
// Analyze prerequisite chains
|
|
342
|
-
const prerequisiteAnalysis = this.analyzePrerequisiteChains(existingRequirements);
|
|
343
|
-
newRequirements.push(...prerequisiteAnalysis.requirements);
|
|
344
|
-
keyFindings.push(...prerequisiteAnalysis.findings);
|
|
345
|
-
|
|
346
|
-
// Analyze common co-requirements
|
|
347
|
-
const coRequirementAnalysis = this.analyzeCoRequirements(objective, existingRequirements);
|
|
348
|
-
newRequirements.push(...coRequirementAnalysis.requirements);
|
|
349
|
-
keyFindings.push(...coRequirementAnalysis.findings);
|
|
350
|
-
|
|
351
|
-
const confidence = newRequirements.length > 0 ? 0.8 : 0.6;
|
|
352
|
-
|
|
353
|
-
this.logger.info(`Pass 2 complete: ${newRequirements.length} new requirements found`);
|
|
354
|
-
return { newRequirements, keyFindings, confidence };
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* 🌐 PASS 3: Context & Implication Analysis
|
|
359
|
-
*/
|
|
360
|
-
private async pass3_ContextAnalysis(objective: string, existingRequirements: ServiceNowRequirement[]): Promise<{
|
|
361
|
-
newRequirements: ServiceNowRequirement[];
|
|
362
|
-
keyFindings: string[];
|
|
363
|
-
confidence: number;
|
|
364
|
-
}> {
|
|
365
|
-
this.logger.info('🔍 Pass 3: Context and implication _analysis');
|
|
366
|
-
|
|
367
|
-
const newRequirements: ServiceNowRequirement[] = [];
|
|
368
|
-
const keyFindings: string[] = [];
|
|
369
|
-
const objectiveLower = objective.toLowerCase();
|
|
370
|
-
|
|
371
|
-
// Analyze context patterns
|
|
372
|
-
for (const [contextName, contextData] of Object.entries(this.CONTEXT_PATTERNS)) {
|
|
373
|
-
const hasContextTrigger = contextData.triggers.some(trigger =>
|
|
374
|
-
objectiveLower.includes(trigger)
|
|
375
|
-
);
|
|
376
|
-
|
|
377
|
-
if (hasContextTrigger) {
|
|
378
|
-
keyFindings.push(`Detected ${contextName} context`);
|
|
379
|
-
|
|
380
|
-
for (const additionalReq of contextData.additional_requirements) {
|
|
381
|
-
if (!existingRequirements.some(req => req.type === additionalReq)) {
|
|
382
|
-
const requirement = this.createRequirement(additionalReq as RequirementType, objective);
|
|
383
|
-
requirement.description += ` (Context implication: ${contextName})`;
|
|
384
|
-
newRequirements.push(requirement);
|
|
385
|
-
keyFindings.push(`Added ${additionalReq} from ${contextName} context`);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// Analyze enterprise vs department scope implications
|
|
392
|
-
const scopeAnalysis = this.analyzeScopeImplications(objective, existingRequirements);
|
|
393
|
-
newRequirements.push(...scopeAnalysis.requirements);
|
|
394
|
-
keyFindings.push(...scopeAnalysis.findings);
|
|
395
|
-
|
|
396
|
-
// Analyze compliance and regulatory implications
|
|
397
|
-
const complianceAnalysis = this.analyzeComplianceImplications(objective);
|
|
398
|
-
newRequirements.push(...complianceAnalysis.requirements);
|
|
399
|
-
keyFindings.push(...complianceAnalysis.findings);
|
|
400
|
-
|
|
401
|
-
const confidence = 0.7;
|
|
402
|
-
|
|
403
|
-
this.logger.info(`Pass 3 complete: ${newRequirements.length} contextual requirements found`);
|
|
404
|
-
return { newRequirements, keyFindings, confidence };
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
/**
|
|
408
|
-
* ✅ PASS 4: Validation & Completeness Check
|
|
409
|
-
*/
|
|
410
|
-
private async pass4_ValidationAnalysis(objective: string, existingRequirements: ServiceNowRequirement[]): Promise<{
|
|
411
|
-
newRequirements: ServiceNowRequirement[];
|
|
412
|
-
keyFindings: string[];
|
|
413
|
-
confidence: number;
|
|
414
|
-
}> {
|
|
415
|
-
this.logger.info('🔍 Pass 4: Validation and completeness check');
|
|
416
|
-
|
|
417
|
-
const newRequirements: ServiceNowRequirement[] = [];
|
|
418
|
-
const keyFindings: string[] = [];
|
|
419
|
-
|
|
420
|
-
// Gap _analysis - check for common missing pieces
|
|
421
|
-
const gapAnalysis = this.performGapAnalysis(objective, existingRequirements);
|
|
422
|
-
newRequirements.push(...gapAnalysis.requirements);
|
|
423
|
-
keyFindings.push(...gapAnalysis.findings);
|
|
424
|
-
|
|
425
|
-
// Validation of requirement completeness
|
|
426
|
-
const completenessCheck = this.validateRequirementCompleteness(existingRequirements);
|
|
427
|
-
keyFindings.push(...completenessCheck.findings);
|
|
428
|
-
|
|
429
|
-
// Final quality check
|
|
430
|
-
const qualityCheck = this.performQualityCheck(existingRequirements);
|
|
431
|
-
keyFindings.push(...qualityCheck.findings);
|
|
432
|
-
|
|
433
|
-
const confidence = 0.95;
|
|
434
|
-
|
|
435
|
-
this.logger.info(`Pass 4 complete: ${newRequirements.length} validation requirements added`);
|
|
436
|
-
return { newRequirements, keyFindings, confidence };
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// Helper methods (implementations would follow similar patterns)
|
|
440
|
-
private createRequirement(type: RequirementType, objective: string): ServiceNowRequirement {
|
|
441
|
-
return {
|
|
442
|
-
id: `req_${type}_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
|
|
443
|
-
type,
|
|
444
|
-
name: `${type.replace(/_/g, ' ').toUpperCase()} for ${objective.substring(0, 50)}...`,
|
|
445
|
-
description: `ServiceNow ${type} component required for: ${objective}`,
|
|
446
|
-
priority: 'medium',
|
|
447
|
-
dependencies: [],
|
|
448
|
-
estimatedEffort: 'medium',
|
|
449
|
-
automatable: true,
|
|
450
|
-
mcpCoverage: ['widget', 'flow', 'business_rule', 'script_include', 'table', 'application'].includes(type),
|
|
451
|
-
category: this.getCategoryForType(type),
|
|
452
|
-
riskLevel: 'medium'
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
private getCategoryForType(type: RequirementType): RequirementCategory {
|
|
457
|
-
// Mapping logic for requirement categories
|
|
458
|
-
const categoryMap: Record<string, RequirementCategory> = {
|
|
459
|
-
widget: 'core_development',
|
|
460
|
-
flow: 'core_development',
|
|
461
|
-
user_role: 'security_compliance',
|
|
462
|
-
dashboard: 'reporting_analytics',
|
|
463
|
-
// ... more mappings
|
|
464
|
-
};
|
|
465
|
-
return categoryMap[type] || 'core_development';
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
// Additional helper methods would be implemented here...
|
|
469
|
-
private detectComplexPatterns(objective: string): { requirements: ServiceNowRequirement[]; findings: string[] } {
|
|
470
|
-
// Implementation for complex pattern detection
|
|
471
|
-
return { requirements: [], findings: [] };
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
private analyzePrerequisiteChains(requirements: ServiceNowRequirement[]): { requirements: ServiceNowRequirement[]; findings: string[] } {
|
|
475
|
-
// Implementation for prerequisite analysis
|
|
476
|
-
return { requirements: [], findings: [] };
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
private analyzeCoRequirements(objective: string, requirements: ServiceNowRequirement[]): { requirements: ServiceNowRequirement[]; findings: string[] } {
|
|
480
|
-
// Implementation for co-requirement analysis
|
|
481
|
-
return { requirements: [], findings: [] };
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
private analyzeScopeImplications(objective: string, requirements: ServiceNowRequirement[]): { requirements: ServiceNowRequirement[]; findings: string[] } {
|
|
485
|
-
// Implementation for scope analysis
|
|
486
|
-
return { requirements: [], findings: [] };
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
private analyzeComplianceImplications(objective: string): { requirements: ServiceNowRequirement[]; findings: string[] } {
|
|
490
|
-
// Implementation for compliance analysis
|
|
491
|
-
return { requirements: [], findings: [] };
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
private performGapAnalysis(objective: string, requirements: ServiceNowRequirement[]): { requirements: ServiceNowRequirement[]; findings: string[] } {
|
|
495
|
-
// Implementation for gap analysis
|
|
496
|
-
return { requirements: [], findings: [] };
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
private validateRequirementCompleteness(requirements: ServiceNowRequirement[]): { findings: string[] } {
|
|
500
|
-
// Implementation for completeness validation
|
|
501
|
-
return { findings: [] };
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
private performQualityCheck(requirements: ServiceNowRequirement[]): { findings: string[] } {
|
|
505
|
-
// Implementation for quality check
|
|
506
|
-
return { findings: [] };
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
private deduplicateRequirements(requirements: ServiceNowRequirement[]): ServiceNowRequirement[] {
|
|
510
|
-
const seen = new Set<string>();
|
|
511
|
-
return requirements.filter(req => {
|
|
512
|
-
const key = `${req.type}_${req.name}`;
|
|
513
|
-
if (seen.has(key)) return false;
|
|
514
|
-
seen.add(key);
|
|
515
|
-
return true;
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
private calculateCompletenessScore(pass1: any, pass2: any, pass3: any, pass4: any): number {
|
|
520
|
-
// Calculate completeness based on multiple passes
|
|
521
|
-
const baseScore = 40;
|
|
522
|
-
const pass2Bonus = Math.min(30, pass2.newRequirements.length * 5);
|
|
523
|
-
const pass3Bonus = Math.min(20, pass3.newRequirements.length * 3);
|
|
524
|
-
const pass4Bonus = Math.min(10, pass4.newRequirements.length * 2);
|
|
525
|
-
|
|
526
|
-
return Math.min(100, baseScore + pass2Bonus + pass3Bonus + pass4Bonus);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
private determineConfidenceLevel(completenessScore: number): 'low' | 'medium' | 'high' | 'very_high' {
|
|
530
|
-
if (completenessScore >= 90) return 'very_high';
|
|
531
|
-
if (completenessScore >= 75) return 'high';
|
|
532
|
-
if (completenessScore >= 60) return 'medium';
|
|
533
|
-
return 'low';
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
private analyzeCrossDomainImpacts(requirements: ServiceNowRequirement[]): string[] {
|
|
537
|
-
const impacts: string[] = [];
|
|
538
|
-
const categories = new Set(requirements.map(req => req.category));
|
|
539
|
-
|
|
540
|
-
if (categories.has('security_compliance') && categories.has('user_interface')) {
|
|
541
|
-
impacts.push('Security changes will require UI permission updates');
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
if (categories.has('data_integration') && categories.has('reporting_analytics')) {
|
|
545
|
-
impacts.push('Data changes will impact existing reports and dashboards');
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
return impacts;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
private extractImplicitDependencies(requirements: ServiceNowRequirement[]): string[] {
|
|
552
|
-
return requirements
|
|
553
|
-
.filter(req => req.dependencies.length > 0)
|
|
554
|
-
.map(req => `${req.name} depends on ${req.dependencies.join(', ')}`)
|
|
555
|
-
.slice(0, 10); // Limit to top 10
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
private calculateComplexity(requirements: ServiceNowRequirement[]): 'low' | 'medium' | 'high' | 'enterprise' {
|
|
559
|
-
const totalEffort = requirements.reduce((sum, req) => {
|
|
560
|
-
const effortMap = { low: 1, medium: 3, high: 5 };
|
|
561
|
-
return sum + effortMap[req.estimatedEffort];
|
|
562
|
-
}, 0);
|
|
563
|
-
|
|
564
|
-
if (totalEffort > 50) return 'enterprise';
|
|
565
|
-
if (totalEffort > 30) return 'high';
|
|
566
|
-
if (totalEffort > 15) return 'medium';
|
|
567
|
-
return 'low';
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
private calculateRiskAssessment(requirements: ServiceNowRequirement[]): 'low' | 'medium' | 'high' {
|
|
571
|
-
const highRiskCount = requirements.filter(req => req.riskLevel === 'high').length;
|
|
572
|
-
const totalCount = requirements.length;
|
|
573
|
-
|
|
574
|
-
if (highRiskCount / totalCount > 0.3) return 'high';
|
|
575
|
-
if (highRiskCount / totalCount > 0.1) return 'medium';
|
|
576
|
-
return 'low';
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
private extractCategories(requirements: ServiceNowRequirement[]): RequirementCategory[] {
|
|
580
|
-
return Array.from(new Set(requirements.map(req => req.category)));
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
private identifyCriticalPath(requirements: ServiceNowRequirement[]): string[] {
|
|
584
|
-
return requirements
|
|
585
|
-
.filter(req => req.priority === 'high')
|
|
586
|
-
.map(req => req.name)
|
|
587
|
-
.slice(0, 5);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
private estimateDuration(requirements: ServiceNowRequirement[]): string {
|
|
591
|
-
const totalDays = requirements.reduce((sum, req) => {
|
|
592
|
-
const effortDays = { low: 1, medium: 3, high: 7 };
|
|
593
|
-
return sum + effortDays[req.estimatedEffort];
|
|
594
|
-
}, 0);
|
|
595
|
-
|
|
596
|
-
if (totalDays > 90) return '3+ months';
|
|
597
|
-
if (totalDays > 30) return '1-3 months';
|
|
598
|
-
if (totalDays > 7) return '1-4 weeks';
|
|
599
|
-
return '1-7 days';
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
export default MultiPassRequirementsAnalyzer;
|