claude-down 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,17 +1,28 @@
1
1
  # claude-down
2
2
 
3
- **Is Claude down? Again?**
3
+ is claude down (again) (yes). booga check, you no cry.
4
4
 
5
- > A tiny CLI tool to check if Claude is operational, combining official status reports with community signals.
5
+ claude no work? maybe you. maybe anthropic. (probably anthropic.) booga look two
6
+ place same time:
6
7
 
7
- `claude-down` monitors two sources in parallel:
8
+ - **status.claude.com** what anthropic admit to.
9
+ - **Downdetector** — what everyone else screaming about, usually first.
8
10
 
9
- 1. **Anthropic Status Page** (`status.claude.com`): The authoritative source for incident reports and component status.
10
- 2. **Downdetector**: Community-driven signal that often leads official reports by several minutes.
11
+ fable 5 cooked rn (anthropic suspend access). it back yet??
11
12
 
12
- ## Installation
13
+ ```bash
14
+ npx -y claude-down@latest --fable
15
+ ```
16
+
17
+ ## or just watch the page
18
+
19
+ no install, no terminal. page poll itself, you stare:
13
20
 
14
- You can run it directly using `bunx` or `npx`:
21
+ <https://kjanat.github.io/claude-down/>
22
+
23
+ ## get booga
24
+
25
+ run direct, no install:
15
26
 
16
27
  ```bash
17
28
  bunx claude-down status
@@ -19,7 +30,7 @@ bunx claude-down status
19
30
  npx -y claude-down status
20
31
  ```
21
32
 
22
- Or install it globally:
33
+ or keep forever:
23
34
 
24
35
  ```bash
25
36
  bun install -g claude-down
@@ -27,50 +38,84 @@ bun install -g claude-down
27
38
  npm install -g claude-down
28
39
  ```
29
40
 
30
- ## Usage
41
+ <details>
42
+ <summary>fresh builds (every commit)</summary>
43
+
44
+ every push + PR get published to [pkg.pr.new]. bot drop the url in the PR. run
45
+ any sha:
46
+
47
+ ```bash
48
+ bunx https://pkg.pr.new/kjanat/claude-down@<sha> status # or npx / pnpx
49
+ ```
50
+
51
+ </details>
31
52
 
32
- ### Human-readable summary
53
+ ## how use
33
54
 
34
- The `status` command provides a status indicator, a brief description, and details from both sources.
55
+ ### words for human
56
+
57
+ `status` give indicator, lil description, details from both place.
35
58
 
36
59
  ```bash
37
60
  claude-down status
38
61
  ```
39
62
 
40
- ### JSON output
63
+ ### words for robot
41
64
 
42
- Get structured data for scripts or monitoring tools.
65
+ json for your scripts and your little monitoring guys.
43
66
 
44
67
  ```bash
45
68
  claude-down status --json
46
69
  ```
47
70
 
48
- ### Silent mode
71
+ ### no words, just number
49
72
 
50
- Use for CI/CD or shell scripts where you only care about the exit code.
73
+ exit code always tell truth (see [the numbers](#the-numbers)), output or not.
74
+ slap `-q`/`--quiet` in CI when you only care about number.
51
75
 
52
76
  ```bash
53
77
  claude-down status -q
54
78
  ```
55
79
 
56
- ### Specific source
80
+ ### pick your place
57
81
 
58
- You can check a specific source using subcommands or the `--source` flag.
82
+ subcommand or `--source`. `--source` eat commas and repeats.
59
83
 
60
84
  ```bash
61
- # Using subcommands
85
+ # subcommand
62
86
  claude-down anthropic
63
87
  claude-down downdetector
64
88
 
65
- # Using flags
89
+ # flag
66
90
  claude-down status --source anthropic
67
- # or
68
91
  claude-down status -s downdetector
92
+
93
+ # many
94
+ claude-down status --source anthropic,downdetector
95
+ claude-down status -s anthropic -s downdetector
69
96
  ```
70
97
 
71
- ## Browser Usage
98
+ ### pick your model
72
99
 
73
- `claude-down` provides a browser-safe entry point that only includes the Anthropic Statuspage source (since Downdetector requires a local Chromium binary).
100
+ only show incident/component that name model you care about. summary AND exit
101
+ code shrink to just those. like `--source`, `--model` eat commas and repeats,
102
+ and every model got shortcut flag.
103
+
104
+ ```bash
105
+ # shortcut
106
+ claude-down status --opus --sonnet
107
+
108
+ # --model, commas and/or repeats
109
+ claude-down status --model opus,sonnet
110
+ claude-down status -m opus -m sonnet
111
+ ```
112
+
113
+ models: `opus`, `haiku`, `sonnet`, `mythos`, `fable`.
114
+
115
+ ## use in browser
116
+
117
+ browser-safe door, anthropic only (downdetector need real chromium, no work in
118
+ browser).
74
119
 
75
120
  ```typescript
76
121
  import { checkAnthropic } from "claude-down/browser";
@@ -87,42 +132,39 @@ if (result.kind === "ok") {
87
132
  }
88
133
  ```
89
134
 
90
- ## Exit Codes
135
+ ## the numbers
91
136
 
92
- The CLI returns specific exit codes based on the severity of the outage:
137
+ exit code = how bad. set every run (not just `--quiet`), worst source win.
93
138
 
94
- | Code | Status | Description |
95
- | -----: | :---------- | :------------------------------------------------------------ |
96
- | **0** | Operational | Everything is working normally. |
97
- | **1** | Degraded | Minor issues reported by Anthropic. |
98
- | **2** | Outage | Major/critical outage or Downdetector reports Claude is down. |
99
- | **21** | Unknown | Both status sources are unreachable. |
139
+ | Code | Vibe | what happen |
140
+ | -----: | :-------- | :------------------------------------------------------ |
141
+ | **0** | all good | everything work. go back to your life. |
142
+ | **1** | meh | minor thing, or anthropic got live incident. |
143
+ | **2** | cooked | major/critical outage, or downdetector say claude down. |
144
+ | **21** | who knows | every source booga try was unreachable. |
100
145
 
101
- ## Development
146
+ source booga no reach = unknown, NOT down. `21` only when EVERY source dead, so
147
+ one flaky downdetector scrape no ruin your day.
102
148
 
103
- This project is built with [dreamcli].
149
+ ## who do all this
104
150
 
105
- ### Setup
151
+ booga no write flag parser. booga no write `--help`, tab-complete, json mode,
152
+ exit codes. all that [dreamcli]. booga just point at anthropic and shitpost.
106
153
 
107
- ```bash
108
- bun install
109
- ```
110
-
111
- ### Build
112
-
113
- ```bash
114
- bun run build
115
- ```
154
+ you want make own CLI look this clean? → [dreamcli]
116
155
 
117
- ### Test
156
+ ## hack on it
118
157
 
119
158
  ```bash
120
- bun test
159
+ bun install # setup
160
+ bun run build # build
161
+ bun test # test
121
162
  ```
122
163
 
123
- ## License
164
+ ## license
124
165
 
125
166
  [MIT][LICENSE] © 2026 Kaj Kowalski
126
167
 
127
168
  [LICENSE]: https://github.com/kjanat/claude-down/blob/master/LICENSE
128
169
  [dreamcli]: https://github.com/kjanat/dreamcli
170
+ [pkg.pr.new]: https://pkg.pr.new
package/dist/bin/cli.mjs CHANGED
@@ -1,7 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import{cli as e,command as t,flag as n}from"@kjanat/dreamcli";import{exit as r,stdout as i}from"node:process";import{spawn as a,spawnSync as o}from"node:child_process";import{mkdtempSync as s,rmSync as c}from"node:fs";import{tmpdir as l}from"node:os";import{join as u}from"node:path";import{setTimeout as d}from"node:timers/promises";var f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.prototype.hasOwnProperty,g=(e,t)=>()=>(e&&(t=e(e=0)),t),_=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),ee=(e,t)=>{let n={};for(var r in e)f(n,r,{get:e[r],enumerable:!0});return t||f(n,Symbol.toStringTag,{value:`Module`}),n},te=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!h.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e},ne=e=>h.call(e,`module.exports`)?e[`module.exports`]:te(f({},`__esModule`,{value:!0}),e),re=`claude-down`,v=`0.4.2`,y=`Is claude code down? Probably...`;const b=[`anthropic`,`downdetector`],x={anthropic:`Anthropic`,downdetector:`Downdetector`},S={none:0,minor:1,major:2,critical:2,unavailable:21},C=`https://status.claude.com`,w=`https://downdetector.com/status/claude-ai/`,ie=[`google-chrome-stable`,`google-chrome`,`chromium`,`brave`,`microsoft-edge-stable`,`microsoft-edge`],T=n.boolean().alias(`q`).describe(`Silent; exit code only`),E=n.string().default(C).env(`CLAUDE_DOWN_ANTHROPIC_STATUS_BASE`).describe(`Override Anthropic status page base URL`),ae=n.array(n.enum(b)).default([...b]).alias(`s`).describe(`Data source(s) to check`),D=`\x1B[31m`,O=`\x1B[32m`;function k(e,t,n){return n?`${t}${e}`:e}function A(e,t,n){return n?`\x1b]8;;${t}\x1b\\${e}\x1b]8;;\x1b\\`:e}function j(e){if(e.indicator===`unavailable`)return`\x1B[2m`;if(e.source===`downdetector`)return e.reportsOutage?D:O;switch(e.indicator){case`none`:return O;case`minor`:return`\x1B[33m`;case`major`:case`critical`:return D}}function M(e){return e.source===`anthropic`?C:w}function N(e,t,n){if(n.length!==0){e.push(` ${t}:`);for(let t of n)e.push(` - ${t}`)}}function P(e,t){let n=j(e),r=[A(k(x[e.source],`${n}`,t),M(e),t)];if(e.indicator===`unavailable`){let i=e.summaryText??`unknown error`;return r.push(` ${k(`Unavailable: ${i}`,n,t)}`),r.join(`
3
- `)}if(e.source===`downdetector`){let i=e.summaryText??`No user-reported issues`;return r.push(` ${k(i,n,t)}`),r.join(`
4
- `)}let i=e.summaryText??`All systems operational`;r.push(` ${k(i,n,t)}`);let a=e.incidents?.map(e=>`${e.name} (${e.status})`)??[];return N(r,a.length===1?`Active incident`:`Active incidents`,a),N(r,`Affected components`,e.affectedComponents?.map(e=>e.name)??[]),r.join(`
5
- `)}function F(e){return e.source===`downdetector`?{source:`downdetector`,status:e.indicator===`unavailable`?`unavailable`:e.reportsOutage?`down`:`up`,details:e.summaryText}:{source:`anthropic`,status:e.indicator===`none`?`up`:e.indicator,details:e.summaryText,incidents:e.incidents,affected:e.affectedComponents}}function I(e){return e.map(e=>F(e))}function L(e,t){if(t.jsonMode||!t.isTTY){t.json(I(e));return}t.log(e.map(e=>P(e,t.isTTY)).join(`
2
+ import{ParseError as e,cli as t,command as n,flag as r}from"@kjanat/dreamcli";import i,{stdout as a}from"node:process";import{spawn as o,spawnSync as s}from"node:child_process";import{existsSync as c,mkdtempSync as ee,rmSync as l}from"node:fs";import{tmpdir as te}from"node:os";import{join as ne,win32 as re}from"node:path";import{setTimeout as u}from"node:timers/promises";import{createNodeAdapter as d}from"@kjanat/dreamcli/runtime";var f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertyNames,m=Object.prototype.hasOwnProperty,h=(e,t)=>()=>(e&&(t=e(e=0)),t),g=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),ae=(e,t)=>{let n={};for(var r in e)f(n,r,{get:e[r],enumerable:!0});return t||f(n,Symbol.toStringTag,{value:`Module`}),n},oe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ie(t),a=0,o=i.length,s;a<o;a++)s=i[a],!m.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e},se=e=>m.call(e,`module.exports`)?e[`module.exports`]:oe(f({},`__esModule`,{value:!0}),e),ce=`claude-down`,_=`0.5.0`,le=`Is claude code down? Probably...`,v={type:`git`,url:`git+https://github.com/kjanat/claude-down.git`};const y=[`anthropic`,`downdetector`],b={anthropic:`Anthropic`,downdetector:`Downdetector`},x=[`opus`,`haiku`,`sonnet`,`mythos`,`fable`];function S(e,t){let n=e.toLowerCase();for(let e of t)if(n.includes(e))return!0;return!1}const C={none:0,minor:1,major:2,critical:2,unavailable:21},w=`https://status.claude.com`,T=`https://downdetector.com/status/claude-ai/`,E=[`google-chrome-stable`,`google-chrome`,`chromium`,`brave`,`microsoft-edge-stable`,`microsoft-edge`],ue=[`chrome.exe`,`msedge.exe`,`brave.exe`],de=[[`Google`,`Chrome`,`Application`,`chrome.exe`],[`Microsoft`,`Edge`,`Application`,`msedge.exe`],[`BraveSoftware`,`Brave-Browser`,`Application`,`brave.exe`],[`Chromium`,`Application`,`chrome.exe`]],fe=[`ProgramFiles`,`ProgramFiles(x86)`,`LOCALAPPDATA`],pe=[`/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`,`/Applications/Brave Browser.app/Contents/MacOS/Brave Browser`,`/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge`,`/Applications/Chromium.app/Contents/MacOS/Chromium`];function D(t,n){return r=>{let i=[];for(let a of String(r).split(`,`)){let r=a.trim();if(r.length===0)continue;let o=t.find(e=>e===r);if(o===void 0)throw new e(`Invalid value '${r}' for flag --${n}. Allowed: ${t.join(`, `)}`,{code:`INVALID_VALUE`,details:{flag:n,input:`--${n}`,value:r,allowed:t}});i.push(o)}return i}}const me=D(x,`model`),he=D(y,`source`),O=r.boolean().alias(`q`).describe(`Silent; exit code only`),k=r.custom(e=>new URL(String(e))).alias(`anthropic-status-base`,{hidden:!0}).alias(`base`).alias(`b`).default(new URL(w)).env(`CLAUDE_DOWN_ANTHROPIC_STATUS_BASE`).describe(`Override Anthropic status page base URL`),ge=r.array(r.custom(he)).alias(`s`).default([[...y]]).env(`CLAUDE_DOWN_SOURCE`).env(`CLAUDE_DOWN_SOURCES`).describe(`Data source(s) to check`),A=r.string().env(`CLAUDE_DOWN_CHROME`).describe(`Path to a Chrome/Chromium binary`),j=r.array(r.custom(me)).alias(`m`).describe(`Only report incidents/components mentioning these model(s)`),M={opus:r.boolean().describe(`Shortcut for --model opus`),haiku:r.boolean().describe(`Shortcut for --model haiku`),sonnet:r.boolean().describe(`Shortcut for --model sonnet`),mythos:r.boolean().describe(`Shortcut for --model mythos`),fable:r.boolean().describe(`Shortcut for --model fable`)};function N(e){let t=new Set(e.model.flat());for(let n of x)e[n]&&t.add(n);return t}function P(e){return e.flat()}const F=`\x1B[31m`,I=`\x1B[32m`,L={none:I,minor:`\x1B[33m`,major:F,critical:F};function R(e,t,n){return n?`${t}${e}`:e}function _e(e,t,n){return n?`\x1b]8;;${t}\x1b\\${e}\x1b]8;;\x1b\\`:e}function ve(e){return e.indicator===`unavailable`?`\x1B[2m`:e.source===`downdetector`?e.reportsOutage?F:I:L[e.indicator]}function ye(e){return e.source===`anthropic`?w:T}function z(e,t,n){if(n.length!==0){e.push(` ${t}:`);for(let t of n)e.push(` - ${t}`)}}function be(e,t){let n=ve(e),r=[_e(R(b[e.source],`${n}`,t),ye(e),t)];if(e.indicator===`unavailable`){let i=e.summaryText??`unknown error`;return r.push(` ${R(`Unavailable: ${i}`,n,t)}`),r.join(`
3
+ `)}if(e.source===`downdetector`){let i=e.summaryText??`No user-reported issues`;return r.push(` ${R(i,n,t)}`),r.join(`
4
+ `)}let i=e.summaryText??`All systems operational`;r.push(` ${R(i,n,t)}`);let a=e.incidents?.map(e=>`${e.name} (${e.status})`)??[];return z(r,a.length===1?`Active incident`:`Active incidents`,a),z(r,`Affected components`,e.affectedComponents?.map(e=>e.name)??[]),r.join(`
5
+ `)}function xe(e){return e.source===`downdetector`?{source:`downdetector`,status:e.indicator===`unavailable`?`unavailable`:e.reportsOutage?`down`:`up`,details:e.summaryText}:{source:`anthropic`,status:e.indicator===`none`?`up`:e.indicator,details:e.summaryText,incidents:e.incidents,affected:e.affectedComponents}}function Se(e){return e.map(e=>xe(e))}function Ce(e,t){if(t.jsonMode||!t.isTTY){t.json(Se(e));return}t.log(e.map(e=>be(e,t.isTTY)).join(`
6
6
 
7
- `))}var R=_((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Endpoint=void 0,e.Endpoint={ACTIVE_JSON:`upcoming.json`,API_V2_BASE:`api/v2`,components(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.COMPONENTS_JSON}`},COMPONENTS_JSON:`components.json`,INCIDENTS:`incidents`,Incidents:{all(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.INCIDENTS_JSON}`},unresolved(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.INCIDENTS}/${e.Endpoint.UNRESOLVED_JSON}`}},INCIDENTS_JSON:`incidents.json`,SCHEDULED_MAINTENANCES:`scheduled-maintenances`,SCHEDULED_MAINTENANCES_JSON:`scheduled-maintenances.json`,ScheduledMaintenances:{active(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES}/${e.Endpoint.ACTIVE_JSON}`},all(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES_JSON}`},upcoming(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES}/${e.Endpoint.UPCOMING_JSON}`}},status(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.STATUS_JSON}`},STATUS_JSON:`status.json`,subscriber(t){return`/${e.Endpoint.API_V2_BASE}/subscribers/${encodeURIComponent(t)}.json`},subscribers(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SUBSCRIBERS_JSON}`},SUBSCRIBERS_JSON:`subscribers.json`,summary(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SUMMARY_JSON}`},SUMMARY_JSON:`summary.json`,UNRESOLVED_JSON:`unresolved.json`,UPCOMING_JSON:`upcoming.json`}})),z=_((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.IncidentsAPI=void 0;let n=R();e.IncidentsAPI=class{constructor(e){this.apiClient=e}getAll(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.Incidents.all(),{data:t}=yield this.apiClient.get(e);return t})}getUnresolved(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.Incidents.unresolved(),{data:t}=yield this.apiClient.get(e);return t})}}})),B=_((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.ScheduledMaintenancesAPI=void 0;let n=R();e.ScheduledMaintenancesAPI=class{constructor(e){this.apiClient=e}getActive(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.active(),{data:t}=yield this.apiClient.get(e);return t})}getAll(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.all(),{data:t}=yield this.apiClient.get(e);return t})}getUpcoming(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.upcoming(),{data:t}=yield this.apiClient.get(e);return t})}}})),V=_((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.SubscribersAPI=void 0;let n=R();e.SubscribersAPI=class{constructor(e){this.apiClient=e}createComponentSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}createIncidentSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}createPageSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}getSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.get(t,{params:{subscriber:{id:e}}});return r})}removeSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscriber(e),{data:r}=yield this.apiClient.delete(t);return r})}}})),H=_((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(z(),e),n(B(),e),n(V(),e)})),U=_((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),W=_((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),G=_((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MaintenanceStatus=e.IncidentStatus=e.IncidentImpact=void 0;var t;(function(e){e.Critical=`critical`,e.Major=`major`,e.Minor=`minor`,e.None=`none`})(t||(e.IncidentImpact=t={}));var n;(function(e){e.Identified=`identified`,e.Investigating=`investigating`,e.Monitoring=`monitoring`,e.Postmortem=`postmortem`,e.Resolved=`resolved`})(n||(e.IncidentStatus=n={}));var r;(function(e){e.Completed=`completed`,e.InProgress=`in_progress`,e.Scheduled=`scheduled`,e.Verifying=`verifying`})(r||(e.MaintenanceStatus=r={}))})),K=_((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(U(),e),n(W(),e),n(G(),e)})),q,J=g((()=>{q=class{constructor(e,t){this.baseUrl=e,this.config=t,this.interceptors={request:[],response:[]}}async delete(e,t){let n=await this.request(e,{...t,method:`DELETE`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async get(e,t){let n=await this.request(e,{...t,method:`GET`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async head(e,t){let n=await this.request(e,{...t,method:`HEAD`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async options(e,t){let n=await this.request(e,{...t,method:`OPTIONS`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async patch(e,t,n){let r=await this.request(e,{...n,data:t,method:`PATCH`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async post(e,t,n){let r=await this.request(e,{data:t,...n,method:`POST`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async put(e,t,n){let r=await this.request(e,{data:t,...n,method:`PUT`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async request(e,t){let n=new URL(e,this.baseUrl);if(t.params)for(let[e,r]of Object.entries(t.params))r!=null&&n.searchParams.append(e,String(r));let r={method:t.method.toUpperCase(),url:n,...this.config};if(t.headers&&(r.headers={...r.headers,...t.headers}),this.config?.auth){let{password:e,username:t}=this.config.auth,n=btoa(`${t}:${e}`);r.headers={...r.headers,Authorization:`Basic ${n}`}}if(t.data&&(t.data instanceof Object&&(r.headers={...r.headers,"Content-Type":`application/json`},t.data=JSON.stringify(t.data)),r.body=t.data),this.interceptors.request.length>0)for(let e of this.interceptors.request)r={...r,...await e({...r,url:n})};n=r.url;let i=await fetch(n,r);if(!i.ok){let e;try{e=await i.text()}catch{e=i.statusText}throw Error(e?`Request failed with status code ${i.status}: ${e}`:`Request failed with status code ${i.status}`)}if(this.interceptors.response.length>0)for(let e of this.interceptors.response)await e(i);return i}setBaseURL(e){this.baseUrl=e}setConfig(e){this.config=e}formatData(e,t){switch(t?.responseType||`json`){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`text`:return e.text();default:return e.json()}}}})),oe=g((()=>{})),se=ee({APIClient:()=>q}),ce=g((()=>{J(),oe()})),le=_((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.Statuspage=void 0;let n=(ce(),ne(se)),r=H(),i=R();e.Statuspage=class{constructor(e){if(this.getComponents=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.components(),{data:t}=yield this.apiClient.get(e);return t}),this.getStatus=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.status(),{data:t}=yield this.apiClient.get(e);return t}),this.getSummary=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.summary(),{data:t}=yield this.apiClient.get(e);return t}),!e)throw Error(`A page ID needs to be set in order to use the client.`);this.apiClient=new n.APIClient(`https://${e}.statuspage.io`),this.api={getComponents:this.getComponents,getStatus:this.getStatus,getSummary:this.getSummary,incidents:new r.IncidentsAPI(this.apiClient),scheduledMaintenances:new r.ScheduledMaintenancesAPI(this.apiClient),subscribers:new r.SubscribersAPI(this.apiClient)}}setApiUrl(e){this.apiClient.setBaseURL(e)}}})),ue=_((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(H(),e),n(K(),e),n(le(),e)}))();async function de(e=C){try{let t=new ue.Statuspage(`anthropic`);return t.setApiUrl(e),{kind:`ok`,summary:await t.api.getSummary()}}catch(e){return{kind:`unknown`,reason:e instanceof Error?e.message:String(e)}}}function fe(e){return typeof e==`object`&&!!e&&`webSocketDebuggerUrl`in e&&typeof e.webSocketDebuggerUrl==`string`}function pe(e){return typeof e==`object`&&!!e&&`id`in e&&typeof e.id==`number`}function me(e){let t=new Map,n=0;return e.onmessage=e=>{let n=typeof e.data==`string`?e.data:e.data instanceof ArrayBuffer?new TextDecoder().decode(e.data):null;if(n===null)return;let r;try{r=JSON.parse(n)}catch{return}if(!pe(r))return;let i=t.get(r.id);i!==void 0&&(t.delete(r.id),i(r))},(r,i={})=>new Promise((a,o)=>{let s=++n,c=setTimeout(()=>{t.delete(s),o(Error(`CDP command '${r}' timed out`))},5e3);t.set(s,e=>{clearTimeout(c),a(e)}),e.send(JSON.stringify({id:s,method:r,params:i}))})}async function he(e,t){let n=await(await fetch(`${e}/json/new?${encodeURIComponent(t)}`,{method:`PUT`})).json();if(!fe(n))return{ok:!1,error:`unexpected CDP target shape`};let r=new WebSocket(n.webSocketDebuggerUrl);return await new Promise((e,t)=>{r.onopen=()=>e(),r.onerror=()=>t(Error(`WebSocket connection failed`)),r.onclose=()=>t(Error(`WebSocket closed before opening`))}),{ok:!0,send:me(r),close:()=>r.close()}}function ge(){for(let e of ie){let t=o(`which`,[e]);if(t.status===0&&t.stdout)return t.stdout.toString().trim()}return null}async function _e(e,t){let n=Date.now()+t;for(;Date.now()<n;){try{if((await fetch(`${e}/json/version`)).ok)return!0}catch{}await d(100)}return!1}async function ve(e){let t;try{t=s(u(l(),`claude-down-`))}catch(e){return{ok:!1,error:`mkdtemp failed: ${e instanceof Error?e.message:String(e)}`}}let n=9222+Math.floor(Math.random()*1e3),r=a(e,[`--headless=new`,`--disable-gpu`,`--no-sandbox`,`--disable-blink-features=AutomationControlled`,`--window-size=1920,1080`,`--user-data-dir=${t}`,`--remote-debugging-port=${n}`,`--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36`,`about:blank`],{stdio:`ignore`}),i=`http://localhost:${n}`;return await _e(i,5e3)?{ok:!0,browser:{proc:r,userDataDir:t,base:i}}:(Y(r,t),{ok:!1,error:`CDP endpoint never came up`})}function Y(e,t){e.kill(),c(t,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}function ye(e){return typeof e==`object`&&!!e&&`result`in e&&typeof e.result==`object`&&e.result!==null&&`result`in e.result&&typeof e.result.result==`object`&&e.result.result!==null&&`value`in e.result.result&&typeof e.result.result.value==`string`}function be(e){if(typeof e!=`object`||!e||!(`title`in e)||typeof e.title!=`string`||`h1`in e&&e.h1!==null&&typeof e.h1!=`string`||!(`pogo`in e))return!1;if(e.pogo===null)return!0;if(typeof e.pogo!=`object`)return!1;let t=e.pogo;return!(`outage`in t&&t.outage!==void 0&&typeof t.outage!=`boolean`)}async function xe(e,t){await e(`Runtime.enable`);let n=Date.now()+t;for(;Date.now()<n;){let t=await e(`Runtime.evaluate`,{expression:`JSON.stringify({ title: document.title, pogo: window.PogoConfig ?? null, h1: document.querySelector("h1")?.innerText ?? null })`,returnByValue:!0});if(ye(t)){let e;try{e=JSON.parse(t.result.result.value)}catch{e=null}if(be(e)&&e.pogo!==null&&e.title!==`Just a moment...`)return{pogo:e.pogo,heading:e.h1}}await d(700)}return null}async function Se(){let e=ge();if(e===null)return{ok:!1,error:`no chromium/chrome binary found`};let t=await ve(e);if(!t.ok)return t;let{browser:{proc:n,userDataDir:r,base:i}}=t;try{let e=await he(i,w);if(!e.ok)return e;let t=await xe(e.send,2e4);return e.close(),t===null?{ok:!1,error:`CF challenge not cleared in time`}:t.pogo.outage===!0?{ok:!0,down:!0,reason:t.heading??`outage reported`}:{ok:!0,down:!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}finally{Y(n,r)}}function Ce(e){return e===`none`||e===`minor`||e===`major`||e===`critical`?e:`critical`}async function X(e){let t=await de(e);if(t.kind===`unknown`)return{source:`anthropic`,indicator:`unavailable`,summaryText:t.reason,incidents:null,affectedComponents:null};let n=Ce(t.summary.status.indicator),r=t.summary.components.filter(e=>e.status!==`operational`);return{source:`anthropic`,indicator:n,summaryText:t.summary.status.description,incidents:t.summary.incidents.length>0?t.summary.incidents.map(e=>({name:e.name,status:e.status})):null,affectedComponents:r.length>0?r.map(e=>({name:e.name,status:e.status})):null}}async function Z(){let e=await Se();return e.ok?{source:`downdetector`,indicator:e.down?`major`:`none`,summaryText:e.down?e.reason:null,reportsOutage:e.down}:{source:`downdetector`,indicator:`unavailable`,summaryText:e.error,reportsOutage:!1}}async function we(e,t){switch(e){case`anthropic`:return X(t);case`downdetector`:return Z()}}async function Q(e,t){return Promise.all(e.map(e=>we(e,t)))}function Te(e){return S[e.indicator]}function Ee(e){return e.reduce((e,t)=>Math.max(e,Te(t)),S.none)}function De(e){return[...e].sort((e,t)=>e.source.localeCompare(t.source))}function $(e,t,n){if(t){let t=Ee(e);t!==0&&r(t);return}L(De(e),n)}const Oe=t(`status`).description(`Check Claude status across Anthropic and Downdetector`).example(`status`,`Check all sources`).example(`status --source anthropic`,`Check only Anthropic`).example(`status --json`,`Emit machine-readable source rows`).flag(`anthropicStatusBase`,E).flag(`quiet`,T).flag(`source`,ae).action(async({flags:e,out:t})=>{$(await Q(e.source,e.anthropicStatusBase),e.quiet,t)}),ke=t(`anthropic`).description(`Check only ${x.anthropic}`).example(`anthropic`,`Check only ${x.anthropic}`).flag(`anthropicStatusBase`,E).flag(`quiet`,T).action(async({flags:e,out:t})=>{$([await X(e.anthropicStatusBase)],e.quiet,t)}),Ae=t(`downdetector`).description(`Check only ${x.downdetector}`).example(`downdetector`,`Check only ${x.downdetector}`).flag(`quiet`,T).action(async({flags:e,out:t})=>{$([await Z()],e.quiet,t)}),je=e(re).version(v).description(y).command(Oe).command(ke).command(Ae).completions();import.meta.main&&je.run({help:{width:i.columns}});export{};
7
+ `))}const B=`/api/v2`,we={components(){return`${B}/components.json`},Incidents:{all(){return`${B}/incidents.json`},unresolved(){return`${B}/incidents/unresolved.json`}},ScheduledMaintenances:{active(){return`${B}/scheduled-maintenances/upcoming.json`},all(){return`${B}/scheduled-maintenances.json`},upcoming(){return`${B}/scheduled-maintenances/upcoming.json`}},status(){return`${B}/status.json`},subscriber(e){return`${B}/subscribers/${encodeURIComponent(e)}.json`},subscribers(){return`${B}/subscribers.json`},summary(){return`${B}/summary.json`}};async function Te(e){try{let t=await e.text(),n=t.length>0?`: ${t}`:``;return`Request failed with status code ${e.status}${n}`}catch{let{status:t,statusText:n}=e;return`Request failed with status code ${t}: ${n}`}}async function Ee(e=w){try{let t=await fetch(new URL(we.summary(),e));if(!t.ok){let{headers:e}=t;return{headers:e,kind:`unknown`,reason:await Te(t)}}let n=await t.json();return{headers:t.headers,kind:`ok`,summary:n}}catch(e){return{kind:`unknown`,reason:e instanceof Error?e.message:String(e)}}}function De(e){return typeof e==`object`&&!!e&&`webSocketDebuggerUrl`in e&&typeof e.webSocketDebuggerUrl==`string`}function Oe(e){return typeof e==`object`&&!!e&&`id`in e&&typeof e.id==`number`}function ke(e){let t=new Map,n=0;return e.onmessage=e=>{let n=typeof e.data==`string`?e.data:e.data instanceof ArrayBuffer?new TextDecoder().decode(e.data):null;if(n===null)return;let r;try{r=JSON.parse(n)}catch{return}if(!Oe(r))return;let i=t.get(r.id);i!==void 0&&(t.delete(r.id),i(r))},(r,i={})=>new Promise((a,o)=>{let s=++n,c=setTimeout(()=>{t.delete(s),o(Error(`CDP command '${r}' timed out`))},5e3);t.set(s,e=>{clearTimeout(c),a(e)}),e.send(JSON.stringify({id:s,method:r,params:i}))})}async function Ae(e,t){let n=await(await fetch(`${e}/json/new?${encodeURIComponent(t)}`,{method:`PUT`})).json();if(!De(n))return{ok:!1,error:`unexpected CDP target shape`};let r=new WebSocket(n.webSocketDebuggerUrl);return await new Promise((e,t)=>{r.onopen=()=>e(),r.onerror=()=>t(Error(`WebSocket connection failed`)),r.onclose=()=>t(Error(`WebSocket closed before opening`))}),{ok:!0,send:ke(r),close:()=>r.close()}}function V(e,t){for(let n of t){let t=s(e,[n]);if(t.status===0&&t.stdout){let e=t.stdout.toString().split(/\r?\n/)[0]?.trim();if(e)return e}}return null}function H(e){for(let t of e)if(t&&c(t))return t;return null}function je(){let e=[];for(let t of fe){let n=process.env[t];if(n)for(let t of de)e.push(re.join(n,...t))}return e}function Me(e){let t=e??process.env.CLAUDE_DOWN_CHROME;return t?c(t)?t:null:process.platform===`win32`?V(`where.exe`,ue)??H(je()):process.platform===`darwin`?V(`which`,E)??H(pe):V(`which`,E)}async function Ne(e,t){let n=Date.now()+t;for(;Date.now()<n;){try{if((await fetch(`${e}/json/version`)).ok)return!0}catch{}await u(100)}return!1}async function Pe(e){let t;try{t=ee(ne(te(),`claude-down-`))}catch(e){return{ok:!1,error:`mkdtemp failed: ${e instanceof Error?e.message:String(e)}`}}let n=9222+Math.floor(Math.random()*1e3),r=o(e,[`--headless=new`,`--disable-gpu`,`--no-sandbox`,`--disable-blink-features=AutomationControlled`,`--window-size=1920,1080`,`--user-data-dir=${t}`,`--remote-debugging-port=${n}`,`--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36`,`about:blank`],{stdio:`ignore`}),i=`http://localhost:${n}`;return await Ne(i,5e3)?{ok:!0,browser:{proc:r,userDataDir:t,base:i}}:(U(r,t),{ok:!1,error:`CDP endpoint never came up`})}function U(e,t){process.platform===`win32`&&e.pid!==void 0?s(`taskkill`,[`/pid`,String(e.pid),`/t`,`/f`]):e.kill();try{l(t,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}catch{}}function Fe(e){return typeof e==`object`&&!!e&&`result`in e&&typeof e.result==`object`&&e.result!==null&&`result`in e.result&&typeof e.result.result==`object`&&e.result.result!==null&&`value`in e.result.result&&typeof e.result.result.value==`string`}function Ie(e){if(typeof e!=`object`||!e||!(`title`in e)||typeof e.title!=`string`||`h1`in e&&e.h1!==null&&typeof e.h1!=`string`||!(`pogo`in e))return!1;let{pogo:t}=e;return t===null?!0:!(typeof t!=`object`||`outage`in t&&t.outage!==void 0&&typeof t.outage!=`boolean`)}async function Le(e,t){await e(`Runtime.enable`);let n=Date.now()+t;for(;Date.now()<n;){let t=await e(`Runtime.evaluate`,{expression:`JSON.stringify({
8
+ title: document.title,
9
+ pogo: window.PogoConfig ?? null,
10
+ h1: document.querySelector('h1')?.innerText ?? null,
11
+ })`,returnByValue:!0});if(Fe(t)){let e;try{e=JSON.parse(t.result.result.value)}catch{e=null}if(Ie(e)&&e.pogo!==null&&e.title!==`Just a moment...`)return{pogo:e.pogo,heading:e.h1}}await u(700)}return null}async function Re(e){let t=Me(e);if(t===null)return{ok:!1,error:`no Chrome/Chromium found; set CLAUDE_DOWN_CHROME or pass --chrome <path>`};let n=await Pe(t);if(!n.ok)return n;let{browser:{proc:r,userDataDir:i,base:a}}=n;try{let e=await Ae(a,T);if(!e.ok)return e;let t=await Le(e.send,2e4);return e.close(),t===null?{ok:!1,error:`CF challenge not cleared in time`}:t.pogo.outage===!0?{ok:!0,down:!0,reason:t.heading??`outage reported`}:{ok:!0,down:!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}finally{U(r,i)}}var W=g((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Endpoint=void 0,e.Endpoint={ACTIVE_JSON:`upcoming.json`,API_V2_BASE:`api/v2`,components(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.COMPONENTS_JSON}`},COMPONENTS_JSON:`components.json`,INCIDENTS:`incidents`,Incidents:{all(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.INCIDENTS_JSON}`},unresolved(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.INCIDENTS}/${e.Endpoint.UNRESOLVED_JSON}`}},INCIDENTS_JSON:`incidents.json`,SCHEDULED_MAINTENANCES:`scheduled-maintenances`,SCHEDULED_MAINTENANCES_JSON:`scheduled-maintenances.json`,ScheduledMaintenances:{active(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES}/${e.Endpoint.ACTIVE_JSON}`},all(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES_JSON}`},upcoming(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES}/${e.Endpoint.UPCOMING_JSON}`}},status(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.STATUS_JSON}`},STATUS_JSON:`status.json`,subscriber(t){return`/${e.Endpoint.API_V2_BASE}/subscribers/${encodeURIComponent(t)}.json`},subscribers(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SUBSCRIBERS_JSON}`},SUBSCRIBERS_JSON:`subscribers.json`,summary(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SUMMARY_JSON}`},SUMMARY_JSON:`summary.json`,UNRESOLVED_JSON:`unresolved.json`,UPCOMING_JSON:`upcoming.json`}})),ze=g((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.IncidentsAPI=void 0;let n=W();e.IncidentsAPI=class{constructor(e){this.apiClient=e}getAll(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.Incidents.all(),{data:t}=yield this.apiClient.get(e);return t})}getUnresolved(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.Incidents.unresolved(),{data:t}=yield this.apiClient.get(e);return t})}}})),Be=g((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.ScheduledMaintenancesAPI=void 0;let n=W();e.ScheduledMaintenancesAPI=class{constructor(e){this.apiClient=e}getActive(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.active(),{data:t}=yield this.apiClient.get(e);return t})}getAll(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.all(),{data:t}=yield this.apiClient.get(e);return t})}getUpcoming(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.upcoming(),{data:t}=yield this.apiClient.get(e);return t})}}})),Ve=g((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.SubscribersAPI=void 0;let n=W();e.SubscribersAPI=class{constructor(e){this.apiClient=e}createComponentSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}createIncidentSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}createPageSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}getSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.get(t,{params:{subscriber:{id:e}}});return r})}removeSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscriber(e),{data:r}=yield this.apiClient.delete(t);return r})}}})),G=g((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(ze(),e),n(Be(),e),n(Ve(),e)})),He=g((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),Ue=g((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),We=g((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MaintenanceStatus=e.IncidentStatus=e.IncidentImpact=void 0;var t;(function(e){e.Critical=`critical`,e.Major=`major`,e.Minor=`minor`,e.None=`none`})(t||(e.IncidentImpact=t={}));var n;(function(e){e.Identified=`identified`,e.Investigating=`investigating`,e.Monitoring=`monitoring`,e.Postmortem=`postmortem`,e.Resolved=`resolved`})(n||(e.IncidentStatus=n={}));var r;(function(e){e.Completed=`completed`,e.InProgress=`in_progress`,e.Scheduled=`scheduled`,e.Verifying=`verifying`})(r||(e.MaintenanceStatus=r={}))})),Ge=g((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(He(),e),n(Ue(),e),n(We(),e)})),K,Ke=h((()=>{K=class{constructor(e,t){this.baseUrl=e,this.config=t,this.interceptors={request:[],response:[]}}async delete(e,t){let n=await this.request(e,{...t,method:`DELETE`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async get(e,t){let n=await this.request(e,{...t,method:`GET`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async head(e,t){let n=await this.request(e,{...t,method:`HEAD`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async options(e,t){let n=await this.request(e,{...t,method:`OPTIONS`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async patch(e,t,n){let r=await this.request(e,{...n,data:t,method:`PATCH`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async post(e,t,n){let r=await this.request(e,{data:t,...n,method:`POST`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async put(e,t,n){let r=await this.request(e,{data:t,...n,method:`PUT`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async request(e,t){let n=new URL(e,this.baseUrl);if(t.params)for(let[e,r]of Object.entries(t.params))r!=null&&n.searchParams.append(e,String(r));let r={method:t.method.toUpperCase(),url:n,...this.config};if(t.headers&&(r.headers={...r.headers,...t.headers}),this.config?.auth){let{password:e,username:t}=this.config.auth,n=btoa(`${t}:${e}`);r.headers={...r.headers,Authorization:`Basic ${n}`}}if(t.data&&(t.data instanceof Object&&(r.headers={...r.headers,"Content-Type":`application/json`},t.data=JSON.stringify(t.data)),r.body=t.data),this.interceptors.request.length>0)for(let e of this.interceptors.request)r={...r,...await e({...r,url:n})};n=r.url;let i=await fetch(n,r);if(!i.ok){let e;try{e=await i.text()}catch{e=i.statusText}throw Error(e?`Request failed with status code ${i.status}: ${e}`:`Request failed with status code ${i.status}`)}if(this.interceptors.response.length>0)for(let e of this.interceptors.response)await e(i);return i}setBaseURL(e){this.baseUrl=e}setConfig(e){this.config=e}formatData(e,t){switch(t?.responseType||`json`){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`text`:return e.text();default:return e.json()}}}})),qe=h((()=>{})),Je=ae({APIClient:()=>K}),Ye=h((()=>{Ke(),qe()})),Xe=g((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.Statuspage=void 0;let n=(Ye(),se(Je)),r=G(),i=W();e.Statuspage=class{constructor(e){if(this.getComponents=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.components(),{data:t}=yield this.apiClient.get(e);return t}),this.getStatus=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.status(),{data:t}=yield this.apiClient.get(e);return t}),this.getSummary=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.summary(),{data:t}=yield this.apiClient.get(e);return t}),!e)throw Error(`A page ID needs to be set in order to use the client.`);this.apiClient=new n.APIClient(`https://${e}.statuspage.io`),this.api={getComponents:this.getComponents,getStatus:this.getStatus,getSummary:this.getSummary,incidents:new r.IncidentsAPI(this.apiClient),scheduledMaintenances:new r.ScheduledMaintenancesAPI(this.apiClient),subscribers:new r.SubscribersAPI(this.apiClient)}}setApiUrl(e){this.apiClient.setBaseURL(e)}}})),q=g((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(G(),e),n(Ge(),e),n(Xe(),e)}))();const Ze=new Set(Object.values(q.IncidentImpact));function Qe(e){return Ze.has(e)}function $e(e){return Qe(e)?e:q.IncidentImpact.Critical}function et(e){return e===`operational`||e===`degraded_performance`||e===`partial_outage`||e===`major_outage`||e===`under_maintenance`?e:`major_outage`}async function J(e){let t=await Ee(e);if(t.kind===`unknown`)return{source:`anthropic`,indicator:`unavailable`,summaryText:t.reason,incidents:null,affectedComponents:null};let n=$e(t.summary.status.indicator),r=t.summary.components.filter(e=>e.status!==`operational`);return{source:`anthropic`,indicator:n,summaryText:t.summary.status.description,incidents:t.summary.incidents.length>0?t.summary.incidents.map(e=>({name:e.name,status:e.status})):null,affectedComponents:r.length>0?r.map(e=>({name:e.name,status:et(e.status)})):null}}async function Y(e){let t=await Re(e);return t.ok?{source:`downdetector`,indicator:t.down?`major`:`none`,summaryText:t.down?t.reason:null,reportsOutage:t.down}:{source:`downdetector`,indicator:`unavailable`,summaryText:t.error,reportsOutage:!1}}async function X(e,t,n){switch(e){case`anthropic`:return J(t);case`downdetector`:return Y(n)}}async function tt(e,t,n){return Promise.all(e.map(e=>X(e,t,n)))}function nt(e,t){if(e.source!==`anthropic`||t.size===0||e.indicator===`unavailable`)return e;let n=e.incidents?.filter(e=>S(e.name,t))??[],r=e.affectedComponents?.filter(e=>S(e.name,t))??[],i=n.length+r.length,a=[...t].filter(e=>n.some(t=>t.name.toLowerCase().includes(e))||r.some(t=>t.name.toLowerCase().includes(e)));return{source:`anthropic`,indicator:i>0?`major`:`none`,summaryText:i>0?`${i} report${i===1?``:`s`} affecting ${a.join(`, `)}`:`No incidents reported for ${[...t].join(`, `)}`,incidents:n.length>0?n:null,affectedComponents:r.length>0?r:null}}function rt(e){let t=C[e.indicator];return e.source===`anthropic`&&e.incidents&&e.incidents.length>0?Math.max(t,C.minor):t}function it(e){let t=e.filter(e=>e.indicator!==`unavailable`);return t.length===0?e.length===0?C.none:C.unavailable:t.reduce((e,t)=>Math.max(e,rt(t)),C.none)}function at(e){return[...e].sort((e,t)=>e.source.localeCompare(t.source))}function Z(e,t,n){t||Ce(at(e),n),i.exitCode=it(e)}function Q(e,t){return t.size===0?e:e.map(e=>nt(e,t))}const ot=n(`status`).description(`Check Claude status across Anthropic and Downdetector`).example(`status`,`Check all sources`).example(`status --source anthropic`,`Check only Anthropic`).example(`status --opus`,`Only report incidents mentioning Opus`).example(`status --json`,`Emit machine-readable source rows`).flag(`anthropicStatusBase`,k).flag(`chrome`,A).flag(`quiet`,O).flag(`source`,ge).flag(`model`,j).flag(`opus`,M.opus).flag(`haiku`,M.haiku).flag(`sonnet`,M.sonnet).flag(`mythos`,M.mythos).flag(`fable`,M.fable).action(async({flags:e,out:t})=>{let{source:n,anthropicStatusBase:r,chrome:i,quiet:a}=e;Z(Q(await tt(P(n),r,i),N(e)),a,t)}),st=n(`anthropic`).description(`Check only ${b.anthropic}`).example(`anthropic`,`Check only ${b.anthropic}`).example(`anthropic --model opus`,`Only report incidents mentioning Opus`).flag(`anthropicStatusBase`,k).flag(`quiet`,O).flag(`model`,j).flag(`opus`,M.opus).flag(`haiku`,M.haiku).flag(`sonnet`,M.sonnet).flag(`mythos`,M.mythos).flag(`fable`,M.fable).action(async({flags:e,out:t})=>{Z(Q([await J(e.anthropicStatusBase)],N(e)),e.quiet,t)}),ct=n(`downdetector`).description(`Check only ${b.downdetector}`).example(`downdetector`,`Check only ${b.downdetector}`).flag(`chrome`,A).flag(`quiet`,O).action(async({flags:e,out:t})=>{Z([await Y(e.chrome)],e.quiet,t)}),$=v.url.replace(/^git\+/,``).replace(/\.git$/,``),lt=t(ce).version(_).description(le).links({name:$,version:`${$}/releases/tag/v${_}`}).default(ot).command(st).command(ct).completions();if(import.meta.main){let e=d();lt.run({help:{width:a.columns},adapter:{...e,exit:t=>e.exit(t===0?Number(i.exitCode??0):t)}})}export{};
@@ -87,21 +87,43 @@ interface Status extends Page {
87
87
  type Summary = Components & Incidents & ScheduledMaintenances & Status;
88
88
  //#endregion
89
89
  //#region src/lib/types.d.ts
90
- /** The result of a status check, which can either be a successful summary or an unknown state with a reason. */
90
+ /** String values of `statuspage.io`'s {@linkcode IncidentImpact} enum. */
91
+ type IncidentImpactValue = `${IncidentImpact}`;
92
+ /** String values of `statuspage.io`'s {@linkcode IncidentStatus} enum. */
93
+ type IncidentStatusValue = `${IncidentStatus}`;
94
+ /** Status for the state of a service.
95
+ * - `'unavailable'` when a source can't be reached. */
96
+ /** The closed set of component statuses `statuspage.io` emits.
97
+ *
98
+ * Hand-rolled because upstream types {@linkcode Component["status"]} as `string`. */
99
+ type ComponentStatus = 'operational' | 'degraded_performance' | 'partial_outage' | 'major_outage' | 'under_maintenance' | Component['status'];
100
+ /** A signal represents the outcome of a status check. */
101
+ /** The result of a status check. */
91
102
  type Result = {
92
- kind: 'ok';
103
+ /** Headers from the response, included when available for debugging purposes. */headers: Headers;
104
+ /** A discriminant property that indicates the type of result.
105
+ * - `'ok'` for a successful summary. */
106
+ kind: 'ok'; /** The summary of the status page, included when the result is 'ok'. @see {@linkcode Summary} */
93
107
  summary: Summary;
94
108
  } | {
95
- kind: 'unknown';
109
+ /** Headers from the response, included when available for debugging purposes. */headers?: Headers;
110
+ /** A discriminant property that indicates the type of result.
111
+ * - `'unknown'` for an unknown state. */
112
+ kind: 'unknown'; /** The reason for the unknown state. */
96
113
  reason: string;
97
114
  };
98
115
  //#endregion
99
116
  //#region src/lib/anthropic.d.ts
100
117
  /** Checks the status of Anthropic's services by querying their Statuspage API.
101
118
  *
102
- * @param baseUrl - Optional base URL for the Anthropic Statuspage API. Defaults to a predefined constant.
119
+ * @param baseUrl - Optional base URL for the Anthropic Statuspage API.
103
120
  * @returns A promise that resolves to a Result object containing either the summary of the status or an error reason.
104
121
  */
105
- declare function check(baseUrl?: string): Promise<Result>;
122
+ declare function check(baseUrl?: string | URL): Promise<Result>;
123
+ //#endregion
124
+ //#region src/browser.d.ts
125
+ declare const _default: {
126
+ checkAnthropic: typeof check;
127
+ };
106
128
  //#endregion
107
- export { type Result, type Summary, check as checkAnthropic };
129
+ export { type Component, type ComponentStatus, type Incident, type IncidentImpactValue, type IncidentStatusValue, type Result, type Summary, check as checkAnthropic, _default as default };
@@ -1 +1 @@
1
- var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t)=>()=>(e&&(t=e(e=0)),t),a=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),o=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},s=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},c=t=>r.call(t,`module.exports`)?t[`module.exports`]:s(e({},`__esModule`,{value:!0}),t),l=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Endpoint=void 0,e.Endpoint={ACTIVE_JSON:`upcoming.json`,API_V2_BASE:`api/v2`,components(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.COMPONENTS_JSON}`},COMPONENTS_JSON:`components.json`,INCIDENTS:`incidents`,Incidents:{all(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.INCIDENTS_JSON}`},unresolved(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.INCIDENTS}/${e.Endpoint.UNRESOLVED_JSON}`}},INCIDENTS_JSON:`incidents.json`,SCHEDULED_MAINTENANCES:`scheduled-maintenances`,SCHEDULED_MAINTENANCES_JSON:`scheduled-maintenances.json`,ScheduledMaintenances:{active(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES}/${e.Endpoint.ACTIVE_JSON}`},all(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES_JSON}`},upcoming(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES}/${e.Endpoint.UPCOMING_JSON}`}},status(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.STATUS_JSON}`},STATUS_JSON:`status.json`,subscriber(t){return`/${e.Endpoint.API_V2_BASE}/subscribers/${encodeURIComponent(t)}.json`},subscribers(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SUBSCRIBERS_JSON}`},SUBSCRIBERS_JSON:`subscribers.json`,summary(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SUMMARY_JSON}`},SUMMARY_JSON:`summary.json`,UNRESOLVED_JSON:`unresolved.json`,UPCOMING_JSON:`upcoming.json`}})),u=a((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.IncidentsAPI=void 0;let n=l();e.IncidentsAPI=class{constructor(e){this.apiClient=e}getAll(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.Incidents.all(),{data:t}=yield this.apiClient.get(e);return t})}getUnresolved(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.Incidents.unresolved(),{data:t}=yield this.apiClient.get(e);return t})}}})),d=a((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.ScheduledMaintenancesAPI=void 0;let n=l();e.ScheduledMaintenancesAPI=class{constructor(e){this.apiClient=e}getActive(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.active(),{data:t}=yield this.apiClient.get(e);return t})}getAll(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.all(),{data:t}=yield this.apiClient.get(e);return t})}getUpcoming(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.upcoming(),{data:t}=yield this.apiClient.get(e);return t})}}})),f=a((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.SubscribersAPI=void 0;let n=l();e.SubscribersAPI=class{constructor(e){this.apiClient=e}createComponentSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}createIncidentSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}createPageSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}getSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.get(t,{params:{subscriber:{id:e}}});return r})}removeSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscriber(e),{data:r}=yield this.apiClient.delete(t);return r})}}})),p=a((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(u(),e),n(d(),e),n(f(),e)})),m=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),h=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),g=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MaintenanceStatus=e.IncidentStatus=e.IncidentImpact=void 0;var t;(function(e){e.Critical=`critical`,e.Major=`major`,e.Minor=`minor`,e.None=`none`})(t||(e.IncidentImpact=t={}));var n;(function(e){e.Identified=`identified`,e.Investigating=`investigating`,e.Monitoring=`monitoring`,e.Postmortem=`postmortem`,e.Resolved=`resolved`})(n||(e.IncidentStatus=n={}));var r;(function(e){e.Completed=`completed`,e.InProgress=`in_progress`,e.Scheduled=`scheduled`,e.Verifying=`verifying`})(r||(e.MaintenanceStatus=r={}))})),_=a((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(m(),e),n(h(),e),n(g(),e)})),v,y=i((()=>{v=class{constructor(e,t){this.baseUrl=e,this.config=t,this.interceptors={request:[],response:[]}}async delete(e,t){let n=await this.request(e,{...t,method:`DELETE`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async get(e,t){let n=await this.request(e,{...t,method:`GET`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async head(e,t){let n=await this.request(e,{...t,method:`HEAD`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async options(e,t){let n=await this.request(e,{...t,method:`OPTIONS`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async patch(e,t,n){let r=await this.request(e,{...n,data:t,method:`PATCH`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async post(e,t,n){let r=await this.request(e,{data:t,...n,method:`POST`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async put(e,t,n){let r=await this.request(e,{data:t,...n,method:`PUT`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async request(e,t){let n=new URL(e,this.baseUrl);if(t.params)for(let[e,r]of Object.entries(t.params))r!=null&&n.searchParams.append(e,String(r));let r={method:t.method.toUpperCase(),url:n,...this.config};if(t.headers&&(r.headers={...r.headers,...t.headers}),this.config?.auth){let{password:e,username:t}=this.config.auth,n=btoa(`${t}:${e}`);r.headers={...r.headers,Authorization:`Basic ${n}`}}if(t.data&&(t.data instanceof Object&&(r.headers={...r.headers,"Content-Type":`application/json`},t.data=JSON.stringify(t.data)),r.body=t.data),this.interceptors.request.length>0)for(let e of this.interceptors.request)r={...r,...await e({...r,url:n})};n=r.url;let i=await fetch(n,r);if(!i.ok){let e;try{e=await i.text()}catch{e=i.statusText}throw Error(e?`Request failed with status code ${i.status}: ${e}`:`Request failed with status code ${i.status}`)}if(this.interceptors.response.length>0)for(let e of this.interceptors.response)await e(i);return i}setBaseURL(e){this.baseUrl=e}setConfig(e){this.config=e}formatData(e,t){switch(t?.responseType||`json`){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`text`:return e.text();default:return e.json()}}}})),b=i((()=>{})),x=o({APIClient:()=>v}),S=i((()=>{y(),b()})),C=a((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.Statuspage=void 0;let n=(S(),c(x)),r=p(),i=l();e.Statuspage=class{constructor(e){if(this.getComponents=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.components(),{data:t}=yield this.apiClient.get(e);return t}),this.getStatus=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.status(),{data:t}=yield this.apiClient.get(e);return t}),this.getSummary=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.summary(),{data:t}=yield this.apiClient.get(e);return t}),!e)throw Error(`A page ID needs to be set in order to use the client.`);this.apiClient=new n.APIClient(`https://${e}.statuspage.io`),this.api={getComponents:this.getComponents,getStatus:this.getStatus,getSummary:this.getSummary,incidents:new r.IncidentsAPI(this.apiClient),scheduledMaintenances:new r.ScheduledMaintenancesAPI(this.apiClient),subscribers:new r.SubscribersAPI(this.apiClient)}}setApiUrl(e){this.apiClient.setBaseURL(e)}}})),w=a((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(p(),e),n(_(),e),n(C(),e)}))();async function T(e=`https://status.claude.com`){try{let t=new w.Statuspage(`anthropic`);return t.setApiUrl(e),{kind:`ok`,summary:await t.api.getSummary()}}catch(e){return{kind:`unknown`,reason:e instanceof Error?e.message:String(e)}}}export{T as checkAnthropic};
1
+ const e=`/api/v2`,t={components(){return`${e}/components.json`},Incidents:{all(){return`${e}/incidents.json`},unresolved(){return`${e}/incidents/unresolved.json`}},ScheduledMaintenances:{active(){return`${e}/scheduled-maintenances/upcoming.json`},all(){return`${e}/scheduled-maintenances.json`},upcoming(){return`${e}/scheduled-maintenances/upcoming.json`}},status(){return`${e}/status.json`},subscriber(t){return`${e}/subscribers/${encodeURIComponent(t)}.json`},subscribers(){return`${e}/subscribers.json`},summary(){return`${e}/summary.json`}};async function n(e){try{let t=await e.text(),n=t.length>0?`: ${t}`:``;return`Request failed with status code ${e.status}${n}`}catch{let{status:t,statusText:n}=e;return`Request failed with status code ${t}: ${n}`}}async function r(e=`https://status.claude.com`){try{let r=await fetch(new URL(t.summary(),e));if(!r.ok){let{headers:e}=r;return{headers:e,kind:`unknown`,reason:await n(r)}}let i=await r.json();return{headers:r.headers,kind:`ok`,summary:i}}catch(e){return{kind:`unknown`,reason:e instanceof Error?e.message:String(e)}}}var i={checkAnthropic:r};export{r as checkAnthropic,i as default};
package/dist/index.d.mts CHANGED
@@ -1,5 +1,175 @@
1
- import { i as EXIT_CODES } from "./constants-CY8aOEl6.mjs";
2
- import { a as Summary, i as Signal, n as Indicator, r as Result, t as AvailableIndicator } from "./types-4oEMjqAH.mjs";
3
- import { checkAnthropic as check } from "./anthropic.mjs";
4
- import { checkDownDetector as check$1 } from "./downdetector.mjs";
5
- export { type AvailableIndicator, EXIT_CODES, type Indicator, type Result, type Signal, type Summary, check as checkAnthropic, check$1 as checkDownDetector };
1
+ //#region node_modules/statuspage.io/dist/interfaces/Result.d.ts
2
+ declare enum IncidentImpact {
3
+ Critical = "critical",
4
+ Major = "major",
5
+ Minor = "minor",
6
+ None = "none"
7
+ }
8
+ declare enum IncidentStatus {
9
+ Identified = "identified",
10
+ Investigating = "investigating",
11
+ Monitoring = "monitoring",
12
+ Postmortem = "postmortem",
13
+ Resolved = "resolved"
14
+ }
15
+ declare enum MaintenanceStatus {
16
+ Completed = "completed",
17
+ InProgress = "in_progress",
18
+ Scheduled = "scheduled",
19
+ Verifying = "verifying"
20
+ }
21
+ interface Component {
22
+ created_at: string;
23
+ description: null | string;
24
+ group: boolean;
25
+ group_id: null | string;
26
+ id: string;
27
+ name: string;
28
+ only_show_if_degraded: boolean;
29
+ page_id: string;
30
+ position: number;
31
+ showcase: boolean;
32
+ start_date: null | string;
33
+ status: string;
34
+ updated_at: string;
35
+ }
36
+ interface Components extends Page {
37
+ components: Component[];
38
+ }
39
+ interface Incident {
40
+ created_at: string;
41
+ id: string;
42
+ impact: IncidentImpact;
43
+ incident_updates: IncidentUpdate[];
44
+ monitoring_at: null | string;
45
+ name: string;
46
+ page_id: string;
47
+ resolved_at: null | string;
48
+ shortlink: string;
49
+ status: IncidentStatus;
50
+ updated_at: string;
51
+ }
52
+ interface Incidents extends Page {
53
+ incidents: Incident[];
54
+ }
55
+ interface IncidentUpdate {
56
+ body: string;
57
+ created_at: string;
58
+ display_at: string;
59
+ id: string;
60
+ incident_id: string;
61
+ status: IncidentStatus;
62
+ updated_at: string;
63
+ }
64
+ interface Page {
65
+ page: {
66
+ id: string;
67
+ name: string;
68
+ time_zone: string;
69
+ updated_at: string;
70
+ url: string;
71
+ };
72
+ }
73
+ type ScheduledMaintenance = {
74
+ scheduled_for: string;
75
+ scheduled_until: string;
76
+ status: MaintenanceStatus;
77
+ } & Omit<Incident, 'status'>;
78
+ interface ScheduledMaintenances extends Page {
79
+ scheduled_maintenances: ScheduledMaintenance[];
80
+ }
81
+ interface Status extends Page {
82
+ status: {
83
+ description: string;
84
+ indicator: string;
85
+ };
86
+ }
87
+ type Summary = Components & Incidents & ScheduledMaintenances & Status;
88
+ //#endregion
89
+ //#region src/lib/types.d.ts
90
+ /** String values of `statuspage.io`'s {@linkcode IncidentImpact} enum. */
91
+ type IncidentImpactValue = `${IncidentImpact}`;
92
+ /** String values of `statuspage.io`'s {@linkcode IncidentStatus} enum. */
93
+ type IncidentStatusValue = `${IncidentStatus}`;
94
+ /** Status for the state of a service.
95
+ * - `'unavailable'` when a source can't be reached. */
96
+ type Indicator = IncidentImpactValue | 'unavailable';
97
+ /** The closed set of component statuses `statuspage.io` emits.
98
+ *
99
+ * Hand-rolled because upstream types {@linkcode Component["status"]} as `string`. */
100
+ type ComponentStatus = 'operational' | 'degraded_performance' | 'partial_outage' | 'major_outage' | 'under_maintenance' | Component['status'];
101
+ /** A signal represents the outcome of a status check. */
102
+ type Signal = {
103
+ /** The check was successful. */ok: true; /** The service is down. */
104
+ down: true; /** The reason for the downtime. */
105
+ reason: string;
106
+ } | {
107
+ /** The check was successful. */ok: true; /** The service is up. */
108
+ down: false;
109
+ } | {
110
+ /** The check failed. */ok: false; /** The reason for the failure. */
111
+ error: string;
112
+ };
113
+ /** The result of a status check. */
114
+ type Result = {
115
+ /** Headers from the response, included when available for debugging purposes. */headers: Headers;
116
+ /** A discriminant property that indicates the type of result.
117
+ * - `'ok'` for a successful summary. */
118
+ kind: 'ok'; /** The summary of the status page, included when the result is 'ok'. @see {@linkcode Summary} */
119
+ summary: Summary;
120
+ } | {
121
+ /** Headers from the response, included when available for debugging purposes. */headers?: Headers;
122
+ /** A discriminant property that indicates the type of result.
123
+ * - `'unknown'` for an unknown state. */
124
+ kind: 'unknown'; /** The reason for the unknown state. */
125
+ reason: string;
126
+ };
127
+ //#endregion
128
+ //#region src/lib/anthropic.d.ts
129
+ /** Checks the status of Anthropic's services by querying their Statuspage API.
130
+ *
131
+ * @param baseUrl - Optional base URL for the Anthropic Statuspage API.
132
+ * @returns A promise that resolves to a Result object containing either the summary of the status or an error reason.
133
+ */
134
+ declare function check(baseUrl?: string | URL): Promise<Result>;
135
+ //#endregion
136
+ //#region src/lib/constants.d.ts
137
+ /** Mapping of status levels to their corresponding exit codes. */
138
+ declare const EXIT_CODES: {
139
+ readonly none: 0;
140
+ readonly minor: 1;
141
+ readonly major: 2;
142
+ readonly critical: 2;
143
+ readonly unavailable: 21;
144
+ };
145
+ /** Base URL for Anthropic's status page API. */
146
+ //#endregion
147
+ //#region src/lib/downdetector.d.ts
148
+ /** Checks the status of Claude AI on Downdetector.
149
+ *
150
+ * Launches a headless Chromium browser, navigates to the Downdetector status
151
+ * page for Claude AI, and polls for the presence of a "Pogo Snapshot" element
152
+ * that indicates whether there is an outage.
153
+ *
154
+ * If an outage is detected, it extracts the reason from the page.
155
+ *
156
+ * @param chromePath Optional explicit Chrome/Chromium binary to use.
157
+ * @returns A promise of {@linkcode Signal}.
158
+ * @see {@link https://downdetector.com/status/claude-ai/} for the target page.
159
+ */
160
+ declare function check$1(chromePath?: string): Promise<Signal>;
161
+ //#endregion
162
+ //#region src/index.d.ts
163
+ declare const claudeDown: {
164
+ checkAnthropic: typeof check;
165
+ checkDownDetector: typeof check$1;
166
+ EXIT_CODES: {
167
+ readonly none: 0;
168
+ readonly minor: 1;
169
+ readonly major: 2;
170
+ readonly critical: 2;
171
+ readonly unavailable: 21;
172
+ };
173
+ };
174
+ //#endregion
175
+ export { type Component, type ComponentStatus, EXIT_CODES, type Incident, type IncidentImpactValue, type IncidentStatusValue, type Indicator, type Result, type Signal, type Summary, check as checkAnthropic, check$1 as checkDownDetector, claudeDown as default };
package/dist/index.mjs CHANGED
@@ -1 +1,5 @@
1
- import{spawn as e,spawnSync as t}from"node:child_process";import{mkdtempSync as n,rmSync as r}from"node:fs";import{tmpdir as i}from"node:os";import{join as a}from"node:path";import{setTimeout as o}from"node:timers/promises";var s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.prototype.hasOwnProperty,d=(e,t)=>()=>(e&&(t=e(e=0)),t),f=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),p=(e,t)=>{let n={};for(var r in e)s(n,r,{get:e[r],enumerable:!0});return t||s(n,Symbol.toStringTag,{value:`Module`}),n},m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,d;a<o;a++)d=i[a],!u.call(e,d)&&d!==n&&s(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=c(t,d))||r.enumerable});return e},h=e=>u.call(e,`module.exports`)?e[`module.exports`]:m(s({},`__esModule`,{value:!0}),e),g=f((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Endpoint=void 0,e.Endpoint={ACTIVE_JSON:`upcoming.json`,API_V2_BASE:`api/v2`,components(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.COMPONENTS_JSON}`},COMPONENTS_JSON:`components.json`,INCIDENTS:`incidents`,Incidents:{all(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.INCIDENTS_JSON}`},unresolved(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.INCIDENTS}/${e.Endpoint.UNRESOLVED_JSON}`}},INCIDENTS_JSON:`incidents.json`,SCHEDULED_MAINTENANCES:`scheduled-maintenances`,SCHEDULED_MAINTENANCES_JSON:`scheduled-maintenances.json`,ScheduledMaintenances:{active(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES}/${e.Endpoint.ACTIVE_JSON}`},all(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES_JSON}`},upcoming(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SCHEDULED_MAINTENANCES}/${e.Endpoint.UPCOMING_JSON}`}},status(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.STATUS_JSON}`},STATUS_JSON:`status.json`,subscriber(t){return`/${e.Endpoint.API_V2_BASE}/subscribers/${encodeURIComponent(t)}.json`},subscribers(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SUBSCRIBERS_JSON}`},SUBSCRIBERS_JSON:`subscribers.json`,summary(){return`/${e.Endpoint.API_V2_BASE}/${e.Endpoint.SUMMARY_JSON}`},SUMMARY_JSON:`summary.json`,UNRESOLVED_JSON:`unresolved.json`,UPCOMING_JSON:`upcoming.json`}})),_=f((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.IncidentsAPI=void 0;let n=g();e.IncidentsAPI=class{constructor(e){this.apiClient=e}getAll(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.Incidents.all(),{data:t}=yield this.apiClient.get(e);return t})}getUnresolved(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.Incidents.unresolved(),{data:t}=yield this.apiClient.get(e);return t})}}})),v=f((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.ScheduledMaintenancesAPI=void 0;let n=g();e.ScheduledMaintenancesAPI=class{constructor(e){this.apiClient=e}getActive(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.active(),{data:t}=yield this.apiClient.get(e);return t})}getAll(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.all(),{data:t}=yield this.apiClient.get(e);return t})}getUpcoming(){return t(this,void 0,void 0,function*(){let e=n.Endpoint.ScheduledMaintenances.upcoming(),{data:t}=yield this.apiClient.get(e);return t})}}})),y=f((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.SubscribersAPI=void 0;let n=g();e.SubscribersAPI=class{constructor(e){this.apiClient=e}createComponentSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}createIncidentSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}createPageSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.post(t,{subscriber:e});return r})}getSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscribers(),{data:r}=yield this.apiClient.get(t,{params:{subscriber:{id:e}}});return r})}removeSubscription(e){return t(this,void 0,void 0,function*(){let t=n.Endpoint.subscriber(e),{data:r}=yield this.apiClient.delete(t);return r})}}})),b=f((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(_(),e),n(v(),e),n(y(),e)})),x=f((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),S=f((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),C=f((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MaintenanceStatus=e.IncidentStatus=e.IncidentImpact=void 0;var t;(function(e){e.Critical=`critical`,e.Major=`major`,e.Minor=`minor`,e.None=`none`})(t||(e.IncidentImpact=t={}));var n;(function(e){e.Identified=`identified`,e.Investigating=`investigating`,e.Monitoring=`monitoring`,e.Postmortem=`postmortem`,e.Resolved=`resolved`})(n||(e.IncidentStatus=n={}));var r;(function(e){e.Completed=`completed`,e.InProgress=`in_progress`,e.Scheduled=`scheduled`,e.Verifying=`verifying`})(r||(e.MaintenanceStatus=r={}))})),w=f((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(x(),e),n(S(),e),n(C(),e)})),T,E=d((()=>{T=class{constructor(e,t){this.baseUrl=e,this.config=t,this.interceptors={request:[],response:[]}}async delete(e,t){let n=await this.request(e,{...t,method:`DELETE`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async get(e,t){let n=await this.request(e,{...t,method:`GET`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async head(e,t){let n=await this.request(e,{...t,method:`HEAD`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async options(e,t){let n=await this.request(e,{...t,method:`OPTIONS`});return{data:await this.formatData(n,t),headers:n.headers,status:n.status}}async patch(e,t,n){let r=await this.request(e,{...n,data:t,method:`PATCH`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async post(e,t,n){let r=await this.request(e,{data:t,...n,method:`POST`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async put(e,t,n){let r=await this.request(e,{data:t,...n,method:`PUT`});return{data:await this.formatData(r,n),headers:r.headers,status:r.status}}async request(e,t){let n=new URL(e,this.baseUrl);if(t.params)for(let[e,r]of Object.entries(t.params))r!=null&&n.searchParams.append(e,String(r));let r={method:t.method.toUpperCase(),url:n,...this.config};if(t.headers&&(r.headers={...r.headers,...t.headers}),this.config?.auth){let{password:e,username:t}=this.config.auth,n=btoa(`${t}:${e}`);r.headers={...r.headers,Authorization:`Basic ${n}`}}if(t.data&&(t.data instanceof Object&&(r.headers={...r.headers,"Content-Type":`application/json`},t.data=JSON.stringify(t.data)),r.body=t.data),this.interceptors.request.length>0)for(let e of this.interceptors.request)r={...r,...await e({...r,url:n})};n=r.url;let i=await fetch(n,r);if(!i.ok){let e;try{e=await i.text()}catch{e=i.statusText}throw Error(e?`Request failed with status code ${i.status}: ${e}`:`Request failed with status code ${i.status}`)}if(this.interceptors.response.length>0)for(let e of this.interceptors.response)await e(i);return i}setBaseURL(e){this.baseUrl=e}setConfig(e){this.config=e}formatData(e,t){switch(t?.responseType||`json`){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`text`:return e.text();default:return e.json()}}}})),D=d((()=>{})),O=p({APIClient:()=>T}),k=d((()=>{E(),D()})),A=f((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,`__esModule`,{value:!0}),e.Statuspage=void 0;let n=(k(),h(O)),r=b(),i=g();e.Statuspage=class{constructor(e){if(this.getComponents=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.components(),{data:t}=yield this.apiClient.get(e);return t}),this.getStatus=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.status(),{data:t}=yield this.apiClient.get(e);return t}),this.getSummary=()=>t(this,void 0,void 0,function*(){let e=i.Endpoint.summary(),{data:t}=yield this.apiClient.get(e);return t}),!e)throw Error(`A page ID needs to be set in order to use the client.`);this.apiClient=new n.APIClient(`https://${e}.statuspage.io`),this.api={getComponents:this.getComponents,getStatus:this.getStatus,getSummary:this.getSummary,incidents:new r.IncidentsAPI(this.apiClient),scheduledMaintenances:new r.ScheduledMaintenancesAPI(this.apiClient),subscribers:new r.SubscribersAPI(this.apiClient)}}setApiUrl(e){this.apiClient.setBaseURL(e)}}})),j=f((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(b(),e),n(w(),e),n(A(),e)}))();const M={none:0,minor:1,major:2,critical:2,unavailable:21},N=[`google-chrome-stable`,`google-chrome`,`chromium`,`brave`,`microsoft-edge-stable`,`microsoft-edge`];async function P(e=`https://status.claude.com`){try{let t=new j.Statuspage(`anthropic`);return t.setApiUrl(e),{kind:`ok`,summary:await t.api.getSummary()}}catch(e){return{kind:`unknown`,reason:e instanceof Error?e.message:String(e)}}}function F(e){return typeof e==`object`&&!!e&&`webSocketDebuggerUrl`in e&&typeof e.webSocketDebuggerUrl==`string`}function I(e){return typeof e==`object`&&!!e&&`id`in e&&typeof e.id==`number`}function L(e){let t=new Map,n=0;return e.onmessage=e=>{let n=typeof e.data==`string`?e.data:e.data instanceof ArrayBuffer?new TextDecoder().decode(e.data):null;if(n===null)return;let r;try{r=JSON.parse(n)}catch{return}if(!I(r))return;let i=t.get(r.id);i!==void 0&&(t.delete(r.id),i(r))},(r,i={})=>new Promise((a,o)=>{let s=++n,c=setTimeout(()=>{t.delete(s),o(Error(`CDP command '${r}' timed out`))},5e3);t.set(s,e=>{clearTimeout(c),a(e)}),e.send(JSON.stringify({id:s,method:r,params:i}))})}async function R(e,t){let n=await(await fetch(`${e}/json/new?${encodeURIComponent(t)}`,{method:`PUT`})).json();if(!F(n))return{ok:!1,error:`unexpected CDP target shape`};let r=new WebSocket(n.webSocketDebuggerUrl);return await new Promise((e,t)=>{r.onopen=()=>e(),r.onerror=()=>t(Error(`WebSocket connection failed`)),r.onclose=()=>t(Error(`WebSocket closed before opening`))}),{ok:!0,send:L(r),close:()=>r.close()}}function z(){for(let e of N){let n=t(`which`,[e]);if(n.status===0&&n.stdout)return n.stdout.toString().trim()}return null}async function B(e,t){let n=Date.now()+t;for(;Date.now()<n;){try{if((await fetch(`${e}/json/version`)).ok)return!0}catch{}await o(100)}return!1}async function V(t){let r;try{r=n(a(i(),`claude-down-`))}catch(e){return{ok:!1,error:`mkdtemp failed: ${e instanceof Error?e.message:String(e)}`}}let o=9222+Math.floor(Math.random()*1e3),s=e(t,[`--headless=new`,`--disable-gpu`,`--no-sandbox`,`--disable-blink-features=AutomationControlled`,`--window-size=1920,1080`,`--user-data-dir=${r}`,`--remote-debugging-port=${o}`,`--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36`,`about:blank`],{stdio:`ignore`}),c=`http://localhost:${o}`;return await B(c,5e3)?{ok:!0,browser:{proc:s,userDataDir:r,base:c}}:(H(s,r),{ok:!1,error:`CDP endpoint never came up`})}function H(e,t){e.kill(),r(t,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}function U(e){return typeof e==`object`&&!!e&&`result`in e&&typeof e.result==`object`&&e.result!==null&&`result`in e.result&&typeof e.result.result==`object`&&e.result.result!==null&&`value`in e.result.result&&typeof e.result.result.value==`string`}function W(e){if(typeof e!=`object`||!e||!(`title`in e)||typeof e.title!=`string`||`h1`in e&&e.h1!==null&&typeof e.h1!=`string`||!(`pogo`in e))return!1;if(e.pogo===null)return!0;if(typeof e.pogo!=`object`)return!1;let t=e.pogo;return!(`outage`in t&&t.outage!==void 0&&typeof t.outage!=`boolean`)}async function G(e,t){await e(`Runtime.enable`);let n=Date.now()+t;for(;Date.now()<n;){let t=await e(`Runtime.evaluate`,{expression:`JSON.stringify({ title: document.title, pogo: window.PogoConfig ?? null, h1: document.querySelector("h1")?.innerText ?? null })`,returnByValue:!0});if(U(t)){let e;try{e=JSON.parse(t.result.result.value)}catch{e=null}if(W(e)&&e.pogo!==null&&e.title!==`Just a moment...`)return{pogo:e.pogo,heading:e.h1}}await o(700)}return null}async function K(){let e=z();if(e===null)return{ok:!1,error:`no chromium/chrome binary found`};let t=await V(e);if(!t.ok)return t;let{browser:{proc:n,userDataDir:r,base:i}}=t;try{let e=await R(i,`https://downdetector.com/status/claude-ai/`);if(!e.ok)return e;let t=await G(e.send,2e4);return e.close(),t===null?{ok:!1,error:`CF challenge not cleared in time`}:t.pogo.outage===!0?{ok:!0,down:!0,reason:t.heading??`outage reported`}:{ok:!0,down:!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}finally{H(n,r)}}export{M as EXIT_CODES,P as checkAnthropic,K as checkDownDetector};
1
+ import{spawn as e,spawnSync as t}from"node:child_process";import{existsSync as n,mkdtempSync as r,rmSync as i}from"node:fs";import{tmpdir as a}from"node:os";import{join as o,win32 as s}from"node:path";import{setTimeout as c}from"node:timers/promises";const l=`/api/v2`,u={components(){return`${l}/components.json`},Incidents:{all(){return`${l}/incidents.json`},unresolved(){return`${l}/incidents/unresolved.json`}},ScheduledMaintenances:{active(){return`${l}/scheduled-maintenances/upcoming.json`},all(){return`${l}/scheduled-maintenances.json`},upcoming(){return`${l}/scheduled-maintenances/upcoming.json`}},status(){return`${l}/status.json`},subscriber(e){return`${l}/subscribers/${encodeURIComponent(e)}.json`},subscribers(){return`${l}/subscribers.json`},summary(){return`${l}/summary.json`}},d={none:0,minor:1,major:2,critical:2,unavailable:21},f=[`google-chrome-stable`,`google-chrome`,`chromium`,`brave`,`microsoft-edge-stable`,`microsoft-edge`],p=[`chrome.exe`,`msedge.exe`,`brave.exe`],m=[[`Google`,`Chrome`,`Application`,`chrome.exe`],[`Microsoft`,`Edge`,`Application`,`msedge.exe`],[`BraveSoftware`,`Brave-Browser`,`Application`,`brave.exe`],[`Chromium`,`Application`,`chrome.exe`]],h=[`ProgramFiles`,`ProgramFiles(x86)`,`LOCALAPPDATA`],g=[`/Applications/Google Chrome.app/Contents/MacOS/Google Chrome`,`/Applications/Brave Browser.app/Contents/MacOS/Brave Browser`,`/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge`,`/Applications/Chromium.app/Contents/MacOS/Chromium`];async function _(e){try{let t=await e.text(),n=t.length>0?`: ${t}`:``;return`Request failed with status code ${e.status}${n}`}catch{let{status:t,statusText:n}=e;return`Request failed with status code ${t}: ${n}`}}async function v(e=`https://status.claude.com`){try{let t=await fetch(new URL(u.summary(),e));if(!t.ok){let{headers:e}=t;return{headers:e,kind:`unknown`,reason:await _(t)}}let n=await t.json();return{headers:t.headers,kind:`ok`,summary:n}}catch(e){return{kind:`unknown`,reason:e instanceof Error?e.message:String(e)}}}function y(e){return typeof e==`object`&&!!e&&`webSocketDebuggerUrl`in e&&typeof e.webSocketDebuggerUrl==`string`}function b(e){return typeof e==`object`&&!!e&&`id`in e&&typeof e.id==`number`}function x(e){let t=new Map,n=0;return e.onmessage=e=>{let n=typeof e.data==`string`?e.data:e.data instanceof ArrayBuffer?new TextDecoder().decode(e.data):null;if(n===null)return;let r;try{r=JSON.parse(n)}catch{return}if(!b(r))return;let i=t.get(r.id);i!==void 0&&(t.delete(r.id),i(r))},(r,i={})=>new Promise((a,o)=>{let s=++n,c=setTimeout(()=>{t.delete(s),o(Error(`CDP command '${r}' timed out`))},5e3);t.set(s,e=>{clearTimeout(c),a(e)}),e.send(JSON.stringify({id:s,method:r,params:i}))})}async function S(e,t){let n=await(await fetch(`${e}/json/new?${encodeURIComponent(t)}`,{method:`PUT`})).json();if(!y(n))return{ok:!1,error:`unexpected CDP target shape`};let r=new WebSocket(n.webSocketDebuggerUrl);return await new Promise((e,t)=>{r.onopen=()=>e(),r.onerror=()=>t(Error(`WebSocket connection failed`)),r.onclose=()=>t(Error(`WebSocket closed before opening`))}),{ok:!0,send:x(r),close:()=>r.close()}}function C(e,n){for(let r of n){let n=t(e,[r]);if(n.status===0&&n.stdout){let e=n.stdout.toString().split(/\r?\n/)[0]?.trim();if(e)return e}}return null}function w(e){for(let t of e)if(t&&n(t))return t;return null}function T(){let e=[];for(let t of h){let n=process.env[t];if(n)for(let t of m)e.push(s.join(n,...t))}return e}function E(e){let t=e??process.env.CLAUDE_DOWN_CHROME;return t?n(t)?t:null:process.platform===`win32`?C(`where.exe`,p)??w(T()):process.platform===`darwin`?C(`which`,f)??w(g):C(`which`,f)}async function D(e,t){let n=Date.now()+t;for(;Date.now()<n;){try{if((await fetch(`${e}/json/version`)).ok)return!0}catch{}await c(100)}return!1}async function O(t){let n;try{n=r(o(a(),`claude-down-`))}catch(e){return{ok:!1,error:`mkdtemp failed: ${e instanceof Error?e.message:String(e)}`}}let i=9222+Math.floor(Math.random()*1e3),s=e(t,[`--headless=new`,`--disable-gpu`,`--no-sandbox`,`--disable-blink-features=AutomationControlled`,`--window-size=1920,1080`,`--user-data-dir=${n}`,`--remote-debugging-port=${i}`,`--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36`,`about:blank`],{stdio:`ignore`}),c=`http://localhost:${i}`;return await D(c,5e3)?{ok:!0,browser:{proc:s,userDataDir:n,base:c}}:(k(s,n),{ok:!1,error:`CDP endpoint never came up`})}function k(e,n){process.platform===`win32`&&e.pid!==void 0?t(`taskkill`,[`/pid`,String(e.pid),`/t`,`/f`]):e.kill();try{i(n,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}catch{}}function A(e){return typeof e==`object`&&!!e&&`result`in e&&typeof e.result==`object`&&e.result!==null&&`result`in e.result&&typeof e.result.result==`object`&&e.result.result!==null&&`value`in e.result.result&&typeof e.result.result.value==`string`}function j(e){if(typeof e!=`object`||!e||!(`title`in e)||typeof e.title!=`string`||`h1`in e&&e.h1!==null&&typeof e.h1!=`string`||!(`pogo`in e))return!1;let{pogo:t}=e;return t===null?!0:!(typeof t!=`object`||`outage`in t&&t.outage!==void 0&&typeof t.outage!=`boolean`)}async function M(e,t){await e(`Runtime.enable`);let n=Date.now()+t;for(;Date.now()<n;){let t=await e(`Runtime.evaluate`,{expression:`JSON.stringify({
2
+ title: document.title,
3
+ pogo: window.PogoConfig ?? null,
4
+ h1: document.querySelector('h1')?.innerText ?? null,
5
+ })`,returnByValue:!0});if(A(t)){let e;try{e=JSON.parse(t.result.result.value)}catch{e=null}if(j(e)&&e.pogo!==null&&e.title!==`Just a moment...`)return{pogo:e.pogo,heading:e.h1}}await c(700)}return null}async function N(e){let t=E(e);if(t===null)return{ok:!1,error:`no Chrome/Chromium found; set CLAUDE_DOWN_CHROME or pass --chrome <path>`};let n=await O(t);if(!n.ok)return n;let{browser:{proc:r,userDataDir:i,base:a}}=n;try{let e=await S(a,`https://downdetector.com/status/claude-ai/`);if(!e.ok)return e;let t=await M(e.send,2e4);return e.close(),t===null?{ok:!1,error:`CF challenge not cleared in time`}:t.pogo.outage===!0?{ok:!0,down:!0,reason:t.heading??`outage reported`}:{ok:!0,down:!1}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}finally{k(r,i)}}const P={checkAnthropic:v,checkDownDetector:N,EXIT_CODES:d};export{d as EXIT_CODES,v as checkAnthropic,N as checkDownDetector,P as default};
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "claude-down",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Is claude code down? Probably...",
5
- "homepage": "https://github.com/kjanat/claude-down#readme",
5
+ "homepage": "https://kjanat.github.io/claude-down/",
6
6
  "bugs": {
7
7
  "url": "https://github.com/kjanat/claude-down/issues"
8
8
  },
@@ -13,9 +13,12 @@
13
13
  "license": "MIT",
14
14
  "author": "Kaj Kowalski <info@kajkowalski.nl> (https://github.com/kjanat)",
15
15
  "type": "module",
16
+ "jsdelivr": "./dist/browser/browser.js",
16
17
  "imports": {
17
18
  "#claude-down": "./src/index.ts",
18
- "#claude-down/*": "./src/*",
19
+ "#claude-down/cli": "./src/cli/index.ts",
20
+ "#claude-down/browser": "./src/browser.ts",
21
+ "#claude-down/*": "./src/*.ts",
19
22
  "#test/*": "./test/*"
20
23
  },
21
24
  "exports": {
@@ -48,40 +51,37 @@
48
51
  "prepublishOnly": "bun run build -l warn",
49
52
  "publishChecks": "e18e-cli analyze; attw; bunx publint --pack bun --strict",
50
53
  "test": "bun test",
51
- "typecheck": "tsc --noEmit"
54
+ "typecheck": "tsc --noEmit",
55
+ "dev": "bun demo/index.html",
56
+ "preview": "bun start",
57
+ "site:build": "bun build --compile --target=browser ./demo/index.html --outdir=dist/site --minify",
58
+ "prestart": "bun site:build",
59
+ "start": "bunx serve dist/site"
52
60
  },
53
61
  "dependencies": {
54
- "@kjanat/dreamcli": "^2.1.0"
62
+ "@kjanat/dreamcli": "^2.2.1"
55
63
  },
56
64
  "devDependencies": {
57
- "@biomejs/biome": "^2.4.13",
58
- "@types/bun": "^1.3.13",
59
- "@types/node": "^25.6.0",
65
+ "@biomejs/biome": "^2.5.0",
66
+ "@types/bun": "^1.3.14",
67
+ "@types/node": "^25.9.3",
60
68
  "statuspage.io": "^3.5.0",
61
- "tsdown": "^0.21.10",
69
+ "tsdown": "^0.22.2",
62
70
  "typescript": "^6.0.3"
63
71
  },
64
- "packageManager": "bun@1.3.13",
72
+ "packageManager": "bun@1.3.14",
65
73
  "engines": {
66
74
  "bun": ">=1.3",
67
- "node": ">=24"
75
+ "node": ">=22.18.0"
68
76
  },
69
77
  "devEngines": {
70
- "packageManager": [
71
- {
72
- "name": "bun",
73
- "onFail": "warn"
74
- }
75
- ],
76
- "runtime": [
77
- {
78
- "name": "bun",
79
- "onFail": "warn"
80
- }
81
- ]
82
- },
83
- "inlinedDependencies": {
84
- "@ffflorian/api-client": "2.5.1",
85
- "statuspage.io": "3.5.0"
78
+ "packageManager": [{
79
+ "name": "bun",
80
+ "onFail": "warn"
81
+ }],
82
+ "runtime": [{
83
+ "name": "bun",
84
+ "onFail": "warn"
85
+ }]
86
86
  }
87
87
  }
@@ -1,11 +0,0 @@
1
- import { r as Result } from "./types-4oEMjqAH.mjs";
2
-
3
- //#region src/lib/anthropic.d.ts
4
- /** Checks the status of Anthropic's services by querying their Statuspage API.
5
- *
6
- * @param baseUrl - Optional base URL for the Anthropic Statuspage API. Defaults to a predefined constant.
7
- * @returns A promise that resolves to a Result object containing either the summary of the status or an error reason.
8
- */
9
- declare function check(baseUrl?: string): Promise<Result>;
10
- //#endregion
11
- export { check as checkAnthropic, check as default };
package/dist/cdp.d.mts DELETED
@@ -1,12 +0,0 @@
1
- //#region src/lib/downdetector/cdp.d.ts
2
- type CdpSend = (method: string, params?: Record<string, unknown>) => Promise<unknown>;
3
- declare function openCdpTarget(base: string, url: string): Promise<{
4
- ok: true;
5
- send: CdpSend;
6
- close: () => void;
7
- } | {
8
- ok: false;
9
- error: string;
10
- }>;
11
- //#endregion
12
- export { type CdpSend, openCdpTarget };
package/dist/chrome.d.mts DELETED
@@ -1,20 +0,0 @@
1
- import { ChildProcess } from "node:child_process";
2
-
3
- //#region src/lib/downdetector/chrome.d.ts
4
- type LaunchedBrowser = {
5
- proc: ChildProcess;
6
- userDataDir: string;
7
- base: string;
8
- };
9
- type LaunchBrowserResult = {
10
- ok: true;
11
- browser: LaunchedBrowser;
12
- } | {
13
- ok: false;
14
- error: string;
15
- };
16
- declare function findChrome(): string | null;
17
- declare function launchBrowser(chrome: string): Promise<LaunchBrowserResult>;
18
- declare function cleanupBrowser(proc: ChildProcess, userDataDir: string): void;
19
- //#endregion
20
- export { type LaunchedBrowser, cleanupBrowser, findChrome, launchBrowser };
@@ -1,17 +0,0 @@
1
- //#region src/lib/constants.d.ts
2
- /** Mapping of status levels to their corresponding exit codes. */
3
- declare const EXIT_CODES: {
4
- readonly none: 0;
5
- readonly minor: 1;
6
- readonly major: 2;
7
- readonly critical: 2;
8
- readonly unavailable: 21;
9
- };
10
- /** Base URL for Anthropic's status page API. */
11
- declare const ANTHROPIC_STATUS_BASE = "https://status.claude.com";
12
- /** URL for Claude AI's status page on Downdetector. */
13
- declare const DOWNDETECTOR_URL = "https://downdetector.com/status/claude-ai/";
14
- /** Executable names to probe via `which` when locating a Chromium-family binary. */
15
- declare const BROWSER_CANDIDATES: readonly ["google-chrome-stable", "google-chrome", "chromium", "brave", "microsoft-edge-stable", "microsoft-edge"];
16
- //#endregion
17
- export { EXIT_CODES as i, BROWSER_CANDIDATES as n, DOWNDETECTOR_URL as r, ANTHROPIC_STATUS_BASE as t };
@@ -1,2 +0,0 @@
1
- import { i as EXIT_CODES, n as BROWSER_CANDIDATES, r as DOWNDETECTOR_URL, t as ANTHROPIC_STATUS_BASE } from "./constants-CY8aOEl6.mjs";
2
- export { ANTHROPIC_STATUS_BASE, BROWSER_CANDIDATES, DOWNDETECTOR_URL, EXIT_CODES };
@@ -1,6 +0,0 @@
1
- import { i as Signal } from "./types-4oEMjqAH.mjs";
2
-
3
- //#region src/lib/downdetector.d.ts
4
- declare function check(): Promise<Signal>;
5
- //#endregion
6
- export { check as checkDownDetector, check as default };
@@ -1,11 +0,0 @@
1
- import { CdpSend } from "./cdp.mjs";
2
-
3
- //#region src/lib/downdetector/snapshot.d.ts
4
- declare function pollPogoSnapshot(send: CdpSend, timeoutMs: number): Promise<{
5
- pogo: {
6
- outage?: boolean;
7
- };
8
- heading: string | null;
9
- } | null>;
10
- //#endregion
11
- export { pollPogoSnapshot };
@@ -1,116 +0,0 @@
1
- import { i as EXIT_CODES } from "./constants-CY8aOEl6.mjs";
2
-
3
- //#region node_modules/statuspage.io/dist/interfaces/Result.d.ts
4
- declare enum IncidentImpact {
5
- Critical = "critical",
6
- Major = "major",
7
- Minor = "minor",
8
- None = "none"
9
- }
10
- declare enum IncidentStatus {
11
- Identified = "identified",
12
- Investigating = "investigating",
13
- Monitoring = "monitoring",
14
- Postmortem = "postmortem",
15
- Resolved = "resolved"
16
- }
17
- declare enum MaintenanceStatus {
18
- Completed = "completed",
19
- InProgress = "in_progress",
20
- Scheduled = "scheduled",
21
- Verifying = "verifying"
22
- }
23
- interface Component {
24
- created_at: string;
25
- description: null | string;
26
- group: boolean;
27
- group_id: null | string;
28
- id: string;
29
- name: string;
30
- only_show_if_degraded: boolean;
31
- page_id: string;
32
- position: number;
33
- showcase: boolean;
34
- start_date: null | string;
35
- status: string;
36
- updated_at: string;
37
- }
38
- interface Components extends Page {
39
- components: Component[];
40
- }
41
- interface Incident {
42
- created_at: string;
43
- id: string;
44
- impact: IncidentImpact;
45
- incident_updates: IncidentUpdate[];
46
- monitoring_at: null | string;
47
- name: string;
48
- page_id: string;
49
- resolved_at: null | string;
50
- shortlink: string;
51
- status: IncidentStatus;
52
- updated_at: string;
53
- }
54
- interface Incidents extends Page {
55
- incidents: Incident[];
56
- }
57
- interface IncidentUpdate {
58
- body: string;
59
- created_at: string;
60
- display_at: string;
61
- id: string;
62
- incident_id: string;
63
- status: IncidentStatus;
64
- updated_at: string;
65
- }
66
- interface Page {
67
- page: {
68
- id: string;
69
- name: string;
70
- time_zone: string;
71
- updated_at: string;
72
- url: string;
73
- };
74
- }
75
- type ScheduledMaintenance = {
76
- scheduled_for: string;
77
- scheduled_until: string;
78
- status: MaintenanceStatus;
79
- } & Omit<Incident, 'status'>;
80
- interface ScheduledMaintenances extends Page {
81
- scheduled_maintenances: ScheduledMaintenance[];
82
- }
83
- interface Status extends Page {
84
- status: {
85
- description: string;
86
- indicator: string;
87
- };
88
- }
89
- type Summary = Components & Incidents & ScheduledMaintenances & Status;
90
- //#endregion
91
- //#region src/lib/types.d.ts
92
- /** Indicator represents the specific status code or condition that can be used to determine the state of a service. */
93
- type Indicator = keyof typeof EXIT_CODES;
94
- type AvailableIndicator = Exclude<Indicator, 'unavailable'>;
95
- /** A signal represents the outcome of a status check, indicating whether the service is down and providing relevant information. */
96
- type Signal = {
97
- ok: true;
98
- down: true;
99
- reason: string;
100
- } | {
101
- ok: true;
102
- down: false;
103
- } | {
104
- ok: false;
105
- error: string;
106
- };
107
- /** The result of a status check, which can either be a successful summary or an unknown state with a reason. */
108
- type Result = {
109
- kind: 'ok';
110
- summary: Summary;
111
- } | {
112
- kind: 'unknown';
113
- reason: string;
114
- };
115
- //#endregion
116
- export { Summary as a, Signal as i, Indicator as n, Result as r, AvailableIndicator as t };
package/dist/types.d.mts DELETED
@@ -1,2 +0,0 @@
1
- import { a as Summary, i as Signal, n as Indicator, r as Result, t as AvailableIndicator } from "./types-4oEMjqAH.mjs";
2
- export { AvailableIndicator, Indicator, Result, Signal, Summary };