Skip to content

feat(cli): add incidents command suite (TIM-26/27/28/29)#1236

Open
thebiglabasky wants to merge 15 commits intomainfrom
herve/TIM-26-27-28-29-incidents
Open

feat(cli): add incidents command suite (TIM-26/27/28/29)#1236
thebiglabasky wants to merge 15 commits intomainfrom
herve/TIM-26-27-28-29-incidents

Conversation

@thebiglabasky
Copy link
Contributor

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:

  • create incidents
  • list incidents
  • post incident progress updates
  • resolve incidents

Linked issues

  • TIM-26: incidents create
  • TIM-27: incidents update <id>
  • TIM-28: incidents resolve <id>
  • TIM-29: incidents list

What changed

  • Added incidents REST client and API wiring:
    • GET /v1/status-pages/incidents
    • GET /v1/status-pages/incidents/{id}
    • POST /v1/status-pages/incidents
    • POST /v1/status-pages/incidents/{id}/incident-updates
  • Added incidents helper utilities for:
    • severity/status option mapping
    • status-page service flattening/resolution
    • list status filtering (open|resolved|all)
  • Added formatter support for incidents:
    • list table rendering (terminal and markdown)
    • incident detail rendering
    • incident update detail rendering
  • Added command implementations:
    • checkly incidents create
    • checkly incidents list
    • checkly incidents update <id>
    • checkly incidents resolve <id>
  • Added incidents topic metadata in oclif config.
  • Updated help rendering/e2e expectations so topic-level commands are included in help output reliably.

Behavior notes

  • incidents create defaults to:
    • status: INVESTIGATING
    • message: "We are investigating this incident."
  • incidents resolve defaults to message:
    • "Incident resolved."
  • incidents list defaults to:
    • --status open

Validation

Executed locally:

  • npm run lint
  • npx vitest --run packages/cli/src/formatters/__tests__/incidents.spec.ts packages/cli/src/formatters/__tests__/status-pages.spec.ts
  • cd packages/cli && NODE_CONFIG_DIR=./e2e/config npx vitest --run -c ./vitest.config.e2e.mts e2e/__tests__/help.spec.ts

Commit breakdown

  • feat(cli): add incidents REST client and helpers
  • feat(cli): add incident formatter output
  • feat(cli): add incidents create list update and resolve commands
  • test(cli): cover incidents help topic in e2e

@thebiglabasky thebiglabasky changed the base branch from main to herve/TIM-24/status-pages-list February 25, 2026 18:20
@thebiglabasky thebiglabasky marked this pull request as draft February 25, 2026 18:30
@thebiglabasky thebiglabasky force-pushed the herve/TIM-26-27-28-29-incidents branch from b031d11 to 82474cb Compare February 25, 2026 18:32
MichaelHogers
MichaelHogers previously approved these changes Feb 26, 2026
Copy link
Contributor

@MichaelHogers MichaelHogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Image

@MichaelHogers
Copy link
Contributor

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 👁️

@thebiglabasky
Copy link
Contributor Author

@thebiglabasky nice stuff, my main concern is that these commands are different from checkly checks, given the side effects when alerting

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...).
Let me research that a bit to see if there are ways to distinguish commands for agents in categories. Otherwise, we probably should have a sort of "mode"?
The same applies to other pre-existing commands like "destroy".

@thebiglabasky
Copy link
Contributor Author

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 👁️

I did test them manually on staging, but not through CC/Codex yet. I'll do a pass here too

Base automatically changed from herve/TIM-24/status-pages-list to main February 26, 2026 15:24
@MichaelHogers MichaelHogers dismissed their stale review February 26, 2026 15:24

The base branch was changed.

@thebiglabasky thebiglabasky marked this pull request as ready for review February 27, 2026 09:33
@thebiglabasky
Copy link
Contributor Author

Latest changes:

  • Standardized metadata about commands (following what the MCP standard proposes for MCPs, but adapted to the CLi) to have a sense of what's readonly / destructive / idempotent and standardize a confirmOrAbort method allowing to provide feedback depending on the execution mode (interactive, agent, ci)
  • Added option to change the incident severity along with an update (e.g minor to major, etc.)
  • Tested with Claude Code on an incident response flow successfully

thebiglabasky and others added 10 commits February 27, 2026 10:38
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>
@thebiglabasky thebiglabasky force-pushed the herve/TIM-26-27-28-29-incidents branch from d7d3011 to 66f9d66 Compare February 27, 2026 09:50
@github-actions
Copy link

⚠️ AI context is out of date

The skills/ directory doesn't match the generated output from packages/cli.

Please run the following locally and commit the changes:

npm run prepare

The import was dropped during the rebase onto main.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
MichaelHogers
MichaelHogers previously approved these changes Feb 27, 2026
Copy link
Contributor

@MichaelHogers MichaelHogers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@thebiglabasky
Copy link
Contributor Author

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>
thebiglabasky and others added 2 commits February 27, 2026 16:06
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants