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.

g1t.sh
30 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import type { User } from "@g1t/contracts";
5
6import { can, needs, permission } from "../../../packages/contracts/src/access.ts";
7import { NEEDS, repoRef } from "./access.ts";
8
9const row = (isPrivate: boolean) => ({ repo_id: "repo_api", repo_namespace: "acme", repo_private: isPrivate ? 1 : 0 });
10const person = (extra: Partial<User>): User => ({ id: "u", username: "u", kind: "user", verified: true, workspaces: [], ...extra }) as User;
11
12test("a private project is seen by those who can read its repository", () => {
13 const none = person({ workspaces: [{ slug: "acme", role: "member", base_permission: "none" }] });
14 assert.equal(permission(none, repoRef(row(true))), null, "a member with no base permission does not see it");
15 assert.ok(permission(none, repoRef(row(false))), "but sees a public one");
16 const granted = person({ workspaces: [{ slug: "acme", role: "member", base_permission: "none" }], grants: [{ repo_id: "repo_api", workspace: "acme", role: "read" }] });
17 assert.equal(permission(granted, repoRef(row(true))), "read");
18 const outside = person({ grants: [{ repo_id: "repo_api", workspace: "acme", role: "read" }] });
19 assert.equal(permission(outside, repoRef(row(true))), "read", "an outside collaborator sees the project of a repository shared with them");
20});
21
Projects no longer depend on each other: the dependsOn relation, its settings page (old links redirect), the overview card, a pull request's Affects panel and preview stacks, reference variables and agents' notes on what a project uses are gone; the table is dropped in a later deploy22test("changing a project takes Maintain", () => {
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas23 const member = person({ workspaces: [{ slug: "acme", role: "member" }] });
Projects no longer depend on each other: the dependsOn relation, its settings page (old links redirect), the overview card, a pull request's Affects panel and preview stacks, reference variables and agents' notes on what a project uses are gone; the table is dropped in a later deploy24 assert.ok(!can(member, repoRef(row(true)), NEEDS.update), "Write, the default base permission, is not enough");
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas25 assert.equal(needs(NEEDS.update), "Needs the Maintain role or higher.");
26 const maintainer = person({ grants: [{ repo_id: "repo_api", workspace: "acme", role: "maintain" }] });
Projects no longer depend on each other: the dependsOn relation, its settings page (old links redirect), the overview card, a pull request's Affects panel and preview stacks, reference variables and agents' notes on what a project uses are gone; the table is dropped in a later deploy27 for (const capability of [NEEDS.update, NEEDS.create]) assert.ok(can(maintainer, repoRef(row(true)), capability));
status.g1t.sh with incident management, invites that land you in the workspace, settings as pages, usage without quotas28 const owner = person({ workspaces: [{ slug: "acme", role: "owner" }] });
29 assert.ok(can(owner, repoRef(row(true)), NEEDS.create));
30});

This file's history is long; its oldest lines are credited to the oldest commit read.