mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-24 11:24:27 +00:00
fix: allow plugin CLI registration for builtin memory command
The performance optimization that skips plugin loading for builtin commands prevented memory-neo4j from registering its "neo4j" subcommand, causing "openclaw memory neo4j sleep" to fail with "unknown command". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -101,6 +101,16 @@ describe("shouldSkipPluginCommandRegistration", () => {
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps plugin registration for plugin-extensible builtins like memory", () => {
|
||||
expect(
|
||||
shouldSkipPluginCommandRegistration({
|
||||
argv: ["node", "openclaw", "memory", "neo4j", "sleep"],
|
||||
primary: "memory",
|
||||
hasBuiltinPrimary: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("shouldEnsureCliPath", () => {
|
||||
|
||||
@@ -27,12 +27,20 @@ export function shouldRegisterPrimarySubcommand(argv: string[]): boolean {
|
||||
return !hasHelpOrVersion(argv);
|
||||
}
|
||||
|
||||
// Builtin commands that plugins are known to extend with subcommands.
|
||||
// These must NOT skip plugin CLI registration even though they are builtins.
|
||||
const PLUGIN_EXTENSIBLE_COMMANDS = new Set(["memory"]);
|
||||
|
||||
export function shouldSkipPluginCommandRegistration(params: {
|
||||
argv: string[];
|
||||
primary: string | null;
|
||||
hasBuiltinPrimary: boolean;
|
||||
}): boolean {
|
||||
if (params.hasBuiltinPrimary) {
|
||||
// Some builtins are extended by plugins (e.g. "memory" gains "neo4j" subcommand).
|
||||
if (params.primary && PLUGIN_EXTENSIBLE_COMMANDS.has(params.primary)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!params.primary) {
|
||||
|
||||
Reference in New Issue
Block a user