{"modulePath":"github.com/diffsec/agentmon","version":"v0.0.0-20261111001054-230ac962f687","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package cli\n\n## Functions\n\n```go\nfunc FormatDuration(d time.Duration) string\n```\nFormatDuration formats a duration nicely.\n\n```go\nfunc ParseKeyValue(s string) (string, string, error)\n```\nParseKeyValue parses a key=value string.\n\n```go\nfunc TruncatePath(path string, maxLen int) string\n```\nTruncatePath truncates a path for display.\n\n## Types\n\n```go\ntype Client interface {\n\t// Session operations\n\tListSessions(ctx context.Context, opts ListSessionsOpts) ([]SessionInfo, error)\n\tGetSession(ctx context.Context, id string) (*SessionDetail, error)\n\tGetSessionLogs(ctx context.Context, id string, follow bool) (io.ReadCloser, error)\n\tGetSessionEvents(ctx context.Context, id string, opts EventsOpts) ([]Event, error)\n\tTerminateSession(ctx context.Context, id string, force bool, reason string) error\n\n\t// Policy operations\n\tValidatePolicy(ctx context.Context, path string) (*ValidationResult, error)\n\tTestPolicy(ctx context.Context, policyDir, testDir string) (*TestResults, error)\n\tDiffPolicies(ctx context.Context, oldPath, newPath string) (*PolicyDiff, error)\n\tLintPolicy(ctx context.Context, path string) ([]LintIssue, error)\n\n\t// Debug operations\n\tTraceSession(ctx context.Context, id string, duration time.Duration) (io.ReadCloser, error)\n\tSimulateRecording(ctx context.Context, recordingPath, policyDir string) (*SimulationResult, error)\n\n\t// Status operations\n\tGetStatus(ctx context.Context) (*Status, error)\n\tGetMetrics(ctx context.Context) (*Metrics, error)\n\n\t// Config operations\n\tValidateConfig(ctx context.Context) error\n\tGetConfig(ctx context.Context, effective bool) (map[string]any, error)\n\tSetConfig(ctx context.Context, key, value string) error\n}\n```\nClient interface for interacting with agentmon server.\n\n```go\ntype Commander struct {\n\t// contains filtered or unexported fields\n}\n```\nCommander executes CLI commands.\n\n```go\nfunc NewCommander(client Client, output io.Writer) *Commander\n```\nNewCommander creates a new commander.\n\n```go\nfunc (c *Commander) ConfigSet(ctx context.Context, key, value string) error\n```\nConfigSet sets a configuration value.\n\n```go\nfunc (c *Commander) ConfigShow(ctx context.Context, effective bool) error\n```\nConfigShow shows the configuration.\n\n```go\nfunc (c *Commander) ConfigValidate(ctx context.Context) error\n```\nConfigValidate validates the configuration.\n\n```go\nfunc (c *Commander) DebugSimulate(ctx context.Context, recordingPath, policyDir string) error\n```\nDebugSimulate simulates a recording against a policy.\n\n```go\nfunc (c *Commander) MetricsShow(ctx context.Context) error\n```\nMetricsShow shows metrics.\n\n```go\nfunc (c *Commander) PolicyDiff(ctx context.Context, oldPath, newPath string) error\n```\nPolicyDiff shows policy differences.\n\n```go\nfunc (c *Commander) PolicyLint(ctx context.Context, path string) error\n```\nPolicyLint lints a policy file.\n\n```go\nfunc (c *Commander) PolicyTest(ctx context.Context, policyDir, testDir string) error\n```\nPolicyTest runs policy tests.\n\n```go\nfunc (c *Commander) PolicyValidate(ctx context.Context, path string) error\n```\nPolicyValidate validates a policy file.\n\n```go\nfunc (c *Commander) SessionEvents(ctx context.Context, id string, opts EventsOpts) error\n```\nSessionEvents shows session events.\n\n```go\nfunc (c *Commander) SessionGet(ctx context.Context, id string) error\n```\nSessionGet gets session details.\n\n```go\nfunc (c *Commander) SessionList(ctx context.Context, opts ListSessionsOpts) error\n```\nSessionList lists sessions.\n\n```go\nfunc (c *Commander) SessionTerminate(ctx context.Context, id string, force bool, reason string) error\n```\nSessionTerminate terminates a session.\n\n```go\nfunc (c *Commander) SetJSONOutput(enabled bool)\n```\nSetJSONOutput enables JSON output mode.\n\n```go\nfunc (c *Commander) StatusShow(ctx context.Context) error\n```\nStatusShow shows agentmon status.\n\n```go\ntype Debugger struct {\n\t// contains filtered or unexported fields\n}\n```\nDebugger provides an interactive debugging session.\n\n```go\nfunc NewDebugger(config DebuggerConfig) *Debugger\n```\nNewDebugger creates a new interactive debugger.\n\n```go\nfunc (d *Debugger) IsRunning() bool\n```\nIsRunning returns whether the debugger is running.\n\n```go\nfunc (d *Debugger) Run(ctx context.Context) error\n```\nRun starts the interactive debugger.\n\n```go\ntype DebuggerConfig struct {\n\tClient    Client\n\tSessionID string\n\tOutput    io.Writer\n\tInput     io.Reader\n}\n```\nDebuggerConfig configures the debugger.\n\n```go\ntype DiagnosticCollector struct {\n\t// contains filtered or unexported fields\n}\n```\nDiagnosticCollector collects diagnostic information.\n\n```go\nfunc NewDiagnosticCollector(config DiagnosticConfig) *DiagnosticCollector\n```\nNewDiagnosticCollector creates a new diagnostic collector.\n\n```go\nfunc (d *DiagnosticCollector) Collect(ctx context.Context) (*DiagnosticReport, error)\n```\nCollect gathers diagnostic information.\n\n```go\nfunc (d *DiagnosticCollector) GenerateReport(ctx context.Context, outputPath string) error\n```\nGenerateReport collects diagnostics and writes to a file.\n\n```go\nfunc (d *DiagnosticCollector) WriteReport(report *DiagnosticReport, outputPath string) error\n```\nWriteReport writes the report to a file.\n\n```go\ntype DiagnosticConfig struct {\n\tClient        Client\n\tOutput        io.Writer\n\tRedactSecrets bool\n}\n```\nDiagnosticConfig configures the collector.\n\n```go\ntype DiagnosticReport struct {\n\tGeneratedAt  time.Time      `json:\"generated_at\"`\n\tVersion      string         `json:\"version\"`\n\tSystemInfo   SystemInfo     `json:\"system_info\"`\n\tStatus       *Status        `json:\"status,omitempty\"`\n\tMetrics      *Metrics       `json:\"metrics,omitempty\"`\n\tConfig       map[string]any `json:\"config,omitempty\"`\n\tSessions     []SessionInfo  `json:\"sessions,omitempty\"`\n\tRecentEvents []Event        `json:\"recent_events,omitempty\"`\n\tErrors       []string       `json:\"errors,omitempty\"`\n}\n```\nDiagnosticReport contains all diagnostic information.\n\n```go\ntype Difference struct {\n\tEventIndex  int    `json:\"event_index\"`\n\tType        string `json:\"type\"`\n\tOldDecision string `json:\"old_decision\"`\n\tNewDecision string `json:\"new_decision\"`\n}\n```\nDifference describes a decision difference.\n\n```go\ntype Event struct {\n\tTimestamp time.Time `json:\"timestamp\"`\n\tType      string    `json:\"type\"`\n\tPath      string    `json:\"path,omitempty\"`\n\tDecision  string    `json:\"decision\"`\n\tLatency   string    `json:\"latency,omitempty\"`\n}\n```\nEvent is an operation event.\n\n```go\ntype EventsOpts struct {\n\tType  string\n\tSince time.Time\n\tLimit int\n}\n```\nEventsOpts are options for getting events.\n\n```go\ntype LintIssue struct {\n\tLevel   string `json:\"level\"` // error, warning, info\n\tPath    string `json:\"path\"`\n\tLine    int    `json:\"line,omitempty\"`\n\tMessage string `json:\"message\"`\n}\n```\nLintIssue is a policy lint issue.\n\n```go\ntype ListSessionsOpts struct {\n\tTenant string\n\tState  string\n\tLimit  int\n}\n```\nListSessionsOpts are options for listing sessions.\n\n```go\ntype Metrics struct {\n\tSessionsTotal    int64            `json:\"sessions_total\"`\n\tSessionsActive   int64            `json:\"sessions_active\"`\n\tOperationsTotal  int64            `json:\"operations_total\"`\n\tOperationsByType map[string]int64 `json:\"operations_by_type\"`\n\tDecisionsByType  map[string]int64 `json:\"decisions_by_type\"`\n\tAvgLatencyMs     float64          `json:\"avg_latency_ms\"`\n\tPolicyReloads    int64            `json:\"policy_reloads\"`\n\tErrorsTotal      int64            `json:\"errors_total\"`\n}\n```\nMetrics contains operational metrics.\n\n```go\ntype PolicyDiff struct {\n\tAdded    []string `json:\"added,omitempty\"`\n\tRemoved  []string `json:\"removed,omitempty\"`\n\tModified []string `json:\"modified,omitempty\"`\n}\n```\nPolicyDiff describes differences between policies.\n\n```go\ntype ResourceUsage struct {\n\tCPUPercent   float64 `json:\"cpu_percent\"`\n\tMemoryMB     int64   `json:\"memory_mb\"`\n\tDiskReadMB   int64   `json:\"disk_read_mb\"`\n\tDiskWriteMB  int64   `json:\"disk_write_mb\"`\n\tNetworkRxMB  int64   `json:\"network_rx_mb\"`\n\tNetworkTxMB  int64   `json:\"network_tx_mb\"`\n\tProcessCount int     `json:\"process_count\"`\n}\n```\nResourceUsage tracks resource consumption.\n\n```go\ntype SessionDetail struct {\n\tSessionInfo\n\tWorkspace     string            `json:\"workspace,omitempty\"`\n\tPolicyRef     string            `json:\"policy_ref,omitempty\"`\n\tEventCount    int64             `json:\"event_count\"`\n\tLastActivity  time.Time         `json:\"last_activity,omitempty\"`\n\tResourceUsage *ResourceUsage    `json:\"resource_usage,omitempty\"`\n\tMetadata      map[string]string `json:\"metadata,omitempty\"`\n}\n```\nSessionDetail is detailed information about a session.\n\n```go\ntype SessionInfo struct {\n\tID        string    `json:\"id\"`\n\tAgentID   string    `json:\"agent_id,omitempty\"`\n\tTenantID  string    `json:\"tenant_id,omitempty\"`\n\tState     string    `json:\"state\"`\n\tStartTime time.Time `json:\"start_time\"`\n\tDuration  string    `json:\"duration,omitempty\"`\n}\n```\nSessionInfo is summary information about a session.\n\n```go\ntype SimulationResult struct {\n\tTotalEvents int          `json:\"total_events\"`\n\tMatched     int          `json:\"matched\"`\n\tDifferences []Difference `json:\"differences,omitempty\"`\n}\n```\nSimulationResult is the result of simulating a recording.\n\n```go\ntype Status struct {\n\tVersion        string    `json:\"version\"`\n\tUptime         string    `json:\"uptime\"`\n\tStartTime      time.Time `json:\"start_time\"`\n\tActiveSessions int       `json:\"active_sessions\"`\n\tPlatform       string    `json:\"platform\"`\n\tPolicyLoaded   bool      `json:\"policy_loaded\"`\n\tHealthy        bool      `json:\"healthy\"`\n}\n```\nStatus is the agentmon status.\n\n```go\ntype SystemInfo struct {\n\tOS         string `json:\"os\"`\n\tArch       string `json:\"arch\"`\n\tNumCPU     int    `json:\"num_cpu\"`\n\tGoVersion  string `json:\"go_version\"`\n\tHostname   string `json:\"hostname,omitempty\"`\n\tWorkingDir string `json:\"working_dir,omitempty\"`\n}\n```\nSystemInfo contains system information.\n\n```go\ntype TestFailure struct {\n\tName     string `json:\"name\"`\n\tExpected string `json:\"expected\"`\n\tGot      string `json:\"got\"`\n\tError    string `json:\"error,omitempty\"`\n}\n```\nTestFailure describes a failed test.\n\n```go\ntype TestResults struct {\n\tPassed  int           `json:\"passed\"`\n\tFailed  int           `json:\"failed\"`\n\tSkipped int           `json:\"skipped\"`\n\tTotal   int           `json:\"total\"`\n\tErrors  []TestFailure `json:\"errors,omitempty\"`\n}\n```\nTestResults contains policy test results.\n\n```go\ntype ValidationResult struct {\n\tValid  bool     `json:\"valid\"`\n\tErrors []string `json:\"errors,omitempty\"`\n}\n```\nValidationResult is the result of policy validation.\n\n","path":"github.com/diffsec/agentmon/pkg/cli","name":"cli","synopsis":"","isRedistributable":true}
