snow-flow 3.4.3 → 3.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.mcp.json.template
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"args": [
|
|
6
6
|
"{{PROJECT_ROOT}}/dist/mcp/servicenow-deployment-mcp.js"
|
|
7
7
|
],
|
|
8
|
-
"description": "Widget deployment (snow_deploy),
|
|
8
|
+
"description": "Widget deployment (snow_deploy) with COHERENCE VALIDATION - ensures HTML template, client script, server script work together perfectly. Validates data.properties sync, ng-click methods, server actions. Update set creation, deployment validation/rollback, artifact export/import, auth diagnostics, widget preview/testing",
|
|
9
9
|
"env": {
|
|
10
10
|
"SNOW_INSTANCE": "{{SNOW_INSTANCE}}",
|
|
11
11
|
"SNOW_CLIENT_ID": "{{SNOW_CLIENT_ID}}",
|
package/README.md
CHANGED
|
@@ -1,635 +1,164 @@
|
|
|
1
|
-
# Snow-Flow
|
|
1
|
+
# Snow-Flow
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://github.com/groeimetai/snow-flow/actions/workflows/ci.yml)
|
|
6
|
-
[](https://www.npmjs.com/package/snow-flow)
|
|
7
|
-
[](https://www.npmjs.com/package/snow-flow)
|
|
8
|
-
[](https://www.servicenow.com)
|
|
9
|
-
[](https://github.com/groeimetai/snow-flow)
|
|
3
|
+
ServiceNow development framework with MCP (Model Context Protocol) server integration and Claude AI orchestration.
|
|
10
4
|
|
|
11
|
-
|
|
5
|
+
## What It Is
|
|
12
6
|
|
|
13
|
-
|
|
7
|
+
Snow-Flow is a Node.js application that provides:
|
|
8
|
+
- 12 MCP servers for ServiceNow operations
|
|
9
|
+
- Command-line interface for task orchestration
|
|
10
|
+
- Multi-agent coordination system
|
|
11
|
+
- OAuth authentication for ServiceNow instances
|
|
12
|
+
- Background script execution with ES5 JavaScript only
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
The simplest way to use Snow-Flow is with the swarm command. Just describe what you want in natural language:
|
|
14
|
+
## Requirements
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
This single command automatically:
|
|
24
|
-
- Spawns multiple specialized AI agents
|
|
25
|
-
- Discovers existing ServiceNow artifacts
|
|
26
|
-
- Creates complete working solutions
|
|
27
|
-
- Deploys directly to your instance
|
|
28
|
-
- Handles all technical complexity
|
|
29
|
-
|
|
30
|
-
More examples:
|
|
31
|
-
```bash
|
|
32
|
-
snow-flow swarm "Build employee onboarding workflow"
|
|
33
|
-
snow-flow swarm "Create knowledge base for IT support"
|
|
34
|
-
snow-flow swarm "Set up change management process"
|
|
35
|
-
snow-flow swarm "Analyze last month's incident patterns"
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Core Functionality
|
|
39
|
-
|
|
40
|
-
Snow-Flow connects directly to ServiceNow instances through OAuth 2.0 authentication and provides:
|
|
41
|
-
|
|
42
|
-
- Direct API integration with ServiceNow REST endpoints
|
|
43
|
-
- Multi-agent system with specialized agents for different tasks
|
|
44
|
-
- Natural language interface for ServiceNow operations
|
|
45
|
-
- Machine learning capabilities using TensorFlow.js
|
|
46
|
-
- Process automation and workflow optimization
|
|
47
|
-
- Real-time logging and token tracking for API operations
|
|
48
|
-
|
|
49
|
-
### API Operation Visibility
|
|
50
|
-
|
|
51
|
-
Snow-Flow displays detailed information during API calls:
|
|
16
|
+
- Node.js 18 or higher
|
|
17
|
+
- ServiceNow instance with OAuth configured
|
|
18
|
+
- Client ID and Client Secret for authentication
|
|
19
|
+
- Instance URL (format: myinstance.service-now.com)
|
|
52
20
|
|
|
53
|
-
|
|
54
|
-
⏳ Operation in progress... (2s elapsed, 150 tokens used)
|
|
55
|
-
🔄 API Call: GET /api/now/table/incident (10 records)
|
|
56
|
-
📊 Tokens used: 450 (in: 100, out: 350)
|
|
57
|
-
✅ Operation complete in 3 seconds
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
MCP operations run in separate processes and their logs are sent to stderr for visibility in the console.
|
|
61
|
-
|
|
62
|
-
## ServiceNow API Integration
|
|
63
|
-
|
|
64
|
-
### Authentication
|
|
65
|
-
Snow-Flow uses OAuth 2.0 for secure authentication with ServiceNow:
|
|
21
|
+
## Installation
|
|
66
22
|
|
|
67
23
|
```bash
|
|
68
|
-
snow-flow
|
|
69
|
-
# Opens ServiceNow OAuth consent screen
|
|
70
|
-
# Authenticate with ServiceNow credentials
|
|
71
|
-
# Token stored locally in ~/.snow-flow/auth.json
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Security
|
|
75
|
-
- OAuth 2.0 authentication protocol
|
|
76
|
-
- Respects ServiceNow ACLs and user permissions
|
|
77
|
-
- Local token storage with encryption
|
|
78
|
-
- No external data transmission
|
|
79
|
-
- All operations logged in ServiceNow audit trails
|
|
80
|
-
|
|
81
|
-
### Network Architecture
|
|
82
|
-
```
|
|
83
|
-
┌─────────────┐ OAuth 2.0 + REST APIs ┌─────────────────┐
|
|
84
|
-
│ Snow-Flow │ ◄─────────────────────────► │ Your ServiceNow │
|
|
85
|
-
│ (Local) │ HTTPS Only │ Instance │
|
|
86
|
-
└─────────────┘ └─────────────────┘
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
## Available Tools
|
|
90
|
-
|
|
91
|
-
Snow-Flow provides 180+ tools across 17 specialized MCP servers:
|
|
92
|
-
|
|
93
|
-
## Complete Tool Reference
|
|
94
|
-
|
|
95
|
-
### MCP Server Overview
|
|
96
|
-
|
|
97
|
-
| Server | Tools | Primary Focus |
|
|
98
|
-
|--------|-------|---------------|
|
|
99
|
-
| servicenow-operations | 15 | CRUD operations, data management |
|
|
100
|
-
| servicenow-deployment | 21 | Widget, portal, and application deployment (create & update) |
|
|
101
|
-
| servicenow-platform-development | 12 | Table creation, field management |
|
|
102
|
-
| servicenow-machine-learning | 15 | Neural networks, predictions, anomaly detection |
|
|
103
|
-
| servicenow-reporting-analytics | 18 | Dashboards, reports, KPIs |
|
|
104
|
-
| servicenow-security-compliance | 14 | Security scanning, ACLs, compliance |
|
|
105
|
-
| servicenow-update-set | 10 | Change packaging, version control |
|
|
106
|
-
| servicenow-automation | 22 | Business rules, scheduled jobs, ATF testing |
|
|
107
|
-
| servicenow-integration | 10 | REST/SOAP, data import/export |
|
|
108
|
-
| servicenow-advanced-features | 15 | Process mining, advanced analytics |
|
|
109
|
-
| servicenow-knowledge-catalog | 15 | Knowledge management, service catalog |
|
|
110
|
-
| servicenow-change-virtualagent-pa | 19 | Change management, virtual agent, PA |
|
|
111
|
-
| servicenow-flow-workspace-mobile | 20 | Flow Designer, agent workspace, mobile |
|
|
112
|
-
| servicenow-cmdb-event-hr-csm-devops | 23 | CMDB, events, HR, CSM, DevOps |
|
|
113
|
-
| servicenow-performance-optimization | 8 | Query optimization, batch operations |
|
|
114
|
-
| servicenow-process-intelligence | 10 | Process mining and discovery |
|
|
115
|
-
| snow-flow | 12 | Orchestration, memory management |
|
|
116
|
-
|
|
117
|
-
### Detailed Tool Listing by Server
|
|
118
|
-
|
|
119
|
-
#### 1. ATF Testing Tools (servicenow-automation)
|
|
120
|
-
| Tool | Description | ServiceNow Table |
|
|
121
|
-
|------|-------------|------------------|
|
|
122
|
-
| snow_create_atf_test | Create automated test | sys_atf_test |
|
|
123
|
-
| snow_create_atf_test_step | Add test steps | sys_atf_step |
|
|
124
|
-
| snow_execute_atf_test | Execute tests | sys_atf_test_result |
|
|
125
|
-
| snow_get_atf_results | Get test results | sys_atf_test_result |
|
|
126
|
-
| snow_create_atf_test_suite | Create test suite | sys_atf_test_suite |
|
|
127
|
-
| snow_discover_atf_tests | Find existing tests | sys_atf_test, sys_atf_test_suite |
|
|
128
|
-
|
|
129
|
-
#### 2. Knowledge Management (servicenow-knowledge-catalog)
|
|
130
|
-
| Tool | Description | ServiceNow Table |
|
|
131
|
-
|------|-------------|------------------|
|
|
132
|
-
| snow_create_knowledge_article | Create KB article | kb_knowledge |
|
|
133
|
-
| snow_search_knowledge | Search articles | kb_knowledge |
|
|
134
|
-
| snow_update_knowledge_article | Update article | kb_knowledge |
|
|
135
|
-
| snow_retire_knowledge_article | Retire article | kb_knowledge |
|
|
136
|
-
| snow_create_knowledge_base | Create KB | kb_knowledge_base |
|
|
137
|
-
| snow_discover_knowledge_bases | List KBs | kb_knowledge_base |
|
|
138
|
-
| snow_get_knowledge_stats | Article statistics | kb_knowledge |
|
|
139
|
-
| snow_knowledge_feedback | Manage feedback | kb_feedback |
|
|
140
|
-
|
|
141
|
-
#### 3. Service Catalog (servicenow-knowledge-catalog)
|
|
142
|
-
| Tool | Description | ServiceNow Table |
|
|
143
|
-
|------|-------------|------------------|
|
|
144
|
-
| snow_create_catalog_item | Create catalog item | sc_cat_item |
|
|
145
|
-
| snow_create_catalog_variable | Create variables | item_option_new |
|
|
146
|
-
| snow_create_catalog_ui_policy | Create UI policies | catalog_ui_policy |
|
|
147
|
-
| snow_order_catalog_item | Submit order | sc_req_item |
|
|
148
|
-
| snow_search_catalog | Search catalog | sc_cat_item |
|
|
149
|
-
| snow_get_catalog_item_details | Get item details | sc_cat_item |
|
|
150
|
-
| snow_discover_catalogs | List catalogs | sc_catalog |
|
|
151
|
-
|
|
152
|
-
#### 4. Change Management (servicenow-change-virtualagent-pa)
|
|
153
|
-
| Tool | Description | ServiceNow Table |
|
|
154
|
-
|------|-------------|------------------|
|
|
155
|
-
| snow_create_change_request | Create change | change_request |
|
|
156
|
-
| snow_create_change_task | Create task | change_task |
|
|
157
|
-
| snow_get_change_request | Get change details | change_request |
|
|
158
|
-
| snow_update_change_state | Update state | change_request |
|
|
159
|
-
| snow_schedule_cab_meeting | Schedule CAB | cab_meeting |
|
|
160
|
-
| snow_search_change_requests | Search changes | change_request |
|
|
161
|
-
|
|
162
|
-
#### 5. Virtual Agent (servicenow-change-virtualagent-pa)
|
|
163
|
-
| Tool | Description | ServiceNow Table |
|
|
164
|
-
|------|-------------|------------------|
|
|
165
|
-
| snow_create_va_topic | Create topic | sys_cs_topic |
|
|
166
|
-
| snow_create_va_topic_block | Create blocks | sys_cs_topic_block |
|
|
167
|
-
| snow_get_va_conversation | Get conversation | sys_cs_conversation |
|
|
168
|
-
| snow_send_va_message | Send message | sys_cs_conversation |
|
|
169
|
-
| snow_handoff_to_agent | Escalate to agent | sys_cs_conversation |
|
|
170
|
-
| snow_discover_va_topics | List topics | sys_cs_topic |
|
|
171
|
-
|
|
172
|
-
#### 6. Performance Analytics (servicenow-change-virtualagent-pa)
|
|
173
|
-
| Tool | Description | ServiceNow Table |
|
|
174
|
-
|------|-------------|------------------|
|
|
175
|
-
| snow_create_pa_indicator | Create KPI | pa_indicators |
|
|
176
|
-
| snow_create_pa_widget | Create widget | pa_widgets |
|
|
177
|
-
| snow_create_pa_breakdown | Create breakdown | pa_breakdowns |
|
|
178
|
-
| snow_create_pa_threshold | Set threshold | pa_thresholds |
|
|
179
|
-
| snow_get_pa_scores | Get scores | pa_scores |
|
|
180
|
-
| snow_create_pa_target | Set target | pa_targets |
|
|
181
|
-
| snow_analyze_pa_trends | Analyze trends | pa_scores |
|
|
182
|
-
|
|
183
|
-
#### 7. Flow Designer (servicenow-flow-workspace-mobile)
|
|
184
|
-
| Tool | Description | ServiceNow Table |
|
|
185
|
-
|------|-------------|------------------|
|
|
186
|
-
| snow_create_flow | Create flow | sys_hub_flow |
|
|
187
|
-
| snow_create_flow_action | Create action | sys_hub_action_instance |
|
|
188
|
-
| snow_create_subflow | Create subflow | sys_hub_sub_flow |
|
|
189
|
-
| snow_add_flow_trigger | Add trigger | sys_hub_trigger_instance |
|
|
190
|
-
| snow_publish_flow | Publish flow | sys_hub_flow |
|
|
191
|
-
| snow_test_flow | Test flow | sys_flow_context |
|
|
192
|
-
| snow_get_flow_execution_details | Get execution | sys_flow_context |
|
|
193
|
-
|
|
194
|
-
#### 8. Agent Workspace (servicenow-flow-workspace-mobile)
|
|
195
|
-
| Tool | Description | ServiceNow Table |
|
|
196
|
-
|------|-------------|------------------|
|
|
197
|
-
| snow_create_workspace | Create workspace | sys_aw_workspace |
|
|
198
|
-
| snow_configure_workspace_tab | Configure tabs | sys_aw_tab |
|
|
199
|
-
| snow_add_workspace_list | Add lists | sys_aw_list |
|
|
200
|
-
| snow_create_workspace_form | Create forms | sys_aw_form |
|
|
201
|
-
| snow_configure_workspace_ui_action | Add UI actions | sys_aw_ui_action |
|
|
202
|
-
| snow_deploy_workspace | Deploy workspace | sys_aw_workspace |
|
|
203
|
-
|
|
204
|
-
#### 9. Mobile Platform (servicenow-flow-workspace-mobile)
|
|
205
|
-
| Tool | Description | ServiceNow Table |
|
|
206
|
-
|------|-------------|------------------|
|
|
207
|
-
| snow_create_mobile_app_config | Configure app | sys_mobile_config |
|
|
208
|
-
| snow_configure_mobile_layout | Configure layout | sys_mobile_layout |
|
|
209
|
-
| snow_create_mobile_applet | Create applet | sys_mobile_applet |
|
|
210
|
-
| snow_configure_offline_tables | Offline sync | sys_mobile_offline |
|
|
211
|
-
| snow_set_mobile_security | Security settings | sys_mobile_security |
|
|
212
|
-
| snow_push_notification_config | Push notifications | sys_push_notification |
|
|
213
|
-
| snow_deploy_mobile_app | Deploy app | sys_mobile_deployment |
|
|
214
|
-
|
|
215
|
-
#### 10. CMDB & Discovery (servicenow-cmdb-event-hr-csm-devops)
|
|
216
|
-
| Tool | Description | ServiceNow Table |
|
|
217
|
-
|------|-------------|------------------|
|
|
218
|
-
| snow_create_cmdb_ci | Create CI | cmdb_ci_* |
|
|
219
|
-
| snow_create_ci_relationship | Create relationship | cmdb_rel_ci |
|
|
220
|
-
| snow_discover_ci_dependencies | Find dependencies | cmdb_rel_ci |
|
|
221
|
-
| snow_run_discovery | Run discovery | discovery_status |
|
|
222
|
-
| snow_get_discovery_status | Get status | discovery_status |
|
|
223
|
-
| snow_import_cmdb_data | Import data | sys_import_set |
|
|
224
|
-
|
|
225
|
-
#### 11. Event Management (servicenow-cmdb-event-hr-csm-devops)
|
|
226
|
-
| Tool | Description | ServiceNow Table |
|
|
227
|
-
|------|-------------|------------------|
|
|
228
|
-
| snow_create_event | Create event | em_event |
|
|
229
|
-
| snow_create_alert_rule | Create rule | em_alert_rule |
|
|
230
|
-
| snow_correlate_alerts | Correlate alerts | em_alert |
|
|
231
|
-
| snow_get_event_metrics | Get metrics | em_event |
|
|
232
|
-
|
|
233
|
-
#### 12. HR Service Delivery (servicenow-cmdb-event-hr-csm-devops)
|
|
234
|
-
| Tool | Description | ServiceNow Table |
|
|
235
|
-
|------|-------------|------------------|
|
|
236
|
-
| snow_create_hr_case | Create HR case | sn_hr_core_case |
|
|
237
|
-
| snow_manage_onboarding | Onboarding | sn_hr_core_task |
|
|
238
|
-
| snow_manage_offboarding | Offboarding | sn_hr_core_task |
|
|
239
|
-
| snow_get_hr_analytics | HR analytics | sn_hr_core_case |
|
|
240
|
-
|
|
241
|
-
#### 13. Customer Service Management (servicenow-cmdb-event-hr-csm-devops)
|
|
242
|
-
| Tool | Description | ServiceNow Table |
|
|
243
|
-
|------|-------------|------------------|
|
|
244
|
-
| snow_create_csm_case | Create case | sn_customerservice_case |
|
|
245
|
-
| snow_manage_customer_account | Manage account | sn_customerservice_account |
|
|
246
|
-
| snow_create_csm_communication | Communications | sn_customerservice_communication |
|
|
247
|
-
| snow_get_customer_satisfaction | Get CSAT | sn_customerservice_csat |
|
|
248
|
-
|
|
249
|
-
#### 14. DevOps (servicenow-cmdb-event-hr-csm-devops)
|
|
250
|
-
| Tool | Description | ServiceNow Table |
|
|
251
|
-
|------|-------------|------------------|
|
|
252
|
-
| snow_create_devops_pipeline | Create pipeline | sn_devops_pipeline |
|
|
253
|
-
| snow_track_deployment | Track deployment | sn_devops_deployment |
|
|
254
|
-
| snow_manage_devops_change | DevOps change | sn_devops_change |
|
|
255
|
-
| snow_get_velocity_metrics | Team velocity | sn_devops_velocity |
|
|
256
|
-
| snow_create_devops_artifact | Build artifacts | sn_devops_artifact |
|
|
257
|
-
|
|
258
|
-
### Table Operations
|
|
259
|
-
The universal `snow_query_table` tool works with all ServiceNow tables:
|
|
260
|
-
|
|
261
|
-
```javascript
|
|
262
|
-
// Query any table with optimized performance
|
|
263
|
-
snow_query_table({
|
|
264
|
-
table: "incident", // Works with any table
|
|
265
|
-
query: "state!=7",
|
|
266
|
-
fields: ["number", "short_description", "priority"],
|
|
267
|
-
limit: 100
|
|
268
|
-
})
|
|
269
|
-
|
|
270
|
-
// Analytics mode - retrieve all records with minimal fields
|
|
271
|
-
snow_query_table({
|
|
272
|
-
table: "incident",
|
|
273
|
-
fields: ["sys_created_on", "priority"] // Omit limit for all records
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
// Count-only mode for large datasets
|
|
277
|
-
snow_query_table({
|
|
278
|
-
table: "sc_request",
|
|
279
|
-
include_content: false // Returns count only
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
// Server-side aggregation
|
|
283
|
-
snow_query_table({
|
|
284
|
-
table: "change_request",
|
|
285
|
-
group_by: "risk",
|
|
286
|
-
order_by: "-count"
|
|
287
|
-
})
|
|
24
|
+
npm install -g snow-flow
|
|
288
25
|
```
|
|
289
26
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
#### Supported Artifact Types (snow_deploy & snow_update)
|
|
293
|
-
|
|
294
|
-
Snow-Flow supports deployment and updating of 16+ different ServiceNow artifact types:
|
|
295
|
-
|
|
296
|
-
| Artifact Type | ServiceNow Table | Deploy | Update | Description |
|
|
297
|
-
|---------------|------------------|--------|---------|-------------|
|
|
298
|
-
| **widget** | sp_widget | ✅ | ✅ | Service Portal widgets with HTML/CSS/JS |
|
|
299
|
-
| **application** | sys_app | ✅ | ✅ | Scoped applications and app stores |
|
|
300
|
-
| **business_rule** | sys_script | ✅ | ✅ | Server-side business logic automation |
|
|
301
|
-
| **script_include** | sys_script_include | ✅ | ✅ | Reusable server-side code libraries |
|
|
302
|
-
| **ui_page** | sys_ui_page | ✅ | ✅ | Custom UI pages and interfaces |
|
|
303
|
-
| **client_script** | sys_script_client | ✅ | ✅ | Client-side form and field scripts |
|
|
304
|
-
| **ui_action** | sys_ui_action | ✅ | ✅ | Buttons, links, and form actions |
|
|
305
|
-
| **ui_policy** | sys_ui_policy | ✅ | ✅ | Dynamic form behavior and validation |
|
|
306
|
-
| **acl** | sys_security_acl | ✅ | ✅ | Access control and security rules |
|
|
307
|
-
| **table** | sys_db_object | ✅ | ✅ | Custom database tables and structures |
|
|
308
|
-
| **field** | sys_dictionary | ✅ | ✅ | Table fields and column definitions |
|
|
309
|
-
| **workflow** | wf_workflow | ✅ | ✅ | Classic workflow processes |
|
|
310
|
-
| **flow** | sys_hub_flow | ✅ | ✅ | Flow Designer automation flows |
|
|
311
|
-
| **notification** | sysevent_email_action | ✅ | ✅ | Email notifications and alerts |
|
|
312
|
-
| **scheduled_job** | sysauto_script | ✅ | ✅ | Scheduled background scripts |
|
|
27
|
+
## Configuration
|
|
313
28
|
|
|
314
|
-
|
|
29
|
+
Create `.env` file with ServiceNow credentials:
|
|
315
30
|
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
name: 'My Dashboard Widget',
|
|
321
|
-
template: '<div>My HTML</div>',
|
|
322
|
-
css: '.my-class { color: blue; }',
|
|
323
|
-
client_script: 'function() { console.log("Hello"); }'
|
|
324
|
-
});
|
|
325
|
-
|
|
326
|
-
await snow_deploy({
|
|
327
|
-
type: 'business_rule',
|
|
328
|
-
name: 'Auto Assignment Rule',
|
|
329
|
-
table: 'incident',
|
|
330
|
-
when: 'before',
|
|
331
|
-
insert: true,
|
|
332
|
-
script: 'if (current.priority == "1") current.assigned_to = "admin";'
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
// Update EXISTING artifacts
|
|
336
|
-
await snow_update({
|
|
337
|
-
type: 'widget',
|
|
338
|
-
identifier: 'My Dashboard Widget', // name or sys_id
|
|
339
|
-
instruction: 'Add a new chart showing priority distribution'
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
await snow_update({
|
|
343
|
-
type: 'ui_action',
|
|
344
|
-
identifier: 'close_incident',
|
|
345
|
-
config: {
|
|
346
|
-
action_name: 'Close with Resolution',
|
|
347
|
-
condition: 'current.state != 7'
|
|
348
|
-
}
|
|
349
|
-
});
|
|
31
|
+
```env
|
|
32
|
+
SNOW_INSTANCE=your-instance.service-now.com
|
|
33
|
+
SNOW_CLIENT_ID=your-client-id
|
|
34
|
+
SNOW_CLIENT_SECRET=your-client-secret
|
|
350
35
|
```
|
|
351
36
|
|
|
352
|
-
|
|
37
|
+
## MCP Servers
|
|
353
38
|
|
|
354
|
-
|
|
355
|
-
// All artifact types support natural language instructions
|
|
356
|
-
await snow_update({
|
|
357
|
-
type: 'notification',
|
|
358
|
-
identifier: 'incident_created',
|
|
359
|
-
instruction: 'Change subject to "High Priority Incident Created" and add escalation details'
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
await snow_update({
|
|
363
|
-
type: 'scheduled_job',
|
|
364
|
-
identifier: 'daily_cleanup',
|
|
365
|
-
instruction: 'Change schedule to run every 2 hours and add error logging'
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
await snow_update({
|
|
369
|
-
type: 'acl',
|
|
370
|
-
identifier: 'incident_read',
|
|
371
|
-
instruction: 'Add condition script to check user department'
|
|
372
|
-
});
|
|
373
|
-
```
|
|
39
|
+
Snow-Flow includes 12 MCP servers:
|
|
374
40
|
|
|
375
|
-
|
|
376
|
-
-
|
|
377
|
-
-
|
|
378
|
-
-
|
|
379
|
-
-
|
|
380
|
-
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
-
|
|
384
|
-
-
|
|
385
|
-
-
|
|
386
|
-
-
|
|
387
|
-
- CMDB and Discovery
|
|
388
|
-
- Event Management
|
|
389
|
-
- HR Service Delivery
|
|
390
|
-
- Customer Service Management
|
|
391
|
-
- DevOps integration
|
|
392
|
-
|
|
393
|
-
### Machine Learning
|
|
394
|
-
|
|
395
|
-
Snow-Flow includes TensorFlow.js for neural network capabilities:
|
|
396
|
-
|
|
397
|
-
#### Incident Classification
|
|
398
|
-
Train LSTM networks on historical incident data:
|
|
399
|
-
```bash
|
|
400
|
-
snow-flow ml train-incident-classifier --sample-size 5000 --epochs 100
|
|
401
|
-
snow-flow ml classify-incident INC0123456
|
|
402
|
-
```
|
|
41
|
+
1. **servicenow-deployment** - Widget and artifact deployment with coherence validation
|
|
42
|
+
2. **servicenow-operations** - Table operations and queries
|
|
43
|
+
3. **servicenow-automation** - Script execution and job scheduling
|
|
44
|
+
4. **servicenow-platform-development** - Business rules and script includes
|
|
45
|
+
5. **servicenow-integration** - REST messages and data imports
|
|
46
|
+
6. **servicenow-system-properties** - System property management
|
|
47
|
+
7. **servicenow-update-set** - Update set management
|
|
48
|
+
8. **servicenow-development-assistant** - Code generation
|
|
49
|
+
9. **servicenow-security-compliance** - Security policies
|
|
50
|
+
10. **servicenow-reporting-analytics** - Reports and dashboards
|
|
51
|
+
11. **servicenow-machine-learning** - ML model training
|
|
52
|
+
12. **snow-flow** - Orchestration and memory management
|
|
403
53
|
|
|
404
|
-
|
|
405
|
-
Analyze change requests to predict implementation risk:
|
|
406
|
-
```bash
|
|
407
|
-
snow-flow ml train-change-risk --include-failed-changes
|
|
408
|
-
snow-flow ml predict-change-risk CHG0123456
|
|
409
|
-
```
|
|
54
|
+
## Basic Commands
|
|
410
55
|
|
|
411
|
-
|
|
412
|
-
Predict future incident volumes:
|
|
56
|
+
Start orchestration system:
|
|
413
57
|
```bash
|
|
414
|
-
snow-flow
|
|
58
|
+
snow-flow start
|
|
415
59
|
```
|
|
416
60
|
|
|
417
|
-
|
|
418
|
-
Detect unusual patterns using autoencoder networks:
|
|
61
|
+
Create agent:
|
|
419
62
|
```bash
|
|
420
|
-
snow-flow
|
|
63
|
+
snow-flow agent spawn researcher
|
|
421
64
|
```
|
|
422
65
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
Access ServiceNow's native ML capabilities when licensed:
|
|
426
|
-
|
|
427
|
-
#### Performance Analytics ML
|
|
66
|
+
Execute task:
|
|
428
67
|
```bash
|
|
429
|
-
snow-flow
|
|
68
|
+
snow-flow task create analysis "Analyze incident patterns"
|
|
430
69
|
```
|
|
431
70
|
|
|
432
|
-
|
|
71
|
+
Run swarm coordination:
|
|
433
72
|
```bash
|
|
434
|
-
snow-flow
|
|
73
|
+
snow-flow swarm "Create incident dashboard"
|
|
435
74
|
```
|
|
436
75
|
|
|
437
|
-
|
|
76
|
+
Store data in memory:
|
|
438
77
|
```bash
|
|
439
|
-
snow-flow
|
|
78
|
+
snow-flow memory store key "data"
|
|
440
79
|
```
|
|
441
80
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
## Multi-Agent System
|
|
445
|
-
|
|
446
|
-
Snow-Flow includes 38 specialized agents that work together:
|
|
447
|
-
|
|
448
|
-
### Agent Types
|
|
449
|
-
- **Architect**: System design and architecture planning
|
|
450
|
-
- **Developer**: Code generation and implementation
|
|
451
|
-
- **Tester**: Test creation and execution
|
|
452
|
-
- **Analyst**: Data analysis and reporting
|
|
453
|
-
- **Security**: Compliance and security validation
|
|
454
|
-
- **Optimizer**: Performance optimization
|
|
455
|
-
- **Documenter**: Documentation generation
|
|
81
|
+
## Script Execution
|
|
456
82
|
|
|
457
|
-
|
|
458
|
-
- **Hierarchical**: Top-down task delegation
|
|
459
|
-
- **Mesh**: Peer-to-peer collaboration
|
|
460
|
-
- **Swarm**: Distributed problem solving
|
|
461
|
-
- **Adaptive**: Dynamic reorganization based on task requirements
|
|
83
|
+
Snow-Flow executes ServiceNow background scripts using ES5 JavaScript only:
|
|
462
84
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
### Install via npm
|
|
472
|
-
```bash
|
|
473
|
-
npm install -g snow-flow
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
### Initial Setup
|
|
477
|
-
```bash
|
|
478
|
-
# Initialize configuration
|
|
479
|
-
snow-flow init
|
|
480
|
-
|
|
481
|
-
# Configure authentication
|
|
482
|
-
snow-flow auth login
|
|
85
|
+
```javascript
|
|
86
|
+
// Supported ES5 syntax
|
|
87
|
+
var gr = new GlideRecord('incident');
|
|
88
|
+
gr.query();
|
|
89
|
+
while (gr.next()) {
|
|
90
|
+
gs.info(gr.getValue('number'));
|
|
91
|
+
}
|
|
483
92
|
|
|
484
|
-
|
|
485
|
-
|
|
93
|
+
// NOT supported (ES6+ will fail)
|
|
94
|
+
const data = await fetch(); // Will fail
|
|
95
|
+
let items = []; // Will fail
|
|
96
|
+
() => {} // Will fail
|
|
486
97
|
```
|
|
487
98
|
|
|
488
|
-
|
|
99
|
+
## Widget Development
|
|
489
100
|
|
|
490
|
-
|
|
101
|
+
Widgets require coherent communication between three components:
|
|
102
|
+
- Server script provides data
|
|
103
|
+
- Client script handles interactions
|
|
104
|
+
- HTML template displays content
|
|
491
105
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
106
|
+
Server and client scripts must align on:
|
|
107
|
+
- Data property names
|
|
108
|
+
- Action names for requests
|
|
109
|
+
- Method names for UI events
|
|
495
110
|
|
|
496
|
-
|
|
497
|
-
# Open Claude Code and ensure it's activated with your account
|
|
111
|
+
## Authentication
|
|
498
112
|
|
|
499
|
-
|
|
500
|
-
|
|
113
|
+
Snow-Flow uses OAuth 2.0 for ServiceNow authentication:
|
|
114
|
+
1. Configure OAuth provider in ServiceNow
|
|
115
|
+
2. Set client credentials in .env
|
|
116
|
+
3. Snow-Flow handles token refresh automatically
|
|
501
117
|
|
|
502
|
-
|
|
503
|
-
# Make sure Claude Code is fully closed before proceeding
|
|
118
|
+
## Directory Structure
|
|
504
119
|
|
|
505
|
-
# 5. Now run Snow-Flow swarm
|
|
506
|
-
snow-flow swarm "Your ServiceNow task here"
|
|
507
120
|
```
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
#
|
|
516
|
-
snow-flow swarm "Create incident management dashboard"
|
|
517
|
-
|
|
518
|
-
# No flags needed for basic usage
|
|
519
|
-
snow-flow swarm "Build service catalog for laptop requests"
|
|
520
|
-
|
|
521
|
-
# Advanced usage with optional flags
|
|
522
|
-
snow-flow swarm "Optimize incident resolution process" --monitor --parallel
|
|
121
|
+
snow-flow/
|
|
122
|
+
├── src/
|
|
123
|
+
│ ├── mcp/ # MCP server implementations
|
|
124
|
+
│ ├── client/ # ServiceNow API client
|
|
125
|
+
│ ├── utils/ # Utility functions
|
|
126
|
+
│ └── types/ # TypeScript definitions
|
|
127
|
+
├── dist/ # Compiled JavaScript
|
|
128
|
+
└── .mcp.json # MCP configuration template
|
|
523
129
|
```
|
|
524
130
|
|
|
525
|
-
|
|
526
|
-
```bash
|
|
527
|
-
# Create an incident dashboard
|
|
528
|
-
snow-flow sparc "Create incident management dashboard with SLA tracking"
|
|
131
|
+
## Error Handling
|
|
529
132
|
|
|
530
|
-
|
|
531
|
-
|
|
133
|
+
Snow-Flow operations include:
|
|
134
|
+
- Automatic retry on network failures
|
|
135
|
+
- Token refresh on authentication errors
|
|
136
|
+
- Timeout protection (5 seconds default)
|
|
137
|
+
- Error logging with context
|
|
532
138
|
|
|
533
|
-
|
|
534
|
-
snow-flow sparc "Analyze incident resolution patterns from last quarter"
|
|
535
|
-
```
|
|
139
|
+
## Testing
|
|
536
140
|
|
|
537
|
-
|
|
141
|
+
Run tests:
|
|
538
142
|
```bash
|
|
539
|
-
|
|
540
|
-
snow-flow query --table incident --limit 10
|
|
541
|
-
|
|
542
|
-
# Create a widget
|
|
543
|
-
snow-flow deploy widget --name "SLA Dashboard" --template dashboard
|
|
544
|
-
|
|
545
|
-
# Generate documentation
|
|
546
|
-
snow-flow generate docs --scope "incident_management"
|
|
143
|
+
npm test
|
|
547
144
|
```
|
|
548
145
|
|
|
549
|
-
|
|
146
|
+
Type checking:
|
|
550
147
|
```bash
|
|
551
|
-
|
|
552
|
-
snow-flow swarm "Build complete HR service portal" \
|
|
553
|
-
--strategy development \
|
|
554
|
-
--mode hierarchical \
|
|
555
|
-
--max-agents 8
|
|
556
|
-
|
|
557
|
-
# Parallel analysis
|
|
558
|
-
snow-flow swarm "Analyze system performance bottlenecks" \
|
|
559
|
-
--strategy analysis \
|
|
560
|
-
--mode mesh \
|
|
561
|
-
--parallel
|
|
562
|
-
|
|
563
|
-
# With monitoring
|
|
564
|
-
snow-flow swarm "Deploy production changes" \
|
|
565
|
-
--monitor \
|
|
566
|
-
--auto-rollback
|
|
148
|
+
npm run typecheck
|
|
567
149
|
```
|
|
568
150
|
|
|
569
|
-
##
|
|
570
|
-
|
|
571
|
-
Configuration file location: `~/.snow-flow/.env`
|
|
572
|
-
|
|
573
|
-
### Required Settings
|
|
574
|
-
```env
|
|
575
|
-
SNOW_INSTANCE=your-instance.service-now.com
|
|
576
|
-
SNOW_CLIENT_ID=your-oauth-client-id
|
|
577
|
-
SNOW_CLIENT_SECRET=your-oauth-client-secret
|
|
578
|
-
```
|
|
579
|
-
|
|
580
|
-
### Optional Settings
|
|
581
|
-
```env
|
|
582
|
-
# Timeout configuration (milliseconds)
|
|
583
|
-
# SNOW_FLOW_INIT_TIMEOUT=30000
|
|
584
|
-
# SNOW_FLOW_OPERATION_TIMEOUT=60000
|
|
585
|
-
# SNOW_FLOW_MEMORY_TIMEOUT=5000
|
|
586
|
-
|
|
587
|
-
# Agent configuration
|
|
588
|
-
SNOW_FLOW_MAX_AGENTS=10
|
|
589
|
-
SNOW_FLOW_AGENT_MODE=hierarchical
|
|
590
|
-
|
|
591
|
-
# ML configuration
|
|
592
|
-
SNOW_FLOW_ML_ENABLED=true
|
|
593
|
-
SNOW_FLOW_ML_MODEL_PATH=./models
|
|
594
|
-
```
|
|
151
|
+
## Build
|
|
595
152
|
|
|
596
|
-
|
|
597
|
-
```
|
|
598
|
-
|
|
599
|
-
├── src/ # Source code
|
|
600
|
-
│ ├── agents/ # Agent implementations
|
|
601
|
-
│ ├── mcp/ # MCP server implementations
|
|
602
|
-
│ ├── utils/ # Utility functions
|
|
603
|
-
│ └── services/ # Service layer
|
|
604
|
-
├── dist/ # Compiled JavaScript
|
|
605
|
-
├── memory/ # Persistent storage
|
|
606
|
-
├── models/ # ML models
|
|
607
|
-
└── tests/ # Test suite
|
|
153
|
+
Build from source:
|
|
154
|
+
```bash
|
|
155
|
+
npm run build
|
|
608
156
|
```
|
|
609
157
|
|
|
610
|
-
##
|
|
611
|
-
|
|
612
|
-
- [API Reference](docs/api.md)
|
|
613
|
-
- [Agent Documentation](docs/agents.md)
|
|
614
|
-
- [MCP Tools Reference](docs/tools.md)
|
|
615
|
-
- [ML Capabilities](docs/ml.md)
|
|
616
|
-
- [Configuration Guide](docs/configuration.md)
|
|
158
|
+
## Version
|
|
617
159
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
Contributions are welcome. Please read the [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
621
|
-
|
|
622
|
-
## Support
|
|
623
|
-
|
|
624
|
-
- GitHub Issues: [github.com/groeimetai/snow-flow/issues](https://github.com/groeimetai/snow-flow/issues)
|
|
625
|
-
- Documentation: [github.com/groeimetai/snow-flow/wiki](https://github.com/groeimetai/snow-flow/wiki)
|
|
160
|
+
Current version: 3.4.4
|
|
626
161
|
|
|
627
162
|
## License
|
|
628
163
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
## Acknowledgments
|
|
632
|
-
|
|
633
|
-
- ServiceNow for the comprehensive REST API
|
|
634
|
-
- TensorFlow.js for machine learning capabilities
|
|
635
|
-
- Model Context Protocol (MCP) for tool orchestration
|
|
164
|
+
MIT
|
package/dist/dynamic-version.js
CHANGED
|
@@ -36,7 +36,7 @@ function getDynamicVersion() {
|
|
|
36
36
|
console.warn('Warning: Could not read version from package.json:', error);
|
|
37
37
|
}
|
|
38
38
|
// Fallback to hardcoded version
|
|
39
|
-
return '3.4.
|
|
39
|
+
return '3.4.4';
|
|
40
40
|
}
|
|
41
41
|
// Export a constant that uses the dynamic version
|
|
42
42
|
exports.VERSION = getDynamicVersion();
|
|
@@ -4,6 +4,39 @@
|
|
|
4
4
|
* ServiceNow Deployment MCP Server
|
|
5
5
|
* Provides specialized deployment tools for ServiceNow artifacts
|
|
6
6
|
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
7
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
41
|
const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
|
|
9
42
|
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
@@ -550,6 +583,36 @@ class ServiceNowDeploymentMCP {
|
|
|
550
583
|
this.logger.warn('⚠️ Token may lack write permissions, deployment might fail with 403');
|
|
551
584
|
}
|
|
552
585
|
this.logger.info('Deploying widget to ServiceNow', { name: args.name, sys_id: args.sys_id });
|
|
586
|
+
// COHERENCE VALIDATION: Check widget component consistency
|
|
587
|
+
if (args.template && args.client_script && args.server_script) {
|
|
588
|
+
try {
|
|
589
|
+
const { widgetTemplateGenerator } = await Promise.resolve().then(() => __importStar(require('../utils/widget-template-generator')));
|
|
590
|
+
const coherenceReport = widgetTemplateGenerator['validateCoherence']({
|
|
591
|
+
template: args.template,
|
|
592
|
+
css: args.css || '',
|
|
593
|
+
serverScript: args.server_script,
|
|
594
|
+
clientScript: args.client_script,
|
|
595
|
+
optionSchema: args.option_schema || ''
|
|
596
|
+
});
|
|
597
|
+
if (!coherenceReport.isCoherent) {
|
|
598
|
+
this.logger.warn('⚠️ Widget coherence issues detected:', {
|
|
599
|
+
warnings: coherenceReport.warnings,
|
|
600
|
+
suggestions: coherenceReport.suggestions
|
|
601
|
+
});
|
|
602
|
+
// Include coherence warnings in response (but don't fail deployment)
|
|
603
|
+
const warningMessage = `⚠️ **Widget Coherence Warnings:**\n\n${coherenceReport.warnings.map(w => `• ${w}`).join('\n')}\n\n**Suggestions:**\n${coherenceReport.suggestions.map(s => `• ${s}`).join('\n')}\n\n*Widget will still deploy but may not function correctly.*`;
|
|
604
|
+
// Store coherence warnings for later inclusion in response
|
|
605
|
+
args._coherenceWarnings = warningMessage;
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
this.logger.info('✅ Widget coherence validation passed');
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
catch (coherenceError) {
|
|
612
|
+
this.logger.warn('Coherence validation failed:', coherenceError);
|
|
613
|
+
// Continue with deployment even if coherence check fails
|
|
614
|
+
}
|
|
615
|
+
}
|
|
553
616
|
// CHECK: If sys_id is provided, this is an UPDATE not a CREATE
|
|
554
617
|
if (args.sys_id) {
|
|
555
618
|
this.logger.info('🔄 UPDATE mode detected - updating existing widget', { sys_id: args.sys_id });
|
|
@@ -587,6 +650,8 @@ class ServiceNowDeploymentMCP {
|
|
|
587
650
|
- Deployment Context: ${args.config?.deployment_context || args.deployment_context || 'Widget update'}
|
|
588
651
|
- Method: Direct update via API
|
|
589
652
|
|
|
653
|
+
${args._coherenceWarnings || ''}
|
|
654
|
+
|
|
590
655
|
🔗 Direct Links:
|
|
591
656
|
- Widget Editor: ${widgetUrl}
|
|
592
657
|
- Service Portal Designer: https://${credentials?.instance}/sp_config?id=designer
|
|
@@ -1156,6 +1221,8 @@ Use \`snow_deployment_debug\` for more information about this session.`,
|
|
|
1156
1221
|
- Widget Editor: ${widgetUrl}
|
|
1157
1222
|
- Service Portal Designer: https://${credentials?.instance}/sp_config?id=designer
|
|
1158
1223
|
|
|
1224
|
+
${args._coherenceWarnings || ''}
|
|
1225
|
+
|
|
1159
1226
|
🛠️ Deployment Info:
|
|
1160
1227
|
- Method Used: ${deploymentMethod === 'direct_api' ? 'Direct API (preferred)' :
|
|
1161
1228
|
deploymentMethod === 'table_record' ? 'Table Record (fallback)' : 'Unknown'}
|
|
@@ -1245,6 +1312,8 @@ Use \`snow_deployment_debug\` for more information about this session.`,
|
|
|
1245
1312
|
- Widget Editor: ${widgetUrl}
|
|
1246
1313
|
- Service Portal Designer: https://${credentials?.instance}/sp_config?id=designer
|
|
1247
1314
|
|
|
1315
|
+
${args._coherenceWarnings || ''}
|
|
1316
|
+
|
|
1248
1317
|
🔧 **Note**: Widget was successfully created despite receiving permission errors during verification. This is a known ServiceNow API limitation.
|
|
1249
1318
|
|
|
1250
1319
|
⚡ **Ready for Testing**
|
|
@@ -15,6 +15,30 @@ export interface WidgetComponents {
|
|
|
15
15
|
serverScript: string;
|
|
16
16
|
clientScript: string;
|
|
17
17
|
optionSchema: string;
|
|
18
|
+
coherenceReport: WidgetCoherenceReport;
|
|
19
|
+
}
|
|
20
|
+
export interface WidgetCoherenceReport {
|
|
21
|
+
isCoherent: boolean;
|
|
22
|
+
dataProperties: {
|
|
23
|
+
server: string[];
|
|
24
|
+
html: string[];
|
|
25
|
+
matched: string[];
|
|
26
|
+
missing: string[];
|
|
27
|
+
};
|
|
28
|
+
methods: {
|
|
29
|
+
html: string[];
|
|
30
|
+
client: string[];
|
|
31
|
+
matched: string[];
|
|
32
|
+
missing: string[];
|
|
33
|
+
};
|
|
34
|
+
serverActions: {
|
|
35
|
+
client: string[];
|
|
36
|
+
server: string[];
|
|
37
|
+
matched: string[];
|
|
38
|
+
missing: string[];
|
|
39
|
+
};
|
|
40
|
+
warnings: string[];
|
|
41
|
+
suggestions: string[];
|
|
18
42
|
}
|
|
19
43
|
export declare class ServiceNowWidgetTemplateGenerator {
|
|
20
44
|
/**
|
|
@@ -77,6 +101,10 @@ export declare class ServiceNowWidgetTemplateGenerator {
|
|
|
77
101
|
* Generate option schema based on widget type
|
|
78
102
|
*/
|
|
79
103
|
private generateOptionSchema;
|
|
104
|
+
/**
|
|
105
|
+
* Validate widget coherence - ensures HTML, client script, and server script work together
|
|
106
|
+
*/
|
|
107
|
+
private validateCoherence;
|
|
80
108
|
}
|
|
81
109
|
export declare const widgetTemplateGenerator: ServiceNowWidgetTemplateGenerator;
|
|
82
110
|
//# sourceMappingURL=widget-template-generator.d.ts.map
|
|
@@ -13,13 +13,17 @@ class ServiceNowWidgetTemplateGenerator {
|
|
|
13
13
|
const { instruction = '', title = 'Widget', type = 'auto' } = options;
|
|
14
14
|
const detectedType = type === 'auto' ? this.detectWidgetType(instruction) : type;
|
|
15
15
|
const widgetTitle = title || this.extractTitleFromInstruction(instruction);
|
|
16
|
-
|
|
16
|
+
const components = {
|
|
17
17
|
template: this.generateTemplate(detectedType, widgetTitle, instruction),
|
|
18
18
|
css: this.generateCss(detectedType, options),
|
|
19
19
|
serverScript: this.generateServerScript(detectedType, instruction),
|
|
20
20
|
clientScript: this.generateClientScript(detectedType, instruction),
|
|
21
|
-
optionSchema: this.generateOptionSchema(detectedType)
|
|
21
|
+
optionSchema: this.generateOptionSchema(detectedType),
|
|
22
|
+
coherenceReport: {}
|
|
22
23
|
};
|
|
24
|
+
// Generate coherence report
|
|
25
|
+
components.coherenceReport = this.validateCoherence(components);
|
|
26
|
+
return components;
|
|
23
27
|
}
|
|
24
28
|
/**
|
|
25
29
|
* Detect widget type from instruction
|
|
@@ -1684,6 +1688,71 @@ function($scope, $http, spUtil, $timeout) {
|
|
|
1684
1688
|
const allOptions = [...baseOptions, ...typeSpecificOptions];
|
|
1685
1689
|
return JSON.stringify(allOptions, null, 2);
|
|
1686
1690
|
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Validate widget coherence - ensures HTML, client script, and server script work together
|
|
1693
|
+
*/
|
|
1694
|
+
validateCoherence(components) {
|
|
1695
|
+
const report = {
|
|
1696
|
+
isCoherent: true,
|
|
1697
|
+
dataProperties: { server: [], html: [], matched: [], missing: [] },
|
|
1698
|
+
methods: { html: [], client: [], matched: [], missing: [] },
|
|
1699
|
+
serverActions: { client: [], server: [], matched: [], missing: [] },
|
|
1700
|
+
warnings: [],
|
|
1701
|
+
suggestions: []
|
|
1702
|
+
};
|
|
1703
|
+
// Extract data properties from server script
|
|
1704
|
+
const serverDataMatches = components.serverScript.match(/data\.(\w+)\s*=/g) || [];
|
|
1705
|
+
report.dataProperties.server = serverDataMatches.map(match => match.replace(/data\.(\w+)\s*=/, '$1'));
|
|
1706
|
+
// Extract data properties from HTML template
|
|
1707
|
+
const htmlDataMatches = components.template.match(/\{\{data\.(\w+)[\}|\.]/g) || [];
|
|
1708
|
+
report.dataProperties.html = [...new Set(htmlDataMatches.map(match => match.replace(/\{\{data\.(\w+)[\}|\.].*/, '$1')))];
|
|
1709
|
+
// Find matched and missing data properties
|
|
1710
|
+
report.dataProperties.matched = report.dataProperties.server.filter(prop => report.dataProperties.html.includes(prop));
|
|
1711
|
+
report.dataProperties.missing = report.dataProperties.server.filter(prop => !report.dataProperties.html.includes(prop));
|
|
1712
|
+
// Extract methods from HTML (ng-click)
|
|
1713
|
+
const htmlMethodMatches = components.template.match(/ng-click="(\w+)\(/g) || [];
|
|
1714
|
+
report.methods.html = [...new Set(htmlMethodMatches.map(match => match.replace(/ng-click="(\w+)\(/, '$1')))];
|
|
1715
|
+
// Extract methods from client script ($scope.method)
|
|
1716
|
+
const clientMethodMatches = components.clientScript.match(/\$scope\.(\w+)\s*=/g) || [];
|
|
1717
|
+
report.methods.client = [...new Set(clientMethodMatches.map(match => match.replace(/\$scope\.(\w+)\s*=/, '$1')))];
|
|
1718
|
+
// Find matched and missing methods
|
|
1719
|
+
report.methods.matched = report.methods.html.filter(method => report.methods.client.includes(method));
|
|
1720
|
+
report.methods.missing = report.methods.html.filter(method => !report.methods.client.includes(method));
|
|
1721
|
+
// Extract client server actions
|
|
1722
|
+
const clientActionMatches = components.clientScript.match(/action:\s*['"](\w+)['"]/g) || [];
|
|
1723
|
+
report.serverActions.client = [...new Set(clientActionMatches.map(match => match.replace(/action:\s*['"](\w+)['"]/, '$1')))];
|
|
1724
|
+
// Extract server action handlers
|
|
1725
|
+
const serverActionMatches = components.serverScript.match(/input\.action\s*===?\s*['"](\w+)['"]/g) || [];
|
|
1726
|
+
report.serverActions.server = [...new Set(serverActionMatches.map(match => match.replace(/input\.action\s*===?\s*['"](\w+)['"]/, '$1')))];
|
|
1727
|
+
// Find matched and missing server actions
|
|
1728
|
+
report.serverActions.matched = report.serverActions.client.filter(action => report.serverActions.server.includes(action));
|
|
1729
|
+
report.serverActions.missing = report.serverActions.client.filter(action => !report.serverActions.server.includes(action));
|
|
1730
|
+
// Generate warnings and suggestions
|
|
1731
|
+
if (report.dataProperties.missing.length > 0) {
|
|
1732
|
+
report.warnings.push(`Server data properties not used in HTML: ${report.dataProperties.missing.join(', ')}`);
|
|
1733
|
+
report.suggestions.push(`Add {{data.${report.dataProperties.missing[0]}}} to HTML template`);
|
|
1734
|
+
}
|
|
1735
|
+
if (report.methods.missing.length > 0) {
|
|
1736
|
+
report.warnings.push(`HTML methods not implemented in client: ${report.methods.missing.join(', ')}`);
|
|
1737
|
+
report.suggestions.push(`Add $scope.${report.methods.missing[0]} = function() {} to client script`);
|
|
1738
|
+
}
|
|
1739
|
+
if (report.serverActions.missing.length > 0) {
|
|
1740
|
+
report.warnings.push(`Client actions not handled by server: ${report.serverActions.missing.join(', ')}`);
|
|
1741
|
+
report.suggestions.push(`Add if (input.action === '${report.serverActions.missing[0]}') {} to server script`);
|
|
1742
|
+
}
|
|
1743
|
+
// Additional coherence checks
|
|
1744
|
+
if (report.dataProperties.server.length === 0) {
|
|
1745
|
+
report.warnings.push('Server script does not set any data properties');
|
|
1746
|
+
report.suggestions.push('Add data.items = [] or similar in server script');
|
|
1747
|
+
}
|
|
1748
|
+
if (components.template.includes('ng-repeat') && !components.template.includes('{{')) {
|
|
1749
|
+
report.warnings.push('HTML has ng-repeat but no data bindings');
|
|
1750
|
+
report.suggestions.push('Add {{item.property}} bindings inside ng-repeat');
|
|
1751
|
+
}
|
|
1752
|
+
// Determine overall coherence
|
|
1753
|
+
report.isCoherent = report.warnings.length === 0;
|
|
1754
|
+
return report;
|
|
1755
|
+
}
|
|
1687
1756
|
}
|
|
1688
1757
|
exports.ServiceNowWidgetTemplateGenerator = ServiceNowWidgetTemplateGenerator;
|
|
1689
1758
|
// Export singleton instance
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "3.4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.4.5",
|
|
4
|
+
"description": "ServiceNow development framework with MCP server integration. Executes background scripts using ES5 JavaScript only (ServiceNow Rhino engine requirement). Provides 12 MCP servers for ServiceNow operations including widget deployment with coherence validation, table operations, script execution, and system property management.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"bin": {
|