Documentation
¶
Overview ¶
Package cli provides the Traceary command-line interface.
Index ¶
- func IsBrokenPipeError(err error) bool
- func Localize(english string, japanese string) string
- func Localizef(english string, japanese string, args ...any) string
- func ResolveDefaultDBPath() (string, error)
- type CockpitStateReader
- type MCPServerRunner
- type RootCLI
- type RootCLIOption
- func WithAntigravityUsage(usage usecase.AntigravityUsageCaptureUsecase) RootCLIOption
- func WithBundle(b usecase.BundleUsecase) RootCLIOption
- func WithClaudeHeadlessUsage(factory application.ClaudeHeadlessUsageStreamFactory) RootCLIOption
- func WithClaudePluginDetector(detector application.ClaudePluginDetector) RootCLIOption
- func WithClaudeUsage(usage usecase.ClaudeUsageCaptureUsecase) RootCLIOption
- func WithCockpitStateReader(reader CockpitStateReader) RootCLIOption
- func WithCodexCaptureDiagnostic(diagnostic usecase.CodexCaptureDiagnosticUsecase) RootCLIOption
- func WithCodexHeadlessUsage(factory application.CodexHeadlessUsageStreamFactory) RootCLIOption
- func WithCodexUsage(usage usecase.CodexUsageCaptureUsecase) RootCLIOption
- func WithContext(contextUsecase usecase.ContextUsecase) RootCLIOption
- func WithDatabasePathSetter(setter func(string)) RootCLIOption
- func WithDefaultAuditPayloadLimits(maxInputBytes int, maxOutputBytes int) RootCLIOption
- func WithDefaultReadColor(value string) RootCLIOption
- func WithDefaultReadFields(columns []string) RootCLIOption
- func WithEvent(event usecase.EventUsecase) RootCLIOption
- func WithEventMetadata(eventMetadata usecase.EventMetadataUsecase) RootCLIOption
- func WithExtraRedactPatterns(patterns []string) RootCLIOption
- func WithFileRetention(retention usecase.FileRetentionUsecase) RootCLIOption
- func WithFileRetentionCapacityInspector(inspector usecase.FileRetentionCapacityInspector) RootCLIOption
- func WithGeminiHeadlessUsage(factory application.GeminiHeadlessUsageStreamFactory) RootCLIOption
- func WithGeminiUsage(usage usecase.GeminiUsageCaptureUsecase) RootCLIOption
- func WithGrokHeadlessUsage(factory application.GrokHeadlessUsageStreamFactory) RootCLIOption
- func WithGrokUsage(usage usecase.GrokUsageCaptureUsecase) RootCLIOption
- func WithHookGrokTranscriptLauncher(launcher func(string) error) RootCLIOption
- func WithHookMemoryAfterFinalCheck(hook func()) RootCLIOption
- func WithHookMemoryBeforeJobRemoval(hook func()) RootCLIOption
- func WithHookMemoryExtractLauncher(launcher func(string) error) RootCLIOption
- func WithHooksInspector(inspector application.HooksInspector) RootCLIOption
- func WithHooksOrchestrator(orchestrator application.HooksOrchestrator) RootCLIOption
- func WithKimiUsage(usage usecase.KimiUsageCaptureUsecase) RootCLIOption
- func WithMCPServerRunner(runner MCPServerRunner) RootCLIOption
- func WithMemory(memory usecase.MemoryUsecase) RootCLIOption
- func WithMemoryEdge(edge usecase.MemoryEdgeUsecase) RootCLIOption
- func WithOneShotRepair(repair usecase.OneShotRepairUsecase) RootCLIOption
- func WithPluginCacheInspector(inspector application.PluginCacheInspector) RootCLIOption
- func WithRawBodyRetention(retention usecase.RawBodyRetentionUsecase) RootCLIOption
- func WithReadPresets(presets map[string]presentation.ReadPreset) RootCLIOption
- func WithReplay(replay usecase.ReplayUsecase) RootCLIOption
- func WithReport(report usecase.ReportUsecase) RootCLIOption
- func WithReportCommand(reportCommand usecase.ReportCommandUsecase) RootCLIOption
- func WithSession(session usecase.SessionUsecase) RootCLIOption
- func WithStoreManagement(storeManagement usecase.StoreManagementUsecase) RootCLIOption
- func WithStructuredRedactRules(rules []redaction.RuleConfig) RootCLIOption
- func WithWorkspaceIdentity(workspaceIdentity usecase.WorkspaceIdentityUsecase) RootCLIOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBrokenPipeError ¶ added in v0.20.1
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 ResolveDefaultDBPath ¶ added in v0.3.0
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.
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
¶
- args.go
- audit.go
- backup.go
- broken_pipe.go
- bundle.go
- claude_plugin_detection.go
- cobra_required_flag.go
- cockpit.go
- cockpit_localization.go
- cockpit_settings.go
- cockpit_state_file.go
- cockpit_state_file_replace_unix.go
- compact_summary.go
- completion.go
- context.go
- context_command.go
- date_parse.go
- doctor.go
- doctor_antigravity.go
- doctor_antigravity_capture_levels.go
- doctor_antigravity_cli_plugin.go
- doctor_antigravity_event_coverage.go
- doctor_antigravity_permissions.go
- doctor_antigravity_routes.go
- doctor_archive_retention.go
- doctor_audit_reliability.go
- doctor_codex_capture.go
- doctor_codex_hook_trust.go
- doctor_codex_plugin.go
- doctor_config_inspect.go
- doctor_content_reliability.go
- doctor_event_coverage.go
- doctor_file_retention.go
- doctor_grok.go
- doctor_kimi.go
- doctor_managed_generation.go
- doctor_mcp.go
- doctor_memory_activation.go
- doctor_memory_inbox.go
- doctor_path.go
- doctor_plugin_version.go
- doctor_report.go
- doctor_retry_loops.go
- doctor_sensitive_access.go
- doctor_store_size.go
- doctor_version.go
- event_json.go
- event_output.go
- event_text_formatter.go
- gc.go
- handoff.go
- hook_antigravity.go
- hook_archive_auto.go
- hook_audit_suppression.go
- hook_detached_process_unix.go
- hook_diagnostics.go
- hook_grok.go
- hook_grok_transcript_queue.go
- hook_kimi.go
- hook_kimi_transcript.go
- hook_memory_decay.go
- hook_memory_extract_queue.go
- hook_resolve.go
- hook_runtime.go
- hook_session.go
- hook_session_gc.go
- hook_spool.go
- hook_spool_file_nofollow.go
- hook_state.go
- hook_subagent.go
- hook_transcript.go
- hooks.go
- hooks_guide.go
- hooks_helper.go
- i18n.go
- init.go
- input.go
- list.go
- log.go
- mcp_server.go
- memory.go
- memory_activate.go
- memory_bridge.go
- memory_decay.go
- memory_extract.go
- memory_graph.go
- memory_hygiene.go
- memory_import.go
- memory_inbox.go
- memory_inbox_review.go
- memory_inbox_review_tui.go
- memory_inbox_review_view.go
- memory_namespace.go
- memory_output.go
- memory_review_localization.go
- output.go
- package.go
- read_color.go
- read_fields.go
- read_presets.go
- replay.go
- report.go
- report_workspace_identity.go
- root.go
- search.go
- session.go
- session_gc.go
- session_label.go
- session_list.go
- session_repair_one_shot.go
- session_resolution.go
- session_run.go
- session_run_process_unix.go
- session_tree.go
- show.go
- store.go
- store_archive.go
- store_dedupe.go
- store_file_retention.go
- store_retention.go
- store_workspace_alias.go
- tail.go
- timeline.go
- tool_aware_summary.go
- top.go
- top_dashboard.go
- top_data.go
- top_json.go