From c09be9bf8b0997f20aaed96b1e6da976b6cf3ab9 Mon Sep 17 00:00:00 2001 From: ysyneu Date: Sun, 20 Sep 2026 19:58:33 -0700 Subject: [PATCH] chore: bump go-flashduty to v0.15.4 and regenerate - member notify: --dry-run is gone. The server now rejects a body the sanitizer would rewrite with a 400, so there is nothing left to preview; the response carries agent_instructions instead of html. Drops the test that pinned a dry run printing the whole email, and the card's dry_run advice. - monit rule-export / rule-import are gone with their endpoints. The monit-rule card now points full-definition requests at rule-list-basic + rule-v2-info. - Generated fences and help pick up the other spec changes (investigation_targets time_range / variables / query kind, and the schema text updates). --- go.mod | 2 +- go.sum | 4 +- internal/cli/gen_support_test.go | 38 --- internal/cli/zz_generated_alert_rules.go | 220 +++++------------- internal/cli/zz_generated_alerts.go | 2 + internal/cli/zz_generated_applications.go | 15 ++ internal/cli/zz_generated_audit_logs.go | 2 +- internal/cli/zz_generated_automations.go | 4 +- internal/cli/zz_generated_incidents.go | 2 + internal/cli/zz_generated_manifest.go | 2 - internal/cli/zz_generated_members.go | 16 +- .../zz_generated_notification_templates.go | 68 ++++++ internal/cli/zz_generated_response_help.go | 30 ++- internal/cli/zz_generated_sessions.go | 11 + skills/flashduty/reference/alert.md | 4 +- skills/flashduty/reference/incident.md | 4 +- skills/flashduty/reference/member.md | 6 +- skills/flashduty/reference/monit-rule.md | 21 +- skills/flashduty/reference/rum.md | 10 +- skills/flashduty/reference/safari.md | 4 +- skills/flashduty/reference/template.md | 14 +- 21 files changed, 214 insertions(+), 265 deletions(-) diff --git a/go.mod b/go.mod index a05b895..2d76bbf 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/flashcatcloud/flashduty-cli go 1.25.1 require ( - github.com/flashcatcloud/go-flashduty v0.15.3 + github.com/flashcatcloud/go-flashduty v0.15.4 github.com/mattn/go-runewidth v0.0.29 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 diff --git a/go.sum b/go.sum index bc67339..a018110 100644 --- a/go.sum +++ b/go.sum @@ -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.3 h1:NKxAupco3bE5GuToAYt5DHtdWg/gdwcwfguyenc/umI= -github.com/flashcatcloud/go-flashduty v0.15.3/go.mod h1:YpHiTYXR5NXBI/rGRZfUy537XMkhdCkwA8NW1QoRHwk= +github.com/flashcatcloud/go-flashduty v0.15.4 h1:Bp7OnOd3dO0BmG2ystR7ycRRCJCwqyEEtonixWzzC3Q= +github.com/flashcatcloud/go-flashduty v0.15.4/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= diff --git a/internal/cli/gen_support_test.go b/internal/cli/gen_support_test.go index 39bda16..a1a26d4 100644 --- a/internal/cli/gen_support_test.go +++ b/internal/cli/gen_support_test.go @@ -287,44 +287,6 @@ func TestPrintGenericResultShortenedRowStaysUTF8(t *testing.T) { } } -// TestMemberNotifyDryRunPrintsWholeEmail pins that a notify dry run is a -// plain object, not a list page: an email past the structured-output limit -// comes back whole, with every recipient outcome, instead of failing on the -// list bound. -func TestMemberNotifyDryRunPrintsWholeEmail(t *testing.T) { - html := "

" + strings.Repeat("report line ", 5000) + "

" - for _, format := range []string{"json", "toon"} { - t.Run(format, func(t *testing.T) { - saveAndResetGlobals(t) - stub := newGFStub(t) - stub.data = map[string]any{ - "recipients": []any{ - map[string]any{"person_id": 5068740052131, "status": "accepted"}, - map[string]any{"person_id": 5068740052132, "status": "skipped", "reason": "no_email"}, - }, - "html": html, - } - - out, stderrText, err := execCommandSplit("member", "notify", - "--subject", "Daily report", "--html", "

report

", "--dry-run", "--output-format", format) - if err != nil { - t.Fatalf("execCommandSplit: %v", err) - } - if len(out) < compactListOutputLimit || !strings.Contains(out, strings.Repeat("report line ", 5000)) { - t.Errorf("%s dry run lost part of the email: %d bytes", format, len(out)) - } - for _, want := range []string{"5068740052131", "5068740052132", "no_email"} { - if !strings.Contains(out, want) { - t.Errorf("%s dry run lost recipient outcome %q", format, want) - } - } - if strings.Contains(out, "truncated") || strings.Contains(stderrText, "note:") { - t.Errorf("%s dry run must not be reduced, stderr:\n%s", format, stderrText) - } - }) - } -} - // TestPrintGenericResultCompleteEnvelopeUnmarked guards the marker's negative // case: a page that fits carries no truncated/emitted_rows keys — the marker // means "this page was reduced", not "this command supports reduction". diff --git a/internal/cli/zz_generated_alert_rules.go b/internal/cli/zz_generated_alert_rules.go index ddf2dc9..f80d104 100644 --- a/internal/cli/zz_generated_alert_rules.go +++ b/internal/cli/zz_generated_alert_rules.go @@ -188,114 +188,6 @@ Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq ' return cmd } -func genAlertRulesReadExportCmd() *cobra.Command { - var dataJSON string - var fIDs []int - cmd := &cobra.Command{ - Use: "rule-export", - Short: "Export alert rules", - Long: `Export alert rules. - -Export the configuration of selected alert rules as a portable JSON array, compatible with 'POST /monit/rule/import'. - -API: POST /monit/rule/export (monit-rule-read-export) - -Request fields: - --ids []int (required) — Rule IDs. - -Response fields ('data' is a TOP-LEVEL array of these row objects — pipe 'jq '.[]'', NOT '.items[]'): - - annotations (object) — Custom annotation key-value pairs attached to alert events; keys must not start with '$' (reserved for query field references). - - cron_pattern (string) (required) — Evaluation schedule as a 6-field cron expression (seconds included) or '@every ' (an integral number of seconds, at least 1s); 'CRON_TZ='/'TZ=' prefixes are rejected — set the timezone in 'timezone' instead. - - debug_log_enabled (boolean) (required) — Whether to emit debug logs for this rule's evaluations; enable when troubleshooting. - - delay_seconds (integer) — Query time offset in seconds: each evaluation reads data as of 'schedule time − delay_seconds' to tolerate ingestion lag; '0' means no offset. - - description (string) — Rule description in the format given by 'description_type', shown with alert events. - - description_type (string) — Format of 'description', 'text' or 'markdown'; treated as 'text' when omitted. [text, markdown] - - ds_ids (array) — Datasource ID list, merged with 'ds_list'; references by ID and is therefore immune to datasource renames. - - ds_list (array) — Datasource name list with wildcard support; merged with 'ds_ids' to decide which datasources the rule monitors — must be maintained by hand if a datasource is renamed. - - ds_type (string) (required) — Datasource type ident, e.g. 'prometheus'; must be a datasource type ('ident') that exists in the import target environment. - - enabled (boolean) (required) — Whether the rule is enabled; rules imported as disabled are not evaluated. - - enabled_times (array) — Effective time windows; each entry has 'days' (0–6, 0 = Sunday) and 'stime'/'etime' ('HH:MM'), interpreted in the rule's 'timezone'; an empty list disables the rule. - - days (array) — Days of week, 0 = Sunday. - - etime (string) — End time, e.g. '18:00'. - - stime (string) — Start time, e.g. '09:00'. - - labels (object) — Custom label key-value pairs attached to alert events produced by this rule. - - name (string) (required) — Rule name, up to 128 characters when imported. - - repeat_interval (integer) — Interval in seconds between repeated notifications for a firing alert; values below 1 fall back to the default of 3600. - - repeat_total (integer) — Maximum number of repeated notifications for the same alert; values below 1 fall back to the default of 3. - - rule_configs (object) — Rule evaluation configuration. - - check_anydata (object) — Any-data check configuration. Fires when the query returns any data rows. - - alerting_check_times (integer) — Number of consecutive evaluations that must satisfy the condition before alerting; minimum 1. - - enabled (boolean) — Whether any-data checking is enabled: any returned data row triggers an alert. - - push_recovery_event (boolean) — Whether to push a recovery event notification when the alert resolves. - - recovery (object) — Recovery condition for any-data check. If omitted or 'mode' is empty, treated as 'nodata'. - - args (object) — Datasource-specific options for the recovery query, same convention as 'queries[].args'; required for Elasticsearch datasources when 'mode' is 'ql'. - - condition (string) — Recovery expression. Required when 'mode' is 'ql'. - - mode (string) — 'nodata' = recover when the query returns no data; 'ql' = recover when the 'condition' expression evaluates to true. When 'mode' is 'ql', only a single query ('name=A') is permitted. [nodata, ql] - - recovery_check_times (integer) — Number of consecutive evaluations that must satisfy the recovery condition before resolving; minimum 1. - - severity (string) — Severity of any-data alert events; case-sensitive. [Critical, Warning, Info] - - check_nodata (object) — No-data check configuration. - - alert_on_empty_result (boolean) — Whether to trigger an alert when every query returns an empty result. - - alert_on_empty_result_severity (string) — Severity of empty-result alerts, case-sensitive; only effective when 'alert_on_empty_result' is enabled. [Critical, Warning, Info] - - alerting_check_times (integer) — Number of consecutive evaluations that must satisfy the condition before alerting; minimum 1. - - enabled (boolean) — Whether no-data checking is enabled: a previously-seen series that stops returning data triggers an alert. - - push_recovery_event (boolean) — Whether to push a recovery event notification when the alert resolves. - - recovery_check_times (integer) — Number of consecutive evaluations that must satisfy the recovery condition before resolving; minimum 1. - - resolve_timeout (integer) — Auto-resolve after N seconds. - - severity (string) — Severity of no-data alert events; case-sensitive. [Critical, Warning, Info] - - check_threshold (object) — Threshold check configuration. - - alerting_check_times (integer) — Number of consecutive evaluations that must satisfy the condition before alerting; minimum 1. - - critical (string) — Critical threshold expression referencing query results via '$' or '$.', e.g. '$A > 90'; at least one severity must be configured. - - enabled (boolean) — Whether threshold checking is enabled. - - info (string) — Info threshold expression, same syntax as 'critical'. - - push_recovery_event (boolean) — Whether to push a recovery event notification when the alert resolves. - - recovery (object) — Recovery evaluation configuration for threshold checks. - - args (object) — Datasource-specific extra parameters for the recovery query, using the same '.' key convention as query 'args'. Omitted when empty. - - condition (string) — Recovery condition expression; required when 'mode' is 'threshold' or 'ql', and must be empty for 'invert'. - - mode (string) — Recovery mode: 'invert' = resolve when the alert expression no longer holds ('condition' stays empty); 'threshold' = resolve when the 'condition' threshold expression holds; 'ql' = resolve when the 'condition' query expression evaluates true. [invert, threshold, ql] - - value_fields (array) — Numeric result fields the recovery 'condition' references as '$A.'; same semantics as the query's 'value_fields'. Omitted when empty. - - recovery_check_times (integer) — Number of consecutive evaluations that must satisfy the recovery condition before resolving; minimum 1. - - warning (string) — Warning threshold expression, same syntax as 'critical'. - - queries (array) (required) — Query list with at least one entry; each needs a unique 'name' ('R' and '__all__' are reserved) and a non-empty, non-duplicate 'expr'. - - args (object) — Datasource-specific query options keyed by the '.