Skip to content

Commit 73b8b53

Browse files
committed
docs: teach AGENTS.md how to check for and bump package updates
Document the _meta.releases field in the schema, add a new section explaining how to check individual or all packages for upstream updates using the releases URL, and how to bump versions.
1 parent 6980ec3 commit 73b8b53

1 file changed

Lines changed: 40 additions & 2 deletions

File tree

AGENTS.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Each package directory has a `data.json` with version entries and a `_meta` key:
2626

2727
```json
2828
{
29-
"_meta": { "default": "1.2.3" },
29+
"_meta": { "default": "1.2.3", "releases": "https://github.com/OWNER/REPO/releases" },
3030
"1.2.3": {
3131
"sha256": "sha256-XXXX",
3232
"vendorHash": "sha256-YYYY"
@@ -35,6 +35,7 @@ Each package directory has a `data.json` with version entries and a `_meta` key:
3535
```
3636

3737
- **`_meta.default`**: Which version is the default (used by `nix build .#<pkg>.default`)
38+
- **`_meta.releases`**: URL to the upstream releases page (e.g., GitHub releases, official download page). Used by the docs generator to link package names, and by agents to check for new versions.
3839
- **Version keys**: Semantic version strings (e.g., `"1.25.6"`, `"0.52.0"`)
3940
- **`sha256`**: SRI hash of the source archive
4041
- **`vendorHash`**: (Go packages) SRI hash of vendored dependencies
@@ -108,7 +109,7 @@ mkdir packages/mypackage
108109

109110
```json
110111
{
111-
"_meta": { "default": "1.0.0" },
112+
"_meta": { "default": "1.0.0", "releases": "https://github.com/OWNER/REPO/releases" },
112113
"1.0.0": {
113114
"sha256": "sha256-XXXX"
114115
}
@@ -237,6 +238,43 @@ registryExtensions = {
237238
};
238239
```
239240

241+
## Checking for Package Updates
242+
243+
Each package's `data.json` has a `_meta.releases` URL pointing to its upstream releases page. Use this to discover whether newer versions are available.
244+
245+
### Checking a single package
246+
247+
1. Read `packages/<pkg>/data.json` to find `_meta.releases` and `_meta.default` (the current default version).
248+
2. Fetch the releases URL to find the latest available version(s).
249+
- **GitHub releases pages** (`github.com/<owner>/<repo>/releases`): use the GitHub API for structured data:
250+
```bash
251+
gh api repos/<owner>/<repo>/releases/latest --jq '.tag_name'
252+
```
253+
Or to list recent releases:
254+
```bash
255+
gh api repos/<owner>/<repo>/releases --jq '.[].tag_name' | head -10
256+
```
257+
- **Non-GitHub pages** (e.g., `go.dev/dl/`, `nodejs.org`, `static.rust-lang.org`): fetch the page and extract version information from it.
258+
3. Compare the latest upstream version against `_meta.default`. Note that some packages use a `v` prefix in their version keys (e.g., `"v1.5.1"`) — match the convention already used in that package's `data.json`.
259+
260+
### Checking all packages for updates
261+
262+
To scan the entire registry for outdated packages:
263+
264+
1. Iterate over every `packages/*/data.json`.
265+
2. For each, extract `_meta.releases` and `_meta.default`.
266+
3. Fetch the upstream releases URL and compare.
267+
4. Report which packages have newer versions available, showing current vs. latest.
268+
269+
### Bumping a package to a new version
270+
271+
Once you've identified that a newer version exists:
272+
273+
1. Follow the steps in "Adding a New Version of an Existing Package" above.
274+
2. Use the URL patterns in the package's `default.nix` to construct the correct download URL for the new version — this tells you how to compute the source hash.
275+
3. Update `_meta.default` to the new version.
276+
4. Test the build and verify the binary.
277+
240278
## Verification Checklist
241279
242280
After making changes:

0 commit comments

Comments
 (0)