import type { APIRoute } from "astro"; import { readFile } from "node:fs/promises"; import { join } from "node:path"; const ROOT = process.env.REPO_ROOT!; export const GET: APIRoute = async () => { try { const raw = await readFile( join(ROOT, "palaces/manglasabang/secretariat/tasks-synced-from-linear-to-git/tasks-index.json"), "utf-8" ); const data = JSON.parse(raw); const issues = (data.tasks || []).map((t: any) => ({ identifier: t.identifier, title: t.title, url: t.url, bucket: t.bucket, })); return new Response(JSON.stringify(issues), { headers: { "Content-Type": "application/json" }, }); } catch (err: any) { return new Response(JSON.stringify({ error: err.message }), { status: 500, headers: { "Content-Type": "application/json" }, }); } };