Pipe library / json-api-diff
json-api-diff
Watch a public JSON document and emit when the selected fields change.
Utilities
api.github.com
CLI
pipes run examples/json-api-diff.pipe.yaml
MCP call
{
"name": "pipe__json-api-diff",
"arguments": {}
}
Pipe file
examples/json-api-diff.pipe.yaml
pipes: 0
name: json-api-diff
version: 0.1.0
description: Watch a public JSON document and emit when the selected fields change.
permissions:
network: [api.github.com]
inputs:
type: object
properties:
repo:
type: string
pattern: "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
default: tokio-rs/tokio
required: [repo]
outputs:
type: object
properties:
text: { type: string }
count: { type: integer }
required: [text, count]
output:
text: "${steps.format.text}"
count: "${steps.format.count}"
steps:
- id: fetch
block: fetch_http
with:
url: "https://api.github.com/repos/${inputs.repo}"
headers:
accept: application/vnd.github+json
max_bytes: 400000
retry: { max: 2, backoff_ms: 500 }
timeout_ms: 15000
- id: parsed
block: parse_json
in: "${steps.fetch}"
- id: shaped
block: map
in: "${steps.parsed}"
with:
pick: [full_name, description, stargazers_count, pushed_at]
- id: changed
block: diff_since_last
in: "${steps.shaped}"
with:
key: [full_name]
compare: [description, stargazers_count, pushed_at]
emit: [added, changed]
first_run: all
- id: format
block: format
in: "${steps.changed}"
with:
header: "Repo:\n"
item_template: "- ${item.full_name} stars ${item.stargazers_count} pushed ${item.pushed_at}"
separator: "\n"
- id: print
block: emit_stdout
in: "${steps.format.text}"
with: { format: text }