snow-flow 3.0.8 → 3.0.10

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 (295) hide show
  1. package/claude-flow.bat +0 -0
  2. package/claude-flow.ps1 +0 -0
  3. package/dist/mcp/servicenow-automation-mcp.js +0 -0
  4. package/dist/mcp/servicenow-deployment-mcp.js +0 -0
  5. package/dist/mcp/servicenow-integration-mcp.js +0 -0
  6. package/dist/mcp/servicenow-mcp-server.js +0 -0
  7. package/dist/mcp/servicenow-operations-mcp.js +0 -0
  8. package/dist/mcp/servicenow-platform-development-mcp.js +0 -0
  9. package/dist/mcp/servicenow-progressive-indexer.js +0 -0
  10. package/dist/mcp/servicenow-reporting-analytics-mcp.js +133 -19
  11. package/dist/mcp/servicenow-security-compliance-mcp.js +0 -0
  12. package/dist/mcp/servicenow-update-set-mcp.js +0 -0
  13. package/dist/mcp/start-all-mcp-servers.js +0 -0
  14. package/dist/mcp/start-servicenow-mcp.js +0 -0
  15. package/dist/utils/snow-oauth.js +53 -16
  16. package/memory/agents/README.md +1 -1
  17. package/memory/claude-flow-data.json +1 -1
  18. package/memory/sessions/README.md +1 -1
  19. package/package.json +2 -2
  20. package/.mcp.json +0 -22
  21. package/claude-flow.config.json +0 -20
  22. package/dist/agents/app-creator.agent.d.ts +0 -55
  23. package/dist/agents/app-creator.agent.js +0 -1292
  24. package/dist/agents/base/base-snow-agent.d.ts +0 -75
  25. package/dist/agents/base/base-snow-agent.js +0 -169
  26. package/dist/agents/base-snow-agent.d.ts +0 -63
  27. package/dist/agents/base-snow-agent.js +0 -296
  28. package/dist/agents/coordinator.d.ts +0 -200
  29. package/dist/agents/coordinator.js +0 -777
  30. package/dist/agents/flow-builder-agent.d.ts +0 -18
  31. package/dist/agents/flow-builder-agent.js +0 -197
  32. package/dist/agents/queen-403-handler.d.ts +0 -47
  33. package/dist/agents/queen-403-handler.js +0 -175
  34. package/dist/agents/queen-agent-example.d.ts +0 -23
  35. package/dist/agents/queen-agent-example.js +0 -240
  36. package/dist/agents/queen-agent.test.d.ts +0 -6
  37. package/dist/agents/script-generator.agent.d.ts +0 -32
  38. package/dist/agents/script-generator.agent.js +0 -772
  39. package/dist/agents/script-writer-agent.d.ts +0 -22
  40. package/dist/agents/script-writer-agent.js +0 -695
  41. package/dist/agents/security-agent.d.ts +0 -23
  42. package/dist/agents/security-agent.js +0 -619
  43. package/dist/agents/specialists/automation-specialist.agent.d.ts +0 -44
  44. package/dist/agents/specialists/automation-specialist.agent.js +0 -204
  45. package/dist/agents/specialists/data-specialist.agent.d.ts +0 -165
  46. package/dist/agents/specialists/data-specialist.agent.js +0 -484
  47. package/dist/agents/specialists/integration-specialist.agent.d.ts +0 -227
  48. package/dist/agents/specialists/integration-specialist.agent.js +0 -725
  49. package/dist/agents/specialists/reporting-specialist.agent.d.ts +0 -54
  50. package/dist/agents/specialists/reporting-specialist.agent.js +0 -193
  51. package/dist/agents/specialists/security-specialist.agent.d.ts +0 -85
  52. package/dist/agents/specialists/security-specialist.agent.js +0 -309
  53. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +0 -111
  54. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +0 -383
  55. package/dist/agents/teams/base-team.d.ts +0 -72
  56. package/dist/agents/teams/base-team.js +0 -253
  57. package/dist/agents/teams/team-types.d.ts +0 -265
  58. package/dist/agents/teams/team-types.js +0 -3
  59. package/dist/agents/teams/widget/widget-architect.agent.d.ts +0 -61
  60. package/dist/agents/teams/widget/widget-architect.agent.js +0 -436
  61. package/dist/agents/teams/widget/widget-backend.agent.d.ts +0 -74
  62. package/dist/agents/teams/widget/widget-backend.agent.js +0 -1531
  63. package/dist/agents/teams/widget/widget-frontend.agent.d.ts +0 -67
  64. package/dist/agents/teams/widget/widget-frontend.agent.js +0 -1014
  65. package/dist/agents/teams/widget/widget-platform.agent.d.ts +0 -90
  66. package/dist/agents/teams/widget/widget-platform.agent.js +0 -1190
  67. package/dist/agents/teams/widget/widget-uiux.agent.d.ts +0 -107
  68. package/dist/agents/teams/widget/widget-uiux.agent.js +0 -1033
  69. package/dist/agents/test-agent.d.ts +0 -26
  70. package/dist/agents/test-agent.js +0 -734
  71. package/dist/agents/test-agents.d.ts +0 -7
  72. package/dist/agents/test-agents.js +0 -64
  73. package/dist/agents/ui-builder.agent.d.ts +0 -50
  74. package/dist/agents/ui-builder.agent.js +0 -1539
  75. package/dist/agents/widget-builder.agent.d.ts +0 -32
  76. package/dist/agents/widget-builder.agent.js +0 -439
  77. package/dist/agents/widget-creator-agent.d.ts +0 -18
  78. package/dist/agents/widget-creator-agent.js +0 -498
  79. package/dist/agents/workflow-designer.agent.d.ts +0 -31
  80. package/dist/agents/workflow-designer.agent.js +0 -583
  81. package/dist/api/error-handling.d.ts +0 -325
  82. package/dist/api/error-handling.js +0 -1488
  83. package/dist/api/flow-designer-api.d.ts +0 -167
  84. package/dist/api/flow-designer-api.js +0 -554
  85. package/dist/api/natural-language-mapper.d.ts +0 -124
  86. package/dist/api/natural-language-mapper.js +0 -501
  87. package/dist/api/performance-optimizer.d.ts +0 -240
  88. package/dist/api/performance-optimizer.js +0 -706
  89. package/dist/api/transaction-manager.d.ts +0 -189
  90. package/dist/api/transaction-manager.js +0 -576
  91. package/dist/assembly/team-assembler.d.ts +0 -140
  92. package/dist/assembly/team-assembler.js +0 -502
  93. package/dist/benchmark-performance.d.ts +0 -41
  94. package/dist/benchmark-performance.js +0 -230
  95. package/dist/cli/snow-flow-cli-integration.d.ts +0 -30
  96. package/dist/cli/snow-flow-cli-integration.js +0 -396
  97. package/dist/coordination/coordination-engine.d.ts +0 -41
  98. package/dist/coordination/coordination-engine.js +0 -324
  99. package/dist/coordination/coordination.test.d.ts +0 -6
  100. package/dist/coordination/example.d.ts +0 -31
  101. package/dist/coordination/example.js +0 -394
  102. package/dist/coordination/execution-patterns.d.ts +0 -43
  103. package/dist/coordination/execution-patterns.js +0 -507
  104. package/dist/coordination/factory.d.ts +0 -94
  105. package/dist/coordination/factory.js +0 -433
  106. package/dist/coordination/index.d.ts +0 -71
  107. package/dist/coordination/index.js +0 -135
  108. package/dist/coordination/progress-monitor.d.ts +0 -71
  109. package/dist/coordination/progress-monitor.js +0 -505
  110. package/dist/coordination/quality-gates.d.ts +0 -124
  111. package/dist/coordination/quality-gates.js +0 -577
  112. package/dist/coordination/shared-memory.d.ts +0 -39
  113. package/dist/coordination/shared-memory.js +0 -289
  114. package/dist/coordination/task-dependencies.d.ts +0 -50
  115. package/dist/coordination/task-dependencies.js +0 -407
  116. package/dist/coordination/team-coordinator.d.ts +0 -59
  117. package/dist/coordination/team-coordinator.js +0 -550
  118. package/dist/coordination/types.d.ts +0 -152
  119. package/dist/coordination/types.js +0 -3
  120. package/dist/mcp/mcp-wrapper.d.ts +0 -8
  121. package/dist/mcp/mcp-wrapper.js +0 -77
  122. package/dist/mcp/servicenow-flow-composer-enhanced.js +0 -396
  123. package/dist/mcp/servicenow-flow-composer-mcp.d.ts +0 -7
  124. package/dist/mcp/servicenow-flow-composer-mcp.js +0 -3103
  125. package/dist/mcp/servicenow-graph-memory-mcp.d.ts +0 -7
  126. package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -143
  127. package/dist/mcp/servicenow-intelligent-mcp.js +0 -4156
  128. package/dist/mcp/servicenow-xml-flow-mcp.d.ts +0 -53
  129. package/dist/mcp/servicenow-xml-flow-mcp.js +0 -1704
  130. package/dist/mcp/singleton-check.js +0 -31
  131. package/dist/mcp/test-simple-mcp.d.ts +0 -6
  132. package/dist/mcp/test-simple-mcp.js +0 -63
  133. package/dist/memory/hierarchical-memory-system.d.ts +0 -90
  134. package/dist/memory/hierarchical-memory-system.js +0 -400
  135. package/dist/memory/index.d.ts +0 -9
  136. package/dist/memory/index.js +0 -20
  137. package/dist/memory/mcp-integration-example.d.ts +0 -6
  138. package/dist/memory/mcp-integration-example.js +0 -281
  139. package/dist/memory/memory-client.d.ts +0 -199
  140. package/dist/memory/memory-client.js +0 -364
  141. package/dist/memory/memory-manager.d.ts +0 -29
  142. package/dist/memory/memory-manager.js +0 -280
  143. package/dist/memory/memory-operations.d.ts +0 -179
  144. package/dist/memory/memory-operations.js +0 -691
  145. package/dist/memory/memory-system.d.ts +0 -153
  146. package/dist/memory/memory-system.js +0 -651
  147. package/dist/memory/memory-test.d.ts +0 -6
  148. package/dist/memory/memory-test.js +0 -161
  149. package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
  150. package/dist/memory/snow-flow-memory-patterns.js +0 -200
  151. package/dist/memory/snow-memory.d.ts +0 -54
  152. package/dist/memory/snow-memory.js +0 -301
  153. package/dist/memory/swarm-memory.d.ts +0 -135
  154. package/dist/memory/swarm-memory.js +0 -378
  155. package/dist/optimization/flow-performance-optimizer.js +0 -723
  156. package/dist/orchestration/discovery/service-discovery.d.ts +0 -81
  157. package/dist/orchestration/discovery/service-discovery.js +0 -808
  158. package/dist/orchestration/distributed-orchestrator.d.ts +0 -131
  159. package/dist/orchestration/distributed-orchestrator.js +0 -712
  160. package/dist/orchestration/distribution/task-distribution-engine.d.ts +0 -53
  161. package/dist/orchestration/distribution/task-distribution-engine.js +0 -586
  162. package/dist/orchestration/flow-update-orchestrator.js +0 -648
  163. package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +0 -606
  164. package/dist/orchestration/interfaces/distributed-orchestration.interface.js +0 -65
  165. package/dist/orchestration/protocols/mcpx-protocol.d.ts +0 -71
  166. package/dist/orchestration/protocols/mcpx-protocol.js +0 -668
  167. package/dist/orchestration/state/distributed-state-manager.d.ts +0 -89
  168. package/dist/orchestration/state/distributed-state-manager.js +0 -716
  169. package/dist/orchestrator/flow-composer.d.ts +0 -105
  170. package/dist/orchestrator/flow-composer.js +0 -404
  171. package/dist/orchestrator/flow-pattern-templates.d.ts +0 -260
  172. package/dist/orchestrator/flow-pattern-templates.js +0 -908
  173. package/dist/orchestrator/flow-subflow-decision-engine.d.ts +0 -202
  174. package/dist/orchestrator/flow-subflow-decision-engine.js +0 -769
  175. package/dist/orchestrator/flow-validation-engine.d.ts +0 -169
  176. package/dist/orchestrator/flow-validation-engine.js +0 -913
  177. package/dist/orchestrator/snow-orchestrator.d.ts +0 -49
  178. package/dist/orchestrator/snow-orchestrator.js +0 -235
  179. package/dist/orchestrator/subflow-creation-handler.d.ts +0 -230
  180. package/dist/orchestrator/subflow-creation-handler.js +0 -791
  181. package/dist/patterns/adaptive-patterns.d.ts +0 -140
  182. package/dist/patterns/adaptive-patterns.js +0 -549
  183. package/dist/queen/advanced-integration-test.d.ts +0 -48
  184. package/dist/queen/advanced-integration-test.js +0 -473
  185. package/dist/queen/integration-example.d.ts +0 -82
  186. package/dist/queen/integration-example.js +0 -219
  187. package/dist/queen/integration-test.d.ts +0 -72
  188. package/dist/queen/integration-test.js +0 -563
  189. package/dist/queen/mock-mcp-client.d.ts +0 -71
  190. package/dist/queen/mock-mcp-client.js +0 -317
  191. package/dist/queen/run-integration-tests.d.ts +0 -9
  192. package/dist/queen/run-integration-tests.js +0 -27
  193. package/dist/sparc/coordinators/adaptive-coordinator.d.ts +0 -54
  194. package/dist/sparc/coordinators/adaptive-coordinator.js +0 -367
  195. package/dist/sparc/coordinators/team-coordinator.d.ts +0 -66
  196. package/dist/sparc/coordinators/team-coordinator.js +0 -402
  197. package/dist/sparc/modes/team-modes.d.ts +0 -33
  198. package/dist/sparc/modes/team-modes.js +0 -399
  199. package/dist/sparc/teams/application-team.d.ts +0 -73
  200. package/dist/sparc/teams/application-team.js +0 -463
  201. package/dist/sparc/teams/flow-team.d.ts +0 -67
  202. package/dist/sparc/teams/flow-team.js +0 -373
  203. package/dist/sparc/teams/widget-team.d.ts +0 -61
  204. package/dist/sparc/teams/widget-team.js +0 -280
  205. package/dist/specialists/app-specialists.d.ts +0 -93
  206. package/dist/specialists/app-specialists.js +0 -1639
  207. package/dist/specialists/base-specialist.d.ts +0 -19
  208. package/dist/specialists/base-specialist.js +0 -54
  209. package/dist/specialists/flow-specialists.d.ts +0 -113
  210. package/dist/specialists/flow-specialists.js +0 -1787
  211. package/dist/specialists/individual-specialists.d.ts +0 -67
  212. package/dist/specialists/individual-specialists.js +0 -632
  213. package/dist/specialists/widget-specialists.d.ts +0 -70
  214. package/dist/specialists/widget-specialists.js +0 -1264
  215. package/dist/src/utils/agent-detector.js +0 -655
  216. package/dist/teams/adaptive-team.d.ts +0 -81
  217. package/dist/teams/adaptive-team.js +0 -1153
  218. package/dist/teams/application-team.d.ts +0 -30
  219. package/dist/teams/application-team.js +0 -547
  220. package/dist/teams/base-team.d.ts +0 -55
  221. package/dist/teams/base-team.js +0 -243
  222. package/dist/teams/flow-team.d.ts +0 -28
  223. package/dist/teams/flow-team.js +0 -525
  224. package/dist/teams/widget-team.d.ts +0 -26
  225. package/dist/teams/widget-team.js +0 -459
  226. package/dist/templates/flow-template-system.js +0 -625
  227. package/dist/test-fetch-incidents.d.ts +0 -2
  228. package/dist/test-fetch-incidents.js +0 -84
  229. package/dist/test-incident-access.d.ts +0 -2
  230. package/dist/test-incident-access.js +0 -72
  231. package/dist/test-iphone-flow.js +0 -189
  232. package/dist/test-limit-problem.d.ts +0 -2
  233. package/dist/test-limit-problem.js +0 -60
  234. package/dist/test-ml-batch-fix.d.ts +0 -2
  235. package/dist/test-ml-batch-fix.js +0 -104
  236. package/dist/test-ml-batch.d.ts +0 -2
  237. package/dist/test-ml-batch.js +0 -87
  238. package/dist/test-ml-query.d.ts +0 -2
  239. package/dist/test-ml-query.js +0 -100
  240. package/dist/test-ml-training-fix.d.ts +0 -12
  241. package/dist/test-ml-training-fix.js +0 -113
  242. package/dist/test-ml-training.d.ts +0 -2
  243. package/dist/test-ml-training.js +0 -32
  244. package/dist/test-operations-query.d.ts +0 -2
  245. package/dist/test-operations-query.js +0 -84
  246. package/dist/test-performance-query.d.ts +0 -2
  247. package/dist/test-performance-query.js +0 -52
  248. package/dist/test-singleton-protection.d.ts +0 -8
  249. package/dist/test-singleton-protection.js +0 -110
  250. package/dist/test-smart-limits.d.ts +0 -13
  251. package/dist/test-smart-limits.js +0 -100
  252. package/dist/test-snow-query-incidents.d.ts +0 -2
  253. package/dist/test-snow-query-incidents.js +0 -66
  254. package/dist/test-universal-query.d.ts +0 -2
  255. package/dist/test-universal-query.js +0 -106
  256. package/dist/testing/flow-testing-automation.js +0 -641
  257. package/dist/utils/complete-flow-xml-generator.js +0 -1285
  258. package/dist/utils/file-storage-fallback.d.ts +0 -62
  259. package/dist/utils/file-storage-fallback.js +0 -289
  260. package/dist/utils/flow-api-discovery.d.ts +0 -151
  261. package/dist/utils/flow-api-discovery.js +0 -439
  262. package/dist/utils/flow-examples.js +0 -720
  263. package/dist/utils/flow-structure-builder.js +0 -677
  264. package/dist/utils/flow-xml-generator.d.ts +0 -41
  265. package/dist/utils/flow-xml-generator.js +0 -258
  266. package/dist/utils/improved-flow-xml-generator.js +0 -820
  267. package/dist/utils/mcp-process-manager.backup.d.ts +0 -58
  268. package/dist/utils/mcp-process-manager.backup.js +0 -220
  269. package/dist/utils/mcp-singleton-enforcer.d.ts +0 -36
  270. package/dist/utils/mcp-singleton-enforcer.js +0 -201
  271. package/dist/utils/mcp-timeout-fix.d.ts +0 -53
  272. package/dist/utils/mcp-timeout-fix.js +0 -221
  273. package/dist/utils/migrate-claude-flow.d.ts +0 -22
  274. package/dist/utils/migrate-claude-flow.js +0 -120
  275. package/dist/utils/scope-utils.d.ts +0 -72
  276. package/dist/utils/scope-utils.js +0 -386
  277. package/dist/utils/snow-oauth-old.d.ts +0 -65
  278. package/dist/utils/snow-oauth-old.js +0 -345
  279. package/dist/utils/xml-first-flow-generator.js +0 -513
  280. package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
  281. package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
  282. package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
  283. package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
  284. package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
  285. package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
  286. package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
  287. package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
  288. package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
  289. package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
  290. package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
  291. package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
  292. package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
  293. package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
  294. package/reports/swarm-auto-centralized-1752649029776.json +0 -13
  295. package/src/memory/README.md +0 -240
@@ -1,695 +0,0 @@
1
- "use strict";
2
- /**
3
- * Script Writer Agent
4
- * Specializes in creating ServiceNow scripts (Business Rules, Script Includes, Client Scripts)
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ScriptWriterAgent = void 0;
8
- const base_agent_1 = require("./base-agent");
9
- class ScriptWriterAgent extends base_agent_1.BaseAgent {
10
- constructor(config) {
11
- super({
12
- type: 'script-writer',
13
- capabilities: [
14
- 'Business rule creation',
15
- 'Script include development',
16
- 'Client script implementation',
17
- 'Data transformation scripts',
18
- 'Performance optimization',
19
- 'GlideRecord operations',
20
- 'GlideSystem methods',
21
- 'REST API scripting',
22
- 'Scheduled job scripts'
23
- ],
24
- mcpTools: [
25
- 'snow_create_script_include',
26
- 'snow_create_business_rule',
27
- 'snow_create_client_script',
28
- 'snow_create_ui_action',
29
- 'snow_create_scheduled_job',
30
- 'snow_discover_table_fields',
31
- 'snow_table_schema_discovery'
32
- ],
33
- ...config
34
- });
35
- }
36
- async execute(instruction, context) {
37
- try {
38
- this.setStatus('working');
39
- await this.reportProgress('Starting script creation', 0);
40
- // Analyze script requirements
41
- const requirements = await this.analyzeScriptRequirements(instruction);
42
- await this.reportProgress('Analyzed script requirements', 20);
43
- // Discover table schema if needed
44
- if (requirements.targetTable) {
45
- const schema = await this.discoverTableSchema(requirements.targetTable);
46
- requirements.tableFields = schema.fields;
47
- await this.reportProgress('Discovered table schema', 30);
48
- }
49
- // Generate script based on type
50
- let script;
51
- let scriptConfig;
52
- switch (requirements.scriptType) {
53
- case 'business_rule':
54
- script = await this.createBusinessRuleScript(requirements);
55
- scriptConfig = this.createBusinessRuleConfig(requirements, script);
56
- break;
57
- case 'script_include':
58
- script = await this.createScriptIncludeScript(requirements);
59
- scriptConfig = this.createScriptIncludeConfig(requirements, script);
60
- break;
61
- case 'client_script':
62
- script = await this.createClientScript(requirements);
63
- scriptConfig = this.createClientScriptConfig(requirements, script);
64
- break;
65
- case 'scheduled_job':
66
- script = await this.createScheduledJobScript(requirements);
67
- scriptConfig = this.createScheduledJobConfig(requirements, script);
68
- break;
69
- default:
70
- throw new Error(`Unknown script type: ${requirements.scriptType}`);
71
- }
72
- await this.reportProgress(`Created ${requirements.scriptType} script`, 60);
73
- // Add performance optimizations
74
- if (requirements.needsOptimization) {
75
- script = await this.optimizeScript(script, requirements);
76
- scriptConfig.script = script;
77
- await this.reportProgress('Optimized script performance', 70);
78
- }
79
- // Create script artifact
80
- const artifact = {
81
- type: 'script',
82
- name: requirements.name,
83
- config: scriptConfig,
84
- dependencies: requirements.dependencies
85
- };
86
- // Store artifact for other agents
87
- await this.storeArtifact(artifact);
88
- await this.reportProgress('Script artifact created and stored', 85);
89
- // Generate documentation
90
- const documentation = this.generateDocumentation(requirements, script);
91
- await this.reportProgress('Generated script documentation', 95);
92
- await this.reportProgress('Script creation completed', 100);
93
- this.setStatus('completed');
94
- await this.logActivity('script_creation', true, {
95
- scriptName: requirements.name,
96
- scriptType: requirements.scriptType,
97
- targetTable: requirements.targetTable
98
- });
99
- return {
100
- success: true,
101
- artifacts: [artifact],
102
- message: `${requirements.scriptType} "${requirements.name}" created successfully`,
103
- metadata: {
104
- scriptType: requirements.scriptType,
105
- targetTable: requirements.targetTable,
106
- when: requirements.when,
107
- documentation,
108
- performanceOptimized: requirements.needsOptimization
109
- }
110
- };
111
- }
112
- catch (error) {
113
- this.setStatus('failed');
114
- await this.logActivity('script_creation', false, { error: error.message });
115
- return {
116
- success: false,
117
- error: error,
118
- message: `Failed to create script: ${error.message}`
119
- };
120
- }
121
- }
122
- async analyzeScriptRequirements(instruction) {
123
- const requirements = {
124
- name: '',
125
- scriptType: '',
126
- targetTable: '',
127
- when: '',
128
- async: false,
129
- needsOptimization: false,
130
- operations: [],
131
- dependencies: [],
132
- tableFields: [],
133
- conditions: [],
134
- features: []
135
- };
136
- // Determine script type
137
- if (/business\s*rule/i.test(instruction)) {
138
- requirements.scriptType = 'business_rule';
139
- }
140
- else if (/script\s*include/i.test(instruction)) {
141
- requirements.scriptType = 'script_include';
142
- }
143
- else if (/client\s*script/i.test(instruction)) {
144
- requirements.scriptType = 'client_script';
145
- }
146
- else if (/scheduled\s*job|scheduled\s*script/i.test(instruction)) {
147
- requirements.scriptType = 'scheduled_job';
148
- }
149
- else {
150
- // Default to business rule if table is mentioned
151
- requirements.scriptType = /table|record/i.test(instruction) ? 'business_rule' : 'script_include';
152
- }
153
- // Extract script name
154
- const nameMatch = instruction.match(/(?:create|write|build)\s+(?:a\s+)?([a-zA-Z0-9_\s]+?)(?:\s+(?:business\s*rule|script\s*include|client\s*script|for))/i);
155
- if (nameMatch) {
156
- requirements.name = nameMatch[1].trim().toLowerCase().replace(/\s+/g, '_');
157
- }
158
- else {
159
- requirements.name = `custom_${requirements.scriptType}_${Date.now()}`;
160
- }
161
- // Detect target table
162
- const tableMatch = instruction.match(/(?:for|on|table)\s+([a-zA-Z0-9_]+)/i);
163
- if (tableMatch) {
164
- requirements.targetTable = tableMatch[1];
165
- }
166
- else if (/incident/i.test(instruction)) {
167
- requirements.targetTable = 'incident';
168
- }
169
- else if (/request/i.test(instruction)) {
170
- requirements.targetTable = 'sc_request';
171
- }
172
- else if (/task/i.test(instruction)) {
173
- requirements.targetTable = 'task';
174
- }
175
- // Determine when to execute (for business rules)
176
- if (/before/i.test(instruction)) {
177
- requirements.when = 'before';
178
- }
179
- else if (/after/i.test(instruction)) {
180
- requirements.when = 'after';
181
- }
182
- else if (/async/i.test(instruction)) {
183
- requirements.when = 'async';
184
- requirements.async = true;
185
- }
186
- else if (/display/i.test(instruction)) {
187
- requirements.when = 'display';
188
- }
189
- // Detect operations
190
- if (/create|insert/i.test(instruction)) {
191
- requirements.operations.push('insert');
192
- }
193
- if (/update|modify/i.test(instruction)) {
194
- requirements.operations.push('update');
195
- }
196
- if (/delete|remove/i.test(instruction)) {
197
- requirements.operations.push('delete');
198
- }
199
- if (!requirements.operations.length && requirements.scriptType === 'business_rule') {
200
- requirements.operations = ['insert', 'update']; // Default
201
- }
202
- // Feature detection
203
- if (/validat/i.test(instruction)) {
204
- requirements.features.push('validation');
205
- }
206
- if (/calculat|compute/i.test(instruction)) {
207
- requirements.features.push('calculation');
208
- }
209
- if (/notification|email/i.test(instruction)) {
210
- requirements.features.push('notification');
211
- requirements.dependencies.push('sys_email');
212
- }
213
- if (/api|rest|integration/i.test(instruction)) {
214
- requirements.features.push('api_call');
215
- requirements.dependencies.push('sys_rest_message');
216
- }
217
- if (/transform|convert/i.test(instruction)) {
218
- requirements.features.push('data_transformation');
219
- }
220
- if (/performance|optimi/i.test(instruction)) {
221
- requirements.needsOptimization = true;
222
- }
223
- return requirements;
224
- }
225
- async discoverTableSchema(tableName) {
226
- // This would use snow_table_schema_discovery MCP tool
227
- // For now, return common fields
228
- return {
229
- fields: [
230
- { name: 'sys_id', type: 'GUID', mandatory: true },
231
- { name: 'number', type: 'string', mandatory: true },
232
- { name: 'short_description', type: 'string', mandatory: false },
233
- { name: 'description', type: 'text', mandatory: false },
234
- { name: 'state', type: 'integer', mandatory: false },
235
- { name: 'priority', type: 'integer', mandatory: false },
236
- { name: 'assigned_to', type: 'reference', reference: 'sys_user' },
237
- { name: 'assignment_group', type: 'reference', reference: 'sys_user_group' },
238
- { name: 'sys_created_on', type: 'glide_date_time', mandatory: true },
239
- { name: 'sys_updated_on', type: 'glide_date_time', mandatory: true }
240
- ]
241
- };
242
- }
243
- async createBusinessRuleScript(requirements) {
244
- let script = '(function executeRule(current, previous /*null when async*/) {\n\n';
245
- // Add header comment
246
- script += ` // Business Rule: ${requirements.name}\n`;
247
- script += ` // Table: ${requirements.targetTable}\n`;
248
- script += ` // When: ${requirements.when}\n`;
249
- script += ` // Operations: ${requirements.operations.join(', ')}\n\n`;
250
- // Add validation if needed
251
- if (requirements.features.includes('validation')) {
252
- script += ' // Validation logic\n';
253
- script += ' if (!current.short_description || current.short_description.toString().trim() === "") {\n';
254
- script += ' gs.addErrorMessage("Short description is required");\n';
255
- script += ' current.setAbortAction(true);\n';
256
- script += ' return;\n';
257
- script += ' }\n\n';
258
- }
259
- // Add calculation if needed
260
- if (requirements.features.includes('calculation')) {
261
- script += ' // Calculation logic\n';
262
- script += ' if (current.priority == 1 && current.impact == 1) {\n';
263
- script += ' current.urgency = 1; // High urgency for P1 high impact\n';
264
- script += ' }\n\n';
265
- }
266
- // Add main business logic based on when
267
- switch (requirements.when) {
268
- case 'before':
269
- script += ' // Before business logic\n';
270
- script += ' // Set field values before the record is saved\n';
271
- script += ' if (current.isNewRecord()) {\n';
272
- script += ' current.active = true;\n';
273
- script += ` current.created_by_rule = "${requirements.name}";\n`;
274
- script += ' }\n\n';
275
- script += ' // Track changes\n';
276
- script += ' if (!current.isNewRecord() && current.state.changes()) {\n';
277
- script += ' current.work_notes = "State changed from " + previous.getDisplayValue("state") + " to " + current.getDisplayValue("state");\n';
278
- script += ' }\n';
279
- break;
280
- case 'after':
281
- script += ' // After business logic\n';
282
- script += ' // Perform actions after the record is saved\n';
283
- if (requirements.features.includes('notification')) {
284
- script += ' \n // Send notification\n';
285
- script += ' if (current.isNewRecord() || current.state.changes()) {\n';
286
- script += ' gs.eventQueue("record.updated", current, current.assigned_to, current.assignment_group);\n';
287
- script += ' }\n';
288
- }
289
- script += ' \n // Create related records if needed\n';
290
- script += ' if (current.isNewRecord() && current.priority == 1) {\n';
291
- script += ' // Example: Create a task for high priority items\n';
292
- script += ' var task = new GlideRecord("task");\n';
293
- script += ' task.initialize();\n';
294
- script += ' task.parent = current.sys_id;\n';
295
- script += ' task.short_description = "Review high priority " + current.getDisplayValue();\n';
296
- script += ' task.insert();\n';
297
- script += ' }\n';
298
- break;
299
- case 'async':
300
- script += ' // Async business logic\n';
301
- script += ' // This runs in the background after the record is saved\n';
302
- if (requirements.features.includes('api_call')) {
303
- script += ' \n // Make API call\n';
304
- script += ' try {\n';
305
- script += ' var r = new sn_ws.RESTMessageV2();\n';
306
- script += ' r.setEndpoint("https://api.example.com/webhook");\n';
307
- script += ' r.setHttpMethod("POST");\n';
308
- script += ' r.setRequestBody(JSON.stringify({\n';
309
- script += ' record_number: current.number.toString(),\n';
310
- script += ' record_type: current.getTableName(),\n';
311
- script += ' action: "created"\n';
312
- script += ' }));\n';
313
- script += ' var response = r.execute();\n';
314
- script += ' gs.info("API Response: " + response.getStatusCode());\n';
315
- script += ' } catch (ex) {\n';
316
- script += ' gs.error("API call failed: " + ex.getMessage());\n';
317
- script += ' }\n';
318
- }
319
- break;
320
- }
321
- // Add error handling
322
- script += '\n // Error handling\n';
323
- script += ' try {\n';
324
- script += ' // Additional processing can go here\n';
325
- script += ' } catch (e) {\n';
326
- script += ` gs.error("Error in business rule ${requirements.name}: " + e.getMessage());\n`;
327
- script += ' }\n';
328
- script += '\n})(current, previous);';
329
- return script;
330
- }
331
- async createScriptIncludeScript(requirements) {
332
- let script = `var ${requirements.name} = Class.create();\n`;
333
- script += `${requirements.name}.prototype = {\n`;
334
- script += ' initialize: function() {\n';
335
- script += ' // Initialize the script include\n';
336
- script += ' this.log_source = "' + requirements.name + '";\n';
337
- script += ' },\n\n';
338
- // Add main methods based on features
339
- if (requirements.features.includes('data_transformation')) {
340
- script += ' /**\n';
341
- script += ' * Transform data from one format to another\n';
342
- script += ' * @param {Object} sourceData - The data to transform\n';
343
- script += ' * @return {Object} Transformed data\n';
344
- script += ' */\n';
345
- script += ' transformData: function(sourceData) {\n';
346
- script += ' var transformedData = {};\n';
347
- script += ' \n';
348
- script += ' try {\n';
349
- script += ' // Transformation logic\n';
350
- script += ' for (var key in sourceData) {\n';
351
- script += ' if (sourceData.hasOwnProperty(key)) {\n';
352
- script += ' transformedData[this._normalizeKey(key)] = sourceData[key];\n';
353
- script += ' }\n';
354
- script += ' }\n';
355
- script += ' } catch (e) {\n';
356
- script += ' gs.error(this.log_source + ": Error transforming data - " + e.getMessage());\n';
357
- script += ' }\n';
358
- script += ' \n';
359
- script += ' return transformedData;\n';
360
- script += ' },\n\n';
361
- script += ' _normalizeKey: function(key) {\n';
362
- script += ' return key.toLowerCase().replace(/[^a-z0-9]/g, "_");\n';
363
- script += ' },\n\n';
364
- }
365
- if (requirements.features.includes('api_call')) {
366
- script += ' /**\n';
367
- script += ' * Make an API call to external service\n';
368
- script += ' * @param {String} endpoint - API endpoint\n';
369
- script += ' * @param {Object} payload - Request payload\n';
370
- script += ' * @return {Object} API response\n';
371
- script += ' */\n';
372
- script += ' callAPI: function(endpoint, payload) {\n';
373
- script += ' var response = {\n';
374
- script += ' success: false,\n';
375
- script += ' data: null,\n';
376
- script += ' error: null\n';
377
- script += ' };\n';
378
- script += ' \n';
379
- script += ' try {\n';
380
- script += ' var r = new sn_ws.RESTMessageV2();\n';
381
- script += ' r.setEndpoint(endpoint);\n';
382
- script += ' r.setHttpMethod("POST");\n';
383
- script += ' r.setRequestHeader("Content-Type", "application/json");\n';
384
- script += ' r.setRequestBody(JSON.stringify(payload));\n';
385
- script += ' \n';
386
- script += ' var httpResponse = r.execute();\n';
387
- script += ' response.success = httpResponse.getStatusCode() == 200;\n';
388
- script += ' response.data = JSON.parse(httpResponse.getBody());\n';
389
- script += ' } catch (e) {\n';
390
- script += ' response.error = e.getMessage();\n';
391
- script += ' gs.error(this.log_source + ": API call failed - " + e.getMessage());\n';
392
- script += ' }\n';
393
- script += ' \n';
394
- script += ' return response;\n';
395
- script += ' },\n\n';
396
- }
397
- // Add utility methods
398
- script += ' /**\n';
399
- script += ' * Process records from a table\n';
400
- script += ' * @param {String} tableName - Table to process\n';
401
- script += ' * @param {String} query - Encoded query\n';
402
- script += ' * @param {Function} callback - Function to call for each record\n';
403
- script += ' */\n';
404
- script += ' processRecords: function(tableName, query, callback) {\n';
405
- script += ' var count = 0;\n';
406
- script += ' var gr = new GlideRecord(tableName);\n';
407
- script += ' \n';
408
- script += ' if (query) {\n';
409
- script += ' gr.addEncodedQuery(query);\n';
410
- script += ' }\n';
411
- script += ' \n';
412
- script += ' gr.query();\n';
413
- script += ' \n';
414
- script += ' while (gr.next()) {\n';
415
- script += ' try {\n';
416
- script += ' callback(gr);\n';
417
- script += ' count++;\n';
418
- script += ' } catch (e) {\n';
419
- script += ' gs.error(this.log_source + ": Error processing record " + gr.getUniqueValue() + " - " + e.getMessage());\n';
420
- script += ' }\n';
421
- script += ' }\n';
422
- script += ' \n';
423
- script += ' gs.info(this.log_source + ": Processed " + count + " records from " + tableName);\n';
424
- script += ' return count;\n';
425
- script += ' },\n\n';
426
- // Add type checking
427
- script += ' type: "' + requirements.name + '"\n';
428
- script += '};';
429
- return script;
430
- }
431
- async createClientScript(requirements) {
432
- let script = 'function ';
433
- // Determine function name based on type
434
- let functionName = 'onLoad';
435
- if (requirements.when === 'onChange') {
436
- functionName = 'onChange';
437
- }
438
- else if (requirements.when === 'onSubmit') {
439
- functionName = 'onSubmit';
440
- }
441
- // Add appropriate function signature
442
- switch (functionName) {
443
- case 'onLoad':
444
- script += 'onLoad() {\n';
445
- break;
446
- case 'onChange':
447
- script += 'onChange(control, oldValue, newValue, isLoading, isTemplate) {\n';
448
- script += ' if (isLoading || newValue === "") {\n';
449
- script += ' return;\n';
450
- script += ' }\n\n';
451
- break;
452
- case 'onSubmit':
453
- script += 'onSubmit() {\n';
454
- break;
455
- }
456
- // Add script logic based on features
457
- if (requirements.features.includes('validation')) {
458
- script += ' // Client-side validation\n';
459
- script += ' var shortDesc = g_form.getValue("short_description");\n';
460
- script += ' if (!shortDesc || shortDesc.trim() === "") {\n';
461
- script += ' g_form.showFieldMsg("short_description", "Short description is required", "error");\n';
462
- script += ' g_form.setMandatory("short_description", true);\n';
463
- if (functionName === 'onSubmit') {
464
- script += ' return false; // Prevent form submission\n';
465
- }
466
- script += ' }\n\n';
467
- }
468
- if (requirements.features.includes('calculation')) {
469
- script += ' // Field calculations\n';
470
- script += ' var priority = g_form.getValue("priority");\n';
471
- script += ' var impact = g_form.getValue("impact");\n';
472
- script += ' \n';
473
- script += ' if (priority == "1" && impact == "1") {\n';
474
- script += ' g_form.setValue("urgency", "1");\n';
475
- script += ' g_form.showFieldMsg("urgency", "Urgency set to High due to P1/High Impact", "info");\n';
476
- script += ' }\n\n';
477
- }
478
- // Add UI behavior logic
479
- script += ' // UI behavior\n';
480
- script += ' var state = g_form.getValue("state");\n';
481
- script += ' \n';
482
- script += ' // Show/hide fields based on state\n';
483
- script += ' if (state == "1") { // New\n';
484
- script += ' g_form.setDisplay("resolution_notes", false);\n';
485
- script += ' g_form.setDisplay("resolved_at", false);\n';
486
- script += ' } else if (state == "6") { // Resolved\n';
487
- script += ' g_form.setDisplay("resolution_notes", true);\n';
488
- script += ' g_form.setMandatory("resolution_notes", true);\n';
489
- script += ' }\n\n';
490
- // Add AJAX example if needed
491
- if (requirements.features.includes('api_call')) {
492
- script += ' // AJAX call example\n';
493
- script += ' var ga = new GlideAjax("' + requirements.name + '_Ajax");\n';
494
- script += ' ga.addParam("sysparm_name", "getData");\n';
495
- script += ' ga.addParam("sysparm_value", g_form.getValue("number"));\n';
496
- script += ' ga.getXMLAnswer(function(response) {\n';
497
- script += ' if (response) {\n';
498
- script += ' g_form.addInfoMessage("Data retrieved: " + response);\n';
499
- script += ' }\n';
500
- script += ' });\n\n';
501
- }
502
- // Close function
503
- if (functionName === 'onSubmit') {
504
- script += ' return true; // Allow form submission\n';
505
- }
506
- script += '}';
507
- return script;
508
- }
509
- async createScheduledJobScript(requirements) {
510
- let script = '// Scheduled Job: ' + requirements.name + '\n';
511
- script += '// Schedule: Daily at midnight (adjust as needed)\n\n';
512
- script += '(function executeScheduledJob() {\n';
513
- script += ' var startTime = new GlideDateTime();\n';
514
- script += ' gs.info("' + requirements.name + ' - Started at " + startTime.getDisplayValue());\n\n';
515
- script += ' try {\n';
516
- script += ' var recordCount = 0;\n';
517
- script += ' var errorCount = 0;\n\n';
518
- if (requirements.targetTable) {
519
- script += ' // Process records from ' + requirements.targetTable + '\n';
520
- script += ' var gr = new GlideRecord("' + requirements.targetTable + '");\n';
521
- script += ' gr.addQuery("active", true);\n';
522
- // Add date filter for scheduled cleanup jobs
523
- if (requirements.features.includes('cleanup')) {
524
- script += ' // Process records older than 30 days\n';
525
- script += ' gr.addQuery("sys_updated_on", "<", gs.daysAgoStart(30));\n';
526
- }
527
- script += ' gr.query();\n\n';
528
- script += ' while (gr.next()) {\n';
529
- script += ' try {\n';
530
- script += ' // Process each record\n';
531
- script += ' recordCount++;\n';
532
- if (requirements.features.includes('data_transformation')) {
533
- script += ' \n // Transform data\n';
534
- script += ' var transformedData = transformRecord(gr);\n';
535
- script += ' if (transformedData) {\n';
536
- script += ' gr.work_notes = "Processed by scheduled job: " + transformedData.summary;\n';
537
- script += ' gr.update();\n';
538
- script += ' }\n';
539
- }
540
- script += ' } catch (e) {\n';
541
- script += ' errorCount++;\n';
542
- script += ' gs.error("' + requirements.name + ' - Error processing record " + gr.getDisplayValue() + ": " + e.getMessage());\n';
543
- script += ' }\n';
544
- script += ' }\n';
545
- }
546
- // Add summary reporting
547
- script += '\n // Summary report\n';
548
- script += ' var endTime = new GlideDateTime();\n';
549
- script += ' var duration = GlideDateTime.subtract(startTime, endTime);\n';
550
- script += ' \n';
551
- script += ' var summary = {\n';
552
- script += ' job_name: "' + requirements.name + '",\n';
553
- script += ' start_time: startTime.getDisplayValue(),\n';
554
- script += ' end_time: endTime.getDisplayValue(),\n';
555
- script += ' duration: duration.getDisplayValue(),\n';
556
- script += ' records_processed: recordCount,\n';
557
- script += ' errors: errorCount,\n';
558
- script += ' status: errorCount === 0 ? "Success" : "Completed with errors"\n';
559
- script += ' };\n';
560
- script += ' \n';
561
- script += ' gs.info("' + requirements.name + ' - Summary: " + JSON.stringify(summary));\n';
562
- // Send notification if configured
563
- if (requirements.features.includes('notification')) {
564
- script += ' \n // Send completion notification\n';
565
- script += ' if (errorCount > 0) {\n';
566
- script += ' gs.eventQueue("scheduled_job.error", null, JSON.stringify(summary));\n';
567
- script += ' }\n';
568
- }
569
- script += ' } catch (e) {\n';
570
- script += ' gs.error("' + requirements.name + ' - Fatal error: " + e.getMessage());\n';
571
- script += ' }\n';
572
- // Add helper function if needed
573
- if (requirements.features.includes('data_transformation')) {
574
- script += '\n function transformRecord(record) {\n';
575
- script += ' // Transform record data\n';
576
- script += ' return {\n';
577
- script += ' summary: record.short_description + " - Processed",\n';
578
- script += ' processed_date: new GlideDateTime().getDisplayValue()\n';
579
- script += ' };\n';
580
- script += ' }\n';
581
- }
582
- script += '})();';
583
- return script;
584
- }
585
- async optimizeScript(script, requirements) {
586
- let optimizedScript = script;
587
- // Add caching for repeated queries
588
- if (script.includes('new GlideRecord') && script.includes('while')) {
589
- optimizedScript = '// Performance optimization: Use setLimit for large queries\n' + optimizedScript;
590
- optimizedScript = optimizedScript.replace(/gr\.query\(\);/g, 'gr.setLimit(1000); // Prevent memory issues\n gr.query();');
591
- }
592
- // Use GlideAggregate for counting
593
- if (script.includes('count') || script.includes('COUNT')) {
594
- const aggregateExample = '\n// Performance tip: Use GlideAggregate for counting:\n' +
595
- '// var ga = new GlideAggregate("table_name");\n' +
596
- '// ga.addAggregate("COUNT");\n' +
597
- '// ga.query();\n' +
598
- '// var count = ga.next() ? ga.getAggregate("COUNT") : 0;\n\n';
599
- optimizedScript = aggregateExample + optimizedScript;
600
- }
601
- // Add bulk operations tip
602
- if (script.includes('.update()') && script.includes('while')) {
603
- const bulkTip = '\n// Performance tip: Consider using updateMultiple() for bulk updates\n' +
604
- '// gr.setValue("field", "value");\n' +
605
- '// gr.updateMultiple();\n\n';
606
- optimizedScript = bulkTip + optimizedScript;
607
- }
608
- return optimizedScript;
609
- }
610
- createBusinessRuleConfig(requirements, script) {
611
- return {
612
- name: requirements.name,
613
- table: requirements.targetTable,
614
- active: true,
615
- when: requirements.when,
616
- order: 100,
617
- script: script,
618
- condition: requirements.conditions.join(' AND ') || '',
619
- description: `Auto-generated business rule: ${requirements.name}`,
620
- advanced: true,
621
- actions: {
622
- insert: requirements.operations.includes('insert'),
623
- update: requirements.operations.includes('update'),
624
- delete: requirements.operations.includes('delete'),
625
- query: requirements.operations.includes('query')
626
- }
627
- };
628
- }
629
- createScriptIncludeConfig(requirements, script) {
630
- return {
631
- name: requirements.name,
632
- api_name: requirements.name,
633
- client_callable: false,
634
- active: true,
635
- script: script,
636
- description: `Auto-generated script include: ${requirements.name}`,
637
- access: 'package_private'
638
- };
639
- }
640
- createClientScriptConfig(requirements, script) {
641
- return {
642
- name: requirements.name,
643
- table: requirements.targetTable,
644
- type: requirements.when || 'onLoad',
645
- field: '', // Set if onChange script
646
- script: script,
647
- active: true,
648
- description: `Auto-generated client script: ${requirements.name}`,
649
- messages: [],
650
- global: false,
651
- isolate_script: true,
652
- ui_type: 10 // Desktop
653
- };
654
- }
655
- createScheduledJobConfig(requirements, script) {
656
- return {
657
- name: requirements.name,
658
- script: script,
659
- active: true,
660
- run_type: 'periodically',
661
- run_period: '1 day',
662
- run_time: '00:00:00',
663
- run_dayofweek: 'all',
664
- conditional: false,
665
- condition: ''
666
- };
667
- }
668
- generateDocumentation(requirements, script) {
669
- let doc = `# ${requirements.name}\n\n`;
670
- doc += `## Type\n${requirements.scriptType}\n\n`;
671
- if (requirements.targetTable) {
672
- doc += `## Target Table\n${requirements.targetTable}\n\n`;
673
- }
674
- if (requirements.when) {
675
- doc += `## When\n${requirements.when}\n\n`;
676
- }
677
- doc += `## Features\n`;
678
- requirements.features.forEach(feature => {
679
- doc += `- ${feature}\n`;
680
- });
681
- doc += `\n## Dependencies\n`;
682
- if (requirements.dependencies.length > 0) {
683
- requirements.dependencies.forEach(dep => {
684
- doc += `- ${dep}\n`;
685
- });
686
- }
687
- else {
688
- doc += 'None\n';
689
- }
690
- doc += `\n## Performance Optimized\n${requirements.needsOptimization ? 'Yes' : 'No'}\n`;
691
- return doc;
692
- }
693
- }
694
- exports.ScriptWriterAgent = ScriptWriterAgent;
695
- //# sourceMappingURL=script-writer-agent.js.map