• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

valksor / kvelmo / 23471163553

24 Mar 2026 02:51AM UTC coverage: 49.867% (-1.4%) from 51.3%
23471163553

push

github

k0d3r1s
Update project config and gap analysis commands

Update CLAUDE.md with new CLI commands and package descriptions. Revise
AGENTS.md with current architecture guidance. Add CodeRabbit config
rule. Update lefthook pre-commit hook. Refresh all gap analysis
commands with current feature inventory.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

811 of 1374 branches covered (59.02%)

Branch coverage included in aggregate %.

22001 of 44372 relevant lines covered (49.58%)

0.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.72
/pkg/socket/worktree_queue.go
1
package socket
2

3
import (
4
        "context"
5
        "encoding/json"
6
        "time"
7

8
        "github.com/valksor/kvelmo/pkg/page"
9
        "github.com/valksor/kvelmo/pkg/storage"
10
)
11

12
// --- Queue Handlers ---
13

14
type queueAddParams struct {
15
        Source string `json:"source"`
16
        Title  string `json:"title"`
17
}
18

19
func (w *WorktreeSocket) handleQueueAdd(ctx context.Context, req *Request) (*Response, error) {
1✔
20
        if w.conductor == nil {
2✔
21
                return NewErrorResponse(req.ID, ErrCodeInternal, "no conductor"), nil
1✔
22
        }
1✔
23

24
        var params queueAddParams
1✔
25
        if err := json.Unmarshal(req.Params, &params); err != nil {
2✔
26
                return NewErrorResponse(req.ID, ErrCodeInvalidParams, "invalid params"), nil //nolint:nilerr // JSON-RPC error response
1✔
27
        }
1✔
28

29
        if params.Source == "" {
2✔
30
                return NewErrorResponse(req.ID, ErrCodeInvalidParams, "source is required"), nil
1✔
31
        }
1✔
32

33
        task, err := w.conductor.QueueTask(params.Source, params.Title)
1✔
34
        if err != nil {
1✔
35
                return NewErrorResponse(req.ID, ErrCodeInternal, err.Error()), nil
×
36
        }
×
37

38
        return NewResultResponse(req.ID, task)
1✔
39
}
40

41
type queueRemoveParams struct {
42
        ID string `json:"id"`
43
}
44

45
func (w *WorktreeSocket) handleQueueRemove(ctx context.Context, req *Request) (*Response, error) {
1✔
46
        if w.conductor == nil {
2✔
47
                return NewErrorResponse(req.ID, ErrCodeInternal, "no conductor"), nil
1✔
48
        }
1✔
49

50
        var params queueRemoveParams
1✔
51
        if err := json.Unmarshal(req.Params, &params); err != nil {
2✔
52
                return NewErrorResponse(req.ID, ErrCodeInvalidParams, "invalid params"), nil //nolint:nilerr // JSON-RPC error response
1✔
53
        }
1✔
54

55
        if params.ID == "" {
2✔
56
                return NewErrorResponse(req.ID, ErrCodeInvalidParams, "id is required"), nil
1✔
57
        }
1✔
58

59
        if err := w.conductor.DequeueTask(params.ID); err != nil {
2✔
60
                return NewErrorResponse(req.ID, ErrCodeInternal, err.Error()), nil
1✔
61
        }
1✔
62

63
        return NewResultResponse(req.ID, map[string]any{"success": true})
×
64
}
65

66
func (w *WorktreeSocket) handleQueueList(ctx context.Context, req *Request) (*Response, error) {
1✔
67
        if w.conductor == nil {
2✔
68
                return NewErrorResponse(req.ID, ErrCodeInternal, "no conductor"), nil
1✔
69
        }
1✔
70

71
        var params struct {
1✔
72
                Page    int `json:"page,omitempty"`
1✔
73
                PerPage int `json:"per_page,omitempty"`
1✔
74
        }
1✔
75
        if req.Params != nil {
1✔
76
                _ = json.Unmarshal(req.Params, &params)
×
77
        }
×
78

79
        queue := w.conductor.ListQueue()
1✔
80
        pg := page.NewPage(queue, paginationWithDefault(params.Page, params.PerPage))
1✔
81

1✔
82
        return NewResultResponse(req.ID, map[string]any{
1✔
83
                "queue":    pg.Items,
1✔
84
                "total":    pg.Total,
1✔
85
                "page":     pg.PageNum,
1✔
86
                "per_page": pg.PerPage,
1✔
87
                "has_next": pg.HasNext,
1✔
88
        })
1✔
89
}
90

91
type queueReorderParams struct {
92
        ID       string `json:"id"`
93
        Position int    `json:"position"`
94
}
95

96
func (w *WorktreeSocket) handleQueueReorder(ctx context.Context, req *Request) (*Response, error) {
1✔
97
        if w.conductor == nil {
2✔
98
                return NewErrorResponse(req.ID, ErrCodeInternal, "no conductor"), nil
1✔
99
        }
1✔
100

101
        var params queueReorderParams
1✔
102
        if err := json.Unmarshal(req.Params, &params); err != nil {
2✔
103
                return NewErrorResponse(req.ID, ErrCodeInvalidParams, "invalid params"), nil //nolint:nilerr // JSON-RPC error response
1✔
104
        }
1✔
105

106
        if params.ID == "" {
2✔
107
                return NewErrorResponse(req.ID, ErrCodeInvalidParams, "id is required"), nil
1✔
108
        }
1✔
109

110
        if params.Position < 1 {
2✔
111
                return NewErrorResponse(req.ID, ErrCodeInvalidParams, "position must be >= 1"), nil
1✔
112
        }
1✔
113

114
        if err := w.conductor.ReorderQueue(params.ID, params.Position); err != nil {
×
115
                return NewErrorResponse(req.ID, ErrCodeInternal, err.Error()), nil
×
116
        }
×
117

118
        // Return updated queue
119
        queue := w.conductor.ListQueue()
×
120

×
121
        return NewResultResponse(req.ID, map[string]any{
×
122
                "queue": queue,
×
123
                "count": len(queue),
×
124
        })
×
125
}
126

127
// --- Task History Handler ---
128

129
func (w *WorktreeSocket) handleTaskHistory(ctx context.Context, req *Request) (*Response, error) {
1✔
130
        if w.conductor == nil {
2✔
131
                return NewErrorResponse(req.ID, ErrCodeInternal, "no conductor"), nil
1✔
132
        }
1✔
133

134
        tasks, err := w.conductor.TaskHistory()
1✔
135
        if err != nil {
1✔
136
                return NewErrorResponse(req.ID, ErrCodeInternal, err.Error()), nil
×
137
        }
×
138

139
        return NewResultResponse(req.ID, map[string]any{
1✔
140
                "tasks": tasks,
1✔
141
                "count": len(tasks),
1✔
142
        })
1✔
143
}
144

145
// --- Task Search Handler ---
146

147
type taskSearchParams struct {
148
        Query string `json:"query,omitempty"`
149
        Tag   string `json:"tag,omitempty"`
150
        Since string `json:"since,omitempty"`
151
        Until string `json:"until,omitempty"`
152
        State string `json:"state,omitempty"`
153
        Limit int    `json:"limit,omitempty"`
154
}
155

156
func (w *WorktreeSocket) handleTaskSearch(ctx context.Context, req *Request) (*Response, error) {
×
157
        if w.conductor == nil {
×
158
                return NewErrorResponse(req.ID, ErrCodeInternal, "no conductor"), nil
×
159
        }
×
160

161
        var params taskSearchParams
×
162
        if req.Params != nil {
×
163
                if err := json.Unmarshal(req.Params, &params); err != nil {
×
164
                        return NewErrorResponse(req.ID, ErrCodeInvalidParams, "invalid params"), nil //nolint:nilerr // JSON-RPC error response
×
165
                }
×
166
        }
167

168
        opts := storage.SearchOptions{
×
169
                Query: params.Query,
×
170
                Tag:   params.Tag,
×
171
                State: params.State,
×
172
                Limit: params.Limit,
×
173
        }
×
174

×
175
        if params.Since != "" {
×
176
                t, err := time.Parse(time.RFC3339, params.Since)
×
177
                if err != nil {
×
178
                        return NewErrorResponse(req.ID, ErrCodeInvalidParams, "invalid since: expected RFC3339"), nil //nolint:nilerr // JSON-RPC error response
×
179
                }
×
180
                opts.Since = t
×
181
        }
182

183
        if params.Until != "" {
×
184
                t, err := time.Parse(time.RFC3339, params.Until)
×
185
                if err != nil {
×
186
                        return NewErrorResponse(req.ID, ErrCodeInvalidParams, "invalid until: expected RFC3339"), nil //nolint:nilerr // JSON-RPC error response
×
187
                }
×
188
                opts.Until = t
×
189
        }
190

191
        tasks, err := w.conductor.SearchTaskHistory(opts)
×
192
        if err != nil {
×
193
                return NewErrorResponse(req.ID, ErrCodeInternal, err.Error()), nil
×
194
        }
×
195

196
        return NewResultResponse(req.ID, map[string]any{
×
197
                "tasks": tasks,
×
198
                "count": len(tasks),
×
199
        })
×
200
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc