@sonisoft/now-sdk-ext-cli 2.0.1 → 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.
@@ -1994,6 +1994,196 @@
1994
1994
  "cancel.js"
1995
1995
  ]
1996
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
+ },
1997
2187
  "flow:error": {
1998
2188
  "aliases": [],
1999
2189
  "args": {},
@@ -2072,6 +2262,108 @@
2072
2262
  "error.js"
2073
2263
  ]
2074
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
+ },
2075
2367
  "flow:message": {
2076
2368
  "aliases": [],
2077
2369
  "args": {},
@@ -2257,7 +2549,7 @@
2257
2549
  "flow:run": {
2258
2550
  "aliases": [],
2259
2551
  "args": {},
2260
- "description": "Execute a Flow Designer flow by scoped name.\n\nRuns a flow using the sn_fd.FlowAPI ScriptableFlowRunner. Supports foreground (synchronous) and background (asynchronous) execution modes.\n\nFeatures:\n • Execute flows by scoped name (e.g. global.my_flow)\n • Pass input values as JSON\n • Foreground or background execution mode\n • Quick mode to skip execution detail records\n • Returns context ID, outputs, and debug information",
2552
+ "description": "Execute a published Flow Designer flow by scoped name.\n\nRuns a flow using the sn_fd.FlowAPI ScriptableFlowRunner. Supports foreground (synchronous) and background (asynchronous) execution modes.\n\nNote: This command requires the flow to be published. For testing flows that are not yet published (draft/saved state), use `flow test` instead.\n\nFeatures:\n • Execute flows by scoped name (e.g. global.my_flow)\n • Pass input values as JSON\n • Foreground or background execution mode\n • Quick mode to skip execution detail records\n • Returns context ID, outputs, and debug information",
2261
2553
  "examples": [
2262
2554
  {
2263
2555
  "description": "Run a flow in foreground mode",
@@ -2451,7 +2743,7 @@
2451
2743
  "flow:subflow": {
2452
2744
  "aliases": [],
2453
2745
  "args": {},
2454
- "description": "Execute a Flow Designer subflow by scoped name.\n\nRuns a subflow using the sn_fd.FlowAPI ScriptableFlowRunner.\n\nFeatures:\n • Execute subflows by scoped name\n • Pass input values as JSON\n • Foreground or background execution mode\n • Returns context ID, outputs, and debug information",
2746
+ "description": "Execute a published Flow Designer subflow by scoped name.\n\nRuns a subflow using the sn_fd.FlowAPI ScriptableFlowRunner.\n\nNote: This command requires the subflow to be published. For testing flows that are not yet published (draft/saved state), use `flow test` instead.\n\nFeatures:\n • Execute subflows by scoped name\n • Pass input values as JSON\n • Foreground or background execution mode\n • Returns context ID, outputs, and debug information",
2455
2747
  "examples": [
2456
2748
  {
2457
2749
  "description": "Run a subflow",
@@ -2560,6 +2852,108 @@
2560
2852
  "subflow.js"
2561
2853
  ]
2562
2854
  },
2855
+ "flow:test": {
2856
+ "aliases": [],
2857
+ "args": {},
2858
+ "description": "Test a Flow Designer flow without requiring it to be published.\n\nInvokes the same API as the \"Test\" button in Flow Designer, running the flow in its current saved (draft) state. Unlike `flow run` which requires a published flow and uses sn_fd.FlowAPI, `flow test` works on unpublished drafts via the ProcessFlow REST API.\n\nFeatures:\n • Test flows by sys_id or scoped name\n • Pass trigger output values as JSON via --output-map\n • Auto-resolves scope from flow definition if not provided\n • Synchronous or asynchronous execution",
2859
+ "examples": [
2860
+ {
2861
+ "description": "Test a flow by sys_id",
2862
+ "command": "<%= config.bin %> <%= command.id %> --flow-id 887dda5583237210fdb8f7b6feaad32c --output-map '{\"current\":\"0ecd7552db252200a6a2b31be0b8f5e6\",\"table_name\":\"change_request\"}' --auth dev"
2863
+ },
2864
+ {
2865
+ "description": "Test a flow by scoped name with explicit scope",
2866
+ "command": "<%= config.bin %> <%= command.id %> -f x_myapp.my_flow -o '{\"current\":\"abc123\",\"table_name\":\"incident\"}' --scope x_myapp --auth dev"
2867
+ },
2868
+ {
2869
+ "description": "Test with JSON output",
2870
+ "command": "<%= config.bin %> <%= command.id %> -f 887dda5583237210fdb8f7b6feaad32c -o '{\"current\":\"abc123\"}' --json --auth dev"
2871
+ }
2872
+ ],
2873
+ "flags": {
2874
+ "json": {
2875
+ "char": "j",
2876
+ "description": "Output results as JSON",
2877
+ "name": "json",
2878
+ "required": false,
2879
+ "allowNo": false,
2880
+ "type": "boolean"
2881
+ },
2882
+ "auth": {
2883
+ "char": "a",
2884
+ "description": "Auth alias to use.",
2885
+ "name": "auth",
2886
+ "required": false,
2887
+ "hasDynamicHelp": false,
2888
+ "multiple": false,
2889
+ "type": "option"
2890
+ },
2891
+ "log-level": {
2892
+ "helpGroup": "GLOBAL",
2893
+ "name": "log-level",
2894
+ "summary": "Specify level for logging.",
2895
+ "default": "info",
2896
+ "hasDynamicHelp": false,
2897
+ "multiple": false,
2898
+ "options": [
2899
+ "debug",
2900
+ "warn",
2901
+ "error",
2902
+ "info",
2903
+ "trace"
2904
+ ],
2905
+ "type": "option"
2906
+ },
2907
+ "flow-id": {
2908
+ "char": "f",
2909
+ "description": "Flow sys_id or scoped name (e.g. x_myapp.my_flow)",
2910
+ "name": "flow-id",
2911
+ "required": true,
2912
+ "hasDynamicHelp": false,
2913
+ "multiple": false,
2914
+ "type": "option"
2915
+ },
2916
+ "output-map": {
2917
+ "char": "o",
2918
+ "description": "JSON mapping of trigger output variable names to test values (e.g. '{\"current\":\"<sys_id>\",\"table_name\":\"change_request\"}')",
2919
+ "name": "output-map",
2920
+ "required": true,
2921
+ "hasDynamicHelp": false,
2922
+ "multiple": false,
2923
+ "type": "option"
2924
+ },
2925
+ "scope": {
2926
+ "description": "Scope sys_id for transaction scope (auto-resolved from flow definition if omitted)",
2927
+ "name": "scope",
2928
+ "required": false,
2929
+ "hasDynamicHelp": false,
2930
+ "multiple": false,
2931
+ "type": "option"
2932
+ },
2933
+ "synchronous": {
2934
+ "description": "Run test synchronously (default: true)",
2935
+ "name": "synchronous",
2936
+ "required": false,
2937
+ "allowNo": true,
2938
+ "type": "boolean"
2939
+ }
2940
+ },
2941
+ "hasDynamicHelp": false,
2942
+ "hiddenAliases": [],
2943
+ "id": "flow:test",
2944
+ "pluginAlias": "@sonisoft/now-sdk-ext-cli",
2945
+ "pluginName": "@sonisoft/now-sdk-ext-cli",
2946
+ "pluginType": "core",
2947
+ "strict": true,
2948
+ "enableJsonFlag": true,
2949
+ "isESM": true,
2950
+ "relativePath": [
2951
+ "dist",
2952
+ "commands",
2953
+ "flow",
2954
+ "test.js"
2955
+ ]
2956
+ },
2563
2957
  "health:check": {
2564
2958
  "aliases": [],
2565
2959
  "args": {},
@@ -6024,5 +6418,5 @@
6024
6418
  ]
6025
6419
  }
6026
6420
  },
6027
- "version": "2.0.1"
6421
+ "version": "2.3.0"
6028
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.0.1",
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.4.0",
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",