adding top_n_files
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
"github.com/joho/godotenv"
|
||||
"mindforge.cronjob/internal/agent"
|
||||
@@ -27,6 +28,14 @@ func main() {
|
||||
// Initialize services
|
||||
gitService := git.NewGitService()
|
||||
|
||||
// Resolve how many top files to return (TOP_N_FILES env var, default 10)
|
||||
topN := 10
|
||||
if v := os.Getenv("TOP_N_FILES"); v != "" {
|
||||
if n, err := strconv.Atoi(v); err == nil && n > 0 {
|
||||
topN = n
|
||||
}
|
||||
}
|
||||
|
||||
// Get modifications
|
||||
var modifications map[string]string
|
||||
error := gitService.FetchContents(gitRepo)
|
||||
@@ -34,7 +43,15 @@ func main() {
|
||||
log.Println("ERROR: Failed to fetch contents:", error)
|
||||
}
|
||||
|
||||
modifications, error = gitService.GetModifications(7)
|
||||
// Resolve how many days to look back (LAST_N_DAYS env var, default 7)
|
||||
days := 7
|
||||
if v := os.Getenv("LAST_N_DAYS"); v != "" {
|
||||
if n, err := strconv.Atoi(v); err == nil && n > 0 {
|
||||
days = n
|
||||
}
|
||||
}
|
||||
|
||||
modifications, error = gitService.GetModifications(days, topN)
|
||||
if error != nil {
|
||||
log.Println("ERROR: Failed to get modifications:", error)
|
||||
}
|
||||
@@ -42,7 +59,7 @@ func main() {
|
||||
fmt.Printf("Found %d modifications\n", len(modifications))
|
||||
|
||||
for file, content := range modifications {
|
||||
fmt.Printf("File: %s\n", file)
|
||||
fmt.Printf("Processing file: %s\n", file)
|
||||
|
||||
raw_summary, err := agent.SummaryCreatorAgent(file, content)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user