# CLI commands

Below you can find the available commands in `@grafana/create-plugin`.

## create-plugin[​](#create-plugin "Direct link to create-plugin")

Use the `create-plugin` command to scaffold your plugin.

* npm
* Yarn
* pnpm

```shell
npx @grafana/create-plugin@latest

```

```shell
yarn dlx @grafana/create-plugin@latest

```

```shell
pnpm dlx @grafana/create-plugin@latest

```

When running the `create-plugin` command, the following prompts appear:

### Select a plugin type[​](#select-a-plugin-type "Direct link to Select a plugin type")

```text
? Select a plugin type …
❯ App (add custom pages, UI extensions and bundle other plugins)
  Data source (query data from a custom source)
  Panel (add a visualization for data or a widget)
  App with Scenes (create dynamic dashboards in app pages)

```

To learn more about the various types of plugins, refer to [Grafana plugin types and usage](https://grafana.com/developers/plugin-tools/key-concepts/plugin-types-usage.md).

For more information on how Scenes allows you to create dashboard-like experiences in app plugins, see the [Scenes](https://grafana.com/developers/scenes) documentation.

### Add a backend to support server-side functionality? (y/N)[​](#add-a-backend-to-support-server-side-functionality-yn "Direct link to Add a backend to support server-side functionality? (y/N)")

If you are creating an app or a data source plugin, you will be asked whether to additionally add a backend component.

Plugin backend components offer powerful features such as:

* Enable [Grafana Alerting](https://grafana.com/docs/grafana/latest/alerting/) for data sources.
* Connect to non-HTTP services to which a browser normally can’t connect. For example, SQL database servers.
* Keep state between users. For example, query caching for data sources.
* Use custom authentication methods and/or authorization checks that aren’t supported in Grafana.
* Use a custom data source request proxy.

To learn more, refer to [plugin backend components](https://grafana.com/developers/plugin-tools/key-concepts/backend-plugins.md).

### Enter a name for your plugin[​](#enter-a-name-for-your-plugin "Direct link to Enter a name for your plugin")

Give your plugin a name which helps identify its purpose.

### Enter your organization name (usually your Grafana Cloud org)[​](#enter-your-organization-name-usually-your-grafana-cloud-org "Direct link to Enter your organization name (usually your Grafana Cloud org)")

Enter the name of your organization. This must be your [Grafana Cloud](https://grafana.com/signup/) organization. With the organization name you can [sign](https://grafana.com/developers/plugin-tools/publish-a-plugin/sign-a-plugin.md) and optionally [publish](https://grafana.com/developers/plugin-tools/publish-a-plugin/publish-a-plugin.md) the plugin to the [Grafana plugin catalog](https://grafana.com/grafana/plugins).

### Bypass prompts[​](#bypass-prompts "Direct link to Bypass prompts")

You can bypass all the preceding prompts by using `create-plugin` CLI arguments. To scaffold a plugin with the CLI arguments, pass them to the `create-plugin` command like so:

```text
npx @grafana/create-plugin \
  --plugin-type="app" \
  --plugin-name="myPlugin" \
  --org-name="myorg" \
  --backend

```

You can scaffold plugins using CLI arguments to get started faster. Using arguments also allows you to run the tool in a non-interactive environment such as CI or to scaffold plugins with other tooling.

Refer to the following table for the full list of prompt bypass options:

| Prompt           | Equivalent Argument Name     | Values                                             |
| ---------------- | ---------------------------- | -------------------------------------------------- |
| **Plugin type**  | `--plugin-type`              | one of `app`, `datasource`, `panel` or `scenesapp` |
| **Backend**      | `--backend` / `--no-backend` | boolean                                            |
| **Name**         | `--plugin-name`              | string                                             |
| **Organization** | `--org-name`                 | string                                             |

## update[​](#update "Direct link to update")

To update an existing plugin to use the latest version of the `create-plugin` tool, run the following command from your plugin's root directory:

* npm
* Yarn
* pnpm

```shell
npx @grafana/create-plugin@latest update

```

```shell
yarn dlx @grafana/create-plugin@latest update

```

```shell
pnpm dlx @grafana/create-plugin@latest update

```

This command updates the following:

* **`/.config`** - configuration files for building a plugin
* **NPM dependencies** - dependencies (mostly used for supporting latest Grafana versions and build updates)
* **NPM scripts** - any updates in build-related scripts

### update --force[​](#update---force "Direct link to update --force")

By default, the `update` command will stop if there are any uncommitted changes in the repository. If you want to force the update, you can use the `--force` flag:

* npm
* Yarn
* pnpm

```shell
npx @grafana/create-plugin@latest update --force

```

```shell
yarn dlx @grafana/create-plugin@latest update --force

```

```shell
pnpm dlx @grafana/create-plugin@latest update --force

```

## add[​](#add "Direct link to add")

To adopt an optional feature in an existing plugin, run the `add` command from your plugin's root directory:

* npm
* Yarn
* pnpm

```shell
npx @grafana/create-plugin@latest add <addition>

```

```shell
yarn dlx @grafana/create-plugin@latest add <addition>

```

```shell
pnpm dlx @grafana/create-plugin@latest add <addition>

```

Run `add` without an addition name to list the additions available in your version of the tool.

Unlike `update`, which applies every pending change for your version, `add` applies one named change that you choose. The command stops if there are uncommitted changes in the repository. Use `--force` to override this.

For more information, refer to [Add features to your plugin](https://grafana.com/developers/plugin-tools/how-to-guides/add-features-to-a-plugin.md).

### add --agent[​](#add---agent "Direct link to add --agent")

Some additions include instructions for an AI coding agent, because the change depends on your plugin's own source code. If you have a supported agent CLI installed, `create-plugin` asks whether to use it. To select an agent without the question, use the `--agent` flag:

* npm
* Yarn
* pnpm

```shell
npx @grafana/create-plugin@latest add <addition> --agent=claude-code

```

```shell
yarn dlx @grafana/create-plugin@latest add <addition> --agent=claude-code

```

```shell
pnpm dlx @grafana/create-plugin@latest add <addition> --agent=claude-code

```

The flag accepts an agent identifier, either `claude-code` or `codex`. It also accepts a path, which lets you use an agent that is installed outside your `PATH`:

```shell
npx @grafana/create-plugin@latest add <addition> --agent="$HOME/.claude/local/claude"

```

### add --no-agent[​](#add---no-agent "Direct link to add --no-agent")

To skip the agent, use the `--no-agent` flag:

* npm
* Yarn
* pnpm

```shell
npx @grafana/create-plugin@latest add <addition> --no-agent

```

```shell
yarn dlx @grafana/create-plugin@latest add <addition> --no-agent

```

```shell
pnpm dlx @grafana/create-plugin@latest add <addition> --no-agent

```

The command then applies the automated part of the addition, if there is one, and prints the path to the instructions file so that you can follow it yourself.
