fix(cli): avoid plugin allowlist hints for unknown commands

Co-authored-by: kagura-agent <kagura.agent.ai@gmail.com>
This commit is contained in:
Peter Steinberger
2026-05-10 07:59:20 +01:00
parent 036eb75a30
commit 09cffbdfbf
6 changed files with 197 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import type { OpenClawConfig } from "../config/types.openclaw.js";
import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js";
import { resolveManifestActivationPluginIds } from "./activation-planner.js";
import {
resolveManifestCommandAliasOwnerInRegistry,
resolveManifestToolOwnerInRegistry,
@@ -34,6 +35,31 @@ export function resolveManifestCommandAliasOwner(params: {
});
}
export function resolveManifestCliCommandSurfaceOwner(params: {
command: string | undefined;
config?: OpenClawConfig;
workspaceDir?: string;
env?: NodeJS.ProcessEnv;
registry?: PluginManifestCommandAliasRegistry;
}): string | undefined {
const normalizedCommand = normalizeOptionalLowercaseString(params.command);
if (!normalizedCommand) {
return undefined;
}
if (params.registry) {
return resolveManifestCommandAliasOwnerInRegistry({
command: normalizedCommand,
registry: params.registry,
})?.pluginId;
}
return resolveManifestActivationPluginIds({
trigger: { kind: "command", command: normalizedCommand },
config: params.config,
workspaceDir: params.workspaceDir,
env: params.env,
})[0];
}
/**
* Resolve which plugin owns an agent-tool name, applying control-plane
* availability filters so disabled/denied plugins are not falsely attributed.