checkly 7.4.0 → 7.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/dist/ai-context/checkly.rules.md +55 -17
- package/dist/ai-context/context.d.ts +76 -24
- package/dist/ai-context/context.js +48 -25
- package/dist/ai-context/context.js.map +1 -1
- package/dist/ai-context/public-skills/checkly/README.md +39 -0
- package/dist/ai-context/public-skills/checkly/SKILL.md +65 -0
- package/dist/ai-context/{skills/monitoring/references/api-checks.md → skills-command/references/configure-api-checks.md} +1 -1
- package/dist/ai-context/skills-command/references/configure-dns-monitors.md +38 -0
- package/dist/ai-context/skills-command/references/configure-heartbeat-monitors.md +33 -0
- package/dist/ai-context/skills-command/references/configure-icmp-monitors.md +41 -0
- package/dist/ai-context/skills-command/references/configure-tcp-monitors.md +45 -0
- package/dist/ai-context/skills-command/references/configure-url-monitors.md +43 -0
- package/dist/ai-context/{skills/monitoring/SKILL.md → skills-command/references/configure.md} +40 -17
- package/dist/ai-context/skills-command/references/initialize.md +116 -0
- package/dist/commands/baseCommand.d.ts +3 -0
- package/dist/commands/baseCommand.js +3 -0
- package/dist/commands/baseCommand.js.map +1 -1
- package/dist/commands/incidents/create.d.ts +15 -0
- package/dist/commands/incidents/create.js +107 -0
- package/dist/commands/incidents/create.js.map +1 -0
- package/dist/commands/incidents/list.d.ts +12 -0
- package/dist/commands/incidents/list.js +107 -0
- package/dist/commands/incidents/list.js.map +1 -0
- package/dist/commands/incidents/resolve.d.ts +14 -0
- package/dist/commands/incidents/resolve.js +87 -0
- package/dist/commands/incidents/resolve.js.map +1 -0
- package/dist/commands/incidents/update.d.ts +16 -0
- package/dist/commands/incidents/update.js +111 -0
- package/dist/commands/incidents/update.js.map +1 -0
- package/dist/commands/skills.d.ts +12 -0
- package/dist/commands/skills.js +104 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/formatters/incidents.d.ts +7 -0
- package/dist/formatters/incidents.js +186 -0
- package/dist/formatters/incidents.js.map +1 -0
- package/dist/help/help-extension.js +17 -6
- package/dist/help/help-extension.js.map +1 -1
- package/dist/helpers/cli-mode.d.ts +3 -0
- package/dist/helpers/cli-mode.js +46 -0
- package/dist/helpers/cli-mode.js.map +1 -0
- package/dist/helpers/command-preview.d.ts +24 -0
- package/dist/helpers/command-preview.js +51 -0
- package/dist/helpers/command-preview.js.map +1 -0
- package/dist/helpers/flags.d.ts +2 -0
- package/dist/helpers/flags.js +16 -1
- package/dist/helpers/flags.js.map +1 -1
- package/dist/helpers/incidents.d.ts +15 -0
- package/dist/helpers/incidents.js +58 -0
- package/dist/helpers/incidents.js.map +1 -0
- package/dist/rest/api.d.ts +2 -1
- package/dist/rest/api.js +5 -24
- package/dist/rest/api.js.map +1 -1
- package/dist/rest/incidents.d.ts +60 -0
- package/dist/rest/incidents.js +30 -0
- package/dist/rest/incidents.js.map +1 -0
- package/dist/rest/status-pages.d.ts +3 -0
- package/dist/rest/status-pages.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +541 -110
- package/package.json +7 -1
- package/dist/ai-context/skills/monitoring/README.md +0 -55
- package/dist/ai-context/skills/monitoring/references/uptime-monitors.md +0 -206
- /package/dist/ai-context/{skills/monitoring/references/alert-channels.md → skills-command/references/configure-alert-channels.md} +0 -0
- /package/dist/ai-context/{skills/monitoring/references/browser-checks.md → skills-command/references/configure-browser-checks.md} +0 -0
- /package/dist/ai-context/{skills/monitoring/references/check-groups.md → skills-command/references/configure-check-groups.md} +0 -0
- /package/dist/ai-context/{skills/monitoring/references/multistep-checks.md → skills-command/references/configure-multistep-checks.md} +0 -0
- /package/dist/ai-context/{skills/monitoring/references/playwright-checks.md → skills-command/references/configure-playwright-checks.md} +0 -0
- /package/dist/ai-context/{skills/monitoring/references/supporting-constructs.md → skills-command/references/configure-supporting-constructs.md} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# URL Monitor
|
|
2
|
+
|
|
3
|
+
- Import the `UrlMonitor` construct from `checkly/constructs`.
|
|
4
|
+
- When adding `assertions`, always use `UrlAssertionBuilder`.
|
|
5
|
+
|
|
6
|
+
**Reference:** https://www.checklyhq.com/docs/constructs/url-monitor/
|
|
7
|
+
|
|
8
|
+
```typescript
|
|
9
|
+
import { AlertEscalationBuilder, Frequency, RetryStrategyBuilder, UrlAssertionBuilder, UrlMonitor } from 'checkly/constructs'
|
|
10
|
+
|
|
11
|
+
new UrlMonitor('example-url-monitor', {
|
|
12
|
+
name: 'Example URL Monitor',
|
|
13
|
+
activated: true,
|
|
14
|
+
locations: [
|
|
15
|
+
'eu-central-1',
|
|
16
|
+
'eu-west-2',
|
|
17
|
+
],
|
|
18
|
+
frequency: Frequency.EVERY_5M,
|
|
19
|
+
alertEscalationPolicy: AlertEscalationBuilder.runBasedEscalation(1, {
|
|
20
|
+
amount: 0,
|
|
21
|
+
interval: 5,
|
|
22
|
+
}, {
|
|
23
|
+
enabled: false,
|
|
24
|
+
percentage: 10,
|
|
25
|
+
}),
|
|
26
|
+
retryStrategy: RetryStrategyBuilder.linearStrategy({
|
|
27
|
+
baseBackoffSeconds: 60,
|
|
28
|
+
maxRetries: 2,
|
|
29
|
+
maxDurationSeconds: 600,
|
|
30
|
+
sameRegion: true,
|
|
31
|
+
}),
|
|
32
|
+
runParallel: true,
|
|
33
|
+
degradedResponseTime: 5000,
|
|
34
|
+
maxResponseTime: 20000,
|
|
35
|
+
request: {
|
|
36
|
+
url: 'INSERT_URL',
|
|
37
|
+
ipFamily: 'IPv4',
|
|
38
|
+
assertions: [
|
|
39
|
+
UrlAssertionBuilder.statusCode().equals(200),
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
```
|
package/dist/ai-context/{skills/monitoring/SKILL.md → skills-command/references/configure.md}
RENAMED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: monitoring
|
|
3
|
-
description: Create and manage monitoring checks using the Checkly CLI. Use when working with API checks, browser checks, URL monitors, ICMP monitors, Playwright checks, heartbeat monitors, alert channels, dashboards, or status pages.
|
|
4
|
-
allowed-tools: Bash(npx:checkly:*) Bash(npm:create:checkly@latest)
|
|
5
|
-
metadata:
|
|
6
|
-
author: checkly
|
|
7
|
-
---
|
|
8
|
-
|
|
9
1
|
# Checkly Monitoring
|
|
10
2
|
|
|
11
3
|
- Refer to docs for Checkly CLI v6.0.0 and above.
|
|
@@ -31,6 +23,7 @@ metadata:
|
|
|
31
23
|
|
|
32
24
|
Here is an example directory tree of what that would look like:
|
|
33
25
|
|
|
26
|
+
```
|
|
34
27
|
.
|
|
35
28
|
|-- checkly.config.ts
|
|
36
29
|
|-- package.json
|
|
@@ -39,6 +32,7 @@ Here is an example directory tree of what that would look like:
|
|
|
39
32
|
|-- alert-channels.ts
|
|
40
33
|
|-- api-check.check.ts
|
|
41
34
|
`-- homepage.spec.ts
|
|
35
|
+
```
|
|
42
36
|
|
|
43
37
|
The `checkly.config.ts` at the root of your project defines a range of defaults for all your checks.
|
|
44
38
|
|
|
@@ -81,16 +75,45 @@ export default defineConfig({
|
|
|
81
75
|
|
|
82
76
|
## Check and Monitor Constructs
|
|
83
77
|
|
|
84
|
-
Parse and read further reference documentation when tasked with creating or managing any of the following Checkly constructs
|
|
78
|
+
Parse and read further reference documentation when tasked with creating or managing any of the following Checkly constructs.
|
|
79
|
+
|
|
80
|
+
If the Checkly CLI is installed (`npx checkly version`), use `npx checkly skills configure [CONSTRUCT]` to access up-to-date information:
|
|
81
|
+
|
|
82
|
+
### `npx checkly skills configure api-checks`
|
|
83
|
+
Api Check construct (`ApiCheck`), assertions, and authentication setup scripts
|
|
84
|
+
|
|
85
|
+
### `npx checkly skills configure browser-checks`
|
|
86
|
+
Browser Check construct (`BrowserCheck`) with Playwright test files
|
|
87
|
+
|
|
88
|
+
### `npx checkly skills configure playwright-checks`
|
|
89
|
+
Playwright Check Suite construct (`PlaywrightCheck`) for multi-browser test suites
|
|
90
|
+
|
|
91
|
+
### `npx checkly skills configure multistep-checks`
|
|
92
|
+
Multistep Check construct (`MultiStepCheck`) for complex user flows
|
|
93
|
+
|
|
94
|
+
### `npx checkly skills configure tcp-monitors`
|
|
95
|
+
TCP Monitor construct (`TcpMonitor`) with assertions
|
|
96
|
+
|
|
97
|
+
### `npx checkly skills configure url-monitors`
|
|
98
|
+
URL Monitor construct (`UrlMonitor`) with assertions
|
|
99
|
+
|
|
100
|
+
### `npx checkly skills configure dns-monitors`
|
|
101
|
+
DNS Monitor construct (`DnsMonitor`) with assertions
|
|
102
|
+
|
|
103
|
+
### `npx checkly skills configure icmp-monitors`
|
|
104
|
+
ICMP Monitor construct (`IcmpMonitor`) with latency and packet loss assertions
|
|
105
|
+
|
|
106
|
+
### `npx checkly skills configure heartbeat-monitors`
|
|
107
|
+
Heartbeat Monitor construct (`HeartbeatMonitor`)
|
|
108
|
+
|
|
109
|
+
### `npx checkly skills configure check-groups`
|
|
110
|
+
CheckGroupV2 construct (`CheckGroupV2`) for organizing checks
|
|
111
|
+
|
|
112
|
+
### `npx checkly skills configure alert-channels`
|
|
113
|
+
Email (`EmailAlertChannel`), Phone (`PhoneCallAlertChannel`), and Slack (`SlackAlertChannel`) alert channels
|
|
85
114
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- [Playwright Checks](references/playwright-checks.md) - PlaywrightCheck construct for multi-browser test suites
|
|
89
|
-
- [MultiStep Checks](references/multistep-checks.md) - MultiStepCheck construct for complex user flows
|
|
90
|
-
- [Uptime Monitors](references/uptime-monitors.md) - TCP (`TcpMonitor`), URL (`UrlMonitor`), DNS (`DnsMonitor`), ICMP (`IcmpMonitor`), and Heartbeat monitors (`HeartbeatMonitor`)
|
|
91
|
-
- [Check Groups](references/check-groups.md) - CheckGroupV2 construct for organizing checks
|
|
92
|
-
- [Alert Channels](references/alert-channels.md) - Email, Phone, and Slack alert channels
|
|
93
|
-
- [Supporting Constructs](references/supporting-constructs.md) - Status pages, dashboards, maintenance windows, and private locations
|
|
115
|
+
### `npx checkly skills configure supporting-constructs`
|
|
116
|
+
Status pages (`StatusPage`), dashboards (`Dashboard`), maintenance windows (`MaintenanceWindow`), and private locations (`PrivateLocation`)
|
|
94
117
|
|
|
95
118
|
## Testing and Debugging
|
|
96
119
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Checkly Project Setup
|
|
2
|
+
|
|
3
|
+
Follow these steps in order to set up a new Checkly monitoring project.
|
|
4
|
+
|
|
5
|
+
## Step 0 — Pre-flight checks
|
|
6
|
+
|
|
7
|
+
Before starting, verify:
|
|
8
|
+
|
|
9
|
+
1. **Node.js** is installed (`node --version`). Checkly CLI requires Node.js 18 or later.
|
|
10
|
+
2. **npm** is available (`npm --version`).
|
|
11
|
+
3. The current working directory is the right location for the project (or create/navigate to it).
|
|
12
|
+
|
|
13
|
+
If any pre-flight check fails, help the user fix it before proceeding.
|
|
14
|
+
|
|
15
|
+
## Step 1 — Choose a setup method
|
|
16
|
+
|
|
17
|
+
Ask the user which setup method they prefer:
|
|
18
|
+
|
|
19
|
+
- **Option A: Scaffold with CLI** — Run `npm create checkly@latest` to generate a complete example project interactively. The CLI handles everything: project name, directory, dependencies, sample checks, and config. This is the fastest way to get started.
|
|
20
|
+
- **Option B: AI-first (Experimental)** — Generate the project structure and checks from scratch using this skill. Best when the user already knows what they want to monitor and prefers a tailored setup without example boilerplate.
|
|
21
|
+
|
|
22
|
+
### Option A: Scaffold with CLI
|
|
23
|
+
|
|
24
|
+
Run the following command:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm create checkly@latest
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The CLI will interactively handle the entire setup — project name, location, dependencies, example checks, and configuration. No further steps are needed. Setup is complete once the CLI finishes.
|
|
31
|
+
|
|
32
|
+
### Option B: AI-first
|
|
33
|
+
|
|
34
|
+
Continue with the following steps:
|
|
35
|
+
|
|
36
|
+
#### Step 1: Install dependencies
|
|
37
|
+
|
|
38
|
+
1. **Install the Checkly dependency**
|
|
39
|
+
|
|
40
|
+
Check if `npx checkly --version` works. If not, run `npm install --save-dev checkly`.
|
|
41
|
+
|
|
42
|
+
2. **Do you want to use TypeScript? (recommended)**
|
|
43
|
+
- If **yes** → install `jiti`:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm i --save-dev jiti
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- If **no** → there's nothing to do
|
|
50
|
+
|
|
51
|
+
#### Step 2: Gather the project requirements
|
|
52
|
+
|
|
53
|
+
Ask the user the following questions to determine the setup:
|
|
54
|
+
|
|
55
|
+
1. **What do you want to monitor?** (multiple selections allowed)
|
|
56
|
+
- **Uptime monitoring** — Monitor URLs for availability and response times
|
|
57
|
+
- **API checks** — Validate API endpoints with custom assertions
|
|
58
|
+
- **Browser checks** — Run Playwright scripts to test user flows
|
|
59
|
+
- **Multistep API checks** — Chain multiple API requests into a single check
|
|
60
|
+
- **Playwright Check Suites** — Reuse your existing Playwright project for synthetic monitoring
|
|
61
|
+
|
|
62
|
+
Remember the selection for later steps when creating checks.
|
|
63
|
+
|
|
64
|
+
2. **How do you want to get alerted?** (multiple selections allowed)
|
|
65
|
+
|
|
66
|
+
Run `npx checkly skills configure alert-channels` to access up-to-date information on alert channel options and setup.
|
|
67
|
+
|
|
68
|
+
3. **Where do you want to store your monitoring configuration?**
|
|
69
|
+
- **__checks__** — create all resources and `check.ts` files in a separate `__checks__` directory
|
|
70
|
+
- **next to the resource** — place the `check.ts` files next to page routes, api endpoints etc.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
#### Step 3 — Create the config file
|
|
74
|
+
|
|
75
|
+
Run the following command to retrieve the configure skill reference:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx checkly skills configure
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Use the output to create a `checkly.config.ts` (or `checkly.config.js` if the user chose JavaScript) in the project root.
|
|
82
|
+
|
|
83
|
+
Adjust the `checkMatch` property according to previous selection.
|
|
84
|
+
|
|
85
|
+
Present the generated configuration to the user and ask if it looks correct. Allow the user to make changes.
|
|
86
|
+
|
|
87
|
+
Congratulate the user on completing the config. Now it's time to test the configuration and turn everything into monitoring!
|
|
88
|
+
|
|
89
|
+
#### Step 4: Log in to Checkly CLI
|
|
90
|
+
|
|
91
|
+
To use the Checkly CLI the user needs to be logged in. Run the following command:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npx checkly whoami
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
If the user is logged in, verify the information and if it's the correct account.
|
|
98
|
+
|
|
99
|
+
If the user is NOT logged in, present two options:
|
|
100
|
+
|
|
101
|
+
- **Option A: Interactive login** — The user runs `npx checkly login` themselves. This command opens a browser for OAuth authentication and cannot be completed by an AI agent. Tell the user to run the command, complete the browser flow, and let you know when they're done so you can re-run `npx checkly whoami` to verify.
|
|
102
|
+
- **Option B: Environment variables (recommended for agentic / CI use)** — The user sets `CHECKLY_API_KEY` and `CHECKLY_ACCOUNT_ID` as environment variables. They can create an API key in the Checkly dashboard under **User Settings > API Keys**. Once both variables are set, re-run `npx checkly whoami` to verify.
|
|
103
|
+
|
|
104
|
+
#### Step 5: Summarize and test the new monitoring configuration
|
|
105
|
+
|
|
106
|
+
Read the generated `checkly.config.ts` (or `checkly.config.js`) and summarize the configured checks, locations, and frequencies.
|
|
107
|
+
|
|
108
|
+
Run the following command to test the new monitoring setup:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npx checkly test
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If the command passed, congratulate the user and ask them what they want to do next!
|
|
115
|
+
|
|
116
|
+
Share more Checkly CLI options and ask if they want to deploy their new monitoring setup using `npx checkly deploy`.
|
|
@@ -8,6 +8,9 @@ export declare abstract class BaseCommand extends Command {
|
|
|
8
8
|
#private;
|
|
9
9
|
static coreCommand: boolean;
|
|
10
10
|
static hidden: boolean;
|
|
11
|
+
static readOnly: boolean;
|
|
12
|
+
static destructive: boolean;
|
|
13
|
+
static idempotent: boolean;
|
|
11
14
|
fancy: boolean;
|
|
12
15
|
style: CommandStyle;
|
|
13
16
|
loadPackageJsonOfSelf(): Promise<PackageJsonFile | undefined>;
|
|
@@ -13,6 +13,9 @@ const package_manager_1 = require("../services/check-parser/package-files/packag
|
|
|
13
13
|
class BaseCommand extends core_1.Command {
|
|
14
14
|
static coreCommand = false;
|
|
15
15
|
static hidden = true;
|
|
16
|
+
static readOnly = false;
|
|
17
|
+
static destructive = false;
|
|
18
|
+
static idempotent = false;
|
|
16
19
|
fancy = true;
|
|
17
20
|
style = new command_style_1.CommandStyle(this);
|
|
18
21
|
#packageJsonLoader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseCommand.js","sourceRoot":"","sources":["../../src/commands/baseCommand.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,sDAA6B;AAC7B,sCAAqC;AACrC,qCAAiC;AACjC,4DAAuD;AAEvD,4FAAiG;AAMjG,MAAsB,WAAY,SAAQ,cAAO;IAC/C,MAAM,CAAC,WAAW,GAAG,KAAK,CAAA;IAC1B,MAAM,CAAC,MAAM,GAAG,IAAI,CAAA;IACpB,KAAK,GAAG,IAAI,CAAA;IACZ,KAAK,GAAG,IAAI,4BAAY,CAAC,IAAI,CAAC,CAAA;IAC9B,kBAAkB,CAAuC;IAEzD,KAAK,CAAC,qBAAqB;QACzB,IAAI,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;gBAC7B,IAAI,CAAC,kBAAkB,GAAG,IAAA,0CAAwB,EAAC,SAAS,CAAC,CAAA;YAC/D,CAAC;YAED,OAAO,MAAM,IAAI,CAAC,kBAAkB,CAAA;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,OAAM;QACR,CAAC;IACH,CAAC;IAED,KAAK,CAAC,wBAAwB;QAC5B,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAA;QACzC,IAAI,W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
|
|
|
1
|
+
import { AuthCommand } from '../authCommand';
|
|
2
|
+
export default class IncidentsCreate extends AuthCommand {
|
|
3
|
+
static hidden: boolean;
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
'status-page-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
title: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
services: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
severity: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
message: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'notify-subscribers': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const core_1 = require("@oclif/core");
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const authCommand_1 = require("../authCommand");
|
|
32
|
+
const flags_1 = require("../../helpers/flags");
|
|
33
|
+
const api = __importStar(require("../../rest/api"));
|
|
34
|
+
const incidents_1 = require("../../formatters/incidents");
|
|
35
|
+
const incidents_2 = require("../../helpers/incidents");
|
|
36
|
+
class IncidentsCreate extends authCommand_1.AuthCommand {
|
|
37
|
+
static hidden = false;
|
|
38
|
+
static description = 'Declare a new incident on a status page.';
|
|
39
|
+
static flags = {
|
|
40
|
+
'status-page-id': core_1.Flags.string({
|
|
41
|
+
description: 'Target status page ID.',
|
|
42
|
+
required: true,
|
|
43
|
+
}),
|
|
44
|
+
'title': core_1.Flags.string({
|
|
45
|
+
description: 'Incident title.',
|
|
46
|
+
required: true,
|
|
47
|
+
}),
|
|
48
|
+
'services': core_1.Flags.string({
|
|
49
|
+
description: 'Affected service IDs. Repeat the flag for multiple services.',
|
|
50
|
+
multiple: true,
|
|
51
|
+
}),
|
|
52
|
+
'severity': core_1.Flags.string({
|
|
53
|
+
description: 'Incident severity.',
|
|
54
|
+
options: incidents_2.incidentSeverityOptions,
|
|
55
|
+
default: 'minor',
|
|
56
|
+
}),
|
|
57
|
+
'message': core_1.Flags.string({
|
|
58
|
+
description: 'Initial incident update message.',
|
|
59
|
+
}),
|
|
60
|
+
'notify-subscribers': core_1.Flags.boolean({
|
|
61
|
+
description: 'Notify status page subscribers about this incident update.',
|
|
62
|
+
default: true,
|
|
63
|
+
allowNo: true,
|
|
64
|
+
}),
|
|
65
|
+
'output': (0, flags_1.outputFlag)({ default: 'table' }),
|
|
66
|
+
};
|
|
67
|
+
async run() {
|
|
68
|
+
const { flags } = await this.parse(IncidentsCreate);
|
|
69
|
+
this.style.outputFormat = flags.output;
|
|
70
|
+
try {
|
|
71
|
+
const statusPage = await api.statusPages.get(flags['status-page-id']);
|
|
72
|
+
const statusPageServices = (0, incidents_2.flattenStatusPageServices)(statusPage);
|
|
73
|
+
const incidentServices = (0, incidents_2.resolveIncidentServices)(statusPageServices, flags.services);
|
|
74
|
+
const incident = await api.incidents.create({
|
|
75
|
+
name: flags.title,
|
|
76
|
+
severity: (0, incidents_2.toIncidentSeverity)(flags.severity),
|
|
77
|
+
services: incidentServices,
|
|
78
|
+
incidentUpdates: [{
|
|
79
|
+
description: flags.message ?? incidents_2.DEFAULT_CREATE_INCIDENT_MESSAGE,
|
|
80
|
+
status: 'INVESTIGATING',
|
|
81
|
+
notifySubscribers: flags['notify-subscribers'],
|
|
82
|
+
}],
|
|
83
|
+
});
|
|
84
|
+
if (flags.output === 'json') {
|
|
85
|
+
this.log(JSON.stringify(incident, null, 2));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const fmt = flags.output === 'md' ? 'md' : 'terminal';
|
|
89
|
+
if (fmt === 'md') {
|
|
90
|
+
this.log((0, incidents_1.formatIncidentDetail)(incident, fmt));
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const output = [];
|
|
94
|
+
output.push((0, incidents_1.formatIncidentDetail)(incident, fmt));
|
|
95
|
+
output.push('');
|
|
96
|
+
output.push(` ${chalk_1.default.dim('Next:')} checkly incidents update ${incident.id} --message "..."`);
|
|
97
|
+
output.push(` ${chalk_1.default.dim('Resolve:')} checkly incidents resolve ${incident.id}`);
|
|
98
|
+
this.log(output.join('\n'));
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
this.style.longError('Failed to create incident.', err);
|
|
102
|
+
process.exitCode = 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.default = IncidentsCreate;
|
|
107
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/incidents/create.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAmC;AACnC,kDAAyB;AACzB,gDAA4C;AAC5C,+CAAgD;AAChD,oDAAqC;AAErC,0DAAiE;AACjE,uDAOgC;AAEhC,MAAqB,eAAgB,SAAQ,yBAAW;IACtD,MAAM,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,MAAM,CAAC,WAAW,GAAG,0CAA0C,CAAA;IAE/D,MAAM,CAAC,KAAK,GAAG;QACb,gBAAgB,EAAE,YAAK,CAAC,MAAM,CAAC;YAC7B,WAAW,EAAE,wBAAwB;YACrC,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,YAAK,CAAC,MAAM,CAAC;YACpB,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,YAAK,CAAC,MAAM,CAAC;YACvB,WAAW,EAAE,8DAA8D;YAC3E,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,YAAK,CAAC,MAAM,CAAC;YACvB,WAAW,EAAE,oBAAoB;YACjC,OAAO,EAAE,mCAAuB;YAChC,OAAO,EAAE,OAAO;SACjB,CAAC;QACF,SAAS,EAAE,YAAK,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,kCAAkC;SAChD,CAAC;QACF,oBAAoB,EAAE,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AG,GAAiB,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAA;YACnE,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;gBACjB,IAAI,CAAC,GAAG,CAAC,IAAA,gCAAoB,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;gBAC7C,OAAM;YACR,CAAC;YAED,MAAM,MAAM,GAAa,EAAE,CAAA;YAC3B,MAAM,CAAC,IAAI,CAAC,IAAA,gCAAoB,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;YAChD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACf,MAAM,CAAC,IAAI,CAAC,KAAK,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,oCAAoC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,CAAA;YACrG,MAAM,CAAC,IAAI,CAAC,KAAK,eAAK,CAAC,GAAG,CAAC,UAAU,CAAC,kCAAkC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAA;YAEtF,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAC7B,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAA;YACvD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;QACtB,CAAC;IACH,CAAC;;AA3EH,kCA4EC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AuthCommand } from '../authCommand';
|
|
2
|
+
export default class IncidentsList extends AuthCommand {
|
|
3
|
+
static hidden: boolean;
|
|
4
|
+
static description: string;
|
|
5
|
+
static flags: {
|
|
6
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'status-page-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
status: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const core_1 = require("@oclif/core");
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const authCommand_1 = require("../authCommand");
|
|
32
|
+
const flags_1 = require("../../helpers/flags");
|
|
33
|
+
const api = __importStar(require("../../rest/api"));
|
|
34
|
+
const incidents_1 = require("../../formatters/incidents");
|
|
35
|
+
const incidents_2 = require("../../helpers/incidents");
|
|
36
|
+
class IncidentsList extends authCommand_1.AuthCommand {
|
|
37
|
+
static hidden = false;
|
|
38
|
+
static description = 'List incidents, optionally filtered by status page or status.';
|
|
39
|
+
static flags = {
|
|
40
|
+
'limit': core_1.Flags.integer({
|
|
41
|
+
char: 'l',
|
|
42
|
+
description: 'Number of incidents to return (1-100).',
|
|
43
|
+
default: 25,
|
|
44
|
+
}),
|
|
45
|
+
'status-page-id': core_1.Flags.string({
|
|
46
|
+
description: 'Filter incidents by status page ID.',
|
|
47
|
+
}),
|
|
48
|
+
'status': core_1.Flags.string({
|
|
49
|
+
description: 'Filter by incident status.',
|
|
50
|
+
options: incidents_2.incidentListStatusOptions,
|
|
51
|
+
default: 'open',
|
|
52
|
+
}),
|
|
53
|
+
'output': (0, flags_1.outputFlag)({ default: 'table' }),
|
|
54
|
+
};
|
|
55
|
+
async run() {
|
|
56
|
+
const { flags } = await this.parse(IncidentsList);
|
|
57
|
+
this.style.outputFormat = flags.output;
|
|
58
|
+
try {
|
|
59
|
+
const page = await api.incidents.getAll({ limit: flags.limit });
|
|
60
|
+
let incidents = (0, incidents_2.filterIncidentsByStatus)(page.entries, flags.status);
|
|
61
|
+
if (flags['status-page-id']) {
|
|
62
|
+
const statusPage = await api.statusPages.get(flags['status-page-id']);
|
|
63
|
+
const statusPageServiceIds = new Set((0, incidents_2.flattenStatusPageServices)(statusPage).map(service => service.id));
|
|
64
|
+
incidents = incidents.filter(incident => incident.services.some(service => statusPageServiceIds.has(service.id)));
|
|
65
|
+
}
|
|
66
|
+
if (flags.output === 'json') {
|
|
67
|
+
this.log(JSON.stringify({
|
|
68
|
+
data: incidents,
|
|
69
|
+
count: incidents.length,
|
|
70
|
+
...(page.nextId ? { nextId: page.nextId } : {}),
|
|
71
|
+
}, null, 2));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (incidents.length === 0) {
|
|
75
|
+
this.log('No incidents found.');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const fmt = flags.output === 'md' ? 'md' : 'terminal';
|
|
79
|
+
if (fmt === 'md') {
|
|
80
|
+
this.log((0, incidents_1.formatIncidentsList)(incidents, fmt));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const output = [];
|
|
84
|
+
output.push((0, incidents_1.formatIncidentsList)(incidents, fmt));
|
|
85
|
+
output.push('');
|
|
86
|
+
const filters = [];
|
|
87
|
+
if (flags.status !== 'all')
|
|
88
|
+
filters.push(`status=${flags.status}`);
|
|
89
|
+
if (flags['status-page-id'])
|
|
90
|
+
filters.push(`status-page-id=${flags['status-page-id']}`);
|
|
91
|
+
const summary = `${incidents.length} incident${incidents.length === 1 ? '' : 's'}`;
|
|
92
|
+
if (filters.length > 0) {
|
|
93
|
+
output.push(chalk_1.default.dim(`Showing ${summary} (${filters.join(', ')})`));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
output.push(chalk_1.default.dim(`Showing ${summary}`));
|
|
97
|
+
}
|
|
98
|
+
this.log(output.join('\n'));
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
this.style.longError('Failed to list incidents.', err);
|
|
102
|
+
process.exitCode = 1;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.default = IncidentsList;
|
|
107
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/incidents/list.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAmC;AACnC,kDAAyB;AACzB,gDAA4C;AA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AChD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAEf,MAAM,OAAO,GAAa,EAAE,CAAA;YAC5B,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK;gBAAE,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;YAClE,IAAI,KAAK,CAAC,gBAAgB,CAAC;gBAAE,OAAO,CAAC,IAAI,CAAC,kBAAkB,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAA;YAEtF,MAAM,OAAO,GAAG,GAAG,SAAS,CAAC,MAAM,YAAY,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;YAClF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvB,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,GAAG,CAAC,WAAW,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;YACtE,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC,GAAG,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC,CAAA;YAC9C,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAC7B,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAA;YACtD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;QACtB,CAAC;IACH,CAAC;;AA7EH,gCA8EC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AuthCommand } from '../authCommand';
|
|
2
|
+
export default class IncidentsResolve extends AuthCommand {
|
|
3
|
+
static hidden: boolean;
|
|
4
|
+
static description: string;
|
|
5
|
+
static args: {
|
|
6
|
+
id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
message: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
|
+
'notify-subscribers': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const core_1 = require("@oclif/core");
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const authCommand_1 = require("../authCommand");
|
|
32
|
+
const flags_1 = require("../../helpers/flags");
|
|
33
|
+
const api = __importStar(require("../../rest/api"));
|
|
34
|
+
const incidents_1 = require("../../formatters/incidents");
|
|
35
|
+
const incidents_2 = require("../../helpers/incidents");
|
|
36
|
+
class IncidentsResolve extends authCommand_1.AuthCommand {
|
|
37
|
+
static hidden = false;
|
|
38
|
+
static description = 'Resolve an incident.';
|
|
39
|
+
static args = {
|
|
40
|
+
id: core_1.Args.string({
|
|
41
|
+
description: 'The incident ID.',
|
|
42
|
+
required: true,
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
static flags = {
|
|
46
|
+
'message': core_1.Flags.string({
|
|
47
|
+
description: 'Optional closing note.',
|
|
48
|
+
}),
|
|
49
|
+
'notify-subscribers': core_1.Flags.boolean({
|
|
50
|
+
description: 'Notify status page subscribers about this incident update.',
|
|
51
|
+
default: true,
|
|
52
|
+
allowNo: true,
|
|
53
|
+
}),
|
|
54
|
+
'output': (0, flags_1.outputFlag)({ default: 'table' }),
|
|
55
|
+
};
|
|
56
|
+
async run() {
|
|
57
|
+
const { args, flags } = await this.parse(IncidentsResolve);
|
|
58
|
+
this.style.outputFormat = flags.output;
|
|
59
|
+
try {
|
|
60
|
+
const update = await api.incidents.createUpdate(args.id, {
|
|
61
|
+
description: flags.message ?? incidents_2.DEFAULT_RESOLVE_INCIDENT_MESSAGE,
|
|
62
|
+
status: 'RESOLVED',
|
|
63
|
+
notifySubscribers: flags['notify-subscribers'],
|
|
64
|
+
});
|
|
65
|
+
if (flags.output === 'json') {
|
|
66
|
+
this.log(JSON.stringify(update, null, 2));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const fmt = flags.output === 'md' ? 'md' : 'terminal';
|
|
70
|
+
if (fmt === 'md') {
|
|
71
|
+
this.log((0, incidents_1.formatIncidentUpdateDetail)(args.id, update, fmt, 'Incident Resolved'));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const output = [];
|
|
75
|
+
output.push((0, incidents_1.formatIncidentUpdateDetail)(args.id, update, fmt, 'Incident Resolved'));
|
|
76
|
+
output.push('');
|
|
77
|
+
output.push(` ${chalk_1.default.dim('List:')} checkly incidents list --status resolved`);
|
|
78
|
+
this.log(output.join('\n'));
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
this.style.longError('Failed to resolve incident.', err);
|
|
82
|
+
process.exitCode = 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.default = IncidentsResolve;
|
|
87
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/commands/incidents/resolve.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAyC;AACzC,kDAAyB;AACzB,gDAA4C;AAC5C,+CAAgD;AAChD,oDAAqC;AAErC,0DAAuE;AACvE,uDAA0E;AAE1E,MAAqB,gBAAiB,SAAQ,yBAAW;IACvD,MAAM,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,MAAM,CAAC,WAAW,GAAG,sBAAsB,CAAA;IAE3C,MAAM,CAAC,IAAI,GAAG;QACZ,EAAE,EAAE,WAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,kBAAkB;YAC/B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IAED,MAAM,CAAC,KAAK,GAAG;QACb,SAAS,EAAE,YAAK,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,wBAAwB;SACtC,CAAC;QACF,oBAAoB,EAAE,YAAK,CAAC,OAAO,CAAC;YAClC,WA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