Skip to content

Commit fdc8785

Browse files
committed
fix: resolve lint errors (ireturn, revive, unused)
- Add //nolint:ireturn for interface-returning methods required by bubbletea.Model and review types.Process/AgentReviewer contracts - Rename AgentForTranscriptPath → ForTranscriptPath to fix revive stutter - Wire newTrailWatchCmd into trail subcommand group - Add //nolint:unused for platform-specific state_lock_unix.go
1 parent fe93eb5 commit fdc8785

12 files changed

Lines changed: 19 additions & 16 deletions

File tree

cmd/trace/cli/agent/registry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ func Detect(ctx context.Context) (Agent, error) {
101101
return detected[0], nil
102102
}
103103

104-
// AgentForTranscriptPath returns the registered agent whose session directory
104+
// ForTranscriptPath returns the registered agent whose session directory
105105
// contains transcriptPath. Returns (nil, false) if no agent matches.
106-
func AgentForTranscriptPath(transcriptPath, repoPath string) (Agent, bool) {
106+
func ForTranscriptPath(transcriptPath, repoPath string) (Agent, bool) {
107107
if transcriptPath == "" {
108108
return nil, false
109109
}

cmd/trace/cli/recap_tui.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (m recapTUIModel) fetch(requestID int) tea.Cmd {
104104
}
105105
}
106106

107-
func (m recapTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
107+
func (m recapTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { //nolint:ireturn // required by bubbletea.Model interface
108108
switch msg := msg.(type) {
109109
case recapDataMsg:
110110
if msg.requestID != m.requestID {

cmd/trace/cli/review/cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ type perAgentConfiguredReviewer struct {
724724
}
725725

726726
func (r *perAgentConfiguredReviewer) Name() string { return r.inner.Name() }
727-
func (r *perAgentConfiguredReviewer) Start(ctx context.Context, _ reviewtypes.RunConfig) (reviewtypes.Process, error) {
727+
func (r *perAgentConfiguredReviewer) Start(ctx context.Context, _ reviewtypes.RunConfig) (reviewtypes.Process, error) { //nolint:ireturn // required by reviewtypes.AgentReviewer interface
728728
return r.inner.Start(ctx, r.cfg) //nolint:wrapcheck // transparent adapter; callers see inner's error type directly
729729
}
730730

cmd/trace/cli/review/cmd_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ type stubDispatchReviewer struct {
369369
}
370370

371371
func (r *stubDispatchReviewer) Name() string { return r.name }
372-
func (r *stubDispatchReviewer) Start(context.Context, reviewtypes.RunConfig) (reviewtypes.Process, error) {
372+
func (r *stubDispatchReviewer) Start(context.Context, reviewtypes.RunConfig) (reviewtypes.Process, error) { //nolint:ireturn // test stub implementing reviewtypes.AgentReviewer
373373
return &stubDispatchProcess{}, nil
374374
}
375375

@@ -396,7 +396,7 @@ type captureRunConfigReviewer struct {
396396
}
397397

398398
func (r *captureRunConfigReviewer) Name() string { return r.name }
399-
func (r *captureRunConfigReviewer) Start(_ context.Context, cfg reviewtypes.RunConfig) (reviewtypes.Process, error) {
399+
func (r *captureRunConfigReviewer) Start(_ context.Context, cfg reviewtypes.RunConfig) (reviewtypes.Process, error) { //nolint:ireturn // test stub implementing reviewtypes.AgentReviewer
400400
r.called = true
401401
r.got = cfg
402402
return &stubDispatchProcess{}, nil

cmd/trace/cli/review/run_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type stubReviewer struct {
1717
}
1818

1919
func (s *stubReviewer) Name() string { return s.name }
20-
func (s *stubReviewer) Start(_ context.Context, _ reviewtypes.RunConfig) (reviewtypes.Process, error) {
20+
func (s *stubReviewer) Start(_ context.Context, _ reviewtypes.RunConfig) (reviewtypes.Process, error) { //nolint:ireturn // test stub implementing reviewtypes.AgentReviewer
2121
if s.startErr != nil {
2222
return nil, s.startErr
2323
}
@@ -159,7 +159,7 @@ type funcReviewer struct {
159159
}
160160

161161
func (r *funcReviewer) Name() string { return r.name }
162-
func (r *funcReviewer) Start(_ context.Context, _ reviewtypes.RunConfig) (reviewtypes.Process, error) {
162+
func (r *funcReviewer) Start(_ context.Context, _ reviewtypes.RunConfig) (reviewtypes.Process, error) { //nolint:ireturn // test stub implementing reviewtypes.AgentReviewer
163163
return r.process, nil
164164
}
165165

cmd/trace/cli/review/tui_model.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func (m reviewTUIModel) Init() tea.Cmd {
108108
}
109109

110110
// Update handles all incoming messages.
111-
func (m reviewTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
111+
func (m reviewTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { //nolint:ireturn // required by bubbletea.Model interface
112112
switch msg := msg.(type) {
113113
case agentEventMsg:
114114
return m.handleAgentEvent(msg)
@@ -166,7 +166,7 @@ func (m reviewTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
166166
}
167167

168168
// handleAgentEvent processes an agentEventMsg, updating the relevant row.
169-
func (m reviewTUIModel) handleAgentEvent(msg agentEventMsg) (tea.Model, tea.Cmd) {
169+
func (m reviewTUIModel) handleAgentEvent(msg agentEventMsg) (tea.Model, tea.Cmd) { //nolint:ireturn // returns bubbletea.Model for Update dispatch
170170
idx, ok := m.rowIdx[msg.agent]
171171
if !ok {
172172
return m, nil
@@ -229,7 +229,7 @@ func (m reviewTUIModel) handleAgentEvent(msg agentEventMsg) (tea.Model, tea.Cmd)
229229
}
230230

231231
// handleKey processes keyboard input.
232-
func (m reviewTUIModel) handleKey(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) {
232+
func (m reviewTUIModel) handleKey(msg tea.KeyPressMsg) (tea.Model, tea.Cmd) { //nolint:ireturn // returns bubbletea.Model for Update dispatch
233233
// Any key after finished dismisses.
234234
if m.finished {
235235
return m, tea.Quit

cmd/trace/cli/review/types/template.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (t *ReviewerTemplate) Name() string { return t.AgentName }
5555
// with a typed error is friendlier than a downstream nil deref — and it
5656
// keeps Start from panicking inside a multi-agent fan-out (CU8) where one
5757
// misconfigured template would otherwise kill the whole run.
58-
func (t *ReviewerTemplate) Start(ctx context.Context, cfg RunConfig) (Process, error) {
58+
func (t *ReviewerTemplate) Start(ctx context.Context, cfg RunConfig) (Process, error) { //nolint:ireturn // required by AgentReviewer interface
5959
if t.AgentName == "" {
6060
return nil, fmt.Errorf("ReviewerTemplate.Start: %w (empty AgentName)", ErrTemplateMisconfigured)
6161
}

cmd/trace/cli/review_bridge.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func logProviderResolutionOutput(ctx context.Context, buf *bytes.Buffer) {
118118
// copilot-cli). This lives in the cli package to avoid the import cycle:
119119
//
120120
// review/cmd.go → claudecode/codex/geminicli → review
121-
func launchableReviewerFor(agentName string) reviewtypes.AgentReviewer {
121+
func launchableReviewerFor(agentName string) reviewtypes.AgentReviewer { //nolint:ireturn // returns concrete types behind reviewtypes.AgentReviewer interface
122122
switch agentName {
123123
case string(agent.AgentNameClaudeCode):
124124
return claudecode.NewReviewer()

cmd/trace/cli/strategy/agent_resolution_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
"github.com/GrayCodeAI/trace/cmd/trace/cli/agent"
1010

11-
// Register agents so AgentForTranscriptPath can resolve them.
11+
// Register agents so agent.ForTranscriptPath can resolve them.
1212
_ "github.com/GrayCodeAI/trace/cmd/trace/cli/agent/claudecode"
1313
_ "github.com/GrayCodeAI/trace/cmd/trace/cli/agent/cursor"
1414

cmd/trace/cli/strategy/manual_commit_hooks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2974,7 +2974,7 @@ func (s *ManualCommitStrategy) carryForwardToNewShadowBranch(
29742974
// session ID.
29752975
func resolveSessionAgentType(ctx context.Context, sessionID string, callerAgentType types.AgentType, transcriptPath string) types.AgentType {
29762976
if repoRoot, err := paths.WorktreeRoot(ctx); err == nil && transcriptPath != "" {
2977-
if owner, ok := agent.AgentForTranscriptPath(transcriptPath, repoRoot); ok {
2977+
if owner, ok := agent.ForTranscriptPath(transcriptPath, repoRoot); ok {
29782978
return owner.Type()
29792979
}
29802980
}
@@ -2995,7 +2995,7 @@ func correctSessionAgentType(ctx context.Context, currentType types.AgentType, t
29952995
if err != nil {
29962996
return currentType, false
29972997
}
2998-
owner, ok := agent.AgentForTranscriptPath(transcriptPath, repoRoot)
2998+
owner, ok := agent.ForTranscriptPath(transcriptPath, repoRoot)
29992999
if !ok {
30003000
return currentType, false
30013001
}

0 commit comments

Comments
 (0)