repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

fix: scope Pi package migration floor

bb9416fb027d237a46dd87e8c475111de8285754

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (2)

.pi/skills/modernize/scripts/audit.mjs

Modified
121 121 export function collectPackageVersions(lock) {
122 122 const packages =
123 123 lock && typeof lock === "object" && lock.packages ? lock.packages : {};
124 - return Object.entries(packages)
125 - .flatMap(([location, value]) => {
126 - const marker = "node_modules/@earendil-works/";
127 - const index = location.lastIndexOf(marker);
128 - if (index === -1 || !value || typeof value !== "object") return [];
129 - const name = location.slice(index + "node_modules/".length);
130 - return typeof value.version === "string"
131 - ? [{ name, version: value.version }]
132 - : [];
133 - })
134 - .sort((a, b) => a.name.localeCompare(b.name));
124 + const found = new Map();
125 + for (const [location, value] of Object.entries(packages)) {
126 + const match = /(?:^|\/)node_modules\/(@earendil-works\/pi-[^/]+)$/.exec(
127 + location,
128 + );
129 + if (!match || !value || typeof value !== "object") continue;
130 + if (typeof value.version !== "string") continue;
131 + const item = { name: match[1], version: value.version };
132 + found.set(`${item.name}@${item.version}`, item);
134 + return [...found.values()].sort(
135 + (a, b) =>
136 + a.name.localeCompare(b.name) || compareVersions(a.version, b.version),
137 + );
137 140 export function parseGitFiles(raw) {

.pi/skills/modernize/scripts/audit.test.mjs

Modified
79 79 collectPackageVersions({
80 80 packages: {
81 81 "node_modules/@earendil-works/pi-ai": { version: "0.80.4" },
82 + "extensions/x/node_modules/@earendil-works/pi-ai": {
83 + version: "0.80.4",
84 + },
82 85 "node_modules/@earendil-works/pi-coding-agent": {
83 86 version: "0.80.6",
88 + "node_modules/@earendil-works/pi-coding-agent/node_modules/partial-json":
89 + {
90 + version: "0.1.7",
91 + },
85 92 "node_modules/vitest": { version: "4.1.9" },