nowaikit 2.6.0 → 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/package.json +11 -3
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
const capability = {
|
|
2
|
+
name: 'build-app',
|
|
3
|
+
title: 'Build Scoped App',
|
|
4
|
+
description: 'Build a complete scoped application from scratch — tables, scripts, ACLs, catalog item, tests, and update set packaging',
|
|
5
|
+
category: 'build',
|
|
6
|
+
arguments: [
|
|
7
|
+
{
|
|
8
|
+
name: 'name',
|
|
9
|
+
description: 'application name',
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'description',
|
|
14
|
+
description: 'what the app does',
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'scope',
|
|
19
|
+
description: 'scope prefix e.g. x_myco',
|
|
20
|
+
required: false,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
recommendedTools: [
|
|
24
|
+
'create_scoped_app',
|
|
25
|
+
'create_business_rule',
|
|
26
|
+
'create_script_include',
|
|
27
|
+
'create_client_script',
|
|
28
|
+
'create_ui_policy',
|
|
29
|
+
'create_ui_action',
|
|
30
|
+
'create_acl',
|
|
31
|
+
'create_catalog_item',
|
|
32
|
+
'create_update_set',
|
|
33
|
+
'run_atf_suite',
|
|
34
|
+
],
|
|
35
|
+
buildPrompt(args = {}) {
|
|
36
|
+
const name = args.name ?? '<not provided>';
|
|
37
|
+
const description = args.description ?? '<not provided>';
|
|
38
|
+
const scope = args.scope ?? 'x_custom';
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
role: 'user',
|
|
42
|
+
content: {
|
|
43
|
+
type: 'text',
|
|
44
|
+
text: [
|
|
45
|
+
`Build a complete scoped application: **${name}**`,
|
|
46
|
+
`**Description:** ${description}`,
|
|
47
|
+
`**Scope:** ${scope}`,
|
|
48
|
+
'',
|
|
49
|
+
'Execute all 7 phases below. After each phase, summarize what was created (name, sys_id, key configuration) before proceeding to the next.',
|
|
50
|
+
'',
|
|
51
|
+
'---',
|
|
52
|
+
'',
|
|
53
|
+
'## Phase 1 — App Setup',
|
|
54
|
+
'',
|
|
55
|
+
'1. **Create the scoped application** using **create_scoped_app** with:',
|
|
56
|
+
` - Name: "${name}"`,
|
|
57
|
+
` - Scope: "${scope}"`,
|
|
58
|
+
` - Description: "${description}"`,
|
|
59
|
+
'2. **Create an update set** using **create_update_set** to track all artifacts.',
|
|
60
|
+
'3. Set the update set as current so all subsequent artifacts are captured.',
|
|
61
|
+
'4. Document the application metadata: sys_id, scope, version (start at 1.0.0).',
|
|
62
|
+
'',
|
|
63
|
+
'---',
|
|
64
|
+
'',
|
|
65
|
+
'## Phase 2 — Data Model',
|
|
66
|
+
'',
|
|
67
|
+
`Analyze the description ("${description}") and design the data model:`,
|
|
68
|
+
'',
|
|
69
|
+
'1. **Identify tables** needed. For each table:',
|
|
70
|
+
' - Define fields with types, max lengths, default values, and reference targets.',
|
|
71
|
+
' - Include standard fields: active (boolean), short_description (string), assigned_to (reference:sys_user), state (choice).',
|
|
72
|
+
' - Define choice lists for state/category fields.',
|
|
73
|
+
'2. **Define relationships:**',
|
|
74
|
+
' - One-to-many: use reference fields.',
|
|
75
|
+
' - Many-to-many: use M2M tables (m2m_* naming convention).',
|
|
76
|
+
' - Parent-child: use the parent field pattern.',
|
|
77
|
+
'3. **Create tables** with appropriate extends (if any — e.g., extend task for workflow-enabled tables).',
|
|
78
|
+
'4. Output an entity-relationship summary showing all tables, fields, and relationships.',
|
|
79
|
+
'',
|
|
80
|
+
'---',
|
|
81
|
+
'',
|
|
82
|
+
'## Phase 3 — Server-Side Logic',
|
|
83
|
+
'',
|
|
84
|
+
'For each table, create the necessary server-side artifacts:',
|
|
85
|
+
'',
|
|
86
|
+
'### Business Rules',
|
|
87
|
+
'Use **create_business_rule** for each:',
|
|
88
|
+
'- **Before insert/update:** field validation, default value population, calculated fields.',
|
|
89
|
+
'- **After insert/update:** cascading updates to related records, event generation, notification triggers.',
|
|
90
|
+
'- **Async:** heavy operations (web service calls, batch processing).',
|
|
91
|
+
'- Apply recursion guards on after rules, `setAbortAction` on validation rules.',
|
|
92
|
+
'',
|
|
93
|
+
'### Script Includes',
|
|
94
|
+
'Use **create_script_include** for each:',
|
|
95
|
+
'- **Utility class** for the app — encapsulate reusable business logic.',
|
|
96
|
+
'- **Client-callable Script Include** (extends AbstractAjaxProcessor) for any server data the UI needs.',
|
|
97
|
+
'- Follow the Class.create() / prototype pattern.',
|
|
98
|
+
'- Include JSDoc for all public methods.',
|
|
99
|
+
'',
|
|
100
|
+
'### Scheduled Jobs (if applicable)',
|
|
101
|
+
'- Identify any periodic tasks: cleanup, sync, report generation.',
|
|
102
|
+
'- Document the schedule (daily, weekly, on-demand) and the script logic.',
|
|
103
|
+
'',
|
|
104
|
+
'---',
|
|
105
|
+
'',
|
|
106
|
+
'## Phase 4 — Client-Side UX',
|
|
107
|
+
'',
|
|
108
|
+
'### Client Scripts',
|
|
109
|
+
'Use **create_client_script** for each:',
|
|
110
|
+
'- **onChange:** dynamic field behavior (show/hide, set mandatory, populate references).',
|
|
111
|
+
'- **onLoad:** form initialization, user-specific defaults.',
|
|
112
|
+
'- **onSubmit:** client-side validation (always backed by server-side validation).',
|
|
113
|
+
'- Use GlideAjax to call the Script Includes from Phase 3 — never use synchronous GlideRecord.',
|
|
114
|
+
'',
|
|
115
|
+
'### UI Policies',
|
|
116
|
+
'Use **create_ui_policy** for each:',
|
|
117
|
+
'- Simple show/hide/mandatory/read-only rules that do NOT require scripting.',
|
|
118
|
+
'- Prefer UI Policies over client scripts for declarative field behavior.',
|
|
119
|
+
'',
|
|
120
|
+
'### UI Actions',
|
|
121
|
+
'Use **create_ui_action** for each:',
|
|
122
|
+
'- Custom form buttons (e.g., "Approve", "Escalate", "Generate Report").',
|
|
123
|
+
'- List context-menu actions for bulk operations.',
|
|
124
|
+
'- Include both client-side and server-side script sections where appropriate.',
|
|
125
|
+
'',
|
|
126
|
+
'---',
|
|
127
|
+
'',
|
|
128
|
+
'## Phase 5 — Security',
|
|
129
|
+
'',
|
|
130
|
+
'Design a comprehensive security model:',
|
|
131
|
+
'',
|
|
132
|
+
'### Roles',
|
|
133
|
+
`Define application roles (e.g., ${scope}.user, ${scope}.admin, ${scope}.manager):`,
|
|
134
|
+
'- Document what each role grants access to.',
|
|
135
|
+
'- Map roles to user personas.',
|
|
136
|
+
'',
|
|
137
|
+
'### ACLs (Access Control Lists)',
|
|
138
|
+
'Use **create_acl** for each. Create three layers:',
|
|
139
|
+
'',
|
|
140
|
+
'1. **Table-level ACLs:**',
|
|
141
|
+
' - Create: who can create records.',
|
|
142
|
+
' - Read: who can view the table/list.',
|
|
143
|
+
' - Write: who can edit records.',
|
|
144
|
+
' - Delete: who can delete records.',
|
|
145
|
+
'',
|
|
146
|
+
'2. **Field-level ACLs:**',
|
|
147
|
+
' - Protect sensitive fields (e.g., approval status, financial data).',
|
|
148
|
+
' - Make certain fields read-only for non-admin roles.',
|
|
149
|
+
'',
|
|
150
|
+
'3. **Row-level ACLs (conditions/scripts):**',
|
|
151
|
+
' - Users can only see records assigned to them or their group.',
|
|
152
|
+
' - Managers can see all records in their department.',
|
|
153
|
+
' - Admins can see everything.',
|
|
154
|
+
'',
|
|
155
|
+
'Test each ACL mentally: "Can user X with role Y perform operation Z on this record?" — document the expected results.',
|
|
156
|
+
'',
|
|
157
|
+
'---',
|
|
158
|
+
'',
|
|
159
|
+
'## Phase 6 — Service Catalog',
|
|
160
|
+
'',
|
|
161
|
+
'Create a catalog item so end-users can request/interact with the application:',
|
|
162
|
+
'',
|
|
163
|
+
'1. **Catalog Item** using **create_catalog_item**:',
|
|
164
|
+
` - Name: "Request ${name}"`,
|
|
165
|
+
' - Category: choose the appropriate category.',
|
|
166
|
+
' - Description: user-facing explanation of what they are requesting.',
|
|
167
|
+
'',
|
|
168
|
+
'2. **Variables:**',
|
|
169
|
+
' - Define catalog variables (text, reference, select box, checkbox, etc.).',
|
|
170
|
+
' - Set mandatory flags and validation (regex, reference qualifiers).',
|
|
171
|
+
' - Organize with variable sets if there are reusable field groups.',
|
|
172
|
+
'',
|
|
173
|
+
'3. **Approval Rules:**',
|
|
174
|
+
' - Define who approves requests (manager, specific group, auto-approve for certain roles).',
|
|
175
|
+
' - Multi-level approval if needed.',
|
|
176
|
+
'',
|
|
177
|
+
'4. **Fulfillment:**',
|
|
178
|
+
' - Define what happens after approval: record creation, task generation, notification.',
|
|
179
|
+
' - Use a catalog task or flow for fulfillment logic.',
|
|
180
|
+
'',
|
|
181
|
+
'---',
|
|
182
|
+
'',
|
|
183
|
+
'## Phase 7 — Quality & Packaging',
|
|
184
|
+
'',
|
|
185
|
+
'### Code Review',
|
|
186
|
+
'Review ALL artifacts created in Phases 2–6:',
|
|
187
|
+
'- No hardcoded sys_ids (use `gs.getProperty()` or reference qualifiers).',
|
|
188
|
+
'- No N+1 query patterns in business rules or script includes.',
|
|
189
|
+
'- No `eval()` or dynamic script execution.',
|
|
190
|
+
'- Consistent naming convention: `${scope}_table_name`, `${scope}.RoleName`.',
|
|
191
|
+
'- All scripts have JSDoc comment blocks.',
|
|
192
|
+
'- Client scripts do not expose sensitive logic (security checks are server-side).',
|
|
193
|
+
'',
|
|
194
|
+
'### Test Plan',
|
|
195
|
+
'Generate a comprehensive ATF test suite covering:',
|
|
196
|
+
'- Business rule behavior (before/after/async for each table).',
|
|
197
|
+
'- Script include methods (unit tests for each public method).',
|
|
198
|
+
'- Client script behavior (form interactions via ATF client-side steps).',
|
|
199
|
+
'- ACL enforcement (role-based access tests).',
|
|
200
|
+
'- Catalog item flow (request → approval → fulfillment).',
|
|
201
|
+
'- End-to-end integration test (full lifecycle of a record).',
|
|
202
|
+
'',
|
|
203
|
+
'Use **run_atf_suite** to execute the suite and report results.',
|
|
204
|
+
'',
|
|
205
|
+
'### Update Set Packaging',
|
|
206
|
+
'Ensure the update set contains ALL artifacts. Provide:',
|
|
207
|
+
'- Complete artifact inventory (table: name → sys_id).',
|
|
208
|
+
'- Installation instructions.',
|
|
209
|
+
'- Configuration guide (properties to set, roles to assign).',
|
|
210
|
+
'- Known limitations or prerequisites.',
|
|
211
|
+
'',
|
|
212
|
+
'---',
|
|
213
|
+
'',
|
|
214
|
+
'## Final Deliverable',
|
|
215
|
+
'',
|
|
216
|
+
'After completing all 7 phases, provide a summary report:',
|
|
217
|
+
'',
|
|
218
|
+
'| Category | Count | Details |',
|
|
219
|
+
'|----------|-------|---------|',
|
|
220
|
+
'| Tables | N | list |',
|
|
221
|
+
'| Business Rules | N | list |',
|
|
222
|
+
'| Script Includes | N | list |',
|
|
223
|
+
'| Client Scripts | N | list |',
|
|
224
|
+
'| UI Policies | N | list |',
|
|
225
|
+
'| UI Actions | N | list |',
|
|
226
|
+
'| ACLs | N | list |',
|
|
227
|
+
'| Roles | N | list |',
|
|
228
|
+
'| Catalog Items | N | list |',
|
|
229
|
+
'| ATF Tests | N | pass/fail |',
|
|
230
|
+
'| Update Set | sys_id | name |',
|
|
231
|
+
].join('\n'),
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
];
|
|
235
|
+
},
|
|
236
|
+
};
|
|
237
|
+
export default capability;
|
|
238
|
+
//# sourceMappingURL=build-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-app.js","sourceRoot":"","sources":["../../../src/prompts/capabilities/build-app.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAyB;IACvC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,kBAAkB;IACzB,WAAW,EACT,yHAAyH;IAC3H,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,kBAAkB;YAC/B,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,mBAAmB;YAChC,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,gBAAgB,EAAE;QAChB,mBAAmB;QACnB,sBAAsB;QACtB,uBAAuB;QACvB,sBAAsB;QACtB,kBAAkB;QAClB,kBAAkB;QAClB,YAAY;QACZ,qBAAqB;QACrB,mBAAmB;QACnB,eAAe;KAChB;IACD,WAAW,CAAC,IAAI,GAAG,EAAE;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,gBAAgB,CAAC;QAC3C,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,IAAI,gBAAgB,CAAC;QACzD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC;QAEvC,OAAO;YACL;gBACE,IAAI,EAAE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/D,yEAAyE;wBACzE,8CAA8C;wBAC9C,yDAAyD;wBACzD,6DAA6D;wBAC7D,EAAE;wBACF,gEAAgE;wBAChE,EAAE;wBACF,0BAA0B;wBAC1B,wDAAwD;wBACxD,uDAAuD;wBACvD,8BAA8B;wBAC9B,6DAA6D;wBAC7D,uCAAuC;wBACvC,EAAE;wBACF,KAAK;wBACL,EAAE;wBACF,sBAAsB;wBACtB,EAAE;wBACF,0DAA0D;wBAC1D,EAAE;wBACF,gCAAgC;wBAChC,gCAAgC;wBAChC,uBAAuB;wBACvB,+BAA+B;wBAC/B,gCAAgC;wBAChC,+BAA+B;wBAC/B,4BAA4B;wBAC5B,2BAA2B;wBAC3B,qBAAqB;wBACrB,sBAAsB;wBACtB,8BAA8B;wBAC9B,+BAA+B;wBAC/B,gCAAgC;qBACjC,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-business-rule.d.ts","sourceRoot":"","sources":["../../../src/prompts/capabilities/build-business-rule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,QAAA,MAAM,UAAU,EAAE,oBA4FjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const capability = {
|
|
2
|
+
name: 'build-business-rule',
|
|
3
|
+
title: 'Build Business Rule',
|
|
4
|
+
description: 'Guided business rule creation — understand requirement, check existing rules, generate, review, create, and test',
|
|
5
|
+
category: 'build',
|
|
6
|
+
arguments: [
|
|
7
|
+
{
|
|
8
|
+
name: 'description',
|
|
9
|
+
description: 'what the business rule should do in plain language',
|
|
10
|
+
required: true,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'table',
|
|
14
|
+
description: 'target table e.g. incident, change_request',
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: 'when',
|
|
19
|
+
description: 'before, after, async, display. Default: before',
|
|
20
|
+
required: false,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
recommendedTools: [
|
|
24
|
+
'create_business_rule',
|
|
25
|
+
'list_business_rules',
|
|
26
|
+
'get_business_rule',
|
|
27
|
+
'get_table_schema',
|
|
28
|
+
'create_script_include',
|
|
29
|
+
'query_records',
|
|
30
|
+
],
|
|
31
|
+
buildPrompt(args = {}) {
|
|
32
|
+
const desc = args.description ?? '<not provided>';
|
|
33
|
+
const table = args.table ?? '<not provided>';
|
|
34
|
+
const when = args.when ?? 'before';
|
|
35
|
+
return [
|
|
36
|
+
{
|
|
37
|
+
role: 'user',
|
|
38
|
+
content: {
|
|
39
|
+
type: 'text',
|
|
40
|
+
text: [
|
|
41
|
+
`Build a business rule for the **${table}** table.`,
|
|
42
|
+
`**When:** ${when}`,
|
|
43
|
+
`**Requirement:** ${desc}`,
|
|
44
|
+
'',
|
|
45
|
+
'Follow these steps exactly:',
|
|
46
|
+
'',
|
|
47
|
+
'### Step 1 — Understand the Requirement',
|
|
48
|
+
`Restate the requirement in your own words. Identify the trigger event (insert, update, delete, query), the "when" timing (${when}), and any conditions that should gate execution. Call out ambiguities and ask for clarification if needed.`,
|
|
49
|
+
'',
|
|
50
|
+
'### Step 2 — Check Existing Rules on the Table',
|
|
51
|
+
`Use **list_business_rules** filtered to table="${table}" to retrieve all active business rules. Summarize them in a table (name, when, order, description). Flag any that overlap with or could conflict with the new requirement. If a conflict exists, recommend a resolution strategy (modify existing vs. create new, adjust execution order).`,
|
|
52
|
+
'',
|
|
53
|
+
'### Step 3 — Check Table Schema',
|
|
54
|
+
`Use **get_table_schema** for "${table}". Verify every field name referenced in the requirement actually exists. List field types and max lengths for fields the script will read or write. If a referenced field does not exist, stop and report the issue.`,
|
|
55
|
+
'',
|
|
56
|
+
'### Step 4 — Generate the Script',
|
|
57
|
+
'Write the business rule script applying these patterns:',
|
|
58
|
+
'- **Recursion guard** (after rules): wrap in `if (current.update()) { ... }` is NOT enough — use `current.autoSysFields(false)` or a scratchpad flag (`gs.getSession().getClientData(...)`) to prevent infinite loops.',
|
|
59
|
+
'- **Abort action** (before rules for validation): use `current.setAbortAction(true)` and `gs.addErrorMessage(...)` for user-facing validation.',
|
|
60
|
+
'- **Async** for heavy work: if the logic involves web-service callouts, large queries, or email sends, recommend an async business rule or an event + Script Include pattern.',
|
|
61
|
+
'- Use `gs.log()` / `gs.debug()` for troubleshooting, never `gs.print()`.',
|
|
62
|
+
'- Always scope field access with `current.getValue(\'field\')` / `current.setValue(\'field\', value)` for clarity.',
|
|
63
|
+
'- Include JSDoc-style comment block at the top: purpose, author, date, related requirement.',
|
|
64
|
+
'',
|
|
65
|
+
'### Step 5 — Review for Security & Performance',
|
|
66
|
+
'Audit the generated script:',
|
|
67
|
+
'- No GlideRecord queries inside loops (N+1 anti-pattern).',
|
|
68
|
+
'- No hardcoded sys_ids — use properties or sys_properties.',
|
|
69
|
+
'- No `eval()` or dynamic script execution.',
|
|
70
|
+
'- Validate that `gs.hasRole()` checks are present if the rule should be role-gated.',
|
|
71
|
+
'- Confirm the execution order is appropriate relative to existing rules found in Step 2.',
|
|
72
|
+
'',
|
|
73
|
+
'### Step 6 — Create the Business Rule',
|
|
74
|
+
`Use **create_business_rule** with the final script, table="${table}", when="${when}", and appropriate conditions. Report the sys_id and name of the created artifact.`,
|
|
75
|
+
'',
|
|
76
|
+
'### Step 7 — Suggest Test Scenarios',
|
|
77
|
+
'Provide a test matrix:',
|
|
78
|
+
'| # | Scenario | Setup | Expected Result |',
|
|
79
|
+
'|---|----------|-------|-----------------|',
|
|
80
|
+
'Include at minimum:',
|
|
81
|
+
'- Happy-path insert/update that triggers the rule.',
|
|
82
|
+
'- Edge case where condition is NOT met (rule should not fire).',
|
|
83
|
+
'- Boundary / null-field scenario.',
|
|
84
|
+
'- Role-based test if applicable.',
|
|
85
|
+
'- Conflict test with the rules identified in Step 2.',
|
|
86
|
+
].join('\n'),
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
export default capability;
|
|
93
|
+
//# sourceMappingURL=build-business-rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-business-rule.js","sourceRoot":"","sources":["../../../src/prompts/capabilities/build-business-rule.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAyB;IACvC,IAAI,EAAE,qBAAqB;IAC3B,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EACT,kHAAkH;IACpH,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,oDAAoD;YACjE,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,OAAO;YACb,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,IAAI;SACf;QACD;YACE,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,KAAK;SAChB;KACF;IACD,gBAAgB,EAAE;QAChB,sBAAsB;QACtB,qBAAqB;QACrB,mBAAmB;QACnB,kBAAkB;QAClB,uBAAuB;QACvB,eAAe;KAChB;IACD,WAAW,CAAC,IAAI,GAAG,EAAE;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,IAAI,gBAAgB,CAAC;QAClD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,gBAAgB,CAAC;QAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC;QAEnC,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;wBACJ,mCAAmC,KAAK,WAAW;wBACnD,aAAa,IAAI,EAAE;wBACnB,oBAAoB,IAAI,EAAE;wBAC1B,EAAE;wBACF,6BAA6B;wBAC7B,EAAE;wBACF,yCAAyC;wBACzC,6HAA6H,IAAI,6GAA6G;wBAC9O,EAAE;wBACF,gDAAgD;wBAChD,kDAAkD,KAAK,6RAA6R;wBACpV,EAAE;wBACF,iCAAiC;wBACjC,iCAAiC,KAAK,uNAAuN;wBAC7P,EAAE;wBACF,kCAAkC;wBAClC,yDAAyD;wBACzD,wNAAwN;wBACxN,gJAAgJ;wBAChJ,+KAA+K;wBAC/K,0EAA0E;wBAC1E,oHAAoH;wBACpH,6FAA6F;wBAC7F,EAAE;wBACF,gDAAgD;wBAChD,6BAA6B;wBAC7B,2DAA2D;wBAC3D,4DAA4D;wBAC5D,4CAA4C;wBAC5C,qFAAqF;wBACrF,0FAA0F;wBAC1F,EAAE;wBACF,uCAAuC;wBACvC,8DAA8D,KAAK,YAAY,IAAI,oFAAoF;wBACvK,EAAE;wBACF,qCAAqC;wBACrC,wBAAwB;wBACxB,4CAA4C;wBAC5C,4CAA4C;wBAC5C,qBAAqB;wBACrB,oDAAoD;wBACpD,gEAAgE;wBAChE,mCAAmC;wBACnC,kCAAkC;wBAClC,sDAAsD;qBACvD,CAAC,IAAI,CAAC,IAAI,CAAC;iBACb;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-catalog.d.ts","sourceRoot":"","sources":["../../../src/prompts/capabilities/build-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,QAAA,MAAM,UAAU,EAAE,oBA6VjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|