From c7cc64e45cb7e937979b58cc28ce26a20bcdf017 Mon Sep 17 00:00:00 2001 From: Reynaldi Chernando <12949382+reynaldichernando@users.noreply.github.com> Date: Sun, 25 Oct 2026 19:18:55 +0700 Subject: [PATCH] docs: medium events recipes (PUT-1971) (#4333) * docs: easy events recipe (PUT-1961) * docs: catch-up-on-notifications events recipe (PUT-1961) * docs: events recipe corrections from a run against a live server (PUT-1961) * docs: medium events recipes (PUT-1971) * docs: simpler wording in medium events recipes (PUT-1971) * refine --------- Co-authored-by: Daniel Salazar --- AGENTS.md | 1 + src/docs/src/Events/onPersistent.md | 2 +- .../src/recipes/keep-an-open-file-in-sync.md | 506 ++++++++++++++++++ .../src/recipes/run-code-in-the-background.md | 456 ++++++++++++++++ 4 files changed, 964 insertions(+), 1 deletion(-) create mode 100644 src/docs/src/recipes/keep-an-open-file-in-sync.md create mode 100644 src/docs/src/recipes/run-code-in-the-background.md diff --git a/AGENTS.md b/AGENTS.md index e0e297b78..c16bb19cd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -184,6 +184,7 @@ Recipes are tested, copy-pasteable patterns for a task, one layer above the per- - **Description.** Written for someone who has never heard of Puter. Start with "Learn how to", put the action first, and say what the reader's app gains: "Learn how to add file sharing to your app with Puter.js, so users can share files in their Puter account with other people." No API names, no mechanism, no list of example cases, and no "not just …" contrast. - **Intro.** Explain the situation and why you'd do this, tied to something the reader already knows ("`puter.kv` is your database in Puter.js"). No "Use this when" bullet list. - **Structure.** Get to the first working call as early as possible, then add validation, rate limits, and sign-in after it. Explain a Puter concept the first time it appears, such as what `me.puter` is or that `puter.workers.exec()` opens the Puter sign-in window. Split recipes by what the reader needs, not by technique, and give a family of recipes a shared tag. +- **Reading order.** A recipe reads top to bottom. Each code block uses only functions and variables from blocks above it, so the reader never has to search further down the page to understand it. Start with a small version that works, and have each section add one case. When a section changes a function from earlier, show the whole new version of that function there. If the code is built up over several sections, end with a `## Full Code` block that has all of it. - **Link to the reference for full option lists.** Mention only the options the recipe uses, then link to the function page for the rest ("All the sort options are listed on [`puter.fs.readdir()`](/FS/readdir/)."). A copied list of options, rules, or scopes goes stale when the reference changes. - **Limits.** Mention a limit only when it's the reason for a pattern the recipe uses, such as one wildcard subscription instead of one per key, and link to [rate-limits-and-quotas.md](src/docs/src/rate-limits-and-quotas.md) or the function page for the number. Leave out limits that code following the recipe never reaches. - **Code.** Platform-neutral: just the code, with top-level `await`. No `