Add /tour, the loop in six steps on the landing's example (find, read, claim, push and hear OutOfScope through the one renderer, fix and land, see the credit), each with its numbered command and a screen drawn by the real components; link it from the hero, the asks' and Explore's empty states and Start here; reserve the name; and seed the dev world with bram's round on parse-iso-week refused OutOfScope at Shape, his second held at the merge, with the kept verdict naming the stage its report names
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by oscabriel · committed by oscabriel · parent 07f14ad · Browse files · 27 files·+1180 added−49 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
27 files+1180 added−49 removed
- tests:+320 added−10 removed
- other:+860 added−39 removed
Provenance
- Commit
eb01fb9- Tree
2d5dfd7- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent
07f14ad
27 files changed+1180 added−49 removed
added:apps/web/src/dev/answer-runs.ts+47 added
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647/** * The inline runner, with a hold: a request the seed holds is never driven, * so the seed can judge a round the way the platform's landing guard would * (`apps/platform/src/workflows/answer/program.ts`), or leave one checking. */import type { RepoHost } from "@repo/artifacts/repo-host";import type { CheckRunner } from "@repo/checks/check-runner";import { AnswerRuns } from "@repo/project/answer-runs";import { AnswerRunsInline } from "@repo/project/answer-runs/inline";import type { Lander } from "@repo/project/lander";import type { RequestId } from "@repo/protocol/ids";import { Context, Effect, Layer, Ref } from "effect";
export class DevAnswerRuns extends Context.Service< DevAnswerRuns, { readonly hold: (requestId: RequestId) => Effect.Effect<void> }>()("web/dev/DevAnswerRuns") {}
export const DevAnswerRunsLayer: Layer.Layer< AnswerRuns | DevAnswerRuns, never, CheckRunner | Lander | RepoHost> = Layer.effectContext( Effect.gen(function* () { const inline = Context.get( yield* Layer.build(AnswerRunsInline), AnswerRuns );
const held = yield* Ref.make<ReadonlySet<RequestId>>(new Set());
return Context.make( AnswerRuns, AnswerRuns.of({ start: (requestId, queue) => Effect.flatMap(Ref.get(held), (ids) => ids.has(requestId) ? Effect.void : inline.start(requestId, queue) ), }) ).pipe( Context.add(DevAnswerRuns, { hold: (requestId) => Ref.update(held, (ids) => new Set(ids).add(requestId)), }) ); }));modified:apps/web/src/dev/examples.ts+68 added
404 unmodified lines405 [AskId.make(stated.id), [askFileOf(stated), test]] as const406 ),407 files: library,408 project: ProjectName.make("oscabriel/datekit"),409+ /**410+ * Bram's two rounds on parse-iso-week: the first refused at Shape for a411+ * path outside the ask's territory, the second still checking.412+ */413+ rounds: {414+ ask: AskId.make("parse-iso-week"),415+ first: {416+ files: new Map([417+ [418+ "src/parse.ts",419+ [420+ "const WEEK = /^(?<year>\\d{4})-W(?<week>\\d{2})-(?<day>[1-7])$/u;",421+ "",422+ "/** An ISO 8601 date (`2026-10-07`), week date (`2026-W41-3`) or date-time, read as UTC. */",423+ "export const parseISO = (text: string): Date => {",424+ " const week = WEEK.exec(text);",425+ "",426+ " if (week === null) {",427+ ' return new Date(text.length === 10 ? text + "T00:00:00Z" : text);',428+ " }",429+ "",430+ " // The week's Monday, from the week holding 4 January, comes next.",431+ " return new Date(Number.NaN);",432+ "};",433+ "",434+ ].join("\n"),435+ ],436+ ]) satisfies Files,437+ message: "Start on ISO week dates",438+ },439+ outside: RepoPath.make("README.md"),440+ second: {441+ files: new Map([442+ [443+ "src/parse.ts",444+ [445+ "const WEEK = /^(?<year>\\d{4})-W(?<week>\\d{2})-(?<day>[1-7])$/u;",446+ "",447+ "const DAY = 86_400_000;",448+ "",449+ "/** The Monday of ISO week 1: the week holding 4 January. */",450+ "const firstMonday = (year: number) => {",451+ " const fourth = Date.UTC(year, 0, 4);",452+ " const weekday = new Date(fourth).getUTCDay() || 7;",453+ "",454+ " return fourth - (weekday - 1) * DAY;",455+ "};",456+ "",457+ "/** An ISO 8601 date (`2026-10-07`), week date (`2026-W41-3`) or date-time, read as UTC. */",458+ "export const parseISO = (text: string): Date => {",459+ " const week = WEEK.exec(text)?.groups;",460+ "",461+ " if (week === undefined) {",462+ ' return new Date(text.length === 10 ? text + "T00:00:00Z" : text);',463+ " }",464+ "",465+ " return new Date(",466+ " firstMonday(Number(week.year)) +",467+ " ((Number(week.week) - 1) * 7 + Number(week.day) - 1) * DAY",468+ " );",469+ "};",470+ "",471+ ].join("\n"),472+ ],473+ ]) satisfies Files,474+ message: "Parse ISO week dates",475+ },476+ },477 stray: {478 files: new Map([479 [480 "README.md",220 unmodified linesmodified:apps/web/src/dev/seed.ts+100 added-6 removed
1 import { RefName, RefOutcome, RepoHost } from "@repo/artifacts/repo-host";2+import { Lander } from "@repo/project/lander";3+import { LandingCommand } from "@repo/project/landing";4 import type { ProjectApi } from "@repo/project/project";5 import { Projects } from "@repo/project/projects";6 import type { HarnessAudit } from "@repo/protocol/audit";7 import { DecisionSubject } from "@repo/protocol/domain/decision";8 import type { Decision } from "@repo/protocol/domain/decision";9 import { AskId, Handle, keyOf, RepoName, RequestId } from "@repo/protocol/ids";10 import type { CommitSha, ProjectName, ProposalId } from "@repo/protocol/ids";11 import { Anonymous, Person } from "@repo/protocol/principal";12+import { OutOfScope } from "@repo/protocol/refusal";13 import { Array, DateTime, Effect, Option } from "effect";14 15+import { DevAnswerRuns } from "./answer-runs.ts";16 import { DevClock, devMinute } from "./clock.ts";17 import {18 burrow,19 burrowPeople,133 unmodified lines153 ),154 { discard: true }155 );156 157+/**158+ * A push to the answerer's fork, recorded and submitted as the gateway does;159+ * a held one is queued but never driven, so it stays at the merge until the160+ * seed judges it.161+ */162 const answered = (163 api: ProjectApi,164 answerer: Handle,165 input: {166 readonly ask: AskId;167 readonly audit: HarnessAudit;168 readonly files: Files;169+ readonly hold?: boolean;170 readonly message: string;171 }172 ) =>173 Effect.gen(function* () {2 unmodified lines176 const claim = yield* Effect.fromOption(177 Array.findFirst(claims, ({ ask }) => ask === input.ask)178 );179 170- const base = yield* filesOf(claim.fork, claim.base);180+ // A second round builds on the first: the fork's tip, which a first push finds at the claim's base.181+ const host = yield* RepoHost;182 183+ const tip = Option.getOrElse(184+ Option.fromNullishOr((yield* host.refs(claim.fork)).get(mainRef)),185+ () => claim.base186+ );187+188+ const base = yield* filesOf(claim.fork, tip);189+190 const head = yield* pushed(claim.fork, {191 author: answerer,192 files: overlay(textOf(base), input.files),193 message: input.message,176- parent: Option.some(claim.base),194+ parent: Option.some(tip),195 });196 197 const refusals = yield* api.recordPush({198 after: head,199 audit: input.audit,182- before: Option.some(claim.base),200+ before: Option.some(tip),201 eventId: `${claim.fork}@${head}`,202 pusher: as(answerer),203 ref: mainRef,204 repo: claim.fork,2 unmodified lines207 if (Array.isReadonlyArrayNonEmpty(refusals)) {208 return yield* Effect.die(refusals);209 }210 211+ const requestId = RequestId.make(`push-${head}-${answerer}`);212+213+ if (input.hold === true) {214+ yield* (yield* DevAnswerRuns).hold(requestId);215+ }216+193- return yield* api.submitAnswer(as(answerer), {217+ const receipt = yield* api.submitAnswer(as(answerer), {218 ask: input.ask,219 base: claim.base,220 head,197- requestId: RequestId.make(`push-${head}-${answerer}`),221+ requestId,222 });223+224+ return { claim, head, receipt, requestId };225 });226 227+const ROUNDS_MINUTE = 19;228+229+/**230+ * Bram's first answer to parse-iso-week, refused at Shape for a path outside231+ * the ask's territory, then his second, still at the merge. The platform's232+ * landing guard judges a merged tree's shape as stage 1 judges a push's and233+ * reports its refusals at that stage (`apps/platform/src/workflows/answer`);234+ * the dev world has no guard, so the seed reports the verdict one would.235+ */236+const refusedRound = (api: ProjectApi) =>237+ Effect.gen(function* () {238+ const { contributor } = datekitPeople;239+ const { ask, first, outside, second } = datekit.rounds;240+ const lander = yield* Lander;241+242+ yield* at(ROUNDS_MINUTE);243+244+ const held = yield* answered(api, contributor, {245+ ...first,246+ ask,247+ audit: bramsHarness,248+ hold: true,249+ });250+251+ const run = yield* Effect.flatMap(252+ api.answer(held.requestId),253+ Effect.fromOption254+ );255+256+ const main = yield* Effect.flatMap(api.head(), ({ landed }) =>257+ Effect.fromOption(Option.fromUndefinedOr(landed))258+ );259+260+ const { changes, tree } = yield* lander.merge({261+ base: held.claim.base,262+ fork: held.claim.fork,263+ head: held.head,264+ main,265+ repo: RepoName.make(keyOf(datekit.project)),266+ });267+268+ yield* api.advanceAnswer(269+ held.requestId,270+ LandingCommand.Merged({ changes, main, tree })271+ );272+273+ yield* api.advanceAnswer(274+ held.requestId,275+ LandingCommand.Checked({276+ decisions: [],277+ finish: run.finish,278+ refusals: [new OutOfScope({ paths: [outside] })],279+ tree,280+ }),281+ { heldBack: [], lanes: [], stage: "shape" }282+ );283+284+ yield* at(ROUNDS_MINUTE + 1);285+286+ yield* answered(api, contributor, {287+ ...second,288+ ask,289+ audit: bramsHarness,290+ hold: true,291+ });292+ });293+294 const decisionOn = (api: ProjectApi, decider: Handle, proposal: ProposalId) =>295 Effect.flatMap(api.today(as(decider)), ({ decisions }) =>296 Effect.fromOption(297 Array.findFirst(104 unmodified lines402 403 export const seedDev: Effect.Effect<404 void,405 never,313- Projects | RepoHost | DevClock406+ Projects | RepoHost | DevClock | Lander | DevAnswerRuns407 > = Effect.gen(function* () {408 const datekitApi = yield* seedDatekit;409 410 yield* seedBurrow;411+ yield* refusedRound(datekitApi);412 yield* strayPush(datekitApi);413 }).pipe(Effect.orDie);modified:apps/web/src/dev/world.ts+13 added-4 removed
3 unmodified lines45678891011121314151617181920212223242526272827293031323324 unmodified lines5859606160616263646566676869703 unmodified linesimport { EvidenceStoreMemory } from "@repo/checks/evidence-store/memory";import { cannedDrafter } from "@repo/drafting/draft-runs/canned";import { withDraftRunsInline } from "@repo/drafting/draft-runs/inline";import { AlarmsMemory } from "@repo/project/alarms/memory";import { AnswerRunsInline } from "@repo/project/answer-runs/inline";import { ProjectDescriptionsMemory } from "@repo/project/description/memory";import type { FrontPage } from "@repo/project/front-page";import type { Lander } from "@repo/project/lander";import { FinishersFromChecks } from "@repo/project/project";import type { Projects } from "@repo/project/projects";import { ProjectsMemory } from "@repo/project/projects/memory";import { RulesEvaluatorJson } from "@repo/rules/rules-evaluator/json";import { Layer } from "effect";import type { DateTime } from "effect";
import { DevAnswerRunsLayer } from "./answer-runs.ts";import type { DevAnswerRuns } from "./answer-runs.ts";import { DevChecker } from "./checker.ts";import { devClockAt, devStart } from "./clock.ts";import type { DevClock } from "./clock.ts";import { DevFrontPage } from "./front-page.ts";import { DevLander } from "./lander.ts";import { DevProjection } from "./projection.ts";
const ports = Layer.mergeAll( AlarmsMemory, AnswerRunsInline, DevAnswerRunsLayer, cannedDrafter, DevProjection, RulesEvaluatorJson.pipe(Layer.provide(FinishersFromChecks))).pipe(24 unmodified lines );
export const devWorldAt = ( start: DateTime.Utc): Layer.Layer<Projects | FrontPage | EvidenceStore | RepoHost | DevClock> => devWorldWith(Layer.empty, start);): Layer.Layer< | Projects | FrontPage | EvidenceStore | RepoHost | DevClock | Lander | DevAnswerRuns> => devWorldWith(Layer.empty, start);modified:apps/web/src/features/ask/ask-page.tsx+2 added-1 removed
176 unmodified lines177 ))}178 </ul>179 );180 181+/** The ask's brief, as the tour reads it too. */181-const Brief = ({ ask }: { readonly ask: Ask }) => {182+export const Brief = ({ ask }: { readonly ask: Ask }) => {183 const { context, current, outOfScope, terms } = ask.brief;184 185 const parts = [186 current === undefined ? null : (434 unmodified linesmodified:apps/web/src/features/explore/explore-page.tsx+10 added-2 removed
3 unmodified lines4 import type { ReactNode } from "react";5 6 import { LandingProjects } from "../landing/projects.ts";7 import { postureLabel } from "../project/posture-label.ts";8+import { LINK } from "../shared/classes.ts";9 import { EmptyState } from "../shared/empty.tsx";10 import { AppLink } from "../shared/link.tsx";10-import { ASKS_PATH, projectPath } from "../shared/paths.ts";11+import { ASKS_PATH, projectPath, TOUR_PATH } from "../shared/paths.ts";12 import { UnreachableNotice } from "../shared/pending.tsx";13 import { PostureBadge } from "../shared/posture.tsx";14 import { GUTTER } from "../shared/shell/gutter.ts";15 import { exploreGroups } from "./groups.ts";111 unmodified lines127 heading="Taking answers now"128 note="Projects with asks open to claim."129 >130 {taking.length === 0 ? (130- <EmptyState title="No project has an open ask right now." />131+ <EmptyState132+ onward={133+ <AppLink className={LINK} to={TOUR_PATH}>134+ Take the tour135+ </AppLink>136+ }137+ title="No project has an open ask right now."138+ />139 ) : (140 <CardGrid projects={taking} />141 )}142 </Group>47 unmodified linesmodified:apps/web/src/features/front/front-page.tsx+9 added-1 removed
15 unmodified lines16 import type { AskProgress } from "../shared/ask-progress.ts";17 import { EmptyState } from "../shared/empty.tsx";18 import { FamilyStrip } from "../shared/family.tsx";19 import { AppLink } from "../shared/link.tsx";20-import { projectPath } from "../shared/paths.ts";20+import { projectPath, TOUR_PATH } from "../shared/paths.ts";21 import { PostureBadge } from "../shared/posture.tsx";22 import { AskRow, RowGroup, useRowSelection } from "../shared/row.tsx";23 import { Workspace } from "../shared/shell/workspace.tsx";24 import { plural } from "./facts.tsx";212 unmodified lines237 </nav>238 );239 };240 241+const TakeTheTour = () => (242+ <AppLink className={LINK} to={TOUR_PATH}>243+ Take the tour244+ </AppLink>245+);246+247 const NoAsks = ({248 projects,249 }: {250 readonly projects: readonly ProjectListing[] | undefined;251 }) =>252 projects?.length === 0 ? (253 <EmptyState254 command={`${Brand.cli} init`}255+ onward={<TakeTheTour />}256 title="No open asks, and no project yet. Run init in a repo to bring it here."257 />258 ) : (259 <EmptyState260 command={`${Brand.cli} ask open <ask> --files <files>`}261+ onward={<TakeTheTour />}262 title="No open asks on any project. A maintainer opens one from an ask file."263 />264 );265 190 unmodified linesmodified:apps/web/src/features/landing/gate-drawing.tsx+3 added-2 removed
65 unmodified lines66 </span>67 );68 };69 70+/** A transcript as a terminal prints it, with its caption under it. */70-const Output = ({71+export const Output = ({72 caption,73 outcome,74 transcript,75 }: {76 readonly caption: string;76- readonly outcome: "landed" | "refused";77+ readonly outcome: "claimed" | "landed" | "refused";78 readonly transcript: Printed;79 }) => (80 <figure className="flex min-w-0 flex-col gap-2" data-output={outcome}>81 <pre40 unmodified linesmodified:apps/web/src/features/landing/landing-page.tsx+11 added-2 removed
3 unmodified lines4 import { buttonVariants } from "../../components/ui/button.tsx";5 import { ID, LINK } from "../shared/classes.ts";6 import { CommandLine } from "../shared/command.tsx";7 import { AppLink } from "../shared/link.tsx";8-import { ASKS_PATH, EXPLORE_PATH, INSTALL_PATH } from "../shared/paths.ts";8+import {9+ ASKS_PATH,10+ EXPLORE_PATH,11+ INSTALL_PATH,12+ LANDING_NOW_ANCHOR,13+ TOUR_PATH,14+} from "../shared/paths.ts";15 import { GUTTER } from "../shared/shell/gutter.ts";16 import { GateDrawing } from "./gate-drawing.tsx";17 import { LandingNowList } from "./landing-now-list.tsx";18 import type { LandingNow } from "./landing-now.ts";160 unmodified lines179 </AppLink>180 <div className="max-w-full min-w-0">181 <CommandLine command={installCommand(webUrl)} />182 </div>183+ <AppLink className={`text-ui ${LINK}`} to={TOUR_PATH}>184+ Take the tour185+ </AppLink>186 </div>187 <div className="w-full max-w-(--container-figure)">188 <MusicBox />189 </div>8 unmodified lines198 </Part>199 200 <Part201 aside={<More to={EXPLORE_PATH}>Explore projects</More>}193- id="landing-now"202+ id={LANDING_NOW_ANCHOR}203 title="Landing now"204 >205 <LandingNowList landings={landings} />206 </Part>10 unmodified linesmodified:apps/web/src/features/landing/transcript.ts+70 added-20 removed
1 /**2 * Every `remote:` line comes from the one renderer, so it cannot drift from3 * what the gateway sends; git's own lines around them are what4 * `apps/platform/test/core-loop.test.ts` asserts from real git, the landed5- * commit's trailers among them.5+ * commit's trailers among them. The example's people are fictional; the6+ * tour's screens read the same names.7 */8+import { Brand } from "@repo/brand";9 import { creditLine } from "@repo/git/trailers";10+import type { ClaimView } from "@repo/protocol/domain/claim";11 import { Outcome } from "@repo/protocol/domain/outcome";12 import {13 AskId,14 CommitSha,15 Handle,16+ LandedSha,17 ProjectName,18+ RepoName,19 RepoPath,20 RequestId,21 } from "@repo/protocol/ids";22 import { OutOfScope } from "@repo/protocol/refusal";23+import type { Refusal } from "@repo/protocol/refusal";24 import { explain, headline, receiptLine } from "@repo/protocol/render";19-import { Result } from "effect";25+import { DateTime, Result } from "effect";26+import type { Array } from "effect";27 28 const ASK = AskId.make("parse-iso");29 23-const FORK = `datekit--${ASK}--alice.git`;30+const CLAIMANT = Handle.make("alice");31 25-const refusals = [26- new OutOfScope({ paths: [RepoPath.make("README.md")] }),27-] as const;32+const HEAD = CommitSha.make("1a2b3c4d5e6f708192a3b4c5d6e7f80912a3b4c5");33 34+/** The example every transcript and tour screen is drawn from: one ask on a fictional project. */35+export const EXAMPLE = {36+ ask: ASK,37+ asker: Handle.make("dora"),38+ base: CommitSha.make("0".repeat(40)),39+ claimant: CLAIMANT,40+ fork: RepoName.make(`datekit--${ASK}--${CLAIMANT}`),41+ head: HEAD,42+ landed: LandedSha.make("7c9e2f4a6b8d0e1f3a5b7c9d1e3f5a7b9c1d3e5f"),43+ /** The path the refused push changed outside the ask's territory. */44+ outside: RepoPath.make("README.md"),45+ project: ProjectName.make("oscabriel/datekit"),46+} as const;47+48+/** The refusal the example push hears, as the gate's shape stage gives it. */49+export const EXAMPLE_REFUSALS: Array.NonEmptyReadonlyArray<Refusal> = [50+ new OutOfScope({ paths: [EXAMPLE.outside] }),51+];52+53+/** The fork's address at a platform, as the claim receipt prints it. */54+export const forkRemote = (platformUrl: string) =>55+ `${platformUrl.replace(/\/+$/u, "")}/${EXAMPLE.fork}.git`;56+57 /** A command typed after `$`, a line the platform sent through git, or one git printed itself. */58 export interface TranscriptLine {59 readonly kind: "command" | "remote" | "printed";60 readonly text: string;10 unmodified lines71 const remote = (text: string): TranscriptLine => ({ kind: "remote", text });72 73 const printed = (text: string): TranscriptLine => ({ kind: "printed", text });74 75+/** The push the claim receipt tells the answerer to run. */76+export const PUSH = `git push ${Brand.slug} HEAD:main`;77+78 /** A push the gate refused at its shape stage, as git prints it. */79 export const refusedPush = (platformUrl: string): Transcript => {49- const fork = `${platformUrl.replace(/\/+$/u, "")}/${FORK}`;50- const tag = headline(refusals);80+ const fork = forkRemote(platformUrl);81+ const tag = headline(EXAMPLE_REFUSALS);82 83 return {84 lines: [54- command("git push"),55- ...explain(refusals).map(remote),85+ command(PUSH),86+ ...explain(EXAMPLE_REFUSALS).map(remote),87 printed(`To ${fork}`),88 printed(` ! [remote rejected] HEAD -> main (${tag})`),89 printed(`error: failed to push some refs to '${fork}'`),90 ],8 unmodified lines99 */100 export const LANDED_CREDITS =101 "git fetch && git log -1 --format='%(trailers:key=Asked-by,key=Signed-off-by)' origin/main";102 72-const HEAD = CommitSha.make("1a2b3c4d5e6f708192a3b4c5d6e7f80912a3b4c5");73-103 /** A push the gate took, then the landing commit's credit once it landed. */104 export const landedPush = (): Transcript => ({105 lines: [77- command("git push"),106+ command(PUSH),107 remote(108 Result.getOrElse(109 receiptLine({81- ask: ASK,82- base: CommitSha.make("0".repeat(40)),83- head: HEAD,110+ ask: EXAMPLE.ask,111+ base: EXAMPLE.base,112+ head: EXAMPLE.head,113 outcome: Outcome.cases.Checking.make({ stage: "merge" }),85- project: ProjectName.make("oscabriel/datekit"),86- requestId: RequestId.make(`push-${HEAD}`),114+ project: EXAMPLE.project,115+ requestId: RequestId.make(`push-${EXAMPLE.head}`),116 }),117 () => ""118 )119 ),120 command(LANDED_CREDITS),92- printed(`Asked-by: ${creditLine(Handle.make("dora"))}`),93- printed(`Signed-off-by: ${creditLine(Handle.make("alice"))}`),121+ printed(`Asked-by: ${creditLine(EXAMPLE.asker)}`),122+ printed(`Signed-off-by: ${creditLine(EXAMPLE.claimant)}`),123 ],124 });125+126+/** The claim command, as the ask page and the front page spell it. */127+export const CLAIM = `${Brand.cli} claim ${EXAMPLE.ask} --project ${EXAMPLE.project}`;128+129+/**130+ * The claim's receipt, the words the CLI prints (`apps/cli/src/render.ts`):131+ * what is held and until when, the fork, and the three commands that follow.132+ */133+export const claimReceipt = (claim: ClaimView): Transcript => ({134+ lines: [135+ command(CLAIM),136+ printed(137+ `You hold the claim on ${claim.ask} in ${claim.project} until ${DateTime.formatIso(claim.lapsesAt)}; only a push keeps it alive.`138+ ),139+ printed(`Its fork: ${claim.remote}`),140+ printed("Next:"),141+ printed(` git remote add ${Brand.slug} ${claim.remote}`),142+ printed(` ${Brand.cli} check`),143+ printed(` ${PUSH}`),144+ ],145+});modified:apps/web/src/features/shared/paths.ts+6 added
23 unmodified lines24 export const SETTINGS_PATH = "/settings";25 26 export const TERMS_PATH = "/terms";27 28+/** The guided walkthrough: the loop in six steps on an example project. */29+export const TOUR_PATH = "/tour";30+31+/** The landing's "Landing now", which the tour's "see it live" opens. */32+export const LANDING_NOW_ANCHOR = "landing-now";33+34 export const docsPath = (page?: string) =>35 page === undefined ? "/docs" : `/docs/${page}`;36 37 export const projectPath = (project: ProjectName) => `/${project}`;45 unmodified linesadded:apps/web/src/features/tour/example.ts+151 added
1+/**2+ * The tour's example, typed by the protocol's schemas and drawn from the same3+ * names as the landing's transcripts: one ask on a fictional project, claimed,4+ * refused once, then landed with credit.5+ */6+import { Brand } from "@repo/brand";7+import type { Verdict } from "@repo/protocol/domain/answer";8+import type { Ask, AskListing } from "@repo/protocol/domain/ask";9+import { CheckSpec } from "@repo/protocol/domain/check";10+import type { ClaimView } from "@repo/protocol/domain/claim";11+import { Glob } from "@repo/protocol/domain/common";12+import type { LandingView } from "@repo/protocol/domain/landing";13+import { Outcome } from "@repo/protocol/domain/outcome";14+import {15+ AskId,16+ CheckVersion,17+ KindName,18+ LandedSha,19+ LaneName,20+ PatchId,21+ RepoPath,22+ TreeSha,23+} from "@repo/protocol/ids";24+import { DateTime } from "effect";25+26+import { EXAMPLE, forkRemote } from "../landing/transcript.ts";27+28+const { ask, asker, base, claimant, fork, head, landed, project } = EXAMPLE;29+30+const at = (iso: string) => DateTime.makeUnsafe(iso);31+32+const CHECK = RepoPath.make(`test/asks/${ask}.test.ts`);33+34+export const OPENED_AT = at("2026-10-05T09:00:00Z");35+36+export const CLAIMED_AT = at("2026-10-07T10:00:00Z");37+38+export const LANDED_AT = at("2026-10-07T11:45:00Z");39+40+/** The front page's rows: the example ask, open, among two more of the project's. */41+export const LISTING: readonly AskListing[] = [42+ {43+ ask,44+ blockedBy: [],45+ claimed: false,46+ kind: KindName.make("fix"),47+ territory: "src/parse.ts",48+ want: "parseISO accepts ISO week dates such as 2026-W41-3.",49+ },50+ {51+ ask: AskId.make("format-ordinal"),52+ blockedBy: [],53+ claimed: true,54+ kind: KindName.make("fix"),55+ territory: "src/format.ts",56+ want: 'format(date, "Do") prints 1st, 2nd, 3rd, 11th, 12th, 13th and 21st.',57+ },58+ {59+ ask: AskId.make("add-months-clamp"),60+ blockedBy: [],61+ claimed: false,62+ kind: KindName.make("fix"),63+ territory: "src/add.ts",64+ want: "addMonths(January 31, 1) is the last day of February, in leap and common years.",65+ },66+];67+68+/** The ask as `ask` prints it: its brief, territory and check. */69+export const ASK: Ask = {70+ askedBy: asker,71+ blockedBy: [],72+ brief: {73+ context: [74+ "ISO 8601 numbers weeks from the Monday of the week holding 4 January.",75+ ],76+ current: "parseISO returns an invalid date for a week date.",77+ outOfScope: ["Formatting week dates back to strings."],78+ terms: ["Week date: a date written as year, week and weekday."],79+ want: "parseISO accepts ISO week dates such as 2026-W41-3.",80+ },81+ check: CheckSpec.cases.RedThenGreen.make({ path: CHECK }),82+ file: RepoPath.make(`${Brand.configDir}/asks/${ask}.ask.ts`),83+ id: ask,84+ kind: KindName.make("fix"),85+ openedAt: OPENED_AT,86+ openedIn: LandedSha.make(base),87+ project,88+ state: "open",89+ territory: { module: ".", paths: [Glob.make("src/parse.ts")] },90+};91+92+/** The claim receipt: a fork of the answerer's own at the platform, held until the lapse unless they push. */93+export const claimOf = (platformUrl: string): ClaimView => ({94+ ask,95+ base,96+ checkCommand: `bun test ${CHECK}`,97+ claimant,98+ fork,99+ lapsesAt: DateTime.add(CLAIMED_AT, { hours: 48 }),100+ openedAt: CLAIMED_AT,101+ project,102+ remote: forkRemote(platformUrl),103+ state: "live",104+ warnsAt: DateTime.add(CLAIMED_AT, { hours: 36 }),105+});106+107+const lane = (name: string, command: string, durationMs: number) => ({108+ command,109+ durationMs,110+ lane: LaneName.make(name),111+ result: "passed" as const,112+});113+114+/** The second push's verdict: every lane passed on the merged tree, so it landed. */115+export const VERDICT: Verdict = {116+ ask,117+ at: LANDED_AT,118+ base,119+ checkVersion: CheckVersion.make("redThenGreen@0.0.0+5e1d"),120+ head,121+ heldBack: [],122+ lanes: [123+ lane("redThenGreen", `bun test ${CHECK}`, 912),124+ lane("types", "bun run typecheck", 3140),125+ lane("unit", "bun test", 2470),126+ ],127+ outcome: Outcome.cases.Landed.make({ sha: landed }),128+ patchId: PatchId.make("c".repeat(64)),129+ project,130+ stage: "human",131+ tree: TreeSha.make("d".repeat(40)),132+ verifier: "platform",133+};134+135+/** The landing commit: its credit trailers, and the agent the answerer disclosed. */136+export const LANDING: LandingView = {137+ ask,138+ assisted: [{ harness: "claude-code", model: "haiku", verified: false }],139+ author: claimant,140+ credits: [141+ { handle: claimant, role: "Signed-off-by" },142+ { handle: asker, role: "Asked-by" },143+ ],144+ landedAt: LANDED_AT,145+ parent: LandedSha.make(base),146+ project,147+ sha: landed,148+};149+150+/** A line of the territory, for `why`. */151+export const WHY_LOCATION = "src/parse.ts:4";added:apps/web/src/features/tour/read.ts+37 added
1+/**2+ * Whether the platform has anything live to point the tour at: an open ask,3+ * a landing. Read as nobody, so the page stays one the edge may keep.4+ */5+import { Client } from "@repo/protocol/contracts";6+import { Effect } from "effect";7+8+export interface TourLive {9+ readonly asks: boolean;10+ readonly landings: boolean;11+}12+13+const some = <A, E>(14+ read: Effect.Effect<readonly A[], E, Client>15+): Effect.Effect<boolean, never, Client> =>16+ read.pipe(17+ Effect.map((items) => items.length > 0),18+ Effect.catchCause(() => Effect.succeed(false))19+ );20+21+export const readTourLive: Effect.Effect<TourLive, never, Client> = Effect.gen(22+ function* () {23+ const client = yield* Client;24+25+ const [asks, landings] = yield* Effect.all(26+ [27+ some(Effect.map(client.frontPage({}), ({ entries }) => entries)),28+ some(29+ Effect.map(client.recentLandings({}), ({ landings: rows }) => rows)30+ ),31+ ],32+ { concurrency: "unbounded" }33+ );34+35+ return { asks, landings };36+ }37+);added:apps/web/src/features/tour/tour-page.tsx+276 added
1+/**2+ * The guided walkthrough: six steps, each one sentence, the command that3+ * runs it (the page's `1` to `6` keys copy them) and a screen drawn by the4+ * real components over example data. The refusal is the renderer's own5+ * words, through the landing's transcript, so it cannot drift from git's.6+ */7+import { Brand } from "@repo/brand";8+import type { ReactNode } from "react";9+10+import { Brief } from "../ask/ask-page.tsx";11+import { Output } from "../landing/gate-drawing.tsx";12+import {13+ CLAIM,14+ claimReceipt,15+ EXAMPLE,16+ landedPush,17+ PUSH,18+ refusedPush,19+} from "../landing/transcript.ts";20+import { LINK } from "../shared/classes.ts";21+import { CommandLine } from "../shared/command.tsx";22+import { CreditTrailers } from "../shared/credits.tsx";23+import { TerritoryFacts } from "../shared/facts.tsx";24+import { AppLink } from "../shared/link.tsx";25+import { StageStrip } from "../shared/outcome.tsx";26+import {27+ ASKS_PATH,28+ INSTALL_PATH,29+ LANDING_NOW_ANCHOR,30+} from "../shared/paths.ts";31+import { AskRow, RowList } from "../shared/row.tsx";32+import { GUTTER } from "../shared/shell/gutter.ts";33+import {34+ ASK,35+ claimOf,36+ LANDING,37+ LISTING,38+ VERDICT,39+ WHY_LOCATION,40+} from "./example.ts";41+import type { TourLive } from "./read.ts";42+import { EXAMPLE_NOTE, TOUR_LEDE, TOUR_TITLE } from "./words.ts";43+44+/** The six commands, in the order the keys number them. */45+export const TOUR_COMMANDS = {46+ ask: `${Brand.cli} ask ${EXAMPLE.ask} --project ${EXAMPLE.project}`,47+ check: `${Brand.cli} check`,48+ claim: CLAIM,49+ front: `${Brand.cli} front`,50+ push: PUSH,51+ why: `${Brand.cli} why ${WHY_LOCATION} --project ${EXAMPLE.project}`,52+} as const;53+54+interface StepWords {55+ readonly id: string;56+ readonly title: string;57+ readonly sentence: string;58+ readonly command: string;59+}60+61+const WORDS = {62+ claim: {63+ command: TOUR_COMMANDS.claim,64+ id: "claim",65+ sentence:66+ "A claim is exclusive and expires unless you push; it gives you a fork of your own at the platform.",67+ title: "Claim it",68+ },69+ credit: {70+ command: TOUR_COMMANDS.why,71+ id: "credit",72+ sentence:73+ "The landing commit credits the asker and the answerer in its trailers; an agent is disclosed, never credited. Any line's history leads back to them.",74+ title: "See the credit",75+ },76+ find: {77+ command: TOUR_COMMANDS.front,78+ id: "find",79+ sentence:80+ "Every open ask across every public project, each a change its maintainers want and will land.",81+ title: "Find an ask",82+ },83+ land: {84+ command: TOUR_COMMANDS.check,85+ id: "land",86+ sentence:87+ "Put the file back, run the checks locally, push again: the gate merges the answer onto main, runs every check on that exact tree, and lands it.",88+ title: "Fix it, and land",89+ },90+ read: {91+ command: TOUR_COMMANDS.ask,92+ id: "read",93+ sentence:94+ "The brief says what done means, the territory which files an answer may change, and the check what judges it.",95+ title: "Read it",96+ },97+ refused: {98+ command: TOUR_COMMANDS.push,99+ id: "refused",100+ sentence:101+ "A push that strays outside the territory is refused in git's own output, with the reason, the command to run next and whether trying again can help.",102+ title: "Push, and hear why not",103+ },104+} as const satisfies Record<string, StepWords>;105+106+/** The six steps in the order the page walks them, and the keys number their commands. */107+export const STEPS: readonly StepWords[] = [108+ WORDS.find,109+ WORDS.read,110+ WORDS.claim,111+ WORDS.refused,112+ WORDS.land,113+ WORDS.credit,114+];115+116+const Step = ({117+ children,118+ live,119+ number,120+ words,121+}: {122+ readonly children: ReactNode;123+ readonly live?: ReactNode;124+ readonly number: number;125+ readonly words: StepWords;126+}) => (127+ <li128+ className="border-rule flex min-w-0 flex-col gap-4 border-t py-8"129+ data-step={words.id}130+ >131+ <div className="flex max-w-(--measure) flex-col gap-2">132+ <h2 className="text-title flex items-baseline gap-3" id={words.id}>133+ <span className="text-muted-foreground tabular-nums">{number}.</span>134+ {words.title}135+ </h2>136+ <p className="text-body text-muted-foreground">{words.sentence}</p>137+ </div>138+ <CommandLine command={words.command} numbered />139+ <div140+ className="border-rule bg-card flex min-w-0 flex-col gap-4 rounded-md border p-4"141+ data-screen={words.id}142+ >143+ {children}144+ </div>145+ {live}146+ </li>147+);148+149+const Live = ({150+ children,151+ to,152+ hash,153+}: {154+ readonly children: string;155+ readonly to: string;156+ readonly hash?: string;157+}) => (158+ <p className="text-ui" data-live="">159+ See it live:{" "}160+ <AppLink className={LINK} to={to} {...(hash === undefined ? {} : { hash })}>161+ {children}162+ </AppLink>163+ </p>164+);165+166+export const TourView = ({167+ live,168+ platformUrl,169+}: {170+ readonly live: TourLive;171+ readonly platformUrl: string;172+}) => {173+ const claim = claimOf(platformUrl);174+175+ return (176+ <main177+ className={`flex min-w-0 flex-1 flex-col gap-8 pt-8 pb-16 outline-none ${GUTTER}`}178+ id="main"179+ tabIndex={-1}180+ >181+ <div className="flex max-w-(--measure) flex-col gap-3">182+ <h1 className="text-headline">{TOUR_TITLE}</h1>183+ <p className="text-want text-muted-foreground font-normal">184+ {TOUR_LEDE}185+ </p>186+ <p className="text-ui text-muted-foreground" data-example-note="">187+ {EXAMPLE_NOTE}188+ </p>189+ </div>190+191+ <ol className="flex min-w-0 flex-col">192+ <Step193+ live={live.asks ? <Live to={ASKS_PATH}>the open asks</Live> : null}194+ number={1}195+ words={WORDS.find}196+ >197+ <RowList label="Open asks">198+ {LISTING.map((listing) => (199+ <AskRow200+ key={listing.ask}201+ listing={listing}202+ project={EXAMPLE.project}203+ showProject204+ takeable={!listing.claimed}205+ />206+ ))}207+ </RowList>208+ </Step>209+210+ <Step number={2} words={WORDS.read}>211+ <Brief ask={ASK} />212+ <TerritoryFacts ask={ASK} />213+ </Step>214+215+ <Step number={3} words={WORDS.claim}>216+ <Output217+ caption="The receipt: what you hold, until when, the fork, and the three commands that follow."218+ outcome="claimed"219+ transcript={claimReceipt(claim)}220+ />221+ </Step>222+223+ <Step number={4} words={WORDS.refused}>224+ <Output225+ caption="Refused at the shape stage, before any check ran: the tag, the reason, the next command, and whether retrying can help."226+ outcome="refused"227+ transcript={refusedPush(platformUrl)}228+ />229+ </Step>230+231+ <Step232+ live={233+ live.landings ? (234+ <Live hash={LANDING_NOW_ANCHOR} to="/">235+ the latest landings236+ </Live>237+ ) : null238+ }239+ number={5}240+ words={WORDS.land}241+ >242+ <Output243+ caption="Taken at the push; once every later stage passed, it landed as a commit crediting every person."244+ outcome="landed"245+ transcript={landedPush()}246+ />247+ <StageStrip248+ holds={{ decided: false, heldBack: false }}249+ outcome={VERDICT.outcome}250+ stage={VERDICT.stage}251+ />252+ </Step>253+254+ <Step number={6} words={WORDS.credit}>255+ <CreditTrailers256+ assisted={LANDING.assisted}257+ credits={LANDING.credits}258+ label="title"259+ />260+ </Step>261+ </ol>262+263+ <p className="text-ui text-muted-foreground">264+ Next:{" "}265+ <AppLink className={`text-foreground ${LINK}`} to={ASKS_PATH}>266+ browse the open asks267+ </AppLink>268+ , or{" "}269+ <AppLink className={`text-foreground ${LINK}`} to={INSTALL_PATH}>270+ install the CLI271+ </AppLink>272+ .273+ </p>274+ </main>275+ );276+};added:apps/web/src/features/tour/words.ts+13 added
1+/**2+ * A module of their own: a route's head is bundled with the route tree every3+ * page loads, so it must pull in no view.4+ */5+6+export const TOUR_TITLE = "Tour";7+8+export const TOUR_LEDE =9+ "The loop in six steps, each with the command that runs it: find an ask, read it, claim it, push and hear why not, fix and land, see the credit. Two minutes.";10+11+/** Said once, above the screens: the project and its people are invented. */12+export const EXAMPLE_NOTE =13+ "The screens show an example project; its people are fictional.";added:apps/web/src/routes/tour.tsx+36 added
1+import { createFileRoute, getRouteApi } from "@tanstack/react-router";2+import { createServerFn } from "@tanstack/react-start";3+import { env } from "cloudflare:workers";4+import { Effect } from "effect";5+6+import { pageHead } from "../features/shared/head.ts";7+import { readTourLive } from "../features/tour/read.ts";8+import { TourView } from "../features/tour/tour-page.tsx";9+import { TOUR_LEDE, TOUR_TITLE } from "../features/tour/words.ts";10+import { branchPage } from "../server/cache-headers.ts";11+import { serverClient } from "../server/client.ts";12+13+const root = getRouteApi("__root__");14+15+// Read as nobody (no cookie reaches the platform): whether anything is live is everyone's, so the page stays one the edge may keep.16+const tourData = createServerFn({ method: "GET" }).handler(() =>17+ Effect.runPromise(readTourLive.pipe(Effect.provide(serverClient(env))))18+);19+20+const Tour = () => {21+ const { platformUrl } = root.useLoaderData();22+ const live = Route.useLoaderData();23+24+ return <TourView live={live} platformUrl={platformUrl} />;25+};26+27+export const tourHead = () =>28+ pageHead({ description: TOUR_LEDE, title: TOUR_TITLE });29+30+export const Route = createFileRoute("/tour")({31+ staticData: { shell: "site" },32+ loader: () => tourData(),33+ head: tourHead,34+ headers: () => branchPage,35+ component: Tour,36+});modified:apps/web/test/dev-backend.test.ts+6 added-2 removed
312 unmodified lines313 () =>314 Effect.gen(function* () {315 const { landing, landings, want } = yield* recentWithLast;316 317- expect(landings[0]?._tag).toBe("Landed");318- expect(landings[0]).toMatchObject({317+ // Bram's refused round on parse-iso-week came after the last landing.318+ expect(landings.map(({ _tag }) => _tag).slice(0, 2)).toStrictEqual([319+ "Refused",320+ "Landed",321+ ]);322+ expect(landings[1]).toMatchObject({323 at: landing.landedAt,324 project: landing.project,325 sha: landing.sha,326 want,184 unmodified linesmodified:apps/web/test/dev-fixtures.test.ts+66 added
3 unmodified lines4 import { DecisionSubject } from "@repo/protocol/domain/decision";5 import type { Decision } from "@repo/protocol/domain/decision";6 import { ProjectEvent } from "@repo/protocol/domain/event";7 import { Outcome } from "@repo/protocol/domain/outcome";8+import { RecentLanding } from "@repo/protocol/domain/recent-landing";9 import { LedgerEntry } from "@repo/protocol/domain/visibility";10 import {11 AskId,12 DecisionId,13 Handle,14 ProjectName,15 ProposalId,16+ RepoPath,17 } from "@repo/protocol/ids";18+import { OutOfScope } from "@repo/protocol/refusal";19 import {20 Context,21 DateTime,22 Duration,861 unmodified lines884 ]).toStrictEqual([true, true]);885 })886 );887 });888+889+const datekit = ProjectName.make("oscabriel/datekit");890+891+const WEEK_WANT = "parseISO accepts ISO week dates such as 2026-W41-3.";892+893+describe("the dev world's refused round", seededWorlds, () => {894+ it.live(895+ "refuses bram's first answer to parse-iso-week at Shape, for a path outside its territory, and holds his second at the merge",896+ () =>897+ inWorld({}, (as) =>898+ Effect.gen(function* () {899+ const anyone = yield* as();900+901+ const { verdict } = yield* anyone.verdict({902+ ask: ask("parse-iso-week"),903+ project: datekit,904+ });905+906+ const events = yield* Stream.runCollect(907+ anyone.watch({ project: datekit })908+ );909+910+ const progress = askStates(events).get(ask("parse-iso-week"));911+912+ expect([verdict?.stage, verdict?.lanes]).toStrictEqual(["shape", []]);913+ expect(refusalsOf(verdict?.outcome)).toStrictEqual([914+ new OutOfScope({ paths: [RepoPath.make("README.md")] }),915+ ]);916+ // The verdict stays with its round: the second push waits at the merge, judged by nothing yet.917+ expect(918+ progress?.rounds.map(({ head, outcome }) => [919+ head === verdict?.head,920+ outcome._tag,921+ ])922+ ).toStrictEqual([[true, "Refused"]]);923+ expect([924+ progress?.claimant,925+ progress?.lastPush !== undefined &&926+ progress.lastPush.head !== verdict?.head,927+ ]).toStrictEqual(["bram", true]);928+ })929+ )930+ );931+932+ it.live(933+ "lists that refusal among the latest landings by its tag alone, under the ask's want",934+ () =>935+ inWorld({}, (as) =>936+ Effect.gen(function* () {937+ const { landings } = yield* (yield* as()).recentLandings({});938+ const refused = landings.filter(RecentLanding.guards.Refused);939+940+ expect(refused).toHaveLength(1);941+ expect(refused[0]).toMatchObject({942+ ask: "parse-iso-week",943+ project: datekit,944+ refusals: [{ tag: "OutOfScope" }],945+ want: WEEK_WANT,946+ });947+ })948+ )949+ );950+});modified:apps/web/test/home.test.tsx+4 added-2 removed
400 unmodified lines401 60_000402 );403 404 it.live(405- "draws a contributor's answered claim with its stages and its next command",405+ "draws a contributor's answered claim with its stages, and no command while the gate still checks the latest push",406 () =>407 Effect.gen(function* () {408 const markup = yield* pageFrom(yield* readInbox({}));409 410 expect(markup).toMatch(/<li[^>]*data-claim="[^"]+"/u);411 expect(markup).toContain('aria-label="Gate stages"');412+ // Bram's parse-iso-week: refused once, the second push at the merge, so nothing for him to run yet.413+ expect(markup).toContain("Checking");412- expect(markup).toMatch(/Copy (?:next|check) command/u);414+ expect(markup).not.toMatch(/Copy (?:next|check) command/u);415 }).pipe(Effect.provide(fixturesClient("bram")), Effect.scoped),416 60_000417 );418 64 unmodified linesmodified:apps/web/test/landing.test.tsx+12 added-6 removed
183 unmodified lines184 ).toStrictEqual([]);185 })186 );187 188- it.effect("links to every way in and to the projects", () =>189- Effect.gen(function* () {190- const hrefs = hrefsOf(mainOf(yield* pageWith(landed)));188+ it.effect(189+ "links to every way in, to the projects, and to the tour under the hero's action",190+ () =>191+ Effect.gen(function* () {192+ const main = mainOf(yield* pageWith(landed));193+ const hrefs = hrefsOf(main);194+ const hero = main.slice(0, main.indexOf('data-figure="music-box"'));195 192- expect(hrefs).toContain("/install");193- expect(hrefs).toContain("/explore");194- })196+ expect(hrefs).toContain("/install");197+ expect(hrefs).toContain("/explore");198+ expect(hrefsOf(hero)).toStrictEqual(["/asks", "/tour"]);199+ expect(textIn(hero)).toContain("Take the tour");200+ })201 );202 203 it.effect(204 "shows the refusal as git prints it, with the platform's own lines and the rejected ref",263 unmodified linesmodified:apps/web/test/render.tsx+1 added
45 unmodified lines46 ["docs/$page", "docs"],47 ["install", "site"],48 ["people/$handle", "project"],49 ["settings", "project"],50+ ["tour", "site"],51 ] as const52 ).map(([path, shell]) =>53 createRoute({ getParentRoute: () => root, path, staticData: { shell } })54 ),35 unmodified linesmodified:apps/web/test/routes.test.ts+1 added
87 unmodified lines88 "rpc",89 "settings",90 "terms",91 "today",92+ "tour",93 ]);94 });95 96 it("are names no project may take", () => {41 unmodified linesadded:apps/web/test/tour.test.tsx+229 added
1+import { describe, expect, it } from "@effect/vitest";2+import { Brand } from "@repo/brand";3+import { Contracts } from "@repo/protocol/contracts";4+import { explain } from "@repo/protocol/render";5+import { Effect } from "effect";6+7+import { commands } from "../src/features/agents/catalog.ts";8+import {9+ EXAMPLE,10+ EXAMPLE_REFUSALS,11+} from "../src/features/landing/transcript.ts";12+import { readTourLive } from "../src/features/tour/read.ts";13+import { STEPS, TourView } from "../src/features/tour/tour-page.tsx";14+import { EXAMPLE_NOTE, TOUR_LEDE } from "../src/features/tour/words.ts";15+import { Route, tourHead } from "../src/routes/tour.tsx";16+import { allInOrder, textIn } from "./markup.ts";17+import { platformWith, unreachablePlatform } from "./platform.ts";18+import { renderAt } from "./render.tsx";19+20+const PLATFORM = "https://platform.example.workers.dev";21+22+const BOTH = { asks: true, landings: true };23+24+const NEITHER = { asks: false, landings: false };25+26+const pageWith = (live: { asks: boolean; landings: boolean }) =>27+ renderAt("/tour", <TourView live={live} platformUrl={PLATFORM} />);28+29+const hrefsOf = (markup: string) =>30+ [...markup.matchAll(/<a\b[^>]*href="(?<href>[^"]+)"/gu)].map(31+ (found) => found.groups?.href32+ );33+34+/** Each step's markup, by its id. */35+const stepsOf = (markup: string) =>36+ new Map(37+ [38+ ...markup.matchAll(39+ /<li\b[^>]*data-step="(?<id>[^"]+)"[\s\S]*?(?=<li\b[^>]*data-step=|<\/ol>)/gu40+ ),41+ ].map(([step, id]) => [id, step])42+ );43+44+/** A `myr` command's words: its path and flags, as `commandDocs` lists them. */45+const partsOf = (command: string) => {46+ const [, ...words] = command.split(/\s+/u);47+48+ return {49+ flags: words50+ .filter((word) => word.startsWith("--"))51+ .map((word) => word.split("=")[0] ?? word),52+ name: words[0] ?? "",53+ };54+};55+56+describe(TourView, () => {57+ it.effect("walks six steps, each with its numbered command, in order", () =>58+ Effect.gen(function* () {59+ const markup = yield* pageWith(NEITHER);60+ const steps = stepsOf(markup);61+62+ expect([...steps.keys()]).toStrictEqual([63+ "find",64+ "read",65+ "claim",66+ "refused",67+ "land",68+ "credit",69+ ]);70+ expect(71+ allInOrder(72+ textIn(markup),73+ STEPS.map(({ command }) => command)74+ )75+ ).toBeTruthy();76+ // One command box per step; the keys number them once the page has a registry, which the server has not.77+ expect(markup.match(/<code class="[^"]*select-all"/gu)).toHaveLength(6);78+ })79+ );80+81+ it("gives each CLI command only flags the command list says it takes", () => {82+ const wrong = STEPS.flatMap(({ command }) => {83+ if (!command.startsWith(`${Brand.cli} `)) {84+ return [];85+ }86+87+ const { flags, name } = partsOf(command);88+ const doc = commands.find(({ path }) => path.join(" ") === name);89+90+ if (doc === undefined) {91+ return [`${command}: no such command`];92+ }93+94+ return flags95+ .filter((flag) => !doc.flags.includes(flag))96+ .map((flag) => `${command}: ${name} takes no ${flag}`);97+ });98+99+ expect(wrong).toStrictEqual([]);100+ });101+102+ it.effect(103+ "prints the refusal as the one renderer gives it, through git, with its next command and whether retrying helps",104+ () =>105+ Effect.gen(function* () {106+ const refused = textIn(107+ stepsOf(yield* pageWith(NEITHER)).get("refused") ?? ""108+ );109+110+ for (const line of explain(EXAMPLE_REFUSALS)) {111+ expect(refused).toContain(`remote: ${line}`);112+ }113+114+ expect(refused).toContain(`remote: next: ${Brand.cli} check`);115+ expect(refused).toContain("remote: retryable: no");116+ expect(refused).toContain(117+ ` ! [remote rejected] HEAD -> main (OutOfScope)`118+ );119+ })120+ );121+122+ it.effect(123+ "draws the first screens with the real components over the example: the ask's row, its brief and territory, and the claim's receipt",124+ () =>125+ Effect.gen(function* () {126+ const markup = yield* pageWith(NEITHER);127+ const steps = stepsOf(markup);128+ const text = (id: string) => textIn(steps.get(id) ?? "");129+130+ expect(steps.get("find")).toContain(`data-ask="${EXAMPLE.ask}"`);131+ expect(text("find")).toContain(132+ "parseISO accepts ISO week dates such as 2026-W41-3."133+ );134+ expect(135+ ["Current behaviour", "Territory and check"].filter(136+ (heading) => !text("read").includes(heading)137+ )138+ ).toStrictEqual([]);139+ expect(text("claim")).toContain(140+ `You hold the claim on ${EXAMPLE.ask} in ${EXAMPLE.project} until`141+ );142+ expect(text("claim")).toContain(143+ `${PLATFORM}/datekit--parse-iso--alice.git`144+ );145+ })146+ );147+148+ it.effect(149+ "draws the landing as the push's receipt over the seven stages, then the credit trailers with the agent set apart, on an example it names as fictional",150+ () =>151+ Effect.gen(function* () {152+ const markup = yield* pageWith(NEITHER);153+ const steps = stepsOf(markup);154+ const text = (id: string) => textIn(steps.get(id) ?? "");155+156+ expect(text("land")).toContain("remote: checking parse-iso at 1a2b3c4");157+ expect([158+ ...(steps.get("land") ?? "").matchAll(/data-stage="[^"]+"/gu),159+ ]).toHaveLength(7);160+ expect(161+ allInOrder(text("credit"), [162+ `Asked-by: ${EXAMPLE.asker}`,163+ `Signed-off-by: ${EXAMPLE.claimant}`,164+ "Agents used, disclosed and not credit",165+ "Assisted-by: claude-code:haiku (claimed)",166+ ])167+ ).toBeTruthy();168+ expect(textIn(markup)).toContain(EXAMPLE_NOTE);169+ })170+ );171+172+ it.effect(173+ "points at the live asks and landings only when the platform has any",174+ () =>175+ Effect.gen(function* () {176+ const both = yield* pageWith(BOTH);177+ const neither = yield* pageWith(NEITHER);178+179+ expect(180+ hrefsOf(both).filter((href) => href === "/#landing-now")181+ ).toHaveLength(1);182+ expect(both.match(/data-live=""/gu)).toHaveLength(2);183+ expect(neither).not.toContain('data-live=""');184+ expect(hrefsOf(neither)).toContain("/asks");185+ expect(hrefsOf(neither)).toContain("/install");186+ })187+ );188+189+ it("is drawn in the site shell, and unfurls with its own sentence", () => {190+ expect(Route.options.staticData?.shell).toBe("site");191+ expect(tourHead().meta).toContainEqual({192+ content: TOUR_LEDE,193+ name: "description",194+ });195+ });196+});197+198+describe("what the tour can point at, read on the server", () => {199+ it.effect("is nothing while the platform lists no ask and no landing", () =>200+ Effect.gen(function* () {201+ const live = yield* readTourLive.pipe(202+ Effect.provide(203+ platformWith(204+ Contracts.toLayerHandler("frontPage", () =>205+ Effect.succeed({ entries: [] })206+ ),207+ Contracts.toLayerHandler("recentLandings", () =>208+ Effect.succeed({ landings: [] })209+ )210+ )211+ )212+ );213+214+ expect(live).toStrictEqual(NEITHER);215+ })216+ );217+218+ it.effect(219+ "is nothing, and never fails, when the platform did not answer",220+ () =>221+ Effect.gen(function* () {222+ const live = yield* readTourLive.pipe(223+ Effect.provide(unreachablePlatform)224+ );225+226+ expect(live).toStrictEqual(NEITHER);227+ })228+ );229+});modified:packages/agent-kit/src/docs/start-here.ts+1 added
36 unmodified lines37 "```",38 "",39 "## Where next",40 "",41+ "- [Take the tour](/tour): the loop in six steps, on an example project, each with its command.",42 "- [The open asks](/asks), across every project.",43 "- [Answer an ask](/docs/answer-an-ask), from finding one to reading its verdict.",44 "- [Run a project](/docs/run-a-project): make one, write its config folder, open asks and decide.",45 "- [Connect an agent](/docs/connect-an-agent) over MCP, the CLI or a skill.",5 unmodified linesmodified:packages/project/src/project.ts+6 added-1 removed
3043 unmodified lines3044 lanes: input.report?.lanes ?? [],3045 now: input.now,3046 outcome: outcomeOf(state),3047 policy: known.value.policy,3048- stage: command.refusals.length > 0 ? "checks" : "human",3048+ // The stage the report names, as the metric reads it: the landing3049+ // guard refuses at `shape`, a cheap lane at `cheap`.3050+ stage:3051+ command.refusals.length > 03052+ ? refusingStageOf(before, input.report)3053+ : "human",3054 }),3055 (made) => ({ fresh: true, verdict: Option.some(made) })3056 );3057 };2471 unmodified linesmodified:packages/protocol/src/ids.ts+1 added
209 unmodified lines210 "rpc",211 "settings",212 "terms",213 "today",214+ "tour",215 ] as const;216 217 const isReservedOwner = (owner: string) =>218 reservedProjectNames.some((reserved) => reserved === owner);274 unmodified linesmodified:packages/protocol/test/project-name.test.ts+1 added
154 unmodified lines155 "inbox",156 "install",157 "settings",158 "today",159+ "tour",160 ])161 );162 });163 104 unmodified lines