Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions components/backend/git/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,10 @@ type ProjectSettings struct {
RunnerSecret string
}

// DiffSummary holds summary counts from git status --porcelain
// DiffSummary holds summary counts from git diff --numstat
type DiffSummary struct {
Added int `json:"added"`
Modified int `json:"modified"`
Deleted int `json:"deleted"`
Renamed int `json:"renamed"`
Untracked int `json:"untracked"`
TotalAdded int `json:"total_added"`
TotalRemoved int `json:"total_removed"`
}

// getProjectSettings retrieves the ProjectSettings CR for a project using the provided dynamic client
Expand Down Expand Up @@ -703,19 +700,19 @@ func DiffRepo(ctx context.Context, repoDir string) (*DiffSummary, error) {
if added != "-" {
var n int
fmt.Sscanf(added, "%d", &n)
summary.Added += n
summary.TotalAdded += n
}
// Parse deletions
if removed != "-" {
var n int
fmt.Sscanf(removed, "%d", &n)
summary.Deleted += n
summary.TotalRemoved += n
}
}
}

log.Printf("gitDiffRepo: added=%d deleted=%d",
summary.Added, summary.Deleted)
log.Printf("gitDiffRepo: total_added=%d total_removed=%d",
summary.TotalAdded, summary.TotalRemoved)
return summary, nil
}

Expand Down
9 changes: 3 additions & 6 deletions components/backend/handlers/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,13 @@ func ContentGitDiff(c *gin.Context) {

summary, err := GitDiffRepo(c.Request.Context(), repoDir)
if err != nil {
c.JSON(http.StatusOK, gin.H{"added": 0, "modified": 0, "deleted": 0, "renamed": 0, "untracked": 0})
c.JSON(http.StatusOK, gin.H{"total_added": 0, "total_removed": 0})
return
}

c.JSON(http.StatusOK, gin.H{
"added": summary.Added,
"modified": summary.Modified,
"deleted": summary.Deleted,
"renamed": summary.Renamed,
"untracked": summary.Untracked,
"total_added": summary.TotalAdded,
"total_removed": summary.TotalRemoved,
})
}

Expand Down
17 changes: 10 additions & 7 deletions components/backend/handlers/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ func parseSpec(spec map[string]interface{}) types.AgenticSessionSpec {
result.Interactive = interactive
}

if autoPushOnComplete, ok := spec["autoPushOnComplete"].(bool); ok {
result.AutoPushOnComplete = autoPushOnComplete
}

if displayName, ok := spec["displayName"].(string); ok {
result.DisplayName = displayName
}
Expand Down Expand Up @@ -1610,10 +1606,17 @@ func DiffSessionRepo(c *gin.Context) {
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
c.JSON(http.StatusOK, gin.H{"added": 0, "modified": 0, "deleted": 0, "renamed": 0, "untracked": 0})
c.JSON(http.StatusOK, gin.H{
"files": gin.H{
"added": 0,
"removed": 0,
},
"total_added": 0,
"total_removed": 0,
})
return
}
defer resp.Body.Close()
b, _ := ioutil.ReadAll(resp.Body)
c.Data(resp.StatusCode, "application/json", b)
bodyBytes, _ := ioutil.ReadAll(resp.Body)
c.Data(resp.StatusCode, resp.Header.Get("Content-Type"), bodyBytes)
}
1 change: 0 additions & 1 deletion components/backend/types/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type AgenticSession struct {
type AgenticSessionSpec struct {
Prompt string `json:"prompt" binding:"required"`
Interactive bool `json:"interactive,omitempty"`
AutoPushOnComplete bool `json:"autoPushOnComplete,omitempty"`
DisplayName string `json:"displayName"`
LLMSettings LLMSettings `json:"llmSettings"`
Timeout int `json:"timeout"`
Expand Down