You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .agents/skills/klicker-environment-doctor/SKILL.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ description: Diagnose and repair a broken KlickerUZH development environment. Us
7
7
8
8
Run the checks **in order** — later checks assume earlier ones pass. Background facts live in the wiki: [docs/getting-started.md](../../../docs/getting-started.md).
9
9
10
-
Provenance: checks 1–6 were executed and verified on macOS (2026-07-07). Steps marked **config-derived** were read from config, not executed — treat their exact output as unconfirmed.
10
+
Provenance: checks 1–5 and 7–9 were executed and verified on macOS (2026-07-07). Check 6's process reconciler was executed in the Linux devcontainer image, and its host-side devrouter lifecycle was verified from a clean linked worktree on macOS (2026-07-13). Other steps marked **config-derived** were read from config, not executed — treat their exact output as unconfirmed.
11
11
12
12
## Agent ground rules
13
13
@@ -32,7 +32,7 @@ Wrong major (e.g. 9.x from a stale Volta shim; `VOLTA_FEATURE_PNPM` unset) **sil
32
32
|`ERR_PNPM_LOCKFILE_CONFIG_MISMATCH` under `CI=true`| restore lockfile (check 1), install without `CI=true`|
33
33
|~19 packages fail `pnpm run check`|`pnpm run build` once (generates Prisma client, codegen, dists), then re-check |
34
34
35
-
Healthy sequence from scratch: `pnpm install` → `pnpm run build` → `pnpm run check` (verified ~20s / ~1.5min / clean).
35
+
Healthy sequence from scratch inside the devcontainer: `pnpm install` → `pnpm run build` → `pnpm run check` (verified ~20s / ~1.5min / clean). The root build script forces `NODE_ENV=production`, including when the devcontainer exports `NODE_ENV=development` for its live apps. A production build can replace Next.js dev output; run `devrouter ensure .` afterward so the exact checkout runtime is health-checked and recovered when needed.
36
36
37
37
## Check 3 — stale GraphQL codegen
38
38
@@ -53,22 +53,25 @@ If `apps/analytics` complains about schema drift or a schema edit isn't visible:
`Bind for :::5432 failed: port is already allocated` means another stack holds the port — stop it or don't start the colliding service. Plain localhost and legacy host-based paths publish fixed ports, so only one such stack runs per machine. For parallel devcontainer worktrees, keep the base `.devcontainer/docker-compose.yml` port-free and use `.devcontainer/docker-compose.devrouter.yml`, which exposes `${WORKSPACE:-klicker-uzh}-app` / `${WORKSPACE:-klicker-uzh}-db` aliases on `devnet`. Start/register linked worktrees with the same token, e.g. `WORKSPACE=<slug> devpod up .` and `devrouter app run <app> --workspace <slug>`. Use `.devcontainer/docker-compose.localhost.yml` only for the one-at-a-time localhost fallback. If manage media uploads fail with an Azure Blob CORS error while GraphQL auth still works, check the storage account before changing app CORS. The media library uploads directly from the browser to Azure Blob Storage via SAS, so the Blob service CORS rule must allow the actual devrouter origin (`https://manage.klicker.localhost` or `https://manage.klicker.<workspace>.localhost`). Use exact origins for production/staging accounts; for a dedicated dev storage account, a dev-only `https://*.localhost` rule keeps parallel worktrees usable.
56
+
`Bind for :::5432 failed: port is already allocated` means another stack holds the port — stop it or don't start the colliding service. Plain localhost and legacy host-based paths publish fixed ports, so only one such stack runs per machine. Parallel devcontainer worktrees use the port-free base compose file plus `.devcontainer/docker-compose.devrouter.yml`; the one-at-a-time fallback uses `.devcontainer/docker-compose.localhost.yml`. If manage media uploads fail with an Azure Blob CORS error while GraphQL auth still works, check the storage account before changing app CORS. The media library uploads directly from the browser to Azure Blob Storage via SAS, so its CORS rule must allow the actual local origin. Use exact origins for production/staging accounts and dev-only localhost rules for a dedicated dev storage account.
57
57
58
58
## Check 6 — infra bring-up / server status (headless-safe)
59
59
60
60
Depending on your environment path:
61
61
62
-
### Path A: Inside Devcontainer
62
+
### Path A: Managed devcontainer
63
63
64
-
The container manages infra services and app servers automatically in the background. Check logs and process status:
64
+
Run the ownership-aware lifecycle check from the host, then inspect the exact container through devrouter:
65
65
66
66
```bash
67
-
pgrep -f "turbo run dev">/dev/null &&echo"Dev servers running"||echo"Dev servers NOT running"
68
-
tail -n 50 /tmp/dev.log # inspect server startup logs
If servers are down, restart them: `bash .devcontainer/post-start.sh`.
72
+
`devrouter ensure` delivers its matching process helper to the exact validated container. Released `0.0.35` fingerprints the workspace, command, adapter bytes, and declared non-secret origin allowlist. The helper replaces a stale owned process group and leaves unknown processes untouched. Host-side ensure checks all routes and can recreate one stale or unhealthy exact-path DevPod once.
73
+
74
+
`devrouter doctor --repo .` provides static diagnostics. `devrouter ensure .` resolves the checkout-specific overlay and is the authoritative runtime proof.
Use this if you are running in a headless cloud server or want to avoid installing Traefik/mkcert on your host:
25
+
The primary checkout keeps fixed localhost ports and receives stable unnamespaced devrouter routes:
25
26
26
-
1.No action required; the default setup dynamically falls back to the localhost overlay. (If you need to force it, ensure `DEVCONTAINER_COMPOSE_OVERLAY` is unset or explicitly set to `docker-compose.localhost.yml`).
27
-
2. Start the devcontainer (`devpod up .` or via VS Code).
27
+
1.Run one-time setup: `devrouter setup --yes`.
28
+
2. Start and prove the checkout: `devrouter ensure .`.
28
29
3. The applications are exposed directly on your host's ports:
1.**Host prerequisite**: Install [devrouter](https://github.com/rschlaefli/devrouter) ≥ 0.0.35 and set it up:
44
45
```bash
45
-
devrouter up && devrouter tls install# Traefik + the shared `devnet` + mkcert CA
46
+
devrouter setup --yes# Traefik + the shared `devnet` + mkcert CA
46
47
```
47
-
2.Start the devcontainer via devrouter workspace commands:
48
+
2.Reconcile this existing linked worktree with one command:
48
49
```bash
49
-
dev workspace up <branch-name>
50
+
devrouter ensure .
50
51
```
51
-
_Note: This automatically provisions a git worktree, sets `WORKSPACE` and `DEVCONTAINER_COMPOSE_OVERLAY=docker-compose.devrouter.yml` inside the environment, and runs `devpod up` under the hood._
52
+
To create a new worktree instead, run `devrouter workspace up <branch-name>` from the main repository. Both commands persist one identity, select the devrouter overlay, mount linked Git metadata, start or attach the exact DevPod, prove the runtime, and reconcile routes.
52
53
3. Open `https://manage.klicker.<workspace>.localhost` (credentials: `lecturer` / `abcd`).
53
54
54
-
For a manual `devpod up` configuration (without using `dev workspace up`), you must supply the environment variables yourself:
55
+
Do not use bare `devpod up`, manual `WORKSPACE`, or per-app `--workspace` route loops for this managed devcontainer. Those paths bypass the identity and runtime proof.
55
56
56
-
```bash
57
-
WORKSPACE=my-branch DEVCONTAINER_COMPOSE_OVERLAY=docker-compose.devrouter.yml devpod up . --ide none
58
-
forain api auth pwa manage control olat-api response-api lti chat db;do
0 commit comments