snow-flow 3.0.9 → 3.0.13

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 (302) hide show
  1. package/claude-flow.bat +0 -0
  2. package/claude-flow.ps1 +0 -0
  3. package/dist/mcp/intelligent-reporting-mcp.d.ts +7 -0
  4. package/dist/mcp/intelligent-reporting-mcp.js +379 -0
  5. package/dist/mcp/servicenow-automation-mcp.js +0 -0
  6. package/dist/mcp/servicenow-deployment-mcp.js +0 -0
  7. package/dist/mcp/servicenow-integration-mcp.js +0 -0
  8. package/dist/mcp/servicenow-mcp-server.js +0 -0
  9. package/dist/mcp/servicenow-operations-mcp.js +0 -0
  10. package/dist/mcp/servicenow-platform-development-mcp.js +0 -0
  11. package/dist/mcp/servicenow-progressive-indexer.js +0 -0
  12. package/dist/mcp/servicenow-reporting-analytics-mcp.js +280 -29
  13. package/dist/mcp/servicenow-security-compliance-mcp.js +0 -0
  14. package/dist/mcp/servicenow-update-set-mcp.js +0 -0
  15. package/dist/mcp/start-all-mcp-servers.js +0 -0
  16. package/dist/mcp/start-servicenow-mcp.js +0 -0
  17. package/dist/services/widget-deployment-service.d.ts +2 -1
  18. package/dist/services/widget-deployment-service.js +17 -16
  19. package/dist/utils/anti-mock-data-validator.d.ts +66 -0
  20. package/dist/utils/anti-mock-data-validator.js +316 -0
  21. package/dist/utils/servicenow-eventual-consistency.d.ts +120 -0
  22. package/dist/utils/servicenow-eventual-consistency.js +220 -0
  23. package/memory/agents/README.md +1 -1
  24. package/memory/claude-flow-data.json +1 -1
  25. package/memory/sessions/README.md +1 -1
  26. package/package.json +4 -3
  27. package/.mcp.json +0 -22
  28. package/claude-flow.config.json +0 -20
  29. package/dist/agents/app-creator.agent.d.ts +0 -55
  30. package/dist/agents/app-creator.agent.js +0 -1292
  31. package/dist/agents/base/base-snow-agent.d.ts +0 -75
  32. package/dist/agents/base/base-snow-agent.js +0 -169
  33. package/dist/agents/base-snow-agent.d.ts +0 -63
  34. package/dist/agents/base-snow-agent.js +0 -296
  35. package/dist/agents/coordinator.d.ts +0 -200
  36. package/dist/agents/coordinator.js +0 -777
  37. package/dist/agents/flow-builder-agent.d.ts +0 -18
  38. package/dist/agents/flow-builder-agent.js +0 -197
  39. package/dist/agents/queen-403-handler.d.ts +0 -47
  40. package/dist/agents/queen-403-handler.js +0 -175
  41. package/dist/agents/queen-agent-example.d.ts +0 -23
  42. package/dist/agents/queen-agent-example.js +0 -240
  43. package/dist/agents/queen-agent.test.d.ts +0 -6
  44. package/dist/agents/script-generator.agent.d.ts +0 -32
  45. package/dist/agents/script-generator.agent.js +0 -772
  46. package/dist/agents/script-writer-agent.d.ts +0 -22
  47. package/dist/agents/script-writer-agent.js +0 -695
  48. package/dist/agents/security-agent.d.ts +0 -23
  49. package/dist/agents/security-agent.js +0 -619
  50. package/dist/agents/specialists/automation-specialist.agent.d.ts +0 -44
  51. package/dist/agents/specialists/automation-specialist.agent.js +0 -204
  52. package/dist/agents/specialists/data-specialist.agent.d.ts +0 -165
  53. package/dist/agents/specialists/data-specialist.agent.js +0 -484
  54. package/dist/agents/specialists/integration-specialist.agent.d.ts +0 -227
  55. package/dist/agents/specialists/integration-specialist.agent.js +0 -725
  56. package/dist/agents/specialists/reporting-specialist.agent.d.ts +0 -54
  57. package/dist/agents/specialists/reporting-specialist.agent.js +0 -193
  58. package/dist/agents/specialists/security-specialist.agent.d.ts +0 -85
  59. package/dist/agents/specialists/security-specialist.agent.js +0 -309
  60. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +0 -111
  61. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +0 -383
  62. package/dist/agents/teams/base-team.d.ts +0 -72
  63. package/dist/agents/teams/base-team.js +0 -253
  64. package/dist/agents/teams/team-types.d.ts +0 -265
  65. package/dist/agents/teams/team-types.js +0 -3
  66. package/dist/agents/teams/widget/widget-architect.agent.d.ts +0 -61
  67. package/dist/agents/teams/widget/widget-architect.agent.js +0 -436
  68. package/dist/agents/teams/widget/widget-backend.agent.d.ts +0 -74
  69. package/dist/agents/teams/widget/widget-backend.agent.js +0 -1531
  70. package/dist/agents/teams/widget/widget-frontend.agent.d.ts +0 -67
  71. package/dist/agents/teams/widget/widget-frontend.agent.js +0 -1014
  72. package/dist/agents/teams/widget/widget-platform.agent.d.ts +0 -90
  73. package/dist/agents/teams/widget/widget-platform.agent.js +0 -1190
  74. package/dist/agents/teams/widget/widget-uiux.agent.d.ts +0 -107
  75. package/dist/agents/teams/widget/widget-uiux.agent.js +0 -1033
  76. package/dist/agents/test-agent.d.ts +0 -26
  77. package/dist/agents/test-agent.js +0 -734
  78. package/dist/agents/test-agents.d.ts +0 -7
  79. package/dist/agents/test-agents.js +0 -64
  80. package/dist/agents/ui-builder.agent.d.ts +0 -50
  81. package/dist/agents/ui-builder.agent.js +0 -1539
  82. package/dist/agents/widget-builder.agent.d.ts +0 -32
  83. package/dist/agents/widget-builder.agent.js +0 -439
  84. package/dist/agents/widget-creator-agent.d.ts +0 -18
  85. package/dist/agents/widget-creator-agent.js +0 -498
  86. package/dist/agents/workflow-designer.agent.d.ts +0 -31
  87. package/dist/agents/workflow-designer.agent.js +0 -583
  88. package/dist/api/error-handling.d.ts +0 -325
  89. package/dist/api/error-handling.js +0 -1488
  90. package/dist/api/flow-designer-api.d.ts +0 -167
  91. package/dist/api/flow-designer-api.js +0 -554
  92. package/dist/api/natural-language-mapper.d.ts +0 -124
  93. package/dist/api/natural-language-mapper.js +0 -501
  94. package/dist/api/performance-optimizer.d.ts +0 -240
  95. package/dist/api/performance-optimizer.js +0 -706
  96. package/dist/api/transaction-manager.d.ts +0 -189
  97. package/dist/api/transaction-manager.js +0 -576
  98. package/dist/assembly/team-assembler.d.ts +0 -140
  99. package/dist/assembly/team-assembler.js +0 -502
  100. package/dist/benchmark-performance.d.ts +0 -41
  101. package/dist/benchmark-performance.js +0 -230
  102. package/dist/cli/snow-flow-cli-integration.d.ts +0 -30
  103. package/dist/cli/snow-flow-cli-integration.js +0 -396
  104. package/dist/coordination/coordination-engine.d.ts +0 -41
  105. package/dist/coordination/coordination-engine.js +0 -324
  106. package/dist/coordination/coordination.test.d.ts +0 -6
  107. package/dist/coordination/example.d.ts +0 -31
  108. package/dist/coordination/example.js +0 -394
  109. package/dist/coordination/execution-patterns.d.ts +0 -43
  110. package/dist/coordination/execution-patterns.js +0 -507
  111. package/dist/coordination/factory.d.ts +0 -94
  112. package/dist/coordination/factory.js +0 -433
  113. package/dist/coordination/index.d.ts +0 -71
  114. package/dist/coordination/index.js +0 -135
  115. package/dist/coordination/progress-monitor.d.ts +0 -71
  116. package/dist/coordination/progress-monitor.js +0 -505
  117. package/dist/coordination/quality-gates.d.ts +0 -124
  118. package/dist/coordination/quality-gates.js +0 -577
  119. package/dist/coordination/shared-memory.d.ts +0 -39
  120. package/dist/coordination/shared-memory.js +0 -289
  121. package/dist/coordination/task-dependencies.d.ts +0 -50
  122. package/dist/coordination/task-dependencies.js +0 -407
  123. package/dist/coordination/team-coordinator.d.ts +0 -59
  124. package/dist/coordination/team-coordinator.js +0 -550
  125. package/dist/coordination/types.d.ts +0 -152
  126. package/dist/coordination/types.js +0 -3
  127. package/dist/mcp/mcp-wrapper.d.ts +0 -8
  128. package/dist/mcp/mcp-wrapper.js +0 -77
  129. package/dist/mcp/servicenow-flow-composer-enhanced.js +0 -396
  130. package/dist/mcp/servicenow-flow-composer-mcp.d.ts +0 -7
  131. package/dist/mcp/servicenow-flow-composer-mcp.js +0 -3103
  132. package/dist/mcp/servicenow-graph-memory-mcp.d.ts +0 -7
  133. package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -143
  134. package/dist/mcp/servicenow-intelligent-mcp.js +0 -4156
  135. package/dist/mcp/servicenow-xml-flow-mcp.d.ts +0 -53
  136. package/dist/mcp/servicenow-xml-flow-mcp.js +0 -1704
  137. package/dist/mcp/singleton-check.js +0 -31
  138. package/dist/mcp/test-simple-mcp.d.ts +0 -6
  139. package/dist/mcp/test-simple-mcp.js +0 -63
  140. package/dist/memory/hierarchical-memory-system.d.ts +0 -90
  141. package/dist/memory/hierarchical-memory-system.js +0 -400
  142. package/dist/memory/index.d.ts +0 -9
  143. package/dist/memory/index.js +0 -20
  144. package/dist/memory/mcp-integration-example.d.ts +0 -6
  145. package/dist/memory/mcp-integration-example.js +0 -281
  146. package/dist/memory/memory-client.d.ts +0 -199
  147. package/dist/memory/memory-client.js +0 -364
  148. package/dist/memory/memory-manager.d.ts +0 -29
  149. package/dist/memory/memory-manager.js +0 -280
  150. package/dist/memory/memory-operations.d.ts +0 -179
  151. package/dist/memory/memory-operations.js +0 -691
  152. package/dist/memory/memory-system.d.ts +0 -153
  153. package/dist/memory/memory-system.js +0 -651
  154. package/dist/memory/memory-test.d.ts +0 -6
  155. package/dist/memory/memory-test.js +0 -161
  156. package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
  157. package/dist/memory/snow-flow-memory-patterns.js +0 -200
  158. package/dist/memory/snow-memory.d.ts +0 -54
  159. package/dist/memory/snow-memory.js +0 -301
  160. package/dist/memory/swarm-memory.d.ts +0 -135
  161. package/dist/memory/swarm-memory.js +0 -378
  162. package/dist/optimization/flow-performance-optimizer.js +0 -723
  163. package/dist/orchestration/discovery/service-discovery.d.ts +0 -81
  164. package/dist/orchestration/discovery/service-discovery.js +0 -808
  165. package/dist/orchestration/distributed-orchestrator.d.ts +0 -131
  166. package/dist/orchestration/distributed-orchestrator.js +0 -712
  167. package/dist/orchestration/distribution/task-distribution-engine.d.ts +0 -53
  168. package/dist/orchestration/distribution/task-distribution-engine.js +0 -586
  169. package/dist/orchestration/flow-update-orchestrator.js +0 -648
  170. package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +0 -606
  171. package/dist/orchestration/interfaces/distributed-orchestration.interface.js +0 -65
  172. package/dist/orchestration/protocols/mcpx-protocol.d.ts +0 -71
  173. package/dist/orchestration/protocols/mcpx-protocol.js +0 -668
  174. package/dist/orchestration/state/distributed-state-manager.d.ts +0 -89
  175. package/dist/orchestration/state/distributed-state-manager.js +0 -716
  176. package/dist/orchestrator/flow-composer.d.ts +0 -105
  177. package/dist/orchestrator/flow-composer.js +0 -404
  178. package/dist/orchestrator/flow-pattern-templates.d.ts +0 -260
  179. package/dist/orchestrator/flow-pattern-templates.js +0 -908
  180. package/dist/orchestrator/flow-subflow-decision-engine.d.ts +0 -202
  181. package/dist/orchestrator/flow-subflow-decision-engine.js +0 -769
  182. package/dist/orchestrator/flow-validation-engine.d.ts +0 -169
  183. package/dist/orchestrator/flow-validation-engine.js +0 -913
  184. package/dist/orchestrator/snow-orchestrator.d.ts +0 -49
  185. package/dist/orchestrator/snow-orchestrator.js +0 -235
  186. package/dist/orchestrator/subflow-creation-handler.d.ts +0 -230
  187. package/dist/orchestrator/subflow-creation-handler.js +0 -791
  188. package/dist/patterns/adaptive-patterns.d.ts +0 -140
  189. package/dist/patterns/adaptive-patterns.js +0 -549
  190. package/dist/queen/advanced-integration-test.d.ts +0 -48
  191. package/dist/queen/advanced-integration-test.js +0 -473
  192. package/dist/queen/integration-example.d.ts +0 -82
  193. package/dist/queen/integration-example.js +0 -219
  194. package/dist/queen/integration-test.d.ts +0 -72
  195. package/dist/queen/integration-test.js +0 -563
  196. package/dist/queen/mock-mcp-client.d.ts +0 -71
  197. package/dist/queen/mock-mcp-client.js +0 -317
  198. package/dist/queen/run-integration-tests.d.ts +0 -9
  199. package/dist/queen/run-integration-tests.js +0 -27
  200. package/dist/sparc/coordinators/adaptive-coordinator.d.ts +0 -54
  201. package/dist/sparc/coordinators/adaptive-coordinator.js +0 -367
  202. package/dist/sparc/coordinators/team-coordinator.d.ts +0 -66
  203. package/dist/sparc/coordinators/team-coordinator.js +0 -402
  204. package/dist/sparc/modes/team-modes.d.ts +0 -33
  205. package/dist/sparc/modes/team-modes.js +0 -399
  206. package/dist/sparc/teams/application-team.d.ts +0 -73
  207. package/dist/sparc/teams/application-team.js +0 -463
  208. package/dist/sparc/teams/flow-team.d.ts +0 -67
  209. package/dist/sparc/teams/flow-team.js +0 -373
  210. package/dist/sparc/teams/widget-team.d.ts +0 -61
  211. package/dist/sparc/teams/widget-team.js +0 -280
  212. package/dist/specialists/app-specialists.d.ts +0 -93
  213. package/dist/specialists/app-specialists.js +0 -1639
  214. package/dist/specialists/base-specialist.d.ts +0 -19
  215. package/dist/specialists/base-specialist.js +0 -54
  216. package/dist/specialists/flow-specialists.d.ts +0 -113
  217. package/dist/specialists/flow-specialists.js +0 -1787
  218. package/dist/specialists/individual-specialists.d.ts +0 -67
  219. package/dist/specialists/individual-specialists.js +0 -632
  220. package/dist/specialists/widget-specialists.d.ts +0 -70
  221. package/dist/specialists/widget-specialists.js +0 -1264
  222. package/dist/src/utils/agent-detector.js +0 -655
  223. package/dist/teams/adaptive-team.d.ts +0 -81
  224. package/dist/teams/adaptive-team.js +0 -1153
  225. package/dist/teams/application-team.d.ts +0 -30
  226. package/dist/teams/application-team.js +0 -547
  227. package/dist/teams/base-team.d.ts +0 -55
  228. package/dist/teams/base-team.js +0 -243
  229. package/dist/teams/flow-team.d.ts +0 -28
  230. package/dist/teams/flow-team.js +0 -525
  231. package/dist/teams/widget-team.d.ts +0 -26
  232. package/dist/teams/widget-team.js +0 -459
  233. package/dist/templates/flow-template-system.js +0 -625
  234. package/dist/test-fetch-incidents.d.ts +0 -2
  235. package/dist/test-fetch-incidents.js +0 -84
  236. package/dist/test-incident-access.d.ts +0 -2
  237. package/dist/test-incident-access.js +0 -72
  238. package/dist/test-iphone-flow.js +0 -189
  239. package/dist/test-limit-problem.d.ts +0 -2
  240. package/dist/test-limit-problem.js +0 -60
  241. package/dist/test-ml-batch-fix.d.ts +0 -2
  242. package/dist/test-ml-batch-fix.js +0 -104
  243. package/dist/test-ml-batch.d.ts +0 -2
  244. package/dist/test-ml-batch.js +0 -87
  245. package/dist/test-ml-query.d.ts +0 -2
  246. package/dist/test-ml-query.js +0 -100
  247. package/dist/test-ml-training-fix.d.ts +0 -12
  248. package/dist/test-ml-training-fix.js +0 -113
  249. package/dist/test-ml-training.d.ts +0 -2
  250. package/dist/test-ml-training.js +0 -32
  251. package/dist/test-operations-query.d.ts +0 -2
  252. package/dist/test-operations-query.js +0 -84
  253. package/dist/test-performance-query.d.ts +0 -2
  254. package/dist/test-performance-query.js +0 -52
  255. package/dist/test-singleton-protection.d.ts +0 -8
  256. package/dist/test-singleton-protection.js +0 -110
  257. package/dist/test-smart-limits.d.ts +0 -13
  258. package/dist/test-smart-limits.js +0 -100
  259. package/dist/test-snow-query-incidents.d.ts +0 -2
  260. package/dist/test-snow-query-incidents.js +0 -66
  261. package/dist/test-universal-query.d.ts +0 -2
  262. package/dist/test-universal-query.js +0 -106
  263. package/dist/testing/flow-testing-automation.js +0 -641
  264. package/dist/utils/complete-flow-xml-generator.js +0 -1285
  265. package/dist/utils/file-storage-fallback.d.ts +0 -62
  266. package/dist/utils/file-storage-fallback.js +0 -289
  267. package/dist/utils/flow-api-discovery.d.ts +0 -151
  268. package/dist/utils/flow-api-discovery.js +0 -439
  269. package/dist/utils/flow-examples.js +0 -720
  270. package/dist/utils/flow-structure-builder.js +0 -677
  271. package/dist/utils/flow-xml-generator.d.ts +0 -41
  272. package/dist/utils/flow-xml-generator.js +0 -258
  273. package/dist/utils/improved-flow-xml-generator.js +0 -820
  274. package/dist/utils/mcp-process-manager.backup.d.ts +0 -58
  275. package/dist/utils/mcp-process-manager.backup.js +0 -220
  276. package/dist/utils/mcp-singleton-enforcer.d.ts +0 -36
  277. package/dist/utils/mcp-singleton-enforcer.js +0 -201
  278. package/dist/utils/mcp-timeout-fix.d.ts +0 -53
  279. package/dist/utils/mcp-timeout-fix.js +0 -221
  280. package/dist/utils/migrate-claude-flow.d.ts +0 -22
  281. package/dist/utils/migrate-claude-flow.js +0 -120
  282. package/dist/utils/scope-utils.d.ts +0 -72
  283. package/dist/utils/scope-utils.js +0 -386
  284. package/dist/utils/snow-oauth-old.d.ts +0 -65
  285. package/dist/utils/snow-oauth-old.js +0 -345
  286. package/dist/utils/xml-first-flow-generator.js +0 -513
  287. package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
  288. package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
  289. package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
  290. package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
  291. package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
  292. package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
  293. package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
  294. package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
  295. package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
  296. package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
  297. package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
  298. package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
  299. package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
  300. package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
  301. package/reports/swarm-auto-centralized-1752649029776.json +0 -13
  302. package/src/memory/README.md +0 -240
@@ -1,734 +0,0 @@
1
- "use strict";
2
- /**
3
- * Test Agent
4
- * Specializes in testing ServiceNow artifacts and ensuring quality
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.TestAgent = void 0;
8
- const base_agent_1 = require("./base-agent");
9
- class TestAgent extends base_agent_1.BaseAgent {
10
- constructor(config) {
11
- super({
12
- type: 'tester',
13
- capabilities: [
14
- 'Test scenario creation',
15
- 'Mock data generation',
16
- 'Integration testing',
17
- 'Performance validation',
18
- 'Quality assurance',
19
- 'Automated test execution',
20
- 'Edge case identification',
21
- 'Security testing',
22
- 'User acceptance testing'
23
- ],
24
- mcpTools: [
25
- 'snow_test_flow_with_mock',
26
- 'snow_widget_test',
27
- 'snow_comprehensive_flow_test',
28
- 'snow_cleanup_test_artifacts',
29
- 'snow_preview_widget',
30
- 'snow_validate_flow_definition',
31
- 'snow_performance_test'
32
- ],
33
- ...config
34
- });
35
- }
36
- async execute(instruction, context) {
37
- try {
38
- this.setStatus('working');
39
- await this.reportProgress('Starting test execution', 0);
40
- // Analyze what needs to be tested
41
- const testRequirements = await this.analyzeTestRequirements(instruction, context);
42
- await this.reportProgress('Analyzed test requirements', 15);
43
- // Retrieve artifacts to test
44
- const artifacts = await this.retrieveArtifacts(testRequirements);
45
- if (!artifacts || artifacts.length === 0) {
46
- throw new Error('No artifacts found to test');
47
- }
48
- await this.reportProgress('Retrieved artifacts for testing', 25);
49
- // Generate test scenarios
50
- const testScenarios = await this.generateTestScenarios(artifacts, testRequirements);
51
- await this.reportProgress(`Generated ${testScenarios.length} test scenarios`, 35);
52
- // Generate mock data
53
- const mockData = await this.generateMockData(testScenarios, artifacts);
54
- await this.reportProgress('Generated mock test data', 45);
55
- // Execute tests
56
- const testResults = [];
57
- let currentProgress = 50;
58
- const progressPerTest = 40 / testScenarios.length;
59
- for (const scenario of testScenarios) {
60
- const result = await this.executeTestScenario(scenario, artifacts[0], mockData);
61
- testResults.push(result);
62
- currentProgress += progressPerTest;
63
- await this.reportProgress(`Executed test: ${scenario.name}`, Math.round(currentProgress));
64
- }
65
- // Analyze test results
66
- const analysis = await this.analyzeTestResults(testResults);
67
- await this.reportProgress('Analyzed test results', 92);
68
- // Clean up test artifacts if all tests passed
69
- if (analysis.allPassed && testRequirements.cleanupAfterTest) {
70
- await this.cleanupTestArtifacts();
71
- await this.reportProgress('Cleaned up test artifacts', 95);
72
- }
73
- // Generate test report
74
- const testReport = this.generateTestReport(testResults, analysis);
75
- await this.reportProgress('Test execution completed', 100);
76
- this.setStatus('completed');
77
- await this.logActivity('test_execution', analysis.allPassed, {
78
- totalTests: testScenarios.length,
79
- passed: analysis.passedCount,
80
- failed: analysis.failedCount,
81
- coverage: analysis.coverage
82
- });
83
- return {
84
- success: analysis.allPassed,
85
- message: analysis.allPassed ?
86
- `All ${testScenarios.length} tests passed successfully` :
87
- `${analysis.failedCount} of ${testScenarios.length} tests failed`,
88
- metadata: {
89
- testReport,
90
- testResults,
91
- analysis,
92
- mockDataGenerated: true,
93
- artifactsTested: artifacts.map(a => ({ type: a.type, name: a.name }))
94
- }
95
- };
96
- }
97
- catch (error) {
98
- this.setStatus('failed');
99
- await this.logActivity('test_execution', false, { error: error.message });
100
- return {
101
- success: false,
102
- error: error,
103
- message: `Test execution failed: ${error.message}`
104
- };
105
- }
106
- }
107
- async analyzeTestRequirements(instruction, context) {
108
- const requirements = {
109
- artifactTypes: [],
110
- testTypes: [],
111
- coverage: 'standard', // minimal, standard, comprehensive
112
- includeNegativeTests: true,
113
- includePerformanceTests: false,
114
- includeSecurityTests: false,
115
- cleanupAfterTest: true,
116
- specificArtifact: null
117
- };
118
- // Detect artifact types to test
119
- if (/widget/i.test(instruction)) {
120
- requirements.artifactTypes.push('widget');
121
- }
122
- if (/flow/i.test(instruction)) {
123
- requirements.artifactTypes.push('flow');
124
- }
125
- if (/script/i.test(instruction)) {
126
- requirements.artifactTypes.push('script');
127
- }
128
- if (!requirements.artifactTypes.length) {
129
- // Test whatever is in context
130
- requirements.artifactTypes = ['widget', 'flow', 'script'];
131
- }
132
- // Detect test types
133
- if (/integration/i.test(instruction)) {
134
- requirements.testTypes.push('integration');
135
- }
136
- if (/performance/i.test(instruction)) {
137
- requirements.testTypes.push('performance');
138
- requirements.includePerformanceTests = true;
139
- }
140
- if (/security/i.test(instruction)) {
141
- requirements.testTypes.push('security');
142
- requirements.includeSecurityTests = true;
143
- }
144
- if (/comprehensive|thorough|extensive/i.test(instruction)) {
145
- requirements.coverage = 'comprehensive';
146
- }
147
- if (/minimal|basic|quick/i.test(instruction)) {
148
- requirements.coverage = 'minimal';
149
- requirements.includeNegativeTests = false;
150
- }
151
- // Check if specific artifact is mentioned
152
- const artifactMatch = instruction.match(/test\s+(?:the\s+)?([a-zA-Z0-9_]+)\s+(?:widget|flow|script)/i);
153
- if (artifactMatch) {
154
- requirements.specificArtifact = artifactMatch[1];
155
- }
156
- return requirements;
157
- }
158
- async retrieveArtifacts(requirements) {
159
- const artifacts = [];
160
- // Try to retrieve specific artifact first
161
- if (requirements.specificArtifact) {
162
- for (const type of requirements.artifactTypes) {
163
- const artifact = await this.getArtifact(type, requirements.specificArtifact);
164
- if (artifact) {
165
- artifacts.push(artifact);
166
- return artifacts;
167
- }
168
- }
169
- }
170
- // Otherwise, get recent artifacts of requested types
171
- for (const type of requirements.artifactTypes) {
172
- // This would retrieve from shared memory
173
- // For now, we'll use a placeholder
174
- const recentArtifact = await this.getArtifact(type, `recent_${type}`);
175
- if (recentArtifact) {
176
- artifacts.push(recentArtifact);
177
- }
178
- }
179
- return artifacts;
180
- }
181
- async generateTestScenarios(artifacts, requirements) {
182
- const scenarios = [];
183
- for (const artifact of artifacts) {
184
- switch (artifact.type) {
185
- case 'widget':
186
- scenarios.push(...this.generateWidgetTestScenarios(artifact, requirements));
187
- break;
188
- case 'flow':
189
- scenarios.push(...this.generateFlowTestScenarios(artifact, requirements));
190
- break;
191
- case 'script':
192
- scenarios.push(...this.generateScriptTestScenarios(artifact, requirements));
193
- break;
194
- }
195
- }
196
- return scenarios;
197
- }
198
- generateWidgetTestScenarios(widget, requirements) {
199
- const scenarios = [];
200
- const config = widget.config;
201
- // Basic rendering test
202
- scenarios.push({
203
- name: 'Widget Basic Rendering',
204
- type: 'positive',
205
- description: 'Test that widget renders without errors',
206
- inputs: {
207
- options: {},
208
- data: {}
209
- },
210
- assertions: [
211
- 'Widget should render without JavaScript errors',
212
- 'HTML template should be valid',
213
- 'CSS should load correctly'
214
- ]
215
- });
216
- // Data loading test
217
- scenarios.push({
218
- name: 'Widget Data Loading',
219
- type: 'positive',
220
- description: 'Test that widget loads and displays data correctly',
221
- inputs: {
222
- server_data: {
223
- rows: [
224
- { id: 1, name: 'Test Item 1', status: 'Active' },
225
- { id: 2, name: 'Test Item 2', status: 'Inactive' }
226
- ]
227
- }
228
- },
229
- assertions: [
230
- 'Data should be displayed in the widget',
231
- 'All rows should be visible',
232
- 'Data formatting should be correct'
233
- ]
234
- });
235
- // Empty data test
236
- if (requirements.includeNegativeTests) {
237
- scenarios.push({
238
- name: 'Widget Empty Data Handling',
239
- type: 'negative',
240
- description: 'Test widget behavior with no data',
241
- inputs: {
242
- server_data: {
243
- rows: []
244
- }
245
- },
246
- assertions: [
247
- 'Widget should display appropriate empty state message',
248
- 'No JavaScript errors should occur',
249
- 'Widget should remain functional'
250
- ]
251
- });
252
- }
253
- // Responsive design test
254
- scenarios.push({
255
- name: 'Widget Responsive Design',
256
- type: 'edge_case',
257
- description: 'Test widget on different screen sizes',
258
- inputs: {
259
- viewport_sizes: [
260
- { width: 320, height: 568 }, // Mobile
261
- { width: 768, height: 1024 }, // Tablet
262
- { width: 1920, height: 1080 } // Desktop
263
- ]
264
- },
265
- assertions: [
266
- 'Widget should be responsive on all screen sizes',
267
- 'Text should remain readable',
268
- 'No horizontal scrolling on mobile'
269
- ]
270
- });
271
- // Performance test
272
- if (requirements.includePerformanceTests) {
273
- scenarios.push({
274
- name: 'Widget Performance',
275
- type: 'performance',
276
- description: 'Test widget performance with large datasets',
277
- inputs: {
278
- server_data: {
279
- rows: Array(1000).fill(null).map((_, i) => ({
280
- id: i,
281
- name: `Item ${i}`,
282
- status: i % 2 === 0 ? 'Active' : 'Inactive'
283
- }))
284
- }
285
- },
286
- assertions: [
287
- 'Widget should render within 3 seconds',
288
- 'Scrolling should be smooth',
289
- 'Memory usage should be reasonable'
290
- ]
291
- });
292
- }
293
- return scenarios;
294
- }
295
- generateFlowTestScenarios(flow, requirements) {
296
- const scenarios = [];
297
- // Basic flow execution
298
- scenarios.push({
299
- name: 'Flow Basic Execution',
300
- type: 'positive',
301
- description: 'Test that flow executes successfully with valid inputs',
302
- inputs: {
303
- trigger_record: {
304
- number: 'TST0001',
305
- short_description: 'Test Record',
306
- priority: 2,
307
- state: 1
308
- }
309
- },
310
- assertions: [
311
- 'Flow should trigger correctly',
312
- 'All actions should execute in order',
313
- 'Flow should complete without errors'
314
- ]
315
- });
316
- // Approval path test
317
- if (flow.config.metadata?.hasApprovals) {
318
- scenarios.push({
319
- name: 'Flow Approval Path - Approved',
320
- type: 'positive',
321
- description: 'Test flow behavior when approval is granted',
322
- inputs: {
323
- trigger_record: {
324
- number: 'TST0002',
325
- priority: 1
326
- },
327
- approval_response: 'approved',
328
- approver: 'admin'
329
- },
330
- assertions: [
331
- 'Approval request should be created',
332
- 'Flow should continue after approval',
333
- 'Approved actions should execute'
334
- ]
335
- });
336
- if (requirements.includeNegativeTests) {
337
- scenarios.push({
338
- name: 'Flow Approval Path - Rejected',
339
- type: 'negative',
340
- description: 'Test flow behavior when approval is rejected',
341
- inputs: {
342
- trigger_record: {
343
- number: 'TST0003',
344
- priority: 1
345
- },
346
- approval_response: 'rejected',
347
- approver: 'admin'
348
- },
349
- assertions: [
350
- 'Approval request should be created',
351
- 'Flow should handle rejection gracefully',
352
- 'Rejection path should execute',
353
- 'Notification should be sent'
354
- ]
355
- });
356
- }
357
- }
358
- // Error handling test
359
- scenarios.push({
360
- name: 'Flow Error Handling',
361
- type: 'negative',
362
- description: 'Test flow error handling capabilities',
363
- inputs: {
364
- trigger_record: {
365
- number: 'TST0004',
366
- force_error: true
367
- }
368
- },
369
- assertions: [
370
- 'Flow should catch errors',
371
- 'Error handler should execute',
372
- 'Flow should not leave data in inconsistent state'
373
- ]
374
- });
375
- // Performance test
376
- if (requirements.includePerformanceTests) {
377
- scenarios.push({
378
- name: 'Flow Performance Under Load',
379
- type: 'performance',
380
- description: 'Test flow performance with multiple simultaneous executions',
381
- inputs: {
382
- concurrent_executions: 10,
383
- trigger_records: Array(10).fill(null).map((_, i) => ({
384
- number: `PERF${i.toString().padStart(4, '0')}`,
385
- priority: (i % 3) + 1
386
- }))
387
- },
388
- assertions: [
389
- 'All flows should complete within reasonable time',
390
- 'No deadlocks should occur',
391
- 'System resources should not be exhausted'
392
- ]
393
- });
394
- }
395
- return scenarios;
396
- }
397
- generateScriptTestScenarios(script, requirements) {
398
- const scenarios = [];
399
- const scriptType = script.config.type || 'business_rule';
400
- // Basic execution test
401
- scenarios.push({
402
- name: 'Script Basic Execution',
403
- type: 'positive',
404
- description: 'Test that script executes without errors',
405
- inputs: {
406
- current: {
407
- sys_id: 'test123',
408
- number: 'TST0001',
409
- short_description: 'Test Record'
410
- },
411
- previous: null
412
- },
413
- assertions: [
414
- 'Script should execute without throwing errors',
415
- 'Expected fields should be set',
416
- 'No infinite loops should occur'
417
- ]
418
- });
419
- // Field validation test (for business rules)
420
- if (scriptType === 'business_rule') {
421
- scenarios.push({
422
- name: 'Business Rule Field Validation',
423
- type: 'positive',
424
- description: 'Test that business rule validates fields correctly',
425
- inputs: {
426
- current: {
427
- short_description: '',
428
- priority: 1
429
- }
430
- },
431
- expectedOutput: {
432
- abort_action: true,
433
- error_messages: ['Short description is required']
434
- },
435
- assertions: [
436
- 'Validation should trigger for empty required fields',
437
- 'Appropriate error messages should be set',
438
- 'Record save should be prevented'
439
- ]
440
- });
441
- }
442
- // Script include method test
443
- if (scriptType === 'script_include') {
444
- scenarios.push({
445
- name: 'Script Include Method Test',
446
- type: 'positive',
447
- description: 'Test script include methods work correctly',
448
- inputs: {
449
- method: 'processRecords',
450
- params: {
451
- tableName: 'incident',
452
- query: 'active=true^priority=1',
453
- callback: 'function(gr) { return gr.number; }'
454
- }
455
- },
456
- assertions: [
457
- 'Method should be callable',
458
- 'Return value should match expected format',
459
- 'No memory leaks should occur'
460
- ]
461
- });
462
- }
463
- // Edge case test
464
- scenarios.push({
465
- name: 'Script Edge Case - Null Values',
466
- type: 'edge_case',
467
- description: 'Test script handling of null/undefined values',
468
- inputs: {
469
- current: {
470
- sys_id: 'test123',
471
- short_description: null,
472
- assigned_to: undefined
473
- }
474
- },
475
- assertions: [
476
- 'Script should handle null values gracefully',
477
- 'No null pointer exceptions should occur',
478
- 'Default values should be applied where appropriate'
479
- ]
480
- });
481
- return scenarios;
482
- }
483
- async generateMockData(scenarios, artifacts) {
484
- const mockData = {
485
- users: [
486
- { sys_id: 'user1', user_name: 'test.user', name: 'Test User', email: 'test@example.com' },
487
- { sys_id: 'user2', user_name: 'admin', name: 'Admin User', email: 'admin@example.com' }
488
- ],
489
- groups: [
490
- { sys_id: 'group1', name: 'Service Desk', manager: 'user2' },
491
- { sys_id: 'group2', name: 'IT Support', manager: 'user1' }
492
- ],
493
- catalog_items: [
494
- { sys_id: 'cat1', name: 'Laptop Request', category: 'Hardware' },
495
- { sys_id: 'cat2', name: 'Software Installation', category: 'Software' }
496
- ]
497
- };
498
- // Generate specific mock data based on artifact types
499
- for (const artifact of artifacts) {
500
- if (artifact.type === 'widget' && artifact.config.dataSource) {
501
- mockData[artifact.config.dataSource] = this.generateTableMockData(artifact.config.dataSource);
502
- }
503
- }
504
- return mockData;
505
- }
506
- generateTableMockData(tableName) {
507
- const baseRecord = {
508
- sys_id: '',
509
- sys_created_on: new Date().toISOString(),
510
- sys_updated_on: new Date().toISOString(),
511
- sys_created_by: 'test.user',
512
- sys_updated_by: 'test.user'
513
- };
514
- switch (tableName) {
515
- case 'incident':
516
- return Array(5).fill(null).map((_, i) => ({
517
- ...baseRecord,
518
- sys_id: `inc${i}`,
519
- number: `INC000100${i}`,
520
- short_description: `Test Incident ${i}`,
521
- description: `This is a test incident for automated testing`,
522
- priority: (i % 3) + 1,
523
- state: i % 4 + 1,
524
- assigned_to: i % 2 === 0 ? 'user1' : 'user2',
525
- assignment_group: i % 2 === 0 ? 'group1' : 'group2'
526
- }));
527
- case 'sc_request':
528
- return Array(3).fill(null).map((_, i) => ({
529
- ...baseRecord,
530
- sys_id: `req${i}`,
531
- number: `REQ000100${i}`,
532
- short_description: `Test Request ${i}`,
533
- requested_for: 'user1',
534
- state: 'pending_approval',
535
- cat_item: `cat${i % 2 + 1}`
536
- }));
537
- default:
538
- return Array(3).fill(null).map((_, i) => ({
539
- ...baseRecord,
540
- sys_id: `rec${i}`,
541
- number: `REC000100${i}`,
542
- short_description: `Test Record ${i}`
543
- }));
544
- }
545
- }
546
- async executeTestScenario(scenario, artifact, mockData) {
547
- const startTime = Date.now();
548
- const result = {
549
- scenario: scenario.name,
550
- passed: true,
551
- executionTime: 0,
552
- assertions: []
553
- };
554
- try {
555
- // Execute test based on artifact type
556
- let testOutput;
557
- switch (artifact.type) {
558
- case 'widget':
559
- testOutput = await this.executeWidgetTest(scenario, artifact, mockData);
560
- break;
561
- case 'flow':
562
- testOutput = await this.executeFlowTest(scenario, artifact, mockData);
563
- break;
564
- case 'script':
565
- testOutput = await this.executeScriptTest(scenario, artifact, mockData);
566
- break;
567
- }
568
- result.actualOutput = testOutput;
569
- // Evaluate assertions
570
- for (const assertion of scenario.assertions) {
571
- const assertionResult = await this.evaluateAssertion(assertion, testOutput, scenario);
572
- result.assertions.push(assertionResult);
573
- if (!assertionResult.passed) {
574
- result.passed = false;
575
- }
576
- }
577
- }
578
- catch (error) {
579
- result.passed = false;
580
- result.error = error.message;
581
- result.assertions.push({
582
- assertion: 'Test execution',
583
- passed: false,
584
- message: `Test failed with error: ${error.message}`
585
- });
586
- }
587
- result.executionTime = Date.now() - startTime;
588
- return result;
589
- }
590
- async executeWidgetTest(scenario, widget, mockData) {
591
- // This would use snow_widget_test MCP tool
592
- // For now, simulate test execution
593
- return {
594
- renderSuccess: true,
595
- loadTime: 250,
596
- errors: [],
597
- dataDisplayed: scenario.inputs.server_data?.rows?.length || 0,
598
- responsive: true
599
- };
600
- }
601
- async executeFlowTest(scenario, flow, mockData) {
602
- // This would use snow_test_flow_with_mock MCP tool
603
- // For now, simulate test execution
604
- return {
605
- executionId: `flow_test_${Date.now()}`,
606
- status: 'completed',
607
- duration: 1500,
608
- stagesExecuted: ['Start', 'Validate', 'Process', 'End'],
609
- errors: [],
610
- outputs: {
611
- success: true,
612
- recordUpdated: true
613
- }
614
- };
615
- }
616
- async executeScriptTest(scenario, script, mockData) {
617
- // Simulate script test execution
618
- return {
619
- executionSuccess: true,
620
- errors: [],
621
- fieldsModified: ['work_notes', 'state'],
622
- validationsPassed: true,
623
- performanceMetrics: {
624
- executionTime: 50,
625
- memoryUsed: 1024
626
- }
627
- };
628
- }
629
- async evaluateAssertion(assertion, actualOutput, scenario) {
630
- // Simple assertion evaluation logic
631
- // In a real implementation, this would be more sophisticated
632
- const assertionResult = {
633
- assertion,
634
- passed: true,
635
- message: 'Assertion passed'
636
- };
637
- // Check for specific assertion patterns
638
- if (assertion.includes('without errors') && actualOutput.errors?.length > 0) {
639
- assertionResult.passed = false;
640
- assertionResult.message = `Found ${actualOutput.errors.length} errors`;
641
- }
642
- if (assertion.includes('should be displayed') && actualOutput.dataDisplayed === 0) {
643
- assertionResult.passed = false;
644
- assertionResult.message = 'No data was displayed';
645
- }
646
- if (assertion.includes('within') && assertion.includes('seconds')) {
647
- const timeMatch = assertion.match(/within (\d+) seconds/);
648
- if (timeMatch) {
649
- const maxTime = parseInt(timeMatch[1]) * 1000;
650
- if (actualOutput.executionTime > maxTime || actualOutput.loadTime > maxTime) {
651
- assertionResult.passed = false;
652
- assertionResult.message = `Execution took longer than ${maxTime}ms`;
653
- }
654
- }
655
- }
656
- return assertionResult;
657
- }
658
- async analyzeTestResults(results) {
659
- const analysis = {
660
- totalTests: results.length,
661
- passedCount: results.filter(r => r.passed).length,
662
- failedCount: results.filter(r => !r.passed).length,
663
- allPassed: results.every(r => r.passed),
664
- averageExecutionTime: results.reduce((sum, r) => sum + r.executionTime, 0) / results.length,
665
- coverage: 0,
666
- failedTests: results.filter(r => !r.passed).map(r => ({
667
- name: r.scenario,
668
- error: r.error,
669
- failedAssertions: r.assertions.filter(a => !a.passed)
670
- })),
671
- performanceIssues: results.filter(r => r.executionTime > 5000).map(r => r.scenario)
672
- };
673
- // Calculate coverage based on test types
674
- const testTypes = new Set(results.map(r => r.scenario.split(' ')[1]));
675
- analysis.coverage = (testTypes.size / 5) * 100; // Assume 5 main test categories
676
- return analysis;
677
- }
678
- async cleanupTestArtifacts() {
679
- // This would use snow_cleanup_test_artifacts MCP tool
680
- // Clean up any test data created during testing
681
- await this.logActivity('cleanup_test_artifacts', true, {
682
- timestamp: new Date()
683
- });
684
- }
685
- generateTestReport(results, analysis) {
686
- let report = '# Test Execution Report\n\n';
687
- report += `**Date**: ${new Date().toISOString()}\n`;
688
- report += `**Total Tests**: ${analysis.totalTests}\n`;
689
- report += `**Passed**: ${analysis.passedCount}\n`;
690
- report += `**Failed**: ${analysis.failedCount}\n`;
691
- report += `**Coverage**: ${analysis.coverage.toFixed(1)}%\n`;
692
- report += `**Average Execution Time**: ${analysis.averageExecutionTime.toFixed(0)}ms\n\n`;
693
- report += '## Test Results\n\n';
694
- for (const result of results) {
695
- const icon = result.passed ? '✅' : '❌';
696
- report += `### ${icon} ${result.scenario}\n`;
697
- report += `- **Status**: ${result.passed ? 'PASSED' : 'FAILED'}\n`;
698
- report += `- **Execution Time**: ${result.executionTime}ms\n`;
699
- if (result.error) {
700
- report += `- **Error**: ${result.error}\n`;
701
- }
702
- report += `- **Assertions**:\n`;
703
- for (const assertion of result.assertions) {
704
- const assertionIcon = assertion.passed ? '✓' : '✗';
705
- report += ` - ${assertionIcon} ${assertion.assertion}\n`;
706
- if (!assertion.passed && assertion.message) {
707
- report += ` - ${assertion.message}\n`;
708
- }
709
- }
710
- report += '\n';
711
- }
712
- if (analysis.failedCount > 0) {
713
- report += '## Failed Tests Summary\n\n';
714
- for (const failed of analysis.failedTests) {
715
- report += `- **${failed.name}**\n`;
716
- if (failed.error) {
717
- report += ` - Error: ${failed.error}\n`;
718
- }
719
- for (const assertion of failed.failedAssertions) {
720
- report += ` - Failed: ${assertion.assertion}\n`;
721
- }
722
- }
723
- }
724
- if (analysis.performanceIssues.length > 0) {
725
- report += '\n## Performance Issues\n\n';
726
- report += 'The following tests took longer than 5 seconds:\n';
727
- for (const test of analysis.performanceIssues) {
728
- report += `- ${test}\n`;
729
- }
730
- }
731
- return report;
732
- }
733
- }
734
- exports.TestAgent = TestAgent;