-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTaskfile.yml
More file actions
190 lines (170 loc) · 5.47 KB
/
Copy pathTaskfile.yml
File metadata and controls
190 lines (170 loc) · 5.47 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
version: "3"
vars:
ROOT: "{{.TASKFILE_DIR}}"
GO_DIR: "{{.ROOT}}"
SWIFT_DIR: "{{.ROOT}}/swift"
BUILD_DIR: "{{.ROOT}}/build"
PROTO_DIR: "{{.ROOT}}/proto"
# Output binaries
GO_BIN: "{{.GO_DIR}}/tingly-cu"
SWIFT_BIN_DEBUG: "{{.SWIFT_DIR}}/.build/debug/tingly-cu-native"
SWIFT_BIN_RELEASE: "{{.SWIFT_DIR}}/.build/release/tingly-cu-native"
# Distribution directory: self-contained release binaries that MCP clients
# can point at directly. Both binaries sit side-by-side so the Go wrapper
# auto-discovers the native bridge (no TINGLY_CU_NATIVE env needed).
DIST_DIR: "{{.ROOT}}/dist"
DIST_GO_BIN: "{{.DIST_DIR}}/tingly-cu"
DIST_SWIFT_BIN: "{{.DIST_DIR}}/tingly-cu-native"
# Socket path for local dev — evaluated at runtime via shell expansion
SOCKET:
sh: echo "/tmp/tingly-cu-$(id -u).sock"
tasks:
# ---------------------------------------------------------------------------
# Default: show available tasks
# ---------------------------------------------------------------------------
default:
silent: true
cmds:
- task --list
# ---------------------------------------------------------------------------
# Build
# ---------------------------------------------------------------------------
build:
desc: "Build everything (Swift debug + Go)"
deps: [build:swift, build:go]
build:release:
desc: "Build everything in release mode"
deps: [build:swift:release, build:go]
release:
desc: "Build release binaries into ./dist (point MCP clients at dist/tingly-cu)"
deps: [build:release]
cmds:
- mkdir -p "{{.DIST_DIR}}"
- cp -f "{{.SWIFT_BIN_RELEASE}}" "{{.DIST_SWIFT_BIN}}"
- cp -f "{{.GO_BIN}}" "{{.DIST_GO_BIN}}"
- |
echo
echo "Release binaries ready:"
echo " {{.DIST_GO_BIN}}"
echo " {{.DIST_SWIFT_BIN}}"
echo
echo "MCP client config:"
echo " command: {{.DIST_GO_BIN}}"
echo " args: [\"mcp\"]"
sources:
- "{{.GO_BIN}}"
- "{{.SWIFT_BIN_RELEASE}}"
generates:
- "{{.DIST_GO_BIN}}"
- "{{.DIST_SWIFT_BIN}}"
build:swift:
desc: "Build Swift native layer (debug)"
dir: "{{.SWIFT_DIR}}"
cmds:
- swift build --product tingly-cu-native
sources:
- "{{.SWIFT_DIR}}/Sources/**/*.swift"
- "{{.SWIFT_DIR}}/Package.swift"
generates:
- "{{.SWIFT_BIN_DEBUG}}"
build:swift:release:
desc: "Build Swift native layer (release)"
dir: "{{.SWIFT_DIR}}"
cmds:
- swift build --product tingly-cu-native -c release
sources:
- "{{.SWIFT_DIR}}/Sources/**/*.swift"
- "{{.SWIFT_DIR}}/Package.swift"
generates:
- "{{.SWIFT_BIN_RELEASE}}"
build:go:
desc: "Build Go MCP wrapper"
dir: "{{.GO_DIR}}"
env:
GOWORK: "off"
cmds:
- go build -o tingly-cu ./cmd/tingly-cu
sources:
- "{{.GO_DIR}}/**/*.go"
- "{{.GO_DIR}}/go.mod"
generates:
- "{{.GO_BIN}}"
# ---------------------------------------------------------------------------
# Proto codegen
# ---------------------------------------------------------------------------
gen:
desc: "Regenerate Go + Swift code from proto (requires protoc + plugins)"
cmds:
- bash "{{.BUILD_DIR}}/gen-proto.sh"
# ---------------------------------------------------------------------------
# Run
# ---------------------------------------------------------------------------
mcp:
desc: "Start the Go MCP stdio server (launches Swift server automatically)"
deps: [build]
env:
TINGLY_CU_NATIVE: "{{.SWIFT_BIN_DEBUG}}"
cmds:
- kill $(pgrep tingly-cu-native) 2>/dev/null || true
- rm -f "{{.SOCKET}}"
- "{{.GO_BIN}} mcp"
doctor:
desc: "Check macOS permissions (Accessibility + Screen Recording)"
deps: [build]
env:
TINGLY_CU_NATIVE: "{{.SWIFT_BIN_DEBUG}}"
cmds:
- kill $(pgrep tingly-cu-native) 2>/dev/null || true
- rm -f "{{.SOCKET}}"
- "{{.GO_BIN}} doctor"
list-app:
desc: "List all running apps"
deps: [build]
env:
TINGLY_CU_NATIVE: "{{.SWIFT_BIN_DEBUG}}"
cmds:
- kill $(pgrep tingly-cu-native) 2>/dev/null || true
- rm -f "{{.SOCKET}}"
- "{{.GO_BIN}} ls-apps"
ax:
desc: "Dump accessibility tree of an app (e.g. task ax -- Safari)"
deps: [build]
env:
TINGLY_CU_NATIVE: "{{.SWIFT_BIN_DEBUG}}"
cmds:
- kill $(pgrep tingly-cu-native) 2>/dev/null || true
- rm -f "{{.SOCKET}}"
- "{{.GO_BIN}} ax {{.CLI_ARGS}}"
snap:
desc: "Screenshot an app window to snap.png (e.g. task snap -- Safari)"
deps: [build]
env:
TINGLY_CU_NATIVE: "{{.SWIFT_BIN_DEBUG}}"
cmds:
- kill $(pgrep tingly-cu-native) 2>/dev/null || true
- rm -f "{{.SOCKET}}"
- "{{.GO_BIN}} snap {{.CLI_ARGS}}"
serve:
desc: "Start the Swift gRPC native server on Unix socket"
deps: [build:swift]
cmds:
- kill $(pgrep tingly-cu-native) 2>/dev/null || true
- rm -f "{{.SOCKET}}"
- "{{.SWIFT_BIN_DEBUG}} serve --socket {{.SOCKET}}"
# ---------------------------------------------------------------------------
# Dev helpers
# ---------------------------------------------------------------------------
clean:
desc: "Remove build artifacts"
cmds:
- rm -rf "{{.SWIFT_DIR}}/.build"
- rm -f "{{.GO_BIN}}"
- rm -rf "{{.DIST_DIR}}"
- rm -f "{{.SOCKET}}"
tidy:
desc: "Run go mod tidy"
dir: "{{.GO_DIR}}"
env:
GOWORK: "off"
cmds:
- go mod tidy