From 3522e0e194cf2dbc9b214d03176cd1b519166f29 Mon Sep 17 00:00:00 2001 From: adssib <75389300+adssib@users.noreply.github.com> Date: Thu, 19 Nov 2026 15:17:40 -0500 Subject: [PATCH 1/3] rewrite the readme in the shared shape, and add the template The README leads with the trigger and the AI-written fix, then proof, layers and a 15-minute quickstart. docs/README-template.md is the shape patch-it's other public repos copy. make plugins-json keeps the plugins badge count right; go test checks it. Co-Authored-By: Claude Opus 5.5 Signed-off-by: adssib <75389300+adssib@users.noreply.github.com> --- AGENTS.md | 5 +- README.md | 117 ++++++++++++++++++------- cmd/list-plugins/main.go | 18 +++- docs/README-template.md | 88 +++++++++++++++++++ docs/README.md | 1 + internal/pluginlist/pluginlist.go | 15 ++++ internal/pluginlist/pluginlist_test.go | 30 +++++++ 7 files changed, 239 insertions(+), 35 deletions(-) create mode 100644 docs/README-template.md diff --git a/AGENTS.md b/AGENTS.md index e755f9d..d187da8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,12 +6,14 @@ Rules for AI coding agents (and humans) working in this repo. `CLAUDE.md` import **If you add a plugin, add its row to [`docs/plugins.md`](docs/plugins.md) in the same PR. If you change a plugin's id, provider, source, what it watches, format plugin or status, update its row in the same PR. If you remove one, remove its row.** -The list of supported APIs on docs.patch-it.dev is generated from that file, so a plugin missing from it doesn't exist as far as users can tell. Then run `make plugins-json`: it regenerates [`docs/plugins.json`](docs/plugins.json) from the plugin registry and the table, and fails if a registered plugin has no row (or a row has no plugin, a wrong format or no provider page). `go test` fails while `docs/plugins.json` is out of date. The check can't tell whether a row's words are right: you are that check. Say in the PR that you compared them. +The list of supported APIs on docs.patch-it.dev is generated from that file, so a plugin missing from it doesn't exist as far as users can tell. Then run `make plugins-json`: it regenerates [`docs/plugins.json`](docs/plugins.json) from the plugin registry and the table (and the plugin count on the README's badge), and fails if a registered plugin has no row (or a row has no plugin, a wrong format or no provider page). `go test` fails while `docs/plugins.json` is out of date. The check can't tell whether a row's words are right: you are that check. Say in the PR that you compared them. Keep the table between the `` and `` markers a plain Markdown table, one row per plugin, absolute links only (the docs site copies it verbatim). ## Rule 2: this repo is public +Public text (README, docs, descriptions) follows [docs/README-template.md](docs/README-template.md): its order, its words, its layer statuses. + Everything you write here is public forever, including commit messages, branch names, PR titles and descriptions, and test data. Never write: - credentials, tokens, keys, or values from any `.env`; @@ -24,7 +26,6 @@ Refer to the service that runs these plugins as "patch-it's hosted ingestion ser ## Rules for plugin code - **Start a new provider with `go run ./cmd/new-plugin --api --provider --format `**, then fill in every `TODO(new-plugin)`; none may be left when you open the PR. - - **Fetch only through the environment** (`env.Get` or `kit/`). No `net/http` outside the fetch layer, no filesystem outside `testdata/`, no database. - **Golden test + dated source quote**: a saved copy of the real source in `testdata/`, a row in `testdata/README.md` (URL, date fetched, license, quote), and `testdata/golden/.json` with the exact events. - **Precision over recall.** When unsure whether something is a change, don't emit an event. diff --git a/README.md b/README.md index 7346417..50fa915 100644 --- a/README.md +++ b/README.md @@ -1,63 +1,122 @@ +Patchy, the patch-it bot, holding up the lines it found + # patch-it-plugins -The source plugins for [patch-it](https://github.com/patch-it-dev/patch-it), the tool that turns third-party API changes into pull requests in your repo. Each plugin reads one provider's own sources (API specs, changelogs, deprecation pages, SDK migration guides, release feeds) and turns what changed into change events. +**How patch-it notices, on its own, that something your code depends on changed.** Each plugin watches one provider's own source (an API spec, a changelog, a shutdown notice, a release feed) and turns what changed into a change event, with the source linked and quoted. -> **Just moved.** The plugins were moved here from patch-it's hosted ingestion service, which imports this module at a tagged release (`v0.x.y`) and runs them every day. +**Why:** when anything your code depends on changes (APIs, packages, SDKs, runtimes, CI, AI models), [patch-it](https://patch-it.dev) finds the code that breaks and opens the pull request that fixes it. In your CI, on your key. You get the fix, not the alert. These plugins are the trigger: nobody has to assign an alert or open a ticket. -## How a plugin works +[![CI](https://github.com/patch-it-dev/patch-it-plugins/actions/workflows/CI_go.yml/badge.svg)](https://github.com/patch-it-dev/patch-it-plugins/actions/workflows/CI_go.yml) +[![Go Reference](https://pkg.go.dev/badge/github.com/patch-it-dev/patch-it-plugins.svg)](https://pkg.go.dev/github.com/patch-it-dev/patch-it-plugins) +[![Go version](https://img.shields.io/github/go-mod/go-version/patch-it-dev/patch-it-plugins)](go.mod) +[![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-3f5bf0)](LICENSE) +[![Plugins](https://img.shields.io/badge/plugins-20-3f5bf0)](docs/plugins.md) +[![Docs](https://img.shields.io/badge/docs-docs.patch--it.dev-3f5bf0)](https://docs.patch-it.dev) +[![Discussions](https://img.shields.io/github/discussions/patch-it-dev/patch-it-plugins)](https://github.com/patch-it-dev/patch-it-plugins/discussions) + +```mermaid +flowchart LR + A["Provider's own source
spec · changelog · shutdown notice · feed"] -->|"read daily"| B["Plugin
(this repo)"] + B -->|"what changed, quoted"| C["Change event
breaking · deprecation · date · source"] + C --> D["patch-it in your CI
finds the lines, an AI model writes the change"] + D --> E["Pull request in your repo
your tests check it, you merge it"] +``` + +## What patch-it does + +1. **It acts on its own.** A plugin here sees the change where the provider announces it, and patch-it starts from there: no alert to triage, no ticket to assign. That includes changes that never bump a version, like an AI model or an API shut down on a date. +2. **It writes the fix.** An AI model (on your own key) reads the change and the lines it affects and writes the code change. Your repo's own tests check it, and it arrives as a pull request you review and merge like any other: the code change, not just the version. +3. **Proof:** 8 pull requests opened by the early version have been merged by outside maintainers. +4. **What it covers:** + + | Layer | Status | + |---|---| + | APIs (Stripe, OpenAI, Anthropic and [more](docs/plugins.md)) | live | + | AI models (shutdowns and retirements) | live | + | Packages and SDKs (breaking major releases) | in testing | + | Runtimes (end of life) | building | + | CI (retired runners, images, actions) | planned | + +5. **Start:** [docs.patch-it.dev](https://docs.patch-it.dev) sets up the GitHub Action in your repo. To have it watch a provider it doesn't cover yet, add a plugin (below). + +## Add a provider in 15 minutes + +You need Go (the version in `go.mod`), `make` and Python 3. Pick the format that reads your provider's source ([which one](docs/writing-a-plugin.md#3-pick-the-format-plugin)), then: + +**1. Scaffold it.** + +```sh +URL=https://acme.example/changelog.xml # your provider's source +go run ./cmd/new-plugin --api acme --provider Acme --format feed --source "$URL" +``` +``` +Scaffolded acme (Acme, format feed): + docs/plugins.md + plugins/feed/acme.go (new) + plugins/feed/acme_test.go (new) + ... +Next steps (every place to fill in says TODO(new-plugin): ...) +``` + +**2. Save a real copy of the source and write the golden file.** Fill in the `TODO(new-plugin)`s: the reader in `plugins/feed/acme.go`, the saved file's row in `testdata/README.md`, and "Why this source" in `providers/acme.md`. + +```sh +curl -fsSL -o plugins/feed/testdata/acme.rss.xml "$URL" +go test ./plugins/feed -run TestAcme -update # writes testdata/golden/acme.json: read it like code +``` + +**3. Check it, the way CI will.** +```sh +make plugins-json && make check +``` ``` -provider source ──fetch──▶ plugin ──▶ change events ──▶ patch-it's change feed ──▶ your CI - (spec, page, feed) reads, diffs, (validated, each (GET /v1/changes) (patch-it opens - normalizes with a source link the PR) - and a quote) +... +make check: all passed ``` +**4. Open the pull request** (`git commit -s`, one plugin per PR). Details: [docs/writing-a-plugin.md](docs/writing-a-plugin.md). Stuck? Ask in [Discussions](https://github.com/patch-it-dev/patch-it-plugins/discussions). Looking for a first change? [Good first issues](https://github.com/patch-it-dev/patch-it-plugins/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22). + +## How a plugin works + 1. **Fetch.** The plugin asks its environment for the source (`env.Get`); it never opens connections itself. Pages that change in place are also cited through a Web Archive snapshot, so the link in an event keeps showing what the plugin read. 2. **Compare.** It compares the source to the last version it saw (the baseline): two OpenAPI specs, two versions of a deprecations page, a new release's changelog section. -3. **Emit events.** Each change becomes one event in [patch-it's change-event format](https://github.com/patch-it-dev/patch-it/tree/main/docs/contract): what changed, how bad it is (breaking, deprecation, behavior change, non-breaking), the date it takes effect, and the source URL with a quote. **No source, no event.** +3. **Emit events.** Each change becomes one event in [patch-it's change-event format](https://github.com/patch-it-dev/patch-it/tree/main/docs/contract): what changed, how bad it is (breaking, deprecation, behavior change, non-breaking), the date it takes effect, and the source URL with a quote. **No source, no event.** When unsure, a plugin emits nothing: a wrong event would become a wrong pull request. + +Most providers are an entry for a shared format plugin (`openapi`, `retirements`, `migrationguide`, `removedmembers`, `changelog`, `feed`, `apichangelog`, `catalog`), not new code. patch-it's hosted ingestion service runs every plugin daily and serves the events to the patch-it GitHub Action and CLI. -Plugins are small: most providers are an entry for a shared format plugin (`openapi`, `retirements`, `migrationguide`, `removedmembers`, `changelog`, `feed`), not new code. patch-it's hosted service runs every plugin daily and serves the events to the patch-it GitHub Action and CLI. +## Supported plugins + +**[docs/plugins.md](docs/plugins.md)** lists every plugin: provider, layer, what it watches, its source. The same list is on [docs.patch-it.dev](https://docs.patch-it.dev/supported-apis/plugins/), and as JSON in [docs/plugins.json](docs/plugins.json) (`make plugins-json`). ## Layout | Path | What's there | |---|---| | [`plugin/`](plugin/) | The `Plugin` interface, the registry (`Register`, `Lookup`, `Names`), `Env`, `Result` | -| [`plugins/`](plugins/) | The format plugins: `openapi`, `retirements`, `migrationguide`, `removedmembers`, `changelog`, `feed`. `plugins/all` imports every one | +| [`plugins/`](plugins/) | The format plugins; `plugins/all` imports every one | +| [`cmd/new-plugin/`](cmd/new-plugin/), [`cmd/list-plugins/`](cmd/list-plugins/) | The starter for a new provider; the generator of `docs/plugins.json` | | [`kit/`](kit/), [`kit/kittest/`](kit/kittest/) | What plugins share (the unchanged-page check, Wayback citing) and the test kit (in-memory store, saved pages, golden files) | | [`event/`](event/), [`migrate/`](migrate/) | The change-event types of [patch-it's contract](https://github.com/patch-it-dev/patch-it/tree/main/docs/contract), and the v1 → v2 conversion | | [`diff/`](diff/), [`normalize/`](normalize/), [`hint/`](hint/), [`adapter/`](adapter/) | The OpenAPI diff engine: compare two specs, turn the changes into events, attach changelog hints; one adapter per spec provider | | [`retire/`](retire/), [`sdkguide/`](sdkguide/), [`fetch/`](fetch/) | The deprecations-page and migration-guide readers; the HTTP fetch and cache | | [`contract/fixtures/`](contract/) | A copy of patch-it's change-event fixtures | | [`providers/`](providers/) | One page per provider: why that source, what the plugin reads | -| [`docs/`](docs/) | [The plugin list](docs/plugins.md) and [how to write a plugin](docs/writing-a-plugin.md) | - -## Supported plugins - -See **[docs/plugins.md](docs/plugins.md)**. The same list is on [docs.patch-it.dev](https://docs.patch-it.dev/supported-apis/plugins/). +| [`docs/`](docs/) | [The plugin list](docs/plugins.md), [how to write a plugin](docs/writing-a-plugin.md), the [README template](docs/README-template.md) patch-it's public repos share | -## Run the tests - -Go (the version in `go.mod`), `make` and Python 3, no other setup: +## Run the checks ```sh make check # what CI runs: tidy, build, gofmt, vet, import and net/http guards, go test -race, leak guard ``` -The tests are offline: every plugin's test reads a saved copy of its source from `testdata/` and compares the events with a golden file. One package: `go test ./plugins/feed`. After an intended change to a plugin's output, `go test ./plugins/ -update` rewrites its golden files; review that diff like code. - -### Environment +The tests are offline: every plugin's test reads a saved copy of its source from `testdata/` and compares the events with a golden file. After an intended change to a plugin's output, `go test ./plugins/ -update` rewrites its golden files; review that diff like code. -| Variable | Needed | What it does | -|---|---|---| -| `GITHUB_TOKEN` | No | Optional. A GitHub token (no scopes needed) sent to the GitHub API when the `openapi` adapters look up release tags (Stripe's and Datadog's releases, GitHub's API versions). It only raises GitHub's rate limit for unauthenticated calls (60 an hour per IP); the tests never use it. | - -Nothing else is read from the environment. +`GITHUB_TOKEN` (optional, no scopes) only raises GitHub's rate limit when the `openapi` adapters look up release tags; the tests never use it. Nothing else is read from the environment. ## Releases -Every release is a `v0.x.y` tag on `main` with a [GitHub release](https://github.com/patch-it-dev/patch-it-plugins/releases) and generated notes. Maintainers make them with the manual **Release** workflow ([how](CONTRIBUTING.md#releasing)); tags are never moved or deleted, so a bad release is fixed with a new patch version. +Releases are `v0.x.y` tags on `main` with a [GitHub release](https://github.com/patch-it-dev/patch-it-plugins/releases) and generated notes. The **Release** workflow tags a patch release on its own every Monday and Thursday at 14:00 UTC when something new was merged, and maintainers can run it by hand ([how](CONTRIBUTING.md#releasing)). patch-it's hosted ingestion service runs the latest release, so a merged plugin is running within a few days. Tags are never moved or deleted. ```sh go get github.com/patch-it-dev/patch-it-plugins@latest @@ -65,9 +124,7 @@ go get github.com/patch-it-dev/patch-it-plugins@latest ## Contributing -New providers and fixes are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) first (DCO sign-off, golden tests, adding your plugin to `docs/plugins.md`). AI coding agents: [AGENTS.md](AGENTS.md). - -User docs for patch-it itself: [docs.patch-it.dev](https://docs.patch-it.dev). +New providers and fixes are welcome: [CONTRIBUTING.md](CONTRIBUTING.md) has the rules (DCO sign-off, golden tests, the plugin list), [docs/writing-a-plugin.md](docs/writing-a-plugin.md) the how-to. AI coding agents: [AGENTS.md](AGENTS.md). Questions and ideas: [Discussions](https://github.com/patch-it-dev/patch-it-plugins/discussions). ## License diff --git a/cmd/list-plugins/main.go b/cmd/list-plugins/main.go index 9932074..55504d7 100644 --- a/cmd/list-plugins/main.go +++ b/cmd/list-plugins/main.go @@ -1,6 +1,7 @@ // Command list-plugins writes docs/plugins.json: every registered plugin // joined with its row in docs/plugins.md (id, provider, what it watches, -// format plugin, source URL, status, provider page). It fails when the +// format plugin, source URL, status, provider page), and sets the plugin +// count on the README's badge. It fails when the // registry and the table disagree. Run it from the repo root: // // go run ./cmd/list-plugins # rewrite docs/plugins.json (make plugins-json) @@ -43,13 +44,24 @@ func run(root, out string, check bool) error { _, err := os.Stdout.Write(b) return err } + readmePath := filepath.Join(root, pluginlist.Readme) + readme, err := os.ReadFile(readmePath) + if err != nil { + return err + } + badged, _ := pluginlist.Badge(readme, len(plugins)) path := filepath.Join(root, out) if check { have, err := os.ReadFile(path) - if err != nil || !bytes.Equal(have, b) { - return fmt.Errorf("%s is out of date: run `make plugins-json` and commit it", out) + if err != nil || !bytes.Equal(have, b) || !bytes.Equal(readme, badged) { + return fmt.Errorf("%s or the README's plugins badge is out of date: run `make plugins-json` and commit them", out) } return nil } + if !bytes.Equal(readme, badged) { + if err := os.WriteFile(readmePath, badged, 0o644); err != nil { + return err + } + } return os.WriteFile(path, b, 0o644) } diff --git a/docs/README-template.md b/docs/README-template.md new file mode 100644 index 0000000..19b261c --- /dev/null +++ b/docs/README-template.md @@ -0,0 +1,88 @@ +# README template for patch-it's public repos + +Every public patch-it repo's README has the same shape, so a developer landing on any of them knows in ten seconds what it is and how to try it. This repo's [README](../README.md) is the worked example. Copy the skeleton at the bottom, then fill each section using the notes. + +## The sections, in order + +| # | Section | What goes in it | +|---|---|---| +| 1 | **What** (one line, bold, under the title) | What *this repo* is, in one sentence, in the product's words. For a part of patch-it, say which part of the story it is ("how patch-it notices, on its own, that something changed"). | +| 2 | **Why** (one short paragraph) | The one-liner for patch-it: when anything your code depends on changes (APIs, packages, SDKs, runtimes, CI, AI models), patch-it finds the code that breaks and opens the pull request that fixes it. In your CI, on your key. "You get the fix, not the alert." Then one sentence on why this repo matters to that. | +| 3 | **Badges** (one line of them) | The badge set below, in that order. | +| 4 | **Visual** | One picture of the flow: a mermaid diagram (GitHub renders it) until there's a GIF or screenshot. Left to right, ending in "pull request in your repo". | +| 5 | **The story** ("What patch-it does") | In this order, one or two lines each: (1) **it acts on its own** (it watches the change itself; no one assigns an alert; also changes with no version bump, like a model or API shut down on a date); (2) **it writes the fix** (an AI model on your key writes the code change, your tests check it, you review and merge it); (3) **proof** ("8 pull requests merged by outside maintainers", no other counts); (4) **layers covered**, as a table marked `live`, `in testing`, `building` or `planned`, never ahead of the truth; (5) **how to start** (a link to docs.patch-it.dev). | +| 6 | **Quickstart** (three or four steps, one screen) | The shortest path from a clean clone to the repo's main job, each step a command that runs as written, with the output to expect. Details live in linked docs. | +| 7 | **How it works, and links** | A short "how it works", the layout if the repo has code, how to run its checks, releases, contributing (with Discussions and good first issues), license, and docs.patch-it.dev. | + +## The badge set + +In this order; drop one only if it can't be honest for the repo (no release yet: no release badge): + +1. **CI**: the main workflow's badge, `https://github.com/patch-it-dev//actions/workflows/.yml/badge.svg`. +2. **Package reference**, if it's a library: Go Reference (`https://pkg.go.dev/badge/.svg`), PyPI or npm version. +3. **Language version**: e.g. `https://img.shields.io/github/go-mod/go-version/patch-it-dev/`. +4. **Latest release**, once there is one: `https://img.shields.io/github/v/release/patch-it-dev/`. +5. **License**: `https://img.shields.io/badge/license--3f5bf0`. +6. **A count the repo is about**, only if a test keeps it right (patch-it-plugins: the plugins badge, set by `make plugins-json` and checked by `go test`). +7. **Docs**: `https://img.shields.io/badge/docs-docs.patch--it.dev-3f5bf0`. +8. **Discussions**: `https://img.shields.io/github/discussions/patch-it-dev/`. + +Static badges use the brand accent, `3f5bf0` (`accent`, light theme, in the brand tokens). + +## Words + +- Say "patch-it" (lowercase), and refer to Patchy as "Patchy" or "patch-it", never "he". +- Always list the layers; never describe patch-it as API-only. +- Use: "on its own", "writes the fix", "the code change, not just the version", "you review and merge". +- Don't name version-bump bots in headlines, the first lines or repo descriptions, and don't write "better than", "killer" or "magic". A factual comparison belongs on the docs' comparison page only. +- A public README never mentions private repos, internal services or pricing that isn't public. The service that runs plugins is "patch-it's hosted ingestion service". + +## Images + +Use only images that are already public, linked by URL, never copied in: Patchy and the wordmark from the organization profile, `https://raw.githubusercontent.com/patch-it-dev/.github/main/profile/assets/.svg` (`bot-asleep`, `bot-found-one`, `bot-merged`, `bot-excited`, `patchy-night-shift`, `wordmark-plain-on-light`, `wordmark-plain-on-dark`). Give every image alt text that says what it shows. No gradients, glows or starry skies. + +## Skeleton + +````markdown +Patchy, the patch-it bot + +# + +**** + +**Why:** when anything your code depends on changes (APIs, packages, SDKs, runtimes, CI, AI models), [patch-it](https://patch-it.dev) finds the code that breaks and opens the pull request that fixes it. In your CI, on your key. You get the fix, not the alert. + + + +```mermaid +flowchart LR + A["A dependency changes"] --> B[""] --> C["Pull request in your repo"] +``` + +## What patch-it does + +1. **It acts on its own.** ... +2. **It writes the fix.** ... +3. **Proof:** 8 pull requests opened by the early version have been merged by outside maintainers. +4. **What it covers:** + + | Layer | Status | + |---|---| + | APIs | live | + | AI models | live | + | Packages and SDKs | in testing | + | Runtimes | building | + | CI | planned | + +5. **Start:** [docs.patch-it.dev](https://docs.patch-it.dev). + +## + +## How it works + +## Contributing + +## License +```` + +Keep the layer statuses the same in every repo, and change them everywhere at once when one moves. diff --git a/docs/README.md b/docs/README.md index 126dc8f..fbfc72d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,6 +4,7 @@ |---|---| | [plugins.md](plugins.md) | Every supported plugin: id, provider, what it watches, source. Also published on [docs.patch-it.dev](https://docs.patch-it.dev/supported-apis/plugins/). | | [plugins.json](plugins.json) | The same list as JSON, generated by `make plugins-json` from the plugin registry and plugins.md. Don't edit by hand. | +| [README-template.md](README-template.md) | The shape every public patch-it repo's README follows: sections, badge set, words, images. | | [writing-a-plugin.md](writing-a-plugin.md) | How to add a provider: the `Plugin` interface, fetching through `env.Get` and `kit/`, saving the source, the golden test with `kittest`, the provider page and the plugin list. | | [../providers/](../providers/) | One page per provider: why that source, what the plugin reads and ignores. | diff --git a/internal/pluginlist/pluginlist.go b/internal/pluginlist/pluginlist.go index 92418b6..7ad543f 100644 --- a/internal/pluginlist/pluginlist.go +++ b/internal/pluginlist/pluginlist.go @@ -16,6 +16,7 @@ import ( "reflect" "regexp" "slices" + "strconv" "strings" "github.com/patch-it-dev/patch-it-plugins/plugin" @@ -208,6 +209,20 @@ func List(root string) ([]Plugin, error) { return out, nil } +// Readme is the README, relative to the repo root: its plugins badge is a +// static count that `make plugins-json` keeps right. +const Readme = "README.md" + +var badge = regexp.MustCompile(`(img\.shields\.io/badge/plugins-)(\d+)(-)`) + +// Badge is readme with its plugins badge set to n. ok is false when it has none. +func Badge(readme []byte, n int) (out []byte, ok bool) { + if !badge.Match(readme) { + return readme, false + } + return badge.ReplaceAll(readme, []byte("${1}"+strconv.Itoa(n)+"${3}")), true +} + // Marshal is docs/plugins.json for plugins, ending in a newline. func Marshal(plugins []Plugin) ([]byte, error) { var buf bytes.Buffer diff --git a/internal/pluginlist/pluginlist_test.go b/internal/pluginlist/pluginlist_test.go index 3c96ac0..895d93f 100644 --- a/internal/pluginlist/pluginlist_test.go +++ b/internal/pluginlist/pluginlist_test.go @@ -77,3 +77,33 @@ func TestListWantsARowPerPlugin(t *testing.T) { t.Errorf("err = %v, want stripe's missing row", err) } } + +// The README's plugins badge is a static number: it must be the count in +// docs/plugins.json (make plugins-json sets it), or the badge lies. +func TestReadmeBadgeCountsThePlugins(t *testing.T) { + plugins, err := List(root) + if err != nil { + t.Fatal(err) + } + readme, err := os.ReadFile(filepath.Join(root, Readme)) + if err != nil { + t.Fatal(err) + } + want, ok := Badge(readme, len(plugins)) + if !ok { + t.Fatal("README.md has no plugins badge (img.shields.io/badge/plugins--...)") + } + if !bytes.Equal(readme, want) { + t.Errorf("README.md's plugins badge doesn't say %d: run `make plugins-json`", len(plugins)) + } +} + +func TestBadge(t *testing.T) { + got, ok := Badge([]byte("[![Plugins](https://img.shields.io/badge/plugins-20-3f5bf0)](docs/plugins.md)"), 21) + if !ok || string(got) != "[![Plugins](https://img.shields.io/badge/plugins-21-3f5bf0)](docs/plugins.md)" { + t.Errorf("Badge = %s, %v", got, ok) + } + if _, ok := Badge([]byte("no badge"), 1); ok { + t.Error("found a badge in none") + } +} From b3f32b15cc605ed6bb83cf0e47c17f71d4a555b4 Mon Sep 17 00:00:00 2001 From: adssib <75389300+adssib@users.noreply.github.com> Date: Thu, 19 Nov 2026 15:18:58 -0500 Subject: [PATCH 2/3] add the going-public checklist to the readme template Co-Authored-By: Claude Opus 5.5 Signed-off-by: adssib <75389300+adssib@users.noreply.github.com> --- docs/README-template.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/README-template.md b/docs/README-template.md index 19b261c..81d0551 100644 --- a/docs/README-template.md +++ b/docs/README-template.md @@ -86,3 +86,14 @@ flowchart LR ```` Keep the layer statuses the same in every repo, and change them everywhere at once when one moves. + +## When a repo goes public + +The README is half of it. The same day, in the repo's settings: + +1. **Description**: one line in the same words (what the repo is, the layers, "You get the fix, not the alert"), under 350 characters, no version-bot names, never API-only. +2. **Website**: `https://docs.patch-it.dev` (or the page in the docs about this repo). +3. **Topics**: from `dependencies`, `breaking-changes`, `api-changes`, `api`, `sdk`, `ai-models`, `ci`, `pull-requests`, `automation`, plus the repo's language and what it is (`go`, `plugins`, `documentation`, …). +4. **Discussions** on, if people will ask questions there; keep the categories Q&A, Ideas, Show and tell and Announcements. +5. **Social preview** (Settings → General → Social preview; GitHub has no API for it): a 1280×640 PNG, dark background from the brand tokens, the plain wordmark, Patchy on a cream tile, IBM Plex, the repo's one line. No gradients or glows. +6. Check a shared link to the repo shows its own card. From 7ab4a68fde610dd9fd2236ae2295383a8a1c9c90 Mon Sep 17 00:00:00 2001 From: adssib <75389300+adssib@users.noreply.github.com> Date: Thu, 19 Nov 2026 15:22:18 -0500 Subject: [PATCH 3/3] keep the todos guard in agents.md and the readme Co-Authored-By: Claude Opus 5.5 Signed-off-by: adssib <75389300+adssib@users.noreply.github.com> --- AGENTS.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 597c63a..fd85b25 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,7 +25,7 @@ Refer to the service that runs these plugins as "patch-it's hosted ingestion ser ## Rules for plugin code -- **Start a new provider with `go run ./cmd/new-plugin --api --provider --format `**, then fill in every `TODO(new-plugin)`; none may be left when you open the PR. +- **Start a new provider with `go run ./cmd/new-plugin --api --provider --format `**, then fill in every `TODO(new-plugin)`; `make todos` (part of `make check` and CI_go) fails while one is left. - **Fetch only through the environment** (`env.Get` or `kit/`). No `net/http` outside the fetch layer, no filesystem outside `testdata/`, no database. - **Golden test + dated source quote**: a saved copy of the real source in `testdata/`, a row in `testdata/README.md` (URL, date fetched, license, quote), and `testdata/golden/.json` with the exact events. - **Precision over recall.** When unsure whether something is a change, don't emit an event. diff --git a/README.md b/README.md index 50fa915..0fa19d7 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,7 @@ Most providers are an entry for a shared format plugin (`openapi`, `retirements` ## Run the checks ```sh -make check # what CI runs: tidy, build, gofmt, vet, import and net/http guards, go test -race, leak guard +make check # what CI runs: tidy, build, gofmt, vet, import and net/http guards, go test -race, no TODO(new-plugin) left, leak guard ``` The tests are offline: every plugin's test reads a saved copy of its source from `testdata/` and compares the events with a golden file. After an intended change to a plugin's output, `go test ./plugins/ -update` rewrites its golden files; review that diff like code.