mattrguerra/meridian-ops-boardmainPrivate on GitHub, published here in full

lib.ts

Language TypeScript804 B19 lines

scripts/lib.ts

  1. import { readFile } from 'node:fs/promises'
  2. import type { RosterEntry } from '@meridian/ninety-client'
  3. /**
  4. * Pinned roster entries from `roster.json` at the repo root, or undefined when
  5. * there is no usable file. Pinning keeps someone with an empty plate on the
  6. * board: GET /todos/company only returns people who have open work, and absent
  7. * reads as untracked, not as idle. Entries still holding a `REPLACE` id are
  8. * template lines and are dropped.
  9. */
  10. export async function loadRoster(): Promise<RosterEntry[] | undefined> {
  11. try {
  12. const raw = JSON.parse(await readFile(new URL('../roster.json', import.meta.url), 'utf8'))
  13. const entries = (raw.entries ?? raw) as RosterEntry[]
  14. return entries.filter((e) => e.id && !e.id.startsWith('REPLACE'))
  15. } catch {
  16. return undefined
  17. }
  18. }