Documentation
¶
Overview ¶
Package core provides types, check functions, and output formatting for the doctor command. Subcommand cmd/root imports core for all doctor orchestration and display logic.
Index ¶
- func AddResourceResults(report *Report, snap sysinfo.Snapshot)
- func CheckContextInitialized(report *Report)
- func CheckContextTokenSize(report *Report)
- func CheckCtxrcValidation(report *Report)
- func CheckDrift(report *Report)
- func CheckEventLogging(report *Report)
- func CheckPluginEnablement(report *Report)
- func CheckRecentEventActivity(report *Report)
- func CheckReminders(report *Report)
- func CheckRequiredFiles(report *Report)
- func CheckSystemResources(report *Report)
- func CheckTaskCompletion(report *Report)
- func CheckWebhook(report *Report)
- func OutputHuman(cmd *cobra.Command, report *Report) error
- func OutputJSON(cmd *cobra.Command, report *Report) error
- func ResourcePct(used, total uint64) int
- func SeverityToStatus(sev sysinfo.Severity) string
- type Report
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddResourceResults ¶
AddResourceResults appends per-metric resource results to the report. Extracted for testability with constructed Snapshot values.
Parameters:
- report: Report to append the results to
- snap: System resource snapshot to evaluate
func CheckContextInitialized ¶
func CheckContextInitialized(report *Report)
CheckContextInitialized verifies that a .context/ directory exists.
Parameters:
- report: Report to append the result to
func CheckContextTokenSize ¶
func CheckContextTokenSize(report *Report)
CheckContextTokenSize estimates context token usage and reports per-file breakdown.
Parameters:
- report: Report to append the result to
func CheckCtxrcValidation ¶
func CheckCtxrcValidation(report *Report)
CheckCtxrcValidation validates the .ctxrc file for unknown fields or parse errors.
Parameters:
- report: Report to append the result to
func CheckDrift ¶
func CheckDrift(report *Report)
CheckDrift detects stale paths or missing files referenced in context.
Parameters:
- report: Report to append the result to
func CheckEventLogging ¶
func CheckEventLogging(report *Report)
CheckEventLogging checks whether event logging is enabled.
Parameters:
- report: Report to append the result to
func CheckPluginEnablement ¶
func CheckPluginEnablement(report *Report)
CheckPluginEnablement checks whether the ctx plugin is installed and enabled.
Parameters:
- report: Report to append the result to
func CheckRecentEventActivity ¶
func CheckRecentEventActivity(report *Report)
CheckRecentEventActivity reports the most recent event log entry.
Parameters:
- report: Report to append the result to
func CheckReminders ¶
func CheckReminders(report *Report)
CheckReminders checks for pending reminders in the context directory.
Parameters:
- report: Report to append the result to
func CheckRequiredFiles ¶
func CheckRequiredFiles(report *Report)
CheckRequiredFiles verifies that all required context files are present.
Parameters:
- report: Report to append the result to
func CheckSystemResources ¶
func CheckSystemResources(report *Report)
CheckSystemResources collects and evaluates system resource metrics.
Parameters:
- report: Report to append the result to
func CheckTaskCompletion ¶
func CheckTaskCompletion(report *Report)
CheckTaskCompletion analyzes the task completion ratio and suggests archiving.
Parameters:
- report: Report to append the result to
func CheckWebhook ¶
func CheckWebhook(report *Report)
CheckWebhook checks whether a webhook notification endpoint is configured.
Parameters:
- report: Report to append the result to
func OutputHuman ¶
OutputHuman writes the report in a human-readable format grouped by category.
Parameters:
- cmd: Cobra command providing the output writer
- report: Doctor report to display
Returns:
- error: Always nil (satisfies interface)
func OutputJSON ¶
OutputJSON writes the report as indented JSON to the command's output stream.
Parameters:
- cmd: Cobra command providing the output writer
- report: Doctor report to serialize
Returns:
- error: Non-nil if JSON marshaling fails
func ResourcePct ¶
ResourcePct calculates the percentage of used versus total.
Parameters:
- used: Used amount
- total: Total capacity
Returns:
- int: Percentage (0 if the total is 0)
func SeverityToStatus ¶
SeverityToStatus converts a sysinfo.Severity to a doctor status string.
Parameters:
- sev: Severity level from system resource evaluation
Returns:
- string: Corresponding status constant (stats.StatusOK, stats.StatusWarning, stats.StatusError)
Types ¶
type Report ¶
type Report struct {
Results []Result `json:"results"`
Warnings int `json:"warnings"`
Errors int `json:"errors"`
}
Report is the complete doctor output.
Fields:
- Results: All individual check results
- Warnings: Count of results with StatusWarning
- Errors: Count of results with StatusError
type Result ¶
type Result struct {
Name string `json:"name"`
Category string `json:"category"`
Status string `json:"status"` // "ok", "warning", "error", "info"
Message string `json:"message"`
}
Result represents a single check outcome.
Fields:
- Name: Machine-readable identifier for the check
- Category: Grouping label (Structure, Quality, Plugin, etc.)
- Status: One of stats.StatusOK, stats.StatusWarning, stats.StatusError, stats.StatusInfo
- Message: Human-readable description of the outcome