Merge pull request #33355 from backstage/rugvip/cli-plugin-api

cli: add CLI module plugin API and auto-discovery
This commit is contained in:
Patrik Oldsberg
2026-03-16 14:50:27 +01:00
committed by GitHub
369 changed files with 5707 additions and 1824 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli-node': patch
---
Added a new `cli-module` package role for packages that provide CLI plugin extensions.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli-defaults': minor
---
Introduced `@backstage/cli-defaults`, a convenience package that bundles all standard Backstage CLI modules. Install this single package as a `devDependency` to get the full default set of CLI commands without listing each module individually.
+41
View File
@@ -0,0 +1,41 @@
---
'@backstage/cli': minor
---
The CLI now automatically discovers CLI modules from the project root's `dependencies` and `devDependencies`. Any installed package with the `cli-module` Backstage role will be loaded automatically without needing to be hardcoded in the CLI itself.
If no CLI modules are found in the project dependencies, the CLI falls back to the built-in set of modules and prints a deprecation warning. This fallback will be removed in a future release. To prepare for this, add `@backstage/cli-defaults` as a `devDependency` in your root `package.json`:
```json
{
"devDependencies": {
"@backstage/cli-defaults": "backstage:^"
}
}
```
If you are not using the Backstage Yarn plugin, run the following instead:
```sh
yarn workspace root add --dev @backstage/cli-defaults
```
For fine-grained control you can instead install individual CLI modules:
```json
{
"devDependencies": {
"@backstage/cli-module-auth": "backstage:^",
"@backstage/cli-module-build": "backstage:^",
"@backstage/cli-module-config": "backstage:^",
"@backstage/cli-module-github": "backstage:^",
"@backstage/cli-module-info": "backstage:^",
"@backstage/cli-module-lint": "backstage:^",
"@backstage/cli-module-maintenance": "backstage:^",
"@backstage/cli-module-migrate": "backstage:^",
"@backstage/cli-module-new": "backstage:^",
"@backstage/cli-module-test-jest": "backstage:^",
"@backstage/cli-module-translations": "backstage:^"
}
}
```
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli-node': minor
---
Added `createCliModule` API and related types for building Backstage CLI plugins.
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Added support for the new `cli-module` package role in the build system, ESLint configuration, Jest configuration, and maintenance commands.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Migrated CLI plugin modules to use `createCliModule` from `@backstage/cli-node`.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/create-app': patch
---
The create-app templates now include `@backstage/cli-defaults` as a `devDependency`, enabling the CLI's automatic module discovery for newly created projects.
+15
View File
@@ -0,0 +1,15 @@
---
'@backstage/cli-module-auth': minor
'@backstage/cli-module-build': minor
'@backstage/cli-module-config': minor
'@backstage/cli-module-github': minor
'@backstage/cli-module-info': minor
'@backstage/cli-module-lint': minor
'@backstage/cli-module-maintenance': minor
'@backstage/cli-module-migrate': minor
'@backstage/cli-module-new': minor
'@backstage/cli-module-test-jest': minor
'@backstage/cli-module-translations': minor
---
Initial release of the CLI module packages. Each module provides a set of commands that can be discovered automatically by `@backstage/cli` or executed standalone.