feat(deployment-checks): add CRUD commands for deployment checks#10
feat(deployment-checks): add CRUD commands for deployment checks#10facundofarias wants to merge 2 commits into
Conversation
Wire the /projects/{id}/deployment_checks API into the SDK and CLI:
ssh, http, and vulnerability_scan checks gating pre_build or post_deploy
stages. Update sends only flags the user set (cmd.Flags().Changed) so
partial updates don't clobber existing values.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…guides Add the command to the README command list, the project-config decision trees in both SKILL guides, and a full Deployment Checks section in the configuration skill reference with examples for ssh, http, and vulnerability_scan checks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
WalkthroughThis PR adds complete deployment checks management to the deployhq CLI, enabling users to create and manage deployment gates (SSH, HTTP, vulnerability scanner) via new ChangesDeployment Checks Management
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pkg/sdk/deployment_checks.go (1)
34-36: 💤 Low valueClarify the comment: API uses PUT, not PATCH, and omitempty applies to non-pointer strings too.
The comment states "Pointer fields are omitted from the JSON body when nil" and mentions "PATCH", but:
- The Update method uses PUT (line 91), not PATCH.
- Non-pointer string fields with
omitemptywill also omit empty strings, so they support partial updates equally well.📝 Suggested comment revision
-// DeploymentCheckCreateRequest is the payload for creating or updating a deployment check. -// Pointer fields are omitted from the JSON body when nil, so callers only send what they -// want to set (important for partial updates via PATCH). +// DeploymentCheckCreateRequest is the payload for creating or updating a deployment check. +// Fields with omitempty are excluded when empty/nil, enabling partial updates: +// pointer bool/int fields distinguish unset from false/0, string fields omit empty values.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/sdk/deployment_checks.go` around lines 34 - 36, Update the comment on DeploymentCheckCreateRequest to accurately reflect behavior: replace the reference to PATCH with PUT (the Update method uses PUT) and clarify that omitempty applies to non-pointer fields (e.g., empty strings) as well as pointer fields, so fields tagged with `omitempty` are omitted when empty allowing partial updates; reference the DeploymentCheckCreateRequest type and the Update method to locate where the comment should be revised.internal/commands/deployment_checks.go (1)
23-49: ⚡ Quick winAdd
Args: cobra.NoArgsto the list subcommand.The
listsubcommand does not accept arguments, but the command definition lacksArgs: cobra.NoArgs. Other subcommands in this file (showon line 51,deleteon line 71) correctly enforce argument count. AddingArgs: cobra.NoArgstolistwill provide consistent validation and a better error message if the user accidentally passes arguments.✨ Proposed addition
&cobra.Command{ - Use: "list", Short: "List deployment checks", + Use: "list", Short: "List deployment checks", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/commands/deployment_checks.go` around lines 23 - 49, The "list" subcommand's cobra.Command struct (the &cobra.Command{ Use: "list", Short: "List deployment checks", RunE: func(...) {...} }) is missing argument validation; add Args: cobra.NoArgs to that struct so the command rejects unexpected arguments (matching the existing pattern used by the "show" and "delete" subcommands) to provide consistent validation and clearer error messages.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/commands/deployment_checks.go`:
- Around line 23-49: The "list" subcommand's cobra.Command struct (the
&cobra.Command{ Use: "list", Short: "List deployment checks", RunE: func(...)
{...} }) is missing argument validation; add Args: cobra.NoArgs to that struct
so the command rejects unexpected arguments (matching the existing pattern used
by the "show" and "delete" subcommands) to provide consistent validation and
clearer error messages.
In `@pkg/sdk/deployment_checks.go`:
- Around line 34-36: Update the comment on DeploymentCheckCreateRequest to
accurately reflect behavior: replace the reference to PATCH with PUT (the Update
method uses PUT) and clarify that omitempty applies to non-pointer fields (e.g.,
empty strings) as well as pointer fields, so fields tagged with `omitempty` are
omitted when empty allowing partial updates; reference the
DeploymentCheckCreateRequest type and the Update method to locate where the
comment should be revised.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c3640bd9-0831-430a-9c49-c036466103e5
📒 Files selected for processing (9)
README.mddocs/SKILL.mdinternal/commands/agent_metadata.gointernal/commands/deployment_checks.gointernal/commands/root.gopkg/sdk/deployment_checks.gopkg/sdk/deployment_checks_test.goskills/deployhq/SKILL.mdskills/deployhq/references/configuration.md
Summary
/projects/{id}/deployment_checksAPI into the SDK and CLI: ssh, http, and vulnerability_scan checks gating pre_build or post_deploy stagesdhq deployment-checks {list,show,create,update,delete}with flags for each check type; update only sends flags the user actually passed (viacmd.Flags().Changed()) so partial updates don't clobber existing valuesTest plan
go test ./...— all tests pass (5 new SDK tests for List/Get/Create/Update/Delete)go vet ./...andgolangci-lint run— cleandhq deployment-checks --helpshows the command treedhq commands --jsonexposes correct agent metadata for each subcommand🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
dhq deployment-checkscommand group with list, show, create, update, and delete subcommands.Documentation
Tests