nowaikit 2.5.3 → 3.0.0

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 (151) hide show
  1. package/dist/cli/index.js +89 -1
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/direct/executor.d.ts +28 -0
  4. package/dist/direct/executor.d.ts.map +1 -0
  5. package/dist/direct/executor.js +228 -0
  6. package/dist/direct/executor.js.map +1 -0
  7. package/dist/direct/llm-client.d.ts +32 -0
  8. package/dist/direct/llm-client.d.ts.map +1 -0
  9. package/dist/direct/llm-client.js +122 -0
  10. package/dist/direct/llm-client.js.map +1 -0
  11. package/dist/prompts/capabilities/build-app.d.ts +4 -0
  12. package/dist/prompts/capabilities/build-app.d.ts.map +1 -0
  13. package/dist/prompts/capabilities/build-app.js +238 -0
  14. package/dist/prompts/capabilities/build-app.js.map +1 -0
  15. package/dist/prompts/capabilities/build-business-rule.d.ts +4 -0
  16. package/dist/prompts/capabilities/build-business-rule.d.ts.map +1 -0
  17. package/dist/prompts/capabilities/build-business-rule.js +93 -0
  18. package/dist/prompts/capabilities/build-business-rule.js.map +1 -0
  19. package/dist/prompts/capabilities/build-catalog.d.ts +4 -0
  20. package/dist/prompts/capabilities/build-catalog.d.ts.map +1 -0
  21. package/dist/prompts/capabilities/build-catalog.js +350 -0
  22. package/dist/prompts/capabilities/build-catalog.js.map +1 -0
  23. package/dist/prompts/capabilities/build-client-script.d.ts +4 -0
  24. package/dist/prompts/capabilities/build-client-script.d.ts.map +1 -0
  25. package/dist/prompts/capabilities/build-client-script.js +157 -0
  26. package/dist/prompts/capabilities/build-client-script.js.map +1 -0
  27. package/dist/prompts/capabilities/build-flow.d.ts +4 -0
  28. package/dist/prompts/capabilities/build-flow.d.ts.map +1 -0
  29. package/dist/prompts/capabilities/build-flow.js +243 -0
  30. package/dist/prompts/capabilities/build-flow.js.map +1 -0
  31. package/dist/prompts/capabilities/build-portal.d.ts +4 -0
  32. package/dist/prompts/capabilities/build-portal.d.ts.map +1 -0
  33. package/dist/prompts/capabilities/build-portal.js +250 -0
  34. package/dist/prompts/capabilities/build-portal.js.map +1 -0
  35. package/dist/prompts/capabilities/build-rest-api.d.ts +4 -0
  36. package/dist/prompts/capabilities/build-rest-api.d.ts.map +1 -0
  37. package/dist/prompts/capabilities/build-rest-api.js +293 -0
  38. package/dist/prompts/capabilities/build-rest-api.js.map +1 -0
  39. package/dist/prompts/capabilities/build-test-plan.d.ts +4 -0
  40. package/dist/prompts/capabilities/build-test-plan.d.ts.map +1 -0
  41. package/dist/prompts/capabilities/build-test-plan.js +162 -0
  42. package/dist/prompts/capabilities/build-test-plan.js.map +1 -0
  43. package/dist/prompts/capabilities/build-uib.d.ts +4 -0
  44. package/dist/prompts/capabilities/build-uib.d.ts.map +1 -0
  45. package/dist/prompts/capabilities/build-uib.js +309 -0
  46. package/dist/prompts/capabilities/build-uib.js.map +1 -0
  47. package/dist/prompts/capabilities/docs-app.d.ts +4 -0
  48. package/dist/prompts/capabilities/docs-app.d.ts.map +1 -0
  49. package/dist/prompts/capabilities/docs-app.js +234 -0
  50. package/dist/prompts/capabilities/docs-app.js.map +1 -0
  51. package/dist/prompts/capabilities/docs-release.d.ts +4 -0
  52. package/dist/prompts/capabilities/docs-release.d.ts.map +1 -0
  53. package/dist/prompts/capabilities/docs-release.js +197 -0
  54. package/dist/prompts/capabilities/docs-release.js.map +1 -0
  55. package/dist/prompts/capabilities/docs-runbook.d.ts +4 -0
  56. package/dist/prompts/capabilities/docs-runbook.d.ts.map +1 -0
  57. package/dist/prompts/capabilities/docs-runbook.js +223 -0
  58. package/dist/prompts/capabilities/docs-runbook.js.map +1 -0
  59. package/dist/prompts/capabilities/docs-script.d.ts +4 -0
  60. package/dist/prompts/capabilities/docs-script.d.ts.map +1 -0
  61. package/dist/prompts/capabilities/docs-script.js +242 -0
  62. package/dist/prompts/capabilities/docs-script.js.map +1 -0
  63. package/dist/prompts/capabilities/ops-deploy.d.ts +4 -0
  64. package/dist/prompts/capabilities/ops-deploy.d.ts.map +1 -0
  65. package/dist/prompts/capabilities/ops-deploy.js +193 -0
  66. package/dist/prompts/capabilities/ops-deploy.js.map +1 -0
  67. package/dist/prompts/capabilities/ops-risk.d.ts +4 -0
  68. package/dist/prompts/capabilities/ops-risk.d.ts.map +1 -0
  69. package/dist/prompts/capabilities/ops-risk.js +227 -0
  70. package/dist/prompts/capabilities/ops-risk.js.map +1 -0
  71. package/dist/prompts/capabilities/ops-triage.d.ts +4 -0
  72. package/dist/prompts/capabilities/ops-triage.d.ts.map +1 -0
  73. package/dist/prompts/capabilities/ops-triage.js +183 -0
  74. package/dist/prompts/capabilities/ops-triage.js.map +1 -0
  75. package/dist/prompts/capabilities/review-acls.d.ts +4 -0
  76. package/dist/prompts/capabilities/review-acls.d.ts.map +1 -0
  77. package/dist/prompts/capabilities/review-acls.js +142 -0
  78. package/dist/prompts/capabilities/review-acls.js.map +1 -0
  79. package/dist/prompts/capabilities/review-code.d.ts +4 -0
  80. package/dist/prompts/capabilities/review-code.d.ts.map +1 -0
  81. package/dist/prompts/capabilities/review-code.js +155 -0
  82. package/dist/prompts/capabilities/review-code.js.map +1 -0
  83. package/dist/prompts/capabilities/review-flows.d.ts +4 -0
  84. package/dist/prompts/capabilities/review-flows.d.ts.map +1 -0
  85. package/dist/prompts/capabilities/review-flows.js +413 -0
  86. package/dist/prompts/capabilities/review-flows.js.map +1 -0
  87. package/dist/prompts/capabilities/review-scripts.d.ts +4 -0
  88. package/dist/prompts/capabilities/review-scripts.d.ts.map +1 -0
  89. package/dist/prompts/capabilities/review-scripts.js +160 -0
  90. package/dist/prompts/capabilities/review-scripts.js.map +1 -0
  91. package/dist/prompts/capabilities/scan-automation.d.ts +4 -0
  92. package/dist/prompts/capabilities/scan-automation.d.ts.map +1 -0
  93. package/dist/prompts/capabilities/scan-automation.js +449 -0
  94. package/dist/prompts/capabilities/scan-automation.js.map +1 -0
  95. package/dist/prompts/capabilities/scan-cmdb.d.ts +4 -0
  96. package/dist/prompts/capabilities/scan-cmdb.d.ts.map +1 -0
  97. package/dist/prompts/capabilities/scan-cmdb.js +450 -0
  98. package/dist/prompts/capabilities/scan-cmdb.js.map +1 -0
  99. package/dist/prompts/capabilities/scan-debt.d.ts +4 -0
  100. package/dist/prompts/capabilities/scan-debt.d.ts.map +1 -0
  101. package/dist/prompts/capabilities/scan-debt.js +287 -0
  102. package/dist/prompts/capabilities/scan-debt.js.map +1 -0
  103. package/dist/prompts/capabilities/scan-health.d.ts +4 -0
  104. package/dist/prompts/capabilities/scan-health.d.ts.map +1 -0
  105. package/dist/prompts/capabilities/scan-health.js +235 -0
  106. package/dist/prompts/capabilities/scan-health.js.map +1 -0
  107. package/dist/prompts/capabilities/scan-security.d.ts +4 -0
  108. package/dist/prompts/capabilities/scan-security.d.ts.map +1 -0
  109. package/dist/prompts/capabilities/scan-security.js +370 -0
  110. package/dist/prompts/capabilities/scan-security.js.map +1 -0
  111. package/dist/prompts/capabilities/scan-upgrade.d.ts +4 -0
  112. package/dist/prompts/capabilities/scan-upgrade.d.ts.map +1 -0
  113. package/dist/prompts/capabilities/scan-upgrade.js +327 -0
  114. package/dist/prompts/capabilities/scan-upgrade.js.map +1 -0
  115. package/dist/prompts/index.d.ts +24 -2
  116. package/dist/prompts/index.d.ts.map +1 -1
  117. package/dist/prompts/index.js +160 -14
  118. package/dist/prompts/index.js.map +1 -1
  119. package/dist/prompts/knowledge.d.ts +10 -0
  120. package/dist/prompts/knowledge.d.ts.map +1 -0
  121. package/dist/prompts/knowledge.js +604 -0
  122. package/dist/prompts/knowledge.js.map +1 -0
  123. package/dist/prompts/types.d.ts +38 -0
  124. package/dist/prompts/types.d.ts.map +1 -0
  125. package/dist/prompts/types.js +8 -0
  126. package/dist/prompts/types.js.map +1 -0
  127. package/dist/server.js +3 -3
  128. package/dist/server.js.map +1 -1
  129. package/dist/servicenow/client.d.ts +15 -0
  130. package/dist/servicenow/client.d.ts.map +1 -1
  131. package/dist/servicenow/client.js +107 -0
  132. package/dist/servicenow/client.js.map +1 -1
  133. package/dist/tools/core.d.ts +68 -0
  134. package/dist/tools/core.d.ts.map +1 -1
  135. package/dist/tools/core.js +58 -0
  136. package/dist/tools/core.js.map +1 -1
  137. package/dist/tools/fluent.d.ts +161 -0
  138. package/dist/tools/fluent.d.ts.map +1 -0
  139. package/dist/tools/fluent.js +277 -0
  140. package/dist/tools/fluent.js.map +1 -0
  141. package/dist/tools/index.d.ts +214 -0
  142. package/dist/tools/index.d.ts.map +1 -1
  143. package/dist/tools/index.js +12 -6
  144. package/dist/tools/index.js.map +1 -1
  145. package/dist/tools/now-assist.d.ts.map +1 -1
  146. package/dist/tools/now-assist.js +8 -0
  147. package/dist/tools/now-assist.js.map +1 -1
  148. package/dist/tools/script.d.ts.map +1 -1
  149. package/dist/tools/script.js +12 -0
  150. package/dist/tools/script.js.map +1 -1
  151. package/package.json +11 -3
@@ -0,0 +1,160 @@
1
+ const capability = {
2
+ name: 'review-scripts',
3
+ title: 'Bulk Script Scan',
4
+ description: 'Scan ALL scripts on a table or in a scope for issues — covers business rules, script includes, client scripts, UI policies, UI actions, and more',
5
+ category: 'review',
6
+ arguments: [
7
+ {
8
+ name: 'scope',
9
+ description: 'Table name (e.g. "incident"), scope name (e.g. "x_myapp"), or "instance" for everything',
10
+ required: true,
11
+ },
12
+ {
13
+ name: 'severity',
14
+ description: 'Minimum severity to report: critical, high, or all (default: all)',
15
+ required: false,
16
+ },
17
+ ],
18
+ recommendedTools: [
19
+ 'list_business_rules',
20
+ 'list_script_includes',
21
+ 'list_client_scripts',
22
+ 'list_ui_policies',
23
+ 'list_ui_actions',
24
+ 'query_records',
25
+ ],
26
+ buildPrompt(args) {
27
+ const scope = args?.scope ?? 'Scan my ServiceNow scripts';
28
+ const severity = args?.severity ?? 'all';
29
+ return [
30
+ {
31
+ role: 'assistant',
32
+ content: {
33
+ type: 'text',
34
+ text: [
35
+ '# Bulk Script Scan',
36
+ '',
37
+ 'I am a **ServiceNow bulk script scanner**. I scan ALL script-bearing artifacts',
38
+ 'on a table, in a scope, or across the entire instance to find security vulnerabilities,',
39
+ 'performance antipatterns, deprecated APIs, and hardcoded values.',
40
+ '',
41
+ `## Scan Scope: **${scope}**`,
42
+ `## Minimum Severity: **${severity}**`,
43
+ '',
44
+ severity === 'all'
45
+ ? 'I will report all findings regardless of severity.'
46
+ : `I will only report **${severity}** severity findings and above.`,
47
+ '',
48
+ '## Artifacts I Scan',
49
+ '',
50
+ 'I scan ALL script-bearing artifacts in the specified scope:',
51
+ '',
52
+ '| Artifact | How I Find Them |',
53
+ '|----------|-----------------|',
54
+ '| **Business Rules** on the table | `list_business_rules` filtered by table |',
55
+ '| **Script Includes** in the scope | `list_script_includes` filtered by scope/API name |',
56
+ '| **Client Scripts** on the table | `list_client_scripts` filtered by table |',
57
+ '| **UI Policy script actions** on the table | `list_ui_policies` filtered by table, then check script fields |',
58
+ '| **UI Actions** on the table | `list_ui_actions` filtered by table |',
59
+ '| **Catalog Client Scripts** | `query_records` on `catalog_script_client` (if catalog table) |',
60
+ '| **ACL advanced scripts** on the table | `query_records` on `sys_security_acl` with script != empty |',
61
+ '| **Transform Map scripts** targeting the table | `query_records` on `sys_transform_script` |',
62
+ '',
63
+ '## What I Check in Every Script',
64
+ '',
65
+ '### 1. Injection Vulnerabilities',
66
+ '- `eval()` or `GlideEvaluator` with user-controlled input',
67
+ '- String concatenation in `addQuery()` or `addEncodedQuery()` — use parameterized queries',
68
+ '- `Packages.java.*` usage for executing system commands',
69
+ '- `GlideSecureEvaluator` bypasses',
70
+ '- Unvalidated input in `GlideSysAttachment`, `GlideHTTPRequest`, etc.',
71
+ '',
72
+ '### 2. Performance Antipatterns',
73
+ '- `GlideRecord` queries inside loops (N+1 pattern)',
74
+ '- Missing `setLimit()` on queries that only need one record',
75
+ '- `getRowCount()` instead of `GlideAggregate`',
76
+ '- `current.update()` inside business rules (causes recursive saves)',
77
+ '- `g_form.getValue()` / `g_form.setValue()` in tight loops without batching',
78
+ '- Synchronous `GlideHTTPRequest` in before business rules',
79
+ '- Loading full GlideRecord when only sys_id is needed (`get()` vs `addQuery`+`setLimit`)',
80
+ '',
81
+ '### 3. Deprecated APIs',
82
+ '- `Packages.java.*` — removed in newer versions',
83
+ '- `GlideRecord.getDisplayValue()` without field name',
84
+ '- `current.variables.*` direct access — use `current.variables.getValue()`',
85
+ '- `gs.print()` — use `gs.log()` or `gs.debug()`',
86
+ '- `GlideRecord.insert()` returning void (check for boolean return)',
87
+ '- `XMLDocument` / `XMLDocument2` deprecated methods',
88
+ '',
89
+ '### 4. Security Issues',
90
+ '- Hardcoded credentials (passwords, API keys, tokens, Bearer strings)',
91
+ '- Missing `gs.hasRole()` checks before privileged operations',
92
+ '- `setWorkflow(false)` — disables business rules, bypasses security',
93
+ '- `gs.setRedirect()` with user-controlled URLs (open redirect)',
94
+ '- Client scripts exposing server data via `g_scratchpad` without filtering',
95
+ '- XSS in UI Actions, UI Pages, or Service Portal widgets',
96
+ '',
97
+ '### 5. Hardcoded sys_ids',
98
+ '- Any 32-character hex string that looks like a sys_id',
99
+ '- Should be replaced with `gs.getProperty()`, system properties, or dynamic lookups',
100
+ '- Especially critical in scoped apps (sys_ids differ between instances)',
101
+ '',
102
+ '## Output Format',
103
+ '',
104
+ '### Summary Table',
105
+ '',
106
+ 'Counts per severity across all scanned artifacts:',
107
+ '',
108
+ '| Severity | Count | Artifacts Affected |',
109
+ '|----------|-------|--------------------|',
110
+ '| Critical | | |',
111
+ '| High | | |',
112
+ '| Medium | | |',
113
+ '| Low | | |',
114
+ '| Info | | |',
115
+ '',
116
+ '### Scan Coverage',
117
+ '',
118
+ '| Artifact Type | Count Scanned | Issues Found |',
119
+ '|---------------|---------------|--------------|',
120
+ '',
121
+ '### Detailed Findings',
122
+ '',
123
+ 'For each issue:',
124
+ '',
125
+ '| Field | Description |',
126
+ '|-------|-------------|',
127
+ '| **Severity** | Critical / High / Medium / Low / Info |',
128
+ '| **Category** | Injection, Performance, Deprecated API, Security, Hardcoded |',
129
+ '| **Artifact** | Name and type of the script artifact |',
130
+ '| **Location** | Line number or section in the script |',
131
+ '| **Issue** | What is wrong and why it matters |',
132
+ '| **Fix** | How to fix it, with a concrete code example |',
133
+ '',
134
+ '## Tools I Use',
135
+ '',
136
+ '| Tool | Purpose |',
137
+ '|------|---------|',
138
+ '| `list_business_rules` | Fetch all business rules on the table |',
139
+ '| `list_script_includes` | Fetch all script includes in the scope |',
140
+ '| `list_client_scripts` | Fetch all client scripts on the table |',
141
+ '| `list_ui_policies` | Fetch UI policies with script actions |',
142
+ '| `list_ui_actions` | Fetch UI actions on the table |',
143
+ '| `query_records` | Fetch catalog client scripts, ACL scripts, transform scripts |',
144
+ '',
145
+ 'I will now begin the bulk script scan.',
146
+ ].join('\n'),
147
+ },
148
+ },
149
+ {
150
+ role: 'user',
151
+ content: {
152
+ type: 'text',
153
+ text: scope,
154
+ },
155
+ },
156
+ ];
157
+ },
158
+ };
159
+ export default capability;
160
+ //# sourceMappingURL=review-scripts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-scripts.js","sourceRoot":"","sources":["../../../src/prompts/capabilities/review-scripts.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAyB;IACvC,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,kJAAkJ;IACpJ,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EACT,yFAAyF;YAC3F,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,mEAAmE;YACrE,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,gBAAgB,EAAE;QAChB,qBAAqB;QACrB,sBAAsB;QACtB,qBAAqB;QACrB,kBAAkB;QAClB,iBAAiB;QACjB,eAAe;KAChB;IAED,WAAW,CAAC,IAAI;QACd,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI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,wDAAwD;wBACxD,qFAAqF;wBACrF,yEAAyE;wBACzE,EAAE;wBACF,kBAAkB;wBAClB,EAAE;wBACF,mBAAmB;wBACnB,EAAE;wBACF,mDAAmD;wBACnD,EAAE;wBACF,2CAA2C;wBAC3C,2CAA2C;wBAC3C,kBAAkB;wBAClB,cAAc;wBACd,gBAAgB;wBAChB,aAAa;wBACb,cAAc;wBACd,EAAE;wBACF,mBAAmB;wBACnB,EAAE;wBACF,kDAAkD;wBAClD,kDAAkD;wBAClD,EAAE;wBACF,uBAAuB;wBACvB,EAAE;wBACF,iBAAiB;wBACjB,EAAE;wBACF,yBAAyB;wBACzB,yBAAyB;wBACzB,0DAA0D;wBAC1D,gFAAgF;wBAChF,yDAAyD;wBACzD,yDAAyD;wBACzD,kDAAkD;wBAClD,2DAA2D;wBAC3D,EAAE;wBACF,gBAAgB;wBAChB,EAAE;wBACF,oBAAoB;wBACpB,oBAAoB;wBACpB,mEAAmE;wBACnE,qEAAqE;wBACrE,mEAAmE;wBACnE,gEAAgE;wBAChE,uDAAuD;wBACvD,oFAAoF;wBACpF,EAAE;wBACF,wCAAwC;qBACzC,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;YACD;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,KAAK;iBACZ;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { CapabilityDefinition } from '../types.js';
2
+ declare const capability: CapabilityDefinition;
3
+ export default capability;
4
+ //# sourceMappingURL=scan-automation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-automation.d.ts","sourceRoot":"","sources":["../../../src/prompts/capabilities/scan-automation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,QAAA,MAAM,UAAU,EAAE,oBA2djB,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,449 @@
1
+ const capability = {
2
+ name: 'scan-automation',
3
+ title: 'Automation Conflict Scan',
4
+ description: 'Automation conflict detection — overlapping business rules and flows, circular triggers, execution order issues',
5
+ category: 'scan',
6
+ arguments: [
7
+ {
8
+ name: 'table',
9
+ description: 'Specific table to scan (e.g. "incident", "change_request"). If omitted, scans all tables with automation',
10
+ required: false,
11
+ },
12
+ {
13
+ name: 'scope',
14
+ description: 'Application scope to filter: "all" (default) or a specific scope (e.g. "x_myapp")',
15
+ required: false,
16
+ },
17
+ ],
18
+ recommendedTools: [
19
+ 'query_records',
20
+ 'list_business_rules',
21
+ 'get_business_rule',
22
+ 'list_flows',
23
+ 'get_flow',
24
+ 'list_client_scripts',
25
+ 'get_client_script',
26
+ 'list_script_includes',
27
+ 'get_table_schema',
28
+ ],
29
+ buildPrompt(args) {
30
+ const table = args?.table ?? '';
31
+ const scope = args?.scope ?? 'all';
32
+ const tableLabel = table || 'All tables with automation';
33
+ const scopeLabel = scope === 'all'
34
+ ? 'Instance-wide (all scopes)'
35
+ : `Application scope: \`${scope}\``;
36
+ // ─── Section 1: Automation Inventory ─────────────────────────────────────
37
+ const inventorySection = [
38
+ '## 1. Automation Inventory',
39
+ '',
40
+ 'Use `list_business_rules`, `list_flows`, `list_client_scripts`, and `query_records` to build',
41
+ 'a complete inventory of all automation artifacts:',
42
+ '',
43
+ '### Business Rules (sys_script)',
44
+ table
45
+ ? `Query all active business rules on \`${table}\`:`
46
+ : 'Query all active business rules, grouped by table:',
47
+ '- Count by timing: before, after, async, display',
48
+ '- Count by operation: insert, update, delete, query',
49
+ '- Note execution order (100-1000 range, lower runs first)',
50
+ '- Flag rules with no condition (fire on every operation)',
51
+ '',
52
+ '### Flow Designer Flows (sys_hub_flow)',
53
+ table
54
+ ? `Query all active flows triggered by record changes on \`${table}\`:`
55
+ : 'Query all active record-triggered flows, grouped by trigger table:',
56
+ '- Count by trigger type: record insert, record update, record delete',
57
+ '- Note trigger conditions',
58
+ '- Identify flows with inline Script steps',
59
+ '',
60
+ '### Client Scripts (sys_script_client)',
61
+ table
62
+ ? `Query all active client scripts on \`${table}\`:`
63
+ : 'Query all active client scripts, grouped by table:',
64
+ '- Count by type: onLoad, onChange, onSubmit, onCellEdit',
65
+ '- Note the trigger field for onChange scripts',
66
+ '',
67
+ '### Other Automation',
68
+ '- **Scheduled Jobs** (`sysauto_script`) — recurring scripts that may interact with the same tables',
69
+ '- **UI Actions** (`sys_ui_action`) — form/list buttons with server-side or client-side scripts',
70
+ '- **UI Policies** (`sys_ui_policy`) — form behavior rules with script actions',
71
+ '- **Notifications** (`sysevent_email_action`) — triggered by record changes',
72
+ '- **Script Actions** (`sysevent_script_action`) — event-driven scripts',
73
+ '- **Transform Map Scripts** (`sys_transform_script`) — import-related automation',
74
+ '- **ACL Scripts** — advanced ACL conditions that run on record access',
75
+ '',
76
+ '**Output:** Automation inventory matrix',
77
+ '| Table | BRs (before) | BRs (after) | BRs (async) | Flows | Client Scripts | Other | Total |',
78
+ '|-------|-------------|-------------|-------------|-------|----------------|-------|-------|',
79
+ ];
80
+ // ─── Section 2: Overlapping Triggers ─────────────────────────────────────
81
+ const overlapSection = [
82
+ '## 2. Overlapping Trigger Detection',
83
+ '',
84
+ 'Identify business rules and flows that may conflict because they act on the same',
85
+ 'table, operation, and timing:',
86
+ '',
87
+ '### Same-Field Conflicts',
88
+ '- Two or more **before** business rules that both `setValue()` the same field on the same',
89
+ ' table during the same operation — the one with the higher order number wins, but this is',
90
+ ' usually unintentional',
91
+ '- A **before** business rule and a **flow** that both try to set the same field — the BR',
92
+ ' fires first, then the flow overwrites it (or vice versa depending on timing)',
93
+ '- Example: BR sets `priority` based on impact/urgency, then a flow also sets `priority`',
94
+ ' based on a different algorithm — result depends on execution order',
95
+ '',
96
+ '### Condition Overlap Analysis',
97
+ '- Two rules with the same condition (or no condition) on the same table+operation',
98
+ ' — one may be redundant, or they may have contradictory effects',
99
+ '- Rules where one condition is a subset of another (e.g., Rule A fires when state=Active,',
100
+ ' Rule B fires when state=Active AND priority=1 — both fire on P1 Active records)',
101
+ '- Rules with mutually exclusive conditions that should be merged into one rule with branching logic',
102
+ '',
103
+ '### BR vs Flow Overlap',
104
+ '**Execution order in ServiceNow save pipeline:**',
105
+ '```',
106
+ '1. Client Scripts (onSubmit) — runs in browser before server',
107
+ '2. Before Business Rules — runs before database write (order 1-1000)',
108
+ '3. Database write occurs',
109
+ '4. After Business Rules — runs after database write (order 1-1000)',
110
+ '5. Async Business Rules — queued for background execution',
111
+ '6. Flow Designer flows — trigger evaluation and execution',
112
+ '7. Notifications — email/SMS triggers evaluate',
113
+ '```',
114
+ '',
115
+ '- A **before BR** setting a field and an **after BR** reading that field is fine (correct order)',
116
+ '- A **before BR** setting a field and a **flow** reading the trigger record\'s field is fine',
117
+ ' (flow sees the committed value)',
118
+ '- A **flow** updating a field and an **after BR** on the same table — the flow\'s update triggers',
119
+ ' the BR again (re-entrant!)',
120
+ '',
121
+ '**Output:**',
122
+ '| Table | Operation | Rule 1 | Rule 2 | Conflict Type | Field(s) | Severity | Recommendation |',
123
+ '|-------|-----------|--------|--------|---------------|----------|----------|----------------|',
124
+ ];
125
+ // ─── Section 3: Circular Triggers ────────────────────────────────────────
126
+ const circularSection = [
127
+ '## 3. Circular Trigger Detection',
128
+ '',
129
+ 'Trace automation chains to find circular dependencies:',
130
+ '',
131
+ '### Direct Circular Triggers',
132
+ '- **After BR on table A updates table B → After BR on table B updates table A**',
133
+ ' This creates an infinite loop. ServiceNow has a recursion depth limit (typically ~5)',
134
+ ' but hitting it wastes resources and may cause partial updates.',
135
+ '- **Flow on table A updates table B → Flow on table B updates table A**',
136
+ ' Same circular pattern in Flow Designer.',
137
+ '- **Self-referential:** After BR on table A does `current.update()` → triggers itself again.',
138
+ ' Common mistake, especially with `current.update()` in after rules.',
139
+ '',
140
+ '### Indirect Circular Triggers (3+ hop chains)',
141
+ '- A → B → C → A — three-table circular chain',
142
+ '- A → B (via BR) → C (via flow) → A (via notification script) — mixed automation types',
143
+ '- Build a directed graph of "table A modifies table B" relationships and detect cycles',
144
+ '',
145
+ '### How to Detect',
146
+ '1. For each after BR and flow, identify which tables it writes to (look for `GlideRecord`',
147
+ ' `.insert()`, `.update()`, `.deleteRecord()` calls, and Update Record flow actions)',
148
+ '2. Build an adjacency map: `source_table → [target_tables]`',
149
+ '3. Run cycle detection (DFS) on the graph',
150
+ '4. Report each cycle with the full chain of automation artifacts involved',
151
+ '',
152
+ '### Common Circular Patterns',
153
+ '- Incident ↔ Task: incident BR creates task, task BR updates parent incident',
154
+ '- Change ↔ Change Task: change request BR creates tasks, task completion BR updates change',
155
+ '- CMDB ↔ Discovery: CI update BR triggers re-discovery, discovery updates CI',
156
+ '- Catalog ↔ Task: request item BR creates tasks, task BR updates request item',
157
+ '',
158
+ '**Output:**',
159
+ '| Cycle | Hop 1 | Hop 2 | Hop 3+ | Automation Chain | Severity | Recommendation |',
160
+ '|-------|-------|-------|--------|------------------|----------|----------------|',
161
+ ];
162
+ // ─── Section 4: Execution Order Issues ───────────────────────────────────
163
+ const orderSection = [
164
+ '## 4. Execution Order Issues',
165
+ '',
166
+ 'Analyze business rule execution order for conflicts:',
167
+ '',
168
+ '### Order Number Analysis',
169
+ '- **Default order (100):** Most OOB and custom BRs use 100. When multiple BRs have order 100',
170
+ ' on the same table+timing+operation, execution order is **undefined** (nondeterministic).',
171
+ ' If these BRs depend on each other\'s output, results are unpredictable.',
172
+ '- **Conflicting explicit orders:** Two BRs with the same explicit order number (e.g., both 200)',
173
+ ' on the same table+timing — same nondeterminism problem.',
174
+ '- **Anti-pattern: order 1 or 0:** Setting order to 0 or 1 to "run first" — fragile, creates',
175
+ ' a race with other rules that also set low orders.',
176
+ '',
177
+ '### Dependency Ordering',
178
+ '- **Read-after-write dependencies:** BR at order 200 reads a field that BR at order 300 sets',
179
+ ' — the reader runs before the writer, gets stale data. Order should be swapped.',
180
+ '- **Write-after-write dependencies:** Two BRs both set the same field but at different orders',
181
+ ' — the last one wins. Is this intentional? Document and verify.',
182
+ '',
183
+ '### BR vs Flow Ordering',
184
+ '- BRs ALWAYS fire before flows in the save pipeline',
185
+ '- If a flow depends on a field value set by a BR, this works correctly',
186
+ '- If a BR depends on an action taken by a flow, it will NOT work — the BR runs first',
187
+ '- If a flow updates the same record, it triggers the BRs again (second save)',
188
+ '',
189
+ '### Display BR Ordering',
190
+ '- Display BRs run when the form loads, before the user sees data',
191
+ '- Multiple display BRs populating `g_scratchpad` — if they set the same key, last one wins',
192
+ '- Display BRs with expensive queries slow down form load for all users',
193
+ '',
194
+ '**Output:**',
195
+ '| Table | Timing | Rule 1 (Order) | Rule 2 (Order) | Issue | Impact | Recommendation |',
196
+ '|-------|--------|----------------|----------------|-------|--------|----------------|',
197
+ ];
198
+ // ─── Section 5: Redundant Automation ─────────────────────────────────────
199
+ const redundantSection = [
200
+ '## 5. Redundant Automation Detection',
201
+ '',
202
+ 'Find duplicated logic across different automation mechanisms:',
203
+ '',
204
+ '### BR + Flow Duplication',
205
+ '- A business rule and a flow on the same table doing the same thing',
206
+ ' (e.g., both sending a notification when state changes to "Resolved")',
207
+ '- Common during migration from BRs to Flow Designer — old BR not deactivated',
208
+ '- Result: duplicate emails, double updates, or conflicting field values',
209
+ '',
210
+ '### Client + Server Duplication',
211
+ '- Client script validation (onSubmit) that is also enforced by a before BR',
212
+ ' — server-side validation is correct, client-side is a UX enhancement.',
213
+ ' This is acceptable but should be documented. Flag cases where logic differs.',
214
+ '- Client script setting a field (onChange) that is also set by a before BR',
215
+ ' — the BR overwrites the client script\'s value, making the client script useless',
216
+ '',
217
+ '### Notification Duplication',
218
+ '- A notification AND a flow both sending emails on the same condition',
219
+ '- A notification AND a business rule both calling `gs.eventQueue()` for the same event',
220
+ '- Multiple notifications with overlapping conditions on the same table',
221
+ '',
222
+ '### Scheduled Job Overlap',
223
+ '- Two scheduled jobs that query and update the same table on similar schedules',
224
+ '- A scheduled job doing work that a BR or flow already handles in real-time',
225
+ '',
226
+ '**Output:**',
227
+ '| Table | Duplicate 1 (Type) | Duplicate 2 (Type) | Overlapping Logic | Recommendation |',
228
+ '|-------|--------------------|--------------------|-------------------|----------------|',
229
+ ];
230
+ // ─── Section 6: Performance Hotspots ─────────────────────────────────────
231
+ const hotspotSection = [
232
+ '## 6. Performance Hotspots',
233
+ '',
234
+ 'Identify tables and operations where automation density creates performance risks:',
235
+ '',
236
+ '### Automation Density',
237
+ '- Tables with **>10 active business rules** — high density, every save runs all of them',
238
+ '- Tables with **>5 before-insert rules** — slows down record creation',
239
+ '- Tables with **>5 after-update rules** — every field change triggers all of them',
240
+ ' (unless conditions are well-scoped)',
241
+ '- Tables where total automation count (BRs + flows + client scripts) exceeds **20**',
242
+ '',
243
+ '### Heavy Save Chains',
244
+ '- Before insert chain: how many BRs fire on insert? What is the total estimated execution time?',
245
+ '- After update chain: how many BRs + flows fire on update? Do any of them trigger additional saves?',
246
+ '- The "cascade factor": one user save → N business rules → M of them do `current.update()` or',
247
+ ' update other tables → triggers additional rules on those tables',
248
+ '',
249
+ '### Script Performance',
250
+ '- BRs with GlideRecord queries in their scripts that run on every save (no caching)',
251
+ '- BRs that call external APIs synchronously (before rules block the save transaction)',
252
+ '- BRs with complex condition scripts instead of simple condition filters',
253
+ ' (condition scripts run on every save to check if the rule should fire)',
254
+ '',
255
+ '### Client-Side Performance',
256
+ '- Tables with >5 onChange client scripts — every field change fires all of them',
257
+ '- onLoad client scripts with synchronous GlideAjax calls — blocks form rendering',
258
+ '- Client scripts loading large datasets into g_scratchpad',
259
+ '',
260
+ '**Output:**',
261
+ '| Table | Total Automation | Before Insert | After Update | Cascade Factor | Risk Level | Recommendation |',
262
+ '|-------|------------------|---------------|--------------|----------------|------------|----------------|',
263
+ ];
264
+ // ─── Section 7: Async vs Sync Mismatch ──────────────────────────────────
265
+ const asyncSection = [
266
+ '## 7. Async vs Sync Mismatch',
267
+ '',
268
+ 'Identify automation running in the wrong execution mode:',
269
+ '',
270
+ '### Should Be Async',
271
+ '- **Before/After BRs with external callouts:** REST calls, SOAP calls, LDAP lookups.',
272
+ ' These block the user\'s save transaction. Move to async BR or flow.',
273
+ '- **After BRs that send emails directly:** Use event queue + notification instead',
274
+ ' (`gs.eventQueue()` → event handler → notification)',
275
+ '- **After BRs that update large record sets:** Updating 100+ records in an after BR',
276
+ ' blocks the user. Move to async BR or scheduled job.',
277
+ '- **Before BRs with heavy computation:** Complex calculations, parsing, or data',
278
+ ' transformation that takes > 1 second. Consider caching or async approach.',
279
+ '',
280
+ '### Should Be Sync (But Is Async)',
281
+ '- **Async BRs that set fields on the triggering record:** `current.update()` in async BRs',
282
+ ' happens after the record is already committed. If another user or process reads the record',
283
+ ' between the original save and the async update, they see stale data.',
284
+ '- **Async BRs for data validation:** If validation fails asynchronously, the invalid record',
285
+ ' is already saved. Validation MUST be in a before BR.',
286
+ '- **Async BRs for field calculation:** If calculated fields need to be visible immediately',
287
+ ' after save (e.g., priority derived from impact+urgency), use a before BR.',
288
+ '',
289
+ '### Async BR Limitations',
290
+ '- `current` in async BRs is a snapshot from the time of trigger — not the live record.',
291
+ ' If another process updates the record between trigger and execution, the async BR works',
292
+ ' with stale data.',
293
+ '- `previous` is available in async BRs but is also a snapshot.',
294
+ '- Async BRs cannot abort the triggering transaction (record is already saved).',
295
+ '- Async BRs run as the user who triggered them, but outside the original transaction scope.',
296
+ '',
297
+ '**Output:**',
298
+ '| Rule Name | Table | Current Mode | Recommended Mode | Reason | Impact | Recommendation |',
299
+ '|-----------|-------|-------------- |------------------|--------|--------|----------------|',
300
+ ];
301
+ // ─── Section 8: Cross-Scope Conflicts ────────────────────────────────────
302
+ const crossScopeSection = [
303
+ '## 8. Cross-Scope Conflicts',
304
+ '',
305
+ 'Analyze conflicts between global scope and scoped app automation:',
306
+ '',
307
+ '### Global vs Scoped BRs',
308
+ '- Global BRs on tables that are also targeted by scoped app BRs',
309
+ ' — both fire on the same operation, potentially conflicting',
310
+ '- Global BRs that cannot be overridden by scoped apps (no condition filter)',
311
+ '- Scoped app BRs that assume global BRs do not exist (fragile assumption)',
312
+ '',
313
+ '### Scope Access Issues',
314
+ '- Scoped app BRs accessing tables outside their scope via cross-scope privileges',
315
+ ' — if the cross-scope access is revoked, the BR silently fails',
316
+ '- Scoped app flows accessing global Script Includes — version dependency risk',
317
+ '- Global BRs calling scoped app Script Includes — breaks if the scoped app is uninstalled',
318
+ '',
319
+ '### Upgrade Conflict Risks',
320
+ '- Custom BRs on OOB tables with the same condition as OOB BRs — ServiceNow upgrades',
321
+ ' may change OOB BR behavior, causing unexpected interactions with custom rules',
322
+ '- Custom BRs with order numbers that interleave with OOB BRs — upgrade may insert new',
323
+ ' OOB rules that change the effective execution sequence',
324
+ '- Customized OOB BRs (modified base system rules) — will be flagged in upgrade previews',
325
+ '',
326
+ '**Output:**',
327
+ '| Table | Global Rule | Scoped Rule | Scope | Conflict Type | Risk | Recommendation |',
328
+ '|-------|-------------|-------------|-------|---------------|------|----------------|',
329
+ ];
330
+ // ─── Build sections ──────────────────────────────────────────────────────
331
+ const sections = [
332
+ inventorySection,
333
+ overlapSection,
334
+ circularSection,
335
+ orderSection,
336
+ redundantSection,
337
+ hotspotSection,
338
+ asyncSection,
339
+ crossScopeSection,
340
+ ];
341
+ // ─── Report Format ───────────────────────────────────────────────────────
342
+ const reportFormat = [
343
+ '## Automation Conflict Report Format',
344
+ '',
345
+ 'Compile ALL findings into this structure:',
346
+ '',
347
+ '```',
348
+ 'AUTOMATION CONFLICT SCAN REPORT',
349
+ '================================',
350
+ `Table Focus: ${tableLabel}`,
351
+ `Scope: ${scopeLabel}`,
352
+ 'Date: [current date]',
353
+ '',
354
+ 'EXECUTIVE SUMMARY',
355
+ '- Tables scanned: X',
356
+ '- Total automation rules found: X',
357
+ '- Conflicts detected: X',
358
+ '- Circular triggers: X',
359
+ '- Performance hotspots: X',
360
+ '- Redundant rules: X',
361
+ '- Overall risk: [Low / Medium / High / Critical]',
362
+ '',
363
+ 'CONFLICT MATRIX',
364
+ 'A visual matrix showing which automation artifacts interact on each table:',
365
+ '',
366
+ ' Table: incident',
367
+ ' ┌─────────────────────┬────────────────┬──────────────────┐',
368
+ ' │ Before Insert │ After Insert │ Flows (Insert) │',
369
+ ' ├─────────────────────┼────────────────┼──────────────────┤',
370
+ ' │ Set Priority (100) │ Create Task │ Notify Assignee │',
371
+ ' │ Validate Fields(200)│ Send Email │ Update CMDB │',
372
+ ' │ │ ↑ conflicts ↑ │ │',
373
+ ' └─────────────────────┴────────────────┴──────────────────┘',
374
+ '',
375
+ 'DETAILED FINDINGS',
376
+ '-----------------',
377
+ 'Each finding MUST include:',
378
+ ' Finding ID: AUTO-XXXX',
379
+ ' Severity: Critical / High / Medium / Low',
380
+ ' Category: Overlap / Circular / Order / Redundant / Performance / Async / Cross-Scope',
381
+ ' Table: Affected table',
382
+ ' Rules Involved: List of conflicting rules with types and orders',
383
+ ' Evidence: [specific conflict details: fields, conditions, execution trace]',
384
+ ' Impact: [data corruption, performance, unpredictable behavior]',
385
+ ' Recommendation: [merge rules, adjust order, convert to async, deactivate, etc.]',
386
+ '',
387
+ 'SEVERITY DEFINITIONS',
388
+ ' CRITICAL — Active data corruption or infinite loop risk',
389
+ ' HIGH — Conflicting rules causing unpredictable behavior',
390
+ ' MEDIUM — Performance risk or redundant automation',
391
+ ' LOW — Best practice violation; no immediate impact',
392
+ '',
393
+ 'REMEDIATION PRIORITIES',
394
+ '1. [Circular triggers and infinite loops — fix immediately]',
395
+ '2. [Field-level conflicts — resolve within 1 week]',
396
+ '3. [Performance hotspots — optimize within 2 weeks]',
397
+ '4. [Redundant automation — clean up in next sprint]',
398
+ '```',
399
+ ];
400
+ return [
401
+ {
402
+ role: 'assistant',
403
+ content: {
404
+ type: 'text',
405
+ text: [
406
+ '# Capability: Automation Conflict Scan',
407
+ '',
408
+ `**Table Focus:** ${tableLabel}`,
409
+ `**Scope:** ${scopeLabel}`,
410
+ '',
411
+ 'This capability detects conflicts, overlaps, and issues across ALL automation',
412
+ 'mechanisms in ServiceNow: business rules, flows, client scripts, scheduled jobs,',
413
+ 'UI actions, notifications, and more. Automation conflicts are one of the most',
414
+ 'common causes of data corruption, performance degradation, and unpredictable',
415
+ 'behavior in ServiceNow instances.',
416
+ '',
417
+ '**Platform Knowledge:**',
418
+ '- Business rules fire BEFORE flows in the ServiceNow save pipeline',
419
+ '- BR execution order: lower order number runs first (range 1-1000, default 100)',
420
+ '- When multiple BRs have the same order number, execution order is nondeterministic',
421
+ '- After BRs that call `current.update()` trigger another full save pipeline cycle',
422
+ '- Flows trigger after all BRs complete; flow-initiated record updates trigger BRs again',
423
+ '- Client scripts run in the browser before the server save pipeline begins',
424
+ '- Async BRs and flows run outside the user\'s transaction context',
425
+ '',
426
+ ...sections.flatMap(s => [...s, '']),
427
+ ...reportFormat,
428
+ '',
429
+ '---',
430
+ '',
431
+ 'Beginning automation conflict scan. Every finding must include its Finding ID,',
432
+ 'severity, category, involved rules, concrete evidence, and a specific recommendation.',
433
+ ].join('\n'),
434
+ },
435
+ },
436
+ {
437
+ role: 'user',
438
+ content: {
439
+ type: 'text',
440
+ text: table
441
+ ? `Run an automation conflict scan on the \`${table}\` table. Find overlapping rules, circular triggers, execution order issues, and performance hotspots. Give me a structured conflict report.`
442
+ : `Run an automation conflict scan across all tables. Find overlapping rules, circular triggers, execution order issues, and performance hotspots. Give me a structured conflict report.`,
443
+ },
444
+ },
445
+ ];
446
+ },
447
+ };
448
+ export default capability;
449
+ //# sourceMappingURL=scan-automation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan-automation.js","sourceRoot":"","sources":["../../../src/prompts/capabilities/scan-automation.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAyB;IACvC,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,0BAA0B;IACjC,WAAW,EACT,iHAAiH;IACnH,QAAQ,EAAE,MAAM;IAEhB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EACT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