Skip to content
Myr

Merge docs/onboarding into main, keeping the Install page without the npm snippet the other branch dropped and naming the install script in the AGENTS.md block

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oscabriel · committed by oscabriel · parents db02276, 41e1e04 · Browse files · 22 files+338 added−89 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

22 files+338 added−89 removed

  • tests:+139 added−21 removed
  • other:+199 added−68 removed

22 files+338 added−89 removed

modified:apps/cli/src/local/login.ts+1 added-1 removed
242 unmodified lines
243 return yield* originOf(current.value.url);244 }245246 return yield* new LoginUsage({247 reason: `no platform to log in to for profile ${name}: run ${Brand.cli} login --url https://<platform host>${Option.isSome(profile) ? ` --profile ${name}` : ""}`,247 reason: `no platform to log in to for profile ${name}: run ${Brand.cli} login --url https://git.${Brand.domain}${Option.isSome(profile) ? ` --profile ${name}` : ""}`,248 });249 });250251const tokenFromStdin = Effect.gen(function* () {
393 unmodified lines
modified:apps/cli/test/local/login.test.ts+4 added-2 removed
462 unmodified lines
463 30_000464 );465466 it.live(467 "with no --url and no stored profile, asks for --url",467 "with no --url and no stored profile, asks for --url, naming the platform's own host",468 () =>469 Effect.gen(function* () {470 const env = yield* home;471 const platform = yield* seams(signedInAs("alice"));
4 unmodified lines
476 stdin: `${given}\n`,477 });478479 expect(Exit.isFailure(exit)).toBeTruthy();480 expect((yield* printed).stderr.join("\n")).toContain("--url");480 expect((yield* printed).stderr.join("\n")).toContain(481 `${Brand.cli} login --url https://git.${Brand.domain}`482 );483 }).pipe(Effect.scoped, Effect.provide(testServices)),484 30_000485 );486});
286 unmodified lines
modified:apps/cli/test/commands-doc.test.ts+27 added-1 removed
15 unmodified lines
16const Takes = Schema.Struct({17 args: Schema.Array(18 Schema.Struct({ name: Schema.String, required: Schema.Boolean })19 ),20 description: Schema.String,21 flags: Schema.Array(22 Schema.Struct({23 name: Schema.String,24 required: Schema.Boolean,
10 unmodified lines
3536const takesOf = (doc: HelpDoc.HelpDoc) =>37 encodeTakes({38 args: (doc.args ?? []).map(({ name, required }) => ({ name, required })),39 description: doc.description,40 flags: doc.flags.map(({ name, required, type }) => ({41 name,42 required,43 type,
132 unmodified lines
176 const commands = yield* runnable;177178 const differ = rows.flatMap((row) => {179 const { takes } = commands.get(words(row)) ?? {178 takes: { args: [], flags: [] },180 takes: { args: [], description: "", flags: [] },181 };182183 const flags = [...declared(row, takes)].toSorted();184 const real = takes.flags.map(({ name }) => name).toSorted();
13 unmodified lines
198 30_000199 );200201 it.effect(202 "say what each command does in the CLI's own words: a local command's exactly, a contract's as its help begins",203 () =>204 Effect.gen(function* () {205 const commands = yield* runnable;206207 const differ = rows.flatMap((row) => {208 const said = commands.get(words(row))?.takes.description ?? "";209210 const same =211 row.source === "local"212 ? said === row.summary213 : said.startsWith(row.summary);214215 return same216 ? []217 : [{ command: words(row), said, summary: row.summary }];218 });219220 expect(differ).toStrictEqual([]);221 }),222 30_000223 );224225 it.effect(226 "require a contract's required fields as flags, all but the --project the repo fills",227 () =>228 Effect.gen(function* () {229 const commands = yield* runnable;
32 unmodified lines
modified:packages/agent-kit/src/docs/answer-an-ask.ts+13 added-3 removed
modified:packages/agent-kit/src/docs/connect-an-agent.ts+1 added-1 removed
modified:packages/agent-kit/src/docs/run-a-project.ts+32 added-6 removed
43 unmodified lines
44 "```",45 "",46 `The project's Policy page shows what the folder evaluated to at the landed commit, and ${cli("policy --project <owner>/<name>")} prints the same.`,47 "",48 "### The run block",49 "",50 `The project's own commands, under ${code("run")}. The platform runs them exactly as written, on the tree an answer makes once merged onto \`main\`, in the checker's image; ${cli("check")} runs them on your machine.`,51 "",52 `- ${code("setup")}: run once, before the network closes, to install what the checks need, as ${code("bun install")} does.`,53 `- ${code("setupEgress")}: hosts setup may reach beyond the defaults; setup only, never the checks, which reach no network.`,54 `- ${code("doctor")}: a command that says whether a machine can run the checks; it judges nothing.`,55 `- ${code("test")}: the one command that runs a single check file, with ${code("{path}")} standing for the file, as in ${code("bun test {path}")}. The red-first check that opens an ask runs it, and so does each ask's check on every answer.`,56 `- ${code("checks")}: the lanes, by name, each a command every answer must keep green, as in ${code('{ unit: "bun test" }')}.`,57 `- ${code("image")}: the image the checks run in; ${code("checker:default")} when absent.`,58 "",59 `An open ask's check fails on \`main\` until the ask is answered: that is what opening it proves. A lane that runs the whole suite would then fail on every answer to every other ask, so keep the asks' checks out of the lanes, as datekit does with ${code("bun test --path-ignore-patterns='test/asks/**'")}. ${cli("init")} writes the unit lane that way.`,60 "",61 "### What init leaves to the defaults",62 "",63 `${cli("init")} writes the run block it found and ${code('vouch: "bansOnly"')}, and leaves every other key out, so each takes its default:`,64 "",65 `- ${code("deciders")}: with none named, the project's owners decide every path, as ${code('{ "**": "owners" }')} would say.`,66 `- ${code("kinds")}: ${code("[kinds.fix]")}, one kind of ask: a check that fails on \`main\` and passes with the answer.`,67 `- ${code("vouch")}: with ${code('"bansOnly"')}, nobody needs a vouch, but a denounced person still may not claim, push or propose. Left out, it is ${code('"forCode"')}: only people vouched for may claim or offer a sealed answer. ${code('"all"')} gates proposals too.`,68 `- ${code("budget")}, ${code("caps")} and ${code("claims")}: 5 decisions a day, each taking its default after 14 days; 3 claims and 2 proposals per person; a claim warned after 2 hours without a push, and lapsed after 24.`,69 "",70 "## Open an ask",71 "",50 `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.`,72 `An ask is a file and a check: the want, the territory, what is out of scope, and a test that fails on \`main\` today. The file is ${code(`${dir}/asks/<ask>.ask.ts`)}, and its stem is the ask's id: ${code(`${dir}/asks/format-ordinal.ask.ts`)} opens the ask ${code("format-ordinal")}. The check lives at the ${code("path")} the ask names; keep every ask's check at ${code("test/asks/<ask>.test.ts")}, so one pattern keeps them all out of the lanes. Some kinds also name a mentor, or hold the ask for newcomers.`,73 "",74 "```ts",75 `import { kinds, territory } from "${Brand.cliPackage}/rules";`,76 "",
4 unmodified lines
81 ' reserve: "newcomers",',82 "});",83 "```",84 "",63 `${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.`,85 `Write both in your clone, then run ${cli("ask open <ask> --project <owner>/<name>")}. It reads the ask file and the check at its ${code("path")} from your working tree, and 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. ${code("--files")} sends other files in their place, as JSON, ${code('[{"path": "…", "content": "…"}]')}; ${cli("schema ask open")} prints what it takes.`,86 "",87 "## Proposals and drafts",88 "",89 `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\`.`,
3 unmodified lines
93 `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\`).`,94 "",95 "## Finish an answer, or land your own change",96 "",75 `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\`.`,97 `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> --requestId <id>")}. They are checked again, and the landing credits you with \`Finished-by\`.`,98 "",77 `A maintainer's own change goes through the same gate. Make your working fork, push to it, and land it:`,99 `A maintainer's own change goes through the same gate. ${cli("fork --project <owner>/<name>")} makes your working fork, or returns the one you have, and prints its name and its git remote. Add the remote, push your change to it, and land it:`,100 "",101 ...shell(102 `${Brand.cli} fork --project <owner>/<name>`,81 `git push <fork remote> HEAD:main`,82 `${Brand.cli} land --project <owner>/<name> --base <base> --head <head>`103 `git remote add fork <remote>`,104 `git push fork HEAD:main`,105 `git fetch ${Brand.slug}`,106 `${Brand.cli} land --project <owner>/<name> --base $(git rev-parse ${Brand.slug}/main) --head $(git rev-parse HEAD) --message "<what it does>" --requestId <id>`107 ),108 "",109 `${code("--base")} is \`main\` as the platform last landed it: ${code(`git rev-parse ${Brand.slug}/main`)} after ${code(`git fetch ${Brand.slug}`)}, where ${code(Brand.slug)} is the remote ${cli("init")} added for the project. ${code("--head")} is the commit you pushed to the fork. ${code("--requestId")} is any 8 to 64 letters, digits, \`-\` or \`_\` you choose: sending the same one again returns the same receipt, and checks nothing twice. ${cli("finish")} takes the same three. If \`main\` moves past your base before the change lands, the platform merges it onto the new \`main\` itself, and refuses with \`StaleBase\` only when that merge conflicts.`,110 "",111 "## Vouch",112 "",113 `${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.`,114 "",
3 unmodified lines
modified:packages/agent-kit/src/agents-block.ts+2 added
45 unmodified lines
46 `## Contributing to ${project}`,47 "",48 `This project takes changes through ${Brand.name}: an answer to one of its asks lands only by passing the gate. This block is generated from the config folder, and the gate decides what lands. The full guide is the ${code(contributeSkillName(project))} skill (${code(agentsPath)}).`,49 "",50 `It needs the ${Brand.name} CLI (the install script on the platform's ${code("/install")} page) signed in with ${code(`${Brand.cli} login --url <platform>`)}, and runs in a clone of the project, ${code(`git clone <platform>/${project}.git`)}, where ${code("<platform>")} is the host this project lives on: in such a clone, ${code("git remote get-url origin")} names it.`,51 "",52 ...loopSteps(),53 "",54 ...rules(policy),55 "",
59 unmodified lines
modified:packages/agent-kit/src/command-doc.ts+5 added-4 removed
2 unmodified lines
3 Description,4 NeedsApproval,5 ReadOnly,6 Surfaces,7 TodayOf,8} from "@repo/protocol/contracts";9import type { Contracts } from "@repo/protocol/contracts";10import { Array as Arr, Context, Order, Schema, SchemaAST } from "effect";11
33 unmodified lines
45 path: ["logout"],46 positional: [],47 readOnly: false,48 source: "local",48 summary: "Forget a platform's stored token.",49 summary:50 "Forget a profile's token, and stop git asking for a platform no profile is on.",51 },52 {53 contract: "initProject",54 flags: [
89 unmodified lines
144 path: ["schema"],145 positional: ["command"],146 readOnly: true,147 source: "local",146 summary: "Print the JSON Schema of a command's payload.",148 summary: "Print the JSON Schema of the payload a command sends.",149 },150 {151 contract: "today",152 flags: ["--project", "--tui", "--json"],
1 unmodified line
154 path: ["today"],155 positional: [],156 readOnly: true,157 source: "local",156 summary:157 "Show your Today: the decisions to take, each with its evidence and a safe default; --tui opens it full-screen at a terminal.",158 summary: `${Context.get(TodayOf.annotations, Description)} It only reads, unless --tui opens it full-screen to take decisions at a terminal.`,159 },160];161162const standIns = new Set(
60 unmodified lines
modified:packages/agent-kit/src/hook-events.ts+23 added
1import { Brand } from "@repo/brand";2import { Schema } from "effect";34export const HookEvent = Schema.Literals([5 "session-start",
14 unmodified lines
20 "Write",21 "MultiEdit",22 "NotebookEdit",23] as const;2425const hookCommand = (event: HookEvent) => ({26 hooks: [{ command: `${Brand.cli} hook ${event} --json`, type: "command" }],27});2829/**30 * Claude Code's `hooks`, as its plugin's `hooks/hooks.json` and a31 * `settings.json` both hold them. Each hook fails open: hooks are early32 * feedback, and the gateway decides.33 */34export const claudeHooks = () => ({35 hooks: Object.fromEntries(36 HookEvent.literals.map((event) => [37 claudeEventOf[event],38 [39 event === "pre-tool-use"40 ? { ...hookCommand(event), matcher: guardedTools.join("|") }41 : hookCommand(event),42 ],43 ])44 ),45});
modified:packages/agent-kit/src/install-channels.ts+12 added-1 removed
9 unmodified lines
10 skills,11 stdioMcp,12} from "./agent-setup.ts";13import type { SetupInput, SetupSnippet } from "./agent-setup.ts";14import { claudeHooks } from "./hook-events.ts";15import { printJson } from "./text.ts";1617/** A page of the web (`page`), or a file it serves, such as `/llms.txt`. */18export interface InstallLink {19 readonly label: string;
23 unmodified lines
43 tabbed: false,44 ...fields,45});4647const hooks: SetupSnippet = {48 label:49 "Claude Code's hooks, in .claude/settings.json: the gate's scope guard before an edit, the claimed ask's brief at the start, and its verdict before you stop",50 language: "json",51 name: "Hooks",52 text: printJson(claudeHooks()).trimEnd(),53};5445/** The script's snippet, said for the machines it has a build for: the one way to install the CLI. */55/** The script's snippet, said for the machines it has a build for: the one way to install the CLI, then sign-in and the harness hooks. */56const cli = (input: SetupInput) =>57 channel({58 audience: "Terminal",59 id: "cli",
3 unmodified lines
63 ...installScript(input),64 label: "The script, for Linux on x64 and macOS on Apple silicon",65 },66 ...signIn(input),67 ...(hasCommand(input.commands, "hook") ? [hooks] : []),68 ],69 summary:70 "Find and claim asks, check an answer on your machine with the gate's first stage before you push, and read verdicts. You push with plain git.",71 title: "The CLI",
95 unmodified lines
modified:packages/agent-kit/src/platform.ts+2 added-19 removed
5 unmodified lines
67import type { CommandDoc } from "./command-doc.ts";8import { frontmatter } from "./generated-file.ts";9import type { GeneratedFile } from "./generated-file.ts";10import { claudeEventOf, guardedTools, HookEvent } from "./hook-events.ts";10import { claudeHooks } from "./hook-events.ts";11import { refusalSection } from "./refusals.ts";12import { loopSteps, unfencedSection } from "./sections.ts";13import { code, page, printJson, table } from "./text.ts";14
113 unmodified lines
128 ? servers[flavour].stdio129 : servers[flavour].remote(`${platformUrl}/mcp`),130});131132const hookCommand = (event: HookEvent) => ({133 hooks: [{ command: `${Brand.cli} hook ${event} --json`, type: "command" }],134});132const hooksJson = () => printJson(claudeHooks());133136// Each hook fails open: hooks are early feedback, and the gateway decides.137const hooksJson = () =>138 printJson({139 hooks: Object.fromEntries(140 HookEvent.literals.map((event) => [141 claudeEventOf[event],142 [143 event === "pre-tool-use"144 ? { ...hookCommand(event), matcher: guardedTools.join("|") }145 : hookCommand(event),146 ],147 ])148 ),149 });150134const pluginDescription = `The ${Brand.name} CLI's skill, MCP server and hooks: the gate's scope guard before an edit, the claimed ask's brief at the start, and its verdict before you stop.`;135136const homepage = (platformUrl: string | undefined) =>137 platformUrl === undefined ? {} : { homepage: platformUrl };
51 unmodified lines
modified:packages/agent-kit/src/sections.ts+2 added-2 removed
17 unmodified lines
18export const loopSteps = () => [19 `1. Read the ask, then claim it: ${cli("ask", "<ask>")}, then ${cli("claim", "<ask>")}. The claim prints your fork's remote; add it with ${code(`git remote add ${remote} <remote>`)}.`,20 "2. Work inside the ask's territory until its check passes.",21 `3. Run ${cli("check")}. It gives the refusals a push would get, then runs the ask's check and the project's lanes; fix everything it reports.`,22 `4. Push your answer to your fork: ${code(pushCommand)}. The push itself can be refused; follow the answer with ${cli("status")}.`,23 `5. Read the verdict on your head: ${code(`git fetch ${remote} ${notesRef}:${notesRef}`)}, then ${code(`git notes --ref=${Brand.slug} show HEAD`)}. It is JSON: match on its \`_tag\`, and run a refusal's \`next\`.`,22 `4. Push your answer to your fork: ${code(pushCommand)}. The push itself can be refused, on git's \`remote:\` lines.`,23 `5. Wait for the verdict: the rest of the checks run on the platform after git returns. Run ${cli("status", "--json")} until your answer's \`outcome._tag\` is no longer \`Checking\`, then read the verdict on your head: ${code(`git fetch ${remote} ${notesRef}:${notesRef}`)}, then ${code(`git notes --ref=${Brand.slug} show HEAD`)}. It is JSON: match on its \`_tag\`, and run a refusal's \`next\`.`,24];2526const unitsOfTime = [27 { ms: 86_400_000 * 7, one: "week" },
213 unmodified lines
modified:packages/agent-kit/test/golden/agent-plugins-stdio.txt+2 added-2 removed
22 unmodified lines
23241. Read the ask, then claim it: `__CLI__ ask <ask>`, then `__CLI__ claim <ask>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.252. Work inside the ask's territory until its check passes.263. Run `__CLI__ check`. It gives the refusals a push would get, then runs the ask's check and the project's lanes; fix everything it reports.274. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused; follow the answer with `__CLI__ status`.285. Read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.274. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused, on git's `remote:` lines.285. Wait for the verdict: the rest of the checks run on the platform after git returns. Run `__CLI__ status --json` until your answer's `outcome._tag` is no longer `Checking`, then read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.2930A project's own `<key>-contribute` skill (its key: the name with each `/` as `__`, as in `oscabriel__foo-contribute`, or for a project made before owners its old one-word key, as in `datekit-contribute`) and the block in its AGENTS.md give its territories, its run block and its ask kinds.3132## Output
65 unmodified lines
modified:packages/agent-kit/test/golden/agent-plugins.txt+2 added-2 removed
23 unmodified lines
24251. Read the ask, then claim it: `__CLI__ ask <ask>`, then `__CLI__ claim <ask>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.262. Work inside the ask's territory until its check passes.273. Run `__CLI__ check`. It gives the refusals a push would get, then runs the ask's check and the project's lanes; fix everything it reports.284. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused; follow the answer with `__CLI__ status`.295. Read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.284. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused, on git's `remote:` lines.295. Wait for the verdict: the rest of the checks run on the platform after git returns. Run `__CLI__ status --json` until your answer's `outcome._tag` is no longer `Checking`, then read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.3031A project's own `<key>-contribute` skill (its key: the name with each `/` as `__`, as in `oscabriel__foo-contribute`, or for a project made before owners its old one-word key, as in `datekit-contribute`) and the block in its AGENTS.md give its territories, its run block and its ask kinds.3233## Output
62 unmodified lines
modified:packages/agent-kit/test/golden/agents-block.txt+4 added-2 removed
2 unmodified lines
3## Contributing to oscabriel/datekit45This project takes changes through __NAME__: an answer to one of its asks lands only by passing the gate. This block is generated from the config folder, and the gate decides what lands. The full guide is the `datekit-contribute` skill (`.agents/skills/datekit-contribute/SKILL.md`).67It needs the __NAME__ CLI (the install script on the platform's `/install` page) signed in with `__CLI__ login --url <platform>`, and runs in a clone of the project, `git clone <platform>/oscabriel/datekit.git`, where `<platform>` is the host this project lives on: in such a clone, `git remote get-url origin` names it.891. Read the ask, then claim it: `__CLI__ ask <ask>`, then `__CLI__ claim <ask>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.102. Work inside the ask's territory until its check passes.113. Run `__CLI__ check`. It gives the refusals a push would get, then runs the ask's check and the project's lanes; fix everything it reports.104. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused; follow the answer with `__CLI__ status`.115. Read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.124. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused, on git's `remote:` lines.135. Wait for the verdict: the rest of the checks run on the platform after git returns. Run `__CLI__ status --json` until your answer's `outcome._tag` is no longer `Checking`, then read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.1415- Change only files in the ask's territory; a push that changes anything else is refused with `OutOfScope`.16- Never change the judge closure (`.__SLUG__/**`, `bunfig.toml`, `tsconfig.json`, `package.json#/scripts`); a push that does is refused with `TouchedJudge`.17- Never add a marker that turns a check off (`.skip(`, `.only(`, `@ts-ignore`); one without a reason is refused with `Weakened`.
8 unmodified lines
modified:packages/agent-kit/test/golden/claude-plugin-stdio.txt+2 added-2 removed
21 unmodified lines
22231. Read the ask, then claim it: `__CLI__ ask <ask>`, then `__CLI__ claim <ask>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.242. Work inside the ask's territory until its check passes.253. Run `__CLI__ check`. It gives the refusals a push would get, then runs the ask's check and the project's lanes; fix everything it reports.264. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused; follow the answer with `__CLI__ status`.275. Read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.264. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused, on git's `remote:` lines.275. Wait for the verdict: the rest of the checks run on the platform after git returns. Run `__CLI__ status --json` until your answer's `outcome._tag` is no longer `Checking`, then read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.2829A project's own `<key>-contribute` skill (its key: the name with each `/` as `__`, as in `oscabriel__foo-contribute`, or for a project made before owners its old one-word key, as in `datekit-contribute`) and the block in its AGENTS.md give its territories, its run block and its ask kinds.3031## Output
100 unmodified lines
modified:packages/agent-kit/test/golden/claude-plugin.txt+2 added-2 removed
22 unmodified lines
23241. Read the ask, then claim it: `__CLI__ ask <ask>`, then `__CLI__ claim <ask>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.252. Work inside the ask's territory until its check passes.263. Run `__CLI__ check`. It gives the refusals a push would get, then runs the ask's check and the project's lanes; fix everything it reports.274. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused; follow the answer with `__CLI__ status`.285. Read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.274. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused, on git's `remote:` lines.285. Wait for the verdict: the rest of the checks run on the platform after git returns. Run `__CLI__ status --json` until your answer's `outcome._tag` is no longer `Checking`, then read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.2930A project's own `<key>-contribute` skill (its key: the name with each `/` as `__`, as in `oscabriel__foo-contribute`, or for a project made before owners its old one-word key, as in `datekit-contribute`) and the block in its AGENTS.md give its territories, its run block and its ask kinds.3132## Output
98 unmodified lines
modified:packages/agent-kit/test/golden/platform-skill.txt+2 added-2 removed
15 unmodified lines
16171. Read the ask, then claim it: `__CLI__ ask <ask>`, then `__CLI__ claim <ask>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.182. Work inside the ask's territory until its check passes.193. Run `__CLI__ check`. It gives the refusals a push would get, then runs the ask's check and the project's lanes; fix everything it reports.204. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused; follow the answer with `__CLI__ status`.215. Read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.204. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused, on git's `remote:` lines.215. Wait for the verdict: the rest of the checks run on the platform after git returns. Run `__CLI__ status --json` until your answer's `outcome._tag` is no longer `Checking`, then read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.2223A project's own `<key>-contribute` skill (its key: the name with each `/` as `__`, as in `oscabriel__foo-contribute`, or for a project made before owners its old one-word key, as in `datekit-contribute`) and the block in its AGENTS.md give its territories, its run block and its ask kinds.2425## Output
51 unmodified lines
modified:packages/agent-kit/test/golden/project-skill.txt+4 added-4 removed
14 unmodified lines
15161. Read the ask, then claim it: `__CLI__ ask <ask>`, then `__CLI__ claim <ask>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.172. Work inside the ask's territory until its check passes.183. Run `__CLI__ check`. It gives the refusals a push would get, then runs the ask's check and the project's lanes; fix everything it reports.194. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused; follow the answer with `__CLI__ status`.205. Read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.194. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused, on git's `remote:` lines.205. Wait for the verdict: the rest of the checks run on the platform after git returns. Run `__CLI__ status --json` until your answer's `outcome._tag` is no longer `Checking`, then read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.2122A claim stays alive only while you push to it: after 2 hours without a push it is warned, and after 1 day it lapses. You may hold 3 claims at once in this project.2324List the open asks with `__CLI__ asks`. Add `--json` to any command for one JSON envelope instead of Markdown.
101 unmodified lines
1261271. Read the ask, then claim it: `__CLI__ ask <ask>`, then `__CLI__ claim <ask>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.1282. Work inside the ask's territory until its check passes.1293. Run `__CLI__ check`. It gives the refusals a push would get, then runs the ask's check and the project's lanes; fix everything it reports.1304. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused; follow the answer with `__CLI__ status`.1315. Read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.1304. Push your answer to your fork: `git push __SLUG__ HEAD:main`. The push itself can be refused, on git's `remote:` lines.1315. Wait for the verdict: the rest of the checks run on the platform after git returns. Run `__CLI__ status --json` until your answer's `outcome._tag` is no longer `Checking`, then read the verdict on your head: `git fetch __SLUG__ refs/notes/__SLUG__:refs/notes/__SLUG__`, then `git notes --ref=__SLUG__ show HEAD`. It is JSON: match on its `_tag`, and run a refusal's `next`.132133A claim stays alive only while you push to it: after 2 hours without a push it is warned, and after 1 day it lapses. You may hold 3 claims at once in this project.134135List the open asks with `__CLI__ asks`. Add `--json` to any command for one JSON envelope instead of Markdown.
86 unmodified lines
modified:packages/agent-kit/test/install-channels.test.ts+51 added-2 removed
22 unmodified lines
23});2425const commands: readonly CommandDoc[] = [26 ...someCommands,27 local("hook", "Answer a harness hook."),28 local("login", "Sign in to a platform."),29 local("mcp", "Serve the platform's tools over MCP on stdio."),30];31
22 unmodified lines
54 );55 }56 });5757 it("install the CLI by the script alone, then sign in to the platform", () => {58 expect(textsOf(channel("cli"))).toStrictEqual([58 it("install the CLI by the script alone, then sign in to the platform, then the hooks", () => {59 expect(textsOf(channel("cli")).slice(0, 2)).toStrictEqual([60 `curl -fsSL ${webUrl}/install.sh | sh`,61 `${Brand.cli} login --url ${platformUrl}`,62 ]);63 expect(64 channels.flatMap(textsOf).filter((each) => /\bnpm install\b/u.test(each))65 ).toStrictEqual([]);66 });6768 it("give Claude Code's settings.json a hook for each event the CLI answers, the edit tools guarded", () => {69 const hooks = channel("cli").snippets.find(({ name }) => name === "Hooks");7071 expect(hooks?.language).toBe("json");72 expect(JSON.parse(hooks?.text ?? "{}")).toStrictEqual({73 hooks: {74 PreToolUse: [75 {76 hooks: [77 {78 command: `${Brand.cli} hook pre-tool-use --json`,79 type: "command",80 },81 ],82 matcher: "Edit|Write|MultiEdit|NotebookEdit",83 },84 ],85 SessionStart: [86 {87 hooks: [88 {89 command: `${Brand.cli} hook session-start --json`,90 type: "command",91 },92 ],93 },94 ],95 Stop: [96 {97 hooks: [98 { command: `${Brand.cli} hook stop --json`, type: "command" },99 ],100 },101 ],102 },103 });104 expect(105 channel(106 "cli",107 installChannels({108 commands: commands.filter(({ path }) => path.join(" ") !== "hook"),109 platformUrl,110 webUrl,111 })112 ).snippets113 ).toHaveLength(2);114 });115116 it("give MCP one tab per client and stdio, with the snippets agentSetup gives", () => {117 const mcp = channel("mcp");118119 const setup = agentSetup({ commands, platformUrl, webUrl }).filter(
63 unmodified lines
modified:packages/protocol/src/contracts.ts+106 added-31 removed
160 unmodified lines
161// An empty `Schema.Struct` has no object root in JSON Schema, which an MCP162// tool's input needs; this is the form `Tool.EmptyParams` takes.163const NoPayload = Schema.Record(Schema.String, Schema.Never);164165// What a flag takes, said once: `--help` and each MCP tool's input schema read it.166const described = <S extends Schema.Top>(schema: S, description: string) =>167 schema.annotate({ description });168169const baseField = described(170 CommitSha,171 "The commit your change is built on: main as the platform last landed it"172);173174const headField = described(175 CommitSha,176 "The commit to check: the one you pushed to your fork"177);178179const requestIdField = described(180 RequestId,181 "Any 8 to 64 letters, digits, - or _ you choose; sending the same one again returns the same receipt"182);183184export class ListProjects extends Rpc.make("listProjects", {185 payload: NoPayload,186 success: Schema.Struct({ projects: Schema.Array(ProjectListing) }),187})
27 unmodified lines
215 .annotate(Surfaces, servedOn.recentLandings) {}216217export class FrontPage extends Rpc.make("frontPage", {218 payload: {200 kind: Schema.optionalKey(KindName),201 reserved: Schema.optionalKey(Reserve),219 kind: Schema.optionalKey(220 described(KindName, "Only asks of this kind, such as fix")221 ),222 reserved: Schema.optionalKey(223 described(Reserve, "Only asks held for newcomers, or for people")224 ),225 },226 success: Schema.Struct({ entries: Schema.Array(FrontPageEntry) }),227})228 .annotate(
46 unmodified lines
275 .annotate(Surfaces, servedOn.showAsk) {}276277export class Status extends Rpc.make("status", {278 error: UnknownProject,256 payload: { project: Schema.optionalKey(ProjectName) },279 payload: {280 project: Schema.optionalKey(281 described(ProjectName, "The project to show; every project when absent")282 ),283 },284 success: Schema.Struct({285 answers: Schema.Array(AnswerView),286 claims: Schema.Array(ClaimView),287 handle: Handle,
15 unmodified lines
303export class VerdictOf extends Rpc.make("verdict", {304 error: Schema.Union([UnknownProject, UnknownAsk]),305 payload: {306 ask: AskId,280 /** The answer's head; its latest when absent. */281 head: Schema.optionalKey(CommitSha),307 head: Schema.optionalKey(308 described(CommitSha, "The answer's head to show; its latest when absent")309 ),310 project: ProjectName,311 },312 success: Schema.Struct({ verdict: Schema.optionalKey(Verdict) }),313})
28 unmodified lines
342 .annotate(Cli, { name: "landing" })343 .annotate(Surfaces, servedOn.landing) {}344345export class Credits extends Rpc.make("credits", {318 payload: { handle: Handle },346 payload: { handle: described(Handle, "The person whose credits to count") },347 success: Schema.Struct({ credits: Schema.Array(CreditSummary) }),348})349 .annotate(350 Description,
313 unmodified lines
664 StaleBase,665 ]),666 payload: {667 ask: AskId,668 files: described(640 files: Schema.NonEmptyArray(ConfigFile),669 Schema.NonEmptyArray(ConfigFile),670 "The ask file and its check, as JSON [{path, content}]; the CLI reads both from your working tree when it is left out"671 ),672 project: ProjectName,673 },674 success: Schema.Struct({ ask: Ask, landed: LandedSha }),675})
24 unmodified lines
700701export class ProposeAsk extends Rpc.make("proposeAsk", {702 error: Schema.Union([UnknownProject, Denounced, CapReached, NotVouched]),703 payload: Schema.Struct({673 draft: Schema.optionalKey(Schema.Literal(true)),674 files: Schema.optionalKey(Schema.NonEmptyArray(ConfigFile)),704 draft: Schema.optionalKey(705 described(706 Schema.Literal(true),707 "Have the platform's agent draft the ask file and its failing check"708 )709 ),710 files: Schema.optionalKey(711 described(712 Schema.NonEmptyArray(ConfigFile),713 "Your own ask file and check, as JSON [{path, content}]"714 )715 ),716 project: ProjectName,676 sealed: Schema.optionalKey(Schema.Struct({ head: CommitSha })),677 territory: Schema.optionalKey(Schema.NonEmptyString),678 want: Schema.NonEmptyString,717 sealed: Schema.optionalKey(718 described(719 Schema.Struct({ head: CommitSha }),720 "An answer you already have, sealed until the ask opens, as JSON {head}"721 )722 ),723 territory: Schema.optionalKey(724 described(725 Schema.NonEmptyString,726 "The paths an answer may change, in your words"727 )728 ),729 want: described(730 Schema.NonEmptyString,731 "What should be true once the ask is answered"732 ),733 }).check(draftsAlone),734 success: Schema.Struct({ proposal: Proposal }),735})736 .annotate(
18 unmodified lines
755 DraftInProgress,756 CapReached,757 ]),758 payload: {705 note: Schema.optionalKey(DraftNote),759 note: Schema.optionalKey(760 described(DraftNote, "What the next round should change, for the agent")761 ),762 project: ProjectName,763 proposal: ProposalId,764 },765 success: Schema.Struct({ proposal: Proposal }),
15 unmodified lines
781 error: Schema.Union([UnknownProject, UnknownAsk, Denounced, CapReached]),782 payload: {783 ask: AskId,784 project: ProjectName,785 reason: described(729 reason: Schema.NonEmptyString,786 Schema.NonEmptyString,787 "What is wrong with the ask, for its maintainers"788 ),789 },790 success: Schema.Struct({ proposal: Proposal }),791})792 .annotate(
18 unmodified lines
811 VerifierBlocked,812 StaleBase,813 ]),814 payload: {756 choice: Choice,757 decision: DecisionId,758 note: Schema.optionalKey(Schema.String),815 choice: described(816 Choice,817 "accept or decline it; for a stray push, adopt or revert it"818 ),819 decision: described(DecisionId, "The decision's id, as Today lists it"),820 note: Schema.optionalKey(821 described(Schema.String, "Why, kept with the decision")822 ),823 project: ProjectName,824 },825 success: Schema.Struct({ decision: Decision }),826})
68 unmodified lines
895 PrivatePathInPublicTree,896 ]),897 payload: {898 ask: AskId,835 base: CommitSha,836 head: CommitSha,899 base: baseField,900 head: headField,901 project: ProjectName,838 requestId: RequestId,902 requestId: requestIdField,903 },904 success: AnswerReceipt,905})906 .annotate(
18 unmodified lines
925 TouchedJudge,926 ]),927 payload: {928 ask: AskId,865 base: CommitSha,866 head: CommitSha,929 base: baseField,930 head: headField,931 project: ProjectName,868 requestId: RequestId,932 requestId: requestIdField,933 },934 success: AnswerReceipt,935})936 .annotate(
11 unmodified lines
948949export class Land extends Rpc.make("land", {950 error: Schema.Union([UnknownProject, NotDecider, StaleBase, RepoBusy]),951 payload: {888 base: CommitSha,889 head: CommitSha,890 message: Schema.NonEmptyString,952 base: baseField,953 head: headField,954 message: described(955 Schema.NonEmptyString,956 "The landing's commit message: what the change does"957 ),958 project: ProjectName,892 requestId: RequestId,959 requestId: requestIdField,960 },961 success: LandReceipt,962})963 .annotate(
32 unmodified lines
996997export class Vouch extends Rpc.make("vouch", {998 error: Schema.Union([UnknownProject, NotDecider, StaleBase]),999 payload: {933 handle: Handle,934 note: Schema.optionalKey(Schema.String),1000 handle: described(Handle, "The person's handle"),1001 note: Schema.optionalKey(1002 described(Schema.String, "Why, kept beside the line in the vouch file")1003 ),1004 project: ProjectName,1005 verdict: described(936 verdict: Schema.Literals(["vouch", "denounce"]),1006 Schema.Literals(["vouch", "denounce"]),1007 "vouch admits them to claim; denounce bars them from claiming and proposing"1008 ),1009 },1010 success: Schema.Struct({ landed: LandedSha }),1011})1012 .annotate(
12 unmodified lines
1025export class EvidenceOf extends Rpc.make("evidence", {1026 error: Schema.Union([UnknownProject, NotDecider]),1027 payload: {1028 project: ProjectName,1029 ref: described(957 ref: Schema.NonEmptyString,1030 Schema.NonEmptyString,1031 "The logRef a failing lane's verdict names"1032 ),1033 },1034 success: Schema.Struct({1035 lane: LaneName,1036 /** The log's tail: its last 256 KiB, where a failure prints. */
139 unmodified lines
added:packages/protocol/test/field-descriptions.test.ts+39 added
1import { describe, expect, it } from "@effect/vitest";2import { Context, Predicate, SchemaAST } from "effect";34import { Cli, Contracts } from "../src/contracts.ts";56// A field named for what it holds needs no more words: its name is the help.7const selfNamed = new Set([8 "acknowledgeShort",9 "ask",10 "import",11 "key",12 "project",13 "proposal",14 "sha",15 "value",16]);1718const undescribed = [...Contracts.requests.values()].flatMap((rpc) => {19 const { name } = Context.get(rpc.annotations, Cli);20 const { ast } = rpc.payloadSchema;2122 if (name === undefined || !SchemaAST.isObjects(ast)) {23 return [];24 }2526 return ast.propertySignatures.flatMap((field) =>27 Predicate.isString(field.name) &&28 !selfNamed.has(field.name) &&29 SchemaAST.resolveDescription(field.type) === undefined30 ? [`${name} --${field.name}`]31 : []32 );33});3435describe("a command's flags", () => {36 it("each say what they take, in --help and in the MCP tool's input schema", () => {37 expect(undescribed).toStrictEqual([]);38 });39});