view

package
v0.1.42 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package view renders user-facing command output from typed values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderAgentsListJSON

func RenderAgentsListJSON(w io.Writer, result AgentsList) error

RenderAgentsListJSON writes the agent list as indented JSON.

func RenderAgentsListText

func RenderAgentsListText(w io.Writer, result AgentsList) error

RenderAgentsListText writes a stable human-readable agent list.

func RenderAgentsShowJSON

func RenderAgentsShowJSON(w io.Writer, result AgentsShow) error

RenderAgentsShowJSON writes the agent detail as indented JSON.

func RenderAgentsShowText

func RenderAgentsShowText(w io.Writer, result AgentsShow) error

RenderAgentsShowText writes a stable human-readable agent detail.

func RenderConfigClearJSON

func RenderConfigClearJSON(w io.Writer, result ConfigClear) error

RenderConfigClearJSON writes the clear summary as indented JSON.

func RenderConfigClearText

func RenderConfigClearText(w io.Writer, result ConfigClear) error

RenderConfigClearText writes a stable human-readable clear summary.

func RenderConfigJSON

func RenderConfigJSON(w io.Writer, show ConfigShow) error

RenderConfigJSON writes the config summary as indented JSON.

func RenderConfigText

func RenderConfigText(w io.Writer, show ConfigShow) error

RenderConfigText writes a stable human-readable config summary.

func RenderCredentialWriteJSON

func RenderCredentialWriteJSON(w io.Writer, result CredentialWrite) error

RenderCredentialWriteJSON writes a set-credential result envelope.

func RenderDataPruneJSON

func RenderDataPruneJSON(w io.Writer, result DataPrune) error

RenderDataPruneJSON writes a prune summary as indented JSON.

func RenderDataPruneText

func RenderDataPruneText(w io.Writer, result DataPrune) error

RenderDataPruneText writes a prune summary.

func RenderDataPurgeJSON

func RenderDataPurgeJSON(w io.Writer, result DataPurge) error

RenderDataPurgeJSON writes a purge summary as indented JSON.

func RenderDataPurgeText

func RenderDataPurgeText(w io.Writer, result DataPurge) error

RenderDataPurgeText writes a purge summary.

func RenderDataShowJSON

func RenderDataShowJSON(w io.Writer, result DataShow) error

RenderDataShowJSON writes data stats as indented JSON.

func RenderDataShowText

func RenderDataShowText(w io.Writer, result DataShow) error

RenderDataShowText writes stable human-readable data stats.

func RenderMeJSON

func RenderMeJSON(w io.Writer, result MeResult) error

RenderMeJSON writes the identity summary as indented JSON.

func RenderMeText

func RenderMeText(w io.Writer, result MeResult) error

RenderMeText writes a stable human-readable identity summary.

func RenderReviewDryRunJSON

func RenderReviewDryRunJSON(w io.Writer, result ReviewDryRun) error

RenderReviewDryRunJSON writes a dry-run summary as indented JSON.

func RenderReviewDryRunText

func RenderReviewDryRunText(w io.Writer, result ReviewDryRun) error

RenderReviewDryRunText writes a human-readable dry-run summary.

func RenderReviewLiveJSON

func RenderReviewLiveJSON(w io.Writer, result ReviewLive) error

RenderReviewLiveJSON writes a live review summary as indented JSON.

func RenderReviewLiveText

func RenderReviewLiveText(w io.Writer, result ReviewLive) error

RenderReviewLiveText writes a human-readable live review summary.

func RenderSessionsDeleteJSON

func RenderSessionsDeleteJSON(w io.Writer, result SessionsDelete) error

RenderSessionsDeleteJSON writes a named-session deletion result as JSON.

func RenderSessionsDeleteText

func RenderSessionsDeleteText(w io.Writer, result SessionsDelete) error

RenderSessionsDeleteText writes a named-session deletion result.

func RenderSessionsListJSON

func RenderSessionsListJSON(w io.Writer, result SessionsList) error

RenderSessionsListJSON writes a named-session list as indented JSON.

func RenderSessionsListText

func RenderSessionsListText(w io.Writer, result SessionsList) error

RenderSessionsListText writes a stable human-readable session list.

func RenderSessionsShowJSON

func RenderSessionsShowJSON(w io.Writer, result SessionsShow) error

RenderSessionsShowJSON writes a named-session detail as indented JSON.

func RenderSessionsShowText

func RenderSessionsShowText(w io.Writer, result SessionsShow) error

RenderSessionsShowText writes stable human-readable session details.

Types

type AgentDetail

type AgentDetail struct {
	ID                   string            `json:"id"`
	Category             string            `json:"category"`
	CategoryDescription  string            `json:"category_description,omitempty"`
	CategoryOwner        string            `json:"category_owner,omitempty"`
	Name                 string            `json:"name"`
	Description          string            `json:"description,omitempty"`
	Model                string            `json:"model,omitempty"`
	Effort               string            `json:"effort,omitempty"`
	FileGlobs            []string          `json:"file_globs,omitempty"`
	AppliesWhen          []string          `json:"applies_when,omitempty"`
	NeedsFullFileContent bool              `json:"needs_full_file_content"`
	Prompt               string            `json:"prompt"`
	Provenance           string            `json:"provenance"`
	Source               agents.SourceInfo `json:"source"`
}

AgentDetail describes one loaded agent.

type AgentSummary

type AgentSummary struct {
	ID          string            `json:"id"`
	Category    string            `json:"category"`
	Name        string            `json:"name"`
	Description string            `json:"description,omitempty"`
	Model       string            `json:"model,omitempty"`
	Effort      string            `json:"effort,omitempty"`
	Provenance  string            `json:"provenance"`
	Source      agents.SourceInfo `json:"source"`
}

AgentSummary is one row in `cr agents list`.

type AgentsList

type AgentsList struct {
	Agents    []AgentSummary      `json:"agents"`
	Sources   []agents.SourceInfo `json:"sources,omitempty"`
	Repo      *agents.RepoInfo    `json:"repo,omitempty"`
	TrustNote string              `json:"trust_note,omitempty"`
}

AgentsList is the presentation model for `cr agents list`.

func NewAgentsList

func NewAgentsList(catalog agents.Catalog) AgentsList

NewAgentsList builds the list presentation model.

type AgentsShow

type AgentsShow struct {
	Agent     AgentDetail         `json:"agent"`
	Sources   []agents.SourceInfo `json:"sources,omitempty"`
	Repo      *agents.RepoInfo    `json:"repo,omitempty"`
	TrustNote string              `json:"trust_note,omitempty"`
}

AgentsShow is the presentation model for `cr agents show`.

func NewAgentsShow

func NewAgentsShow(agent agents.Agent, catalog agents.Catalog) AgentsShow

NewAgentsShow builds the detail presentation model.

type CacheClear added in v0.1.32

type CacheClear struct {
	Path   string `json:"path,omitempty"`
	Status string `json:"status,omitempty"`
	Error  string `json:"error,omitempty"`
}

CacheClear describes cache cleanup performed by `config clear --all`.

type ClearedCredentialRef

type ClearedCredentialRef struct {
	Ref  string   `json:"ref"`
	Keys []string `json:"keys"`
}

ClearedCredentialRef describes the keys removed from one credential ref.

type ConfigClear

type ConfigClear struct {
	Backend              string                 `json:"backend"`
	BackendSource        string                 `json:"backend_source"`
	DryRun               bool                   `json:"dry_run"`
	Cleared              []ClearedCredentialRef `json:"cleared"`
	ConfigProfileRemoved string                 `json:"config_profile_removed,omitempty"`
	DefaultProfile       string                 `json:"default_profile,omitempty"`
	ConfigPathRemoved    string                 `json:"config_path_removed,omitempty"`
	Cache                *CacheClear            `json:"cache,omitempty"`
}

ConfigClear is the presentation model for `cr config clear`.

type ConfigShow

type ConfigShow struct {
	ActiveProfile  string              `json:"active_profile"`
	Profile        config.Profile      `json:"profile"`
	Data           config.DataConfig   `json:"data"`
	Backend        string              `json:"backend,omitempty"`
	BackendSource  string              `json:"backend_source,omitempty"`
	CredentialRef  string              `json:"credential_ref,omitempty"`
	CredentialRefs []CredentialStatus  `json:"credential_refs"`
	LLMCredential  LLMCredential       `json:"llm_credential"`
	AgentSources   []agents.SourceInfo `json:"agent_sources,omitempty"`
}

ConfigShow is the presentation model for `cr config show`.

func NewConfigShow

func NewConfigShow(profileName string, profile config.Profile, data config.DataConfig, refs []CredentialStatus) ConfigShow

NewConfigShow builds the config presentation model.

type CredentialStatus

type CredentialStatus struct {
	Purpose string      `json:"purpose"`
	Ref     string      `json:"ref"`
	Mode    string      `json:"mode"`
	Keys    []KeyStatus `json:"keys,omitempty"`
}

CredentialStatus reports key presence for one declared credential ref.

type CredentialWrite

type CredentialWrite struct {
	Ref           string `json:"ref"`
	Key           string `json:"key"`
	Backend       string `json:"backend,omitempty"`
	BackendSource string `json:"backend_source,omitempty"`
	Written       bool   `json:"written"`
	Error         string `json:"error,omitempty"`
}

CredentialWrite is the JSON envelope for `cr set-credential`.

type DataOrphanItem

type DataOrphanItem struct {
	Path  string `json:"path"`
	Bytes int64  `json:"bytes"`
}

DataOrphanItem describes one lifecycle orphan artifact directory.

type DataPrune

type DataPrune struct {
	DryRun         bool             `json:"dry_run"`
	SelectedRuns   []DataRunItem    `json:"selected_runs"`
	DeletedRuns    []DataRunItem    `json:"deleted_runs"`
	OrphansRemoved []DataOrphanItem `json:"orphans_removed"`
	Warnings       []string         `json:"warnings,omitempty"`
}

DataPrune is the presentation model for `cr data prune`.

func NewDataPrune

func NewDataPrune(result datalifecycle.PruneResult) DataPrune

NewDataPrune builds a prune presentation model.

type DataPurge

type DataPurge struct {
	DataRoot string `json:"data_root"`
	DryRun   bool   `json:"dry_run"`
	Removed  bool   `json:"removed"`
}

DataPurge is the presentation model for `cr data purge`.

func NewDataPurge

func NewDataPurge(result datalifecycle.PurgeResult) DataPurge

NewDataPurge builds a purge presentation model.

type DataRunItem

type DataRunItem struct {
	RunID        string    `json:"run_id"`
	PostMode     string    `json:"post_mode"`
	StartedAt    time.Time `json:"started_at"`
	ArtifactPath string    `json:"artifact_path"`
}

DataRunItem describes one lifecycle-selected run.

type DataShow

type DataShow struct {
	DataRoot      string         `json:"data_root"`
	LedgerPath    string         `json:"ledger_path"`
	RunsRoot      string         `json:"runs_root"`
	RunCount      int            `json:"run_count"`
	LiveRuns      int            `json:"live_runs"`
	DryRunRuns    int            `json:"dry_run_runs"`
	OutcomeCounts map[string]int `json:"outcome_counts"`
	OldestStarted *time.Time     `json:"oldest_started,omitempty"`
	NewestStarted *time.Time     `json:"newest_started,omitempty"`
	ArtifactBytes int64          `json:"artifact_bytes"`
	OrphanCount   int            `json:"orphan_count"`
	OrphanBytes   int64          `json:"orphan_bytes"`
}

DataShow is the presentation model for `cr data show`.

func NewDataShow

func NewDataShow(stats datalifecycle.Stats) DataShow

NewDataShow builds a data stats presentation model.

type KeyStatus

type KeyStatus struct {
	Key     string `json:"key"`
	Present *bool  `json:"present,omitempty"`
	Status  string `json:"status"`
	Error   string `json:"error,omitempty"`
}

KeyStatus reports one non-secret key name and whether a value exists.

type LLMCredential

type LLMCredential struct {
	Mode string `json:"mode"`
	Ref  string `json:"ref,omitempty"`
}

LLMCredential describes how cr accounts for LLM credentials.

type MeProfile

type MeProfile struct {
	Profile               string `json:"profile"`
	CredentialSource      string `json:"credential_source"`
	Host                  string `json:"host"`
	Login                 string `json:"login"`
	ID                    string `json:"id"`
	DisplayName           string `json:"display_name"`
	PreviousIdentityCache string `json:"previous_identity_cache"`
	IdentityCacheUpdated  bool   `json:"identity_cache_updated"`
}

MeProfile describes one live identity lookup.

type MeResult

type MeResult struct {
	Profiles []MeProfile `json:"profiles"`
}

MeResult is the presentation model for `cr me`.

func NewMeResult

func NewMeResult(results []identity.ProfileResult) MeResult

NewMeResult builds the me presentation model.

type ReviewAction

type ReviewAction struct {
	ID            string          `json:"id"`
	Kind          string          `json:"kind"`
	FindingID     string          `json:"finding_id,omitempty"`
	ThreadID      string          `json:"thread_id,omitempty"`
	Status        string          `json:"status"`
	Required      bool            `json:"required"`
	MarkerOmitted bool            `json:"marker_omitted"`
	Payload       json.RawMessage `json:"payload"`
}

ReviewAction is one planned action.

type ReviewArtifacts

type ReviewArtifacts struct {
	Dir            string `json:"dir"`
	DiffPatch      string `json:"diff_patch"`
	SlicesDir      string `json:"slices_dir"`
	FindingsJSON   string `json:"findings_json"`
	RollupMarkdown string `json:"rollup_markdown"`
	AgentLogsDir   string `json:"agent_logs_dir"`
}

ReviewArtifacts lists dry-run artifact paths.

type ReviewDryRun

type ReviewDryRun struct {
	Run             ReviewRun       `json:"run"`
	Quota           *ReviewQuota    `json:"quota,omitempty"`
	RollupMarkdown  string          `json:"rollup_markdown"`
	Findings        []ReviewFinding `json:"findings"`
	Actions         []ReviewAction  `json:"actions"`
	Artifacts       ReviewArtifacts `json:"artifacts"`
	FailOnTriggered bool            `json:"fail_on_triggered"`
}

ReviewDryRun is the presentation model for `cr review --dry-run`.

type ReviewFinding

type ReviewFinding struct {
	ID        string `json:"id"`
	Severity  string `json:"severity"`
	FilePath  string `json:"file_path"`
	Anchoring string `json:"anchoring"`
	Side      string `json:"side,omitempty"`
	Line      *int   `json:"line,omitempty"`
	Body      string `json:"body"`
}

ReviewFinding is one dry-run finding summary.

type ReviewLive

type ReviewLive struct {
	Run             ReviewRun       `json:"run"`
	Status          string          `json:"status"`
	Decision        string          `json:"decision,omitempty"`
	Message         string          `json:"message,omitempty"`
	Outbox          ReviewOutbox    `json:"outbox"`
	Artifacts       ReviewArtifacts `json:"artifacts"`
	FailOnTriggered bool            `json:"fail_on_triggered"`
}

ReviewLive is the presentation model for live `cr review`.

type ReviewOutbox

type ReviewOutbox struct {
	Outcome        string `json:"outcome,omitempty"`
	ExitCode       int    `json:"exit_code"`
	Posted         int    `json:"posted"`
	Pending        int    `json:"pending"`
	FailedTerminal int    `json:"failed_terminal"`
	Aborted        bool   `json:"aborted"`
}

ReviewOutbox summarizes live posting state.

type ReviewQuota

type ReviewQuota struct {
	BlockRemainingPct  float64 `json:"block_remaining_pct"`
	WeeklyRemainingPct float64 `json:"weekly_remaining_pct"`
	Low                bool    `json:"low"`
}

ReviewQuota describes adapter quota when the adapter supports it.

type ReviewRun

type ReviewRun struct {
	RunID        string `json:"run_id"`
	PRURL        string `json:"pr_url"`
	PRKey        string `json:"pr_key"`
	PostMode     string `json:"post_mode"`
	Outcome      string `json:"outcome"`
	ArtifactPath string `json:"artifact_path"`
}

ReviewRun describes the durable run envelope.

type SessionSummary

type SessionSummary struct {
	Name              string    `json:"name"`
	Profile           string    `json:"profile"`
	Provider          string    `json:"provider"`
	Adapter           string    `json:"adapter"`
	Model             string    `json:"model"`
	Host              string    `json:"host"`
	ProviderSessionID string    `json:"provider_session_id"`
	CreatedAt         time.Time `json:"created_at"`
	LastUsedAt        time.Time `json:"last_used_at"`
}

SessionSummary describes one named LLM session.

type SessionsDelete

type SessionsDelete struct {
	Name    string `json:"name"`
	Deleted bool   `json:"deleted"`
}

SessionsDelete is the presentation model for `cr sessions delete`.

func NewSessionsDelete

func NewSessionsDelete(name string) SessionsDelete

NewSessionsDelete builds a named-session deletion presentation model.

type SessionsList

type SessionsList struct {
	Sessions []SessionSummary `json:"sessions"`
}

SessionsList is the presentation model for `cr sessions list`.

func NewSessionsList

func NewSessionsList(sessions []ledger.NamedSession) SessionsList

NewSessionsList builds a named-session list presentation model.

type SessionsShow

type SessionsShow struct {
	Session SessionSummary `json:"session"`
}

SessionsShow is the presentation model for `cr sessions show`.

func NewSessionsShow

func NewSessionsShow(session ledger.NamedSession) SessionsShow

NewSessionsShow builds a named-session detail presentation model.

Jump to

Keyboard shortcuts

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