-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathTaskfile.yml
More file actions
232 lines (199 loc) · 5.68 KB
/
Taskfile.yml
File metadata and controls
232 lines (199 loc) · 5.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
version: '3'
vars:
BINARY_NAME: cco
VERSION: 0.3.0
BUILD_DIR: build
MODULE_PATH: github.com/Davincible/claude-code-open
env:
CGO_ENABLED: 0
tasks:
default:
desc: Run format, test, and build
cmds:
- task: fmt
- task: test
- task: build
build:
desc: Build the binary
cmds:
- go build -ldflags="-s -w -X '{{.MODULE_PATH}}/cmd.Version={{.VERSION}}'" -o {{.BINARY_NAME}} .
generates:
- "{{.BINARY_NAME}}"
build-all:
desc: Build binaries for all platforms
deps: [clean]
cmds:
- mkdir -p {{.BUILD_DIR}}
- task: build-linux-amd64
- task: build-linux-arm64
- task: build-darwin-amd64
- task: build-darwin-arm64
- task: build-windows-amd64
build-linux-amd64:
internal: true
env:
GOOS: linux
GOARCH: amd64
cmds:
- go build -ldflags="-s -w -X '{{.MODULE_PATH}}/cmd.Version={{.VERSION}}'" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-linux-amd64 .
build-linux-arm64:
internal: true
env:
GOOS: linux
GOARCH: arm64
cmds:
- go build -ldflags="-s -w -X '{{.MODULE_PATH}}/cmd.Version={{.VERSION}}'" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-linux-arm64 .
build-darwin-amd64:
internal: true
env:
GOOS: darwin
GOARCH: amd64
cmds:
- go build -ldflags="-s -w -X '{{.MODULE_PATH}}/cmd.Version={{.VERSION}}'" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-darwin-amd64 .
build-darwin-arm64:
internal: true
env:
GOOS: darwin
GOARCH: arm64
cmds:
- go build -ldflags="-s -w -X '{{.MODULE_PATH}}/cmd.Version={{.VERSION}}'" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-darwin-arm64 .
build-windows-amd64:
internal: true
env:
GOOS: windows
GOARCH: amd64
cmds:
- go build -ldflags="-s -w -X '{{.MODULE_PATH}}/cmd.Version={{.VERSION}}'" -o {{.BUILD_DIR}}/{{.BINARY_NAME}}-windows-amd64.exe .
test:
desc: Run tests
cmds:
- go test -v ./...
test-coverage:
desc: Run tests with coverage
cmds:
- go test -coverprofile=coverage.out ./...
- go tool cover -html=coverage.out -o coverage.html
- echo 'Coverage report generated{{":"}} coverage.html'
fmt:
desc: Format code
cmds:
- gofmt -s -w .
lint:
desc: Run linter (requires golangci-lint)
cmds:
- |
if ! command -v golangci-lint &> /dev/null; then
echo "golangci-lint not installed"
exit 1
fi
- golangci-lint run
clean:
desc: Clean build artifacts
cmds:
- go clean
- rm -f {{.BINARY_NAME}}
- rm -rf {{.BUILD_DIR}}
- rm -f coverage.out coverage.html
deps:
desc: Download and tidy dependencies
cmds:
- go mod download
- go mod tidy
install:
desc: Install binary to system
deps: [build]
cmds:
- sudo cp {{.BINARY_NAME}} /usr/local/bin/{{.BINARY_NAME}}
- echo '{{.BINARY_NAME}} installed to /usr/local/bin'
uninstall:
desc: Remove binary from system
cmds:
- sudo rm -f /usr/local/bin/{{.BINARY_NAME}}
- echo '{{.BINARY_NAME}} removed from /usr/local/bin'
dev:
desc: Run in development mode with auto-reload
cmds:
- |
if ! command -v air &> /dev/null; then
echo "Installing air..."
go install github.com/cosmtrek/air@latest
fi
- echo "Starting development server with hot reload..."
- echo "The server will start automatically and reload on code changes"
- air
docker-build:
desc: Build Docker image
cmds:
- docker build -t claude-code-open{{":"}}{{.VERSION}} .
- docker tag claude-code-open{{":"}}{{.VERSION}} claude-code-open{{":"}}latest
docker-run:
desc: Run Docker container
cmds:
- docker run --rm -p 6970{{":"}}6970 -v ~/.claude-code-open{{":"}}/root/.claude-code-open claude-code-open{{":"}}latest
release:
desc: Create release build
deps: [clean, fmt, test, build-all]
cmds:
- echo 'Release {{.VERSION}} built successfully'
- echo 'Binaries available in {{.BUILD_DIR}}/'
start:
desc: Start the service
deps: [build]
cmds:
- ./{{.BINARY_NAME}} start
stop:
desc: Stop the service
cmds:
- ./{{.BINARY_NAME}} stop
status:
desc: Check service status
cmds:
- ./{{.BINARY_NAME}} status
config-generate:
desc: Generate example configuration
deps: [build]
cmds:
- ./{{.BINARY_NAME}} config generate
config-validate:
desc: Validate configuration
deps: [build]
cmds:
- ./{{.BINARY_NAME}} config validate
benchmark:
desc: Run benchmarks
cmds:
- go test -bench=. -benchmem ./...
security:
desc: Run security audit (requires gosec)
cmds:
- |
if ! command -v gosec &> /dev/null; then
echo "Installing gosec..."
go install github.com/securecodewarrior/gosec/v2/cmd/gosec@latest
fi
- gosec ./...
mod-update:
desc: Update all dependencies
cmds:
- go get -u ./...
- go mod tidy
docs:
desc: Generate documentation (requires godoc)
cmds:
- |
if ! command -v godoc &> /dev/null; then
echo "Installing godoc..."
go install golang.org/x/tools/cmd/godoc@latest
fi
- echo "Starting godoc server at http{{":"}}//localhost{{":"}}6060"
- godoc -http={{":"}}6060
profile:
desc: Build with profiling enabled
cmds:
- go build -ldflags="-s -w -X '{{.MODULE_PATH}}/cmd.Version={{.VERSION}}'" -tags profile -o {{.BINARY_NAME}}-profile .
- echo 'Profile-enabled binary built{{":"}} {{.BINARY_NAME}}-profile'
check:
desc: Run comprehensive checks
deps: [fmt, lint, test, security]
cmds:
- echo 'All checks passed!'