feat(cli): add incidents command suite (TIM-26/27/28/29)#1236
feat(cli): add incidents command suite (TIM-26/27/28/29)#1236thebiglabasky wants to merge 15 commits intomainfrom
Conversation
b031d11 to
82474cb
Compare
MichaelHogers
left a comment
There was a problem hiding this comment.
@thebiglabasky nice stuff, my main concern is that these commands are different from checkly checks, given the side effects when alerting
do we have sufficiently explicit warnings to an agent or user? e.g. a user using these commands in the CLI with their agent -> the CLI should print "ARE YOU SURE" kind of output to validate that one really wants to create an incident/send notifications/...
i don't think we should overcomplicate at this stage, but this category of CLI commands probably deserve some special treatment
|
one note @thebiglabasky i haven't tested this CLI version in my Claude Code/Codex to get a feel for all the output formatting, partially because it feels more dangerous to do so 👁️ |
Agreed. I think we should already think about that mechanism. I'm not quite clear about how we can distinguish "write" actions from read ones for an agent to ask for permissions. At the very least, asking for confirmation to a user seems necessary though, so I'd be inclined to already have an interactive mode or so. The problem with incident management is that the point is to communicate to subscribers, so if we're too cautious, we add burden to users who want to proceed (the typical case of someone paged at 3am...). |
I did test them manually on staging, but not through CC/Codex yet. I'll do a pass here too |
|
Latest changes:
|
Move detectOperator from rest/api.ts to helpers/cli-mode.ts as a shared helper. Add detectCliMode that maps operators to interactive/ci/agent modes with CHECKLY_CLI_MODE env var override. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add structured preview output for agent/CI consumption and terminal display. Includes buildConfirmCommand to reconstruct CLI invocations with --force appended. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add readOnly, destructive, idempotent classification to BaseCommand. Add forceFlag() and dryRunFlag() helpers matching the outputFlag() pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Allow updating the overall incident severity alongside posting a progress update, via PATCH /v1/status-pages/incidents/:id. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d7d3011 to
66f9d66
Compare
|
The import was dropped during the rebase onto main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MichaelHogers
left a comment
There was a problem hiding this comment.
Would suggest at minimum adding e2e tests for incidents list (read-only, follows the same pattern as checks-list.spec.ts — default/json/md output).
Could also go for a lifecycle e2e test (create → update → resolve → verify via list) in the empty e2e account i set up earlier <- but up to you
I think e2e tests are our lowest hanging fruit here, will leave it to your judgment, otherwise looks good
Let's do that, thanks! |
Add incidents-list e2e tests (default/json/md output, status filtering) and incidents-lifecycle e2e test (create → update → resolve → delete) with afterAll cleanup via API. Wire CHECKLY_STATUS_PAGE_ID in CI workflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…setup Merge incidents-list and incidents-lifecycle into one file to avoid parallel rate limiting. Create status page + service in beforeAll and clean up in afterAll, removing the need for CHECKLY_STATUS_PAGE_ID config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
This PR implements the incidents command set requested in TIM-26, TIM-27, TIM-28, and TIM-29.
It adds end-to-end CLI support to:
Linked issues
incidents createincidents update <id>incidents resolve <id>incidents listWhat changed
GET /v1/status-pages/incidentsGET /v1/status-pages/incidents/{id}POST /v1/status-pages/incidentsPOST /v1/status-pages/incidents/{id}/incident-updatesopen|resolved|all)checkly incidents createcheckly incidents listcheckly incidents update <id>checkly incidents resolve <id>incidentstopic metadata in oclif config.Behavior notes
incidents createdefaults to:INVESTIGATINGincidents resolvedefaults to message:incidents listdefaults to:--status openValidation
Executed locally:
npm run lintnpx vitest --run packages/cli/src/formatters/__tests__/incidents.spec.ts packages/cli/src/formatters/__tests__/status-pages.spec.tscd packages/cli && NODE_CONFIG_DIR=./e2e/config npx vitest --run -c ./vitest.config.e2e.mts e2e/__tests__/help.spec.tsCommit breakdown
feat(cli): add incidents REST client and helpersfeat(cli): add incident formatter outputfeat(cli): add incidents create list update and resolve commandstest(cli): cover incidents help topic in e2e