Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

12 linesCodeBlameRaw
1import type { Setting } from "@g1t/contracts";
2
3/** Project keys suppress workspace values per kind and reader, even when
4 * none of the project's rows applies to the requested environment. */
5export function settingOverride(row: Setting, rows: Setting[]): string | null {
6 const others = rows.filter((other) => other.scope !== row.scope && other.name === row.name && other.kind === row.kind);
7 const readers = row.availableTo.filter((reader) => others.some((other) => other.availableTo.includes(reader)));
8 if (readers.length === 0) return null;
9 const labels = readers.map((reader) => reader === "workflows" ? "Workflows" : reader === "deployments" ? "Deployments" : reader).join(", ");
10 if (row.scope === "project") return `Overrides workspace: ${labels}`;
11 return readers.length === row.availableTo.length ? "Overridden by project" : `Partially overridden: ${labels}`;
12}