mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-05-08 16:17:54 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
89 lines
2.7 KiB
TypeScript
89 lines
2.7 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { HookStatusReport } from "../hooks/hooks-status.js";
|
|
import { formatHookInfo, formatHooksCheck, formatHooksList } from "./hooks-cli.js";
|
|
import { createEmptyInstallChecks } from "./requirements-test-fixtures.js";
|
|
|
|
const report: HookStatusReport = {
|
|
workspaceDir: "/tmp/workspace",
|
|
managedHooksDir: "/tmp/hooks",
|
|
hooks: [
|
|
{
|
|
name: "session-memory",
|
|
description: "Save session context to memory",
|
|
source: "openclaw-bundled",
|
|
pluginId: undefined,
|
|
filePath: "/tmp/hooks/session-memory/HOOK.md",
|
|
baseDir: "/tmp/hooks/session-memory",
|
|
handlerPath: "/tmp/hooks/session-memory/handler.js",
|
|
hookKey: "session-memory",
|
|
emoji: "💾",
|
|
homepage: "https://docs.openclaw.ai/automation/hooks#session-memory",
|
|
events: ["command:new"],
|
|
always: false,
|
|
enabledByConfig: true,
|
|
requirementsSatisfied: true,
|
|
loadable: true,
|
|
blockedReason: undefined,
|
|
managedByPlugin: false,
|
|
...createEmptyInstallChecks(),
|
|
},
|
|
],
|
|
};
|
|
|
|
function createPluginManagedHookReport(): HookStatusReport {
|
|
return {
|
|
workspaceDir: "/tmp/workspace",
|
|
managedHooksDir: "/tmp/hooks",
|
|
hooks: [
|
|
{
|
|
name: "plugin-hook",
|
|
description: "Hook from plugin",
|
|
source: "openclaw-plugin",
|
|
pluginId: "voice-call",
|
|
filePath: "/tmp/hooks/plugin-hook/HOOK.md",
|
|
baseDir: "/tmp/hooks/plugin-hook",
|
|
handlerPath: "/tmp/hooks/plugin-hook/handler.js",
|
|
hookKey: "plugin-hook",
|
|
emoji: "🔗",
|
|
homepage: undefined,
|
|
events: ["command:new"],
|
|
always: false,
|
|
enabledByConfig: true,
|
|
requirementsSatisfied: true,
|
|
loadable: true,
|
|
blockedReason: undefined,
|
|
managedByPlugin: true,
|
|
...createEmptyInstallChecks(),
|
|
},
|
|
],
|
|
};
|
|
}
|
|
|
|
describe("hooks cli formatting", () => {
|
|
it("labels hooks list output", () => {
|
|
const output = formatHooksList(report, {});
|
|
expect(output).toContain("Hooks");
|
|
expect(output).not.toContain("Internal Hooks");
|
|
});
|
|
|
|
it("labels hooks status output", () => {
|
|
const output = formatHooksCheck(report, {});
|
|
expect(output).toContain("Hooks Status");
|
|
});
|
|
|
|
it("labels plugin-managed hooks with plugin id", () => {
|
|
const pluginReport = createPluginManagedHookReport();
|
|
|
|
const output = formatHooksList(pluginReport, {});
|
|
expect(output).toContain("plugin:voice-call");
|
|
});
|
|
|
|
it("shows plugin-managed details in hook info", () => {
|
|
const pluginReport = createPluginManagedHookReport();
|
|
|
|
const output = formatHookInfo(pluginReport, "plugin-hook", {});
|
|
expect(output).toContain("voice-call");
|
|
expect(output).toContain("Managed by plugin");
|
|
});
|
|
});
|