@pi-archimedes/ui 2.10.3 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/package.json +8 -8
- package/src/bash/index.ts +0 -2
- package/src/bash/renderer.test.ts +50 -5
- package/src/bash/renderer.ts +28 -30
- package/src/codemode/index.ts +0 -9
- package/src/codemode/renderer.test.ts +32 -31
- package/src/codemode/renderer.ts +29 -61
- package/src/config.test.ts +62 -1
- package/src/config.ts +45 -1
- package/src/editor/index.test.ts +118 -2
- package/src/editor/index.ts +34 -3
- package/src/editor/spin-quips.ts +1 -1
- package/src/index.screen-mode.test.ts +411 -0
- package/src/index.test.ts +506 -101
- package/src/index.ts +252 -104
- package/src/settings.test.ts +37 -2
- package/src/settings.ts +16 -3
- package/src/startup/index.test.ts +239 -129
- package/src/startup/index.ts +179 -272
- package/src/startup/pi-listing.test.ts +290 -0
- package/src/startup/sections.test.ts +38 -208
- package/src/startup/sections.ts +83 -236
- package/src/startup-splash-gate.test.ts +546 -0
- package/src/thinking/patch.test.ts +81 -1
- package/src/thinking/patch.ts +22 -6
- package/src/bash/tool.test.ts +0 -26
- package/src/bash/tool.ts +0 -17
- package/src/codemode/loader.test.ts +0 -139
- package/src/codemode/loader.ts +0 -115
- package/src/codemode/tool.test.ts +0 -149
- package/src/codemode/tool.ts +0 -96
- package/src/startup/capture.ts +0 -47
- package/src/startup/version.test.ts +0 -98
- package/src/startup/version.ts +0 -26
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import * as fc from "fast-check";
|
|
3
|
-
import { compareVersions } from "./version.js";
|
|
4
|
-
|
|
5
|
-
// ── Version generator for property tests ─────────────────────────────────────
|
|
6
|
-
|
|
7
|
-
const versionArb = fc.tuple(fc.nat(100), fc.nat(100), fc.nat(100)).map(
|
|
8
|
-
([major, minor, patch]) => `${major}.${minor}.${patch}`,
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
// ── compareVersions ──────────────────────────────────────────────────────────
|
|
12
|
-
|
|
13
|
-
describe("compareVersions", () => {
|
|
14
|
-
it('returns 0 for equal versions', () => {
|
|
15
|
-
expect(compareVersions("1.0.0", "1.0.0")).toBe(0);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('returns 1 when first version is greater', () => {
|
|
19
|
-
expect(compareVersions("2.0.0", "1.9.9")).toBe(1);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('returns -1 when second version is greater', () => {
|
|
23
|
-
expect(compareVersions("1.0.0", "2.0.0")).toBe(-1);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("handles v prefix on first argument", () => {
|
|
27
|
-
expect(compareVersions("v1.2.3", "1.2.3")).toBe(0);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("handles v prefix on second argument", () => {
|
|
31
|
-
expect(compareVersions("1.2.3", "v1.2.3")).toBe(0);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("handles v prefix on both arguments", () => {
|
|
35
|
-
expect(compareVersions("v2.0.0", "v1.0.0")).toBe(1);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("handles partial versions (2 parts vs 3 parts)", () => {
|
|
39
|
-
expect(compareVersions("1.0", "1.0.0")).toBe(0);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("handles partial versions with difference", () => {
|
|
43
|
-
expect(compareVersions("1.1", "1.0.5")).toBe(1);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("handles zero-padded versions", () => {
|
|
47
|
-
expect(compareVersions("01.02.03", "1.2.3")).toBe(0);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it("compares minor version correctly", () => {
|
|
51
|
-
expect(compareVersions("1.2.0", "1.1.9")).toBe(1);
|
|
52
|
-
expect(compareVersions("1.1.0", "1.2.0")).toBe(-1);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("compares patch version correctly", () => {
|
|
56
|
-
expect(compareVersions("1.0.5", "1.0.3")).toBe(1);
|
|
57
|
-
expect(compareVersions("1.0.3", "1.0.5")).toBe(-1);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it("handles all-zero versions", () => {
|
|
61
|
-
expect(compareVersions("0.0.0", "0.0.0")).toBe(0);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// ── Property tests ───────────────────────────────────────────────────
|
|
65
|
-
|
|
66
|
-
it("property: reflexive — compareVersions(a, a) === 0", () => {
|
|
67
|
-
fc.assert(
|
|
68
|
-
fc.property(versionArb, a => {
|
|
69
|
-
return compareVersions(a, a) === 0;
|
|
70
|
-
}),
|
|
71
|
-
);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
it("property: antisymmetric — compareVersions(a, b) === -compareVersions(b, a)", () => {
|
|
75
|
-
fc.assert(
|
|
76
|
-
fc.property(versionArb, versionArb, (a, b) => {
|
|
77
|
-
return compareVersions(a, b) === -compareVersions(b, a);
|
|
78
|
-
}),
|
|
79
|
-
);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it("property: transitivity — if a<b and b<c then a<c", () => {
|
|
83
|
-
fc.assert(
|
|
84
|
-
fc.property(
|
|
85
|
-
fc.tuple(versionArb, versionArb, versionArb),
|
|
86
|
-
([a, b, c]) => {
|
|
87
|
-
const ab = compareVersions(a, b);
|
|
88
|
-
const bc = compareVersions(b, c);
|
|
89
|
-
const ac = compareVersions(a, c);
|
|
90
|
-
if (ab < 0 && bc < 0) {
|
|
91
|
-
return ac < 0;
|
|
92
|
-
}
|
|
93
|
-
return true;
|
|
94
|
-
},
|
|
95
|
-
),
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
});
|
package/src/startup/version.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const NPM_REGISTRY_URL = "https://registry.npmjs.org/@earendil-works/pi-coding-agent/latest";
|
|
2
|
-
const FETCH_TIMEOUT_MS = 4000;
|
|
3
|
-
|
|
4
|
-
export async function fetchLatestVersion(): Promise<string | undefined> {
|
|
5
|
-
try {
|
|
6
|
-
const controller = new AbortController();
|
|
7
|
-
const timeout = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
8
|
-
const res = await fetch(NPM_REGISTRY_URL, { signal: controller.signal });
|
|
9
|
-
clearTimeout(timeout);
|
|
10
|
-
if (!res.ok) return undefined;
|
|
11
|
-
const data = (await res.json()) as { version?: string };
|
|
12
|
-
return data.version;
|
|
13
|
-
} catch {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function compareVersions(a: string, b: string): number {
|
|
19
|
-
const pa = a.replace(/^v/, "").split(".").map(Number);
|
|
20
|
-
const pb = b.replace(/^v/, "").split(".").map(Number);
|
|
21
|
-
for (let i = 0; i < 3; i++) {
|
|
22
|
-
if ((pa[i] ?? 0) > (pb[i] ?? 0)) return 1;
|
|
23
|
-
if ((pa[i] ?? 0) < (pb[i] ?? 0)) return -1;
|
|
24
|
-
}
|
|
25
|
-
return 0;
|
|
26
|
-
}
|