Skip to content

fix: correct CLI code samples that do not compile against the checkly package [RED-935] - #499

Merged
sorccu merged 8 commits into
mainfrom
simo/red-935-fix-docs-ts-samples
Sep 4, 2026
Merged

sorccu merged 8 commits into
mainfrom
simo/red-935-fix-docs-ts-samples

Conversation

@sorccu

@sorccu sorccu commented Sep 4, 2026

Copy link
Copy Markdown
Member

Linear: RED-935

Fixes checkly/checkly-cli#1457.

A user type-checked the TypeScript samples in these docs against the published checkly package and found that several do not compile. Type-checking every code block that imports from checkly (207 blocks) against the CLI's current main found the same class of drift on eleven pages. This PR fixes all samples that use a wrong or non-existent construct API.

Changes

  • constructs/dynamic-monitor-creation.mdx, guides/create-multiple-monitors.mdx, guides/uptime-monitoring.mdx (the pages from the issue): skipSslskipSSL, missing AssertionBuilder import, maxResponseTime removed from the CheckGroupV2 sample (not a group property), Frequency.EVERY_60SFrequency.EVERY_1M.
  • detect/uptime-monitoring/cli-configuration.mdx: every ts/js sample pair rewritten to the real API. The old samples used method/headers on URL monitor requests, response-time and body assertions that UrlAssertionBuilder does not have, target/timeout/ssl/responseValidation on TCP monitors, heartbeat monitors without periodUnit/graceUnit, a MonitorGroup class, and alert channels as strings. Two section headings were retitled because the feature they named (authentication headers, TCP SSL) is not available on those monitor types; a note points to API checks instead. Sample file names now match the default checkMatch pattern.
  • detect/uptime-monitoring/heartbeat-monitors/cli-configuration.mdx: alert channels defined as constructs instead of strings (Slack samples use SlackAppAlertChannel, the preferred Slack integration); HeartbeatCheck alias replaced with HeartbeatMonitor to match the construct reference.
  • detect/synthetic-monitoring/api-checks/api-structure.mdx, platform/secrets.mdx: request headers written as { key, value } arrays.
  • concepts/environments.mdx: locations typed as (keyof Region)[].
  • cli/environment-variables.mdx: removed the always-truthy '{{ENVIRONMENT_URL}}' || ... fallback and corrected the prose that promised one.
  • constructs/heartbeat-monitor.mdx: the advanced example now defines the alert channels it references.

Verification

After the change, re-running the type check leaves only errors in snippets that are partial by design (/* More options... */, checkly.config.ts fragments that show only the checks section, secret() snippets without imports). Those were left as-is.

Other changes

  • CLI samples across the docs now use Frequency constants (Frequency.EVERY_5M) instead of numeric minutes, so the unit is explicit. Blocks that depict generated output (checkly init, checkly pw-test --create-check) and non-CLI samples (Pulumi, Terraform, REST payloads) keep numbers, because those tools write numbers.
  • Three pages still imported from the pre-rename @checkly/cli package; they now import from checkly. Type-checking those blocks surfaced one more error, a lowercase retry strategy type: 'linear', now 'LINEAR'.
  • The login and logout pages listed the auth token file under @checkly/cli-nodejs; the CLI actually stores it under @checkly/cli. The login page also claimed the file is encrypted; it is plain JSON.
  • Samples use the construct builders (RetryStrategyBuilder, AlertEscalationBuilder) instead of hand-built objects. The startup guide showed an alertSettings object in the REST API's shape, which is not a construct property; it now shows alertEscalationPolicy built with the builder. A mis-cased comparison value in an explanatory comment on the URL monitor page is corrected.
  • The GitHub Actions sample on the uptime CLI page now uses Node 22, which the current CLI requires.

🤖 Generated with Claude Code

sorccu and others added 3 commits September 4, 2026 21:07
…nd uptime guides [RED-935]

Reported in checkly/checkly-cli#1457. The ApiCheck samples used `skipSsl`
(the property is `skipSSL`) and referenced `AssertionBuilder` without
importing it; the group sample set `maxResponseTime`, which CheckGroupV2
does not accept; and the URL monitor sample used the non-existent
`Frequency.EVERY_60S`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ruct APIs [RED-935]

The samples on detect/uptime-monitoring/cli-configuration.mdx used
properties and classes that do not exist in the checkly package:
`method`/`headers` on URL monitor requests, `UrlAssertionBuilder`
response-time and body assertions, `target`/`timeout`/`ssl`/
`responseValidation` on TCP monitors, heartbeat monitors without
`periodUnit`/`graceUnit`, a `MonitorGroup` class, and alert channels
referenced by string name. Rewrite every ts/js sample pair to the real
API, retitle the two sections whose feature no longer applies, name the
check files so the default `checkMatch` picks them up, and bump the CI
workflow sample to a Node version the current CLI supports.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ct API [RED-935]

Alert channels were passed as string names on the heartbeat CLI page,
API check headers were written as an object instead of an array of
key/value pairs, the environments config typed `locations` as
`string[]`, the environment-variables sample OR-ed a string literal
with a fallback (always truthy), and the heartbeat construct page's
advanced example referenced channels it never defined. Also rename the
deprecated `HeartbeatCheck` alias to `HeartbeatMonitor` on the heartbeat
CLI page so it matches the construct reference.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mintlify

mintlify Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
checkly-422f444a 🟢 Ready View Preview Sep 4, 2026, 12:24 PM

…ED-935]

The Slack App integration is the preferred way to send alerts to Slack;
the webhook-based SlackAlertChannel is the legacy option. Switch the
samples introduced on the uptime and heartbeat CLI pages to
SlackAppAlertChannel.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…es [RED-935]

`frequency: 5` reads as an ambiguous number; `Frequency.EVERY_5M` makes
the unit explicit. Replace the numeric form in every hand-written CLI
construct and checkly.config.ts sample and add the import to each
block. Blocks that show what `checkly init` or `checkly pw-test
--create-check` generate keep the number, because the CLI writes a
number there. Pulumi, Terraform, and REST payload samples are unchanged
since those APIs take numbers. Also point the add-to-group highlights at
the `group` lines the prose describes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… name [RED-935]

Three pages still imported constructs from `@checkly/cli`, the package
name the CLI shipped under before it was renamed to `checkly`. Bringing
those blocks under the type check also surfaced a lowercase retry
strategy type (`'linear'`, the API takes `'LINEAR'`) and a mis-cased
`./alert-Channels` import, and a browser check block titled as the
config file. The `@checkly/cli-nodejs` auth.json paths on the login and
logout pages are unchanged: the CLI still stores its config under that
name.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The login and logout pages pointed at `@checkly/cli-nodejs`, but the CLI
registers its config store with an explicit empty suffix, so the real
directory is `@checkly/cli` (`Config` subfolder on Windows). The login
page also described the tokens as encrypted; the store has no encryption
key and the file is plain JSON.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Hand-written retry strategy and alert escalation objects are easy to get
wrong (casing of enum values, REST-API field names that the constructs
do not accept). Switch the remaining samples to RetryStrategyBuilder and
AlertEscalationBuilder. The startup guide showed an `alertSettings`
object in the REST API's shape, which is not a construct property; it
now shows `alertEscalationPolicy` built with the builder. Also correct
`comparison: 'lessThan'` to `'LESS_THAN'` in an explanatory comment.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sorccu
sorccu merged commit b4ef7cc into main Sep 4, 2026
6 checks passed
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.

Broken TypeScript sample in your dynamic monitor creation docs

1 participant