mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-05-08 00:02:20 +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
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import process from "node:process";
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
const { buildProgram } = await import("./build-program.js");
|
|
|
|
describe("buildProgram version alias handling", () => {
|
|
let originalArgv: string[];
|
|
|
|
beforeEach(() => {
|
|
originalArgv = [...process.argv];
|
|
});
|
|
|
|
afterEach(() => {
|
|
process.argv = originalArgv;
|
|
vi.restoreAllMocks();
|
|
});
|
|
|
|
it("exits with version output for root -v", () => {
|
|
process.argv = ["node", "openclaw", "-v"];
|
|
const logSpy = vi.spyOn(console, "log").mockImplementation(() => {});
|
|
const exitSpy = vi.spyOn(process, "exit").mockImplementation(((code?: number) => {
|
|
throw new Error(`process.exit:${String(code)}`);
|
|
}) as typeof process.exit);
|
|
|
|
expect(() => buildProgram()).toThrow("process.exit:0");
|
|
expect(logSpy).toHaveBeenCalledTimes(1);
|
|
expect(exitSpy).toHaveBeenCalledWith(0);
|
|
});
|
|
|
|
it("does not treat subcommand -v as root version alias", () => {
|
|
process.argv = ["node", "openclaw", "acp", "-v"];
|
|
const exitSpy = vi.spyOn(process, "exit").mockImplementation(((code?: number) => {
|
|
throw new Error(`unexpected process.exit:${String(code)}`);
|
|
}) as typeof process.exit);
|
|
|
|
expect(() => buildProgram()).not.toThrow();
|
|
expect(exitSpy).not.toHaveBeenCalled();
|
|
});
|
|
});
|