Add @internal/cli package for opaque CLI types

Move OpaqueCliPlugin to a new @internal/cli inline package, following the
same pattern as @internal/frontend. Both cli-plugin-api and cli import it
directly, and it gets bundled into their dists at build time.

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
Made-with: Cursor
This commit is contained in:
Patrik Oldsberg
2026-03-11 08:18:55 +01:00
parent d6caf7f13b
commit 2e5f189cfa
12 changed files with 107 additions and 146 deletions
+4 -6
View File
@@ -15,10 +15,7 @@
*/
import { CommandGraph } from './CommandGraph';
import {
isCliPlugin,
initializeCliPlugin,
} from '@backstage/cli-plugin-api/internals';
import { OpaqueCliPlugin } from '@internal/cli';
import type { BackstageCommand, CliFeature } from '@backstage/cli-plugin-api';
import { CommandRegistry } from './CommandRegistry';
import { Command } from 'commander';
@@ -57,8 +54,9 @@ export class CliInitializer {
}
async #register(feature: CliFeature) {
if (isCliPlugin(feature)) {
await initializeCliPlugin(feature, this.commandRegistry);
if (OpaqueCliPlugin.isType(feature)) {
const internal = OpaqueCliPlugin.toInternal(feature);
await internal.init(this.commandRegistry);
} else {
throw new Error(`Unsupported feature type: ${(feature as any).$$type}`);
}