run-a-project.ts
This file
Path
packages/agent-kit/src/docs/run-a-project.ts
91 lines · 6.2 KiB · TypeScript
Last changed by
Merge redesign into mainoscabrielbefore adoptioncaedd21
History of this fileTake it
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192import { Brand } from "@repo/brand";import { sourceHosts } from "@repo/protocol/ids";
import { code } from "../text.ts";import type { DocSource } from "./page.ts";import { cli, shell } from "./page.ts";
const dir = Brand.configDir;
export const runAProject: DocSource = { body: () => [ "## Make a project", "", `In a repo of your own, ${cli("init --project <owner>/<name>")} makes it a project: it finds the repo's checks (its test and lint commands, and its CI), writes the config folder, ${code(`${dir}/`)}, and pushes. You are the project's first maintainer.`, "", "## How a project is named", "", `A project's name is its owner, then a short name: ${code("<owner>/<name>")}, as in ${code("oscabriel/datekit")}. The name is the project's address everywhere: ${code("--project")} takes it, the web shows the project at ${code("/<owner>/<name>")}, and git clones it from ${code("<platform>/<owner>/<name>.git")}. You make projects under your own handle; a bare word, as in ${cli("init --project datekit")}, is taken as yours, under the handle ${cli("login")} kept. Owning a namespace is the right to make projects in it and nothing more: who decides stays with the config folder.`, "", "## Import a repo", "", `To bring a public repo over HTTPS: ${cli("init --import <url>")}, with ${code("--branch")} when its default branch is not the one you want. A repo from ${sourceHosts.map((host) => code(host)).join(", ")} is named after its source namespace, ${code("<host>/<account>/<name>")}, so ${code("https://github.com/pallets/click")} becomes ${code("github.com/pallets/click")}; a repo from any other host is named under your handle, after the URL's last segment. ${code("--project")} names it otherwise, a bare word again under your handle. On the web, [Import a repo](/import) does the same, and the web address of such a name nobody has imported yet, such as ${code("/github.com/pallets/click")}, offers the import. You are an import's first maintainer, as of any project.`, "", "## The config folder", "", `How the project takes changes is TypeScript on \`main\`, in ${code(`${dir}/`)}. The platform reads it only from the commit it last landed, in a sandbox with no network and frozen time, so it changes the way everything else does: by a landing.`, "", `- ${code(`${dir}/project.ts`)}: who decides which paths, the kinds of ask the project takes, the daily budget of decisions, caps on claims and proposals, the commands the checks run, and who must be vouched for to claim.`, `- ${code(`${dir}/asks/`)}: one file per ask.`, `- ${code(`${dir}/vouched.td`)}: who is vouched for, and who is denounced.`, `- ${code(`${dir}/visibility.ts`)}: layers and held-back checks, if any (see [Held-back checks and layers](/docs/held-back-checks)).`, "", "```ts", `import { kinds, project } from "${Brand.cliPackage}/rules";`, "", "export default project({", ' budget: { decisionsPerDay: 5, expire: "14 days" },', " caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },", ' deciders: { "**": ["ines-v"], "src/tz.ts": ["okonkwo"] },', " kinds: [kinds.fix],", ' run: { checks: { unit: "bun test" }, test: "bun test {path}" },', ' vouch: "forCode",', "});", "```", "", `The project's Policy page shows what the folder evaluated to at the landed commit, and ${cli("policy --project <owner>/<name>")} prints the same.`, "", "## Open an ask", "", `An ask is a file in ${code(`${dir}/asks/`)} with its check beside it: the want, the territory, what is out of scope, and a test that fails on \`main\` today. Some kinds also name a mentor, or hold the ask for newcomers.`, "", "```ts", `import { kinds, territory } from "${Brand.cliPackage}/rules";`, "", "export default kinds.fix.ask({", ' want: "The Do token of format prints the day of the month as an English ordinal.",', ' path: "test/asks/format-ordinal.test.ts",', ' territory: territory.paths("src/format.ts", "test/format.test.ts"),', ' reserve: "newcomers",', "});", "```", "", `${cli("ask open <ask> --project <owner>/<name>")} lands the ask, but only once its check fails on \`main\` twice the same way, by an assertion: a check that cannot fail, or fails by not loading, opens nothing. ${cli("schema ask open")} prints what it takes.`, "", "## Proposals and drafts", "", `Anyone not denounced may propose an ask: ${cli('propose --project <owner>/<name> --want "<what should be true>"')}. A proposal expires unless a maintainer accepts it. With ${code("--draft")}, the platform's agent drafts the ask file and its failing check, runs them red first, and puts the draft to a maintainer with its evidence; ${cli("proposal <proposal> --project <owner>/<name>")} follows it, and ${cli("ask draft <proposal> --project <owner>/<name>")} asks for another round. Nothing lands until a maintainer accepts, and the landing discloses the agent in \`Assisted-by\`.`, "", "## Today", "", `A maintainer's day is a short list of decisions, each with its evidence and a safe default taken if nobody decides before it expires, held to the project's budget. Read it on the web in [your inbox](/inbox), or with ${cli("today")}, and take one with ${cli("decide --project <owner>/<name> --decision <decision> --choice accept")} (or \`decline\`, \`adopt\`, \`revert\`).`, "", "## Finish an answer, or land your own change", "", `When an ask's kind requires a finish, a passing answer waits for a maintainer's own commits on top: ${cli("finish <ask> --project <owner>/<name> --base <base> --head <head>")}. They are checked again, and the landing credits you with \`Finished-by\`.`, "", `A maintainer's own change goes through the same gate. Make your working fork, push to it, and land it:`, "", ...shell( `${Brand.cli} fork --project <owner>/<name>`, `git push <fork remote> HEAD:main`, `${Brand.cli} land --project <owner>/<name> --base <base> --head <head>` ), "", "## Vouch", "", `${cli("vouch --project <owner>/<name> --handle <handle> --verdict vouch")} admits a person to claim, by landing a line in the vouch file; \`--verdict denounce\` bars them from proposing.`, "", ], slug: "run-a-project",};