diff --git a/internal/command/interactive.go b/internal/command/interactive.go index 89d9759..79e0cfd 100644 --- a/internal/command/interactive.go +++ b/internal/command/interactive.go @@ -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 diff --git a/internal/command/ssh.go b/internal/command/ssh.go index 9fd6795..dd2dec7 100644 --- a/internal/command/ssh.go +++ b/internal/command/ssh.go @@ -53,7 +53,7 @@ func HandleSSHConnect( return // Do not initialize agent yet } - remotePwd := "/root" + var remotePwd string if path != "" { remotePwd = path } else { diff --git a/internal/config/config.go b/internal/config/config.go index 9735968..a94f296 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -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"` diff --git a/internal/handler/acp.go b/internal/handler/acp.go index 75de6c2..97aac42 100644 --- a/internal/handler/acp.go +++ b/internal/handler/acp.go @@ -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": diff --git a/internal/tools/goal.go b/internal/tools/goal.go index ba58c95..1df66ab 100644 --- a/internal/tools/goal.go +++ b/internal/tools/goal.go @@ -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. diff --git a/internal/tools/goal_test.go b/internal/tools/goal_test.go index 3ab93d0..6e64479 100644 --- a/internal/tools/goal_test.go +++ b/internal/tools/goal_test.go @@ -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) { diff --git a/internal/tui/tui.go b/internal/tui/tui.go index 2909d15..7ff2510 100644 --- a/internal/tui/tui.go +++ b/internal/tui/tui.go @@ -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 } }