Feat/ai sre#49
Merged
Merged
Conversation
Generated commands carried no hand-written column set, so in human (table)
mode they fell back to indented JSON. Add a generic, reflection-based
renderer that gives every generated command an aligned table:
- a paginated list envelope ({Items:[...], Total, ...}) or a top-level
row array prints as an aligned table;
- a single object prints as a vertical FIELD/VALUE table;
- anything else falls back to indented JSON, so output is never empty.
Columns come from a display-only seed (display_columns.go) lifted from the
curated commands' hand-written column sets, with a reflective heuristic
(first N scalar/timestamp fields) for unmapped row types. The seed is
display-only: it never affects flags or machine output, so a wrong entry
degrades one table column at worst — it cannot cause a functional error.
Machine modes (--output-format json/toon) are untouched: the renderer is
reached only in table mode; structured output still marshals the full
typed response (verified byte-identical to the direct printer).
This is the keystone for converging the CLI on generated commands as the
single source of truth: human tables no longer require hand-written
commands, so curated shadows can be removed later without losing readable
output. Follow-ups (separate PRs): drop curated shadows group-by-group with
skill-doc migration; unshadow insight to expose its server-side filters;
add team/creator names + incident short-id to the API so the generated
commands inherit them.
…gs (#47) Generated commands' unix-SECONDS timestamp flags now accept relative time (7d/24h/+7d/now/date/RFC3339/raw-unix), parsed at runtime via timeutil.Parse — the curated incident-list logic. Detector excludes millisecond timestamps and durations; name-conventions (bare start/end, *_at_*_seconds) catch spec-deficient fields. Help renders these as string + accepted-forms hint. Also fixes shell-unsafe single-quoting of generated --data examples (clears go/unsafe-quoting).
…ponder, member list) (#48) Continues the generated-as-single-source convergence (after the table renderer and relative-time keystones). Removes the curated commands whose only difference from their generated twin is flag spelling — a clean rename, now that generated --start-time/--end-time accept relative time: - insight team/channel/responder: curated --since/--until → generated --start-time/--end-time (relative-time capable) PLUS the generated twin exposes severities, *_ids, fields, aggregate-unit, … (net gain). - member list: curated --name/--email → generated --query (the curated command already folded both into the SDK Query field; generated also keeps --role-id/--orderby/--asc and adds the rest of the member API). To preserve the curated human tables, the generic renderer gains an optional per-column formatter (colSpec.Format); DimensionInsightItem and ResponderInsightItem seeds render ACK%/MTTA/MTTR with the same percent/ duration formatting the curated tables used. json/toon output unchanged. insight top-alerts and incidents are KEPT curated for now — their generated twins differ by more than flag spelling (--limit→--k, offset→cursor pagination), so they're not pure renames. e2e: member filter tests migrated to --query. Doc/scan.sh references in fc-safari migrate in a paired PR; the dropped commands only disappear for agents once a new CLI is released into the sandbox, so the two land together.
Generated commands were flag/--data-only, which blocked removing the curated ID-based shadows (incident/alert verbs) without ergonomic regression. Add positional-argument support in the generator: a generated command whose request has a required *_id (scalar) or *_ids (array) body field now accepts that id positionally (folded onto the existing flag at runtime; the flag and --data still work and take precedence). - Selection: required *_id/*_ids, array-wins, with a per-op override map (incident merge -> target_incident_id; war-room detail/add-member -> chat_id). - Suppress positional on `create` verbs (the required id is a parent ref) and on rule-move (its rule-ids field is `ids`, not `*_ids`). - Scalar positionals require exactly one arg; arrays require >=1; friendly errors mirror curated requireArgs (new requireExactArg sibling). - intslice fold for []uint64 id fields (team_ids/person_ids/role_ids/...). - gen_support.go genFoldPositional helper; selectPositional unit-tested. 123 positionals across 250 generated commands; non-breaking (no curated command behavior changed); live-verified on testback. Foundation for dropping the clean curated ID-verb shadows in a reviewed follow-up.
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.
Closes: