is-it-down-now 0.0.0-stage → 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/README.md +14 -2
- package/bin/isitdown.js +112 -0
- package/package.json +12 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 IsItDown.now
|
|
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/README.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Is It Down
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Check whether a website or popular service is down from your terminal.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install --global is-it-down-now
|
|
7
|
+
isitdown github.com
|
|
8
|
+
isitdown down
|
|
9
|
+
isitdown outages youtube.com --days 30
|
|
10
|
+
isitdown search cloud
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Add `--json` for machine-readable output. Set `ISITDOWN_API_KEY` when an API key is needed for additional live checks.
|
|
14
|
+
|
|
15
|
+
Documentation: <https://isitdown.now/cli>
|
package/bin/isitdown.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const pkg = require('../package.json');
|
|
5
|
+
const endpoint = (process.env.ISITDOWN_MCP_URL || 'https://mcp.isitdown.now').replace(/\/$/, '');
|
|
6
|
+
|
|
7
|
+
function help() {
|
|
8
|
+
return `Is It Down ${pkg.version}
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
isitdown <service-or-domain>
|
|
12
|
+
isitdown status <service>
|
|
13
|
+
isitdown check <domain>
|
|
14
|
+
isitdown down
|
|
15
|
+
isitdown outages [service] [--days 7]
|
|
16
|
+
isitdown search <words>
|
|
17
|
+
|
|
18
|
+
Options:
|
|
19
|
+
--json Print JSON
|
|
20
|
+
--days N Outage-history window, 1–90 days
|
|
21
|
+
--help Show help
|
|
22
|
+
--version Show version
|
|
23
|
+
|
|
24
|
+
Environment:
|
|
25
|
+
ISITDOWN_API_KEY Optional API key for additional live checks`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function parse(argv) {
|
|
29
|
+
const args = [...argv];
|
|
30
|
+
if (!args.length || args.includes('--help') || args.includes('-h')) return { help: true };
|
|
31
|
+
if (args.includes('--version') || args.includes('-v')) return { version: true };
|
|
32
|
+
const json = args.includes('--json');
|
|
33
|
+
if (json) args.splice(args.indexOf('--json'), 1);
|
|
34
|
+
let days = 7;
|
|
35
|
+
const daysIndex = args.indexOf('--days');
|
|
36
|
+
if (daysIndex >= 0) {
|
|
37
|
+
days = Number(args[daysIndex + 1]);
|
|
38
|
+
args.splice(daysIndex, 2);
|
|
39
|
+
}
|
|
40
|
+
if (!Number.isInteger(days) || days < 1 || days > 90) throw new Error('--days must be an integer from 1 to 90.');
|
|
41
|
+
const commands = new Set(['status', 'check', 'down', 'outages', 'search']);
|
|
42
|
+
const command = commands.has(args[0]) ? args.shift() : 'auto';
|
|
43
|
+
return { command, target: args.join(' ').trim(), days, json };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async function call(name, args) {
|
|
47
|
+
const response = await fetch(endpoint, {
|
|
48
|
+
method: 'POST',
|
|
49
|
+
headers: {
|
|
50
|
+
Accept: 'application/json, text/event-stream',
|
|
51
|
+
'Content-Type': 'application/json',
|
|
52
|
+
'User-Agent': `is-it-down/${pkg.version}`,
|
|
53
|
+
...(process.env.ISITDOWN_API_KEY ? { Authorization: `Bearer ${process.env.ISITDOWN_API_KEY}` } : {}),
|
|
54
|
+
},
|
|
55
|
+
body: JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name, arguments: args } }),
|
|
56
|
+
signal: AbortSignal.timeout(20_000),
|
|
57
|
+
});
|
|
58
|
+
const body = await response.json().catch(() => ({}));
|
|
59
|
+
if (!response.ok || body.error) throw new Error(body.error?.message || `IsItDown.now returned HTTP ${response.status}.`);
|
|
60
|
+
if (body.result?.isError) throw new Error(body.result.content?.[0]?.text || 'The status check failed.');
|
|
61
|
+
return body.result?.structuredContent || {};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function format(data) {
|
|
65
|
+
if (Array.isArray(data.services)) {
|
|
66
|
+
if (!data.services.length) return 'No monitored services have a confirmed outage right now.';
|
|
67
|
+
return data.services.map((item) => `${item.service || item.name} (${item.domain}) — ${item.state || 'down'}`).join('\n');
|
|
68
|
+
}
|
|
69
|
+
if (Array.isArray(data.outages)) {
|
|
70
|
+
if (!data.outages.length) return 'No confirmed outages found.';
|
|
71
|
+
return data.outages.map((item) => `${item.service}: ${item.started_at} to ${item.ongoing ? 'ongoing' : item.ended_at}`).join('\n');
|
|
72
|
+
}
|
|
73
|
+
return [
|
|
74
|
+
`${data.service || data.host || data.domain}: ${data.summary || data.state || 'unknown'}`,
|
|
75
|
+
data.http_status != null ? `HTTP: ${data.http_status}` : null,
|
|
76
|
+
data.response_ms != null ? `Response: ${data.response_ms} ms` : null,
|
|
77
|
+
data.status_page ? `Details: ${data.status_page}` : null,
|
|
78
|
+
].filter(Boolean).join('\n');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function main() {
|
|
82
|
+
const options = parse(process.argv.slice(2));
|
|
83
|
+
if (options.help) return process.stdout.write(`${help()}\n`);
|
|
84
|
+
if (options.version) return process.stdout.write(`${pkg.version}\n`);
|
|
85
|
+
const target = options.target;
|
|
86
|
+
let data;
|
|
87
|
+
if (options.command === 'down') data = await call('list_down_services', {});
|
|
88
|
+
else if (options.command === 'outages') data = await call('recent_outages', { days: options.days, ...(target ? { service: target } : {}) });
|
|
89
|
+
else if (options.command === 'search') {
|
|
90
|
+
if (!target) throw new Error('search needs a service name.');
|
|
91
|
+
data = await call('search_services', { query: target });
|
|
92
|
+
} else if (options.command === 'check') {
|
|
93
|
+
if (!target) throw new Error('check needs a domain.');
|
|
94
|
+
data = await call('check_website', { url: target });
|
|
95
|
+
} else {
|
|
96
|
+
if (!target) throw new Error('Add a service name or domain.');
|
|
97
|
+
try { data = await call('get_service_status', { service: target }); }
|
|
98
|
+
catch (error) {
|
|
99
|
+
if (options.command === 'status') throw error;
|
|
100
|
+
data = await call('check_website', { url: target });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
process.stdout.write(options.json ? `${JSON.stringify(data, null, 2)}\n` : `${format(data)}\n`);
|
|
104
|
+
if (data.state === 'down') process.exitCode = 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (require.main === module) main().catch((error) => {
|
|
108
|
+
process.stderr.write(`isitdown: ${error.name === 'TimeoutError' ? 'The request timed out.' : error.message}\n`);
|
|
109
|
+
process.exitCode = 2;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
module.exports = { parse };
|
package/package.json
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "is-it-down-now",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Check website and service status, current outages, and outage history from your terminal.",
|
|
5
|
+
"bin": { "isitdown": "bin/isitdown.js" },
|
|
6
|
+
"files": ["bin", "README.md", "LICENSE"],
|
|
7
|
+
"scripts": { "test": "node --check bin/isitdown.js && node bin/isitdown.js --version", "prepublishOnly": "npm test" },
|
|
8
|
+
"engines": { "node": ">=20" },
|
|
9
|
+
"keywords": ["uptime", "outage", "status", "website-monitoring", "cli", "is-it-down"],
|
|
10
|
+
"homepage": "https://isitdown.now/cli",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "IsItDown.now",
|
|
13
|
+
"publishConfig": { "access": "public" }
|
|
14
|
+
}
|