Skip to content
Myr

Merge branch 'build/906-platform-root-page'

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

# Conflicts: # apps/platform/test/w9-contracts.test.ts

authored by oscabriel · committed by oscabriel · parents 958650a, cdd07dd · Browse files · 10 files+1050 added−333 removed
This commit

State

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

Diff stats

10 files+1050 added−333 removed

  • tests:+470 added−12 removed
  • other:+580 added−321 removed

10 files+1050 added−333 removed

modified:apps/platform/src/auth/pages.ts+2 added-1 removed
modified:apps/platform/src/home.ts+196 added-14 removed
1/**2 * The platform's `/`: a page saying what this host serves (clone URLs, MCP,3 * agent skills, sign-in, the CLI and its releases, the web app), in HTML4 * for a browser and in Markdown for an agent. A stub until 906 lands: it5 * answers 501, naming what it read.2 * The platform's `/`: a page saying what this host serves (clone URLs,3 * MCP, agent skills, RPC, sign-in, the CLI and its releases, drafting, the4 * web app), in HTML for a browser and in Markdown for an agent that asks5 * for `text/markdown` or `text/plain`. The Markdown is the web's6 * `/llms.txt` (`@repo/agent-kit/host-doc`), so both hosts say the same.7 *8 * Every URL is built from the request's origin, the one the client reached:9 * the platform is also the git remote, the MCP base and the CLI's URL, so10 * the page names them as the reader will type them. The projects are the11 * front page's, and nothing else: no layer and no fork is listed. Every12 * value that reaches the HTML is escaped. Not a redirect: the web app is a13 * link (W9-D11).14 */7import type { FrontPage } from "@repo/project/front-page";8import { Effect } from "effect";15import { commandDocs } from "@repo/agent-kit/command-doc";16import { frontLlms, MCP_PROTOCOL } from "@repo/agent-kit/host-doc";17import { Brand } from "@repo/brand";18import { FrontPage } from "@repo/project/front-page";19import { Contracts } from "@repo/protocol/contracts";20import type { ProjectListing } from "@repo/protocol/domain/front-page";21import { Effect, Option } from "effect";2223import { escapeHtml, page } from "./auth/pages.ts";24import { HostInfo } from "./host-info.ts";2526/** A minute: the page changes only when a project is made. */27const BRIEFLY = "public, max-age=60";2829/** The CLI's commands, as the platform's skill and the web's `llms.txt` list them. */30const commands = commandDocs(Contracts);3132/** The media ranges of an `Accept` header, each its type and its quality. */33const rangesOf = (accept: string) =>34 accept.split(",").map((range) => {35 const [type = "", ...params] = range.split(";").map((part) => part.trim());3637 const quality = Option.getOrElse(38 Option.flatMap(39 Option.fromUndefinedOr(40 params.find((param) => param.toLowerCase().startsWith("q="))41 ),42 (param) => Option.liftPredicate(Number(param.slice(2)), Number.isFinite)43 ),44 () => 145 );4647 return { quality, type: type.toLowerCase() };48 });4950/** The highest quality `ranges` give any of `types` by name; 0 for none. */51const qualityOf = (52 ranges: ReturnType<typeof rangesOf>,53 types: readonly string[]54) =>55 Math.max(56 0,57 ...ranges.filter(({ type }) => types.includes(type)).map((r) => r.quality)58 );5960/**61 * Whether the request asks for Markdown: it names `text/markdown` or62 * `text/plain` itself, at least as high as it names `text/html`. A63 * wildcard alone (`*\/*`, or no `Accept`) gets the page, as a browser does.64 */65const wantsMarkdown = (request: Request) => {66 const ranges = rangesOf(request.headers.get("accept") ?? "");67 const markdown = qualityOf(ranges, ["text/markdown", "text/plain"]);6869 return markdown > 0 && markdown >= qualityOf(ranges, ["text/html"]);70};7172const code = (text: string) => `<code>${escapeHtml(text)}</code>`;7374const pre = (text: string) => `<pre><code>${escapeHtml(text)}</code></pre>`;7576const link = (url: string, text = url) =>77 `<a href="${escapeHtml(url)}">${escapeHtml(text)}</a>`;7879const item = (html: string) => `<li>${html}</li>`;8081const section = (title: string, ...html: readonly string[]) =>82 `<section>\n<h2>${escapeHtml(title)}</h2>\n${html.join("\n")}\n</section>`;8384const list = (items: readonly string[]) =>85 `<ul>\n${items.map(item).join("\n")}\n</ul>`;8687/** Wider than sign-in's column, for clone and install lines. */88const STYLE = `<style>89main{max-width:44rem}90h2{font-size:1.1rem;margin:2rem 0 .5rem}91pre{overflow-x:auto;padding:.5rem .75rem;background:rgba(127,127,127,.12)}92code{font-family:ui-monospace,monospace;font-size:.9em}93li{margin:.25rem 0}94</style>`;9596const projectsSection = (origin: string, projects: readonly ProjectListing[]) =>97 section(98 "Projects",99 projects.length === 0100 ? "<p>No project is on the platform yet.</p>"101 : list(102 projects.map(103 ({ openAsks, project }) =>104 `<strong>${escapeHtml(project)}</strong>, ${openAsks} open ask${openAsks === 1 ? "" : "s"}${pre(`git clone ${origin}/${project}.git`)}`105 )106 )107 );108109/** The page for a browser. */110const homeHtml = (input: {111 readonly origin: string;112 readonly projects: readonly ProjectListing[];113 readonly webUrl: Option.Option<string>;114 readonly draftModel: string;115}) => {116 const { draftModel, origin, projects, webUrl } = input;117118 return page(119 "What this host serves",120 [121 STYLE,122 `<h1>${escapeHtml(Brand.name)}</h1>`,123 `<p>A Git platform where everything a project ships is public. A project states each change it wants as an ask; you answer one with a commit, and the platform lands it only once its checks pass.</p>`,124 ...Option.toArray(125 Option.map(126 webUrl,127 (web) => `<p><strong>${link(web, "Open the web app")}</strong></p>`128 )129 ),130 projectsSection(origin, projects),131 section(132 "CLI",133 pre(`curl -fsSL ${origin}/install.sh | sh`),134 `<p>Releases: ${link(`${origin}/releases/manifest.json`)}</p>`,135 `<p>Then sign in: ${code(`${Brand.cli} login --url ${origin}`)}</p>`136 ),137 section(138 "Agents",139 list([140 `MCP: ${code(`${origin}/mcp`)}, streamable HTTP, protocol ${code(MCP_PROTOCOL)}, signed in`,141 `Agent skills: ${link(`${origin}/.well-known/agent-skills/index.json`)}`,142 `RPC: ${code(`POST ${origin}/rpc`)}`,143 `OAuth: ${link(`${origin}/.well-known/oauth-protected-resource`)} and ${link(`${origin}/.well-known/oauth-authorization-server`)}`,144 `The same facts as Markdown: ask for ${code("text/markdown")}, as in ${code(`curl -H 'accept: text/markdown' ${origin}/`)}`,145 ])146 ),147 section(148 "Sign in",149 list([150 `Sign up: ${link(`${origin}/signup`)}`,151 `Authorize a client: ${code(`${origin}/authorize`)}`,152 ])153 ),154 section(155 "Drafting",156 `<p>A member can ask the platform's agent to draft a proposed ask (Workers AI, ${code(draftModel)}); a decider accepts it, and only people are credited.</p>`157 ),158 section("Health", `<p>${link(`${origin}/health`)}</p>`),159 ].join("\n")160 );161};162163/** `/` for `request`: Markdown for an agent that asks for it, else the page. */164export const homeResponse = (13 _request: Request165 request: Request166): Effect.Effect<Response, never, FrontPage | HostInfo> =>15 Effect.map(16 Effect.service(HostInfo),17 ({ draftModel }) =>18 new Response(`not built: 906 (draft model ${draftModel})`, {19 status: 501,20 })21 );167 Effect.gen(function* () {168 const { draftModel, webUrl } = yield* HostInfo;169 const projects = yield* FrontPage.use((frontPage) => frontPage.projects());170 const { origin } = new URL(request.url);171172 if (wantsMarkdown(request)) {173 return new Response(174 frontLlms({175 commands,176 platformUrl: origin,177 projects,178 ...Option.match(webUrl, {179 onNone: () => ({}),180 onSome: (web) => ({ webUrl: web }),181 }),182 }),183 {184 headers: {185 "cache-control": BRIEFLY,186 "content-type": "text/markdown; charset=utf-8",187 vary: "accept",188 },189 }190 );191 }192193 return new Response(homeHtml({ draftModel, origin, projects, webUrl }), {194 headers: {195 "cache-control": BRIEFLY,196 "content-security-policy":197 "default-src 'none'; style-src 'unsafe-inline'; frame-ancestors 'none'",198 "content-type": "text/html; charset=utf-8",199 "referrer-policy": "no-referrer",200 vary: "accept",201 },202 });203 });
added:apps/platform/test/home.test.ts+231 added
1/**2 * The platform's `/`: what this host serves, built from the request's3 * origin, the projects the front page lists and the host's own facts. A4 * browser gets HTML; an agent asking for Markdown or plain text gets the5 * text the web serves at `/llms.txt`. Open to a stale credential, as every6 * public path is.7 */8import { describe, expect, it } from "@effect/vitest";9import { commandDocs } from "@repo/agent-kit/command-doc";10import { frontLlms } from "@repo/agent-kit/host-doc";11import { Brand } from "@repo/brand";12import { FrontPageMemory } from "@repo/project/front-page/memory";13import { Contracts } from "@repo/protocol/contracts";14import type { ProjectListing } from "@repo/protocol/domain/front-page";15import { ProjectName } from "@repo/protocol/ids";16import { Effect, Layer, Option } from "effect";1718import { MemorySessions } from "../src/sessions/memory.ts";19import { HostInfo } from "../src/surfaces.ts";20import { noProjects, origin, served } from "./harness.ts";2122const webUrl = "https://web-test.example.workers.dev";2324const projects: readonly ProjectListing[] = [25 { openAsks: 3, posture: "open", project: ProjectName.make("datekit") },26 {27 openAsks: 1,28 posture: "openWithSealedEvidence",29 project: ProjectName.make("burrow"),30 },31];3233/** The platform listing `listed`, on a host whose web app is `web`. */34const platform = (35 listed: readonly ProjectListing[],36 web: Option.Option<string> = Option.some(webUrl)37) =>38 served(39 Layer.mergeAll(40 noProjects,41 MemorySessions.layer({}),42 FrontPageMemory.layer({ credits: [], entries: [], projects: listed }),43 Layer.succeed(44 HostInfo,45 HostInfo.of({ draftModel: "@cf/test/drafter", webUrl: web })46 )47 )48 );4950/** `/` as `headers` ask for it: its status, type and text. */51const home = (52 listed: readonly ProjectListing[],53 init: RequestInit = {},54 web?: Option.Option<string>55) =>56 Effect.gen(function* () {57 const { fetch } = yield* platform(listed, web);58 const response = yield* fetch(new Request(`${origin}/`, init));5960 return {61 status: response.status,62 text: yield* Effect.promise(() => response.text()),63 type: response.headers.get("content-type"),64 };65 });6667const html = { headers: { accept: "text/html,application/xhtml+xml" } };6869describe("the platform's /", () => {70 it.effect("tells a browser what this host serves, from its origin", () =>71 Effect.gen(function* () {72 const { status, text, type } = yield* home(projects, html);7374 expect(status).toBe(200);75 expect(type).toBe("text/html; charset=utf-8");76 expect(text).toContain(`<h1>${Brand.name}</h1>`);7778 for (const named of [79 `git clone ${origin}/datekit.git`,80 `git clone ${origin}/burrow.git`,81 `curl -fsSL ${origin}/install.sh | sh`,82 `${origin}/releases/manifest.json`,83 `${origin}/mcp`,84 "2026-07-28",85 `POST ${origin}/rpc`,86 `${origin}/.well-known/agent-skills/index.json`,87 `${origin}/.well-known/oauth-protected-resource`,88 `${origin}/.well-known/oauth-authorization-server`,89 `${origin}/signup`,90 `${origin}/authorize`,91 "@cf/test/drafter",92 `${origin}/health`,93 `<a href="${webUrl}">Open the web app</a>`,94 ]) {95 expect(text).toContain(named);96 }97 })98 );99100 it.effect("links no web app on a host that has none", () =>101 Effect.gen(function* () {102 const { status, text } = yield* home(projects, html, Option.none());103104 expect(status).toBe(200);105 expect(text).not.toContain("Open the web app");106 expect(text).not.toContain(webUrl);107 })108 );109110 it.effect("says so when no project is listed yet", () =>111 Effect.gen(function* () {112 const { text } = yield* home([], html);113114 expect(text).toContain("No project is on the platform yet.");115 expect(text).not.toContain("git clone");116 })117 );118119 it.effect("escapes whatever a listing names", () =>120 Effect.gen(function* () {121 const crafted = ProjectName.make(`<script>alert("x")</script>`, {122 disableChecks: true,123 });124125 const { text } = yield* home(126 [{ openAsks: 0, posture: "open", project: crafted }],127 html128 );129130 expect(text).not.toContain("<script>");131 expect(text).toContain(132 "&lt;script&gt;alert(&quot;x&quot;)&lt;/script&gt;"133 );134 })135 );136137 it.effect("gives an agent the web's /llms.txt as Markdown", () =>138 Effect.gen(function* () {139 const expected = frontLlms({140 commands: commandDocs(Contracts),141 platformUrl: origin,142 projects,143 webUrl,144 });145146 const markdown = yield* home(projects, {147 headers: { accept: "text/markdown" },148 });149150 const plain = yield* home(projects, {151 headers: { accept: "text/plain" },152 });153154 expect(markdown).toStrictEqual({155 status: 200,156 text: expected,157 type: "text/markdown; charset=utf-8",158 });159 expect(plain.text).toBe(expected);160 })161 );162163 it.effect(164 "gives an agent the platform's own Markdown on a host with no web app",165 () =>166 Effect.gen(function* () {167 const { text, type } = yield* home(168 projects,169 { headers: { accept: "text/markdown" } },170 Option.none()171 );172173 expect({ text, type }).toStrictEqual({174 text: frontLlms({175 commands: commandDocs(Contracts),176 platformUrl: origin,177 projects,178 }),179 type: "text/markdown; charset=utf-8",180 });181 })182 );183184 it.effect.each([185 { accept: undefined, wants: "html" },186 { accept: "*/*", wants: "html" },187 {188 accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",189 wants: "html",190 },191 { accept: "text/html, text/markdown;q=0.5", wants: "html" },192 { accept: "text/html;q=0.5, text/markdown", wants: "markdown" },193 { accept: "text/plain, text/html", wants: "markdown" },194 { accept: "text/markdown;q=0, text/html;q=0.1", wants: "html" },195 ])("answers Accept $accept with $wants", ({ accept, wants }) =>196 Effect.gen(function* () {197 const { type } = yield* home(198 projects,199 accept === undefined ? {} : { headers: { accept } }200 );201202 expect(type).toBe(203 wants === "html"204 ? "text/html; charset=utf-8"205 : "text/markdown; charset=utf-8"206 );207 })208 );209210 it.effect("answers a stale credential, as every public path does", () =>211 Effect.gen(function* () {212 const { status, text } = yield* home(projects, {213 headers: { ...html.headers, authorization: "Bearer nope" },214 });215216 expect(status).toBe(200);217 expect(text).toContain(`git clone ${origin}/datekit.git`);218 })219 );220221 it.effect("answers HEAD with no body", () =>222 Effect.gen(function* () {223 const { status, text } = yield* home(projects, {224 ...html,225 method: "HEAD",226 });227228 expect({ status, text }).toStrictEqual({ status: 200, text: "" });229 })230 );231});
modified:apps/platform/test/w9-contracts.test.ts+4 added-10 removed
118 unmodified lines
119120 const raw = `/${project}/raw/${"4".repeat(40)}/README.md`;121122 expect({123 home: yield* read("/"),124 homeStale: yield* read("/", stale),123 home: (yield* read("/")).status,124 homeStale: (yield* read("/", stale)).status,125 raw: yield* read(raw),126 rawStale: yield* read(raw, stale),127 }).toStrictEqual({128 home: {129 status: 501,130 text: "not built: 906 (draft model test-model)",131 },132 homeStale: {133 status: 501,134 text: "not built: 906 (draft model test-model)",135 },128 home: 200,129 homeStale: 200,130 raw: { status: 404, text: "" },131 rawStale: { status: 404, text: "" },132 });133 })
15 unmodified lines
modified:apps/web/src/features/agents/llms.ts+12 added-304 removed
1/**2 * What an agent, or a person, reads first on the web host, as3 * plain Markdown in the `llms.txt` shape (a title, a one-line summary, then4 * sections of links): `/llms.txt` says what the platform is, how to install5 * the CLI, how to connect over MCP, how to find and take an ask, every6 * command, and which projects exist; `/<project>/llms.txt` says the same7 * for one project, with its open asks. `mcpCard` is8 * `/.well-known/mcp.json`.9 *10 * Pure: the routes hand in what the platform lists and the CLI's commands11 * as `@repo/agent-kit`'s one list holds them, so no command is written here12 * by hand. A step names a command only when the catalog has it. Every13 * name comes from `Brand`.2 * What an agent, or a person, reads first on the web host: `/llms.txt`,3 * `/<project>/llms.txt` and the MCP card at `/.well-known/mcp.json`. The4 * text lives in `@repo/agent-kit/host-doc`, which the platform's own `/`5 * serves too, so both hosts say the same thing; the routes import it from6 * here.7 */15import type { CommandDoc } from "@repo/agent-kit/command-doc";16import { Brand } from "@repo/brand";17import type { AskListing } from "@repo/protocol/domain/ask";18import type { ProjectListing } from "@repo/protocol/domain/front-page";19import type { ProjectName } from "@repo/protocol/ids";20import type { Posture } from "@repo/protocol/posture";21import { Array as Arr, Option } from "effect";8export {9 frontLlms,10 mcpCard,11 missingProjectLlms,12 projectLlms,13} from "@repo/agent-kit/host-doc";1423type Command = CommandDoc;2425type Commands = readonly CommandDoc[];2627/** The MCP protocol the platform serves over HTTP. */28const MCP_PROTOCOL = "2026-07-28";2930/** Each posture as GLOSSARY.md names it. */31const postureWords = {32 open: "Open",33 openCore: "Open core",34 openOnSchedule: "Open on schedule",35 openWithSealedEvidence: "Open with sealed evidence",36 sourceAvailable: "Source available",37} as const satisfies Record<Posture, string>;3839const code = (text: string) => `\`${text}\``;4041const counted = (count: number, one: string) =>42 `${count} ${one}${count === 1 ? "" : "s"}`;4344/** The lines as one document, ending in a newline. */45const page = (lines: readonly string[]) => `${lines.join("\n")}\n`;4647/** What a placeholder stands for in a command line, if the page knows it. */48interface Known {49 readonly project?: string;50}5152/** The command whose words are `words`, if the catalog has it. */53const commandOf = (commands: Commands, words: string) =>54 Arr.findFirst(commands, ({ path }) => path.join(" ") === words);5556/**57 * A command as typed: the CLI's name, its words, its arguments, then58 * `flags` it takes, each with a value the page knows or a placeholder.59 */60const usage = (61 command: Command,62 known: Known = {},63 flags: readonly ("ask" | "project")[] = []64) => {65 const valueOf = (name: string) =>66 name === "project" && known.project !== undefined67 ? known.project68 : `<${name}>`;6970 return [71 Brand.cli,72 ...command.path,73 ...command.positional.map((name) => `<${name}>`),74 ...flags.flatMap((flag) =>75 command.flags.includes(`--${flag}`) && !command.positional.includes(flag)76 ? [`--${flag}`, valueOf(flag)]77 : []78 ),79 ].join(" ");80};8182/** `words` as typed, with `flags`, when the catalog has the command. */83const typed = (84 commands: Commands,85 words: string,86 known: Known,87 flags: readonly ("ask" | "project")[] = []88) =>89 Option.map(commandOf(commands, words), (command) =>90 code(usage(command, known, flags))91 );9293/** The sentence `make` writes around a typed command, or nothing without it. */94const withCommand = (95 command: Option.Option<string>,96 make: (typedCommand: string) => string97) => Option.toArray(Option.map(command, make));9899/**100 * How to take an ask, each step with the commands the catalog has: find,101 * read, claim, change and check, push and read the verdict. Numbered in102 * order, whatever steps the catalog leaves out.103 */104const takeAnAsk = (commands: Commands, known: Known) => {105 const front = typed(commands, "front", known);106 const asks = typed(commands, "asks", known, ["project"]);107108 const find = [109 ...Option.toArray(110 Option.map(front, (each) => `${each} lists the open asks across projects`)111 ),112 ...Option.toArray(113 Option.map(asks, (each) => `${each} lists one project's`)114 ),115 ];116117 const steps = [118 ...(find.length === 0 ? [] : [`Find one: ${find.join("; ")}.`]),119 ...withCommand(120 typed(commands, "ask", known, ["project"]),121 (each) => `Read it: ${each}.`122 ),123 ...withCommand(124 typed(commands, "claim", known, ["project"]),125 (each) =>126 `Claim it: ${each}. The claim prints your fork's remote; add it with ${code(`git remote add ${Brand.slug} <remote>`)}.`127 ),128 ...withCommand(129 typed(commands, "check", known),130 (each) =>131 `Change only the ask's territory, then run ${each} and fix everything it reports.`132 ),133 `Push to your fork with ${code(`git push ${Brand.slug} HEAD:main`)}${Option.match(134 typed(commands, "verdict", known, ["ask", "project"]),135 { onNone: () => "", onSome: (each) => `, then read the verdict: ${each}` }136 )}. A refusal names the command to run next.`,137 ];138139 return [140 "## Take an ask",141 "",142 ...steps.map((step, at) => `${at + 1}. ${step}`),143 "",144 ];145};146147/** What a command row adds to its description. */148const notes = ({ needsApproval, readOnly }: Command) => [149 ...(readOnly ? ["Only reads."] : []),150 ...(needsApproval ? [`Runs only with ${code("--yes")}.`] : []),151];152153/** Every command, one line each, in the catalog's order. */154const commandList = (commands: Commands) => [155 "## Commands",156 "",157 ...commands.map(158 (command) =>159 `- ${code(usage(command))}: ${[command.summary, ...notes(command)].join(" ")}`160 ),161 "",162];163164/** Where a project's page is on the web host. */165const projectPage = (webUrl: string, project: string) => `${webUrl}/${project}`;166167const projectLine = (webUrl: string, listing: ProjectListing) =>168 `- [${listing.project}](${projectPage(webUrl, listing.project)}/llms.txt): ${postureWords[listing.posture]}, ${counted(listing.openAsks, "open ask")}.`;169170/** `/llms.txt`: the platform, the CLI, MCP, taking an ask, the commands and the projects. */171export const frontLlms = (input: {172 readonly projects: readonly ProjectListing[];173 readonly commands: Commands;174 readonly platformUrl: string;175 readonly webUrl: string;176}) => {177 const { commands, platformUrl, projects, webUrl } = input;178179 return page([180 `# ${Brand.name}`,181 "",182 `> ${Brand.name} is a Git platform where everything a project ships is public. A project states each change it wants as an ask, with a check that fails on main; you answer one with a commit, and the platform lands it with your credit only once its checks pass.`,183 "",184 `The same facts read as Markdown: each project at ${webUrl}/<project>/llms.txt, and each ask at ${webUrl}/<project>/asks/<ask>.md.`,185 "",186 "## Install the CLI",187 "",188 "```sh",189 `curl -fsSL ${webUrl}/install.sh | sh`,190 "```",191 "",192 ...Option.match(commandOf(commands, "login"), {193 onNone: () => [],194 onSome: () => [195 "Then sign in once; git pushes to the platform with your token from then on:",196 "",197 "```sh",198 `${Brand.cli} login --url ${platformUrl}`,199 "```",200 "",201 ],202 }),203 "## Connect over MCP",204 "",205 `- Endpoint: ${platformUrl}/mcp (streamable HTTP, MCP ${MCP_PROTOCOL}), described at ${webUrl}/.well-known/mcp.json.`,206 `- Auth: a bearer token from the platform's own OAuth server, which an MCP client finds at ${platformUrl}/.well-known/oauth-protected-resource; you sign in with your account on ${Brand.name}.`,207 ...withCommand(208 typed(commands, "mcp", {}),209 (each) =>210 `- Without a client that signs in: ${each} serves the same tools over stdio, with the token ${code(`${Brand.cli} login`)} stored.`211 ),212 `- Skills: ${webUrl}/.well-known/agent-skills/index.json lists each project's contribute skill, with its digest.`,213 "",214 ...takeAnAsk(commands, {}),215 ...commandList(commands),216 "## Projects",217 "",218 ...(projects.length === 0219 ? ["No project is on the platform yet."]220 : projects.map((listing) => projectLine(webUrl, listing))),221 ]);222};223224/** What an ask's line adds after its want: its kind and territory, then whether it can be taken. */225const askNotes = (listing: AskListing) => [226 `Kind ${code(listing.kind)}, territory ${code(listing.territory)}.`,227 ...(listing.claimed ? ["Claimed."] : []),228 ...(listing.reserve === undefined ? [] : [`Held for ${listing.reserve}.`]),229 ...(listing.blockedBy.length === 0230 ? []231 : [`Waits for ${listing.blockedBy.map(code).join(", ")}.`]),232];233234/** An ask's want as a sentence of its own, however it was punctuated. */235const sentence = (text: string) => `${text.replace(/[.\s]+$/u, "")}.`;236237const askLine = (webUrl: string, project: string, listing: AskListing) =>238 `- [${listing.ask}](${projectPage(webUrl, project)}/asks/${listing.ask}.md): ${[sentence(listing.want), ...askNotes(listing)].join(" ")}`;239240/** `/<project>/llms.txt`: the project, its posture, how to clone it, its open asks and how to take one. */241export const projectLlms = (input: {242 readonly listing: ProjectListing;243 readonly asks: readonly AskListing[];244 readonly commands: Commands;245 readonly platformUrl: string;246 readonly webUrl: string;247}) => {248 const { asks, commands, listing, platformUrl, webUrl } = input;249 const { project } = listing;250251 return page([252 `# ${project}`,253 "",254 `> A project on ${Brand.name}. Posture: ${postureWords[listing.posture]}. ${counted(asks.length, "open ask")}.`,255 "",256 `- Page: ${projectPage(webUrl, project)}`,257 `- Clone: ${code(`git clone ${platformUrl}/${project}.git`)}`,258 `- Everything else, and every command: ${webUrl}/llms.txt`,259 "",260 "## Open asks",261 "",262 ...(asks.length === 0263 ? ["No ask is open."]264 : asks.map((each) => askLine(webUrl, project, each))),265 "",266 ...takeAnAsk(commands, { project }).slice(0, -1),267 ]);268};269270/**271 * `/<project>/llms.txt` for a project the platform does not list. A name272 * that could not be a project's is not repeated back.273 */274export const missingProjectLlms = (input: {275 readonly project: Option.Option<ProjectName>;276 readonly webUrl: string;277}) =>278 page([279 "# Not found",280 "",281 `${Option.match(input.project, {282 onNone: () => "No such project",283 onSome: (project) => `No project named ${code(project)}`,284 })} is on ${Brand.name}. Every project is listed at ${input.webUrl}/llms.txt.`,285 ]);286287/**288 * `/.well-known/mcp.json`: the platform's MCP endpoint, its transport and289 * protocol, and where a client learns to sign in. No settled standard says290 * this card's shape; it follows the MCP server card draft, and names its291 * authorization the way the platform's 401 does (RFC 9728's292 * `resource_metadata`).293 */294export const mcpCard = (input: { readonly platformUrl: string }) => ({295 authentication: {296 required: true,297 resource_metadata: `${input.platformUrl}/.well-known/oauth-protected-resource`,298 schemes: ["bearer"],299 },300 capabilities: { prompts: {}, resources: {}, tools: {} },301 description: `The contracts of ${Brand.name} as MCP tools, each ask's brief as a resource, and the contribute skill as a prompt.`,302 name: Brand.name,303 protocolVersion: MCP_PROTOCOL,304 transport: { endpoint: `${input.platformUrl}/mcp`, type: "streamable-http" },305});306307export type McpCard = ReturnType<typeof mcpCard>;15export type { McpCard } from "@repo/agent-kit/host-doc";
modified:infra/smoke.ts+24 added-2 removed
10 unmodified lines
11 * 4. `anonymous-unknown-project`: an anonymous `/rpc` `listAsks` for a project12 * that doesn't exist answers 200 with a typed `UnknownProject` refusal;13 * 5. `missing-repo-404`: git's `info/refs` for a repo that doesn't exist14 * answers 404;15 * 6. `platform-root`: the platform's `GET /` answers 200 with a page that16 * names its MCP endpoint (`/mcp`) and the CLI's `install.sh`;15 * 6. `web-front-page`: the web's `GET /` answers 200 with HTML;16 * 7. `web-llms-txt`: the web's `GET /llms.txt` answers 200 with Markdown,17 * 7. `web-front-page`: the web's `GET /` answers 200 with HTML;18 * 8. `web-llms-txt`: the web's `GET /llms.txt` answers 200 with Markdown,19 * which it builds from the platform's project list, so only a web that20 * reaches the platform through its service binding passes.21 *22 * The web's two run when smoke knows where the web lives: bootstrap's
34 unmodified lines
57 "oauth-metadata",58 "mcp-needs-credential",59 "anonymous-unknown-project",60 "missing-repo-404",61 "platform-root",62] as const;6364/** The web's probes, run after the platform's when smoke has the web's origin. */65export const webProbes = ["web-front-page", "web-llms-txt"] as const;
282 unmodified lines
348 HttpClientRequest.get(`${origin}${route}?service=git-upload-pack`)349 ).pipe(Effect.flatMap(statusIs(label, 404)), Effect.asVoid);350};351352/** The platform's own `/`: a page naming its MCP endpoint and the CLI's installer. */353const platformRoot = (origin: string) => {354 const label = "GET /";355356 return send(label, HttpClientRequest.get(`${origin}/`)).pipe(357 Effect.flatMap(statusIs(label, 200)),358 Effect.flatMap(({ text }) =>359 text.includes("/mcp") && text.includes("install.sh")360 ? Effect.void361 : Effect.fail(362 new Missed({363 reason: `${label} answered 200 without naming /mcp and install.sh`,364 })365 )366 )367 );368};369370/** `answer`, when its content type is `wanted` (by its media type alone). */371const typeIs =372 (label: string, wanted: string, said: string) => (answer: Answer) =>373 answer.contentType.split(";")[0]?.trim() === wanted
90 unmodified lines
464 ["oauth-metadata", oauthMetadata(origin)],465 ["mcp-needs-credential", mcpNeedsCredential(origin)],466 ["anonymous-unknown-project", anonymousUnknownProject(origin)],467 ["missing-repo-404", missingRepo(origin)],468 ["platform-root", platformRoot(origin)],469 ...(options.web === undefined470 ? []471 : ([472 ["web-front-page", webFrontPage(options.web)],
113 unmodified lines
added:packages/agent-kit/src/host-doc.ts+346 added
1/**2 * What an agent, or a person, reads first about a host, as plain Markdown3 * in the `llms.txt` shape (a title, a one-line summary, then sections of4 * links). `frontLlms` says what the platform is, how to install the CLI,5 * how to connect over MCP, how to find and take an ask, every command, and6 * which projects exist: the web serves it at `/llms.txt`, and the platform7 * at `/` for an agent, with no web app's pages named when it knows of none.8 * `projectLlms` is the web's `/<project>/llms.txt`, with the project's open9 * asks, and `mcpCard` its `/.well-known/mcp.json`.10 *11 * Pure: the hosts hand in what the platform lists and the CLI's commands12 * as this package's one list holds them, so no command is written here13 * by hand. A step names a command only when the catalog has it. Every14 * name comes from `Brand`.15 */16import { Brand } from "@repo/brand";17import type { AskListing } from "@repo/protocol/domain/ask";18import type { ProjectListing } from "@repo/protocol/domain/front-page";19import type { ProjectName } from "@repo/protocol/ids";20import type { Posture } from "@repo/protocol/posture";21import { Array as Arr, Option } from "effect";2223import type { CommandDoc } from "./command-doc.ts";2425type Command = CommandDoc;2627type Commands = readonly CommandDoc[];2829/** The MCP protocol the platform serves over HTTP. */30export const MCP_PROTOCOL = "2026-07-28";3132/** Each posture as GLOSSARY.md names it. */33const postureWords = {34 open: "Open",35 openCore: "Open core",36 openOnSchedule: "Open on schedule",37 openWithSealedEvidence: "Open with sealed evidence",38 sourceAvailable: "Source available",39} as const satisfies Record<Posture, string>;4041const code = (text: string) => `\`${text}\``;4243const counted = (count: number, one: string) =>44 `${count} ${one}${count === 1 ? "" : "s"}`;4546/** The lines as one document, ending in a newline. */47const page = (lines: readonly string[]) => `${lines.join("\n")}\n`;4849/** What a placeholder stands for in a command line, if the page knows it. */50interface Known {51 readonly project?: string;52}5354/** The command whose words are `words`, if the catalog has it. */55const commandOf = (commands: Commands, words: string) =>56 Arr.findFirst(commands, ({ path }) => path.join(" ") === words);5758/**59 * A command as typed: the CLI's name, its words, its arguments, then60 * `flags` it takes, each with a value the page knows or a placeholder.61 */62const usage = (63 command: Command,64 known: Known = {},65 flags: readonly ("ask" | "project")[] = []66) => {67 const valueOf = (name: string) =>68 name === "project" && known.project !== undefined69 ? known.project70 : `<${name}>`;7172 return [73 Brand.cli,74 ...command.path,75 ...command.positional.map((name) => `<${name}>`),76 ...flags.flatMap((flag) =>77 command.flags.includes(`--${flag}`) && !command.positional.includes(flag)78 ? [`--${flag}`, valueOf(flag)]79 : []80 ),81 ].join(" ");82};8384/** `words` as typed, with `flags`, when the catalog has the command. */85const typed = (86 commands: Commands,87 words: string,88 known: Known,89 flags: readonly ("ask" | "project")[] = []90) =>91 Option.map(commandOf(commands, words), (command) =>92 code(usage(command, known, flags))93 );9495/** The sentence `make` writes around a typed command, or nothing without it. */96const withCommand = (97 command: Option.Option<string>,98 make: (typedCommand: string) => string99) => Option.toArray(Option.map(command, make));100101/**102 * How to take an ask, each step with the commands the catalog has: find,103 * read, claim, change and check, push and read the verdict. Numbered in104 * order, whatever steps the catalog leaves out.105 */106const takeAnAsk = (commands: Commands, known: Known) => {107 const front = typed(commands, "front", known);108 const asks = typed(commands, "asks", known, ["project"]);109110 const find = [111 ...Option.toArray(112 Option.map(front, (each) => `${each} lists the open asks across projects`)113 ),114 ...Option.toArray(115 Option.map(asks, (each) => `${each} lists one project's`)116 ),117 ];118119 const steps = [120 ...(find.length === 0 ? [] : [`Find one: ${find.join("; ")}.`]),121 ...withCommand(122 typed(commands, "ask", known, ["project"]),123 (each) => `Read it: ${each}.`124 ),125 ...withCommand(126 typed(commands, "claim", known, ["project"]),127 (each) =>128 `Claim it: ${each}. The claim prints your fork's remote; add it with ${code(`git remote add ${Brand.slug} <remote>`)}.`129 ),130 ...withCommand(131 typed(commands, "check", known),132 (each) =>133 `Change only the ask's territory, then run ${each} and fix everything it reports.`134 ),135 `Push to your fork with ${code(`git push ${Brand.slug} HEAD:main`)}${Option.match(136 typed(commands, "verdict", known, ["ask", "project"]),137 { onNone: () => "", onSome: (each) => `, then read the verdict: ${each}` }138 )}. A refusal names the command to run next.`,139 ];140141 return [142 "## Take an ask",143 "",144 ...steps.map((step, at) => `${at + 1}. ${step}`),145 "",146 ];147};148149/** What a command row adds to its description. */150const notes = ({ needsApproval, readOnly }: Command) => [151 ...(readOnly ? ["Only reads."] : []),152 ...(needsApproval ? [`Runs only with ${code("--yes")}.`] : []),153];154155/** Every command, one line each, in the catalog's order. */156const commandList = (commands: Commands) => [157 "## Commands",158 "",159 ...commands.map(160 (command) =>161 `- ${code(usage(command))}: ${[command.summary, ...notes(command)].join(" ")}`162 ),163 "",164];165166/** Where a project's page is on the web host. */167const projectPage = (webUrl: string, project: string) => `${webUrl}/${project}`;168169/** What a project's line says of it: its posture and its open asks. */170const projectFacts = (listing: ProjectListing) =>171 `${postureWords[listing.posture]}, ${counted(listing.openAsks, "open ask")}.`;172173/**174 * A project's line: a link to its Markdown on the web host, or, with no175 * web app, its clone URL on the platform.176 */177const projectLine = (178 platformUrl: string,179 webUrl: Option.Option<string>,180 listing: ProjectListing181) =>182 Option.match(webUrl, {183 onNone: () =>184 `- ${listing.project}: ${projectFacts(listing)} Clone: ${code(`git clone ${platformUrl}/${listing.project}.git`)}.`,185 onSome: (web) =>186 `- [${listing.project}](${projectPage(web, listing.project)}/llms.txt): ${projectFacts(listing)}`,187 });188189/**190 * The platform, the CLI, MCP, taking an ask, the commands and the191 * projects: the web's `/llms.txt`, and the platform's `/` for an agent.192 * Without `webUrl` it names only what the platform serves itself: the CLI193 * and the skills from the platform, each project by its clone URL, and no194 * page that only a web app serves.195 */196export const frontLlms = (input: {197 readonly commands: Commands;198 readonly projects: readonly ProjectListing[];199 readonly platformUrl: string;200 readonly webUrl?: string;201}) => {202 const { commands, platformUrl, projects } = input;203 const webUrl = Option.fromUndefinedOr(input.webUrl);204 // The CLI's downloads and the skills: the web forwards both to the platform.205 const served = Option.getOrElse(webUrl, () => platformUrl);206207 return page([208 `# ${Brand.name}`,209 "",210 `> ${Brand.name} is a Git platform where everything a project ships is public. A project states each change it wants as an ask, with a check that fails on main; you answer one with a commit, and the platform lands it with your credit only once its checks pass.`,211 "",212 ...Option.match(webUrl, {213 onNone: () => [],214 onSome: (web) => [215 `The same facts read as Markdown: each project at ${web}/<project>/llms.txt, and each ask at ${web}/<project>/asks/<ask>.md.`,216 "",217 ],218 }),219 "## Install the CLI",220 "",221 "```sh",222 `curl -fsSL ${served}/install.sh | sh`,223 "```",224 "",225 ...Option.match(commandOf(commands, "login"), {226 onNone: () => [],227 onSome: () => [228 "Then sign in once; git pushes to the platform with your token from then on:",229 "",230 "```sh",231 `${Brand.cli} login --url ${platformUrl}`,232 "```",233 "",234 ],235 }),236 "## Connect over MCP",237 "",238 `- Endpoint: ${platformUrl}/mcp (streamable HTTP, MCP ${MCP_PROTOCOL})${Option.match(239 webUrl,240 {241 onNone: () => "",242 onSome: (web) => `, described at ${web}/.well-known/mcp.json`,243 }244 )}.`,245 `- Auth: a bearer token from the platform's own OAuth server, which an MCP client finds at ${platformUrl}/.well-known/oauth-protected-resource; you sign in with your account on ${Brand.name}.`,246 ...withCommand(247 typed(commands, "mcp", {}),248 (each) =>249 `- Without a client that signs in: ${each} serves the same tools over stdio, with the token ${code(`${Brand.cli} login`)} stored.`250 ),251 `- Skills: ${served}/.well-known/agent-skills/index.json lists each project's contribute skill, with its digest.`,252 "",253 ...takeAnAsk(commands, {}),254 ...commandList(commands),255 "## Projects",256 "",257 ...(projects.length === 0258 ? ["No project is on the platform yet."]259 : projects.map((listing) => projectLine(platformUrl, webUrl, listing))),260 ]);261};262263/** What an ask's line adds after its want: its kind and territory, then whether it can be taken. */264const askNotes = (listing: AskListing) => [265 `Kind ${code(listing.kind)}, territory ${code(listing.territory)}.`,266 ...(listing.claimed ? ["Claimed."] : []),267 ...(listing.reserve === undefined ? [] : [`Held for ${listing.reserve}.`]),268 ...(listing.blockedBy.length === 0269 ? []270 : [`Waits for ${listing.blockedBy.map(code).join(", ")}.`]),271];272273/** An ask's want as a sentence of its own, however it was punctuated. */274const sentence = (text: string) => `${text.replace(/[.\s]+$/u, "")}.`;275276const askLine = (webUrl: string, project: string, listing: AskListing) =>277 `- [${listing.ask}](${projectPage(webUrl, project)}/asks/${listing.ask}.md): ${[sentence(listing.want), ...askNotes(listing)].join(" ")}`;278279/** `/<project>/llms.txt`: the project, its posture, how to clone it, its open asks and how to take one. */280export const projectLlms = (input: {281 readonly listing: ProjectListing;282 readonly asks: readonly AskListing[];283 readonly commands: Commands;284 readonly platformUrl: string;285 readonly webUrl: string;286}) => {287 const { asks, commands, listing, platformUrl, webUrl } = input;288 const { project } = listing;289290 return page([291 `# ${project}`,292 "",293 `> A project on ${Brand.name}. Posture: ${postureWords[listing.posture]}. ${counted(asks.length, "open ask")}.`,294 "",295 `- Page: ${projectPage(webUrl, project)}`,296 `- Clone: ${code(`git clone ${platformUrl}/${project}.git`)}`,297 `- Everything else, and every command: ${webUrl}/llms.txt`,298 "",299 "## Open asks",300 "",301 ...(asks.length === 0302 ? ["No ask is open."]303 : asks.map((each) => askLine(webUrl, project, each))),304 "",305 ...takeAnAsk(commands, { project }).slice(0, -1),306 ]);307};308309/**310 * `/<project>/llms.txt` for a project the platform does not list. A name311 * that could not be a project's is not repeated back.312 */313export const missingProjectLlms = (input: {314 readonly project: Option.Option<ProjectName>;315 readonly webUrl: string;316}) =>317 page([318 "# Not found",319 "",320 `${Option.match(input.project, {321 onNone: () => "No such project",322 onSome: (project) => `No project named ${code(project)}`,323 })} is on ${Brand.name}. Every project is listed at ${input.webUrl}/llms.txt.`,324 ]);325326/**327 * `/.well-known/mcp.json`: the platform's MCP endpoint, its transport and328 * protocol, and where a client learns to sign in. No settled standard says329 * this card's shape; it follows the MCP server card draft, and names its330 * authorization the way the platform's 401 does (RFC 9728's331 * `resource_metadata`).332 */333export const mcpCard = (input: { readonly platformUrl: string }) => ({334 authentication: {335 required: true,336 resource_metadata: `${input.platformUrl}/.well-known/oauth-protected-resource`,337 schemes: ["bearer"],338 },339 capabilities: { prompts: {}, resources: {}, tools: {} },340 description: `The contracts of ${Brand.name} as MCP tools, each ask's brief as a resource, and the contribute skill as a prompt.`,341 name: Brand.name,342 protocolVersion: MCP_PROTOCOL,343 transport: { endpoint: `${input.platformUrl}/mcp`, type: "streamable-http" },344});345346export type McpCard = ReturnType<typeof mcpCard>;
added:packages/agent-kit/test/golden/host-doc.txt+49 added
1# __NAME__23> __NAME__ is a Git platform where everything a project ships is public. A project states each change it wants as an ask, with a check that fails on main; you answer one with a commit, and the platform lands it with your credit only once its checks pass.45The same facts read as Markdown: each project at https://web-test.example.workers.dev/<project>/llms.txt, and each ask at https://web-test.example.workers.dev/<project>/asks/<ask>.md.67## Install the CLI89```sh10curl -fsSL https://web-test.example.workers.dev/install.sh | sh11```1213Then sign in once; git pushes to the platform with your token from then on:1415```sh16__CLI__ login --url https://platform-test.example.workers.dev17```1819## Connect over MCP2021- Endpoint: https://platform-test.example.workers.dev/mcp (streamable HTTP, MCP 2026-07-28), described at https://web-test.example.workers.dev/.well-known/mcp.json.22- Auth: a bearer token from the platform's own OAuth server, which an MCP client finds at https://platform-test.example.workers.dev/.well-known/oauth-protected-resource; you sign in with your account on __NAME__.23- Without a client that signs in: `__CLI__ mcp` serves the same tools over stdio, with the token `__CLI__ login` stored.24- Skills: https://web-test.example.workers.dev/.well-known/agent-skills/index.json lists each project's contribute skill, with its digest.2526## Take an ask27281. Find one: `__CLI__ front` lists the open asks across projects; `__CLI__ asks --project <project>` lists one project's.292. Read it: `__CLI__ ask <ask> --project <project>`.303. Claim it: `__CLI__ claim <ask> --project <project>`. The claim prints your fork's remote; add it with `git remote add __SLUG__ <remote>`.314. Change only the ask's territory, then run `__CLI__ check` and fix everything it reports.325. Push to your fork with `git push __SLUG__ HEAD:main`, then read the verdict: `__CLI__ verdict --ask <ask> --project <project>`. A refusal names the command to run next.3334## Commands3536- `__CLI__ ask <ask>`: Show one ask in full, with its brief in Markdown for an answerer to read first. Only reads.37- `__CLI__ asks`: List a project's open asks. Only reads.38- `__CLI__ check`: Run the gate's checks on your answer locally. Only reads.39- `__CLI__ claim <ask>`: Claim an ask: an exclusive, expiring right to answer it.40- `__CLI__ env set <key>`: Set a sensitive env item's value from stdin. Runs only with `--yes`.41- `__CLI__ front`: List the open asks across every project. Only reads.42- `__CLI__ login`: Sign in to a platform.43- `__CLI__ mcp`: Serve the platform's tools over MCP on stdio. Only reads.44- `__CLI__ verdict`: Show the verdict on an answer to an ask. Only reads.4546## Projects4748- [datekit](https://web-test.example.workers.dev/datekit/llms.txt): Open, 3 open asks.49- [burrow](https://web-test.example.workers.dev/burrow/llms.txt): Open with sealed evidence, 1 open ask.
added:packages/agent-kit/test/host-doc.test.ts+134 added
1/**2 * The host's own Markdown, `frontLlms`: what the web serves at `/llms.txt`3 * and the platform at `/` for an agent. A pure function of the CLI's4 * commands, the listed projects and the two hosts' URLs; with no web app5 * it points only at what the platform serves itself.6 */7import { NodeServices } from "@effect/platform-node";8import { describe, expect, it } from "@effect/vitest";9import { Brand } from "@repo/brand";10import type { ProjectListing } from "@repo/protocol/domain/front-page";11import { ProjectName } from "@repo/protocol/ids";12import { Effect } from "effect";1314import type { CommandDoc } from "../src/command-doc.ts";15import { frontLlms } from "../src/host-doc.ts";16import { expectGolden } from "./golden.ts";1718const platformUrl = "https://platform-test.example.workers.dev";1920const webUrl = "https://web-test.example.workers.dev";2122/** A command row as the command list holds it. */23const row = (24 path: readonly [string, ...string[]],25 summary: string,26 more: Partial<CommandDoc> = {}27): CommandDoc => ({28 flags: ["--json"],29 needsApproval: false,30 path,31 positional: [],32 readOnly: true,33 source: "contract",34 summary,35 ...more,36});3738/** The web's own `llms.test.ts` catalog, so the golden file is its former output. */39const commands: readonly CommandDoc[] = [40 row(41 ["ask"],42 "Show one ask in full, with its brief in Markdown for an answerer to read first.",43 { flags: ["--project", "--json"], positional: ["ask"] }44 ),45 row(["asks"], "List a project's open asks.", {46 flags: ["--project", "--json"],47 }),48 row(["check"], "Run the gate's checks on your answer locally.", {49 flags: ["--ask", "--project", "--json"],50 source: "local",51 }),52 row(["claim"], "Claim an ask: an exclusive, expiring right to answer it.", {53 flags: ["--project", "--json", "--dry-run"],54 positional: ["ask"],55 readOnly: false,56 }),57 row(["env", "set"], "Set a sensitive env item's value from stdin.", {58 flags: ["--project", "--yes"],59 needsApproval: true,60 positional: ["key"],61 readOnly: false,62 source: "local",63 }),64 row(["front"], "List the open asks across every project."),65 row(["login"], "Sign in to a platform.", {66 flags: ["--url", "--json"],67 readOnly: false,68 source: "local",69 }),70 row(["mcp"], "Serve the platform's tools over MCP on stdio.", {71 flags: [],72 source: "local",73 }),74 row(["verdict"], "Show the verdict on an answer to an ask.", {75 flags: ["--ask", "--head", "--project", "--json"],76 }),77];7879const projects: readonly ProjectListing[] = [80 { openAsks: 3, posture: "open", project: ProjectName.make("datekit") },81 {82 openAsks: 1,83 posture: "openWithSealedEvidence",84 project: ProjectName.make("burrow"),85 },86];8788const linesOf = (text: string) => text.split("\n");8990describe("the host's Markdown", () => {91 it.effect("with a web app, is the text the web served at /llms.txt", () =>92 expectGolden(93 "host-doc",94 frontLlms({ commands, platformUrl, projects, webUrl })95 ).pipe(Effect.provide(NodeServices.layer))96 );9798 describe("without a web app", () => {99 const text = frontLlms({ commands, platformUrl, projects });100 const lines = linesOf(text);101102 it("installs the CLI and finds the skills on the platform itself", () => {103 expect(lines).toContain(`curl -fsSL ${platformUrl}/install.sh | sh`);104 expect(lines).toContain(105 `- Skills: ${platformUrl}/.well-known/agent-skills/index.json lists each project's contribute skill, with its digest.`106 );107 expect(lines).toContain(108 `- Endpoint: ${platformUrl}/mcp (streamable HTTP, MCP 2026-07-28).`109 );110 });111112 it("gives each project's clone URL in place of a web page", () => {113 expect(lines).toContain(114 `- datekit: Open, 3 open asks. Clone: \`git clone ${platformUrl}/datekit.git\`.`115 );116 expect(lines).toContain(117 `- burrow: Open with sealed evidence, 1 open ask. Clone: \`git clone ${platformUrl}/burrow.git\`.`118 );119 });120121 it("names no page only a web app serves", () => {122 expect(text).not.toContain("llms.txt");123 expect(text).not.toContain("mcp.json");124 expect(text).not.toContain(".md");125 });126127 it("still opens with the name and lists every command", () => {128 expect(lines[0]).toBe(`# ${Brand.name}`);129 expect(130 lines.filter((line) => line.startsWith(`- \`${Brand.cli} `))131 ).toHaveLength(commands.length);132 });133 });134});
modified:packages/config/test/smoke.test.ts+52 added-2 removed
62 unmodified lines
6364/**65 * The platform as smoke expects to find it: healthy, OAuth's resource66 * metadata published, MCP closed to anyone without a credential, anonymous67 * reads open, and no repo it doesn't hold.67 * reads open, no repo it doesn't hold, and a `/` that names MCP and the68 * CLI's installer.69 */70const healthy = ({ authorized, body, method, path }: Seen): Reply => {71 if (method === "GET" && path === "/") {72 return {73 body: "<!doctype html><p><code>http://127.0.0.1/mcp</code></p><pre>curl -fsSL http://127.0.0.1/install.sh | sh</pre>",74 contentType: "text/html; charset=utf-8",75 status: 200,76 };77 }7879 if (method === "GET" && path === "/health") {80 return { body: '{"ok":true,"stage":"dev-oscabriel"}', status: 200 };81 }82
16 unmodified lines
99};100101/**102 * A platform whose 401 gate is gone and whose stage is down: `/health` and94 * `/rpc` break, MCP opens to anyone, and git's paths answer 200.103 * `/rpc` break, MCP opens to anyone, git's paths answer 200, and `/` is104 * gone.105 */106const broken = (seen: Seen): Reply => {107 if (seen.path === "/") {108 return { status: 404 };109 }110111 if (seen.path === "/health") {112 return { body: "upstream connect error", status: 503 };113 }114
55 unmodified lines
170 expect(report.stage).toBe("dev-oscabriel");171 expect(report.probes.map(({ probe }) => probe)).toStrictEqual([172 ...platformProbes,173 ]);174 expect(platformProbes).toStrictEqual([175 "health",176 "oauth-metadata",177 "mcp-needs-credential",178 "anonymous-unknown-project",179 "missing-repo-404",180 "platform-root",181 ]);182 expect(183 report.probes.every(({ elapsedMs }) => elapsedMs >= 0)184 ).toBeTruthy();185 }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer))
69 unmodified lines
255 {256 probe: "missing-repo-404",257 reason: "GET /no-such-project.git/info/refs answered 200, not 404",258 },259 { probe: "platform-root", reason: "GET / answered 404, not 200" },260 ]);261 }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer))262 );263
160 unmodified lines
424 },425 ]);426 }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer))427 );428429 it.live(430 "fails the platform's / when it names neither MCP nor the installer",431 () =>432 Effect.gen(function* () {433 const origin = yield* fakePlatform((seen) =>434 seen.path === "/"435 ? {436 body: "<!doctype html><p>Hello</p>",437 contentType: "text/html; charset=utf-8",438 status: 200,439 }440 : healthy(seen)441 );442443 const result = yield* Effect.result(smoke(origin));444445 expect(446 Result.isFailure(result) ? result.failure.failures : []447 ).toStrictEqual([448 {449 probe: "platform-root",450 reason: "GET / answered 200 without naming /mcp and install.sh",451 },452 ]);453 }).pipe(Effect.scoped, Effect.provide(FetchHttpClient.layer))454 );455});456457describe("the smoke command", () => {458 it.live("refuses without a stage it knows, before it probes anything", () =>
70 unmodified lines