downlaude 1.0.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/LICENSE +21 -0
- package/dist/app.d.ts +5 -0
- package/dist/app.js +78 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +56 -0
- package/dist/spinner.d.ts +6 -0
- package/dist/spinner.js +20 -0
- package/dist/statusRow.d.ts +8 -0
- package/dist/statusRow.js +26 -0
- package/dist/theme.d.ts +13 -0
- package/dist/theme.js +51 -0
- package/package.json +56 -0
- package/readme.md +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dawson Huang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/app.d.ts
ADDED
package/dist/app.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Text, Box, useApp } from 'ink';
|
|
3
|
+
import StatusRow from './statusRow.js';
|
|
4
|
+
import Spinner from './spinner.js';
|
|
5
|
+
import { darkTheme, detectTheme } from './theme.js';
|
|
6
|
+
export const ALL_COMPONENTS = [
|
|
7
|
+
'claude.ai',
|
|
8
|
+
'Claude Console',
|
|
9
|
+
'Claude API',
|
|
10
|
+
'Claude Code',
|
|
11
|
+
'Claude Cowork',
|
|
12
|
+
'Claude for Government',
|
|
13
|
+
];
|
|
14
|
+
const stripSuffix = (name) => name.replace(/\s*\([^)]+\)$/, '');
|
|
15
|
+
export default function App({ all = false }) {
|
|
16
|
+
const { exit } = useApp();
|
|
17
|
+
const [theme, setTheme] = useState(darkTheme);
|
|
18
|
+
const [components, setComponents] = useState([]);
|
|
19
|
+
const [done, setDone] = useState(false);
|
|
20
|
+
const [error, setError] = useState(false);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
async function init() {
|
|
23
|
+
const detected = await detectTheme();
|
|
24
|
+
setTheme(detected);
|
|
25
|
+
try {
|
|
26
|
+
const res = await fetch('https://status.anthropic.com/api/v2/components.json');
|
|
27
|
+
const data = await res.json();
|
|
28
|
+
const target = data.components
|
|
29
|
+
.filter((c) => all
|
|
30
|
+
? ALL_COMPONENTS.some(n => c.name.includes(n))
|
|
31
|
+
: c.name.includes('Claude API') || c.name.includes('Claude Code'))
|
|
32
|
+
.sort((a, b) => {
|
|
33
|
+
if (all) {
|
|
34
|
+
const ai = ALL_COMPONENTS.findIndex(n => a.name.includes(n));
|
|
35
|
+
const bi = ALL_COMPONENTS.findIndex(n => b.name.includes(n));
|
|
36
|
+
return ai - bi;
|
|
37
|
+
}
|
|
38
|
+
return a.name.includes('Claude Code') ? -1 : b.name.includes('Claude Code') ? 1 : 0;
|
|
39
|
+
});
|
|
40
|
+
setComponents(target);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
setError(true);
|
|
44
|
+
}
|
|
45
|
+
setDone(true);
|
|
46
|
+
}
|
|
47
|
+
init();
|
|
48
|
+
}, []);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (done)
|
|
51
|
+
exit();
|
|
52
|
+
}, [done, exit]);
|
|
53
|
+
if (!done)
|
|
54
|
+
return React.createElement(Spinner, { text: "Fetching status...", theme: theme });
|
|
55
|
+
if (error)
|
|
56
|
+
return (React.createElement(Box, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, paddingTop: 1, borderStyle: "round", borderColor: theme.major, width: 54 },
|
|
57
|
+
React.createElement(Text, { bold: true },
|
|
58
|
+
React.createElement(Text, { color: theme.accent }, "\u273B"),
|
|
59
|
+
React.createElement(Text, { color: theme.text }, " Claude Status")),
|
|
60
|
+
React.createElement(Box, { marginTop: 1 },
|
|
61
|
+
React.createElement(Text, { color: theme.major }, "\u2718 Could not reach status page")),
|
|
62
|
+
React.createElement(Box, { marginTop: 1 },
|
|
63
|
+
React.createElement(Text, { color: theme.muted }, "Visit https://status.claude.com/ for latest status"))));
|
|
64
|
+
if (components.length === 0)
|
|
65
|
+
return React.createElement(Text, null, " ");
|
|
66
|
+
const displayName = (name) => all ? name : stripSuffix(name);
|
|
67
|
+
const STATUS_COL_WIDTH = 16; // "✘ Partial outage"
|
|
68
|
+
const FOOTER = 'Visit https://status.claude.com/ for latest status';
|
|
69
|
+
const dynamicWidth = Math.max(...components.map(c => displayName(c.name).length)) + 4;
|
|
70
|
+
const boxWidth = Math.max(dynamicWidth + STATUS_COL_WIDTH, FOOTER.length) + 4; // +4 for padding + border
|
|
71
|
+
return (React.createElement(Box, { flexDirection: "column", paddingLeft: 1, paddingRight: 1, paddingTop: 1, borderStyle: "round", borderColor: theme.muted, width: boxWidth },
|
|
72
|
+
React.createElement(Text, { bold: true },
|
|
73
|
+
React.createElement(Text, { color: theme.accent }, "\u273B"),
|
|
74
|
+
React.createElement(Text, { color: theme.text }, " Claude Status")),
|
|
75
|
+
React.createElement(Box, { flexDirection: "column", marginTop: 1 }, components.map((comp) => (React.createElement(StatusRow, { key: comp.id, comp: comp, nameWidth: dynamicWidth, theme: theme, all: all })))),
|
|
76
|
+
React.createElement(Box, { marginTop: 1 },
|
|
77
|
+
React.createElement(Text, { color: theme.muted }, "Visit https://status.claude.com/ for latest status"))));
|
|
78
|
+
}
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { render } from 'ink';
|
|
4
|
+
import meow from 'meow';
|
|
5
|
+
import App, { ALL_COMPONENTS } from './app.js';
|
|
6
|
+
const cli = meow(`
|
|
7
|
+
Usage
|
|
8
|
+
$ downlaude
|
|
9
|
+
|
|
10
|
+
Options
|
|
11
|
+
-a, --all Show all Claude services
|
|
12
|
+
-s, --silent No output; exit 0 if operational, 1 if outage, 2 if unreachable
|
|
13
|
+
|
|
14
|
+
Examples
|
|
15
|
+
$ downlaude
|
|
16
|
+
$ downlaude --all
|
|
17
|
+
$ downlaude --silent && echo "all good"
|
|
18
|
+
`, {
|
|
19
|
+
importMeta: import.meta,
|
|
20
|
+
flags: {
|
|
21
|
+
all: {
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
alias: 'a',
|
|
24
|
+
},
|
|
25
|
+
silent: {
|
|
26
|
+
type: 'boolean',
|
|
27
|
+
alias: 's',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
const known = new Set(['all', 'a', 'silent', 's']);
|
|
32
|
+
const unknown = Object.keys(cli.unnormalizedFlags).filter(f => f !== '_' && !known.has(f));
|
|
33
|
+
if (unknown.length > 0) {
|
|
34
|
+
cli.showHelp(2);
|
|
35
|
+
}
|
|
36
|
+
if (cli.flags.silent) {
|
|
37
|
+
(async () => {
|
|
38
|
+
try {
|
|
39
|
+
const res = await fetch('https://status.anthropic.com/api/v2/components.json');
|
|
40
|
+
const data = await res.json();
|
|
41
|
+
const target = data.components.filter((c) => cli.flags.all
|
|
42
|
+
? ALL_COMPONENTS.some(n => c.name.includes(n))
|
|
43
|
+
: c.name.includes('Claude API') || c.name.includes('Claude Code'));
|
|
44
|
+
const hasOutage = target.some(c => c.status !== 'operational');
|
|
45
|
+
process.exit(hasOutage ? 1 : 0);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
process.exit(2);
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
render(React.createElement(App, { all: cli.flags.all })).waitUntilExit().then(() => {
|
|
54
|
+
process.exit(0);
|
|
55
|
+
});
|
|
56
|
+
}
|
package/dist/spinner.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Text, Box } from 'ink';
|
|
3
|
+
const SPINNER_FRAMES = ["·", "·", "✢", "✳", "✶", "✻", "✽", "✽", "✻", "✶", "✳", "✢"];
|
|
4
|
+
export default function Spinner({ text, theme }) {
|
|
5
|
+
const [time, setTime] = useState(0);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const startTime = Date.now();
|
|
8
|
+
const interval = setInterval(() => setTime(Date.now() - startTime), 10);
|
|
9
|
+
return () => clearInterval(interval);
|
|
10
|
+
}, []);
|
|
11
|
+
const frame = Math.floor(time / 120) % SPINNER_FRAMES.length;
|
|
12
|
+
const glimmerIndex = (Math.floor(time / 50) % (text.length + 20)) - 10;
|
|
13
|
+
return (React.createElement(Box, { padding: 1, flexDirection: "row" },
|
|
14
|
+
React.createElement(Box, { width: 2 },
|
|
15
|
+
React.createElement(Text, { color: theme.accent }, SPINNER_FRAMES[frame])),
|
|
16
|
+
React.createElement(Text, null, text.split('').map((char, index) => {
|
|
17
|
+
const isHighlighted = Math.abs(index - glimmerIndex) <= 1;
|
|
18
|
+
return (React.createElement(Text, { key: index, color: isHighlighted ? theme.shimmer : theme.base }, char));
|
|
19
|
+
}))));
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text, Box } from 'ink';
|
|
3
|
+
const stripSuffix = (name) => name.replace(/\s*\([^)]+\)$/, '');
|
|
4
|
+
export default function StatusRow({ comp, nameWidth, theme, all }) {
|
|
5
|
+
let icon = '✔';
|
|
6
|
+
let statusText = 'Operational';
|
|
7
|
+
let color = theme.operational;
|
|
8
|
+
if (comp.status === 'major_outage') {
|
|
9
|
+
icon = '✘';
|
|
10
|
+
statusText = 'Major outage';
|
|
11
|
+
color = theme.major;
|
|
12
|
+
}
|
|
13
|
+
else if (comp.status !== 'operational') {
|
|
14
|
+
icon = '✘';
|
|
15
|
+
statusText = 'Partial outage';
|
|
16
|
+
color = theme.partial;
|
|
17
|
+
}
|
|
18
|
+
return (React.createElement(Box, null,
|
|
19
|
+
React.createElement(Box, { width: nameWidth },
|
|
20
|
+
React.createElement(Text, null, all ? comp.name : stripSuffix(comp.name))),
|
|
21
|
+
React.createElement(Text, { color: color },
|
|
22
|
+
React.createElement(Text, { bold: true }, icon),
|
|
23
|
+
React.createElement(Text, null,
|
|
24
|
+
" ",
|
|
25
|
+
statusText))));
|
|
26
|
+
}
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Theme = {
|
|
2
|
+
accent: string;
|
|
3
|
+
text: string;
|
|
4
|
+
muted: string;
|
|
5
|
+
shimmer: string;
|
|
6
|
+
base: string;
|
|
7
|
+
operational: string;
|
|
8
|
+
partial: string;
|
|
9
|
+
major: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const darkTheme: Theme;
|
|
12
|
+
export declare const lightTheme: Theme;
|
|
13
|
+
export declare function detectTheme(): Promise<Theme>;
|
package/dist/theme.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const darkTheme = {
|
|
2
|
+
accent: '#c15f3c',
|
|
3
|
+
text: '#FFFFFF',
|
|
4
|
+
muted: '#666666',
|
|
5
|
+
shimmer: '#dcdcdc',
|
|
6
|
+
base: '#acacac',
|
|
7
|
+
operational: 'green',
|
|
8
|
+
partial: 'yellow',
|
|
9
|
+
major: 'red',
|
|
10
|
+
};
|
|
11
|
+
export const lightTheme = {
|
|
12
|
+
accent: '#c15f3c',
|
|
13
|
+
text: '#000000',
|
|
14
|
+
muted: '#404040',
|
|
15
|
+
shimmer: '#000000',
|
|
16
|
+
base: '#262626',
|
|
17
|
+
operational: '#006400',
|
|
18
|
+
partial: '#856404',
|
|
19
|
+
major: '#b22222',
|
|
20
|
+
};
|
|
21
|
+
export async function detectTheme() {
|
|
22
|
+
const colorFGBG = process.env['COLORFGBG'];
|
|
23
|
+
if (colorFGBG) {
|
|
24
|
+
const bg = parseInt(colorFGBG.split(';')[1] || '');
|
|
25
|
+
if (!isNaN(bg) && (bg <= 6 || bg === 8))
|
|
26
|
+
return darkTheme;
|
|
27
|
+
return lightTheme;
|
|
28
|
+
}
|
|
29
|
+
if (!process.stdin.isTTY)
|
|
30
|
+
return darkTheme;
|
|
31
|
+
// Fallback to detection logic
|
|
32
|
+
return new Promise((resolve) => {
|
|
33
|
+
process.stdin.setRawMode(true);
|
|
34
|
+
process.stdout.write('\x1b]11;?\x1b\\');
|
|
35
|
+
process.stdin.once('data', (data) => {
|
|
36
|
+
process.stdin.setRawMode(false);
|
|
37
|
+
const res = data ? data.toString() : '';
|
|
38
|
+
const match = res.match(/rgb:([0-9a-f]+)\/([0-9a-f]+)\/([0-9a-f]+)/i);
|
|
39
|
+
if (match) {
|
|
40
|
+
const r = parseInt(match[1], 16) / 65535;
|
|
41
|
+
const g = parseInt(match[2], 16) / 65535;
|
|
42
|
+
const b = parseInt(match[3], 16) / 65535;
|
|
43
|
+
const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
44
|
+
resolve(luminance > 0.5 ? lightTheme : darkTheme);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
resolve(darkTheme);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "downlaude",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"bin": "dist/cli.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=16"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch",
|
|
13
|
+
"test": "prettier --check . && xo && ava"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"ink": "^4.1.0",
|
|
20
|
+
"ink-spinner": "^5.0.0",
|
|
21
|
+
"meow": "^11.0.0",
|
|
22
|
+
"react": "^18.2.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@sindresorhus/tsconfig": "^3.0.1",
|
|
26
|
+
"@types/react": "^18.0.32",
|
|
27
|
+
"@vdemedes/prettier-config": "^2.0.1",
|
|
28
|
+
"ava": "^5.2.0",
|
|
29
|
+
"chalk": "^5.2.0",
|
|
30
|
+
"eslint-config-xo-react": "^0.27.0",
|
|
31
|
+
"eslint-plugin-react": "^7.32.2",
|
|
32
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
33
|
+
"ink-testing-library": "^3.0.0",
|
|
34
|
+
"prettier": "^2.8.7",
|
|
35
|
+
"ts-node": "^10.9.1",
|
|
36
|
+
"typescript": "^5.0.3",
|
|
37
|
+
"xo": "^0.53.1"
|
|
38
|
+
},
|
|
39
|
+
"ava": {
|
|
40
|
+
"extensions": {
|
|
41
|
+
"ts": "module",
|
|
42
|
+
"tsx": "module"
|
|
43
|
+
},
|
|
44
|
+
"nodeArguments": [
|
|
45
|
+
"--loader=ts-node/esm"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"xo": {
|
|
49
|
+
"extends": "xo-react",
|
|
50
|
+
"prettier": true,
|
|
51
|
+
"rules": {
|
|
52
|
+
"react/prop-types": "off"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"prettier": "@vdemedes/prettier-config"
|
|
56
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# downlaude
|
|
2
|
+
|
|
3
|
+
<img src="demo.png" width="400" />
|
|
4
|
+
|
|
5
|
+
> CLI to check Claude's service status from your terminal
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --global downlaude
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
downlaude # show Claude API + Claude Code status
|
|
17
|
+
downlaude --all # show all Claude services
|
|
18
|
+
downlaude --silent # no output; use exit code in scripts
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Options
|
|
22
|
+
|
|
23
|
+
| Flag | Description |
|
|
24
|
+
|------|-------------|
|
|
25
|
+
| `--all`,<br>`-a` | Show all Claude services |
|
|
26
|
+
| `--silent`,<br>`-s` | No output. Exit `0` if operational, `1` if outage, `2` if unreachable |
|
|
27
|
+
| `--help`,<br>`-h` | Show help |
|
|
28
|
+
|
|
29
|
+
## Exit codes (--silent)
|
|
30
|
+
|
|
31
|
+
| Code | Meaning |
|
|
32
|
+
|------|---------|
|
|
33
|
+
| `0` | All operational |
|
|
34
|
+
| `1` | At least one outage |
|
|
35
|
+
| `2` | Could not reach status page |
|
|
36
|
+
|
|
37
|
+
By default `--silent` checks Claude API and Claude Code only. Combine with `--all` to check all services:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
downlaude -s # checks Claude API + Claude Code
|
|
41
|
+
downlaude -s -a # checks all six services
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Scripting
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
downlaude --silent || echo "Claude is having issues"
|
|
48
|
+
downlaude --silent --all && deploy.sh
|
|
49
|
+
```
|