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.
Files changed (173) hide show
  1. package/{.claude/mcp-config.json → .mcp.json} +13 -12
  2. package/.releaserc.json +47 -0
  3. package/README.md +6 -0
  4. package/package.json +1 -1
  5. package/.claude/claude-settings.json +0 -15
  6. package/.claude/commands/analysis/README.md +0 -9
  7. package/.claude/commands/automation/README.md +0 -9
  8. package/.claude/commands/github/README.md +0 -11
  9. package/.claude/commands/helpers/standard-checkpoint-hooks.sh +0 -179
  10. package/.claude/commands/hooks/README.md +0 -11
  11. package/.claude/commands/monitoring/README.md +0 -9
  12. package/.claude/commands/optimization/README.md +0 -9
  13. package/.claude/commands/training/README.md +0 -9
  14. package/.claude/commands/workflows/README.md +0 -9
  15. package/.claude/config.json +0 -36
  16. package/.claude/helpers/github-setup.sh +0 -28
  17. package/.claude/helpers/quick-start.sh +0 -19
  18. package/.claude/helpers/setup-mcp.sh +0 -18
  19. package/.claude/settings.json +0 -114
  20. package/.claude/settings.local.json +0 -33
  21. package/.claude-flow/metrics/agent-metrics.json +0 -1
  22. package/.claude-flow/metrics/performance.json +0 -9
  23. package/.claude-flow/metrics/system-metrics.json +0 -15986
  24. package/.claude-flow/metrics/task-metrics.json +0 -10
  25. package/.roo/README.md +0 -402
  26. package/.roo/mcp-list.txt +0 -257
  27. package/.roo/mcp.json +0 -32
  28. package/.roo/workflows/basic-tdd.json +0 -32
  29. package/.roomodes +0 -201
  30. package/CLAUDE.md +0 -393
  31. package/bin/snow-flow.js +0 -3
  32. package/dist/cli.js.bak +0 -2052
  33. package/dist/config/snow-flow-config.d.ts +0 -1492
  34. package/dist/config/snow-flow-config.js +0 -938
  35. package/scripts/create-env.js +0 -91
  36. package/scripts/postinstall.js +0 -30
  37. package/scripts/register-mcp-servers.js +0 -210
  38. package/scripts/reset-mcp-servers.js +0 -246
  39. package/scripts/setup-mcp.js +0 -106
  40. package/scripts/update-version.js +0 -31
  41. package/src/agents/README.md +0 -192
  42. package/src/agents/base-agent.ts +0 -251
  43. package/src/agents/coordinator.ts +0 -971
  44. package/src/agents/index.ts +0 -18
  45. package/src/agents/queen-403-handler.ts +0 -230
  46. package/src/agents/queen-agent.ts +0 -1399
  47. package/src/agents/script-writer-agent.ts +0 -769
  48. package/src/agents/security-agent.ts +0 -726
  49. package/src/agents/widget-creator-agent.ts +0 -568
  50. package/src/api/error-handling.ts +0 -1758
  51. package/src/api/natural-language-mapper.ts +0 -630
  52. package/src/api/performance-optimizer.ts +0 -891
  53. package/src/api/transaction-manager.ts +0 -754
  54. package/src/cli/deploy-artifact.ts +0 -304
  55. package/src/cli/snow-flow-cli-integration.ts +0 -434
  56. package/src/cli.ts +0 -4455
  57. package/src/cli.ts.bak +0 -5616
  58. package/src/compliance/advanced-compliance-system.ts +0 -1268
  59. package/src/compliance/index.ts +0 -19
  60. package/src/config/snow-flow-config.ts +0 -1019
  61. package/src/documentation/index.ts +0 -16
  62. package/src/documentation/self-documenting-system.ts +0 -1421
  63. package/src/dynamic-version.ts +0 -44
  64. package/src/healing/index.ts +0 -20
  65. package/src/healing/self-healing-system.ts +0 -1435
  66. package/src/health/README.md +0 -161
  67. package/src/health/system-health.ts +0 -995
  68. package/src/index.ts +0 -60
  69. package/src/intelligence/acl-analyzer.ts +0 -377
  70. package/src/intelligence/auto-resolution-engine.ts +0 -643
  71. package/src/intelligence/gap-analysis-engine.ts +0 -488
  72. package/src/intelligence/manual-instructions-generator.ts +0 -744
  73. package/src/intelligence/mcp-coverage-analyzer.ts +0 -708
  74. package/src/intelligence/multi-pass-requirements-analyzer.ts +0 -603
  75. package/src/intelligence/performance-recommendations-engine.ts +0 -1223
  76. package/src/intelligence/requirements-analyzer.ts +0 -1148
  77. package/src/intelligence/task-analyzer.ts +0 -628
  78. package/src/managers/scope-manager.ts +0 -555
  79. package/src/mcp/advanced/servicenow-advanced-features-mcp.ts +0 -16110
  80. package/src/mcp/base-mcp-server.ts +0 -660
  81. package/src/mcp/http-transport-wrapper.ts +0 -426
  82. package/src/mcp/service-discovery-client.ts +0 -312
  83. package/src/mcp/servicenow-automation-mcp-refactored.ts +0 -678
  84. package/src/mcp/servicenow-automation-mcp.ts +0 -838
  85. package/src/mcp/servicenow-deployment-mcp-refactored.ts +0 -1292
  86. package/src/mcp/servicenow-deployment-mcp.ts +0 -7244
  87. package/src/mcp/servicenow-graph-memory-mcp-refactored.ts +0 -721
  88. package/src/mcp/servicenow-graph-memory-mcp.ts +0 -832
  89. package/src/mcp/servicenow-integration-mcp-refactored.ts +0 -655
  90. package/src/mcp/servicenow-integration-mcp.ts +0 -819
  91. package/src/mcp/servicenow-intelligent-mcp-refactored.ts +0 -977
  92. package/src/mcp/servicenow-intelligent-mcp.ts +0 -4638
  93. package/src/mcp/servicenow-mcp-server.ts +0 -728
  94. package/src/mcp/servicenow-memory-mcp.ts +0 -474
  95. package/src/mcp/servicenow-operations-mcp-refactored.ts +0 -1995
  96. package/src/mcp/servicenow-operations-mcp.ts +0 -3384
  97. package/src/mcp/servicenow-platform-development-mcp-refactored.ts +0 -611
  98. package/src/mcp/servicenow-platform-development-mcp.ts +0 -970
  99. package/src/mcp/servicenow-progressive-indexer.ts +0 -370
  100. package/src/mcp/servicenow-reporting-analytics-mcp-refactored.ts +0 -695
  101. package/src/mcp/servicenow-reporting-analytics-mcp.ts +0 -1123
  102. package/src/mcp/servicenow-security-compliance-mcp-refactored.ts +0 -642
  103. package/src/mcp/servicenow-security-compliance-mcp.ts +0 -1157
  104. package/src/mcp/servicenow-update-set-mcp-refactored.ts +0 -751
  105. package/src/mcp/servicenow-update-set-mcp.ts +0 -811
  106. package/src/mcp/shared/agent-context-provider.ts +0 -365
  107. package/src/mcp/shared/base-mcp-server.ts +0 -2463
  108. package/src/mcp/shared/mcp-memory-manager.ts +0 -540
  109. package/src/mcp/shared/mcp-resource-manager.ts +0 -367
  110. package/src/mcp/snow-flow-mcp.ts +0 -911
  111. package/src/mcp/start-all-mcp-servers.ts +0 -102
  112. package/src/mcp/start-servicenow-mcp.ts +0 -67
  113. package/src/monitoring/enhanced-monitoring-system.ts +0 -1345
  114. package/src/monitoring/performance-tracker.ts +0 -777
  115. package/src/optimization/cost-optimization-engine.ts +0 -1125
  116. package/src/optimization/index.ts +0 -10
  117. package/src/queen/README.md +0 -403
  118. package/src/queen/agent-factory.ts +0 -574
  119. package/src/queen/index.ts +0 -94
  120. package/src/queen/mcp-execution-bridge.ts +0 -681
  121. package/src/queen/neural-learning.ts +0 -319
  122. package/src/queen/parallel-agent-engine.ts +0 -848
  123. package/src/queen/queen-memory-system.ts +0 -490
  124. package/src/queen/queen-memory.ts +0 -456
  125. package/src/queen/servicenow-queen.ts +0 -1029
  126. package/src/queen/types.ts +0 -87
  127. package/src/rollback/smart-rollback-system.ts +0 -866
  128. package/src/schemas/deployment.schema.json +0 -58
  129. package/src/schemas/flow.schema.json +0 -79
  130. package/src/schemas/widget.schema.json +0 -72
  131. package/src/snow-flow-system.ts +0 -541
  132. package/src/sparc/sparc-help.ts +0 -49
  133. package/src/sparc/team-sparc.ts +0 -88
  134. package/src/strategies/global-scope-strategy.ts +0 -736
  135. package/src/templates/base/application.template.json +0 -45
  136. package/src/templates/base/business_rule.template.json +0 -33
  137. package/src/templates/base/script_include.template.json +0 -18
  138. package/src/templates/base/table.template.json +0 -64
  139. package/src/templates/base/widget.template.json +0 -25
  140. package/src/templates/patterns/composite.incident-management.template.json +0 -140
  141. package/src/templates/patterns/widget.dashboard.template.json +0 -238
  142. package/src/templates/patterns/widget.datatable.template.json +0 -292
  143. package/src/testing/integration-test-suite.ts +0 -1276
  144. package/src/types/index.ts +0 -183
  145. package/src/types/neo4j-driver.d.ts +0 -23
  146. package/src/types/servicenow.types.ts +0 -307
  147. package/src/types/snow-flow.types.ts +0 -186
  148. package/src/types/todo.types.ts +0 -70
  149. package/src/utils/action-type-cache.ts +0 -286
  150. package/src/utils/agent-detector.ts +0 -573
  151. package/src/utils/artifact-tracker.ts +0 -379
  152. package/src/utils/dependency-detector.ts +0 -233
  153. package/src/utils/deployment-metadata-handler.ts +0 -518
  154. package/src/utils/error-recovery.ts +0 -680
  155. package/src/utils/logger.ts +0 -60
  156. package/src/utils/mcp-auth-middleware.ts +0 -262
  157. package/src/utils/mcp-config-manager.ts +0 -270
  158. package/src/utils/mcp-server-manager.ts +0 -446
  159. package/src/utils/mcp-tool-registry.ts +0 -298
  160. package/src/utils/migrate-snow-flow.ts +0 -98
  161. package/src/utils/oauth-html-templates.ts +0 -188
  162. package/src/utils/scope-utils.ts +0 -443
  163. package/src/utils/servicenow-client.ts +0 -3321
  164. package/src/utils/servicenow-id-generator.ts +0 -181
  165. package/src/utils/snow-memory-manager.ts +0 -605
  166. package/src/utils/snow-oauth.ts +0 -797
  167. package/src/utils/template-engine.ts +0 -463
  168. package/src/utils/theme-manager.ts +0 -295
  169. package/src/utils/unified-auth-store.ts +0 -222
  170. package/src/utils/update-set-importer.ts +0 -422
  171. package/src/utils/update-set-xml-packager.ts +0 -371
  172. package/src/utils/widget-template-generator.ts +0 -1744
  173. package/src/version.ts +0 -1950
@@ -1,708 +0,0 @@
1
- /**
2
- * MCP Coverage Analyzer - Maps what ServiceNow MCP tools can handle
3
- *
4
- * This module analyzes what ServiceNow configurations and operations
5
- * our current MCP tools can handle versus what requires manual intervention
6
- * or additional automation.
7
- */
8
-
9
- import { RequirementType, ServiceNowRequirement } from './requirements-analyzer';
10
-
11
- export interface McpToolCapability {
12
- tool: string;
13
- requirementTypes: RequirementType[];
14
- description: string;
15
- limitations?: string[];
16
- scope: 'global' | 'scoped' | 'both';
17
- autoDeployable: boolean;
18
- requiresPermissions?: string[];
19
- }
20
-
21
- export interface CoverageAnalysis {
22
- covered: ServiceNowRequirement[];
23
- gaps: ServiceNowRequirement[];
24
- partialCoverage: Array<{
25
- requirement: ServiceNowRequirement;
26
- coveringTool: string;
27
- limitations: string[];
28
- manualSteps: string[];
29
- }>;
30
- coveragePercentage: number;
31
- recommendations: string[];
32
- }
33
-
34
- export interface AutomationCapability {
35
- canAutomate: boolean;
36
- automationTool?: string;
37
- requiredPermissions?: string[];
38
- riskLevel: 'low' | 'medium' | 'high';
39
- complexity: 'simple' | 'moderate' | 'complex';
40
- estimatedTime?: string;
41
- fallbackStrategy?: string;
42
- }
43
-
44
- /**
45
- * Comprehensive mapping of all ServiceNow MCP tool capabilities
46
- */
47
- export const MCP_TOOL_CAPABILITIES: McpToolCapability[] = [
48
- // Core Development Tools (Primary Coverage)
49
- {
50
- tool: 'snow_deploy',
51
- requirementTypes: ['widget', 'flow', 'application', 'script_include', 'business_rule', 'table'],
52
- description: 'Unified deployment for core ServiceNow artifacts',
53
- scope: 'both',
54
- autoDeployable: true,
55
- requiresPermissions: ['app_creator', 'admin']
56
- },
57
-
58
- // Intelligent & Discovery Tools
59
- {
60
- tool: 'snow_find_artifact',
61
- requirementTypes: ['widget', 'flow', 'script_include', 'business_rule', 'table', 'application'],
62
- description: 'AI-powered artifact discovery and search',
63
- scope: 'both',
64
- autoDeployable: false
65
- },
66
- {
67
- tool: 'snow_comprehensive_search',
68
- requirementTypes: ['widget', 'flow', 'script_include', 'business_rule', 'table', 'user_role'],
69
- description: 'Multi-table search across ServiceNow',
70
- scope: 'both',
71
- autoDeployable: false
72
- },
73
-
74
- // Flow Development
75
- {
76
- tool: 'snow_create_flow',
77
- requirementTypes: ['flow', 'approval_workflow', 'notification_rule'],
78
- description: 'Natural language flow creation with AI',
79
- scope: 'both',
80
- autoDeployable: true,
81
- requiresPermissions: ['flow_designer']
82
- },
83
- {
84
- tool: 'snow_test_flow_with_mock',
85
- requirementTypes: ['flow', 'approval_workflow'],
86
- description: 'Flow testing with mock data and users',
87
- scope: 'both',
88
- autoDeployable: true
89
- },
90
-
91
- // Operations & ITSM
92
- {
93
- tool: 'snow_query_incidents',
94
- requirementTypes: ['incident_table', 'query_rule'],
95
- description: 'Advanced incident querying and _analysis',
96
- scope: 'both',
97
- autoDeployable: false
98
- },
99
- {
100
- tool: 'snow_analyze_incident',
101
- requirementTypes: ['incident__analysis', 'knowledge_article'],
102
- description: 'AI-powered incident _analysis with suggestions',
103
- scope: 'both',
104
- autoDeployable: false
105
- },
106
-
107
- // Catalog Management
108
- {
109
- tool: 'snow_catalog_item_search',
110
- requirementTypes: ['catalog_item', 'catalog_category'],
111
- description: 'Intelligent catalog item discovery with fuzzy matching',
112
- scope: 'both',
113
- autoDeployable: false
114
- },
115
- {
116
- tool: 'snow_catalog_item_manager',
117
- requirementTypes: ['catalog_item', 'catalog_variable'],
118
- description: 'Complete catalog item lifecycle management',
119
- scope: 'both',
120
- autoDeployable: true,
121
- requiresPermissions: ['catalog_admin']
122
- },
123
- {
124
- tool: 'snow_link_catalog_to_flow',
125
- requirementTypes: ['catalog_item', 'flow', 'workflow_integration'],
126
- description: 'Direct catalog-flow linking for fulfillment',
127
- scope: 'both',
128
- autoDeployable: true
129
- },
130
-
131
- // User & Group Management
132
- {
133
- tool: 'snow_create_user',
134
- requirementTypes: ['user_account'],
135
- description: 'User creation with department and role assignment',
136
- scope: 'global',
137
- autoDeployable: true,
138
- requiresPermissions: ['user_admin']
139
- },
140
- {
141
- tool: 'snow_create_user_group',
142
- requirementTypes: ['user_group'],
143
- description: 'Group creation with hierarchy support',
144
- scope: 'global',
145
- autoDeployable: true,
146
- requiresPermissions: ['user_admin']
147
- },
148
- {
149
- tool: 'snow_assign_user_to_group',
150
- requirementTypes: ['group_membership'],
151
- description: 'User-group assignment management',
152
- scope: 'global',
153
- autoDeployable: true,
154
- requiresPermissions: ['user_admin']
155
- },
156
-
157
- // Platform Development
158
- {
159
- tool: 'snow_create_ui_page',
160
- requirementTypes: ['ui_page'],
161
- description: 'UI Page creation with client and server scripts',
162
- scope: 'both',
163
- autoDeployable: true,
164
- requiresPermissions: ['admin']
165
- },
166
- {
167
- tool: 'snow_create_client_script',
168
- requirementTypes: ['client_script'],
169
- description: 'Client script creation for forms',
170
- scope: 'both',
171
- autoDeployable: true,
172
- requiresPermissions: ['admin']
173
- },
174
- {
175
- tool: 'snow_create_ui_policy',
176
- requirementTypes: ['ui_policy'],
177
- description: 'UI Policy creation for dynamic forms',
178
- scope: 'both',
179
- autoDeployable: true,
180
- requiresPermissions: ['admin']
181
- },
182
- {
183
- tool: 'snow_create_ui_action',
184
- requirementTypes: ['ui_action'],
185
- description: 'UI Action creation for forms and lists',
186
- scope: 'both',
187
- autoDeployable: true,
188
- requiresPermissions: ['admin']
189
- },
190
-
191
- // Integration Tools
192
- {
193
- tool: 'snow_create_rest_message',
194
- requirementTypes: ['rest_message', 'integration_endpoint'],
195
- description: 'REST Message endpoint creation',
196
- scope: 'both',
197
- autoDeployable: true,
198
- requiresPermissions: ['web_service_admin']
199
- },
200
- {
201
- tool: 'snow_create_transform_map',
202
- requirementTypes: ['transform_map', 'import_set'],
203
- description: 'Data transformation and import mapping',
204
- scope: 'both',
205
- autoDeployable: true,
206
- requiresPermissions: ['import_admin']
207
- },
208
-
209
- // Automation Tools
210
- {
211
- tool: 'snow_create_scheduled_job',
212
- requirementTypes: ['scheduled_job', 'scheduled_task'],
213
- description: 'Scheduled job creation with cron patterns',
214
- scope: 'both',
215
- autoDeployable: true,
216
- requiresPermissions: ['scheduler_admin']
217
- },
218
- {
219
- tool: 'snow_create_notification',
220
- requirementTypes: ['notification_rule', 'email_template'],
221
- description: 'Email notification creation with templates',
222
- scope: 'both',
223
- autoDeployable: true,
224
- requiresPermissions: ['notification_admin']
225
- },
226
- {
227
- tool: 'snow_create_event_rule',
228
- requirementTypes: ['event_rule', 'event_registration'],
229
- description: 'Event-driven automation rules',
230
- scope: 'both',
231
- autoDeployable: true,
232
- requiresPermissions: ['admin']
233
- },
234
-
235
- // Security & Compliance
236
- {
237
- tool: 'snow_create_access_control',
238
- requirementTypes: ['acl_rule'],
239
- description: 'Access Control List creation',
240
- scope: 'both',
241
- autoDeployable: true,
242
- requiresPermissions: ['security_admin'],
243
- limitations: ['Complex role hierarchies require manual review']
244
- },
245
- {
246
- tool: 'snow_create_data_policy',
247
- requirementTypes: ['data_policy'],
248
- description: 'Data policy and validation rules',
249
- scope: 'both',
250
- autoDeployable: true,
251
- requiresPermissions: ['admin']
252
- },
253
-
254
- // Reporting & Analytics
255
- {
256
- tool: 'snow_create_report',
257
- requirementTypes: ['report', 'dashboard_tab'],
258
- description: 'Report creation with dynamic fields',
259
- scope: 'both',
260
- autoDeployable: true,
261
- requiresPermissions: ['report_admin']
262
- },
263
- {
264
- tool: 'snow_create_dashboard',
265
- requirementTypes: ['dashboard', 'homepage'],
266
- description: 'Dashboard creation with widgets',
267
- scope: 'both',
268
- autoDeployable: true,
269
- requiresPermissions: ['admin']
270
- },
271
-
272
- // Update Set Management
273
- {
274
- tool: 'snow_update_set_create',
275
- requirementTypes: ['update_set'],
276
- description: 'Update Set lifecycle management',
277
- scope: 'global',
278
- autoDeployable: true,
279
- requiresPermissions: ['admin']
280
- }
281
- ];
282
-
283
- /**
284
- * Requirements that have NO current MCP coverage and require manual intervention
285
- */
286
- export const UNCOVERED_REQUIREMENTS: RequirementType[] = [
287
- // Advanced Authentication
288
- 'ldap_config', 'saml_config', 'oauth_provider', 'sso_config', 'mfa_config',
289
-
290
- // System Configuration
291
- 'system_property', 'system_definition', 'application_menu', 'module_navigation',
292
- 'theme_configuration', 'branding_config',
293
-
294
- // Database & Performance
295
- 'database_index', 'database_view', 'table_rotation', 'partitioning_config',
296
- 'cache_configuration',
297
-
298
- // Advanced Integration
299
- 'web_service', 'soap_message', 'import_set_transformer', 'coremeta_data',
300
- 'data_source', 'ldap_server',
301
-
302
- // Workflow & Process
303
- 'workflow_activity', 'workflow_transition', 'sla_definition', 'escalation_rule',
304
- 'approval_definition',
305
-
306
- // Advanced Automation
307
- 'inbound_email_action', 'processor', 'pdf_generator', 'sys_script_validator',
308
-
309
- // Performance & Monitoring
310
- 'performance_analytics', 'metric_definition', 'job_queue', 'transaction_quota',
311
-
312
- // Advanced UI
313
- 'form_layout', 'form_section', 'list_layout', 'related_list', 'formatter',
314
- 'reference_qualifier', 'choice_list', 'dictionary_entry'
315
- ];
316
-
317
- export class McpCoverageAnalyzer {
318
-
319
- /**
320
- * Analyze coverage for a list of requirements
321
- */
322
- static analyzeCoverage(requirements: ServiceNowRequirement[]): CoverageAnalysis {
323
- const covered: ServiceNowRequirement[] = [];
324
- const gaps: ServiceNowRequirement[] = [];
325
- const partialCoverage: CoverageAnalysis['partialCoverage'] = [];
326
-
327
- for (const requirement of requirements) {
328
- const capability = this.findToolCapability(requirement.type);
329
-
330
- if (!capability) {
331
- gaps.push(requirement);
332
- } else if (capability.limitations && capability.limitations.length > 0) {
333
- // Partial coverage - tool exists but has limitations
334
- partialCoverage.push({
335
- requirement,
336
- coveringTool: capability.tool,
337
- limitations: capability.limitations,
338
- manualSteps: this.generateManualSteps(requirement, capability)
339
- });
340
- } else {
341
- covered.push(requirement);
342
- }
343
- }
344
-
345
- const coveragePercentage = Math.round(
346
- ((covered.length + partialCoverage.length * 0.5) / requirements.length) * 100
347
- );
348
-
349
- const recommendations = this.generateRecommendations(covered, gaps, partialCoverage);
350
-
351
- return {
352
- covered,
353
- gaps,
354
- partialCoverage,
355
- coveragePercentage,
356
- recommendations
357
- };
358
- }
359
-
360
- /**
361
- * Analyze automation capabilities for a specific requirement
362
- */
363
- static analyzeAutomationCapability(requirement: ServiceNowRequirement): AutomationCapability {
364
- const capability = this.findToolCapability(requirement.type);
365
-
366
- if (!capability) {
367
- return {
368
- canAutomate: false,
369
- riskLevel: 'high',
370
- complexity: 'complex',
371
- estimatedTime: 'Manual setup required',
372
- fallbackStrategy: 'Provide detailed manual instructions'
373
- };
374
- }
375
-
376
- if (!capability.autoDeployable) {
377
- return {
378
- canAutomate: false,
379
- automationTool: capability.tool,
380
- riskLevel: 'low',
381
- complexity: 'simple',
382
- estimatedTime: '1-2 minutes',
383
- fallbackStrategy: 'Use tool for discovery, manual configuration'
384
- };
385
- }
386
-
387
- // Assess risk based on requirements and permissions
388
- const riskLevel = this.assessRiskLevel(requirement, capability);
389
- const complexity = this.assessComplexity(requirement, capability);
390
-
391
- return {
392
- canAutomate: true,
393
- automationTool: capability.tool,
394
- requiredPermissions: capability.requiresPermissions,
395
- riskLevel,
396
- complexity,
397
- estimatedTime: this.estimateTime(complexity),
398
- fallbackStrategy: this.getFallbackStrategy(requirement, capability)
399
- };
400
- }
401
-
402
- /**
403
- * Get all available tools for a requirement type
404
- */
405
- static getAvailableTools(requirementType: RequirementType): McpToolCapability[] {
406
- return MCP_TOOL_CAPABILITIES.filter(cap =>
407
- cap.requirementTypes.includes(requirementType)
408
- );
409
- }
410
-
411
- /**
412
- * Check if a requirement type is completely uncovered
413
- */
414
- static isUncovered(requirementType: RequirementType): boolean {
415
- return UNCOVERED_REQUIREMENTS.includes(requirementType);
416
- }
417
-
418
- /**
419
- * Generate automation strategy for a list of requirements
420
- */
421
- static generateAutomationStrategy(requirements: ServiceNowRequirement[]): {
422
- automatable: ServiceNowRequirement[];
423
- manual: ServiceNowRequirement[];
424
- sequence: Array<{
425
- step: number;
426
- requirements: ServiceNowRequirement[];
427
- strategy: 'parallel' | 'sequential';
428
- estimatedTime: string;
429
- }>;
430
- } {
431
- const automatable = requirements.filter(req => {
432
- const capability = this.analyzeAutomationCapability(req);
433
- return capability.canAutomate;
434
- });
435
-
436
- const manual = requirements.filter(req => {
437
- const capability = this.analyzeAutomationCapability(req);
438
- return !capability.canAutomate;
439
- });
440
-
441
- // Generate execution sequence
442
- const sequence = this.planExecutionSequence(automatable);
443
-
444
- return { automatable, manual, sequence };
445
- }
446
-
447
- // Private helper methods
448
-
449
- private static findToolCapability(requirementType: RequirementType): McpToolCapability | undefined {
450
- return MCP_TOOL_CAPABILITIES.find(cap =>
451
- cap.requirementTypes.includes(requirementType)
452
- );
453
- }
454
-
455
- private static generateManualSteps(
456
- requirement: ServiceNowRequirement,
457
- capability: McpToolCapability
458
- ): string[] {
459
- const steps: string[] = [];
460
-
461
- if (capability.limitations) {
462
- for (const limitation of capability.limitations) {
463
- if (limitation.includes('permissions')) {
464
- steps.push(`Verify ${capability.requiresPermissions?.join(', ')} permissions before deployment`);
465
- }
466
- if (limitation.includes('manual review')) {
467
- steps.push(`Review generated configuration before activation`);
468
- }
469
- if (limitation.includes('testing')) {
470
- steps.push(`Test thoroughly in development environment first`);
471
- }
472
- }
473
- }
474
-
475
- return steps;
476
- }
477
-
478
- private static generateRecommendations(
479
- covered: ServiceNowRequirement[],
480
- gaps: ServiceNowRequirement[],
481
- partial: CoverageAnalysis['partialCoverage']
482
- ): string[] {
483
- const recommendations: string[] = [];
484
-
485
- if (covered.length > 0) {
486
- recommendations.push(`✅ ${covered.length} requirements can be fully automated`);
487
- }
488
-
489
- if (partial.length > 0) {
490
- recommendations.push(`⚠️ ${partial.length} requirements have partial automation - manual steps needed`);
491
- }
492
-
493
- if (gaps.length > 0) {
494
- recommendations.push(`❌ ${gaps.length} requirements require manual configuration`);
495
-
496
- // Group gaps by category for better recommendations
497
- const gapsByCategory = this.categorizeGaps(gaps);
498
- for (const [category, count] of Object.entries(gapsByCategory)) {
499
- if (count > 0) {
500
- recommendations.push(`• ${count} ${category} configurations need manual setup`);
501
- }
502
- }
503
- }
504
-
505
- // Strategic recommendations
506
- if (gaps.length / (covered.length + partial.length + gaps.length) > 0.3) {
507
- recommendations.push('💡 Consider extending MCP tools to cover more requirements');
508
- }
509
-
510
- if (partial.length > 0) {
511
- recommendations.push('🔧 Enable auto-permissions flag to reduce manual intervention');
512
- }
513
-
514
- return recommendations;
515
- }
516
-
517
- private static categorizeGaps(gaps: ServiceNowRequirement[]): Record<string, number> {
518
- const categories = {
519
- 'Authentication': 0,
520
- 'Database': 0,
521
- 'Integration': 0,
522
- 'UI/Forms': 0,
523
- 'Workflow': 0,
524
- 'Security': 0,
525
- 'System': 0
526
- };
527
-
528
- for (const gap of gaps) {
529
- switch (gap.type) {
530
- case 'ldap_config':
531
- case 'saml_config':
532
- case 'oauth_provider':
533
- case 'sso_config':
534
- case 'mfa_config':
535
- categories['Authentication']++;
536
- break;
537
-
538
- case 'database_index':
539
- case 'database_view':
540
- case 'table_rotation':
541
- case 'partitioning_config':
542
- categories['Database']++;
543
- break;
544
-
545
- case 'web_service':
546
- case 'soap_message':
547
- case 'import_set_transformer':
548
- case 'data_source':
549
- categories['Integration']++;
550
- break;
551
-
552
- case 'form_layout':
553
- case 'form_section':
554
- case 'list_layout':
555
- case 'dictionary_entry':
556
- categories['UI/Forms']++;
557
- break;
558
-
559
- case 'workflow_activity':
560
- case 'workflow_transition':
561
- case 'sla_definition':
562
- case 'escalation_rule':
563
- categories['Workflow']++;
564
- break;
565
-
566
- case 'acl_rule':
567
- case 'data_policy':
568
- categories['Security']++;
569
- break;
570
-
571
- default:
572
- categories['System']++;
573
- }
574
- }
575
-
576
- return categories;
577
- }
578
-
579
- private static assessRiskLevel(
580
- requirement: ServiceNowRequirement,
581
- capability: McpToolCapability
582
- ): 'low' | 'medium' | 'high' {
583
- // Security-related requirements have higher risk
584
- if (['acl_rule', 'data_policy', 'user_role'].includes(requirement.type)) {
585
- return 'high';
586
- }
587
-
588
- // Global scope operations have medium risk
589
- if (capability.scope === 'global') {
590
- return 'medium';
591
- }
592
-
593
- // Standard development artifacts are low risk
594
- return 'low';
595
- }
596
-
597
- private static assessComplexity(
598
- requirement: ServiceNowRequirement,
599
- capability: McpToolCapability
600
- ): 'simple' | 'moderate' | 'complex' {
601
- if (capability.limitations && capability.limitations.length > 2) {
602
- return 'complex';
603
- }
604
-
605
- if (capability.requiresPermissions && capability.requiresPermissions.length > 2) {
606
- return 'moderate';
607
- }
608
-
609
- return 'simple';
610
- }
611
-
612
- private static estimateTime(complexity: 'simple' | 'moderate' | 'complex'): string {
613
- switch (complexity) {
614
- case 'simple': return '1-2 minutes';
615
- case 'moderate': return '3-5 minutes';
616
- case 'complex': return '5-10 minutes';
617
- }
618
- }
619
-
620
- private static getFallbackStrategy(
621
- requirement: ServiceNowRequirement,
622
- capability: McpToolCapability
623
- ): string {
624
- if (capability.limitations) {
625
- return 'Automatic deployment with manual verification';
626
- }
627
-
628
- if (capability.requiresPermissions) {
629
- return 'Request permissions, then automatic deployment';
630
- }
631
-
632
- return 'Full automatic deployment';
633
- }
634
-
635
- private static planExecutionSequence(requirements: ServiceNowRequirement[]): Array<{
636
- step: number;
637
- requirements: ServiceNowRequirement[];
638
- strategy: 'parallel' | 'sequential';
639
- estimatedTime: string;
640
- }> {
641
- // Group by dependencies and complexity
642
- const grouped = this.groupByExecutionOrder(requirements);
643
-
644
- return grouped.map((group, index) => ({
645
- step: index + 1,
646
- requirements: group,
647
- strategy: group.length > 1 ? 'parallel' : 'sequential',
648
- estimatedTime: this.calculateGroupTime(group)
649
- }));
650
- }
651
-
652
- private static groupByExecutionOrder(requirements: ServiceNowRequirement[]): ServiceNowRequirement[][] {
653
- // Simple grouping - in a real implementation, this would analyze dependencies
654
- const groups: ServiceNowRequirement[][] = [];
655
-
656
- // Group 1: Foundation (tables, applications)
657
- const foundation = requirements.filter(req =>
658
- ['table', 'application'].includes(req.type)
659
- );
660
- if (foundation.length > 0) groups.push(foundation);
661
-
662
- // Group 2: Security and Users
663
- const security = requirements.filter(req =>
664
- ['user_role', 'user_group', 'acl_rule', 'data_policy'].includes(req.type)
665
- );
666
- if (security.length > 0) groups.push(security);
667
-
668
- // Group 3: Core Logic
669
- const logic = requirements.filter(req =>
670
- ['business_rule', 'script_include', 'client_script'].includes(req.type)
671
- );
672
- if (logic.length > 0) groups.push(logic);
673
-
674
- // Group 4: UI and Workflows
675
- const ui = requirements.filter(req =>
676
- ['widget', 'flow', 'ui_page', 'ui_action'].includes(req.type)
677
- );
678
- if (ui.length > 0) groups.push(ui);
679
-
680
- // Group 5: Integration and Automation
681
- const automation = requirements.filter(req =>
682
- ['scheduled_job', 'notification_rule', 'rest_message'].includes(req.type)
683
- );
684
- if (automation.length > 0) groups.push(automation);
685
-
686
- return groups;
687
- }
688
-
689
- private static calculateGroupTime(requirements: ServiceNowRequirement[]): string {
690
- let totalMinutes = 0;
691
-
692
- for (const req of requirements) {
693
- const capability = this.analyzeAutomationCapability(req);
694
- const timeStr = capability.estimatedTime || '2 minutes';
695
- const minutes = parseInt(timeStr.match(/\d+/)?.[0] || '2');
696
- totalMinutes += minutes;
697
- }
698
-
699
- // For parallel execution, use the maximum time rather than sum
700
- const maxTime = Math.max(...requirements.map(req => {
701
- const capability = this.analyzeAutomationCapability(req);
702
- const timeStr = capability.estimatedTime || '2 minutes';
703
- return parseInt(timeStr.match(/\d+/)?.[0] || '2');
704
- }));
705
-
706
- return requirements.length > 1 ? `${maxTime} minutes (parallel)` : `${totalMinutes} minutes`;
707
- }
708
- }