Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
454 changes: 441 additions & 13 deletions .brain/data/cafe/news.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .brain/data/git-snapshot.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions apps/infra/test/website-build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ it.layer(NodeServices.layer)((test) => {
"/",
"/lore/services-capture-dependencies",
"/news",
"/news/latest",
"/directory",
])
);
Expand Down Expand Up @@ -208,6 +209,12 @@ it.layer(NodeServices.layer)((test) => {
path.join(result.clientDirectory, "news/index.html")
),
],
[
"/news/latest",
yield* fs.readFileString(
path.join(result.clientDirectory, "news/latest/index.html")
),
],
[
"/directory",
yield* fs.readFileString(
Expand Down
62 changes: 40 additions & 22 deletions apps/site/scripts/cafe-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
cafeDomain,
cafeLetterInitial,
githubProfileUrl,
selectCafeNews,
rankCafeNews,
sortCafeNewsNewest,
sortCafeProjects,
verifiedLetters,
xProfileUrl,
Expand Down Expand Up @@ -37,10 +38,12 @@ import {
sortSources,
threadCounts,
} from "../../web/src/features/cafe/copy.ts";
import {
newsOrder,
otherNewsOrder,
} from "../../web/src/features/cafe/news-order.ts";
import { cafeSubmissionGuide } from "../src/agent-guide.ts";

const pageLimit = 100;

const submissionSource = [
"<HumanOnly>",
cafeSubmissionPrompt,
Expand Down Expand Up @@ -93,40 +96,55 @@ const newsItemMarkdown =
[
`${index + 1}. [${newsKindLabels[item.kind]}] [${linkText(item.title)}](${item.url}) (${cafeDomain(item.url)})`,
...(item.summary === null ? [] : [` ${item.summary}`]),
...(item.interest === undefined ? [] : [` ${item.interest.why}`]),
` ${item.date} by ${authorMarkdown(item.author, cafeDomain(item.url))}${profileLink(people, item)}`,
...threadMarkdown(item),
].join("\n");

export const cafeNewsPageItems = (
data: CafeDataValue,
sort: keyof typeof newsOrder
) =>
sort === "rank"
? rankCafeNews(data.news, data.rankedAt, data.people).map(
(entry) => entry.item
)
: sortCafeNewsNewest(data.news);

const sortMarkdown = [
`## ${newsCopy.sortHeading}`,
"",
sortSignalsLead,
"",
...sortSignals.map((signal) => `- ${signal}`),
"",
sortRulesLead,
"",
...sortRules.map((rule) => `- ${rule}`),
"",
`Prior art: ${sortSources.map((source) => `[${source.label}](${source.href})`).join(", ")}.`,
"",
];

export const cafeNewsMarkdown = (
data: CafeDataValue,
people: typeof CafePeopleList.Type
people: typeof CafePeopleList.Type,
sort: keyof typeof newsOrder
) => {
const list = selectCafeNews(data, { limit: pageLimit, sort: "rank" });
const itemMarkdown = newsItemMarkdown(people.people);
const other = otherNewsOrder(sort);

return [
`# ${newsCopy.heading}`,
`# ${sort === "rank" ? newsCopy.heading : newsOrder.newest.heading}`,
"",
newsCopy.intro,
"",
`[${newsCopy.feedLabel}](/news.xml)`,
`[${other.label}](${other.href}) · [${newsCopy.feedLabel}](/news.xml)`,
"",
list.items
.map((entry, index) => itemMarkdown(entry.item, index))
cafeNewsPageItems(data, sort)
.map(newsItemMarkdown(people.people))
.join("\n\n"),
"",
`## ${newsCopy.sortHeading}`,
"",
sortSignalsLead,
"",
...sortSignals.map((signal) => `- ${signal}`),
"",
sortRulesLead,
"",
...sortRules.map((rule) => `- ${rule}`),
"",
`Prior art: ${sortSources.map((source) => `[${source.label}](${source.href})`).join(", ")}.`,
"",
...(sort === "rank" ? sortMarkdown : []),
submissionSource,
].join("\n");
};
Expand Down
92 changes: 54 additions & 38 deletions apps/site/scripts/generate-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {
directoryCopy,
newsCopy,
} from "../../web/src/features/cafe/copy.ts";
import { newsOrder } from "../../web/src/features/cafe/news-order.ts";
import { searchCopy } from "../../web/src/features/docs-copy.ts";
import {
tubeCopy,
Expand Down Expand Up @@ -1100,13 +1101,25 @@ const program = Effect.gen(function* generateContent() {
const withNewsCallout = (markdown: string, routePath: string) =>
withNewsPointer(markdown, routePath, newsTitle);

const cafeNewsSource = cafeNewsMarkdown(cafeData, allStarsList);
const cafeNewsPages = [
{
...newsOrder.rank,
description: newsCopy.description,
heading: newsCopy.heading,
sort: "rank",
},
{ ...newsOrder.newest, sort: "newest" },
] as const;

const cafeNewsText = renderAgentPage(
cafeNewsSource,
"/news",
newsCopy.heading
);
const cafeNewsSources = cafeNewsPages.map((page) => {
const source = cafeNewsMarkdown(cafeData, allStarsList, page.sort);

return {
...page,
source,
text: renderAgentPage(source, page.href, page.heading),
};
});

const cafeDirectorySource = cafeDirectoryMarkdown(cafeData);

Expand Down Expand Up @@ -2223,7 +2236,7 @@ Follow [ports and adapters](/lore/hexagonal-architecture) for provider boundarie
"- [Public content corpus](__RATSTACK_ORIGIN__/llms-full.txt): rules, lore, and skills in one response",
"- [HTTP API](__RATSTACK_ORIGIN__/openapi.json): routes, inputs, outputs, and errors",
"- [MCP server](__RATSTACK_ORIGIN__/mcp): Model Context Protocol tools for search, reading, and code in a restricted environment",
"- [Ratstack news](__RATSTACK_ORIGIN__/news): Cloudflare, Alchemy, Foldkit and Effect news, ranked by engagement and freshness; also an [Atom feed](__RATSTACK_ORIGIN__/news.xml) and the `listCafeNews` tool",
"- [Ratstack news](__RATSTACK_ORIGIN__/news): Cloudflare, Alchemy, Foldkit and Effect news, ranked by interest; also [latest first](__RATSTACK_ORIGIN__/news/latest), an [Atom feed](__RATSTACK_ORIGIN__/news.xml) and the `listCafeNews` tool",
"- [Ratstack directory](__RATSTACK_ORIGIN__/directory): reviewed projects with per-letter stack evidence; also the `listCafeProjects` tool",
llmsAllStarsLinks,
"- [RatTube](__RATSTACK_ORIGIN__/tube): curated videos for learning Effect, Alchemy, XState, TypeScript, agents and MCP, Cloudflare, and systems thinking, ranked S to F with a short take on each",
Expand Down Expand Up @@ -2262,7 +2275,7 @@ Follow [ports and adapters](/lore/hexagonal-architecture) for provider boundarie
dillonPosterRoutePath,
"/glossary",
"/og/glossary.png",
"/news",
...cafeNewsPages.map((page) => page.href),
"/news.xml",
"/directory",
"/all-stars",
Expand Down Expand Up @@ -2930,7 +2943,7 @@ Follow [ports and adapters](/lore/hexagonal-architecture) for provider boundarie
const contentVersion = digest(
[
learnCoverageText,
cafeNewsText,
...cafeNewsSources.map((page) => page.text),
cafeDirectoryText,
allStarsIndexText,
...allStarsPages.map((page) => page.text),
Expand Down Expand Up @@ -2994,11 +3007,11 @@ Follow [ports and adapters](/lore/hexagonal-architecture) for provider boundarie
} as const;

const ogPages: readonly OgPage[] = [
{
description: newsCopy.description,
routePath: "/news",
title: newsCopy.heading,
},
...cafeNewsPages.map((page) => ({
description: page.description,
routePath: page.href,
title: page.heading,
})),
{
description: directoryCopy.description,
routePath: "/directory",
Expand Down Expand Up @@ -3484,25 +3497,32 @@ Follow [ports and adapters](/lore/hexagonal-architecture) for provider boundarie
})
)(workshop.pages);

const cafeNewsBody = yield* compileMarkdownBody(
cafeNewsSource,
"cafe-news.md",
highlighter,
emptyTargets,
[],
"/news"
);
const cafeNewsDocuments = yield* Effect.forEach(
(page: (typeof cafeNewsSources)[number]) =>
Effect.gen(function* makeCafeNewsDocument() {
const body = yield* compileMarkdownBody(
page.source,
`cafe-news-${page.sort}.md`,
highlighter,
emptyTargets,
[],
page.href
);

const cafeNewsDocument = yield* makeDocument(
cafeNewsBody.bodyHtml,
{
description: newsCopy.description,
path: "/news",
title: pageTitle(newsCopy.heading),
},
cafeNewsFile,
contentVersion
);
const documentHtml = yield* makeDocument(
body.bodyHtml,
{
description: page.description,
path: page.href,
title: pageTitle(page.heading),
},
cafeNewsFile,
contentVersion
);

return { documentHtml, routePath: page.href, text: page.text };
})
)(cafeNewsSources);

const cafeDirectoryBody = yield* compileMarkdownBody(
cafeDirectorySource,
Expand Down Expand Up @@ -3692,7 +3712,7 @@ Follow [ports and adapters](/lore/hexagonal-architecture) for provider boundarie
"/skills",
"/glossary",
"/prompts",
"/news",
...cafeNewsPages.map((page) => page.href),
"/directory",
"/all-stars",
...allStarsProfiles.map((profile) => profile.route),
Expand Down Expand Up @@ -3829,11 +3849,7 @@ Follow [ports and adapters](/lore/hexagonal-architecture) for provider boundarie
routePath: "/prompts",
text: promptsIndexMarkdown,
},
{
documentHtml: cafeNewsDocument,
routePath: "/news",
text: cafeNewsText,
},
...cafeNewsDocuments,
{
documentHtml: cafeDirectoryDocument,
routePath: "/directory",
Expand Down
2 changes: 1 addition & 1 deletion apps/site/scripts/home-featured.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const homeFeaturedMarkdown = (
videos: readonly TubeVideoValue[],
origin: string
) => {
const news = rankCafeNews(cafe.news, cafe.rankedAt)
const news = rankCafeNews(cafe.news, cafe.rankedAt, cafe.people)
.slice(0, featuredCount)
.map(({ item }) =>
[
Expand Down
27 changes: 16 additions & 11 deletions apps/site/scripts/reader-cafe-flags.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CafeDirectory, listPeople } from "@rat-stack/core/cafe-directory";
import { profileForNewsRow } from "@rat-stack/core/cafe-people";
import { selectCafeNews, sortCafeProjects } from "@rat-stack/core/contracts";
import { sortCafeProjects } from "@rat-stack/core/contracts";
import { Effect, Option } from "effect";

import { Model } from "../../web/src/client/cafe/model.ts";
Expand All @@ -10,6 +10,8 @@ import {
directoryCopy,
newsCopy,
} from "../../web/src/features/cafe/copy.ts";
import { newsOrder } from "../../web/src/features/cafe/news-order.ts";
import { cafeNewsPageItems } from "./cafe-pages.ts";
import { ReaderInputError } from "./reader-input-error.ts";
import { prepareReaderSiteInputs } from "./reader-site-inputs.ts";

Expand All @@ -21,7 +23,7 @@ export const readerCafeFlags = Effect.fn("readerCafeFlags")(
const data = inputs.cafe;

const page = Effect.fn("readerCafeFlags.page")(function* page(
path: "/news" | "/directory" | "/all-stars",
path: "/news" | "/news/latest" | "/directory" | "/all-stars",
heading: string,
sourcePath: string,
cafe: CafeModel
Expand Down Expand Up @@ -60,15 +62,12 @@ export const readerCafeFlags = Effect.fn("readerCafeFlags")(
.handler({ limit: pageLimit })
.pipe(Effect.provide(CafeDirectory.layer(data)));

const items = selectCafeNews(data, {
limit: pageLimit,
sort: "rank",
}).items.map((entry) => entry.item);
const newsPage = (sort: keyof typeof newsOrder) => {
const items = cafeNewsPageItems(data, sort);

return [
yield* page(
"/news",
newsCopy.heading,
return page(
newsOrder[sort].href,
sort === "rank" ? newsCopy.heading : newsOrder.newest.heading,
".brain/data/cafe/news.json",
Model.News({
items,
Expand All @@ -82,8 +81,14 @@ export const readerCafeFlags = Effect.fn("readerCafeFlags")(
)
),
rankedAt: data.rankedAt,
sort,
})
),
);
};

return [
yield* newsPage("rank"),
yield* newsPage("newest"),
yield* page(
"/all-stars",
allStarsCopy.heading,
Expand Down
2 changes: 1 addition & 1 deletion apps/site/src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Alchemy, Foldkit, the cartridges and the content build are optional. Add each on
- [HTTP API](${origin}/openapi.json): routes, inputs, outputs, and errors
- [MCP server](${origin}/mcp): Model Context Protocol tools for search, reading, and code in a restricted environment
- [Code mode](${origin}/api/execute): run a program instead of several calls; POST JSON with a \`code\` string, or call the MCP \`execute\` tool
- [Ratstack news](${origin}/news): Cloudflare, Alchemy, Foldkit and Effect news, ranked by engagement and freshness; also an [Atom feed](${origin}/news.xml) and the \`listCafeNews\` tool
- [Ratstack news](${origin}/news): Cloudflare, Alchemy, Foldkit and Effect news, ranked by interest; also [latest first](${origin}/news/latest), an [Atom feed](${origin}/news.xml) and the \`listCafeNews\` tool
- [Ratstack directory](${origin}/directory): reviewed projects with per-letter stack evidence; also the \`listCafeProjects\` tool. Suggest entries through GitHub with the approval steps below.
${catalog.llmsAllStarsLinks.replaceAll(originToken, origin)}
- [RatTube](${origin}/tube): curated videos for learning Effect, Alchemy, XState, TypeScript, agents and MCP, Cloudflare, and systems thinking, ranked S to F with a short take on each
Expand Down
1 change: 1 addition & 0 deletions apps/site/src/reader-website.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const readerWebsiteRoutes: readonly string[] = [
"/all-stars/*",
"/directory",
"/news",
"/news/latest",
"/search",
"/README.md",
"/VISION.md",
Expand Down
1 change: 1 addition & 0 deletions apps/site/test/content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,7 @@ it.layer(contentServices)("generated content", (test) => {
"/lore",
"/prompts",
"/news",
"/news/latest",
"/directory",
...allStarsRoutes,
"/tube",
Expand Down
1 change: 1 addition & 0 deletions apps/site/test/emit-assets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ it.effect(
"/lore",
"/prompts",
"/news",
"/news/latest",
"/directory",
"/tube",
...tube.videos.flatMap((video) =>
Expand Down
Loading
Loading