status

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateTokens

func EstimateTokens(bytes int64) int

EstimateTokens estimates token count from byte count (~4 bytes per token for English/code).

func ExtractGitHost

func ExtractGitHost(cloneURL string) string

ExtractGitHost extracts the hostname from a git clone URL. Handles both HTTPS (https://git.example.com/...) and SSH (git@git.example.com:...) URLs. Returns empty string if parsing fails.

func FormatDurationShort

func FormatDurationShort(d time.Duration) string

FormatDurationShort formats a duration in a short human-readable form.

func FormatEndpointDisplay

func FormatEndpointDisplay(endpointURL string) string

FormatEndpointDisplay returns a shorter display name for an endpoint URL. e.g., "https://api.test.sageox.ai" -> "api.test.sageox.ai"

func FormatGitRepoStatus

func FormatGitRepoStatus(s GitRepoStatus) (string, string)

FormatGitRepoStatus formats the git repo status for display. Returns a human-readable status string and a semantic type for styling.

func FormatTimeAgo

func FormatTimeAgo(t time.Time) string

FormatTimeAgo formats a time as a human-readable relative time.

func FormatTokenCount

func FormatTokenCount(tokens int) string

FormatTokenCount formats a token count in human-readable form (e.g., "3.1K", "1.2M").

func InferSemantic

func InferSemantic(label, value string) string

InferSemantic auto-detects value semantic type from context. Returns one of: "success", "error", "highlight", "muted", "default".

Types

type AICoworkerJSON

type AICoworkerJSON struct {
	AgentID       string `json:"agent_id"`
	ContextTokens int64  `json:"context_tokens"`
	CommandCount  int    `json:"command_count"`
	Status        string `json:"status"`
	Age           string `json:"age"`
}

AICoworkerJSON represents an AI coworker in JSON output.

type AgentWorkerJSON

type AgentWorkerJSON struct {
	Agent         string `json:"agent"`  // resolved agent: "claude", "codex", or "none"
	Source        string `json:"source"` // "auto", "configured", or "disabled"
	Authenticated bool   `json:"authenticated"`
	AuthDetail    string `json:"auth_detail,omitempty"`
}

AgentWorkerJSON represents the agent worker status in JSON output.

type AuthJSON

type AuthJSON struct {
	Authenticated bool       `json:"authenticated"`
	Endpoint      string     `json:"endpoint"`
	User          string     `json:"user,omitempty"`
	Email         string     `json:"email,omitempty"`
	ExpiresAt     *time.Time `json:"expires_at,omitempty"`
	GitPATValid   *bool      `json:"git_pat_valid,omitempty"`
	GitPATReason  string     `json:"git_pat_reason,omitempty"`
	Error         string     `json:"error,omitempty"`
}

AuthJSON represents authentication info in JSON output.

type CodeIndexJSON

type CodeIndexJSON struct {
	Indexed     bool       `json:"indexed"`
	LastIndexed *time.Time `json:"last_indexed,omitempty"`
	IndexingNow bool       `json:"indexing_now"`
	Commits     int        `json:"commits,omitempty"`
	Blobs       int        `json:"blobs,omitempty"`
	Symbols     int        `json:"symbols,omitempty"`
	Error       string     `json:"error,omitempty"`
}

CodeIndexJSON represents code index info in JSON output.

type ConfigJSON

type ConfigJSON struct {
	UserConfigDir  string `json:"user_config_dir"`
	AuthFile       string `json:"auth_file"`
	AuthFileExists bool   `json:"auth_file_exists"`
}

ConfigJSON represents configuration info in JSON output.

type DaemonJSON

type DaemonJSON struct {
	Running       bool             `json:"running"`
	Pid           int              `json:"pid,omitempty"`
	UptimeSeconds int64            `json:"uptime_seconds,omitempty"`
	TotalSyncs    int              `json:"total_syncs,omitempty"`
	SyncsLastHour int              `json:"syncs_last_hour,omitempty"`
	LastError     string           `json:"last_error,omitempty"`
	AgentWorker   *AgentWorkerJSON `json:"agent_worker,omitempty"`
}

DaemonJSON represents daemon info in JSON output.

type GitRepoStatus

type GitRepoStatus struct {
	Path             string
	Exists           bool
	Branch           string
	UncommittedCount int
	IsSynced         bool
	HasLastSync      bool
	LastSync         time.Time
	BehindCount      int
	Error            string
}

GitRepoStatus holds information about a git repository's status.

type JSONOutput

type JSONOutput struct {
	Auth         *AuthJSON         `json:"auth"`
	Config       *ConfigJSON       `json:"config"`
	Project      *ProjectJSON      `json:"project"`
	Ledger       *LedgerJSON       `json:"ledger"`
	TeamContexts []TeamContextJSON `json:"team_contexts,omitempty"`
	AICoworkers  []AICoworkerJSON  `json:"ai_coworkers,omitempty"`
	Daemon       *DaemonJSON       `json:"daemon,omitempty"`
	Version      *VersionJSON      `json:"version,omitempty"`
}

JSONOutput is the JSON output structure for ox status --json.

type LedgerJSON

type LedgerJSON struct {
	Configured  bool   `json:"configured"`
	Path        string `json:"path,omitempty"`
	Exists      bool   `json:"exists"`
	Branch      string `json:"branch,omitempty"`
	Status      string `json:"status,omitempty"`
	Error       string `json:"error,omitempty"`
	Visibility  string `json:"visibility,omitempty"`
	AccessLevel string `json:"access_level,omitempty"`
}

LedgerJSON represents ledger info in JSON output.

type ProjectJSON

type ProjectJSON struct {
	Initialized bool           `json:"initialized"`
	Directory   string         `json:"directory"`
	ConfigPath  string         `json:"config_path,omitempty"`
	CodeIndex   *CodeIndexJSON `json:"code_index,omitempty"`
}

ProjectJSON represents project info in JSON output.

type TeamContextJSON

type TeamContextJSON struct {
	TeamID   string     `json:"team_id"`
	TeamName string     `json:"team_name,omitempty"`
	Path     string     `json:"path"`
	Exists   bool       `json:"exists"`
	Branch   string     `json:"branch,omitempty"`
	Status   string     `json:"status,omitempty"`
	Error    string     `json:"error,omitempty"`
	LastSync *time.Time `json:"last_sync,omitempty"`
	Stale    bool       `json:"stale,omitempty"`
}

TeamContextJSON represents team context info in JSON output.

type VersionJSON

type VersionJSON struct {
	Current         string `json:"current"`
	Latest          string `json:"latest,omitempty"`
	UpdateAvailable bool   `json:"update_available"`
}

VersionJSON represents version info in JSON output.

Jump to

Keyboard shortcuts

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