feat(coding-agent): show update notes (#4724)

This commit is contained in:
Armin Ronacher
2026-05-19 12:08:13 +02:00
committed by GitHub
parent 2787b601d7
commit f4f0ac7ada
4 changed files with 97 additions and 23 deletions

View File

@@ -38,7 +38,7 @@ describe("version checks", () => {
vi.stubGlobal("fetch", fetchMock);
await expect(checkForNewPiVersion("1.2.3")).resolves.toBeUndefined();
await expect(checkForNewPiVersion("1.2.2")).resolves.toBe("1.2.3");
await expect(checkForNewPiVersion("1.2.2")).resolves.toEqual({ version: "1.2.3" });
});
it("uses the pi.dev version check api with a pi user agent", async () => {
@@ -57,11 +57,26 @@ describe("version checks", () => {
);
});
it("returns the active package name from the version check api", async () => {
const fetchMock = vi.fn(async () => Response.json({ packageName: "@new-scope/pi", version: "1.2.4" }));
it("returns the active package metadata from the version check api", async () => {
const fetchMock = vi.fn(async () =>
Response.json({
packageName: "@new-scope/pi",
version: "1.2.4",
}),
);
vi.stubGlobal("fetch", fetchMock);
await expect(getLatestPiRelease("1.2.3")).resolves.toEqual({ packageName: "@new-scope/pi", version: "1.2.4" });
await expect(getLatestPiRelease("1.2.3")).resolves.toEqual({
packageName: "@new-scope/pi",
version: "1.2.4",
});
});
it("returns update notes from the version check api", async () => {
const fetchMock = vi.fn(async () => Response.json({ note: " **Read this** ", version: "1.2.4" }));
vi.stubGlobal("fetch", fetchMock);
await expect(getLatestPiRelease("1.2.3")).resolves.toEqual({ note: "**Read this**", version: "1.2.4" });
});
it("skips api calls when version checks are disabled", async () => {