Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
.docker/druid-install-command.sh

prerelease:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests, validate-api, build]
outputs:
Expand Down
28 changes: 28 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Druid CLI Agent Guide

## Local daemon command selection

Keep the normal Linux and macOS development path on the existing command:

```bash
make watch
```

That command uses `http://host.k3d.internal:8083` for Kubernetes worker
callbacks and must remain free of Windows or WSL auto-detection.

When Docker Desktop runs on Windows and the repository is executed inside
WSL2, use the explicit Windows command instead:

```bash
make watch-windows
```

The Windows command derives the current WSL source address and passes its
callback URL to the unchanged `make watch` implementation. Set
`DRUID_HOST_SERVICES_IP` to override address discovery, or set
`DRUID_WORKER_CALLBACK_URL` to override the complete callback URL.

Do not use `make watch-windows` on native Linux or macOS. Keep future
platform-specific setup additive instead of adding OS detection to `make
watch`.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: test build k3d-build-pull-image watch test-integration test-integration-docker test-integration-kubernetes kind-integration-up kind-integration-down
.PHONY: test build k3d-build-pull-image watch watch-windows test-integration test-integration-docker test-integration-kubernetes kind-integration-up kind-integration-down

VERSION ?= "dev"
DRUID_K8S_PULL_IMAGE ?= druid:local
Expand Down Expand Up @@ -55,6 +55,9 @@ watch: ## Run Daemon with auto reload
@command -v air >/dev/null 2>&1 || go install github.com/air-verse/air@latest
air --build.cmd "CGO_ENABLED=0 go build -ldflags '-X github.com/highcard-dev/daemon/internal.Version=$(VERSION)' -o ./bin/druid ./apps/druid" --build.full_bin "DRUID_REGISTRY_PLAIN_HTTP=true ./bin/druid $(DRUID_WATCH_ARGS)"

watch-windows: ## Run Daemon with auto reload on Windows through WSL
./scripts/watch-windows.sh

mock:
mockgen -source=internal/core/ports/services_ports.go -destination test/mock/services.go

Expand Down
26 changes: 26 additions & 0 deletions scripts/watch-windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
callback_url="${DRUID_WORKER_CALLBACK_URL:-}"

if [[ -z "$callback_url" ]]; then
host_services_ip="${DRUID_HOST_SERVICES_IP:-}"
if [[ -z "$host_services_ip" ]]; then
host_services_ip="$({
ip -4 route get 1.1.1.1 2>/dev/null \
| sed -n 's/.* src \([^ ]*\).*/\1/p' \
| head -n 1
} || true)"
fi

if [[ -z "$host_services_ip" ]]; then
echo "Unable to determine the WSL callback address; set DRUID_WORKER_CALLBACK_URL explicitly." >&2
exit 1
fi

callback_url="http://${host_services_ip}:8083"
fi

exec make -C "$ROOT" watch DRUID_WORKER_CALLBACK_URL="$callback_url"
Loading