github-up 0.1.0 → 0.1.1
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/dist/bin/cli.mjs +1 -1
- package/package.json +2 -2
package/dist/bin/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{ParseError as e,cli as t,command as n,flag as r,osc8 as i}from"@kjanat/dreamcli";import{createColors as a}from"ansispeck";import{spawn as o,spawnSync as s}from"node:child_process";import{existsSync as c,mkdtempSync as ee,readFileSync as te,rmSync as ne}from"node:fs";import{tmpdir as re}from"node:os";import{join as l,win32 as ie}from"node:path";import{setTimeout as u}from"node:timers/promises";import{argv as ae,platform as oe,stdout as se}from"node:process";import{createNodeAdapter as ce}from"@kjanat/dreamcli/runtime";var le=`github-up`,d=`0.1.
|
|
2
|
+
import{ParseError as e,cli as t,command as n,flag as r,osc8 as i}from"@kjanat/dreamcli";import{createColors as a}from"ansispeck";import{spawn as o,spawnSync as s}from"node:child_process";import{existsSync as c,mkdtempSync as ee,readFileSync as te,rmSync as ne}from"node:fs";import{tmpdir as re}from"node:os";import{join as l,win32 as ie}from"node:path";import{setTimeout as u}from"node:timers/promises";import{argv as ae,platform as oe,stdout as se}from"node:process";import{createNodeAdapter as ce}from"@kjanat/dreamcli/runtime";var le=`github-up`,d=`0.1.1`,ue=`Is GitHub down? Probably...`,f=`https://github-up.kjanat.dev`,de={type:`git`,url:`git+https://github.com/kjanat/github-up.git`};const p=[`github`,`downdetector`],m={github:`GitHub`,downdetector:`Downdetector`},h=[`actions`,`api`,`codespaces`,`copilot`,`git`,`issues`,`packages`,`pages`,`pr`,`webhooks`],fe={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},pe=/\b(?:all|many|most|multiple|several|some|various)\s+(?:github\s+)?(?:components|services|systems)\b/i;function g(e){return pe.test(e)}function _(e,t){let n=[];for(let r of t)fe[r].test(e)&&n.push(r);return n}function v(e,t){return t.size>0&&(_(e,t).length>0||g(e))}const y={none:0,minor:1,major:2,critical:2,unavailable:21},b=`https://www.githubstatus.com`,x=`https://downdetector.com/status/github/`,S=[`google-chrome-stable`,`google-chrome`,`chromium`,`brave`,`microsoft-edge-stable`,`microsoft-edge`],me=[`chrome.exe`,`msedge.exe`,`brave.exe`],he=[[`Google`,`Chrome`,`Application`,`chrome.exe`],[`Microsoft`,`Edge`,`Application`,`msedge.exe`],[`BraveSoftware`,`Brave-Browser`,`Application`,`brave.exe`],[`Chromium`,`Application`,`chrome.exe`]],ge=[`ProgramFiles`,`ProgramFiles(x86)`,`LOCALAPPDATA`],_e=[`/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 C(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 ve=C(p,`source`),ye=C(h,`component`),w=r.boolean().alias(`q`).describe(`Silent; exit code only`),T=r.custom(e=>new URL(String(e))).alias(`github-status-base`,{hidden:!0}).alias(`base`).alias(`b`).default(new URL(b)).env(`GITHUB_UP_GITHUB_STATUS_BASE`).describe(`Override GitHub status page base URL`),be=r.array(r.custom(ve)).alias(`s`).default([[...p]]).env(`GITHUB_UP_SOURCE`).env(`GITHUB_UP_SOURCES`).describe(`Data source(s) to check`),E=r.string().env(`GITHUB_UP_CHROME`).describe(`Path to a Chrome/Chromium binary`),xe=r.array(r.custom(ye)).alias(`c`).describe(`Only report incidents/components mentioning these component(s)`),D={actions:r.boolean().describe(`Shortcut for --component actions`),api:r.boolean().describe(`Shortcut for --component api`),codespaces:r.boolean().describe(`Shortcut for --component codespaces`),copilot:r.boolean().describe(`Shortcut for --component copilot`),git:r.boolean().describe(`Shortcut for --component git`),issues:r.boolean().alias(`issue`).describe(`Shortcut for --component issues`),packages:r.boolean().describe(`Shortcut for --component packages`),pages:r.boolean().describe(`Shortcut for --component pages`),pr:r.boolean().alias(`prs`).describe(`Shortcut for --component pr`),webhooks:r.boolean().describe(`Shortcut for --component webhooks`)};function O(e){let t=new Set(e.component.flat());for(let n of h)e[n]&&t.add(n);return t}function Se(e){return[...new Set(e.flat())]}function Ce(e){return{none:e.green,minor:e.yellow,major:e.red,critical:e.red}}function we(e,t){return e.indicator===`unavailable`?t.dim:Ce(t)[e.indicator]}function Te(e){return e.source===`github`?b:x}function k(e,t,n){if(n.length!==0){e.push(` ${t}:`);for(let t of n)e.push(` - ${t}`)}}function A(e,t){let n=a(t),r=we(e,n),i=[n.link(Te(e),n.underline(n.bold(r(m[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
4
|
`)}let o=e.summaryText??`All systems operational`;i.push(` ${r(o)}`);let s=e.incidents?.map(e=>`${e.name} (${e.status})`)??[];return k(i,s.length===1?`Active incident`:`Active incidents`,s),k(i,`Affected components`,e.affectedComponents?.map(e=>e.name)??[]),i.join(`
|
|
5
5
|
`)}function Ee(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 De(e){return e.map(e=>Ee(e))}function Oe(e,t){if(t.jsonMode||!t.isTTY){t.json(De(e));return}t.log(e.map(e=>A(e,t.isTTY)).join(`
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-up",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Is GitHub down? Probably...",
|
|
5
|
-
"homepage": "https://github-up.kjanat.dev
|
|
5
|
+
"homepage": "https://github-up.kjanat.dev",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/kjanat/github-up/issues"
|
|
8
8
|
},
|