cli

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 52 Imported by: 0

Documentation

Overview

Package cli provides the Traceary command-line interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBrokenPipeError added in v0.20.1

func IsBrokenPipeError(err error) bool

IsBrokenPipeError reports whether err represents an output stream closed by the downstream reader. This is normal for scripted inspection commands piped into early-closing consumers such as head, jq filters, or byte limiters.

func Localize

func Localize(english string, japanese string) string

Localize returns the English or Japanese string for the active CLI locale.

func Localizef

func Localizef(english string, japanese string, args ...any) string

Localizef formats the English or Japanese string for the active CLI locale.

func ResolveDefaultDBPath added in v0.3.0

func ResolveDefaultDBPath() (string, error)

ResolveDefaultDBPath resolves the default database path from environment or conventions.

Types

type CockpitStateReader added in v0.17.0

type CockpitStateReader interface {
	MemoryLastSeenAt(ctx context.Context) (time.Time, bool, error)
}

CockpitStateReader provides optional local cockpit state. Missing or failing state must not block read-only cockpit views; callers should treat it as a notification enhancement rather than critical data.

func NewFileCockpitStateStore added in v0.17.0

func NewFileCockpitStateStore() CockpitStateReader

NewFileCockpitStateStore returns the local-first cockpit state store used by the default CLI wiring. Missing or unreadable state is treated as non-critical by cockpit callers; writes use an atomic replace under the user's state dir.

type MCPServerRunner

type MCPServerRunner interface {
	// Run starts an MCP server. The shared sqlite.Database has been
	// resolved to the user-specified path by the RunE caller before Run
	// is invoked, so no dbPath argument is needed here.
	Run(ctx context.Context) error
}

MCPServerRunner provides MCP server startup.

type RootCLI

type RootCLI struct {
	// contains filtered or unexported fields
}

RootCLI provides the Traceary root command.

func NewRootCLI

func NewRootCLI(opts ...RootCLIOption) *RootCLI

NewRootCLI creates a new RootCLI with the given options applied.

func (*RootCLI) Command

func (c *RootCLI) Command() *cobra.Command

Command returns the Traceary root command.

type RootCLIOption added in v0.4.0

type RootCLIOption func(*RootCLI)

RootCLIOption configures a RootCLI during construction. Options are applied in order, so later options override earlier ones.

func WithAntigravityUsage added in v0.32.0

func WithAntigravityUsage(usage usecase.AntigravityUsageCaptureUsecase) RootCLIOption

WithAntigravityUsage injects cumulative status and unavailable Stop capture.

func WithBundle added in v0.9.0

func WithBundle(b usecase.BundleUsecase) RootCLIOption

WithBundle injects the BundleUsecase used by `traceary bundle` export / import subcommands.

func WithClaudeHeadlessUsage added in v0.32.0

func WithClaudeHeadlessUsage(factory application.ClaudeHeadlessUsageStreamFactory) RootCLIOption

WithClaudeHeadlessUsage injects the body-free Claude one-shot stream adapter.

func WithClaudePluginDetector added in v0.8.2

func WithClaudePluginDetector(detector application.ClaudePluginDetector) RootCLIOption

WithClaudePluginDetector injects the ClaudePluginDetector used by doctor / hooks install to detect whether the Traceary Claude Code plugin is active in the user's global settings.

func WithClaudeUsage added in v0.32.0

func WithClaudeUsage(usage usecase.ClaudeUsageCaptureUsecase) RootCLIOption

WithClaudeUsage injects the body-free Claude usage capture adapter.

func WithCockpitStateReader added in v0.17.0

func WithCockpitStateReader(reader CockpitStateReader) RootCLIOption

WithCockpitStateReader injects optional local cockpit state used for non-critical notification checkpoints such as memory/event last-seen time.

func WithCodexCaptureDiagnostic added in v0.32.0

func WithCodexCaptureDiagnostic(diagnostic usecase.CodexCaptureDiagnosticUsecase) RootCLIOption

WithCodexCaptureDiagnostic injects the body-free Codex doctor projection.

func WithCodexHeadlessUsage added in v0.32.0

func WithCodexHeadlessUsage(factory application.CodexHeadlessUsageStreamFactory) RootCLIOption

WithCodexHeadlessUsage injects the body-free `codex exec --json` stream adapter.

func WithCodexUsage added in v0.32.0

func WithCodexUsage(usage usecase.CodexUsageCaptureUsecase) RootCLIOption

WithCodexUsage injects the body-free Codex usage capture adapter.

func WithContext added in v0.5.0

func WithContext(contextUsecase usecase.ContextUsecase) RootCLIOption

WithContext injects the ContextUsecase used by structured handoff commands.

func WithDatabasePathSetter added in v0.4.0

func WithDatabasePathSetter(setter func(string)) RootCLIOption

WithDatabasePathSetter injects a callback invoked by every subcommand after it resolves the --db-path flag / TRACEARY_DB_PATH environment variable. The callback is typically a closure around the shared sqlite.Database's SetPath method, so datasources built from it open the user-specified path on the next operation.

func WithDefaultAuditPayloadLimits added in v0.21.0

func WithDefaultAuditPayloadLimits(maxInputBytes int, maxOutputBytes int) RootCLIOption

WithDefaultAuditPayloadLimits injects config-backed command-audit persistence limits. Command flags and TRACEARY_MAX_AUDIT_* environment variables still override these defaults at runtime.

func WithDefaultReadColor added in v0.7.0

func WithDefaultReadColor(value string) RootCLIOption

WithDefaultReadColor injects the default --color mode (auto / always / never) applied to read commands when the operator does not pass --color. Callers source this from read.color in the user config; empty string falls back to the built-in auto behavior.

func WithDefaultReadFields added in v0.7.0

func WithDefaultReadFields(columns []string) RootCLIOption

WithDefaultReadFields injects the default column order used by tail / list / search text output when the user does not pass --fields. Callers typically source this from the read.fields entry in the user config. Nil or empty lists fall back to the built-in default column order.

func WithEvent added in v0.4.0

func WithEvent(event usecase.EventUsecase) RootCLIOption

WithEvent injects the EventUsecase used by event-producing commands.

func WithEventMetadata added in v0.31.0

func WithEventMetadata(eventMetadata usecase.EventMetadataUsecase) RootCLIOption

WithEventMetadata injects body-free event reads used by metadata projections.

func WithExtraRedactPatterns added in v0.4.0

func WithExtraRedactPatterns(patterns []string) RootCLIOption

WithExtraRedactPatterns injects additional redaction regex patterns used by the audit command.

func WithFileRetention added in v0.31.0

func WithFileRetention(retention usecase.FileRetentionUsecase) RootCLIOption

WithFileRetention injects reviewed archive/backup capacity management.

func WithFileRetentionCapacityInspector added in v0.31.0

func WithFileRetentionCapacityInspector(inspector usecase.FileRetentionCapacityInspector) RootCLIOption

WithFileRetentionCapacityInspector injects only the read-only doctor/status capability.

func WithGeminiHeadlessUsage added in v0.32.0

func WithGeminiHeadlessUsage(factory application.GeminiHeadlessUsageStreamFactory) RootCLIOption

WithGeminiHeadlessUsage injects the body-free Gemini stream adapter.

func WithGeminiUsage added in v0.32.0

func WithGeminiUsage(usage usecase.GeminiUsageCaptureUsecase) RootCLIOption

WithGeminiUsage injects the body-free Gemini usage capture adapter.

func WithGrokHeadlessUsage added in v0.32.0

func WithGrokHeadlessUsage(factory application.GrokHeadlessUsageStreamFactory) RootCLIOption

WithGrokHeadlessUsage injects the body-free Grok streaming-json adapter.

func WithGrokUsage added in v0.32.0

func WithGrokUsage(usage usecase.GrokUsageCaptureUsecase) RootCLIOption

WithGrokUsage injects headless usage and unavailable Stop capture.

func WithHookGrokTranscriptLauncher added in v0.23.0

func WithHookGrokTranscriptLauncher(launcher func(string) error) RootCLIOption

WithHookGrokTranscriptLauncher overrides the detached Grok transcript worker launcher. Production callers use the default detached process; tests can capture the durable job path and run the worker deterministically.

func WithHookMemoryAfterFinalCheck added in v0.23.0

func WithHookMemoryAfterFinalCheck(hook func()) RootCLIOption

WithHookMemoryAfterFinalCheck installs a deterministic synchronization point after the worker's final marker check but before unlock.

func WithHookMemoryBeforeJobRemoval added in v0.23.0

func WithHookMemoryBeforeJobRemoval(hook func()) RootCLIOption

WithHookMemoryBeforeJobRemoval installs a deterministic synchronization point for queue race tests. Production callers must leave it unset.

func WithHookMemoryExtractLauncher added in v0.23.0

func WithHookMemoryExtractLauncher(launcher func(string) error) RootCLIOption

WithHookMemoryExtractLauncher overrides the detached worker launcher used by hook-driven memory extraction. It is primarily intended for deterministic tests; production callers use the default process launcher.

func WithHooksInspector added in v0.4.0

func WithHooksInspector(inspector application.HooksInspector) RootCLIOption

WithHooksInspector injects the HooksInspector used by the doctor command to inspect client hook configurations.

func WithHooksOrchestrator added in v0.4.0

func WithHooksOrchestrator(orchestrator application.HooksOrchestrator) RootCLIOption

WithHooksOrchestrator injects the HooksOrchestrator used by hooks and doctor commands. The orchestrator is required before the corresponding commands can run.

func WithKimiUsage added in v0.32.0

func WithKimiUsage(usage usecase.KimiUsageCaptureUsecase) RootCLIOption

WithKimiUsage injects partial wire usage and unavailable lifecycle capture.

func WithMCPServerRunner added in v0.4.0

func WithMCPServerRunner(runner MCPServerRunner) RootCLIOption

WithMCPServerRunner injects the MCPServerRunner used by the mcp-server command.

func WithMemory added in v0.5.0

func WithMemory(memory usecase.MemoryUsecase) RootCLIOption

WithMemory injects the MemoryUsecase used by durable-memory commands.

func WithMemoryEdge added in v0.9.0

func WithMemoryEdge(edge usecase.MemoryEdgeUsecase) RootCLIOption

WithMemoryEdge injects the MemoryEdgeUsecase used by `traceary memory graph` subcommands.

func WithOneShotRepair added in v0.31.0

func WithOneShotRepair(repair usecase.OneShotRepairUsecase) RootCLIOption

WithOneShotRepair injects the evidence-backed historical repair use case.

func WithPluginCacheInspector added in v0.8.2

func WithPluginCacheInspector(inspector application.PluginCacheInspector) RootCLIOption

WithPluginCacheInspector injects the PluginCacheInspector used by the doctor command to detect cached-vs-marketplace drift on hosts that have a per-plugin version cache (Claude Code).

func WithRawBodyRetention added in v0.31.0

func WithRawBodyRetention(retention usecase.RawBodyRetentionUsecase) RootCLIOption

WithRawBodyRetention injects the opt-in reviewed raw-body retention workflow.

func WithReadPresets added in v0.7.0

func WithReadPresets(presets map[string]presentation.ReadPreset) RootCLIOption

WithReadPresets injects the user-defined read presets loaded from ~/.config/traceary/config.json. The builtin preset catalog is always available; these entries merge on top and override built-in names on collision (with a stderr warning from the resolver).

func WithReplay added in v0.8.0

func WithReplay(replay usecase.ReplayUsecase) RootCLIOption

WithReplay injects the ReplayUsecase used by the replay HTML export command. WithReplay is required: the CLI returns a configuration error at runtime if `traceary replay` is invoked without it.

func WithReport added in v0.31.0

func WithReport(report usecase.ReportUsecase) RootCLIOption

WithReport injects the shared CLI/MCP report generator.

func WithReportCommand added in v0.31.0

func WithReportCommand(reportCommand usecase.ReportCommandUsecase) RootCLIOption

WithReportCommand injects structured command-audit aggregation for report.

func WithSession added in v0.4.0

func WithSession(session usecase.SessionUsecase) RootCLIOption

WithSession injects the SessionUsecase used by session-related commands.

func WithStoreManagement added in v0.4.0

func WithStoreManagement(storeManagement usecase.StoreManagementUsecase) RootCLIOption

WithStoreManagement injects the StoreManagementUsecase used by init, backup, gc, and doctor commands.

func WithStructuredRedactRules added in v0.10.0

func WithStructuredRedactRules(rules []redaction.RuleConfig) RootCLIOption

WithStructuredRedactRules injects named/configurable redaction rules.

func WithWorkspaceIdentity added in v0.31.0

func WithWorkspaceIdentity(workspaceIdentity usecase.WorkspaceIdentityUsecase) RootCLIOption

WithWorkspaceIdentity injects body-free identity reporting and reviewed aliases.

Source Files

Directories

Path Synopsis
Package tui hosts the shared Bubble Tea / Bubbles / Lip Gloss foundation used by Traceary's interactive CLI surfaces.
Package tui hosts the shared Bubble Tea / Bubbles / Lip Gloss foundation used by Traceary's interactive CLI surfaces.

Jump to

Keyboard shortcuts

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