An open-source, faster Devin alternative
TypeScript
Board: explain itself before it has cards: placeholder lanes, an example repository, one next step per state
Igor Zalutski via Computere29e5b255d54
diff --git a/web/src/managed-agents/work/Board.tsx b/web/src/managed-agents/work/Board.tsxindex ce74d8ae..1e355a4c 100644--- a/web/src/managed-agents/work/Board.tsx+++ b/web/src/managed-agents/work/Board.tsx@@ -1,14 +1,7 @@import { useContext, type ReactNode } from 'react'import { Link, Navigate, useSearchParams } from 'react-router-dom'import { useInfiniteQuery } from '@tanstack/react-query'-import {- ChevronRight,- FileText,- Loader2,- Search,- SquareKanban,- X,-} from 'lucide-react'+import { ChevronRight, Loader2, Search, SquareKanban, X } from 'lucide-react'import { ApiError } from '@/api/errors'import { EmptyState } from '@/components/empty-state'import { Panel } from '@/components/panel'@@ -38,8 +31,8 @@ import {UnpublishedMark,WarningMark,} from './parts'-import { useOpenItems } from './queries'-import { FirstRepository } from './RepositorySetting'+import { BoardIntro, BoardReading } from './BoardIntro'+import { useGrantingInstallations, useOpenItems } from './queries'// The board (ux-spec 4): tracked items in three columns, Mine or Everyone.// Read-only for now; Close and Reopen arrive with build step 5.@@ -52,6 +45,7 @@ export default function BoardPage() {}export function Board() {+ const auth = useContext(AuthContext)const org = useOrg()const [params, setParams] = useSearchParams()const tab: Tab = params.get('tab') === 'everyone' ? 'everyone' : 'mine'@@ -83,6 +77,9 @@ export function Board() {const open = useOpenItems()const repository = open.data?.page.repository ?? null+ // Before a repository is chosen: is GitHub connected at all?+ const noRepository = open.isSuccess && !repository+ const installations = useGrantingInstallations(noRepository)const closed = useInfiniteQuery({queryKey: workKeys.closed(org),queryFn: ({ pageParam }) => getClosedItems(pageParam),@@ -123,17 +120,14 @@ export function Board() {const page = open.data.pageif (!page.repository) {+ // The list failing is the combobox's to say; it offers a retry.+ const connected = !installations.isSuccess || installations.data.length > 0return (<BoardFrame>- <Panel>- <EmptyState- icon={FileText}- title="Nothing is tracked yet"- description={<WhatIsAnItem />}- action={<FirstRepository />}- className="[&>div:last-child]:w-full"- />- </Panel>+ <BoardIntro+ step={connected ? 'choose' : 'connect'}+ checking={installations.isPending}+ /></BoardFrame>)}@@ -154,7 +148,31 @@ export function Board() {!all.some((i) => i.mine) &&all.length > 0 &&!closed.isPending- const nothing = all.length === 0 && !page.building && !closed.isPending+ const nothing = all.length === 0 && !closed.isPending+ const status = (+ <IndexStatus+ repository={repositoryName(page.repository)}+ problem={repositoryProblem(page.repository)}+ building={page.building}+ asOf={page.asOf}+ />+ )+ // Nothing to show yet: no tabs or filter, the lanes drawn as placeholders.+ if (nothing && !repositoryProblem(page.repository)) {+ return (+ <BoardFrame status={status}>+ {page.building ? (+ <BoardReading repository={page.repository} />+ ) : (+ <BoardIntro+ step="track"+ repository={page.repository}+ email={auth?.user?.email}+ />+ )}+ </BoardFrame>+ )+ }return (<BoardFrame@@ -164,24 +182,9 @@ export function Board() {onQ={(q) => setParam('q', q || null)}tag={filters.tag}onClearTag={() => setParam('tag', null)}- status={- <IndexStatus- repository={repositoryName(page.repository)}- problem={repositoryProblem(page.repository)}- building={page.building}- asOf={page.asOf}- />- }+ status={status}>- {nothing ? (- <Panel>- <EmptyState- icon={FileText}- title="Nothing is tracked yet"- description={<WhatIsAnItem />}- />- </Panel>- ) : mineEmpty ? (+ {mineEmpty ? (<Panel><EmptyStateicon={SquareKanban}@@ -334,16 +337,6 @@ function Dormant({)}-function WhatIsAnItem() {- return (- <>- An item is a working doc an agent keeps about work that outlives one- sitting: what it is, where it stands, and what is left. Any session can be- tracked: say “track this” in it, and the item shows up here.- </>- )-}-function BoardFrame({tab,onTab,@@ -455,18 +448,13 @@ function IndexStatus({) : building ? (<span role="status" className="inline-flex items-center gap-1.5"><Loader2 className="size-3 animate-spin" aria-hidden />- Reading {repository}…+ <span>+ Reading <RepositoryLink repository={repository} />…+ </span></span>) : (<>- {/* Quiet: where the board reads from, and the way to change it. */}- <Link- to="/settings#work-repository"- title="Change the working docs repository"- className="hover:text-foreground"- >- {repository}- </Link>+ <RepositoryLink repository={repository} />{indexIsOld(asOf) ? (<span title={asOf ?? undefined}>· As of {timeAgo(asOf)} ago</span>) : null}@@ -476,6 +464,19 @@ function IndexStatus({)}+/** Quiet: where the board reads from, and the way to change it. */+function RepositoryLink({ repository }: { repository: string }) {+ return (+ <Link+ to="/settings#work-repository"+ title="Knowledge repository settings"+ className="hover:text-foreground underline-offset-4 hover:underline"+ >+ {repository}+ </Link>+ )+}+/** A stage: a tinted lane with its header inside, one stack of cards. */function Column({title,diff --git a/web/src/managed-agents/work/BoardIntro.tsx b/web/src/managed-agents/work/BoardIntro.tsxnew file mode 100644index 00000000..24abfb41--- /dev/null+++ b/web/src/managed-agents/work/BoardIntro.tsx@@ -0,0 +1,413 @@+import type { ReactNode } from 'react'+import { Link } from 'react-router-dom'+import { Check, ExternalLink, Loader2 } from 'lucide-react'+import { Skeleton } from '@/components/ui/skeleton'+import { Button } from '@/components/ui/button'+import { cn } from '@/lib/utils'+import type { Repository } from './api'+import { newItemUrl, repositoryName } from './board'+import { ConnectGitHubButton, RepositoryCombobox } from './RepositorySetting'++// What the board says before it has cards (WORK_WEB_NOTES "First visit"):+// the lanes drawn as placeholders behind one message, which says what the+// board is, what the knowledge repository is for, and offers the one next+// step. The example tree follows the item conventions agents are given+// (computer/src/workspaces/knowledge.ts): `work/NN-slug.md`, `done/`.++export type IntroStep = 'connect' | 'choose' | 'track'++/** Connect GitHub (1), choose the repository (2), or no items in it (3). */+export function BoardIntro({+ step,+ repository,+ email,+ checking = false,+}: {+ step: IntroStep+ /** The chosen repository, for `track`. */+ repository?: Repository | null+ /** The viewer's email, for the example file's `owner:`. */+ email?: string | null+ /** Whether GitHub is connected is still being read: hold the action. */+ checking?: boolean+}) {+ return (+ <GhostBoard>+ <Steps current={step} />+ {step === 'track' && repository ? (+ <Track repository={repository} email={email ?? null} />+ ) : (+ <>+ <h2 className="text-base leading-6 font-semibold tracking-tight text-balance">+ The work your team and its agents have in progress+ </h2>+ <p className="text-muted-foreground mt-1.5 text-sm text-pretty">+ Each card is a markdown file in a git repository. Agents read and+ update those files as they work, so there is nothing to keep in sync+ by hand.+ </p>+ <RepositoryFigure+ className="mt-5"+ root="knowledge"+ open={['12-usage-billing.md', '14-slack-formatting.md']}+ closed={['09-webhook-retries.md']}+ card={{+ number: 12,+ tag: 'billing',+ title: 'Usage billing',+ state: 'Metering is live; invoices next.',+ }}+ />+ <div className="mt-5 border-t pt-5">+ <h3 className="text-sm font-medium">Knowledge repository</h3>+ <p className="text-muted-foreground mt-0.5 text-sm text-pretty">+ The one repository where that work is written down:{' '}+ <Path>work/</Path> for open items, <Path>done/</Path> for closed+ ones.+ </p>+ <div className="mt-3">+ {checking ? (+ <Skeleton className="h-8 w-full" />+ ) : step === 'connect' ? (+ <div className="flex flex-wrap items-center justify-between gap-x-4 gap-y-2">+ <p className="text-muted-foreground text-sm">+ It is chosen from what GitHub lets the app read.+ </p>+ <ConnectGitHubButton variant="default" size="default" />+ </div>+ ) : (+ <>+ <RepositoryCombobox current={null} prominent />+ <p className="text-muted-foreground mt-2 text-xs">+ Any repository works. Nothing is written to it until an+ agent tracks something.+ </p>+ </>+ )}+ </div>+ </div>+ </>+ )}+ </GhostBoard>+ )+}++/** The first read of a repository: the lanes, and a line on what is going on. */+export function BoardReading({ repository }: { repository: Repository }) {+ return (+ <GhostBoard narrow>+ <div role="status" className="flex items-start gap-3">+ <Loader2+ className="text-muted-foreground mt-0.5 size-4 shrink-0 animate-spin"+ aria-hidden+ />+ <div>+ <h2 className="text-sm leading-5 font-medium">+ Reading {repositoryName(repository)} for the first time+ </h2>+ <p className="text-muted-foreground mt-1 text-sm text-pretty">+ Each file in <Path>work/</Path> and <Path>done/</Path> becomes a+ card. They show here once the first read is done.+ </p>+ </div>+ </div>+ </GhostBoard>+ )+}++// State 3: a repository with no items. One way in (ask an agent), and the+// file to add by hand as the quiet alternative.+function Track({+ repository,+ email,+}: {+ repository: Repository+ email: string | null+}) {+ return (+ <>+ <h2 className="text-base leading-6 font-semibold tracking-tight text-balance">+ Nothing is tracked in {repositoryName(repository)} yet+ </h2>+ <p className="text-muted-foreground mt-1.5 text-sm text-pretty">+ A card appears here for each file in its <Path>work/</Path> folder. Ask+ an agent to track something, in any session, and it writes the first+ one:+ </p>+ <blockquote className="bg-muted/60 mt-3 rounded-lg px-3.5 py-2.5 text-sm">+ Track the usage billing work: what is done and what is left.+ </blockquote>+ <RepositoryFigure+ className="mt-3"+ root={repository.name}+ open={['1-usage-billing.md']}+ closed={[]}+ card={{+ number: 1,+ title: 'Usage billing',+ state: 'Metering is live; invoices next.',+ }}+ />+ <div className="mt-5 flex flex-col-reverse items-start gap-3 border-t pt-5 sm:flex-row sm:items-center sm:justify-between sm:gap-4">+ <a+ href={newItemUrl(repository, email)}+ target="_blank"+ rel="noreferrer"+ className="text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs underline-offset-4 hover:underline"+ >+ Or add a file to <Path>work/</Path> on GitHub+ <ExternalLink className="size-3" aria-hidden />+ </a>+ <Button asChild>+ <Link to="/computer/sessions/new">Start a session</Link>+ </Button>+ </div>+ </>+ )+}++const STEPS: { id: IntroStep; label: string }[] = [+ { id: 'connect', label: 'Connect GitHub' },+ { id: 'choose', label: 'Choose a repository' },+ { id: 'track', label: 'Track a first item' },+]++/** Where this organization is in getting started, quietly. */+function Steps({ current }: { current: IntroStep }) {+ const at = STEPS.findIndex((s) => s.id === current)+ return (+ <ol+ aria-label="Getting started"+ className="text-muted-foreground mb-5 flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs sm:gap-x-2"+ >+ {STEPS.map((s, i) => (+ <li+ key={s.id}+ aria-current={i === at ? 'step' : undefined}+ className="flex items-center gap-2"+ >+ {i > 0 ? (+ <span+ aria-hidden+ className="bg-border hidden h-px w-4 shrink-0 sm:block"+ />+ ) : null}+ <span+ aria-hidden+ className={cn(+ 'flex size-4 shrink-0 items-center justify-center rounded-full border text-[10px] leading-none font-medium tabular-nums',+ i < at && 'bg-foreground/10 border-transparent',+ i === at && 'border-foreground text-foreground',+ )}+ >+ {i < at ? <Check className="size-2.5" /> : i + 1}+ </span>+ <span className={cn(i === at && 'text-foreground font-medium')}>+ {s.label}+ {i < at ? <span className="sr-only"> (done)</span> : null}+ </span>+ </li>+ ))}+ </ol>+ )+}++const Path = ({ children }: { children: ReactNode }) => (+ <code className="text-foreground/80 font-mono text-[0.92em]">{children}</code>+)++// The tree's rows are 20px, so the connector meets the first open file's+// row at its middle: 2 rows above it (root, work/) and half of its own. The+// card (76px: 10 + 16 + 4 + 16 + 2 + 16 + 10, and its border) is centred on+// that line, so the line meets its title.+const ROW = 20+const LINK_Y = 2 * ROW + ROW / 2+const CARD_H = 76++/**+ * A quiet monospace tree of an example knowledge repository, with a thin+ * line from its first open file to the card it becomes.+ */+function RepositoryFigure({+ root,+ open,+ closed,+ card,+ className,+}: {+ root: string+ open: string[]+ closed: string[]+ card: { number: number; tag?: string; title: string; state: string }+ className?: string+}) {+ const rows: { text: string; file?: boolean; first?: boolean }[] = [+ { text: `${root}/` },+ { text: '├─ work/' },+ ...open.map((f, i) => ({+ text: `│ ${i === open.length - 1 ? '└─' : '├─'} ${f}`,+ file: true,+ first: i === 0,+ })),+ { text: '└─ done/' },+ ...closed.map((f, i) => ({+ text: ` ${i === closed.length - 1 ? '└─' : '├─'} ${f}`,+ file: true,+ })),+ ]+ return (+ <figure+ aria-label={`An example: ${open[0]} in work/ is the card "${card.title}"`}+ className={cn(+ 'bg-muted/40 flex items-start rounded-lg border px-4 py-3',+ className,+ )}+ >+ <pre+ aria-hidden+ className="text-muted-foreground/80 shrink-0 font-mono text-xs leading-5"+ >+ {rows.map((r) => (+ <div+ key={r.text}+ className={cn(+ r.first && 'text-foreground',+ !r.file && 'font-medium',+ )}+ >+ {r.text}+ </div>+ ))}+ </pre>+ <div+ aria-hidden+ className="hidden min-w-6 flex-1 items-center sm:flex"+ style={{ marginTop: LINK_Y - 2 }}+ >+ <span className="bg-muted-foreground/50 ml-3 size-1 shrink-0 rounded-full" />+ <span className="border-muted-foreground/40 h-0 flex-1 border-t border-dashed" />+ <span className="bg-muted-foreground/50 mr-0 size-1 shrink-0 rounded-full" />+ </div>+ <div+ aria-hidden+ className="bg-panel hidden w-48 shrink-0 rounded-md border p-2.5 shadow-[0_1px_1px_0_rgb(20_19_17/0.03)] sm:block"+ style={{ marginTop: LINK_Y - CARD_H / 2 }}+ >+ <div className="text-muted-foreground flex h-4 items-center gap-1.5 text-[11px]">+ <span className="font-medium tabular-nums">{card.number}</span>+ {card.tag ? (+ <span className="rounded-sm border px-1 leading-3.5">+ {card.tag}+ </span>+ ) : null}+ </div>+ <p className="mt-1 truncate text-xs leading-4 font-medium">+ {card.title}+ </p>+ <p className="text-muted-foreground mt-0.5 truncate text-[11px] leading-4">+ {card.state}+ </p>+ </div>+ </figure>+ )+}++/**+ * Three lanes of placeholder cards (dashed, still) behind the message, fading+ * out downwards. Below `lg` only the first lane is drawn, as the board stacks.+ */+function GhostBoard({+ narrow = false,+ children,+}: {+ narrow?: boolean+ children: ReactNode+}) {+ return (+ <div className="grid">+ <div+ aria-hidden+ className="col-start-1 row-start-1 grid gap-4 [mask-image:linear-gradient(to_bottom,black_45%,transparent)] lg:grid-cols-3"+ >+ <GhostLane title="In progress" cards={[3, 2, 3, 2]} />+ <GhostLane+ title="Ready to close"+ cards={[2, 3, 2]}+ className="hidden lg:flex"+ />+ <GhostLane+ title="Closed"+ cards={[2, 2, 3]}+ className="hidden lg:flex"+ />+ </div>+ <div+ className={cn(+ 'bg-panel relative z-10 col-start-1 row-start-1 mx-3 mt-12 mb-16 self-start justify-self-center rounded-xl border p-6 shadow-sm sm:mx-6 sm:w-[34rem] sm:max-w-[calc(100%-3rem)]',+ narrow && 'sm:w-[28rem]',+ )}+ >+ {children}+ </div>+ </div>+ )+}++function GhostLane({+ title,+ cards,+ className,+}: {+ title: string+ // Each card's number of text bars.+ cards: number[]+ className?: string+}) {+ return (+ <div+ className={cn(+ 'bg-muted/60 flex min-w-0 flex-col rounded-xl p-2 dark:bg-black/15',+ className,+ )}+ >+ <div className="text-muted-foreground flex h-9 items-center px-[13px] pb-1 text-sm">+ {title}+ </div>+ <div className="flex flex-col gap-2">+ {cards.map((bars, i) => (+ <GhostCard key={i} bars={bars} seed={i + title.length} />+ ))}+ </div>+ </div>+ )+}++// A card's outline: an identity bar, a title and state bars of a few widths.+const WIDTHS = ['w-3/4', 'w-2/3', 'w-5/6', 'w-1/2', 'w-3/5']++function GhostCard({ bars, seed }: { bars: number; seed: number }) {+ return (+ <div className="border-foreground/15 rounded-lg border border-dashed p-3">+ <div className="flex h-5 items-center gap-1.5">+ <span className="bg-foreground/[0.07] h-2 w-5 rounded-full" />+ <span className="bg-foreground/[0.05] h-2 w-10 rounded-full" />+ </div>+ <div className="mt-2 space-y-2 py-1">+ {Array.from({ length: bars }, (_, i) => (+ <span+ key={i}+ className={cn(+ 'block h-2 rounded-full',+ i === 0 ? 'bg-foreground/[0.08]' : 'bg-foreground/[0.05]',+ WIDTHS[(seed + i) % WIDTHS.length],+ )}+ />+ ))}+ </div>+ <div className="mt-3 flex h-5 items-center justify-between">+ <span className="bg-foreground/[0.05] h-2 w-16 rounded-full" />+ <span className="bg-foreground/[0.05] h-2 w-6 rounded-full" />+ </div>+ </div>+ )+}diff --git a/web/src/managed-agents/work/RepositorySetting.tsx b/web/src/managed-agents/work/RepositorySetting.tsxindex 1dda1b8f..77d475f1 100644--- a/web/src/managed-agents/work/RepositorySetting.tsx+++ b/web/src/managed-agents/work/RepositorySetting.tsx@@ -43,25 +43,9 @@ import { useGrantingInstallations } from './queries'// one per organization, chosen from what its GitHub connection can reach.// One control shows the choice and opens a searchable list of what the// installations grant, as GitHub's and Vercel's repository pickers do. The-// board's first-time state uses it (`FirstRepository`); the setting with its+// board's first-time state uses it (`BoardIntro`); the setting with its// state and fixes is KnowledgeRepositorySection.-/** The board's empty state: choose the repository, and the board loads. */-export function FirstRepository() {- return (- <div className="mx-auto w-full max-w-sm space-y-3 text-left">- <p className="text-muted-foreground text-center text-sm">- Choose the{' '}- <span className="text-foreground font-medium">- knowledge repository- </span>- : the GitHub repository where agents keep these docs.- </p>- <RepositoryCombobox current={null} prominent />- </div>- )-}-/*** Starts the managed GitHub App install in a new window, as Connections and* the Computer page do. Coming back, the list and the repository are read@@ -70,15 +54,17 @@ export function FirstRepository() {export function ConnectGitHubButton({label = 'Connect GitHub',variant = 'outline',+ size = 'sm',}: {label?: stringvariant?: 'default' | 'outline'+ size?: 'sm' | 'default'}) {const [starting, setStarting] = useState(false)return (<Buttontype="button"- size="sm"+ size={size}variant={variant}disabled={starting}onClick={() => {diff --git a/web/src/managed-agents/work/board.test.ts b/web/src/managed-agents/work/board.test.tsindex 91acb0a5..1ae8c25b 100644--- a/web/src/managed-agents/work/board.test.ts+++ b/web/src/managed-agents/work/board.test.ts@@ -5,6 +5,7 @@ import {indexIsOld,inProgress,matches,+ newItemUrl,presentBody,pullLabel,readyToClose,@@ -218,3 +219,30 @@ describe('the doc as shown', () => {expect(resolveAgainst('#why', base)).toBe('#why')})})++describe('newItemUrl', () => {+ const repository = {+ installationId: '1',+ owner: 'acme',+ name: 'knowledge',+ branch: 'main',+ }+ it("opens GitHub's new-file page in work/ with an item's shape", () => {+ const url = new URL(newItemUrl(repository, '[email protected]'))+ expect(url.origin + url.pathname).toBe(+ 'https://github.com/acme/knowledge/new/main',+ )+ expect(url.searchParams.get('filename')).toBe('work/1-usage-billing.md')+ const body = url.searchParams.get('value') ?? ''+ expect(+ body.startsWith('---\nowner: [email protected]\n---\n\n# Usage billing'),+ ).toBe(true)+ expect(body).toContain('## Left\n\n- [ ] ')+ })+ it('leaves out the frontmatter without an email', () => {+ const url = new URL(newItemUrl(repository, null))+ expect(url.searchParams.get('value')?.startsWith('# Usage billing')).toBe(+ true,+ )+ })+})diff --git a/web/src/managed-agents/work/board.ts b/web/src/managed-agents/work/board.tsindex 49bfba93..82d4bdb9 100644--- a/web/src/managed-agents/work/board.ts+++ b/web/src/managed-agents/work/board.ts@@ -204,3 +204,27 @@ export function resolveAgainst(url: string, base: string): string {return url}}++/**+ * GitHub's new-file page in `work/`, filled in with an item's shape: the+ * frontmatter `owner:`, a title, the line on where it stands and `## Left`.+ */+export function newItemUrl(repository: Repository, email: string | null) {+ const body = [+ ...(email ? ['---', `owner: ${email}`, '---', ''] : []),+ '# Usage billing',+ '',+ 'Metering is live; invoices next.',+ '',+ '## Left',+ '',+ '- [ ] Draft the invoice email',+ '- [ ] Backfill last month',+ '',+ ].join('\n')+ const q = new URLSearchParams({+ filename: 'work/1-usage-billing.md',+ value: body,+ })+ return `https://github.com/${repository.owner}/${repository.name}/new/${encodeURIComponent(repository.branch)}?${q}`+}diff --git a/web/src/managed-agents/work/screens.test.tsx b/web/src/managed-agents/work/screens.test.tsxindex 3223252f..eacb9ad8 100644--- a/web/src/managed-agents/work/screens.test.tsx+++ b/web/src/managed-agents/work/screens.test.tsx@@ -248,19 +248,77 @@ describe('board', () => {expect(titles(column('In progress'))).toEqual(['Theirs'])})- it('explains what an item is before a repository is set', async () => {+ it('says what the board is and offers the repository before one is set', async () => {workApi.getOpenItems.mockResolvedValue(openPage([], { repository: null, head: null, asOf: null }),)workApi.getRepository.mockResolvedValue(null)workApi.getRepositories.mockResolvedValue([acme])await render('/computer/work')- expect(container.textContent).toContain('An item is a working doc')- expect(container.textContent).toContain('Choose the knowledge repository')+ const text = container.textContent+ expect(text).toContain('The work your team and its agents have in progress')+ expect(text).toContain('Each card is a markdown file in a git repository')+ expect(text).toContain('The one repository where that work is written down')+ expect(currentStep()).toBe('Choose a repository')expect(trigger()?.textContent).toContain('Select a repository')+ expect(button('Connect GitHub')).toBeUndefined()expect(workApi.getClosedItems).not.toHaveBeenCalled()})+ it('asks to connect GitHub first when nothing is connected', async () => {+ workApi.getOpenItems.mockResolvedValue(+ openPage([], { repository: null, head: null, asOf: null }),+ )+ workApi.getRepositories.mockResolvedValue([])+ await render('/computer/work')+ expect(container.textContent).toContain(+ 'The work your team and its agents have in progress',+ )+ expect(currentStep()).toBe('Connect GitHub')+ expect(button('Connect GitHub')).toBeTruthy()+ expect(trigger()).toBeNull()+ })++ it('shows how to track a first item when the repository has none', async () => {+ workApi.getOpenItems.mockResolvedValue(openPage([]))+ await render('/computer/work')+ expect(container.textContent).toContain(+ 'Nothing is tracked in acme/knowledge yet',+ )+ expect(currentStep()).toBe('Track a first item')+ expect(+ container.querySelector('a[href="/computer/sessions/new"]')?.textContent,+ ).toBe('Start a session')+ const github = container.querySelector<HTMLAnchorElement>(+ 'a[href^="https://github.com/acme/knowledge/new/main?"]',+ )+ expect(github?.textContent).toContain('Or add a file to work/ on GitHub')+ // No lanes, tabs or filter while there is nothing to show.+ expect(+ container.querySelector('section[aria-label="In progress"]'),+ ).toBeNull()+ expect(container.querySelector('[role="tablist"]')).toBeNull()+ expect(+ container.querySelector('a[href="/settings#work-repository"]')+ ?.textContent,+ ).toBe('acme/knowledge')+ })++ it('says the first read is going on, without the getting-started steps', async () => {+ workApi.getOpenItems.mockResolvedValue(openPage([], { building: true }))+ await render('/computer/work')+ expect(container.textContent).toContain(+ 'Reading acme/knowledge for the first time',+ )+ expect(currentStep()).toBeNull()+ expect(container.textContent).not.toContain('Start a session')+ // The header names the repository, linked to its setting.+ expect(+ container.querySelector('a[href="/settings#work-repository"]')+ ?.textContent,+ ).toBe('acme/knowledge')+ })+it('reads a 404 as not available yet', async () => {workApi.getOpenItems.mockRejectedValue(new ApiError('Not found', 404))await render('/computer/work')@@ -635,6 +693,11 @@ const acme = {problemMessage: null,}+// The current step's label (its number is drawn, hidden from readers).+const currentStep = () =>+ container.querySelector('[aria-current="step"]')?.lastElementChild+ ?.textContent ?? null+const trigger = () =>container.querySelector<HTMLButtonElement>('button[aria-haspopup="listbox"]')