fix: rename OMX_OPENCLAW env vars to OMO_OPENCLAW
Renames all environment variable gates from the old oh-my-codex (OMX) prefix to the correct oh-my-openagent (OMO) prefix: - OMX_OPENCLAW -> OMO_OPENCLAW - OMX_OPENCLAW_COMMAND -> OMO_OPENCLAW_COMMAND - OMX_OPENCLAW_DEBUG -> OMO_OPENCLAW_DEBUG - OMX_OPENCLAW_COMMAND_TIMEOUT_MS -> OMO_OPENCLAW_COMMAND_TIMEOUT_MS Adds TDD tests verifying: - OMO_OPENCLAW=1 is required for activation - Old OMX_OPENCLAW env var is not accepted
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "bun:test";
|
||||
import { resolveGateway } from "../client";
|
||||
import { describe, it, expect, beforeEach, afterEach } from "bun:test";
|
||||
import { resolveGateway, wakeOpenClaw } from "../client";
|
||||
import { type OpenClawConfig } from "../types";
|
||||
|
||||
describe("OpenClaw Client", () => {
|
||||
@@ -38,4 +38,61 @@ describe("OpenClaw Client", () => {
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("wakeOpenClaw env gate", () => {
|
||||
let oldEnv: string | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
oldEnv = process.env.OMO_OPENCLAW;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (oldEnv === undefined) {
|
||||
delete process.env.OMO_OPENCLAW;
|
||||
} else {
|
||||
process.env.OMO_OPENCLAW = oldEnv;
|
||||
}
|
||||
});
|
||||
|
||||
it("returns null when OMO_OPENCLAW is not set", async () => {
|
||||
delete process.env.OMO_OPENCLAW;
|
||||
const config: OpenClawConfig = {
|
||||
enabled: true,
|
||||
gateways: { gw: { type: "command", command: "echo test" } },
|
||||
hooks: {
|
||||
"session-start": { gateway: "gw", instruction: "hi", enabled: true },
|
||||
},
|
||||
};
|
||||
const result = await wakeOpenClaw("session-start", { projectPath: "/tmp" }, config);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("returns null when OMO_OPENCLAW is not '1'", async () => {
|
||||
process.env.OMO_OPENCLAW = "0";
|
||||
const config: OpenClawConfig = {
|
||||
enabled: true,
|
||||
gateways: { gw: { type: "command", command: "echo test" } },
|
||||
hooks: {
|
||||
"session-start": { gateway: "gw", instruction: "hi", enabled: true },
|
||||
},
|
||||
};
|
||||
const result = await wakeOpenClaw("session-start", { projectPath: "/tmp" }, config);
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
|
||||
it("does not use OMX_OPENCLAW (old env var)", async () => {
|
||||
delete process.env.OMO_OPENCLAW;
|
||||
process.env.OMX_OPENCLAW = "1";
|
||||
const config: OpenClawConfig = {
|
||||
enabled: true,
|
||||
gateways: { gw: { type: "command", command: "echo test" } },
|
||||
hooks: {
|
||||
"session-start": { gateway: "gw", instruction: "hi", enabled: true },
|
||||
},
|
||||
};
|
||||
const result = await wakeOpenClaw("session-start", { projectPath: "/tmp" }, config);
|
||||
expect(result).toBeNull();
|
||||
delete process.env.OMX_OPENCLAW;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -63,8 +63,8 @@ describe("OpenClaw Dispatcher", () => {
|
||||
|
||||
describe("wakeCommandGateway", () => {
|
||||
it("rejects if disabled via env", async () => {
|
||||
const oldEnv = process.env.OMX_OPENCLAW_COMMAND;
|
||||
process.env.OMX_OPENCLAW_COMMAND = "0";
|
||||
const oldEnv = process.env.OMO_OPENCLAW_COMMAND;
|
||||
process.env.OMO_OPENCLAW_COMMAND = "0";
|
||||
const config: OpenClawCommandGatewayConfig = {
|
||||
type: "command",
|
||||
command: "echo hi",
|
||||
@@ -72,7 +72,7 @@ describe("OpenClaw Dispatcher", () => {
|
||||
const result = await wakeCommandGateway("test", config, {});
|
||||
expect(result.success).toBe(false);
|
||||
expect(result.error).toContain("disabled");
|
||||
process.env.OMX_OPENCLAW_COMMAND = oldEnv;
|
||||
process.env.OMO_OPENCLAW_COMMAND = oldEnv;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user