mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 17:30:43 +00:00
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
50 lines
1.4 KiB
TypeScript
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",
|
|
});
|
|
});
|
|
});
|