Files
oh-my-pi/packages/coding-agent/test/discovery/agent-fields.test.ts
T
can1357 a3f8f122cc feat(coding-agent): renamed grep to search in runtime mappings
- Renamed the built-in `grep` content-search tool to `search` across settings, schemas, and SDK exports.
- Switched execution wiring so `Task`, `Plan`, cursor, and shell mapping now invoke `search` instead of `grep`.
- Updated prompts, plan-mode docs, and example tool lists to replace `grep`/`ls` references with `search` guidance.
- Aligned `Grep*`/`grep` event, renderer, and hook types to `Search*`/`search` across runtime and tests.
- Documented and fixed `search` result rendering budget behavior and added internal-URL/path-list transcript notes.
2026-04-27 21:55:31 +02:00

70 lines
1.6 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import { Effort } from "@oh-my-pi/pi-ai";
import { parseAgentFields } from "../../src/discovery/helpers";
describe("parseAgentFields", () => {
test("parses blocking from boolean frontmatter", () => {
const fields = parseAgentFields({
name: "reviewer",
description: "desc",
blocking: true,
});
expect(fields).toBeDefined();
expect(fields?.blocking).toBe(true);
});
test("parses blocking from string frontmatter", () => {
const fields = parseAgentFields({
name: "reviewer",
description: "desc",
blocking: "false",
});
expect(fields).toBeDefined();
expect(fields?.blocking).toBe(false);
});
test("ignores invalid blocking values", () => {
const fields = parseAgentFields({
name: "reviewer",
description: "desc",
blocking: "sometimes",
});
expect(fields).toBeDefined();
expect(fields?.blocking).toBeUndefined();
});
test("parses legacy thinking key", () => {
const fields = parseAgentFields({
name: "reviewer",
description: "desc",
thinking: "medium",
});
expect(fields).toBeDefined();
expect(fields?.thinkingLevel).toBe(Effort.Medium);
});
test("prefers thinking-level over legacy thinking", () => {
const fields = parseAgentFields({
name: "reviewer",
description: "desc",
thinking: "minimal",
thinkingLevel: Effort.High,
});
expect(fields?.thinkingLevel).toBe(Effort.High);
});
test("lowercases tool names", () => {
const fields = parseAgentFields({
name: "reviewer",
description: "desc",
tools: ["Read", "Search"],
});
expect(fields?.tools).toEqual(["read", "search", "yield"]);
});
});