Skip to content

Commit caf77d3

Browse files
committed
ci: fix CI failures from previous push
- ci.yml: ./tok filter → ./tok compress (the 'filter' subcommand does not exist) - quality.yml fmt + imports jobs: exclude .gomodcache/.gocache/.gosrccache/vendor from the scan. The CI runner was populating .gomodcache inside the workdir, so gofmt and goimports were flagging every file in the Go module cache - .gitignore: add .gomodcache/, .gocache/, .gosrccache/ - gofmt -s -w across internal/, cmd/, test/ — fixes mostly tabular struct alignment in pre-existing files. No logic changes Tests: 49/49 packages pass with -count=1.
1 parent 8e9fb06 commit caf77d3

32 files changed

Lines changed: 256 additions & 153 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ jobs:
157157
run: |
158158
./tok --version
159159
./tok --help
160-
echo "test content" | ./tok filter
160+
echo "test content" | ./tok compress

.github/workflows/quality.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ jobs:
117117

118118
- name: Check formatting
119119
run: |
120-
if [ -n "$(gofmt -l .)" ]; then
120+
# Exclude vendored / cache dirs — these aren't ours to reformat.
121+
files=$(gofmt -l . 2>/dev/null | grep -v -E '^(\.gomodcache|\.gocache|\.gosrccache|vendor)/' || true)
122+
if [ -n "$files" ]; then
121123
echo "❌ The following files need formatting:"
122-
gofmt -l .
124+
echo "$files"
123125
exit 1
124126
fi
125127
echo "✅ All files are properly formatted"
@@ -139,9 +141,10 @@ jobs:
139141
- name: Check imports
140142
run: |
141143
go install golang.org/x/tools/cmd/goimports@latest
142-
if [ -n "$(goimports -l .)" ]; then
144+
files=$(goimports -l . 2>/dev/null | grep -v -E '^(\.gomodcache|\.gocache|\.gosrccache|vendor)/' || true)
145+
if [ -n "$files" ]; then
143146
echo "❌ The following files have import issues:"
144-
goimports -l .
147+
echo "$files"
145148
exit 1
146149
fi
147150
echo "✅ All imports are properly organized"

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,8 @@ coverage.out
6060
config/local.toml
6161
.env
6262
.env.local
63+
64+
# Go build/mod caches
65+
.gomodcache/
66+
.gocache/
67+
.gosrccache/

cmd/tok/main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
// (for terminal/tool output) into a single CLI tool.
55
//
66
// Usage:
7-
// tok <command> [args]
7+
//
8+
// tok <command> [args]
89
//
910
// Examples:
10-
// tok compress -mode ultra -input "text to compress"
11-
// tok git status
12-
// tok doctor
11+
//
12+
// tok compress -mode ultra -input "text to compress"
13+
// tok git status
14+
// tok doctor
1315
package main
1416

1517
import (

internal/app/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const version = "0.1.0"
1313

1414
// App represents the tok application.
1515
type App struct {
16-
inputHandler *input.Handler
17-
outputHandler *output.Handler
16+
inputHandler *input.Handler
17+
outputHandler *output.Handler
1818
unifiedHandler *unified.Handler
1919
}
2020

internal/cache/multilevel.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010

1111
// MultiLevelCache implements L1 (memory) + L2 (disk) + L3 (optional Redis) caching
1212
type MultiLevelCache struct {
13-
l1 map[string]string // In-memory LRU
14-
l2Dir string // Disk cache directory
15-
mu sync.RWMutex
13+
l1 map[string]string // In-memory LRU
14+
l2Dir string // Disk cache directory
15+
mu sync.RWMutex
1616
maxL1 int
1717
}
1818

@@ -35,7 +35,7 @@ func (mc *MultiLevelCache) Get(key string) (string, bool) {
3535
return val, true
3636
}
3737
mc.mu.RUnlock()
38-
38+
3939
// L2: Disk
4040
hash := hashKey(key)
4141
path := filepath.Join(mc.l2Dir, hash)
@@ -45,7 +45,7 @@ func (mc *MultiLevelCache) Get(key string) (string, bool) {
4545
mc.promoteToL1(key, val)
4646
return val, true
4747
}
48-
48+
4949
return "", false
5050
}
5151

@@ -61,7 +61,7 @@ func (mc *MultiLevelCache) Set(key, value string) {
6161
}
6262
mc.l1[key] = value
6363
mc.mu.Unlock()
64-
64+
6565
// L2: Disk
6666
hash := hashKey(key)
6767
path := filepath.Join(mc.l2Dir, hash)

internal/commands/core/compress_memory_cmd.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -256,24 +256,24 @@ func compressFull(text string) string {
256256
}
257257

258258
redundant := map[string]string{
259-
"in order to": "to",
260-
"due to the fact that": "because",
259+
"in order to": "to",
260+
"due to the fact that": "because",
261261
"at this point in time": "now",
262-
"for the purpose of": "for",
263-
"in the event that": "if",
264-
"with regard to": "about",
265-
"with respect to": "about",
266-
"on the basis of": "by",
267-
"as a result of": "from",
268-
"in relation to": "to",
269-
"prior to": "before",
270-
"subsequent to": "after",
271-
"in addition to": "plus",
272-
"has the ability to": "can",
273-
"is able to": "can",
274-
"there is": "",
275-
"there are": "",
276-
"it is": "",
262+
"for the purpose of": "for",
263+
"in the event that": "if",
264+
"with regard to": "about",
265+
"with respect to": "about",
266+
"on the basis of": "by",
267+
"as a result of": "from",
268+
"in relation to": "to",
269+
"prior to": "before",
270+
"subsequent to": "after",
271+
"in addition to": "plus",
272+
"has the ability to": "can",
273+
"is able to": "can",
274+
"there is": "",
275+
"there are": "",
276+
"it is": "",
277277
}
278278
for k, v := range redundant {
279279
text = caseInsensitiveReplace(text, k, v)
@@ -287,12 +287,12 @@ func compressUltra(text string) string {
287287
text = compressFull(text)
288288

289289
ultraReplacements := map[string]string{
290-
"configuration": "config",
290+
"configuration": "config",
291291
"implementation": "impl",
292-
"documentation": "docs",
293-
"development": "dev",
294-
"environment": "env",
295-
"application": "app",
292+
"documentation": "docs",
293+
"development": "dev",
294+
"environment": "env",
295+
"application": "app",
296296
"authentication": "auth",
297297
"authorization": "authz",
298298
"information": "info",

internal/commands/core/init.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,19 @@ type AgentInfo struct {
102102

103103
// agentNameMap maps CLI agent names to AgentInfo names
104104
var agentNameMap = map[string]string{
105-
"claude-code": "Claude Code",
106-
"claude": "Claude Code",
107-
"copilot": "GitHub Copilot",
108-
"cursor": "Cursor",
109-
"windsurf": "Windsurf",
110-
"cline": "Cline",
111-
"roo-code": "Cline",
112-
"codex": "Codex",
113-
"gemini": "Gemini CLI",
114-
"kilocode": "Kilo Code",
115-
"antigravity": "Google Antigravity",
116-
"opencode": "OpenCode",
117-
"openclaw": "OpenClaw",
105+
"claude-code": "Claude Code",
106+
"claude": "Claude Code",
107+
"copilot": "GitHub Copilot",
108+
"cursor": "Cursor",
109+
"windsurf": "Windsurf",
110+
"cline": "Cline",
111+
"roo-code": "Cline",
112+
"codex": "Codex",
113+
"gemini": "Gemini CLI",
114+
"kilocode": "Kilo Code",
115+
"antigravity": "Google Antigravity",
116+
"opencode": "OpenCode",
117+
"openclaw": "OpenClaw",
118118
}
119119

120120
// SupportedAgents lists all supported agent names

internal/commands/core/learn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package core
33
import (
44
"encoding/json"
55
"fmt"
6-
"io/fs"
76
out "github.com/lakshmanpatel/tok/internal/output"
7+
"io/fs"
88
"os"
99
"path/filepath"
1010
"strings"

internal/commands/core/review_diff_cmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
var reviewDiffCmd = &cobra.Command{
1717
Use: "review-diff",
1818
Short: "Emit caveman-style one-line review comments for a diff",
19-
Long: `Scan a unified diff (or `+"`git diff`"+` output) and emit one-line
19+
Long: `Scan a unified diff (or ` + "`git diff`" + ` output) and emit one-line
2020
review comments with the form:
2121
2222
<file>:<line> <severity> <problem>. <fix>.

0 commit comments

Comments
 (0)