Documentation
¶
Index ¶
- Constants
- type Provider
- func (p *Provider) CaptureFileSnapshot(store *state.Store, input *trace.HookInput) error
- func (p *Provider) CleanupAfterEdit(store *state.Store, input *trace.HookInput)
- func (p *Provider) CopySessionData(store *state.Store, repoRoot, sessionID string) error
- func (p *Provider) DiscoverSession(repoRoot string) (*trace.DiscoveredSession, error)
- func (p *Provider) InstallHooks(repoRoot string) error
- func (p *Provider) InstallHooksForTraceRun(repoRoot string) error
- func (p *Provider) IsCommandTool(toolName string) bool
- func (p *Provider) IsFileWritingTool(toolName string) bool
- func (p *Provider) Name() string
- func (p *Provider) ParseSession(_ context.Context, opts *trace.ParseOpts) (*aicodingsession.Evidence, error)
- func (p *Provider) ReadHookInput(r io.Reader) (*trace.HookInput, error)
- func (p *Provider) ResolveBeforeContent(store *state.Store, input *trace.HookInput, _ []byte) []byte
- func (p *Provider) SessionDirForRepo(repoRoot string) string
- func (p *Provider) SettingsFile(repoRoot string) string
- func (p *Provider) SystemMessage(msg string) error
- func (p *Provider) UninstallHooks(repoRoot string) error
Constants ¶
const Name = "claude-code"
Name is the provider identifier emitted to evidence and used as the key in SessionRecord.Provider. Kept as an exported constant so CLI wiring can refer to it without instantiating the provider.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct{}
Provider implements trace.Provider for Claude Code sessions.
func (*Provider) CaptureFileSnapshot ¶
CaptureFileSnapshot reads the file at input.FilePath and stores its content under the store's snapshots/ directory so the post-tool-use handler can compute line-range diffs after the edit. A missing file (e.g. Claude's Write creating a new file) is treated as a non-error; other read errors (permission denied, I/O failures) are surfaced.
func (*Provider) CleanupAfterEdit ¶
CleanupAfterEdit removes the per-edit snapshot. Safe to call when no snapshot was ever taken.
func (*Provider) CopySessionData ¶
CopySessionData copies the Claude Code JSONL (and subagent files) from the Claude project directory into the store's raw/ directory so pre-push can parse them even if Claude rotates its own storage later.
func (*Provider) DiscoverSession ¶
func (p *Provider) DiscoverSession(repoRoot string) (*trace.DiscoveredSession, error)
DiscoverSession finds the most relevant Claude Code session for the given repo root.
func (*Provider) InstallHooks ¶
InstallHooks adds Chainloop hooks to .claude/settings.json.
func (*Provider) InstallHooksForTraceRun ¶
InstallHooksForTraceRun installs every hook except SessionEnd; trace run drives end-of-session itself.
func (*Provider) IsCommandTool ¶
IsCommandTool returns true if the named tool runs a shell command.
func (*Provider) IsFileWritingTool ¶
IsFileWritingTool returns true if the named tool modifies files on disk.
func (*Provider) ParseSession ¶
func (p *Provider) ParseSession(_ context.Context, opts *trace.ParseOpts) (*aicodingsession.Evidence, error)
ParseSession parses a Claude Code session JSONL and returns structured evidence.
func (*Provider) ReadHookInput ¶
ReadHookInput reads and parses the Claude Code hook JSON from the given reader.
func (*Provider) ResolveBeforeContent ¶
func (p *Provider) ResolveBeforeContent(store *state.Store, input *trace.HookInput, _ []byte) []byte
ResolveBeforeContent returns the snapshot saved by CaptureFileSnapshot. The "after" argument is unused for Claude — we always rely on the pre-edit snapshot — but is part of the interface for providers that reconstruct from edits instead of snapshots.
func (*Provider) SessionDirForRepo ¶
SessionDirForRepo returns the Claude Code project directory for a given repo root.
func (*Provider) SettingsFile ¶
SettingsFile returns the absolute path to .claude/settings.json for the given repo.
func (*Provider) SystemMessage ¶
SystemMessage writes a message to stdout for Claude Code to display on session start.
func (*Provider) UninstallHooks ¶
UninstallHooks removes Chainloop hooks from .claude/settings.json.