2.8 KiB
2.8 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |
|---|---|---|---|---|---|---|---|
| 04-dev-command | dev command, web port, and dev env wiring | done | 2 |
|
plan.md | ../../specs/platform/requirements/go-dev-launcher.md |
Task 04: dev command, web port, and dev env wiring
Teach the launcher's arg parser, port picker, and env builder about dev mode.
Acceptance
parseArgsacceptsdevand--dev(→CommandDev),--web-internal-port <n>and--web-internal-port=<n>, and rejects--web-portwith the existing message "--web-porthas been removed; use--web-internal-portfor dev mode" and--web-internal-portoutside dev mode with "only applies to dev mode". Port values keep the 1–65535 validation and the existingParseErrorexit code 2.pickDevPortsresolves the web port from the flag thenKANDEV_WEB_PORT, defaults to37429, and guarantees backend, web, and agentctl ports are mutually distinct. An explicitly requested but occupied web port is a hard error naming the port and whether it came from the flag or the env var, matching the backend-port preflight from PR #2394.backendEnvsetsKANDEV_WEB_INTERNAL_URL=http://localhost:<webPort>when a web port is present andKANDEV_DEBUG_DEV_MODE=truein dev mode, and leavesstart/runoutput byte-identical to today when it is not.cli.Help()documentsdevand--web-internal-port.
Verification
Use TDD across the existing suites, then:
cd apps/backend && go test ./internal/launcher/ -race
Files
apps/backend/internal/launcher/options.go,options_test.goapps/backend/internal/launcher/ports.go,ports_test.goapps/backend/internal/launcher/env.go,env_test.goapps/backend/internal/launcher/cli/help.goapps/backend/internal/launcher/launcher.go— dispatchCommandDevtorunDev(a stub returning "not implemented" is acceptable here; task 05 fills it in).
Inputs
apps/cli/src/args.ts:22-138— the exact flag surface and error strings to preserve.apps/cli/src/cli.ts:13-58— the help text wording fordevand--web-internal-port.apps/backend/internal/launcher/ports.go:65-91—pickPortsand theusedmap; extend rather than fork it.apps/backend/internal/launcher/supervisor.go:169-190—allowedSupervisorEnvalready allowlistsKANDEV_WEB_INTERNAL_URLandKANDEV_DEBUG_DEV_MODE; confirm, do not duplicate.
Risks
portConfig.WebPortmust be optional.startandrunhave no web port andbackendEnvmust not emit an emptyKANDEV_WEB_INTERNAL_URLfor them — the TypeScript version explicitly deletes the key in that case (apps/cli/src/shared.ts:85-87).- Watch the Go complexity limits in
apps/backend/.golangci.yml;parseArgAtis already a dispatch chain, so add aparseWebPortArghelper rather than growing it.