Skip to content
Myr

Merge web/controls-not-commands into main

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

authored by oscabriel · committed by oscabriel · parents 83ea953, 0e2977c · Browse files · 88 files+2423 added−1970 removed
This commit

State

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

Diff stats

88 files+2423 added−1970 removed

  • tests:+1073 added−623 removed
  • other:+1350 added−1347 removed

88 files+2423 added−1970 removed

modified:apps/web/public/icons/icon-192.pngbinary

A binary file, modified.

modified:apps/web/public/icons/icon-512.pngbinary

A binary file, modified.

modified:apps/web/public/icons/icon.svg+2 added-12 removed
1<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">2 <!-- The repeat button emoji, drawn as text by the reader's emoji font, then set in the palette: its greys3 mapped to the ink, the sage primary and white, so no platform's own colour (Noto's is orange) shows. -->4 <filter id="palette" color-interpolation-filters="sRGB">5 <feColorMatrix type="saturate" values="0"/>6 <feComponentTransfer>7 <feFuncR type="table" tableValues="0.102 0.404 0.404 1"/>8 <feFuncG type="table" tableValues="0.122 0.478 0.478 1"/>9 <feFuncB type="table" tableValues="0.180 0.427 0.427 1"/>10 </feComponentTransfer>11 </filter>12 <rect width="512" height="512" fill="#f8f7f4"/>13 <text x="256" y="256" font-size="240" text-anchor="middle" dominant-baseline="central" filter="url(#palette)" font-family="'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif">🔁</text>2 <!-- The repeat button emoji, drawn as text by the reader's emoji font, filling the square: no ground of its own. -->3 <text x="256" y="255" font-size="452" text-anchor="middle" dominant-baseline="central" font-family="'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif">🔁</text>4</svg>
modified:apps/web/public/apple-touch-icon.pngbinary

A binary file, modified.

modified:apps/web/public/favicon.icobinary

A binary file, modified.

added:apps/web/src/client/claim.ts+52 added
modified:apps/web/src/client/discussion.ts+20 added-1 removed
added:apps/web/src/client/evidence.ts+22 added
added:apps/web/src/client/finish.ts+33 added
modified:apps/web/src/features/agents/manifest.ts+7 added-8 removed
modified:apps/web/src/features/answer/answer-page.tsx+43 added-30 removed
1import { Brand } from "@repo/brand";1import type {2 HeldBackResult,3 LaneOutcome,4 LaneResult,
6 unmodified lines
11import { ChecksFailed } from "@repo/protocol/refusal";12import type { DateTime } from "effect";13import { ArrowRight, ChevronDown, LockKeyhole } from "lucide-react";14import { useState } from "react";15import type { ComponentType } from "react";1617import { Region } from "../ask/fields.tsx";18import { commitHref, shortSha } from "../code/paths.ts";19import type { AskProgress, Round } from "../shared/ask-progress.ts";20import { CommandLine } from "../shared/command.tsx";20import { CompactCredit, CreditTrailers } from "../shared/credits.tsx";21import { EmptyState } from "../shared/empty.tsx";22import {23 ClaimFacts,
14 unmodified lines
38import { Workspace } from "../shared/shell/workspace.tsx";39import { readStatus, StatusLine } from "../shared/status-line.tsx";40import type { StatusSubject } from "../shared/status-line.tsx";41import { distanceInWords, When } from "../shared/time.tsx";42import type { LogReaderProps } from "./lane-log.tsx";43import {44 deleteChildOf,45 familyHead,46 holdsOf,
32 unmodified lines
79 { label: ask.id, mono: true, to: askPath(ask.project, ask.id) },80 { label: "Answer" },81];8283/** Reads a kept log in the browser; absent, the page only says it is kept. */84export type LogReader = ComponentType<LogReaderProps>;8586interface Reading {87 readonly LogReader?: LogReader | undefined;88 readonly project: ProjectName;89}9091const LaneLog = ({92 lane,85 project,93 reading: { LogReader, project },94}: {95 readonly lane: LaneResult;88 readonly project: Ask["project"];96 readonly reading: Reading;97}) => {98 if (lane.logRef === undefined) {99 return null;100 }10194 return lane.logRef === ChecksFailed.withheld ? (95 <p className="text-ui text-muted-foreground">96 Its log was not kept: it held a write-only value.97 </p>98 ) : (99 <CommandLine100 command={`${Brand.cli} evidence ${lane.logRef} --project ${project}`}101 />102 if (lane.logRef === ChecksFailed.withheld) {103 return (104 <p className="text-ui text-muted-foreground">105 Its log was not kept: it held a write-only value.106 </p>107 );108 }109110 return (111 <div className="flex min-w-0 flex-col gap-2">112 <p className="text-ui text-muted-foreground">113 Its log is kept for the answerer and the project&apos;s maintainers.114 </p>115 {LogReader === undefined ? null : (116 <LogReader lane={lane.lane} logRef={lane.logRef} project={project} />117 )}118 </div>119 );120};121122const LaneRow = ({123 lane,107 project,124 reading,125}: {126 readonly lane: LaneResult;110 readonly project: Ask["project"];127 readonly reading: Reading;128}) => {129 const { mark, tone, word } = results[lane.result];130131 return (
18 unmodified lines
150 </span>151 </div>152 {lane.result === "passed" ? null : (153 <div className="pl-7">137 <LaneLog lane={lane} project={project} />154 <LaneLog lane={lane} reading={reading} />155 </div>156 )}157 </li>158 );
6 unmodified lines
165166export const Lanes = ({167 checking = false,168 lanes,152 project,169 reading,170}: {171 readonly lanes: readonly LaneResult[];155 readonly project: Ask["project"];172 readonly reading: Reading;173 readonly checking?: boolean;174}) => {175 if (lanes.length === 0) {176 return (
15 unmodified lines
192 aria-label="Lanes that did not pass"193 className="border-rule border-t"194 >195 {open.map((lane) => (179 <LaneRow key={lane.lane} lane={lane} project={project} />196 <LaneRow key={lane.lane} lane={lane} reading={reading} />197 ))}198 </ul>199 )}200 {passed.length === 0 ? null : (
10 unmodified lines
211 />212 </summary>213 <ul aria-label="Lanes that passed" className="border-rule border-t">214 {passed.map((lane) => (198 <LaneRow key={lane.lane} lane={lane} project={project} />215 <LaneRow key={lane.lane} lane={lane} reading={reading} />216 ))}217 </ul>218 </details>219 )}
142 unmodified lines
362 }363364 if (ask.state === "open") {365 return (349 <EmptyState350 command={`${Brand.cli} claim ${ask.id} --project ${ask.project}`}351 title="Nobody has answered this ask yet."352 />366 <EmptyState onward={toAsk} title="Nobody has answered this ask yet." />367 );368 }369370 return (
56 unmodified lines
427428const Run = ({429 holds,430 landing,431 LogReader,432 now,433 round,434 verdict,435}: {436 readonly holds: ReturnType<typeof holdsOf>;437 readonly landing: LandingView | undefined;438 readonly LogReader: LogReader | undefined;439 readonly now: DateTime.Utc;440 readonly round: ReturnType<typeof roundOf>;441 readonly verdict: Verdict;442}) => (
29 unmodified lines
472 <Region id="answer-lanes" title="Lanes">473 <Lanes474 checking={Outcome.isAnyOf(["Checking"])(verdict.outcome)}475 lanes={verdict.lanes}460 project={verdict.project}476 reading={{ LogReader, project: verdict.project }}477 />478 </Region>479480 {verdict.heldBack.length === 0 ? null : (
50 unmodified lines
531 ? {}532 : { heldBack: landing.heldBackTrailer })}533 />534 </div>519 <div className="flex min-w-0 flex-col gap-1.5">520 <span className="text-label text-muted-foreground">521 In a clone of {landing.project}522 </span>523 <CommandLine command={`git show ${landing.sha}`} />524 </div>535 <AppLink536 className="text-ui flex items-center gap-1.5 self-start font-medium no-underline hover:underline"537 to={commitHref(landing.project, landing.sha)}538 >
23 unmodified lines
562 readonly parent?: Ask | undefined;563 readonly head?: CommitSha | undefined;564 readonly stamp?: boolean;565 readonly viewer?: Handle | undefined;566 readonly LogReader?: LogReader | undefined;567}568569const NONE: ReadonlyMap<AskId, AskProgress> = new Map();570
95 unmodified lines
666export const AnswerView = ({667 ask,668 head,669 landing,670 LogReader,671 now,672 parent,673 stamp = false,674 states = NONE,
82 unmodified lines
757 {verdict === undefined ? null : (758 <Run759 holds={holdsOf(verdict, landing, progress?.rounds ?? [])}760 landing={landing}761 LogReader={LogReader}762 now={now}763 round={roundOf(progress?.rounds ?? [], verdict.head)}764 verdict={verdict}765 />
4 unmodified lines
added:apps/web/src/features/answer/lane-log.tsx+100 added
1/**2 * A failed lane's log, read when its reader asks. The contract lets in the3 * answer's own claimant and the project's maintainers; anyone else hears the4 * refusal. The text is the check's own output, so it is shown as text only.5 */6import { useAtom, useAtomValue } from "@effect/atom-react";7import type { ProjectName } from "@repo/protocol/ids";8import { useLocation } from "@tanstack/react-router";9import { Option } from "effect";10import { AsyncResult } from "effect/reactivity";1112import { evidenceAtom } from "../../client/evidence.ts";13import type { Evidence } from "../../client/evidence.ts";14import { Button } from "../../components/ui/button.tsx";15import { hereOf, signInHref } from "../auth/session-slot.tsx";16import { whoAtom } from "../auth/who.ts";17import { CallFailure } from "../shared/call-failure.tsx";1819const LINK = "decoration-rule font-medium underline hover:decoration-current";2021export interface LogReaderProps {22 readonly lane: string;23 readonly logRef: string;24 readonly project: ProjectName;25}2627const Log = ({ evidence }: { readonly evidence: Evidence }) => (28 <figure className="flex min-w-0 flex-col gap-1.5" data-log={evidence.lane}>29 <figcaption className="text-label text-muted-foreground">30 The log of {evidence.lane}31 {evidence.truncated ? ". Truncated: the last 256 KiB." : ""}32 </figcaption>33 <pre className="border-rule bg-surface text-mono leading-terminal max-h-[32rem] overflow-auto border p-3 font-mono [overflow-wrap:anywhere] whitespace-pre-wrap">34 {evidence.text}35 </pre>36 </figure>37);3839export const LaneLogView = ({40 here,41 onShow,42 result,43 signedOut,44}: {45 readonly here: string;46 readonly onShow: () => void;47 readonly result: AsyncResult.AsyncResult<Evidence, unknown>;48 readonly signedOut: boolean;49}) => {50 if (AsyncResult.isSuccess(result)) {51 return <Log evidence={result.value} />;52 }5354 if (signedOut) {55 return (56 <p className="text-ui">57 <a className={LINK} href={signInHref(here)}>58 Sign in to read the log59 </a>60 </p>61 );62 }6364 return (65 <div className="flex min-w-0 flex-col items-start gap-2">66 <Button67 disabled={result.waiting}68 onClick={onShow}69 size="sm"70 type="button"71 variant="outline"72 >73 {result.waiting ? "Reading the log…" : "Show the log"}74 </Button>75 {AsyncResult.isFailure(result) ? (76 <div aria-live="polite" className="w-full">77 <CallFailure cause={result.cause} doing="read the log" here={here} />78 </div>79 ) : null}80 </div>81 );82};8384/** The answer's route draws this one; the page's own tests draw none. */85export const EvidenceLog = ({ logRef, project }: LogReaderProps) => {86 const [result, show] = useAtom(evidenceAtom(logRef));87 const who = useAtomValue(whoAtom);88 const here = useLocation({ select: hereOf });8990 return (91 <LaneLogView92 here={here}93 onShow={() => {94 show({ project, ref: logRef });95 }}96 result={result}97 signedOut={AsyncResult.isSuccess(who) && Option.isNone(who.value)}98 />99 );100};
modified:apps/web/src/features/ask/ask-page.tsx+21 added-15 removed
1import { Brand } from "@repo/brand";1import type { Verdict } from "@repo/protocol/domain/answer";2import type { Ask } from "@repo/protocol/domain/ask";3import { CheckSpec } from "@repo/protocol/domain/check";4import { Outcome } from "@repo/protocol/domain/outcome";
21 unmodified lines
26 PostureFacts,27 TakeItFacts,28 TerritoryFacts,29} from "../shared/facts.tsx";30import type { ClaimControl } from "../shared/facts.tsx";31import { FamilyStrip } from "../shared/family.tsx";32import { HandleLink } from "../shared/handle.tsx";33import { AppLink } from "../shared/link.tsx";34import { answerPath, askPath } from "../shared/paths.ts";
23 unmodified lines
58 { label: "Asks", to: `/${ask.project}` },59 { label: ask.id, mono: true },60];6162export const claimCommand = (ask: Ask) =>63 `${Brand.cli} claim ${ask.id} --project ${ask.project}`;6462const CheckSummary = ({ ask }: { readonly ask: Ask }) =>63 CheckSpec.match(ask.check, {64 LintToZero: ({ rule, territory }) => (65 <>
269 unmodified lines
335export interface AskViewProps {336 readonly ask: Ask;337 readonly brief: string;338 readonly now: DateTime.Utc;342 readonly platformUrl: string;339 readonly states?: ReadonlyMap<AskId, AskProgress>;340 readonly parent?: Ask | undefined;341 readonly verdict?: Verdict | undefined;342 readonly check?: CheckSource | undefined;343 readonly posture?: Posture | undefined;344 readonly viewer?: Handle | undefined;345 /** Claiming and releasing from the page; read-only without it. */346 readonly control?: ClaimControl | undefined;347 /** Who claimed it from this page, before the project's events say so. */348 readonly claimedHere?: Handle | undefined;349}350351const subjectOf = (352 ask: Ask,
72 unmodified lines
425};426427const AskFacts = ({428 ask,429 claimedHere,430 control,431 now,432 parent,431 platformUrl,433 posture,434 states,435 viewer,436}: {437 readonly ask: Ask;438 readonly claimedHere: Handle | undefined;439 readonly control: ClaimControl | undefined;440 readonly now: DateTime.Utc;441 readonly parent: Ask | undefined;439 readonly platformUrl: string;442 readonly posture: Posture | undefined;443 readonly states: ReadonlyMap<AskId, AskProgress>;444 readonly viewer: Handle | undefined;445}) => {444 const { held, progress, takeable } = standing(ask, states, parent);446 const standingNow = standing(ask, states, parent);447 const { progress } = standingNow;448 const claimant = progress?.claimant ?? claimedHere;449 const takeable = standingNow.takeable && claimedHere === undefined;450 const held = standingNow.held || claimedHere !== undefined;451452 return (453 <>448 {takeable ? <TakeItFacts ask={ask} platformUrl={platformUrl} /> : null}454 {takeable ? <TakeItFacts ask={ask} control={control} /> : null}455 {!takeable && held && ask.state !== "closed" ? (456 <ClaimFacts457 control={control}458 now={now}452 {...(progress?.claimant === undefined453 ? {}454 : { claimant: progress.claimant })}459 {...(claimant === undefined ? {} : { claimant })}460 {...(progress?.lastPush === undefined461 ? {}462 : { lastPush: progress.lastPush })}463 {...(viewer === undefined ? {} : { viewer })}
74 unmodified lines
538export const AskView = ({539 ask,540 brief,541 check,542 claimedHere,543 control,544 now,545 parent,539 platformUrl,546 posture,547 states = NONE,548 verdict,549 viewer,
11 unmodified lines
561 crumbs={askCrumbs(ask)}562 facts={563 <AskFacts564 ask={ask}565 claimedHere={claimedHere}566 control={control}567 now={now}568 parent={parent}561 platformUrl={platformUrl}569 posture={posture}570 states={states}571 viewer={viewer}572 />
30 unmodified lines
603 </>604 }605 said606 title={ask.brief.want}600 {...(takeable ? { primaryCommand: claimCommand(ask) } : {})}607 >608 <Brief ask={ask} />609610 <Region id="ask-check" title="The check">
16 unmodified lines
modified:apps/web/src/features/code/refs-view.tsx+8 added-25 removed
6 unmodified lines
7import { defaultStringifySearch } from "@tanstack/react-router";8import { Option } from "effect";9import type { ReactNode } from "react";1011import { CommandLine } from "../shared/command.tsx";11import { EmptyState } from "../shared/empty.tsx";12import { FactBlock } from "../shared/facts.tsx";13import { HandleLink } from "../shared/handle.tsx";14import { AppLink } from "../shared/link.tsx";
255 unmodified lines
270271const noTags = (only: string | undefined) =>272 only === undefined ? "No tags." : `No tags for ${only}.`;273275const Facts = ({276 platformUrl,277 project,278}: {279 readonly platformUrl: string;280 readonly project: Refs["project"];281}) => (282 <>283 <FactBlock label="Clone it">284 <CommandLine285 command={`git clone ${platformUrl}/${project}.git`}286 numbered287 />288 </FactBlock>289 <FactBlock label="Claim forks">290 <p className="text-ui text-muted-foreground">291 A claim fork is the copy a claim gives its claimant, the one place their292 answer is pushed.293 </p>294 </FactBlock>274const Facts = () => (275 <FactBlock label="Claim forks">276 <p className="text-ui text-muted-foreground">277 A claim fork is the copy a claim gives its claimant, the one place their278 answer is pushed.279 </p>280 </FactBlock>295 </>281);282283export const RefsView = ({284 from = 0,285 package: only,301 platformUrl,286 refs,287}: {288 readonly from?: number | undefined;289 readonly package?: string | undefined;306 readonly platformUrl: string;290 readonly refs: Refs;291}) => {292 const { forks, landed, project } = refs;293 const packages = packagesOf(refs.tags);
10 unmodified lines
304 const working = forks.filter((fork) => fork.kind === "working");305306 return (307 <Workspace325 facts={<Facts platformUrl={platformUrl} project={project} />}308 facts={<Facts />}309 factsHeading="These refs"310 meta={311 <MetaLine312 parts={[
81 unmodified lines
modified:apps/web/src/features/decision/decision-page.tsx-4 removed
1import { Brand } from "@repo/brand";1import type { Ask } from "@repo/protocol/domain/ask";2import { DecisionSubject } from "@repo/protocol/domain/decision";3import type { Decision } from "@repo/protocol/domain/decision";4import type { DecisionId, ProjectName } from "@repo/protocol/ids";
5 unmodified lines
10import { MarkerNote } from "../finish/annotation.tsx";11import type { PatchFile } from "../finish/files.ts";12import { FinishPlainDiff } from "../finish/finish-plain.tsx";13import type { LineNote } from "../finish/finish-plain.tsx";15import { CommandLine } from "../shared/command.tsx";14import { EmptyState } from "../shared/empty.tsx";15import { FactBlock, PostureFacts } from "../shared/facts.tsx";16import { HandleLink } from "../shared/handle.tsx";17import { AppLink } from "../shared/link.tsx";
142 unmodified lines
160 Who decides in {project}161 </AppLink>162 </p>163 {children}166 <CommandLine command={`${Brand.cli} today --project ${project}`} />164 </div>165);166167export interface DecisionViewProps {
121 unmodified lines
289 ),290 NotOnToday: () => (291 <Apart data={data}>292 <EmptyState296 command={`${Brand.cli} today --project ${data.project}`}293 title={`Decision ${data.decision} is not on your Today: it was decided, or it expired to its default.`}294 />295 </Apart>296 ),
28 unmodified lines
modified:apps/web/src/features/discussion/discussion-view.tsx+26 added-12 removed
1import { Brand } from "@repo/brand";1import type {2 Discussion,3 DiscussionPost,4} from "@repo/protocol/domain/discussion";5import type { DateTime } from "effect";6import type { ReactNode } from "react";79import { CommandLine } from "../shared/command.tsx";8import { FactBlock } from "../shared/facts.tsx";9import { HandleLink } from "../shared/handle.tsx";10import { AppLink } from "../shared/link.tsx";11import { askPath } from "../shared/paths.ts";12import { Workspace } from "../shared/shell/workspace.tsx";13import { When } from "../shared/time.tsx";16import { replyCommand, STATE_LABEL } from "./discussions-view.tsx";14import { STATE_LABEL } from "./discussions-view.tsx";15import { PostForm } from "./post-form.tsx";16import type { Poster } from "./post-form.tsx";1718const LINK = "decoration-rule underline hover:decoration-current";1920const Post = ({
34 unmodified lines
5556const ThreadFacts = ({ discussion }: { readonly discussion: Discussion }) => (57 <FactBlock label="This discussion">58 {discussion.state === "open" ? (59 <>60 <p className="text-ui">61 Reply from a terminal; anyone not denounced may. A maintainer may open62 an ask from the thread with{" "}63 <code className="text-mono font-mono">{`${Brand.cli} ask open <ask> --discussion ${discussion.id}`}</code>64 .65 </p>66 <CommandLine command={replyCommand(discussion)} numbered />67 </>59 <p className="text-ui">60 Anyone not denounced may reply. A maintainer may open an ask from the61 thread.62 </p>63 ) : (64 <p className="text-ui">65 {discussion.state === "closed"66 ? "This discussion is closed: it takes no more posts."
2 unmodified lines
69 )}70 </FactBlock>71);7273const ReplyHere = ({ poster }: { readonly poster: Poster }) => (74 <section75 aria-labelledby="reply-here"76 className="flex flex-col gap-3"77 data-reply=""78 >79 <h2 className="text-ui font-semibold" id="reply-here">80 Reply81 </h2>82 <PostForm {...poster} doing="reply" kind="reply" />83 </section>84);8586/** Without a `poster`, the thread alone; a closed or asked thread takes no reply. */87export const DiscussionView = ({88 discussion,89 now,90 poster,91}: {92 readonly discussion: Discussion;93 readonly now: DateTime.Utc;94 readonly poster?: Poster | undefined;95}): ReactNode => (96 <Workspace97 facts={<ThreadFacts discussion={discussion} />}98 factsHeading="This discussion"
16 unmodified lines
115 {discussion.posts.map((post, index) => (116 <Post key={index} now={now} post={post} />117 ))}118 </div>119 {poster === undefined || discussion.state !== "open" ? null : (120 <ReplyHere poster={poster} />121 )}122 </Workspace>123);
modified:apps/web/src/features/discussion/discussions-view.tsx+25 added-23 removed
1import { Brand } from "@repo/brand";1import type {2 DiscussionListing,3 DiscussionState,4} from "@repo/protocol/domain/discussion";6import type { ProjectName } from "@repo/protocol/ids";5import type { DateTime } from "effect";6import type { ReactNode } from "react";710import { CommandLine } from "../shared/command.tsx";8import { EmptyState } from "../shared/empty.tsx";9import { FactBlock } from "../shared/facts.tsx";10import { HandleLink } from "../shared/handle.tsx";11import { AppLink } from "../shared/link.tsx";12import { askPath, discussionPath } from "../shared/paths.ts";13import { Workspace } from "../shared/shell/workspace.tsx";14import { When } from "../shared/time.tsx";15import { PostForm } from "./post-form.tsx";16import type { Poster } from "./post-form.tsx";1718const LINK = "decoration-rule underline hover:decoration-current";1920const plural = (count: number, one: string, many: string) =>
5 unmodified lines
26 closed: "Closed",27 open: "Open",28} as const satisfies Record<DiscussionState, string>;2931export const openCommand = (project: ProjectName) =>32 `${Brand.cli} discussion post --project ${project} --title "<title>" --body "<post>"`;3334export const replyCommand = (35 listing: Pick<DiscussionListing, "id" | "project">36) =>37 `${Brand.cli} discussion post ${listing.id} --project ${listing.project} --body "<post>"`;3830const Row = ({31 listing,32 now,33}: {
36 unmodified lines
70 </p>71 </li>72);7383const PostFacts = ({ project }: { readonly project: ProjectName }) => (84 <FactBlock label="How to post">74const PostFacts = () => (75 <FactBlock label="Who may post">76 <p className="text-ui">86 Anyone not denounced may open a thread or reply, from a terminal. A87 discussion lands nothing itself; a maintainer may open an ask from one.77 Anyone not denounced may open a thread or reply. A discussion lands78 nothing itself; a maintainer may open an ask from one.79 </p>89 <CommandLine command={openCommand(project)} numbered />80 </FactBlock>81);8283const OpenOne = ({ poster }: { readonly poster: Poster }) => (84 <section85 aria-labelledby="open-a-discussion"86 className="flex flex-col gap-3"87 data-open-discussion=""88 >89 <h2 className="text-ui font-semibold" id="open-a-discussion">90 Open a discussion91 </h2>92 <PostForm {...poster} doing="open a discussion" kind="open" />93 </section>94);9596/** Without a `poster`, the list alone: no way to post is drawn. */97export const DiscussionsView = ({98 discussions,99 now,96 project,100 poster,101}: {102 readonly discussions: readonly DiscussionListing[];103 readonly now: DateTime.Utc;100 readonly project: ProjectName;104 readonly poster?: Poster | undefined;105}): ReactNode => (106 <Workspace107 count={plural(discussions.length, "discussion", "discussions")}104 facts={<PostFacts project={project} />}108 facts={<PostFacts />}109 factsHeading="Discussions here"110 title="Discussions"111 variant="list"112 >113 {discussions.length === 0 ? (110 <EmptyState111 command={openCommand(project)}112 title="No discussions yet. Open one from a terminal; anyone not denounced may."113 />114 <EmptyState title="No discussions yet." />115 ) : (116 <ul className="border-rule flex flex-col border-t" data-discussions="">117 {discussions.map((listing) => (118 <Row key={listing.id} listing={listing} now={now} />119 ))}120 </ul>121 )}122 {poster === undefined ? null : <OpenOne poster={poster} />}123 </Workspace>124);
added:apps/web/src/features/discussion/post-form.tsx+230 added
1import type { Handle } from "@repo/protocol/ids";2import { Option } from "effect";3import { LogIn } from "lucide-react";4import { useId, useState } from "react";5import type { ReactNode } from "react";67import { Button } from "../../components/ui/button.tsx";8import { Input } from "../../components/ui/input.tsx";9import { Spinner } from "../../components/ui/spinner.tsx";10import { Textarea } from "../../components/ui/textarea.tsx";11import { signInHref } from "../auth/session-slot.tsx";1213/** As the platform caps them: a title to 200 characters, a post to 10,000. */14const TITLE_MAX = 200;1516const BODY_MAX = 10_000;1718const LINK = "decoration-rule font-medium underline hover:decoration-current";1920const LABEL = "text-ui font-medium";2122const HINT = "text-label text-muted-foreground font-normal";2324export interface Post {25 readonly title?: string;26 readonly body?: string;27}2829/** Who is posting and how a post goes, from the page's route. */30export interface Poster {31 readonly handle: Option.Option<Handle>;32 readonly here: string;33 readonly checking?: boolean | undefined;34 readonly busy?: boolean | undefined;35 readonly onPost?: ((post: Post) => void) | undefined;36 readonly refusal?: ReactNode | undefined;37 /** Counts the posts that went through, so a sent form starts empty again. */38 readonly sent?: number | undefined;39}4041const trimmed = (text: string) => {42 const kept = text.trim();4344 return kept === "" ? undefined : kept;45};4647const Submit = ({48 busy,49 label,50 ready,51}: {52 readonly busy: boolean;53 readonly label: string;54 readonly ready: boolean;55}) => (56 <Button57 className="tablet:h-9 tablet:w-fit h-11 w-full min-w-28 px-4"58 disabled={busy || !ready}59 type="submit"60 >61 {busy ? <Spinner /> : null}62 {busy ? "Posting" : label}63 </Button>64);6566const OpenFields = ({67 busy,68 onPost,69 refusal,70}: Pick<Poster, "onPost" | "refusal"> & { readonly busy: boolean }) => {71 const id = useId();72 const [title, setTitle] = useState("");73 const [body, setBody] = useState("");74 const ready = trimmed(title) !== undefined;7576 return (77 <form78 aria-label="Open a discussion"79 className="flex max-w-(--measure) flex-col gap-4"80 data-post-form="open"81 onSubmit={(event) => {82 event.preventDefault();8384 const kept = { body: trimmed(body), title: trimmed(title) };8586 if (busy || kept.title === undefined) {87 return;88 }8990 onPost?.(91 kept.body === undefined92 ? { title: kept.title }93 : { body: kept.body, title: kept.title }94 );95 }}96 >97 <div className="flex flex-col gap-1.5">98 <label className={LABEL} htmlFor={`${id}-title`}>99 Title100 </label>101 <Input102 id={`${id}-title`}103 maxLength={TITLE_MAX}104 name="title"105 onChange={(event) => {106 setTitle(event.target.value);107 }}108 readOnly={busy}109 required110 value={title}111 />112 </div>113 <div className="flex flex-col gap-1.5">114 <label className={LABEL} htmlFor={`${id}-body`}>115 First post <span className={HINT}>(optional)</span>116 </label>117 <Textarea118 className="min-h-28"119 id={`${id}-body`}120 maxLength={BODY_MAX}121 name="body"122 onChange={(event) => {123 setBody(event.target.value);124 }}125 readOnly={busy}126 value={body}127 />128 </div>129 {refusal}130 <Submit busy={busy} label="Open discussion" ready={ready} />131 </form>132 );133};134135const ReplyFields = ({136 busy,137 onPost,138 refusal,139}: Pick<Poster, "onPost" | "refusal"> & { readonly busy: boolean }) => {140 const id = useId();141 const [body, setBody] = useState("");142 const ready = trimmed(body) !== undefined;143144 return (145 <form146 aria-label="Reply"147 className="flex max-w-(--measure) flex-col gap-4"148 data-post-form="reply"149 onSubmit={(event) => {150 event.preventDefault();151152 const kept = trimmed(body);153154 if (!busy && kept !== undefined) {155 onPost?.({ body: kept });156 }157 }}158 >159 <div className="flex flex-col gap-1.5">160 <label className={LABEL} htmlFor={`${id}-body`}>161 Your reply162 </label>163 <Textarea164 className="min-h-28"165 id={`${id}-body`}166 maxLength={BODY_MAX}167 name="body"168 onChange={(event) => {169 setBody(event.target.value);170 }}171 readOnly={busy}172 required173 value={body}174 />175 </div>176 {refusal}177 <Submit busy={busy} label="Reply" ready={ready} />178 </form>179 );180};181182/**183 * A thread is opened with a title, a reply is a body; signed out, the place184 * for the form is a way to sign in that comes back here.185 */186export const PostForm = ({187 busy = false,188 checking = false,189 doing,190 handle,191 here,192 kind,193 onPost,194 refusal,195 sent = 0,196}: Poster & {197 readonly kind: "open" | "reply";198 readonly doing: string;199}): ReactNode => {200 if (checking) {201 return (202 <output className="text-ui text-muted-foreground block">203 Checking who is signed in204 </output>205 );206 }207208 if (Option.isNone(handle)) {209 return (210 <p className="text-ui flex items-start gap-2" data-post-signin="">211 <LogIn212 aria-hidden="true"213 className="mt-0.5 size-4 shrink-0"214 strokeWidth={1.75}215 />216 <span>217 <a className={LINK} href={signInHref(here)}>218 Sign in219 </a>{" "}220 to {doing}.221 </span>222 </p>223 );224 }225226 const Fields = kind === "open" ? OpenFields : ReplyFields;227228 // A new key per sent post clears the fields.229 return <Fields busy={busy} key={sent} onPost={onPost} refusal={refusal} />;230};
added:apps/web/src/features/discussion/use-poster.tsx+81 added
1import { useAtom, useAtomValue } from "@effect/atom-react";2import type { PostDiscussion } from "@repo/protocol/contracts";3import { ownerOf } from "@repo/protocol/ids";4import type { DiscussionId, ProjectName } from "@repo/protocol/ids";5import { useLocation, useNavigate } from "@tanstack/react-router";6import { Effect, Option } from "effect";7import { AsyncResult } from "effect/reactivity";8import { useState } from "react";910import { postDiscussionAtom } from "../../client/discussion.ts";11import { hereOf } from "../auth/session-slot.tsx";12import { whoAtom } from "../auth/who.ts";13import { CallFailure } from "../shared/call-failure.tsx";14import type { Poster } from "./post-form.tsx";1516type PostPayload = typeof PostDiscussion.payloadSchema.Type;1718/**19 * Posts in `project`: a reply in `discussion` when named, else a new thread,20 * whose page it goes to once it is open. Only this page's own post is21 * answered here: the atom is shared, and another page's result is not ours.22 * A sent post clears the form from the answer itself, not from an effect.23 */24export const usePoster = (25 project: ProjectName,26 discussion?: DiscussionId27): Poster => {28 const navigate = useNavigate();29 const here = useLocation({ select: hereOf });30 const who = useAtomValue(whoAtom);31 const [posted, post] = useAtom(postDiscussionAtom, { mode: "promiseExit" });32 const [waiting, setWaiting] = useState(false);33 const [sent, setSent] = useState(0);3435 const posting = (payload: PostPayload) =>36 Effect.promise(() => post(payload)).pipe(37 Effect.flatMap((exit) => exit),38 Effect.tap(({ discussion: made }) =>39 Effect.sync(() => {40 setWaiting(false);41 setSent((count) => count + 1);4243 if (discussion === undefined) {44 void navigate({45 params: { discussion: made.id, owner: ownerOf(project), project },46 to: "/$owner/$project/discussions/$discussion",47 });48 }49 })50 ),51 Effect.ignore52 );5354 return {55 busy: waiting && posted.waiting,56 checking: !AsyncResult.isSuccess(who),57 handle: AsyncResult.isSuccess(who) ? who.value : Option.none(),58 here,59 onPost: (input) => {60 setWaiting(true);61 Effect.runFork(62 posting(63 discussion === undefined64 ? { ...input, project }65 : { ...input, discussion, project }66 )67 );68 },69 refusal:70 waiting && AsyncResult.isFailure(posted) ? (71 <div aria-live="polite">72 <CallFailure73 cause={posted.cause}74 doing={discussion === undefined ? "open a discussion" : "reply"}75 here={here}76 />77 </div>78 ) : undefined,79 sent,80 };81};
modified:apps/web/src/features/env/env-page.tsx+5 added-14 removed
2 unmodified lines
3 * required and whether it is set. Never a value, and nothing that would take4 * or show one: `setEnv` is RPC and CLI alone. Lint keeps "shape" out of code5 * names, so the prop is `schema`.6 */7import { Brand } from "@repo/brand";7import type { EnvItem, EnvSchemaView } from "@repo/protocol/domain/env";8import type { ProjectName } from "@repo/protocol/ids";9import { DateTime } from "effect";10import { LockKeyhole } from "lucide-react";11import type { ReactNode } from "react";1213import { Definition, Definitions, Region } from "../ask/fields.tsx";14import { commitHref, shortSha } from "../code/paths.ts";16import { CommandLine } from "../shared/command.tsx";15import { EmptyState } from "../shared/empty.tsx";16import { HandleLink } from "../shared/handle.tsx";17import { AppLink } from "../shared/link.tsx";18import { distanceInWords, When } from "../shared/time.tsx";
262 unmodified lines
281 </dl>282 </div>283);284287const SetValue = ({ project }: { readonly project: ProjectName }) => (288 <div className="flex flex-col gap-2">289 <p className="text-ui text-muted-foreground">290 A maintainer sets a sensitive value from a terminal; nobody reads it back.291 </p>285const SetValue = () => (286 <p className="text-ui text-muted-foreground">287 A maintainer sets a sensitive value; nobody reads it back.288 </p>292 <CommandLine293 command={`${Brand.cli} env set <KEY> --project ${project} --yes`}294 numbered295 />296 </div>289);290291const Items = ({292 now,
19 unmodified lines
312 <ItemRow item={item} key={item.key} now={seen} />313 ))}314 </ol>315 )}324 <SetValue project={schema.project} />316 <SetValue />317 </>318 );319};320
10 unmodified lines
331 <Region id="environment" title="Environment">332 <Caption />333 {schema === undefined ? (334 <EmptyState343 command={`${Brand.cli} env shape --project ${project}`}335 title={`Nothing has landed in ${project} yet, so there is no .env.schema to read. Its environment appears here once its main lands.`}336 />337 ) : (338 <Items now={now} schema={schema} />
3 unmodified lines
modified:apps/web/src/features/finish/finish-view.tsx+170 added-88 removed
1/** The web never calls `finish` itself. */2import { Brand } from "@repo/brand";3import type { Verdict } from "@repo/protocol/domain/answer";1import type { Finish } from "@repo/protocol/contracts";2import type { AnswerReceipt, Verdict } from "@repo/protocol/domain/answer";3import type { Ask } from "@repo/protocol/domain/ask";4import type { ChangedFile } from "@repo/protocol/domain/code";5import { RequestId } from "@repo/protocol/ids";6import type { CommitSha } from "@repo/protocol/ids";7import { Array as Arr, Option } from "effect";7import { Option } from "effect";8import type { DateTime } from "effect";9import { ChevronLeft, ChevronRight, FileDiff, RotateCw } from "lucide-react";10import { useState } from "react";11import type { ReactNode } from "react";
8 unmodified lines
20import { Choices, DecisionRecord, stuckAtFoot } from "../decision/choices.tsx";21import { DecisionCard, ExpiryLines } from "../decision/decision-card.tsx";22import type { DecideInput } from "../decision/decision-card.tsx";23import { describeSubject } from "../decision/subject.ts";24import { CommandLine } from "../shared/command.tsx";24import { FactBlock, GateFacts } from "../shared/facts.tsx";25import { AppLink } from "../shared/link.tsx";26import { askPath, INBOX_PATH } from "../shared/paths.ts";27import { GUTTER } from "../shared/shell/gutter.ts";
4 unmodified lines
32import type { PatchFile } from "./files.ts";33import { FinishPlainDiff } from "./finish-plain.tsx";34import type { LineNote } from "./finish-plain.tsx";35import { MarkRead } from "./mark-read.tsx";37import { FORK_LABEL } from "./patch.ts";36import { forkOf } from "./patch.ts";37import type { FinishDecision } from "./patch.ts";38import type { MarkedFile } from "./read-marks.ts";3940export { patchOf } from "./patch.ts";
1 unmodified line
42export type { FinishDecision } from "./patch.ts";4344const LINK = "decoration-rule underline hover:decoration-current";4547const remoteOf = (decision: FinishDecision, platformUrl: string) =>48 Arr.findFirst(decision.evidence, ({ label }) => label === FORK_LABEL).pipe(49 Option.map(50 ({ href, value }) => href ?? `${platformUrl}/${value.trim()}.git`51 ),52 Option.getOrElse(53 () =>54 `${platformUrl}/${decision.project}--${decision.subject.ask}--<answerer>.git`55 )56 );5758export const finishLines = (59 decision: FinishDecision,60 platformUrl: string,61 verdict: Verdict | undefined62) => {63 const remote = remoteOf(decision, platformUrl);64 const { ask, head } = decision.subject;65 const base = verdict?.base ?? "<base>";6667 return [68 {69 command: `git fetch ${remote} ${head} && git switch --detach FETCH_HEAD`,70 label: "Fetch the answer's head and stand on it",71 },72 {73 command: `git push ${remote} HEAD:main`,74 label: "Commit your changes on top, then push them onto its fork",75 },76 {77 command: `${Brand.cli} finish ${ask} --project ${decision.project} --base ${base} --head $(git rev-parse HEAD) --requestId finish-$(git rev-parse HEAD) --yes`,78 label: "Hand the finish to the gate: it lands with you as Finished-by",79 },80 ] as const;81};8283const FinishLines = ({84 decision,85 platformUrl,86 verdict,87}: {88 readonly decision: FinishDecision;89 readonly platformUrl: string;90 readonly verdict: Verdict | undefined;91}) => (92 <FactBlock label="Finish it from your clone">93 <ol className="flex flex-col gap-3" data-finish-lines="">94 {finishLines(decision, platformUrl, verdict).map(({ command, label }) => (95 <li className="flex min-w-0 flex-col gap-1" key={command}>96 <p className="text-label text-muted-foreground font-normal">97 {label}98 </p>99 <CommandLine command={command} numbered />100 </li>101 ))}102 </ol>103 <p className="text-ui text-muted-foreground">104 To land the answer as it is, accept the decision instead.105 </p>106 </FactBlock>107);10846const WantFacts = ({ ask }: { readonly ask: Ask }) => (47 <FactBlock label="The ask wants">48 <p className="text-want font-normal" data-said="">49 {ask.brief.want}
7 unmodified lines
57const VerdictFacts = ({ verdict }: { readonly verdict: Verdict }) => (58 <FactBlock label={`Verdict at ${shortSha(verdict.head)}`}>59 <div className="flex flex-col gap-2" data-outcome={verdict.outcome._tag}>60 <StatusLine124 command={false}61 subject={{62 kind: "answer",63 outcome: verdict.outcome,64 project: verdict.project,
3 unmodified lines
68 </div>69 </FactBlock>70);7172export type FinishInput = typeof Finish.payloadSchema.Type;7374export interface FinishViewProps {75 readonly decision: FinishDecision;76 readonly ask?: Ask | undefined;77 readonly verdict?: Verdict | undefined;140 readonly platformUrl: string;78 readonly now: DateTime.Utc;79 readonly onDecide: (input: DecideInput) => void;80 readonly busy?: boolean;81 readonly soon?: boolean;
10 unmodified lines
92 readonly draw?: boolean;93 readonly filesButton?: ReactNode;94 readonly stamp?: boolean;95 readonly failure?: ReactNode;96 /** The answer fork's newest commit; undefined while it is read, none when it could not be. */97 readonly forkHead?: Option.Option<CommitSha> | undefined;98 readonly onReadFork?: (() => void) | undefined;99 readonly onFinish?: ((input: FinishInput) => void) | undefined;100 readonly finishing?: boolean;101 readonly finished?: AnswerReceipt | undefined;102 readonly finishFailure?: ReactNode;103}104105const NO_FILES: ReadonlySet<string> = new Set();106
322 unmodified lines
429 )}430 {verdict === undefined ? null : (431 <div data-outcome={verdict.outcome._tag}>432 <StatusLine489 command={false}433 subject={{434 kind: "answer",435 outcome: verdict.outcome,436 project: verdict.project,
24 unmodified lines
461 )}462 </div>463);464465const ForkHeadLine = ({466 answer,467 forkHead,468}: {469 readonly answer: CommitSha;470 readonly forkHead: Option.Option<CommitSha> | undefined;471}) => {472 if (forkHead === undefined) {473 return (474 <p className="text-ui text-muted-foreground">475 Reading the fork&apos;s head…476 </p>477 );478 }479480 if (Option.isNone(forkHead)) {481 return (482 <p className="text-ui text-muted-foreground">483 The fork&apos;s head could not be read.484 </p>485 );486 }487488 const head = forkHead.value;489490 return head === answer ? (491 <p className="text-ui text-muted-foreground" data-fork-head={head}>492 Nothing is on top of the answer yet: the fork&apos;s head is still{" "}493 <code className="text-mono font-mono">{shortSha(head)}</code>.494 </p>495 ) : (496 <p className="text-ui" data-fork-head={head}>497 The fork&apos;s head is{" "}498 <code className="text-mono font-mono">{shortSha(head)}</code>, on top of499 the answer.500 </p>501 );502};503504/** A head on top of the answer's, with the verdict's base to finish from. */505export const finishInput = (506 decision: FinishDecision,507 verdict: Verdict | undefined,508 forkHead: Option.Option<CommitSha> | undefined509): Option.Option<FinishInput> =>510 Option.flatMap(511 Option.filter(512 Option.flatten(Option.fromUndefinedOr(forkHead)),513 (head) => head !== decision.subject.head514 ),515 (head) =>516 Option.map(Option.fromUndefinedOr(verdict), ({ base }) => ({517 ask: decision.subject.ask,518 base,519 head,520 project: decision.project,521 requestId: RequestId.make(`finish-${head}`),522 }))523 );524525const FinishItFacts = ({526 decision,527 finishFailure,528 finished,529 finishing = false,530 forkHead,531 onFinish,532 onReadFork,533 verdict,534}: Pick<535 FinishViewProps,536 | "decision"537 | "finishFailure"538 | "finished"539 | "finishing"540 | "forkHead"541 | "onFinish"542 | "onReadFork"543 | "verdict"544>) => {545 const fork = forkOf(decision);546 const input = finishInput(decision, verdict, forkHead);547548 return (549 <FactBlock label="Finish it">550 <p className="text-ui">551 To finish it with your own changes, push your commits onto the552 answer&apos;s fork, on top of its head, then finish it here. They are553 checked again, and you are credited as Finished-by.554 </p>555 {Option.isSome(fork) ? (556 <p className="text-ui text-muted-foreground">557 The fork:{" "}558 <code className="text-mono text-foreground font-mono [overflow-wrap:anywhere]">559 {fork.value}560 </code>561 </p>562 ) : null}563 <ForkHeadLine answer={decision.subject.head} forkHead={forkHead} />564 <div className="flex flex-wrap items-center gap-2">565 <Button566 data-action="finish"567 disabled={finishing || onFinish === undefined || Option.isNone(input)}568 onClick={() => {569 if (Option.isSome(input)) {570 onFinish?.(input.value);571 }572 }}573 size="sm"574 >575 Finish with these commits576 </Button>577 {onReadFork === undefined ? null : (578 <Button onClick={onReadFork} size="sm" variant="outline">579 <RotateCw aria-hidden="true" strokeWidth={1.75} />580 Read the fork again581 </Button>582 )}583 </div>584 {finished === undefined ? null : (585 <div data-finished={finished.head}>586 <StatusLine587 subject={{588 kind: "answer",589 outcome: finished.outcome,590 project: finished.project,591 }}592 />593 </div>594 )}595 <Failure>{finishFailure}</Failure>596 <p className="text-ui text-muted-foreground">597 To land the answer as it is, accept the decision instead.598 </p>599 </FactBlock>600 );601};602603const FinishFacts = ({604 ask,605 busy,606 decision,607 files,608 now,609 onDecide,529 platformUrl,610 soon,611 stamp,612 verdict,613 ...finish614}: Required<615 Pick<616 FinishViewProps,536 | "busy"537 | "decision"538 | "files"539 | "now"540 | "onDecide"541 | "platformUrl"542 | "soon"543 | "stamp"617 "busy" | "decision" | "files" | "now" | "onDecide" | "soon" | "stamp"618 >619> &546 Pick<FinishViewProps, "ask" | "verdict">) => (620 Pick<621 FinishViewProps,622 | "ask"623 | "finishFailure"624 | "finished"625 | "finishing"626 | "forkHead"627 | "onFinish"628 | "onReadFork"629 | "verdict"630 >) => (631 <>632 {ask === undefined ? null : <WantFacts ask={ask} />}633 {verdict === undefined ? null : <VerdictFacts verdict={verdict} />}634 {verdict === undefined ? null : (
14 unmodified lines
649 soon={soon}650 stamp={stamp}651 />652 </FactBlock>569 <FinishLines570 decision={decision}571 platformUrl={platformUrl}572 verdict={verdict}573 />653 {decision.decided === undefined ? (654 <FinishItFacts {...finish} decision={decision} verdict={verdict} />655 ) : null}656 {files.length === 0 ? null : (657 <DiffStatsFacts stats={statsOf(files, ask?.territory.paths ?? [])} />658 )}659 </>
73 unmodified lines
733 {files.length === 0 ? (734 <p735 className={`text-ui text-muted-foreground tablet:block hidden ${GUTTER}`}736 >655 This decision carries no diff: fetch the answer&apos;s head to read656 it, with the first line in Facts.737 This decision carries no diff: read the answer&apos;s head on its738 fork.739 </p>740 ) : (741 <WideDiff {...props} {...shared} draw={draw} split={split} />742 )}
3 unmodified lines
modified:apps/web/src/features/finish/patch.ts+20 added-1 removed
1import { DecisionSubject } from "@repo/protocol/domain/decision";2import type { Decision } from "@repo/protocol/domain/decision";3import { Handle } from "@repo/protocol/ids";3import { Array as Arr, Option } from "effect";4import { Array as Arr, Option, Schema } from "effect";56export const PATCH_LABEL = "patch";78export const FORK_LABEL = "fork";
7 unmodified lines
16export const isFinishDecision = (17 decision: Decision18): decision is FinishDecision => finishes(decision.subject);1920const evidenceOf = (decision: Decision, label: string) =>21 Arr.findFirst(decision.evidence, (fact) => fact.label === label);2223const decodeHandle = Schema.decodeUnknownOption(Handle);2425/** The answerer, as the decision's `answer` evidence names them: `<handle> at <head> (<request>)`. */26export const answererOf = (decision: FinishDecision): Option.Option<Handle> =>27 Option.flatMap(evidenceOf(decision, "answer"), ({ value }) =>28 decodeHandle(value.split(" at ")[0])29 );3031/** The answer's fork, as its `fork` evidence names it: a link when it carries one, else the fork's repo. */32export const forkOf = (decision: FinishDecision): Option.Option<string> =>33 Option.map(34 evidenceOf(decision, FORK_LABEL),35 ({ href, value }) => href ?? value.trim()36 );3738export const patchOf = (decision: Decision): Option.Option<string> =>39 isFinishDecision(decision)40 ? Option.map(41 Arr.findFirst(decision.evidence, ({ label }) => label === PATCH_LABEL),
90 unmodified lines
modified:apps/web/src/features/front/facts.tsx-148 removed
1import { Brand } from "@repo/brand";2import type { Ask, AskListing } from "@repo/protocol/domain/ask";3import type { AskId, ProjectName } from "@repo/protocol/ids";4import type { Posture } from "@repo/protocol/posture";1import { ArrowRight } from "lucide-react";27import type { AskProgress } from "../shared/ask-progress.ts";8import { CommandLine } from "../shared/command.tsx";9import {10 FactBlock,11 FamilyFacts,12 PostureFacts,13 TerritoryFacts,14} from "../shared/facts.tsx";3import { AppLink } from "../shared/link.tsx";16import { askPath } from "../shared/paths.ts";17import { MetaCode } from "../shared/row.tsx";18import { FactsSkeleton } from "../shared/skeleton.tsx";19import { StatusLine } from "../shared/status-line.tsx";45const LINK = "decoration-rule underline hover:decoration-current";623export const Step = ({24 command,25 label,26}: {27 readonly command: string;28 readonly label: string;29}) => (30 <div className="flex min-w-0 flex-col gap-1">31 <p className="text-label text-muted-foreground">{label}</p>32 <CommandLine command={command} numbered />33 </div>34);357export const Onward = ({8 children,9 to,10}: {
20 unmodified lines
31);3233export const plural = (count: number, one: string, many: string) =>34 `${count} ${count === 1 ? one : many}`;6465const whoMayTake = (66 listing: AskListing,67 project: ProjectName,68 full: Ask | undefined69) => {70 if (listing.reserve === "newcomers") {71 return full?.mentor === undefined72 ? "Held for newcomers"73 : `Held for newcomers, mentored by ${full.mentor}`;74 }7576 return listing.reserve === "people"77 ? "Held for people, not agents"78 : `Anyone vouched in ${project}, or with a record in its area`;79};8081export interface SelectedFamily {82 readonly parent: Ask;83 readonly finale: AskId;84 readonly states: ReadonlyMap<AskId, AskProgress>;85}8687export interface SelectedPosture {88 readonly label: string;89 readonly posture: Posture;90}9192export const SelectedAskFacts = ({93 family,94 full,95 listing,96 platformUrl,97 posture,98 progress,99 project,100 takeable,101}: {102 readonly listing: AskListing;103 readonly project: ProjectName;104 readonly takeable: boolean;105 readonly full: Ask | undefined;106 readonly progress: AskProgress | undefined;107 readonly family: SelectedFamily | undefined;108 readonly posture: SelectedPosture | undefined;109 readonly platformUrl: string;110}) => {111 const claim = `${Brand.cli} claim ${listing.ask} --project ${project}`;112113 return (114 <>115 <FactBlock label="State">116 {full === undefined ? (117 <p className="text-want font-medium" data-said="">118 {listing.want}119 </p>120 ) : (121 <StatusLine122 command={false}123 subject={{124 ask: full,125 claimant: progress?.claimant,126 kind: "ask",127 latest: progress?.latest,128 takeable,129 }}130 />131 )}132 <p className="text-ui text-muted-foreground">133 {listing.kind} · <MetaCode>{listing.ask}</MetaCode>134 </p>135 </FactBlock>136 <FactBlock label="Take it">137 <p className="text-ui">{whoMayTake(listing, project, full)}</p>138 {takeable ? (139 <>140 <Step command={claim} label="Claim it" />141 <Step142 command={`git clone ${platformUrl}/${project}.git`}143 label="Clone the project to answer in"144 />145 <Step146 command={`${Brand.cli} check`}147 label="Check your answer before you push"148 />149 </>150 ) : (151 <p className="text-ui text-muted-foreground">152 Not open to you now: its page says why.153 </p>154 )}155 </FactBlock>156 {full === undefined ? (157 <FactsSkeleton labels={["Territory and check"]} />158 ) : (159 <TerritoryFacts ask={full} />160 )}161 {family === undefined ? null : (162 <FamilyFacts163 current={listing.ask}164 finale={family.finale}165 parent={family.parent}166 project={project}167 states={family.states}168 />169 )}170 {posture === undefined ? null : (171 <PostureFacts172 label={posture.label}173 posture={posture.posture}174 project={project}175 />176 )}177 <FactBlock label="Its page">178 <Onward to={askPath(project, listing.ask)}>Open the ask</Onward>179 </FactBlock>180 </>181 );182};
modified:apps/web/src/features/front/front-page.tsx+45 added-66 removed
1import { Brand } from "@repo/brand";1import { Reserve } from "@repo/protocol/domain/ask";2import type { Ask } from "@repo/protocol/domain/ask";3import type { ProjectEvent } from "@repo/protocol/domain/event";4import type {
10 unmodified lines
15import type { AskProgress } from "../shared/ask-progress.ts";16import { EmptyState } from "../shared/empty.tsx";17import { FamilyStrip } from "../shared/family.tsx";18import { AppLink } from "../shared/link.tsx";20import { projectPath, TOUR_PATH } from "../shared/paths.ts";19import { IMPORT_PATH, projectPath, TOUR_PATH } from "../shared/paths.ts";20import { PostureBadge } from "../shared/posture.tsx";21import { AskRow, RowGroup, useRowSelection } from "../shared/row.tsx";22import { Workspace } from "../shared/shell/workspace.tsx";23import { plural } from "./facts.tsx";
1 unmodified line
25import type { Arranged } from "./families.ts";26import { compact, countWith, filterEntries, frontPath } from "./filter.ts";27import type { FrontFilter, FrontFilterInput } from "./filter.ts";28import { EXPLAINER } from "./head.ts";30import { HOW_TO_TITLE, HowToTake, useHowTo } from "./how-to.tsx";2930export const frontCount = (shown: readonly FrontPageEntry[]) =>31 `${plural(shown.length, "open ask", "open asks")}, ${32 shown.filter(({ takeable }) => takeable).length
98 unmodified lines
131 */132const Filters = ({133 entries,134 filter,137 onRestore,135}: {136 readonly entries: readonly FrontPageEntry[];137 readonly filter: FrontFilter;141 readonly onRestore: (() => void) | undefined;138}) => {139 const held = Reserve.literals.filter(140 (reserved) =>141 entries.some(({ ask }) => ask.reserve === reserved) ||
69 unmodified lines
211 search={{ ...filter, project }}212 />213 ))}214 </Facet>219 {filtered || onRestore !== undefined ? (215 {filtered ? (216 <div className="text-ui flex flex-col items-start gap-2 px-2">221 {filtered ? (222 <AppLink className={LINK} to={frontPath({})}>223 Reset filters224 </AppLink>217 <AppLink className={LINK} to={frontPath({})}>218 Reset filters219 </AppLink>225 ) : null}226 {onRestore === undefined ? null : (227 <button228 className={`text-muted-foreground hover:text-foreground ${LINK}`}229 onClick={onRestore}230 type="button"231 >232 {HOW_TO_TITLE}233 </button>234 )}220 </div>221 ) : null}222 </nav>223 );
11 unmodified lines
235 readonly projects: readonly ProjectListing[] | undefined;236}) =>237 projects?.length === 0 ? (238 <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."239 onward={240 <>241 <AppLink className={LINK} to={IMPORT_PATH}>242 Bring a project here243 </AppLink>244 <TakeTheTour />245 </>246 }247 title="No open asks, and no project yet."248 />249 ) : (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 />250 <EmptyState onward={<TakeTheTour />} title="No open asks on any project." />251 );252253interface Group {254 readonly project: ProjectName;
103 unmodified lines
358 projects,359 stampsOf,360}: FrontPageProps) => {361 const shown = filterEntries(entries, filter);375 const { dismiss, dismissed, restore } = useHowTo();362363 const states = useMemo(364 () =>365 new Map(
29 unmodified lines
395 >396 {entries.length === 0 ? (397 <NoAsks projects={projects} />398 ) : (413 <>414 {dismissed ? null : <HowToTake onDismiss={dismiss} />}415 <div416 className="columns:grid columns:grid-cols-[var(--column-filters)_minmax(0,1fr)] flex flex-col gap-8"417 data-board=""418 >419 <Filters420 entries={entries}421 filter={filter}422 onRestore={dismissed ? restore : undefined}423 />424 <div className="flex min-w-0 flex-col gap-6" data-board-list="">425 {shown.length === 0 ? (426 <EmptyState427 onward={428 <AppLink className={LINK} to={frontPath({})}>429 Show every open ask430 </AppLink>431 }432 title="No open asks match this filter."399 <div400 className="columns:grid columns:grid-cols-[var(--column-filters)_minmax(0,1fr)] flex flex-col gap-8"401 data-board=""402 >403 <Filters entries={entries} filter={filter} />404 <div className="flex min-w-0 flex-col gap-6" data-board-list="">405 {shown.length === 0 ? (406 <EmptyState407 onward={408 <AppLink className={LINK} to={frontPath({})}>409 Show every open ask410 </AppLink>411 }412 title="No open asks match this filter."413 />414 ) : (415 groups.map((group) => (416 <ProjectGroup417 group={group}418 key={group.project}419 listing={projects?.find(420 ({ project }) => project === group.project421 )}422 now={now}423 parents={parents}424 selected={selected}425 stamps={stampsOf?.(group.project) ?? new Set()}426 />434 ) : (435 groups.map((group) => (436 <ProjectGroup437 group={group}438 key={group.project}439 listing={projects?.find(440 ({ project }) => project === group.project441 )}442 now={now}443 parents={parents}444 selected={selected}445 stamps={stampsOf?.(group.project) ?? new Set()}446 />447 ))448 )}427 ))428 )}449 </div>429 </div>451 </>430 </div>431 )}432 </Workspace>433 );434};
deleted:apps/web/src/features/front/how-to.tsx-163 removed
1/**2 * The strip of three steps above the asks, which a reader may dismiss. The3 * dismissal is kept in this browser's localStorage, never a cookie: a cookie4 * would take the page out of the edge cache (ADR 0042 says the same of the5 * theme). The server has no storage and draws the strip; a reader who6 * dismissed it sees it go once the page has read the storage.7 */8import { pushCommand } from "@repo/agent-kit/install";9import { Brand } from "@repo/brand";10import { Result } from "effect";11import { X } from "lucide-react";12import { useCallback, useId, useSyncExternalStore } from "react";1314import { Button } from "../../components/ui/button.tsx";15import { CommandLine } from "../shared/command.tsx";16import { AppLink } from "../shared/link.tsx";17import { INSTALL_PATH } from "../shared/paths.ts";18import { browserStorage } from "../shared/storage.ts";1920const DISMISSED = "asks.how-to";2122export const readHowToDismissed = (storage?: Storage): boolean =>23 storage !== undefined &&24 Result.getOrElse(25 Result.try(() => storage.getItem(DISMISSED) === "dismissed"),26 () => false27 );2829export const dismissHowTo = (storage?: Storage) => {30 Result.try(() => storage?.setItem(DISMISSED, "dismissed"));31};3233export const restoreHowTo = (storage?: Storage) => {34 Result.try(() => storage?.removeItem(DISMISSED));35};3637/** Said on this page when it changes the storage; another tab says `storage`. */38const CHANGED = "asks-how-to";3940const subscribe = (onChange: () => void) => {41 globalThis.addEventListener(CHANGED, onChange);42 globalThis.addEventListener("storage", onChange);4344 return () => {45 globalThis.removeEventListener(CHANGED, onChange);46 globalThis.removeEventListener("storage", onChange);47 };48};4950const dismissedHere = () => readHowToDismissed(browserStorage());5152const shownOnServer = () => false;5354export const useHowTo = () => {55 const dismissed = useSyncExternalStore(56 subscribe,57 dismissedHere,58 shownOnServer59 );6061 const dismiss = useCallback(() => {62 dismissHowTo(browserStorage());63 globalThis.dispatchEvent(new Event(CHANGED));64 }, []);6566 const restore = useCallback(() => {67 restoreHowTo(browserStorage());68 globalThis.dispatchEvent(new Event(CHANGED));69 }, []);7071 return { dismiss, dismissed, restore };72};7374export const HOW_TO_TITLE = "How to take an ask";7576const STEPS = [77 {78 command: `${Brand.cli} claim <ask> --project <owner>/<name>`,79 label: "Claim one you may take",80 },81 { command: `${Brand.cli} check`, label: "Check your answer before you push" },82 {83 command: pushCommand,84 label: "Push it to your fork",85 },86] as const;8788const LINK = "decoration-rule underline hover:decoration-current";8990/**91 * The strip itself. Its onward line links Install through the router and92 * `llms.txt` as a plain anchor, since `llms.txt` is a server route. On a phone93 * only the first step is a command box; the other two read as code in the94 * list, so the strip never becomes a column of code blocks (ADR 0041).95 */96export const HowToTake = ({97 onDismiss,98}: {99 readonly onDismiss: () => void;100}) => {101 const heading = useId();102103 return (104 <section105 aria-labelledby={heading}106 className="border-rule bg-card flex flex-col gap-4 border p-4"107 data-how-to=""108 >109 <div className="flex items-center justify-between gap-3">110 <h2 className="text-ui font-semibold" id={heading}>111 {HOW_TO_TITLE}112 </h2>113 <Button114 aria-label={`Dismiss ${HOW_TO_TITLE.toLowerCase()}`}115 onClick={onDismiss}116 size="icon-sm"117 title="Dismiss"118 type="button"119 variant="ghost"120 >121 <X aria-hidden="true" strokeWidth={1.75} />122 </Button>123 </div>124 <ol className="columns:grid-cols-3 tablet:gap-4 grid gap-3">125 {STEPS.map(({ command, label }, index) => (126 <li className="flex min-w-0 flex-col gap-1" key={command}>127 <p className="text-label text-muted-foreground">128 {index + 1}. {label}129 </p>130 {index === 0 ? (131 <CommandLine command={command} numbered />132 ) : (133 <>134 <code135 className="text-mono tablet:hidden font-mono [overflow-wrap:anywhere]"136 data-step-text=""137 >138 {command}139 </code>140 <div className="max-tablet:hidden">141 <CommandLine command={command} numbered />142 </div>143 </>144 )}145 </li>146 ))}147 </ol>148 <p className="text-ui text-muted-foreground">149 New here?{" "}150 <AppLink className={`text-foreground ${LINK}`} to={INSTALL_PATH}>151 Install the command line152 </AppLink>{" "}153 first. For agents:{" "}154 <a155 className={`text-foreground text-mono font-mono ${LINK}`}156 href="/llms.txt"157 >158 llms.txt159 </a>160 </p>161 </section>162 );163};
modified:apps/web/src/features/import/import-form.tsx+1 added-12 removed
1import { Brand } from "@repo/brand";1import type {2 Handle,3 Owner,4 ShortName,
7 unmodified lines
12import { Button } from "../../components/ui/button.tsx";13import { Input } from "../../components/ui/input.tsx";14import { Spinner } from "../../components/ui/spinner.tsx";15import { signInHref } from "../auth/session-slot.tsx";17import { CommandLine } from "../shared/command.tsx";16import { ClientOwnerSelect } from "./client-owner.tsx";17import {18 importPayload,19 importSourceOf,
22 unmodified lines
42 readonly fixedOwner?: SourceNamespace | undefined;43 readonly here: string;44}4548export const importCommand = (project = "<owner>/<name>", url = "<url>") =>49 `${Brand.cli} init --project ${project} --import ${url}`;5046const LINK = "decoration-rule font-medium underline hover:decoration-current";4748const LABEL = "text-ui font-medium";49
85 unmodified lines
135 Importing is for signed-in people.{" "}136 <a className={LINK} href={signInHref(here)}>137 Sign in138 </a>{" "}144 to import it here, or import from a terminal:139 to import it here.140 </span>141 </p>147 <CommandLine148 command={importCommand(149 project,150 prefill === undefined || prefill.url === "" ? undefined : prefill.url151 )}152 />142 </section>143 );144};145
242 unmodified lines
modified:apps/web/src/features/import/import-page.tsx+14 added-20 removed
1import { CommandLine } from "../shared/command.tsx";1import { FactBlock } from "../shared/facts.tsx";2import { Workspace } from "../shared/shell/workspace.tsx";4import { ImportForm, importCommand } from "./import-form.tsx";3import { ImportForm } from "./import-form.tsx";4import type { Importer } from "./import-form.tsx";56export const ImportFacts = () => (8 <>9 <FactBlock label="What an import does">10 <ul className="text-ui flex list-disc flex-col gap-1.5 pl-4">11 <li>12 The platform clones the repo once, over HTTPS. Later pushes to the13 source do not follow it.14 </li>15 <li>You become the project&apos;s maintainer.</li>16 <li>17 A repo with no config folder takes its checks from its CI and its test18 command.19 </li>20 </ul>21 </FactBlock>7 <FactBlock label="What an import does">8 <ul className="text-ui flex list-disc flex-col gap-1.5 pl-4">9 <li>10 The platform clones the repo once, over HTTPS. Later pushes to the11 source do not follow it.12 </li>13 <li>You become the project&apos;s maintainer.</li>14 <li>15 A repo with no config folder takes its checks from its CI and its test16 command.17 </li>18 </ul>19 </FactBlock>22 <FactBlock label="From a terminal">23 <CommandLine command={importCommand()} numbered />24 </FactBlock>25 </>20);2122export const ImportView = ({23 url = "",
25 unmodified lines
modified:apps/web/src/features/inbox/decision-sections.tsx+1 added-5 removed
1import { Brand } from "@repo/brand";1import type { Decision, Today } from "@repo/protocol/domain/decision";2import type { LandingView } from "@repo/protocol/domain/landing";3import { Array as Arr, Option, Order } from "effect";4import type { DateTime } from "effect";
400 unmodified lines
405406 return listed.length === 0 ? (407 <Section name="Decisions waiting">408 <li className="pt-3">410 <EmptyState411 command={`${Brand.cli} today`}412 title="Nothing to decide today. Undecided decisions expire to their safe default."413 />409 <EmptyState title="Nothing to decide today. Undecided decisions expire to their safe default." />410 </li>411 </Section>412 ) : (413 <DecisionSections listed={listed} props={props} />
16 unmodified lines
modified:apps/web/src/features/inbox/inbox-page.tsx+6 added-40 removed
1import { Brand } from "@repo/brand";1import type { FrontPageEntry } from "@repo/protocol/domain/front-page";3import { Outcome } from "@repo/protocol/domain/outcome";2import type { Handle } from "@repo/protocol/ids";3import { Option } from "effect";4import type { DateTime } from "effect";5import { AsyncResult } from "effect/reactivity";6import type { ReactNode } from "react";78import { signInHref } from "../auth/session-slot.tsx";9import type { DecideInput } from "../decision/decision-card.tsx";12import { CommandLine } from "../shared/command.tsx";13import { CopyAction } from "../shared/copy-action.tsx";10import { EmptyState } from "../shared/empty.tsx";11import { HandleLink } from "../shared/handle.tsx";12import { AppLink } from "../shared/link.tsx";13import { StageStrip } from "../shared/outcome.tsx";
55 unmodified lines
69 <EmptyState {...props} />70 </li>71);7277const nextOf = ({ answer, claim }: Work) => {78 if (answer !== undefined) {79 return Outcome.guards.Refused(answer.outcome)80 ? {81 command: answer.outcome.refusals[0].next,82 label: "Copy next command",83 }84 : undefined;85 }8687 return isRunning(claim)88 ? { command: claim.checkCommand, label: "Copy check command" }89 : undefined;90};9173const ClaimRow = ({74 now,75 work,76}: {77 readonly now: DateTime.Utc;78 readonly work: Work;79}) => {80 const { answer, claim, holds, stage, want } = work;100 const next = nextOf(work);8182 return (83 <Row104 action={next === undefined ? undefined : <CopyAction {...next} />}84 data={{85 "data-claim": claim.ask,86 "data-project": claim.project,87 "data-state": claim.state,
63 unmodified lines
151 under="bar"152 >153 {read.work.length === 0 ? (154 <Empty176 command={177 first === undefined178 ? `${Brand.cli} front`179 : `${Brand.cli} claim ${first.ask.ask} --project ${first.project}`180 }155 onward={156 <AppLink className={LINK} to={ASKS_PATH}>157 The open asks158 </AppLink>
14 unmodified lines
173 ))174 )}175 </RowGroup>176 {read.held > WORK_SHOWN ? (203 <div className="flex flex-col items-start gap-2">204 <p className="text-ui text-muted-foreground">205 The newest {WORK_SHOWN} of your {read.held} claims; every one:206 </p>177 <p className="text-ui text-muted-foreground">178 The newest {WORK_SHOWN} of your {read.held} claims.179 </p>207 <CommandLine command={`${Brand.cli} status`} />208 </div>180 ) : null}181 </div>182 );183};
15 unmodified lines
199 </AppLink>200);201202const NoAsks = ({ title }: { readonly title: string }) => (232 <Empty command={`${Brand.cli} front`} onward={EVERY_ASK} title={title} />203 <Empty onward={EVERY_ASK} title={title} />204);205206const AskList = ({ asks }: { readonly asks: Takeable }) =>207 Takeable.match(asks, {
37 unmodified lines
245 <p className="text-ui">246 <a className={LINK} href={signInHref(INBOX_PATH)}>247 Sign in248 </a>{" "}278 to see yours, or read it from a terminal:249 to see yours.250 </p>280 <CommandLine command={`${Brand.cli} status`} />251 </div>252);253254const DecidedFailure = ({ decided }: { readonly decided: Decided }) => {
10 unmodified lines
265};266267const UnreachableDecisions = () => (268 <RowGroup label="Decisions waiting" name="Decisions waiting" under="bar">299 <Empty300 command={`${Brand.cli} today`}301 title="Your decisions did not come: the platform did not answer. Read them from a terminal."302 />269 <Empty title="Your decisions did not come: the platform did not answer." />270 </RowGroup>271);272273interface Deciding {
96 unmodified lines
370 Refused: ({ refusal }) => (371 <Unlisted>372 <p className="text-body max-w-(--measure)">{WHAT_THE_INBOX_IS}</p>373 <RefusalView refusals={[refusal]} />407 <CommandLine command={`${Brand.cli} status`} />374 </Unlisted>375 ),376 SignedOut: () => (377 <Unlisted>
9 unmodified lines
modified:apps/web/src/features/ledger/ledger-page.tsx+1 added-11 removed
2 unmodified lines
3 * ledger carries no path, no check name and no file name, and nothing here4 * adds one; the layer read log is maintainers' data and never reaches the5 * public ledger. A layer's files are never browsed here (principle 7).6 */7import { Brand } from "@repo/brand";7import { LedgerEntry } from "@repo/protocol/domain/visibility";8import type { Layer, Ledger, Members } from "@repo/protocol/domain/visibility";9import type { Handle, ProjectName } from "@repo/protocol/ids";10import { DateTime, Match, Option } from "effect";
3 unmodified lines
1415import { Definition, Definitions, Region } from "../ask/fields.tsx";16import { commitHref, shortSha } from "../code/paths.ts";17import { postureLabel } from "../project/posture-label.ts";19import { CommandLine } from "../shared/command.tsx";18import { CopyAction } from "../shared/copy-action.tsx";19import { disclosureWords } from "../shared/disclosure.ts";20import { EmptyState } from "../shared/empty.tsx";21import { CodeValue, FactBlock, HeldBackFacts } from "../shared/facts.tsx";
141 unmodified lines
163 {Option.isSome(summary.root) ? (164 <span className="flex min-w-0 items-center gap-2">165 <CodeValue value={summary.root.value} />166 <CopyAction169 command={summary.root.value}167 label={`Copy ${summary.area}'s root`}168 text={summary.root.value}169 />170 </span>171 ) : (172 "none published yet"
163 unmodified lines
336);337338export const LedgerFacts = ({339 areas,342 ledger,340}: {341 readonly areas: readonly AreaSummary[];345 readonly ledger: Ledger;342}) => (343 <>344 <HeldBackFacts345 areas={areas.map((summary) => ({346 area: summary.area,347 detail: plural(summary.checks, "sealed check", "sealed checks"),348 }))}349 />354 <FactBlock label="Read it in a terminal">355 <CommandLine356 command={`${Brand.cli} ledger --project ${ledger.project}`}357 numbered358 />359 </FactBlock>350 <Disclosures />351 </>352);353
63 unmodified lines
modified:apps/web/src/features/project/asks-page.tsx+2 added-8 removed
1import { Brand } from "@repo/brand";1import type { Ask, AskListing } from "@repo/protocol/domain/ask";2import type { AskId, ProjectName } from "@repo/protocol/ids";3import { useRouter } from "@tanstack/react-router";4import { Predicate } from "effect";5import type { DateTime } from "effect";67import { stillWaiting } from "../front/families.ts";8import type { AskProgress } from "../shared/ask-progress.ts";10import { CommandLine } from "../shared/command.tsx";9import { FactBlock } from "../shared/facts.tsx";10import { useRowSelection } from "../shared/row.tsx";11import { Workspace } from "../shared/shell/workspace.tsx";12import { askListIds, OpenAskRows, openAsks, openCount } from "./asks.tsx";
7 unmodified lines
20 readonly states: ReadonlyMap<AskId, AskProgress>;21 readonly unreachable: boolean;22}2326export const claimCommand = (project: ProjectName) =>27 `${Brand.cli} claim <ask> --project ${project}`;2829const TakeFacts = ({ project }: { readonly project: ProjectName }) => (24const TakeFacts = () => (25 <FactBlock label="How to take one">26 <p className="text-ui">27 Claim an ask open to take; the claim comes with a fork to push your answer28 to, and the platform checks it and lands it, or refuses it.29 </p>35 <CommandLine command={claimCommand(project)} numbered />30 </FactBlock>31);3233const AsksPanes = ({
6 unmodified lines
40 <Workspace41 {...(props.asks === undefined42 ? {}43 : { count: openCount(openAsks(props.asks)) })}50 facts={<TakeFacts project={props.project} />}44 facts={<TakeFacts />}45 factsHeading="Taking an ask"46 title="Asks"47 variant="list"48 >
23 unmodified lines
modified:apps/web/src/features/project/asks.tsx+1 added-5 removed
1import { Brand } from "@repo/brand";1import type { Ask, AskListing } from "@repo/protocol/domain/ask";2import type { AskId, ProjectName } from "@repo/protocol/ids";3import type { DateTime } from "effect";4import type { ReactNode } from "react";
120 unmodified lines
125 return unreachable ? <UnreachableNotice /> : <ReadingRows />;126 }127128 return asks.length === 0 ? (130 <EmptyState131 command={`${Brand.cli} ask open <ask> --files <files>`}132 title="No open asks. A maintainer opens one from an ask file."133 />129 <EmptyState title="No open asks." />130 ) : (131 <AskList asks={asks} {...props} />132 );133};
modified:apps/web/src/features/project/project-header.tsx+4 added-23 removed
1 unmodified line
2 * A project's one header (ADR 0041): its name, posture, description, facts3 * and three actions, then its nine tabs. Every page of the project draws it4 * the same; only the current tab moves.5 */6import { Brand } from "@repo/brand";6import type { RefsView, TagName } from "@repo/protocol/domain/code";7import type { Handle, ProjectName } from "@repo/protocol/ids";8import type { Posture } from "@repo/protocol/posture";9import { Option } from "effect";
64 unmodified lines
7475export const cloneCommand = (platformUrl: string, project: ProjectName) =>76 `git clone ${platformUrl}/${project}.git`;7779/**80 * Clone with git, or claim an ask to answer it: a claim brings its own fork.81 * The Clone popover and Overview's clone card say the same thing.82 */78/** The Clone popover and Overview's clone card say the same thing. */79export const CloneSteps = ({80 platformUrl,81 project,82}: {
4 unmodified lines
87 <div className="flex min-w-0 flex-col gap-1">88 <p className="text-ui">Clone it with git</p>89 <CommandLine command={cloneCommand(platformUrl, project)} />90 </div>95 <div className="flex min-w-0 flex-col gap-1">96 <p className="text-ui">Or claim an ask to answer it</p>97 <CommandLine command={`${Brand.cli} claim <ask> --project ${project}`} />98 </div>99 <p className="text-ui text-muted-foreground">100 A claim comes with a fork to push your answer to, so there is nothing to101 fork by hand.102 </p>91 </div>92);93106/**107 * The CLI has no command that follows a project, so Watch says what already108 * follows it (this page, and the events) and how to read your own part in it.109 */110export const WatchSteps = ({ project }: { readonly project: ProjectName }) => (94/** Watch says what already follows the project: this page, and the events. */95export const WatchSteps = () => (96 <div className="flex min-w-0 flex-col gap-3" data-steps="watch">97 <p className="text-ui">98 This page follows the project as it happens: claims, pushes, verdicts and99 landings arrive without a reload.100 </p>116 <div className="flex min-w-0 flex-col gap-1">117 <p className="text-ui">Your own claims and answers here</p>118 <CommandLine command={`${Brand.cli} status --project ${project}`} />119 </div>101 <AppLink className={`text-ui ${LINK} self-start`} to="/docs/events">102 Follow its events from a program103 </AppLink>104 </div>
60 unmodified lines
165 readonly project: ProjectName;166}) => (167 <div className="flex shrink-0 flex-wrap items-center gap-2">168 <Action label="Watch">188 <WatchSteps project={project} />169 <WatchSteps />170 </Action>171 <Action label="Clone" wide>172 <CloneSteps platformUrl={platformUrl} project={project} />173 </Action>
175 unmodified lines
modified:apps/web/src/features/project/project-page.tsx+30 added-43 removed
18 unmodified lines
19import { ForAgents, Onward, plural } from "../front/facts.tsx";20import { stillWaiting } from "../front/families.ts";21import type { AskProgress } from "../shared/ask-progress.ts";22import { LINK } from "../shared/classes.ts";23import { CommandLine } from "../shared/command.tsx";24import { CommandSlotProvider } from "../shared/keys.tsx";23import { AppLink } from "../shared/link.tsx";24import {25 ENVIRONMENT_ANCHOR,26 LEDGER_ANCHOR,
322 unmodified lines
349const RecentLandings = ({350 landedAt,351 landings,352 now,355 platformUrl,353 project,354}: {355 readonly landedAt: DateTime.Utc | undefined;356 readonly landings: readonly LandingView[];357 readonly now: DateTime.Utc;361 readonly platformUrl: string;358 readonly project: ProjectName;359}) => {360 let shown: ReactNode;361362 if (landings.length > 0) {363 shown = <LandingList landings={recentShown(landings)} now={now} />;364 } else if (landedAt === undefined) {365 shown = (370 <>371 <p className="text-ui">372 Nothing has landed yet. The first push to main, by whoever ran init,373 lands it.366 <p className="text-ui">367 Nothing has landed yet. The first push to main lands it.368 </p>374 </p>375 <CommandLine376 command={`git push ${platformUrl}/${project}.git HEAD:main`}377 />378 </>369 );370 } else {371 shown = (372 <p className="text-ui text-muted-foreground">
52 unmodified lines
425 data-variant="overview"426 id="main"427 tabIndex={-1}428 >439 <CommandSlotProvider slot="main">440 <div441 className={`columns:grid columns:grid-cols-[minmax(0,1fr)_var(--column-about)] columns:items-start flex flex-col gap-10 pt-6 pb-16 ${GUTTER}`}442 >443 <div className="flex min-w-0 flex-col gap-8">444 <AsksSection445 asks={asks}446 now={props.now}447 parents={props.parents ?? []}448 project={project}449 selected={selected}450 stamps={props.stamps ?? new Set()}451 states={states}452 unreachable={props.unreachable === true}453 />454 <RecentLandings455 landedAt={props.lastLanded ?? listing.landedAt}456 landings={props.landings}457 now={props.now}458 platformUrl={props.platformUrl}459 project={project}460 />461 {code?.readme === undefined ? null : (462 <div className="max-w-(--measure) min-w-0">463 <ReadmeSection file={code.readme} project={project} />464 </div>429 <div430 className={`columns:grid columns:grid-cols-[minmax(0,1fr)_var(--column-about)] columns:items-start flex flex-col gap-10 pt-6 pb-16 ${GUTTER}`}431 >432 <div className="flex min-w-0 flex-col gap-8">433 <AsksSection434 asks={asks}435 now={props.now}436 parents={props.parents ?? []}437 project={project}438 selected={selected}439 stamps={props.stamps ?? new Set()}440 states={states}441 unreachable={props.unreachable === true}442 />443 <RecentLandings444 landedAt={props.lastLanded ?? listing.landedAt}445 landings={props.landings}446 now={props.now}447 project={project}448 />449 {code?.readme === undefined ? null : (450 <div className="max-w-(--measure) min-w-0">451 <ReadmeSection file={code.readme} project={project} />452 </div>453 )}465 )}466 </div>467 <About props={props} />454 </div>469 </CommandSlotProvider>455 <About props={props} />456 </div>457 </main>458 );459};460
21 unmodified lines
modified:apps/web/src/features/project-people/people-view.tsx+3 added-44 removed
7 unmodified lines
8import type { ReactNode } from "react";910import { Definition, Definitions, Region } from "../ask/fields.tsx";11import { blobHref, commitHref, shortSha, treeHref } from "../code/paths.ts";12import { CommandLine } from "../shared/command.tsx";12import { EmptyState } from "../shared/empty.tsx";13import { FactBlock } from "../shared/facts.tsx";14import { HandleLink } from "../shared/handle.tsx";15import { AppLink } from "../shared/link.tsx";
341 unmodified lines
357 </p>358 <p className="text-ui max-w-(--measure)">359 {"To make it evaluate, a maintainer lands a "}360 <Code>{PROJECT_FILE}</Code>362 {363 " that names the test command. In a clone, this prints the file the CLI proposes from the repo's own files; add the test command to it, commit it, and land it as the facts say."364 }361 {" that names the test command."}362 </p>366 <CommandLine367 command={`${Brand.cli} init --project ${project} --dry-run`}368 />363 </>364 ) : (365 <>366 <p className="max-w-(--measure) font-medium">
14 unmodified lines
381 </p>382 </div>383);384391const Step = ({392 command,393 label,394}: {395 readonly command: string;396 readonly label: string;397}) => (398 <div className="flex min-w-0 flex-col gap-1">399 <p className="text-label text-muted-foreground">{label}</p>400 <CommandLine command={command} numbered />401 </div>402);403404const lines = (command: string, flags: readonly string[]) =>405 [command, ...flags].join(" \\\n ");406407const ChangeFacts = ({ project }: { readonly project: ProjectName }) => (385const ChangeFacts = () => (386 <FactBlock label="How to change these">387 <p className="text-ui">388 {`Land a change to ${CONFIG_DIR}: open an ask for it, or, as a maintainer, land your own from a clone.`}389 </p>412 <Step413 command={lines(`${Brand.cli} ask open <ask>`, [414 `--project ${project}`,415 "--files <files>",416 "--yes",417 ])}418 label="Open an ask for the change"419 />420 <Step421 command={lines(`${Brand.cli} land`, [422 `--project ${project}`,423 "--base <base>",424 "--head $(git rev-parse HEAD)",425 "--message <message>",426 "--requestId land-$(git rev-parse HEAD)",427 "--yes",428 ])}429 label="Or land your own, as a maintainer"430 />390 </FactBlock>391);392393export const PeopleView = ({
7 unmodified lines
401 readonly project: ProjectName;402 readonly unevaluated: Option.Option<PolicyPending>;403}): ReactNode => (404 <Workspace446 facts={<ChangeFacts project={project} />}405 facts={<ChangeFacts />}406 factsHeading="This policy"407 meta={408 Option.isSome(policy) ? (409 <AsOf policy={policy.value} project={project} />
18 unmodified lines
modified:apps/web/src/features/shared/shell/context-bar.tsx-37 removed
1import { Check, Copy } from "lucide-react";1import type { ReactNode } from "react";24import { Button } from "../../../components/ui/button.tsx";5import { useCopy } from "../copy-action.tsx";6import { useNumberedCommand } from "../keys.tsx";3import { AppLink } from "../link.tsx";4import { GUTTER } from "./gutter.ts";5import type { Crumb } from "./sections.ts";6
45 unmodified lines
52 </ol>53 </nav>54);5560export const CopyCommand = ({ command }: { readonly command: string }) => {61 const { copied, copy } = useCopy(command);62 const number = useNumberedCommand(command);6364 return (65 <Button66 onClick={copy}67 size="sm"68 title={69 number === undefined70 ? `Copy: ${command}`71 : `Copy (${number}): ${command}`72 }73 variant="outline"74 >75 {copied ? (76 <Check aria-hidden="true" strokeWidth={1.75} />77 ) : (78 <Copy aria-hidden="true" strokeWidth={1.75} />79 )}80 <span aria-hidden="true">{copied ? "Copied" : "Copy"}</span>81 <code className="sr-only">82 {copied ? `Copied ${command}` : `Copy ${command}`}83 </code>84 </Button>85 );86};8756export const ContextBar = ({57 count,58 crumbs,91 primaryCommand,59 state,60}: {61 readonly count?: string | undefined;62 readonly crumbs: readonly Crumb[];96 readonly primaryCommand?: string | undefined;63 readonly state?: ReactNode;64}) => (65 <div66 className={`border-rule bg-background flex h-11 shrink-0 items-center gap-3 border-b ${GUTTER}`}
7 unmodified lines
74 )}75 {state === undefined ? null : (76 <div className="text-ui flex items-center">{state}</div>77 )}112 {primaryCommand === undefined ? null : (113 <CopyCommand command={primaryCommand} />114 )}78 </div>79 </div>80);
modified:apps/web/src/features/shared/shell/workspace.tsx+46 added-57 removed
1 unmodified line
2import { Predicate } from "effect";3import { ChevronDown } from "lucide-react";4import type { ReactNode } from "react";56import { CommandSlotProvider } from "../keys.tsx";6import { ContextBar } from "./context-bar.tsx";7import { GUTTER } from "./gutter.ts";8import { crumbsFor } from "./sections.ts";9import type { Crumb } from "./sections.ts";
6 unmodified lines
16 readonly status?: ReactNode;17 readonly meta?: ReactNode;18 readonly state?: ReactNode;19 readonly count?: string;21 readonly primaryCommand?: string;20 readonly toolbar?: ReactNode;21 readonly facts?: ReactNode;22 readonly factsHeading?: string;23 readonly factsSummary?: ReactNode;
94 unmodified lines
118 factsHeading = "Facts",119 factsKey,120 factsSummary,121 meta,124 primaryCommand,122 said,123 state,124 status,125 title,
16 unmodified lines
142 data-variant={variant}143 id="main"144 tabIndex={-1}145 >149 <CommandSlotProvider slot="main">150 {focus || quietHead ? null : (151 <ContextBar152 count={count}153 crumbs={crumbs ?? crumbsFor(pathname)}154 primaryCommand={primaryCommand}155 state={state}156 />157 )}158 {/* A quiet head draws nothing, but keeps a region's gap under the code bar. */}146 {focus || quietHead ? null : (147 <ContextBar148 count={count}149 crumbs={crumbs ?? crumbsFor(pathname)}150 state={state}151 />152 )}153 {/* A quiet head draws nothing, but keeps a region's gap under the code bar. */}154 <div155 className={`${GUTTER} ${code ? "" : MEASURE} ${quietHead ? "pt-6" : ""}`}156 >157 <PageHead158 meta={meta}159 quiet={quietHead}160 said={said}161 status={status}162 title={title}163 />164 </div>165 {hasFacts ? (166 // A new selection's facts settle in rather than swap.167 <div className="animate-in fade-in-0 duration-[120ms]" key={factsKey}>168 <div className={GUTTER}>169 <InlineFacts170 facts={facts}171 heading={factsHeading}172 list={variant !== "document"}173 summary={factsSummary}174 />175 </div>176 </div>177 ) : null}178 {toolbar === undefined ? null : (179 <div160 className={`${GUTTER} ${code ? "" : MEASURE} ${quietHead ? "pt-6" : ""}`}180 className={`border-rule bg-background sticky top-(--stick-bar) z-10 h-(--toolbar) shrink-0 border-y ${GUTTER}`}181 data-toolbar=""182 >162 <PageHead163 meta={meta}164 quiet={quietHead}165 said={said}166 status={status}167 title={title}168 />169 </div>170 {hasFacts ? (171 <CommandSlotProvider slot="facts">172 {/* A new selection's facts settle in rather than swap. */}173 <div174 className="animate-in fade-in-0 duration-[120ms]"175 key={factsKey}176 >177 <div className={GUTTER}>178 <InlineFacts179 facts={facts}180 heading={factsHeading}181 list={variant !== "document"}182 summary={factsSummary}183 />184 </div>185 </div>186 </CommandSlotProvider>187 ) : null}188 {toolbar === undefined ? null : (183 {/* Its controls end where the rows end; its rules run the pane. */}184 <div190 className={`border-rule bg-background sticky top-(--stick-bar) z-10 h-(--toolbar) shrink-0 border-y ${GUTTER}`}191 data-toolbar=""185 className={`flex h-full items-center gap-3 ${code ? "" : MEASURE}`}186 >193 {/* Its controls end where the rows end; its rules run the pane. */}194 <div195 className={`flex h-full items-center gap-3 ${code ? "" : MEASURE}`}196 >197 {toolbar}187 {toolbar}198 </div>188 </div>200 )}201 <div202 className={`flex flex-1 flex-col gap-8 pb-16 ${203 code ? "" : `${GUTTER} ${board ? "" : MEASURE}`204 } ${toolbar === undefined ? "" : "pt-6"}`}205 >206 {children}189 </div>208 </CommandSlotProvider>190 )}191 <div192 className={`flex flex-1 flex-col gap-8 pb-16 ${193 code ? "" : `${GUTTER} ${board ? "" : MEASURE}`194 } ${toolbar === undefined ? "" : "pt-6"}`}195 >196 {children}197 </div>198 </main>199 );200};201
13 unmodified lines
modified:apps/web/src/features/shared/command.tsx+1 added-34 removed
1 unmodified line
2import type { CSSProperties } from "react";34import { Button } from "../../components/ui/button.tsx";5import { useCopy } from "./copy-action.tsx";6import { useNumberedCommand } from "./keys.tsx";67const HANG = 6;89const BOX =
51 unmodified lines
61 </span>62 );63 });6466const Line = ({67 command,68 number,69}: {70 readonly command: string;71 readonly number: number | undefined;72}) => {65export const CommandLine = ({ command }: { readonly command: string }) => {66 const { copied, copy } = useCopy(command);6768 return (69 <div className={BOX}>77 {number === undefined ? null : (78 <span79 aria-hidden="true"80 className="text-muted-foreground font-sans tabular-nums select-none"81 >82 {number}83 </span>84 )}70 <span aria-hidden="true" className="text-muted-foreground select-none">71 $72 </span>73 <code className="min-w-0 flex-1 py-0.5 whitespace-pre-wrap select-all">
2 unmodified lines
76 <Button77 className="shrink-0 font-sans"78 onClick={copy}79 size="sm"95 title={number === undefined ? undefined : `Copy (${number})`}80 type="button"81 variant="ghost"82 >83 {copied ? <Check aria-hidden="true" /> : <Copy aria-hidden="true" />}
3 unmodified lines
87 </Button>88 </div>89 );90};107108const NumberedLine = ({ command }: { readonly command: string }) => (109 <Line command={command} number={useNumberedCommand(command)} />110);111112export const CommandLine = ({113 command,114 numbered = false,115}: {116 readonly command: string;117 readonly numbered?: boolean;118}) =>119 numbered ? (120 <NumberedLine command={command} />121 ) : (122 <Line command={command} number={undefined} />123 );
modified:apps/web/src/features/shared/copy-action.tsx+17 added-76 removed
1/**2 * The command is always text in the page, so an agent reading the HTML and a3 * screen reader both get it, never only a clipboard payload.2 * The copied text is always text in the page, so an agent reading the HTML3 * and a screen reader both get it, never only a clipboard payload.4 */5import { Brand } from "@repo/brand";6import { Effect, Option } from "effect";5import { Effect } from "effect";6import { Check, Copy } from "lucide-react";7import { useState } from "react";810import { useCopiedCommand, useNumberedCommand } from "./keys.tsx";1112const copyFor = (command: string, shown: (copied: boolean) => void) =>13 Effect.tryPromise(() => navigator.clipboard.writeText(command)).pipe(9const copyFor = (text: string, shown: (copied: boolean) => void) =>10 Effect.tryPromise(() => navigator.clipboard.writeText(text)).pipe(11 Effect.andThen(12 Effect.sync(() => {13 shown(true);14 })
6 unmodified lines
21 ),22 Effect.ignore23 );2428export const useCopy = (command: string) => {25export const useCopy = (text: string) => {26 const [pressed, setPressed] = useState(false);30 const byKey = useCopiedCommand();2728 return {33 copied: pressed || Option.contains(byKey, command),29 copied: pressed,30 copy: () => {35 Effect.runFork(copyFor(command, setPressed));31 Effect.runFork(copyFor(text, setPressed));32 },33 };34};3540interface CopyProps {41 readonly command: string;42 readonly label: string;43 readonly numbered?: boolean;44}4546const ActionButton = ({47 command,36export const CopyAction = ({37 label,49 number,50}: Omit<CopyProps, "numbered"> & { readonly number: number | undefined }) => {51 const { copied, copy } = useCopy(command);38 text,39}: {40 readonly label: string;41 readonly text: string;42}) => {43 const { copied, copy } = useCopy(text);44 const Icon = copied ? Check : Copy;4546 return (47 <button48 aria-label={label}49 className="text-muted-foreground hover:bg-surface hover:text-foreground relative z-10 inline-flex size-8 shrink-0 items-center justify-center transition-colors duration-[120ms] focus-visible:outline-offset-[-2px]"50 onClick={copy}59 title={number === undefined ? label : `${label} (${number})`}51 title={label}52 type="button"53 >54 <Icon55 aria-hidden="true"56 className={`size-4 ${copied ? "text-foreground" : ""}`}57 strokeWidth={1.75}58 />67 <code className="sr-only">{command}</code>59 <code className="sr-only">{text}</code>60 <span61 aria-live="polite"62 className={63 copied
5 unmodified lines
69 </span>70 </button>71 );72};8182const NumberedAction = (props: Omit<CopyProps, "numbered">) => (83 <ActionButton {...props} number={useNumberedCommand(props.command)} />84);8586export const CopyAction = ({ numbered = false, ...props }: CopyProps) =>87 numbered ? (88 <NumberedAction {...props} />89 ) : (90 <ActionButton {...props} number={undefined} />91 );9293export const ClaimAction = ({94 ask,95 project,96}: {97 readonly ask: string;98 readonly project: string;99}) => (100 <CopyAction101 command={`${Brand.cli} claim ${ask} --project ${project}`}102 label="Copy claim command"103 />104);105106export const CommandChip = ({ command }: { readonly command: string }) => {107 const { copied, copy } = useCopy(command);108 const Icon = copied ? Check : Copy;109110 return (111 <button112 className="border-rule bg-surface hover:border-input text-mono inline-flex max-w-full min-w-0 items-center gap-1.5 border px-1.5 align-baseline font-mono transition-colors duration-[120ms]"113 onClick={copy}114 title={`Copy: ${command}`}115 type="button"116 >117 <span className="sr-only">Copy </span>118 <code className="min-w-0 text-left [overflow-wrap:anywhere]">119 {command}120 </code>121 <Icon122 aria-hidden="true"123 className="text-muted-foreground size-3.5 shrink-0"124 strokeWidth={1.75}125 />126 <span aria-live="polite" className="sr-only">127 {copied ? "Copied" : ""}128 </span>129 </button>130 );131};
modified:apps/web/src/features/shared/empty.tsx-5 removed
1import type { ReactNode } from "react";23import { CommandLine } from "./command.tsx";43export const EmptyState = ({6 command,4 onward,5 title,6}: {10 readonly command?: string;7 readonly onward?: ReactNode;8 readonly title: string;9}) => (10 <div className="border-rule flex flex-col items-start gap-3 border border-dashed px-4 py-5">11 <p className="text-ui text-foreground max-w-(--measure)">{title}</p>16 {command === undefined ? null : <CommandLine command={command} />}12 {onward === undefined ? null : (13 <div className="text-ui flex flex-wrap gap-x-4 gap-y-1">{onward}</div>14 )}15 </div>
1 unmodified line
modified:apps/web/src/features/shared/facts.tsx+86 added-49 removed
1import { Brand } from "@repo/brand";1import type { Verdict } from "@repo/protocol/domain/answer";2import type { Ask } from "@repo/protocol/domain/ask";3import { CheckSpec } from "@repo/protocol/domain/check";4import type { AgentTrailer, Credit } from "@repo/protocol/domain/credit";
6 unmodified lines
11import { ChevronDown, LockKeyhole } from "lucide-react";12import { useState } from "react";13import type { ReactNode } from "react";1415import { Button } from "../../components/ui/button.tsx";16import { signInHref } from "../auth/session-slot.tsx";17import { blobHref, shortSha, treeHref } from "../code/paths.ts";18import type { AskProgress } from "./ask-progress.ts";18import { CommandLine } from "./command.tsx";19import { CopyAction } from "./copy-action.tsx";20import { CreditTrailers } from "./credits.tsx";21import { FamilyTree } from "./family.tsx";22import { HandleLink } from "./handle.tsx";
4 unmodified lines
27import type { StageHolds, StageState } from "./outcome.tsx";28import { LEDGER_ANCHOR, visibilityPath } from "./paths.ts";29import { PostureBadge } from "./posture.tsx";30import { MetaCode } from "./row.tsx";31import {32 StatusLine,33 readStatus,34 stageNames,35 stageRuns,36} from "./status-line.tsx";31import { StatusLine, stageNames, stageRuns } from "./status-line.tsx";32import type { StatusSubject } from "./status-line.tsx";33import { When } from "./time.tsx";3435const BLOCK =
35 unmodified lines
71 </code>72);7374export const StateFacts = ({80 command,75 subject,76}: {77 readonly subject: StatusSubject;84 readonly command?: string;85}) => {86 const next = command ?? readStatus(subject).next;8788 return (89 <FactBlock label="State">90 <StatusLine command={false} subject={subject} />91 {next === undefined ? null : <CommandLine command={next} numbered />}92 </FactBlock>93 );94};9596const Step = ({97 command,98 label,99}: {100 readonly command: string;101 readonly label: string;78}) => (103 <div className="flex min-w-0 flex-col gap-1">104 <p className="text-label text-muted-foreground">{label}</p>105 <CommandLine command={command} numbered />106 </div>79 <FactBlock label="State">80 <StatusLine subject={subject} />81 </FactBlock>82);8384const whoMayTake = (ask: Ask) => {85 if (ask.reserve === "newcomers") {
6 unmodified lines
92 ? "Held for people, not agents"93 : `Anyone vouched in ${ask.project}, or with a record in its area`;94};9596/**97 * What a reader can do about a claim from the page: claim an ask open to take,98 * or release the claim they hold. The page reads and sends; these views only99 * draw what it hands them.100 */101export interface ClaimControl {102 readonly busy: boolean;103 /** Why the last claim or release did not go through. */104 readonly failure?: ReactNode;105 /** The page, for signing in and coming back to it. */106 readonly here: string;107 readonly onClaim: () => void;108 readonly onRelease: () => void;109 /** The fork the reader's claim pushes to, once it is read. */110 readonly remote?: string | undefined;111 readonly signedIn: boolean;112}113114const ClaimButton = ({ control }: { readonly control: ClaimControl }) =>115 control.signedIn ? (116 <Button117 className="self-start"118 data-action="claim"119 disabled={control.busy}120 onClick={() => {121 control.onClaim();122 }}123 type="button"124 >125 {control.busy ? "Claiming…" : "Claim it"}126 </Button>127 ) : (128 <a className={`text-ui self-start ${LINK}`} href={signInHref(control.here)}>129 Sign in to claim it130 </a>131 );132133export const TakeItFacts = ({134 ask,123 platformUrl,135 control,136}: {137 readonly ask: Ask;126 readonly platformUrl: string;138 readonly control?: ClaimControl | undefined;139}) => (140 <FactBlock label="Take it">141 <p className="text-ui">{whoMayTake(ask)}</p>130 <Step131 command={`git clone ${platformUrl}/${ask.project}.git`}132 label="Clone the project"133 />134 <Step135 command={`${Brand.cli} claim ${ask.id} --project ${ask.project}`}136 label="Claim it, in the clone"137 />138 <Step command={`${Brand.cli} check`} label="Check before you push" />142 {control === undefined ? null : (143 <>144 <ClaimButton control={control} />145 {control.failure}146 </>147 )}148 </FactBlock>149);150151const YourClaim = ({ control }: { readonly control: ClaimControl }) => (152 <>153 {control.remote === undefined ? null : (154 <div className="flex min-w-0 flex-col gap-1" data-claim-remote="">155 <p className="text-label text-muted-foreground">156 Push your answer to your fork157 </p>158 <p className="text-ui flex min-h-8 min-w-0 items-center gap-3">159 <code className="text-mono min-w-0 flex-1 truncate font-mono">160 {control.remote}161 </code>162 <CopyAction label="Copy the fork's address" text={control.remote} />163 </p>164 </div>165 )}166 <Button167 className="self-start"168 data-action="release"169 disabled={control.busy}170 onClick={() => {171 control.onRelease();172 }}173 type="button"174 variant="outline"175 >176 {control.busy ? "Releasing…" : "Release it"}177 </Button>178 {control.failure}179 </>180);181182const Holder = ({183 claimant,184 yours,185}: {
15 unmodified lines
201202/** No read carries a claim's deadline, so none is shown. */203export const ClaimFacts = ({204 claimant,205 control,206 lastPush,207 now,208 viewer,209}: {210 readonly claimant?: Handle;211 readonly control?: ClaimControl | undefined;212 readonly lastPush?: AskProgress["lastPush"];213 readonly now: DateTime.Utc;214 readonly viewer?: Handle;215}) => {
9 unmodified lines
225 Last pushed <When at={lastPush.at} now={now} />, as{" "}226 <CodeValue value={lastPush.head} />227 </p>228 )}187 {yours ? (188 <>189 <Step command={`${Brand.cli} check`} label="Check before you push" />190 <Step command="git push" label="Push your answer" />191 </>192 ) : null}229 {yours && control !== undefined ? <YourClaim control={control} /> : null}230 </FactBlock>231 );232};233
342 unmodified lines
576 <span className="min-w-0 flex-1 truncate">577 {shown ?? <CodeValue value={value} />}578 </span>579 {shown === undefined ? (543 <CopyAction command={value} label={`Copy ${label}`} />580 <CopyAction label={`Copy ${label}`} text={value} />581 ) : (582 <span aria-hidden="true" className="size-8 shrink-0" />583 )}584 </dd>
6 unmodified lines
modified:apps/web/src/features/shared/family.tsx-4 removed
3 unmodified lines
4import { useId, useState } from "react";56import { familyMarks, markOf } from "./ask-progress.ts";7import type { AskProgress, Mark } from "./ask-progress.ts";8import { ClaimAction } from "./copy-action.tsx";8import { AppLink } from "./link.tsx";9import { StateMarkIcon } from "./marks.tsx";10import type { StateMark } from "./marks.tsx";11import { askPath } from "./paths.ts";
229 unmodified lines
241 ) : null}242 <span className="text-label text-muted-foreground ml-auto shrink-0">243 {words[mark]}244 </span>246 {mark === "open" ? (247 <ClaimAction ask={ask} project={project} />248 ) : null}245 </li>246 ))}247 </ul>248 </div>
103 unmodified lines
modified:apps/web/src/features/shared/keys.tsx+15 added-137 removed
1/**2 * The switch turns every key but `?` off (WCAG 2.2 SC 2.1.4), and is on3 * whenever the storage cannot be read.4 */5import { Effect, Option, Result } from "effect";5import { Result } from "effect";6import {7 createContext,8 useCallback,9 useContext,10 useEffect,11 useId,11 useMemo,12 useRef,13 useState,14} from "react";
9 unmodified lines
24 readonly key: string;25 readonly metaKey: boolean;26}2729export type KeyIntent =30 | { readonly index: number; readonly kind: "copy" }31 | {32 readonly kind:33 | "clear"34 | "keys"35 | "next"36 | "nextFile"37 | "previous"38 | "previousFile";39 };28export interface KeyIntent {29 readonly kind:30 | "clear"31 | "keys"32 | "next"33 | "nextFile"34 | "previous"35 | "previousFile";36}3738const MOVES = {39 J: "nextFile",40 K: "previousFile",41 j: "next",42 k: "previous",43} as const satisfies Record<string, KeyIntent["kind"]>;4448const DIGIT = /^[1-9]$/u;4945export const intentOf = (46 press: KeyPress,47 on: boolean48): KeyIntent | undefined => {
12 unmodified lines
61 if (!on) {62 return undefined;63 }6470 if (DIGIT.test(press.key)) {71 return { index: Number(press.key), kind: "copy" };72 }7365 const move = Object.entries(MOVES).find(([key]) => key === press.key);6667 return move === undefined ? undefined : { kind: move[1] };68};
16 unmodified lines
85 { does: "Next or previous row", keys: ["j", "k"] },86 { does: "Open the focused row", keys: ["Enter"] },87 { does: "Next or previous file", keys: ["J", "K"] },88 { does: "Go to file, in the Code tab", keys: ["t"] },98 { does: "Copy the page's numbered command", keys: ["1", "…", "9"] },89 { does: "Close, or clear the selection", keys: ["Esc"] },90] as const;9192const SETTINGS = [
12 unmodified lines
105 <dl className="text-ui grid grid-cols-[auto_1fr] gap-x-4 gap-y-2.5">106 {KEYS.map(({ does, keys }) => (107 <div className="contents" key={does}>108 <dt className="flex items-center gap-1">119 {keys.map((key) =>120 key === "…" ? (121 <span className="text-muted-foreground" key={key}>122 to123 </span>124 ) : (125 <Kbd key={key}>{key}</Kbd>126 )127 )}109 {keys.map((key) => (110 <Kbd key={key}>{key}</Kbd>111 ))}112 </dt>113 <dd>{does}</dd>114 </div>115 ))}
23 unmodified lines
139 </p>140 </div>141);142159export type CommandSlot = "facts" | "main";160161const SlotContext = createContext<CommandSlot>("main");162163export const CommandSlotProvider = ({164 children,165 slot,166}: {167 readonly children: ReactNode;168 readonly slot: CommandSlot;169}) => <SlotContext value={slot}>{children}</SlotContext>;170143interface ListRegistration {144 readonly focus: (id: string) => void;145 readonly read: () => {146 readonly ids: readonly string[];
8 unmodified lines
155 };156 at?: string;157}158187interface Command {188 readonly command: string;189 readonly id: string;190 readonly slot: CommandSlot;191}192159interface Registry {160 readonly clearers: Set<() => void>;161 readonly files: Set<FileRegistration>;162 readonly lists: Set<ListRegistration>;197 readonly register: (command: Command) => () => void;163}164165interface KeysState {201 readonly copied: string | undefined;202 readonly numbered: ReadonlyMap<string, number>;166 readonly on: boolean;167 readonly setOn: (on: boolean) => void;168}169
25 unmodified lines
195 ) !== null)196 );197};198236const numberOf = (237 commands: readonly Command[]238): ReadonlyMap<string, number> => {239 const ordered = [240 ...commands.filter(({ slot }) => slot === "facts"),241 ...commands.filter(({ slot }) => slot === "main"),242 ];243244 const unique = [...new Set(ordered.map(({ command }) => command))];245246 return new Map(247 unique.slice(0, 9).map((command, index) => [command, index + 1])248 );249};250251const copyNumbered = (command: string, shown: (copied?: string) => void) =>252 Effect.tryPromise(() => navigator.clipboard.writeText(command)).pipe(253 Effect.andThen(254 Effect.sync(() => {255 shown(command);256 })257 ),258 Effect.andThen(Effect.sleep("2 seconds")),259 Effect.andThen(260 Effect.sync(() => {261 shown();262 })263 ),264 Effect.ignore265 );266199const moveTo = (list: ListRegistration, step: 1 | -1) => {200 const { ids } = list.read();201 const at = list.focused === undefined ? -1 : ids.indexOf(list.focused);202
31 unmodified lines
234 }235};236237interface Pressing {306 readonly copy: (command: string) => void;307 readonly numbered: ReadonlyMap<string, number>;238 readonly on: boolean;239 readonly openDialog: () => void;240 readonly registry: Registry;241}
15 unmodified lines
257258 return false;259 }260331 if (intent.kind === "copy") {332 const command = [...now.numbered].find(333 ([, index]) => index === intent.index334 )?.[0];335336 if (command !== undefined) {337 now.copy(command);338 }339340 return command !== undefined;341 }342261 if (intent.kind === "next" || intent.kind === "previous") {262 const list = lastOf(registry.lists);263264 if (list !== undefined) {
21 unmodified lines
286}) => {287 // The server has no storage and renders the keys on; nothing it renders288 // depends on them.289 const [on, setOn] = useState(() => readShortcuts(browserStorage()));372 const [commands, setCommands] = useState<readonly Command[]>([]);373 const [copied, setCopied] = useState<string>();290291 const registry = useMemo<Registry>(292 () => ({293 clearers: new Set(),294 files: new Set(),295 lists: new Set(),380 register: (command) => {381 setCommands((now) => [...now, command]);382383 return () => {384 setCommands((now) => now.filter(({ id }) => id !== command.id));385 };386 },296 }),297 []298 );299
1 unmodified line
301 setOn(next);302 writeShortcuts(browserStorage(), next);303 }, []);304396 const numbered = useMemo(() => numberOf(commands), [commands]);397305 const pressing = useRef<Pressing | null>(null);306307 useEffect(() => {308 pressing.current = {402 copy: (command) => {403 Effect.runFork(copyNumbered(command, setCopied));404 },405 numbered,309 on,310 openDialog,311 registry,312 };
29 unmodified lines
342 document.removeEventListener("keydown", onKey);343 };344 }, []);345443 const state = useMemo(444 () => ({ copied, numbered, on, setOn: turn }),445 [copied, numbered, on, turn]446 );346 const state = useMemo(() => ({ on, setOn: turn }), [on, turn]);347348 return (349 <RegistryContext value={registry}>450 <StateContext value={state}>451 {children}452 <output aria-live="polite" className="sr-only">453 {copied === undefined ? "" : `Copied: ${copied}`}454 </output>455 </StateContext>350 <StateContext value={state}>{children}</StateContext>351 </RegistryContext>352 );353};354
43 unmodified lines
398 [latest, registry]399 );400};401507export const useNumberedCommand = (command: string): number | undefined => {508 const registry = useContext(RegistryContext);509 const state = useContext(StateContext);510 const slot = useContext(SlotContext);511 const id = useId();512513 useEffect(514 () => registry?.register({ command, id, slot }),515 [command, id, registry, slot]516 );517518 return state?.on === true ? state.numbered.get(command) : undefined;519};520521export const useCopiedCommand = (): Option.Option<string> =>522 Option.fromUndefinedOr(useContext(StateContext)?.copied);523402export const useEscapeClears = (clear: () => void): void => {403 const registry = useContext(RegistryContext);404 const latest = useLatest(clear);405
10 unmodified lines
modified:apps/web/src/features/shared/outcome.tsx+1 added-1 removed
35 unmodified lines
36 className="flex flex-col gap-3"37 data-outcome={outcome._tag}38 data-state="final"39 >40 <StatusLine command={false} size={size} subject={subject} />40 <StatusLine size={size} subject={subject} />41 <RefusalView refusals={outcome.refusals} />42 </div>43 );44 }
159 unmodified lines
modified:apps/web/src/features/shared/refusal.tsx-3 removed
5 unmodified lines
6import { explain, headline } from "@repo/protocol/render";7import type { Array } from "effect";8import { OctagonX, RotateCcw } from "lucide-react";910import { CommandLine } from "./command.tsx";1110const Lines = ({ refusal }: { readonly refusal: Refusal }) => {11 const prefix = `${refusal._tag}:`;1213 return (
44 unmodified lines
58 className={`mt-1 size-3.5 shrink-0 ${refusal.retryable ? "text-waiting" : "text-refused"}`}59 />60 <Lines refusal={refusal} />61 </div>64 <CommandLine command={refusal.next} />62 </li>63 );64 })}65 </ol>
2 unmodified lines
modified:apps/web/src/features/shared/row.tsx-7 removed
5 unmodified lines
6import type { ReactNode } from "react";7import { Fragment } from "react";89import type { AskProgress } from "./ask-progress.ts";10import { ClaimAction } from "./copy-action.tsx";10import { useListKeys } from "./keys.tsx";11import { AppLink } from "./link.tsx";12import { STATE_MARKS, StateMarkIcon } from "./marks.tsx";13import type { StateMark } from "./marks.tsx";
355 unmodified lines
369 : { ...standing, time: <When at={at} now={now} /> };370371 const claimant = progress?.claimant;372 const rounds = progress?.rounds.length ?? 0;374 const open = state.mark === "open";373374 return (375 <Row378 action={379 open && takeable !== false ? (380 <ClaimAction ask={listing.ask} project={project} />381 ) : undefined382 }376 data={{377 "data-ask": listing.ask,378 "data-project": project,379 "data-takeable": takeable,
22 unmodified lines
modified:apps/web/src/features/shared/status-line.tsx-14 removed
13 unmodified lines
1415import { commitHref, shortSha } from "../code/paths.ts";16import { whoseMove } from "./ask-progress.ts";17import type { Family, Move } from "./ask-progress.ts";18import { CommandChip } from "./copy-action.tsx";18import { HandleLink } from "./handle.tsx";19import { AppLink } from "./link.tsx";20import { StateMarkIcon } from "./marks.tsx";21import type { StateMark } from "./marks.tsx";
94 unmodified lines
116 readonly tone: StatusTone;117 readonly lead: string;118 readonly rest?: ReactNode;119 readonly after: readonly string[];121 readonly next?: string;120}121122const Code = ({ children }: { readonly children: ReactNode }) => (123 <code className="text-mono font-mono [overflow-wrap:anywhere]">
128 unmodified lines
252 Refused: ({ refusals }): Reading => ({253 after: after(),254 lead: "Refused",255 mark: refusals[0].retryable ? "retry" : "refused",258 next: refusals[0].next,256 rest: (257 <>258 {stage === undefined ? (259 ": "
216 unmodified lines
476} as const;477478export interface StatusLineProps {479 readonly subject: StatusSubject;483 readonly command?: string | false;480 readonly compact?: boolean;481 readonly size?: keyof typeof SIZE;482 readonly stamp?: boolean;483}484485export const StatusLine = ({490 command,486 compact = false,487 size = "body",488 stamp = false,489 subject,490}: StatusLineProps) => {491 const reading = readStatus(subject);497 const next = command === false ? undefined : (command ?? reading.next);492493 if (compact) {494 return (495 <span
32 unmodified lines
528 </span>529 <span className="text-muted-foreground">{part}</span>530 </Fragment>531 ))}538 {next === undefined ? null : (539 <>540 <span aria-hidden="true" className="text-muted-foreground">541 {" · "}542 </span>543 <CommandChip command={next} />544 </>545 )}532 </span>533 </p>534 );535};
modified:apps/web/src/features/tour/example.ts-3 removed
144 unmodified lines
145 parent: LandedSha.make(base),146 project,147 sha: landed,148};149150/** A line of the territory, for `why`. */151export const WHY_LOCATION = "src/parse.ts:4";
modified:apps/web/src/features/tour/tour-page.tsx+4 added-34 removed
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 own2 * The guided walkthrough: six steps, each one sentence and a screen drawn by3 * the real components over example data. The refusal is the renderer's own4 * words, through the landing's transcript, so it cannot drift from git's.5 */7import { Brand } from "@repo/brand";6import type { ReactNode } from "react";78import { Brief } from "../ask/ask-page.tsx";9import { Output } from "../landing/gate-drawing.tsx";10import {13 CLAIM,11 claimReceipt,12 EXAMPLE,13 landedPush,17 PUSH,14 refusedPush,15} from "../landing/transcript.ts";16import { LINK } from "../shared/classes.ts";21import { CommandLine } from "../shared/command.tsx";17import { CreditTrailers } from "../shared/credits.tsx";18import { TerritoryFacts } from "../shared/facts.tsx";19import { AppLink } from "../shared/link.tsx";20import { StageStrip } from "../shared/outcome.tsx";
3 unmodified lines
24 LANDING_NOW_ANCHOR,25} from "../shared/paths.ts";26import { AskRow, RowList } from "../shared/row.tsx";27import { GUTTER } from "../shared/shell/gutter.ts";33import {34 ASK,35 claimOf,36 LANDING,37 LISTING,38 VERDICT,39 WHY_LOCATION,40} from "./example.ts";28import { ASK, claimOf, LANDING, LISTING, VERDICT } from "./example.ts";29import type { TourLive } from "./read.ts";30import { EXAMPLE_NOTE, TOUR_LEDE, TOUR_TITLE } from "./words.ts";3144/** The six commands, in the order the keys number them. */45export 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;5332interface StepWords {33 readonly id: string;34 readonly title: string;35 readonly sentence: string;58 readonly command: string;36}3738const WORDS = {39 claim: {63 command: TOUR_COMMANDS.claim,40 id: "claim",41 sentence:42 "A claim is exclusive and expires unless you push; it gives you a fork of your own at the platform.",43 title: "Claim it",44 },45 credit: {70 command: TOUR_COMMANDS.why,46 id: "credit",47 sentence:48 "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.",49 title: "See the credit",50 },51 find: {77 command: TOUR_COMMANDS.front,52 id: "find",53 sentence:54 "Every open ask across every public project, each a change its maintainers want and will land.",55 title: "Find an ask",56 },57 land: {84 command: TOUR_COMMANDS.check,58 id: "land",59 sentence:60 "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.",61 title: "Fix it, and land",62 },63 read: {91 command: TOUR_COMMANDS.ask,64 id: "read",65 sentence:66 "The brief says what done means, the territory which files an answer may change, and the check what judges it.",67 title: "Read it",68 },69 refused: {98 command: TOUR_COMMANDS.push,70 id: "refused",71 sentence:72 "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.",73 title: "Push, and hear why not",74 },75} as const satisfies Record<string, StepWords>;76106/** The six steps in the order the page walks them, and the keys number their commands. */77/** The six steps in the order the page walks them. */78export const STEPS: readonly StepWords[] = [79 WORDS.find,80 WORDS.read,81 WORDS.claim,
23 unmodified lines
105 {words.title}106 </h2>107 <p className="text-body text-muted-foreground">{words.sentence}</p>108 </div>138 <CommandLine command={words.command} numbered />109 <div110 className="border-rule bg-card flex min-w-0 flex-col gap-4 rounded-md border p-4"111 data-screen={words.id}112 >
134 unmodified lines
modified:apps/web/src/features/visibility/visibility-page.tsx+1 added-1 removed
45 unmodified lines
46 const seen = ledgerReadAt(ledger, now);4748 return (49 <Workspace50 facts={<LedgerFacts areas={areas} ledger={ledger} />}50 facts={<LedgerFacts areas={areas} />}51 factsHeading="This project's visibility"52 meta={metaOf(ledger, areas.length, env)}53 status={<HeadSentence ledger={ledger} />}54 title="Visibility"
8 unmodified lines
modified:apps/web/src/routes/$owner/$project/answers/$ask.tsx+2 added
12 unmodified lines
13import { askStates, projectEventsAtom } from "../../../../client/events.ts";14import { SeededAtoms, seedSuccess } from "../../../../client/seeded.ts";15import { watchAtom } from "../../../../client/watch.ts";16import { AnswerView } from "../../../../features/answer/answer-page.tsx";17import { EvidenceLog } from "../../../../features/answer/lane-log.tsx";18import {19 AnswerPageData,20 landedBy,21 readAnswer,
70 unmodified lines
92 <AnswerView93 ask={ask}94 head={read.head}95 landing={landing}96 LogReader={EvidenceLog}97 now={read.now}98 parent={read.parent}99 // A landing the server's read already held never stamps.100 stamp={landed !== undefined && landed.seq > read.lastSeq}
65 unmodified lines
modified:apps/web/src/routes/$owner/$project/asks/$ask.tsx+100 added-10 removed
1import { useAtomMount, useAtomValue } from "@effect/atom-react";2import type { Handle } from "@repo/protocol/ids";1import { useAtom, useAtomMount, useAtomValue } from "@effect/atom-react";2import type { ClaimView } from "@repo/protocol/domain/claim";3import type { AskId, Handle, ProjectName } from "@repo/protocol/ids";4import {5 createFileRoute,5 getRouteApi,6 useLocation,7 useParams,8} from "@tanstack/react-router";9import { createServerFn } from "@tanstack/react-start";10import { env } from "cloudflare:workers";11import { Effect, Option, Schema } from "effect";12import { AsyncResult } from "effect/reactivity";13import { useState } from "react";1415import { verdictAtom } from "../../../../client/answer.ts";16import { askAtom } from "../../../../client/ask.ts";17import {18 claimAtom,19 myClaimsAtom,20 releaseAtom,21} from "../../../../client/claim.ts";22import { askStates, projectEventsAtom } from "../../../../client/events.ts";23import { useProjectList } from "../../../../client/front.ts";24import { SeededAtoms, seedSuccess } from "../../../../client/seeded.ts";25import { watchAtom } from "../../../../client/watch.ts";
3 unmodified lines
29 markdownAlternate,30 wantsMarkdown,31} from "../../../../features/ask/markdown.ts";32import { NoSuchAsk } from "../../../../features/ask/refused.tsx";33import { hereOf } from "../../../../features/auth/session-slot.tsx";34import { whoAtom } from "../../../../features/auth/who.ts";35import { CallFailure } from "../../../../features/shared/call-failure.tsx";36import type { ClaimControl } from "../../../../features/shared/facts.tsx";37import { pageHead } from "../../../../features/shared/head.ts";38import { branchPage } from "../../../../server/cache-headers.ts";39import { serverClient } from "../../../../server/client.ts";40import { AskPath, askMarkdownHandler } from "./{$ask}[.]md.ts";
33 unmodified lines
74 .handler(({ data }) =>75 Effect.runPromise(readAsk(data).pipe(Effect.provide(serverClient(env))))76 );7768const root = getRouteApi("__root__");78/** The claim this page made for this ask, once the platform has answered. */79const madeHere = (80 claimed: AsyncResult.AsyncResult<{ readonly claim: ClaimView }, unknown>,81 project: ProjectName,82 ask: AskId83) =>84 AsyncResult.isSuccess(claimed) &&85 !claimed.waiting &&86 claimed.value.claim.project === project &&87 claimed.value.claim.ask === ask88 ? claimed.value.claim89 : undefined;9091const useClaiming = ({92 ask,93 holds,94 project,95 viewer,96}: {97 readonly ask: AskId;98 readonly holds: boolean;99 readonly project: ProjectName;100 readonly viewer: Handle | undefined;101}) => {102 const here = useLocation({ select: hereOf });103 const [claimed, claim] = useAtom(claimAtom);104 const [released, release] = useAtom(releaseAtom);105 const [last, setLast] = useState<"claim" | "release">();106 const made = last === "claim" ? madeHere(claimed, project, ask) : undefined;107 const mine = holds || made !== undefined;108109 const claims = useAtomValue(myClaimsAtom(mine ? project : undefined));110111 const remote =112 made?.remote ??113 (AsyncResult.isSuccess(claims)114 ? claims.value.claims.find((each) => each.ask === ask)?.remote115 : undefined);116117 const failed =118 last === "release"119 ? AsyncResult.isFailure(released) && released.cause120 : last === "claim" && AsyncResult.isFailure(claimed) && claimed.cause;121122 const control: ClaimControl = {123 busy: claimed.waiting || released.waiting,124 failure:125 failed === false ? undefined : (126 <div aria-live="polite">127 <CallFailure128 cause={failed}129 doing={last === "claim" ? "claim it" : "release it"}130 here={here}131 />132 </div>133 ),134 here,135 onClaim: () => {136 setLast("claim");137 claim({ ask, project });138 },139 onRelease: () => {140 setLast("release");141 release({ ask, project });142 },143 remote,144 signedIn: viewer !== undefined,145 };146147 return { claimedHere: made?.claimant, control };148};149150const FreshAsk = ({71 platformUrl,151 read,152 viewer,153 whoKnown,154}: {75 readonly platformUrl: string;155 readonly read: AskPageData;156 readonly viewer: Handle | undefined;157 readonly whoKnown: boolean;158}) => {159 const { project } = read.ask;160161 useAtomMount(watchAtom(project));
18 unmodified lines
180 const posture = useProjectList()?.find(181 (listing) => listing.project === project182 )?.posture;183184 const states = askStates(events);185186 const { claimedHere, control } = useClaiming({187 ask: ask.id,188 holds: viewer !== undefined && states.get(ask.id)?.claimant === viewer,189 project,190 viewer,191 });192193 return (194 <AskView195 ask={ask}196 brief={brief}197 check={read.check}198 claimedHere={claimedHere}199 // Until the session is read, neither a button nor a sign-in link.200 control={whoKnown ? control : undefined}201 now={read.now}202 parent={read.parent}111 platformUrl={platformUrl}203 posture={posture}113 states={askStates(events)}204 states={states}205 verdict={verdict}206 viewer={viewer}207 />208 );209};210211const AskPage = () => {121 const { platformUrl } = root.useLoaderData();212 const read = Schema.decodeSync(AskPageData)(Route.useLoaderData());213 const who = useAtomValue(whoAtom);214 const { ask, brief, verdict } = read;215
8 unmodified lines
224 ),225 ]}226 >227 <FreshAsk138 platformUrl={platformUrl}228 read={read}229 viewer={230 AsyncResult.isSuccess(who)231 ? Option.getOrUndefined(who.value)232 : undefined233 }234 whoKnown={AsyncResult.isSuccess(who)}235 />236 </SeededAtoms>237 );238};
28 unmodified lines
modified:apps/web/src/routes/$owner/$project/decisions/$decision.tsx+56 added-8 removed
1import { useAtom, useAtomMount, useAtomValue } from "@effect/atom-react";1import {2 useAtom,3 useAtomMount,4 useAtomRefresh,5 useAtomValue,6} from "@effect/atom-react";7import { forkRev } from "@repo/protocol/domain/code";8import type { Decision } from "@repo/protocol/domain/decision";9import type { CommitSha } from "@repo/protocol/ids";10import {11 createFileRoute,5 getRouteApi,12 useLocation,13 useRouter,14} from "@tanstack/react-router";15import { createServerFn } from "@tanstack/react-start";16import { getRequest } from "@tanstack/react-start/server";17import { env } from "cloudflare:workers";12import { Effect, Option, Schema } from "effect";18import { Array as Arr, Effect, Option, Schema } from "effect";19import type { DateTime } from "effect";14import { AsyncResult } from "effect/reactivity";20import { Atom, AsyncResult } from "effect/reactivity";21import { useCallback, useMemo, useState } from "react";22import type { ReactNode } from "react";2324import { decideAtom } from "../../../../client/decide.ts";25import { projectEventsAtom } from "../../../../client/events.ts";26import { finishAtom, forkHeadAtom } from "../../../../client/finish.ts";27import { watchAtom } from "../../../../client/watch.ts";28import { hereOf } from "../../../../features/auth/session-slot.tsx";29import { useCodeFileKeys } from "../../../../features/code/file-keys.ts";30import { parseDiffHash } from "../../../../features/code/line-hash.ts";
12 unmodified lines
43import { FinishColumn } from "../../../../features/finish/finish-column.tsx";44import { FinishFilesButton } from "../../../../features/finish/finish-files-button.tsx";45import { FinishView } from "../../../../features/finish/finish-view.tsx";46import {47 answererOf,48 isFinishDecision,49 patchOf,50 waiverPatchOf,51} from "../../../../features/finish/patch.ts";
8 unmodified lines
60import { serverClient } from "../../../../server/client.ts";6162// The decision comes from `today` alone: someone who decides nothing there sees no evidence.6356const root = getRouteApi("__root__");5764interface DecisionParams {65 readonly project: string;66 readonly decision: string;67}
29 unmodified lines
97 taken.decided !== undefined98 )99 );100101type ForkLog = AsyncResult.AsyncResult<102 { readonly commits: readonly { readonly sha: CommitSha }[] },103 unknown104>;105106// A decision that names no answerer has no fork to read.107const noFork: Atom.Atom<ForkLog> = Atom.make<ForkLog>(108 AsyncResult.success({ commits: [] })109);110111const forkLogOf = (decision: FinishDecision): Atom.Atom<ForkLog> =>112 Option.match(answererOf(decision), {113 onNone: () => noFork,114 onSome: (handle) =>115 forkHeadAtom(decision.project)(116 forkRev({ ask: decision.subject.ask, handle })117 ),118 });119120/** Undefined while it is read; none when the fork could not be read or holds nothing. */121const headOf = (log: ForkLog): Option.Option<CommitSha> | undefined => {122 if (AsyncResult.isSuccess(log)) {123 return Option.map(Arr.head(log.value.commits), ({ sha }) => sha);124 }125126 return AsyncResult.isFailure(log) ? Option.none() : undefined;127};128129const Finish = ({130 busy,131 decision,132 failure,
9 unmodified lines
142 readonly busy: boolean;143 readonly taken: Decision | undefined;144 readonly failure: ReactNode;145}) => {112 const { platformUrl } = root.useLoaderData();146 const router = useRouter();147 const here = useLocation({ select: hereOf });148 const { ask, head } = decision.subject;149150 const forkLog = useMemo(() => forkLogOf(decision), [decision]);151 const forkHead = headOf(useAtomValue(forkLog));152 const readFork = useAtomRefresh(forkLog);153 const [finished, finish] = useAtom(finishAtom);154155 useAtomMount(watchAtom(decision.project));156 const events = useAtomValue(projectEventsAtom(decision.project));157158 const newerHead =
93 unmodified lines
252 draw253 failure={failure}254 files={files}255 filesButton={<FinishFilesButton />}256 finishFailure={257 AsyncResult.isFailure(finished) ? (258 <CallFailure cause={finished.cause} doing="finish it" here={here} />259 ) : undefined260 }261 finished={Option.getOrUndefined(AsyncResult.value(finished))}262 finishing={finished.waiting}263 folded={folded}264 forkHead={forkHead}265 newerHead={newerHead}266 now={now}267 onDecide={onDecide}268 onFold={onFold}269 onFoldAll={(fold) => {270 setFolded(fold ? new Set(paths) : new Set());271 }}272 onFinish={finish}273 onMark={mark}274 onReadFork={readFork}275 onSplit={setChosen}276 placed={found.placed}228 platformUrl={platformUrl}277 read={read}278 soon={found.soon}279 split={split}280 stamp={taken !== undefined}
73 unmodified lines
modified:apps/web/src/routes/$owner/$project/discussions/$discussion.tsx+9 added-1 removed
10 unmodified lines
11import { SeededAtoms, seedSuccess } from "../../../../client/seeded.ts";12import { watchAtom } from "../../../../client/watch.ts";13import { NotFoundView } from "../../../../features/ask/refused.tsx";14import { DiscussionView } from "../../../../features/discussion/discussion-view.tsx";15import { usePoster } from "../../../../features/discussion/use-poster.tsx";16import { pageHead } from "../../../../features/shared/head.ts";17import { notFoundFor, Refusals } from "../../../../features/shared/refusals.ts";18import { branchPage } from "../../../../server/cache-headers.ts";19import { serverClient } from "../../../../server/client.ts";
42 unmodified lines
62 readonly project: ProjectName;63 readonly read: Shown;64}) => {65 useAtomMount(watchAtom(project));66 const poster = usePoster(project, read.discussion.id);6768 const { discussion } = Option.getOrElse(69 AsyncResult.value(70 useAtomValue(discussionAtom(project)(read.discussion.id))71 ),72 () => read73 );7473 return <DiscussionView discussion={discussion} now={DateTime.nowUnsafe()} />;75 return (76 <DiscussionView77 discussion={discussion}78 now={DateTime.nowUnsafe()}79 poster={poster}80 />81 );82};8384const DiscussionPage = () => {85 const read = Schema.decodeSync(ShowDiscussion.successSchema)(
43 unmodified lines
modified:apps/web/src/routes/$owner/$project/discussions/index.tsx+3 added-1 removed
9 unmodified lines
10import { discussionsAtom } from "../../../../client/discussion.ts";11import { SeededAtoms, seedSuccess } from "../../../../client/seeded.ts";12import { watchAtom } from "../../../../client/watch.ts";13import { DiscussionsView } from "../../../../features/discussion/discussions-view.tsx";14import { usePoster } from "../../../../features/discussion/use-poster.tsx";15import { UnknownProjectView } from "../../../../features/project/unknown-project.tsx";16import { pageHead } from "../../../../features/shared/head.ts";17import { branchPage } from "../../../../server/cache-headers.ts";18import { serverClient } from "../../../../server/client.ts";
33 unmodified lines
52 readonly project: ProjectName;53 readonly read: Listed;54}) => {55 useAtomMount(watchAtom(project));56 const poster = usePoster(project);5758 const { discussions } = Option.getOrElse(59 AsyncResult.value(useAtomValue(discussionsAtom(project))),60 () => read
2 unmodified lines
63 return (64 <DiscussionsView65 discussions={discussions}66 now={DateTime.nowUnsafe()}65 project={project}67 poster={poster}68 />69 );70};71
33 unmodified lines
modified:apps/web/src/routes/$owner/$project/refs.tsx+3 added-8 removed
30 unmodified lines
31 .validator((name: string) => name)32 .handler(({ data }) =>33 Effect.runPromise(34 readRefsPage(data).pipe(35 Effect.map((refs) => ({ platformUrl: env.PUBLIC_PLATFORM_URL, refs })),35 Effect.map((refs) => ({ refs })),36 Effect.provide(serverClient(env))37 )38 )39 );4041const RefsPage = () => {42 const { platformUrl, refs: read } = Route.useLoaderData();42 const { refs: read } = Route.useLoaderData();43 const refs = Schema.decodeSync(Refs)(read);44 const search = Route.useSearch();4546 return (47 <RefsView48 from={search.from ?? 0}49 package={search.package}50 platformUrl={platformUrl}51 refs={refs}52 />47 <RefsView from={search.from ?? 0} package={search.package} refs={refs} />48 );49};5051export const Route = createFileRoute("/$owner/$project/refs")({
21 unmodified lines
modified:apps/web/src/routes/people/$handle.tsx+1 added-1 removed
52 unmodified lines
53 return <PersonView credits={read.credits} handle={read.handle} />;54};5556export const Route = createFileRoute("/people/$handle")({57 staticData: { shell: "project" },57 staticData: { shell: "site" },58 component: PersonPage,59 headers: () => branchPage,60 head: ({ params }) =>61 pageHead({
6 unmodified lines
modified:apps/web/src/routes/inbox.tsx+1 added-1 removed
86 unmodified lines
87 );88};8990export const Route = createFileRoute("/inbox")({91 staticData: { shell: "project" },91 staticData: { shell: "site" },92 validateSearch: (search: {93 readonly decision?: unknown;94 readonly project?: unknown;95 }): InboxSearch => Option.getOrElse(searchOf(search), () => ({})),
9 unmodified lines
modified:apps/web/src/routes/settings.tsx+1 added-1 removed
8 unmodified lines
9import { branchPage } from "../server/cache-headers.ts";1011// Reads nothing on the server: the preference lives in the reader's browser, so the page is the same for everyone and the edge may keep it.12export const Route = createFileRoute("/settings")({13 staticData: { shell: "project" },13 staticData: { shell: "site" },14 component: SettingsView,15 headers: () => branchPage,16 head: () => pageHead({ description: SETTINGS_LEDE, title: SETTINGS_TITLE }),17});
modified:apps/web/test/answer.test.tsx+180 added-22 removed
3 unmodified lines
4import type { Verdict } from "@repo/protocol/domain/answer";5import type { Ask } from "@repo/protocol/domain/ask";6import { Outcome } from "@repo/protocol/domain/outcome";7import type { StageName } from "@repo/protocol/domain/outcome";8import { AreaName, AskId, CommitSha, DecisionId } from "@repo/protocol/ids";8import {9 AreaName,10 AskId,11 CommitSha,12 DecisionId,13 LaneName,14} from "@repo/protocol/ids";15import {16 ChecksFailed,17 HeldBackFailed,18 NotDecider,19 UnknownAsk,20 UnknownCommit,21} from "@repo/protocol/refusal";22import { explain } from "@repo/protocol/render";23import { asTester, unanswered } from "@repo/protocol/testing";24import { isNotFound } from "@tanstack/react-router";18import { Effect, Layer, Ref, Schema, Stream } from "effect";25import { Cause, Effect, Layer, Ref, Result, Schema, Stream } from "effect";26import { AsyncResult, Atom, AtomRegistry, Reactivity } from "effect/reactivity";27import { RpcTest } from "effect/rpc";28import { renderToStaticMarkup } from "react-dom/server";2930import { evidenceAtom } from "../src/client/evidence.ts";31import type { Evidence } from "../src/client/evidence.ts";32import {33 AnswerView,34 durationText,35 HeldBackBits,36} from "../src/features/answer/answer-page.tsx";37import { LaneLogView } from "../src/features/answer/lane-log.tsx";38import type { LogReaderProps } from "../src/features/answer/lane-log.tsx";39import { readAnswer } from "../src/features/answer/reads.ts";40import { askStates } from "../src/features/shared/ask-progress.ts";41import { Refusals } from "../src/features/shared/refusals.ts";42import { ContractsClient, webContracts } from "../src/surfaces.ts";43import {44 ask,45 askId,46 brief,
166 unmodified lines
213 ["human", "passed"],214 ]);215 });216203 it("opens failed lanes first, each with the command that reads its log, and folds the passed ones into a line", () => {217 it("opens failed lanes first, each saying its log is kept, and folds the passed ones into a line", () => {218 const markup = markupOf(refusedPage);219 const text = textOf(refusedPage);220221 expect(lanesOf(mainOf(markup))).toStrictEqual([222 ["unit", "failed"],223 ["lint", "passed"],224 ]);225 expect(text).toContain(212 `${Brand.cli} evidence logs/datekit/parse-iso-week/unit --project oscabriel/datekit`226 "Its log is kept for the answerer and the project's maintainers."227 );228 expect(text).toContain("1 lane passed in 1.2 s");229 expect(230 /<details\b[^>]*>.*data-lane="lint".*<\/details>/su.test(mainOf(markup))
61 unmodified lines
292 // An ask nothing blocks is open to take, as before.293 expect(markupOf(page({ verdict: undefined }))).toContain(">Open to take<");294 });295282 it("names a lane's log only as the command that reads it", () => {296 it("names a lane's log by no ref and no command, only that it is kept", () => {297 const passing = verdictOf(Outcome.cases.Checking.make({ stage: "checks" }));298 const text = textOf(page({ verdict: passing }));299286 const mentions = [287 ...text.matchAll(/logs\/datekit\/parse-iso-week\/unit/gu),288 ];289290 expect(mentions.length).toBeGreaterThan(0);291292 for (const { index } of mentions) {293 expect(text.slice(index - `${Brand.cli} evidence `.length, index)).toBe(294 `${Brand.cli} evidence `295 );296 }300 expect(text).toContain(301 "Its log is kept for the answerer and the project's maintainers."302 );303 expect(text).not.toContain("logs/datekit/parse-iso-week/unit");304 expect(text).not.toContain(`${Brand.cli} evidence`);305 });306307 it("shows held-back checks only as an area's counts and its suite root, shortened, the whole root in its title", () => {308 const bits =
120 unmodified lines
429430 expect(text).toContain("Waiting on decision dec-000001");431 });432425 it("gives an ask nobody answered the command that claims it", () => {433 it("says an ask nobody answered is unanswered, with no command to claim it", () => {434 const text = textOf(page({ verdict: undefined }));435436 expect(text).toContain("Nobody has answered this ask yet.");429 expect(text).toContain(430 `${Brand.cli} claim ${askId} --project oscabriel/datekit`431 );437 expect(text).not.toContain(`${Brand.cli} claim`);438 expect(markupOf(page({ verdict: undefined }))).not.toContain("data-stage");439 });440441 it("names who holds a claimed ask with no answer pushed, and links back to the ask", () => {
4 unmodified lines
446 expect(textIn(main)).toContain("Claimed by bram, no answer pushed yet.");447 expect(main).toContain(`href="/oscabriel/datekit/asks/${askId}"`);448 });449444 it("shows a landed answer's credit trailers in trailer order, its held-back trailer, and its commit", () => {450 it("shows a landed answer's credit trailers in trailer order and its held-back trailer, with no git command", () => {451 const landed = verdictOf(Outcome.cases.Landed.make({ sha: landedSha }));452 const text = textOf(page({ landing, verdict: landed }));453454 expect(text).toContain("Landed as 9b1c3e5");
1 unmodified line
456 inOrder(text, ["Asked-by: ines-v", "Signed-off-by: okafor"])457 ).toBeTruthy();458 expect(text).toContain(`Held-back: export 7/7 @ ${suite}`);459 expect(text).toContain("Assisted-by: claude-code:opus-5 (verified)");454 expect(text).toContain(`git show ${landedSha}`);460 expect(text).not.toContain(`git show ${landedSha}`);461 });462463 it("links a landed answer's landing (from the hero and the landing) and its base to their commit pages", () => {464 const landed = verdictOf(Outcome.cases.Landed.make({ sha: landedSha }));
288 unmodified lines
753 expect(yield* Ref.get(asked)).toStrictEqual(nothingAsked);754 })755 );756});757758const Reader = ({ lane, logRef, project: of }: LogReaderProps) => (759 <span data-reader={`${of} ${lane} ${logRef}`} />760);761762const readersOf = (markup: string) =>763 [...markup.matchAll(/data-reader="(?<value>[^"]+)"/gu)].map(764 ({ groups }) => groups?.value765 );766767const withheld = {768 ...refused,769 lanes: refused.lanes.map((lane) =>770 lane.logRef === undefined771 ? lane772 : { ...lane, logRef: ChecksFailed.withheld }773 ),774};775776const unitLog: Evidence = {777 lane: LaneName.make("unit"),778 text: "expected 1 <b>to</b> be 2",779 truncated: false,780};781782const view = (783 result: AsyncResult.AsyncResult<Evidence, unknown>,784 signedOut = false785) =>786 renderToStaticMarkup(787 <LaneLogView788 here="/oscabriel/datekit/answers/parse-iso-week"789 onShow={() => {790 // Nothing to read in a static render.791 }}792 result={result}793 signedOut={signedOut}794 />795 );796797describe("a failed lane's log", () => {798 it("hands a kept log's lane and ref to the page's reader, and a withheld one to none", () => {799 expect(800 readersOf(markupOf(page({ LogReader: Reader, verdict: refused })))801 ).toStrictEqual([`${project} unit logs/datekit/parse-iso-week/unit`]);802 expect(803 readersOf(markupOf(page({ LogReader: Reader, verdict: withheld })))804 ).toStrictEqual([]);805 expect(textOf(page({ LogReader: Reader, verdict: withheld }))).toContain(806 "Its log was not kept: it held a write-only value."807 );808 });809810 it("offers to show the log before it is read, and a sign-in link back to the page when signed out", () => {811 expect(plainText(view(AsyncResult.initial()))).toContain("Show the log");812 expect(view(AsyncResult.initial(true))).toContain("disabled");813 expect(view(AsyncResult.initial(), true)).toContain(814 'href="/auth/signin?return=%2Foscabriel%2Fdatekit%2Fanswers%2Fparse-iso-week"'815 );816 });817818 it("shows the log as text, never markup, and says when it was cut to its tail", () => {819 const markup = view(AsyncResult.success(unitLog));820821 expect(markup).toContain("expected 1 &lt;b&gt;to&lt;/b&gt; be 2");822 expect(markup).not.toContain("<b>to</b>");823 expect(plainText(markup)).not.toContain("Truncated");824 expect(825 plainText(view(AsyncResult.success({ ...unitLog, truncated: true })))826 ).toContain("Truncated: the last 256 KiB.");827 });828829 it("shows a refusal as the refusal, with the button to try again", () => {830 const markup = view(AsyncResult.failure(Cause.fail(new NotDecider({}))));831832 expect(markup).toContain('data-refusal="NotDecider"');833 expect(plainText(markup)).toContain("Show the log");834 });835836 type EvidenceAsked = readonly {837 readonly project: string;838 readonly ref: string;839 }[];840841 const readOnce = (answer: Effect.Effect<Evidence, NotDecider>) =>842 Effect.gen(function* () {843 const asked = yield* Ref.make<EvidenceAsked>([]);844845 const handlers = Layer.mergeAll(846 unanswered,847 Contracts.toLayerHandler("evidence", (payload) =>848 Ref.update(asked, (all) => [...all, payload]).pipe(849 Effect.andThen(answer)850 )851 )852 );853854 const layer = Layer.effect(ContractsClient)(855 RpcTest.makeClient(webContracts, { flatten: true })856 ).pipe(857 Layer.provide([handlers, asTester]),858 Layer.provideMerge(Reactivity.layer)859 );860861 const registry = yield* Effect.acquireRelease(862 Effect.sync(() =>863 AtomRegistry.make({864 initialValues: [865 Atom.initialValue(ContractsClient.runtime.layer, layer),866 ],867 })868 ),869 (made) =>870 Effect.sync(() => {871 made.dispose();872 })873 );874875 const ref = "logs/datekit/parse-iso-week/unit";876 const atom = evidenceAtom(ref);877878 registry.mount(atom);879 registry.set(atom, { project, ref });880881 const read = yield* AtomRegistry.getResult(registry, atom, {882 suspendOnWaiting: true,883 }).pipe(Effect.result);884885 return { asked: yield* Ref.get(asked), read };886 });887888 it.effect(889 "asks for the lane's log by its ref, once pressed, and shows its text",890 () =>891 Effect.gen(function* () {892 const { asked, read } = yield* readOnce(Effect.succeed(unitLog));893894 expect(asked).toStrictEqual([895 { project, ref: "logs/datekit/parse-iso-week/unit" },896 ]);897 expect(read).toStrictEqual(Result.succeed(unitLog));898 }).pipe(Effect.scoped)899 );900901 it.effect("keeps a refusal as the refusal", () =>902 Effect.gen(function* () {903 const { read } = yield* readOnce(Effect.fail(new NotDecider({})));904905 expect(read).toStrictEqual(Result.fail(new NotDecider({})));906 }).pipe(Effect.scoped)907 );908});
modified:apps/web/test/ask.test.tsx+216 added-27 removed
1import { describe, expect, it } from "@effect/vitest";2import { Brand } from "@repo/brand";3import { Client, Contracts } from "@repo/protocol/contracts";4import type { Ask } from "@repo/protocol/domain/ask";5import type { ClaimView } from "@repo/protocol/domain/claim";6import { Outcome } from "@repo/protocol/domain/outcome";7import {8 AskId,9 BlobSha,10 CommitSha,11 Handle,12 ProjectName,13 RepoName,14 RepoPath,15} from "@repo/protocol/ids";16import {17 OutOfScope,
3 unmodified lines
21} from "@repo/protocol/refusal";22import { explain } from "@repo/protocol/render";23import { asTester, unanswered } from "@repo/protocol/testing";24import { isNotFound } from "@tanstack/react-router";23import { Effect, Layer, Ref, Schema, Stream } from "effect";25import { DateTime, Effect, Exit, Layer, Ref, Schema, Stream } from "effect";26import { Atom, AtomRegistry, Reactivity } from "effect/reactivity";27import { RpcTest } from "effect/rpc";2829import { claimAtom, releaseAtom } from "../src/client/claim.ts";30import { keys } from "../src/client/keys.ts";31import { readAsk } from "../src/features/answer/reads.ts";32import { AskView } from "../src/features/ask/ask-page.tsx";33import { NoSuchAsk } from "../src/features/ask/refused.tsx";34import { askStates } from "../src/features/shared/ask-progress.ts";35import type { ClaimControl } from "../src/features/shared/facts.tsx";36import { Refusals } from "../src/features/shared/refusals.ts";37import { ContractsClient, webContracts } from "../src/surfaces.ts";38import {39 ask,40 askId,41 brief,
11 unmodified lines
53 verdictOf,54} from "./ask-fixtures.ts";55import { textIn } from "./markup.ts";5650const platformUrl = "https://platform-test.example.workers.dev";5157const inPre = (markup: string) =>58 /<pre\b[^>]*>(?<inner>.*?)<\/pre>/su.exec(markup)?.groups?.inner;5960const mainOf = (markup: string) =>
4 unmodified lines
65 ?.groups?.inner ?? "";6667type AskProps = Parameters<typeof AskView>[0];6869const tamsin = Handle.make("tamsin");7071const ignore = () => {};7273const forkRemote =74 "https://git.example.dev/oscabriel/datekit--parse-iso-week--tamsin.git";7576const claiming = (overrides: Partial<ClaimControl> = {}): ClaimControl => ({77 busy: false,78 here: `/${project}/asks/${askId}`,79 onClaim: ignore,80 onRelease: ignore,81 signedIn: true,82 ...overrides,83});8485const page = (shown = ask, more: Partial<AskProps> = {}) => (65 <AskView66 ask={shown}67 brief={brief}68 now={now}69 platformUrl={platformUrl}70 {...more}71 />86 <AskView ask={shown} brief={brief} now={now} {...more} />87);8889const checkSource = (lines: number) => ({90 path: RepoPath.make("test/parse-week.test.ts"),
90 unmodified lines
181 'href="/oscabriel/datekit/blob/main/test/parse-week.test.ts"'182 );183 });184170 it("gives the lines that clone the project, claim the ask and check an answer, with the CLI's own name", () => {171 expect(172 inOrder(textOf(page()), [173 `git clone ${platformUrl}/oscabriel/datekit.git`,174 `${Brand.cli} claim ${askId} --project oscabriel/datekit`,175 `${Brand.cli} check`,176 ])177 ).toBeTruthy();185 it("says who may take an open ask, with no command to clone, claim or check", () => {186 const text = textOf(page());187188 expect(text).toContain("Take it");189 expect(text).not.toContain("git clone");190 expect(text).not.toContain(`${Brand.cli} claim`);191 expect(text).not.toContain(`${Brand.cli} check`);192 });193194 it("claims an ask open to take with a button, once the page hands it a control", () => {195 const markup = markupOf(page(ask, { control: claiming(), viewer: tamsin }));196197 expect(markup).toContain('data-action="claim"');198 expect(markup).not.toContain('data-action="release"');199 });200201 it("says the reader holds a claim they made from the page, before the events say so", () => {202 const text = textIn(203 markupOf(204 page(ask, {205 claimedHere: tamsin,206 control: claiming({ remote: forkRemote }),207 viewer: tamsin,208 })209 )210 );211212 expect(text).toContain("You hold this claim");213 expect(text).toContain(forkRemote);214 expect(text).toContain("Release it");215 expect(text).not.toContain("Claim it");216 });217218 it("offers a claimed ask's holder a release, and anyone else neither claim nor release", () => {219 const states = askStates([claimedEvent(1, "tamsin")]);220 const claimed = { ...ask, state: "claimed" } as const;221222 const holder = markupOf(223 page(claimed, { control: claiming(), states, viewer: tamsin })224 );225226 const other = markupOf(227 page(claimed, {228 control: claiming(),229 states,230 viewer: Handle.make("okonkwo"),231 })232 );233234 expect(holder).toContain('data-action="release"');235 expect(other).not.toContain('data-action="release"');236 expect(other).not.toContain('data-action="claim"');237 });238239 it("names who holds a claimed ask and offers no way to take it", () => {240 const states = askStates([claimedEvent(1, "tamsin")]);241242 const text = textIn(
5 unmodified lines
248 expect(text).not.toContain("Take it");249 expect(text).not.toContain(`${Brand.cli} claim`);250 });251193 it("says where a refused answer was refused, whose move it is and what to run", () => {252 it("says where a refused answer was refused and whose move it is", () => {253 const refusal = new OutOfScope({ paths: [RepoPath.make("README.md")] });254 const outcome = Outcome.cases.Refused.make({ refusals: [refusal] });255256 const states = askStates([
8 unmodified lines
265 )266 );267268 expect(210 inOrder(text, [211 "Refused",212 "at Shape",213 "OutOfScope",214 "tamsin's move",215 refusal.next,216 ])269 inOrder(text, ["Refused", "at Shape", "OutOfScope", "tamsin's move"])270 ).toBeTruthy();271 });272273 it("says a landed ask landed, with its commit", () => {
208 unmodified lines
482 expect(483 inOrder(textOf(<NoSuchAsk data={data} />), [484 "No such ask",485 ...explain([refusal]).map((line) => line.trim()),433 `${Brand.cli} asks`,486 ])487 ).toBeTruthy();488 });489
219 unmodified lines
709 expect(yield* Ref.get(asked)).toStrictEqual(nothingAsked);710 })711 );712});713714const claimView: ClaimView = {715 ask: askId,716 base: CommitSha.make("a".repeat(40)),717 checkCommand: "bun test",718 claimant: tamsin,719 fork: RepoName.make("datekit--parse-iso-week--tamsin"),720 lapsesAt: DateTime.add(now, { days: 3 }),721 openedAt: now,722 project,723 remote: forkRemote,724 state: "live",725 warnsAt: DateTime.add(now, { days: 2 }),726};727728interface Sent {729 readonly claim: readonly unknown[];730 readonly release: readonly unknown[];731 readonly showAsk: number;732}733734const claimContracts = (sent: Ref.Ref<Sent>) =>735 Layer.effect(ContractsClient)(736 RpcTest.makeClient(webContracts, { flatten: true })737 ).pipe(738 Layer.provide([739 Layer.mergeAll(740 unanswered,741 Contracts.toLayerHandler("claim", (payload) =>742 Ref.update(sent, (all) => ({743 ...all,744 claim: [...all.claim, payload],745 })).pipe(Effect.as({ claim: claimView }))746 ),747 Contracts.toLayerHandler("release", (payload) =>748 Ref.update(sent, (all) => ({749 ...all,750 release: [...all.release, payload],751 })).pipe(Effect.as({ released: true }))752 ),753 Contracts.toLayerHandler("showAsk", () =>754 Ref.update(sent, (all) => ({755 ...all,756 showAsk: all.showAsk + 1,757 })).pipe(Effect.as({ ask, brief }))758 )759 ),760 asTester,761 ]),762 Layer.provideMerge(Reactivity.layer)763 );764765const theAsk = ContractsClient.query(766 "showAsk",767 { ask: askId, project },768 { reactivityKeys: keys.ask(project, askId) }769);770771const pressing = (which: "claim" | "release") =>772 Effect.gen(function* () {773 const sent = yield* Ref.make<Sent>({ claim: [], release: [], showAsk: 0 });774775 const registry = yield* Effect.acquireRelease(776 Effect.sync(() =>777 AtomRegistry.make({778 initialValues: [779 Atom.initialValue(780 ContractsClient.runtime.layer,781 claimContracts(sent)782 ),783 ],784 })785 ),786 (made) =>787 Effect.sync(() => {788 made.dispose();789 })790 );791792 registry.mount(theAsk);793 yield* AtomRegistry.getResult(registry, theAsk);794795 const input = { ask: askId, project };796797 const succeeded =798 which === "claim"799 ? yield* Effect.exit(800 Effect.suspend(() => {801 registry.mount(claimAtom);802 registry.set(claimAtom, input);803804 return AtomRegistry.getResult(registry, claimAtom, {805 suspendOnWaiting: true,806 });807 })808 ).pipe(Effect.map(Exit.isSuccess))809 : yield* Effect.exit(810 Effect.suspend(() => {811 registry.mount(releaseAtom);812 registry.set(releaseAtom, input);813814 return AtomRegistry.getResult(registry, releaseAtom, {815 suspendOnWaiting: true,816 });817 })818 ).pipe(Effect.map(Exit.isSuccess));819820 yield* AtomRegistry.getResult(registry, theAsk, { suspendOnWaiting: true });821822 return { sent: yield* Ref.get(sent), succeeded };823 }).pipe(Effect.scoped);824825describe("claiming from the ask page", () => {826 it.live(827 "sends the ask and its project as the claim, and reads the ask again",828 () =>829 Effect.gen(function* () {830 const { sent, succeeded } = yield* pressing("claim");831832 expect(succeeded).toBeTruthy();833 expect(sent.claim).toStrictEqual([{ ask: askId, project }]);834 expect(sent.showAsk).toBe(2);835 })836 );837838 it.live(839 "sends the ask and its project as the release, and reads the ask again",840 () =>841 Effect.gen(function* () {842 const { sent, succeeded } = yield* pressing("release");843844 expect(succeeded).toBeTruthy();845 expect(sent.release).toStrictEqual([{ ask: askId, project }]);846 expect(sent.showAsk).toBe(2);847 })848 );849});
modified:apps/web/test/decision.test.tsx+2 added-2 removed
456 unmodified lines
457 expect(refusal).toBeGreaterThan(-1);458 expect(refusal).toBeLessThan(markup.indexOf("data-choices="));459 });460461 it("signed out, says what a decision is and who takes it, with no choices and no evidence", () => {461 it("signed out, says what a decision is and who takes it, with no choices, no evidence and no command", () => {462 const markup = pageOf(DecisionRead.cases.SignedOut.make({}));463 const text = plainTextOf(markup);464465 expect(markup).not.toContain("data-choice=");466 expect(markup).not.toContain(".skip(");467 expect(text).toContain("A maintainer takes it on their Today");468 expect(markup).toContain('href="/oscabriel/vellum/policy"');469 expect(text).toContain(`${Brand.cli} today --project oscabriel/vellum`);469 expect(text).not.toContain(`${Brand.cli} today`);470 });471});
modified:apps/web/test/design-rules.test.tsx+2 added-2 removed
329 unmodified lines
330331 expect(rows).toStrictEqual(["site", "project", "docs", "focus"]);332 });333334 it("states ADR 0041's four rules", () => {334 it("states ADR 0041's four rules, the third as the maintainer amended it: no CLI command on a page", () => {335 const shells = section("Shells");336337 expect(shells).toContain("**No global left rail.**");338 expect(shells).toContain("**No generic right rail.**");339 expect(shells).toContain("**A command at most once per screen.**");339 expect(shells).toContain("**No CLI command on a page.**");340 expect(shells).toContain("**Prose stops at 72 to 80ch.**");341 });342343 it("holds a page's document and its prose to the measure tokens, never a literal", () => {
30 unmodified lines
modified:apps/web/test/discussions.test.tsx+226 added-22 removed
1import { RegistryContext } from "@effect/atom-react";2import { describe, expect, it } from "@effect/vitest";3import { Brand } from "@repo/brand";4import { Client, Contracts } from "@repo/protocol/contracts";5import type { PostDiscussion } from "@repo/protocol/contracts";6import {7 Discussion,8 DiscussionListing,9} from "@repo/protocol/domain/discussion";8import { DiscussionId, ProjectName } from "@repo/protocol/ids";9import { UnknownDiscussion, UnknownProject } from "@repo/protocol/refusal";10import { asTester, unanswered } from "@repo/protocol/testing";10import { DiscussionId, Handle, ProjectName } from "@repo/protocol/ids";11import {12 Denounced,13 UnknownDiscussion,14 UnknownProject,15} from "@repo/protocol/refusal";16import { asPerson, asTester, unanswered } from "@repo/protocol/testing";17import { isNotFound } from "@tanstack/react-router";12import { DateTime, Effect, Layer, Schema } from "effect";18import { Cause, DateTime, Effect, Exit, Layer, Option, Schema } from "effect";19import { Atom, AtomRegistry, Reactivity } from "effect/reactivity";20import { RpcTest } from "effect/rpc";2122import { postDiscussionAtom } from "../src/client/discussion.ts";23import { DiscussionView } from "../src/features/discussion/discussion-view.tsx";24import { DiscussionsView } from "../src/features/discussion/discussions-view.tsx";25import type { Poster } from "../src/features/discussion/post-form.tsx";26import { usePoster } from "../src/features/discussion/use-poster.tsx";27import { CallFailure } from "../src/features/shared/call-failure.tsx";28import {29 crumbsFor,30 projectSections,31 projectTabOf,32} from "../src/features/shared/shell/sections.ts";33import { readDiscussion } from "../src/routes/$owner/$project/discussions/$discussion.tsx";34import { readDiscussions } from "../src/routes/$owner/$project/discussions/index.tsx";35import { ContractsClient, webContracts } from "../src/surfaces.ts";36import { inOrder, markupOf, plainText } from "./ask-fixtures.ts";37import { elementWith, mainOf } from "./records.ts";38import { renderAt } from "./render.tsx";39
73 unmodified lines
113 ].map((found) =>114 plainText((found.groups?.line ?? "").replaceAll(/ \\\n\s*/gu, " ")).trim()115 );116105const list = (106 <DiscussionsView discussions={listings} now={now} project={datekit} />107);117const list = <DiscussionsView discussions={listings} now={now} />;118119const wren = Handle.make("wren");120121const signedIn: Poster = {122 handle: Option.some(wren),123 here: "/oscabriel/datekit/discussions",124};125126const signedOut: Poster = { ...signedIn, handle: Option.none() };127128const formsIn = (markup: string) =>129 [...markup.matchAll(/<form\b[^>]*data-post-form="(?<kind>\w+)"/gu)].map(130 (found) => found.groups?.kind131 );132133const fieldsIn = (markup: string) =>134 [...markup.matchAll(/<(?:input|textarea)\b[^>]*name="(?<name>\w+)"/gu)].map(135 (found) => found.groups?.name136 );137138const returnOf = (markup: string) => {139 const href = /href="(?<href>\/auth\/signin[^"]*)"/u140 .exec(markup)141 ?.groups?.href?.replaceAll("&amp;", "&");142143 return href === undefined144 ? undefined145 : new URL(href, "https://web.test").searchParams.get("return");146};147148describe("a project's discussions page", () => {149 it("lists each thread by title, opener, posts, last post and state, each linked to its page", () => {150 const markup = mainOf(markupOf(list));151 const rows = elementWith(markup, "data-discussions");
17 unmodified lines
169 ])170 ).toBeTruthy();171 });172134 it("shows the command to open a thread, copyable, and no form", () => {135 const markup = markupOf(list);173 it("says who may open a thread, and gives a signed-in reader a form for its title and first post, with no command", () => {174 const markup = markupOf(175 <DiscussionsView discussions={listings} now={now} poster={signedIn} />176 );177137 expect(commandsOf(markup)).toContain(138 `${Brand.cli} discussion post --project oscabriel/datekit --title "<title>" --body "<post>"`178 expect(plainText(markup)).toContain(179 "Anyone not denounced may open a thread"180 );140 expect(markup).not.toMatch(/<form\b|<textarea\b/u);181 expect(formsIn(markup)).toStrictEqual(["open"]);182 expect(fieldsIn(markup)).toStrictEqual(["title", "body"]);183 expect(commandsOf(markup)).toStrictEqual([]);184 expect(plainText(markup)).not.toContain(`${Brand.cli} discussion post`);185 });186143 it("says so, with the command, when there are none", () => {187 it("gives a signed-out reader no form, only a way to sign in that comes back here", () => {188 const markup = markupOf(145 <DiscussionsView discussions={[]} now={now} project={datekit} />189 <DiscussionsView discussions={listings} now={now} poster={signedOut} />190 );191192 expect(formsIn(markup)).toStrictEqual([]);193 expect(returnOf(markup)).toBe("/oscabriel/datekit/discussions");194 expect(plainText(markup)).toContain("Sign in to open a discussion");195 });196197 it("says so when there are none", () => {198 const markup = markupOf(<DiscussionsView discussions={[]} now={now} />);199200 expect(plainText(mainOf(markup))).toContain("No discussions yet");201 expect(markup).not.toContain("data-discussions");202 });203
27 unmodified lines
231 );232});233234describe("a discussion's page", () => {183 it("shows the posts in order, each by its person and time, and the reply command while open", () => {184 const markup = markupOf(<DiscussionView discussion={open} now={now} />);235 it("shows the posts in order, each by its person and time, and a reply form while open, with no command", () => {236 const markup = markupOf(237 <DiscussionView discussion={open} now={now} poster={signedIn} />238 );239240 const main = mainOf(markup);241 const posts = elementWith(main, "data-posts");242243 expect(main).toMatch(/<h1\b[^>]*>Which day starts a week\?<\/h1>/u);
7 unmodified lines
251 "ISO, always.",252 ])253 ).toBeTruthy();254 expect(posts).toMatch(/<a\b[^>]*href="\/people\/wren"[^>]*>wren<\/a>/u);200 expect(commandsOf(markup)).toContain(201 `${Brand.cli} discussion post disc-000001 --project oscabriel/datekit --body "<post>"`202 );203 expect(markup).not.toMatch(/<form\b|<textarea\b/u);255 expect(commandsOf(markup)).toStrictEqual([]);256 expect(formsIn(markup)).toStrictEqual(["reply"]);257 });258259 it("names the ask a maintainer opened from it, linked, and offers no reply", () => {207 const markup = markupOf(<DiscussionView discussion={asked} now={now} />);260 const markup = markupOf(261 <DiscussionView discussion={asked} now={now} poster={signedIn} />262 );263264 const became = elementWith(mainOf(markup), "data-became");265266 expect(became).toMatch(267 /<a\b[^>]*href="\/oscabriel\/datekit\/asks\/parse-iso-week"[^>]*>parse-iso-week<\/a>/u268 );269 expect(plainText(markup)).toContain("Became an ask");270 expect(plainText(markup)).toContain("takes no more posts");216 expect(commandsOf(markup)).toStrictEqual([]);271 expect(formsIn(markup)).toStrictEqual([]);272 });273274 it("offers a signed-out reader of an open thread no form, only a way to sign in", () => {275 const markup = markupOf(276 <DiscussionView277 discussion={open}278 now={now}279 poster={{280 ...signedOut,281 here: "/oscabriel/datekit/discussions/disc-000001",282 }}283 />284 );285286 expect(formsIn(markup)).toStrictEqual([]);287 expect(returnOf(markup)).toBe("/oscabriel/datekit/discussions/disc-000001");288 });289});290291type PostPayload = typeof PostDiscussion.payloadSchema.Type;292293const browserWith = (294 sent: PostPayload[],295 answer: (296 payload: PostPayload297 ) => Effect.Effect<298 typeof PostDiscussion.successSchema.Type,299 typeof PostDiscussion.errorSchema.Type300 >301) =>302 AtomRegistry.make({303 initialValues: [304 Atom.initialValue(305 ContractsClient.runtime.layer,306 Layer.effect(307 ContractsClient,308 RpcTest.makeClient(webContracts, { flatten: true })309 ).pipe(310 Layer.provide([311 Layer.mergeAll(312 unanswered,313 Contracts.toLayerHandler("postDiscussion", (payload) => {314 sent.push(payload);315316 return answer(payload);317 })318 ),319 asPerson(wren),320 ]),321 Layer.provideMerge(Reactivity.layer)322 )323 ),324 ],325 });326327// A server's render reads who is signed in as not yet known; this one says, as the browser would, that wren is.328const Thread = ({ seen }: { readonly seen?: (poster: Poster) => void }) => {329 const poster = usePoster(datekit, first);330331 seen?.(poster);332333 return (334 <DiscussionView335 discussion={open}336 now={now}337 poster={{ ...poster, checking: false, handle: Option.some(wren) }}338 />339 );340};341342const reply = (registry: AtomRegistry.AtomRegistry, body: string) =>343 Effect.gen(function* () {344 const posters: Poster[] = [];345346 yield* renderAt(347 "/oscabriel/datekit/discussions/disc-000001",348 <RegistryContext.Provider value={registry}>349 <Thread350 seen={(poster) => {351 posters.push(poster);352 }}353 />354 </RegistryContext.Provider>355 );356357 // A page in the browser keeps the atom mounted while it waits; a358 // server's render keeps nothing.359 registry.mount(postDiscussionAtom);360 posters.at(-1)?.onPost?.({ body });361362 return yield* Effect.exit(363 AtomRegistry.getResult(registry, postDiscussionAtom, {364 suspendOnWaiting: true,365 })366 );367 });368369describe("posting from the web", () => {370 it.live("sends a reply to postDiscussion, named for its thread", () =>371 Effect.gen(function* () {372 const sent: PostPayload[] = [];373374 const registry = browserWith(sent, () =>375 Effect.succeed({ discussion: open })376 );377378 const answered = yield* reply(registry, "Monday, then.");379380 expect(Exit.isSuccess(answered)).toBeTruthy();381 expect(sent).toStrictEqual([382 { body: "Monday, then.", discussion: first, project: datekit },383 ]);384 })385 );386387 it.live(388 "hears a refusal as the platform gave it, and draws it inside the reply form",389 () =>390 Effect.gen(function* () {391 const registry = browserWith([], () => Effect.fail(new Denounced()));392393 const answered = yield* reply(registry, "Monday, then.");394395 const markup = markupOf(396 <DiscussionView397 discussion={open}398 now={now}399 poster={{400 ...signedIn,401 refusal: (402 <CallFailure403 cause={Cause.fail(new Denounced())}404 doing="reply"405 here="/oscabriel/datekit/discussions/disc-000001"406 />407 ),408 }}409 />410 );411412 const refused = Exit.isFailure(answered)413 ? Cause.findErrorOption(answered.cause)414 : Option.none();415416 expect(Option.exists(refused, Schema.is(Denounced))).toBeTruthy();417 expect(elementWith(markup, 'data-post-form="reply"')).toContain(418 'data-refusal="Denounced"'419 );420 })421 );422});423424const platformOf = () =>425 Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(426 Layer.provide(427 Layer.mergeAll(
52 unmodified lines
modified:apps/web/test/env.test.tsx+4 added-8 removed
222 unmodified lines
223 'href="/oscabriel/datekit/commit/9b1c3e5d7f9a1b3c5d7e9f1a3b5c7d9e1f3a5b7c"'224 );225 });226227 it("shows no value and no control to set or read one, only the CLI line, numbered", () => {227 it("shows no value, no control to set or read one, and no command", () => {228 const markup = markupOf(page);229230 for (const control of ["<input", "<textarea", "<form", "<select"]) {231 expect(markup).not.toContain(control);
1 unmodified line
233234 expect(markup).not.toMatch(/reveal|show value/iu);235 // The placeholder unlanded code sees is not a value, but reads like one.236 expect(markup).not.toContain("placeholder-sentry-auth-token");237 expect(plainText(environmentOf(markup))).toContain(238 `${Brand.cli} env set <KEY> --project oscabriel/datekit --yes`239 );237 expect(plainText(environmentOf(markup))).not.toContain(Brand.cli);238 });239240 it("shows the posture the project's own ledger gives in its status line", () => {241 const layered = markupOf(
82 unmodified lines
324 );325});326327describe("a project with nothing landed", () => {330 it("says it has no environment yet, rather than that it is unknown, with the command to read it", () => {328 it("says it has no environment yet, rather than that it is unknown, with no command", () => {329 const view = tabWith();330 const text = plainText(environmentOf(markupOf(view)));331332 expect(markupOf(view)).toMatch(/<h1\b[^>]*>Visibility<\/h1>/u);333 expect(text).toContain("Nothing has landed in oscabriel/datekit yet");336 expect(text).toContain(337 `${Brand.cli} env shape --project oscabriel/datekit`338 );334 expect(text).not.toContain(`${Brand.cli} env shape`);335 expect(text).not.toContain("UnknownProject");336 });337});338
108 unmodified lines
modified:apps/web/test/facts.test.tsx+104 added-27 removed
15 unmodified lines
16 TakeItFacts,17 TerritoryFacts,18 verdictProvenance,19} from "../src/features/shared/facts.tsx";20import type { ClaimControl } from "../src/features/shared/facts.tsx";21import { ask, landing, now, suite, verdictOf } from "./ask-fixtures.ts";22import {21 ask,22 askId,23 landing,24 now,25 project,26 suite,27 verdictOf,28} from "./ask-fixtures.ts";29import {23 allInOrder,24 attributeOf,25 markupOf,26 tagsWith,
3 unmodified lines
30import { renderAt } from "./render.tsx";3132const tamsin = Handle.make("tamsin");3334const ignore = () => {};3536const control = (overrides: Partial<ClaimControl> = {}): ClaimControl => ({37 busy: false,38 here: "/oscabriel/datekit/asks/parse-iso-week",39 onClaim: ignore,40 onRelease: ignore,41 signedIn: true,42 ...overrides,43});4445const actions = (markup: string, action: string) =>46 tagsWith(markup, "data-action").filter((tag) =>47 tag.includes(`data-action="${action}"`)48 );4950const remote =51 "https://git.example.dev/oscabriel/datekit--parse-iso-week--tamsin.git";5253const checking = Outcome.cases.Checking.make({ stage: "checks" });5455describe(FactBlock, () => {56 it("heads its content with its label", () => {
20 unmodified lines
77 expect(text).toContain("2 h ago");78 expect(text).not.toMatch(/until|deadline|expires|lapses|left/iu);79 });8069 it("tells the claimant they hold it, with what they run next", () => {81 it("tells the claimant they hold it, with no command to run", () => {82 const text = textOf(83 <ClaimFacts claimant={tamsin} now={now} viewer={tamsin} />84 );8586 expect(text).toContain("You hold this claim");75 expect(text).toContain(`${Brand.cli} check`);76 expect(text).toContain("git push");87 expect(text).not.toContain(`${Brand.cli} check`);88 expect(text).not.toContain("git push");89 });9091 it("gives the claimant their fork's address to push to, copyable, and a way to release it", () => {92 const markup = markupOf(93 <ClaimFacts94 claimant={tamsin}95 control={control({ remote })}96 now={now}97 viewer={tamsin}98 />99 );100101 expect(textIn(markup)).toContain("Push your answer to your fork");102 expect(actions(markup, "release")).toHaveLength(1);103 expect(markup).toContain('aria-label="Copy the fork&#x27;s address"');104 expect(textIn(markup)).toContain(remote);105 });106107 it("offers no release to someone who does not hold the claim", () => {108 const markup = markupOf(109 <ClaimFacts110 claimant={tamsin}111 control={control({ remote })}112 now={now}113 viewer={Handle.make("okonkwo")}114 />115 );116117 expect(markup).not.toContain('data-action="release"');118 expect(markup).not.toContain(remote);119 });120121 it("holds its button while a release is on its way, and says why one failed", () => {122 const markup = markupOf(123 <ClaimFacts124 claimant={tamsin}125 control={control({ busy: true, failure: <p>NotClaimed</p> })}126 now={now}127 viewer={tamsin}128 />129 );130131 expect(attributeOf(actions(markup, "release")[0] ?? "", "disabled")).toBe(132 ""133 );134 expect(textIn(markup)).toContain("Releasing…");135 expect(textIn(markup)).toContain("NotClaimed");136 });137});138139describe(CreditFacts, () => {140 it("puts the agents below the line that says they are not credit", () => {
114 unmodified lines
255 });256});257258describe(StateFacts, () => {200 it("repeats the status line and gives the next command", () => {259 it("repeats the status line, with no next command", () => {260 const text = textOf(202 <StateFacts203 command={`${Brand.cli} status`}204 subject={{ kind: "answer", outcome: checking }}205 />261 <StateFacts subject={{ kind: "answer", outcome: checking }} />262 );263264 expect(text).toContain("Checking at the checks stage");209 expect(text).toContain(`${Brand.cli} status`);265 expect(text).not.toContain(Brand.cli);266 });267});268269describe(TakeItFacts, () => {214 it("says who may take an ask held for newcomers, then clone, claim and check in order", () => {270 it("says who may take an ask held for newcomers, with no command to clone, claim or check", () => {271 const text = textOf(272 <TakeItFacts273 ask={{ ...ask, mentor: Handle.make("okonkwo"), reserve: "newcomers" }}218 platformUrl="https://platform.example"274 />275 );276277 expect(text).toContain("Held for newcomers, mentored by okonkwo");223 expect(224 allInOrder(text, [225 `git clone https://platform.example/${project}.git`,226 `${Brand.cli} claim ${askId} --project ${project}`,227 `${Brand.cli} check`,228 ])229 ).toBeTruthy();278 expect(text).not.toContain("git clone");279 expect(text).not.toContain(Brand.cli);280 });281282 it("claims it with a button for a signed-in reader", () => {283 const markup = markupOf(<TakeItFacts ask={ask} control={control()} />);284285 expect(actions(markup, "claim")).toHaveLength(1);286 expect(textIn(markup)).toContain("Claim it");287 expect(markup).not.toContain("/auth/signin");288 });289290 it("asks a signed-out reader to sign in and come back, with no button", () => {291 const markup = markupOf(292 <TakeItFacts ask={ask} control={control({ signedIn: false })} />293 );294295 expect(markup).not.toContain('data-action="claim"');296 expect(markup).toContain(297 'href="/auth/signin?return=%2Foscabriel%2Fdatekit%2Fasks%2Fparse-iso-week"'298 );299 expect(textIn(markup)).toContain("Sign in to claim it");300 });301302 it("draws no control at all when the page hands it none", () => {303 const markup = markupOf(<TakeItFacts ask={ask} />);304305 expect(markup).not.toContain("<button");306 expect(markup).not.toContain("/auth/signin");307 });308});309310describe(TerritoryFacts, () => {311 it.effect(
48 unmodified lines
modified:apps/web/test/family.test.tsx+7 added-17 removed
197 unmodified lines
198 );199 })200 );201202 it.effect(203 "holds each open child's claim command as text, folded or not",204 () =>205 Effect.gen(function* () {206 for (const expanded of [false, true]) {207 const markup = yield* strip({ expanded });202 it.effect("holds no claim command for any child, folded or not", () =>203 Effect.gen(function* () {204 for (const expanded of [false, true]) {205 const markup = yield* strip({ expanded });206209 for (const open of ["burrow-notify", "burrow-search"]) {210 expect(markup).toContain(211 `<code class="sr-only">${Brand.cli} claim ${id(open)} --project oscabriel/burrow</code>`212 );213 }214215 // A child someone holds, or that landed, has none.216 expect(markup).not.toContain(`claim ${id("burrow-catalog")} `);217 expect(markup).not.toContain(`claim ${id("burrow-auth")} `);218 }219 })207 expect(markup).not.toContain(`${Brand.cli} claim`);208 }209 })210 );211212 it.effect(213 "lists the children as rows when expanded, the delete child apart",
131 unmodified lines
modified:apps/web/test/finish.test.tsx+95 added-35 removed
19 unmodified lines
20 ProjectName,21 RepoPath,22 TreeSha,23} from "@repo/protocol/ids";24import { Weakened } from "@repo/protocol/refusal";25import { DateTime, Option } from "effect";24import { StaleBase, Weakened } from "@repo/protocol/refusal";25import { Cause, DateTime, Option } from "effect";26import type { ReactElement } from "react";27import { renderToStaticMarkup } from "react-dom/server";2829import type { PlacedRefusal } from "../src/features/finish/annotation.tsx";30import { patchFiles } from "../src/features/finish/files.ts";31import {32 finishInput,33 FinishView,31import { FinishView } from "../src/features/finish/finish-view.tsx";34} from "../src/features/finish/finish-view.tsx";35import type {36 FinishDecision,37 FinishViewProps,38} from "../src/features/finish/finish-view.tsx";36import { changedFiles, patchOf } from "../src/features/finish/patch.ts";39import {40 answererOf,41 changedFiles,42 patchOf,43} from "../src/features/finish/patch.ts";44import {45 marksKey,46 readMarks,47 writeMark,48} from "../src/features/finish/read-marks.ts";49import { CallFailure } from "../src/features/shared/call-failure.tsx";5051const ENTITIES: ReadonlyMap<string, string> = new Map([52 ["&#x27;", "'"],53 ["&amp;", "&"],
14 unmodified lines
68 .replaceAll(/\s+/gu, " ");6970const textOf = (element: ReactElement) => textIn(markupOf(element));7164const PLATFORM_URL = "https://platform-test.example.workers.dev";6572const datekit = ProjectName.make("oscabriel/datekit");7374const parseIso = AskId.make("parse-iso");75
124 unmodified lines
200 decision={decision}201 files={filesOf(decision)}202 now={now}203 onDecide={() => {}}198 platformUrl={PLATFORM_URL}204 {...extra}205 />206);207
76 unmodified lines
284 "export const parse = (text: string) => fromIso(text);"285 );286 });287283 it("numbers the three lines that finish it", () => {284 const markup = markupOf(pageOf(withPatch));288 it("gives no command lines to finish it from a clone", () => {289 const markup = markupOf(pageOf(withPatch, { verdict }));290 const text = textOf(pageOf(withPatch, { verdict }));291286 const list =287 /<ol[^>]*data-finish-lines=""[^>]*>(?<items>[\s\S]*?)<\/ol>/u.exec(markup)288 ?.groups?.items;289290 expect([...(list ?? "").matchAll(/<li\b/gu)]).toHaveLength(3);292 expect(markup).not.toContain("data-finish-lines");293 expect(text).not.toContain("git fetch");294 expect(text).not.toContain(`${Brand.cli} finish`);295 });296293 it("without a patch, shows the lines that fetch the head and finish it, and no diff", () => {297 it("without a patch, shows no diff and no command lines", () => {298 const element = pageOf(withoutPatch);295 const text = textOf(element);299297 expect(text).toContain(`git fetch ${PLATFORM_URL}/`);298 expect(text).toContain(` ${head}`);299 expect(text).toContain(300 `${Brand.cli} finish parse-iso --project oscabriel/datekit`301 );300 expect(textOf(element)).not.toContain(`${Brand.cli} finish`);301 expect(markupOf(element)).not.toContain("<diffs-container");302 expect(markupOf(element)).not.toContain('data-diff="');303 });304306 it("fetches from the answer's fork when the decision names it, and finishes from the verdict's base", () => {307 const named = finishOf([308 ...withoutPatch.evidence,309 { label: "fork", value: "datekit--parse-iso--ines-v" },310 ]);311312 const text = textOf(pageOf(named, { verdict }));313314 expect(text).toContain(315 `git fetch ${PLATFORM_URL}/datekit--parse-iso--ines-v.git ${head}`316 );317 expect(text).toContain(`--base ${base}`);318 });319305 it("shows the ask's want and the verdict beside the diff", () => {306 const element = pageOf(withPatch, { ask, verdict });307308 expect(textOf(element)).toContain(
13 unmodified lines
322 );323 });324});325326const finishButtonOf = (markup: string) =>327 /<button\b[^>]*data-action="finish"[^>]*>/u.exec(markup)?.[0] ?? "";328329const onTop = CommitSha.make("f".repeat(40));330331describe("finishing it from the page", () => {332 it("offers no Finish while the fork's head is still the answer's own", () => {333 const element = pageOf(withPatch, {334 forkHead: Option.some(head),335 onFinish: () => {},336 verdict,337 });338339 expect(finishButtonOf(markupOf(element))).toContain('disabled=""');340 expect(textOf(element)).toContain("Nothing is on top of the answer yet");341 });342343 it("offers Finish once commits sit on top, and finishes from the verdict's base at the fork's head", () => {344 const markup = markupOf(345 pageOf(withPatch, {346 forkHead: Option.some(onTop),347 onFinish: () => {},348 verdict,349 })350 );351352 expect(finishButtonOf(markup)).not.toBe("");353 expect(finishButtonOf(markup)).not.toContain('disabled=""');354 expect(finishInput(withPatch, verdict, Option.some(onTop))).toStrictEqual(355 Option.some({356 ask: parseIso,357 base,358 head: onTop,359 project: datekit,360 requestId: `finish-${onTop}`,361 })362 );363 });364365 it("finishes nothing with no verdict to take the base from, or no fork head", () => {366 expect(finishInput(withPatch, undefined, Option.some(onTop))).toStrictEqual(367 Option.none()368 );369 expect(finishInput(withPatch, verdict, Option.none())).toStrictEqual(370 Option.none()371 );372 });373374 it("shows a refused finish as the refusal", () => {375 const markup = markupOf(376 pageOf(withPatch, {377 finishFailure: (378 <CallFailure379 cause={Cause.fail(380 new StaleBase({ base, conflicts: [], main: onTop })381 )}382 doing="finish it"383 here="/oscabriel/datekit/decisions/dec-000007"384 />385 ),386 forkHead: Option.some(onTop),387 verdict,388 })389 );390391 expect(markup).toContain('data-refusal="StaleBase"');392 });393394 it("reads the answerer from the decision's answer evidence, to find their fork", () => {395 expect(answererOf(withPatch)).toStrictEqual(396 Option.some(Handle.make("ines-v"))397 );398 });399});400401describe("a finish taken on its page", () => {402 it("keeps the choice's record at the diff's foot, where its choices were, and offers them no more", () => {403 const markup = markupOf(404 pageOf({
153 unmodified lines
modified:apps/web/test/front.test.tsx+20 added-127 removed
33 unmodified lines
34} from "../src/features/front/filter.ts";35import type { FrontFilter } from "../src/features/front/filter.ts";36import { FrontPageView } from "../src/features/front/front-page.tsx";37import type { FrontPageProps } from "../src/features/front/front-page.tsx";38import {39 dismissHowTo,40 readHowToDismissed,41} from "../src/features/front/how-to.tsx";38import { FrontPageData, readFrontPage } from "../src/server/front-page.ts";39import { ask as parseIsoWeek } from "./ask-fixtures.ts";40import { textIn } from "./markup.ts";41import { renderAt } from "./render.tsx";
30 unmodified lines
7273const filtersIn = (markup: string) =>74 /<nav aria-label="Filter the asks"[\s\S]*?<\/nav>/u.exec(markup)?.[0] ?? "";7580const stripIn = (markup: string) =>81 /<section\b[^>]*data-how-to=""[\s\S]*?<\/section>/u.exec(markup)?.[0] ?? "";8276const now = DateTime.makeUnsafe("2026-10-07T12:00:00Z");7778const entries = Schema.decodeSync(Schema.Array(FrontPageEntry))([79 {
347 unmodified lines
427 })428 );429430 it.effect(438 "gives an ask the viewer may take its claim command as text in its copy button, with no command box",431 "gives an ask the viewer may take no claim command, no copy button and no command box",432 () =>433 Effect.gen(function* () {434 const row = rowOf(yield* front({}), "fix-week-start");435443 expect(row).toMatch(444 new RegExp(445 `<button[^>]*aria-label="Copy claim command"[\\s\\S]*?<code[^>]*>${Brand.cli} claim fix-week-start --project oscabriel/datekit</code>`,446 "u"447 )448 );449 // A command box's text is selectable whole; a row's command is a button's.436 expect(row).not.toContain(`${Brand.cli} claim`);437 expect(row).not.toContain('aria-label="Copy claim command"');438 expect(row).not.toContain("select-all");439 })440 );441
103 unmodified lines
545 ).toStrictEqual([]);546 })547 );548561 it.effect(562 "keeps one command box in the strip on a phone, the other two steps as code in the list",563 () =>564 Effect.gen(function* () {565 const strip = stripIn(yield* front({}));549 it.effect("puts no strip of steps and no command box above the list", () =>550 Effect.gen(function* () {551 const markup = yield* front({});552567 expect(568 [569 ...strip.matchAll(570 /<code\b[^>]*data-step-text=""[^>]*>(?<command>[^<]*)<\/code>/gu571 ),572 ].map(({ groups }) => groups?.command)573 ).toStrictEqual([574 `${Brand.cli} check`,575 `git push ${Brand.slug} HEAD:main`,576 ]);577 expect(strip.match(/<div class="max-tablet:hidden">/gu)).toHaveLength(578 2579 );580 })553 expect(markup).not.toContain("data-how-to");554 expect(markup).not.toMatch(/<code\b[^>]*select-all/u);555 expect(textIn(markup)).not.toContain(Brand.cli);556 })557 );558583 it.effect(584 "puts one strip of three steps above the list, each a command, with a control that dismisses it",585 () =>586 Effect.gen(function* () {587 const markup = yield* front({});588 const strip = stripIn(markup);589590 expect([591 ...strip.matchAll(/<code\b[^>]*select-all[^>]*>/gu),592 ]).toHaveLength(3);593 expect(594 [595 `${Brand.cli} claim <ask> --project <owner>/<name>`,596 `${Brand.cli} check`,597 `git push ${Brand.slug} HEAD:main`,598 ].filter((command) => !textIn(strip).includes(command))599 ).toStrictEqual([]);600 expect(strip).toMatch(601 /<button\b[^>]*aria-label="Dismiss how to take an ask"/u602 );603 expect(markup.indexOf("data-how-to")).toBeLessThan(604 markup.indexOf("data-board=")605 );606 expect(strip).toContain('href="/llms.txt"');607 })608 );609559 it.effect("with an ask selected, marks its row and opens no inspector", () =>560 Effect.gen(function* () {561 const markup = yield* renderAt(562 "/asks?ask=fix-week-start",
17 unmodified lines
580 })581 );582583 it.effect(635 "says an empty front page is empty, with the command that starts a project",584 "says an empty front page is empty, with a link to bring a project and no command",585 () =>586 Effect.gen(function* () {638 const text = textIn(yield* front({}, { entries: [], projects: [] }));587 const markup = yield* front({}, { entries: [], projects: [] });588 const text = textIn(markup);589590 expect(text).toContain("No open asks");641 expect(text).toContain(`${Brand.cli} init`);591 expect(markup).toMatch(592 /<a\b[^>]*href="\/import"[^>]*>Bring a project here<\/a>/u593 );594 expect(text).not.toContain(Brand.cli);595 })596 );597598 it.effect(646 "says a front page with projects but no asks needs an ask opened",599 "says a front page with projects but no asks has none open, with no command",600 () =>601 Effect.gen(function* () {602 const text = textIn(yield* front({}, { entries: [] }));603604 expect(text).toContain("No open asks");652 expect(text).toContain(`${Brand.cli} ask open`);605 expect(text).not.toContain(Brand.cli);606 })607 );608});609
168 unmodified lines
778 })779 );780});781829/** A browser's storage held in a map, so a test reads back what was kept. */830const memoryStorage = (): Storage => {831 const kept = new Map<string, string>();832833 return {834 clear: () => {835 kept.clear();836 },837 getItem: (key) => kept.get(key) ?? null,838 key: (index) => [...kept.keys()][index] ?? null,839 get length() {840 return kept.size;841 },842 removeItem: (key) => {843 kept.delete(key);844 },845 setItem: (key, value) => {846 kept.set(key, value);847 },848 };849};850851const blocked = () => {852 throw new Error("blocked");853};854855/** Storage a private window or a blocked site refuses. */856const refusingStorage = (): Storage => ({857 clear: blocked,858 getItem: blocked,859 key: blocked,860 length: 0,861 removeItem: blocked,862 setItem: blocked,863});864865describe("the strip's dismissal", () => {866 it("is remembered in the storage it is given, and is not until then", () => {867 const storage = memoryStorage();868869 expect(readHowToDismissed(storage)).toBeFalsy();870871 dismissHowTo(storage);872873 expect(readHowToDismissed(storage)).toBeTruthy();874 expect(storage).toHaveLength(1);875 });876877 it("shows the strip when there is no storage, or the storage refuses", () => {878 expect(readHowToDismissed()).toBeFalsy();879 expect(readHowToDismissed(refusingStorage())).toBeFalsy();880 expect(() => {881 dismissHowTo(refusingStorage());882 }).not.toThrow();883 });884});885782describe("the front page's views", () => {783 const sources: Readonly<Record<string, string>> = import.meta.glob(784 "../src/features/front/**/*.{ts,tsx}",785 { eager: true, import: "default", query: "?raw" }
3 unmodified lines
789 expect(Object.keys(sources).length).toBeGreaterThanOrEqual(1);790 expect(reachingTransport(sources)).toStrictEqual([]);791 });792897 it("never write a cookie: the strip's dismissal is kept in localStorage", () => {793 it("never write a cookie", () => {794 expect(795 Object.entries(sources).flatMap(([path, source]) =>796 /document\.cookie|cookieStore|set-cookie/iu.test(source) ? [path] : []797 )798 ).toStrictEqual([]);903 expect(sources["../src/features/front/how-to.tsx"]).toContain(904 "localStorage"905 );799 });800});
modified:apps/web/test/home.test.tsx+26 added-32 removed
75 unmodified lines
76 /data-stage="(?<stage>[^"]+)" data-state="(?<state>[^"]+)"/gu77 ),78 ].map((found) => `${found.groups?.stage} ${found.groups?.state}`);7980const commandsOf = (markup: string) =>81 [...markup.matchAll(/<code\b[^>]*>(?<command>.*?)<\/code>/gsu)].map((found) =>82 textIn(found.groups?.command ?? "").trim()80const cliCommandsOf = (markup: string) =>81 [...markup.matchAll(/<code\b[^>]*>(?<command>.*?)<\/code>/gsu)].flatMap(82 (found) => {83 const code = textIn(found.groups?.command ?? "").trim();8485 return code.startsWith(`${Brand.cli} `) ? [code] : [];86 }87 );8889const claim = (fields: Partial<typeof ClaimView.Encoded> = {}) =>90 Schema.decodeSync(ClaimView)({
58 unmodified lines
149});150151describe("the inbox, for the asks a reader holds and may take", () => {152 it.effect(149 "shows a running claim by its want, with its check command, and a refused answer with its next command",153 "shows a running claim by its want and a refused answer, with no command to copy for either",154 () =>155 Effect.gen(function* () {156 const markup = yield* pageOf({157 held: 2,
16 unmodified lines
174175 expect(textIn(markup)).toContain(176 "A week starts on the locale's first day."177 );174 expect(commandsOf(markup)).toStrictEqual(175 expect.arrayContaining([176 `${Brand.cli} check fix-week-start --project oscabriel/datekit`,177 `${Brand.cli} claim parse-iso-week`,178 ])179 );178 expect(cliCommandsOf(markup)).toStrictEqual([]);179 expect(markup).not.toMatch(/Copy (?:next|check) command/u);180 // A refusal a new push can mend turns back, in its own mark.181 expect(markup).toContain("lucide-rotate-ccw");182 expect(markup).toContain(183 'href="/oscabriel/datekit/answers/parse-iso-week"'
121 unmodified lines
305 })306 );307308 it.effect(309 "says so, with a command, when the decisions or the asks did not come, rather than showing none",309 "says so, with no command, when the decisions or the asks did not come, rather than showing none",310 () =>311 Effect.gen(function* () {312 const markup = yield* pageOf({313 asks: Takeable.cases.Unreachable.make({}),
4 unmodified lines
318319 expect(text).toContain("Your decisions did not come");320 expect(text).toContain("The asks did not come");321 expect(text).not.toContain("No open ask is yours to take");322 expect(commandsOf(markup)).toStrictEqual(323 expect.arrayContaining([`${Brand.cli} today`, `${Brand.cli} front`])324 );322 expect(cliCommandsOf(markup)).toStrictEqual([]);323 })324 );325328 it.effect(329 "with no claim, gives the claim command for the first ask the reader may take",330 () =>331 Effect.gen(function* () {332 const markup = yield* pageOf({333 asks: Takeable.cases.Listed.make({ asks: [takeable] }),334 });326 it.effect("with no claim, says so and gives no claim command", () =>327 Effect.gen(function* () {328 const markup = yield* pageOf({329 asks: Takeable.cases.Listed.make({ asks: [takeable] }),330 });331336 expect(textIn(markup)).toContain("You hold no claim.");337 expect(commandsOf(markup)).toContain(338 `${Brand.cli} claim split-format --project oscabriel/burrow`339 );340 })332 expect(textIn(markup)).toContain("You hold no claim.");333 expect(cliCommandsOf(markup)).toStrictEqual([]);334 })335 );336337 it.effect("links the reader's handle and their record", () =>338 Effect.gen(function* () {
4 unmodified lines
343 })344 );345346 it.effect(353 "past the claims it shows, says how many there are and gives the command for every one",347 "past the claims it shows, says how many there are, with no command",348 () =>349 Effect.gen(function* () {350 const markup = yield* pageOf({351 held: 14,
1 unmodified line
353 work: [{ claim: claim() }],354 });355356 expect(textIn(markup)).toContain("The newest 10 of your 14 claims");363 expect(commandsOf(markup)).toContain(`${Brand.cli} status`);357 expect(cliCommandsOf(markup)).toStrictEqual([]);358 })359 );360});361
108 unmodified lines
470 60_000471 );472473 it.live(480 "signed out, says what the page is, how to sign in and come back, and the command",474 "signed out, says what the page is and how to sign in and come back, with no command",475 () =>476 Effect.gen(function* () {477 const markup = yield* pageFrom(yield* readInbox({}));478485 expect(textIn(markup)).toContain(`${Brand.cli} status`);479 expect(textIn(markup)).not.toContain(`${Brand.cli} status`);480 expect(markup).toContain(481 `href="/auth/signin?return=${encodeURIComponent("/inbox")}"`482 );483 expect(sectionsOf(markup)).toStrictEqual([]);
7 unmodified lines
491 "Cache-Control": "private, no-store",492 });493 });494501 it("is drawn in the project shell", () => {502 expect(Route.options.staticData?.shell).toBe("project");495 it("is drawn in the site shell, ruled as Explore and Asks are", () => {496 expect(Route.options.staticData?.shell).toBe("site");497 });498});499500const movedFrom = (searchStr: string) =>
21 unmodified lines
modified:apps/web/test/icons.test.ts+4 added-4 removed
1// The site has no logomark: wherever a file must stand for it (the tab's icon, a home screen's, the manifest's),2// it draws the repeat button emoji as text on the paper, and each raster is that drawing at its size.2// it draws the repeat button emoji as text, filling the square, and each raster is that drawing at its size.3import { describe, expect, it } from "@effect/vitest";45import svg from "../public/icons/icon.svg?raw";6import { themeColors } from "../src/features/shared/theme.ts";67const rasters: Readonly<Record<string, string>> = import.meta.glob(8 "../public/**/*.{png,ico}",9 { eager: true, import: "default", query: "?inline" }
37 unmodified lines
47 /<(?:path|polygon|polyline|circle|ellipse|line)\b/u48 );49 });5052 it("lays the emoji on the light paper", () => {53 expect(svg).toContain(`fill="${themeColors.light}"`);51 it("lays the emoji on no ground of its own, in its own colours", () => {52 expect(svg).not.toMatch(/<rect\b/u);53 expect(svg).not.toContain("filter");54 });5556 it("keeps each raster at the size its place asks for", () => {57 expect(pngSize("../public/apple-touch-icon.png")).toStrictEqual([180, 180]);
5 unmodified lines
modified:apps/web/test/import.test.tsx+2 added-2 removed
63 unmodified lines
64 expect(importSearch({ url: CLICK })).toStrictEqual({ url: CLICK });65 expect(importSearch({ url: 3 })).toStrictEqual({});66 });6768 it("signed out, shows no form and a sign-in link that comes back to /import", () => {68 it("signed out, shows no form, no command and a sign-in link that comes back to /import", () => {69 const markup = markupOf(70 <ImportView handle={Option.none()} here="/import" />71 );7273 expect(markup).not.toContain("<form");74 expect(returnOf(markup)).toBe("/import");75 expect(textIn(markup)).toContain(`${Brand.cli} init --project`);75 expect(textIn(markup)).not.toContain(`${Brand.cli} init`);76 });7778 it("says so while it learns who is signed in", () => {79 const markup = markupOf(
389 unmodified lines
modified:apps/web/test/keys.test.tsx+10 added-14 removed
72 unmodified lines
73 { kind: "previousFile" },74 ]);75 });7677 it("copies the page's numbered commands with 1 to 9, and nothing with 0", () => {78 expect(intentOf(press("1"), true)).toStrictEqual({79 index: 1,80 kind: "copy",81 });82 expect(intentOf(press("9"), true)).toStrictEqual({83 index: 9,84 kind: "copy",85 });86 expect(intentOf(press("0"), true)).toBeUndefined();77 it("leaves the digits to the browser: no page has a numbered command to copy", () => {78 for (const key of ["0", "1", "9"]) {79 expect(intentOf(press(key), true)).toBeUndefined();80 }81 });8283 it("clears with Escape", () => {84 expect(intentOf(press("Escape"), true)).toStrictEqual({ kind: "clear" });85 });8687 it("does nothing once the switch is off, but ? still opens the dialog that holds it", () => {88 expect(intentOf(press("j"), false)).toBeUndefined();95 expect(intentOf(press("1"), false)).toBeUndefined();89 expect(intentOf(press("J"), false)).toBeUndefined();90 expect(intentOf(press("?"), false)).toStrictEqual({ kind: "keys" });91 });9293 it("does nothing while focus is in a text field, ? and Escape included", () => {94 expect(101 ["j", "?", "1", "Escape"].map((key) => intentOf(press(key, true), true))95 ["j", "?", "J", "Escape"].map((key) => intentOf(press(key, true), true))96 ).toStrictEqual([undefined, undefined, undefined, undefined]);97 });9899 it("leaves a press with Ctrl, Alt or Meta to the browser", () => {100 expect(intentOf({ ...press("k"), ctrlKey: true }, true)).toBeUndefined();101 expect(intentOf({ ...press("j"), metaKey: true }, true)).toBeUndefined();108 expect(intentOf({ ...press("1"), altKey: true }, true)).toBeUndefined();102 expect(intentOf({ ...press("J"), altKey: true }, true)).toBeUndefined();103 });104});105106describe("the switch", () => {
78 unmodified lines
185 groups?.classes?.split(" ").includes("text-label") !== true186 )187 ).toStrictEqual([]);188195 for (const key of ["?", "j", "k", "J", "K", "1", "9", "Esc"]) {189 for (const key of ["?", "j", "k", "J", "K", "Esc"]) {190 expect(markup).toContain(`<kbd`);191 expect(text).toContain(key);192 }193194 expect(text).not.toContain("numbered command");195 });196});
modified:apps/web/test/ledger.test.tsx+2 added-8 removed
394 unmodified lines
395 expect(whenOf(markup, 'data-seq="7"')).toBe("22 h ago");396 expect(markup).not.toMatch(/>in \d+ (?:min|h|d)</u);397 });398399 it("puts what is held back, the CLI line and what each disclosure means in its facts, and says the posture in its status line, not again there", () => {399 it("puts what is held back and what each disclosure means in its facts, with no CLI line, and says the posture in its status line, not again there", () => {400 const markup = markupOf(page);401 const facts = factsOf(markup);402 const text = plainText(facts);403
7 unmodified lines
411 "export",412 "7 sealed checks",413 "parser",414 "4 sealed checks",415 `${Brand.cli} ledger --project oscabriel/datekit`,415 "sealed: counts, authors and a salted root",416 "write-only: names, and who set each value and when",417 ])418 ).toBeTruthy();420 // The command is the text of the one code element a tap selects whole.421 expect(422 plainText(423 /<code\b[^>]*select-all[^>]*>.*?<\/code>/u.exec(facts)?.[0] ?? ""424 )425 ).toContain("ledger --project oscabriel/datekit");419 expect(text).not.toContain(`${Brand.cli} ledger`);420 });421422 it("shows a project without layers as Open, with nothing held back", () => {423 const view = tabWith(open);
385 unmodified lines
added:apps/web/test/no-cli-commands.test.ts+54 added
1import { describe, expect, it } from "@effect/vitest";23/**4 * A page shows what it is about, never the CLI commands that would do it from5 * a terminal. The CLI's own pages name its commands: Install, the landing's6 * install line and transcript, and an ask's Markdown, which an agent reads.7 */8const NAMES_THE_CLI = new Set([9 "../src/features/agents/catalog.ts",10 "../src/features/agents/install-page.tsx",11 "../src/features/ask/markdown.ts",12 "../src/features/landing/landing-page.tsx",13 "../src/features/landing/transcript.ts",14 "../src/features/landing/ways-in.tsx",15]);1617/** A command box shows only an install line or a git clone. */18const DRAWS_A_COMMAND = new Set([19 "../src/features/agents/install-page.tsx",20 "../src/features/code/code-bar.tsx",21 "../src/features/landing/landing-page.tsx",22 "../src/features/project/project-header.tsx",23 "../src/features/shared/command.tsx",24]);2526describe("the web's pages", () => {27 // Keys only: the sources as text.28 const sources: Readonly<Record<string, string>> = import.meta.glob(29 ["../src/features/**/*.{ts,tsx}", "../src/routes/**/*.{ts,tsx}"],30 { eager: true, import: "default", query: "?raw" }31 );3233 const files = (test: (source: string) => boolean) =>34 Object.entries(sources).flatMap(([file, source]) =>35 test(source) ? [file] : []36 );3738 it("name the CLI only on its own pages", () => {39 expect(Object.keys(sources).length).toBeGreaterThan(50);40 expect(41 files((source) => /Brand\.cli\b/u.test(source)).filter(42 (file) => !NAMES_THE_CLI.has(file)43 )44 ).toStrictEqual([]);45 });4647 it("draw a command box only for an install line or a git clone", () => {48 expect(49 files((source) => /\bCommandLine\b/u.test(source)).filter(50 (file) => !DRAWS_A_COMMAND.has(file)51 )52 ).toStrictEqual([]);53 });54});
modified:apps/web/test/outcome.test.tsx+7 added-11 removed
1import { describe, expect, it } from "@effect/vitest";2import { Brand } from "@repo/brand";2import { Outcome } from "@repo/protocol/domain/outcome";3import type { StageName } from "@repo/protocol/domain/outcome";4import {5 AskId,
44 unmodified lines
5051const landed = Outcome.cases.Landed.make({ sha });5253describe(RefusalView, () => {55 it("shows every line explain gives, in order, each refusal's tag, and then its next command", () => {56 const text = textOf(<RefusalView refusals={refusals} />);54 it("shows every line explain gives, in order, and each refusal's tag, with no command to copy beside them", () => {55 const element = <RefusalView refusals={refusals} />;56 const text = textOf(element);5758 const expected = refusals.flatMap((refusal) => [59 ...explain([refusal]).map((line) => line.trim()),60 refusal.next,61 ]);58 const expected = refusals.flatMap((refusal) =>59 explain([refusal]).map((line) => line.trim())60 );6162 expect(allInOrder(text, expected)).toBeTruthy();63 expect(text).toContain("OutOfScope");64 expect(text).toContain("Weakened");6667 for (const refusal of refusals) {68 expect(refusal.next.startsWith(`${Brand.cli} `)).toBeTruthy();69 }65 expect(markupOf(element)).not.toContain("<button");66 });6768 it("points at the path and line of a refusal that has one", () => {69 const text = textOf(<RefusalView refusals={[weakened]} />);
232 unmodified lines
modified:apps/web/test/project-people.test.tsx+13 added-79 removed
1import { describe, expect, it } from "@effect/vitest";2import { commandDocs } from "@repo/agent-kit/command-doc";2import { Brand } from "@repo/brand";3import { Client, Contracts } from "@repo/protocol/contracts";4import { PolicyPending, PublicPolicy } from "@repo/protocol/domain/policy";5import { Ledger } from "@repo/protocol/domain/visibility";
123 unmodified lines
129 ].map((found) =>130 plainText((found.groups?.line ?? "").replaceAll(/ \\\n\s*/gu, " ")).trim()131 );132134const commandOf = (line: string) =>135 commandDocs(Contracts)136 .filter(({ path }) => line.startsWith(`${Brand.cli} ${path.join(" ")} `))137 .toSorted((one, other) => other.path.length - one.path.length)138 .at(0);139133const decidersOf = (markup: string) =>134 elementsWith(mainOf(markup), "data-paths=").map((row) =>135 plainText(row).trim()136 );
180 unmodified lines
317 expect(markup).not.toContain(control);318 }319320 expect(facts).toContain(`Land a change to ${Brand.configDir}/`);328 expect(facts).toContain(`${Brand.cli} ask open`);329 expect(facts).toContain(`${Brand.cli} land`);321 expect(facts).not.toContain(`${Brand.cli} `);322 expect(commandsOf(markup)).toStrictEqual([]);323 });324332 it("puts each change command on lines of its own, numbered, never one wall", () => {333 const facts = factsOf(markupOf(page));334335 const raw = [336 ...facts.matchAll(/<code\b[^>]*select-all[^>]*>(?<line>.*?)<\/code>/gsu),337 ].map((found) => found.groups?.line ?? "");338339 expect(raw).toHaveLength(2);340341 for (const command of raw) {342 expect(command.split("\n").length).toBeGreaterThan(1);343344 for (const line of command.split("\n")) {345 expect(line.split("$(git rev-parse HEAD)").length).toBeLessThan(3);346 }347 }348349 expect([...facts.matchAll(/<code\b[^>]*select-all/gu)]).toHaveLength(2);350 });351352 it("shows each command whole: a real CLI command, with every flag its payload takes and --yes", () => {353 const lines = commandsOf(factsOf(markupOf(page)));354355 expect(lines.map((line) => commandOf(line)?.contract)).toStrictEqual([356 "openAsk",357 "land",358 ]);359360 for (const line of lines) {361 const doc = commandOf(line);362 const given = line.split(" ").filter((word) => word.startsWith("--"));363364 // `--discussion` names the thread an ask came from; a change to the config folder comes from none.365 const payload = (doc?.flags ?? []).filter(366 (flag) =>367 !["--dry-run", "--json", "--yes", "--discussion"].includes(flag)368 );369370 expect(371 given.filter((flag) => !(doc?.flags ?? []).includes(flag))372 ).toStrictEqual([]);373 expect(payload.filter((flag) => !given.includes(flag))).toStrictEqual([]);374 expect(given.includes("--yes")).toBe(doc?.needsApproval);375 }376 });377325 it("adds no sealed path, check name, salt or read log to what it was given", () => {326 const markup = markupOf(page);327328 for (const leak of [
79 unmodified lines
408 markup.includes("data-paths="),409 ]).toStrictEqual([true, false]);410 });411465 it("offers the CLI lines that make a config with no config folder evaluate, each a real command", () => {466 const markup = markupOf(412 it("says the file that makes a config with no config folder evaluate, with no command to run", () => {413 const view = (414 <PeopleView415 ledger={burrowLedger}416 policy={Option.none()}417 project={ProjectName.make("oscabriel/burrow")}418 unevaluated={Option.some(noConfig)}419 />420 );421475 const lines = [476 ...commandsOf(mainOf(markup)),477 ...commandsOf(factsOf(markup)),478 ];479480 expect(lines.map((line) => commandOf(line)?.path.join(" "))).toStrictEqual([481 "init",482 "ask open",483 "land",484 ]);485 expect(lines[0]).toContain("--dry-run");486487 for (const line of lines) {488 const flags = commandOf(line)?.flags ?? [];489490 expect(491 line492 .split(" ")493 .filter((word) => word.startsWith("--"))494 .filter((flag) => !flags.includes(flag))495 ).toStrictEqual([]);496 }422 expect(423 inOrder(textOf(view), [424 "To make it evaluate, a maintainer lands a",425 `${Brand.configDir}/project.ts`,426 "that names the test command.",427 ])428 ).toBeTruthy();429 expect(textOf(view)).not.toContain(`${Brand.cli} `);430 expect(commandsOf(markupOf(view))).toStrictEqual([]);431 });432433 it("says a config folder that did not evaluate has not been evaluated, linking the folder at that commit", () => {434 const view = (
215 unmodified lines
modified:apps/web/test/project.test.tsx+27 added-50 removed
1import { describe, expect, it } from "@effect/vitest";2import { commandDocs } from "@repo/agent-kit/command-doc";2import { Brand } from "@repo/brand";3import { Client, Contracts } from "@repo/protocol/contracts";4import { AskListing } from "@repo/protocol/domain/ask";5import type { Ask } from "@repo/protocol/domain/ask";
296 unmodified lines
302 renderAt("/oscabriel/datekit", <ProjectView {...props(more)} />);303304describe(ProjectView, () => {305 it.effect(307 "lists every open ask with its want as the link, then its kind, territory and id",306 "lists every open ask with its want as the link, then its kind, territory and id, and no claim command",307 () =>308 Effect.gen(function* () {309 const row = rowOf(yield* page(), "fix-week-start");310
1 unmodified line
312 /<a\b[^>]*href="\/oscabriel\/datekit\/asks\/fix-week-start"[^>]*>A week starts on the locale&#x27;s first day, not always on Sunday\.<\/a>/u313 );314 expect(textIn(row)).toContain("bug · core · fix-week-start");315 expect(textIn(row)).toContain("Open to take");317 expect(textIn(row)).toContain(318 `${Brand.cli} claim fix-week-start --project oscabriel/datekit`319 );316 expect(textIn(row)).not.toContain(`${Brand.cli} claim`);317 })318 );319320 it.effect(
142 unmodified lines
463 })464 );465466 it.effect(470 "gives the clone command and the claim command in the about column, and the last three landings as one-line credits in the main one",467 "gives the clone command, and no claim command, in the about column, and the last three landings as one-line credits in the main one",468 () =>469 Effect.gen(function* () {470 const markup = yield* page();471 const about = textIn(aboutOf(markup));472 const landed = mainColumnOf(markup);473477 expect(478 allInOrder(about, [479 `git clone ${platformUrl}/oscabriel/datekit.git`,480 `${Brand.cli} claim <ask> --project oscabriel/datekit`,481 ])482 ).toBeTruthy();474 expect(about).toContain(475 `git clone ${platformUrl}/oscabriel/datekit.git`476 );477 expect(about).not.toContain(`${Brand.cli} `);478 expect(landed.match(/data-landing="/gu)).toHaveLength(3);479 expect(480 missingFrom(textIn(landed), [481 "Answer parse-iso-week",
25 unmodified lines
507 ).toBeTruthy();508 })509 );510516 it.effect(517 "says an empty project is empty, with the commands that would fill it",518 () =>519 Effect.gen(function* () {520 const { landedAt: _landed, ...unlanded } = listing;511 it.effect("says an empty project is empty, with no command to fill it", () =>512 Effect.gen(function* () {513 const { landedAt: _landed, ...unlanded } = listing;514522 const text = textIn(523 yield* page({524 asks: [],525 landings: [],526 listing: { ...unlanded, openAsks: 0 },527 })528 );515 const text = textIn(516 yield* page({517 asks: [],518 landings: [],519 listing: { ...unlanded, openAsks: 0 },520 })521 );522530 expect(text).toContain("No open asks");531 expect(text).toContain(`${Brand.cli} ask open`);532 expect(text).toContain("Nothing has landed");533 // The project exists, so `init` would refuse it: its first push lands main.534 expect(text).toContain(535 `git push ${platformUrl}/oscabriel/datekit.git HEAD:main`536 );537 expect(text).not.toContain(`${Brand.cli} init`);538 })523 expect(text).toContain("No open asks");524 expect(text).toContain("Nothing has landed");525 expect(text).toContain("The first push to main lands it.");526 expect(text).not.toContain(`${Brand.cli} `);527 expect(text).not.toContain("git push");528 })529 );530531 it.effect(532 "never says nothing has landed on a project whose main has landed",
560 unmodified lines
1093 );1094 })1095 );10961107 it("says the commands its popovers give whole, each a real CLI command with its project", () => {1097 it("gives the clone command in its Clone popover, and no CLI command in it or in Watch", () => {1098 const steps = textOf(1099 <>1100 <CloneSteps platformUrl={platformUrl} project={headerFacts.project} />1111 <WatchSteps project={headerFacts.project} />1101 <WatchSteps />1102 </>1103 );11041115 expect(1116 allInOrder(steps, [1117 `git clone ${platformUrl}/oscabriel/datekit.git`,1118 `${Brand.cli} claim <ask> --project oscabriel/datekit`,1119 `${Brand.cli} status --project oscabriel/datekit`,1120 ])1121 ).toBeTruthy();1122 expect(1123 commandDocs(Contracts)1124 .filter(({ path }) => ["claim", "status"].includes(path.join(" ")))1125 .map(({ flags, path }) => [path.join(" "), flags.includes("--project")])1126 ).toStrictEqual([1127 ["claim", true],1128 ["status", true],1129 ]);1105 expect(steps).toContain(`git clone ${platformUrl}/oscabriel/datekit.git`);1106 expect(steps).not.toContain(`${Brand.cli} `);1107 });1108});11091110describe("the project's header as the server sends it", () => {
404 unmodified lines
modified:apps/web/test/refs.test.tsx+9 added-18 removed
29 unmodified lines
30 ? ""31 : markup.slice(start, next === -1 ? undefined : next);32};3334const platformUrl = "https://platform-test.example.workers.dev";3534const LANDED = "1".repeat(40);3536const IMPORTED = "2".repeat(40);37
22 unmodified lines
60 { name: "v1.0.0", sha: OLDER },61 ],62 });6366 const page = <RefsView platformUrl={platformUrl} refs={refs} />;64 const page = <RefsView refs={refs} />;6566 it("is titled Refs", () => {67 expect(markupOf(page)).toMatch(/<h1\b[^>]*>Refs<\/h1>/u);68 });
20 unmodified lines
89 project: "datekit",90 tags: [],91 });9295 expect(96 textOf(<RefsView platformUrl={platformUrl} refs={empty} />)97 ).toContain("Nothing has landed on main yet.");93 expect(textOf(<RefsView refs={empty} />)).toContain(94 "Nothing has landed on main yet."95 );96 });9798 it("lists the tags newest first, each linking its tree first and its commit", () => {99 const markup = mainOf(markupOf(page));
38 unmodified lines
138 expect(plainText(fork)).toContain("Working fork of");139 expect(hrefsOf(fork)).toContain("/people/bram");140 });141144 it("puts the clone command and what a claim fork is in its facts", () => {142 it("says what a claim fork is in its facts, and gives no command there", () => {143 const facts = factsOf(markupOf(page));144147 expect(plainText(facts)).toContain(148 `git clone ${platformUrl}/oscabriel/datekit.git`149 );150 // The command is the text of the one code element a tap selects whole.151 expect(152 plainText(153 /<code\b[^>]*select-all[^>]*>.*?<\/code>/u.exec(facts)?.[0] ?? ""154 )155 ).toMatch(/^ ?git clone /u);145 expect(plainText(facts)).toContain("claim fork");146 expect(plainText(facts)).not.toContain("git clone");147 expect(facts).not.toContain("select-all");148 });149150 it("never names the platform's own refs, and says tags, not releases", () => {151 const text = textOf(page);
13 unmodified lines
165 { name: "@datekit/core@1.0.0", sha: OLDER },166 ],167 });168178 const view = <RefsView platformUrl={platformUrl} refs={one} />;169 const view = <RefsView refs={one} />;170171 expect(markupOf(page)).not.toContain("data-package=");172 expect(markupOf(view)).not.toContain("data-package=");173 expect(textOf(view)).not.toContain("Packages");
12 unmodified lines
186 );187});188189const viewOf = (refs: Refs, only?: string, from?: number) => (199 <RefsView from={from} package={only} platformUrl={platformUrl} refs={refs} />190 <RefsView from={from} package={only} refs={refs} />191);192193describe("a monorepo's refs page", () => {194 const monorepo = Schema.decodeSync(Refs)({
232 unmodified lines
modified:apps/web/test/row.test.tsx+4 added-10 removed
73 unmodified lines
74 })75 );7677 it.effect(78 "holds the claim command as text inside its copy button, named for what it copies",78 "gives an ask open to take no claim command to copy: the row is a link to the ask",79 () =>80 Effect.gen(function* () {81 const markup = yield* rowsAt(82 <AskRow listing={listing("@burrow/auth")} project={burrow} takeable />83 );8485 const command = `${Brand.cli} claim fix-week-start --project oscabriel/burrow`;8687 expect(markup).toMatch(88 new RegExp(89 `<button\\b[^>]*aria-label="Copy claim command"[^>]*>.*<code class="sr-only">${command}</code>.*</button>`,90 "su"91 )92 );85 expect(markup).not.toContain("Copy claim command");86 expect(markup).not.toContain(`${Brand.cli} claim`);87 })88 );8990 it.effect(
13 unmodified lines
104 })105 );106107 it.effect(114 "says an ask it may take is open to take, and gives one it may not no command",108 "says an ask it may take is open to take, and one it may not is claimed",109 () =>110 Effect.gen(function* () {111 const open = textIn(112 yield* rowsAt(
314 unmodified lines
modified:apps/web/test/shared.test.tsx+12 added-16 removed
67 unmodified lines
68 });69});7071describe(CopyAction, () => {72 it("holds its command as text and is named for what it copies", () => {73 const command = `${Brand.cli} claim fix-week-start --project oscabriel/datekit`;72 it("holds its text as text and is named for what it copies", () => {73 const text = "4f1c2a9e0b7d3c5f6a8e1d2b4c6f8a0e2d4b6c8f";7475 const markup = markupOf(76 <CopyAction command={command} label="Copy claim command" />77 );75 const markup = markupOf(<CopyAction label="Copy Head" text={text} />);7679 expect(markup).toMatch(/^<button\b[^>]*aria-label="Copy claim command"/u);80 expect(markup).toContain(`<code class="sr-only">${command}</code>`);77 expect(markup).toMatch(/^<button\b[^>]*aria-label="Copy Head"/u);78 expect(markup).toContain(`<code class="sr-only">${text}</code>`);79 expect(markup).toContain('aria-live="polite"');80 });81});82
100 unmodified lines
183 });184});185186describe(EmptyState, () => {189 it("says what is empty and the command that would change it", () => {190 const command = `${Brand.cli} ask open`;191 const text = textOf(<EmptyState command={command} title="No open asks" />);187 it("says what is empty, and no command", () => {188 const markup = markupOf(<EmptyState title="No open asks" />);189193 expect(text).toContain("No open asks");194 expect(text).toContain(command);195 expect(196 markupOf(<EmptyState command={command} title="No open asks" />)197 ).toContain(markupOf(<CommandLine command={command} />));190 expect(textOf(<EmptyState title="No open asks" />)).toContain(191 "No open asks"192 );193 expect(markup).not.toContain("<code");194 });195200 it("gives a way onward when no command changes it", () => {196 it("gives a way onward", () => {197 const text = textOf(198 <EmptyState199 onward={<a href="/oscabriel/datekit">Back to datekit</a>}200 title="Nobody has answered this ask yet."
52 unmodified lines
modified:apps/web/test/status-line.test.tsx+17 added-27 removed
30 unmodified lines
31 mentor: okonkwo,32 reserve: "newcomers",33};3435const claim = `${Brand.cli} claim format-ordinal --project ${project}`;3635const refusals = [36 new OutOfScope({ paths: [RepoPath.make("README.md")] }),37 new Weakened({38 at: { line: 12, path: RepoPath.make("test/parse.test.ts") },
21 unmodified lines
60 text: textOf(element),61 };62};6366const line = (subject: StatusSubject, command?: string) =>67 rendered(68 command === undefined ? (69 <StatusLine subject={subject} />70 ) : (71 <StatusLine command={command} subject={subject} />72 )73 );64const line = (subject: StatusSubject) =>65 rendered(<StatusLine subject={subject} />);6667describe(StatusLine, () => {76 it("says an open ask the viewer may take is open to take, who it is held for, and the claim", () => {77 const { markup, text, tone } = line(78 { ask: formatOrdinal, kind: "ask", takeable: true },79 claim80 );68 it("says an open ask the viewer may take is open to take and who it is held for, with no command", () => {69 const { text, tone } = line({70 ask: formatOrdinal,71 kind: "ask",72 takeable: true,73 });7475 expect(text).toContain("Open to take");76 expect(text).toContain("held for newcomers, mentored by okonkwo");84 expect(markup).toMatch(new RegExp(`<code\\b[^>]*>${claim}</code>`, "u"));77 expect(text).not.toContain(Brand.cli);78 expect(tone).toBe("muted");79 });8081 it("says who holds a claimed ask that has no answer yet, and that it is their move", () => {
19 unmodified lines
101 expect(text).toContain("the platform's move");102 expect(tone).toBe("checking");103 });104112 it("names a refusal by its headline and stage, leaves it to the answerer, and never paraphrases it", () => {113 const { text, tone } = line(114 {115 claimant: tamsin,116 kind: "answer",117 outcome: Outcome.cases.Refused.make({ refusals }),118 stage: "shape",119 },120 `${Brand.cli} check`121 );105 it("names a refusal by its headline and stage, leaves it to the answerer, and never paraphrases it or gives its next command", () => {106 const { text, tone } = line({107 claimant: tamsin,108 kind: "answer",109 outcome: Outcome.cases.Refused.make({ refusals }),110 stage: "shape",111 });112113 expect(text).toContain(`Refused at Shape: ${headline(refusals)}`);114 expect(text).toContain("tamsin's move");125 expect(text).toContain(`${Brand.cli} check`);115 expect(text).not.toContain(refusals[0].next);116 expect(tone).toBe("refused");117118 for (const words of explain(refusals).slice(1)) {119 expect(text).not.toContain(words.trim());
150 unmodified lines
modified:apps/web/test/today.test.tsx+3 added-3 removed
383 unmodified lines
384 );385386 expect(markup).toContain(markupOf(<RefusalView refusals={[refused]} />));387 expect(markup).not.toContain("data-decision");388 expect(textIn(markup)).toContain(`${Brand.cli} status`);388 expect(textIn(markup)).not.toContain(`${Brand.cli} status`);389 });390391 it("signed out, says what the inbox is in one sentence, links to sign in, and gives the command", () => {391 it("signed out, says what the inbox is in one sentence and links to sign in, with no command", () => {392 const markup = markupOf(viewOf(InboxRead.cases.SignedOut.make({})));393 const text = textIn(markup);394395 expect(text).toContain("The inbox is your own page");396 expect(markup).toMatch(397 /<a[^>]*href="\/auth\/signin[^"]*"[^>]*>Sign in<\/a>/u398 );399 expect(text).toContain(`${Brand.cli} status`);399 expect(text).not.toContain(Brand.cli);400 expect(markup).not.toContain("data-decision");401 });402403 it("shows a DecisionClosed refusal the maintainer's choice came back with", () => {
233 unmodified lines
modified:apps/web/test/tour.test.tsx+22 added-55 removed
2 unmodified lines
3import { Contracts } from "@repo/protocol/contracts";4import { explain } from "@repo/protocol/render";5import { Effect } from "effect";67import { commands } from "../src/features/agents/catalog.ts";7import {8 EXAMPLE,9 EXAMPLE_REFUSALS,10} from "../src/features/landing/transcript.ts";
28 unmodified lines
39 ),40 ].map(([step, id]) => [id, step])41 );4244/** A CLI command's words: its path and flags, as `commandDocs` lists them. */45const partsOf = (command: string) => {46 const [, ...words] = command.split(/\s+/u);4748 return {49 flags: words50 .filter((word) => word.startsWith("--"))51 .map((word) => word.split("=")[0] ?? word),52 name: words[0] ?? "",53 };54};5543describe(TourView, () => {44 it.effect(45 "walks six steps in order, each its title and sentence, with no command box",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);46 () =>47 Effect.gen(function* () {48 const markup = yield* pageWith(NEITHER);49 const steps = stepsOf(markup);5062 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 })51 expect([...steps.keys()]).toStrictEqual([52 "find",53 "read",54 "claim",55 "refused",56 "land",57 "credit",58 ]);59 expect(60 allInOrder(61 textIn(markup),62 STEPS.flatMap(({ sentence, title }) => [title, sentence])63 )64 ).toBeTruthy();65 expect(markup).not.toMatch(/<code class="[^"]*select-all"/u);66 })67 );6881 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 }8687 const { flags, name } = partsOf(command);88 const doc = commands.find(({ path }) => path.join(" ") === name);8990 if (doc === undefined) {91 return [`${command}: no such command`];92 }9394 return flags95 .filter((flag) => !doc.flags.includes(flag))96 .map((flag) => `${command}: ${name} takes no ${flag}`);97 });9899 expect(wrong).toStrictEqual([]);100 });10169 it.effect(70 "prints the refusal as the one renderer gives it, through git, with its next command and whether retrying helps",71 () =>72 Effect.gen(function* () {
124 unmodified lines
modified:packages/protocol/src/contracts.ts+5 added-6 removed
116 unmodified lines
117// Lint keeps "shape" out of code names, so the tag is spelled once, here.118const envSchemaTag = "envShape";119120const servedOn = {121 claim: ["rpc", "mcp", "cli"],121 claim: SurfaceName.literals,122 credits: SurfaceName.literals,123 decide: SurfaceName.literals,124 [envSchemaTag]: SurfaceName.literals,125 // A log may hold text an agent's transcript should not carry: never MCP.126 evidence: ["rpc", "cli"],127 finish: ["rpc", "mcp", "cli"],126 evidence: ["rpc", "cli", "web"],127 finish: SurfaceName.literals,128 fork: ["rpc", "mcp", "cli"],129 frontPage: SurfaceName.literals,130 initProject: ["rpc", "mcp", "cli", "web"],131 land: ["rpc", "mcp", "cli"],
7 unmodified lines
139 listProjects: SurfaceName.literals,140 listRefs: ["rpc", "mcp", "web"],141 log: ["rpc", "mcp", "web"],142 openAsk: ["rpc", "mcp", "cli"],143 // The web adds no form for what the CLI does: a post is made from a terminal.144 postDiscussion: ["rpc", "mcp", "cli"],143 postDiscussion: SurfaceName.literals,144 projectPolicy: SurfaceName.literals,145 readFile: ["rpc", "mcp", "web"],146 readTree: ["rpc", "mcp", "web"],147 // A list with no command: an agent asks it over MCP, a person reads it on the landing.148 recentLandings: ["rpc", "mcp", "web"],150 release: ["rpc", "mcp", "cli"],149 release: SurfaceName.literals,150 // A value must never pass through an agent's transcript, so never MCP.151 setEnv: ["rpc", "cli"],152 showAsk: SurfaceName.literals,153 showCommit: ["rpc", "web"],
1008 unmodified lines
modified:packages/protocol/test/contracts.test.ts+5 added-5 removed
263 unmodified lines
264 "Denounced",265 "CapReached",266 ],267 flags: "",268 on: "RMC",268 on: "RMCW",269 tag: "postDiscussion",270 },271 {272 audience: "decider",
22 unmodified lines
295 "NotVouched",296 "Denounced",297 ],298 flags: "I",299 on: "RMC",299 on: "RMCW",300 tag: "claim",301 },302 {303 audience: "signedIn",304 cli: "release <ask>",305 errors: ["UnknownProject", "NotClaimed"],306 flags: "I",307 on: "RMC",307 on: "RMCW",308 tag: "release",309 },310 {311 audience: "signedIn",
24 unmodified lines
336 "RepoBusy",337 "TouchedJudge",338 ],339 flags: "IA",340 on: "RMC",340 on: "RMCW",341 tag: "finish",342 },343 {344 audience: "decider",
23 unmodified lines
368 audience: "signedIn",369 cli: "evidence <ref>",370 errors: ["UnknownProject", "NotDecider"],371 flags: "RI",372 on: "RC",372 on: "RCW",373 tag: "evidence",374 },375 {376 audience: "decider",
246 unmodified lines
modified:DESIGN.md+19 added-21 removed
1---2name: Myr web3description: Four shells on warm paper, three of them ruled. What state a change is in, whose move it is, and the command that runs next.3description: Four shells on warm paper, three of them ruled. What state a change is in, whose move it is, and what to do next.4colors:5 paper: "#f8f7f4"6 paper-dark: "#0a0a0a"7 ink: "oklch(0.2417 0.0298 269.8827)"
249 unmodified lines
257---258259# Design System: the web260261The web's look, for anyone adding or changing a page. Tokens live in `apps/web/src/styles.css`. The pieces every page shares (the top bar, the footer, the project header, the row, the status line, the family fan, the fact blocks, the copy action, refusals, credit, posture, outcomes, stages, commands, marks, times, people, empty and pending states) live in `apps/web/src/features/shared/`. A page uses them rather than drawing its own. Pierre's code drawing is configured once, in `apps/web/src/features/code/pierre.ts`. Words follow `GLOSSARY.md` and `PRODUCT.md`.261The web's look, for anyone adding or changing a page. Tokens live in `apps/web/src/styles.css`. The pieces every page shares (the top bar, the footer, the project header, the row, the status line, the family fan, the fact blocks, the copy action, refusals, credit, posture, outcomes, stages, the command line, marks, times, people, empty and pending states) live in `apps/web/src/features/shared/`. A page uses them rather than drawing its own. Pierre's code drawing is configured once, in `apps/web/src/features/code/pierre.ts`. Words follow `GLOSSARY.md` and `PRODUCT.md`.262263The rules here are ADR 0041 (four shells, Overview first, no logomark, a plain sans), ADR 0042 (the theme preference), ADR 0043 (fork browsing) and the maintainer's overrides of 2026-10-12 (IBM Plex, the sage garden palette, the repeat button icon, the footer's wordmark, no fingernails, no eyebrows). Where the code has not caught up yet, this file is the target and `apps/web/test/design-rules.test.tsx` holds what it can.264265## Overview266267**Creative North Star: "Four shells on warm paper"**268269The web serves four jobs, and each gets its own frame: a site that explains the platform and lists its projects, a project with one header and its tabs, a docs site, and a focused card for signing in. All four share the top bar's contents, so moving between them never reads as a different app. Three of them are ruled: two hairlines run down the container's edges the page's full height, the top bar is a box between them under a small gap, and every rule inside runs rail to rail, so the page reads as one sheet pinned to the bench, like the music box's own ruler. A project is full-bleed: its code and diffs want the whole window. Every screen still answers three questions in this order: what state is it in, whose move is it, and what runs next. The answer to the last one is a command you can copy, shown once.269The web serves four jobs, and each gets its own frame: a site that explains the platform and lists its projects, a project with one header and its tabs, a docs site, and a focused card for signing in. All four share the top bar's contents, so moving between them never reads as a different app. Three of them are ruled: two hairlines run down the container's edges the page's full height, the top bar is a box between them under a small gap, and every rule inside runs rail to rail, so the page reads as one sheet pinned to the bench, like the music box's own ruler. A project is full-bleed: its code and diffs want the whole window. Every screen still answers three questions in this order: what state is it in, whose move is it, and what to do next. The answer to the last one is a control on the page, never a command to copy: the terminal has its own surface, the CLI.270271The pages are for operating, with one page that persuades: the landing at `/`, which draws the platform as a music box whose cylinder only its own press can pin, and leads to the open asks. Density is set by a maintainer clearing the inbox on a phone and a contributor reading a refusal beside a terminal: two-line rows (64 px), 14 px metadata, a 13 px floor. Colour means state, and always sits beside a word and a mark, so a page read in grayscale, by a screen reader or in a terminal says the same thing. In a list the colour sits on the mark and the word stays ink. The one colour that is not a state is the sage primary: the page's main action and the focus ring.272273Rejected on purpose: the dashboard look (stat tiles, big numbers over small labels, a blue link colour, pill badges, avatar stacks, coloured file icons), its glossy cousin (dark glass, blur, glows, gradients), and the terminal costume (green on black, monospace for everything). Rejected too: a logomark of any kind (crest, gate, doorway); a display serif; a coloured strip on the edge of a card; an eyebrow over a headline; a filled pill or tinted square that carries a state without its word; shadows and glows; `outline: none`; text at 12 px and greys under 4.5:1; avatars and activity sparklines; a command box that ellipsises; a column of code blocks; and spinners and shimmer in content. Monospace appears only where the text is what a terminal prints or takes: commands, refusal transcripts, trailers, SHAs, paths, ids, env keys and code.
2 unmodified lines
276277- Four shells (site, project, docs, focus), each named by its route, with no global rail and no generic right rail. The site, the docs and a focused page are ruled (the rails); a project is full-bleed.278- A project has one header and eight tabs, and opens on Overview.279- State is a mark, then a word, then a colour; red belongs to refusals, violet to sealed things, green to what is on main, olive to waiting, blue to checking. In a row the colour is the mark's; the word is ink, except Refused and Landed.280- Every action is a command to copy, shown once per screen. The only web controls that change anything are a maintainer's choices, the theme preference, and signing in or out.280- A page names no CLI command. What a person does on the web is a control: a maintainer's choices, claiming and releasing an ask, posting in a discussion, reading a failed lane's log, finishing an answer, importing a repo, the theme preference, and signing in or out. A command box shows only the install line and `git clone` (`apps/web/test/no-cli-commands.test.ts`).281- Light and dark follow the system setting, or its opposite by the reader's choice on `/settings` (ADR 0042).282- Motion carries state, never decoration: transitions of 120 to 200 ms, the landing's stamp, and the landing's music box, whose every move is a step of an answer through the gate.283284## Colors
111 unmodified lines
396Every route names exactly one shell in its `staticData` (`shell: "site" | "project" | "docs" | "focus"`), and the root draws the matching frame. The widths are tokens in `styles.css` (`@theme static`), never literals; `design-rules.test.tsx` holds this file's spacing values equal to them.397398| Shell | Routes | Container | Header | Side columns |399| --- | --- | --- | --- | --- |400| `site` | `/`, `/explore`, `/asks`, `/install`, `/privacy`, `/terms` | centred, ruled, `--container-site` (1760 px), `--gutter-site` (32 px) | framed top bar | only the filters on `/asks` (`--column-filters`, 240 px), left of the list |401| `project` | `/:owner/:project/**`, `/inbox`, `/settings`, `/people/:handle` | fluid to `--container-project` (1600 px), `--gutter-project` (28 px) | full-bleed top bar, then the page header | only the about column on Overview (`--column-about`, 340 px) and the file tree on Code (`--column-tree`, 280 px) |400| `site` | `/`, `/explore`, `/asks`, `/inbox`, `/settings`, `/people/:handle`, `/install`, `/privacy`, `/terms` | centred, ruled, `--container-site` (1760 px), `--gutter-site` (32 px) | framed top bar | only the filters on `/asks` (`--column-filters`, 240 px), left of the list |401| `project` | `/:owner/:project/**` | fluid to `--container-project` (1600 px), `--gutter-project` (28 px) | full-bleed top bar, then the page header | only the about column on Overview (`--column-about`, 340 px) and the file tree on Code (`--column-tree`, 280 px) |402| `docs` | `/docs/**` | centred, ruled, `--container-site` (1760 px) | the site's top bar | nav tree `--column-docs-nav` (240 px), parted from the article by a rule its full height; the article at `--measure` (72ch) with "on this page" (`--column-docs-toc`, 220 px) beside it, hugging it, the rest of the frame paper |403| `focus` | sign-in, MCP consent, new project | a centred, ruled card, `--container-focus` (400 px) | the wordmark only, in the framed bar | none |404405A shell sets its gutter once, on its frame, and every bar and page inside it reads it: 16 px on a phone, 20 px from `tablet`, and from `shell` (1120 px) `--gutter-site` in the site, the docs and a focused page, or `--gutter-project` in a project.
5 unmodified lines
411**The four rules (ADR 0041):**412413- **No global left rail.** The project list moves to Explore and the account menu; a project's navigation is its tabs.414- **No generic right rail.** A side column exists only where it holds facts about what is on screen (a project's about column, a doc's headings), 220 to 340 px wide, and stacks under 1100 px. The asks board's filters are the one column that is not facts: they narrow the list beside them, and stand above it under 1100 px.415- **A command at most once per screen.** As content, a command sits in a popover, a single strip or a card. Never a column of code blocks.415- **No CLI command on a page.** The install line on the landing and Install, and `git clone` in the Clone popover, are the only command boxes. Never a column of code blocks.416- **Prose stops at 72 to 80ch.** Lists and tables run to the container; prose, a README and a doc's article stop at `--measure` (72ch). A project page's head, facts, toolbar and document body stop at `--measure-page` (56rem), so its prose and the table beside it share one edge.417418### Inside a page419
13 unmodified lines
433## Shapes434435Square. The radius is 2 px (`--radius: 0.125rem`), and shadcn's base-lyra components square most corners. Borders are one-pixel hairlines; the current tab's 2 px ink underline is the one heavy line, and no edge of a card carries a colour. An empty state's border is dashed (an unfilled field), and so is the rule that parts disclosed agents from credit. Marks are lucide icons at 16 px (14 px in dense places), stroke 1.75, one family.436437**No logomark.** The wordmark is the product's name set in the UI sans. Where a file must stand for the site (the favicon, `apple-touch-icon.png`, the manifest's icons), it is the repeat button emoji (U+1F501) drawn as text in `public/icons/icon.svg` on the warm paper, through an SVG filter that maps its greys to the ink, the sage primary and white, so no platform's own colour shows (Noto's is orange). The rasters are that one drawing, rendered in headless Chromium at 1024 px and downscaled with Lanczos: 512 and 192 for the manifest, 180 for iOS, and 16, 32 and 48 in `favicon.ico`. The emoji fills 52% of the square, inside a maskable icon's safe circle. `apps/web/test/icons.test.ts` holds the text, the paper and the sizes.437**No logomark.** The wordmark is the product's name set in the UI sans. Where a file must stand for the site (the favicon, `apple-touch-icon.png`, the manifest's icons), it is the repeat button emoji (U+1F501) drawn as text in `public/icons/icon.svg`, plain: in the reader's own emoji font and colours, filling the square, with no ground of its own. The rasters are that one drawing, rendered in headless Chromium at 1024 px on a transparent ground and downscaled with Lanczos: 512 and 192 for the manifest, 180 for iOS, and 16, 32 and 48 in `favicon.ico`. Since the emoji fills the square, the manifest offers no maskable icon. `apps/web/test/icons.test.ts` holds the text, the bare ground and the sizes.438439## Components440441### Top bar
8 unmodified lines
450- **Shape:** a hairline above, rail to rail, a row of plain links (Docs, Install, Settings, Privacy, Terms), then **the brand's domain in upper case** as a watermark: one line of display text in the UI sans, read from `@repo/brand` (`Brand.domain`), upper-cased with CSS, never typed (`brand:check` fails on the name outside `packages/brand`). It is drawn in the ink at a tenth of its strength (`text-foreground/10`), centred, and sized with container query units to fill the content's width exactly, at 600 with -0.04em tracking and a 0.9 line, standing whole on the page's bottom edge (the 0.9 line leaves 0.075em under the baseline, and nothing else), so the page ends in the name. It is the one type that scales with its box. No mark beside it. The size (12.131cqi) is the width over the line's measured width per em, noted in `footer.tsx`; measure again if the domain changes.451452### Project header and tabs453454- **Header:** the name (`owner / project`, the owner muted, both in the UI sans at Headline size), the posture (`PostureBadge`), the description (the README's first sentence), a facts row in UI type, muted (open asks, last landing, latest tag, licence if known, deciders), and three actions at the right: **Watch** (a popover: what already follows the project, this page and its events, plus `myr status --project` for your own claims and answers; the CLI has no watch command), **Clone** (a popover: the `git clone` URL, `myr claim <ask> --project`, and that forks come with a claim), **Contribute** (a popover: take an ask, start a discussion, read the policy). It never changes between tabs.454- **Header:** the name (`owner / project`, the owner muted, both in the UI sans at Headline size), the posture (`PostureBadge`), the description (the README's first sentence), a facts row in UI type, muted (open asks, last landing, latest tag, licence if known, deciders), and three actions at the right: **Watch** (a popover: what already follows the project, this page and its events, and a link to the events), **Clone** (a popover: the `git clone` URL), **Contribute** (a popover: take an ask, start a discussion, read the policy). It never changes between tabs.455- **Tabs:** Overview · Code · Asks · Landings · Discussions · Policy · Visibility, each a text tab with its count in label type; the current one ink at 500 with a 2 px ink underline (the one current-tab style of the whole web), the rest muted. The header and tabs stick under the top bar together; on a phone the tabs scroll sideways inside their own strip.456- **Overview** (the default tab): open asks, recent landings and the README in the main column (its headings a level down, so the project's name stays the page's one h1); the about column (`--column-about`) with clone, how a change lands (the seven stages), who decides, a visibility summary and languages.457- **Code:** under the header, the code bar: a Files/History toggle, the revision picker (`main`, tags, and answers in claim forks, ADR 0043), the HEAD commit, Go to file and Clone; then the file tree in `--column-tree` beside every page of the tab. The history is git's first-parent log with the platform's landing record on each commit that has one, filtered to Landings, Answers, Ask openings or Every commit (Landings by default on main); the Landings tab opens that history of main filtered to its landings, and a commit's page sits under it.458- **Visibility:** posture, layers, held-back checks, the environment (once "Env shape") and the ledger, one tab.
12 unmodified lines
471472### The asks board (`/asks`)473474- **Shape:** the page's title and its one line, then one strip, then the filters in `--column-filters` on the left and the list running to the container on the right. Under 1100 px the filters stand above the list, their three groups side by side from `tablet`.475- **Strip:** "How to take an ask", a plain bordered card with three numbered steps, each a `CommandLine` (claim, check, push), and a line onward to Install and `llms.txt`. A ghost X button dismisses it; the dismissal is kept in `localStorage`, never a cookie, and "How to take an ask" at the foot of the filters brings it back. The server always draws it, so a reader who dismissed it sees it go once the page reads the storage.475- **Filters:** a `nav` landmark ("Filter the asks") of three groups, Kind, State (who may take it: any, open to take, held for newcomers or for people) and Project, each a list of links with its count, the current one on the field surface at 600 with `aria-current="page"`. Every filter is an address (`/asks?kind=fix&take=open`), each link keeps the other filters, and "Reset filters" shows once one is set. Sticky under the top bar from 1100 px.476- **List:** rows in a `RowGroup` per project, sticky under the top bar; a migrate family is its parent row with the family fan, its children listed under it.477- **Open asks only:** the board lists the asks still open, as the `frontPage` contract gives them, so it has no filter to show landed asks. Listing those needs a read of landed asks across every project, which no contract gives yet.478480### Copy action (`CopyAction`, `CommandChip`) and command line (`CommandLine`)479### Copy action (`CopyAction`) and command line (`CommandLine`)480482- **Copy action:** a 32 px ghost button at a row's end, named for what it copies ("Copy claim command"), its command always in the DOM as text (`<code class="sr-only">`), never only a clipboard payload. After a copy it shows a check and says "Copied" for 2 s in a polite live region.483- **Command chip:** the command shown whole, small, at the end of a status line; pressing it copies it.481- **Copy action:** a 32 px ghost button beside a value, named for what it copies ("Copy Head"), its text always in the DOM (`<code class="sr-only">`), never only a clipboard payload. After a copy it shows a check and says "Copied" for 2 s in a polite live region.482- **Command line:** a field-surface box with a hairline border that hugs its command; a muted `$` that selection skips; the command in mono at terminal leading, broken only between words, each wrapped line hanging 6ch; a ghost Copy button. A command is always shown whole; it never ellipsises, and a screen shows it once.483484### Status line (`StatusLine`) and state badge (`StateBadge`)485488- **Status line:** one sentence: the mark, the lead word in its role at 600, the rest in ink, then whose move in muted, then the next command as a chip. "Open to take", "Claimed by tamsin, no answer pushed yet · tamsin's move", "Checking at the checks stage · the platform's move", "Refused at Shape: OutOfScope", "Waiting on decision dec-000001 · a maintainer's move", "Landed as 9b1c3e5". A refusal's lead and tag come from `headline`, never a paraphrase. `data-tone` and `data-mark` carry it.486- **Status line:** one sentence: the mark, the lead word in its role at 600, the rest in ink, then whose move in muted. "Open to take", "Claimed by tamsin, no answer pushed yet · tamsin's move", "Checking at the checks stage · the platform's move", "Refused at Shape: OutOfScope", "Waiting on decision dec-000001 · a maintainer's move", "Landed as 9b1c3e5". A refusal's lead and tag come from `headline`, never a paraphrase. `data-tone` and `data-mark` carry it.487- **State badge:** the one way a state shows as a word: its mark, then its word in the role, at the size of its line. No pill, no fill, no box. `data-mark` (and `data-posture` on a posture's label) carry it.488489### Marks (`marks.tsx`)490
11 unmodified lines
502- **Rounds:** every push the gate checked is a round, numbered from 1; on an answer with more than one round the first region is **Rounds**: one 40 px `Row` per round, the round read in the address (`?head=`).503- **Waiting:** under the strip, the one sentence a contributor needs, from the typed state ("Nothing for you to run. A maintainer has until Thu 14:00."). Never a spinner.504- **Landed:** told as a sentence before it is shown as a hash: one `StatusLine` at Title size, then the credit trailers under "Credit", then the held-back lines, then "The landing commit".505- **Stage strip:** seven ruled cells in cost order (Parse, Shape, Merge, Cheap, Checks, Held-back, Maintainer), each a mark, its label and a 13 px state word: passed, now, refused, not yet, not needed. The current cell is on the surface with `aria-current="step"`.508- **Refusal:** a hairline above and below (no coloured top rule), then `headline(refusals)` in mono red with an octagon mark, then one row per refusal parted by hairlines: its `explain` lines verbatim, then its `next` as a command line. A retryable refusal's mark is the olive turn-back arrow. `data-refusal` and `data-retryable` carry it. The web never rewords a refusal.506- **Refusal:** a hairline above and below (no coloured top rule), then `headline(refusals)` in mono red with an octagon mark, then one row per refusal parted by hairlines: its `explain` lines verbatim. A retryable refusal's mark is the olive turn-back arrow. `data-refusal` and `data-retryable` carry it. The web never rewords a refusal.507508### Credit trailers (`CreditTrailers`, `CompactCredit`) and held-back lines509510- **Credit:** a "Credit" label over one mono line per trailer, `Role: handle`, in `CreditRole`'s order (`Asked-by` first), handles linked; below a dashed rule, "Agents used, disclosed and not credit" and the muted `Assisted-by:` lines. The compact form reads "Asked by ines-v · answered by bram" and never names an agent.
4 unmodified lines
515The platform's own label, never rewritten, through the state badge: a lock and the word in sealed violet for postures that keep something sealed, an open lock in ink for Open, muted for Source available. Said once per page: in the project header, in a list's group heading, or on an Explore card; never per row. `data-posture` carries the literal.516517### Decisions, the inbox and the finish518521- **Inbox** (`/inbox`, once Home and Today, which redirect to it with their query kept): the reader's handle and record, how many decisions wait as one sentence for a decider, then sections under sticky headers: the decisions (Due today, Later), every open one, each decided in its row; Your claims, each answer's stage strip under its row and its next command as the row's copy action; Asks you may take; and what happened lately in the projects the reader decides for (Newcomers to welcome, Landed without a decision). `?project=` narrows it to one project. A personal page: never kept at the edge.519- **Inbox** (`/inbox`, once Home and Today, which redirect to it with their query kept): the reader's handle and record, how many decisions wait as one sentence for a decider, then sections under sticky headers: the decisions (Due today, Later), every open one, each decided in its row; Your claims, each answer's stage strip under its row; Asks you may take; and what happened lately in the projects the reader decides for (Newcomers to welcome, Landed without a decision). `?project=` narrows it to one project. A personal page: never kept at the edge.520- **Choices:** one tap each, no confirm. Primary buttons, the default the outline button with "default" beside its name; 36 px in a row from 640 px, 44 px in a two-column grid on a phone. Under each, a 13 px muted consequence line written from what the platform does. After a choice the record replaces the buttons, landed green only for a choice that took effect.523- **Finish:** the changed files in the tree column with status letters, `+n −m` and a local read mark; the diff with sticky file headers and "Mark read"; the want, verdict, choices and the finish commands in a strip.521- **Finish:** the changed files in the tree column with status letters, `+n −m` and a local read mark; the diff with sticky file headers and "Mark read"; the want, verdict, choices, and Finish it: the answer fork's head, read in the browser, and a button that finishes with the commits on top of the answer.522523### Code browser (the Code tab)524525- **Code bar:** one row under the project's header, not sticky, wrapping on a narrow screen: Files | History (a segmented control marking the view, nothing on the refs list), the revision picker (a field-bordered button reading "At main", "At v1.2.0" or "At handle/ask", with no branch mark or heading, since a tag and a fork are revisions, not branches; its list reads the refs only when it opens: main, the tags, then "Answers in claim forks", each fork as its ask in mono over its claimant and the claim's state in a word; its field finds a tag or an answer; a fork's entry opens the same page in that fork at its address, `@<handle>/<ask>`, shown as `handle/ask` with the fork mark; no repo is named), the revision's head commit (short SHA and subject linking the commit, then author and age; from 640 px), Go to file (`t`, a dialog over the paths at the revision, a match in the file's own name first) and Clone (a popover: the clone command, and the checkout of a tag or a commit, quoted when it is not one plain word; none for a fork, whose commits come with a claim). Below `columns`, a Files button at its start opens the tree, or a commit's changed files, as a sheet. Its reads are the route's (`routes/$owner/$project/-code-bar.tsx`); the bar itself, in `features/code/`, reads nothing. Inside a fork every link that pins a commit (raw, the permalink, a log row, a commit's parent and files, why one step back) pins it inside the fork, `@<handle>/<ask>:<sha>`, so a fork's page is a permalink.
13 unmodified lines
539### Visibility, policy and refs540541- **Ledger:** the head sentence carries the facts; layers as rows (name in sealed-violet mono, readers, writers, disclosure, reason), sealed areas with root and admission, history newest first. No path, check name or file name.542- **Environment:** items as definition rows, sensitive first: the key in mono, the sealed lock and "sensitive", "set by ines-v" or "not set", type, required, proxy hosts. Never a value.545- **Policy:** maintainers by path, vouching one line per vouch, limits in tabular figures, agents, one line per layer; the commands that change it, each flag on its own line.543- **Policy:** maintainers by path, vouching one line per vouch, limits in tabular figures, agents, one line per layer; how to change it, in words.544- **Refs:** main ("moves only by a landing"), tags, and forks with their claim's state word.545546### Empty, pending and error states547550- **Empty (`EmptyState`):** a dashed hairline block: one sentence saying what is empty, then the command that changes it or a link onward.548- **Empty (`EmptyState`):** a dashed hairline block: one sentence saying what is empty, then a link onward.549- **Pending:** the shell and header stay; after 300 ms main shows its title over rows of skeleton (outlined bars, no shimmer).550- **Not found:** the trail up to what exists, a title saying what was asked for ("No such ask"), `RefusalView` verbatim, then one or two onward links.551- **Unreachable:** "The platform did not answer.", "Try again in a minute; nothing was changed. Git and the CLI reach it directly." and Reload. Never red.552
9 unmodified lines
562563### Navigation and keys564565- **Links:** every link between pages is the router's (`AppLink`), preloading on hover or focus; the page being read is `aria-current="page"`. Links in running text are ink, underlined in the hairline colour, ink on hover. A skip link to `#main` is the first tab stop.568- **Keys:** `?` opens the keys dialog with "Single-key shortcuts: On / Off"; `j`/`k` move through a list's rows, Enter opens; `J`/`K` move between files; `t` opens Go to file and `y` makes the address a permalink on a Code tab page; `1` to `9` copy the page's numbered commands; Escape closes a sheet. No key acts in a field. Every key has a pointer twin.566- **Keys:** `?` opens the keys dialog with "Single-key shortcuts: On / Off"; `j`/`k` move through a list's rows, Enter opens; `J`/`K` move between files; `t` opens Go to file and `y` makes the address a permalink on a Code tab page; Escape closes a sheet. No key acts in a field. Every key has a pointer twin.567568### Owners and imports569570- **Names:** a project is named in full wherever a page names it, `<owner>/<name>`; the owner is never dropped. A field that holds the namespace is labelled "Owner".
38 unmodified lines
609### Do:610611- **Do** name exactly one shell per route, and read every width from its token (`max-w-site`, `w-(--column-about)`, `max-w-(--measure)`, `max-w-(--measure-page)`).612- **Do** draw rows, status lines, the fan, refusals, credit, held-back lines, posture, outcomes and stages with the shared components; change the component, not a page's copy of it.615- **Do** show the command for every action once, its text in the DOM, through `CommandLine` or `CopyAction`.613- **Do** give every action a control on the page, and never a CLI command to copy.614- **Do** carry every state as a mark, then a word, then a colour, and key tests and styles on the `data-*` attribute that names it.615- **Do** link between pages with `AppLink`, and read a list's rows in its loader so they arrive in the HTML.616- **Do** keep text at 4.5:1, controls and borders at 3:1, every control reachable and visibly focused by keyboard, and nothing below 13 px.617- **Do** set the footer's wordmark from `Brand.domain`, upper-cased by CSS, one line across the full width of the site and docs shells.
21 unmodified lines
modified:PRODUCT.md+6 added-6 removed
66 unmodified lines
67- **No vouch counts.** A vouch is read as the line it is, with its reason and the landing it followed; "vouched for by 3 people" is a score by another name.6869## Operating Context7071- Work happens in git and the CLI (`Brand.cli` in code; the name lives only in `packages/brand`). The CLI is a single binary served by the platform itself (`/install.sh`, `/releases/…`), with a versioned `--json` envelope on every command, `--dry-run` and `--yes` where a command writes, and `mcp` to serve the platform's tools over stdio. Every web page that suggests an action shows its command, copyable.71- Work happens in git and the CLI (`Brand.cli` in code; the name lives only in `packages/brand`). The CLI is a single binary served by the platform itself (`/install.sh`, `/releases/…`), with a versioned `--json` envelope on every command, `--dry-run` and `--yes` where a command writes, and `mcp` to serve the platform's tools over stdio. The web shows no CLI command: an action a person takes there is a control on the page.72- Harnesses plug in without installing anything: the project's AGENTS.md block and skill, `/llms.txt`, an ask as Markdown, and `/.well-known/mcp.json`. The CLI also answers harness hooks (`hook`), and pi users can load a user-level adapter.73- Every page sits in one of four shells, named by its route: `site` (the landing, Explore, the asks board, Install), `project` (a project's tabs, the inbox, settings, a person), `docs`, and `focus` (sign-in, MCP consent and the forms that make something). The top bar is the same everywhere (Explore, Asks, Docs, Install, search, the keys and the account with its inbox count); there is no global rail, and a side column holds only facts about what is on screen. Below 1100 px each side column stacks under its page; below 900 px the top bar's links fold into a menu.74- Pages per job on the web:75 - **Landing** (`/`): what the gate does, the issue and pull-request flow beside the ask, answer and gate flow, the seven stages, and the latest landings and refused answers across projects. A signed-in reader goes on to the inbox.
1 unmodified line
77 - **Front page** (`/asks`): open asks across projects a viewer may take, grouped by project with each project's posture said once, in the group heading, filtered by kind, by open to take and by asks held for newcomers; a split family is one row with its children as a fan. The same list as Markdown by `Accept: text/markdown`.78 - **Project** (`/$project`, the Overview tab): a header that stays across the tabs (the name, the posture said once, a description, its facts and Watch, Clone and Contribute), then the tabs Overview, Code, Asks, Landings, Discussions, Policy and Visibility. Overview holds its asks, recent landings and README, beside an about column with how a change lands here and who decides. The same as the project's `llms.txt` by `Accept: text/markdown`.79 - **Code** (`/$project/tree/…`, `blob/…`, `why/…`, `commits/…`, `commit/…`, `refs`): the files at any commit, tag or answer fork with a persistent tree, highlighted code with `#L` links, why each line is there, the landings by day, each commit's diff, and the refs; raw bytes under a sandboxing CSP.80 - **Asks** (`/$project/asks`): the project's open asks, each saying whether it is open to take.81 - **Ask** (`/$project/asks/$ask`): the want, the territory, the check, who may claim, and the commands; the same as Markdown by `Accept: text/markdown` or at `/$project/asks/$ask.md`.81 - **Ask** (`/$project/asks/$ask`): the want, the territory, the check, who may claim, and a Claim button; the same as Markdown by `Accept: text/markdown` or at `/$project/asks/$ask.md`.82 - **Answer** (`/$project/answers/$ask`): the outcome, the gate's stages, the rounds, the lanes, held-back results as one line per area, the refusal, and the landing. A waiting answer says the one thing the contributor needs; a landed one is told as a sentence first, then credits its people, and only then shows its sealed roots.83 - **Person** (`/people/$handle`): their credits by role and area, in words, never a number or a score.84 - **Policy** (`/$project/policy`; `/$project/people` moves here): who decides which paths, who is vouched for or denounced, the limits and the agent rules, read from the config folder at the landed commit, with the commands that change them.85 - **Discussions** (`/$project/discussions`, `/$project/discussions/$discussion`): a project's public, freeform threads, open to anyone not denounced, that land nothing themselves; each page shows its posts, the ask a maintainer opened from it, and the command to post, since the web adds no form for it.84 - **Policy** (`/$project/policy`; `/$project/people` moves here): who decides which paths, who is vouched for or denounced, the limits and the agent rules, read from the config folder at the landed commit, and how to change them.85 - **Discussions** (`/$project/discussions`, `/$project/discussions/$discussion`): a project's public, freeform threads, open to anyone not denounced, that land nothing themselves; each page shows its posts, the ask a maintainer opened from it, and a form to open a thread or reply.86 - **Inbox** (`/inbox`; `/home` and `/today` move here): the reader's own page. A maintainer's decisions in sections (due today, later), every open one, each with its evidence, safe default, expiry and one-tap choices whose consequence is written under each, with how many wait said as a sentence; the asks the reader holds and where each answer stands in the gate; the asks they may take next. Each decision has its own page (`/$project/decisions/$decision`), where a finish shows the answer's diff with refusals marked at their lines.87 - **Visibility** (`/$project/visibility`; `/$project/ledger` and `/$project/env` move here): the posture, each declared layer with its reason, each sealed area's count, authors, committed root and admission; the Environment, every item the project's committed `.env.schema` declares, parsed at the landed commit and never resolved, with who set a sensitive item's value and when, never a value; and the ledger, newest first.88 - **Settings** (`/settings`): the theme, the system's or its opposite, kept in this browser's `localStorage`, never a cookie.89 - **Sign-in** (`/auth/signin`): through the platform's own accounts; the session lives in an HttpOnly cookie the browser cannot read.90 - **Install** (`/install`; `/agents` moves here, and `/agents.md` stays): every way in, the CLI, remote and stdio MCP, the skills and `llms.txt`, each snippet copyable. The reference lives in the docs (`/docs`), over `/llms.txt`, `/llms-full.txt`, each project's `/$project/llms.txt`, `/.well-known/mcp.json` and the skills under `/.well-known/agent-skills/`.91- Pages arrive with their data in the server's HTML, and moving between them never reloads the document. The project, ask and answer pages update live while open (the project's `watch` stream), and fall back to reading again every 5 s when the stream cannot be held.92- A minimal keyboard set works on every page: `?` (the keys, with a switch that turns the rest off), `j`/`k` through a list, `J`/`K` through files, `1`–`9` to copy the page's numbered commands, and Escape.92- A minimal keyboard set works on every page: `?` (the keys, with a switch that turns the rest off), `j`/`k` through a list, `J`/`K` through files, and Escape.93- A project may not take a name the web uses for its own pages (`reservedProjectNames` in `@repo/protocol`: `explore`, `inbox`, `install`, `settings`, `asks`, `docs`, `people`, `auth`, `rpc` and the rest, the old `agents`, `home` and `today` kept).94- Phone width is a first-class target (the web installs as a PWA that opens on the inbox).9596## Capabilities and Constraints
16 unmodified lines
113- Measured numbers come only from live runs on a stage, each with its date. No testimonials, customers or adoption figures exist; none may be invented.114115## Product Principles1161171. **The terminal is the workplace; the web is the window.** Every action shows its command; nothing adds a second way to land.1171. **The terminal is the workplace; the web is the window.** An action on the web is a control, never a command to copy; nothing adds a second way to land.1182. **Render the typed value, not a paraphrase.** Refusals, credits, postures and outcomes read the same on every surface, because one renderer and one component draw each.1193. **Waiting is not refusing.** Checking, waiting on a parent ask, a finish or a decision each read as waiting, never as an error.1204. **Credit people, disclose agents, score no one.**1215. **Decisions fit a phone.** Today's density is set by a maintainer clearing it in a few minutes on a small screen: one tap a choice, its consequence said under it.
4 unmodified lines