Skip to content

feat(cli): add lo1 doctor and fail lo1 up early on port conflicts - #25

Merged
fr3shw3b merged 1 commit into
mainfrom
feat/doctor
Nov 17, 2026
Merged

fr3shw3b merged 1 commit into
mainfrom
feat/doctor

Conversation

@fr3shw3b

Copy link
Copy Markdown
Contributor

Summary

Base: feat/detach-dotenv (#24). Retarget to main once the earlier PRs merge.

lo1 doctor

Checks what a first lo1 up depends on, and prints a fix under each problem:

  • Node.js 24 or later
  • Docker installed, and its daemon running (reported separately)
  • Docker Compose v2
  • Git (a failure only when lo1.yaml lists repositories, otherwise a warning)
  • lo1.yaml loads and validates
  • Ports for the proxy and every service are free (skipped while the workspace is running)
  • The workspace's domains are in the hosts file (warning, since lo1 up adds them)
  • ACME credentials, when proxy.tls.mode is acme

Exits 1 if any check fails. --json prints { "ok": boolean, "checks": [{ id, status, message, fix? }] }. --config <path> points it at another config file.

  ✓ Node.js 24.14.0
  ✓ Docker 29.5.2
  ✓ Docker Compose 5.1.4
  ✓ Git 2.50.1 (Apple Git-155)
  ✓ lo1.yaml is valid (workspace "e2etest")
  ✗ Port 18081 is already in use, but service "api" needs it
      Stop whatever is listening on port 18081, or change services.api.port in lo1.yaml

  1 problem.

Port conflicts at lo1 up

lo1 up checks the same ports after cleaning up any previous run and before starting anything. A conflict stops it with:

Can't start: a port lo1 needs is already in use.
  - Port 3000 is already in use, but service "api" needs it (services.api.port)
Stop whatever is using it, or change the setting in lo1.yaml.

Ports are probed by connecting to 127.0.0.1 and ::1, rather than binding, so ports below 1024 aren't falsely reported on Linux. Ports published by the extraCompose file aren't checked; Docker still reports those.

Testing

  • Unit tests for port claims, real port probing, each doctor check, report formatting, and lo1 up refusing to start on a conflict.
  • Ran the built CLI: lo1 doctor outside a workspace (warning, exit 0), in a healthy workspace (exit 0), and with a service port taken (exit 1, same result in --json). The orchestrator stopped with the conflict error before starting anything.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 31629105-724e-46a3-b576-6997c9bbe69d
Commits

Reviewing files that changed from the base of the PR and between 2f3cd1d and 996b494.

Files selected for processing: 9

  • packages/cli/src/cli/commands/doctor.ts
  • packages/cli/src/cli/index.ts
  • packages/cli/src/doctor/checks.ts
  • packages/cli/src/doctor/ports.ts
  • packages/cli/src/orchestrator/start.ts
  • packages/cli/src/orchestrator/types.ts
  • packages/cli/tests/doctor/checks.test.ts
  • packages/cli/tests/doctor/ports.test.ts
  • packages/cli/tests/orchestrator/start.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@fr3shw3b
fr3shw3b force-pushed the feat/doctor branch 2 times, most recently from 471641e to 3ddc9e1 Compare November 16, 2026 23:13
@fr3shw3b
fr3shw3b force-pushed the feat/detach-dotenv branch 2 times, most recently from 1f8d645 to 75368b3 Compare November 16, 2026 23:24
@fr3shw3b
fr3shw3b force-pushed the feat/doctor branch 2 times, most recently from 3d9d10a to 7ae6f88 Compare November 17, 2026 00:02
Base automatically changed from feat/detach-dotenv to main November 17, 2026 00:56
`lo1 doctor` checks what a first `lo1 up` depends on and prints a fix for
each problem: Node.js 24+, Docker installed and its daemon running, Docker
Compose v2, Git, a valid lo1.yaml, free ports for the proxy and every
service, hosts file entries and ACME credentials. It exits 1 when any check
fails, and `--json` prints `{ ok, checks }`.

`lo1 up` now checks the same ports before starting anything and stops with
a PortConflictError naming each port, what needs it and the lo1.yaml
setting that changes it, instead of failing midway with a Docker error.
@sonarqubecloud

Copy link
Copy Markdown

@fr3shw3b
fr3shw3b merged commit e7d3f68 into main Nov 17, 2026
4 checks passed
@fr3shw3b
fr3shw3b deleted the feat/doctor branch November 17, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant