Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit a8e6f1bfba2702caf72b2186334f64fadb247580
parent 76411f9f08134c56322ed5ccaa49f687431328d0
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sun, 11 Oct 2026 13:58:26 -0400

editor: the Articles tab — /sites/articles over the article store, its jobs on the reports queue

Release 26 A6. /sites/articles (linked from /sites; a static segment beside
/sites/[siteId], as /sites/new is) lists transcripts/reports/: the published
articles in reports/index.json's order, then the drafts, each with its
problems and its audience. Publish, unpublish, up/down and Make public /
Make private write through the article registry (configureArticle), as
`pnpm ops articles-config` does. A site's own pages stay on its Reports tab.

The evidence media and exports are the Reports tab's over the articles
(articlesWorkHost): Fetch missing evidence, Prepare evidence media (then the
exports) and Export articles — reports-prepare / reports-export jobs on the
same queue, their spec `params.articles: true`, replayed as such. The ops
routes take {"articles": true} (prepare also {"article": id}) in place of a
site. Unit: route tests for the articles branch; e2e: articles.spec.ts.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
MCOMMANDS.md | 4++--
Meditor/app/api/ops/reports-export/route.test.ts | 11+++++++++++
Meditor/app/api/ops/reports-export/route.ts | 27++++++++++++++++++---------
Meditor/app/api/ops/reports-prepare/route.test.ts | 11+++++++++++
Meditor/app/api/ops/reports-prepare/route.ts | 19++++++++++++++++---
Meditor/app/channels/[slug]/videos/fetchWindowsAction.ts | 27+++++++++++++++++++++++++--
Meditor/app/jobs/jobReplayRegistry.ts | 9+++++++++
Aeditor/app/sites/articles/page.tsx | 289++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aeditor/app/sites/components/ArticleRowActions.tsx | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aeditor/app/sites/components/ArticlesJobButtons.tsx | 40++++++++++++++++++++++++++++++++++++++++
Meditor/app/sites/components/FetchMissingEvidenceButton.tsx | 10++++++++--
Aeditor/app/sites/lib/articlesActions.ts | 196+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aeditor/app/sites/lib/articlesServer.ts | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Meditor/app/sites/page.tsx | 21+++++++++++++++------
Aeditor/e2e/articles.spec.ts | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mscripts/archilyzer-ops.mjs | 6+++++-
16 files changed, 900 insertions(+), 25 deletions(-)

diff --git a/COMMANDS.md b/COMMANDS.md @@ -110,8 +110,8 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `relocate` | relocate moves channels' media to a location: {"slugs", "locationId" \| "root"}. "dryRun": true answers each channel's preview (bytes to copy, free space both sides) and moves nothing — though, as on the Storage panel, a channel never tiered is first tiered in place on the corpus disk. | `pnpm ops relocate --json '{"slugs":["x"],"locationId":"platter"}'`<br>`pnpm ops relocate --json '{"slugs":["x"],"locationId":"platter","dryRun":true}'` | | `relocate-back` | relocate-back moves channels' media back onto the corpus disk, one job per channel on the relocation queue: {"slugs"}. A busy channel is answered in "skipped"; --wait follows the jobs started. | | | `evict-clips` | evict-clips deletes cached clip windows (data/&lt;id&gt;/clips/) older than a number of days, as /storage's button does: {"olderThanDays", "slug"?, "dryRun"?}. BY AGE: nothing knows whether a umtool report still cites a window; an evicted window is fetched again when asked for. | | -| `reports-prepare` | reports-prepare cuts every clip and copies every post capture a site's published reports cite into its report-media cache, before its build: {"siteId"}. The job fails, naming each one, when a citation lacks media. When nothing is missing it then exports the reports, as reports-export. | `pnpm ops reports-prepare --json '{"siteId":"demo-site"}' --wait` | -| `reports-export` | reports-export writes each published report as report.html, report.pdf, report.md, slides.html, slides.pdf and evidence-pack.zip for the site's build to publish: {"siteId", "reportId"?, "formats"?: \["html","pdf","md", "slides","slides-pdf","zip"\]}. | `pnpm ops reports-export --json '{"siteId":"demo-site","formats":["html","md"]}' --wait` | +| `reports-prepare` | reports-prepare cuts every clip and copies every post capture a site's published reports cite into its report-media cache, before its build: {"siteId"}. The job fails, naming each one, when a citation lacks media. When nothing is missing it then exports the reports, as reports-export. {"articles": true} does it for the published articles (transcripts/ reports/, the homepage's); {"article": "&lt;id&gt;"} adds that one (a draft). | `pnpm ops reports-prepare --json '{"siteId":"demo-site"}' --wait`<br>`pnpm ops reports-prepare --json '{"articles":true}' --wait` | +| `reports-export` | reports-export writes each published report as report.html, report.pdf, report.md, slides.html, slides.pdf and evidence-pack.zip for the site's build to publish: {"siteId", "reportId"?, "formats"?: \["html","pdf","md", "slides","slides-pdf","zip"\]}; {"articles": true, "reportId"?, …} the articles' (reportId: one article, published or a draft). | `pnpm ops reports-export --json '{"siteId":"demo-site","formats":["html","md"]}' --wait` | | `lane` | lane takes {"lane": "transcription"\|"download"\|"digest"\|"backfill"\| "publish", "enabled"?, "held"?, "action"?: "start"\|"stop"\|"drain"}. | `pnpm ops lane --json '{"lane":"download","held":true}'`<br>`pnpm ops lane --json '{"lane":"publish","action":"drain"}'` | | `tags` | tags edits the curated-tag vocabulary through its one writer: {"op": "define", "tag": {...}} (the WHOLE definition: id, label, rules and "sites", the sites it exists on, absent = every site) or {"op": "remove", "tag": "&lt;id&gt;"}. `get tags [<id>]` reads it. | `pnpm ops tags --json '{"op":"define","tag":{"id":"eva-collab","label":"Collab"}}'` | | `tag-videos` | tag-videos pins, unpins, suppresses or unsuppresses one tag on many videos in ONE write: {"tag", "op": "add" \| "remove" \| "suppress" \| "unsuppress", "videos": \[{"slug", "id"}, ...\]}. "remove" unpins only — a rule's hit survives; "suppress" rejects it. The write records who asked (ARCHILYZER\_AGENT); a big list goes in --file. | `pnpm ops tag-videos --file ids.json` | diff --git a/editor/app/api/ops/reports-export/route.test.ts b/editor/app/api/ops/reports-export/route.test.ts @@ -53,3 +53,14 @@ test("a site that does not exist is refused before any job", async () => { assert.equal(r.status, 400); assert.match(r.error, /No site "demo-site"/); }); + +// The articles' (release 26): `articles: true` in place of a site. +test("articles: true or a site, never both; an article that is not there is refused before any job", async () => { + const both = await post({ siteId: "demo-site", articles: true }); + assert.equal(both.status, 400); + assert.match(both.error, /give "siteId" or "articles", not both/); + assert.match((await post({ articles: false })).error, /"articles" is true when given/); + const none = await post({ articles: true, reportId: "nope" }); + assert.equal(none.status, 400); + assert.match(none.error, /no article "nope"/); +}); diff --git a/editor/app/api/ops/reports-export/route.ts b/editor/app/api/ops/reports-export/route.ts @@ -1,4 +1,5 @@ import { reportsExportAction } from "../../../sites/lib/reportsExportAction"; +import { articlesExportAction } from "../../../sites/lib/articlesActions"; import { jobResponse, OpsInputError, ops, optString, optSubset, reqString } from "../_lib"; import { isValidSiteId } from "yt-dlp-transcript-common/lib/site"; import { REPORT_EXPORT_FORMATS } from "yt-dlp-transcript-common/lib/report/views"; @@ -6,6 +7,7 @@ import { REPORT_EXPORT_FORMATS } from "yt-dlp-transcript-common/lib/report/views export const dynamic = "force-dynamic"; // POST { siteId: string, reportId?: string, formats?: ("html"|"pdf"|"md"|"zip")[] } +// | { articles: true, reportId?: string, formats?: … } // -> { ok: true, jobId } // // An adapter: one call to the action the site's Reports tab posts. Writes each @@ -13,21 +15,28 @@ export const dynamic = "force-dynamic"; // and an evidence pack (or the formats named) into the site's report-exports // staging, as one `reports-export` job on prepare's queue. The job fails, // naming each, when an export cannot be written. +// +// `articles: true` is the Articles tab's (release 26): each published article +// (or `reportId`, published or a draft) into .export-index/articles/. export async function POST(request: Request) { - return ops(request, ["siteId", "reportId", "formats"], async (body) => { + return ops(request, ["siteId", "reportId", "formats", "articles"], async (body) => { + const reportId = optString(body, "reportId"); + const formats = optSubset(body, "formats", REPORT_EXPORT_FORMATS, "the export formats"); + const opts = { + ...(reportId !== undefined ? { reportId } : {}), + ...(formats ? { formats } : {}), + }; + if (body.articles !== undefined) { + if (body.articles !== true) throw new OpsInputError('"articles" is true when given'); + if (body.siteId !== undefined) throw new OpsInputError('give "siteId" or "articles", not both'); + return jobResponse(await articlesExportAction(opts)); + } const siteId = reqString(body, "siteId"); if (!isValidSiteId(siteId)) { throw new OpsInputError( `"${siteId}" is not a valid site id (lowercase letters, digits and "-"; must start with a letter or digit)`, ); } - const reportId = optString(body, "reportId"); - const formats = optSubset(body, "formats", REPORT_EXPORT_FORMATS, "the export formats"); - return jobResponse( - await reportsExportAction(siteId, { - ...(reportId !== undefined ? { reportId } : {}), - ...(formats ? { formats } : {}), - }), - ); + return jobResponse(await reportsExportAction(siteId, opts)); }); } diff --git a/editor/app/api/ops/reports-prepare/route.test.ts b/editor/app/api/ops/reports-prepare/route.test.ts @@ -47,3 +47,14 @@ test("a site that does not exist is refused before any job", async () => { assert.equal(r.status, 400); assert.match(r.error, /No site "demo-site"/); }); + +// The articles' (release 26): `articles: true`, or `article` (that one too). +test("the articles in place of a site, never both; an article that is not there is refused before any job", async () => { + const both = await post({ siteId: "demo-site", articles: true }); + assert.equal(both.status, 400); + assert.match(both.error, /give "siteId" or the articles, not both/); + assert.match((await post({ articles: "yes" })).error, /"articles" is true when given/); + const none = await post({ article: "nope" }); + assert.equal(none.status, 400); + assert.match(none.error, /no article "nope"/); +}); diff --git a/editor/app/api/ops/reports-prepare/route.ts b/editor/app/api/ops/reports-prepare/route.ts @@ -1,17 +1,30 @@ import { reportsPrepareAction } from "../../../sites/lib/reportsPrepareAction"; -import { jobResponse, OpsInputError, ops, reqString } from "../_lib"; +import { articlesPrepareAction } from "../../../sites/lib/articlesActions"; +import { jobResponse, OpsInputError, ops, optString, reqString } from "../_lib"; import { isValidSiteId } from "yt-dlp-transcript-common/lib/site"; export const dynamic = "force-dynamic"; -// POST { siteId: string } -> { ok: true, jobId } +// POST { siteId: string } | { articles: true } | { article: string } -> { ok: true, jobId } // // An adapter: one call to the action the site's Reports tab posts. Cuts every // clip and copies every post capture the site's published reports cite into // its report-media cache, as one `reports-prepare` job on its own queue. The // job fails, naming each citation, when any lacks its media. +// +// `articles: true` is the Articles tab's (release 26): every published +// article's, into .export-index/articles/; `article` the same plus that one +// (a draft being readied), as `archilyzer reports prepare --article <id>`. export async function POST(request: Request) { - return ops(request, ["siteId"], async (body) => { + return ops(request, ["siteId", "articles", "article"], async (body) => { + const article = optString(body, "article"); + if (body.articles !== undefined && body.articles !== true) { + throw new OpsInputError('"articles" is true when given'); + } + if (body.articles === true || article !== undefined) { + if (body.siteId !== undefined) throw new OpsInputError('give "siteId" or the articles, not both'); + return jobResponse(await articlesPrepareAction(article)); + } const siteId = reqString(body, "siteId"); if (!isValidSiteId(siteId)) { throw new OpsInputError( diff --git a/editor/app/channels/[slug]/videos/fetchWindowsAction.ts b/editor/app/channels/[slug]/videos/fetchWindowsAction.ts @@ -39,6 +39,7 @@ import { type UnfetchableEvidenceWindow, } from "yt-dlp-transcript-common/publish/reportMedia"; import { isValidSiteId, listSiteIds } from "yt-dlp-transcript-common/lib/site"; +import { articlesWorkHost } from "yt-dlp-transcript-common/publish/reportHost"; import { heldPlatformRefusal, platformCooldownRemainingMs, @@ -451,7 +452,29 @@ export async function fetchMissingEvidenceAction( if (!isValidSiteId(id)) return { ok: false, error: `"${id}" is not a valid site id` }; const paths = getPaths(); if (!listSiteIds(paths).includes(id)) return { ok: false, error: `No site "${id}"` }; - const need = await missingEvidenceWindows(paths, id); + return fetchMissingFor(await missingEvidenceWindows(paths, id), id, { ...opts, siteId: id }); +} + +// The same for the ARTICLES (release 26: transcripts/reports/, every +// published article): the Articles tab's "Fetch missing evidence". +export async function fetchMissingArticleEvidenceAction( + opts: { dryRun?: boolean; maxHeight?: number } = {}, +): Promise<FetchMissingEvidenceResult> { + const paths = getPaths(); + let host; + try { + host = await articlesWorkHost(paths); + } catch (err) { + return { ok: false, error: (err as Error).message }; + } + return fetchMissingFor(await missingEvidenceWindows(paths, host), host.id, opts); +} + +async function fetchMissingFor( + need: Awaited<ReturnType<typeof missingEvidenceWindows>>, + id: string, + opts: { dryRun?: boolean; maxHeight?: number; siteId?: string }, +): Promise<FetchMissingEvidenceResult> { const extra = { siteId: id, onDisk: need.onDisk, unfetchable: need.unfetchable }; if (need.missing.length === 0) { return { @@ -477,7 +500,7 @@ export async function fetchMissingEvidenceAction( })), requestedBy: "reports", manifest: id, - siteId: id, + ...(opts.siteId ? { siteId: opts.siteId } : {}), maxHeight: opts.maxHeight, dryRun: opts.dryRun, }); diff --git a/editor/app/jobs/jobReplayRegistry.ts b/editor/app/jobs/jobReplayRegistry.ts @@ -61,6 +61,7 @@ import { fetchWindowsJobAction } from "../channels/[slug]/videos/fetchWindowsAct import type { FetchWindowsItem } from "yt-dlp-transcript-common/controller/fetchWindows"; import { reportsPrepareAction } from "../sites/lib/reportsPrepareAction"; import { reportsExportAction } from "../sites/lib/reportsExportAction"; +import { articlesExportAction, articlesPrepareAction } from "../sites/lib/articlesActions"; import { enqueueStage, stageRequestFromSpec, @@ -148,6 +149,8 @@ export const JOB_REPLAY_HANDLERS: Record<string, ReplayHandler> = { // cache does not already hold. "reports-prepare": (spec) => { const { p } = params(spec); + // The articles' (release 26): `params.articles`, and the draft it readied. + if (p.articles === true) return articlesPrepareAction(str(p.article)); return reportsPrepareAction(str(p.siteId) ?? spec.slug); }, // A report site's exports: the same site, report and formats, from the @@ -156,6 +159,12 @@ export const JOB_REPLAY_HANDLERS: Record<string, ReplayHandler> = { const { p } = params(spec); const reportId = str(p.reportId); const formats = strings(p.formats); + if (p.articles === true) { + return articlesExportAction({ + ...(reportId ? { reportId } : {}), + ...(formats ? { formats } : {}), + }); + } return reportsExportAction(str(p.siteId) ?? spec.slug, { ...(reportId ? { reportId } : {}), ...(formats ? { formats } : {}), diff --git a/editor/app/sites/articles/page.tsx b/editor/app/sites/articles/page.tsx @@ -0,0 +1,289 @@ +import type { Metadata } from "next"; +import Link from "next/link"; +import { getPaths } from "yt-dlp-transcript-common/lib/paths"; +import { formatBytes } from "yt-dlp-transcript-common/lib/format"; +import { + REPORT_EXPORT_FILENAMES, + REPORT_EXPORT_FORMATS, +} from "yt-dlp-transcript-common/lib/report/views"; +import { ArticleRowActions } from "../components/ArticleRowActions"; +import { ExportArticlesButton, PrepareArticlesMediaButton } from "../components/ArticlesJobButtons"; +import { FetchMissingEvidenceButton } from "../components/FetchMissingEvidenceButton"; +import { publishRefusal, reportMediaSummary, type ReportMediaSummary } from "../lib/reportList"; +import type { ReportExportsRow } from "../lib/reportListServer"; +import { + latestArticlesJob, + readArticleExports, + readArticleRows, + readArticlesMediaIndex, + type ArticleRow, +} from "../lib/articlesServer"; + +export const dynamic = "force-dynamic"; +export const metadata: Metadata = { title: "Articles — Sites" }; + +// THE ARTICLES (release 26): every article directory under +// `transcripts/reports/`, published by the project homepage — not by a site — +// in `reports/index.json`'s order, then the drafts. Each article's audience +// says which homepage build carries it: the public one only "public" +// articles, the private (local-only) one every published article. Publish, +// unpublish, reorder and the audience are written through the article +// registry (lib/report/registry.ts), as `pnpm ops articles-config` writes +// them. The evidence media and the exports are a site's Reports tab's, over +// the articles, on the same queue. A site's own pages stay on its Reports tab. +// +// A static segment beside /sites/[siteId]: a site named "articles" is not +// reachable here, as one named "new" is not. +export default async function ArticlesPage() { + const paths = getPaths(); + const { rows, indexError } = await readArticleRows(paths); + const published = rows.filter((r) => r.position !== null).map((r) => r.id); + const [mediaIndex, exportRows, lastJob, lastExportJob] = await Promise.all([ + readArticlesMediaIndex(paths), + readArticleExports(paths, published), + latestArticlesJob(paths, "reports-prepare"), + latestArticlesJob(paths, "reports-export"), + ]); + const publicCount = rows.filter((r) => r.position !== null && r.audience === "public").length; + + return ( + <div className="flex flex-col gap-8 max-w-4xl"> + <div className="flex flex-col gap-2"> + <div className="flex items-center gap-2 text-sm text-muted-foreground"> + <Link href="/sites" className="underline hover:text-foreground"> + Sites + </Link> + <span>/</span> + <span>Articles</span> + </div> + <h1 className="text-2xl font-semibold">Articles</h1> + <p className="text-sm"> + {published.length} published ({publicCount} public), {rows.length - published.length} draft + {rows.length - published.length === 1 ? "" : "s"} + </p> + {indexError && ( + <p role="alert" className="text-sm text-destructive"> + {indexError} + </p> + )} + </div> + + <section className="flex flex-col gap-3" aria-label="Articles"> + {rows.length === 0 ? ( + <p className="rounded-md border border-dashed px-3 py-6 text-center text-sm text-muted-foreground"> + No articles yet. Put one at <code>reports/&lt;articleId&gt;/report.json</code>. + </p> + ) : ( + <ul className="flex flex-col gap-3"> + {rows.map((row) => ( + <ArticleListItem key={row.id} row={row} publishedCount={published.length} /> + ))} + </ul> + )} + </section> + + <section className="flex flex-col gap-3 border-t border-border pt-6" aria-label="Evidence media"> + <h2 className="text-lg font-semibold">Evidence media</h2> + <FetchMissingEvidenceButton articles /> + <PrepareArticlesMediaButton /> + <p className="text-sm text-muted-foreground"> + Last prepare job:{" "} + {lastJob ? ( + <Link href={`/jobs/${lastJob.id}`} className="underline font-mono"> + {lastJob.id} + </Link> + ) : ( + "none among recent jobs" + )} + {lastJob && <> ({lastJob.status})</>} + </p> + {mediaIndex ? ( + <MediaSummary summary={reportMediaSummary(mediaIndex)} /> + ) : ( + <p className="text-sm text-muted-foreground">Not prepared yet.</p> + )} + </section> + + <section className="flex flex-col gap-3 border-t border-border pt-6" aria-label="Exports"> + <h2 className="text-lg font-semibold">Exports</h2> + <ExportArticlesButton /> + <p className="text-sm text-muted-foreground"> + Last export job:{" "} + {lastExportJob ? ( + <Link href={`/jobs/${lastExportJob.id}`} className="underline font-mono"> + {lastExportJob.id} + </Link> + ) : ( + "none among recent jobs" + )} + {lastExportJob && <> ({lastExportJob.status})</>} + </p> + {exportRows.length === 0 ? ( + <p className="text-sm text-muted-foreground">No published article to export.</p> + ) : ( + <ul className="flex flex-col gap-2" aria-label="Article exports"> + {exportRows.map((row) => ( + <ExportSummary key={row.reportId} row={row} /> + ))} + </ul> + )} + </section> + </div> + ); +} + +const STATUS_TEXT: Record<ArticleRow["status"], string> = { + ok: "No problems", + problems: "Has problems", + invalid: "Not a valid report", + missing: "Missing", +}; + +function ArticleListItem({ row, publishedCount }: { row: ArticleRow; publishedCount: number }) { + const dates = [ + row.publishedDate ? `published ${row.publishedDate}` : null, + row.updatedDate ? `updated ${row.updatedDate}` : null, + ].filter(Boolean); + return ( + <li + data-testid="article-row" + data-article={row.id} + data-audience={row.audience} + className="flex flex-col gap-2 rounded-lg border bg-card/60 px-3 py-3" + > + <div className="flex flex-wrap items-start justify-between gap-2"> + <div className="flex flex-col gap-0.5"> + <span className="font-medium"> + {row.position !== null && <span className="text-muted-foreground">{row.position + 1}. </span>} + {row.title ?? row.id} + </span> + {row.subtitle && <span className="text-sm text-muted-foreground">{row.subtitle}</span>} + <span className="text-xs text-muted-foreground"> + <code>{row.id}</code> + {row.kind && <> · {row.kind === "factcheck" ? "fact-check" : "sweep"}</>} + {dates.length > 0 && <> · {dates.join(", ")}</>} + </span> + </div> + <div className="flex flex-col items-end gap-1"> + <span className="text-xs"> + <span className={row.position !== null ? "text-success" : "text-muted-foreground"}> + {row.position !== null ? "Published" : "Draft"} + </span> + {" · "} + <span className={row.audience === "public" ? "text-warning" : "text-muted-foreground"}> + {row.audience === "public" ? "Public" : "Private"} + </span> + </span> + <ArticleRowActions + articleId={row.id} + position={row.position} + publishedCount={publishedCount} + publishable={publishRefusal(row)} + audience={row.audience} + /> + </div> + </div> + {(row.status === "ok" || row.status === "problems") && ( + <p className="text-sm"> + {row.sections} section{row.sections === 1 ? "" : "s"} · {row.claims} claim + {row.claims === 1 ? "" : "s"} · {row.citations} citation{row.citations === 1 ? "" : "s"} + </p> + )} + {row.problems.length === 0 ? ( + <span className="text-xs text-muted-foreground">{STATUS_TEXT[row.status]}</span> + ) : ( + <details> + <summary className="cursor-pointer select-none text-xs text-warning"> + {STATUS_TEXT[row.status]} — {row.problems.length} problem{row.problems.length === 1 ? "" : "s"} + </summary> + <ul className="mt-2 flex flex-col gap-1 text-xs"> + {row.problems.map((p, i) => ( + <li key={i}> + {p.path && <code className="text-muted-foreground">{p.path}</code>} + {p.path && ": "} + {p.message} + </li> + ))} + </ul> + </details> + )} + </li> + ); +} + +function MediaSummary({ summary }: { summary: ReportMediaSummary }) { + return ( + <div className="flex flex-col gap-2 rounded-md border border-border bg-card px-4 py-3 text-sm"> + <p> + Prepared {new Date(summary.preparedAt).toLocaleString()}: {summary.moments} moment + {summary.moments === 1 ? "" : "s"} + {summary.momentsByKind.length > 0 && <> ({summary.momentsByKind.map((k) => `${k.count} ${k.kind}`).join(", ")})</>} + , {formatBytes(summary.totalBytes)}. + </p> + {summary.problems.length === 0 ? ( + <p className="text-success">No problems.</p> + ) : ( + <details> + <summary className="cursor-pointer select-none text-warning"> + {summary.problems.length} problem{summary.problems.length === 1 ? "" : "s"}:{" "} + {summary.problemsByKind.map((k) => `${k.count} ${k.kind}`).join(", ")} + </summary> + <ul className="mt-2 flex flex-col gap-1 text-xs"> + {summary.problems.map((p, i) => ( + <li key={i}> + <code className="text-muted-foreground">{p.kind}</code> <code>{p.moment ?? p.report ?? "?"}</code> + {p.citations && p.citations.length > 0 && ( + <span className="text-muted-foreground"> (cited by {p.citations.join(", ")})</span> + )} + : {p.message} + </li> + ))} + </ul> + </details> + )} + </div> + ); +} + +function ExportSummary({ row }: { row: ReportExportsRow }) { + const { manifest, publishable } = row; + return ( + <li + data-testid="article-export" + data-article={row.reportId} + className="flex flex-col gap-1 rounded-md border border-border bg-card px-4 py-3 text-sm" + > + <p> + <code>{row.reportId}</code>{" "} + <span className="text-muted-foreground"> + {manifest ? `exported ${new Date(manifest.exportedAt).toLocaleString()}` : "not exported yet"} + </span> + </p> + {manifest?.revision && ( + <p className="text-xs"> + Revision {manifest.revision.revision} · {manifest.revision.date.slice(0, 10)} ·{" "} + <code title={manifest.revision.commit}>{manifest.revision.commit.slice(0, 12)}</code> + </p> + )} + {manifest && ( + <ul className="flex flex-wrap gap-x-4 gap-y-1 text-xs"> + {REPORT_EXPORT_FORMATS.filter((f) => manifest.files[f]).map((f) => ( + <li key={f}> + <code>{REPORT_EXPORT_FILENAMES[f]}</code> {formatBytes(manifest.files[f]!.bytes)}{" "} + {publishable.files[f] ? ( + <span className="text-success">published on build</span> + ) : ( + <span className="text-warning">local only</span> + )} + </li> + ))} + </ul> + )} + {[...(manifest?.notes ?? []), ...publishable.notes].map((note, i) => ( + <p key={i} className="text-xs text-muted-foreground"> + {note} + </p> + ))} + </li> + ); +} diff --git a/editor/app/sites/components/ArticleRowActions.tsx b/editor/app/sites/components/ArticleRowActions.tsx @@ -0,0 +1,103 @@ +"use client"; + +import { useState, useTransition } from "react"; +import { + moveArticleAction, + publishArticleAction, + setArticleAudienceAction, + unpublishArticleAction, + type ArticlesActionResult, +} from "../lib/articlesActions"; + +// One article's buttons on the Articles tab: Publish for a draft; Up, Down and +// Unpublish for a published one; and its audience — Make public / Make +// private. Each is one write through the article registry +// (lib/articlesActions.ts); the action revalidates the tab. +export function ArticleRowActions({ + articleId, + position, + publishedCount, + publishable, + audience, +}: { + articleId: string; + // Its place in the published list, or null for a draft. + position: number | null; + publishedCount: number; + // Why it may not be published, or null when it may. + publishable: string | null; + audience: "public" | "private"; +}) { + const [pending, start] = useTransition(); + const [error, setError] = useState<string | null>(null); + const run = (fn: () => Promise<ArticlesActionResult>) => { + setError(null); + start(async () => { + const res = await fn(); + if (!res.ok) setError(res.error); + }); + }; + const btn = "rounded border border-border px-2 py-1 text-xs hover:bg-muted disabled:opacity-50"; + const other = audience === "public" ? "private" : "public"; + + return ( + <span className="flex flex-wrap items-center gap-2"> + {position === null ? ( + <button + type="button" + disabled={pending || publishable !== null} + title={publishable ?? undefined} + aria-label={`Publish article ${articleId}`} + onClick={() => run(() => publishArticleAction(articleId))} + className={btn} + > + {pending ? "Working…" : "Publish"} + </button> + ) : ( + <> + <button + type="button" + disabled={pending || position === 0} + aria-label={`Move article ${articleId} up`} + onClick={() => run(() => moveArticleAction(articleId, -1))} + className={btn} + > + ↑ + </button> + <button + type="button" + disabled={pending || position >= publishedCount - 1} + aria-label={`Move article ${articleId} down`} + onClick={() => run(() => moveArticleAction(articleId, 1))} + className={btn} + > + ↓ + </button> + <button + type="button" + disabled={pending} + aria-label={`Unpublish article ${articleId}`} + onClick={() => run(() => unpublishArticleAction(articleId))} + className={btn} + > + Unpublish + </button> + </> + )} + <button + type="button" + disabled={pending} + aria-label={`Make article ${articleId} ${other}`} + onClick={() => run(() => setArticleAudienceAction(articleId, other))} + className={btn} + > + Make {other} + </button> + {error && ( + <span role="alert" className="text-xs text-destructive"> + {error} + </span> + )} + </span> + ); +} diff --git a/editor/app/sites/components/ArticlesJobButtons.tsx b/editor/app/sites/components/ArticlesJobButtons.tsx @@ -0,0 +1,40 @@ +"use client"; + +import { useRouter } from "next/navigation"; +import { StreamActionLog } from "yt-dlp-transcript-common/components/StreamActionLog"; +import { articlesExportAction, articlesPrepareAction } from "../lib/articlesActions"; +import { cancelJobAction } from "../../jobs/actions"; + +// The Articles tab's two jobs, on the reports queue: "Prepare evidence media" +// (every published article's clips and captures, then their exports) and +// "Export articles". Each streams its log; when it settles the tab re-renders +// with what the job wrote. +export function PrepareArticlesMediaButton() { + const router = useRouter(); + return ( + <StreamActionLog + trigger={() => articlesPrepareAction()} + cancelAction={cancelJobAction} + buttonLabel="Prepare evidence media" + runningLabel="Preparing evidence media…" + onSettled={(started) => { + if (started) router.refresh(); + }} + /> + ); +} + +export function ExportArticlesButton() { + const router = useRouter(); + return ( + <StreamActionLog + trigger={() => articlesExportAction()} + cancelAction={cancelJobAction} + buttonLabel="Export articles" + runningLabel="Exporting articles…" + onSettled={(started) => { + if (started) router.refresh(); + }} + /> + ); +} diff --git a/editor/app/sites/components/FetchMissingEvidenceButton.tsx b/editor/app/sites/components/FetchMissingEvidenceButton.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import { useState, useTransition } from "react"; import { Button } from "yt-dlp-transcript-common/components/ui/button"; import { + fetchMissingArticleEvidenceAction, fetchMissingEvidenceAction, type FetchMissingEvidenceResult, } from "../../channels/[slug]/videos/fetchWindowsAction"; @@ -13,12 +14,17 @@ import { // (fetch-windows). Preview answers the same question without starting // anything. It is not a streamed log because a run can start two jobs (YouTube // and Rumble side by side); each is linked, and its log is on /jobs. -export function FetchMissingEvidenceButton({ siteId }: { siteId: string }) { +// `articles` instead of a site: the published articles' (release 26). +export function FetchMissingEvidenceButton(props: { siteId: string } | { articles: true }) { const [pending, start] = useTransition(); const [result, setResult] = useState<FetchMissingEvidenceResult | null>(null); const run = (dryRun: boolean) => { start(async () => { - setResult(await fetchMissingEvidenceAction(siteId, { dryRun })); + setResult( + "siteId" in props + ? await fetchMissingEvidenceAction(props.siteId, { dryRun }) + : await fetchMissingArticleEvidenceAction({ dryRun }), + ); }); }; return ( diff --git a/editor/app/sites/lib/articlesActions.ts b/editor/app/sites/lib/articlesActions.ts @@ -0,0 +1,196 @@ +"use server"; + +import { revalidatePath } from "next/cache"; +import { getPaths } from "yt-dlp-transcript-common/lib/paths"; +import { + ArticleRegistryError, + configureArticle, + isReportAudience, + readArticlesIndex, + setArticlesOrder, + type ArticleConfigChange, +} from "yt-dlp-transcript-common/lib/report/registry"; +import { isReportId } from "yt-dlp-transcript-common/lib/report/schema"; +import { + REPORT_EXPORT_FORMATS, + type ReportExportFormat, +} from "yt-dlp-transcript-common/lib/report/views"; +import { + runManagedFunction, + type StreamActionResult, +} from "yt-dlp-transcript-common/jobs/streamCommand"; +import { formatReportMediaProblems, prepareReportMedia } from "yt-dlp-transcript-common/publish/reportMedia"; +import { + exportAfterPrepare, + exportSiteReports, + formatReportExportProblems, +} from "yt-dlp-transcript-common/publish/reportExports"; +import { articlesWorkHost } from "yt-dlp-transcript-common/publish/reportHost"; +import { withReportMoved } from "./reportList"; +import { REPORTS_PREPARE_QUEUE } from "./reportsQueue"; + +// THE ARTICLES TAB'S WRITES AND JOBS (release 26 A6): the article store, +// `transcripts/reports/` — published by the project homepage, not a site. +// +// Every write goes through the article registry (lib/report/registry.ts: +// locked, validated, atomic), the one writer of `reports/index.json` and an +// article's `audience`, as `pnpm ops articles-config` does. The jobs are a +// site's prepare and export over the articles' host (publish/reportHost.ts +// articlesWorkHost: every published article, plus a named draft), on the +// same queue: an export reads the media cache a prepare writes and prunes. +// A job's spec carries `params.articles: true`; its slug is "articles" (a +// spec needs one, and the job belongs to no channel and no site). + +export type ArticlesActionResult = { ok: true } | { ok: false; error: string }; + +async function configure(id: string, change: ArticleConfigChange): Promise<ArticlesActionResult> { + if (!isReportId(id)) return { ok: false, error: `"${id}" is not a valid article id` }; + try { + await configureArticle(id, change, getPaths()); + } catch (err) { + return { ok: false, error: err instanceof ArticleRegistryError || err instanceof Error ? err.message : String(err) }; + } + revalidatePath("/sites/articles"); + return { ok: true }; +} + +// Publish a draft (last in the list). Refused by the registry unless its +// report.json is sound — read now, not when the tab rendered. +export async function publishArticleAction(id: string): Promise<ArticlesActionResult> { + return configure(id, { published: true }); +} + +// Unpublish: off the list, back to a draft. Its directory is not touched. +export async function unpublishArticleAction(id: string): Promise<ArticlesActionResult> { + return configure(id, { published: false }); +} + +// Who may read it: the public homepage build carries only "public" articles. +export async function setArticleAudienceAction(id: string, audience: string): Promise<ArticlesActionResult> { + if (!isReportAudience(audience)) return { ok: false, error: `"${audience}" is not an audience` }; + return configure(id, { audience }); +} + +// One place up (-1) or down (1) in the published order, applied to the order +// as it is on disk inside the registry's lock. +export async function moveArticleAction(id: string, dir: -1 | 1): Promise<ArticlesActionResult> { + if (dir !== -1 && dir !== 1) return { ok: false, error: "An article moves one place up or down." }; + if (!isReportId(id)) return { ok: false, error: `"${id}" is not a valid article id` }; + const paths = getPaths(); + try { + const index = await readArticlesIndex(paths); + if (!index.published.includes(id)) return { ok: false, error: `"${id}" is not published` }; + const position = withReportMoved(index.published, id, dir).indexOf(id); + await configureArticle(id, { position }, paths); + } catch (err) { + return { ok: false, error: err instanceof Error ? err.message : String(err) }; + } + revalidatePath("/sites/articles"); + return { ok: true }; +} + +// The whole published order at once (a caller that reorders by dragging). +export async function setArticlesOrderAction(ids: string[]): Promise<ArticlesActionResult> { + try { + await setArticlesOrder(ids, getPaths()); + } catch (err) { + return { ok: false, error: err instanceof Error ? err.message : String(err) }; + } + revalidatePath("/sites/articles"); + return { ok: true }; +} + +// PREPARE THE ARTICLES' EVIDENCE MEDIA as a job: every clip the published +// articles (plus `article`, a draft being readied) cite, cut from the media on +// disk, and every cited post capture, into `.export-index/articles/report-media/`; +// then, when nothing is missing, their exports. As the site's prepare: the job +// FAILS when a citation lacks its media, the log naming each. +export async function articlesPrepareAction(article?: string): Promise<StreamActionResult> { + const paths = getPaths(); + const include = article?.trim() ? [article.trim()] : []; + let host; + try { + host = await articlesWorkHost(paths, include); + } catch (err) { + return { ok: false, error: (err as Error).message }; + } + return runManagedFunction({ + kind: "reports-prepare", + queueKey: REPORTS_PREPARE_QUEUE, + paths, + spec: { kind: "reports-prepare", slug: "articles", params: { articles: true, ...(include[0] ? { article: include[0] } : {}) } }, + fn: async (onLog, signal) => { + const index = await prepareReportMedia({ host, paths, onLog, signal }); + if (index.problems.length > 0) { + for (const line of formatReportMediaProblems(index.problems)) onLog(line); + throw new Error(`${index.problems.length} problem(s): the articles' evidence media is not complete`); + } + const exported = await exportAfterPrepare(index, { host, paths, onLog, signal }); + for (const r of exported?.exported ?? []) { + for (const note of r.manifest.notes) onLog(`note: ${r.reportId}: ${note}`); + } + if (!exported || exported.problems.length === 0) return; + for (const line of formatReportExportProblems(exported.problems)) onLog(line); + throw new Error(`${exported.problems.length} problem(s): the articles were not all exported`); + }, + }); +} + +// EXPORT THE ARTICLES as a job: each published article (or the one named, +// published or a draft) as files, into `.export-index/articles/report-exports/`, +// where the homepage's compose publishes them from. +export async function articlesExportAction( + opts: { reportId?: string; formats?: string[] } = {}, +): Promise<StreamActionResult> { + const paths = getPaths(); + if (opts.reportId !== undefined && !isReportId(opts.reportId)) { + return { ok: false, error: `"${opts.reportId}" is not an article id` }; + } + let formats: ReportExportFormat[] | undefined; + if (opts.formats !== undefined) { + const bad = opts.formats.filter((f) => !(REPORT_EXPORT_FORMATS as readonly string[]).includes(f)); + if (bad.length > 0 || opts.formats.length === 0) { + return { + ok: false, + error: `formats are some of ${REPORT_EXPORT_FORMATS.join(", ")}${bad.length ? ` (not ${bad.join(", ")})` : ""}`, + }; + } + formats = REPORT_EXPORT_FORMATS.filter((f) => opts.formats!.includes(f)); + } + let host; + try { + host = await articlesWorkHost(paths, opts.reportId ? [opts.reportId] : []); + } catch (err) { + return { ok: false, error: (err as Error).message }; + } + return runManagedFunction({ + kind: "reports-export", + queueKey: REPORTS_PREPARE_QUEUE, + paths, + spec: { + kind: "reports-export", + slug: "articles", + params: { + articles: true, + ...(opts.reportId ? { reportId: opts.reportId } : {}), + ...(formats ? { formats } : {}), + }, + }, + fn: async (onLog, signal) => { + const result = await exportSiteReports({ + host, + paths, + onLog, + signal, + ...(opts.reportId ? { reportId: opts.reportId } : {}), + ...(formats ? { formats } : {}), + }); + for (const r of result.exported) { + for (const note of r.manifest.notes) onLog(`note: ${r.reportId}: ${note}`); + } + if (result.problems.length === 0) return; + for (const line of formatReportExportProblems(result.problems)) onLog(line); + throw new Error(`${result.problems.length} problem(s): the articles were not all exported`); + }, + }); +} diff --git a/editor/app/sites/lib/articlesServer.ts b/editor/app/sites/lib/articlesServer.ts @@ -0,0 +1,85 @@ +import "server-only"; +import type { Paths } from "yt-dlp-transcript-common/lib/paths"; +import { readJsonFile } from "yt-dlp-transcript-common/lib/jsonFile-server"; +import { + articleAudience, + articleFile, + listArticleDirs, + readArticlesIndex, +} from "yt-dlp-transcript-common/lib/report/registry"; +import type { ReportAudience } from "yt-dlp-transcript-common/lib/report/schema"; +import { articleReportStore } from "yt-dlp-transcript-common/lib/report/store"; +import { readStoreMediaIndex, type ReportMediaIndex } from "yt-dlp-transcript-common/publish/reportMedia"; +import { + publishableStoreExports, + readStoreExportManifest, +} from "yt-dlp-transcript-common/publish/reportExportFiles"; +import { getRegistry } from "yt-dlp-transcript-common/jobs/registry"; +import { listAllJobs, type JobListEntry } from "yt-dlp-transcript-common/jobs/listJobs"; +import { readJobMeta } from "yt-dlp-transcript-common/jobs/jobMeta"; +import { reportRows, type ReportFileRead, type ReportRow } from "./reportList"; +import type { ReportExportsRow } from "./reportListServer"; + +// THE ARTICLES TAB, read: every article directory under +// `transcripts/reports/`, published (reports/index.json, in order) then +// drafts, each read and validated as a site's report is (reportList.ts), with +// its audience; the articles' prepared media; their exports; the last jobs. + +export type ArticleRow = ReportRow & { audience: ReportAudience }; + +// An index.json that cannot be read is the tab's error to show, not an empty +// list (lib/report/registry.ts readArticlesIndex). +export async function readArticleRows(paths: Paths): Promise<{ rows: ArticleRow[]; indexError: string | null }> { + let published: string[] = []; + let indexError: string | null = null; + try { + published = (await readArticlesIndex(paths)).published; + } catch (err) { + indexError = (err as Error).message; + } + const dirIds = await listArticleDirs(paths); + const ids = [...new Set([...published, ...dirIds])]; + const reads = new Map<string, ReportFileRead>( + await Promise.all(ids.map(async (id) => [id, await readJsonFile(articleFile(paths, id))] as const)), + ); + const rows = reportRows(published, dirIds, reads).map((row) => { + const read = reads.get(row.id); + return { ...row, audience: articleAudience(read?.ok ? (read.value as { audience?: unknown }) : null) }; + }); + return { rows, indexError }; +} + +export async function readArticlesMediaIndex(paths: Paths): Promise<ReportMediaIndex | null> { + return readStoreMediaIndex(articleReportStore(paths)); +} + +// Each published article's exports: the last export's manifest and which +// files the homepage's compose would publish now. +export async function readArticleExports(paths: Paths, published: readonly string[]): Promise<ReportExportsRow[]> { + const store = articleReportStore(paths); + return Promise.all( + published.map(async (reportId) => ({ + reportId, + manifest: await readStoreExportManifest(store, reportId), + publishable: await publishableStoreExports(store, reportId), + })), + ); +} + +const JOB_LOOKBACK = 100; + +// The newest articles job of `kind` (its spec says `params.articles`), live or +// from an earlier server lifetime, or null. +export async function latestArticlesJob( + paths: Paths, + kind: "reports-prepare" | "reports-export", +): Promise<JobListEntry | null> { + const page = await listAllJobs(paths, { limit: JOB_LOOKBACK }); + const registry = getRegistry(); + for (const entry of page.entries) { + if (entry.kind !== kind) continue; + const spec = registry.get(entry.id)?.spec ?? (await readJobMeta(paths, entry.id))?.spec; + if ((spec?.params as { articles?: unknown } | undefined)?.articles === true) return entry; + } + return null; +} diff --git a/editor/app/sites/page.tsx b/editor/app/sites/page.tsx @@ -77,12 +77,21 @@ export default async function SitesPage() { <section className="flex flex-col gap-4"> <div className="flex items-center justify-between gap-2"> <h1 className="text-2xl font-semibold">Sites</h1> - <Link - href="/sites/new" - className="px-3 py-2 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:opacity-90" - > - + New site - </Link> + <div className="flex items-center gap-2"> + {/* The articles the homepage publishes (release 26). */} + <Link + href="/sites/articles" + className="px-3 py-2 rounded-md border border-border text-sm font-medium hover:bg-muted" + > + Articles + </Link> + <Link + href="/sites/new" + className="px-3 py-2 rounded-md bg-primary text-primary-foreground text-sm font-medium hover:opacity-90" + > + + New site + </Link> + </div> </div> {sites.length === 0 && ( <div className="flex flex-col gap-3 rounded border border-border p-4"> diff --git a/editor/e2e/articles.spec.ts b/editor/e2e/articles.spec.ts @@ -0,0 +1,67 @@ +import { test, expect } from "@playwright/test"; +import { mkdir, readFile, writeFile } from "node:fs/promises"; +import { join } from "node:path"; +import { resetData, testPaths } from "./helpers"; + +// The Articles tab (release 26 A6): /sites/articles lists the article store +// (transcripts/reports/), and its buttons write reports/index.json and an +// article's `audience` through the article registry. Invented fixture ids +// only. + +const reportsDir = () => join(testPaths().transcriptsDir, "reports"); +const article = (id: string, over: Record<string, unknown> = {}) => ({ + format: "archilyzer-report", + version: 1, + id, + kind: "sweep", + title: `Fixture article ${id}`, + sections: [{ id: "s1", title: "One", body: "Plain words." }], + ...over, +}); + +async function putArticle(id: string, over: Record<string, unknown> = {}) { + await mkdir(join(reportsDir(), id), { recursive: true }); + await writeFile(join(reportsDir(), id, "report.json"), JSON.stringify(article(id, over), null, 2)); +} + +const readIndex = async () => + JSON.parse(await readFile(join(reportsDir(), "index.json"), "utf8").catch(() => '{"published":[]}')) as { + published: string[]; + }; +const readArticle = async (id: string) => + JSON.parse(await readFile(join(reportsDir(), id, "report.json"), "utf8")) as { audience?: string }; + +test("publish, reorder, make public and unpublish articles; one with problems cannot be published", async ({ page }) => { + await resetData("empty"); + await putArticle("fixture-one"); + await putArticle("fixture-two"); + await putArticle("fixture-broken", { summary: "see [x](cite:nobody)" }); + + await page.goto("/sites"); + await page.getByRole("link", { name: "Articles", exact: true }).click(); + await expect(page).toHaveURL(/\/sites\/articles$/); + await expect(page.getByRole("heading", { name: "Articles", level: 1 })).toBeVisible(); + const row = (id: string) => page.locator(`[data-testid="article-row"][data-article="${id}"]`); + await expect(page.getByTestId("article-row")).toHaveCount(3); + await expect(row("fixture-broken").getByRole("button", { name: "Publish article fixture-broken" })).toBeDisabled(); + + await row("fixture-one").getByRole("button", { name: "Publish article fixture-one" }).click(); + await expect(row("fixture-one").getByRole("button", { name: "Unpublish article fixture-one" })).toBeVisible(); + await row("fixture-two").getByRole("button", { name: "Publish article fixture-two" }).click(); + await expect(row("fixture-two").getByRole("button", { name: "Unpublish article fixture-two" })).toBeVisible(); + await expect.poll(readIndex).toEqual({ published: ["fixture-one", "fixture-two"] }); + + await row("fixture-two").getByRole("button", { name: "Move article fixture-two up" }).click(); + await expect.poll(readIndex).toEqual({ published: ["fixture-two", "fixture-one"] }); + + // Private by default; going public is explicit and lands in report.json. + await expect(row("fixture-one")).toHaveAttribute("data-audience", "private"); + await row("fixture-one").getByRole("button", { name: "Make article fixture-one public" }).click(); + await expect(row("fixture-one")).toHaveAttribute("data-audience", "public"); + await expect.poll(async () => (await readArticle("fixture-one")).audience).toBe("public"); + await expect(page.getByText("2 published (1 public), 1 draft")).toBeVisible(); + + await row("fixture-two").getByRole("button", { name: "Unpublish article fixture-two" }).click(); + await expect.poll(readIndex).toEqual({ published: ["fixture-one"] }); + await expect(page.locator('[data-testid="article-export"]')).toHaveCount(1); +}); diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs @@ -79,6 +79,7 @@ // pnpm ops deploy-homepage --json '{"preview":"refresh"}' --wait // pnpm ops reports-prepare --json '{"siteId":"demo-site"}' --wait // pnpm ops reports-export --json '{"siteId":"demo-site","formats":["html","md"]}' --wait +// pnpm ops reports-prepare --json '{"articles":true}' --wait // pnpm ops get channel the-quartering // pnpm ops get channels // pnpm ops tags --json '{"op":"define","tag":{"id":"eva-collab","label":"Collab"}}' @@ -765,11 +766,14 @@ export function usage() { ' published reports cite into its report-media cache, before its build:', ' {"siteId"}. The job fails, naming each one, when a citation lacks media.', ' When nothing is missing it then exports the reports, as reports-export.', + ' {"articles": true} does it for the published articles (transcripts/', + ' reports/, the homepage\'s); {"article": "<id>"} adds that one (a draft).', "", 'reports-export writes each published report as report.html, report.pdf,', ' report.md, slides.html, slides.pdf and evidence-pack.zip for the site\'s', ' build to publish: {"siteId", "reportId"?, "formats"?: ["html","pdf","md",', - ' "slides","slides-pdf","zip"]}.', + ' "slides","slides-pdf","zip"]}; {"articles": true, "reportId"?, …} the', + ' articles\' (reportId: one article, published or a draft).', "", 'settings patches settings.json through the editor\'s one writer:', ' {"patch": {"<top-level key>": value, …}} (SETTINGS.md). A block\'s keys',