Documentation
¶
Index ¶
- Constants
- Variables
- func EffectiveMaxBatch(flagChanged bool, configured int, dryRun bool) int
- func EffectiveMaxBatchWithDefaults(flagChanged bool, configured int, dryRun bool, realDefault, dryRunDefault int) int
- func IsPreviewNoiseText(v string) bool
- func ParsePreviewLine(line string) (role string, text string)
- type AgentsExplainFilters
- type AgentsExplainInput
- type AgentsExplainResult
- type AgentsExplainRule
- type AgentsExplainSource
- type AgentsExplainSummary
- type AgentsLintInput
- type AgentsLintIssue
- type AgentsLintResult
- type AgentsLintSummary
- type DeleteActionInput
- type DeleteActionResult
- type DeleteExecutor
- type DeleteSelectInput
- type DeleteSelectResult
- type DoctorCheck
- type DoctorHostPathInput
- type DoctorLevel
- type DoctorRiskInput
- type DoctorRiskReport
- type DoctorRiskSample
- type GroupInput
- type GroupStat
- type ListInput
- type ListResult
- type LoadTUISessionsInput
- type LoadTUISessionsResult
- type NewBatchID
- type PreviewMessage
- type RestoreActionInput
- type RestoreActionResult
- type RestoreExecutor
- type RestoreSelectInput
- type RestoreSelectResult
- type WriteActionLog
Constants ¶
const ( DefaultMaxBatchTUIReal = 100 DefaultMaxBatchTUIDryRun = 1000 )
const ( DefaultMaxBatchReal = 50 DefaultMaxBatchDryRun = 500 )
const (
DefaultPreviewMaxMessages = 600
)
Variables ¶
var ErrPreviewEntryTooLong = errors.New("preview entry exceeds max line size")
Functions ¶
func IsPreviewNoiseText ¶
func ParsePreviewLine ¶
Types ¶
type AgentsExplainFilters ¶ added in v0.3.7
type AgentsExplainInput ¶ added in v0.3.2
type AgentsExplainInput struct {
CWD string
EffectiveOnly bool
SourceFilter string
RuleFilter string
}
AgentsExplainInput controls AGENTS.md explain behavior.
type AgentsExplainResult ¶ added in v0.3.2
type AgentsExplainResult struct {
CWD string `json:"cwd"`
Sources []AgentsExplainSource `json:"sources"`
Rules []AgentsExplainRule `json:"rules"`
Filters AgentsExplainFilters `json:"filters,omitempty"`
Summary AgentsExplainSummary `json:"summary"`
}
AgentsExplainResult is the normalized AGENTS.md explain output.
func ExplainAgents ¶ added in v0.3.2
func ExplainAgents(in AgentsExplainInput) (AgentsExplainResult, error)
ExplainAgents discovers AGENTS.md sources and computes effective/shadowed rules.
type AgentsExplainRule ¶ added in v0.3.2
type AgentsExplainRule struct {
ID string `json:"id"`
Key string `json:"key"`
Text string `json:"text"`
SourcePath string `json:"source_path"`
Line int `json:"line"`
Priority int `json:"priority"`
Status string `json:"status"`
ShadowedBy string `json:"shadowed_by,omitempty"`
}
AgentsExplainRule is one extracted rule line.
type AgentsExplainSource ¶ added in v0.3.2
AgentsExplainSource is one discovered AGENTS.md source.
type AgentsExplainSummary ¶ added in v0.3.2
type AgentsExplainSummary struct {
Sources int `json:"sources"`
Rules int `json:"rules"`
Effective int `json:"effective"`
Shadowed int `json:"shadowed"`
}
AgentsExplainSummary reports aggregate counters.
type AgentsLintInput ¶ added in v0.3.7
type AgentsLintInput struct {
CWD string
}
type AgentsLintIssue ¶ added in v0.3.7
type AgentsLintResult ¶ added in v0.3.7
type AgentsLintResult struct {
CWD string `json:"cwd"`
Issues []AgentsLintIssue `json:"issues"`
Summary AgentsLintSummary `json:"summary"`
}
func LintAgents ¶ added in v0.3.7
func LintAgents(in AgentsLintInput) (AgentsLintResult, error)
type AgentsLintSummary ¶ added in v0.3.7
type DeleteActionInput ¶
type DeleteActionInput struct {
Sessions []session.Session
Selector session.Selector
DryRun bool
Confirm bool
Yes bool
Hard bool
SessionsRoot string
TrashRoot string
MaxBatch int
MaxBatchChanged bool
RealDefault int
DryRunDefault int
Executor DeleteExecutor
LogFile string
NewBatchID NewBatchID
WriteActionLog WriteActionLog
Now time.Time
}
type DeleteActionResult ¶
type DeleteActionResult struct {
Summary session.DeleteSummary
AppliedMaxBatch int
BatchID string
LogError error
}
func RunDeleteAction ¶
func RunDeleteAction(in DeleteActionInput) (DeleteActionResult, error)
type DeleteExecutor ¶
type DeleteExecutor func(candidates []session.Session, sel session.Selector, opts session.DeleteOptions) (session.DeleteSummary, error)
DeleteExecutor executes delete workflow over selected sessions.
type DeleteSelectInput ¶ added in v0.3.2
type DeleteSelectResult ¶ added in v0.3.2
func SelectDeleteSessions ¶ added in v0.3.2
func SelectDeleteSessions(in DeleteSelectInput) (DeleteSelectResult, error)
type DoctorCheck ¶
type DoctorCheck struct {
Name string
Level DoctorLevel
Detail string
}
func CheckSessionHostPaths ¶
func CheckSessionHostPaths(in DoctorHostPathInput) DoctorCheck
type DoctorHostPathInput ¶
type DoctorLevel ¶
type DoctorLevel string
const ( DoctorPass DoctorLevel = "PASS" DoctorWarn DoctorLevel = "WARN" DoctorFail DoctorLevel = "FAIL" )
type DoctorRiskInput ¶
type DoctorRiskInput struct {
SessionsRoot string
SampleLimit int
IntegrityCheck bool
Repository core.SessionRepository
Evaluator core.RiskEvaluator
}
type DoctorRiskReport ¶
type DoctorRiskReport struct {
SessionsTotal int `json:"sessions_total"`
RiskTotal int `json:"risk_total"`
RiskRate float64 `json:"risk_rate"`
High int `json:"high"`
Medium int `json:"medium"`
IntegrityCheck bool `json:"integrity_check"`
SampleLimit int `json:"sample_limit"`
Samples []DoctorRiskSample `json:"samples"`
}
func DoctorRisk ¶
func DoctorRisk(in DoctorRiskInput) (DoctorRiskReport, error)
type DoctorRiskSample ¶
type GroupInput ¶
type GroupStat ¶
type GroupStat struct {
Group string `json:"group"`
Count int `json:"count"`
SizeBytes int64 `json:"size_bytes"`
Latest string `json:"latest"`
}
func BuildGroupStats ¶
func GroupSessions ¶
func GroupSessions(in GroupInput) ([]GroupStat, error)
type ListResult ¶
func ListSessions ¶
func ListSessions(in ListInput) (ListResult, error)
type LoadTUISessionsInput ¶
type LoadTUISessionsInput struct {
SessionsRoot string
ScanLimit int
ViewLimit int
Now time.Time
Repository core.SessionRepository
Evaluator core.RiskEvaluator
}
LoadTUISessionsInput describes TUI session-loading constraints.
type LoadTUISessionsResult ¶
LoadTUISessionsResult is the normalized TUI session set.
func LoadTUISessions ¶
func LoadTUISessions(in LoadTUISessionsInput) (LoadTUISessionsResult, error)
LoadTUISessions loads sessions for TUI and applies risk-first ordering.
type NewBatchID ¶ added in v0.3.5
NewBatchID allocates operation batch IDs for action logging.
type PreviewMessage ¶
func ExtractPreviewMessages ¶
func ExtractPreviewMessages(path string, maxMessages int) ([]PreviewMessage, error)
type RestoreActionInput ¶
type RestoreActionInput struct {
Sessions []session.Session
Selector session.Selector
DryRun bool
Confirm bool
Yes bool
SessionsRoot string
TrashSessionsRoot string
MaxBatch int
MaxBatchChanged bool
RealDefault int
DryRunDefault int
AllowEmptySelector bool
Executor RestoreExecutor
LogFile string
NewBatchID NewBatchID
WriteActionLog WriteActionLog
Now time.Time
}
type RestoreActionResult ¶
type RestoreActionResult struct {
Summary session.RestoreSummary
AppliedMaxBatch int
BatchID string
LogError error
}
func RunRestoreAction ¶
func RunRestoreAction(in RestoreActionInput) (RestoreActionResult, error)
type RestoreExecutor ¶
type RestoreExecutor func(candidates []session.Session, sel session.Selector, opts session.RestoreOptions) (session.RestoreSummary, error)
RestoreExecutor executes restore workflow over selected sessions.
type RestoreSelectInput ¶ added in v0.3.2
type RestoreSelectResult ¶ added in v0.3.2
func SelectRestoreSessions ¶ added in v0.3.2
func SelectRestoreSessions(in RestoreSelectInput) (RestoreSelectResult, error)
type WriteActionLog ¶ added in v0.3.5
type WriteActionLog func(logFile string, rec audit.ActionRecord) error
WriteActionLog appends one action record into the action log file.