mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 19:32:27 +00:00
refactor: move memory tooling into memory-core extension
This commit is contained in:
@@ -72,7 +72,6 @@ describe("command-registry", () => {
|
||||
it("returns only commands that support subcommands", () => {
|
||||
const names = getCoreCliCommandsWithSubcommands();
|
||||
expect(names).toContain("config");
|
||||
expect(names).toContain("memory");
|
||||
expect(names).toContain("agents");
|
||||
expect(names).toContain("backup");
|
||||
expect(names).toContain("browser");
|
||||
|
||||
@@ -147,19 +147,6 @@ const coreEntries: CoreCliEntry[] = [
|
||||
mod.registerMessageCommands(program, ctx);
|
||||
},
|
||||
},
|
||||
{
|
||||
commands: [
|
||||
{
|
||||
name: "memory",
|
||||
description: "Search and reindex memory files",
|
||||
hasSubcommands: true,
|
||||
},
|
||||
],
|
||||
register: async ({ program }) => {
|
||||
const mod = await import("../memory-cli.js");
|
||||
mod.registerMemoryCli(program);
|
||||
},
|
||||
},
|
||||
{
|
||||
commands: [
|
||||
{
|
||||
|
||||
@@ -56,11 +56,6 @@ export const CORE_CLI_COMMAND_DESCRIPTORS = [
|
||||
description: "Send, read, and manage messages",
|
||||
hasSubcommands: true,
|
||||
},
|
||||
{
|
||||
name: "memory",
|
||||
description: "Search and reindex memory files",
|
||||
hasSubcommands: true,
|
||||
},
|
||||
{
|
||||
name: "agent",
|
||||
description: "Run one agent turn via the Gateway",
|
||||
|
||||
@@ -13,11 +13,17 @@ function buildRootHelpProgram(): Command {
|
||||
agentChannelOptions: "",
|
||||
});
|
||||
|
||||
const existingCommands = new Set<string>();
|
||||
for (const command of getCoreCliCommandDescriptors()) {
|
||||
program.command(command.name).description(command.description);
|
||||
existingCommands.add(command.name);
|
||||
}
|
||||
for (const command of getSubCliEntries()) {
|
||||
if (existingCommands.has(command.name)) {
|
||||
continue;
|
||||
}
|
||||
program.command(command.name).description(command.description);
|
||||
existingCommands.add(command.name);
|
||||
}
|
||||
|
||||
return program;
|
||||
|
||||
@@ -260,10 +260,6 @@ describe("program routes", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("returns false for memory status route when --agent value is missing", async () => {
|
||||
await expectRunFalse(["memory", "status"], ["node", "openclaw", "memory", "status", "--agent"]);
|
||||
});
|
||||
|
||||
it("returns false for models list route when --provider value is missing", async () => {
|
||||
await expectRunFalse(["models", "list"], ["node", "openclaw", "models", "list", "--provider"]);
|
||||
});
|
||||
|
||||
@@ -151,23 +151,6 @@ const routeAgentsList: RouteSpec = {
|
||||
},
|
||||
};
|
||||
|
||||
const routeMemoryStatus: RouteSpec = {
|
||||
match: (path) => path[0] === "memory" && path[1] === "status",
|
||||
run: async (argv) => {
|
||||
const agent = getFlagValue(argv, "--agent");
|
||||
if (agent === null) {
|
||||
return false;
|
||||
}
|
||||
const json = hasFlag(argv, "--json");
|
||||
const deep = hasFlag(argv, "--deep");
|
||||
const index = hasFlag(argv, "--index");
|
||||
const verbose = hasFlag(argv, "--verbose");
|
||||
const { runMemoryStatus } = await import("../memory-cli.js");
|
||||
await runMemoryStatus({ agent, json, deep, index, verbose });
|
||||
return true;
|
||||
},
|
||||
};
|
||||
|
||||
function getFlagValues(argv: string[], name: string): string[] | null {
|
||||
const values: string[] = [];
|
||||
const args = argv.slice(2);
|
||||
@@ -316,7 +299,6 @@ const routes: RouteSpec[] = [
|
||||
routeGatewayStatus,
|
||||
routeSessions,
|
||||
routeAgentsList,
|
||||
routeMemoryStatus,
|
||||
routeConfigGet,
|
||||
routeConfigUnset,
|
||||
routeModelsList,
|
||||
|
||||
Reference in New Issue
Block a user