Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Duplicated output helpers already exist in metrics.go
- Consolidated validateOutputFormat and isJSONOutput into output.go, removing duplicate functions from summary.go and metrics.go.
Or push these changes by commenting:
@cursor push 1198fe54fc
Preview (1198fe54fc)
diff --git a/pkg/cmd/ci/metrics.go b/pkg/cmd/ci/metrics.go
--- a/pkg/cmd/ci/metrics.go
+++ b/pkg/cmd/ci/metrics.go
@@ -38,7 +38,7 @@
depot ci metrics --job job_123 --output json
depot ci metrics --run run_123 --output json`,
RunE: func(cmd *cobra.Command, args []string) error {
- if err := validateMetricsOutput(output); err != nil {
+ if err := validateOutputFormat(output); err != nil {
return err
}
if len(args) > 1 {
@@ -84,7 +84,7 @@
}
return fmt.Errorf("failed to get job metrics: %w", err)
}
- if metricsOutputJSON(output) {
+ if isJSONOutput(output) {
return writeJSON(buildJobMetricsJSON(resp))
}
printJobMetrics(resp, orgFlag)
@@ -96,7 +96,7 @@
}
return fmt.Errorf("failed to get run metrics: %w", err)
}
- if metricsOutputJSON(output) {
+ if isJSONOutput(output) {
return writeJSON(buildRunMetricsJSON(resp))
}
printRunMetrics(resp, orgFlag)
@@ -108,7 +108,7 @@
}
return fmt.Errorf("failed to get attempt metrics: %w", err)
}
- if metricsOutputJSON(output) {
+ if isJSONOutput(output) {
return writeJSON(buildAttemptMetricsJSON(resp))
}
printAttemptMetrics(resp, orgFlag)
@@ -451,17 +451,6 @@
return ""
}
-func validateMetricsOutput(output string) error {
- if output == "" || output == "text" || output == "json" {
- return nil
- }
- return fmt.Errorf("unsupported output %q (valid: text, json)", output)
-}
-
-func metricsOutputJSON(output string) bool {
- return output == "json"
-}
-
func countNonEmpty(values ...string) int {
count := 0
for _, value := range values {
diff --git a/pkg/cmd/ci/output.go b/pkg/cmd/ci/output.go
--- a/pkg/cmd/ci/output.go
+++ b/pkg/cmd/ci/output.go
@@ -2,6 +2,7 @@
import (
"encoding/json"
+ "fmt"
"os"
)
@@ -12,3 +13,17 @@
enc.SetIndent("", " ")
return enc.Encode(v)
}
+
+// validateOutputFormat validates that the output format is one of: "", "text", or "json".
+// Used by CI verbs that support --output flags.
+func validateOutputFormat(output string) error {
+ if output == "" || output == "text" || output == "json" {
+ return nil
+ }
+ return fmt.Errorf("unsupported output %q (valid: text, json)", output)
+}
+
+// isJSONOutput returns true if the output format is "json".
+func isJSONOutput(output string) bool {
+ return output == "json"
+}
diff --git a/pkg/cmd/ci/summary.go b/pkg/cmd/ci/summary.go
--- a/pkg/cmd/ci/summary.go
+++ b/pkg/cmd/ci/summary.go
@@ -33,7 +33,7 @@
depot ci summary <job-id>
depot ci summary <attempt-id> --output json`,
RunE: func(cmd *cobra.Command, args []string) error {
- if err := validateSummaryOutput(output); err != nil {
+ if err := validateOutputFormat(output); err != nil {
return err
}
if len(args) == 0 {
@@ -60,7 +60,7 @@
resp, attemptErr := ciGetJobAttemptSummary(ctx, tokenVal, orgID, id)
if attemptErr == nil {
- if summaryOutputJSON(output) {
+ if isJSONOutput(output) {
return writeJSON(buildSummaryJSON(resp))
}
return printSummaryResponse(cmd.OutOrStdout(), resp)
@@ -82,7 +82,7 @@
return fmt.Errorf("failed to get job summary: %w", jobErr)
}
- if summaryOutputJSON(output) {
+ if isJSONOutput(output) {
return writeJSON(buildSummaryJSON(resp))
}
@@ -156,14 +156,3 @@
return "No CI step summary was produced."
}
}
-
-func validateSummaryOutput(output string) error {
- if output == "" || output == "text" || output == "json" {
- return nil
- }
- return fmt.Errorf("unsupported output %q (valid: text, json)", output)
-}
-
-func summaryOutputJSON(output string) bool {
- return output == "json"
-}You can send follow-ups to the cloud agent here.
ischolten
approved these changes
May 7, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: JSON mode emits non-JSON help text to stdout
- Modified the code to return a structured error instead of calling cmd.Help() when --output json is set but no arguments are provided.
Or push these changes by commenting:
@cursor push 730f9a8d6b
Preview (730f9a8d6b)
diff --git a/pkg/cmd/ci/summary.go b/pkg/cmd/ci/summary.go
--- a/pkg/cmd/ci/summary.go
+++ b/pkg/cmd/ci/summary.go
@@ -36,6 +36,9 @@
return err
}
if len(args) == 0 {
+ if outputIsJSON(output) {
+ return fmt.Errorf("expected exactly one attempt or job ID")
+ }
return cmd.Help()
}
if len(args) > 1 {You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 2488b57. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
depot ci summarynow gives humans and agents a direct way to read authored CI step summary markdown for one job or attempt. The command supports plain markdown for humans and structured JSON for automation, so scripts do not have to parse terminal text.Details
depot ci summary <attempt-id | job-id>.GetJobSummaryAPI contract from depot/api#3648.--output json/-o jsonwith IDs, statuses,has_summary,empty_reason,step_count, andmarkdown.depot ci metrics.The command intentionally does not add plural workflow/run summary discovery. It depends on the API contract in https://github.com/depot/api/pull/3648 being merged and deployed before it works against production.
Verification
make generatego test ./pkg/api ./pkg/cmd/cigo test ./...go build -o ./depot ./cmd/depotgit diff --checkNote
Medium Risk
Adds a new CLI surface and wires in a new CI RPC (
GetJobSummary) including regenerated protobuf/connect code; risk is mainly around API compatibility and correctly resolving job vs attempt IDs and output formatting.Overview
Adds a new
depot ci summarycommand to fetch authored CI step summary markdown for a job or attempt, with optional--output jsonfor automation and clean stdout/stderr behavior.Introduces a new CI API wrapper
CIGetJobSummaryand plumbs a newGetJobSummaryRPC through the protobuf and Connect client/server stubs. Also centralizes output validation (textvsjson) inoutput.goand updatesci metricsto use the shared helpers.Reviewed by Cursor Bugbot for commit 0802bb1. Bugbot is set up for automated code reviews on this repo. Configure here.