feat/ai-sre → main: add --fields projection to incident/alert list (v1.3.16)#59
Merged
Conversation
* feat(cli): add --fields projection to incident/alert list (json/toon)
In structured (json/toon) mode the curated `incident list` / `alert list`
commands ignore the compact column set and marshal the full nested SDK
record (IncidentInfo/AlertItem with responders/labels/alerts and
events/incident blobs). That makes the first list call huge — 20 incidents
~60-70KB, 66 alerts ~83KB — which spills to file and is then re-queried with
a narrower jq projection. The first dump is pure waste.
Add an additive --fields flag to both list commands: in json/toon mode it
projects each row to only the named JSON-tagged fields via one shared
reflection helper (projectFields), so the first call is already compact and
no jq round-trip is needed. Default behavior (no --fields) is byte-identical
to today; --fields is a no-op in table mode. Unknown field names fail fast
listing the valid tag names.
Out of scope by design: --count/group-by aggregation, nested/dotted paths.
* fix(skilldoc): regenerate incident/alert cards for --fields flag
The --fields projection flag added to `incident list` / `alert list`
changed the cobra command tree, leaving the generated card fences stale.
CI 'Check skill command-cards' (go run ./internal/cmd/skilldoc check)
failed on reference/{alert,incident}.md. Regenerated via make gen-cards.
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.
Release v1.3.16 (patch +1 over v1.3.15).
Included: flashduty-cli #58 — additive
--fieldsprojection onincident list/alert list(json/toon mode), reflection-driven from go-flashduty struct tags; default output unchanged. Surfaced by the AI-SRE session audit (audit-2026-06-23) as the top token-waste class (oversized list dumps re-queried with jq).Content delta vs main = exactly the 6 files of #58. CI was green on #58 (build×3 / lint / Analyze / CodeQL).