@sonisoft/now-sdk-ext-cli 2.1.0 → 2.3.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/README.md +220 -65
- package/dist/commands/flow/copy.d.ts +17 -0
- package/dist/commands/flow/copy.d.ts.map +1 -0
- package/dist/commands/flow/copy.js +79 -0
- package/dist/commands/flow/copy.js.map +1 -0
- package/dist/commands/flow/details.d.ts +17 -0
- package/dist/commands/flow/details.d.ts.map +1 -0
- package/dist/commands/flow/details.js +75 -0
- package/dist/commands/flow/details.js.map +1 -0
- package/dist/commands/flow/logs.d.ts +17 -0
- package/dist/commands/flow/logs.d.ts.map +1 -0
- package/dist/commands/flow/logs.js +79 -0
- package/dist/commands/flow/logs.js.map +1 -0
- package/dist/services/flow-display.service.d.ts +11 -0
- package/dist/services/flow-display.service.d.ts.map +1 -1
- package/dist/services/flow-display.service.js +158 -0
- package/dist/services/flow-display.service.js.map +1 -1
- package/oclif.manifest.json +410 -118
- package/package.json +2 -2
package/oclif.manifest.json
CHANGED
|
@@ -1678,6 +1678,123 @@
|
|
|
1678
1678
|
"update.js"
|
|
1679
1679
|
]
|
|
1680
1680
|
},
|
|
1681
|
+
"exec": {
|
|
1682
|
+
"aliases": [],
|
|
1683
|
+
"args": {
|
|
1684
|
+
"scope": {
|
|
1685
|
+
"description": "Scope to execute script in. Use \"global\" for global scope.",
|
|
1686
|
+
"name": "scope",
|
|
1687
|
+
"required": true
|
|
1688
|
+
},
|
|
1689
|
+
"file": {
|
|
1690
|
+
"description": "File to execute in scripts background. If omitted, starts REPL mode.",
|
|
1691
|
+
"name": "file",
|
|
1692
|
+
"required": false
|
|
1693
|
+
}
|
|
1694
|
+
},
|
|
1695
|
+
"description": "Execute JavaScript on a ServiceNow instance remotely using Scripts - Background.\n\nThis command allows you to run JavaScript either from files or interactively via REPL mode. It mimics the functionality of the Scripts - Background interface in ServiceNow, providing a way to execute scripts programmatically without manual interaction. The output is returned in real-time and can be piped to other commands or saved to files.\n\nModes:\n • File Mode: Provide a file path to execute scripts from a file\n • REPL Mode: Omit the file path to start an interactive session\n\nFeatures:\n • Execute local JavaScript files remotely\n • Interactive REPL for ad-hoc script execution\n • Script parameterization with {placeholder} replacement\n • Multi-line script support in REPL\n • Scope-aware execution (global or custom scope)\n • Real-time console output capture\n • Pipe-able output for command chaining\n • Debug logging support\n • Useful for data migration, testing, and administrative tasks\n\nScript Parameterization:\n Use {paramName} placeholders in your script files, then provide values via --params:\n • Supports any JSON-serializable values (strings, numbers, booleans)\n • Multiple parameters supported\n • All occurrences of each placeholder are replaced\n • Example: {token}, {username}, {environment}\n\nREPL Controls:\n • Press Enter to add a new line\n • Type .exec or press Ctrl+D to execute the script\n • Type .clear to clear the current input\n • Type .exit or press Ctrl+C twice to exit REPL\n\n⚠️ IMPORTANT SECURITY WARNING:\nThis command executes scripts with the same permissions and risks as using Scripts - Background directly\nin ServiceNow. Always:\n • Review scripts before execution\n • Test in non-production environments first\n • Use appropriate scoping to limit access\n • Be aware of data modification risks\n • Follow your organization's security policies\n • Never execute untrusted scripts\n\nScript Capabilities:\n Scripts run with full GlideSystem API access and can:\n • Query and modify database records\n • Create, update, and delete data\n • Execute business rules and workflows\n • Access all APIs available in Scripts - Background\n • Use gs, GlideRecord, GlideAggregate, and other server-side APIs",
|
|
1696
|
+
"examples": [
|
|
1697
|
+
{
|
|
1698
|
+
"description": "Start REPL in global scope",
|
|
1699
|
+
"command": "<%= config.bin %> <%= command.id %> global --auth dev-instance"
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
"description": "Start REPL in custom application scope",
|
|
1703
|
+
"command": "<%= config.bin %> <%= command.id %> x_my_custom_app --auth dev-instance"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
"description": "Execute a script file in global scope",
|
|
1707
|
+
"command": "<%= config.bin %> <%= command.id %> global ./scripts/cleanup.js --auth dev-instance"
|
|
1708
|
+
},
|
|
1709
|
+
{
|
|
1710
|
+
"description": "Execute a script file in a custom application scope",
|
|
1711
|
+
"command": "<%= config.bin %> <%= command.id %> x_my_custom_app ./scripts/app-config.js --auth dev-instance"
|
|
1712
|
+
},
|
|
1713
|
+
{
|
|
1714
|
+
"description": "Execute a parameterized script with single parameter",
|
|
1715
|
+
"command": "<%= config.bin %> <%= command.id %> global ./scripts/query-user.js --auth dev-instance --params '{\"username\":\"admin\"}'"
|
|
1716
|
+
},
|
|
1717
|
+
{
|
|
1718
|
+
"description": "Execute a parameterized script with multiple parameters",
|
|
1719
|
+
"command": "<%= config.bin %> <%= command.id %> global ./scripts/update-record.js --auth dev-instance --params '{\"table\":\"incident\",\"field\":\"priority\",\"value\":\"1\"}'"
|
|
1720
|
+
},
|
|
1721
|
+
{
|
|
1722
|
+
"description": "Execute and save output to a file",
|
|
1723
|
+
"command": "<%= config.bin %> <%= command.id %> global ./scripts/report.js --auth dev-instance > report.txt"
|
|
1724
|
+
},
|
|
1725
|
+
{
|
|
1726
|
+
"description": "Execute and pipe output to grep for filtering",
|
|
1727
|
+
"command": "<%= config.bin %> <%= command.id %> global ./scripts/list-users.js --auth dev-instance | grep \"admin\""
|
|
1728
|
+
},
|
|
1729
|
+
{
|
|
1730
|
+
"description": "Execute with debug logging to troubleshoot issues",
|
|
1731
|
+
"command": "<%= config.bin %> <%= command.id %> global ./script.js --auth dev-instance --log-level debug"
|
|
1732
|
+
},
|
|
1733
|
+
{
|
|
1734
|
+
"description": "Execute with parameters for template replacement",
|
|
1735
|
+
"command": "<%= config.bin %> <%= command.id %> global ./script.js --auth dev-instance --params '{\"token\":\"abc123\",\"env\":\"dev\"}'"
|
|
1736
|
+
}
|
|
1737
|
+
],
|
|
1738
|
+
"flags": {
|
|
1739
|
+
"json": {
|
|
1740
|
+
"description": "Format output as json.",
|
|
1741
|
+
"helpGroup": "GLOBAL",
|
|
1742
|
+
"name": "json",
|
|
1743
|
+
"allowNo": false,
|
|
1744
|
+
"type": "boolean"
|
|
1745
|
+
},
|
|
1746
|
+
"auth": {
|
|
1747
|
+
"char": "a",
|
|
1748
|
+
"description": "Auth alias to use.",
|
|
1749
|
+
"name": "auth",
|
|
1750
|
+
"required": false,
|
|
1751
|
+
"hasDynamicHelp": false,
|
|
1752
|
+
"multiple": false,
|
|
1753
|
+
"type": "option"
|
|
1754
|
+
},
|
|
1755
|
+
"log-level": {
|
|
1756
|
+
"helpGroup": "GLOBAL",
|
|
1757
|
+
"name": "log-level",
|
|
1758
|
+
"summary": "Specify level for logging.",
|
|
1759
|
+
"default": "info",
|
|
1760
|
+
"hasDynamicHelp": false,
|
|
1761
|
+
"multiple": false,
|
|
1762
|
+
"options": [
|
|
1763
|
+
"debug",
|
|
1764
|
+
"warn",
|
|
1765
|
+
"error",
|
|
1766
|
+
"info",
|
|
1767
|
+
"trace"
|
|
1768
|
+
],
|
|
1769
|
+
"type": "option"
|
|
1770
|
+
},
|
|
1771
|
+
"params": {
|
|
1772
|
+
"char": "p",
|
|
1773
|
+
"description": "JSON object of parameters to replace in script file. Use {paramName} syntax in your script.",
|
|
1774
|
+
"name": "params",
|
|
1775
|
+
"required": false,
|
|
1776
|
+
"hasDynamicHelp": false,
|
|
1777
|
+
"multiple": false,
|
|
1778
|
+
"type": "option"
|
|
1779
|
+
}
|
|
1780
|
+
},
|
|
1781
|
+
"hasDynamicHelp": false,
|
|
1782
|
+
"hiddenAliases": [],
|
|
1783
|
+
"id": "exec",
|
|
1784
|
+
"pluginAlias": "@sonisoft/now-sdk-ext-cli",
|
|
1785
|
+
"pluginName": "@sonisoft/now-sdk-ext-cli",
|
|
1786
|
+
"pluginType": "core",
|
|
1787
|
+
"strict": true,
|
|
1788
|
+
"enableJsonFlag": true,
|
|
1789
|
+
"autocomplete": {},
|
|
1790
|
+
"isESM": true,
|
|
1791
|
+
"relativePath": [
|
|
1792
|
+
"dist",
|
|
1793
|
+
"commands",
|
|
1794
|
+
"exec",
|
|
1795
|
+
"index.js"
|
|
1796
|
+
]
|
|
1797
|
+
},
|
|
1681
1798
|
"flow:action": {
|
|
1682
1799
|
"aliases": [],
|
|
1683
1800
|
"args": {},
|
|
@@ -1877,6 +1994,196 @@
|
|
|
1877
1994
|
"cancel.js"
|
|
1878
1995
|
]
|
|
1879
1996
|
},
|
|
1997
|
+
"flow:copy": {
|
|
1998
|
+
"aliases": [],
|
|
1999
|
+
"args": {},
|
|
2000
|
+
"description": "Copy an existing flow into a target scoped application.\n\nThis is the ServiceNow best practice before modifying any flow — OOB and shared flows must never be modified directly; always copy first. The copied flow lands in draft/unpublished state in the target scope.\n\nEnables the full CLI-driven flow development lifecycle:\n copy → pull (now-sdk transform) → modify → push → test → publish\n\nFeatures:\n • Copy flows by sys_id or scoped name\n • Specify a display name for the new copy\n • Target any scoped application by sys_id\n • Returns the new flow sys_id for use in subsequent commands",
|
|
2001
|
+
"examples": [
|
|
2002
|
+
{
|
|
2003
|
+
"description": "Copy an OOB flow into your app scope",
|
|
2004
|
+
"command": "<%= config.bin %> <%= command.id %> --source-flow-id e89e3ade731310108ef62d2b04f6a744 --name \"Copy of Change - Standard\" --target-scope 4a5a6115402946939ee48e3fe80f60f8 --auth dev"
|
|
2005
|
+
},
|
|
2006
|
+
{
|
|
2007
|
+
"description": "Copy by scoped name",
|
|
2008
|
+
"command": "<%= config.bin %> <%= command.id %> -s global.change__standard -n \"My Custom Change Flow\" -t 4a5a6115402946939ee48e3fe80f60f8 --auth dev"
|
|
2009
|
+
},
|
|
2010
|
+
{
|
|
2011
|
+
"description": "Copy with JSON output for scripting",
|
|
2012
|
+
"command": "<%= config.bin %> <%= command.id %> -s e89e3ade731310108ef62d2b04f6a744 -n \"Copy\" -t 4a5a6115402946939ee48e3fe80f60f8 --json --auth dev"
|
|
2013
|
+
}
|
|
2014
|
+
],
|
|
2015
|
+
"flags": {
|
|
2016
|
+
"json": {
|
|
2017
|
+
"char": "j",
|
|
2018
|
+
"description": "Output results as JSON",
|
|
2019
|
+
"name": "json",
|
|
2020
|
+
"required": false,
|
|
2021
|
+
"allowNo": false,
|
|
2022
|
+
"type": "boolean"
|
|
2023
|
+
},
|
|
2024
|
+
"auth": {
|
|
2025
|
+
"char": "a",
|
|
2026
|
+
"description": "Auth alias to use.",
|
|
2027
|
+
"name": "auth",
|
|
2028
|
+
"required": false,
|
|
2029
|
+
"hasDynamicHelp": false,
|
|
2030
|
+
"multiple": false,
|
|
2031
|
+
"type": "option"
|
|
2032
|
+
},
|
|
2033
|
+
"log-level": {
|
|
2034
|
+
"helpGroup": "GLOBAL",
|
|
2035
|
+
"name": "log-level",
|
|
2036
|
+
"summary": "Specify level for logging.",
|
|
2037
|
+
"default": "info",
|
|
2038
|
+
"hasDynamicHelp": false,
|
|
2039
|
+
"multiple": false,
|
|
2040
|
+
"options": [
|
|
2041
|
+
"debug",
|
|
2042
|
+
"warn",
|
|
2043
|
+
"error",
|
|
2044
|
+
"info",
|
|
2045
|
+
"trace"
|
|
2046
|
+
],
|
|
2047
|
+
"type": "option"
|
|
2048
|
+
},
|
|
2049
|
+
"source-flow-id": {
|
|
2050
|
+
"char": "s",
|
|
2051
|
+
"description": "Source flow sys_id or scoped name (e.g. global.change__standard)",
|
|
2052
|
+
"name": "source-flow-id",
|
|
2053
|
+
"required": true,
|
|
2054
|
+
"hasDynamicHelp": false,
|
|
2055
|
+
"multiple": false,
|
|
2056
|
+
"type": "option"
|
|
2057
|
+
},
|
|
2058
|
+
"name": {
|
|
2059
|
+
"char": "n",
|
|
2060
|
+
"description": "Display name for the new copied flow",
|
|
2061
|
+
"name": "name",
|
|
2062
|
+
"required": true,
|
|
2063
|
+
"hasDynamicHelp": false,
|
|
2064
|
+
"multiple": false,
|
|
2065
|
+
"type": "option"
|
|
2066
|
+
},
|
|
2067
|
+
"target-scope": {
|
|
2068
|
+
"char": "t",
|
|
2069
|
+
"description": "Scope sys_id of the target application (use `nex scope` to find scope sys_ids)",
|
|
2070
|
+
"name": "target-scope",
|
|
2071
|
+
"required": true,
|
|
2072
|
+
"hasDynamicHelp": false,
|
|
2073
|
+
"multiple": false,
|
|
2074
|
+
"type": "option"
|
|
2075
|
+
}
|
|
2076
|
+
},
|
|
2077
|
+
"hasDynamicHelp": false,
|
|
2078
|
+
"hiddenAliases": [],
|
|
2079
|
+
"id": "flow:copy",
|
|
2080
|
+
"pluginAlias": "@sonisoft/now-sdk-ext-cli",
|
|
2081
|
+
"pluginName": "@sonisoft/now-sdk-ext-cli",
|
|
2082
|
+
"pluginType": "core",
|
|
2083
|
+
"strict": true,
|
|
2084
|
+
"enableJsonFlag": true,
|
|
2085
|
+
"isESM": true,
|
|
2086
|
+
"relativePath": [
|
|
2087
|
+
"dist",
|
|
2088
|
+
"commands",
|
|
2089
|
+
"flow",
|
|
2090
|
+
"copy.js"
|
|
2091
|
+
]
|
|
2092
|
+
},
|
|
2093
|
+
"flow:details": {
|
|
2094
|
+
"aliases": [],
|
|
2095
|
+
"args": {},
|
|
2096
|
+
"description": "Get rich execution details for a flow context.\n\nReturns per-action timing, inputs, outputs, and high-level metadata (state, runtime, who ran it, test vs production). This is the primary diagnostic command after flow test or flow run.\n\nUses the ProcessFlow operations API (GET /api/now/processflow/operations/flow/context/{id}), the same endpoint Flow Designer uses to display execution details.\n\nNOTE: Requires flow operations logging to be enabled on the instance. If the execution report is unavailable, a notice will explain why.\n\nTypical workflow:\n flow test → flow details → diagnose → modify flow → flow test again",
|
|
2097
|
+
"examples": [
|
|
2098
|
+
{
|
|
2099
|
+
"description": "Get execution details after testing a flow",
|
|
2100
|
+
"command": "<%= config.bin %> <%= command.id %> --context-id d4e5f6789012345678abcdef01234567 --auth dev"
|
|
2101
|
+
},
|
|
2102
|
+
{
|
|
2103
|
+
"description": "Get details with explicit scope",
|
|
2104
|
+
"command": "<%= config.bin %> <%= command.id %> -c d4e5f6789012345678abcdef01234567 --scope x_myapp --auth dev"
|
|
2105
|
+
},
|
|
2106
|
+
{
|
|
2107
|
+
"description": "Get details with JSON output for scripting",
|
|
2108
|
+
"command": "<%= config.bin %> <%= command.id %> -c d4e5f6789012345678abcdef01234567 --json --auth dev"
|
|
2109
|
+
}
|
|
2110
|
+
],
|
|
2111
|
+
"flags": {
|
|
2112
|
+
"json": {
|
|
2113
|
+
"char": "j",
|
|
2114
|
+
"description": "Output results as JSON",
|
|
2115
|
+
"name": "json",
|
|
2116
|
+
"required": false,
|
|
2117
|
+
"allowNo": false,
|
|
2118
|
+
"type": "boolean"
|
|
2119
|
+
},
|
|
2120
|
+
"auth": {
|
|
2121
|
+
"char": "a",
|
|
2122
|
+
"description": "Auth alias to use.",
|
|
2123
|
+
"name": "auth",
|
|
2124
|
+
"required": false,
|
|
2125
|
+
"hasDynamicHelp": false,
|
|
2126
|
+
"multiple": false,
|
|
2127
|
+
"type": "option"
|
|
2128
|
+
},
|
|
2129
|
+
"log-level": {
|
|
2130
|
+
"helpGroup": "GLOBAL",
|
|
2131
|
+
"name": "log-level",
|
|
2132
|
+
"summary": "Specify level for logging.",
|
|
2133
|
+
"default": "info",
|
|
2134
|
+
"hasDynamicHelp": false,
|
|
2135
|
+
"multiple": false,
|
|
2136
|
+
"options": [
|
|
2137
|
+
"debug",
|
|
2138
|
+
"warn",
|
|
2139
|
+
"error",
|
|
2140
|
+
"info",
|
|
2141
|
+
"trace"
|
|
2142
|
+
],
|
|
2143
|
+
"type": "option"
|
|
2144
|
+
},
|
|
2145
|
+
"context-id": {
|
|
2146
|
+
"char": "c",
|
|
2147
|
+
"description": "Flow context sys_id returned by flow test, flow run, flow subflow, or flow action",
|
|
2148
|
+
"name": "context-id",
|
|
2149
|
+
"required": true,
|
|
2150
|
+
"hasDynamicHelp": false,
|
|
2151
|
+
"multiple": false,
|
|
2152
|
+
"type": "option"
|
|
2153
|
+
},
|
|
2154
|
+
"scope": {
|
|
2155
|
+
"description": "Scope sys_id for the ProcessFlow API transaction scope parameter",
|
|
2156
|
+
"name": "scope",
|
|
2157
|
+
"required": false,
|
|
2158
|
+
"hasDynamicHelp": false,
|
|
2159
|
+
"multiple": false,
|
|
2160
|
+
"type": "option"
|
|
2161
|
+
},
|
|
2162
|
+
"include-definition": {
|
|
2163
|
+
"char": "d",
|
|
2164
|
+
"description": "Include the full flow definition snapshot in the response",
|
|
2165
|
+
"name": "include-definition",
|
|
2166
|
+
"required": false,
|
|
2167
|
+
"allowNo": false,
|
|
2168
|
+
"type": "boolean"
|
|
2169
|
+
}
|
|
2170
|
+
},
|
|
2171
|
+
"hasDynamicHelp": false,
|
|
2172
|
+
"hiddenAliases": [],
|
|
2173
|
+
"id": "flow:details",
|
|
2174
|
+
"pluginAlias": "@sonisoft/now-sdk-ext-cli",
|
|
2175
|
+
"pluginName": "@sonisoft/now-sdk-ext-cli",
|
|
2176
|
+
"pluginType": "core",
|
|
2177
|
+
"strict": true,
|
|
2178
|
+
"enableJsonFlag": true,
|
|
2179
|
+
"isESM": true,
|
|
2180
|
+
"relativePath": [
|
|
2181
|
+
"dist",
|
|
2182
|
+
"commands",
|
|
2183
|
+
"flow",
|
|
2184
|
+
"details.js"
|
|
2185
|
+
]
|
|
2186
|
+
},
|
|
1880
2187
|
"flow:error": {
|
|
1881
2188
|
"aliases": [],
|
|
1882
2189
|
"args": {},
|
|
@@ -1955,6 +2262,108 @@
|
|
|
1955
2262
|
"error.js"
|
|
1956
2263
|
]
|
|
1957
2264
|
},
|
|
2265
|
+
"flow:logs": {
|
|
2266
|
+
"aliases": [],
|
|
2267
|
+
"args": {},
|
|
2268
|
+
"description": "Retrieve flow execution log entries for a given context.\n\nLog entries include error messages, step-level debug output, and cancellation reasons. Use this alongside flow details to get the full picture of what happened during an execution.\n\nQueries sys_flow_log entries and maps numeric log levels to human-readable names (ERROR, WARN, INFO, DEBUG).\n\nNOTE: Log entries may be empty for simple successful executions, or if the flow reporting level is set to NONE. Errors and warnings are always logged regardless of the reporting level setting.",
|
|
2269
|
+
"examples": [
|
|
2270
|
+
{
|
|
2271
|
+
"description": "Get flow execution logs",
|
|
2272
|
+
"command": "<%= config.bin %> <%= command.id %> --context-id d4e5f6789012345678abcdef01234567 --auth dev"
|
|
2273
|
+
},
|
|
2274
|
+
{
|
|
2275
|
+
"description": "Get latest 10 log entries in reverse order",
|
|
2276
|
+
"command": "<%= config.bin %> <%= command.id %> -c d4e5f6789012345678abcdef01234567 --limit 10 --order desc --auth dev"
|
|
2277
|
+
},
|
|
2278
|
+
{
|
|
2279
|
+
"description": "Get logs with JSON output for scripting",
|
|
2280
|
+
"command": "<%= config.bin %> <%= command.id %> -c d4e5f6789012345678abcdef01234567 --json --auth dev"
|
|
2281
|
+
}
|
|
2282
|
+
],
|
|
2283
|
+
"flags": {
|
|
2284
|
+
"json": {
|
|
2285
|
+
"char": "j",
|
|
2286
|
+
"description": "Output results as JSON",
|
|
2287
|
+
"name": "json",
|
|
2288
|
+
"required": false,
|
|
2289
|
+
"allowNo": false,
|
|
2290
|
+
"type": "boolean"
|
|
2291
|
+
},
|
|
2292
|
+
"auth": {
|
|
2293
|
+
"char": "a",
|
|
2294
|
+
"description": "Auth alias to use.",
|
|
2295
|
+
"name": "auth",
|
|
2296
|
+
"required": false,
|
|
2297
|
+
"hasDynamicHelp": false,
|
|
2298
|
+
"multiple": false,
|
|
2299
|
+
"type": "option"
|
|
2300
|
+
},
|
|
2301
|
+
"log-level": {
|
|
2302
|
+
"helpGroup": "GLOBAL",
|
|
2303
|
+
"name": "log-level",
|
|
2304
|
+
"summary": "Specify level for logging.",
|
|
2305
|
+
"default": "info",
|
|
2306
|
+
"hasDynamicHelp": false,
|
|
2307
|
+
"multiple": false,
|
|
2308
|
+
"options": [
|
|
2309
|
+
"debug",
|
|
2310
|
+
"warn",
|
|
2311
|
+
"error",
|
|
2312
|
+
"info",
|
|
2313
|
+
"trace"
|
|
2314
|
+
],
|
|
2315
|
+
"type": "option"
|
|
2316
|
+
},
|
|
2317
|
+
"context-id": {
|
|
2318
|
+
"char": "c",
|
|
2319
|
+
"description": "Flow context sys_id returned by flow test, flow run, flow subflow, or flow action",
|
|
2320
|
+
"name": "context-id",
|
|
2321
|
+
"required": true,
|
|
2322
|
+
"hasDynamicHelp": false,
|
|
2323
|
+
"multiple": false,
|
|
2324
|
+
"type": "option"
|
|
2325
|
+
},
|
|
2326
|
+
"limit": {
|
|
2327
|
+
"char": "l",
|
|
2328
|
+
"description": "Maximum number of log entries to return",
|
|
2329
|
+
"name": "limit",
|
|
2330
|
+
"required": false,
|
|
2331
|
+
"default": 100,
|
|
2332
|
+
"hasDynamicHelp": false,
|
|
2333
|
+
"multiple": false,
|
|
2334
|
+
"type": "option"
|
|
2335
|
+
},
|
|
2336
|
+
"order": {
|
|
2337
|
+
"char": "o",
|
|
2338
|
+
"description": "Order direction: asc (oldest first) or desc (newest first)",
|
|
2339
|
+
"name": "order",
|
|
2340
|
+
"required": false,
|
|
2341
|
+
"default": "asc",
|
|
2342
|
+
"hasDynamicHelp": false,
|
|
2343
|
+
"multiple": false,
|
|
2344
|
+
"options": [
|
|
2345
|
+
"asc",
|
|
2346
|
+
"desc"
|
|
2347
|
+
],
|
|
2348
|
+
"type": "option"
|
|
2349
|
+
}
|
|
2350
|
+
},
|
|
2351
|
+
"hasDynamicHelp": false,
|
|
2352
|
+
"hiddenAliases": [],
|
|
2353
|
+
"id": "flow:logs",
|
|
2354
|
+
"pluginAlias": "@sonisoft/now-sdk-ext-cli",
|
|
2355
|
+
"pluginName": "@sonisoft/now-sdk-ext-cli",
|
|
2356
|
+
"pluginType": "core",
|
|
2357
|
+
"strict": true,
|
|
2358
|
+
"enableJsonFlag": true,
|
|
2359
|
+
"isESM": true,
|
|
2360
|
+
"relativePath": [
|
|
2361
|
+
"dist",
|
|
2362
|
+
"commands",
|
|
2363
|
+
"flow",
|
|
2364
|
+
"logs.js"
|
|
2365
|
+
]
|
|
2366
|
+
},
|
|
1958
2367
|
"flow:message": {
|
|
1959
2368
|
"aliases": [],
|
|
1960
2369
|
"args": {},
|
|
@@ -2545,123 +2954,6 @@
|
|
|
2545
2954
|
"test.js"
|
|
2546
2955
|
]
|
|
2547
2956
|
},
|
|
2548
|
-
"exec": {
|
|
2549
|
-
"aliases": [],
|
|
2550
|
-
"args": {
|
|
2551
|
-
"scope": {
|
|
2552
|
-
"description": "Scope to execute script in. Use \"global\" for global scope.",
|
|
2553
|
-
"name": "scope",
|
|
2554
|
-
"required": true
|
|
2555
|
-
},
|
|
2556
|
-
"file": {
|
|
2557
|
-
"description": "File to execute in scripts background. If omitted, starts REPL mode.",
|
|
2558
|
-
"name": "file",
|
|
2559
|
-
"required": false
|
|
2560
|
-
}
|
|
2561
|
-
},
|
|
2562
|
-
"description": "Execute JavaScript on a ServiceNow instance remotely using Scripts - Background.\n\nThis command allows you to run JavaScript either from files or interactively via REPL mode. It mimics the functionality of the Scripts - Background interface in ServiceNow, providing a way to execute scripts programmatically without manual interaction. The output is returned in real-time and can be piped to other commands or saved to files.\n\nModes:\n • File Mode: Provide a file path to execute scripts from a file\n • REPL Mode: Omit the file path to start an interactive session\n\nFeatures:\n • Execute local JavaScript files remotely\n • Interactive REPL for ad-hoc script execution\n • Script parameterization with {placeholder} replacement\n • Multi-line script support in REPL\n • Scope-aware execution (global or custom scope)\n • Real-time console output capture\n • Pipe-able output for command chaining\n • Debug logging support\n • Useful for data migration, testing, and administrative tasks\n\nScript Parameterization:\n Use {paramName} placeholders in your script files, then provide values via --params:\n • Supports any JSON-serializable values (strings, numbers, booleans)\n • Multiple parameters supported\n • All occurrences of each placeholder are replaced\n • Example: {token}, {username}, {environment}\n\nREPL Controls:\n • Press Enter to add a new line\n • Type .exec or press Ctrl+D to execute the script\n • Type .clear to clear the current input\n • Type .exit or press Ctrl+C twice to exit REPL\n\n⚠️ IMPORTANT SECURITY WARNING:\nThis command executes scripts with the same permissions and risks as using Scripts - Background directly\nin ServiceNow. Always:\n • Review scripts before execution\n • Test in non-production environments first\n • Use appropriate scoping to limit access\n • Be aware of data modification risks\n • Follow your organization's security policies\n • Never execute untrusted scripts\n\nScript Capabilities:\n Scripts run with full GlideSystem API access and can:\n • Query and modify database records\n • Create, update, and delete data\n • Execute business rules and workflows\n • Access all APIs available in Scripts - Background\n • Use gs, GlideRecord, GlideAggregate, and other server-side APIs",
|
|
2563
|
-
"examples": [
|
|
2564
|
-
{
|
|
2565
|
-
"description": "Start REPL in global scope",
|
|
2566
|
-
"command": "<%= config.bin %> <%= command.id %> global --auth dev-instance"
|
|
2567
|
-
},
|
|
2568
|
-
{
|
|
2569
|
-
"description": "Start REPL in custom application scope",
|
|
2570
|
-
"command": "<%= config.bin %> <%= command.id %> x_my_custom_app --auth dev-instance"
|
|
2571
|
-
},
|
|
2572
|
-
{
|
|
2573
|
-
"description": "Execute a script file in global scope",
|
|
2574
|
-
"command": "<%= config.bin %> <%= command.id %> global ./scripts/cleanup.js --auth dev-instance"
|
|
2575
|
-
},
|
|
2576
|
-
{
|
|
2577
|
-
"description": "Execute a script file in a custom application scope",
|
|
2578
|
-
"command": "<%= config.bin %> <%= command.id %> x_my_custom_app ./scripts/app-config.js --auth dev-instance"
|
|
2579
|
-
},
|
|
2580
|
-
{
|
|
2581
|
-
"description": "Execute a parameterized script with single parameter",
|
|
2582
|
-
"command": "<%= config.bin %> <%= command.id %> global ./scripts/query-user.js --auth dev-instance --params '{\"username\":\"admin\"}'"
|
|
2583
|
-
},
|
|
2584
|
-
{
|
|
2585
|
-
"description": "Execute a parameterized script with multiple parameters",
|
|
2586
|
-
"command": "<%= config.bin %> <%= command.id %> global ./scripts/update-record.js --auth dev-instance --params '{\"table\":\"incident\",\"field\":\"priority\",\"value\":\"1\"}'"
|
|
2587
|
-
},
|
|
2588
|
-
{
|
|
2589
|
-
"description": "Execute and save output to a file",
|
|
2590
|
-
"command": "<%= config.bin %> <%= command.id %> global ./scripts/report.js --auth dev-instance > report.txt"
|
|
2591
|
-
},
|
|
2592
|
-
{
|
|
2593
|
-
"description": "Execute and pipe output to grep for filtering",
|
|
2594
|
-
"command": "<%= config.bin %> <%= command.id %> global ./scripts/list-users.js --auth dev-instance | grep \"admin\""
|
|
2595
|
-
},
|
|
2596
|
-
{
|
|
2597
|
-
"description": "Execute with debug logging to troubleshoot issues",
|
|
2598
|
-
"command": "<%= config.bin %> <%= command.id %> global ./script.js --auth dev-instance --log-level debug"
|
|
2599
|
-
},
|
|
2600
|
-
{
|
|
2601
|
-
"description": "Execute with parameters for template replacement",
|
|
2602
|
-
"command": "<%= config.bin %> <%= command.id %> global ./script.js --auth dev-instance --params '{\"token\":\"abc123\",\"env\":\"dev\"}'"
|
|
2603
|
-
}
|
|
2604
|
-
],
|
|
2605
|
-
"flags": {
|
|
2606
|
-
"json": {
|
|
2607
|
-
"description": "Format output as json.",
|
|
2608
|
-
"helpGroup": "GLOBAL",
|
|
2609
|
-
"name": "json",
|
|
2610
|
-
"allowNo": false,
|
|
2611
|
-
"type": "boolean"
|
|
2612
|
-
},
|
|
2613
|
-
"auth": {
|
|
2614
|
-
"char": "a",
|
|
2615
|
-
"description": "Auth alias to use.",
|
|
2616
|
-
"name": "auth",
|
|
2617
|
-
"required": false,
|
|
2618
|
-
"hasDynamicHelp": false,
|
|
2619
|
-
"multiple": false,
|
|
2620
|
-
"type": "option"
|
|
2621
|
-
},
|
|
2622
|
-
"log-level": {
|
|
2623
|
-
"helpGroup": "GLOBAL",
|
|
2624
|
-
"name": "log-level",
|
|
2625
|
-
"summary": "Specify level for logging.",
|
|
2626
|
-
"default": "info",
|
|
2627
|
-
"hasDynamicHelp": false,
|
|
2628
|
-
"multiple": false,
|
|
2629
|
-
"options": [
|
|
2630
|
-
"debug",
|
|
2631
|
-
"warn",
|
|
2632
|
-
"error",
|
|
2633
|
-
"info",
|
|
2634
|
-
"trace"
|
|
2635
|
-
],
|
|
2636
|
-
"type": "option"
|
|
2637
|
-
},
|
|
2638
|
-
"params": {
|
|
2639
|
-
"char": "p",
|
|
2640
|
-
"description": "JSON object of parameters to replace in script file. Use {paramName} syntax in your script.",
|
|
2641
|
-
"name": "params",
|
|
2642
|
-
"required": false,
|
|
2643
|
-
"hasDynamicHelp": false,
|
|
2644
|
-
"multiple": false,
|
|
2645
|
-
"type": "option"
|
|
2646
|
-
}
|
|
2647
|
-
},
|
|
2648
|
-
"hasDynamicHelp": false,
|
|
2649
|
-
"hiddenAliases": [],
|
|
2650
|
-
"id": "exec",
|
|
2651
|
-
"pluginAlias": "@sonisoft/now-sdk-ext-cli",
|
|
2652
|
-
"pluginName": "@sonisoft/now-sdk-ext-cli",
|
|
2653
|
-
"pluginType": "core",
|
|
2654
|
-
"strict": true,
|
|
2655
|
-
"enableJsonFlag": true,
|
|
2656
|
-
"autocomplete": {},
|
|
2657
|
-
"isESM": true,
|
|
2658
|
-
"relativePath": [
|
|
2659
|
-
"dist",
|
|
2660
|
-
"commands",
|
|
2661
|
-
"exec",
|
|
2662
|
-
"index.js"
|
|
2663
|
-
]
|
|
2664
|
-
},
|
|
2665
2957
|
"health:check": {
|
|
2666
2958
|
"aliases": [],
|
|
2667
2959
|
"args": {},
|
|
@@ -6126,5 +6418,5 @@
|
|
|
6126
6418
|
]
|
|
6127
6419
|
}
|
|
6128
6420
|
},
|
|
6129
|
-
"version": "2.
|
|
6421
|
+
"version": "2.3.0"
|
|
6130
6422
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonisoft/now-sdk-ext-cli",
|
|
3
3
|
"description": "A CLI extending the functionality of the ServiceNow SDK.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.0",
|
|
5
5
|
"author": "Chris Nanda",
|
|
6
6
|
"bin": {
|
|
7
7
|
"nex": "./bin/run.js"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@servicenow/sdk-cli": "4.3.0",
|
|
18
18
|
"@servicenow/sdk-cli-core": "3.0.3",
|
|
19
19
|
"@servicenow/sdk-core": "4.3.0",
|
|
20
|
-
"@sonisoft/now-sdk-ext-core": "^3.
|
|
20
|
+
"@sonisoft/now-sdk-ext-core": "^3.8.0",
|
|
21
21
|
"@ts-morph/common": "^0.24.0",
|
|
22
22
|
"chalk": "^4.1.2",
|
|
23
23
|
"cometd": "^8.0.4",
|