Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
454 lines (385 loc) · 19.4 KB
/
Copy pathTaskfile.yml
File metadata and controls
454 lines (385 loc) · 19.4 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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# ═══════════════════════════════════════════════════════════════════════════════
# AgentBlazor — Taskfile.yml
# Cross-platform task runner (https://taskfile.dev)
#
# Usage:
# task → lists all tasks
# task demo → run Demo via Aspire AppHost (SQL Server + Docker)
# task demo:aspire → run Demo via Aspire AppHost explicitly
# task demo:build → build Demo project
# task starter → run Starter sample (default)
# task starter:run:openai → run Starter with OpenAI provider
# task build → build entire solution (Release)
# task test → run all unit/integration tests
# task pack → pack all NuGet packages
#
# Prerequisites:
# - .NET SDK 10.0.x (pinned via global.json)
# - Docker Desktop (required for Aspire AppHost SQL Server container)
# - Node.js + npm (for E2E tests only)
# - Playwright (installed via tests/e2e/ npm scripts)
# ═══════════════════════════════════════════════════════════════════════════════
version: '3'
vars:
DEMO_PROJECT: demo/AgentBlazor.Demo/AgentBlazor.Demo.csproj
APPHOST_PROJECT: demo/AgentBlazor.Demo.AppHost/AgentBlazor.Demo.AppHost.csproj
STARTER_PROJECT: samples/AgentBlazor.Starter/AgentBlazor.Starter.csproj
SOLUTION: AgentBlazor.slnx
E2E_DIR: tests/e2e
# ── Global environment ────────────────────────────────────────────────────────
env:
DOTNET_CLI_TELEMETRY_OPTOUT: '1'
DOTNET_NOLOGO: '1'
# ─────────────────────────────────────────────────────────────────────────────
# Tasks
# ─────────────────────────────────────────────────────────────────────────────
tasks:
# ═══════════════════════════════════════════════════════════════════════════
# SOLUTION-LEVEL: Restore / Build / Clean
# ═══════════════════════════════════════════════════════════════════════════
restore:
desc: Restore all NuGet packages (force-evaluate to refresh lock files)
cmds:
- dotnet restore {{.SOLUTION}} --force-evaluate
build:
desc: Build entire solution in Release mode
aliases: [b]
cmds:
- dotnet build {{.SOLUTION}} -c Release
build:debug:
desc: Build entire solution in Debug mode
aliases: [bd]
cmds:
- dotnet build {{.SOLUTION}} -c Debug
clean:
desc: Remove build artifacts and temp files
aliases: [c]
cmds:
- dotnet clean {{.SOLUTION}} -c Release -v quiet
- dotnet clean {{.SOLUTION}} -c Debug -v quiet
- cmd: powershell -Command 'if (Test-Path artifacts/obj) { Remove-Item -Recurse -Force artifacts/obj }'
platforms: [windows]
- cmd: rm -rf artifacts/obj
platforms: [linux, darwin]
rebuild:
desc: Clean + Build (Release)
deps: [clean, restore]
cmds:
- task: build
# ── Aspire AppHost (solution-level) ──────────────────────────────────────
aspire:build:
desc: Build the Aspire AppHost project
cmds:
- dotnet build {{.APPHOST_PROJECT}} -c Release
aspire:
desc: "Run Aspire AppHost (orchestrates Demo + SQL Server)"
aliases: [a]
summary: >-
Launches the Aspire AppHost which orchestrates the Demo project
with a SQL Server Docker container. Connection strings are
injected automatically by Aspire.
cmds:
- dotnet run --project {{.APPHOST_PROJECT}} -c Release
# ═══════════════════════════════════════════════════════════════════════════
# CODE QUALITY: Format / Lint / CSS
# ═══════════════════════════════════════════════════════════════════════════
format:
desc: Auto-fix code formatting with dotnet format
aliases: [fmt, f]
cmds:
- dotnet format {{.SOLUTION}}
format:verify:
desc: Verify code formatting (CI check, no changes)
cmds:
- dotnet format {{.SOLUTION}} --verify-no-changes
css:regenerate:
desc: Regenerate AgentBlazor.min.css from compiled scoped CSS
cmds:
- powershell -File scripts/regenerate-min-css.ps1
css:check:
desc: Verify AgentBlazor.min.css is up-to-date (CI gate)
cmds:
- powershell -File scripts/regenerate-min-css.ps1 -Check
# ═══════════════════════════════════════════════════════════════════════════
# UNIT & INTEGRATION TESTS
# ═══════════════════════════════════════════════════════════════════════════
test:
desc: Run all unit and integration tests
aliases: [t]
cmds:
- dotnet test {{.SOLUTION}} -c Release --no-build
test:build:
desc: Build test projects in Release mode
cmds:
- dotnet build {{.SOLUTION}} -c Release --no-restore
test:core:
desc: Run AgentBlazor.Core unit tests only
cmds:
- dotnet test tests/AgentBlazor.Core.Tests/ -c Release
test:components:
desc: Run AgentBlazor.Components (bUnit) tests only
cmds:
- dotnet test tests/AgentBlazor.Components.Tests/ -c Release
test:integration:
desc: Run AgentBlazor.IntegrationTests only
cmds:
- dotnet test tests/AgentBlazor.IntegrationTests/ -c Release
test:cli:
desc: Run CLI analysis + integration tests
cmds:
- dotnet test tests/AgentBlazor.Cli.Analysis.Tests/ -c Release
- dotnet test tests/AgentBlazor.Cli.IntegrationTests/ -c Release
test:coverage:
desc: Run tests with code coverage (Cobertura + HTML report)
cmds:
- dotnet test {{.SOLUTION}} -c Release --collect:"XPlat Code Coverage" --results-directory ./coverage
- cmd: reportgenerator "-reports:./coverage/**/coverage.cobertura.xml" "-targetdir:./coverage/report" "-reporttypes:Html"
platforms: [linux, darwin]
- cmd: reportgenerator -reports:.\coverage\**\coverage.cobertura.xml -targetdir:.\coverage\report -reporttypes:Html
platforms: [windows]
# ═══════════════════════════════════════════════════════════════════════════
# DEMO PROJECT — Build & Run (Aspire AppHost + SQL Server)
# ═══════════════════════════════════════════════════════════════════════════
demo:build:
desc: Build the Demo project (Release)
cmds:
- dotnet build {{.DEMO_PROJECT}} -c Release
# ── Aspire AppHost (primary local dev workflow) ─────────────────────────
demo:aspire:
desc: "Run Demo via Aspire AppHost (SQL Server + Docker)"
aliases: [da]
summary: >-
Launches the Demo through the Aspire AppHost which orchestrates a
SQL Server Docker container (agentblazor-demo-sqlserver) and injects
the connection string. Dashboard at https://localhost:22222.
cmds:
- dotnet run --project {{.APPHOST_PROJECT}} -c Release
demo:
desc: "Run Demo via Aspire AppHost (default)"
aliases: [d]
summary: >-
Launches the Demo through the Aspire AppHost which orchestrates
SQL Server via Docker and injects the connection string.
cmds:
- task: demo:aspire
# ── Database utilities ───────────────────────────────────────────────────
demo:db:reset:
desc: Remove the SQL Server Docker container and volume (fresh database)
summary: >-
Stops and removes the agentblazor-demo-sqlserver container and its
Docker volume. The next Aspire AppHost run will recreate both.
cmds:
- docker rm -f agentblazor-demo-sqlserver 2>/dev/null || true
- docker volume rm agentblazor-demo-sqlserver 2>/dev/null || true
- echo "SQL Server container and volume removed"
# ═══════════════════════════════════════════════════════════════════════════
# STARTER SAMPLE — Build & Run
# ═══════════════════════════════════════════════════════════════════════════
starter:build:
desc: Build the Starter sample (Release)
cmds:
- dotnet build {{.STARTER_PROJECT}} -c Release
starter:build:debug:
desc: Build the Starter sample (Debug)
cmds:
- dotnet build {{.STARTER_PROJECT}} -c Debug
starter:
desc: "Run Starter sample (no provider configured)"
aliases: [s]
summary: >-
Launches the Starter Blazor app with JsonFile conversation store.
No LLM provider configured — useful for UI-only testing.
env:
ASPNETCORE_ENVIRONMENT: Development
cmds:
- dotnet run --project {{.STARTER_PROJECT}} -c Release
starter:run:openai:
desc: "Run Starter with OpenAI provider (requires OPENAI_API_KEY)"
summary: >-
Durable JsonFile conversation store with OpenAI as the LLM provider.
Set OPENAI_API_KEY and optionally OPENAI_MODEL before running.
env:
ASPNETCORE_ENVIRONMENT: Development
preconditions:
- sh: test -n "$OPENAI_API_KEY"
platforms: [linux, darwin]
msg: "Set OPENAI_API_KEY environment variable first"
- cmd: if "%OPENAI_API_KEY%"=="" exit /b 1
platforms: [windows]
msg: "Set OPENAI_API_KEY environment variable first"
cmds:
- dotnet run --project {{.STARTER_PROJECT}} -c Release
starter:run:ollama:
desc: "Run Starter with Ollama provider (local, requires Ollama running)"
summary: >-
Durable JsonFile conversation store with Ollama as the LLM provider.
Ollama must be running locally on the default endpoint.
env:
ASPNETCORE_ENVIRONMENT: Development
OLLAMA_MODEL: $OLLAMA_MODEL
OLLAMA_ENDPOINT: 'http://127.0.0.1:11434/v1'
cmds:
- dotnet run --project {{.STARTER_PROJECT}} -c Release
starter:run:debug:
desc: "Run Starter in Debug mode (no provider)"
env:
ASPNETCORE_ENVIRONMENT: Development
cmds:
- dotnet run --project {{.STARTER_PROJECT}} -c Debug
starter:watch:
desc: Run Starter with dotnet watch (hot-reload on code changes)
cmds:
- dotnet watch run --project {{.STARTER_PROJECT}} -c Debug
starter:new-agent:
desc: "Scaffold a new agent registration in the Starter sample"
summary: >-
Runs the AgentBlazor CLI init command in the Starter sample to create
a new agent registration with the required attributes and boilerplate.
cmds:
- dotnet run --project {{.STARTER_PROJECT}}
# ═══════════════════════════════════════════════════════════════════════════
# END-TO-END TESTS
# ═══════════════════════════════════════════════════════════════════════════
e2e:
desc: Run Playwright E2E tests (headless, requires Demo running)
dir: '{{.E2E_DIR}}'
cmds:
- npm run test:e2e
e2e:headed:
desc: Run Playwright E2E tests in headed mode
dir: '{{.E2E_DIR}}'
cmds:
- npm run test:e2e:headed
e2e:ui:
desc: Open Playwright Test UI for interactive test authoring
dir: '{{.E2E_DIR}}'
cmds:
- npm run test:e2e:ui
e2e:install:
desc: Install Playwright Chromium browser
dir: '{{.E2E_DIR}}'
cmds:
- npm install
- npx playwright install --with-deps chromium
e2e:real-usability:
desc: Run real-usability test suite (requires live LLM provider)
dir: '{{.E2E_DIR}}'
cmds:
- npm run test:real-usability
e2e:markdown:
desc: Run markdown enhancement tests
dir: '{{.E2E_DIR}}'
cmds:
- npm run test:markdown-enhance
e2e:external-widget:
desc: Validate chat widget in external Blazor repos
dir: '{{.E2E_DIR}}'
cmds:
- npm run test:external-chat-widget
# ═══════════════════════════════════════════════════════════════════════════
# PACKAGING & PUBLISHING
# ═══════════════════════════════════════════════════════════════════════════
pack:
desc: Pack all NuGet packages (Release)
cmds:
- dotnet build {{.SOLUTION}} -c Release -p:GeneratePackageOnBuild=true
pack:clean:
desc: Remove all generated .nupkg / .snupkg files
cmds:
- cmd: powershell -Command 'Get-ChildItem -Path artifacts -Recurse -Include *.nupkg,*.snupkg -ErrorAction SilentlyContinue | Remove-Item -Force'
platforms: [windows]
- cmd: find artifacts -name "*.nupkg" -delete 2>/dev/null; find artifacts -name "*.snupkg" -delete 2>/dev/null
platforms: [linux, darwin]
publish:private:
desc: "Publish packages to local private feed (set VERSION env var)"
vars:
VERSION:
sh: echo ${VERSION:-0.2.24-internal.3}
cmds:
- powershell -File scripts/publish-private-feed.ps1 -Pack -Version {{.VERSION}}
publish:nuget:
desc: Publish packages to nuget.org (use GitHub Actions workflow)
cmds:
- cmd: echo Use GitHub Actions workflow publish-nuget-org.yml
- cmd: echo gh workflow run publish-nuget-org.yml -f package_version=VERSION
# ═══════════════════════════════════════════════════════════════════════════
# CLI TOOL
# ═══════════════════════════════════════════════════════════════════════════
cli:build:
desc: Build the AgentBlazor.Cli tool (net10.0)
cmds:
- dotnet build src/AgentBlazor.Cli/AgentBlazor.Cli.csproj -c Release
cli:pack:
desc: Pack the AgentBlazor.Cli as a NuGet tool package
cmds:
- dotnet pack src/AgentBlazor.Cli/AgentBlazor.Cli.csproj -c Release
cli:analyze:
desc: "Run CLI analyze on a target project (set TARGET env var)"
vars:
TARGET:
sh: echo ${TARGET:-.}
cmds:
- dotnet run --project src/AgentBlazor.Cli/AgentBlazor.Cli.csproj -- analyze {{.TARGET}}
cli:watch:
desc: Watch project and auto-regenerate AGENT.md on changes
cmds:
- dotnet run --project src/AgentBlazor.Cli/AgentBlazor.Cli.csproj -- watch
cli:scaffold:
desc: Scaffold AgentBlazor wiring into an existing Blazor project
cmds:
- dotnet run --project src/AgentBlazor.Cli/AgentBlazor.Cli.csproj -- scaffold
# ═══════════════════════════════════════════════════════════════════════════
# SMOKE TESTS
# ═══════════════════════════════════════════════════════════════════════════
smoke:
desc: "Run local package smoke test (creates scratch app, installs packages)"
vars:
VERSION:
sh: echo ${VERSION:-0.2.24-internal.3}
cmds:
- powershell -File scripts/smoke-test-local-package.ps1 -PackageVersion {{.VERSION}} -Pack
smoke:cli:
desc: Run CLI v2 workflow smoke test
cmds:
- bash scripts/smoke-test-cli-v2-workflows.sh
# ═══════════════════════════════════════════════════════════════════════════
# DEVELOPMENT SHORTCUTS
# ═══════════════════════════════════════════════════════════════════════════
demo:watch:
desc: Run Demo with dotnet watch (hot-reload on code changes)
summary: >-
Hot-reload for the Demo project. Requires a running SQL Server —
start demo:aspire in another terminal first to spin up the container.
cmds:
- dotnet watch run --project {{.DEMO_PROJECT}} -c Debug
ci:
desc: "Simulate CI pipeline locally: restore → build → format:verify → css:check → test"
cmds:
- task: restore
- task: build
- task: format:verify
- task: css:check
- task: test
# ═══════════════════════════════════════════════════════════════════════════
# INFO & HELPERS
# ═══════════════════════════════════════════════════════════════════════════
info:
desc: Show environment info (SDK version, runtime, etc.)
silent: true
cmds:
- cmd: echo .NET SDK
- dotnet --info
- cmd: echo Git
- git --version
- git log --oneline -5
- cmd: echo Node for E2E
- cmd: node --version || echo Node.js not installed
platforms: [linux, darwin]
- cmd: node --version
ignore_error: true
platforms: [windows]
default:
desc: List all available tasks (run with -v for descriptions)
silent: true
cmds:
- task --list