{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":2468,"path":"application-development/servicenow-sdk/servicenow-sdk-cli-commands.md","title":"ServiceNow SDK CLI","bundle":null,"doc_type":null,"release":"australia","body":"\n# ServiceNow SDK CLI\n\nUse the ServiceNow SDK command-line interface \\(CLI\\) to manage changes between a local application and the application on an instance.\n\n**Note:** For the latest ServiceNow SDK CLI documentation, see the [ServiceNow SDK CLI reference](https://servicenow.github.io/sdk/cli) on GitHub.\n\nFrom the command-line tool on your system, enter `now-sdk` to start the CLI and return a list of available commands or `now-sdk [command]` to begin using the ServiceNow SDK.\n\n**Note:** If you use `npx` to install the ServiceNow SDK in application rather than globally, you must use `npx @servicenow/sdk [command]` rather than `now-sdk [command]` with the ServiceNow SDK CLI.\n\nThe CLI includes the following commands and global options:\n\n|Option|Description|\n|------|-----------|\n|--version, -v|Return the version of the CLI.|\n|--help, -h|Return information about commands, sub-commands, and parameters.|\n|--debug, -d|Return the debug logs generated with a command.|\n\n**Parent Topic:**[ServiceNow SDK reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/servicenow-sdk-reference.md)\n\n## auth\n\nAuthenticate to an instance and store, update, or view user credentials for accessing an instance on your system.\n\nThe `auth` command has parameters for adding credentials, deleting credentials, listing credentials, and setting credentials to use by default. To use non-interactive authentication in CI/CD pipelines, see the [install](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/servicenow-sdk-cli-commands.md) command.\n\nFor more information, see [Authenticating to a ServiceNow instance with the ServiceNow SDK](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/authenticate-instance-now-sdk.md).\n\n### add\n\nStore credentials in the device keychain or credential manager on your system.\n\nThe `auth` command has the following structure with the `--add` parameter:\n\n```cmd\nnpx @servicenow/sdk auth [--add <instance url>] [--type <auth method>] [--alias <alias>]\n```\n\n**Note:** Using the `npx` command installs the ServiceNow SDK in your application directory instead of globally.\n\n|Parameter|Type|Description|Default value|\n|---------|----|-----------|-------------|\n|--add|String|The URL of the target instance to access and to which you install applications. The instance must be on the Washington DC release or later.|—|\n\n<table id=\"table_erc_hwb_l2c\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\n--type\n\n</td><td>\n\nString\n\n</td><td>\n\nThe method to use to authenticate with the target instance. Specify `basic` for basic authentication or `oauth` for OAuth 2.0 authentication.\n\n</td><td>\n\noauth\n\n</td></tr><tr><td>\n\n--alias\n\n</td><td>\n\nString\n\n</td><td>\n\nThe alias for the instance and user credentials.The alias can be used for authentication with the `init`, `transform`, `dependencies`, and `install` commands.\n\n</td><td>\n\n—\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnpx @servicenow/sdk auth --add https://myinstance.service-now.com --type oauth --alias devuser1\n```\n\n### delete\n\nRemove credentials in the device keychain or credential manager on your system.\n\nThe `auth` command has the following structure with the `--delete` parameter:\n\n```cmd\nnow-sdk auth [--delete <alias or all>]\n```\n\n<table id=\"table_jbw_rxb_l2c\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\n--delete\n\n</td><td>\n\nString\n\n</td><td>\n\nThe alias for the instance and user credentials.\n\n To delete all credentials, set this parameter to `--delete all`.\n\n</td><td>\n\n—\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnow-sdk auth --delete devuser1\n```\n\n### list\n\nView credentials saved in the device keychain or credential manager on your system. Passwords and authentication codesaren't returned.\n\nThe `auth` command has the following structure with the `--list` parameter:\n\n```cmd\nnow-sdk auth [--list]\n```\n\n|Parameter|Type|Description|Default value|\n|---------|----|-----------|-------------|\n|--list|String|Lists all available authentication credentials.|—|\n\nFor example:\n\n```cmd\nnow-sdk auth --list\n```\n\n### use\n\nSet the credentials to be used by commands by default.\n\nThe `auth` command has the following structure with the `--use` parameter:\n\n```cmd\nnow-sdk auth [--use <alias>]\n```\n\n|Parameter|Type|Description|Default value|\n|---------|----|-----------|-------------|\n|--use|String|The alias for the instance and user credentials.|—|\n\nFor example:\n\n```cmd\nnow-sdk auth --use devuser1\n```\n\n## init\n\nCreate an application or convert an existing application to support development in source code. The application is added in the current directory.\n\nTo create an application, you can run the `init` command without any optional parameters \\(`now-sdk init`\\). To convert an existing application, you must include the `--from` parameter to provide the sys\\_id of an application on an instance or a path to a local directory that contains an application.\n\nAfter initializing an application, you must install the required third-party dependencies using your preferred package manager before building the application. For example, if you use Node Package Manager \\(npm\\), run `npm install`.\n\nThe `init` command has the following structure:\n\n```cmd\nnpx @servicenow/sdk init [--from <sys_id or path>] [--appName <name>] [--packageName <name>] [--scopeName <name>] [--auth <alias>] \\[--template &lt;template&gt;\\]\n```\n\n**Note:** Using the `npx` command installs the ServiceNow SDK in your application directory instead of globally.\n\n<table id=\"table_bny_zfc_l2c\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\n--from\n\n</td><td>\n\nString\n\n</td><td>\n\nA sys\\_id of an application on the instance or a path to a local directory that contains an application to convert to support development in source code.Converting an application adds the necessary files and directories for using the ServiceNow SDK locally and downloads the application metadata. The application isn't changed on the instance until you build and install it on the instance. After installing a converted application, the **Package JSON** field of the custom application record \\[sys\\_app\\] contains the path to the `package.json` file for the application.\n\n</td><td>\n\n—\n\n</td></tr><tr><td>\n\n--appName\n\n</td><td>\n\nString\n\n</td><td>\n\nA name for the application.\n\n</td><td>\n\n—\n\n</td></tr><tr><td>\n\n--packageName\n\n</td><td>\n\nString\n\n</td><td>\n\nA name for the application package used in the `package.json` file. The package name must adhere to Node Package Manager \\(npm\\) package naming standards.\n\n</td><td>\n\n—\n\n</td></tr><tr><td>\n\n--scopeName\n\n</td><td>\n\nString\n\n</td><td>\n\nThe scope of the application. The scope name must be unique on the instance, begin with x\\_&lt;prefix&gt;, and be 18 characters or fewer. For more information, see [Namespace identifier](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/c_NamespaceIdentifier.md).\n\n</td><td>\n\n—\n\n</td></tr><tr><td>\n\n--auth, -a\n\n</td><td>\n\nString\n\n</td><td>\n\nAn alias for the credentials to use to authenticate to the instance.\n\n</td><td>\n\nIf set, the default alias.\n\n</td></tr><tr><td>\n\n--template\n\n</td><td>\n\nString\n\n</td><td>\n\nA template for the default structure of the application.-   base: An application with only the basic structure necessary for development in source code.\n-   javascript.basic: An application configured for development in ServiceNow Fluent and JavaScript.\n-   javascript.react: An application configured for development in ServiceNow Fluent, JavaScript, and React.\n-   typescript.basic: An application configured for development in ServiceNow Fluent and TypeScript. TypeScript source files in the `src/server` directory are transpiled into JavaScript modules.\n-   typescript.react: An application configured for development in ServiceNow Fluent, TypeScript, and React. TypeScript source files in the `src/server` directory are transpiled into JavaScript modules.\n-   partial.javascript.react: Adds template files and directories to an existing application for development in ServiceNow Fluent, JavaScript, and React.\n-   partial.typescript.react: Adds template files and directories to an existing application for development in ServiceNow Fluent, TypeScript, and React.\n\n</td><td>\n\n—\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnpx @servicenow/sdk init --from dbce0f6a3b3fda107b45b5d355e45af6 --appName Example App --packageName example-app --scopeName x_snc_example --auth devuser1 --template base\n```\n\nFor more information, see [Create an application with the ServiceNow SDK](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/create-application-now-sdk.md) or [Convert an application with the ServiceNow SDK](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/convert-application-now-sdk.md).\n\n## build\n\nCompile source files and output build artifacts. Third-party library dependencies are converted into XML files that can be installed with the application.\n\nThe `build` command has the following structure:\n\n```cmd\nnow-sdk build <source> \\[--frozenKeys &lt;flag&gt;\\] \\[--errorOnConflict &lt;flag&gt;\\] \\[--skipClean &lt;flag&gt;\\]\n```\n\n<table id=\"table_vx2_vvr_rzb\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\nsource\n\n</td><td>\n\nString\n\n</td><td>\n\nThe path to the directory that contains the `package.json` file for your application. The `package.json` should be in the base directory of your application.\n\n</td><td>\n\nCurrent working directory\n\n</td></tr><tr><td>\n\n--frozenKeys\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to validate that the `keys.ts` file is up to date for continuous integration \\(CI\\) builds. If true and changes were made to the application's ServiceNow Fluent code, the `keys.ts` file isn't updated and the build fails.The `keys.ts` file is automatically generated in the `src/fluent/generated` directory.\n\n</td><td>\n\nfalse\n\n</td></tr><tr><td>\n\n--errorOnConflict\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to treat sys\\_id conflicts between ServiceNow Fluent code and metadata XML as errors instead of warnings.\n\n</td><td>\n\nfalse\n\n</td></tr><tr><td>\n\n--skipClean\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to skip cleaning the output directory before building the application, which can reduce the build time for incremental builds.\n\n</td><td>\n\nfalse\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnow-sdk build /path/to/package --frozenKeys true --errorOnConflict true --skipClean true\n```\n\nFor more information, see [Build and install an application with the ServiceNow SDK](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/build-deploy-application-now-sdk.md).\n\n## install\n\nPackage the build artifacts and install or update an application on an instance. Before using the `install` command, you must use the `build` command to generate an installable package.\n\nThe `install` command has the following structure:\n\n```cmd\nnow-sdk install [--source <package path>] [--reinstall <flag>] [--auth <alias>] [--open-browser <flag>] [--info <flag>] \\[--demoData &lt;flag&gt;\\] \\[--skip-flow-activation &lt;flag&gt;\\]\n```\n\n<table id=\"table_fwn_q5d_m2c\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\n--source\n\n</td><td>\n\nString\n\n</td><td>\n\nThe path to the directory that contains the `package.json` file for your application. The `package.json` should be in the base directory of your application.\n\n</td><td>\n\nCurrent working directory\n\n</td></tr><tr><td>\n\n--reinstall, -r\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to uninstall and reinstall the application on the instance to ensure that the metadata on the instance matches the metadata in the installation package. **Warning:** Metadata that is on the instance but not in your local application is removed.\n\nIf you have previous versions of modules in the EcmaScript Module \\[sys\\_module\\] table that aren't needed, re-installing an application removes previous versions of the application’s modules from the table.\n\n</td><td>\n\nfalse\n\n</td></tr><tr><td>\n\n--auth, -a\n\n</td><td>\n\nString\n\n</td><td>\n\nAn alias for the credentials to use to authenticate to the instance.**Note:** For CI/CD pipelines, you can set the following environment variables to authenticate with an instance at runtime:\n\n-   SN\\_SDK\\_NODE\\_ENV: Set to `SN_SDK_CI_INSTALL` to enable CI server support.\n-   SN\\_SDK\\_INSTANCE\\_URL: The URL of the target instance to access and to which you install applications.\n-   SN\\_SDK\\_AUTH\\_TYPE: Set to `oauth_client_credentials` to enable OAuth 2.0 authentication. The default value is `basic` for basic authentication.\n-   SN\\_SDK\\_CLIENT\\_ID: An OAuth 2.0 client ID.\n-   SN\\_SDK\\_CLIENT\\_SECRET: An OAuth 2.0 client secret.\n-   SN\\_SDK\\_USER: A username to access the instance using basic authentication.\n-   SN\\_SDK\\_USER\\_PWD: The password associated with the user.\n\n</td><td>\n\nIf set, the default alias.\n\n</td></tr><tr><td>\n\n--open-browser, -b\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to open the application record in your default browser after successfully installing the application.\n\n</td><td>\n\nfalse\n\n</td></tr><tr><td>\n\n--info, -i\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to return details about the most recent installation of this application, such as the status and records updated. When this parameter is used, the application isn’t installed.\n\n</td><td>\n\nfalse\n\n</td></tr><tr><td>\n\n--demoData\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to install demo data with an application.\n\n</td><td>\n\ntrue\n\n</td></tr><tr><td>\n\n--skip-flow-activation\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to skip activating, or publishing, flows when installing an application. By default, flows are activated on the instance when an application is installed.**Note:** ServiceNow IDE version 4.1.1 or later must be installed to activate flows with this command.\n\n</td><td>\n\nfalse\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnow-sdk install --source /path/to/package --reinstall false --auth devuser1 --open-browser true --info true --demoData false --skip-flow-activation true\n```\n\nFor more information, see [Build and install an application with the ServiceNow SDK](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/build-deploy-application-now-sdk.md).\n\n## dependencies\n\nDownload application dependencies and TypeScript definitions from an instance to enable IntelliSense and code validation for an application.\n\nThe `dependencies` command downloads dependencies and TypeScript definitions for scripts and ServiceNow Fluent code:\n\n-   For scripts, this command downloads TypeScript definitions for all Glide APIs and scans the modules and scripts in your application and generates type definitions for the script includes that they use. Type definitions are added in the `@types/servicenow` directory. After downloading script dependencies, you must update your `tsconfig.json` file to include the type definitions.\n-   For ServiceNow Fluent, this command downloads the dependencies listed in an application's `now.config.json` file and generates TypeScript definitions for them in the `@types/servicenow/fluent` directory.\n\nTo download all script and ServiceNow Fluent dependencies for an application, you can use the `dependencies` command with no parameters. If needed, provide the application directory and authentication alias too.\n\nThe `dependencies` command has the following structure:\n\n```cmd\nnow-sdk dependencies [--directory <package path>] [--auth <alias>]\\[--type-defs-only &lt;flag&gt;\\] \\[--fluent-only &lt;flag&gt;\\] \\[--add &lt;table&gt; &lt;sys\\_ids or names&gt;\\] \\[--scope &lt;name&gt;\\]\n```\n\n<table id=\"table_fwn_q5d_m2c\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\n--directory\n\n</td><td>\n\nString\n\n</td><td>\n\nThe path to the directory that contains the `package.json` file for your application. The `package.json` should be in the base directory of your application.\n\n</td><td>\n\nCurrent working directory\n\n</td></tr><tr><td>\n\n--auth, -a\n\n</td><td>\n\nString\n\n</td><td>\n\nAn alias for the credentials to use to authenticate to the instance.\n\n</td><td>\n\nIf set, the default alias.\n\n</td></tr><tr><td>\n\n--type-defs-only\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to download TypeScript definitions for only script dependencies.Script types are downloaded in the `@types/servicenow` directory.\n\n</td><td>\n\nfalse\n\n</td></tr><tr><td>\n\n--fluent-only\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to download dependencies and TypeScript definitions for only ServiceNow Fluent dependencies from other application scopes. You must list an application’s dependencies in its `now.config.json` file.ServiceNow Fluent types are generated in the `@types/servicenow/fluent` directory.\n\n</td><td>\n\nfalse\n\n</td></tr><tr><td>\n\n--add\n\n</td><td>\n\nString\n\n</td><td>\n\nAdds the dependencies that you want to download to the application's `now.config.json` file. You must specify the type of dependencies to add using the table name and then the names or sys\\_ids of each item to add, separated by spaces.```cmd\n--add <table_name> <sys_id1> <sys_id2> <sys_id3>\n```\n\n-   To add table dependencies, you can use the `table` alias and names of tables instead of the sys\\_ids. For example:\n\n    ```cmd\n--add tables incident problem change_request\n    ```\n\n-   To add role dependencies, you can use the `role` alias and names of roles instead of the sys\\_ids. For example:\n\n    ```cmd\n--add roles admin user itil\n    ```\n\n\nUse a wildcard \\(`*`\\) to add all items from a specified table and scope. For example:\n\n```cmd\n--add sys_security_acl \"*\"\n```\n\n</td><td>\n\n—\n\n</td></tr><tr><td>\n\nsysIds\n\n</td><td>\n\nArray\n\n</td><td>\n\nA list of sys\\_ids of dependencies to download and generate TypeScript definitions from. This parameter only applies if you use the `--add` parameter.\n\n</td><td>\n\n—\n\n</td></tr><tr><td>\n\n--scope\n\n</td><td>\n\nString\n\n</td><td>\n\nThe application scope from which to download dependencies. This parameter is required if you use the `--add` parameter.\n\n</td><td>\n\n—\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnow-sdk dependencies --directory /path/to/package --auth devuser1 --add sys\\_ui\\_view fa776f6d97700100f309124eda2975bc --scope global\n```\n\nFor more information, see [Downloading dependencies with the ServiceNow SDK](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/downloading-dependencies-now-sdk.md).\n\n## transform\n\nDownload application metadata \\(XML\\) from the instance and transform the metadata into ServiceNow Fluent source code to synchronize the application changes on the instance into your local application.\n\nAfter initializing an application, you can run the `transform` command without any parameters to transform new application metadata from the instance into source code in the `src/fluent/generated` directory and synchronize changes to metadata into source code in the `src/fluent` directory. To transform metadata that existed when the application was initialized into source code, use the `--from` parameter to provide the path to a local directory or file that contains XML. If metadata exists in the local application as both XML and source code, the XML version takes precedence when installed on the instance.\n\nThe `transform` command has the following structure:\n\n```cmd\nnow-sdk transform [--from <path>] [--directory <package path>] [--auth <alias>] \\[--format &lt;flag&gt;\\] \\[--table &lt;name&gt;\\]\n```\n\n<table id=\"table_bny_zfc_l2c\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\n--from\n\n</td><td>\n\nString\n\n</td><td>\n\nA path to a local directory or file that contains metadata XML to transform into ServiceNow Fluent code.\n\n</td><td>\n\n—\n\n</td></tr><tr><td>\n\n--directory\n\n</td><td>\n\nString\n\n</td><td>\n\nThe path to the directory that contains the `package.json` file for your application. The `package.json` should be in the base directory of your application.\n\n</td><td>\n\nCurrent working directory\n\n</td></tr><tr><td>\n\n--auth, -a\n\n</td><td>\n\nString\n\n</td><td>\n\nAn alias for the credentials to use to authenticate to the instance.\n\n</td><td>\n\nIf set, the default alias.\n\n</td></tr><tr><td>\n\n--format, -f\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to format new and updated ServiceNow Fluent source code when it's transformed.\n\n</td><td>\n\ntrue\n\n</td></tr><tr><td>\n\n--table\n\n</td><td>\n\nString\n\n</td><td>\n\nA comma-separated list of table names to transform to ServiceNow Fluent, including child tables. For example, `--table sys_script,sys_security_acl --from ./metadata`.\n\n</td><td>\n\n—\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnow-sdk transform --from metadata/update --directory /path/to/package --auth devuser1 --format true --table sys\\_security\\_acl\n```\n\nFor more information, see [Convert an application with the ServiceNow SDK](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/convert-application-now-sdk.md) or [Build and install an application with the ServiceNow SDK](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/application-development/servicenow-sdk/build-deploy-application-now-sdk.md).\n\n## move\n\nTransform application metadata \\(XML\\) in the global scope from an instance into ServiceNow Fluent source code in a local global application.\n\nTo customize the global metadata, the global application in which you want to move metadata must already be installed on the instance.\n\nThe `move` command has the following structure:\n\n```cmd\nnow-sdk move [--ids <sys_ids>] [--source <package path>] [--auth <alias>]\n```\n\n<table id=\"table_qp2_2j1_l2c\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\n--ids\n\n</td><td>\n\nArray\n\n</td><td>\n\nA list of sys\\_ids of global application metadata to move into the local global application and transform into ServiceNow Fluent code.\n\n</td><td>\n\n—\n\n</td></tr></tbody>\n</table><table id=\"table_bny_zfc_l2c\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\n--source\n\n</td><td>\n\nString\n\n</td><td>\n\nThe path to the directory that contains the `package.json` file for your application. The `package.json` should be in the base directory of your application.\n\n</td><td>\n\nCurrent working directory\n\n</td></tr><tr><td>\n\n--auth, -a\n\n</td><td>\n\nString\n\n</td><td>\n\nAn alias for the credentials to use to authenticate to the instance.\n\n</td><td>\n\nIf set, the default alias.\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnow-sdk move --ids 9f4e7402317d470da09ac34c0693d02d,c4e34f348b1843899ca5efb2a31666f0,5057309fccef409cb30692c86a9aaac6 --auth devuser1\n```\n\n## download\n\nDownload all application metadata \\(XML\\) from an application on an instance to compare with the metadata in your local application.\n\nUpdates to JavaScript modules aren't included when downloading application metadata from your instance.​\n\nThe `download` command has the following structure:\n\n```cmd\nnow-sdk download <directory> [--source <package path>] [--incremental <flag>]\n```\n\n<table id=\"table_fwd_rcf_m2c\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\ndirectory\n\n</td><td>\n\nString\n\n</td><td>\n\nA path to any directory in which to download the metadata.**Note:** This directory should be a different directory from the `metadata` directory in your application.\n\n</td><td>\n\n—\n\n</td></tr></tbody>\n</table><table id=\"table_sbb_xds_rzb\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\n--source\n\n</td><td>\n\nString\n\n</td><td>\n\nThe path to the directory that contains the `package.json` file for your application. The `package.json` should be in the base directory of your application.\n\n</td><td>\n\nCurrent working directory\n\n</td></tr><tr><td>\n\n--incremental\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to download only changes to application metadata made on the instance and recorded in the Customer Updates \\[sys\\_update\\_xml\\] table.\n\n</td><td>\n\nfalse\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnow-sdk download /path/to/directory --source /path/to/package --incremental true\n```\n\n## clean\n\nRemove the build artifacts that were output with the previous build.\n\nThe `clean` command has the following structure:\n\n```cmd\nnow-sdk clean <source>\n```\n\n<table id=\"table_vx2_vvr_rzb\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\nsource\n\n</td><td>\n\nString\n\n</td><td>\n\nThe path to the directory that contains the `package.json` file for your application. The `package.json` should be in the base directory of your application.\n\n</td><td>\n\nCurrent working directory\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnow-sdk clean /path/to/package\n```\n\n## pack\n\nPackage the build artifacts that were output with the previous build into an installable ZIP file.\n\nThe `pack` command has the following structure:\n\n```cmd\nnow-sdk pack <source> \\[--skip-package-inventory &lt;flag&gt;\\]\n```\n\n<table id=\"table_vx2_vvr_rzb\"><thead><tr><th>\n\nParameter\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th><th>\n\nDefault value\n\n</th></tr></thead><tbody><tr><td>\n\nsource\n\n</td><td>\n\nString\n\n</td><td>\n\nThe path to the directory that contains the `package.json` file for your application. The `package.json` should be in the base directory of your application.\n\n</td><td>\n\nCurrent working directory\n\n</td></tr><tr><td>\n\n--skip-package-inventory\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nAn option to skip generating the `package_inventory.csv` file in the packaged artifact. The `package_inventory.csv` is used to optimize performance during upgrades.\n\n</td><td>\n\nfalse\n\n</td></tr></tbody>\n</table>For example:\n\n```cmd\nnow-sdk pack /path/to/package --skip-package-inventory true\n```\n\n## explain\n\nView documentation and examples for a ServiceNow Fluent API.\n\nThe `explain` command has the following structure:\n\n```cmd\nnow-sdk explain <topic> \\[--list &lt;keyword&gt;\\] \\[--format &lt;output type&gt;\\] \\[--peek &lt;flag&gt;\\]\n```\n\n|Parameter|Type|Description|Default value|\n|---------|----|-----------|-------------|\n|topic|String|A keyword or topic name to search for to view related ServiceNow Fluent API, guide, or skill documentation, such as `table-api` or `table-guide`. To get a list of available topics, use the `--list` parameter.|—|\n\n|Parameter|Type|Description|Default value|\n|---------|----|-----------|-------------|\n|--list, -l|Boolean|An option to view a list of available topics, which you can filter by providing a topic name or keyword, such as `now-sdk explain flow --list`. The list returned includes matches that contain the keyword and possibly related matches.|—|\n|--format|String|An option to format the output for the terminal \\(`pretty`\\) or as Markdown \\(`raw`\\).|pretty|\n|--peek, -p|Boolean|An option to display a short description of a topic instead of the complete topic content. You can use this parameter with the `--list` parameter to display summaries of the listed topics.|—|\n\nFor example:\n\n```cmd\nnow-sdk explain uipage-api --format raw\n```\n\n## query\n\nRuns a read-only REST Table API query on an instance to return a filtered list of records.\n\nThe `query` command can help with referring to instance data while writing ServiceNow Fluent code, such as looking up sys\\_ids, inspecting table schemas, checking existing records, and reading choice values. You can use this command with the `explain` command to provide an AI agent with instance data.\n\nThe `query` command has the following structure:\n\n```cmd\nnow-sdk query <table> --query <encoded query> [--limit <number>] [--offset <number>] [--fields <field list>] [--display-value <value>] [--exclude-reference-link <flag>] [--no-count <flag>] [--timeout <time>] [--view <view>] [--query-category <category>] [--query-no-domain <flag>] [--auth <alias>] [--output <format>]\n```\n\n|Parameter|Type|Description|Default value|\n|---------|----|-----------|-------------|\n|table|String|The name of a table to query, such as incident or sys\\_dictionary.|—|\n|--query, -q|String|An encoded query string \\(sysparm\\_query\\) used to filter records, such as `\"active=true^priority<=2\"`.|—|\n\n|Parameter|Type|Description|Default value|\n|---------|----|-----------|-------------|\n|--limit|Number|The maximum number of records to return per page \\(sysparm\\_limit\\).|100|\n|--offset|Number|The starting record offset for pagination \\(sysparm\\_offset\\). If --output is `json`, use the `nextOffset` value returned in a previous response to fetch the next page.|0|\n|--fields, -f|String|A comma-separated list of fields to return \\(sysparm\\_fields\\). If omitted, all fields are returned.|—|\n|--display-value|String|An option to return display values instead of raw values \\(sysparm\\_display\\_value\\). Specify `true` to return display values, `false` to return raw values, or `all` to return both.|false|\n|--exclude-reference-link|Boolean|An option to exclude reference link metadata in the response \\(sysparm\\_exclude\\_reference\\_link\\).|true|\n|--no-count|Boolean|An option to skip calculating the total record count \\(sysparm\\_no\\_count\\). Skipping the count can improve performance for large tables.|false|\n|--timeout|Number|The per-request timeout in milliseconds. Each page fetch is bounded by this value.|30000|\n|--view|String|A UI view used to determine which fields to return \\(sysparm\\_view\\).|—|\n|--query-category|String|A query category for extended queries \\(sysparm\\_query\\_category\\).|—|\n|--query-no-domain|Boolean|An option to ignore domain separation when querying \\(sysparm\\_query\\_no\\_domain\\).|false|\n|--auth, -a|String|An alias for the credentials to use to authenticate to the instance.|If set, the default alias.|\n|--output, -o|String|The output format for the response. Specify `json` to paginate the response and return a machine-readable JSON envelope with `ok`, `hasMore`, `nextOffset`, and `records` fields. When this parameter is used, log output is suppressed.|—|\n\nFor example:\n\n```cmd\nnow-sdk query incident --query 'active=true^priority<=2' --limit 50 --fields 'number,short_description,priority' --auth devuser1 --output json\n```\n\nFor more information, see [Table API](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/api-reference/c_TableAPI.md).\n\n"}}