mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 17:50:42 +00:00
fix(cli): restore help registration and descriptor graph
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import type { Command } from "commander";
|
||||
import type { CommandGroupEntry } from "./register-command-groups.js";
|
||||
|
||||
export type NamedCommandDescriptor = {
|
||||
name: string;
|
||||
@@ -23,6 +22,11 @@ export type ResolvedCommandGroupEntry<TDescriptor extends NamedCommandDescriptor
|
||||
register: TRegister;
|
||||
};
|
||||
|
||||
type CommandGroupEntryLike = {
|
||||
placeholders: NamedCommandDescriptor[];
|
||||
register: (program: Command) => Promise<void> | void;
|
||||
};
|
||||
|
||||
function buildDescriptorIndex<TDescriptor extends NamedCommandDescriptor>(
|
||||
descriptors: readonly TDescriptor[],
|
||||
): Map<string, TDescriptor> {
|
||||
@@ -49,8 +53,8 @@ export function resolveCommandGroupEntries<TDescriptor extends NamedCommandDescr
|
||||
export function buildCommandGroupEntries<TRegister>(
|
||||
descriptors: readonly NamedCommandDescriptor[],
|
||||
specs: readonly CommandGroupDescriptorSpec<TRegister>[],
|
||||
mapRegister: (register: TRegister) => CommandGroupEntry["register"],
|
||||
): CommandGroupEntry[] {
|
||||
mapRegister: (register: TRegister) => CommandGroupEntryLike["register"],
|
||||
): CommandGroupEntryLike[] {
|
||||
return resolveCommandGroupEntries(descriptors, specs).map((entry) => ({
|
||||
placeholders: entry.placeholders,
|
||||
register: mapRegister(entry.register),
|
||||
|
||||
Reference in New Issue
Block a user