Skip to content
42 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.

Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar1/**
Pricing says it plainly: models at the provider's price, the agent rate for what g1t runs around every model call (the gateway, secrets, routing, context and pass-through to your own provider, so your own keys too), everything else at cost plus 20%, your own runners free, no seats; Security and quality comes with the plan with no separate fee, and live activations end. Each agent has an effort setting, Auto to Max, with what a typical task has cost at each level, and Spend's Spend less, keep quality suggests a lower level only when the agent's own past work shows quality held, to apply or dismiss. The pricing, spend and agents guides say how.2 * What the security pages ask the services for beyond one call: the g1t
3 * plan's price (always billing's), which Security and quality comes with, and
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar4 * "Set up code scanning", which commits the starter workflow on a new
5 * branch as the person asking and opens it as their pull request, as
6 * "Add CI" does.
7 */
8import { type RepoPath, STARTER_WORKFLOW_PATH, type User, type Viewer } from "@g1t/contracts";
9
10import { billing, repos, work } from "./services.server";
11import { codeScanningBranch, codeScanningPullBody, codeScanningWorkflow } from "./security-suite";
12
Pricing says it plainly: models at the provider's price, the agent rate for what g1t runs around every model call (the gateway, secrets, routing, context and pass-through to your own provider, so your own keys too), everything else at cost plus 20%, your own runners free, no seats; Security and quality comes with the plan with no separate fee, and live activations end. Each agent has an effort setting, Auto to Max, with what a typical task has cost at each level, and Spend's Spend less, keep quality suggests a lower level only when the agent's own past work shows quality held, to apply or dismiss. The pricing, spend and agents guides say how.13/** The g1t plan's monthly price, in cents, or null: Security and quality comes with it. */
14export async function planPrice(workspace: string, viewer: Viewer): Promise<number | null> {
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar15 const states = await billing.features(workspace, viewer).catch(() => null);
16 if (!states?.ok) return null;
Pricing says it plainly: models at the provider's price, the agent rate for what g1t runs around every model call (the gateway, secrets, routing, context and pass-through to your own provider, so your own keys too), everything else at cost plus 20%, your own runners free, no seats; Security and quality comes with the plan with no separate fee, and live activations end. Each agent has an effort setting, Auto to Max, with what a typical task has cost at each level, and Spend's Spend less, keep quality suggests a lower level only when the agent's own past work shows quality held, to apply or dismiss. The pricing, spend and agents guides say how.17 return states.value.find((state) => state.plan.feature === "plan")?.plan.monthlyCents ?? null;
Teams and CODEOWNERS, labels and milestones, dependency updates, the security suite, and a clearer top bar18}
19
20export async function setupCodeScanning(user: User, path: RepoPath): Promise<{ ok: true; number: number } | { ok: false; message: string }> {
21 const repo = await repos.get(path, user);
22 if (!repo.ok) return { ok: false, message: repo.error.message };
23 const defaultBranch = repo.value.defaultBranch;
24 const branches = await repos.branches(path, user);
25 const branch = codeScanningBranch(branches.ok ? branches.value.map((known) => known.name) : []);
26 const committed = await repos.commitFile(path, user, {
27 branch,
28 path: STARTER_WORKFLOW_PATH,
29 content: codeScanningWorkflow(defaultBranch),
30 message: "Add code scanning",
31 });
32 if (!committed.ok) return { ok: false, message: committed.error.message };
33 const opened = await work.openPull(user, path, {
34 branch,
35 title: "Add code scanning",
36 body: codeScanningPullBody(defaultBranch),
37 agent: user.username,
38 runtime: "external",
39 });
40 if (!opened.ok) return { ok: false, message: opened.error.message };
41 return { ok: true, number: opened.value.number };
42}