Skip to content

Commit aeae431

Browse files
feat(check): add global speed checker command
Adds `openstatus check <URL>` (alias `c`): a top-level, unauthenticated command that runs a one-shot HTTP check from 28 global regions via the public OpenStatus speed checker. Highlights: - Live row-per-region output streaming as NDJSON arrives, followed by a summary footer (fastest/slowest/mean/success-rate + share URL). - --timing adds DNS / Connection / TLS / TTFB / Transfer columns. - --json buffers a single object with full timing nested per region, ready for jq pipelines. - curl-style flags -X / -H / -d (with @file and @- stdin support). - Typed errors for 429 (parsed Retry-After + body reset fallback), 4xx (with VPN/proxy hint when body mentions client IP), 5xx, network errors, and truncated streams. - Region codes mapped to human-readable names (e.g. koyeb_tyo → "Tokyo (Koyeb)") from the upstream skill repo snapshot. Internals: - New internal/check/ package: client.go (NDJSON streaming parser), render.go (table + summary + JSON output), regions.go (display names), types.go (typed errors). - internal/api/client.go gains PlayCheckerURL pinned to www.openstatus.dev (skips a 308 redirect on every call). - Tests use the existing RoundTripper-interceptor pattern from internal/run/run_test.go; fixtures captured from live probes live in internal/check/testdata/. Docs: - README: new check row, dedicated Quick Start example, Global Speed Check section. - Manpage and generated markdown regenerated. - skills/cli/SKILL.md teaches when to reach for check vs. saved monitors. Version bumped to v1.2.0 (new top-level command = semver minor).
1 parent ea19c17 commit aeae431

21 files changed

Lines changed: 1745 additions & 556 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
dist/
33
.env
44
.claude/
5+
plan.md

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ iwr https://raw.githubusercontent.com/openstatusHQ/cli/refs/heads/main/install.p
2525
## Quick Start
2626

2727
```bash
28+
# Run a one-shot HTTP check against a URL from 28 global regions (no auth)
29+
openstatus check https://openstat.us
30+
2831
# Authenticate with your API token
2932
openstatus login
3033

@@ -44,10 +47,26 @@ openstatus status-report create --title "API degradation" --status investigating
4447
openstatus run
4548
```
4649

50+
## Global Speed Check
51+
52+
`openstatus check <URL>` runs a one-shot HTTP check from 28 global probe
53+
regions via the public OpenStatus speed checker. No API token required.
54+
55+
```bash
56+
openstatus check https://openstat.us
57+
openstatus check https://openstat.us -X POST -H 'Authorization: Bearer …' -d '{"ping":true}'
58+
openstatus check https://openstat.us -d @payload.json
59+
openstatus check https://openstat.us --timing # adds DNS/Connection/TLS/TTFB/Transfer columns
60+
openstatus check https://openstat.us --json | jq '.summary'
61+
```
62+
63+
Rate limit: 3 requests per 60 seconds.
64+
4765
## Commands
4866

4967
| Command | Alias | Description |
5068
|---------|-------|-------------|
69+
| `check` | `c` | Run an HTTP check against a URL from 28 global regions (no auth) |
5170
| `login` / `logout` | | Authenticate with the OpenStatus API |
5271
| `whoami` | `w` | Show current workspace info |
5372
| `monitors` | `m` | List, inspect, trigger, import, and apply monitors |

docs/openstatus-docs.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,34 @@ Global flags:
2121
| `--quiet` (`-q`) | Suppress non-error output | bool | `false` | *none* |
2222
| `--debug` | Enable debug output | bool | `false` | *none* |
2323

24+
### `check` command (aliases: `c`)
25+
26+
Run an HTTP check against a URL from 28 global regions.
27+
28+
> openstatus check <URL>
29+
> openstatus check https://openstat.us
30+
> openstatus check https://openstat.us -X POST -H 'Authorization: Bearer …' -d '{"ping":true}'
31+
> openstatus check https://openstat.us -d @payload.json
32+
> openstatus check https://openstat.us --timing
33+
> openstatus check https://openstat.us --json | jq '.summary'
34+
35+
Run a one-shot HTTP check against a URL from 28 global regions. The check is executed by the public OpenStatus speed checker. No API token is required. Results stream to the terminal as they arrive from each region. Output is sorted in the order regions report back (roughly fastest first). Pass --timing to see DNS/Connection/TLS/TTFB/Transfer phase breakdowns. Pass --json for a machine-readable single object including all phase data. Rate limit: 3 requests per 60 seconds.
36+
37+
Usage:
38+
39+
```bash
40+
$ openstatus [GLOBAL FLAGS] check [COMMAND FLAGS] [ARGUMENTS...]
41+
```
42+
43+
The following flags are supported:
44+
45+
| Name | Description | Type | Default value | Environment variables |
46+
|-----------------------|----------------------------------------------------------|--------|:-------------:|:---------------------:|
47+
| `--method="…"` (`-X`) | HTTP method | string | `"GET"` | *none* |
48+
| `--header="…"` (`-H`) | Header in "Key: Value" form (repeatable) | string | | *none* |
49+
| `--body="…"` (`-d`) | Request body. Use @filename to read a file, @- for stdin | string | | *none* |
50+
| `--timing` | Show DNS/Connection/TLS/TTFB/Transfer phases | bool | `false` | *none* |
51+
2452
### `monitors` command (aliases: `m`)
2553

2654
Manage your monitors.

docs/openstatus.1

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,96 @@ T}@T{
8787
\f[I]none\f[R]
8888
T}
8989
.TE
90+
.SS \f[CR]check\f[R] command (aliases: \f[CR]c\f[R])
91+
Run an HTTP check against a URL from 28 global regions.
92+
.RS
93+
.PP
94+
openstatus check openstatus check https://openstat.us openstatus check
95+
https://openstat.us \-X POST \-H `Authorization: Bearer \&...' \-d
96+
`{\(lqping\(rq:true}' openstatus check https://openstat.us \-d
97+
\(atpayload.json openstatus check https://openstat.us \(entiming
98+
openstatus check https://openstat.us \(enjson | jq `.summary'
99+
.RE
100+
.PP
101+
Run a one\-shot HTTP check against a URL from 28 global regions.
102+
The check is executed by the public OpenStatus speed checker.
103+
No API token is required.
104+
Results stream to the terminal as they arrive from each region.
105+
Output is sorted in the order regions report back (roughly fastest
106+
first).
107+
Pass \(entiming to see DNS/Connection/TLS/TTFB/Transfer phase
108+
breakdowns.
109+
Pass \(enjson for a machine\-readable single object including all phase
110+
data.
111+
Rate limit: 3 requests per 60 seconds.
112+
.PP
113+
Usage:
114+
.IP
115+
.EX
116+
$ openstatus [GLOBAL FLAGS] check [COMMAND FLAGS] [ARGUMENTS...]
117+
.EE
118+
.PP
119+
The following flags are supported:
120+
.PP
121+
.TS
122+
tab(@);
123+
lw(12.7n) lw(32.0n) lw(4.4n) cw(8.3n) cw(12.7n).
124+
T{
125+
Name
126+
T}@T{
127+
Description
128+
T}@T{
129+
Type
130+
T}@T{
131+
Default value
132+
T}@T{
133+
Environment variables
134+
T}
135+
_
136+
T{
137+
\f[CR]\-\-method=\(dq\&...\(dq\f[R] (\f[CR]\-X\f[R])
138+
T}@T{
139+
HTTP method
140+
T}@T{
141+
string
142+
T}@T{
143+
\f[CR]\(dqGET\(dq\f[R]
144+
T}@T{
145+
\f[I]none\f[R]
146+
T}
147+
T{
148+
\f[CR]\-\-header=\(dq\&...\(dq\f[R] (\f[CR]\-H\f[R])
149+
T}@T{
150+
Header in \(lqKey: Value\(rq form (repeatable)
151+
T}@T{
152+
string
153+
T}@T{
154+
T}@T{
155+
\f[I]none\f[R]
156+
T}
157+
T{
158+
\f[CR]\-\-body=\(dq\&...\(dq\f[R] (\f[CR]\-d\f[R])
159+
T}@T{
160+
Request body.
161+
Use \(atfilename to read a file, \(at\- for stdin
162+
T}@T{
163+
string
164+
T}@T{
165+
T}@T{
166+
\f[I]none\f[R]
167+
T}
168+
T{
169+
\f[CR]\-\-timing\f[R]
170+
T}@T{
171+
Show DNS/Connection/TLS/TTFB/Transfer phases
172+
T}@T{
173+
bool
174+
T}@T{
175+
\f[CR]false\f[R]
176+
T}@T{
177+
\f[I]none\f[R]
178+
T}
179+
.TE
90180
.SS \f[CR]monitors\f[R] command (aliases: \f[CR]m\f[R])
91181
Manage your monitors.
92182
.PP

internal/api/client.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ const APIBaseURL = "https://api.openstatus.dev/v1"
1616

1717
const ConnectBaseURL = "https://api.openstatus.dev/rpc"
1818

19+
// PlayCheckerURL is the public Speed Checker endpoint backing the `check`
20+
// command. The www. prefix is intentional: the bare openstatus.dev host
21+
// returns a 308 redirect that adds latency to every call.
22+
const PlayCheckerURL = "https://www.openstatus.dev/play/checker/api"
23+
1924
var DefaultHTTPClient = &http.Client{
2025
Timeout: 30 * time.Second,
2126
}

0 commit comments

Comments
 (0)