initial commit

yessss

feat: add Vikunja issues provider and integrate tasks retrieval

Co-authored-by: aider (openai/qwen2.5-coder:32b-instruct-q4_0) <aider@aider.chat>

feat: add Vikunja handler to main file

Co-authored-by: aider (openai/qwen2.5-coder:32b-instruct-q4_0) <aider@aider.chat>

refactor: Move Jira user from positional arg to flag parameter

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

fix: replace manual argument parsing with Go flags package

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

feat: replace positional arguments with flags in main function

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

fix: enforce mandatory start/end dates and at least one identifier flag

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

fix: only call relevant tools based on flag presence

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

feat: add vikunja task support to summarize function

feat: add flag to pass custom prompt with default prompt as fallback

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

Minor fix

fix: comment out vikunja tasks integration for now

fix: check for OpenAI environment variables before calling Summarize

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

feat: add timestamped prompt file generation for summarization

refactor: remove duplicate os.Getenv calls for OpenAI env vars in SummarizeData

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

refactor: pass OpenAI env vars from main to SummarizeData instead of calling os.Getenv inside the function

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

feat: add file prompt support with fallback to literal prompt string

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

fix: remove single quotes around JIRA user assignee and add debug printing

feat: implement accountID lookup for Jira user search in GetIssues function

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

fix: remove debug print statement in Jira user search function

fix: Replace user parameter with JIRA_USER environment variable in SetBasicAuth calls

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

fix: add missing os import in summarize.go

refactor: split SummarizeData into buildPrompt and callSummarizationEndpoint functions

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

fix: always call SummarizeData to ensure prompt file is created for debugging, but only call OpenAI endpoint if env vars are set

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

refactor: extract callSummarizationEndpoint into Summarizer interface for multiple implementations

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

refactor: move OpenAI variable checks into OpenAISummarizer's Summarize method and always call the summarizer's method

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

feat: implement Ollama Summarizer using official SDK as per article example

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

refactor: simplify OpenAI and Ollama summarizer implementations

refactor: simplify Summarizer interface by moving endpoint, token, and model to struct properties

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

feat: add Ollama summarizer support to main command

fix: remove extraneous parameters from SummarizeData call and use properly initialized OllamaSummarizer

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

feat: add AnthropicSummarizer implementation using anthropic-sdk-go package

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

fix: change summarizer call condition to check if summarizer is nil instead of environment variables

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

fix: correct client reference and update Anthropic summarizer implementation

feat: extract PR rendering to String() method using text/template

Co-authored-by: aider (openai/qwen3-coder:30b-a3b-q4_K_M) <aider@aider.chat>

Some cleanup
This commit is contained in:
Olivier Tremblay 2025-09-13 08:40:40 -04:00
commit a2c8207998
9 changed files with 726 additions and 0 deletions

113
contributions/gh.go Normal file
View file

@ -0,0 +1,113 @@
package contributions
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"strings"
"text/template"
)
var ghc = http.Client{}
var gh_token = os.Getenv("GH_TOKEN")
type SearchResponse struct {
Items []PRResp
}
type PRResp struct {
Body string
Title string
HtmlUrl string `json:"html_url"`
ClosedAt string `json:"closed_at"`
RepositoryUrl string `json:"repository_url"`
}
type PullRequest struct {
Body string
Title string
ClosedAt string
URL string
}
var prtmpl = template.Must(template.New("pr").Parse(`- Title: {{.Title}}
Body: {{.Body}}
`))
// String returns a formatted string representation of the PullRequest
func (pr PullRequest) String() string {
var buf bytes.Buffer
err := prtmpl.Execute(&buf, pr)
if err != nil {
return "" // Return empty string on error
}
return buf.String()
}
type PRMap map[string][]PullRequest
var prlisttmpl = template.Must(template.New("prlist").Parse(`{{range $k, $v := .}}
{{$k}}:
{{$v}}
{{end}}`))
func (p PRMap) String() string {
var buf bytes.Buffer
err := prlisttmpl.Execute(&buf, p)
if err != nil {
return "" // Return empty string on error
}
return buf.String()
}
func GetPRs(org, username string, from string, to string) (PRMap, error) {
req, err := http.NewRequest(
http.MethodGet,
fmt.Sprintf(
"https://api.github.com/search/issues?q=type:pr+org:%s+author:%s+is:closed+merged:%s..%s",
org,
username,
from,
to,
),
nil)
if err != nil {
return nil, fmt.Errorf("error making request: %w", err)
}
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", gh_token))
resp, err := ghc.Do(req)
if err != nil {
return nil, fmt.Errorf("error talking to github: %w", err)
}
if resp.StatusCode > 400 {
b := bytes.NewBuffer(nil)
io.Copy(b, resp.Body)
return nil, fmt.Errorf("error talking to github: %s", b.String())
}
r := &SearchResponse{}
dec := json.NewDecoder(resp.Body)
err = dec.Decode(&r)
if err != nil {
return nil, fmt.Errorf("error decoding response: %w", err)
}
allthings := PRMap{}
for _, pr := range r.Items {
reponameparts := strings.Split(pr.RepositoryUrl, "/")
reponame := reponameparts[len(reponameparts)-1]
if prs, ok := allthings[reponame]; !ok {
allthings[reponame] = []PullRequest{{pr.Body, pr.Title, pr.ClosedAt, pr.HtmlUrl}}
} else {
allthings[reponame] = append(prs, PullRequest{pr.Body, pr.Title, pr.ClosedAt, pr.HtmlUrl})
}
}
return allthings, nil
}