nowaikit 2.6.0 → 3.1.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/LICENSE +10 -10
- package/README.md +8 -6
- package/desktop/renderer/dist/assets/index-C_5k3daB.js +49 -0
- package/desktop/renderer/dist/index.html +1 -1
- package/desktop/serve.cjs +46 -10
- package/dist/cli/config-store.d.ts +22 -0
- package/dist/cli/config-store.d.ts.map +1 -1
- package/dist/cli/config-store.js +44 -1
- package/dist/cli/config-store.js.map +1 -1
- package/dist/cli/index.js +104 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +486 -49
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/shortcuts.d.ts +2 -0
- package/dist/cli/shortcuts.d.ts.map +1 -0
- package/dist/cli/shortcuts.js +122 -0
- package/dist/cli/shortcuts.js.map +1 -0
- 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 +197 -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/sdk/index.d.ts +49 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +53 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/server.js +3 -3
- package/dist/server.js.map +1 -1
- package/dist/servicenow/client.js +1 -1
- package/dist/servicenow/client.js.map +1 -1
- package/dist/tools-manifest.json +565 -0
- package/package.json +30 -5
- package/desktop/renderer/dist/assets/index-B-6BYnh8.js +0 -49
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
const capability = {
|
|
2
|
+
name: 'scan-upgrade',
|
|
3
|
+
title: 'Upgrade Readiness Check',
|
|
4
|
+
description: 'Check deprecated APIs, incompatible patterns, and plugin conflicts before upgrading to the next ServiceNow release',
|
|
5
|
+
category: 'scan',
|
|
6
|
+
arguments: [
|
|
7
|
+
{
|
|
8
|
+
name: 'target_release',
|
|
9
|
+
description: 'Target ServiceNow release (e.g. "zurich", "xanadu"). If omitted, checks against latest known release.',
|
|
10
|
+
required: false,
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
recommendedTools: [
|
|
14
|
+
'list_business_rules',
|
|
15
|
+
'list_script_includes',
|
|
16
|
+
'list_client_scripts',
|
|
17
|
+
'query_records',
|
|
18
|
+
'list_system_properties',
|
|
19
|
+
'get_table_schema',
|
|
20
|
+
],
|
|
21
|
+
buildPrompt(args) {
|
|
22
|
+
const targetRelease = args?.target_release ?? 'latest';
|
|
23
|
+
const releaseLabel = targetRelease === 'latest'
|
|
24
|
+
? 'Latest available release'
|
|
25
|
+
: `${targetRelease.charAt(0).toUpperCase()}${targetRelease.slice(1)}`;
|
|
26
|
+
// ─── Deprecated API Section ───────────────────────────────────────────────
|
|
27
|
+
const deprecatedApiSection = [
|
|
28
|
+
'## 1. Deprecated API Usage Across All Scripts',
|
|
29
|
+
'',
|
|
30
|
+
'Scan ALL scriptable artifact types for deprecated API calls that will break or behave',
|
|
31
|
+
'differently in newer releases:',
|
|
32
|
+
'',
|
|
33
|
+
'### Artifact Types to Scan',
|
|
34
|
+
'- **Business Rules** (`sys_script`)',
|
|
35
|
+
'- **Script Includes** (`sys_script_include`)',
|
|
36
|
+
'- **Client Scripts** (`sys_script_client`)',
|
|
37
|
+
'- **Fix Scripts** (`sys_script_fix`)',
|
|
38
|
+
'- **Scheduled Jobs** (`sysauto_script`)',
|
|
39
|
+
'- **UI Actions** (`sys_ui_action`)',
|
|
40
|
+
'- **UI Pages** (`sys_ui_page`) \u2014 processing scripts + client scripts',
|
|
41
|
+
'- **UI Macros** (`sys_ui_macro`)',
|
|
42
|
+
'- **Catalog Client Scripts** (`catalog_script_client`)',
|
|
43
|
+
'- **Script Actions** (`sysevent_script_action`)',
|
|
44
|
+
'- **Processors** (`sys_processor`)',
|
|
45
|
+
'- **Transform Map Scripts** (`sys_transform_script`)',
|
|
46
|
+
'- **Scripted REST Resources** (`sys_ws_operation`)',
|
|
47
|
+
'- **REST Message Function Scripts** (`sys_rest_message_fn`)',
|
|
48
|
+
'- **MID Server Script Includes** (`ecc_agent_script_include`)',
|
|
49
|
+
'- **Flow Designer Script Steps** (within `sys_hub_action_instance`)',
|
|
50
|
+
'- **SP Widget Server/Client Scripts** (`sp_widget`)',
|
|
51
|
+
'',
|
|
52
|
+
'### Deprecated Patterns to Flag',
|
|
53
|
+
'',
|
|
54
|
+
'**Server-Side (High Risk):**',
|
|
55
|
+
'- `Packages.java.*` \u2014 Java package imports (blocked in scoped apps, deprecated in global)',
|
|
56
|
+
'- `GlideRecord.getDisplayValue()` without field parameter',
|
|
57
|
+
'- `current.getDisplayValue()` in async BRs (current not available)',
|
|
58
|
+
'- `GlideRecord.getRowCount()` \u2014 performance issues, use `getRowCount` with caution',
|
|
59
|
+
'- `getReference()` \u2014 synchronous reference lookup, use GlideRecord query',
|
|
60
|
+
'- `gs.print()` \u2014 replaced by `gs.info()`',
|
|
61
|
+
'- `gs.log()` \u2014 use scoped `gs.debug()` / `gs.info()` / `gs.warn()` / `gs.error()`',
|
|
62
|
+
'- `GlideHTTPClient` \u2014 use `sn_ws.RESTMessageV2`',
|
|
63
|
+
'- `XMLDocument` / `XMLDocument2` deprecated methods',
|
|
64
|
+
'- `GlideEmailOutbound` direct usage \u2014 use Event + Notification pattern',
|
|
65
|
+
'',
|
|
66
|
+
'**Client-Side (High Risk):**',
|
|
67
|
+
'- `GlideDialogWindow` \u2014 replaced by `GlideModal` / UI Builder modals',
|
|
68
|
+
'- `GlideAjax.getXMLWait()` \u2014 synchronous, use `getXML()` with callback',
|
|
69
|
+
'- `g_form.getReference()` without callback (synchronous)',
|
|
70
|
+
'- `gel()` / `gel_dec()` \u2014 legacy DOM functions',
|
|
71
|
+
'- `$j()` / `$$()` \u2014 Prototype.js selectors (removed in newer UI)',
|
|
72
|
+
'- `g_list` API changes across versions',
|
|
73
|
+
'- `GlideDialogForm` deprecated constructors',
|
|
74
|
+
'',
|
|
75
|
+
'**Output:** Table of deprecated calls with artifact, location, risk level, and replacement API',
|
|
76
|
+
];
|
|
77
|
+
// ─── Hardcoded Sys IDs ────────────────────────────────────────────────────
|
|
78
|
+
const hardcodedSysIdSection = [
|
|
79
|
+
'## 2. Hardcoded Sys IDs',
|
|
80
|
+
'',
|
|
81
|
+
'Scan ALL scriptable artifacts for hardcoded sys_id values (32-character hex strings):',
|
|
82
|
+
'',
|
|
83
|
+
'- Regex pattern: `/[0-9a-f]{32}/` in script bodies',
|
|
84
|
+
'- For each found sys_id, identify what record it references (if possible)',
|
|
85
|
+
'- Sys IDs that differ between instances WILL break during upgrade/clone',
|
|
86
|
+
'',
|
|
87
|
+
'### Common Problem Areas',
|
|
88
|
+
'- Hardcoded user sys_ids (should use `gs.getUserID()` or properties)',
|
|
89
|
+
'- Hardcoded group sys_ids (should use `getByName()` or reference qualifiers)',
|
|
90
|
+
'- Hardcoded catalog item / variable sys_ids (differ per instance)',
|
|
91
|
+
'- Hardcoded table sys_ids (`sys_db_object` records)',
|
|
92
|
+
'- Hardcoded update set / application sys_ids',
|
|
93
|
+
'',
|
|
94
|
+
'### Exceptions (Lower Risk)',
|
|
95
|
+
'- System tables and OOB records that are consistent across instances',
|
|
96
|
+
'- Dictionary references to well-known OOB fields',
|
|
97
|
+
'',
|
|
98
|
+
'**Output:** Hardcoded sys_id inventory with artifact, sys_id, referenced record (if resolved), and risk',
|
|
99
|
+
];
|
|
100
|
+
// ─── Direct Table Queries ─────────────────────────────────────────────────
|
|
101
|
+
const directQuerySection = [
|
|
102
|
+
'## 3. Direct Table Queries That Should Use APIs',
|
|
103
|
+
'',
|
|
104
|
+
'Scan scripts for direct GlideRecord queries on tables that have dedicated APIs:',
|
|
105
|
+
'',
|
|
106
|
+
'- **`sys_user_has_role`** \u2014 use `gs.hasRole()` / `GlideUser.hasRole()`',
|
|
107
|
+
'- **`sys_user_group`** / **`sys_user_grmember`** \u2014 use `gs.getUser().isMemberOf()`',
|
|
108
|
+
'- **`sys_properties`** \u2014 use `gs.getProperty()` / `gs.setProperty()`',
|
|
109
|
+
'- **`sys_choice`** \u2014 use `GlideChoice` API',
|
|
110
|
+
'- **`cmdb_ci`** and subclasses \u2014 use CMDB APIs where available',
|
|
111
|
+
'- **`sys_attachment`** \u2014 use `GlideSysAttachment` API',
|
|
112
|
+
'- **`sys_journal_field`** \u2014 use `current.work_notes.getJournalEntry()`',
|
|
113
|
+
'- **`task_sla`** \u2014 use `SLACalculation` API',
|
|
114
|
+
'',
|
|
115
|
+
'Direct table queries bypass business logic, ACLs, and may break when table schemas change.',
|
|
116
|
+
'',
|
|
117
|
+
'**Output:** List of direct query patterns with artifact, table queried, and recommended API',
|
|
118
|
+
];
|
|
119
|
+
// ─── Version-Specific Behavior ────────────────────────────────────────────
|
|
120
|
+
const versionBehaviorSection = [
|
|
121
|
+
'## 4. Version-Specific Behavior Assumptions',
|
|
122
|
+
'',
|
|
123
|
+
'Scan for patterns that assume specific platform behavior which changes across releases:',
|
|
124
|
+
'',
|
|
125
|
+
'- **Execution order assumptions:** Business Rules relying on specific execution order',
|
|
126
|
+
' (order field < 100 or > 900 may conflict with OOB rules in new releases)',
|
|
127
|
+
'- **Null handling changes:** `current.field == null` vs `current.field.nil()` behavior differences',
|
|
128
|
+
'- **Scope isolation changes:** Global scripts accessing scoped resources or vice versa',
|
|
129
|
+
'- **GlideRecord query behavior:** `get()` vs `addQuery()` + `query()` subtle differences across versions',
|
|
130
|
+
'- **Security context changes:** `gs.getUser()` behavior in scheduled job context',
|
|
131
|
+
'- **Time zone handling:** `GlideDateTime` parsing differences',
|
|
132
|
+
'- **REST API versioning:** `/api/now/v1` vs `/api/now/v2` differences',
|
|
133
|
+
'',
|
|
134
|
+
'**Output:** Behavior-dependent patterns with artifact, assumption, and risk if behavior changes',
|
|
135
|
+
];
|
|
136
|
+
// ─── Plugin Compatibility ─────────────────────────────────────────────────
|
|
137
|
+
const pluginSection = [
|
|
138
|
+
'## 5. Plugin Compatibility',
|
|
139
|
+
'',
|
|
140
|
+
'Use `query_records` on `v_plugin` and `list_system_properties` to check:',
|
|
141
|
+
'',
|
|
142
|
+
'- **Active plugins** against known compatibility matrix for target release',
|
|
143
|
+
'- **Plugin dependencies:** plugins requiring other plugins that may be deprecated',
|
|
144
|
+
'- **Store apps** that may not have a compatible version for target release',
|
|
145
|
+
'- **Plugin activation order** dependencies that may change',
|
|
146
|
+
'- **Demo data plugins** active in production (may interfere with upgrades)',
|
|
147
|
+
'- **Legacy plugins** replaced by new functionality in target release:',
|
|
148
|
+
' - Legacy Workflow \u2192 Flow Designer',
|
|
149
|
+
' - Legacy Portal \u2192 Service Portal / Next Experience',
|
|
150
|
+
' - Legacy CMDB \u2192 CMDB Workspace',
|
|
151
|
+
' - Legacy Reporting \u2192 Performance Analytics',
|
|
152
|
+
'',
|
|
153
|
+
'**Output:** Plugin compatibility matrix with status (compatible/deprecated/unknown/at-risk)',
|
|
154
|
+
];
|
|
155
|
+
// ─── UI & Navigation ──────────────────────────────────────────────────────
|
|
156
|
+
const uiSection = [
|
|
157
|
+
'## 6. Custom UI & Navigation Compatibility',
|
|
158
|
+
'',
|
|
159
|
+
'Use `query_records` to scan UI artifacts that may break with UI framework changes:',
|
|
160
|
+
'',
|
|
161
|
+
'### Classic UI \u2192 Next Experience Migration',
|
|
162
|
+
'- **UI Pages** (`sys_ui_page`) \u2014 Jelly-based pages will not render in Next Experience',
|
|
163
|
+
'- **UI Macros** (`sys_ui_macro`) \u2014 Jelly macros are Classic UI only',
|
|
164
|
+
'- **Formatters** (`sys_ui_formatter`) \u2014 may need workspace equivalents',
|
|
165
|
+
'- **Homepage widgets** (`sys_ui_hp_publisher`) \u2014 replaced by dashboard/workspace',
|
|
166
|
+
'- **Content blocks** \u2014 Classic CMS content not compatible with Next Experience',
|
|
167
|
+
'',
|
|
168
|
+
'### Service Portal \u2192 Next Experience',
|
|
169
|
+
'- **SP Widgets** (`sp_widget`) using AngularJS 1.x \u2014 no path to Next Experience without rewrite',
|
|
170
|
+
'- **Angular Providers** \u2014 will need migration to Seismic components',
|
|
171
|
+
'- **SP Pages** with custom CSS that may conflict with Next Experience theming',
|
|
172
|
+
'- **SP Themes** and CSS includes \u2014 not compatible with workspace theming',
|
|
173
|
+
'',
|
|
174
|
+
'### Navigation',
|
|
175
|
+
'- **Custom modules** (`sys_app_module`) with URL-type links to Classic UI pages',
|
|
176
|
+
'- **Application menus** relying on Classic UI navigation structure',
|
|
177
|
+
'- **Interceptors** (`sys_ui_interceptor`) \u2014 behavior may change',
|
|
178
|
+
'',
|
|
179
|
+
'**Output:** UI migration risk matrix per artifact type with estimated rewrite effort',
|
|
180
|
+
];
|
|
181
|
+
// ─── Java Package Imports ─────────────────────────────────────────────────
|
|
182
|
+
const javaImportSection = [
|
|
183
|
+
'## 7. Java Package Imports in Scripts',
|
|
184
|
+
'',
|
|
185
|
+
'Scan ALL server-side scripts for Java package usage via `Packages.*`:',
|
|
186
|
+
'',
|
|
187
|
+
'### Patterns to Find',
|
|
188
|
+
'- `Packages.java.lang.*` (String, Integer, etc.)',
|
|
189
|
+
'- `Packages.java.util.*` (ArrayList, HashMap, etc.)',
|
|
190
|
+
'- `Packages.java.io.*` (File, InputStream, etc.)',
|
|
191
|
+
'- `Packages.java.net.*` (URL, HttpURLConnection, etc.)',
|
|
192
|
+
'- `Packages.javax.*` (xml, crypto, etc.)',
|
|
193
|
+
'- `Packages.org.*` (apache, json, etc.)',
|
|
194
|
+
'- `Packages.com.glide.*` (direct Glide Java API access)',
|
|
195
|
+
'- `Packages.com.snc.*` (ServiceNow internal Java classes)',
|
|
196
|
+
'',
|
|
197
|
+
'### Migration Path',
|
|
198
|
+
'- `Packages.java.util.ArrayList` \u2192 use JavaScript arrays `[]`',
|
|
199
|
+
'- `Packages.java.util.HashMap` \u2192 use JavaScript objects `{}`',
|
|
200
|
+
'- `Packages.java.lang.String` \u2192 use JavaScript string methods',
|
|
201
|
+
'- `Packages.java.io.*` \u2192 use `GlideSysAttachment`, `sn_ws.RESTMessageV2`',
|
|
202
|
+
'- `Packages.com.glide.*` \u2192 use documented Scoped API equivalents',
|
|
203
|
+
'',
|
|
204
|
+
'Java imports are BLOCKED in scoped applications and will be removed in future releases.',
|
|
205
|
+
'',
|
|
206
|
+
'**Output:** Java import inventory with artifact, import path, usage context, and JavaScript replacement',
|
|
207
|
+
];
|
|
208
|
+
// ─── Undocumented API Usage ───────────────────────────────────────────────
|
|
209
|
+
const undocumentedApiSection = [
|
|
210
|
+
'## 8. Undocumented & Internal API Usage',
|
|
211
|
+
'',
|
|
212
|
+
'Scan for usage of undocumented/internal APIs that can break without notice:',
|
|
213
|
+
'',
|
|
214
|
+
'- **`GlideController`** methods not in public documentation',
|
|
215
|
+
'- **`GlideappCalculationHelper`** and other `Glideapp*` internal classes',
|
|
216
|
+
'- **`GlidePluginManager`** direct calls (use `gs.hasPlugin()` instead)',
|
|
217
|
+
'- **`GlideUpdateManager`** / `GlideUpdateSet` internal methods',
|
|
218
|
+
'- **`TableUtils`** undocumented methods',
|
|
219
|
+
'- **`GlideDBObjectManager`** direct access',
|
|
220
|
+
'- **Internal REST endpoints** (`/xmlstats.do`, `/navpage.do`, `/stats.do`)',
|
|
221
|
+
'- **`SNC.*`** namespace calls (internal ServiceNow classes)',
|
|
222
|
+
'- **`global.*`** scope crossover calls in scoped apps',
|
|
223
|
+
'- **`new GlideScriptEvaluator()`** and similar internal evaluators',
|
|
224
|
+
'',
|
|
225
|
+
'**Output:** Undocumented API inventory with artifact, API call, risk level, and documented alternative',
|
|
226
|
+
];
|
|
227
|
+
// ─── Report Format ────────────────────────────────────────────────────────
|
|
228
|
+
const reportFormat = [
|
|
229
|
+
'## Upgrade Readiness Report Format',
|
|
230
|
+
'',
|
|
231
|
+
'Compile ALL findings into this structure:',
|
|
232
|
+
'',
|
|
233
|
+
'```',
|
|
234
|
+
'UPGRADE READINESS REPORT',
|
|
235
|
+
'========================',
|
|
236
|
+
`Target Release: ${releaseLabel}`,
|
|
237
|
+
'Current Version: [detected from instance]',
|
|
238
|
+
'Date: [current date]',
|
|
239
|
+
'',
|
|
240
|
+
'READINESS SCORE',
|
|
241
|
+
' Overall: [Ready / Ready with Caveats / Not Ready]',
|
|
242
|
+
' Estimated remediation: [X hours/days]',
|
|
243
|
+
'',
|
|
244
|
+
'MIGRATION RISK MATRIX',
|
|
245
|
+
'------------------------------------------------------------',
|
|
246
|
+
'| Artifact Type | Count | Risk | Effort |',
|
|
247
|
+
'|-----------------------|-------|--------|----------------|',
|
|
248
|
+
'| Deprecated APIs | X | [H/M/L]| [hours/days] |',
|
|
249
|
+
'| Hardcoded sys_ids | X | [H/M/L]| [hours/days] |',
|
|
250
|
+
'| Direct table queries | X | [H/M/L]| [hours/days] |',
|
|
251
|
+
'| Version assumptions | X | [H/M/L]| [hours/days] |',
|
|
252
|
+
'| Plugin conflicts | X | [H/M/L]| [hours/days] |',
|
|
253
|
+
'| UI compatibility | X | [H/M/L]| [hours/days] |',
|
|
254
|
+
'| Java imports | X | [H/M/L]| [hours/days] |',
|
|
255
|
+
'| Undocumented APIs | X | [H/M/L]| [hours/days] |',
|
|
256
|
+
'------------------------------------------------------------',
|
|
257
|
+
'',
|
|
258
|
+
'RISK DEFINITIONS',
|
|
259
|
+
' HIGH \u2014 Will break during or after upgrade; must fix before upgrade',
|
|
260
|
+
' MEDIUM \u2014 May cause issues; should fix before upgrade',
|
|
261
|
+
' LOW \u2014 Minor risk; can fix after upgrade',
|
|
262
|
+
'',
|
|
263
|
+
'BLOCKING ISSUES (must resolve before upgrade)',
|
|
264
|
+
'1. [issue + affected artifact]',
|
|
265
|
+
'',
|
|
266
|
+
'PRE-UPGRADE CHECKLIST',
|
|
267
|
+
'[ ] All deprecated APIs replaced',
|
|
268
|
+
'[ ] Hardcoded sys_ids converted to properties',
|
|
269
|
+
'[ ] Plugin compatibility verified',
|
|
270
|
+
'[ ] Custom UI migration plan created',
|
|
271
|
+
'[ ] Java imports replaced with JavaScript equivalents',
|
|
272
|
+
'[ ] Undocumented APIs replaced with supported alternatives',
|
|
273
|
+
'[ ] Clone + test upgrade completed in sub-prod',
|
|
274
|
+
'',
|
|
275
|
+
'DETAILED FINDINGS',
|
|
276
|
+
'[Organized by category, each item with artifact, code evidence, risk, and fix]',
|
|
277
|
+
'```',
|
|
278
|
+
];
|
|
279
|
+
return [
|
|
280
|
+
{
|
|
281
|
+
role: 'assistant',
|
|
282
|
+
content: {
|
|
283
|
+
type: 'text',
|
|
284
|
+
text: [
|
|
285
|
+
'# Capability: Upgrade Readiness Check',
|
|
286
|
+
'',
|
|
287
|
+
`**Target Release:** ${releaseLabel}`,
|
|
288
|
+
'',
|
|
289
|
+
'This capability scans every scriptable and configurable artifact type for patterns',
|
|
290
|
+
'that will break, degrade, or behave differently after upgrading to the target release.',
|
|
291
|
+
'The output is a migration risk matrix that tells you exactly what to fix before upgrading.',
|
|
292
|
+
'',
|
|
293
|
+
'CRITICAL INSTRUCTION: Scan ALL artifact types listed in each section. Upgrade issues',
|
|
294
|
+
'hide everywhere \u2014 a single `Packages.java` call in an obscure UI Page processor can',
|
|
295
|
+
'block an entire upgrade.',
|
|
296
|
+
'',
|
|
297
|
+
...deprecatedApiSection, '',
|
|
298
|
+
...hardcodedSysIdSection, '',
|
|
299
|
+
...directQuerySection, '',
|
|
300
|
+
...versionBehaviorSection, '',
|
|
301
|
+
...pluginSection, '',
|
|
302
|
+
...uiSection, '',
|
|
303
|
+
...javaImportSection, '',
|
|
304
|
+
...undocumentedApiSection, '',
|
|
305
|
+
...reportFormat,
|
|
306
|
+
'',
|
|
307
|
+
'---',
|
|
308
|
+
'',
|
|
309
|
+
'Beginning upgrade readiness check. Every finding must include the artifact type,',
|
|
310
|
+
'name, exact code evidence, risk level, and specific remediation steps.',
|
|
311
|
+
].join('\n'),
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
role: 'user',
|
|
316
|
+
content: {
|
|
317
|
+
type: 'text',
|
|
318
|
+
text: targetRelease === 'latest'
|
|
319
|
+
? 'Run an upgrade readiness check on my ServiceNow instance for the latest release. Scan every artifact type and give me a migration risk matrix.'
|
|
320
|
+
: `Run an upgrade readiness check on my ServiceNow instance for the ${releaseLabel} release. Scan every artifact type and give me a migration risk matrix.`,
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
];
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
export default capability;
|
|
327
|
+
//# sourceMappingURL=scan-upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan-upgrade.js","sourceRoot":"","sources":["../../../src/prompts/capabilities/scan-upgrade.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAyB;IACvC,IAAI,EAAE,cAAc;IACpB,KAAK,EAAE,yBAAyB;IAChC,WAAW,EACT,oHAAoH;IACtH,QAAQ,EAAE,MAAM;IAEhB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,gBAAgB;YACtB,WAAW,EACT,uGAAuG;YACzG,QAAQ,EAAE,KAAK;SAChB;KACF;IAED,gBAAgB,EAAE;QAChB,qBAAqB;QACrB,sBAAsB;QACtB,qBAAqB;QACrB,eAAe;QACf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C;CACF,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { CapabilityDefinition, CapabilityCategory } from './types.js';
|
|
2
|
+
export type { CapabilityDefinition, CapabilityCategory } from './types.js';
|
|
1
3
|
export interface McpPrompt {
|
|
2
4
|
name: string;
|
|
3
5
|
description: string;
|
|
@@ -18,8 +20,28 @@ export interface GetPromptResult {
|
|
|
18
20
|
description: string;
|
|
19
21
|
messages: McpPromptMessage[];
|
|
20
22
|
}
|
|
21
|
-
|
|
23
|
+
interface CapabilityMeta {
|
|
24
|
+
name: string;
|
|
25
|
+
title: string;
|
|
26
|
+
description: string;
|
|
27
|
+
category: CapabilityCategory;
|
|
28
|
+
file: string;
|
|
29
|
+
arguments?: Array<{
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
/** All prompts merged (ITSM + user-defined + capabilities). Lightweight — no capability module loading. */
|
|
22
36
|
export declare function getPrompts(): McpPrompt[];
|
|
23
|
-
/** Resolve a prompt by name
|
|
37
|
+
/** Resolve a prompt by name. Lazy-loads capability modules only when needed. */
|
|
38
|
+
export declare function resolvePromptAsync(name: string, args?: Record<string, string>): Promise<GetPromptResult | null>;
|
|
39
|
+
/** Synchronous resolve — for backward compatibility. Only resolves ITSM/user prompts. */
|
|
24
40
|
export declare function resolvePrompt(name: string, args?: Record<string, string>): GetPromptResult | null;
|
|
41
|
+
/** Get capability metadata for CLI listing. Lightweight — no module loading. */
|
|
42
|
+
export declare function getCapabilityMeta(): CapabilityMeta[];
|
|
43
|
+
/** Get full capability definitions (loads all modules). For direct execution. */
|
|
44
|
+
export declare function getCapabilities(): Promise<CapabilityDefinition[]>;
|
|
45
|
+
/** Initialize registry — loads pro extensions if configured. */
|
|
46
|
+
export declare function initializeRegistry(): Promise<void>;
|
|
25
47
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG3E,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACpB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAID,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAC9E;AAqHD,2GAA2G;AAC3G,wBAAgB,UAAU,IAAI,SAAS,EAAE,CAqBxC;AAED,gFAAgF;AAChF,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CA6BrH;AAED,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,eAAe,GAAG,IAAI,CAiCjG;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,IAAI,cAAc,EAAE,CAGpD;AAED,iFAAiF;AACjF,wBAAsB,eAAe,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAQvE;AAED,gEAAgE;AAChE,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAExD"}
|
package/dist/prompts/index.js
CHANGED
|
@@ -1,25 +1,192 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MCP Prompts registry — exposes built-in
|
|
2
|
+
* MCP Prompts registry — exposes built-in ITSM prompts, user-defined prompts,
|
|
3
|
+
* and 26 Apex capability prompts (scan/review/build/ops/docs).
|
|
4
|
+
*
|
|
5
|
+
* Performance: Capability modules are lazy-loaded — only imported when a
|
|
6
|
+
* capability prompt is actually resolved. The prompt listing uses a lightweight
|
|
7
|
+
* metadata array so MCP clients never pay the cost of loading 26 capability
|
|
8
|
+
* files + knowledge base just to list available prompts.
|
|
3
9
|
*/
|
|
4
10
|
import { itsmPrompts } from './itsm.js';
|
|
5
11
|
import { loadUserPrompts } from './user-prompts.js';
|
|
6
|
-
|
|
12
|
+
import { loadConfig } from '../cli/config-store.js';
|
|
13
|
+
const capabilityMeta = [
|
|
14
|
+
// Scan
|
|
15
|
+
{ name: 'scan-health', title: 'Instance Health Scan', description: 'Complete instance health assessment — plugins, scheduled jobs, logs, quotas, system diagnostics', category: 'scan', file: 'scan-health' },
|
|
16
|
+
{ name: 'scan-security', title: 'Security Audit', description: 'Comprehensive security scan — ACLs, roles, scripts, APIs, compliance across ALL artifact types', category: 'scan', file: 'scan-security', arguments: [{ name: 'scope', description: 'Audit scope: "instance" for full audit, or a specific table/app name', required: true }, { name: 'focus', description: 'Narrow focus: "acls", "roles", "scripts", "api", or "all"', required: false }] },
|
|
17
|
+
{ name: 'scan-debt', title: 'Technical Debt Analysis', description: 'Find dead code, unused scripts, duplicate logic, stale configurations across ALL artifact types', category: 'scan', file: 'scan-debt' },
|
|
18
|
+
{ name: 'scan-upgrade', title: 'Upgrade Readiness Check', description: 'Check deprecated APIs, incompatible patterns, and plugin conflicts before upgrading', category: 'scan', file: 'scan-upgrade' },
|
|
19
|
+
{ name: 'scan-cmdb', title: 'CMDB Health Scan', description: 'CMDB health — stale CIs, broken relationships, data quality, orphan detection, class compliance', category: 'scan', file: 'scan-cmdb' },
|
|
20
|
+
{ name: 'scan-automation', title: 'Automation Conflict Scan', description: 'Automation conflict detection — overlapping business rules and flows, circular triggers, execution order', category: 'scan', file: 'scan-automation' },
|
|
21
|
+
// Review
|
|
22
|
+
{ name: 'review-code', title: 'Deep Code Review', description: 'Deep code review — security, performance, best practices, upgrade safety across all artifact types', category: 'review', file: 'review-code' },
|
|
23
|
+
{ name: 'review-acls', title: 'ACL Coverage Analysis', description: 'ACL coverage analysis — missing ACLs, field-level gaps, overly permissive rules, conflicts', category: 'review', file: 'review-acls' },
|
|
24
|
+
{ name: 'review-scripts', title: 'Bulk Script Scan', description: 'Bulk script scan — injection, performance antipatterns, deprecated APIs, hardcoded sys_ids', category: 'review', file: 'review-scripts' },
|
|
25
|
+
{ name: 'review-flows', title: 'Flow Designer Audit', description: 'Flow Designer audit — error handling, performance, dead paths, async issues, security, compliance', category: 'review', file: 'review-flows' },
|
|
26
|
+
// Build
|
|
27
|
+
{ name: 'build-business-rule', title: 'Build Business Rule', description: 'Guided business rule creation — understand, check existing, generate, review, create, test', category: 'build', file: 'build-business-rule', arguments: [{ name: 'description', description: 'what the business rule should do', required: true }, { name: 'table', description: 'target table', required: true }, { name: 'when', description: 'before, after, async, display', required: false }] },
|
|
28
|
+
{ name: 'build-client-script', title: 'Build Client Script', description: 'Guided client script creation — onChange, onLoad, onSubmit, onCellEdit with best practices', category: 'build', file: 'build-client-script', arguments: [{ name: 'description', description: 'what the client script should do', required: true }, { name: 'table', description: 'target table', required: true }, { name: 'type', description: 'onChange, onLoad, onSubmit, onCellEdit', required: false }] },
|
|
29
|
+
{ name: 'build-test-plan', title: 'Build Test Plan', description: 'Generate ATF test plan for any artifact type — BRs, SIs, Client Scripts, Flows, ACLs, Catalog', category: 'build', file: 'build-test-plan', arguments: [{ name: 'artifact_type', description: 'artifact type to test', required: true }, { name: 'description', description: 'what the artifact does', required: true }] },
|
|
30
|
+
{ name: 'build-app', title: 'Build Application', description: 'Complete 7-phase scoped application builder — from data model to packaging', category: 'build', file: 'build-app', arguments: [{ name: 'description', description: 'what the application should do', required: true }, { name: 'app_name', description: 'application name', required: true }, { name: 'scope_prefix', description: 'scope prefix e.g. x_myco', required: false }] },
|
|
31
|
+
{ name: 'build-flow', title: 'Build Flow', description: 'Flow Designer creation — triggers, actions, error handling, subflows, testing', category: 'build', file: 'build-flow', arguments: [{ name: 'description', description: 'what the flow should do', required: true }, { name: 'trigger_type', description: 'record, scheduled, application, email', required: false }] },
|
|
32
|
+
{ name: 'build-portal', title: 'Build Portal Widget', description: 'Service Portal widget builder — server, client, HTML, CSS with architectural guidance', category: 'build', file: 'build-portal', arguments: [{ name: 'description', description: 'what the widget should do', required: true }, { name: 'widget_name', description: 'widget name', required: false }, { name: 'table', description: 'data table', required: false }] },
|
|
33
|
+
{ name: 'build-uib', title: 'Build UIB Component', description: 'UI Builder / Next Experience component builder — Seismic, NEDS, macroponents', category: 'build', file: 'build-uib', arguments: [{ name: 'description', description: 'what the component should do', required: true }, { name: 'component_type', description: 'page, macroponent, data_resource', required: false }] },
|
|
34
|
+
{ name: 'build-catalog', title: 'Build Catalog Item', description: 'End-to-end catalog item builder — variables, approval, fulfillment, client scripts', category: 'build', file: 'build-catalog', arguments: [{ name: 'description', description: 'what the catalog item provides', required: true }, { name: 'item_name', description: 'catalog item name', required: false }, { name: 'category', description: 'catalog category', required: false }] },
|
|
35
|
+
{ name: 'build-rest-api', title: 'Build REST API', description: 'Scripted REST API builder — resources, auth, error handling, versioning, documentation', category: 'build', file: 'build-rest-api', arguments: [{ name: 'description', description: 'what the API should do', required: true }, { name: 'api_name', description: 'API name', required: false }, { name: 'http_methods', description: 'GET, POST, PUT, DELETE', required: false }] },
|
|
36
|
+
// Ops
|
|
37
|
+
{ name: 'ops-triage', title: 'Incident Triage', description: 'P1/P2 incident triage — fetch details, assess CMDB impact, check SLAs, search KB, suggest resolution', category: 'ops', file: 'ops-triage', arguments: [{ name: 'incident', description: 'incident number or situation description', required: true }, { name: 'action', description: 'triage, escalate, communicate, review', required: false }] },
|
|
38
|
+
{ name: 'ops-deploy', title: 'Deploy to Production', description: 'Safe deployment pipeline — validate, preview, create change, ATF, commit, rollback plan', category: 'ops', file: 'ops-deploy', arguments: [{ name: 'updateset', description: 'update set name or sys_id', required: true }, { name: 'target', description: 'target instance', required: false }] },
|
|
39
|
+
{ name: 'ops-risk', title: 'Change Risk Assessment', description: 'Change risk scoring, conflict detection, CAB preparation, and rollback planning', category: 'ops', file: 'ops-risk', arguments: [{ name: 'change', description: 'change number or description', required: true }, { name: 'action', description: 'assess, prepare-cab, check-conflicts, plan-rollback', required: false }] },
|
|
40
|
+
// Docs
|
|
41
|
+
{ name: 'docs-app', title: 'Document Application', description: 'Auto-generate comprehensive application documentation — tables, scripts, flows, ACLs, catalog', category: 'docs', file: 'docs-app', arguments: [{ name: 'app', description: 'scoped app name or scope prefix', required: true }] },
|
|
42
|
+
{ name: 'docs-release', title: 'Generate Release Notes', description: 'Generate release notes from update set — categorize changes, highlight breaking changes', category: 'docs', file: 'docs-release', arguments: [{ name: 'updateset', description: 'update set name or sys_id', required: true }, { name: 'version', description: 'version number', required: false }] },
|
|
43
|
+
{ name: 'docs-runbook', title: 'Generate Runbook', description: 'Operational runbook — incident response, health checks, escalation, recovery procedures', category: 'docs', file: 'docs-runbook', arguments: [{ name: 'service', description: 'service, CI, or application name', required: true }] },
|
|
44
|
+
{ name: 'docs-script', title: 'Document Script', description: 'Detailed script documentation — JSDoc, explanation, usage examples, dependencies, security', category: 'docs', file: 'docs-script', arguments: [{ name: 'script', description: 'script name or pasted code', required: true }] },
|
|
45
|
+
];
|
|
46
|
+
// Cache for loaded capability modules (lazy-load on first resolve)
|
|
47
|
+
const capabilityCache = new Map();
|
|
48
|
+
/** Lazy-load a capability module by file name. */
|
|
49
|
+
async function loadCapability(fileName) {
|
|
50
|
+
const cached = capabilityCache.get(fileName);
|
|
51
|
+
if (cached)
|
|
52
|
+
return cached;
|
|
53
|
+
const mod = await import(`./capabilities/${fileName}.js`);
|
|
54
|
+
const cap = mod.default;
|
|
55
|
+
capabilityCache.set(fileName, cap);
|
|
56
|
+
return cap;
|
|
57
|
+
}
|
|
58
|
+
// ─── Pro extension support ──────────────────────────────────────────────────
|
|
59
|
+
let proLoaded = false;
|
|
60
|
+
async function loadProExtensions() {
|
|
61
|
+
if (proLoaded)
|
|
62
|
+
return;
|
|
63
|
+
proLoaded = true;
|
|
64
|
+
const proPath = process.env.NOWAIKIT_PRO_PATH;
|
|
65
|
+
if (!proPath)
|
|
66
|
+
return;
|
|
67
|
+
try {
|
|
68
|
+
const { join } = await import('path');
|
|
69
|
+
const proModule = await import(join(proPath, 'capabilities/index.js'));
|
|
70
|
+
if (typeof proModule.getProCapabilities === 'function') {
|
|
71
|
+
const proCaps = proModule.getProCapabilities();
|
|
72
|
+
for (const cap of proCaps) {
|
|
73
|
+
capabilityCache.set(cap.name, cap);
|
|
74
|
+
// Add to metadata if not already present
|
|
75
|
+
if (!capabilityMeta.find(m => m.name === cap.name)) {
|
|
76
|
+
capabilityMeta.push({
|
|
77
|
+
name: cap.name,
|
|
78
|
+
title: cap.title,
|
|
79
|
+
description: cap.description,
|
|
80
|
+
category: cap.category,
|
|
81
|
+
file: cap.name,
|
|
82
|
+
arguments: cap.arguments,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// Pro extensions not available
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// ─── Apex feature flag ──────────────────────────────────────────────────────
|
|
93
|
+
/**
|
|
94
|
+
* Check if Apex AI Skills are enabled.
|
|
95
|
+
* Disabled via NOWAIKIT_APEX_ENABLED=false env var or apexEnabled=false on the
|
|
96
|
+
* active instance in the config store. Defaults to enabled.
|
|
97
|
+
*/
|
|
98
|
+
function isApexEnabled() {
|
|
99
|
+
// Env var override (fastest check)
|
|
100
|
+
const envFlag = process.env.NOWAIKIT_APEX_ENABLED;
|
|
101
|
+
if (envFlag !== undefined) {
|
|
102
|
+
return envFlag !== 'false' && envFlag !== '0';
|
|
103
|
+
}
|
|
104
|
+
// Check config store — if *any* instance has apexEnabled explicitly false, respect it.
|
|
105
|
+
// Typically the default instance is the one that matters.
|
|
106
|
+
try {
|
|
107
|
+
const config = loadConfig();
|
|
108
|
+
const defaultInst = config.instances[config.defaultInstance];
|
|
109
|
+
if (defaultInst && defaultInst.apexEnabled === false) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
// Config not available — default to enabled
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
// ─── Public API ─────────────────────────────────────────────────────────────
|
|
119
|
+
/** All prompts merged (ITSM + user-defined + capabilities). Lightweight — no capability module loading. */
|
|
7
120
|
export function getPrompts() {
|
|
8
121
|
const userPrompts = loadUserPrompts();
|
|
9
|
-
|
|
122
|
+
const itsmMapped = itsmPrompts.map(p => ({
|
|
10
123
|
name: p.name,
|
|
11
124
|
description: p.description,
|
|
12
125
|
arguments: p.arguments,
|
|
13
126
|
}));
|
|
127
|
+
// Only include Apex capabilities if enabled
|
|
128
|
+
if (!isApexEnabled()) {
|
|
129
|
+
return [...itsmMapped, ...userPrompts];
|
|
130
|
+
}
|
|
131
|
+
const capMapped = capabilityMeta.map(c => ({
|
|
132
|
+
name: c.name,
|
|
133
|
+
description: c.description,
|
|
134
|
+
arguments: c.arguments,
|
|
135
|
+
}));
|
|
136
|
+
return [...itsmMapped, ...userPrompts, ...capMapped];
|
|
137
|
+
}
|
|
138
|
+
/** Resolve a prompt by name. Lazy-loads capability modules only when needed. */
|
|
139
|
+
export async function resolvePromptAsync(name, args) {
|
|
140
|
+
// 1. Check ITSM prompts
|
|
141
|
+
const allTemplated = [...itsmPrompts, ...loadUserPrompts()];
|
|
142
|
+
const prompt = allTemplated.find(p => p.name === name);
|
|
143
|
+
if (prompt) {
|
|
144
|
+
let text = prompt.template;
|
|
145
|
+
if (args) {
|
|
146
|
+
for (const [key, value] of Object.entries(args)) {
|
|
147
|
+
text = text.replaceAll(`{${key}}`, value);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
description: prompt.description,
|
|
152
|
+
messages: [{ role: 'user', content: { type: 'text', text } }],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
// 2. Check capabilities (lazy-load) — only if Apex is enabled
|
|
156
|
+
if (isApexEnabled()) {
|
|
157
|
+
const capMeta = capabilityMeta.find(c => c.name === name);
|
|
158
|
+
if (capMeta) {
|
|
159
|
+
await loadProExtensions();
|
|
160
|
+
const cap = await loadCapability(capMeta.file);
|
|
161
|
+
const messages = cap.buildPrompt(args);
|
|
162
|
+
return { description: cap.description, messages };
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return null;
|
|
14
166
|
}
|
|
15
|
-
/**
|
|
167
|
+
/** Synchronous resolve — for backward compatibility. Only resolves ITSM/user prompts. */
|
|
16
168
|
export function resolvePrompt(name, args) {
|
|
17
|
-
const
|
|
18
|
-
const prompt =
|
|
19
|
-
if (!prompt)
|
|
169
|
+
const allTemplated = [...itsmPrompts, ...loadUserPrompts()];
|
|
170
|
+
const prompt = allTemplated.find(p => p.name === name);
|
|
171
|
+
if (!prompt) {
|
|
172
|
+
// Check if it's a capability — return a minimal prompt directing to use async
|
|
173
|
+
const capMeta = isApexEnabled() ? capabilityMeta.find(c => c.name === name) : undefined;
|
|
174
|
+
if (capMeta) {
|
|
175
|
+
// Synchronous fallback: build a lightweight redirect prompt
|
|
176
|
+
return {
|
|
177
|
+
description: capMeta.description,
|
|
178
|
+
messages: [{
|
|
179
|
+
role: 'user',
|
|
180
|
+
content: {
|
|
181
|
+
type: 'text',
|
|
182
|
+
text: `Execute the "${capMeta.name}" capability: ${capMeta.description}. ${args ? `Arguments: ${JSON.stringify(args)}` : ''}`,
|
|
183
|
+
},
|
|
184
|
+
}],
|
|
185
|
+
};
|
|
186
|
+
}
|
|
20
187
|
return null;
|
|
188
|
+
}
|
|
21
189
|
let text = prompt.template;
|
|
22
|
-
// Substitute {argName} placeholders with provided values
|
|
23
190
|
if (args) {
|
|
24
191
|
for (const [key, value] of Object.entries(args)) {
|
|
25
192
|
text = text.replaceAll(`{${key}}`, value);
|
|
@@ -27,12 +194,28 @@ export function resolvePrompt(name, args) {
|
|
|
27
194
|
}
|
|
28
195
|
return {
|
|
29
196
|
description: prompt.description,
|
|
30
|
-
messages: [
|
|
31
|
-
{
|
|
32
|
-
role: 'user',
|
|
33
|
-
content: { type: 'text', text },
|
|
34
|
-
},
|
|
35
|
-
],
|
|
197
|
+
messages: [{ role: 'user', content: { type: 'text', text } }],
|
|
36
198
|
};
|
|
37
199
|
}
|
|
200
|
+
/** Get capability metadata for CLI listing. Lightweight — no module loading. */
|
|
201
|
+
export function getCapabilityMeta() {
|
|
202
|
+
if (!isApexEnabled())
|
|
203
|
+
return [];
|
|
204
|
+
return [...capabilityMeta];
|
|
205
|
+
}
|
|
206
|
+
/** Get full capability definitions (loads all modules). For direct execution. */
|
|
207
|
+
export async function getCapabilities() {
|
|
208
|
+
if (!isApexEnabled())
|
|
209
|
+
return [];
|
|
210
|
+
await loadProExtensions();
|
|
211
|
+
const loaded = [];
|
|
212
|
+
for (const meta of capabilityMeta) {
|
|
213
|
+
loaded.push(await loadCapability(meta.file));
|
|
214
|
+
}
|
|
215
|
+
return loaded;
|
|
216
|
+
}
|
|
217
|
+
/** Initialize registry — loads pro extensions if configured. */
|
|
218
|
+
export async function initializeRegistry() {
|
|
219
|
+
await loadProExtensions();
|
|
220
|
+
}
|
|
38
221
|
//# sourceMappingURL=index.js.map
|