CLI commands
Below you can find the available commands in @grafana/create-plugin.
create-pluginβ
Use the create-plugin command to scaffold your plugin.
- npm
- Yarn
- pnpm
npx @grafana/create-plugin@latest
yarn dlx @grafana/create-plugin@latest
pnpm dlx @grafana/create-plugin@latest
When running the create-plugin command, the following prompts appear:
Select a plugin typeβ
? 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.
For more information on how Scenes allows you to create dashboard-like experiences in app plugins, see the Scenes documentation.
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 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.
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 the name of your organization. This must be your Grafana Cloud organization. With the organization name you can sign and optionally publish the plugin to the Grafana plugin catalog.
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:
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β
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
npx @grafana/create-plugin@latest update
yarn dlx @grafana/create-plugin@latest update
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β
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
npx @grafana/create-plugin@latest update --force
yarn dlx @grafana/create-plugin@latest update --force
pnpm dlx @grafana/create-plugin@latest update --force
addβ
To adopt an optional feature in an existing plugin, run the add command from your plugin's root directory:
- npm
- Yarn
- pnpm
npx @grafana/create-plugin@latest add <addition>
yarn dlx @grafana/create-plugin@latest add <addition>
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.
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
npx @grafana/create-plugin@latest add <addition> --agent=claude-code
yarn dlx @grafana/create-plugin@latest add <addition> --agent=claude-code
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:
npx @grafana/create-plugin@latest add <addition> --agent="$HOME/.claude/local/claude"
add --no-agentβ
To skip the agent, use the --no-agent flag:
- npm
- Yarn
- pnpm
npx @grafana/create-plugin@latest add <addition> --no-agent
yarn dlx @grafana/create-plugin@latest add <addition> --no-agent
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.