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
2 changes: 1 addition & 1 deletion internal/command/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ func resolveStartupMode(cfg *config.Config, unsafe bool) mode.SessionMode {
if cfg != nil && cfg.DefaultMode != "" {
return mode.Parse(cfg.DefaultMode)
}
if cfg != nil && cfg.AutoApprove {
if cfg != nil && cfg.AutoApprove { //nolint:staticcheck // intentional fallback to the deprecated field when DefaultMode is unset
return mode.Autopilot
}
return mode.Ask
Expand Down
2 changes: 1 addition & 1 deletion internal/command/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func HandleSSHConnect(
return // Do not initialize agent yet
}

remotePwd := "/root"
var remotePwd string
if path != "" {
remotePwd = path
} else {
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ type Config struct {
Team *TeamConfig `json:"team,omitempty"`

// AutoApprove sets the default approval mode to auto on startup.
//
// Deprecated: superseded by DefaultMode; still honored as a fallback when
// DefaultMode is empty (true → "autopilot").
AutoApprove bool `json:"auto_approve,omitempty"`
Expand Down
7 changes: 4 additions & 3 deletions internal/handler/acp.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,12 @@ func (h *ACPHandler) presentationForTool(name, argsJSON string) acpToolPresentat
p.Title = "Load skill " + getString("name")
case "team_send_message":
to := getString("to")
if to == "*" {
switch {
case to == "*":
p.Title = "Message team"
} else if to != "" {
case to != "":
p.Title = "Message @" + to
} else {
default:
p.Title = "Send team message"
}
case "team_create":
Expand Down
16 changes: 7 additions & 9 deletions internal/tools/goal.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,32 +169,30 @@ func (s *GoalStore) IsActive() bool {
return s.goal != nil && s.goal.Status == GoalActive
}

// setStatus transitions the goal to a terminal status. Returns the snapshot and
// whether a goal existed to update.
func (s *GoalStore) setStatus(status GoalStatus) (*Goal, bool) {
// setStatus transitions the goal to a terminal status. Returns whether a goal
// existed to update.
func (s *GoalStore) setStatus(status GoalStatus) bool {
s.mu.Lock()
if s.goal == nil {
s.mu.Unlock()
return nil, false
return false
}
s.goal.Status = status
s.goal.UpdatedAt = s.now()
snap := s.goal.clone()
s.mu.Unlock()
s.fireUpdate(snap)
return snap, true
return true
}

// Complete marks the goal complete. Returns false if no goal is set.
func (s *GoalStore) Complete() bool {
_, ok := s.setStatus(GoalComplete)
return ok
return s.setStatus(GoalComplete)
}

// Block marks the goal blocked. Returns false if no goal is set.
func (s *GoalStore) Block() bool {
_, ok := s.setStatus(GoalBlocked)
return ok
return s.setStatus(GoalBlocked)
}

// Clear removes the goal entirely.
Expand Down
3 changes: 2 additions & 1 deletion internal/tools/goal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package tools
import (
"context"
"encoding/json"
"github.com/cnjack/jcode/internal/session"
"strings"
"testing"

"github.com/cnjack/jcode/internal/session"
)

func TestGoalStore_SetAndGet(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/tui/tui.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func NewModel(hasPrompt bool, pwd string, todoStore *tools.TodoStore) Model {

if cfg, err := config.LoadConfig(); err == nil {
m.activeProvider, m.activeModel = cfg.GetProviderModel()
if cfg.AutoApprove {
if cfg.AutoApprove { //nolint:staticcheck // intentional fallback to the deprecated field when DefaultMode is unset
m.approvalMode = ModeAuto
}
}
Expand Down
Loading