history

package
v0.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package history implements the `aiwf history` verb (per-verb subpackage of M-0116; cmd/aiwf/main.go's newRootCmd wires it via NewCmd). The neutral, Cobra-free HistoryEvent parsing lives in internal/entityview; this package holds the Cobra wiring plus the text-rendering helpers (RenderTo, RenderActor, RenderScopeChips) and the scope-map guard (ScopeMapFor) that composes entityview's predicates with cliutil.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmd

func NewCmd(correlationID string) *cobra.Command

NewCmd builds `aiwf history <id>`: filters git log for the entity's structured trailers and prints one line per event.

func RenderActor

func RenderActor(e entityview.HistoryEvent) string

RenderActor formats the actor column. When a non-human principal is present and differs from the actor (the agent-acts-for-human case from I2.5), the column reads `principal via agent` so the human is visually attributed first. Direct human acts (no principal) render the actor verbatim.

func RenderScopeChips

func RenderScopeChips(e entityview.HistoryEvent, scopeEntities map[string]string, showAuth bool) string

RenderScopeChips assembles the trailing chip block for one history row. For `aiwf authorize` rows, a `[<scope> <event>]` chip names the lifecycle event (`opened` / `paused` / `resumed`). For scope-authorized rows, a `[<scope-entity> <auth-short>]` chip names the authorizing scope. For terminal-promote rows that ended one or more scopes, one `[<scope-entity> ended]` chip per ended scope.

scopeEntities maps full auth-SHA to scope-entity id. showAuth flips on the full SHA inline (the --show-authorization flag).

The output begins with a leading " " when non-empty so it sits flush against the Commit column the caller already printed.

func RenderTo

func RenderTo(to string) string

RenderTo formats the target-status column in `aiwf history` text output. Empty (the absent-trailer case for non-promote events and pre-I2 promote commits) renders as "-"; a populated value is shown with a leading arrow so the column reads as a transition target.

func Run

func Run(id, root, format string, pretty, showAuth bool, correlationID string) (code int)

Run executes `aiwf history`. Returns one of the cliutil.Exit* codes.

func ScopeMapFor added in v0.23.0

func ScopeMapFor(ctx context.Context, root string, events []entityview.HistoryEvent) map[string]string

ScopeMapFor returns the authorize-opener → scope-entity map the history text renderer hands to RenderScopeChips, or nil when the loaded events carry no scope data. When nil, no row reads the map (an opener's own [scope: opened] chip renders from e.Scope), so the repo-wide cliutil.AuthorizeOpeners grep is skipped entirely — the E-0054 / M-0223 guard. A grep failure yields nil, so chips render "?" rather than blocking the verb, exactly as the old best-effort BuildScopeEntityMap did.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL