Sources

Sources

Pages that fetch their own data on a schedule and fill their cards from the answer.

A page can fetch its own data. Give it named sources, and Legato calls each one on a schedule and fills the cards from the answer. You don't need to write Swift, change the app or keep an agent running: once the page is written, it stays current by itself.

  1. In the page file

    "sources": {
      "repo": { "url": "https://api.github.com/repos/…",
                "every": "1h" }
    },
    "cards": [
      { "type": "stat", "label": "Stars",
        "source": { "ref": "repo",
                    "map": { "value": "stargazers_count" } } },
      { "type": "stat", "label": "Forks",
        "source": { "ref": "repo",
                    "map": { "value": "forks_count" } } }
    ]
  2. In Legato

    Stars2,847↗ +12
    Forks1,203
One request an hour fills both cards. repo is the connection, each card’s ref picks it, and each map takes a different field from the same answer.

A source can be an internet API such as GitHub or Tessie, a service on your network such as Pi-hole or Home Assistant, or this Mac's own calendars and reminders. Cards on a page with sources can also carry buttons that call the same service: pause ad blocking, lock the car, tick off a task. The page files, the answers and your secrets stay on the Mac; requests go only to the services the page names.

An agent can write a page like this as easily as one with fixed values: ask it for a page that keeps itself up to date. A page can mix both, sourced cards next to cards with values written in.

Start here

Set up a source

Use the answer