|
27 | 27 | - HTTP services via `https://*.hack` hostnames (matching your Caddy labels) |
28 | 28 | - non-HTTP services via Compose service hostnames (e.g. `db`, `redis`) |
29 | 29 |
|
| 30 | +## What discovery checks (and what it can't) |
| 31 | + |
| 32 | +`hack init` (interactive and `--auto`) discovers dev scripts across a repo/monorepo |
| 33 | +and runs a validation pass over the results before writing `.hack/docker-compose.yml`. |
| 34 | +It catches common scaffolding mistakes automatically, but it is not a substitute for |
| 35 | +reviewing the generated compose file: |
| 36 | + |
| 37 | +- **Duplicate/aggregator script dedupe**: when a package defines both `dev` and |
| 38 | + `start` (or similar), only the best-scoring script becomes a service — no more |
| 39 | + `web` + `web-2`. Root-level "aggregator" scripts that just delegate to a |
| 40 | + workspace package's own dev script (e.g. `turbo run dev --filter=web`, or |
| 41 | + `dotnet run --project apps/backend`) are also dropped in favor of the |
| 42 | + package-local script. In the interactive wizard, the deduped set is |
| 43 | + pre-selected by default — you can still add a dropped script back manually. |
| 44 | +- **Port reassignment**: HTTP services that would collide on the same internal |
| 45 | + port are deterministically reassigned to the next free port (ascending from |
| 46 | + the collision), and the container command is rewritten to match. Each |
| 47 | + reassignment is logged as a warning. |
| 48 | +- **Runtime TODOs**: services whose dev script looks non-JS (`.csproj`/`.fsproj`, |
| 49 | + `go.mod`, `Cargo.toml`, `pyproject.toml`/`requirements.txt`, `mix.exs`, |
| 50 | + `Gemfile`, or a command like `dotnet run`/`go run`/`cargo`/`python`/`mix`) get an |
| 51 | + obviously-wrong placeholder image (`alpine:3`) plus a `TODO(hack-init): ...` |
| 52 | + comment above the service in the compose file — instead of silently getting the |
| 53 | + default Bun/Node image. You must replace the image and command by hand. |
| 54 | +- **Backing-service warnings**: dependencies (`pg`, `ioredis`, `@temporalio/*`, |
| 55 | + `kafkajs`, `amqplib`, `mongodb`/`mongoose`, `prisma`, ...) and `.env`/`.env.example` |
| 56 | + key names (never values) are scanned for signals of postgres, mysql, redis, |
| 57 | + temporal, kafka, rabbitmq, or mongodb. These are **not** auto-scaffolded — they |
| 58 | + show up as warnings and as a comment block at the top of the generated compose |
| 59 | + file with a one-line suggestion each. If a `docker-compose*.yml`/`compose*.yml` |
| 60 | + already exists at the repo root, it's flagged too ("treat it as ground truth for |
| 61 | + backing services and images") instead of being re-derived from scratch. |
| 62 | + |
| 63 | +None of this replaces reviewing the scaffold. Discovery is a best-effort heuristic |
| 64 | +pass, not ground truth — always inventory the generated `.hack/docker-compose.yml` |
| 65 | +against the real repo before running `hack up` (agents included; see the |
| 66 | +onboarding prompt for the inventory-first review step). |
| 67 | + |
30 | 68 | When the local path is working and you intentionally want remote execution or gateway exposure, move |
31 | 69 | to [Beta workflows](../beta.md). For full command lookup and extension docs, use |
32 | 70 | [Extensions & reference](../reference.md). |
0 commit comments