Rename BackstageCommand to CliCommand and CommandContext to CliCommandContext

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-03-13 07:46:09 +01:00
parent 7d055ef0c4
commit 1929a95b97
47 changed files with 114 additions and 114 deletions
+20 -20
View File
@@ -6,21 +6,6 @@
import { JsonValue } from '@backstage/types';
import { Package } from '@manypkg/get-packages';
// @public
export interface BackstageCommand {
deprecated?: boolean;
description: string;
execute:
| ((context: CommandContext) => Promise<void>)
| {
loader: () => Promise<{
default: (context: CommandContext) => Promise<void>;
}>;
};
experimental?: boolean;
path: string[];
}
// @public
export type BackstagePackage = {
dir: string;
@@ -102,13 +87,22 @@ export interface BackstagePackageJson {
}
// @public
export interface CliPlugin {
// (undocumented)
readonly $$type: '@backstage/CliPlugin';
export interface CliCommand {
deprecated?: boolean;
description: string;
execute:
| ((context: CliCommandContext) => Promise<void>)
| {
loader: () => Promise<{
default: (context: CliCommandContext) => Promise<void>;
}>;
};
experimental?: boolean;
path: string[];
}
// @public
export interface CommandContext {
export interface CliCommandContext {
args: string[];
info: {
usage: string;
@@ -116,6 +110,12 @@ export interface CommandContext {
};
}
// @public
export interface CliPlugin {
// (undocumented)
readonly $$type: '@backstage/CliPlugin';
}
// @public
export type ConcurrentTasksOptions<TItem> = {
concurrencyFactor?: number;
@@ -129,7 +129,7 @@ export function createCliPlugin(options: {
name: string;
};
init: (registry: {
addCommand: (command: BackstageCommand) => void;
addCommand: (command: CliCommand) => void;
}) => Promise<void>;
}): CliPlugin;
@@ -15,7 +15,7 @@
*/
import { OpaqueCliPlugin } from '@internal/cli';
import { BackstageCommand, CliPlugin } from './types';
import { CliCommand, CliPlugin } from './types';
/**
* Creates a new CLI plugin that provides commands to the Backstage CLI.
@@ -52,10 +52,10 @@ export function createCliPlugin(options: {
*/
init: (registry: {
/** Registers a new command with the CLI. */
addCommand: (command: BackstageCommand) => void;
addCommand: (command: CliCommand) => void;
}) => Promise<void>;
}): CliPlugin {
const commands: BackstageCommand[] = [];
const commands: CliCommand[] = [];
const commandsPromise = options
.init({ addCommand: command => commands.push(command) })
.then(() => commands);
+1 -1
View File
@@ -15,4 +15,4 @@
*/
export { createCliPlugin } from './createCliPlugin';
export type { BackstageCommand, CommandContext, CliPlugin } from './types';
export type { CliCommand, CliCommandContext, CliPlugin } from './types';
+4 -4
View File
@@ -21,7 +21,7 @@
*
* @public
*/
export interface CommandContext {
export interface CliCommandContext {
/**
* The remaining arguments passed to the command after the command path
* has been resolved. This includes both positional arguments and flags.
@@ -61,7 +61,7 @@ export interface CommandContext {
*
* @public
*/
export interface BackstageCommand {
export interface CliCommand {
/**
* The path segments that define the command's position in the CLI tree.
* For example, `['repo', 'test']` maps to `backstage-cli repo test`.
@@ -99,10 +99,10 @@ export interface BackstageCommand {
* ```
*/
execute:
| ((context: CommandContext) => Promise<void>)
| ((context: CliCommandContext) => Promise<void>)
| {
loader: () => Promise<{
default: (context: CommandContext) => Promise<void>;
default: (context: CliCommandContext) => Promise<void>;
}>;
};
}