Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

scripts/build/settings-entries.ts

Raw
// Print the explicit Pi package list for ~/.pi/agent/settings.json: one
// generated package per extension, pfui and footer first so they own prompt
// sections and footer slots before the rest register.
import { join } from "node:path";
import { allExtensionNames, DIST_ROOT } from "./build.ts";

const FIRST = ["pfui", "footer"];

export function settingsEntries(
	names = allExtensionNames(),
	distRoot = DIST_ROOT,
): string[] {
	const ordered = [
		...FIRST.filter((name) => names.includes(name)),
		...names.filter((name) => !FIRST.includes(name)),
	];
	return ordered.map((name) => join(distRoot, name));
}

console.log(JSON.stringify(settingsEntries(), null, "\t"));