-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathTaskfile.yml
More file actions
379 lines (337 loc) · 9.93 KB
/
Taskfile.yml
File metadata and controls
379 lines (337 loc) · 9.93 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# https://taskfile.dev
version: '3'
includes:
wails:
taskfile: ./Taskfile.wails.yml
flatten: true
windows-cli:
taskfile: ./Taskfile.windows.yml
linux-cli:
taskfile: ./Taskfile.linux.yml
docker:
taskfile: ./Taskfile.docker.yml
vars:
VERSION: ""
BUILD_DIR: build
DIST_DIR: build/dist
PORT: 12580
BIN_NAME: "tingly-box"
BIN_DIR: "bin"
# Submodule versions (format: "name:branch/tag/commit")
# Example: "openai-go:tingly-dev-v3.32.0"
OPENAI_GO_VERSION: "tingly-dev-v3.37.0"
ANTHROPIC_SDK_GO_VERSION: "tingly-dev-v1.45.0"
GO_GENAI_VERSION: "upstream-v1.58.0"
tasks:
build:
aliases:
- cli:build
cmds:
- task: web:dist
- task: go:build
dev:
aliases:
- cli:dev
cmds:
- task: web:dist
- task: start
e2e:
cmds:
- go build ./... && go test -v ./internal/protocol/transform -run TestE2E
start:
aliases:
- http
cmds:
- go run ./cli/tingly-box --verbose start --debug --port 12580 --browser=false
restart:
cmds:
- go run ./cli/tingly-box --verbose restart --debug --port 12580 --browser=false
record:
cmds:
- go run ./cli/tingly-box --verbose start --port 12580 --record-mode=scenario --debug --browser=false
swagger:
aliases:
- openapi
cmds:
- |
# Generate OpenAPI v3 schema directly without starting the server
go run ./cli/tingly-box swagger
codegen:
cmds:
- |
cd frontend
pnpm install
pnpm gen:api
go:build:
env:
ARCH:
OS:
cmds:
- |
# Get build info
VERSION="dev"
GIT_COMMIT="$(git rev-parse HEAD 2>/dev/null || echo 'unknown')"
BUILD_TIME="$(date -u '+%Y-%m-%d-%H-%M-%S' 2>/dev/null || echo 'unknown')"
GO_VERSION="$(go env GOVERSION 2>/dev/null || echo 'unknown')"
PLATFORM="${OS}/${ARCH}"
# Determine binary extension based on OS
BINARY_EXT=""
if [ "{{.OS}}" = "windows" ]; then
BINARY_EXT=".exe"
fi
# Set CGO_ENABLED: 1 for all platform
CGO_ENABLED=1
# Build with ldflags
mkdir -p build
LDFLAGS="-X main.version=${VERSION} -X main.gitCommit=${GIT_COMMIT} -X main.buildTime=${BUILD_TIME} -X main.goVersion=${GO_VERSION} -X main.platform=${PLATFORM}"
GOOS={{.OS}} GOARCH={{.ARCH}} go build -ldflags="${LDFLAGS}" -o ./build/{{.BIN_NAME}} ./cli/tingly-box
CGO_ENABLED=${CGO_ENABLED} GOOS={{.OS}} GOARCH={{.ARCH}} go build -ldflags="${LDFLAGS}" -o ./build/{{.BIN_NAME}}${BINARY_EXT} ./cli/tingly-box
go:test:
cmds:
- |
go test ./internal/...
tests:interface:
summary: Run Python interface tests (test_automation)
cmds:
- |
python -m tests.test_automation
mcp:web-tools:
summary: Run local MCP stdio server exposing mcp_web_search/mcp_web_fetch tools
cmds:
- |
python3 ./scripts/mcp_web_tools.py
web:
aliases:
- web:dev
cmds:
- |
echo "This is only for frontend dev, please start your tingly-box server too"
- |
cd frontend;
pnpm install
- |
cd frontend;
pnpm dev
web:mock:
cmds:
- |
echo "This is only for frontend dev, please start your tingly-box server too"
- |
cd frontend;
pnpm install
- |
cd frontend;
pnpm dev:mock
web:build:
aliases:
- web:dist
cmds:
- task: codegen
- |
cd frontend;
if [ "$CI" = "true" ]; then
pnpm install --no-frozen-lockfile;
else
pnpm install;
fi;
pnpm build
- |
mkdir -p internal/web/dist/
cp -R frontend/dist/* internal/web/dist/
web:build:dev:
cmds:
- task: codegen
- |
cd frontend;
if [ "$CI" = "true" ]; then
pnpm install --no-frozen-lockfile;
else
pnpm install;
fi;
pnpm build:dev
- |
mkdir -p internal/web/dist/
cp -R frontend/dist/* internal/web/dist/
check:zig:
summary: Check if zig is installed
cmds:
- |
if ! command -v zig &> /dev/null; then
echo "Error: zig not found!"
echo ""
echo "To install zig:"
echo " macOS: brew install zig"
echo " Or download from: https://ziglang.org/download/"
echo ""
exit 1
fi
echo "Found: $(zig version)"
# remote-coder Service tasks
remote-coder:run:
summary: Run remote-coder service via tingly-box rc
env:
RCC_PORT: "18080"
RCC_SESSION_TIMEOUT: "30m"
cmds:
- |
go run ./cli/tingly-box rc
remote-coder:test:
summary: Run tests for remote-coder service
cmds:
- |
go test ./internal/remote_coder/... -v
remote-coder-token:build:
summary: Build the remote-coder-token binary
cmds:
- |
# Determine binary extension based on OS
BINARY_EXT=""
if [ "$(go env GOOS)" = "windows" ]; then
BINARY_EXT=".exe"
fi
go build -o ./bin/remote-coder-token${BINARY_EXT} ./cmd/remote-coder
remote-coder-token:run:
summary: Generate an API token (run via SSH)
cmds:
- go run ./cmd/remote-coder
submodule:
summary: Show git HEAD and branch for each submodule in libs/
cmds:
- |
for dir in libs/*/; do
if [ -d "$dir" ]; then
name=$(basename "$dir")
cd "$dir"
head=$(git rev-parse HEAD 2>/dev/null || echo "N/A")
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "N/A")
echo "$name:"
echo " HEAD: $head"
echo " Branch: $branch"
echo ""
cd - > /dev/null
fi
done
submodule:sync:
summary: Sync and update all submodules to their remote branches
cmds:
- |
git submodule sync
git submodule update --remote
- |
for dir in libs/*/; do
if [ -d "$dir" ]; then
name=$(basename "$dir")
cd "$dir"
git --no-pager log -n 3
cd - > /dev/null
fi
done
submodule:update:
summary: Update submodules to versions specified in Taskfile.yml variables
cmds:
- |
echo "Updating openai-go to {{.OPENAI_GO_VERSION}}..."
cd libs/openai-go
git fetch origin
git checkout {{.OPENAI_GO_VERSION}}
cd - > /dev/null
- |
echo "Updating anthropic-sdk-go to {{.ANTHROPIC_SDK_GO_VERSION}}..."
cd libs/anthropic-sdk-go
git fetch origin
git checkout {{.ANTHROPIC_SDK_GO_VERSION}}
cd - > /dev/null
- |
echo "Updating go-genai to {{.GO_GENAI_VERSION}}..."
cd libs/go-genai
git fetch origin
git checkout {{.GO_GENAI_VERSION}}
cd - > /dev/null
- |
echo "Updating .gitmodules with new branch versions..."
# Update each submodule's branch in .gitmodules
python3 << 'EOF'
import re
with open('.gitmodules', 'r') as f:
content = f.read()
# Update openai-go branch
content = re.sub(
r'(\[submodule "libs/openai-go"\]\s+path = libs/openai-go\s+url = [^\n]+\s+)branch = "[^"]+"',
r'\1branch = "{{.OPENAI_GO_VERSION}}"',
content
)
# Update anthropic-sdk-go branch
content = re.sub(
r'(\[submodule "libs/anthropic-sdk-go"\]\s+path = libs/anthropic-sdk-go\s+url = [^\n]+\s+)branch = "[^"]+"',
r'\1branch = "{{.ANTHROPIC_SDK_GO_VERSION}}"',
content
)
# Update go-genai branch
content = re.sub(
r'(\[submodule "libs/go-genai"\]\s+path = libs/go-genai\s+url = [^\n]+\s+)branch = "[^"]+"',
r'\1branch = "{{.GO_GENAI_VERSION}}"',
content
)
with open('.gitmodules', 'w') as f:
f.write(content)
print(".gitmodules updated successfully")
EOF
- task: submodule
submodule:openai-go:
summary: Update openai-go submodule to a specific version (branch/tag/commit)
cmds:
- |
cd libs/openai-go
git fetch origin
git checkout {{.CLI_ARGS}}
cd - > /dev/null
- |
echo "openai-go updated to:"
cd libs/openai-go
git --no-pager log -n 1
cd - > /dev/null
submodule:anthropic-sdk-go:
summary: Update anthropic-sdk-go submodule to a specific version (branch/tag/commit)
cmds:
- |
cd libs/anthropic-sdk-go
git fetch origin
git checkout {{.CLI_ARGS}}
cd - > /dev/null
- |
echo "anthropic-sdk-go updated to:"
cd libs/anthropic-sdk-go
git --no-pager log -n 1
cd - > /dev/null
submodule:go-genai:
summary: Update go-genai submodule to a specific version (branch/tag/commit)
cmds:
- |
cd libs/go-genai
git fetch origin
git checkout {{.CLI_ARGS}}
cd - > /dev/null
- |
echo "go-genai updated to:"
cd libs/go-genai
git --no-pager log -n 1
cd - > /dev/null
changelog:
cmds:
- |
# Find the latest release tag (excluding alpha, beta, rc, pre, etc. suffixes)
LATEST_RELEASE_TAG=$(git tag -l "v*[0-9]" | grep -v -e 'alpha' -e 'beta' -e 'rc' -e 'pre' -e 'snapshot' | sort -V | tail -n 1)
# If no tag is found, use HEAD~10 as default value
if [ -z "$LATEST_RELEASE_TAG" ]; then
echo "Warning: No release tag found, showing last 10 commits"
git --no-pager log -10 --pretty=format:"%h - %s (%an, %ar)" --graph
else
echo "Latest release tag: $LATEST_RELEASE_TAG"
echo ""
echo "Commits since $LATEST_RELEASE_TAG:"
git --no-pager log ${LATEST_RELEASE_TAG}..HEAD --pretty=format:"%h - %s (%an, %ar)" --graph
fi
harness:matrix:
cmds:
- |
go run ./cli/harness matrix