Documentation
¶
Index ¶
- func CleanupSessions() (int, error)
- func EndSession() (string, error)
- func FindGographRoot() string
- func FindMostRecentSessionID() (string, error)
- func GetActiveSessionID() (string, error)
- func LogCommand(command string, args []string, intention string, elapsed time.Duration, ...) error
- func RunAudit(sessionID string, jsonMode bool) int
- func StartSession(customWord string) (string, error)
- type ActiveSessionPointer
- type AuditReport
- type CommandLogEntry
- type GenericLogLine
- type SessionEndEntry
- type SessionStartEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupSessions ¶
CleanupSessions deletes all inactive session JSONL logs. If no session is active, it deletes all logs.
func FindGographRoot ¶ added in v1.4.72
func FindGographRoot() string
FindGographRoot walks up from the current working directory until it finds a directory that already contains a ".gograph" subdirectory (i.e. the project root where `gograph build` was run). Falls back to "." when none is found so that existing behaviour and tests that chdir to a fresh temp dir are unaffected.
This is a thin wrapper around rootfind.FindRoot() kept for backward compatibility.
func FindMostRecentSessionID ¶
FindMostRecentSessionID finds the session log file with the newest modification time.
func GetActiveSessionID ¶
GetActiveSessionID retrieves the currently active session ID if it exists.
func LogCommand ¶
func LogCommand(command string, args []string, intention string, elapsed time.Duration, status string) error
LogCommand Telemetry records command execution details inside the active session log if present.
func StartSession ¶
StartSession initializes a new session and writes the active session pointer.
Types ¶
type ActiveSessionPointer ¶
type ActiveSessionPointer struct {
ActiveSessionID string `json:"active_session_id"`
}
ActiveSessionPointer tracks the currently active session ID.
type AuditReport ¶
type AuditReport struct {
SessionID string `json:"session_id"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
EndedAt string `json:"ended_at"`
DurationSeconds float64 `json:"duration_seconds"`
TotalCommands int `json:"total_commands"`
SuccessCount int `json:"success_count"`
FailureCount int `json:"failure_count"`
SuccessRate float64 `json:"success_rate"`
PlanRun bool `json:"plan_run"`
ReviewRun bool `json:"review_run"`
ComposedCount int `json:"composed_count"`
RawQueryCount int `json:"raw_query_count"`
Composability float64 `json:"composability"`
ComplianceScore float64 `json:"compliance_score"`
Grade string `json:"grade"`
Recommendations []string `json:"recommendations"`
}
AuditReport holds the calculated compliance and success metrics of a session.
type CommandLogEntry ¶
type CommandLogEntry struct {
Type string `json:"type"`
Timestamp string `json:"timestamp"`
Command string `json:"command"`
Args []string `json:"args"`
Intention string `json:"intention"`
ExecutionMs int64 `json:"execution_ms"`
Status string `json:"status"`
}
CommandLogEntry logs telemetry metadata for an executed command.
type GenericLogLine ¶
type GenericLogLine struct {
Type string `json:"type"`
SessionID string `json:"session_id"`
CreatedAt string `json:"created_at"`
EndedAt string `json:"ended_at"`
Timestamp string `json:"timestamp"`
Command string `json:"command"`
Args []string `json:"args"`
Intention string `json:"intention"`
ExecutionMs int64 `json:"execution_ms"`
Status string `json:"status"`
}
GenericLogLine represents any log line parsed from a JSONL session file.
type SessionEndEntry ¶
type SessionEndEntry struct {
Type string `json:"type"`
EndedAt string `json:"ended_at"`
Status string `json:"status"`
}
SessionEndEntry logs the termination of a session.
type SessionStartEntry ¶
type SessionStartEntry struct {
Type string `json:"type"`
SessionID string `json:"session_id"`
CreatedAt string `json:"created_at"`
}
SessionStartEntry logs the start of a session.