Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions packages/cli/e2e/__tests__/deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,30 @@
Update and Unchanged:
ApiCheck: not-testonly-default-check
ApiCheck: not-testonly-false-check`)
// --output without --verbose should not show name or id
expect(stdout).not.toContain('name:')
expect(stdout).not.toContain('id:')
})

it('Should show resource name and id with --verbose', async () => {
const { stdout } = await runDeploy(fixt, ['--force', '--verbose'], {
env: {
PROJECT_LOGICAL_ID: projectLogicalId,
PRIVATE_LOCATION_SLUG_NAME: privateLocationSlugname,
TEST_ONLY: 'true',
CHECKLY_CLI_VERSION: '4.8.0',
},
})
const uuid = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
expect(stdout).toMatch(new RegExp(

Check failure on line 339 in packages/cli/e2e/__tests__/deploy.spec.ts

View workflow job for this annotation

GitHub Actions / test - windows-latest-x64

e2e/__tests__/deploy.spec.ts > deploy > test-only-project > Should show resource name and id with --verbose

AssertionError: expected 'Parsing your project... ✅\n\nValidati…' to match /Update and Unchanged:\n ApiCheck: …/ - Expected: /Update and Unchanged:\n ApiCheck: not-testonly-default-check\n name: TestOnly=false \(default\) Check\n id: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\n ApiCheck: not-testonly-false-check\n name: TestOnly=false Check\n id: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ + Received: "Parsing your project... ✅ Validating project resources... ✅ Bundling project resources... ✅ Uploading Playwright tests... ✅ Create: ApiCheck: not-testonly-default-check name: TestOnly=false (default) Check id: 2fbaae35-6339-4dd9-a67e-83abe33f3109 ApiCheck: not-testonly-false-check name: TestOnly=false Check id: 9db34888-f466-4391-ae1e-0d2a596b5395 Skip (testOnly): ApiCheck: testonly-true-check Successfully deployed project \"Test Project (Check testOnly flag)\" to account \"*** E2E E2E E2E\"." ❯ e2e/__tests__/deploy.spec.ts:339:22

Check failure on line 339 in packages/cli/e2e/__tests__/deploy.spec.ts

View workflow job for this annotation

GitHub Actions / test - ubuntu-latest

e2e/__tests__/deploy.spec.ts > deploy > test-only-project > Should show resource name and id with --verbose

AssertionError: expected 'Parsing your project... ✅\n\nValidati…' to match /Update and Unchanged:\n ApiCheck: …/ - Expected: /Update and Unchanged:\n ApiCheck: not-testonly-default-check\n name: TestOnly=false \(default\) Check\n id: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\n ApiCheck: not-testonly-false-check\n name: TestOnly=false Check\n id: [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ + Received: "Parsing your project... ✅ Validating project resources... ✅ Bundling project resources... ✅ Uploading Playwright tests... ✅ Create: ApiCheck: not-testonly-default-check name: TestOnly=false (default) Check id: d9062025-d57d-4313-a915-496050d83054 ApiCheck: not-testonly-false-check name: TestOnly=false Check id: 8baa6401-b2a0-4069-8053-0df12492aea7 Skip (testOnly): ApiCheck: testonly-true-check Successfully deployed project \"Test Project (Check testOnly flag)\" to account \"*** E2E E2E E2E\"." ❯ e2e/__tests__/deploy.spec.ts:339:22
`Update and Unchanged:\n`
+ ` ApiCheck: not-testonly-default-check\n`
+ ` name: TestOnly=false \\(default\\) Check\n`
+ ` id: ${uuid}\n`
+ ` ApiCheck: not-testonly-false-check\n`
+ ` name: TestOnly=false Check\n`
+ ` id: ${uuid}`,
))
})
})

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/ai-context/references/communicate.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Write commands (`incidents create`, `incidents update`, `incidents resolve`, `de
3. This applies to **every** write command, not just the first one. Incident updates and resolutions also require confirmation.
4. Use `--dry-run` to preview what a command will do without executing or prompting.
5. Read-only commands (`incidents list`, `status-pages list`) execute immediately without confirmation.
6. When deploying, use `--verbose` to include resource names and physical IDs (UUIDs) in the output. This is useful for programmatically referencing deployed resources (e.g. running `npx checkly checks get <id>` to inspect a deployed check).

## Available Commands

Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/ai-context/skill.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Run `npx checkly skills manage` for the full reference.

Write commands (e.g. `incidents create`, `deploy`, `destroy`) return exit code 2 with a `confirmation_required` JSON envelope instead of executing. **Always present the `changes` to the user and wait for approval before running the `confirmCommand`.** Never auto-append `--force`. This applies to every write command individually — updates and resolutions need confirmation too, not just the initial create.

When deploying, use `--verbose` to include resource names and physical IDs (UUIDs) in the output. This is useful for programmatically referencing deployed resources (e.g. running `npx checkly checks get <id>` to inspect a deployed check).

Run `npx checkly skills communicate` for the full protocol details.

<!-- SKILL_COMMANDS -->
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ describe('deploy confirmation flow', () => {
'force': false,
'preview': false,
'output': false,
'verbose': false,
'config': undefined,
'schedule-on-deploy': true,
'verify-runtime-dependencies': true,
Expand Down
35 changes: 27 additions & 8 deletions packages/cli/src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export default class Deploy extends AuthCommand {
description: 'Shows the changes made after the deploy command.',
default: false,
}),
'verbose': Flags.boolean({
char: 'v',
description: 'Show resource names and IDs in the deploy output.',
default: false,
}),
'schedule-on-deploy': Flags.boolean({
description: 'Enables automatic check scheduling after a deploy.',
default: true,
Expand Down Expand Up @@ -79,12 +84,14 @@ export default class Deploy extends AuthCommand {
force,
preview,
'schedule-on-deploy': scheduleOnDeploy,
output,
output: outputFlag,
verbose,
config: configFilename,
'verify-runtime-dependencies': verifyRuntimeDependencies,
'debug-bundle': debugBundle,
'debug-bundle-output-file': debugBundleOutputFile,
} = flags
const output = outputFlag || verbose
const { configDirectory, configFilenames } = splitConfigFilePath(configFilename)
const {
config: checklyConfig,
Expand Down Expand Up @@ -234,7 +241,7 @@ export default class Deploy extends AuthCommand {
try {
const { data } = await api.projects.deploy({ ...projectPayload, repoInfo }, { dryRun: preview, scheduleOnDeploy })
if (preview || output) {
this.log(this.formatPreview(data, project))
this.log(this.formatPreview(data, project, verbose))
}
if (!preview) {
await setTimeout(500)
Expand All @@ -256,15 +263,15 @@ export default class Deploy extends AuthCommand {
}
}

private formatPreview (previewData: ProjectDeployResponse, project: Project): string {
private formatPreview (previewData: ProjectDeployResponse, project: Project, verbose = false): string {
// Current format of the data is: { checks: { logical-id-1: 'UPDATE' }, groups: { another-logical-id: 'CREATE' } }
// We convert it into update: [{ logicalId, resourceType, construct }, ...], create: [], delete: []
// This makes it easier to display.
const updating = []
const creating = []
const deleting: Array<{ resourceType: string, logicalId: string }> = []
for (const change of previewData?.diff ?? []) {
const { type, logicalId, action } = change
const { type, logicalId, physicalId, action } = change
if ([
AlertChannelSubscription.__checklyType,
PrivateLocationCheckAssignment.__checklyType,
Expand All @@ -276,9 +283,9 @@ export default class Deploy extends AuthCommand {
}
const construct = project.data[type as keyof ProjectData][logicalId]
if (action === ResourceDeployStatus.UPDATE) {
updating.push({ resourceType: type, logicalId, construct })
updating.push({ resourceType: type, logicalId, physicalId, construct })
} else if (action === ResourceDeployStatus.CREATE) {
creating.push({ resourceType: type, logicalId, construct })
creating.push({ resourceType: type, logicalId, physicalId, construct })
} else if (action === ResourceDeployStatus.DELETE) {
// Since the resource is being deleted, the construct isn't in the project.
deleting.push({ resourceType: type, logicalId })
Expand Down Expand Up @@ -331,8 +338,14 @@ export default class Deploy extends AuthCommand {

if (sortedCreating.filter(({ construct }) => Boolean(construct)).length) {
output.push(chalk.bold.green('Create:'))
for (const { logicalId, construct } of sortedCreating) {
for (const { logicalId, physicalId, construct } of sortedCreating) {
output.push(` ${construct.constructor.name}: ${logicalId}`)
if (verbose && (construct as any).name) {
output.push(` name: ${(construct as any).name}`)
}
if (verbose && physicalId) {
output.push(` id: ${physicalId}`)
}
}
output.push('')
}
Expand All @@ -353,8 +366,14 @@ export default class Deploy extends AuthCommand {
}
if (sortedUpdating.length) {
output.push(chalk.bold.magenta('Update and Unchanged:'))
for (const { logicalId, construct } of sortedUpdating) {
for (const { logicalId, physicalId, construct } of sortedUpdating) {
output.push(` ${construct.constructor.name}: ${logicalId}`)
if (verbose && (construct as any).name) {
output.push(` name: ${(construct as any).name}`)
}
if (verbose && physicalId) {
output.push(` id: ${physicalId}`)
}
}
output.push('')
}
Expand Down
2 changes: 2 additions & 0 deletions skills/checkly/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Run `npx checkly skills manage` for the full reference.

Write commands (e.g. `incidents create`, `deploy`, `destroy`) return exit code 2 with a `confirmation_required` JSON envelope instead of executing. **Always present the `changes` to the user and wait for approval before running the `confirmCommand`.** Never auto-append `--force`. This applies to every write command individually — updates and resolutions need confirmation too, not just the initial create.

When deploying, use `--verbose` to include resource names and physical IDs (UUIDs) in the output. This is useful for programmatically referencing deployed resources (e.g. running `npx checkly checks get <id>` to inspect a deployed check).

Run `npx checkly skills communicate` for the full protocol details.

### `npx checkly skills initialize`
Expand Down
Loading