mirror of
https://github.com/backnotprop/plannotator.git
synced 2026-09-14 14:17:26 +08:00
8a8d0544c6
* feat: detect the oh-my-pi harness as its own agent origin - omp injects OMPCODE=1 (+ a CLAUDECODE=1 compat shim) into every Bash-tool child; the env chain now maps it to a dedicated oh-my-pi origin labeled "Oh My Pi". - Distinct origin rather than aliasing claude-code, because the claude-code-only gates (permission-mode setup, permissionMode in approve) presuppose a PermissionRequest hook that a bash-invoked plannotator never has; omp has no approve support and no planning integration yet. - Fallback deliberately left "claude-code"; wording unchanged. - No dedicated Ask AI provider for oh-my-pi. * chore: sync lockfile workspace versions * fix: check OMPCODE last so runtimes inside an OMP session keep their label OMP exports OMPCODE into every shell it spawns. With the check at the top of the chain, opencode/codex/... launched from an OMP session inherited OMPCODE and were mislabeled "Oh My Pi". Moving it just above the terminal fallback lets specific runtime env vars win; OMPCODE still beats the claude-code fallback for bare shells. Reported by backnotprop in #1373.
38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { AGENT_CONFIG, getAgentAIProviderTypes, getAgentBadge, getAgentName } from "./agents";
|
|
|
|
describe("getAgentName", () => {
|
|
test("resolves oh-my-pi to its display name", () => {
|
|
expect(getAgentName("oh-my-pi")).toBe("Oh My Pi");
|
|
});
|
|
|
|
test("falls back to Coding Agent for null/undefined/unknown origins", () => {
|
|
expect(getAgentName(null)).toBe("Coding Agent");
|
|
expect(getAgentName(undefined)).toBe("Coding Agent");
|
|
expect(getAgentName("not-a-real-origin" as never)).toBe("Coding Agent");
|
|
});
|
|
});
|
|
|
|
describe("getAgentBadge", () => {
|
|
test("resolves oh-my-pi badge classes", () => {
|
|
expect(getAgentBadge("oh-my-pi")).toBe("bg-fuchsia-500/15 text-fuchsia-400");
|
|
});
|
|
});
|
|
|
|
describe("getAgentAIProviderTypes", () => {
|
|
test("oh-my-pi has no dedicated Ask AI provider", () => {
|
|
expect(getAgentAIProviderTypes("oh-my-pi")).toEqual([]);
|
|
});
|
|
});
|
|
|
|
describe("pi vs oh-my-pi are distinct origins", () => {
|
|
test("both keys exist in AGENT_CONFIG with different names", () => {
|
|
// Guards against conflating the Pi coding agent with the oh-my-pi harness.
|
|
expect("pi" in AGENT_CONFIG).toBe(true);
|
|
expect("oh-my-pi" in AGENT_CONFIG).toBe(true);
|
|
expect(AGENT_CONFIG.pi.name).not.toBe(AGENT_CONFIG["oh-my-pi"].name);
|
|
expect(AGENT_CONFIG.pi.name).toBe("Pi");
|
|
expect(AGENT_CONFIG["oh-my-pi"].name).toBe("Oh My Pi");
|
|
});
|
|
});
|