---
title: "CLI commands and configuration"
slug: "cli-commands-and-configuration"
abstract: "Overview of the Content SDK command-line interface (CLI), including supported commands and how you can configure its behaviour"
---
# CLI commands and configuration

The Content SDK CLI provides commands and supports scripts for common tasks during the development of projects using the Content SDK. To use the CLI, you must first [install it globally](https://doc.sitecore.com/sai/en/developers/content-sdk/angular/1x/install-the-content-sdk-cli.html "Install the Content SDK CLI") on your local machine.

The CLI is configured using the `sitecore.cli.config.ts` file by default. When this file is created as part of an app using a starter template, it contains the following configuration settings:

```ts
import {
  defineCliConfig,
  generateMetadata,
  generateSites,
  writeImportMap,
  extractFiles,
} from '@sitecore-content-sdk/angular/config-cli';
import scConfig from './sitecore.config';

export default defineCliConfig({
  config: scConfig,
  build: {
    commands: [
      generateMetadata(),
      generateSites(),
    ],
  },
  componentMap: {
    paths: ['src/app/components'],
    exclude: ['**/*.spec.ts', 'src/app/components/content-sdk'],
  },
});
```

> [!note]
> The build command supports the `--config` flag that you can use to provide the location of a config file.

## The build command

The `sitecore-tools project build` CLI command prepares app-specific build artifacts, such as those required for the app to connect to SitecoreAI. It does this by sequentially executing the functions listed in the `build:` section of your CLI config file.

```shell
sitecore-tools project build
```

Your app's `package.json` file includes a `build` script that calls this CLI command, so it runs every time your app is built.

By default, the CLI will try to use a file named `sitecore.cli.config.ts` in the folder where you run the command. If that file does not exist the CLI will try to use `sitecore.cli.config.js` instead.

If you're running the command in a folder that doesn't contain either of these files, you need to specify the name and (relative) location of the file by using the `--config` argument, as shown in the following example where a custom file is used in the current folder:

```shell
sitecore-tools project build --config=custom.sitecore.cli.config.ts
```

Within the config file's `build.commands:` section, you can add custom functionality as shown with `myBuildCommand()` in the following example:

```ts
import { defineCliConfig, generateSites, generateMetadata } from '@sitecore-content-sdk/angular/config-cli';
import type { AngularSitecoreConfig } from '@sitecore-content-sdk/angular/config';
import scConfig from './sitecore.config';

const myBuildCommand = (
  param: string
): (({ scConfig }: { scConfig: AngularSitecoreConfig }) => Promise<void>) => {
  return async ({ scConfig }) => {
    console.log(param, scConfig.defaultSite);
    return Promise.resolve();
  };
};

export default defineCliConfig({
  config,
  build: {
    commands: [generateMetadata(), generateSites(), myBuildCommand('this is my build command!')],
  },
});
```

You can configure the default `generateMetadata` method using a [`GenerateMetadataConfig`](https://github.com/Sitecore/content-sdk/blob/v1.4.1/packages/core/src/tools/generateMetadata.ts#L16) object. It accepts two optional parameters:

<table style="width:100%;" class="informaltable frame-void rules-rows"><thead><tr><th class="th"><p>Parameter</p></th><th class="th"><p>Type</p></th><th class="th"><p>Description</p></th></tr></thead><tbody><tr><td class="td"><p><code class="code">destinationPath</code></p></td><td class="td"><p>string</p></td><td class="td"><p>Specify the path to store the generated metadata. If no value is provided, the default path is used.</p><p>Default: <span class="emphasis"><em>.sitecore/metadata.json</em></span></p></td></tr><tr><td class="td"><p><code class="code">allowWorkspaces</code></p></td><td class="td"><p>boolean</p></td><td class="td"><p>Specify whether to allow metadata generation for npm monorepos.</p><p>Default: <span class="emphasis"><em>false</em></span></p></td></tr></tbody></table>

For additional examples of customization, look at the implementations of `generateMetadata` and `generateSites` in the `core` package.

## The experimental list command

The `sitecore-tools project experimental list` command lists the experimental features available in your Content SDK app and whether each feature is enabled. It reads the features from the app's installed `@sitecore-content-sdk` packages, including `@sitecore-content-sdk/angular`.

Run the command from the root folder of your app:

```shell
sitecore-tools project experimental list
```

For each feature, the output includes:

| Detail | Description |
| --- | --- |
| Name | The feature's display name and ID. |
| Status | `enabled` or `disabled`. |
| Environment variable | The variable used to enable the feature. |
| Description | A short description of the feature. |

The command also prints instructions for enabling features. For example, the following output shows a sample feature:

```text
Experimental features available in @sitecore-content-sdk/angular:

  Dummy Feature (dummy-feature)
    Status:               disabled
    Environment variable: CSDK_EXPERIMENTAL_DUMMY_FEATURE
    Sample experimental feature used to verify the visibility API.

Set an environment variable to "true" to enable a single feature, or CSDK_GLOBAL_EXPERIMENTAL_FEATURES_ENABLED="true" to enable all of them.
```

Sample dummy features are available to verify the command. Actual experimental features appear in the same format as they become available.

To enable experimental features:

- To enable one feature, set its environment variable to `true`.
- To enable all features, set `CSDK_GLOBAL_EXPERIMENTAL_FEATURES_ENABLED=true`.

Use the lowercase value `true`. Values such as `TRUE` and `1` do not enable features. Run the command again after changing the environment variables to see the updated status.

If the installed packages have no experimental features, the command reports that none are available in the current version. If you run it outside a Content SDK app, it prints the following error:

```text
Content SDK app not found. Run this command from the root folder of a Content SDK app.
```
