Documentation
¶
Index ¶
- func FindTemplate(all []types.Template, query string) *types.Template
- func LoadTemplates(dir string) ([]types.Template, error)
- func ParseInto(raw string, v any) error
- func Play(enabled bool, event SoundEvent)
- type Agent
- type GitHub
- func (g *GitHub) AssignMe(ctx context.Context, number int) error
- func (g *GitHub) CheckAuth(ctx context.Context) error
- func (g *GitHub) Close(ctx context.Context, number int) error
- func (g *GitHub) Comment(ctx context.Context, number int, body string) error
- func (g *GitHub) Comments(ctx context.Context, number int) ([]types.Comment, error)
- func (g *GitHub) Create(ctx context.Context, draft types.Draft) (string, error)
- func (g *GitHub) EditIssue(ctx context.Context, number int, title, body string) error
- func (g *GitHub) List(ctx context.Context, state string, limit int) ([]types.Issue, error)
- func (g *GitHub) Reopen(ctx context.Context, number int) error
- func (g *GitHub) Unassign(ctx context.Context, number, _unused int) error
- func (g *GitHub) View(ctx context.Context, number int) (*types.Issue, error)
- type OllamaClient
- type SoundEvent
- type StreamDoneMsg
- type StreamErrMsg
- type TokenMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindTemplate ¶
FindTemplate returns the first template whose filename contains the query (case-insensitive, without extension). Empty query returns nil.
func LoadTemplates ¶
LoadTemplates reads every *.md file in dir and parses YAML frontmatter. Files without frontmatter are skipped silently.
func Play ¶
func Play(enabled bool, event SoundEvent)
Play emits an async terminal sound. It is a no-op when:
- enabled is false
- the platform has no supported sound command
- the sound binary is not found
Types ¶
type Agent ¶
type Agent struct {
O *OllamaClient
Template types.Template
Title string
Brief string
History []types.Turn
MaxTurns int
Debug bool
}
Agent runs the multi-turn issue-drafting conversation with Ollama. Ported from agent.sh lines 740–897.
type GitHub ¶
type GitHub struct {
Repo string
}
func (*GitHub) Create ¶
Create writes the body to a temp file and invokes `gh issue create`. Returns the URL of the new issue.
type OllamaClient ¶
func (*OllamaClient) GenerateJSON ¶
GenerateJSON calls Ollama with format:json and stream:false, returns the model's text response (which is expected to be a JSON blob).
func (*OllamaClient) Ping ¶
func (c *OllamaClient) Ping(ctx context.Context) error
Ping checks the /api/tags endpoint is reachable.
func (*OllamaClient) StreamCmd ¶
StreamCmd launches a goroutine that POSTs to /api/generate with stream:true and returns a tea.Cmd that delivers a single StreamDoneMsg / StreamErrMsg. Token chunks are pushed to the Program via the provided Send function.
Using a send-channel keeps the API aligned with Bubble Tea's (*Program).Send — callers hold a program reference and pass its Send.
type SoundEvent ¶
type SoundEvent int
const ( SoundTick SoundEvent = iota // AI finished a turn SoundDone // issue created SoundError // something went wrong )
type StreamDoneMsg ¶
type StreamDoneMsg struct {
Full string
}
StreamDoneMsg is emitted once Ollama finishes sending.
type StreamErrMsg ¶
type StreamErrMsg struct {
Err error
}
StreamErrMsg is emitted on any transport or decode error.