Merge pull request #32275 from meganide/feat/cli-pattern

feat: add --include and --output-file to backstage-cli-info
This commit is contained in:
Fredrik Adelöw
2026-01-20 15:34:30 +01:00
committed by GitHub
5 changed files with 269 additions and 18 deletions
+73 -2
View File
@@ -432,8 +432,79 @@ Usage: backstage-cli create-github-app <github-org>
Outputs debug information which is useful when opening an issue. Outputs system
information, node.js and npm versions, CLI version and type (inside backstage
repo or a created app), all `@backstage/*` package dependency versions.
repo or a created app), all `@backstage/*` package dependency versions, and any
packages that contain a `backstage` field in their `package.json`.
The command distinguishes between installed packages (from npm) and local
workspace packages, making it easier to understand your Backstage setup.
```text
Usage: backstage-cli info
Usage: backstage-cli info [options]
Options:
--include <patterns...> Glob patterns for additional packages to include
(e.g., @mycompany/backstage-*)
--format <text|json> Output format (default: text)
-h, --help display help for command
```
### Examples
Output debug information to the console:
```bash
yarn backstage-cli info
```
Include additional packages matching a glob pattern:
```bash
yarn backstage-cli info --include "@mycompany/*"
```
Output as JSON:
```bash
yarn backstage-cli info --format json
```
Export JSON to a file for further processing:
```bash
yarn backstage-cli info --format json > backstage-info.json
```
Combine options to include custom packages and export to JSON:
```bash
yarn backstage-cli info --include "@mycompany/backstage-*" --include "@internal/*" --format json > debug-info.json
```
Export text output to a file:
```bash
yarn backstage-cli info --format text > backstage-info.txt
```
### JSON Output Format
When using `--format json`, the output is structured as follows:
```json
{
"system": {
"os": "Darwin 23.0.0 - darwin/arm64",
"node": "v18.17.0",
"yarn": "3.6.0",
"cli": { "version": "0.27.0", "local": false },
"backstage": "1.20.0"
},
"dependencies": {
"@backstage/core-plugin-api": "1.8.0",
"@backstage/plugin-catalog": "1.15.0"
},
"local": {
"@mycompany/backstage-plugin-custom": "0.1.0"
}
}
```