Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2import { buildRuntimeInstructions } from "./RuntimeInstructions.ts";
3
4describe("buildRuntimeInstructions", () => {
5 it("requires explicit registration of every PR and stack layer", () => {
6 const instructions = buildRuntimeInstructions({ harness: "Codex" });
7 expect(instructions).toContain("When the t3-code MCP server exposes link_pull_request");
8 expect(instructions).toContain("with the full PR URL immediately after creating a PR");
9 expect(instructions).toContain("For a stack, call it for every layer");
10 expect(instructions).toContain("call list_thread_pull_requests and link any PR");
11 });
12
13 it("asks agents to hand the thread off to a worktree they create for it", () => {
14 const instructions = buildRuntimeInstructions({ harness: "Claude Code" });
15 expect(instructions).toContain("call t3_worktree_handoff with the worktree's absolute path");
16 expect(instructions).toContain("Do not call it for worktrees you create for other purposes");
17 });
18
19 it("keeps known model and effort metadata on one line", () => {
20 expect(
21 buildRuntimeInstructions({
22 harness: "Codex",
23 model: " custom\nmodel ",
24 reasoningEffort: " high\n",
25 }),
26 ).toContain("through the Codex harness, as custom model with high reasoning effort.");
27 });
28
29 it.each([undefined, "", "auto", "default"])("omits unresolved model %s", (model) => {
30 const instructions = buildRuntimeInstructions({ harness: "Cursor", model });
31 expect(instructions).toContain("through the Cursor harness.");
32 expect(instructions).not.toContain("reasoning effort");
33 });
34});