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.
- package/dist/cli/index.js +89 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/direct/executor.d.ts +28 -0
- package/dist/direct/executor.d.ts.map +1 -0
- package/dist/direct/executor.js +228 -0
- package/dist/direct/executor.js.map +1 -0
- package/dist/direct/llm-client.d.ts +32 -0
- package/dist/direct/llm-client.d.ts.map +1 -0
- package/dist/direct/llm-client.js +122 -0
- package/dist/direct/llm-client.js.map +1 -0
- package/dist/prompts/capabilities/build-app.d.ts +4 -0
- package/dist/prompts/capabilities/build-app.d.ts.map +1 -0
- package/dist/prompts/capabilities/build-app.js +238 -0
- package/dist/prompts/capabilities/build-app.js.map +1 -0
- package/dist/prompts/capabilities/build-business-rule.d.ts +4 -0
- package/dist/prompts/capabilities/build-business-rule.d.ts.map +1 -0
- package/dist/prompts/capabilities/build-business-rule.js +93 -0
- package/dist/prompts/capabilities/build-business-rule.js.map +1 -0
- package/dist/prompts/capabilities/build-catalog.d.ts +4 -0
- package/dist/prompts/capabilities/build-catalog.d.ts.map +1 -0
- package/dist/prompts/capabilities/build-catalog.js +350 -0
- package/dist/prompts/capabilities/build-catalog.js.map +1 -0
- package/dist/prompts/capabilities/build-client-script.d.ts +4 -0
- package/dist/prompts/capabilities/build-client-script.d.ts.map +1 -0
- package/dist/prompts/capabilities/build-client-script.js +157 -0
- package/dist/prompts/capabilities/build-client-script.js.map +1 -0
- package/dist/prompts/capabilities/build-flow.d.ts +4 -0
- package/dist/prompts/capabilities/build-flow.d.ts.map +1 -0
- package/dist/prompts/capabilities/build-flow.js +243 -0
- package/dist/prompts/capabilities/build-flow.js.map +1 -0
- package/dist/prompts/capabilities/build-portal.d.ts +4 -0
- package/dist/prompts/capabilities/build-portal.d.ts.map +1 -0
- package/dist/prompts/capabilities/build-portal.js +250 -0
- package/dist/prompts/capabilities/build-portal.js.map +1 -0
- package/dist/prompts/capabilities/build-rest-api.d.ts +4 -0
- package/dist/prompts/capabilities/build-rest-api.d.ts.map +1 -0
- package/dist/prompts/capabilities/build-rest-api.js +293 -0
- package/dist/prompts/capabilities/build-rest-api.js.map +1 -0
- package/dist/prompts/capabilities/build-test-plan.d.ts +4 -0
- package/dist/prompts/capabilities/build-test-plan.d.ts.map +1 -0
- package/dist/prompts/capabilities/build-test-plan.js +162 -0
- package/dist/prompts/capabilities/build-test-plan.js.map +1 -0
- package/dist/prompts/capabilities/build-uib.d.ts +4 -0
- package/dist/prompts/capabilities/build-uib.d.ts.map +1 -0
- package/dist/prompts/capabilities/build-uib.js +309 -0
- package/dist/prompts/capabilities/build-uib.js.map +1 -0
- package/dist/prompts/capabilities/docs-app.d.ts +4 -0
- package/dist/prompts/capabilities/docs-app.d.ts.map +1 -0
- package/dist/prompts/capabilities/docs-app.js +234 -0
- package/dist/prompts/capabilities/docs-app.js.map +1 -0
- package/dist/prompts/capabilities/docs-release.d.ts +4 -0
- package/dist/prompts/capabilities/docs-release.d.ts.map +1 -0
- package/dist/prompts/capabilities/docs-release.js +197 -0
- package/dist/prompts/capabilities/docs-release.js.map +1 -0
- package/dist/prompts/capabilities/docs-runbook.d.ts +4 -0
- package/dist/prompts/capabilities/docs-runbook.d.ts.map +1 -0
- package/dist/prompts/capabilities/docs-runbook.js +223 -0
- package/dist/prompts/capabilities/docs-runbook.js.map +1 -0
- package/dist/prompts/capabilities/docs-script.d.ts +4 -0
- package/dist/prompts/capabilities/docs-script.d.ts.map +1 -0
- package/dist/prompts/capabilities/docs-script.js +242 -0
- package/dist/prompts/capabilities/docs-script.js.map +1 -0
- package/dist/prompts/capabilities/ops-deploy.d.ts +4 -0
- package/dist/prompts/capabilities/ops-deploy.d.ts.map +1 -0
- package/dist/prompts/capabilities/ops-deploy.js +193 -0
- package/dist/prompts/capabilities/ops-deploy.js.map +1 -0
- package/dist/prompts/capabilities/ops-risk.d.ts +4 -0
- package/dist/prompts/capabilities/ops-risk.d.ts.map +1 -0
- package/dist/prompts/capabilities/ops-risk.js +227 -0
- package/dist/prompts/capabilities/ops-risk.js.map +1 -0
- package/dist/prompts/capabilities/ops-triage.d.ts +4 -0
- package/dist/prompts/capabilities/ops-triage.d.ts.map +1 -0
- package/dist/prompts/capabilities/ops-triage.js +183 -0
- package/dist/prompts/capabilities/ops-triage.js.map +1 -0
- package/dist/prompts/capabilities/review-acls.d.ts +4 -0
- package/dist/prompts/capabilities/review-acls.d.ts.map +1 -0
- package/dist/prompts/capabilities/review-acls.js +142 -0
- package/dist/prompts/capabilities/review-acls.js.map +1 -0
- package/dist/prompts/capabilities/review-code.d.ts +4 -0
- package/dist/prompts/capabilities/review-code.d.ts.map +1 -0
- package/dist/prompts/capabilities/review-code.js +155 -0
- package/dist/prompts/capabilities/review-code.js.map +1 -0
- package/dist/prompts/capabilities/review-flows.d.ts +4 -0
- package/dist/prompts/capabilities/review-flows.d.ts.map +1 -0
- package/dist/prompts/capabilities/review-flows.js +413 -0
- package/dist/prompts/capabilities/review-flows.js.map +1 -0
- package/dist/prompts/capabilities/review-scripts.d.ts +4 -0
- package/dist/prompts/capabilities/review-scripts.d.ts.map +1 -0
- package/dist/prompts/capabilities/review-scripts.js +160 -0
- package/dist/prompts/capabilities/review-scripts.js.map +1 -0
- package/dist/prompts/capabilities/scan-automation.d.ts +4 -0
- package/dist/prompts/capabilities/scan-automation.d.ts.map +1 -0
- package/dist/prompts/capabilities/scan-automation.js +449 -0
- package/dist/prompts/capabilities/scan-automation.js.map +1 -0
- package/dist/prompts/capabilities/scan-cmdb.d.ts +4 -0
- package/dist/prompts/capabilities/scan-cmdb.d.ts.map +1 -0
- package/dist/prompts/capabilities/scan-cmdb.js +450 -0
- package/dist/prompts/capabilities/scan-cmdb.js.map +1 -0
- package/dist/prompts/capabilities/scan-debt.d.ts +4 -0
- package/dist/prompts/capabilities/scan-debt.d.ts.map +1 -0
- package/dist/prompts/capabilities/scan-debt.js +287 -0
- package/dist/prompts/capabilities/scan-debt.js.map +1 -0
- package/dist/prompts/capabilities/scan-health.d.ts +4 -0
- package/dist/prompts/capabilities/scan-health.d.ts.map +1 -0
- package/dist/prompts/capabilities/scan-health.js +235 -0
- package/dist/prompts/capabilities/scan-health.js.map +1 -0
- package/dist/prompts/capabilities/scan-security.d.ts +4 -0
- package/dist/prompts/capabilities/scan-security.d.ts.map +1 -0
- package/dist/prompts/capabilities/scan-security.js +370 -0
- package/dist/prompts/capabilities/scan-security.js.map +1 -0
- package/dist/prompts/capabilities/scan-upgrade.d.ts +4 -0
- package/dist/prompts/capabilities/scan-upgrade.d.ts.map +1 -0
- package/dist/prompts/capabilities/scan-upgrade.js +327 -0
- package/dist/prompts/capabilities/scan-upgrade.js.map +1 -0
- package/dist/prompts/index.d.ts +24 -2
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +160 -14
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/knowledge.d.ts +10 -0
- package/dist/prompts/knowledge.d.ts.map +1 -0
- package/dist/prompts/knowledge.js +604 -0
- package/dist/prompts/knowledge.js.map +1 -0
- package/dist/prompts/types.d.ts +38 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +8 -0
- package/dist/prompts/types.js.map +1 -0
- package/dist/server.js +3 -3
- package/dist/server.js.map +1 -1
- package/dist/servicenow/client.d.ts +15 -0
- package/dist/servicenow/client.d.ts.map +1 -1
- package/dist/servicenow/client.js +107 -0
- package/dist/servicenow/client.js.map +1 -1
- package/dist/tools/core.d.ts +68 -0
- package/dist/tools/core.d.ts.map +1 -1
- package/dist/tools/core.js +58 -0
- package/dist/tools/core.js.map +1 -1
- package/dist/tools/fluent.d.ts +161 -0
- package/dist/tools/fluent.d.ts.map +1 -0
- package/dist/tools/fluent.js +277 -0
- package/dist/tools/fluent.js.map +1 -0
- package/dist/tools/index.d.ts +214 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +12 -6
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/now-assist.d.ts.map +1 -1
- package/dist/tools/now-assist.js +8 -0
- package/dist/tools/now-assist.js.map +1 -1
- package/dist/tools/script.d.ts.map +1 -1
- package/dist/tools/script.js +12 -0
- package/dist/tools/script.js.map +1 -1
- package/package.json +11 -3
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
const capability = {
|
|
2
|
+
name: 'review-code',
|
|
3
|
+
title: 'Code Review',
|
|
4
|
+
description: 'Deep code review for ANY ServiceNow script — security, performance, best practices, and upgrade safety across ALL artifact types',
|
|
5
|
+
category: 'review',
|
|
6
|
+
arguments: [
|
|
7
|
+
{
|
|
8
|
+
name: 'artifact',
|
|
9
|
+
description: 'Paste code, provide a sys_id, or name a business rule/script include/client script/widget/flow action',
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'focus',
|
|
14
|
+
description: 'Review focus: security, performance, best-practices, upgrade-safety, or all (default: all)',
|
|
15
|
+
required: false,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
recommendedTools: [
|
|
19
|
+
'get_business_rule',
|
|
20
|
+
'list_business_rules',
|
|
21
|
+
'get_script_include',
|
|
22
|
+
'list_script_includes',
|
|
23
|
+
'get_client_script',
|
|
24
|
+
'list_client_scripts',
|
|
25
|
+
'get_ui_policy',
|
|
26
|
+
'list_ui_policies',
|
|
27
|
+
'get_ui_action',
|
|
28
|
+
'list_ui_actions',
|
|
29
|
+
'list_acls',
|
|
30
|
+
'get_acl',
|
|
31
|
+
'query_records',
|
|
32
|
+
'get_table_schema',
|
|
33
|
+
],
|
|
34
|
+
buildPrompt(args) {
|
|
35
|
+
const artifact = args?.artifact ?? 'Review my ServiceNow code';
|
|
36
|
+
const focus = args?.focus ?? 'all';
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
role: 'assistant',
|
|
40
|
+
content: {
|
|
41
|
+
type: 'text',
|
|
42
|
+
text: [
|
|
43
|
+
'# Code Review',
|
|
44
|
+
'',
|
|
45
|
+
'I am a **ServiceNow code review specialist**. I perform deep reviews of ANY script',
|
|
46
|
+
'artifact type for security vulnerabilities, performance issues, best-practice violations,',
|
|
47
|
+
'and upgrade-safety risks.',
|
|
48
|
+
'',
|
|
49
|
+
'## Supported Artifact Types',
|
|
50
|
+
'',
|
|
51
|
+
'I can review ALL of the following artifact types:',
|
|
52
|
+
'',
|
|
53
|
+
'| Artifact | Table |',
|
|
54
|
+
'|----------|-------|',
|
|
55
|
+
'| Business Rules | `sys_script` |',
|
|
56
|
+
'| Script Includes | `sys_script_include` |',
|
|
57
|
+
'| Client Scripts | `sys_script_client` |',
|
|
58
|
+
'| Fix Scripts | `sys_script_fix` |',
|
|
59
|
+
'| UI Policies (script actions) | `sys_ui_policy` |',
|
|
60
|
+
'| UI Actions | `sys_ui_action` |',
|
|
61
|
+
'| UI Pages | `sys_ui_page` |',
|
|
62
|
+
'| UI Macros | `sys_ui_macro` |',
|
|
63
|
+
'| Scheduled Jobs | `sysauto_script` |',
|
|
64
|
+
'| MID Server Script Includes | `ecc_agent_script_include` |',
|
|
65
|
+
'| Script Actions | `sysevent_script_action` |',
|
|
66
|
+
'| Processors | `sys_processor` |',
|
|
67
|
+
'| Transform Map Scripts | `sys_transform_script` |',
|
|
68
|
+
'| Flow Actions / Subflow scripts | Flow Designer |',
|
|
69
|
+
'| Service Portal Widgets | `sp_widget` (client controller, server script, CSS, HTML) |',
|
|
70
|
+
'| Angular Providers | `sp_angular_provider` |',
|
|
71
|
+
'| Catalog Client Scripts | `catalog_script_client` |',
|
|
72
|
+
'| Scripted REST APIs | `sys_ws_operation` |',
|
|
73
|
+
'| Email notification scripts | `sysevent_email_action` |',
|
|
74
|
+
'| ACL scripts (advanced conditions) | `sys_security_acl` |',
|
|
75
|
+
'',
|
|
76
|
+
'## Review Dimensions',
|
|
77
|
+
'',
|
|
78
|
+
'### 1. Security',
|
|
79
|
+
'- **Injection risks** — `eval()`, `GlideEvaluator` with untrusted input, SQL-like string concatenation in queries',
|
|
80
|
+
'- **Authorization gaps** — missing `gs.hasRole()` checks, overly permissive ACLs',
|
|
81
|
+
'- **Data exposure** — sensitive fields returned without filtering, missing field-level ACLs',
|
|
82
|
+
'- **XSS** — unescaped output in UI scripts, Service Portal widgets, UI Pages',
|
|
83
|
+
'- **CSRF** — REST endpoints without proper token validation',
|
|
84
|
+
'- **Credential leakage** — hardcoded passwords, API keys, tokens',
|
|
85
|
+
'',
|
|
86
|
+
'### 2. Performance',
|
|
87
|
+
'- **N+1 queries** — `GlideRecord` inside loops',
|
|
88
|
+
'- **Unbounded queries** — missing `setLimit()`, no encoded query optimization',
|
|
89
|
+
'- **Unnecessary loads** — loading full records when only `sys_id` is needed',
|
|
90
|
+
'- **Synchronous bottlenecks** — heavy processing in before business rules',
|
|
91
|
+
'- **DOM overhead** — excessive `g_form` calls in client scripts (should batch)',
|
|
92
|
+
'- **Payload bloat** — Service Portal widgets returning unused data to client',
|
|
93
|
+
'',
|
|
94
|
+
'### 3. Best Practices',
|
|
95
|
+
'- **Naming conventions** — consistent, descriptive names for variables and artifacts',
|
|
96
|
+
'- **Error handling** — try/catch blocks, graceful failures, `gs.addErrorMessage()`',
|
|
97
|
+
'- **Logging** — appropriate `gs.log()` / `gs.debug()` usage, no `gs.print()` in production',
|
|
98
|
+
'- **Scoping** — proper use of `current` vs `previous`, variable scope, `var` vs `let`/`const`',
|
|
99
|
+
'- **DRY** — duplicate logic that should be in a Script Include',
|
|
100
|
+
'- **Abort-on-false** — business rules that modify `current` without checking `current.operation()`',
|
|
101
|
+
'',
|
|
102
|
+
'### 4. Upgrade Safety',
|
|
103
|
+
'- **OOB modifications** — direct edits to out-of-box scripts (should use insert-and-stay)',
|
|
104
|
+
'- **Deprecated APIs** — `Packages.java.*`, `GlideRecord.getDisplayValue()` without field name, `current.update()` in business rules',
|
|
105
|
+
'- **Hardcoded sys_ids** — should use `gs.getProperty()`, system properties, or reference qualifiers',
|
|
106
|
+
'- **Version-specific behavior** — code relying on platform version quirks',
|
|
107
|
+
'- **Skipped list conflicts** — customizations that will collide with upgrades',
|
|
108
|
+
'',
|
|
109
|
+
`## Review Focus: **${focus}**`,
|
|
110
|
+
'',
|
|
111
|
+
focus === 'all'
|
|
112
|
+
? 'I will review across all dimensions: security, performance, best practices, and upgrade safety.'
|
|
113
|
+
: `I will focus primarily on **${focus}**, but will flag critical issues in other areas.`,
|
|
114
|
+
'',
|
|
115
|
+
'## Output Format',
|
|
116
|
+
'',
|
|
117
|
+
'For each issue found, I will report:',
|
|
118
|
+
'',
|
|
119
|
+
'| Field | Description |',
|
|
120
|
+
'|-------|-------------|',
|
|
121
|
+
'| **Severity** | Critical / Warning / Info |',
|
|
122
|
+
'| **Category** | Security, Performance, Best Practice, Upgrade Safety |',
|
|
123
|
+
'| **Location** | Line number or section in the script |',
|
|
124
|
+
'| **Issue** | What is wrong and why it matters |',
|
|
125
|
+
'| **Fix** | How to fix it, with a concrete code example |',
|
|
126
|
+
'',
|
|
127
|
+
'## Tools I Use',
|
|
128
|
+
'',
|
|
129
|
+
'| Tool | Purpose |',
|
|
130
|
+
'|------|---------|',
|
|
131
|
+
'| `get_business_rule` / `list_business_rules` | Fetch business rules to review |',
|
|
132
|
+
'| `get_script_include` / `list_script_includes` | Fetch script includes to review |',
|
|
133
|
+
'| `get_client_script` / `list_client_scripts` | Fetch client scripts to review |',
|
|
134
|
+
'| `get_ui_policy` / `list_ui_policies` | Fetch UI policies and script actions |',
|
|
135
|
+
'| `get_ui_action` / `list_ui_actions` | Fetch UI actions to review |',
|
|
136
|
+
'| `list_acls` / `get_acl` | Check ACL coverage and advanced scripts |',
|
|
137
|
+
'| `query_records` | Fetch any other artifact type by table |',
|
|
138
|
+
'| `get_table_schema` | Understand table structure for context |',
|
|
139
|
+
'',
|
|
140
|
+
'I will now review your artifact.',
|
|
141
|
+
].join('\n'),
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
role: 'user',
|
|
146
|
+
content: {
|
|
147
|
+
type: 'text',
|
|
148
|
+
text: artifact,
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
];
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
export default capability;
|
|
155
|
+
//# sourceMappingURL=review-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-code.js","sourceRoot":"","sources":["../../../src/prompts/capabilities/review-code.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAyB;IACvC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,aAAa;IACpB,WAAW,EACT,kIAAkI;IACpI,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,UAAU;YAChB,WAAW,EACT,uGAAuG;YACzG,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EACT,4FAA4F;YAC9F,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,gBAAgB,EAAE;QAChB,mBAAmB;QACnB,qBAAqB;QACrB,oBAAoB;QACpB,sBAAsB;QACtB,mBAAmB;QACnB,qBAAqB;QACrB,eAAe;QACf,kBAAkB;QAClB,eAAe;QACf,iBAAiB;QACjB,WAAW;QACX,SAAS;QACT,eAAe;QACf,kBAAkB;KACnB;IAED,WAAW,CAAC,IAAI;QACd,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI,2BAA2B,CAAC;QAC/D,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,KAAK,CAAC;QAEnC,OAAO;YACL;gBACE,IAAI,EAAE,WAAoB;gBAC1B,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE;wBACJ,eAAe;wBACf,EAAE;wBACF,oFAAoF;wBACpF,2FAA2F;wBAC3F,2BAA2B;wBAC3B,EAAE;wBACF,6BAA6B;wBAC7B,EAAE;wBACF,mDAAmD;wBACnD,EAAE;wBACF,sBAAsB;wBACtB,sBAAs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AoB;wBACpB,kFAAkF;wBAClF,qFAAqF;wBACrF,kFAAkF;wBAClF,iFAAiF;wBACjF,sEAAsE;wBACtE,uEAAuE;wBACvE,8DAA8D;wBAC9D,iEAAiE;wBACjE,EAAE;wBACF,kCAAkC;qBACnC,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;YACD;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,QAAQ;iBACf;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-flows.d.ts","sourceRoot":"","sources":["../../../src/prompts/capabilities/review-flows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,QAAA,MAAM,UAAU,EAAE,oBAwbjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
const capability = {
|
|
2
|
+
name: 'review-flows',
|
|
3
|
+
title: 'Flow Designer Audit',
|
|
4
|
+
description: 'Flow audit — dead paths, missing error handlers, async issues, performance bottlenecks, best practices',
|
|
5
|
+
category: 'review',
|
|
6
|
+
arguments: [
|
|
7
|
+
{
|
|
8
|
+
name: 'scope',
|
|
9
|
+
description: 'Application scope to audit (e.g. "x_myapp"), or "all" for instance-wide. Default: all',
|
|
10
|
+
required: false,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'focus',
|
|
14
|
+
description: 'Audit focus area: "errors", "performance", "security", or "all" (default)',
|
|
15
|
+
required: false,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
recommendedTools: [
|
|
19
|
+
'query_records',
|
|
20
|
+
'list_flows',
|
|
21
|
+
'get_flow',
|
|
22
|
+
'list_subflows',
|
|
23
|
+
'get_subflow',
|
|
24
|
+
'list_flow_executions',
|
|
25
|
+
'get_flow_execution',
|
|
26
|
+
'get_flow_error_log',
|
|
27
|
+
],
|
|
28
|
+
buildPrompt(args) {
|
|
29
|
+
const scope = args?.scope ?? 'all';
|
|
30
|
+
const focus = args?.focus ?? 'all';
|
|
31
|
+
const scopeLabel = scope === 'all'
|
|
32
|
+
? 'Instance-wide (all scopes)'
|
|
33
|
+
: `Application scope: \`${scope}\``;
|
|
34
|
+
const focusLabel = {
|
|
35
|
+
all: 'Full audit — errors, performance, security, best practices',
|
|
36
|
+
errors: 'Error handling and failure paths',
|
|
37
|
+
performance: 'Performance bottlenecks and resource consumption',
|
|
38
|
+
security: 'Security, role checks, and data exposure',
|
|
39
|
+
};
|
|
40
|
+
const focusDescription = focusLabel[focus] ?? `Custom focus: ${focus}`;
|
|
41
|
+
// ─── Section 1: Inventory ────────────────────────────────────────────────
|
|
42
|
+
const inventorySection = [
|
|
43
|
+
'## 1. Flow Inventory',
|
|
44
|
+
'',
|
|
45
|
+
'Use `list_flows`, `list_subflows`, and `query_records` to build a complete inventory:',
|
|
46
|
+
'',
|
|
47
|
+
'### Flows (sys_hub_flow)',
|
|
48
|
+
'- Count by status: active, inactive, draft',
|
|
49
|
+
'- Count by trigger type: record-based, schedule-based, application-based, inbound email, REST',
|
|
50
|
+
scope !== 'all'
|
|
51
|
+
? `- Filter to scope \`${scope}\` — also note any global flows that affect tables in this scope`
|
|
52
|
+
: '- Group by application scope',
|
|
53
|
+
'- Identify flows with no trigger (manually invoked only)',
|
|
54
|
+
'- Identify flows created but never executed',
|
|
55
|
+
'',
|
|
56
|
+
'### Subflows (sys_hub_sub_flow)',
|
|
57
|
+
'- Count of subflows, grouped by scope',
|
|
58
|
+
'- Subflows that are never referenced by any parent flow (orphaned)',
|
|
59
|
+
'- Subflows used by 5+ parent flows (shared utilities — verify they are robust)',
|
|
60
|
+
'',
|
|
61
|
+
'### Legacy Workflows (wf_workflow)',
|
|
62
|
+
'- Count of active legacy workflows — flag for migration to Flow Designer',
|
|
63
|
+
'- Workflows with Run Script activities (security review needed)',
|
|
64
|
+
'',
|
|
65
|
+
'**Output:** Inventory table',
|
|
66
|
+
'| Name | Type | Scope | Trigger | Status | Last Executed | Execution Count |',
|
|
67
|
+
'|------|------|-------|---------|--------|---------------|-----------------|',
|
|
68
|
+
];
|
|
69
|
+
// ─── Section 2: Error Handling ───────────────────────────────────────────
|
|
70
|
+
const errorSection = [
|
|
71
|
+
'## 2. Error Handling Audit',
|
|
72
|
+
'',
|
|
73
|
+
'Use `get_flow`, `get_subflow`, and `get_flow_error_log` to inspect each flow:',
|
|
74
|
+
'',
|
|
75
|
+
'### Missing Error Handlers',
|
|
76
|
+
'- Flows with **no Try/Catch blocks** — any action failure crashes the entire flow',
|
|
77
|
+
'- Flows where Try blocks exist but Catch blocks are empty (swallowed errors)',
|
|
78
|
+
'- Flows with error handling that only logs but takes no corrective action',
|
|
79
|
+
'- Subflows without error outputs — parent flow cannot detect failure',
|
|
80
|
+
'',
|
|
81
|
+
'### Missing Rollback Logic',
|
|
82
|
+
'- Flows that create/update multiple records but have no rollback on partial failure',
|
|
83
|
+
'- Example: Flow creates a record in table A, then tries to create in table B. If B fails,',
|
|
84
|
+
' the record in A is orphaned. The Catch block should clean up A.',
|
|
85
|
+
'- Flows that call external APIs without handling non-2xx responses',
|
|
86
|
+
'',
|
|
87
|
+
'### Unhandled Error Paths',
|
|
88
|
+
'- If/Else branches where only the "If" path has actions (missing Else handling)',
|
|
89
|
+
'- Decision tables with no default/fallback branch',
|
|
90
|
+
'- Flows that call subflows without checking the subflow\'s return status',
|
|
91
|
+
'',
|
|
92
|
+
'### Error Notification Gaps',
|
|
93
|
+
'- Flows that fail silently — no email notification, no event, no log entry',
|
|
94
|
+
'- Flows that should alert admins on failure but have no notification action in Catch',
|
|
95
|
+
'',
|
|
96
|
+
'**Output per finding:**',
|
|
97
|
+
'| Flow Name | Issue Type | Severity | Details | Recommendation |',
|
|
98
|
+
'|-----------|------------|----------|---------|----------------|',
|
|
99
|
+
];
|
|
100
|
+
// ─── Section 3: Performance ──────────────────────────────────────────────
|
|
101
|
+
const performanceSection = [
|
|
102
|
+
'## 3. Performance Analysis',
|
|
103
|
+
'',
|
|
104
|
+
'Use `get_flow`, `list_flow_executions`, `get_flow_execution`, and `query_records` to analyze:',
|
|
105
|
+
'',
|
|
106
|
+
'### Action Count Bloat',
|
|
107
|
+
'- Flows with more than **20 actions** — Flow Designer has a practical limit of ~100 actions',
|
|
108
|
+
' but performance degrades well before that. Recommend breaking into subflows.',
|
|
109
|
+
'- Subflows with more than **15 actions** — should be further decomposed',
|
|
110
|
+
'- Flows with deeply nested subflow calls (depth > 3 levels, max platform limit is 500)',
|
|
111
|
+
'',
|
|
112
|
+
'### Loop Performance',
|
|
113
|
+
'- **For Each loops** iterating over unbounded record sets — must have `setLimit()` or a',
|
|
114
|
+
' reasonable filter to prevent processing millions of records',
|
|
115
|
+
'- Nested loops (loop inside a loop) — O(n^2) complexity, major performance risk',
|
|
116
|
+
'- Loops containing GlideRecord queries — each iteration fires a separate query (N+1 pattern)',
|
|
117
|
+
'- Loops with Update Record actions — each iteration is a separate database write',
|
|
118
|
+
'',
|
|
119
|
+
'### Query Performance',
|
|
120
|
+
'- Flows using **Look Up Records** without filters or with very broad filters',
|
|
121
|
+
'- Flows querying large tables (task, sys_audit, syslog) without date or scope filters',
|
|
122
|
+
'- Multiple sequential Look Up Records actions that could be combined into one query',
|
|
123
|
+
'- Flows using dot-walked fields extensively — each dot-walk is an additional query',
|
|
124
|
+
'',
|
|
125
|
+
'### Execution Duration',
|
|
126
|
+
'- Flows with average execution time > 30 seconds (should be async)',
|
|
127
|
+
'- Flows with average execution time > 5 minutes (investigate bottleneck)',
|
|
128
|
+
'- Flows with high variance in execution time (sometimes fast, sometimes slow)',
|
|
129
|
+
'',
|
|
130
|
+
'### Resource Consumption',
|
|
131
|
+
'- Flows triggered on high-frequency tables (sys_audit, syslog) — can overwhelm the system',
|
|
132
|
+
'- Flows with record-based triggers that fire on every update (no condition filter)',
|
|
133
|
+
'- Multiple flows triggered on the same table+operation — cumulative impact',
|
|
134
|
+
'',
|
|
135
|
+
'**Output per finding:**',
|
|
136
|
+
'| Flow Name | Metric | Value | Threshold | Severity | Recommendation |',
|
|
137
|
+
'|-----------|--------|-------|-----------|----------|----------------|',
|
|
138
|
+
];
|
|
139
|
+
// ─── Section 4: Dead Paths ───────────────────────────────────────────────
|
|
140
|
+
const deadPathSection = [
|
|
141
|
+
'## 4. Dead Path Detection',
|
|
142
|
+
'',
|
|
143
|
+
'Analyze flow logic for unreachable or redundant paths:',
|
|
144
|
+
'',
|
|
145
|
+
'### Unreachable Conditions',
|
|
146
|
+
'- If/Else branches where the condition is always true or always false',
|
|
147
|
+
' (e.g., checking `current.state == "resolved"` in a flow triggered only on insert)',
|
|
148
|
+
'- Decision tables where a row\'s condition is a subset of a previous row\'s condition',
|
|
149
|
+
' (the later row is never reached due to first-match semantics)',
|
|
150
|
+
'- Conditions that reference fields not present on the trigger table',
|
|
151
|
+
'',
|
|
152
|
+
'### Redundant Actions',
|
|
153
|
+
'- Actions that set a field value, followed by another action that overwrites the same field',
|
|
154
|
+
'- Look Up Records actions whose results are never used by subsequent actions',
|
|
155
|
+
'- Log actions left from debugging that serve no production purpose',
|
|
156
|
+
'',
|
|
157
|
+
'### Orphaned Branches',
|
|
158
|
+
'- If/Else structures where one branch has no actions (empty branch)',
|
|
159
|
+
'- Parallel branches where one branch always completes instantly (no-op)',
|
|
160
|
+
'- Flow stages with no actions between them',
|
|
161
|
+
'',
|
|
162
|
+
'### Inactive Elements',
|
|
163
|
+
'- Actions within a flow that are individually disabled/inactive',
|
|
164
|
+
'- Subflow calls where the target subflow is inactive',
|
|
165
|
+
'- Trigger conditions that can never match (contradictory filters)',
|
|
166
|
+
'',
|
|
167
|
+
'**Output per finding:**',
|
|
168
|
+
'| Flow Name | Dead Path Type | Location | Evidence | Recommendation |',
|
|
169
|
+
'|-----------|---------------|----------|----------|----------------|',
|
|
170
|
+
];
|
|
171
|
+
// ─── Section 5: Async Issues ─────────────────────────────────────────────
|
|
172
|
+
const asyncSection = [
|
|
173
|
+
'## 5. Async Issues',
|
|
174
|
+
'',
|
|
175
|
+
'Analyze synchronous vs. asynchronous execution patterns:',
|
|
176
|
+
'',
|
|
177
|
+
'### Should Be Async But Is Not',
|
|
178
|
+
'- Flows with **REST/SOAP callouts** running synchronously — external API latency blocks the user',
|
|
179
|
+
'- Flows with **email/notification** actions running synchronously — SMTP delays affect response time',
|
|
180
|
+
'- Flows with **heavy GlideRecord operations** (updating 100+ records) running synchronously',
|
|
181
|
+
'- Flows triggered by user actions (form submit) that take > 5 seconds to complete',
|
|
182
|
+
'',
|
|
183
|
+
'### Should Be Sync But Is Async',
|
|
184
|
+
'- Flows that set field values on the triggering record but run asynchronously — the values',
|
|
185
|
+
' will not be available when the record is saved (race condition)',
|
|
186
|
+
'- Flows that validate data and should abort the transaction but run async (validation is skipped)',
|
|
187
|
+
'- Flows that must complete before downstream processes depend on their output',
|
|
188
|
+
'',
|
|
189
|
+
'### Async Ordering Issues',
|
|
190
|
+
'- Multiple async flows on the same table — execution order is not guaranteed',
|
|
191
|
+
'- Async flows that depend on each other\'s output but have no sequencing mechanism',
|
|
192
|
+
'- Async flows competing for the same record (concurrent update conflicts)',
|
|
193
|
+
'',
|
|
194
|
+
'### Wait/Timer Misuse',
|
|
195
|
+
'- Flows using Wait For Condition with no timeout — can wait indefinitely',
|
|
196
|
+
'- Timer triggers with intervals < 1 minute (excessive system load)',
|
|
197
|
+
'- Flows combining timers with record queries in a polling pattern (use events instead)',
|
|
198
|
+
'',
|
|
199
|
+
'**Output per finding:**',
|
|
200
|
+
'| Flow Name | Async Issue | Current Mode | Recommended Mode | Impact | Recommendation |',
|
|
201
|
+
'|-----------|-------------|--------------|------------------|--------|----------------|',
|
|
202
|
+
];
|
|
203
|
+
// ─── Section 6: Security ─────────────────────────────────────────────────
|
|
204
|
+
const securitySection = [
|
|
205
|
+
'## 6. Security Review',
|
|
206
|
+
'',
|
|
207
|
+
'Analyze flows for security risks:',
|
|
208
|
+
'',
|
|
209
|
+
'### Missing Role Checks',
|
|
210
|
+
'- Flows triggered by record changes on sensitive tables (sys_user, sys_user_has_role,',
|
|
211
|
+
' sys_security_acl) without verifying the actor\'s role',
|
|
212
|
+
'- Flows that modify security-related tables (ACLs, roles, users) without admin checks',
|
|
213
|
+
'- Flows invocable via REST trigger without authentication requirements',
|
|
214
|
+
'',
|
|
215
|
+
'### Data Exposure',
|
|
216
|
+
'- Notification actions in flows that include sensitive fields in email body (password,',
|
|
217
|
+
' SSN, salary, credit card, API keys)',
|
|
218
|
+
'- Flows that log sensitive data via Log actions (visible in flow execution history)',
|
|
219
|
+
'- Flows that pass sensitive data to external systems without encryption',
|
|
220
|
+
'',
|
|
221
|
+
'### Privilege Escalation',
|
|
222
|
+
'- Flows running as "System" that could be exploited to perform admin-level operations',
|
|
223
|
+
' triggered by non-admin users',
|
|
224
|
+
'- Subflows with elevated privileges called from flows with lower privilege requirements',
|
|
225
|
+
'- Flows that create or modify user roles, group memberships, or ACLs',
|
|
226
|
+
'',
|
|
227
|
+
'### Script Actions in Flows',
|
|
228
|
+
'- Inline Script steps with `eval()`, `GlideEvaluator`, or `Packages.java.*`',
|
|
229
|
+
'- Script steps with hardcoded credentials or sys_ids',
|
|
230
|
+
'- Script steps using `setWorkflow(false)` to bypass other business rules',
|
|
231
|
+
'',
|
|
232
|
+
'**Output per finding:**',
|
|
233
|
+
'| Flow Name | Security Issue | Severity | Evidence | Risk | Recommendation |',
|
|
234
|
+
'|-----------|---------------|----------|----------|------|----------------|',
|
|
235
|
+
];
|
|
236
|
+
// ─── Section 7: Best Practices ───────────────────────────────────────────
|
|
237
|
+
const bestPracticesSection = [
|
|
238
|
+
'## 7. Best Practices Audit',
|
|
239
|
+
'',
|
|
240
|
+
'### Naming Conventions',
|
|
241
|
+
'- Flows without a clear naming pattern — recommend: `[Scope] - [Table] - [Trigger] - [Purpose]`',
|
|
242
|
+
' (e.g., `ITSM - Incident - Before Save - Set Priority`)',
|
|
243
|
+
'- Subflows without the "Subflow" or "SF" prefix/suffix for easy identification',
|
|
244
|
+
'- Actions with generic names like "Script Step 1", "Do Something"',
|
|
245
|
+
'',
|
|
246
|
+
'### Documentation',
|
|
247
|
+
'- Flows without descriptions — the description field should explain the business purpose',
|
|
248
|
+
'- Flows with undocumented inline scripts (no comments explaining logic)',
|
|
249
|
+
'- Complex decision logic without comments on what each branch handles',
|
|
250
|
+
'',
|
|
251
|
+
'### Version Control',
|
|
252
|
+
'- Flows not captured in an update set or source control',
|
|
253
|
+
'- Flows with many versions but no clear changelog',
|
|
254
|
+
'- Flows modified directly in production without a change record',
|
|
255
|
+
'',
|
|
256
|
+
'### Subflow Reuse',
|
|
257
|
+
'- Repeated action sequences (3+ identical actions) that should be extracted into subflows',
|
|
258
|
+
'- Flows duplicating logic that already exists in a subflow',
|
|
259
|
+
'- Subflows that are too specific — contain hardcoded values instead of accepting inputs',
|
|
260
|
+
'',
|
|
261
|
+
'### Trigger Hygiene',
|
|
262
|
+
'- Flows with overly broad triggers (e.g., "on update" with no condition — fires on EVERY update)',
|
|
263
|
+
'- Flows with conditions that should use "Run Trigger Once" to prevent re-firing',
|
|
264
|
+
'- Multiple flows with the same trigger and condition (candidates for merging)',
|
|
265
|
+
'',
|
|
266
|
+
'**Output per finding:**',
|
|
267
|
+
'| Flow Name | Best Practice Violation | Category | Recommendation |',
|
|
268
|
+
'|-----------|------------------------|----------|----------------|',
|
|
269
|
+
];
|
|
270
|
+
// ─── Section 8: Execution History ────────────────────────────────────────
|
|
271
|
+
const executionSection = [
|
|
272
|
+
'## 8. Execution History Analysis',
|
|
273
|
+
'',
|
|
274
|
+
'Use `list_flow_executions`, `get_flow_execution`, and `get_flow_error_log` to analyze:',
|
|
275
|
+
'',
|
|
276
|
+
'### Failure Rates',
|
|
277
|
+
'- Flows with failure rate > 5% over the last 30 days — investigate root cause',
|
|
278
|
+
'- Flows with failure rate > 25% — likely broken, should be disabled pending fix',
|
|
279
|
+
'- Flows that started failing recently (new failures in last 7 days)',
|
|
280
|
+
'- Subflows that are a common failure point across multiple parent flows',
|
|
281
|
+
'',
|
|
282
|
+
'### Duration Analysis',
|
|
283
|
+
'- Average, median, and P95 execution time per flow',
|
|
284
|
+
'- Flows where execution time has increased > 50% over the last 30 days (degrading)',
|
|
285
|
+
'- Flows that frequently hit the platform timeout (300 seconds for sync, 900 for async)',
|
|
286
|
+
'',
|
|
287
|
+
'### Resource Consumption',
|
|
288
|
+
'- Flows with the highest execution counts (top 10 most-executed)',
|
|
289
|
+
'- Total flow execution volume per day — are we approaching platform limits?',
|
|
290
|
+
'- Flows consuming the most total execution time (count * average duration)',
|
|
291
|
+
'',
|
|
292
|
+
'### Error Patterns',
|
|
293
|
+
'- Most common error messages across all flows',
|
|
294
|
+
'- Errors correlated with time of day (batch processing conflicts)',
|
|
295
|
+
'- Errors correlated with specific users or integrations',
|
|
296
|
+
'',
|
|
297
|
+
'**Output:**',
|
|
298
|
+
'| Flow Name | Executions (30d) | Failures (30d) | Failure Rate | Avg Duration | P95 Duration | Trend |',
|
|
299
|
+
'|-----------|------------------|----------------|--------------|--------------|--------------|-------|',
|
|
300
|
+
];
|
|
301
|
+
// ─── Build sections based on focus ───────────────────────────────────────
|
|
302
|
+
let sections;
|
|
303
|
+
switch (focus) {
|
|
304
|
+
case 'errors':
|
|
305
|
+
sections = [inventorySection, errorSection, deadPathSection, executionSection];
|
|
306
|
+
break;
|
|
307
|
+
case 'performance':
|
|
308
|
+
sections = [inventorySection, performanceSection, asyncSection, executionSection];
|
|
309
|
+
break;
|
|
310
|
+
case 'security':
|
|
311
|
+
sections = [inventorySection, securitySection];
|
|
312
|
+
break;
|
|
313
|
+
default:
|
|
314
|
+
sections = [
|
|
315
|
+
inventorySection,
|
|
316
|
+
errorSection,
|
|
317
|
+
performanceSection,
|
|
318
|
+
deadPathSection,
|
|
319
|
+
asyncSection,
|
|
320
|
+
securitySection,
|
|
321
|
+
bestPracticesSection,
|
|
322
|
+
executionSection,
|
|
323
|
+
];
|
|
324
|
+
}
|
|
325
|
+
// ─── Report Format ───────────────────────────────────────────────────────
|
|
326
|
+
const reportFormat = [
|
|
327
|
+
'## Flow Audit Report Format',
|
|
328
|
+
'',
|
|
329
|
+
'Compile ALL findings into this structure:',
|
|
330
|
+
'',
|
|
331
|
+
'```',
|
|
332
|
+
'FLOW DESIGNER AUDIT REPORT',
|
|
333
|
+
'==========================',
|
|
334
|
+
`Scope: ${scopeLabel}`,
|
|
335
|
+
`Focus: ${focusDescription}`,
|
|
336
|
+
'Date: [current date]',
|
|
337
|
+
'',
|
|
338
|
+
'EXECUTIVE SUMMARY',
|
|
339
|
+
'- Total flows audited: X',
|
|
340
|
+
'- Total subflows audited: X',
|
|
341
|
+
'- Critical findings: X',
|
|
342
|
+
'- High findings: X',
|
|
343
|
+
'- Medium findings: X',
|
|
344
|
+
'- Low findings: X',
|
|
345
|
+
'- Overall health: [Healthy / Needs Attention / Critical]',
|
|
346
|
+
'',
|
|
347
|
+
'DETAILED FINDINGS',
|
|
348
|
+
'-----------------',
|
|
349
|
+
'Each finding MUST include:',
|
|
350
|
+
' Finding ID: FLOW-XXXX',
|
|
351
|
+
' Severity: Critical / High / Medium / Low',
|
|
352
|
+
' Category: Error Handling / Performance / Dead Path / Async / Security / Best Practice',
|
|
353
|
+
' Flow: [name] (sys_id)',
|
|
354
|
+
' Details: [specific issue found]',
|
|
355
|
+
' Evidence: [action name, execution log, or configuration detail]',
|
|
356
|
+
' Impact: [what happens if ignored]',
|
|
357
|
+
' Recommendation: [specific fix]',
|
|
358
|
+
'',
|
|
359
|
+
'SEVERITY DEFINITIONS',
|
|
360
|
+
' CRITICAL — Flow failure causes data loss or business process outage',
|
|
361
|
+
' HIGH — Flow has errors/performance issues affecting users',
|
|
362
|
+
' MEDIUM — Flow works but violates best practices or has hidden risks',
|
|
363
|
+
' LOW — Cosmetic or hygiene issue; address during next maintenance',
|
|
364
|
+
'```',
|
|
365
|
+
];
|
|
366
|
+
return [
|
|
367
|
+
{
|
|
368
|
+
role: 'assistant',
|
|
369
|
+
content: {
|
|
370
|
+
type: 'text',
|
|
371
|
+
text: [
|
|
372
|
+
'# Capability: Flow Designer Audit',
|
|
373
|
+
'',
|
|
374
|
+
`**Scope:** ${scopeLabel}`,
|
|
375
|
+
`**Focus:** ${focusDescription}`,
|
|
376
|
+
'',
|
|
377
|
+
'This capability performs a comprehensive audit of Flow Designer flows and subflows.',
|
|
378
|
+
'I analyze flow structure, error handling, performance characteristics, execution history,',
|
|
379
|
+
'and adherence to best practices. The audit covers both Flow Designer (sys_hub_flow) and',
|
|
380
|
+
'legacy Workflow Editor (wf_workflow) artifacts.',
|
|
381
|
+
'',
|
|
382
|
+
'**Platform Knowledge:**',
|
|
383
|
+
'- Flow Designer execution limit: ~100 actions per flow, 500 subflow call depth',
|
|
384
|
+
'- Flows execute AFTER business rules in the save pipeline',
|
|
385
|
+
'- Synchronous flows block the user transaction; async flows run in the background',
|
|
386
|
+
'- Flow Designer replaced Workflow Editor starting in Madrid; legacy workflows should be migrated',
|
|
387
|
+
'- Subflows can be reused across flows but add execution overhead per invocation',
|
|
388
|
+
'- Flow execution history is stored in `sys_flow_context` and `sys_hub_action_execution`',
|
|
389
|
+
'',
|
|
390
|
+
...sections.flatMap(s => [...s, '']),
|
|
391
|
+
...reportFormat,
|
|
392
|
+
'',
|
|
393
|
+
'---',
|
|
394
|
+
'',
|
|
395
|
+
'Beginning flow audit. Every finding must include its Finding ID, severity,',
|
|
396
|
+
'category, concrete evidence, and a specific recommendation.',
|
|
397
|
+
].join('\n'),
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
role: 'user',
|
|
402
|
+
content: {
|
|
403
|
+
type: 'text',
|
|
404
|
+
text: scope === 'all'
|
|
405
|
+
? `Run a comprehensive Flow Designer audit across the entire instance. Focus: ${focus}. Analyze every flow and subflow and give me a structured report with severity ratings.`
|
|
406
|
+
: `Run a Flow Designer audit for scope \`${scope}\`. Focus: ${focus}. Analyze every flow and subflow in this scope and give me a structured report with severity ratings.`,
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
];
|
|
410
|
+
},
|
|
411
|
+
};
|
|
412
|
+
export default capability;
|
|
413
|
+
//# sourceMappingURL=review-flows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-flows.js","sourceRoot":"","sources":["../../../src/prompts/capabilities/review-flows.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAyB;IACvC,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,wGAAwG;IAC1G,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EACT,uFAAuF;YACzF,QAAQ,EAAE,KAAK;SAChB;QACD;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EACT,2EAA2E;YAC7E,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,gBAAgB,EAAE;QAChB,eAAe;QACf,YAAY;QACZ,UAAU;QACV,eAAe;QACf,aAAa;QACb,sBAAsB;QACtB,oBAAoB;QACpB,oBAAoB;KACrB;IAED,WAAW,CAAC,IAAI;QACd,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,KAAK,CAAC;QACnC,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,KAAK,CAAC;QAEnC,MAAM,UAAU,GACd,KAAK,KAAK,KAAK;YACb,CAAC,CAAC,4BAA4B;YAC9B,CAAC,CAAC,wBAAwB,KAAK,IAAI,CAAC;QAExC,MAAM,UAAU,GAA2B;YACzC,GAAG,EAAE,4DAA4D;YACjE,MAAM,EAAE,kCAAkC;YAC1C,WAAW,EAAE,kDAAkD;YAC/D,QAAQ,EAAE,0CAA0C;SACrD,CAAC;QAEF,MAAM,gBAAgB,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,iBAAiB,KAA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E,yEAAyE;YACzE,KAAK;SACN,CAAC;QAEF,OAAO;YACL;gBACE,IAAI,EAAE,WAAoB;gBAC1B,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE;wBACJ,mCAAmC;wBACnC,EAAE;wBACF,cAAc,UAAU,EAAE;wBAC1B,cAAc,gBAAgB,EAAE;wBAChC,EAAE;wBACF,qFAAqF;wBACrF,2FAA2F;wBAC3F,yFAAyF;wBACzF,iDAAiD;wBACjD,EAAE;wBACF,yBAAyB;wBACzB,gFAAgF;wBAChF,2DAA2D;wBAC3D,mFAAmF;wBACnF,kGAAkG;wBAClG,iFAAiF;wBACjF,yFAAyF;wBACzF,EAAE;wBACF,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;wBACpC,GAAG,YAAY;wBACf,EAAE;wBACF,KAAK;wBACL,EAAE;wBACF,4EAA4E;wBAC5E,6DAA6D;qBAC9D,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;YACD;gBACE,IAAI,EAAE,MAAe;gBACrB,OAAO,EAAE;oBACP,IAAI,EAAE,MAAe;oBACrB,IAAI,EACF,KAAK,KAAK,KAAK;wBACb,CAAC,CAAC,8EAA8E,KAAK,yFAAyF;wBAC9K,CAAC,CAAC,yCAAyC,KAAK,cAAc,KAAK,uGAAuG;iBAC/K;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-scripts.d.ts","sourceRoot":"","sources":["../../../src/prompts/capabilities/review-scripts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,QAAA,MAAM,UAAU,EAAE,oBAkKjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|