mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-29 15:05:16 +00:00
fix(cli): keep plugin command metadata intact
This commit is contained in:
@@ -59,10 +59,11 @@ async function registerGatewayRunOnly(program: Command): Promise<void> {
|
||||
|
||||
async function registerSubCliWithPluginCommands(
|
||||
program: Command,
|
||||
argv: string[],
|
||||
registerSubCli: () => Promise<void>,
|
||||
pluginCliPosition: "before" | "after",
|
||||
) {
|
||||
const invocation = resolveCliArgvInvocation(process.argv);
|
||||
const invocation = resolveCliArgvInvocation(argv);
|
||||
const shouldRegisterPluginCommands =
|
||||
!invocation.hasHelpOrVersion &&
|
||||
resolveCliCommandPathPolicy(invocation.commandPath).loadPlugins !== "never";
|
||||
@@ -204,9 +205,10 @@ const entrySpecs: readonly CommandGroupDescriptorSpec<SubCliRegistrar>[] = [
|
||||
]),
|
||||
{
|
||||
commandNames: ["pairing"],
|
||||
register: async (program) => {
|
||||
register: async (program, argv) => {
|
||||
await registerSubCliWithPluginCommands(
|
||||
program,
|
||||
argv,
|
||||
async () => {
|
||||
const mod = await import("../pairing-cli.js");
|
||||
mod.registerPairingCli(program);
|
||||
@@ -217,9 +219,10 @@ const entrySpecs: readonly CommandGroupDescriptorSpec<SubCliRegistrar>[] = [
|
||||
},
|
||||
{
|
||||
commandNames: ["plugins"],
|
||||
register: async (program) => {
|
||||
register: async (program, argv) => {
|
||||
await registerSubCliWithPluginCommands(
|
||||
program,
|
||||
argv,
|
||||
async () => {
|
||||
const mod = await import("../plugins-cli.js");
|
||||
mod.registerPluginsCli(program);
|
||||
|
||||
@@ -50,9 +50,7 @@ export const routedCommands: RouteSpec[] = cliCommandCatalog
|
||||
): entry is CliCommandCatalogEntry & { route: { id: keyof typeof routedCommandDefinitions } } =>
|
||||
Boolean(entry.route),
|
||||
)
|
||||
.map((entry) =>
|
||||
createParsedRoute({
|
||||
entry,
|
||||
definition: routedCommandDefinitions[entry.route.id],
|
||||
}),
|
||||
);
|
||||
.flatMap((entry) => {
|
||||
const definition = routedCommandDefinitions[entry.route.id];
|
||||
return definition ? [createParsedRoute({ entry, definition })] : [];
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user