github-up 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/bin/cli.mjs +12 -12
  2. package/package.json +3 -3
package/dist/bin/cli.mjs CHANGED
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env node
2
- import{argv as e,platform as t}from"node:process";import{ParseError as n,cli as r,command as i,flag as a,osc8 as o,packageRepositoryUrl as s}from"@kjanat/dreamcli";import{createColors as c}from"ansispeck";import{spawn as l,spawnSync as u}from"node:child_process";import{existsSync as d,mkdtempSync as ee,readFileSync as te,rmSync as ne}from"node:fs";import{tmpdir as re}from"node:os";import{join as f,win32 as ie}from"node:path";import{setTimeout as p}from"node:timers/promises";import{createAdapter as ae}from"@kjanat/dreamcli/runtime";const m=[`github`,`downdetector`],h={github:`GitHub`,downdetector:`Downdetector`},g=[`actions`,`api`,`codespaces`,`copilot`,`git`,`issues`,`packages`,`pages`,`pr`,`webhooks`],oe={actions:/\bactions\b/i,api:/\bapi\b/i,codespaces:/\bcodespaces\b/i,copilot:/\bcopilot\b/i,git:/\bgit\b/i,issues:/\bissues\b/i,packages:/\bpackages\b/i,pages:/\bpages\b/i,pr:/\bpull requests?\b/i,webhooks:/\bwebhooks?\b/i},se=/\b(?:all|many|most|multiple|several|some|various)\s+(?:github\s+)?(?:components|services|systems)\b/i;function _(e){return se.test(e)}function v(e,t){let n=[];for(let r of t)oe[r].test(e)&&n.push(r);return n}function y(e,t){return t.size>0&&(v(e,t).length>0||_(e))}const b={none:0,minor:1,major:2,critical:2,unavailable:21},x=`https://www.githubstatus.com`,S=`https://downdetector.com/status/github/`,C=[`google-chrome-stable`,`google-chrome`,`chromium`,`brave`,`microsoft-edge-stable`,`microsoft-edge`],ce=[`chrome.exe`,`msedge.exe`,`brave.exe`],le=[[`Google`,`Chrome`,`Application`,`chrome.exe`],[`Microsoft`,`Edge`,`Application`,`msedge.exe`],[`BraveSoftware`,`Brave-Browser`,`Application`,`brave.exe`],[`Chromium`,`Application`,`chrome.exe`]],ue=[`ProgramFiles`,`ProgramFiles(x86)`,`LOCALAPPDATA`],de=[`/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 w(e,t){return r=>{let i=[];for(let a of String(r).split(`,`)){let r=a.trim();if(r.length===0)continue;let o=e.find(e=>e===r);if(o===void 0)throw new n(`Invalid value '${r}' for flag --${t}. Allowed: ${e.join(`, `)}`,{code:`INVALID_VALUE`,details:{flag:t,input:`--${t}`,value:r,allowed:e}});i.push(o)}return i}}const fe=w(m,`source`),pe=w(g,`component`),T=a.boolean().alias(`q`).describe(`Silent; exit code only`),E=a.custom(e=>new URL(String(e))).alias(`github-status-base`,{hidden:!0}).alias(`base`).alias(`b`).default(new URL(x)).env(`GITHUB_UP_GITHUB_STATUS_BASE`).describe(`Override GitHub status page base URL`),me=a.array(a.custom(fe)).alias(`s`).default([[...m]]).env(`GITHUB_UP_SOURCE`).env(`GITHUB_UP_SOURCES`).describe(`Data source(s) to check`),D=a.string().env(`GITHUB_UP_CHROME`).describe(`Path to a Chrome/Chromium binary`),he=a.array(a.custom(pe)).alias(`c`).describe(`Only report incidents/components mentioning these component(s)`),O={actions:a.boolean().describe(`Shortcut for --component actions`),api:a.boolean().describe(`Shortcut for --component api`),codespaces:a.boolean().describe(`Shortcut for --component codespaces`),copilot:a.boolean().describe(`Shortcut for --component copilot`),git:a.boolean().describe(`Shortcut for --component git`),issues:a.boolean().alias(`issue`).describe(`Shortcut for --component issues`),packages:a.boolean().describe(`Shortcut for --component packages`),pages:a.boolean().describe(`Shortcut for --component pages`),pr:a.boolean().alias(`prs`).describe(`Shortcut for --component pr`),webhooks:a.boolean().describe(`Shortcut for --component webhooks`)};function k(e){let t=new Set(e.component.flat());for(let n of g)e[n]&&t.add(n);return t}function ge(e){return[...new Set(e.flat())]}var _e=`github-up`,ve=`0.1.2`,A=`https://github-up.kjanat.dev`,ye={type:`git`,url:`git+https://github.com/kjanat/github-up.git`};function be(e){return{none:e.green,minor:e.yellow,major:e.red,critical:e.red}}function xe(e,t){return e.indicator===`unavailable`?t.dim:be(t)[e.indicator]}function Se(e){return e.source===`github`?x:S}function j(e,t,n){if(n.length!==0){e.push(` ${t}:`);for(let t of n)e.push(` - ${t}`)}}function M(e,t){let n=c(t),r=xe(e,n),i=[n.link(Se(e),n.underline(n.bold(r(h[e.source]))))];if(e.indicator===`unavailable`){let t=e.summaryText??`unknown error`;return i.push(` ${r(`Unavailable: ${t}`)}`),i.join(`
2
+ import{argv as e,platform as t}from"node:process";import{ParseError as n,cli as r,command as i,flag as a,osc8 as o,packageRepositoryUrl as s}from"@kjanat/dreamcli";import{cyan as c}from"ansispeck/safe";import{createColors as l}from"ansispeck";import{spawn as u,spawnSync as d}from"node:child_process";import{existsSync as f,mkdtempSync as ee,readFileSync as te,rmSync as ne}from"node:fs";import{tmpdir as re}from"node:os";import{join as p,win32 as ie}from"node:path";import{setTimeout as m}from"node:timers/promises";import{createAdapter as ae}from"@kjanat/dreamcli/runtime";const h=[`github`,`downdetector`],g={github:`GitHub`,downdetector:`Downdetector`},_=[`actions`,`api`,`codespaces`,`copilot`,`git`,`issues`,`packages`,`pages`,`pr`,`webhooks`],oe={actions:/\bactions\b/i,api:/\bapi\b/i,codespaces:/\bcodespaces\b/i,copilot:/\bcopilot\b/i,git:/\bgit\b/i,issues:/\bissues\b/i,packages:/\bpackages\b/i,pages:/\bpages\b/i,pr:/\bpull requests?\b/i,webhooks:/\bwebhooks?\b/i},se=/\b(?:all|many|most|multiple|several|some|various)\s+(?:github\s+)?(?:components|services|systems)\b/i;function ce(e){return se.test(e)}function v(e,t){let n=[];for(let r of t)oe[r].test(e)&&n.push(r);return n}function y(e,t){return t.size>0&&(v(e,t).length>0||ce(e))}const b={none:0,minor:1,major:2,critical:2,unavailable:21},x=`https://www.githubstatus.com`,S=`https://downdetector.com/status/github/`,C=[`google-chrome-stable`,`google-chrome`,`chromium`,`brave`,`microsoft-edge-stable`,`microsoft-edge`],le=[`chrome.exe`,`msedge.exe`,`brave.exe`],ue=[[`Google`,`Chrome`,`Application`,`chrome.exe`],[`Microsoft`,`Edge`,`Application`,`msedge.exe`],[`BraveSoftware`,`Brave-Browser`,`Application`,`brave.exe`],[`Chromium`,`Application`,`chrome.exe`]],de=[`ProgramFiles`,`ProgramFiles(x86)`,`LOCALAPPDATA`],fe=[`/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 w(e,t){return r=>{let i=[];for(let a of String(r).split(`,`)){let r=a.trim();if(r.length===0)continue;let o=e.find(e=>e===r);if(o===void 0)throw new n(`Invalid value '${r}' for flag --${t}. Allowed: ${e.join(`, `)}`,{code:`INVALID_VALUE`,details:{flag:t,input:`--${t}`,value:r,allowed:e}});i.push(o)}return i}}const pe=w(h,`source`),me=w(_,`component`),T=a.boolean().alias(`q`).describe(`Silent; exit code only`),E=a.custom(e=>new URL(String(e))).alias(`github-status-base`,{hidden:!0}).alias(`base`).alias(`b`).default(new URL(x)).env(`GITHUB_UP_GITHUB_STATUS_BASE`).describe(`Override GitHub status page base URL`),he=a.array(a.custom(pe)).alias(`s`).default([[...h]]).env(`GITHUB_UP_SOURCE`).env(`GITHUB_UP_SOURCES`).describe(`Data source(s) to check`),D=a.string().env(`GITHUB_UP_CHROME`).describe(`Path to a Chrome/Chromium binary`),ge=a.array(a.custom(me)).alias(`c`).describe(`Only report incidents/components mentioning these component(s)`),O=e=>`Shortcut for ${c`--component ${e}`}`,k={actions:a.boolean().describe(O(`actions`)),api:a.boolean().describe(O(`api`)),codespaces:a.boolean().describe(O(`codespaces`)),copilot:a.boolean().describe(O(`copilot`)),git:a.boolean().describe(O(`git`)),issues:a.boolean().alias(`issue`).describe(O(`issues`)),packages:a.boolean().describe(O(`packages`)),pages:a.boolean().describe(O(`pages`)),pr:a.boolean().alias(`prs`).describe(O(`pr`)),webhooks:a.boolean().describe(O(`webhooks`))};function A(e){let t=new Set(e.component.flat());for(let n of _)e[n]&&t.add(n);return t}function _e(e){return[...new Set(e.flat())]}var j=`https://github-up.kjanat.dev`,M={name:`github-up`,version:`0.1.3`,description:`Is GitHub down? Probably...`,homepage:j,bugs:{url:`https://github.com/kjanat/github-up/issues`},repository:{type:`git`,url:`git+https://github.com/kjanat/github-up.git`},license:`MIT`,author:`Kaj Kowalski <info@kajkowalski.nl> (https://github.com/kjanat)`,keywords:[`github`,`cli`,`downdetector`,`dreamcli`,`statuspage`,`ansispeck`],type:`module`,jsdelivr:`./dist/browser/browser.js`,imports:{"#github-up":`./src/index.ts`,"#github-up/cli":`./src/cli/index.ts`,"#github-up/browser":`./src/browser.ts`,"#github-up/types":`./src/lib/types.ts`,"#github-up/*":`./src/*.ts`,"#demo/*":`./demo/*.ts`,"#pkg":`./package.json`,"#test/*":`./test/*`},exports:{".":{types:`./dist/index.d.mts`,default:`./dist/index.mjs`},"./browser":{types:`./dist/browser/browser.d.ts`,default:`./dist/browser/browser.js`},"./package.json":`./package.json`},bin:{"github-up":`dist/bin/cli.mjs`},files:[`dist`,`README.md`,`LICENSE`,`package.json`],scripts:{bd:`runner build`,build:`bun --bun build.ts`,"build:watch":`runner build --watch`,check:`biome check`,fmt:`bunx dprint fmt`,lint:`biome lint`,local:`bun run build -l warn && bun link`,prepublishOnly:`bun run build -l warn`,publishChecks:`e18e-cli analyze; attw; bunx publint --pack bun --strict`,test:`bun test`,typecheck:`tsc --noEmit`,dev:`runner build:watch`,preview:`bun start`,"site:build":`runner build`,prestart:`runner build`,start:`bunx serve dist/site`,"publish:npm":`npm view "$(jq -r '"\\(.name)@\\(.version)"' package.json)" version >/dev/null 2>&1 && echo already published, skipping || bunx npm@11 publish`,"publish:pkg-pr-new":`bunx pkg-pr-new publish --bun --bin --packageManager=npm,bun,pnpm`},dependencies:{"@kjanat/dreamcli":`^3.0.0-rc.8`,ansispeck:`^0.1.2`},devDependencies:{"@biomejs/biome":`>=2.5,<2.5.3`,"@types/bun":`^1.3`,"@types/node":`^26`,"runner-run":`^0.19.1`,"statuspage.io":`^3.5`,tsdown:`^0.22`,typescript:`^7`},packageManager:`bun@1.3.14`,engines:{bun:`>=1.3`,node:`>=22.18`},devEngines:{packageManager:[{name:`bun`,onFail:`warn`}],runtime:[{name:`bun`,onFail:`ignore`}]},volta:{node:`26.5.0`,npm:`11.18.0`},publishConfig:{access:`public`,tag:`latest`}};function ve(e){return{none:e.green,minor:e.yellow,major:e.red,critical:e.red}}function ye(e,t){return e.indicator===`unavailable`?t.dim:ve(t)[e.indicator]}function be(e){return e.source===`github`?x:S}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=l(t),r=ye(e,n),i=[n.link(be(e),n.underline(n.bold(r(g[e.source]))))];if(e.indicator===`unavailable`){let t=e.summaryText??`unknown error`;return i.push(` ${r(`Unavailable: ${t}`)}`),i.join(`
3
3
  `)}if(e.source===`downdetector`){let t=e.summaryText??`No user-reported issues`;return i.push(` ${r(t)}`),i.join(`
4
- `)}let a=e.summaryText??`All systems operational`;i.push(` ${r(a)}`);let o=e.incidents?.map(e=>`${e.name} (${e.status})`)??[];return j(i,o.length===1?`Active incident`:`Active incidents`,o),j(i,`Affected components`,e.affectedComponents?.map(e=>e.name)??[]),i.join(`
5
- `)}function Ce(e){return e.source===`downdetector`?{source:`downdetector`,status:e.indicator===`unavailable`?`unavailable`:e.reportsOutage?`down`:`up`,details:e.summaryText}:{source:`github`,status:e.indicator===`none`?`up`:e.indicator,details:e.summaryText,incidents:e.incidents,affected:e.affectedComponents}}function we(e){return e.map(e=>Ce(e))}function Te(e,t){if(t.jsonMode||!t.isTTY){t.json(we(e));return}t.log(e.map(e=>M(e,t.isTTY)).join(`
4
+ `)}let a=e.summaryText??`All systems operational`;i.push(` ${r(a)}`);let o=e.incidents?.map(e=>`${e.name} (${e.status})`)??[];return N(i,o.length===1?`Active incident`:`Active incidents`,o),N(i,`Affected components`,e.affectedComponents?.map(e=>e.name)??[]),i.join(`
5
+ `)}function xe(e){return e.source===`downdetector`?{source:`downdetector`,status:e.indicator===`unavailable`?`unavailable`:e.reportsOutage?`down`:`up`,details:e.summaryText}:{source:`github`,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=>P(e,t.isTTY)).join(`
6
6
 
7
- `))}function Ee(e,t,n={}){let r=n.leadingBlank===!0?`
8
- `:``;t.log(`${r}${M(e,t.isTTY)}`)}function De(e){if(e.jsonMode||!e.isTTY)return;let t=c(!0),n=t.link(A,t.underline(A));e.log(`\n${t.dim(`Watch the live status page: ${n}`)}`)}function Oe(e){return typeof e==`object`&&!!e&&`webSocketDebuggerUrl`in e&&typeof e.webSocketDebuggerUrl==`string`}function ke(e){return typeof e==`object`&&!!e&&`id`in e&&typeof e.id==`number`}function Ae(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(!ke(r))return;let i=t.get(r.id);typeof i==`function`&&(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 je(e,t){let n=await(await fetch(`${e}/json/new?about%3Ablank`,{method:`PUT`})).json();if(!Oe(n))return{ok:!1,error:`unexpected CDP target shape`};let r=new WebSocket(n.webSocketDebuggerUrl);await new Promise((e,t)=>{r.onopen=()=>e(),r.onerror=()=>t(Error(`WebSocket connection failed`)),r.onclose=()=>t(Error(`WebSocket closed before opening`))});let i=Ae(r);return await i(`Page.enable`),await i(`Page.navigate`,{url:t}),{ok:!0,send:i,close:()=>r.close()}}function N(e,t){for(let n of t){let t=u(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 P(e){for(let t of e)if(t&&d(t))return t;return null}function Me(){let e=[];for(let t of ue){let n=process.env[t];if(n)for(let t of le)e.push(ie.join(n,...t))}return e}function Ne(e){let t=e??process.env.GITHUB_UP_CHROME;return t?d(t)?t:null:process.platform===`win32`?N(`where.exe`,ce)??P(Me()):process.platform===`darwin`?N(`which`,C)??P(de):N(`which`,C)}async function Pe(e,t){let n=Date.now()+t;for(;Date.now()<n;){try{if((await fetch(`${e}/json/version`)).ok)return!0}catch{}await p(100)}return!1}async function Fe(e,t){let n=f(e,`DevToolsActivePort`),r=Date.now()+t;for(;Date.now()<r;){try{let e=te(n,`utf8`).split(`
9
- `)[0]?.trim(),t=Number(e);if(Number.isInteger(t)&&t>0)return t}catch{}await p(100)}return null}async function Ie(e){let t;try{t=ee(f(re(),`github-up-`))}catch(e){return{ok:!1,error:`mkdtemp failed: ${e instanceof Error?e.message:String(e)}`}}let n=l(e,[`--headless=new`,`--disable-gpu`,`--no-sandbox`,`--disable-blink-features=AutomationControlled`,`--window-size=1920,1080`,`--user-data-dir=${t}`,`--remote-debugging-port=0`,`--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`}),r=new Promise(e=>{n.once(`error`,t=>e({failed:t.message})),n.once(`exit`,(t,n)=>e({failed:`Chrome exited before CDP came up (${n??t??`unknown`})`}))}),i=await Promise.race([Fe(t,5e3),r]);if(typeof i!=`number`)return F(n,t),{ok:!1,error:i===null?`CDP endpoint never came up`:`Chrome launch failed: ${i.failed}`};let a=`http://localhost:${i}`;return await Pe(a,5e3)?{ok:!0,browser:{proc:n,userDataDir:t,base:a}}:(F(n,t),{ok:!1,error:`CDP endpoint never came up`})}function F(e,t){process.platform===`win32`&&e.pid!==void 0?u(`taskkill`,[`/pid`,String(e.pid),`/t`,`/f`]):e.kill();try{ne(t,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}catch{}}const I=`({
7
+ `))}function we(e,t,n={}){let r=n.leadingBlank===!0?`
8
+ `:``;t.log(`${r}${P(e,t.isTTY)}`)}function Te(e){if(e.jsonMode||!e.isTTY)return;let t=l(!0),n=t.link(M.homepage,t.underline(M.homepage));e.log(`\n${t.dim(`Watch the live status page: ${n}`)}`)}function Ee(e){return typeof e==`object`&&!!e&&`webSocketDebuggerUrl`in e&&typeof e.webSocketDebuggerUrl==`string`}function De(e){return typeof e==`object`&&!!e&&`id`in e&&typeof e.id==`number`}function Oe(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(!De(r))return;let i=t.get(r.id);typeof i==`function`&&(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 ke(e,t){let n=await(await fetch(`${e}/json/new?about%3Ablank`,{method:`PUT`})).json();if(!Ee(n))return{ok:!1,error:`unexpected CDP target shape`};let r=new WebSocket(n.webSocketDebuggerUrl);await new Promise((e,t)=>{r.onopen=()=>e(),r.onerror=()=>t(Error(`WebSocket connection failed`)),r.onclose=()=>t(Error(`WebSocket closed before opening`))});let i=Oe(r);return await i(`Page.enable`),await i(`Page.navigate`,{url:t}),{ok:!0,send:i,close:()=>r.close()}}function F(e,t){for(let n of t){let t=d(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 I(e){for(let t of e)if(t&&f(t))return t;return null}function Ae(){let e=[];for(let t of de){let n=process.env[t];if(n)for(let t of ue)e.push(ie.join(n,...t))}return e}function je(e){let t=e??process.env.GITHUB_UP_CHROME;return t?f(t)?t:null:process.platform===`win32`?F(`where.exe`,le)??I(Ae()):process.platform===`darwin`?F(`which`,C)??I(fe):F(`which`,C)}async function Me(e,t){let n=Date.now()+t;for(;Date.now()<n;){try{if((await fetch(`${e}/json/version`)).ok)return!0}catch{}await m(100)}return!1}async function Ne(e,t){let n=p(e,`DevToolsActivePort`),r=Date.now()+t;for(;Date.now()<r;){try{let e=te(n,`utf8`).split(`
9
+ `)[0]?.trim(),t=Number(e);if(Number.isInteger(t)&&t>0)return t}catch{}await m(100)}return null}async function Pe(e){let t;try{t=ee(p(re(),`github-up-`))}catch(e){return{ok:!1,error:`mkdtemp failed: ${e instanceof Error?e.message:String(e)}`}}let n=u(e,[`--headless=new`,`--disable-gpu`,`--no-sandbox`,`--disable-blink-features=AutomationControlled`,`--window-size=1920,1080`,`--user-data-dir=${t}`,`--remote-debugging-port=0`,`--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`}),r=new Promise(e=>{n.once(`error`,t=>e({failed:t.message})),n.once(`exit`,(t,n)=>e({failed:`Chrome exited before CDP came up (${n??t??`unknown`})`}))}),i=await Promise.race([Ne(t,5e3),r]);if(typeof i!=`number`)return L(n,t),{ok:!1,error:i===null?`CDP endpoint never came up`:`Chrome launch failed: ${i.failed}`};let a=`http://localhost:${i}`;return await Me(a,5e3)?{ok:!0,browser:{proc:n,userDataDir:t,base:a}}:(L(n,t),{ok:!1,error:`CDP endpoint never came up`})}function L(e,t){process.platform===`win32`&&e.pid!==void 0?d(`taskkill`,[`/pid`,String(e.pid),`/t`,`/f`]):e.kill();try{ne(t,{recursive:!0,force:!0,maxRetries:5,retryDelay:100})}catch{}}const R=`({
10
10
  title: document.title,
11
11
  pogo: window.PogoConfig ?? null,
12
12
  h1: document.querySelector('h1')?.innerText ?? null,
13
13
  cfChallenge: document.title === 'Just a moment...'
14
14
  || document.querySelector('script[src*="/cdn-cgi/challenge-platform/"]') !== null
15
15
  || document.body?.innerText?.includes('Enable JavaScript and cookies to continue') === true,
16
- })`;function Le(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 L(e){if(typeof e!=`object`||!e||!(`title`in e)||typeof e.title!=`string`||`h1`in e&&e.h1!==null&&typeof e.h1!=`string`||`cfChallenge`in e&&e.cfChallenge!==void 0&&typeof e.cfChallenge!=`boolean`||!(`pogo`in e))return!1;let{pogo:t}=e;return t===null||!(typeof t!=`object`||`outage`in t&&t.outage!==void 0&&typeof t.outage!=`boolean`)}async function Re(e,t){return await e(`Runtime.enable`),ze(async t=>{let n=await e(`Runtime.evaluate`,{expression:`JSON.stringify(${t})`,returnByValue:!0});if(!Le(n))return null;try{return JSON.parse(n.result.result.value)}catch{return null}},t)}async function ze(e,t){let n=Date.now()+t;for(;Date.now()<n;){let t=await e(I);if(L(t)&&t.cfChallenge===!0)return{kind:`cloudflare-challenge`};if(L(t)&&t.pogo!==null)return{kind:`status`,pogo:t.pogo,heading:t.h1};await p(700)}return null}const R=/possible problems/i;function z(e){return e!==null&&R.test(e)?e:void 0}const Be=`
16
+ })`;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`||`cfChallenge`in e&&e.cfChallenge!==void 0&&typeof e.cfChallenge!=`boolean`||!(`pogo`in e))return!1;let{pogo:t}=e;return t===null||!(typeof t!=`object`||`outage`in t&&t.outage!==void 0&&typeof t.outage!=`boolean`)}async function Le(e,t){return await e(`Runtime.enable`),Re(async t=>{let n=await e(`Runtime.evaluate`,{expression:`JSON.stringify(${t})`,returnByValue:!0});if(!Fe(n))return null;try{return JSON.parse(n.result.result.value)}catch{return null}},t)}async function Re(e,t){let n=Date.now()+t;for(;Date.now()<n;){let t=await e(R);if(Ie(t)&&t.cfChallenge===!0)return{kind:`cloudflare-challenge`};if(Ie(t)&&t.pogo!==null)return{kind:`status`,pogo:t.pogo,heading:t.h1};await m(700)}return null}const z=/possible problems/i;function B(e){return e!==null&&z.test(e)?e:void 0}const ze=`
17
17
  const WEBVIEW_WIDTH = 1920;
18
18
  const WEBVIEW_HEIGHT = 1080;
19
19
  const SNAPSHOT_TIMEOUT_MS = 20000;
20
20
  const POLL_INTERVAL_MS = 700;
21
21
  const CHROME_ARGV = ${JSON.stringify([`--headless=new`,`--disable-gpu`,`--no-sandbox`,`--disable-blink-features=AutomationControlled`,`--window-size=1920,1080`,`--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36`])};
22
- const POSSIBLE_PROBLEMS_PATTERN = ${R};
23
- ${z.toString()}
22
+ const POSSIBLE_PROBLEMS_PATTERN = ${z};
23
+ ${B.toString()}
24
24
 
25
25
  function webViewOptions(chromePath) {
26
26
  if (chromePath || process.platform !== 'darwin') {
@@ -54,7 +54,7 @@ function isPogoSnapshot(value) {
54
54
  async function pollPogoSnapshot(view) {
55
55
  const deadline = Date.now() + SNAPSHOT_TIMEOUT_MS;
56
56
  while (Date.now() < deadline) {
57
- const snapshot = await view.evaluate(${JSON.stringify(I)}).catch(() => null);
57
+ const snapshot = await view.evaluate(${JSON.stringify(R)}).catch(() => null);
58
58
  if (isPogoSnapshot(snapshot) && snapshot.cfChallenge === true) {
59
59
  return { kind: 'cloudflare-challenge' };
60
60
  }
@@ -116,6 +116,6 @@ self.onmessage = async (event) => {
116
116
  });
117
117
  }
118
118
  };
119
- `;function Ve(){let e=globalThis.Bun;return e===void 0?null:e}function B(){let e=Ve()?.WebView;return typeof e==`function`?e:null}function He(){return B()!==null}function Ue(){let e=URL.createObjectURL(new Blob([Be],{type:`text/javascript`}));return new Worker(e,{type:`module`})}async function We(e,t,n=45e3){let r;try{r=Ue()}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}try{return await new Promise(i=>{let a=setTimeout(()=>{r.terminate(),i({ok:!1,error:`Bun.WebView timed out`})},n);r.onmessage=e=>{clearTimeout(a),r.terminate();let t=e.data;if(t.type===`result`){i(t.result);return}i({ok:!1,error:t.error})},r.onerror=e=>{clearTimeout(a),r.terminate(),i({ok:!1,error:e.message})},r.postMessage({url:e,chromePath:t})})}finally{await p(0)}}async function Ge(e,t){return B()===null?{ok:!1,error:`Bun.WebView is unavailable; upgrade Bun or run with Node`}:We(e,t??process.env.GITHUB_UP_CHROME)}async function Ke(e){if(He())return Ge(S,e);let t=Ne(e);if(t===null)return{ok:!1,error:`no Chrome/Chromium found; set GITHUB_UP_CHROME or pass --chrome <path>`};let n=await Ie(t);if(!n.ok)return n;let{browser:{proc:r,userDataDir:i,base:a}}=n;try{let e=await je(a,S);if(!e.ok)return e;let t=await Re(e.send,2e4);if(e.close(),t===null)return{ok:!1,error:`CF challenge not cleared in time`};if(t.kind===`cloudflare-challenge`)return{ok:!1,error:`Cloudflare challenge page`};if(t.pogo.outage===!0)return{ok:!0,down:!0,reason:t.heading??`outage reported`};let n=z(t.heading);return n===void 0?{ok:!0,down:!1}:{ok:!0,down:!1,note:n}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}finally{F(r,i)}}const qe={components(){return V(`/components.json`)},Incidents:{all(){return V(`/incidents.json`)},unresolved(){return V(`/incidents/unresolved.json`)}},ScheduledMaintenances:{active(){return V(`/scheduled-maintenances/active.json`)},all(){return V(`/scheduled-maintenances.json`)},upcoming(){return V(`/scheduled-maintenances/upcoming.json`)}},status(){return V(`/status.json`)},subscriber(e){return V(`/subscribers/${encodeURIComponent(e)}.json`)},subscribers(){return V(`/subscribers.json`)},summary(){return V(`/summary.json`)}},V=(e,t=`/api/v2/`)=>`${t.replace(/\/+$/,``)}/${e.replace(/^\/+/,``)}`;function H(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function U(e){return H(e)&&typeof e.name==`string`&&typeof e.status==`string`}function Je(e){return H(e)&&typeof e.indicator==`string`&&typeof e.description==`string`}function Ye(e){return U(e)&&H(e)&&typeof e.impact==`string`}function Xe(e){return H(e)&&Je(e.status)&&Array.isArray(e.components)&&e.components.every(U)&&Array.isArray(e.incidents)&&e.incidents.every(Ye)}async function Ze(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 Qe(e=x){try{let t=await fetch(new URL(qe.summary(),e));if(!t.ok){let{headers:e}=t;return{headers:e,kind:`unknown`,reason:await Ze(t)}}let n=await t.json();return Xe(n)?{headers:t.headers,kind:`ok`,summary:n}:{headers:t.headers,kind:`unknown`,reason:`unexpected response shape from status API`}}catch(e){return{kind:`unknown`,reason:e instanceof Error?e.message:String(e)}}}const W={none:0,minor:1,major:2,critical:3},$e={none:`All Systems Operational`,minor:`Minor Service Outage`,major:`Major Service Outage`,critical:`Critical Service Outage`};function et(e){return typeof e==`string`&&e in W}function tt(e){return et(e)?e:`critical`}function G(e,t){return W[t]>W[e]?t:e}function nt(e){switch(e){case`operational`:return`none`;case`degraded_performance`:case`under_maintenance`:return`minor`;case`partial_outage`:case`major_outage`:return`major`;default:return`major`}}function rt(e){switch(e){case`degraded_performance`:case`partial_outage`:case`major_outage`:return!0;default:return!1}}function K(e){let t=`none`,n=0;for(let r of e)rt(r.status)&&(n+=1),t=G(t,nt(r.status));return n>=3?G(t,`major`):t}function it(e,t=[]){return G(tt(e),K(t))}function at(e){return $e[e]}function ot(e){return e===`operational`||e===`degraded_performance`||e===`partial_outage`||e===`major_outage`||e===`under_maintenance`?e:`major_outage`}async function q(e){let t=await Qe(e);if(t.kind===`unknown`)return{source:`github`,indicator:`unavailable`,summaryText:t.reason,incidents:null,affectedComponents:null};let n=t.summary.status.indicator,r=it(n,t.summary.components),i=r===n?t.summary.status.description:`${at(r)} (reported ${String(n)})`,a=t.summary.components.filter(e=>e.status!==`operational`);return{source:`github`,indicator:r,summaryText:i,incidents:t.summary.incidents.length>0?t.summary.incidents.map(e=>({name:e.name,status:e.status})):null,affectedComponents:a.length>0?a.map(e=>({name:e.name,status:ot(e.status)})):null}}async function J(e){let t=await Ke(e);return t.ok?t.down?{source:`downdetector`,indicator:`major`,summaryText:t.reason,reportsOutage:!0}:{source:`downdetector`,indicator:t.note===void 0?`none`:`minor`,summaryText:t.note??null,reportsOutage:!1}:{source:`downdetector`,indicator:`unavailable`,summaryText:t.error,reportsOutage:!1}}async function st(e,t,n){switch(e){case`github`:return q(t);case`downdetector`:return J(n)}}function Y(e,t,n){let r=!1;for(let i of t){_(i.name)&&(r=!0);for(let t of v(i.name,n))e.add(t)}return r}function ct(e,t,n){let r=new Set,i=Y(r,e,n),a=Y(r,t,n);if(i||a)for(let e of n)r.add(e);return[...n].filter(e=>r.has(e))}function X(e,t){if(e.source!==`github`||t.size===0||e.indicator===`unavailable`)return e;let n=e.incidents?.filter(e=>y(e.name,t))??[],r=e.affectedComponents?.filter(e=>y(e.name,t))??[],i=n.length+r.length,a=ct(n,r,t),o=K(r);return{source:`github`,indicator:n.length>0?G(o,`minor`):o,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 lt(e){let t=b[e.indicator];return e.source===`github`&&e.incidents&&e.incidents.length>0?Math.max(t,b.minor):t}function Z(e){let t=e.filter(e=>e.indicator!==`unavailable`);return t.length===0?e.length===0?b.none:b.unavailable:t.reduce((e,t)=>Math.max(e,lt(t)),b.none)}function ut(e){return[...e].sort((e,t)=>e.source.localeCompare(t.source))}function dt(e,n=t){switch(n){case`darwin`:return{command:`open`,args:[e]};case`win32`:return{command:`cmd`,args:[`/c`,`start`,``,e]};default:return{command:`xdg-open`,args:[e]}}}function ft(e){let{args:t,command:n}=dt(e);return new Promise((e,r)=>{let i=l(n,[...t],{detached:!0,stdio:`ignore`});i.once(`error`,r),i.once(`spawn`,()=>{i.unref(),e()})})}function Q(e){return e.flag(`component`,he).flag(`actions`,O.actions).flag(`api`,O.api).flag(`codespaces`,O.codespaces).flag(`copilot`,O.copilot).flag(`git`,O.git).flag(`issues`,O.issues).flag(`packages`,O.packages).flag(`pages`,O.pages).flag(`pr`,O.pr).flag(`webhooks`,O.webhooks)}async function $(e,t,n,r){if(r.isTTY&&!r.jsonMode&&!n){let n=await mt(e,t,r);r.setExitCode(Z(n));return}ht(gt(await Promise.all(e.map(e=>e.run())),t),n,r)}function pt(e){return`Checking ${[...e].map(e=>h[e]).join(`, `)}…`}async function mt(e,t,n){let r=new Set(e.map(e=>e.source)),i=[],a=new Map(e.map((e,t)=>[t,e.run().then(t=>({source:e.source,row:t}))])),o=n.spinner(pt(r)),s=0;try{for(;a.size>0;){let e=await Promise.race([...a].map(([e,t])=>t.then(t=>({index:e,...t}))));a.delete(e.index),r.delete(e.source);let c=X(e.row,t);i.push(c),o.stop(),Ee(c,n,{leadingBlank:s>0}),s+=1,r.size>0&&(o=n.spinner(pt(r)))}}catch(e){throw o.stop(),e}return De(n),i}function ht(e,t,n){t||Te(ut(e),n),n.setExitCode(Z(e))}function gt(e,t){return t.size===0?e:e.map(e=>X(e,t))}const _t=Q(i(`status`).description(`Check GitHub status across GitHub and Downdetector`).example(`status`,`Check all sources`).example(`status --source github`,`Check only GitHub`).example(`status --actions`,`Only report trouble mentioning Actions`).example(`status --json`,`Emit machine-readable source rows`)).flag(`githubStatusBase`,E).flag(`chrome`,D).flag(`quiet`,T).flag(`source`,me).action(async({flags:e,out:t})=>{let{source:n,githubStatusBase:r,chrome:i,quiet:a}=e;await $(ge(n).map(e=>({source:e,run:()=>st(e,r,i)})),k(e),a,t)}),vt=Q(i(`github`).description(`Check only ${h.github}`).example(`github`,`Check only ${h.github}`).example(`github --component actions`,`Only report trouble mentioning Actions`)).flag(`githubStatusBase`,E).flag(`quiet`,T).action(async({flags:e,out:t})=>{await $([{source:`github`,run:()=>q(e.githubStatusBase)}],k(e),e.quiet,t)}),yt=i(`downdetector`).description(`Check only ${h.downdetector}`).example(`downdetector`,`Check only ${h.downdetector}`).flag(`chrome`,D).flag(`quiet`,T).action(async({flags:e,out:t})=>{await $([{source:`downdetector`,run:()=>J(e.chrome)}],new Set,e.quiet,t)});function bt(e=ft){return i(`web`).alias(`site`).description(`Open the live status page`).example(`web`,`Open the live status page in your browser`).action(async({out:t})=>{await e(A),t.log(`Opening ${A}`)})}const xt=bt(),St=s({repository:ye}),Ct=r(_e).manifest({from:import.meta.url}).links({name:St,version:`${St}/releases/tag/v${ve}`}).default(_t,{route:!0}).command(vt).command(yt).command(xt).completions(),wt=new Set([`--help`,`-h`]);function Tt(e){return e.some(e=>wt.has(e))}function Et(e,t=!1){return`
119
+ `;function Be(){let e=globalThis.Bun;return e===void 0?null:e}function V(){let e=Be()?.WebView;return typeof e==`function`?e:null}function Ve(){return V()!==null}function He(){let e=URL.createObjectURL(new Blob([ze],{type:`text/javascript`}));return new Worker(e,{type:`module`})}async function Ue(e,t,n=45e3){let r;try{r=He()}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}try{return await new Promise(i=>{let a=setTimeout(()=>{r.terminate(),i({ok:!1,error:`Bun.WebView timed out`})},n);r.onmessage=e=>{clearTimeout(a),r.terminate();let t=e.data;if(t.type===`result`){i(t.result);return}i({ok:!1,error:t.error})},r.onerror=e=>{clearTimeout(a),r.terminate(),i({ok:!1,error:e.message})},r.postMessage({url:e,chromePath:t})})}finally{await m(0)}}async function We(e,t){return V()===null?{ok:!1,error:`Bun.WebView is unavailable; upgrade Bun or run with Node`}:Ue(e,t??process.env.GITHUB_UP_CHROME)}async function Ge(e){if(Ve())return We(S,e);let t=je(e);if(t===null)return{ok:!1,error:`no Chrome/Chromium found; set GITHUB_UP_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 ke(a,S);if(!e.ok)return e;let t=await Le(e.send,2e4);if(e.close(),t===null)return{ok:!1,error:`CF challenge not cleared in time`};if(t.kind===`cloudflare-challenge`)return{ok:!1,error:`Cloudflare challenge page`};if(t.pogo.outage===!0)return{ok:!0,down:!0,reason:t.heading??`outage reported`};let n=B(t.heading);return n===void 0?{ok:!0,down:!1}:{ok:!0,down:!1,note:n}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}finally{L(r,i)}}const Ke={components(){return H(`/components.json`)},Incidents:{all(){return H(`/incidents.json`)},unresolved(){return H(`/incidents/unresolved.json`)}},ScheduledMaintenances:{active(){return H(`/scheduled-maintenances/active.json`)},all(){return H(`/scheduled-maintenances.json`)},upcoming(){return H(`/scheduled-maintenances/upcoming.json`)}},status(){return H(`/status.json`)},subscriber(e){return H(`/subscribers/${encodeURIComponent(e)}.json`)},subscribers(){return H(`/subscribers.json`)},summary(){return H(`/summary.json`)}},H=(e,t=`/api/v2/`)=>`${t.replace(/\/+$/,``)}/${e.replace(/^\/+/,``)}`;function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e){return U(e)&&typeof e.name==`string`&&typeof e.status==`string`}function qe(e){return U(e)&&typeof e.indicator==`string`&&typeof e.description==`string`}function Je(e){return W(e)&&U(e)&&typeof e.impact==`string`}function Ye(e){return U(e)&&qe(e.status)&&Array.isArray(e.components)&&e.components.every(W)&&Array.isArray(e.incidents)&&e.incidents.every(Je)}async function Xe(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 Ze(e=x){try{let t=await fetch(new URL(Ke.summary(),e));if(!t.ok){let{headers:e}=t;return{headers:e,kind:`unknown`,reason:await Xe(t)}}let n=await t.json();return Ye(n)?{headers:t.headers,kind:`ok`,summary:n}:{headers:t.headers,kind:`unknown`,reason:`unexpected response shape from status API`}}catch(e){return{kind:`unknown`,reason:e instanceof Error?e.message:String(e)}}}const G={none:0,minor:1,major:2,critical:3},Qe={none:`All Systems Operational`,minor:`Minor Service Outage`,major:`Major Service Outage`,critical:`Critical Service Outage`};function $e(e){return typeof e==`string`&&e in G}function et(e){return $e(e)?e:`critical`}function K(e,t){return G[t]>G[e]?t:e}function tt(e){switch(e){case`operational`:return`none`;case`degraded_performance`:case`under_maintenance`:return`minor`;case`partial_outage`:case`major_outage`:return`major`;default:return`major`}}function nt(e){switch(e){case`degraded_performance`:case`partial_outage`:case`major_outage`:return!0;default:return!1}}function q(e){let t=`none`,n=0;for(let r of e)nt(r.status)&&(n+=1),t=K(t,tt(r.status));return n>=3?K(t,`major`):t}function rt(e,t=[]){return K(et(e),q(t))}function it(e){return Qe[e]}function at(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 Ze(e);if(t.kind===`unknown`)return{source:`github`,indicator:`unavailable`,summaryText:t.reason,incidents:null,affectedComponents:null};let n=t.summary.status.indicator,r=rt(n,t.summary.components),i=r===n?t.summary.status.description:`${it(r)} (reported ${String(n)})`,a=t.summary.components.filter(e=>e.status!==`operational`);return{source:`github`,indicator:r,summaryText:i,incidents:t.summary.incidents.length>0?t.summary.incidents.map(e=>({name:e.name,status:e.status})):null,affectedComponents:a.length>0?a.map(e=>({name:e.name,status:at(e.status)})):null}}async function Y(e){let t=await Ge(e);return t.ok?t.down?{source:`downdetector`,indicator:`major`,summaryText:t.reason,reportsOutage:!0}:{source:`downdetector`,indicator:t.note===void 0?`none`:`minor`,summaryText:t.note??null,reportsOutage:!1}:{source:`downdetector`,indicator:`unavailable`,summaryText:t.error,reportsOutage:!1}}async function ot(e,t,n){switch(e){case`github`:return J(t);case`downdetector`:return Y(n)}}function X(e,t,n){let r=!1;for(let i of t){ce(i.name)&&(r=!0);for(let t of v(i.name,n))e.add(t)}return r}function st(e,t,n){let r=new Set,i=X(r,e,n),a=X(r,t,n);if(i||a)for(let e of n)r.add(e);return[...n].filter(e=>r.has(e))}function Z(e,t){if(e.source!==`github`||t.size===0||e.indicator===`unavailable`)return e;let n=e.incidents?.filter(e=>y(e.name,t))??[],r=e.affectedComponents?.filter(e=>y(e.name,t))??[],i=n.length+r.length,a=st(n,r,t),o=q(r);return{source:`github`,indicator:n.length>0?K(o,`minor`):o,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 ct(e){let t=b[e.indicator];return e.source===`github`&&e.incidents&&e.incidents.length>0?Math.max(t,b.minor):t}function Q(e){let t=e.filter(e=>e.indicator!==`unavailable`);return t.length===0?e.length===0?b.none:b.unavailable:t.reduce((e,t)=>Math.max(e,ct(t)),b.none)}function lt(e){return[...e].sort((e,t)=>e.source.localeCompare(t.source))}function ut(e,n=t){switch(n){case`darwin`:return{command:`open`,args:[e]};case`win32`:return{command:`cmd`,args:[`/c`,`start`,``,e]};default:return{command:`xdg-open`,args:[e]}}}function dt(e){let{args:t,command:n}=ut(e);return new Promise((e,r)=>{let i=u(n,[...t],{detached:!0,stdio:`ignore`});i.once(`error`,r),i.once(`spawn`,()=>{i.unref(),e()})})}function ft(e){return e.flag(`component`,ge).flag(`actions`,k.actions).flag(`api`,k.api).flag(`codespaces`,k.codespaces).flag(`copilot`,k.copilot).flag(`git`,k.git).flag(`issues`,k.issues).flag(`packages`,k.packages).flag(`pages`,k.pages).flag(`pr`,k.pr).flag(`webhooks`,k.webhooks)}async function $(e,t,n,r){if(r.isTTY&&!r.jsonMode&&!n){let n=await mt(e,t,r);r.setExitCode(Q(n));return}ht(gt(await Promise.all(e.map(e=>e.run())),t),n,r)}function pt(e){return`Checking ${[...e].map(e=>g[e]).join(`, `)}…`}async function mt(e,t,n){let r=new Set(e.map(e=>e.source)),i=[],a=new Map(e.map((e,t)=>[t,e.run().then(t=>({source:e.source,row:t}))])),o=n.spinner(pt(r)),s=0;try{for(;a.size>0;){let e=await Promise.race([...a].map(([e,t])=>t.then(t=>({index:e,...t}))));a.delete(e.index),r.delete(e.source);let c=Z(e.row,t);i.push(c),o.stop(),we(c,n,{leadingBlank:s>0}),s+=1,r.size>0&&(o=n.spinner(pt(r)))}}catch(e){throw o.stop(),e}return Te(n),i}function ht(e,t,n){t||Ce(lt(e),n),n.setExitCode(Q(e))}function gt(e,t){return t.size===0?e:e.map(e=>Z(e,t))}const _t=ft(i(`status`).description(`Check GitHub status across GitHub and Downdetector`).example(`status`,`Check all sources`).example(`status --source github`,`Check only GitHub`).example(`status --actions`,`Only report trouble mentioning Actions`).example(`status --json`,`Emit machine-readable source rows`)).flag(`githubStatusBase`,E).flag(`chrome`,D).flag(`quiet`,T).flag(`source`,he).action(async({flags:e,out:t})=>{let{source:n,githubStatusBase:r,chrome:i,quiet:a}=e;await $(_e(n).map(e=>({source:e,run:()=>ot(e,r,i)})),A(e),a,t)}),vt=ft(i(`github`).description(`Check only ${g.github}`).example(`github`,`Check only ${g.github}`).example(`github --component actions`,`Only report trouble mentioning Actions`)).flag(`githubStatusBase`,E).flag(`quiet`,T).action(async({flags:e,out:t})=>{await $([{source:`github`,run:()=>J(e.githubStatusBase)}],A(e),e.quiet,t)}),yt=i(`downdetector`).description(`Check only ${g.downdetector}`).example(`downdetector`,`Check only ${g.downdetector}`).flag(`chrome`,D).flag(`quiet`,T).action(async({flags:e,out:t})=>{await $([{source:`downdetector`,run:()=>Y(e.chrome)}],new Set,e.quiet,t)});function bt(e=dt){return i(`web`).alias(`site`).description(`Open the live status page`).example(`web`,`Open the live status page in your browser`).action(async({out:t})=>{await e(M.homepage),t.log(`Opening ${M.homepage}`)})}const xt=bt(),St=s({repository:M.repository}),Ct=r(M.name).manifest(M).links({name:St,version:`${St}/releases/tag/v${M.version}`}).default(_t,{route:!0}).command(vt).command(yt).command(xt).completions(),wt=new Set([`--help`,`-h`]);function Tt(e){return e.some(e=>wt.has(e))}function Et(e,t=!1){return`
120
120
  No terminal? Watch the live status page: ${t?o(e,e):e}
121
- `}if(import.meta.main){let t=ae(),n=Tt(e.slice(2));Ct.run({adapter:{...t,exit:e=>(n&&t.stdout(Et(A,t.isTTY)),t.exit(e))}})}export{};
121
+ `}if(import.meta.main){let t=ae(),n=Tt(e.slice(2));Ct.run({adapter:{...t,exit:e=>(n&&t.stdout(Et(j,t.isTTY)),t.exit(e))}})}export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-up",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Is GitHub down? Probably...",
5
5
  "homepage": "https://github-up.kjanat.dev",
6
6
  "bugs": {
@@ -73,7 +73,7 @@
73
73
  "publish:pkg-pr-new": "bunx pkg-pr-new publish --bun --bin --packageManager=npm,bun,pnpm"
74
74
  },
75
75
  "dependencies": {
76
- "@kjanat/dreamcli": "^3.0.0-rc.7",
76
+ "@kjanat/dreamcli": "^3.0.0-rc.8",
77
77
  "ansispeck": "^0.1.2"
78
78
  },
79
79
  "devDependencies": {
@@ -100,7 +100,7 @@
100
100
  "runtime": [
101
101
  {
102
102
  "name": "bun",
103
- "onFail": "warn"
103
+ "onFail": "ignore"
104
104
  }
105
105
  ]
106
106
  },