@sonisoft/now-sdk-ext-cli v1.0.0-alpha.0
@sonisoft/now-sdk-ext-cli
A CLI extending the functionality of the ServiceNow SDK.
Future capabilities will be expanded, but currently this CLI will allow you to execute a javascript file that resides on your local computer in a ServiceNow instance remotely. This mimicks the functionality of using Scripts - Background and has all of the caveats and warnings carried in doing so.
This library extends the ServiceNow SDK published originally in Washington DC. Currently you must use the ServiceNow SDK to configure your authentication credentials for a particular ServiceNow instance. Then the credential alias configured using the ServiceNow SDK can be passed to the command(s) below.
The library has a built in dependency for @servicenow/sdk version 2.0.1. You will need to install the SDK globally separately in order to use the now-sdk command.
Note: One of the current limitations of the ServiceNow SDK is that it does not work if Multifactor Authentication is enable on the user that is being used with the SDK. Either MFA on the instance needs to be turned off, or the local user account being used needs to be excluded from the MFA configuration. -- Future work of this CLI is intended to overcome this issue.
Usage
$ npm install -g @sonisoft/now-sdk-ext-cli
$ nex COMMAND
running command...
$ nex (--version)
@sonisoft/now-sdk-ext-cli/1.0.0-alpha.0 darwin-arm64 node-v22.2.0
$ nex --help [COMMAND]
USAGE
$ nex COMMAND
...
Commands
nex exec SCOPE FILE
nex help [COMMAND]
nex plugins
nex plugins add PLUGIN
nex plugins:inspect PLUGIN...
nex plugins install PLUGIN
nex plugins link PATH
nex plugins remove [PLUGIN]
nex plugins reset
nex plugins uninstall [PLUGIN]
nex plugins unlink [PLUGIN]
nex plugins update
nex exec SCOPE FILE
Execute a local javascript file on a ServiceNow instance using Scripts - Background remotely. Returns the output/raw console output that Scripts - Background outputs to the browser in order to support the execution and result being piped to another command.
USAGE
$ nex exec SCOPE FILE [--json] [-a <value>] [--log-level debug|warn|error|info|trace]
ARGUMENTS
SCOPE Scope to execute file in.
FILE File to execute in scripts background.
FLAGS
-a, --auth=<value> Auth alias to use.
GLOBAL FLAGS
--json Format output as json.
--log-level=<option> [default: info] Specify level for logging.
<options: debug|warn|error|info|trace>
DESCRIPTION
Execute a local javascript file on a ServiceNow instance using Scripts - Background remotely. Returns the output/raw
console output that Scripts - Background outputs to the browser in order to support the execution and result being
piped to another command.
EXAMPLES
$ nex exec exec global test.js --auth sn_alias
test
nex help [COMMAND]
Display help for nex.
USAGE
$ nex help [COMMAND...] [-n]
ARGUMENTS
COMMAND... Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for nex.
See code: @oclif/plugin-help
nex plugins
List installed plugins.
USAGE
$ nex plugins [--json] [--core]
FLAGS
--core Show core plugins.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
List installed plugins.
EXAMPLES
$ nex plugins
See code: @oclif/plugin-plugins
nex plugins add PLUGIN
Installs a plugin into nex.
USAGE
$ nex plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
ARGUMENTS
PLUGIN... Plugin to install.
FLAGS
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
-h, --help Show CLI help.
-s, --silent Silences npm output.
-v, --verbose Show verbose npm output.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Installs a plugin into nex.
Uses npm to install plugins.
Installation of a user-installed plugin will override a core plugin.
Use the NEX_NPM_LOG_LEVEL environment variable to set the npm loglevel.
Use the NEX_NPM_REGISTRY environment variable to set the npm registry.
ALIASES
$ nex plugins add
EXAMPLES
Install a plugin from npm registry.
$ nex plugins add myplugin
Install a plugin from a github url.
$ nex plugins add https://github.com/someuser/someplugin
Install a plugin from a github slug.
$ nex plugins add someuser/someplugin
nex plugins:inspect PLUGIN...
Displays installation properties of a plugin.
USAGE
$ nex plugins inspect PLUGIN...
ARGUMENTS
PLUGIN... [default: .] Plugin to inspect.
FLAGS
-h, --help Show CLI help.
-v, --verbose
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Displays installation properties of a plugin.
EXAMPLES
$ nex plugins inspect myplugin
See code: @oclif/plugin-plugins
nex plugins install PLUGIN
Installs a plugin into nex.
USAGE
$ nex plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
ARGUMENTS
PLUGIN... Plugin to install.
FLAGS
-f, --force Force npm to fetch remote resources even if a local copy exists on disk.
-h, --help Show CLI help.
-s, --silent Silences npm output.
-v, --verbose Show verbose npm output.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Installs a plugin into nex.
Uses npm to install plugins.
Installation of a user-installed plugin will override a core plugin.
Use the NEX_NPM_LOG_LEVEL environment variable to set the npm loglevel.
Use the NEX_NPM_REGISTRY environment variable to set the npm registry.
ALIASES
$ nex plugins add
EXAMPLES
Install a plugin from npm registry.
$ nex plugins install myplugin
Install a plugin from a github url.
$ nex plugins install https://github.com/someuser/someplugin
Install a plugin from a github slug.
$ nex plugins install someuser/someplugin
See code: @oclif/plugin-plugins
nex plugins link PATH
Links a plugin into the CLI for development.
USAGE
$ nex plugins link PATH [-h] [--install] [-v]
ARGUMENTS
PATH [default: .] path to plugin
FLAGS
-h, --help Show CLI help.
-v, --verbose
--[no-]install Install dependencies after linking the plugin.
DESCRIPTION
Links a plugin into the CLI for development.
Installation of a linked plugin will override a user-installed or core plugin.
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
command will override the user-installed or core plugin implementation. This is useful for development work.
EXAMPLES
$ nex plugins link myplugin
See code: @oclif/plugin-plugins
nex plugins remove [PLUGIN]
Removes a plugin from the CLI.
USAGE
$ nex plugins remove [PLUGIN...] [-h] [-v]
ARGUMENTS
PLUGIN... plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ nex plugins unlink
$ nex plugins remove
EXAMPLES
$ nex plugins remove myplugin
nex plugins reset
Remove all user-installed and linked plugins.
USAGE
$ nex plugins reset [--hard] [--reinstall]
FLAGS
--hard Delete node_modules and package manager related files in addition to uninstalling plugins.
--reinstall Reinstall all plugins after uninstalling.
See code: @oclif/plugin-plugins
nex plugins uninstall [PLUGIN]
Removes a plugin from the CLI.
USAGE
$ nex plugins uninstall [PLUGIN...] [-h] [-v]
ARGUMENTS
PLUGIN... plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ nex plugins unlink
$ nex plugins remove
EXAMPLES
$ nex plugins uninstall myplugin
See code: @oclif/plugin-plugins
nex plugins unlink [PLUGIN]
Removes a plugin from the CLI.
USAGE
$ nex plugins unlink [PLUGIN...] [-h] [-v]
ARGUMENTS
PLUGIN... plugin to uninstall
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Removes a plugin from the CLI.
ALIASES
$ nex plugins unlink
$ nex plugins remove
EXAMPLES
$ nex plugins unlink myplugin
nex plugins update
Update installed plugins.
USAGE
$ nex plugins update [-h] [-v]
FLAGS
-h, --help Show CLI help.
-v, --verbose
DESCRIPTION
Update installed plugins.
See code: @oclif/plugin-plugins
9 months ago