Documentation
¶
Overview ¶
Copyright 2026 The GOT Authors. MIT License.
Copyright 2026 The GOT Authors. MIT License.
Copyright 2026 The GOT Authors. MIT License.
Package store implements the SQLite persistence layer for GOT. It provides a minimal migration runner using embedded SQL files and sub-store accessors for each domain (knowledge, workspaces, etc.).
Copyright 2026 The GOT Authors. MIT License.
The migration framework is intentionally lightweight — it reads and executes .sql files embedded via //go:embed in filename order.
Index ¶
- Variables
- type AddWorkspaceCommitParams
- type CreateDecisionParams
- type CreateIssueParams
- type CreateNoteParams
- type CreatePullRequestParams
- type CreateReviewParams
- type CreateSnapshotParams
- type CreateWorkspaceParams
- type Decision
- type DecisionFilter
- type DecisionLink
- type EventLogger
- type GitHubConfig
- type Issue
- type KnowledgeStore
- func (ks *KnowledgeStore) AddWorkspaceBranch(ctx context.Context, workspaceName, branchName string) (*WorkspaceBranch, error)
- func (ks *KnowledgeStore) AddWorkspaceCommit(ctx context.Context, params AddWorkspaceCommitParams) (*WorkspaceCommit, error)
- func (ks *KnowledgeStore) AddWorkspaceFile(ctx context.Context, workspaceName, filePath string) (*WorkspaceFile, error)
- func (ks *KnowledgeStore) CompleteOnboarding(ctx context.Context, sessionID string) error
- func (ks *KnowledgeStore) CreateDecision(ctx context.Context, params CreateDecisionParams) (*Decision, error)
- func (ks *KnowledgeStore) CreateIssue(ctx context.Context, params CreateIssueParams) (*Issue, error)
- func (ks *KnowledgeStore) CreateNote(ctx context.Context, params CreateNoteParams) (*Note, error)
- func (ks *KnowledgeStore) CreatePullRequest(ctx context.Context, params CreatePullRequestParams) (*PullRequest, error)
- func (ks *KnowledgeStore) CreateReview(ctx context.Context, params CreateReviewParams) (*PRReview, error)
- func (ks *KnowledgeStore) CreateSnapshot(ctx context.Context, params CreateSnapshotParams) (*Snapshot, error)
- func (ks *KnowledgeStore) CreateWorkspace(ctx context.Context, params CreateWorkspaceParams) (*Workspace, error)
- func (ks *KnowledgeStore) DeleteDecision(ctx context.Context, id string) error
- func (ks *KnowledgeStore) DeleteNote(ctx context.Context, id string) error
- func (ks *KnowledgeStore) DeleteSnapshot(ctx context.Context, id string) error
- func (ks *KnowledgeStore) DeleteWorkspace(ctx context.Context, name string) (*Workspace, error)
- func (ks *KnowledgeStore) DisablePlugin(ctx context.Context, name string) error
- func (ks *KnowledgeStore) EnablePlugin(ctx context.Context, name string) error
- func (ks *KnowledgeStore) GetDecision(ctx context.Context, id string) (*Decision, error)
- func (ks *KnowledgeStore) GetDecisionLinks(ctx context.Context, decisionID string) ([]DecisionLink, error)
- func (ks *KnowledgeStore) GetGitHubConfig(ctx context.Context) (*GitHubConfig, error)
- func (ks *KnowledgeStore) GetNote(ctx context.Context, id string) (*Note, error)
- func (ks *KnowledgeStore) GetOnboardingProgress(ctx context.Context, sessionID string) (*OnboardingProgress, error)
- func (ks *KnowledgeStore) GetOnboardingSession(ctx context.Context, sessionID string) (*OnboardingSession, error)
- func (ks *KnowledgeStore) GetPlugin(ctx context.Context, name string) (*Plugin, error)
- func (ks *KnowledgeStore) GetPullRequestByNumber(ctx context.Context, number int) (*PullRequest, error)
- func (ks *KnowledgeStore) GetSnapshot(ctx context.Context, id string) (*Snapshot, error)
- func (ks *KnowledgeStore) GetWorkspace(ctx context.Context, name string) (*Workspace, error)
- func (ks *KnowledgeStore) GetWorkspaceByID(ctx context.Context, id string) (*Workspace, error)
- func (ks *KnowledgeStore) GetWorkspaceStatus(ctx context.Context, workspaceName string) (*WorkspaceStatus, error)
- func (ks *KnowledgeStore) InstallPlugin(ctx context.Context, name, version, description, path, manifestJSON string) (*Plugin, error)
- func (ks *KnowledgeStore) LinkDecision(ctx context.Context, params LinkDecisionParams) error
- func (ks *KnowledgeStore) ListAllDecisions(ctx context.Context) ([]Decision, error)
- func (ks *KnowledgeStore) ListDecisions(ctx context.Context, filter DecisionFilter) ([]Decision, error)
- func (ks *KnowledgeStore) ListIssues(ctx context.Context, workspaceID string) ([]Issue, error)
- func (ks *KnowledgeStore) ListNotes(ctx context.Context, filter NoteFilter) ([]Note, error)
- func (ks *KnowledgeStore) ListPlugins(ctx context.Context) ([]Plugin, error)
- func (ks *KnowledgeStore) ListPullRequests(ctx context.Context, workspaceID string) ([]PullRequest, error)
- func (ks *KnowledgeStore) ListReviews(ctx context.Context, prNumber int) ([]PRReview, error)
- func (ks *KnowledgeStore) ListSnapshots(ctx context.Context, limit int) ([]Snapshot, error)
- func (ks *KnowledgeStore) ListUnwatchedItems(ctx context.Context, sessionID string) ([]OnboardingItem, error)
- func (ks *KnowledgeStore) ListWorkspaceBranches(ctx context.Context, workspaceName string) ([]WorkspaceBranch, error)
- func (ks *KnowledgeStore) ListWorkspaceCommits(ctx context.Context, workspaceName string, limit int) ([]WorkspaceCommit, error)
- func (ks *KnowledgeStore) ListWorkspaceFiles(ctx context.Context, workspaceName string) ([]WorkspaceFile, error)
- func (ks *KnowledgeStore) ListWorkspaces(ctx context.Context) ([]Workspace, error)
- func (ks *KnowledgeStore) MarkOnboardingItem(ctx context.Context, sessionID, itemType, itemTarget string) error
- func (ks *KnowledgeStore) RemovePlugin(ctx context.Context, name string) error
- func (ks *KnowledgeStore) RemoveWorkspaceBranch(ctx context.Context, workspaceName, branchName string) error
- func (ks *KnowledgeStore) RemoveWorkspaceFile(ctx context.Context, workspaceName, filePath string) error
- func (ks *KnowledgeStore) Search(ctx context.Context, params SearchParams) ([]SearchResult, error)
- func (ks *KnowledgeStore) SetGitHubConfig(ctx context.Context, cfg GitHubConfig) error
- func (ks *KnowledgeStore) SkipOnboardingItem(ctx context.Context, sessionID, itemType, itemTarget string) error
- func (ks *KnowledgeStore) StartOnboarding(ctx context.Context, participant string) (*OnboardingSession, error)
- func (ks *KnowledgeStore) SupersedeDecision(ctx context.Context, oldID, newID string) error
- func (ks *KnowledgeStore) UpdateDecision(ctx context.Context, id string, params UpdateDecisionParams) (*Decision, error)
- func (ks *KnowledgeStore) UpdateNoteCommitHash(ctx context.Context, id, commitHash string) error
- func (ks *KnowledgeStore) UpdatePullRequestMerge(ctx context.Context, params UpdatePullRequestMergeParams) error
- func (ks *KnowledgeStore) UpdateWorkspace(ctx context.Context, name string, params UpdateWorkspaceParams) (*Workspace, error)
- func (ks *KnowledgeStore) UpdateWorkspaceLastCommit(ctx context.Context, workspaceName, commitSHA string) error
- type LinkDecisionParams
- type Note
- type NoteFilter
- type OnboardingItem
- type OnboardingProgress
- type OnboardingSession
- type PRReview
- type Plugin
- type PluginManifest
- type PluginManifestCommand
- type PullRequest
- type SearchParams
- type SearchResult
- type Snapshot
- type Store
- type TypeProgress
- type UpdateDecisionParams
- type UpdatePullRequestMergeParams
- type UpdateWorkspaceParams
- type Workspace
- type WorkspaceBranch
- type WorkspaceCommit
- type WorkspaceFile
- type WorkspaceStatus
Constants ¶
This section is empty.
Variables ¶
var ( ErrDecisionNotFound = fmt.Errorf("decision not found") ErrNoteNotFound = fmt.Errorf("note not found") ErrOnboardingNotFound = fmt.Errorf("onboarding session not found") ErrEmptyMessage = fmt.Errorf("note message cannot be empty") ErrInvalidStatus = fmt.Errorf("invalid decision status") ErrInvalidLinkType = fmt.Errorf("link type must be one of: commit, file, workspace") ErrDecisionAlreadyLinked = fmt.Errorf("this link already exists") ErrSessionAlreadyComplete = fmt.Errorf("session is already completed") ErrWorkspaceNotFound = fmt.Errorf("workspace not found") ErrDuplicateWorkspace = fmt.Errorf("workspace with this name already exists") ErrPluginNotFound = fmt.Errorf("plugin not found") ErrDuplicatePlugin = fmt.Errorf("plugin with this name already exists") ErrSnapshotNotFound = fmt.Errorf("snapshot not found") )
Functions ¶
This section is empty.
Types ¶
type AddWorkspaceCommitParams ¶
type AddWorkspaceCommitParams struct {
WorkspaceName string
CommitSHA string
BranchName string
Message string
}
AddWorkspaceCommitParams holds fields for adding a commit to a workspace.
type CreateDecisionParams ¶
type CreateDecisionParams struct {
Title string
Context string
Decision string
Alternatives string
Consequences string
WorkspaceID *string
SupersedesID *string
}
CreateDecisionParams holds the user-supplied fields for creating a decision.
type CreateIssueParams ¶
type CreateIssueParams struct {
Number int
Title string
State string
Labels []string
URL string
WorkspaceID string
}
CreateIssueParams holds fields for recording an issue in GOT.
type CreateNoteParams ¶
CreateNoteParams holds fields for creating a note.
type CreatePullRequestParams ¶
type CreatePullRequestParams struct {
Number int
Title string
State string
Branch string
Base string
URL string
WorkspaceID string
}
CreatePullRequestParams holds fields for recording a PR in GOT.
type CreateReviewParams ¶
type CreateReviewParams struct {
PRNumber int
Reviewer string
State string
Body string
WorkspaceID string
}
CreateReviewParams holds fields for recording a review in GOT.
type CreateSnapshotParams ¶
type CreateSnapshotParams struct {
Reason string // e.g. "before-reset", "before-rebase", "before-force-push"
Ref string // e.g. "refs/heads/feature/x" or "detached@abc123"
ReflogSel string // optional reflog selector
StashRef string // optional git stash ref
Metadata string // optional JSON metadata
}
CreateSnapshotParams holds fields for creating a snapshot.
type CreateWorkspaceParams ¶
CreateWorkspaceParams holds fields for creating a workspace.
type Decision ¶
type Decision struct {
ID string `json:"id"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Status string `json:"status"`
Title string `json:"title"`
Context string `json:"context"`
Decision string `json:"decision"`
Alternatives string `json:"alternatives"`
Consequences string `json:"consequences"`
BodyPath string `json:"body_path"`
WorkspaceID *string `json:"workspace_id,omitempty"`
SupersedesID *string `json:"supersedes_id,omitempty"`
}
Decision represents an architectural decision record (ADR).
type DecisionFilter ¶
type DecisionFilter struct {
WorkspaceID *string
Status *string
Limit int // 0 means use default (20)
All bool
}
DecisionFilter specifies how to filter/list decisions.
type DecisionLink ¶
type DecisionLink struct {
ID string `json:"id"`
DecisionID string `json:"decision_id"`
LinkType string `json:"link_type"`
Target string `json:"target"`
LineStart *int `json:"line_start,omitempty"`
LineEnd *int `json:"line_end,omitempty"`
Branch string `json:"branch,omitempty"`
CreatedAt int64 `json:"created_at"`
}
DecisionLink represents a link between a decision and a commit, file, or workspace.
type EventLogger ¶
type EventLogger struct {
// contains filtered or unexported fields
}
EventLogger subscribes to all events on a Bus and durably writes them to the event_log table. It is the bridge between the in-memory event bus and the persistent audit trail that external plugins can poll.
Use NewEventLogger to create and start logging. Call Close to unsubscribe all handlers.
func NewEventLogger ¶
func NewEventLogger(db *sql.DB, bus *events.Bus) *EventLogger
NewEventLogger creates an EventLogger, subscribes to every event type the Knowledge Engine publishes, and returns the ready-to-use logger. The logger is tied to the lifetime of the caller — Close when done.
func (*EventLogger) Close ¶
func (el *EventLogger) Close()
Close unsubscribes all registered event handlers. After Close returns the EventLogger will not write any more rows to the event_log table (though existing rows remain). Idempotent.
type GitHubConfig ¶
type GitHubConfig struct {
Token string `json:"token,omitempty"`
Owner string `json:"owner"`
Repo string `json:"repo"`
BaseBranch string `json:"base_branch"`
UpdatedAt int64 `json:"updated_at"`
}
GitHubConfig stores the GitHub integration configuration.
type Issue ¶
type Issue struct {
ID string `json:"id"`
Number int `json:"number"`
Title string `json:"title"`
State string `json:"state"` // open, closed
Labels []string `json:"labels,omitempty"`
URL string `json:"url,omitempty"`
WorkspaceID string `json:"workspace_id,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
Issue represents a GitHub issue tracked in GOT.
type KnowledgeStore ¶
type KnowledgeStore struct {
// contains filtered or unexported fields
}
KnowledgeStore provides CRUD operations for the Knowledge Engine entities (decisions, notes, onboarding sessions). Every mutating operation publishes a corresponding event on the provided Bus.
func NewKnowledgeStore ¶
func NewKnowledgeStore(db *sql.DB, bus *events.Bus) *KnowledgeStore
NewKnowledgeStore creates a KnowledgeStore backed by the given database and event bus. The bus may be nil, in which case events are silently dropped.
func (*KnowledgeStore) AddWorkspaceBranch ¶
func (ks *KnowledgeStore) AddWorkspaceBranch(ctx context.Context, workspaceName, branchName string) (*WorkspaceBranch, error)
AddWorkspaceBranch adds a branch name to a workspace. Publishes WorkspaceItemAdded.
func (*KnowledgeStore) AddWorkspaceCommit ¶
func (ks *KnowledgeStore) AddWorkspaceCommit(ctx context.Context, params AddWorkspaceCommitParams) (*WorkspaceCommit, error)
AddWorkspaceCommit records a commit as activity in a workspace. Also updates the workspace's last_commit_sha for fast access. Idempotent (UNIQUE constraint on workspace_id + commit_sha).
func (*KnowledgeStore) AddWorkspaceFile ¶
func (ks *KnowledgeStore) AddWorkspaceFile(ctx context.Context, workspaceName, filePath string) (*WorkspaceFile, error)
AddWorkspaceFile adds a file path to a workspace. Publishes WorkspaceItemAdded.
func (*KnowledgeStore) CompleteOnboarding ¶
func (ks *KnowledgeStore) CompleteOnboarding(ctx context.Context, sessionID string) error
CompleteOnboarding marks a session as completed. Publishes OnboardingCompleted.
func (*KnowledgeStore) CreateDecision ¶
func (ks *KnowledgeStore) CreateDecision(ctx context.Context, params CreateDecisionParams) (*Decision, error)
CreateDecision inserts a new decision and publishes DecisionCreated. If SupersedesID is set, the referenced decision is marked superseded and a DecisionSuperseded event is also published.
func (*KnowledgeStore) CreateIssue ¶
func (ks *KnowledgeStore) CreateIssue(ctx context.Context, params CreateIssueParams) (*Issue, error)
CreateIssue records an issue in the store.
func (*KnowledgeStore) CreateNote ¶
func (ks *KnowledgeStore) CreateNote(ctx context.Context, params CreateNoteParams) (*Note, error)
CreateNote inserts a new note and publishes NoteAdded.
func (*KnowledgeStore) CreatePullRequest ¶
func (ks *KnowledgeStore) CreatePullRequest(ctx context.Context, params CreatePullRequestParams) (*PullRequest, error)
CreatePullRequest records a pull request in the store.
func (*KnowledgeStore) CreateReview ¶
func (ks *KnowledgeStore) CreateReview(ctx context.Context, params CreateReviewParams) (*PRReview, error)
CreateReview records a pull request review in the store.
func (*KnowledgeStore) CreateSnapshot ¶
func (ks *KnowledgeStore) CreateSnapshot(ctx context.Context, params CreateSnapshotParams) (*Snapshot, error)
CreateSnapshot records a recovery point in the snapshots table.
func (*KnowledgeStore) CreateWorkspace ¶
func (ks *KnowledgeStore) CreateWorkspace(ctx context.Context, params CreateWorkspaceParams) (*Workspace, error)
CreateWorkspace inserts a new workspace and publishes WorkspaceCreated.
func (*KnowledgeStore) DeleteDecision ¶
func (ks *KnowledgeStore) DeleteDecision(ctx context.Context, id string) error
DeleteDecision hard-deletes a decision and its cascade (links, onboarding items). Publishes a DecisionDeleted event.
func (*KnowledgeStore) DeleteNote ¶
func (ks *KnowledgeStore) DeleteNote(ctx context.Context, id string) error
DeleteNote hard-deletes a note from the database. Publishes a NoteDeleted event.
func (*KnowledgeStore) DeleteSnapshot ¶
func (ks *KnowledgeStore) DeleteSnapshot(ctx context.Context, id string) error
DeleteSnapshot removes a snapshot by ID.
func (*KnowledgeStore) DeleteWorkspace ¶
DeleteWorkspace hard-deletes a workspace and its cascade (files, branches, decisions, notes). Does NOT delete the decisions/notes themselves — they are handled via ON DELETE SET NULL on workspace_id in those tables, but since we use a string reference (not FK), we clear them explicitly.
func (*KnowledgeStore) DisablePlugin ¶
func (ks *KnowledgeStore) DisablePlugin(ctx context.Context, name string) error
DisablePlugin sets a plugin's enabled flag to 0.
func (*KnowledgeStore) EnablePlugin ¶
func (ks *KnowledgeStore) EnablePlugin(ctx context.Context, name string) error
EnablePlugin sets a plugin's enabled flag to 1.
func (*KnowledgeStore) GetDecision ¶
GetDecision retrieves a single decision by ID.
func (*KnowledgeStore) GetDecisionLinks ¶
func (ks *KnowledgeStore) GetDecisionLinks(ctx context.Context, decisionID string) ([]DecisionLink, error)
GetDecisionLinks returns all links for a decision.
func (*KnowledgeStore) GetGitHubConfig ¶
func (ks *KnowledgeStore) GetGitHubConfig(ctx context.Context) (*GitHubConfig, error)
GetGitHubConfig retrieves the GitHub integration configuration. Returns nil if no config has been stored.
func (*KnowledgeStore) GetOnboardingProgress ¶
func (ks *KnowledgeStore) GetOnboardingProgress(ctx context.Context, sessionID string) (*OnboardingProgress, error)
GetOnboardingProgress returns a structured progress report for a session.
func (*KnowledgeStore) GetOnboardingSession ¶
func (ks *KnowledgeStore) GetOnboardingSession(ctx context.Context, sessionID string) (*OnboardingSession, error)
GetOnboardingSession retrieves a session by ID.
func (*KnowledgeStore) GetPullRequestByNumber ¶
func (ks *KnowledgeStore) GetPullRequestByNumber(ctx context.Context, number int) (*PullRequest, error)
GetPullRequestByNumber retrieves a pull request by its GitHub number.
func (*KnowledgeStore) GetSnapshot ¶
GetSnapshot retrieves a snapshot by ID.
func (*KnowledgeStore) GetWorkspace ¶
GetWorkspace retrieves a workspace by name (the user-facing identifier).
func (*KnowledgeStore) GetWorkspaceByID ¶
GetWorkspaceByID retrieves a workspace by ULID.
func (*KnowledgeStore) GetWorkspaceStatus ¶
func (ks *KnowledgeStore) GetWorkspaceStatus(ctx context.Context, workspaceName string) (*WorkspaceStatus, error)
GetWorkspaceStatus returns a full summary of a workspace's contents — its metadata, tracked files, tracked branches, linked decisions, linked notes, linked pull requests, and linked issues. Also computes item count and last activity timestamp.
func (*KnowledgeStore) InstallPlugin ¶
func (ks *KnowledgeStore) InstallPlugin(ctx context.Context, name, version, description, path, manifestJSON string) (*Plugin, error)
InstallPlugin registers a plugin in the database. The manifest JSON is stored so future migrations or compatibility checks can inspect it.
func (*KnowledgeStore) LinkDecision ¶
func (ks *KnowledgeStore) LinkDecision(ctx context.Context, params LinkDecisionParams) error
LinkDecision attaches a link (commit, file, or workspace) to a decision. Publishes a DecisionLinked event.
func (*KnowledgeStore) ListAllDecisions ¶
func (ks *KnowledgeStore) ListAllDecisions(ctx context.Context) ([]Decision, error)
ListAllDecisions returns all decisions with no limit.
func (*KnowledgeStore) ListDecisions ¶
func (ks *KnowledgeStore) ListDecisions(ctx context.Context, filter DecisionFilter) ([]Decision, error)
ListDecisions returns decisions matching the given filter, ordered by created_at descending. Default limit is 20 unless filter.All is true or filter.Limit is set.
func (*KnowledgeStore) ListIssues ¶
ListIssues returns all tracked issues, optionally filtered by workspace.
func (*KnowledgeStore) ListNotes ¶
func (ks *KnowledgeStore) ListNotes(ctx context.Context, filter NoteFilter) ([]Note, error)
ListNotes returns notes matching the given filter, ordered by created_at descending. Default limit is 20.
func (*KnowledgeStore) ListPlugins ¶
func (ks *KnowledgeStore) ListPlugins(ctx context.Context) ([]Plugin, error)
ListPlugins returns all installed plugins, ordered by name.
func (*KnowledgeStore) ListPullRequests ¶
func (ks *KnowledgeStore) ListPullRequests(ctx context.Context, workspaceID string) ([]PullRequest, error)
ListPullRequests returns all tracked pull requests, optionally filtered by workspace.
func (*KnowledgeStore) ListReviews ¶
ListReviews returns all reviews for a given PR number.
func (*KnowledgeStore) ListSnapshots ¶
ListSnapshots returns all snapshots ordered by creation time (most recent first).
func (*KnowledgeStore) ListUnwatchedItems ¶
func (ks *KnowledgeStore) ListUnwatchedItems(ctx context.Context, sessionID string) ([]OnboardingItem, error)
ListUnwatchedItems returns all onboarding items for a session that are not covered and not skipped.
func (*KnowledgeStore) ListWorkspaceBranches ¶
func (ks *KnowledgeStore) ListWorkspaceBranches(ctx context.Context, workspaceName string) ([]WorkspaceBranch, error)
ListWorkspaceBranches returns all branches tracked in a workspace.
func (*KnowledgeStore) ListWorkspaceCommits ¶
func (ks *KnowledgeStore) ListWorkspaceCommits(ctx context.Context, workspaceName string, limit int) ([]WorkspaceCommit, error)
ListWorkspaceCommits returns commits recorded for a workspace, ordered by created_at (link time) descending.
func (*KnowledgeStore) ListWorkspaceFiles ¶
func (ks *KnowledgeStore) ListWorkspaceFiles(ctx context.Context, workspaceName string) ([]WorkspaceFile, error)
ListWorkspaceFiles returns all files tracked in a workspace.
func (*KnowledgeStore) ListWorkspaces ¶
func (ks *KnowledgeStore) ListWorkspaces(ctx context.Context) ([]Workspace, error)
ListWorkspaces returns all workspaces, ordered by name.
func (*KnowledgeStore) MarkOnboardingItem ¶
func (ks *KnowledgeStore) MarkOnboardingItem(ctx context.Context, sessionID, itemType, itemTarget string) error
MarkOnboardingItem marks an item as covered. Publishes OnboardingItemCovered.
func (*KnowledgeStore) RemovePlugin ¶
func (ks *KnowledgeStore) RemovePlugin(ctx context.Context, name string) error
RemovePlugin uninstalls a plugin from the database.
func (*KnowledgeStore) RemoveWorkspaceBranch ¶
func (ks *KnowledgeStore) RemoveWorkspaceBranch(ctx context.Context, workspaceName, branchName string) error
RemoveWorkspaceBranch removes a branch from a workspace. Publishes WorkspaceItemRemoved.
func (*KnowledgeStore) RemoveWorkspaceFile ¶
func (ks *KnowledgeStore) RemoveWorkspaceFile(ctx context.Context, workspaceName, filePath string) error
RemoveWorkspaceFile removes a file path from a workspace. Publishes WorkspaceItemRemoved.
func (*KnowledgeStore) Search ¶
func (ks *KnowledgeStore) Search(ctx context.Context, params SearchParams) ([]SearchResult, error)
Search performs a full-text LIKE search across decisions (title, context, decision, alternatives, consequences) and notes (message). Returns results ordered by relevance (score) then recency.
func (*KnowledgeStore) SetGitHubConfig ¶
func (ks *KnowledgeStore) SetGitHubConfig(ctx context.Context, cfg GitHubConfig) error
SetGitHubConfig saves the GitHub integration configuration (upsert).
func (*KnowledgeStore) SkipOnboardingItem ¶
func (ks *KnowledgeStore) SkipOnboardingItem(ctx context.Context, sessionID, itemType, itemTarget string) error
SkipOnboardingItem marks an item as explicitly skipped.
func (*KnowledgeStore) StartOnboarding ¶
func (ks *KnowledgeStore) StartOnboarding(ctx context.Context, participant string) (*OnboardingSession, error)
StartOnboarding creates a new onboarding session (or resumes an active one for the same participant). Publishes OnboardingStarted.
In v0.4 this creates the session record and scans existing decisions and notes as onboarding items. File scanning is deferred to the CLI layer which has access to the Git adapter.
func (*KnowledgeStore) SupersedeDecision ¶
func (ks *KnowledgeStore) SupersedeDecision(ctx context.Context, oldID, newID string) error
SupersedeDecision marks oldID as superseded by newID. Both decisions must exist. Publishes a DecisionSuperseded event.
func (*KnowledgeStore) UpdateDecision ¶
func (ks *KnowledgeStore) UpdateDecision(ctx context.Context, id string, params UpdateDecisionParams) (*Decision, error)
UpdateDecision updates the mutable body fields of an existing decision. Only non-nil fields are applied. Publishes a DecisionUpdated event.
func (*KnowledgeStore) UpdateNoteCommitHash ¶
func (ks *KnowledgeStore) UpdateNoteCommitHash(ctx context.Context, id, commitHash string) error
UpdateNoteCommitHash sets the commit_hash field on an existing note without changing its ID or any other fields. Returns ErrNoteNotFound if the note does not exist.
func (*KnowledgeStore) UpdatePullRequestMerge ¶
func (ks *KnowledgeStore) UpdatePullRequestMerge(ctx context.Context, params UpdatePullRequestMergeParams) error
UpdatePullRequestMerge sets merge fields on a pull request after a merge.
func (*KnowledgeStore) UpdateWorkspace ¶
func (ks *KnowledgeStore) UpdateWorkspace(ctx context.Context, name string, params UpdateWorkspaceParams) (*Workspace, error)
UpdateWorkspace updates mutable fields of a workspace. Publishes WorkspaceUpdated.
func (*KnowledgeStore) UpdateWorkspaceLastCommit ¶
func (ks *KnowledgeStore) UpdateWorkspaceLastCommit(ctx context.Context, workspaceName, commitSHA string) error
UpdateWorkspaceLastCommit updates just the last_commit_sha and updated_at on a workspace without recording a workspace_commit entry. Used during event-driven updates from the Git adapter.
type LinkDecisionParams ¶
type LinkDecisionParams struct {
DecisionID string
LinkType string // "commit", "file", "workspace"
Target string
LineStart *int
LineEnd *int
Branch string
}
LinkDecisionParams holds the fields for linking a decision.
type Note ¶
type Note struct {
ID string `json:"id"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Message string `json:"message"`
WorkspaceID *string `json:"workspace_id,omitempty"`
Branch string `json:"branch,omitempty"`
CommitHash string `json:"commit_hash,omitempty"`
}
Note represents a freeform knowledge note.
type NoteFilter ¶
NoteFilter specifies how to filter notes.
type OnboardingItem ¶
type OnboardingItem struct {
ID string `json:"id"`
SessionID string `json:"session_id"`
ItemType string `json:"item_type"`
ItemTarget string `json:"item_target"`
CoveredAt *int64 `json:"covered_at,omitempty"`
Skipped bool `json:"skipped"`
}
OnboardingItem represents a single item (decision, note, file) in an onboarding session.
type OnboardingProgress ¶
type OnboardingProgress struct {
Session OnboardingSession `json:"session"`
ByType map[string]TypeProgress `json:"by_type"`
TotalItems int `json:"total_items"`
Covered int `json:"covered"`
Skipped int `json:"skipped"`
Remaining int `json:"remaining"`
}
OnboardingProgress summarises the scanning progress for a session.
type OnboardingSession ¶
type OnboardingSession struct {
ID string `json:"id"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Participant string `json:"participant"`
Status string `json:"status"` // active | completed | paused
}
OnboardingSession represents an onboarding session for a contributor.
type PRReview ¶
type PRReview struct {
ID string `json:"id"`
PRNumber int `json:"pr_number"`
Reviewer string `json:"reviewer"`
State string `json:"state"` // APPROVED, CHANGES_REQUESTED, COMMENTED
Body string `json:"body,omitempty"`
WorkspaceID string `json:"workspace_id,omitempty"`
SubmittedAt int64 `json:"submitted_at"`
}
PRReview represents a GitHub pull request review recorded in GOT.
type Plugin ¶
type Plugin struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description,omitempty"`
Path string `json:"path"`
Enabled bool `json:"enabled"`
ManifestJSON string `json:"manifest_json,omitempty"`
Manifest *PluginManifest `json:"manifest,omitempty"` // parsed from manifest_json on read
InstalledAt int64 `json:"installed_at"`
}
Plugin represents an installed plugin in the database.
type PluginManifest ¶
type PluginManifest struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
Events []string `json:"events,omitempty"`
Hooks map[string]string `json:"hooks,omitempty"` // event type -> command/script
Commands []PluginManifestCommand `json:"commands,omitempty"`
RequiresGotVersion string `json:"requires_got_version,omitempty"`
}
PluginManifest represents the contents of a plugin manifest.json file.
type PluginManifestCommand ¶
type PluginManifestCommand struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Executable string `json:"executable"` // relative path from plugin root, or "commands/<name>"
}
PluginManifestCommand describes a command the plugin exposes.
type PullRequest ¶
type PullRequest struct {
ID string `json:"id"`
Number int `json:"number"`
Title string `json:"title"`
State string `json:"state"` // open, closed, merged
Branch string `json:"branch"` // head branch
Base string `json:"base"` // target branch
URL string `json:"url,omitempty"`
WorkspaceID string `json:"workspace_id,omitempty"`
MergeCommitSHA string `json:"merge_commit_sha,omitempty"`
MergedAt int64 `json:"merged_at,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
PullRequest represents a GitHub pull request tracked in GOT.
type SearchParams ¶
type SearchParams struct {
Query string // search term
Type *string // "decision", "note", or nil for both
WorkspaceID *string // optional workspace filter
Limit int // 0 means default (20)
}
SearchParams specifies a full-text search across decisions and notes.
type SearchResult ¶
type SearchResult struct {
Type string `json:"type"` // "decision" or "note"
ID string `json:"id"`
Title string `json:"title"` // decision title or note message preview
Status string `json:"status,omitempty"` // decision status (empty for notes)
WorkspaceID *string `json:"workspace_id,omitempty"`
CreatedAt int64 `json:"created_at"`
Score int `json:"score"` // number of fields matched (crude relevance)
}
SearchResult is a single match returned by the Search method.
type Snapshot ¶
type Snapshot struct {
ID string `json:"id"`
CreatedAt int64 `json:"created_at"`
Reason string `json:"reason"`
Ref string `json:"ref"`
ReflogSel string `json:"reflog_sel,omitempty"`
StashRef string `json:"stash_ref,omitempty"`
Metadata string `json:"metadata,omitempty"`
}
Snapshot represents a recovery point before a destructive Git operation.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps an *sql.DB connection and provides migration support.
type TypeProgress ¶
type TypeProgress struct {
Total int `json:"total"`
Covered int `json:"covered"`
Skipped int `json:"skipped"`
Remaining int `json:"remaining"`
}
TypeProgress shows coverage counts for one item type.
type UpdateDecisionParams ¶
type UpdateDecisionParams struct {
Title *string // nil = don't update
Context *string
Decision *string
Alternatives *string
Consequences *string
WorkspaceID *string // empty string = clear, nil = don't update
}
UpdateDecisionParams holds the fields that can be updated on an existing decision.
type UpdatePullRequestMergeParams ¶
UpdatePullRequestMergeParams holds fields for updating a PR's merge state.
type UpdateWorkspaceParams ¶
type UpdateWorkspaceParams struct {
Name *string
Description *string
Status *string // active | archived
Tags []string // nil = no change, empty = clear
}
UpdateWorkspaceParams holds fields for updating a workspace.
type Workspace ¶
type Workspace struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Status string `json:"status"` // active | archived
Tags []string `json:"tags,omitempty"` // JSON array stored in DB
LastCommitSHA string `json:"last_commit_sha,omitempty"` // most recent commit SHA
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
Workspace represents a logical grouping of related artifacts.
type WorkspaceBranch ¶
type WorkspaceBranch struct {
ID string `json:"id"`
WorkspaceID string `json:"workspace_id"`
BranchName string `json:"branch_name"`
CreatedAt int64 `json:"created_at"`
}
WorkspaceBranch represents a branch tracked in a workspace.
type WorkspaceCommit ¶
type WorkspaceCommit struct {
ID string `json:"id"`
WorkspaceID string `json:"workspace_id"`
CommitSHA string `json:"commit_sha"`
BranchName string `json:"branch_name,omitempty"`
Message string `json:"message,omitempty"`
CreatedAt int64 `json:"created_at"`
}
WorkspaceCommit represents a commit recorded as activity in a workspace.
type WorkspaceFile ¶
type WorkspaceFile struct {
ID string `json:"id"`
WorkspaceID string `json:"workspace_id"`
Path string `json:"path"`
CreatedAt int64 `json:"created_at"`
}
WorkspaceFile represents a file tracked in a workspace.
type WorkspaceStatus ¶
type WorkspaceStatus struct {
Workspace Workspace `json:"workspace"`
Files []WorkspaceFile `json:"files"`
Branches []WorkspaceBranch `json:"branches"`
Decisions []Decision `json:"decisions"`
Notes []Note `json:"notes"`
Commits []WorkspaceCommit `json:"commits,omitempty"`
PullRequests []PullRequest `json:"pull_requests,omitempty"`
Issues []Issue `json:"issues,omitempty"`
ItemCount int `json:"item_count"`
LastActivity int64 `json:"last_activity"`
}
WorkspaceStatus holds a summary of a workspace's contents — metadata, tracked files, tracked branches, linked decisions, linked notes, linked commits, linked pull requests, linked issues, item count, and last activity timestamp.