Skip to content
Merged
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/flashcatcloud/flashduty-cli
go 1.25.1

require (
github.com/flashcatcloud/go-flashduty v0.15.5
github.com/flashcatcloud/go-flashduty v0.15.7
github.com/mattn/go-runewidth v0.0.29
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY=
github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/flashcatcloud/go-flashduty v0.15.5 h1:ovhuVr+PyE/1XdsGiMnCTIyLXlaPwv3Yi81PbufgXQg=
github.com/flashcatcloud/go-flashduty v0.15.5/go.mod h1:YpHiTYXR5NXBI/rGRZfUy537XMkhdCkwA8NW1QoRHwk=
github.com/flashcatcloud/go-flashduty v0.15.7 h1:3bnopTmY2w6zUbPSV2MpLrHdzl1fr3hEM3DDbbj4cOY=
github.com/flashcatcloud/go-flashduty v0.15.7/go.mod h1:YpHiTYXR5NXBI/rGRZfUy537XMkhdCkwA8NW1QoRHwk=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/mattn/go-runewidth v0.0.29 h1:3oGF3R/S2N9DQ3ptftzVIvg2eicmojCzlwBEmqEPDfQ=
Expand Down
6 changes: 3 additions & 3 deletions internal/cli/fieldproject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func TestIncidentListStructuredDefaultUsesCompactProjection(t *testing.T) {
t.Fatalf("execCommandSplit: %v", err)
}

assertProjectedJSONFields(t, out, []string{"incident_id", "title", "incident_severity", "progress", "start_time", "channel_id"})
assertProjectedJSONFields(t, out, []string{"incident_id", "num", "title", "incident_severity", "progress", "start_time", "channel_id", "detail_url"})
if !strings.Contains(stderrText, "note: rows projected to default compact fields") {
t.Errorf("default projection should announce itself on stderr, got:\n%s", stderrText)
}
Expand All @@ -296,7 +296,7 @@ func TestIncidentListStructuredDefaultUsesCompactProjection(t *testing.T) {

// Positive keys must come from stdout alone: the stderr note embeds the
// same field names, so a merged capture would satisfy this vacuously.
for _, key := range []string{"incident_id", "title", "incident_severity", "progress", "start_time", "channel_id"} {
for _, key := range []string{"incident_id", "num", "title", "incident_severity", "progress", "start_time", "channel_id", "detail_url"} {
if !strings.Contains(out, key) {
t.Errorf("default toon output missing compact key %q, got:\n%s", key, out)
}
Expand Down Expand Up @@ -572,7 +572,7 @@ func TestIncidentSimilarStructuredProjection(t *testing.T) {
if err := json.Unmarshal([]byte(strings.TrimSpace(out)), &rows); err != nil {
t.Fatalf("parse compact similar json: %v\n%s", err, out)
}
want := []string{"incident_id", "title", "incident_severity", "progress", "start_time", "close_time", "ack_time", "alert_cnt", "root_cause", "score"}
want := []string{"incident_id", "num", "title", "incident_severity", "progress", "start_time", "close_time", "ack_time", "alert_cnt", "root_cause", "score", "detail_url"}
if len(rows) != len(items) {
t.Fatalf("got %d rows, want %d", len(rows), len(items))
}
Expand Down
6 changes: 3 additions & 3 deletions internal/cli/incident.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ func newIncidentListCmd() *cobra.Command {
var progress, severity, query, since, until, nums, fields, channel string
var channelID int64
var limit, page int
defaultStructuredFields := []string{"incident_id", "title", "incident_severity", "progress", "start_time", "channel_id"}
defaultStructuredFields := []string{"incident_id", "num", "title", "incident_severity", "progress", "start_time", "channel_id", "detail_url"}

cmd := &cobra.Command{
Use: "list",
Short: "List incidents",
Long: curatedLong("List incidents matching the given filters. The --since/--until window must be < 31 days; --limit max is 100. In json/toon mode, rows default to the compact fields incident_id,title,incident_severity,progress,start_time,channel_id; pass --fields to choose a different projection.\n\nSee also: fduty insight <team|responder|channel> for aggregated metrics (MTTA, MTTR, noise reduction), fduty insight incident-list for metric-rich filtered incident rows, and fduty insight incident-export for CSV incident exports.", "Incidents", "List"),
Long: curatedLong("List incidents matching the given filters. The --since/--until window must be < 31 days; --limit max is 100. In json/toon mode, rows default to the compact fields incident_id,num,title,incident_severity,progress,start_time,channel_id,detail_url; pass --fields to choose a different projection.\n\nSee also: fduty insight <team|responder|channel> for aggregated metrics (MTTA, MTTR, noise reduction), fduty insight incident-list for metric-rich filtered incident rows, and fduty insight incident-export for CSV incident exports.", "Incidents", "List"),
RunE: func(cmd *cobra.Command, args []string) error {
return runCommand(cmd, args, func(ctx *RunContext) error {
startTime, err := timeutil.Parse(since)
Expand Down Expand Up @@ -629,7 +629,7 @@ func newIncidentSimilarCmd() *cobra.Command {
}

if ctx.Structured() {
fieldNames := []string{"incident_id", "title", "incident_severity", "progress", "start_time", "close_time", "ack_time", "alert_cnt", "root_cause", "score"}
fieldNames := []string{"incident_id", "num", "title", "incident_severity", "progress", "start_time", "close_time", "ack_time", "alert_cnt", "root_cause", "score", "detail_url"}
if fields != "" {
fieldNames = parseStringSlice(fields)
} else {
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/incident_summary_script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestIncidentSummaryScriptCompactOutput(t *testing.T) {
if len(lines) != 6 {
t.Fatalf("fduty calls = %d, want 6:\n%s", len(lines), invocations)
}
wantDetail := "incident detail inc-1 --fields incident_id,title,incident_severity,progress,ai_summary,root_cause,resolution,alert_cnt,start_time,channel_id --output-format toon"
wantDetail := "incident detail inc-1 --fields incident_id,num,title,incident_severity,progress,ai_summary,root_cause,resolution,alert_cnt,start_time,channel_id,detail_url --output-format toon"
if lines[0] != wantDetail {
t.Fatalf("detail call = %q, want compact projection %q", lines[0], wantDetail)
}
Expand Down
3 changes: 3 additions & 0 deletions internal/cli/zz_generated_alerts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions internal/cli/zz_generated_incidents.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading