Files
pi-goals/test/append-log.test.ts
T
wassnameandClaudypoo c0f80b869e v2: delete the parser -- plan.md is for LLMs, the judge subsumes the machinery
The v1 lesson: the parser existed so TypeScript could read goals.md, but every
reader is a model. v2 injects .pi/plan.md verbatim each turn, teaches the format
as a convention, and hands the whole file to the judge, which now does the goal
matching (tolerates wording drift), evidence validation, verify execution, and
format reading that v1 did in code. 1874 -> 530 lines.

Deleted: plan-file.ts + tests, JSON-stream judge transport, custom tool
rendering, review menu + $EDITOR + newSession dance, pruneCompleted, unwired
continuation/loopJudge prompts, MUTATING_BASH_PATTERNS. CompleteGoal's only
write is the ## Log sign-off line (the audit trail); the agent ticks [x] itself.
Judge runs with --no-extensions so a broken global extension can't take down
sign-offs (pi-hermes-memory currently does exactly that). File renamed
goals.md -> plan.md.

UAT (real judge subprocess on a toy repo, /tmp/claude-goals-uat/judge-*.log):
accept with verify run + byte-check, reject on placeholder evidence + missing
file, accept under drifted goal wording.

Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
2026-07-03 10:24:35 +08:00

18 lines
792 B
TypeScript

import { describe, expect, it } from "vitest";
import { appendLog } from "../src/index.js";
describe("appendLog (the extension's only plan-file write)", () => {
it("creates ## Log at EOF when absent", () => {
const out = appendLog("# Plan\n\n## Goals\n\n1. [ ] goal: x\n", "2026-07-03 10:00 signed off \"x\" (judge accept)");
expect(out).toContain("## Log\n- 2026-07-03 10:00 signed off");
});
it("appends after the last existing log line, before any following header", () => {
const plan = "# Plan\n\n## Log\n- first\n- second\n\n# Future work\n- later\n";
const out = appendLog(plan, "third");
const lines = out.split("\n");
expect(lines[lines.indexOf("- second") + 1]).toBe("- third");
expect(out.indexOf("- third")).toBeLessThan(out.indexOf("# Future work"));
});
});