Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HookContentUpdate ¶
type HookInput ¶
type HookInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
Cwd string `json:"cwd"`
PermissionMode string `json:"permission_mode"`
HookEventName string `json:"hook_event_name"`
ToolName string `json:"tool_name"`
ToolInput HookToolInput `json:"-"`
ToolInputRaw json.RawMessage `json:"tool_input"`
PermissionSuggestions []json.RawMessage `json:"permission_suggestions"`
}
func (HookInput) MetricsFields ¶ added in v0.4.2
MetricsFields returns the subset of tool_input recorded in metrics. Only command/file_path/path/pattern are exposed; description, content, content_updates and the raw JSON are intentionally omitted to keep metrics compact and avoid leaking descriptive or file-body text.
func (HookInput) ToolInputText ¶
ToolInputText returns a textual representation of the tool input for path extraction.
func (*HookInput) UnmarshalJSON ¶
type HookToolInput ¶
type PermissionContext ¶
type PermissionContext struct {
Cwd string `json:"cwd"`
RepoRoot string `json:"repo_root,omitempty"`
GitDir string `json:"git_dir,omitempty"`
GitCommonDir string `json:"git_common_dir,omitempty"`
PrimaryCheckoutRoot string `json:"primary_checkout_root,omitempty"`
BranchName string `json:"branch_name,omitempty"`
IsWorktree bool `json:"is_worktree"`
ReferencedPaths []string `json:"referenced_paths,omitempty"`
}
func BuildPermissionContext ¶
func BuildPermissionContext(input HookInput) PermissionContext
BuildPermissionContext gathers git repository context for the given hook input.
type RecentTranscript ¶
type RecentTranscript struct {
UserMessages []string `json:"user_messages,omitempty"`
RecentToolCalls []string `json:"recent_tool_calls,omitempty"`
}
RecentTranscript holds recent user messages and tool operations from the session transcript.
func LoadRecentTranscript ¶
func LoadRecentTranscript(path string) (RecentTranscript, error)
LoadRecentTranscript reads the tail of the transcript JSONL and extracts the most recent user messages and tool call summaries.
type SettingsPermissions ¶
type SettingsPermissions struct {
Allow []string `json:"allow,omitempty"`
Deny []string `json:"deny,omitempty"`
}
func LoadSettingsPermissions ¶
func LoadSettingsPermissions(cwd string) SettingsPermissions
LoadSettingsPermissions reads permissions from settings.json files. File-not-found errors are expected and silently ignored. JSON parse errors are logged as warnings but do not fail the operation.