Remove the legacy plan2code-loop CLI

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-02 13:22:59 -08:00
1 parent d7abcd2ac6
commit c8d12a3d99
89 files changed
+449 -3189

No files matched your search

+14 -14
View File
@@ -65,7 +65,7 @@ async function runUpdate(steps) {
const log = console.log;
console.log = (...args) => lines.push(args.join(" "));
try {
const code = await installer.update({ steps });
const code = await installer.update({ steps, cleanShims: () => {} });
return { code, out: lines.join("\n").replace(/\x1b\[[0-9;]*m/g, "") };
} finally {
console.log = log;
@@ -76,12 +76,12 @@ test("install record: recordInstalled and forgetInstalled round trip a sorted se
clearRecord();
assert.equal(installer.INSTALL_RECORD, RECORD);
assert.equal(installer.readInstallRecord(), null);
installer.recordInstalled("loop");
installer.recordInstalled("metrics");
installer.recordInstalled("skills");
installer.recordInstalled("skills");
installer.recordInstalled("not-a-piece");
assert.deepEqual(installer.readInstallRecord(), { version: VERSION, scope: "global", pieces: ["loop", "skills"] });
installer.forgetInstalled("loop");
assert.deepEqual(installer.readInstallRecord(), { version: VERSION, scope: "global", pieces: ["metrics", "skills"] });
installer.forgetInstalled("metrics");
assert.deepEqual(installer.readInstallRecord().pieces, ["skills"]);
installer.forgetInstalled("skills");
assert.deepEqual(installer.readInstallRecord().pieces, []);
@@ -112,26 +112,26 @@ test("update: with no record it says so and updates the skills and the plan2code
});
test("update: a partial record runs only the listed pieces, in order, unattended", async () => {
writeRecord(["loop", "statusline"]);
writeRecord(["bot", "statusline"]);
const fake = fakeSteps();
const { code, out } = await runUpdate(fake.steps);
assert.equal(code, 0, out);
assert.deepEqual(fake.ran(), ["statusline", "loop"]);
assert.deepEqual(fake.ran(), ["statusline", "bot"]);
for (const call of fake.calls) assert.equal(call.options.unattended, true, call.piece);
assert.doesNotMatch(out, /No install record/);
assert.doesNotMatch(out, /skills:/);
});
test("update: a failing piece exits 1 naming it, and the others still run", async () => {
writeRecord(["skills", "launcher", "loop", "metrics", "bot"]);
const fake = fakeSteps({ codes: { loop: 1 }, throws: { metrics: "npm exploded" } });
writeRecord(["skills", "launcher", "statusline", "metrics", "bot"]);
const fake = fakeSteps({ codes: { statusline: 1 }, throws: { metrics: "npm exploded" } });
const { code, out } = await runUpdate(fake.steps);
assert.equal(code, 1, out);
assert.deepEqual(fake.ran(), ["skills", "loop", "metrics", "bot"]);
assert.match(out, /loop: failed: /);
assert.deepEqual(fake.ran(), ["skills", "statusline", "metrics", "bot"]);
assert.match(out, /statusline: failed: /);
assert.match(out, /metrics: failed: npm exploded/);
assert.match(out, /bot: updated/);
assert.match(out, /Update failed for: loop, metrics/);
assert.match(out, /Update failed for: statusline, metrics/);
});
test("update: when the skills install leaves the command out, the launcher step runs on its own", async () => {
@@ -351,7 +351,7 @@ test("app update: plan2code update replaces an older app and reports it", { skip
const server = await releaseServer(goodRelease(bytes));
try {
// The real app step, in the real update loop; the record lists only the app.
const { result, out } = await captured(() => installer.update({ steps: installer.UPDATE_STEPS }));
const { result, out } = await captured(() => installer.update({ steps: installer.UPDATE_STEPS, cleanShims: () => {} }));
assert.equal(result, 0, out);
assert.match(out, /app: updated/);
assert.deepEqual(fs.readFileSync(installer.APP_DEST), bytes);
@@ -366,7 +366,7 @@ test("app update: a checksum mismatch fails the update naming the app, nothing e
writeRecord(["app"]);
const server = await releaseServer(goodRelease(Buffer.from("tampered bytes"), "1".repeat(64)));
try {
const { result, out } = await captured(() => installer.update({ steps: installer.UPDATE_STEPS }));
const { result, out } = await captured(() => installer.update({ steps: installer.UPDATE_STEPS, cleanShims: () => {} }));
assert.equal(result, 1);
assert.match(out, /Update failed for: app/);
} finally {
@@ -382,7 +382,7 @@ test("app update: a release with no app file yet keeps the installed app and doe
// main moves to a new version before the release's files are attached: every file is a 404.
const server = await releaseServer({});
try {
const { result, out } = await captured(() => installer.update({ steps: installer.UPDATE_STEPS }));
const { result, out } = await captured(() => installer.update({ steps: installer.UPDATE_STEPS, cleanShims: () => {} }));
assert.equal(result, 0, out);
assert.match(out, /app: kept/);
assert.doesNotMatch(out, /Update failed/);
-6
View File
@@ -100,12 +100,6 @@ test("Quick Task and Review name the tests covering the changed files", () => {
assert.match(src("plan2code-review.md"), /\*\*Verify\*\* -- build and run the tests covering the fixed files \(per `references\/test-runs\.md`/);
});
test("the loop prompt points at the tests the task or phase file lists", () => {
const tpl = fs.readFileSync(path.join(ROOT, "plan2code-loop", "src", "prompt", "templates.ts"), "utf8");
assert.equal(tpl.split("run the tests the task or phase file lists").length - 1, 2);
assert.ok(!tpl.includes("if applicable"));
});
test("Finalize offers the full suite, skips it for Never and records the four outcomes", () => {
const fin = src("plan2code-4-finalize.md");
assert.ok(fin.includes("Run the full suite now?"), "Finalize asks the question");
@@ -1603,3 +1603,35 @@ test("Ghoul Rush's weapons all draw and every sound they name exists", () => {
}
assert.ok(round.score >= 0);
});
test("Ghoul Rush's Dynamite, Road Flare, Salt and Flash Powder are aimed: they land on the first monster ahead, or the middle of the group around it, and fly the old fixed throw with nothing ahead", () => {
const landsAt = (kind, setup, tail) => {
const round = roomOf("village", "inn");
standAt(round, 40);
give(round, kind, 3);
setup(round);
tapTap(round);
const hz = round.hazards.find((h) => ["stick", "armRoadFlare", "armPod"].includes(h.kind));
assert.ok(hz, `${kind} thrown`);
for (let i = 0; i < 400 && round.hazards.includes(hz) && !hz.rest; i++) run(round, 16);
return hz.x;
};
const still = (round, x) => put(round, "zombie", x, { stunMs: 1e9 });
for (const kind of ["dyn", "flare", "salt", "flash"]) {
const lone = landsAt(kind, (r) => still(r, 70));
assert.ok(Math.abs(lone - 70) < (kind === "salt" || kind === "flash" ? 8 : 2), `${kind} lands on a lone monster (${lone})`);
const group = landsAt(kind, (r) => { still(r, 62); still(r, 66); still(r, 70); still(r, 130); });
assert.ok(Math.abs(group - 66) < (kind === "salt" || kind === "flash" ? 8 : 2), `${kind} lands in the middle of the group (${group})`);
const behind = landsAt(kind, (r) => still(r, 10));
const none = landsAt(kind, () => {});
assert.ok(Math.abs(behind - none) < 0.5, `${kind} ignores what is behind`);
}
// The Creampie keeps its fixed lob.
const pie = roomOf("village", "inn");
standAt(pie, 40);
give(pie, "pie", 3);
put(pie, "zombie", 62, { stunMs: 1e9 });
tapTap(pie);
const lob = pie.hazards.find((h) => h.kind === "armPie");
assert.ok(lob && Math.abs(lob.vx - arm.PIE_VX) < 1e-9, "the pie is not aimed");
});
@@ -614,7 +614,7 @@ test("Ghoul Rush's Mirror You fires a bolt for each bolt you fire, 500 ms late,
};
assert.equal(hit(false), "mirrorbolt", "a bolt on a standing you");
assert.equal(hit(true), undefined, "a bolt over a ducked you");
// Cancelling: your bolt and its bolt meet in the air.
// Canceling: your bolt and its bolt meet in the air.
const meet = carnivalRound("mirrors");
standAt(meet, 50);
meet.you.safeMs = 1e9;