Files
openclaw/src/plugins/manifest-command-aliases.test.ts
Peter Steinberger d763b83854 fix: explain disabled plugin command aliases
Preserve enabled-by-default metadata for manifest command aliases so missing CLI command diagnostics can point users at the parent bundled plugin and the `openclaw plugins enable <plugin>` repair path.

Also carries the current-main deadcode allowlist entry for the command-analysis barrel that blocked CI.

Verified:
- pnpm test src/cli/run-main.test.ts src/plugins/manifest-command-aliases.test.ts
- pnpm deadcode:unused-files
- pnpm exec oxfmt --check --threads=1 scripts/deadcode-unused-files.allowlist.mjs CHANGELOG.md src/cli/run-main-policy.ts src/cli/run-main.test.ts src/plugins/manifest-command-aliases.ts src/plugins/manifest-command-aliases.test.ts
- git diff --check
- PR CI on 6076ff2d52 green, ignoring cancelled auto-response per landing matrix
2026-05-03 18:19:50 +01:00

50 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import {
normalizeManifestCommandAliases,
resolveManifestCommandAliasOwnerInRegistry,
} from "./manifest-command-aliases.js";
describe("manifest command aliases", () => {
it("normalizes string and object entries", () => {
expect(
normalizeManifestCommandAliases([
"memory",
{ name: "reindex", kind: "runtime-slash", cliCommand: "memory" },
{ name: "" },
{ name: "bad-kind", kind: "unknown" },
]),
).toEqual([
{ name: "memory" },
{ name: "reindex", kind: "runtime-slash", cliCommand: "memory" },
{ name: "bad-kind" },
]);
});
it("resolves aliases without treating plugin ids as command aliases", () => {
const registry = {
plugins: [
{
id: "memory-core",
commandAliases: [{ name: "memory", kind: "runtime-slash" as const }],
},
{
id: "memory",
enabledByDefault: true,
commandAliases: [{ name: "legacy-memory" }],
},
],
};
expect(resolveManifestCommandAliasOwnerInRegistry({ command: "memory", registry })).toBe(
undefined,
);
expect(
resolveManifestCommandAliasOwnerInRegistry({ command: "legacy-memory", registry }),
).toMatchObject({
pluginId: "memory",
enabledByDefault: true,
name: "legacy-memory",
});
});
});