Documentation
¶
Index ¶
- Constants
- type DB
- func (d *DB) CleanupOldIntentCache(maxAge time.Duration) (int64, error)
- func (d *DB) ClearStepFindings(id string) error
- func (d *DB) Close() error
- func (d *DB) CompleteStep(id string, exitCode int, durationMS int64, logPath string) error
- func (d *DB) CompleteStepWithStatus(id string, status types.StepStatus, exitCode int, durationMS int64, ...) error
- func (d *DB) DeleteRepo(id string) error
- func (d *DB) FailStep(id string, errMsg string, durationMS int64) error
- func (d *DB) FixedFindingsByStep(step *StepResult) (int, error)
- func (d *DB) GetActiveRun(repoID, branch string) (*Run, error)
- func (d *DB) GetIntentCache(key string) (*IntentCacheEntry, error)
- func (d *DB) GetRepo(id string) (*Repo, error)
- func (d *DB) GetRepoByPath(workingPath string) (*Repo, error)
- func (d *DB) GetRoundsByStep(stepResultID string) ([]*StepRound, error)
- func (d *DB) GetRun(id string) (*Run, error)
- func (d *DB) GetRunsByRepo(repoID string) ([]*Run, error)
- func (d *DB) GetStats() (*Stats, error)
- func (d *DB) GetStepResult(id string) (*StepResult, error)
- func (d *DB) GetStepsByRun(runID string) ([]*StepResult, error)
- func (d *DB) InsertRepo(workingPath, upstreamURL, defaultBranch string) (*Repo, error)
- func (d *DB) InsertRepoWithID(id, workingPath, upstreamURL, defaultBranch string) (*Repo, error)
- func (d *DB) InsertRun(repoID, branch, headSHA, baseSHA string) (*Run, error)
- func (d *DB) InsertStepResult(runID string, stepName types.StepName) (*StepResult, error)
- func (d *DB) InsertStepRound(stepResultID string, round int, trigger string, findingsJSON *string, ...) (*StepRound, error)
- func (d *DB) PutIntentCache(e IntentCacheEntry) error
- func (d *DB) RecoverStaleRuns(errMsg string) (int, error)
- func (d *DB) SetStepDuration(id string, durationMS int64) error
- func (d *DB) SetStepFindings(id string, findingsJSON string) error
- func (d *DB) SetStepRoundSelectedFindingIDs(id string, selectedFindingIDs *string) error
- func (d *DB) SetStepRoundSelection(id string, selectedFindingIDs *string, source string) error
- func (d *DB) SetStepRoundUserFindings(id string, userFindingsJSON *string) error
- func (d *DB) StartStep(id string) error
- func (d *DB) StepFindingStats(step *StepResult) (StepStats, error)
- func (d *DB) UpdateRunError(id, errMsg string) error
- func (d *DB) UpdateRunErrorStatus(id, errMsg string, status types.RunStatus) error
- func (d *DB) UpdateRunHeadSHA(id, headSHA string) error
- func (d *DB) UpdateRunIntent(id string, intent RunIntent) error
- func (d *DB) UpdateRunPRURL(id, prURL string) error
- func (d *DB) UpdateRunStatus(id string, status types.RunStatus) error
- func (d *DB) UpdateStepStatus(id string, status types.StepStatus) error
- func (d *DB) UpdateStepStatusWithDuration(id string, status types.StepStatus, durationMS int64) error
- type IntentCacheEntry
- type Repo
- type RepoStats
- type Run
- type RunIntent
- type Stats
- type StepResult
- type StepRound
- type StepStats
Constants ¶
const ( RoundSelectionSourceUser = "user" RoundSelectionSourceAutoFix = "auto_fix" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB wraps a SQLite database connection.
func (*DB) CleanupOldIntentCache ¶ added in v1.14.0
CleanupOldIntentCache deletes entries older than maxAge. Returns rows deleted.
func (*DB) ClearStepFindings ¶
ClearStepFindings removes any stored findings JSON from a step result.
func (*DB) CompleteStep ¶
CompleteStep marks a step as completed with timing and result info.
func (*DB) CompleteStepWithStatus ¶ added in v1.10.1
func (d *DB) CompleteStepWithStatus(id string, status types.StepStatus, exitCode int, durationMS int64, logPath string) error
CompleteStepWithStatus marks a step as finished with timing and result info.
func (*DB) DeleteRepo ¶
DeleteRepo deletes a repo by ID (cascade deletes runs and steps).
func (*DB) FixedFindingsByStep ¶ added in v1.18.0
func (d *DB) FixedFindingsByStep(step *StepResult) (int, error)
FixedFindingsByStep returns how many findings were resolved for a single step.
func (*DB) GetActiveRun ¶
GetActiveRun returns the currently active run (pending or running) for a repo, if any. When branch is non-empty, only a run on that exact branch is returned - the setup wizard relies on this to decide whether a new run is needed for the current branch. When branch is empty, returns the most recently created active run across any branch.
func (*DB) GetIntentCache ¶ added in v1.14.0
func (d *DB) GetIntentCache(key string) (*IntentCacheEntry, error)
GetIntentCache returns the cached summary for a key, or nil if absent.
func (*DB) GetRepoByPath ¶
GetRepoByPath returns a repo by its working path.
func (*DB) GetRoundsByStep ¶ added in v1.1.0
GetRoundsByStep returns all rounds for a step result, ordered by round number.
func (*DB) GetRunsByRepo ¶
GetRunsByRepo returns all runs for a repo, newest first.
func (*DB) GetStats ¶ added in v1.16.0
GetStats aggregates historical usage across all repositories.
func (*DB) GetStepResult ¶
func (d *DB) GetStepResult(id string) (*StepResult, error)
GetStepResult returns a step result by ID.
func (*DB) GetStepsByRun ¶
func (d *DB) GetStepsByRun(runID string) ([]*StepResult, error)
GetStepsByRun returns all step results for a run, in execution order.
func (*DB) InsertRepo ¶
InsertRepo creates a new repo record and returns it with a generated ID.
func (*DB) InsertRepoWithID ¶
InsertRepoWithID creates a new repo record with a caller-provided ID.
func (*DB) InsertStepResult ¶
InsertStepResult creates a new step result record.
func (*DB) InsertStepRound ¶ added in v1.1.0
func (d *DB) InsertStepRound(stepResultID string, round int, trigger string, findingsJSON *string, fixSummary *string, durationMS int64) (*StepRound, error)
InsertStepRound creates a new round record for a step result. fixSummary may be nil for non-fix rounds or when the agent produced no summary.
func (*DB) PutIntentCache ¶ added in v1.14.0
func (d *DB) PutIntentCache(e IntentCacheEntry) error
PutIntentCache inserts or replaces an intent cache entry.
func (*DB) RecoverStaleRuns ¶
RecoverStaleRuns marks any runs stuck in pending/running status as failed and fails any in-progress steps. This is called at daemon startup to clean up after a previous crash. Returns the number of recovered runs.
func (*DB) SetStepDuration ¶ added in v1.1.0
SetStepDuration sets the execution-only duration on a step result.
func (*DB) SetStepFindings ¶
SetStepFindings sets the findings JSON on a step result.
func (*DB) SetStepRoundSelectedFindingIDs ¶ added in v1.5.0
SetStepRoundSelectedFindingIDs preserves the old API for callers that do not need to distinguish how the selection was made.
func (*DB) SetStepRoundSelection ¶ added in v1.5.0
SetStepRoundSelection records which findings were selected for fix AFTER the given round produced its findings, along with whether that selection came from the user or auto-fix filtering. Passing a nil or empty JSON array clears both columns.
func (*DB) SetStepRoundUserFindings ¶ added in v1.10.0
SetStepRoundUserFindings records the merged finding list (with user instructions attached and user-added findings appended) that was dispatched to the fix agent for the round. Passing nil clears the column.
func (*DB) StepFindingStats ¶ added in v1.18.0
func (d *DB) StepFindingStats(step *StepResult) (StepStats, error)
StepFindingStats returns reported and fixed finding counts for a single step.
func (*DB) UpdateRunError ¶
UpdateRunError sets the error message on a run.
func (*DB) UpdateRunErrorStatus ¶
UpdateRunErrorStatus sets the error message and terminal status on a run.
func (*DB) UpdateRunHeadSHA ¶
UpdateRunHeadSHA updates the run head SHA and timestamp.
func (*DB) UpdateRunIntent ¶ added in v1.14.0
UpdateRunIntent persists the inferred user intent for a run.
func (*DB) UpdateRunPRURL ¶
UpdateRunPRURL sets the PR URL on a run.
func (*DB) UpdateRunStatus ¶
UpdateRunStatus updates a run's status and updated_at timestamp.
func (*DB) UpdateStepStatus ¶
func (d *DB) UpdateStepStatus(id string, status types.StepStatus) error
UpdateStepStatus updates a step's status.
func (*DB) UpdateStepStatusWithDuration ¶ added in v1.18.0
func (d *DB) UpdateStepStatusWithDuration(id string, status types.StepStatus, durationMS int64) error
UpdateStepStatusWithDuration updates a step's status and execution duration together.
type IntentCacheEntry ¶ added in v1.14.0
type IntentCacheEntry struct {
CacheKey string
Summary string
AgentName string
SessionID string
CreatedAt int64
}
IntentCacheEntry is a cached summarization for a known agent session.
type Repo ¶
type Repo struct {
ID string
WorkingPath string
UpstreamURL string
DefaultBranch string
CreatedAt int64
}
Repo represents a registered repository.
type RepoStats ¶ added in v1.16.0
type RepoStats struct {
RepoID string
WorkingPath string
Runs int
RescueRuns int
ReportedFindings int
FixedFindings int
}
RepoStats summarizes historical usage for one repository.
func (RepoStats) DisplayName ¶ added in v1.16.0
DisplayName returns a compact repository name for terminal reports.
type Run ¶
type Run struct {
ID string
RepoID string
Branch string
HeadSHA string
BaseSHA string
Status types.RunStatus
PRURL *string
Error *string
Intent *string
IntentSource *string
IntentSessionID *string
IntentScore *float64
CreatedAt int64
UpdatedAt int64
}
Run represents a pipeline run.
type RunIntent ¶ added in v1.14.0
RunIntent carries the four intent-related columns persisted on a run.
type Stats ¶ added in v1.16.0
type Stats struct {
TotalRepos int
TotalRuns int
PullRequests int
RescueRuns int
ReportedFindings int
FixedFindings int
StepStats []StepStats
RepoStats []RepoStats
}
Stats summarizes historical no-mistakes usage across all repositories.
type StepResult ¶
type StepResult struct {
ID string
RunID string
StepName types.StepName
StepOrder int
Status types.StepStatus
ExitCode *int
DurationMS *int64
LogPath *string
FindingsJSON *string
Error *string
StartedAt *int64
CompletedAt *int64
}
StepResult represents the result of a pipeline step execution.
type StepRound ¶ added in v1.1.0
type StepRound struct {
ID string
StepResultID string
Round int
Trigger string // "initial", "auto_fix"; legacy "user_fix" is treated as "auto_fix"
FindingsJSON *string // nullable - findings produced by this round
// UserFindingsJSON, when non-nil, is the merged finding list that was
// dispatched to the fix agent after the user edited per-finding
// instructions or added their own findings. It includes both the
// selected agent-produced findings (with any attached user
// instructions) and the user-authored findings.
UserFindingsJSON *string
// SelectedFindingIDs, when non-nil, is a JSON array of finding IDs that
// were chosen (by the user or auto-fix filter) to be fixed AFTER this
// round. It is populated on the round whose findings triggered the next
// round, so that later rounds' prompts can tell which findings were
// deliberately left unselected.
SelectedFindingIDs *string
SelectionSource *string
// FixSummary, when non-nil, is the agent's one-line commit summary for
// the fix attempt performed during this round. It is only set when the
// round itself was a fix round (trigger=="auto_fix").
FixSummary *string
DurationMS int64
CreatedAt int64
}
StepRound represents one execution round within a pipeline step.