mirror of
https://github.com/wassname/pi-goals.git
synced 2026-07-24 13:10:41 +08:00
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>
18 lines
792 B
TypeScript
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"));
|
|
});
|
|
});
|