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.

The plan says what g1t is for without measuring it against other products1import assert from "node:assert/strict";
2import { test } from "node:test";
3
4import { workOwner } from "../../../../packages/contracts/src/work.ts";
5import { madeByG1t, openedBy } from "./opened-by.ts";
6
7const syntaqx = { id: "usr_1", username: "syntaqx" };
8const g1t = { id: "usr_g1t_agent", username: "g1t", kind: "agent" as const };
9
10test("a pull request g1t made shows g1t, requested by whoever asked", () => {
11 const pull = { agent: "g1t", branch: null, author: g1t, requestedBy: syntaqx };
12 assert.equal(madeByG1t(pull), true);
13 assert.deepEqual(openedBy(pull), { name: "g1t", requestedBy: "syntaqx" });
14 // It is theirs to manage, as their own would be.
15 assert.equal(workOwner(pull).id, "usr_1");
16});
17
18test("anything else shows its author", () => {
19 // Someone's own agent.
20 assert.deepEqual(openedBy({ author: syntaqx, requestedBy: null }), { name: "syntaqx", requestedBy: null });
21 // A branch pushed to the repository, even with g1t named on it.
22 assert.equal(madeByG1t({ agent: "g1t", branch: "fix-login" }), false);
23 assert.equal(workOwner({ author: syntaqx, requestedBy: null }).id, "usr_1");
24});
25
26test("work g1t started itself names nobody as asking", () => {
27 const pull = { author: { id: "g1t", username: "g1t", kind: "system" as const }, requestedBy: null };
28 assert.deepEqual(openedBy(pull), { name: "g1t", requestedBy: null });
29 assert.equal(workOwner(pull).username, "g1t");
30});

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