Skip to content

Commit d5980e9

Browse files
committed
Merge branch 'docs/tutorial' into 0.5-maintenance
2 parents affec74 + 489a98f commit d5980e9

29 files changed

Lines changed: 2247 additions & 4 deletions

AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,3 +700,21 @@ mise run docs:dev # Start development server
700700
701701
Always run `mise run docs:build` before committing documentation changes to
702702
catch Twoslash type errors.
703+
704+
705+
Keeping tutorials in sync with their examples
706+
---------------------------------------------
707+
708+
*docs/tutorial/rss-bot.md* and *examples/rss-bot/* are hand-synced: the
709+
tutorial's code samples are meant to be exact copies of the real, tested
710+
files, not paraphrased from memory. A sample that merely reads plausibly
711+
can drift from the file it claims to show, missing a comment or a line,
712+
without failing any check, since `mise run docs:build` only type-checks
713+
a sample in isolation and has no idea what the real file looks like.
714+
Before treating a tutorial edit as done, diff every changed sample
715+
against the actual file, not just the parts that obviously changed.
716+
717+
The same applies in the other direction: changing code under
718+
*examples/rss-bot/* without checking whether *docs/tutorial/rss-bot.md*
719+
needs a matching update is how that drift starts in the first place.
720+
When one changes, check the other.

deno.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"@fedify/vocab-runtime": "jsr:@fedify/vocab-runtime@~2.3.1",
99
"@js-temporal/polyfill": "npm:@js-temporal/polyfill@^0.5.1",
1010
"@logtape/logtape": "jsr:@logtape/logtape@^2.2.3",
11+
"@rowanmanning/feed-parser": "npm:@rowanmanning/feed-parser@^2.1.3",
1112
"@std/fs": "jsr:@std/fs@^1.0.24",
1213
"@std/path": "jsr:@std/path@^1.1.6",
1314
"hono": "jsr:@hono/hono@^4.12.27",

deno.lock

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/.vitepress/config.mts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ if (process.env.PLAUSIBLE_DOMAIN) {
3131
];
3232
}
3333

34+
const learn = {
35+
text: "Learn",
36+
items: [
37+
{ text: "What is BotKit?", link: "/intro.md" },
38+
{ text: "Getting started", link: "/start.md" },
39+
{ text: "Building an RSS bot", link: "/tutorial/rss-bot.md" },
40+
{ text: "Recipes", link: "/recipes.md" },
41+
{ text: "Examples", link: "/examples.md" },
42+
],
43+
};
44+
3445
const concepts = {
3546
text: "Concepts",
3647
items: [
@@ -83,18 +94,16 @@ export default defineConfig({
8394
logo: "/logo.svg",
8495
nav: [
8596
{ text: "Home", link: "/" },
86-
{ text: "About", link: "/intro.md" },
87-
{ text: "Start", link: "/start.md" },
97+
learn,
8898
concepts,
8999
deploy,
90100
references,
91-
{ text: "Recipes", link: "/recipes.md" },
92-
{ text: "Examples", link: "/examples.md" },
93101
],
94102

95103
sidebar: [
96104
{ text: "What is BotKit?", link: "/intro.md" },
97105
{ text: "Getting started", link: "/start.md" },
106+
{ text: "Building an RSS bot", link: "/tutorial/rss-bot.md" },
98107
concepts,
99108
deploy,
100109
references,

docs/examples.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,33 @@ multiple bot groups are probed in the order they were created.
153153
<!-- hongdown-enable -->
154154

155155

156+
RSS/Atom feed bot
157+
-----------------
158+
159+
The following example shows a bot that polls an RSS, Atom, or RDF feed on
160+
an interval and publishes new entries to the fediverse, replies to
161+
mentions with its status, and persists both its own state and BotKit's
162+
data across restarts using SQLite. It's covered in depth, file by file,
163+
in the [*Building an RSS bot*](./tutorial/rss-bot.md) tutorial, which also
164+
grows it into a `createInstance()`-based instance hosting one bot per
165+
feed, registered by mentioning the instance with a feed's URL, and ends
166+
with a self-hosted deployment.
167+
168+
<!-- hongdown-disable -->
169+
170+
::: code-group
171+
172+
<<< @/../examples/rss-bot/feed.ts [feed.ts]
173+
174+
<<< @/../examples/rss-bot/db.ts [db.ts]
175+
176+
<<< @/../examples/rss-bot/instance.ts [instance.ts]
177+
178+
:::
179+
180+
<!-- hongdown-enable -->
181+
182+
156183
FediChatBot
157184
-----------
158185

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"@fedify/vocab": "^2.3.1",
1313
"@fedify/vocab-runtime": "^2.3.1",
1414
"@js-temporal/polyfill": "catalog:",
15+
"@rowanmanning/feed-parser": "^2.1.3",
1516
"@shikijs/vitepress-twoslash": "^4.3.1",
1617
"@types/deno": "^2.3.0",
1718
"@types/node": "^24.0.3",

0 commit comments

Comments
 (0)