Documentation
¶
Overview ¶
Package build orchestrates the coding agent integration.
Index ¶
- func AdvanceStep(db *store.DB, session *SessionState) error
- func LogActivity(specID, entry string) error
- func SaveSession(db *store.DB, session *SessionState) error
- func SessionDir(specID string) string
- func SetActivityDB(db *store.DB)
- func ToolDefinitions() []map[string]interface{}
- func WriteContextFile(ctx *BuildContext, outputPath string) error
- type BuildContext
- type Engine
- type MCPResource
- type MCPServer
- type MCPToolResult
- type PRStep
- type SessionState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdvanceStep ¶
func AdvanceStep(db *store.DB, session *SessionState) error
AdvanceStep marks the current step as complete and moves to the next.
func LogActivity ¶
LogActivity appends an entry to both the SQLite activity log and the session file.
func SaveSession ¶
func SaveSession(db *store.DB, session *SessionState) error
SaveSession persists a session to the database.
func SessionDir ¶
SessionDir returns the path to the session directory.
func SetActivityDB ¶
SetActivityDB sets the database used for activity logging.
func ToolDefinitions ¶
func ToolDefinitions() []map[string]interface{}
ToolDefinitions returns the MCP tool definitions for advertising.
func WriteContextFile ¶
func WriteContextFile(ctx *BuildContext, outputPath string) error
WriteContextFile writes a consolidated context markdown file for non-MCP agents.
Types ¶
type BuildContext ¶
type BuildContext struct {
SpecPath string
SpecContent string
PriorDiffs []string
FailingTests string
Conventions string
CurrentStep PRStep
SystemPrompt string
}
BuildContext is the assembled context payload passed to an agent.
func AssembleContext ¶
func AssembleContext(specPath string, session *SessionState, conventions string) (*BuildContext, error)
AssembleContext builds the full context payload for an agent.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine orchestrates the build process.
type MCPResource ¶
type MCPResource struct {
URI string `json:"uri"`
Name string `json:"name"`
Content string `json:"content"`
}
MCPResource represents a resource served by the MCP server.
type MCPServer ¶
type MCPServer struct {
// contains filtered or unexported fields
}
MCPServer serves spec context to MCP-compatible agents. This is a simplified implementation that handles the core resource/tool protocol.
func NewMCPServer ¶
func NewMCPServer(session *SessionState, buildCtx *BuildContext, db *store.DB, specPath string) *MCPServer
NewMCPServer creates a new MCP server for a build session.
func (*MCPServer) CallTool ¶
func (s *MCPServer) CallTool(name string, args json.RawMessage) (*MCPToolResult, error)
CallTool executes an MCP tool.
func (*MCPServer) GetResource ¶
func (s *MCPServer) GetResource(uri string) (*MCPResource, error)
GetResource returns a specific resource by URI.
func (*MCPServer) ListResources ¶
func (s *MCPServer) ListResources() []MCPResource
ListResources returns all available resources.
type MCPToolResult ¶
MCPToolResult represents the result of an MCP tool call.
type PRStep ¶
type PRStep struct {
Number int `yaml:"number" json:"number"`
Repo string `yaml:"repo" json:"repo"`
Description string `yaml:"description" json:"description"`
Branch string `yaml:"branch" json:"branch"`
Status string `yaml:"status" json:"status"` // "pending", "in-progress", "complete"
}
PRStep represents one step in the PR stack plan.
func ParsePRStack ¶
ParsePRStack extracts PR steps from the §7.3 PR Stack Plan section.
func ParsePRStackFromFile ¶
ParsePRStackFromFile reads a spec file and extracts PR steps.
type SessionState ¶
type SessionState struct {
SpecID string `json:"spec_id"`
CurrentStep int `json:"current_step"`
Branch string `json:"branch"`
Repo string `json:"repo"`
WorkDir string `json:"work_dir"`
LastActivity time.Time `json:"last_activity"`
Steps []PRStep `json:"steps"`
}
SessionState persists the build session for `spec do` resume.
func CreateSession ¶
func CreateSession(db *store.DB, specID string, steps []PRStep, workDir string) (*SessionState, error)
CreateSession creates a new build session.
func LoadSession ¶
func LoadSession(db *store.DB, specID string) (*SessionState, error)
LoadSession loads a session from the database.
func (*SessionState) CurrentPRStep ¶
func (s *SessionState) CurrentPRStep() *PRStep
CurrentPRStep returns the current step, or nil if complete.
func (*SessionState) IsComplete ¶
func (s *SessionState) IsComplete() bool
IsComplete returns true if all steps are done.