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.
| Merge branch 'ask-g1t' | 1 | import assert from "node:assert/strict"; |
| 2 | import { test } from "node:test"; | |
| 3 | ||
| g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other. | 4 | import { askPage, askWhere, foldAnswer, proposalTitle } from "./ask.ts"; |
| Merge branch 'ask-g1t' | 5 | |
| 6 | test("the page says which repository, issue or pull request the person is on", () => { | |
| 7 | assert.deepEqual(askPage("/Acme/web/issues/12"), { path: "/Acme/web/issues/12", repo: { namespace: "acme", name: "web" }, issue: 12 }); | |
| 8 | assert.deepEqual(askPage("/acme/web/pull/3/files"), { path: "/acme/web/pull/3/files", repo: { namespace: "acme", name: "web" }, pull: 3 }); | |
| 9 | assert.deepEqual(askPage("/acme/web/tree/main"), { path: "/acme/web/tree/main", repo: { namespace: "acme", name: "web" } }); | |
| 10 | assert.deepEqual(askPage("/acme/web/issues"), { path: "/acme/web/issues", repo: { namespace: "acme", name: "web" } }); | |
| 11 | // A workspace's own pages, and g1t's, name no repository. | |
| 12 | assert.deepEqual(askPage("/acme/-/chat/general"), { path: "/acme/-/chat/general" }); | |
| 13 | assert.deepEqual(askPage("/settings/profile"), { path: "/settings/profile" }); | |
| 14 | assert.deepEqual(askPage("/acme"), { path: "/acme" }); | |
| 15 | assert.deepEqual(askPage(""), { path: "/" }); | |
| 16 | }); | |
| 17 | ||
| g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other. | 18 | test("the composer says where the question is asked from", () => { |
| 19 | assert.equal(askWhere(askPage("/acme/web/issues/12")), "On issue #12"); | |
| 20 | assert.equal(askWhere(askPage("/acme/web/pull/3")), "On pull request #3"); | |
| 21 | assert.equal(askWhere(askPage("/acme/web")), "In web"); | |
| 22 | assert.equal(askWhere(askPage("/acme/-/chat")), null); | |
| 23 | }); | |
| Merge branch 'ask-g1t' | 24 | |
| g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other. | 25 | test("an answer's kept lines fold into its steps, each as it last was, and its sources", () => { |
| 26 | const started = { | |
| 27 | type: "tool" as const, | |
| 28 | id: "step_0_0", | |
| 29 | name: "workspace", | |
| 30 | action: "activity", | |
| 31 | label: "Read activity in acme since 2026-10-12", | |
| 32 | status: "running" as const, | |
| 33 | summary: null, | |
| 34 | link: "https://g1t.sh/acme", | |
| 35 | }; | |
| 36 | const folded = foldAnswer([ | |
| 37 | started, | |
| 38 | { ...started, id: "step_0_1", name: "repository", action: "list", label: "Listed repositories" }, | |
| 39 | { ...started, status: "done", summary: "12 results" }, | |
| 40 | { type: "text", text: "ignored" }, | |
| 41 | null, | |
| 42 | { type: "sources", sources: [{ title: "#7 Fix login", url: "https://g1t.sh/acme/web/pull/7", cited: true }, { url: 3 }] }, | |
| 43 | ]); | |
| Merge branch 'ask-g1t' | 44 | assert.deepEqual( |
| g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other. | 45 | folded.steps.map((step) => [step.id, step.status, step.summary]), |
| 46 | [ | |
| 47 | ["step_0_0", "done", "12 results"], | |
| 48 | ["step_0_1", "running", null], | |
| 49 | ], | |
| Merge branch 'ask-g1t' | 50 | ); |
| g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other. | 51 | assert.equal(folded.sources.length, 1); |
| 52 | assert.equal(folded.sources[0]!.url, "https://g1t.sh/acme/web/pull/7"); | |
| 53 | assert.deepEqual(foldAnswer("junk"), { steps: [], sources: [], proposals: [] }); | |
| Merge branch 'ask-g1t' | 54 | }); |
| 55 | ||
| g1t coordinates the work and the person's own sessions do it: Ask g1t reads g1t with the same tools any agent gets, answers in one conversation shared with the @g1t direct message in Chat, and hands work to sessions in the person's own harness, whose subagents g1t records, ties to issues and pull requests, and lets see each other. | 56 | test("a proposed session is kept once and says what it will do", () => { |
| 57 | const proposal = { type: "proposal" as const, id: "proposal_0_0", repo: "acme/web", issue: 12, title: null, body: null, mode: "implement" as const, instruction: null }; | |
| 58 | const folded = foldAnswer([proposal, proposal, { ...proposal, id: "proposal_0_1", issue: null, title: "Add a route", mode: "plan" }, { type: "proposal", id: "x", repo: "acme/web" }]); | |
| 59 | assert.deepEqual(folded.proposals.map(proposalTitle), ["Implement #12 in acme/web", "Plan “Add a route” in acme/web"]); | |
| Merge branch 'ask-g1t' | 60 | }); |
This file's history is long; its oldest lines are credited to the oldest commit read.