-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathmise.toml
More file actions
436 lines (379 loc) · 17.3 KB
/
Copy pathmise.toml
File metadata and controls
436 lines (379 loc) · 17.3 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
[tools]
actionlint = "latest"
buf = "latest"
go = "1.26.2"
goreleaser = "latest"
node = "22"
uv = "0.11.30"
[env]
_.file = '.env'
# =============================================================================
# Setup
# =============================================================================
[tasks.setup]
description = "Set up the development environment"
run = [
{ task = "setup-cli" },
{ task = "setup-frontend" },
{ task = "build-api-types" },
]
# =============================================================================
# Dependencies
# =============================================================================
[tasks.deps-cli]
description = "Install Go dependencies"
dir = "cli"
run = "go mod download"
sources = ["go.mod", "go.sum"]
[tasks.deps-frontend]
description = "Install frontend dependencies"
dir = "."
run = "pnpm install"
# package.json also contains app metadata and scripts; the lockfile is the
# dependency-resolution input that should trigger installs.
sources = ["package.json", "pnpm-lock.yaml", "pnpm-workspace.yaml", ".npmrc", "apps/*/package.json", "packages/*/package.json"]
[tasks.deps]
description = "Install all dependencies"
run = { task = "deps-*" }
[tasks.setup-cli]
description = "Set up the CLI module"
depends = ["deps-cli", "sync-cli-legal"]
[tasks.setup-frontend]
description = "Set up the frontend module"
depends = ["deps-frontend"]
# =============================================================================
# License Metadata
# =============================================================================
[tasks.license-check]
description = "Check SPDX/REUSE license metadata"
run = "uvx --with charset-normalizer 'reuse==6.2.0' lint"
# =============================================================================
# Code Generation
# =============================================================================
[tasks.codegen-proto]
description = "Generate Go and frontend code from protobuf schemas"
depends = ["setup-cli", "setup-frontend"]
dir = "proto"
run = [
"pnpm --dir ../packages/api-types run clean",
"buf generate",
"node ../tools/split-connectrpc-docs.mjs",
"node ../tools/trim-proto-codegen-output.mjs",
]
[tasks.codegen-emoji]
description = "Generate Go emoji map from gemoji npm package"
depends = ["setup-frontend"]
run = "node tools/gen-emoji-map.mjs"
[tasks.codegen]
description = "Run all code generation tasks"
run = { task = "codegen-*" }
# =============================================================================
# Build
# =============================================================================
[tasks.sync-cli-legal]
description = "Copy root legal files into the CLI module for go:embed"
run = [
"mkdir -p cli/cmd/embedded",
"cp LICENSES/AGPL-3.0-or-later.txt cli/LICENSE",
"cp NOTICE cli/NOTICE",
"cp LICENSES/AGPL-3.0-or-later.txt cli/cmd/embedded/LICENSE",
"cp NOTICE cli/cmd/embedded/NOTICE",
]
sources = ["LICENSES/AGPL-3.0-or-later.txt", "NOTICE"]
outputs = ["cli/LICENSE", "cli/NOTICE", "cli/cmd/embedded/LICENSE", "cli/cmd/embedded/NOTICE"]
[tasks.build]
description = "Build the entire project for all architectures"
run = [{ task = "build-*" }, "ls -lah cli/bin/*"]
[tasks.build-api-types]
description = "Build the generated TypeScript API package"
depends = ["setup-frontend"]
dir = "packages/api-types"
run = "pnpm build"
sources = ["package.json", "tsconfig.json", "src/**/*"]
[tasks.build-frontend]
description = "Build the frontend application"
depends = ["setup-frontend", "build-api-types"]
dir = "apps/frontend"
run = [
"pnpm svelte-kit sync",
"pnpm build",
"touch build/.mise-build-stamp",
"rm -rf ../../cli/internal/http_server/.client",
"cp -r build ../../cli/internal/http_server/.client",
"touch ../../cli/internal/http_server/.client/.gitkeep",
]
sources = [
"../../.npmrc",
"../../package.json",
"../../pnpm-lock.yaml",
"../../pnpm-workspace.yaml",
"../../packages/api-types/dist/**/*",
"package.json",
"src/**/*",
"!src/**/*.spec.*",
"!src/**/*.test.*",
"!src/**/*.stories.*",
"!src/**/*TestHarness.svelte",
"static/**/*",
"svelte.config.js",
"tsconfig.json",
"vite.config.ts",
]
outputs = ["build/.mise-build-stamp", "../../cli/internal/http_server/.client/.gitkeep"]
[tasks.build-dev-cli]
description = "Build the development CLI application for the current architecture"
depends = ["setup-cli", "build-frontend"]
dir = "cli"
run = "go build -trimpath -tags bootstrap -o bin/chatto ."
sources = [
"go.mod",
"go.sum",
"**/*.go",
"!**/*_test.go",
"cmd/embedded/LICENSE",
"cmd/embedded/NOTICE",
"internal/http_server/.client/**/*",
]
outputs = ["bin/chatto"]
[tasks.build-e2e-server]
description = "Build the E2E test server binary with dev bootstrap and test endpoints enabled"
depends = ["setup-cli", "build-frontend"]
dir = "cli"
# `bootstrap` enables the [bootstrap] section in chatto.toml, which seeds
# the e2eadmin user the harness logs in as. `test_endpoints` exposes the
# test-only HTTP endpoints (e.g. /auth/test/create-user) used by per-test
# fixtures. Deliberately scoped — the e2e binary should NOT pull in any
# future broader dev-only code that might land under a separate tag.
run = "CGO_ENABLED=0 go build -trimpath -tags 'bootstrap test_endpoints' -ldflags '-s -w' -o ../apps/frontend/e2e/fixtures/bin/chatto ."
sources = [
"**/*.go",
"cmd/embedded/LICENSE",
"cmd/embedded/NOTICE",
"internal/http_server/.client/**/*",
]
outputs = ["../apps/frontend/e2e/fixtures/bin/chatto"]
[tasks.build-compatibility-server]
description = "Build the production Chatto binary used as the current side of compatibility tests"
depends = ["setup-cli", "build-frontend"]
dir = "cli"
run = "CGO_ENABLED=0 go build -trimpath -ldflags '-s -w' -o ../apps/frontend/e2e/fixtures/bin/chatto-current ."
sources = [
"**/*.go",
"cmd/embedded/LICENSE",
"cmd/embedded/NOTICE",
"internal/http_server/.client/**/*",
]
outputs = ["../apps/frontend/e2e/fixtures/bin/chatto-current"]
[tasks.storybook]
description = "Run the Storybook design-system catalog on the workspace port"
depends = ["setup-frontend", "build-api-types"]
dir = "apps/frontend"
env = {
CHATTO_STORYBOOK_PORT = "{{env.CHATTO_STORYBOOK_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')))}}",
}
run = "exec pnpm exec storybook dev --host 127.0.0.1 --port \"$CHATTO_STORYBOOK_PORT\" --no-open"
[tasks.dev-backend]
description = "Build and run the local development backend"
depends = ["setup-cli"]
dir = "cli"
run = "mkdir -p internal/http_server/.client && touch internal/http_server/.client/.gitkeep && go build -trimpath -tags bootstrap -o bin/chatto-dev . && exec ./bin/chatto-dev start"
[tasks.dev-frontend]
description = "Run the local development frontend"
depends = ["setup-frontend", "build-api-types"]
dir = "apps/frontend"
run = "exec ./node_modules/.bin/vite dev"
[tasks.dev-livekit]
description = "Run a local LiveKit server with workspace-safe ports"
env = {
CHATTO_DEV_PORT_BASE = "{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000'))}}",
CHATTO_DEV_LIVEKIT_KEYS = "devkey: devsecret",
CHATTO_DEV_LIVEKIT_PORT = "{{env.CHATTO_DEV_PORT_BASE | int + 5}}",
CHATTO_DEV_LIVEKIT_RTC_TCP_PORT = "{{env.CHATTO_DEV_PORT_BASE | int + 6}}",
CHATTO_DEV_LIVEKIT_UDP_PORTS = "{{env.CHATTO_DEV_PORT_BASE | int + 7}}",
}
run = "exec livekit-server --dev --bind 127.0.0.1 --node-ip 127.0.0.1 --keys \"$CHATTO_DEV_LIVEKIT_KEYS\" --port \"$CHATTO_DEV_LIVEKIT_PORT\" --rtc.tcp_port \"$CHATTO_DEV_LIVEKIT_RTC_TCP_PORT\" --udp-port \"$CHATTO_DEV_LIVEKIT_UDP_PORTS\""
[tasks.dev-mailpit]
description = "Run a local Mailpit SMTP server with workspace-safe ports"
env = {
CHATTO_DEV_PORT_BASE = "{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000'))}}",
CHATTO_DEV_MAILPIT_SMTP_PORT = "{{env.CHATTO_DEV_PORT_BASE | int + 8}}",
CHATTO_DEV_MAILPIT_UI_PORT = "{{env.CHATTO_DEV_PORT_BASE | int + 9}}",
}
run = "exec mailpit --smtp \"127.0.0.1:$CHATTO_DEV_MAILPIT_SMTP_PORT\" --listen \"127.0.0.1:$CHATTO_DEV_MAILPIT_UI_PORT\""
[tasks.dev]
description = "Run the local backend and frontend development servers"
depends = ["setup-cli", "build-api-types"]
env = {
VITE_PORT = "{{env.VITE_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')))}}",
CHATTO_WEBSERVER_PORT = "{{env.CHATTO_WEBSERVER_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 1)}}",
CHATTO_WEBSERVER_URL = "{% if env.CHATTO_WEBSERVER_URL is defined and env.CHATTO_WEBSERVER_URL != '' %}{{env.CHATTO_WEBSERVER_URL}}{% else %}http://localhost:{{env.VITE_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')))}}{% endif %}",
CHATTO_NATS_EMBEDDED_PORT = "{{env.CHATTO_NATS_EMBEDDED_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 2)}}",
CHATTO_NATS_CLIENT_URL = "{% if env.CHATTO_NATS_CLIENT_URL is defined and env.CHATTO_NATS_CLIENT_URL != '' %}{{env.CHATTO_NATS_CLIENT_URL}}{% else %}nats://localhost:{{env.CHATTO_NATS_EMBEDDED_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 2)}}{% endif %}",
CHATTO_METRICS_PORT = "{{env.CHATTO_METRICS_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 3)}}",
CHATTO_EXPORTER_PORT = "{{env.CHATTO_EXPORTER_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 4)}}",
CHATTO_LIVEKIT_URL = "{% if env.CHATTO_LIVEKIT_URL is defined and env.CHATTO_LIVEKIT_URL != '' %}{{env.CHATTO_LIVEKIT_URL}}{% else %}ws://localhost:{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 5}}{% endif %}",
CHATTO_LIVEKIT_WEBHOOK_URL = "{% if env.CHATTO_LIVEKIT_WEBHOOK_URL is defined and env.CHATTO_LIVEKIT_WEBHOOK_URL != '' %}{{env.CHATTO_LIVEKIT_WEBHOOK_URL}}{% else %}http://localhost:{{env.CHATTO_WEBSERVER_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 1)}}/webhooks/livekit{% endif %}",
CHATTO_SMTP_PORT = "{{env.CHATTO_SMTP_PORT | default(value=env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 8)}}",
}
run = { tasks = ["dev-backend", "dev-frontend", "dev-livekit", "dev-mailpit"] }
[tasks.dev-docs-website]
description = "Run the docs website development server with workspace-safe ports"
depends = ["setup-frontend"]
dir = "apps/docs-website"
raw = true
run = """
workspace_port_base="${CONDUCTOR_PORT:-${PASEO_PORT:-4000}}"
docs_website_port="${CHATTO_DOCS_WEBSITE_PORT:-$workspace_port_base}"
exec pnpm astro dev --host 127.0.0.1 --port "$docs_website_port"
"""
[tasks.chatto]
description = "Build and run the bundled Chatto CLI command with workspace-safe ports"
depends = ["build-dev-cli"]
dir = "cli"
env = {
CHATTO_WEBSERVER_PORT = "{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000'))}}",
CHATTO_WEBSERVER_URL = "http://localhost:{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000'))}}",
CHATTO_NATS_EMBEDDED_PORT = "{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 1}}",
CHATTO_NATS_CLIENT_URL = "nats://localhost:{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 1}}",
CHATTO_METRICS_ENABLED = "true",
CHATTO_METRICS_BIND_ADDRESS = "127.0.0.1",
CHATTO_METRICS_PORT = "{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 2}}",
CHATTO_METRICS_PATH = "/metrics",
CHATTO_EXPORTER_ENABLED = "true",
CHATTO_EXPORTER_BIND_ADDRESS = "127.0.0.1",
CHATTO_EXPORTER_PORT = "{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 3}}",
CHATTO_EXPORTER_PATH = "/metrics",
CHATTO_LIVEKIT_ENABLED = "true",
CHATTO_LIVEKIT_URL = "ws://localhost:{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 5}}",
CHATTO_LIVEKIT_API_KEY = "devkey",
CHATTO_LIVEKIT_API_SECRET = "devsecret",
CHATTO_LIVEKIT_WEBHOOK_URL = "http://localhost:{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int}}/webhooks/livekit",
CHATTO_SMTP_ENABLED = "true",
CHATTO_SMTP_HOST = "127.0.0.1",
CHATTO_SMTP_PORT = "{{env.CONDUCTOR_PORT | default(value=env.PASEO_PORT | default(value='4000')) | int + 8}}",
CHATTO_SMTP_TLS = "opportunistic",
CHATTO_SMTP_FROM = "chatto-dev@chatto.localhost",
}
run = "exec bin/chatto"
[tasks.dev-compiled]
description = "Build and run the bundled Chatto stack with LiveKit and Mailpit"
run = { tasks = ["chatto run", "dev-livekit", "dev-mailpit"] }
# =============================================================================
# Benchmarking
# =============================================================================
[tasks.bench-projections]
description = "Benchmark projection replay throughput and retained heap"
depends = ["setup-cli"]
dir = "cli"
run = [
"go test -trimpath ./internal/core -run '^$' -bench '^BenchmarkProjectionReplay$' -benchmem -count=${CHATTO_BENCH_COUNT:-5}",
"go test -trimpath ./internal/core -run '^$' -bench '^BenchmarkProjectionRetainedHeap$' -benchmem -benchtime=1x -count=${CHATTO_BENCH_COUNT:-5}",
]
[tasks.bench-projections-profile]
description = "Capture exact retained-heap profiles for projection replay"
depends = ["setup-cli"]
dir = "cli"
env = { CHATTO_BENCH_HEAP_PROFILE_DIR = "../.context/bench/projections" }
run = "go test -trimpath ./internal/core -run '^$' -bench '^BenchmarkProjectionRetainedHeap$' -benchmem -benchtime=1x -count=1"
# =============================================================================
# Testing
# =============================================================================
[tasks.test-cli]
description = "Run CLI tests"
depends = ["setup-cli", "build-frontend"]
dir = "cli"
run = [
"../tools/dev-supervisor_test.sh",
"go test -trimpath -p ${CHATTO_GO_TEST_P:-4} -tags test_endpoints ./...",
]
sources = ["**/*.go", "cmd/embedded/LICENSE", "cmd/embedded/NOTICE"]
[tasks.test-cli-shutdown]
description = "Run backend process shutdown integration tests"
depends = ["setup-cli"]
dir = "cli"
run = "go test -trimpath -tags integration ./cmd -run TestRunCommandShutsDownOnSignals -count=1 -timeout 2m"
sources = ["**/*.go", "cmd/embedded/LICENSE", "cmd/embedded/NOTICE"]
[tasks.knip]
description = "Find unused frontend/docs files, dependencies, and exports"
depends = ["setup-frontend", "build-api-types"]
run = "pnpm knip"
[tasks.lint-frontend]
description = "Run TypeScript and ESLint checks on frontend"
depends = ["setup-frontend", "build-api-types"]
dir = "apps/frontend"
run = ["pnpm check", "pnpm lint"]
[tasks.lint]
description = "Run linters"
run = [{ task = "lint-*" }]
[tasks.test-frontend]
description = "Run frontend unit tests"
depends = ["setup-frontend", "build-api-types"]
dir = "apps/frontend"
run = "pnpm vitest --run"
[tasks.test-e2e]
description = "Run E2E tests"
depends = ["setup-frontend", "build-e2e-server"]
dir = "apps/frontend"
run = "pnpm exec playwright test"
[tasks.test]
description = "Run all tests"
run = [{ task = "test-cli" }, { task = "test-frontend" }, { task = "test-e2e" }]
# =============================================================================
# Utility
# =============================================================================
[tasks.run]
description = "Compile and run the project"
depends = ["build"]
dir = "cli"
run = "bin/chatto run"
[tasks.clean]
description = "Clean all build artifacts"
run = [
"rm -rf cli/bin/*",
"rm -rf cli/cmd/embedded",
"rm -rf cli/internal/http_server/.client",
"rm -rf apps/frontend/build",
]
[tasks.reset-config]
description = "Delete and reinitialize chatto.toml"
confirm = "Are you sure you want to re-initialize chatto.toml? This will delete your current configuration."
depends = ["setup-cli"]
dir = "cli"
run = ["rm chatto.toml", "go run . init"]
[tasks.reset-data]
description = "Reset the development environment (NATS data etc.)"
confirm = "Are you sure you want to reset the development environment? This will delete all data."
dir = "cli"
run = ["rm -rf data"]
[tasks.docs]
description = "Start pkgsite documentation server for the CLI"
dir = "cli"
run = """
echo "Starting pkgsite documentation server..."
echo "Browse to: http://localhost:6060/hmans.de/chatto"
pkgsite -http=localhost:6060 .
"""
[tasks.verify-docker]
description = "Validate Docker, GoReleaser, and image workflow wiring"
run = """
set -euo pipefail
goreleaser check
actionlint .github/workflows/*.yml
docker/nats-wrapper_test.sh
docker buildx build --check --build-arg TARGETARCH=amd64 -f docker/Dockerfile.dev .
docker buildx build --check -f docker/Dockerfile.frontend.dev .
docker buildx build --check -f docker/Dockerfile.frontend.prebuilt .
tmp="$(mktemp -d /tmp/chatto-docker-verify.XXXXXX)"
trap 'rm -rf "$tmp"' EXIT
context="$tmp/linux-amd64"
mkdir -p "$context/docker"
cp docker/Dockerfile.goreleaser "$context/Dockerfile"
cp docker/docker-entrypoint.sh "$context/docker/docker-entrypoint.sh"
cp docker/nats-wrapper.sh "$context/docker/nats-wrapper.sh"
mkdir -p "$context/LICENSES"
cp LICENSES/AGPL-3.0-or-later.txt "$context/LICENSES/AGPL-3.0-or-later.txt"
cp NOTICE "$context/NOTICE"
printf '#!/bin/sh\necho chatto dummy\n' > "$context/chatto"
chmod +x "$context/chatto"
docker buildx build --build-arg TARGETARCH=amd64 -f "$context/Dockerfile" "$context"
"""