Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
271 lines (229 loc) · 8.58 KB
/
Copy pathTaskfile.yml
File metadata and controls
271 lines (229 loc) · 8.58 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
version: '3'
tasks:
default:
desc: List all available tasks
silent: true
cmds:
- task --list
# CLI (rsk)
cli:build:
desc: Build the rsk CLI binary to bin/rsk
sources:
- "cmd/rsk/**/*.go"
- "internal/**/*.go"
- go.mod
generates:
- bin/rsk
cmds:
- go build -o bin/rsk ./cmd/rsk
cli:run:
desc: "Run the rsk CLI — pass args after -- (e.g. task cli:run -- init)"
cmds:
- go run ./cmd/rsk {{.CLI_ARGS}}
cli:tag:
desc: "Tag and push a CLI release — triggers the Release CLI workflow (e.g. task cli:tag VERSION=0.1.0)"
requires:
vars: [VERSION]
vars:
TAG: v{{.VERSION}}
cmds:
- platforms: [windows]
cmd: pwsh -NoProfile -Command "if ('{{.VERSION}}' -notmatch '^\d+\.\d+\.\d+$') { Write-Error 'Invalid version {{.VERSION}} — expected X.Y.Z'; exit 1 }"
- platforms: [linux, darwin]
cmd: echo '{{.VERSION}}' | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$' || { echo "Invalid version {{.VERSION}} — expected X.Y.Z"; exit 1; }
- git tag -m "{{.TAG}}" {{.TAG}}
- git push origin {{.TAG}}
cli:lint:
desc: Lint the rsk CLI
cmds:
- golangci-lint run --config .golangci.yml ./cmd/rsk/... ./internal/...
cli:fmt:
desc: Format the rsk CLI (goimports + golines)
cmds:
- golangci-lint fmt --config .golangci.yml ./cmd/rsk/... ./internal/...
# cmd/count-tokens
tokens:
desc: Re-generate docs/TOKEN_COUNTS.md with latest SKILL.md byte/token estimates
sources:
- skills/**/SKILL.md
- cmd/count-tokens/**/*.go
generates:
- docs/TOKEN_COUNTS.md
cmds:
- go run ./cmd/count-tokens
tokens:lint:
desc: Lint the count-tokens tool
cmds:
- golangci-lint run --config .golangci.yml ./cmd/count-tokens/...
tokens:fmt:
desc: Format the count-tokens tool (goimports + golines)
cmds:
- golangci-lint fmt --config .golangci.yml ./cmd/count-tokens/...
# cmd/generate-registry
registry:generate:
desc: "Build registry tarballs and updated index.json into dist/ (merges against registry/index.json)"
sources:
- skills/**/*.md
- cmd/generate-registry/**/*.go
generates:
- dist/index.json
- dist/new-versions.json
cmds:
- mkdir -p dist registry
- go run ./cmd/generate-registry --skills-dir skills --output-dir dist --existing-index registry/index.json {{.CLI_ARGS}}
registry:check:
desc: "Preview what would be published; validate version format and show current → new for each skill"
cmds:
- mkdir -p registry
- go run ./cmd/generate-registry --skills-dir skills --existing-index registry/index.json --check
registry:sync-index:
desc: "Copy dist/index.json → registry/index.json (run after registry:generate; commit the result to bootstrap or repair the index)"
cmds:
- task: registry:generate
- platforms: [windows]
cmd: pwsh -NoProfile -Command "Copy-Item dist/index.json registry/index.json -Force"
- platforms: [linux, darwin]
cmd: cp dist/index.json registry/index.json
- echo ""
- echo "registry/index.json updated. Commit it:"
- echo " git add registry/index.json"
registry:lint:
desc: Lint the generate-registry tool
cmds:
- golangci-lint run --config .golangci.yml ./cmd/generate-registry/...
registry:fmt:
desc: Format the generate-registry tool
cmds:
- golangci-lint fmt --config .golangci.yml ./cmd/generate-registry/...
registry:clean:
desc: Remove the dist/ output directory
cmds:
- platforms: [windows]
cmd: pwsh -NoProfile -Command "Remove-Item -Recurse -Force dist -ErrorAction SilentlyContinue"
- platforms: [linux, darwin]
cmd: rm -rf dist
registry:remove:
desc: >-
Remove a skill, a version, or a version range from registry/index.json
and delete the matching GitHub tags/releases (e.g.
task registry:remove -- --skill NAME [--version X.Y.Z | --min X.Y.Z --max X.Y.Z] [--dry-run]).
Always run with --dry-run first.
cmds:
- go run ./cmd/registry-remove {{.CLI_ARGS}}
registry:remove:lint:
desc: Lint the registry-remove tool
cmds:
- golangci-lint run --config .golangci.yml ./cmd/registry-remove/...
registry:remove:fmt:
desc: Format the registry-remove tool
cmds:
- golangci-lint fmt --config .golangci.yml ./cmd/registry-remove/...
# aggregate
lint:
desc: Lint everything
cmds:
- golangci-lint run --config .golangci.yml ./...
deadcode:
desc: Report functions unreachable from any main or test
cmd: deadcode -test ./...
deadcode:check:
desc: Fail if any Go function is unreachable from any main or test (CI gate)
cmds:
- |
set -e
out=$(deadcode -test ./...)
if [ -n "$out" ]; then
printf '%s\n' "$out"
echo "deadcode: unreachable function(s) found" >&2
exit 1
fi
lint:doccheck:
desc: "Check exported doc-comment coverage (revive exported & package-comments rules)"
cmds:
- golangci-lint run --config .golangci.doccheck.yml ./cmd/rsk/... ./internal/... ./cmd/count-tokens/... ./cmd/generate-registry/... ./cmd/registry-remove/...
lint:oneliners:
desc: Check for one-line function bodies (not part of the standard gate — opt-in)
cmds:
- bash skills/languages/go-architect/assets/check-no-oneline-functions.sh
lint:separators:
desc: Check for decorative comment separators (// ──, # ──, etc. — opt-in)
cmds:
- bash skills/languages/go-architect/assets/check-no-separator-comments.sh
fmt:
desc: Format everything
cmds:
- golangci-lint fmt --config .golangci.yml ./...
build:
desc: Build all binaries
deps:
- cli:build
deps:
desc: Update Go dependencies
cmds:
- go get -u ./...
- go mod tidy
# Downloads into a throwaway module cache so a missing GOPRIVATE or git auth
# fails here instead of on a clean machine or CI. -modcacherw keeps the
# cache deletable; `go clean -modcache` empties it before and after.
deps:check:
desc: Verify every Go module resolves from an empty module cache
env:
GOMODCACHE: '{{.ROOT_DIR}}/.task/modcheck'
GOFLAGS: -modcacherw
cmds:
- defer: go clean -modcache
- go clean -modcache
- go mod download
test:
desc: Run all tests
cmds:
- go test ./...
# Local CI: runs a real workflow file in Docker with act, so the gate that
# guards a pull request can run here first. Scoped with -W on purpose:
# publish-registry.yml is also workflow_dispatch and must never run locally.
ci:local:
desc: Run the site workflow locally with act (WORKFLOW=check-site.yml; secrets from .secrets, else $NODE_AUTH_TOKEN)
vars:
WORKFLOW: '{{.WORKFLOW | default "check-site.yml"}}'
cmds:
- |
if [ -f .secrets ]; then secrets="--secret-file .secrets"; else secrets="-s NODE_AUTH_TOKEN"; fi
act workflow_dispatch -W .github/workflows/{{.WORKFLOW}} $secrets \
--artifact-server-path .artifacts --env-file /dev/null
# site/ — the landing page (React + Vite). Its data is generated from this
# repository before every dev run and build, so the page cannot state a number
# the tree does not prove.
site:install:
desc: Install the landing page dependencies (needs NODE_AUTH_TOKEN for GitHub Packages)
dir: site
cmds:
- pnpm install --frozen-lockfile
site:dev:
desc: Run the landing page dev server
dir: site
cmds:
- pnpm dev
site:build:
desc: Build the landing page into site/dist
dir: site
cmds:
- pnpm build
site:check:
desc: Lint, typecheck, build and run the landing page gate (axe, overflow, reveals, films, JS off)
dir: site
cmds:
- pnpm lint
- pnpm typecheck
- pnpm build
- node scripts/verify.mjs
site:deploy:
desc: Gate, then deploy site/dist as the Cloudflare Worker `ralvaskills` on $SITE_HOST (static assets; needs CLOUDFLARE_API_TOKEN_FILE, CLOUDFLARE_ACCOUNT_ID, SITE_HOST in site/.env)
dir: site
dotenv: ['.env']
cmds:
# Not a `preconditions:` entry: Task evaluates those before it loads the task's dotenv file.
- 'test -n "$CLOUDFLARE_API_TOKEN$CLOUDFLARE_API_TOKEN_FILE" -a -n "$CLOUDFLARE_ACCOUNT_ID" || { echo "set CLOUDFLARE_API_TOKEN_FILE (or CLOUDFLARE_API_TOKEN) and CLOUDFLARE_ACCOUNT_ID first (see site/.env.example)"; exit 1; }'
- pnpm lint
- SITE_URL="${SITE_HOST:+https://$SITE_HOST}" pnpm build
- SITE_URL="${SITE_HOST:+https://$SITE_HOST}" node scripts/verify.mjs
- node scripts/deploy.mjs