# Moochy docs (all pages) > Moochy lets developers donate LLM tokens from their own API accounts to open-source projects, whole GitHub organisations and GitLab groups, or the maintainers themselves, with a monthly limit they choose; maintainers use those tokens from any MCP client or any tool with a provider-compatible base URL. Keys never leave the donor's machine and every request is end-to-end encrypted. Open-source client (Apache-2.0) · 100% free. # Add a "Donate tokens" button A **Donate tokens** button in a README takes visitors to the project's donation page on moochy.dev. This page is an exact recipe: a person or an AI coding agent working inside a repository can follow it step by step without guessing. Raw Markdown of this page: `https://moochy.dev/docs/donate-button.md`. The button is a plain image link. Adding it needs no account, no key, and no token. --- ## Recipe ### 1. Find the project's provider and path Run, in the repository: ```sh url=$(git remote get-url origin) host=$(printf '%s\n' "$url" | sed -E 's#^[a-z+]+://##; s#^[^@/]*@##; s#[:/].*$##') path=$(printf '%s\n' "$url" | sed -E 's#^[a-z+]+://##; s#^[^@/]*@##; s#^[^:/]+(:[0-9]+)?[:/]##; s#/+$##; s#\.git$##') case "$host" in github.com) provider=github ;; gitlab.com) provider=gitlab ;; *) provider= ;; esac echo "$provider $path" ``` | `git remote get-url origin` | provider | path | |---|---|---| | `https://github.com/tinyhttp/arrow.git` | `github` | `tinyhttp/arrow` | | `https://github.com/tinyhttp/arrow` | `github` | `tinyhttp/arrow` | | `git@github.com:tinyhttp/arrow.git` | `github` | `tinyhttp/arrow` | | `ssh://git@github.com/tinyhttp/arrow.git` | `github` | `tinyhttp/arrow` | | `https://gitlab.com/group/project.git` | `gitlab` | `group/project` | | `git@gitlab.com:group/project.git` | `gitlab` | `group/project` | | `https://gitlab.com/group/subgroup/project.git` | `gitlab` | `group/subgroup/project` | Stop and tell the maintainer instead of guessing when: - `provider` is empty: only public repositories on github.com and gitlab.com can receive donations; - `provider` is `github` and `path` does not have exactly one `/` (GitHub paths are always `owner/name`); - there is no `origin` remote: ask which remote is the public one, and use `git remote get-url `. GitLab paths keep every group and subgroup (`group/subgroup/project`, up to 20 levels). Each segment is 1 to 100 characters from `A–Z a–z 0–9 . _ -` and starts with a letter or digit. Keep the case as it appears in the URL. Never print or store the remote URL itself: it can contain a token (`https://user:token@github.com/…`). ### 2. Check that the project is on Moochy, and get its addresses ```sh curl -fsS "https://moochy.dev/api/v1/projects/$provider/$path" ``` The answer is public and contains no donor or amount. For `github` and `tinyhttp/arrow`: ```json {"claimed": true, "donate_url": "https://moochy.dev/p/github/tinyhttp/arrow/donate", "button_url": "https://moochy.dev/p/github/tinyhttp/arrow/button.svg", "docs": "/docs/donate-button.md"} ``` - `"claimed": true`: go to step 3, and use `button_url` and `donate_url` exactly as returned. - `"claimed": false`: do not add the button yet (it would show "project not found"). Tell the maintainer what is in [Not on Moochy yet](#not-on-moochy-yet). - `404` with an `error` message: the provider or path is not valid; recheck step 1. With the Moochy app installed, `moochy button` does steps 1 to 3 at once: it reads the git remote (offline) and prints the snippet. Options: `--repo `, `--provider github|gitlab`, `--style mascot|text|compact`, `--theme light|dark|auto`, `--size s|m|l`, `--label TEXT`, `--format markdown|html|rst`. **Project addresses.** A project's pages live at `https://moochy.dev/p//`: `/p/github/tinyhttp/arrow`, `/p/gitlab/group/subgroup/project`. Add `/button.svg` for the image and `/donate` for the donation page; on GitLab these come after GitLab's `/-/` separator (`/p/gitlab/group/subgroup/project/-/button.svg`, `/-/donate`), so nested group names stay unambiguous. For GitHub, the short form without the provider (`/p/tinyhttp/arrow/button.svg`) also works and always will, so existing buttons keep working; `moochy button` prints it for GitHub projects. ### 3. Pick the snippet Replace `BUTTON_URL` and `DONATE_URL` with the values from step 2. The default button (mascot and text, light, medium) needs no options. **Markdown** (`README.md`; works on GitHub, GitLab, and most package registries): ```markdown [![Donate tokens](BUTTON_URL)](DONATE_URL) ``` **HTML, following the reader's light or dark theme** (GitHub and GitLab README files; recommended on GitHub): ```html Donate tokens ``` **HTML, one theme** (when the README already uses HTML badges): ```html Donate tokens ``` **reStructuredText** (`README.rst`): ```rst .. image:: BUTTON_URL :target: DONATE_URL :alt: Donate tokens ``` For example, a GitLab project in a subgroup: ```markdown [![Donate tokens](https://moochy.dev/p/gitlab/group/subgroup/project/-/button.svg)](https://moochy.dev/p/gitlab/group/subgroup/project/-/donate) ``` Keep the alt text "Donate tokens" (or the label you chose): screen readers announce it, and it shows when the image cannot load. Set `height` to match the size: 28 for `s`, 36 for `m`, 44 for `l`. ### 4. Put it in the README 1. Use the README at the repository root: `README.md`, `README.rst`, or `README` (in that order). If there is none, ask the maintainer before creating one. 2. **Avoid duplicates.** Search the README for `moochy.dev/p/` and `moochy.dev/org/`. If a Moochy button or badge is already there, do not add another; replace it only if the maintainer asked for a different style. 3. **Where.** If the README has a row of badges near the top (images linking to CI, coverage, package versions), add the button at the end of that row, on the same line or the same block, matching how the others are written (Markdown next to Markdown, HTML next to HTML). If there are no badges, add it on its own line right after the title (the first `#` heading or the `====` title), with one blank line before and after. 4. **Keep everything else as it is.** Do not reorder, reformat, or remove existing badges, and do not touch other files. 5. Commit only the README change, for example: `docs: add a "Donate tokens" button (Moochy)`. ### 5. Check Open the image address in a browser or run `curl -s -o /dev/null -w '%{http_code}\n' ""`: `200` means the image renders. `400` means an option is wrong (the image then reads "invalid button options"). A project that is not registered gets a "project not found" badge, also with `200` so README image proxies such as GitHub's still show it: check registration with the projects API (step 1). --- ## `button.svg` reference `https://moochy.dev/p///button.svg` is the image and `…/donate` is where it links (for GitHub also the short form `/p///…`). Query parameters are optional; these are all the accepted ones: | Parameter | Values | Default | Meaning | |---|---|---|---| | `label` | 1 to 32 characters: letters, digits, spaces, and `. , : ; ! ? ' ’ & + - ( ) / # @` | `Donate tokens` | The text on the button. URL-encode it (`label=Fuel+this+project`) | | `style` | `mascot`, `text`, `compact` | `mascot` | Mascot and text; text only; or two flat segments (the mascot on dark, the label on light blue) that look the same in every theme | | `theme` | `light`, `dark`, `auto` | `light` | `auto` follows the viewer's system setting inside the image; on GitHub, use the `` snippet instead, which follows the reader's GitHub theme | | `size` | `s`, `m`, `l` | `m` | Height 28, 36, or 44 pixels | Rules, enforced by the server: - Any other parameter, a parameter given twice, a value not listed above, or a query longer than 256 bytes makes the server answer `400` with an image that reads "invalid button options". Tracking parameters such as `utm_source` therefore break the button. - Parameter order does not matter. The studio leaves out defaults and writes the rest in alphabetical order. - The image is cached for a day by the server and by GitHub's image proxy. A changed option shows within that time; a new address (different options) shows at once. ## Organisations A GitHub organisation or a GitLab group claimed on Moochy has its own button: a donation to the organisation serves every project its owner chose ([Donate to an organisation](donate-to-an-organisation.md)). Use it in the organisation's profile README, or in a project README when the maintainer asks for the organisation's button instead of the project's. | Profile README | File | |---|---| | GitHub organisation | `profile/README.md` in the organisation's public `.github` repository | | GitLab group | `README.md` in the group's `gitlab-profile` project | Personal accounts are not organisations: a personal profile README uses the button of one of the person's projects. **Check and get the addresses** (`ORG` is `acme` on GitHub; `group` or `group/subgroup` on GitLab): ```sh curl -fsS "https://moochy.dev/api/v1/orgs/github/ORG" ``` ```json {"org_id": "o_01J…", "path": "github/acme", "claimed": true, "repos": [{"repo_id": "r_01J…", "slug": "github/acme/api"}], "donate_url": "https://moochy.dev/org/github/acme/donate", "button_url": "https://moochy.dev/org/github/acme/button.svg"} ``` Use `button_url` and `donate_url` exactly as returned. A `404` (`{"error":"not_found"}`) means the organisation is not on Moochy: do not add the button, and tell the maintainer what is in [Not on Moochy yet](#not-on-moochy-yet). An empty `repos` list is fine: donations start serving once the owner adds a project. | Organisation | Image | Link | |---|---|---| | GitHub | `https://moochy.dev/org/github/ORG/button.svg` | `https://moochy.dev/org/github/ORG/donate` | | GitLab, group or subgroup | `https://moochy.dev/org/gitlab/GROUP/SUBGROUP/-/button.svg` | `https://moochy.dev/org/gitlab/GROUP/SUBGROUP/-/donate` | As for projects, GitLab actions come after `/-/`. The organisation path always starts with `github/` or `gitlab/`; there is no short form. The snippets of [step 3](#3-pick-the-snippet), the [query parameters](#buttonsvg-reference), the placement rules of [step 4](#4-put-it-in-the-readme) and the check of [step 5](#5-check) are the same. For example: ```markdown [![Donate tokens](https://moochy.dev/org/github/acme/button.svg)](https://moochy.dev/org/github/acme/donate) ``` `moochy button` prints project buttons only (`moochy button --chart --org` prints the organisation's chart); the organisation owner finds this snippet, with a copy button, in **Organisation settings → Donate button**. ## People A maintainer who claimed their own GitHub or GitLab profile can be sponsored: a sponsorship pays for that person's own requests on the public repos they maintain ([Sponsor a person](sponsor-a-person.md)). Their button goes in their personal profile README (GitHub: `README.md` of the repository named like the user, `LOGIN/LOGIN`; GitLab: the `README.md` of the project named like the user, `USERNAME/USERNAME`). | Person | Page | Image | |---|---|---| | GitHub user | `https://moochy.dev/people/github/LOGIN` | `https://moochy.dev/people/github/LOGIN/button.svg` | | GitLab user | `https://moochy.dev/people/gitlab/USERNAME` | `https://moochy.dev/people/gitlab/USERNAME/-/button.svg` | Check first and get the addresses with `curl -fsS "https://moochy.dev/api/v1/people/github/LOGIN"` (or `…/people/gitlab/USERNAME`): the same shape as the organisations API, and `404` means the person has not claimed their profile, so do not add the button. Use `button_url` and `donate_url` exactly as returned. Snippets, options and placement are those of steps 3 to 5. ## Showcase charts Next to the button, a project, an organisation or a person can show a live **chart** of the tokens donated to it and used by it. It is an image, so it works in GitHub and GitLab READMEs like the button, and updates by itself (every five minutes at most). It shows totals per day only: never a donor, never an amount per donor. ### Addresses | For | Image (README) | Card (website ` ``` Card sizes: `s` 320×160, `m` 480×240, `l` 640×320; sparklines 320×40, 480×60, 640×80. Put the chart in the README right below the button row or in a "Support" section, never instead of the button; the placement rules of [step 4](#4-put-it-in-the-readme) apply. Keep the alt text (it is what screen readers announce); the image also carries its own text summary. ### The showcase studio `https://moochy.dev/button` is the showcase studio: tab **Button** and tab **Chart**. Pick a project or organisation you can see, set every option above with a live preview in light and dark side by side, and copy the Markdown, HTML, reStructuredText or iframe snippet. The URLs are the canonical ones above (`/-/` on GitLab), exactly what `moochy button --chart` prints. ## Not on Moochy yet If the project is not registered, give the maintainer this message (replace `PATH` with the path from step 1): > Moochy lets people donate LLM tokens to this project from their own API accounts. To accept donations: sign in at https://moochy.dev/claim with the GitHub or GitLab account that administers `PATH`, register the repository, then confirm on your own machine with the Moochy app: `moochy owner init` (once) and `moochy claim PATH`. After that, the "Donate tokens" button can go in the README. Guide: https://moochy.dev/docs/maintainer For an organisation (`ORG` as `github/acme` or `gitlab/group/subgroup`): > To accept token donations for the whole organisation: sign in at https://moochy.dev/claim with an account that owns `ORG` (GitHub: an organisation admin; GitLab: a group Owner), choose Organisation, then confirm on your own machine with the Moochy app: `moochy claim --org ORG`, and add the projects it funds with `moochy org add PROJECT --org ORG`. Guide: https://moochy.dev/docs/organisations Do not register the project or the organisation yourself, and do not run `moochy` commands that sign anything on the maintainer's behalf: claiming needs the maintainer's own owner key and confirmation. ## What not to do - **No secrets.** The button needs no API key, token, password, or Moochy account. Never put one in a README, a URL, or a commit, and never ask the maintainer for one to add the button. - **No tracking.** Do not add analytics or `utm_*` parameters, redirects, or link shorteners. Moochy does not track readers: it sees requests from GitHub's image proxy, not from visitors. - **No scripts or embeds in a README.** No JavaScript, iframes (the chart card is for websites), or inline SVG copies of the button or chart. - **No donations or settings changes.** Adding a button never creates a donation, signs in, changes CI, or edits Moochy settings. - **No other files.** Only the README changes. ## The studio People can also build the button by hand: on moochy.dev, open the project and choose **Donate button** (or go to `https://moochy.dev/button`, tab **Button**). Pick the label, style, theme, and size, see a live preview, and copy the Markdown or HTML. It produces exactly the snippets above. Tab **Chart** builds the [showcase chart](#showcase-charts). ## For maintainers: tell your agents Add this to your repository's `AGENTS.md`, `CLAUDE.md`, or similar instructions file, so coding agents know about the button and keep it intact: ```markdown ## Moochy donate button This project accepts LLM token donations through Moochy (https://moochy.dev). - The README shows a "Donate tokens" button linking to the project's Moochy page (https://moochy.dev/p/…/donate). Keep it when you edit the README; do not duplicate it, change its address, or add tracking parameters. - To add or change it, follow https://moochy.dev/docs/donate-button.md exactly. - Never put API keys or tokens in the README or in commits. ``` # For AI agents This page is for coding agents (and the people who instruct them). Everything here is public and needs no sign-in. ## Start here - **Index:** `https://moochy.dev/llms.txt` lists every page as raw Markdown, following the llms.txt convention. The donate-button recipe comes first. - **Everything at once:** `https://moochy.dev/llms-full.txt` is all pages in one text file. - **One page:** add `.md` to any docs address for its raw Markdown, for example `https://moochy.dev/docs/donate-button.md`. The same page as HTML is `https://moochy.dev/docs/donate-button`. Prefer the `.md` pages: they are the source of the HTML pages, with the same text. ## Install the Moochy skills Three skills give your agent the exact steps, so it does not have to read the whole docs each time: ```sh npx skills add moochy-dev/moochy-skills ``` | Skill | For | |---|---| | `moochy-donate-button` | Add, fix, or check the "Donate tokens" button in a README | | `moochy-use-donated-tokens` | Use a project's donated tokens: `moochy connect`, `moochy run`, `moochy_delegate` | | `moochy-donate` | Help a donor install the app, keep keys local, set limits, donate, pause, stop | They work with Claude Code, Codex, GitHub Copilot, Gemini CLI, Cursor, Windsurf, Cline, Amp, Antigravity, OpenClaw, Droid, Goose, Kilo Code, Kiro CLI, Hermes Agent, OpenCode, Roo Code, Trae, Zed, and Continue; per-agent notes and the skills themselves are on [Agent skills](https://moochy.dev/docs/skills) (source: [`moochy-dev/moochy-skills`](https://github.com/moochy-dev/moochy-skills)). Each `SKILL.md` is also raw Markdown at `https://moochy.dev/docs/skills/.md`. ## Common tasks | Task | Read | |---|---| | Add a "Donate tokens" button to a repository's README | [`donate-button.md`](donate-button.md) (or the `moochy-donate-button` skill): follow the recipe exactly, top to bottom | | Use donated tokens from a coding tool or agent framework | [`integrations.md`](integrations.md) (MCP server and provider-compatible base URLs, one section per agent) or the `moochy-use-donated-tokens` skill | | Run inside the Moochy sandbox | [`run.md`](run.md) | | Set yourself up inside a cloud box (boat.dev, E2B, Daytona, Modal, Morph, Fly, Codespaces) | [`boxes.md`](boxes.md#1-use-donated-tokens-from-a-cloud-box): install, enroll with the token the maintainer gives you, then `moochy run` | | Explain Moochy to a maintainer or donor | [`maintainer.md`](maintainer.md), [`donor.md`](donor.md), [`faq.md`](faq.md) | ## Rules for agents - **Never handle secrets.** No Moochy task an agent does needs a provider API key, a Moochy token, or a passphrase. Do not ask for them, print them, or write them to files. The project token a maintainer's tools use comes from `moochy env` on their machine and stays there. - **Never sign for a person.** Claiming a project, accepting a donor, and adding a member are signed with the maintainer's owner key after they confirm. Tell the maintainer the command; do not run it for them. - **Do not create donations.** Donating is the donor's decision and spends their money. - **In a cloud box, enroll; never copy keys.** Use the enrollment token the maintainer gives you (`MOOCHY_ENROLL`), enroll when the box starts (never in a template or snapshot), and if Moochy says the box is a copy, delete its Moochy home folder and enroll again. - **Inside `moochy run`**, the standard variables (`ANTHROPIC_BASE_URL`, `ANTHROPIC_API_KEY`, `OPENAI_BASE_URL`, `OPENAI_API_KEY`) already point to Moochy and hold a token for that run only. Use them as they are; there is nothing to configure. - **Tool calls from donated tokens** reach an agent only inside `moochy run`. If you see a `[moochy]` notice instead of a tool call, ask the maintainer to start you with `moochy run -- `. ## Using Moochy as a model or a tool - **MCP:** `moochy mcp --repo owner/name` (stdio) or `http://127.0.0.1:PORT/mcp` with a bearer token. Tools: `moochy_delegate` (hand a self-contained task to donated tokens) and `moochy_pool_status` (what is available). See [integrations](integrations.md#1-the-values-you-need). - **Provider-compatible API:** Anthropic Messages at `http://127.0.0.1:PORT`, OpenAI Chat Completions and OpenAI Responses (for Codex) at `http://127.0.0.1:PORT/v1`, on the maintainer's machine only. `moochy env --repo owner/name` prints the values. - **Protocol** (for implementers): `spec/protocol.md` in the public `moochy-dev/moochy-docs` repository. ## For maintainers: a snippet for your agents Paste this into your repository's `AGENTS.md`, `CLAUDE.md`, or similar file: ```markdown ## Moochy This project uses Moochy (https://moochy.dev) for donated LLM tokens. - Docs for agents: https://moochy.dev/llms.txt (raw Markdown pages end in .md). - The README "Donate tokens" button links to the project's Moochy page (https://moochy.dev/p/…/donate). Keep it; to add or change it, follow https://moochy.dev/docs/donate-button.md exactly. - Never put API keys or tokens in files or commits; never run `moochy claim`, `moochy accept`, `moochy members`, or `moochy donate` for me: tell me the command instead. ``` # Moochy skills for coding agents Three skills teach a coding agent how to work with Moochy. Each is a folder with a `SKILL.md` in the [skills](https://skills.sh) format: a short description of when to use it, then the exact commands and file edits. They contain no tokens and never ask the agent to run a downloaded script or to skip an approval. | Skill | Use it when | |---|---| | [`moochy-donate-button`](#moochy-donate-button) | Adding, fixing, or checking the "Donate tokens" button in a README, including an organisation's or a person's profile README, and the live showcase chart | | [`moochy-use-donated-tokens`](#moochy-use-donated-tokens) | A maintainer wants the agent to use the project's donated tokens: `moochy connect`, `moochy run`, the `moochy_delegate` tool | | [`moochy-donate`](#moochy-donate) | A donor wants to donate tokens to a project, an organisation, or a person: install, keys stay local, limits, `moochy donate`, pause and stop | ## Install ```sh npx skills add moochy-dev/moochy-skills # pick skills and agents interactively npx skills add moochy-dev/moochy-skills --skill moochy-donate-button -a claude-code npx skills add moochy-dev/moochy-skills --skill '*' -g -a codex -a gemini-cli # every skill, user-wide ``` Without `-g`, skills go into the project (commit them so the whole team gets them); with `-g`, into your home folder for every project. | Agent | `-a` value | Project folder | User folder (`-g`) | |---|---|---|---| | Claude Code | `claude-code` | `.claude/skills/` | `~/.claude/skills/` | | Codex | `codex` | `.agents/skills/` | `~/.codex/skills/` | | GitHub Copilot (CLI and VS Code) | `github-copilot` | `.agents/skills/` | `~/.copilot/skills/` | | Gemini CLI | `gemini-cli` | `.agents/skills/` | `~/.gemini/skills/` | | Cursor | `cursor` | `.agents/skills/` | `~/.cursor/skills/` | | Windsurf | `windsurf` | `.windsurf/skills/` | `~/.codeium/windsurf/skills/` | | Cline | `cline` | `.agents/skills/` | `~/.agents/skills/` | | Amp | `amp` | `.agents/skills/` | `~/.config/agents/skills/` | | Antigravity | `antigravity` | `.agents/skills/` | `~/.gemini/antigravity/skills/` | | OpenClaw | `openclaw` | `skills/` | `~/.openclaw/skills/` | | Droid (Factory) | `droid` | `.agents/skills/` | `~/.factory/skills/` | | Goose | `goose` | `.goose/skills/` | `~/.config/goose/skills/` | | Kilo Code | `kilo` | `.agents/skills/` | `~/.kilo/skills/` | | Kiro CLI | `kiro-cli` | `.kiro/skills/` | `~/.kiro/skills/` | | Hermes Agent (Nous Research) | `hermes-agent` | `.hermes/skills/` | `~/.hermes/skills/` | | OpenCode | `opencode` | `.agents/skills/` | `~/.config/opencode/skills/` | | Roo Code | `roo` | `.roo/skills/` | `~/.roo/skills/` | | Trae | `trae` | `.trae/skills/` | `~/.trae/skills/` | | Zed | `zed` | `.agents/skills/` | `~/.agents/skills/` | | Continue | `continue` | `.continue/skills/` | `~/.continue/skills/` | Folders are those of the skills CLI (checked 2026-10-02); `npx skills add` picks the right one for each agent. Agents that do not read skill folders can still read the same instructions as Markdown: https://moochy.dev/docs/skills.md ## For contributors - `name` and `description` in the frontmatter are required; the description says when to use the skill. - Keep each `SKILL.md` under 500 lines and name only `moochy` commands that exist (`moochy --help` must succeed). - Never include a token, a key, or an instruction to pipe a downloaded script into a shell or to disable approvals. - The same files are published on the docs site at https://moochy.dev/docs/skills (the site copies this repository at build time). - Check the format before you push: `python3 scripts/check-skills.py`. ## License Apache-2.0 ([LICENSE](https://github.com/moochy-dev/moochy-skills/blob/main/LICENSE)). Open-source client (Apache-2.0) · 100% free. ## moochy-donate-button **When to use:** Add, fix, or check the Moochy "Donate tokens" button or the live showcase chart (tokens donated and used) in a repository README, in a GitHub organisation's or GitLab group's profile README, or in a maintainer's personal profile README, so people can donate LLM tokens to the project, the organisation, or the person. Use when the user asks for a Moochy button, badge, or chart, to accept token donations through moochy.dev, or to repair an existing Moochy button. Raw `SKILL.md`: `https://moochy.dev/docs/skills/moochy-donate-button.md` The button is a plain image link in the README. It needs no account, no key, and no token, and it changes nothing but the README. Full recipe: https://moochy.dev/docs/donate-button.md ### Rules - Never put an API key, a token, or a password in the README, a URL, or a commit, and never ask the user for one: the button does not need any. - Do not add tracking or `utm_*` parameters, redirects, scripts, or iframes. Unknown parameters break the image. - Do not register (claim) the project or the organisation, or run any `moochy` command that signs something. Those need the maintainer's own owner key; tell them the command instead. - Change only the README. ### Steps #### 1. Find the provider and path If the Moochy app is installed, `moochy button` reads the git remote (offline) and prints the snippet; skip to step 3 with its output, after checking step 2. Otherwise: ```sh url=$(git remote get-url origin) host=$(printf '%s\n' "$url" | sed -E 's#^[a-z+]+://##; s#^[^@/]*@##; s#[:/].*$##') path=$(printf '%s\n' "$url" | sed -E 's#^[a-z+]+://##; s#^[^@/]*@##; s#^[^:/]+(:[0-9]+)?[:/]##; s#/+$##; s#\.git$##') case "$host" in github.com) provider=github ;; gitlab.com) provider=gitlab ;; *) provider= ;; esac echo "$provider $path" ``` - `github` paths are `owner/name`; `gitlab` paths keep every group and subgroup (`group/subgroup/project`). - Stop and ask the user when `provider` is empty (only public github.com and gitlab.com repositories can receive donations), or when there is no `origin` remote. - Never print or store the remote URL itself: it can contain a token. #### 2. Check that the project is on Moochy ```sh curl -fsS "https://moochy.dev/api/v1/projects/$provider/$path" ``` The answer is `{"claimed": …, "donate_url": …, "button_url": …, "docs": …}`, public, with no donor or amount. - `"claimed": true`: use `button_url` and `donate_url` **exactly as returned**. - `"claimed": false`: do not add the button (it would show "project not found"). Tell the user what is in "Not on Moochy yet" below. - `404`: the provider or path is wrong; go back to step 1. Address rules, for checking what you got: | Project | Image | Link | |---|---|---| | GitHub | `https://moochy.dev/p/github/OWNER/NAME/button.svg` | `https://moochy.dev/p/github/OWNER/NAME/donate` | | GitHub, short form (also valid, forever) | `https://moochy.dev/p/OWNER/NAME/button.svg` | `https://moochy.dev/p/OWNER/NAME/donate` | | GitLab, with groups and subgroups | `https://moochy.dev/p/gitlab/GROUP/SUBGROUP/NAME/-/button.svg` | `https://moochy.dev/p/gitlab/GROUP/SUBGROUP/NAME/-/donate` | On GitLab the action always comes after `/-/`, so a nested group path is never mistaken for an action. #### 3. Pick the snippet Default button (mascot and text, light, medium), Markdown: ```markdown [![Donate tokens](BUTTON_URL)](DONATE_URL) ``` Light and dark, following the reader's GitHub theme (HTML in `README.md`): ```html Donate tokens ``` reStructuredText (`README.rst`): ```rst .. image:: BUTTON_URL :target: DONATE_URL :alt: Donate tokens ``` Options, added to `BUTTON_URL` as a query string (any other key, a repeated key, or a value not listed makes the server answer 400): | Key | Values | Default | |---|---|---| | `label` | 1–32 characters: letters, digits, spaces, `. , : ; ! ? ' ’ & + - ( ) / # @` | `Donate tokens` | | `style` | `mascot`, `text`, `compact` | `mascot` | | `theme` | `light`, `dark`, `auto` | `light` | | `size` | `s` (28 px), `m` (36 px), `l` (44 px) | `m` | Match `height` in HTML to the size. Keep `alt="Donate tokens"` (or the label). #### 4. Put it in the README 1. Use `README.md`, `README.rst`, or `README` at the repository root, in that order. If none exists, ask before creating one. 2. Search for `moochy.dev/p/`, `moochy.dev/org/` and `moochy.dev/people/`. If a Moochy button is already there, do not add another; replace it only if the user asked for a change. 3. If the README has a row of badges near the top, add the button at the end of that row in the same syntax. Otherwise add it on its own line right after the title, with a blank line before and after. 4. Do not reorder, reformat, or remove anything else. 5. Commit only the README: `docs: add a "Donate tokens" button (Moochy)`. #### 5. Check `curl -s -o /dev/null -w '%{http_code}\n' "BUTTON_URL"` prints `200` when the image renders and `400` for a wrong option. A project that is not registered also gets `200`, with a "project not found" badge, so check registration with the projects API (step 1). ### Organisations (profile READMEs) A GitHub organisation or GitLab group claimed on Moochy has its own button; a donation to it serves every project its owner chose. Use it in the organisation's profile README, or in a project README only when the user asks for the organisation's button. Personal accounts are not organisations: see People below. | Where | Profile README file | |---|---| | GitHub organisation `ORG` | `profile/README.md` in the `ORG/.github` repository | | GitLab group `GROUP` | `README.md` in the `GROUP/gitlab-profile` project | In the `.github` or `gitlab-profile` checkout, the organisation is the remote path without its last segment (`acme/.github` → `github/acme`; `group/sub/gitlab-profile` → `gitlab/group/sub`). Check it and get the addresses: ```sh curl -fsS "https://moochy.dev/api/v1/orgs/github/acme" # or .../orgs/gitlab/group/sub ``` The answer is `{"org_id": …, "path": …, "claimed": true, "repos": […], "donate_url": …, "button_url": …}`, public, with no donor or amount. Use `button_url` and `donate_url` exactly as returned. A `404` means the organisation is not on Moochy: do not add the button; give the user the organisation message below. | Organisation | Image | Link | |---|---|---| | GitHub | `https://moochy.dev/org/github/ORG/button.svg` | `https://moochy.dev/org/github/ORG/donate` | | GitLab, group or subgroup | `https://moochy.dev/org/gitlab/GROUP/SUB/-/button.svg` | `https://moochy.dev/org/gitlab/GROUP/SUB/-/donate` | Snippets, options, placement and the check are those of steps 3 to 5. Example: ```markdown [![Donate tokens](https://moochy.dev/org/github/acme/button.svg)](https://moochy.dev/org/github/acme/donate) ``` `moochy button` prints project buttons only (`moochy button --chart --org …` prints the organisation's chart). Commit message: `docs: add a "Donate tokens" button for the organisation (Moochy)`. ### People (personal profile READMEs) A maintainer who claimed their own GitHub or GitLab profile on Moochy can be sponsored: sponsors' tokens pay for that person's own requests on the public repos they maintain. Their personal profile README is `README.md` in the repository named like the user (`LOGIN/LOGIN` on GitHub; `USERNAME/USERNAME` on GitLab), so the person is `github/LOGIN` or `gitlab/USERNAME`. Check it and get the addresses: ```sh curl -fsS "https://moochy.dev/api/v1/people/github/LOGIN" # or .../people/gitlab/USERNAME ``` Same shape as the organisations API. Use `button_url` and `donate_url` exactly as returned (images `https://moochy.dev/people/github/LOGIN/button.svg`, GitLab `https://moochy.dev/people/gitlab/USERNAME/-/button.svg`). A `404` means the person has not claimed their profile: do not add the button; tell the user to sign in on moochy.dev, choose Claim your profile, then run `moochy claim --person` on their own machine (guide: https://moochy.dev/docs/sponsor-a-person). Snippets, options, placement and the check are those of steps 3 to 5. ### Showcase chart A live chart of the tokens donated to and used by a project, an organisation, or a person, as an image for READMEs (`chart.svg`) or a card for websites (`card`, in an `