# Work ## `/work` — every piece One lit list: every article (with the video projects it claims), every project no article claims, every series and every watch. An edition of a series is not a row; its series is. A row: the title and id (and a schedule's chip), the stage on a step bar, the kind ("article + report video" …), the lifecycle ("· looks done" when it does), open calls in Meter, and on the lit line **Park** / **Mark done** (or **Reactivate**). **+ Create** in the head. The facets are links (any view is one pasteable URL), each chip with the count it would show; `/` focuses **Find a piece** (a GET search, `q`). | Facet | Key | Values | |---|---|---| | Stage | `stage` | `research`, `article`, `video`, `deliver` — the one stage rule ([piece.md](piece.md#the-stepper)); a song files Spec → article, Cuts → video, Done → deliver | | Kind | `kind` | `article`, `series`, `watch` (a watch is stored like a series but is its own kind), a project kind id (`report-video`, `song`, `sweep-report`); a project kind also finds the article whose video it is | | Lifecycle | `life` | `active` (the default), `parked`, `done`, `all` | | Site | `site` | a site id (`articles` = the store); **site page →** opens `/sites/` | | Recurring | `recurring=1` | series, watches and living reports | | View | `by=site`, `sort=name` | **By site** groups by site; **By name** sorts | | Also | `template`, `state`, `open`, `status`, `notes`, `audience` | the old lists' keys; each shows as a chip that takes itself off | `/browse`, `/articles` and `/sites` redirect here with their keys kept (`/articles` → `?kind=article&site=articles`, the store's; `/sites` → `?by=site`). After a delete, `?deleted=` (and `freed`) says what went. ## `/projects` — every project, by folder The project grid the old `/browse` was: one card per project, by folder. **+ new project** (or `?new=1`) opens the scaffold form; **copy the whole picture** copies every project as markdown. Server-rendered, no client JavaScript. | Filter | Key | Values | |---|---|---| | Kind / template | `kind`, `template` | registry ids | | State | `state` | `draft` `windows` `fetched` `built` `shipped` `stale` | | Decisions | `open` | `blocking`, `1` (any waiting) | | Text / order | `q`, `sort` | substring over the haystack; `name` or `recent` | - **Counts come from the unfiltered set**, so a chip's number does not move under the cursor; an e2e spec holds the number to the cards drawn. - **One state vocabulary across every kind**, so "what is half-done" needs no "at what". A kind maps onto it; it does not invent a seventh. - **The cards carry no kind ids** (`components/projects/ProjectGrid.tsx`): a kind's summariser renders its own facts (`19 clips · 4m46s · 17 sources`, `3/4 cuts · 2 variants`) and flags, and attaches `data-*` through `attrs`. - **The poster** falls back: the deliverable → a built segment → a raw clip → nothing, served by `/api/browse/poster?project=…`, which takes no client-supplied `rel`. - **Listing never probes.** A summary is memoised against a signature of mtimes and sizes; `open` needs every kind's reducer, memoised the same way. The footer says the index's health ("index: 9/11 fresh"). - `/projects/` is the same grid under a folder. A bare name two projects share lists both canonical paths. ## `/sites/` — a site's page Its articles (status, updated, citations, open notes, the linked video and source draft), its report videos (playable), the video projects they were cut in (their takes and like / maybe / no), and the workspace files they were written from (`?ws=&rel=` opens one). Its articles open as pieces at `/sites//` ([piece.md](piece.md)). - **Site and reports**: common's `listSites`/`getSite`, `listReportDirs`, each `report.json` through the report validator. **Published** = named in `site.json` `pages`, in that order; every other report directory is a draft. - **Source** (`lib/articles/sources.mjs`): the draft under `~/reports//polemics/drafts/` whose `id` or file name is the report id (`polemic-` allowed on either side), preferring a workspace whose generator names the site. **Edit the draft, not `report.json`** — the generator overwrites `report.json`. - `SITES_DIR` (else `TRANSCRIPTS_DIR/sites`, else the checkout's `transcripts/sites`) is where it is read; the e2e suite points it at `e2e/fixtures/sites-fixture.mjs`'s fixture. | Route (read-only) | Serves | |---|---| | `/api/sites/media?site&report&file` | a file in the report dir (video.mp4, poster.jpg, stills/…), byte ranges | | `/api/sites/media?site&moment` | the prepared clip of a moment | | `/api/sites/media?corpus=` | a media file lexically under `CHANNELS_DIR` | | `/api/sites/evidence?site&report&cite` | one citation's evidence (JSON) | | `/api/sites/workspace?ws&rel` | a listed workspace file; HTML under a CSP sandbox | ## Discovered by getting it wrong once **Tailwind's source detection is OFF, and the scanned directories are named in `app/globals.css`** (`source(none)` plus `@source "../app"`, `"../components"`, `"../lib"`, common's report components). Auto-detection read a scratch `NEXT_DIST_DIR`'s binary cache, took a garbage class candidate, and every page 500'd on a CSS parse error — then it happened again from a doc that quoted the candidate. A doc, a fixture or a stray dist dir can no longer poison the stylesheet. If you add a directory that holds class names, name it there. **`lmdb` must be in `serverExternalPackages`.** Bundled, Turbopack resolves its optional `moduleRequire('cbor-x')` and fails the whole module graph — every page importing `lib/projects` 500s naming a package nothing here uses. **Every page is dynamic, so a `` prefetch is a full render.** The rail, the Inbox, Work and the tool lists do not prefetch; a piece's tabs do not either.