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
29 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.

Git storage hardened, pages in tens of milliseconds, honest security alerts, and costs reconciled daily1/**
2 * How the site speaks of a workspace's trial credit. Pure, so it can be
3 * tested.
4 */
5
6import type { Trial } from "@g1t/contracts";
7
8/** "November 1", in UTC, when new trials start again. */
9export function resumesOn(at: string): string {
10 return new Date(at).toLocaleDateString("en-US", { month: "long", day: "numeric", timeZone: "UTC" });
11}
12
13/**
14 * Why the trial cannot pay for anything now, in a sentence, or null when it
15 * can: no card check yet (`verify`), used, or this month's pool given out.
16 */
17export function trialClosed(trial: Trial | null | undefined, workspace: string): string | null {
18 if (!trial || trial.open) return null;
19 // `verify` is newer than the contract's list of reasons: the trial waits for a card check.
20 if ((trial.reason as string | null) === "verify")
21 return `${workspace} needs a card check before its trial starts. The card is never charged.`;
22 if (trial.reason === "used") return `${workspace} has used its trial credit on g1t.`;
23 if (trial.reason === "pool")
24 return trial.waitsUntil
25 ? `This month's free trials are all given out; new ones start on ${resumesOn(trial.waitsUntil)}.`
26 : "This month's free trials are all given out; new ones start next month.";
27 if (trial.reason === "ended") return "The free allowance on g1t's models has ended.";
28 return null;
29}

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