Skip to content

feat: added support for specifying the HMR port for CLI start command#2947

Merged
davydkov merged 5 commits into
mainfrom
kieron/specify-hmr-port
May 16, 2026
Merged

feat: added support for specifying the HMR port for CLI start command#2947
davydkov merged 5 commits into
mainfrom
kieron/specify-hmr-port

Conversation

@kieronlanning

@kieronlanning kieronlanning commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Checklist

  • I've thoroughly read the latest contribution guidelines.
  • I've rebased my branch onto main before creating this PR.
  • I've added tests to cover my changes (if applicable).
  • I've verified pnpm typecheck and pnpm test.
  • I've added changesets (you can use /changeset-generator SKILL).
  • My change requires documentation updates.
  • I've updated the documentation accordingly (or will do in follow-up PR).

Copilot AI review requested due to automatic review settings May 9, 2026 10:53
@changeset-bot

changeset-bot Bot commented May 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0018e84

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
likec4 Patch
@likec4/docs-astro Patch
likec4-vscode Patch
@likec4/playground Patch
@likec4/style-preset Patch
@likec4/styles Patch
@likec4/config Patch
@likec4/core Patch
@likec4/diagram Patch
@likec4/generators Patch
@likec4/language-server Patch
@likec4/language-services Patch
@likec4/layouts Patch
@likec4/leanix-bridge Patch
@likec4/spa Patch
@likec4/log Patch
@likec4/lsp Patch
@likec4/mcp Patch
@likec4/react Patch
@likec4/tsconfig Patch
@likec4/vite-plugin Patch
@likec4/vscode-preview Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds explicit HMR WebSocket port handling: a new --hmr-port CLI option, support for HMR_PORT env var, and auto-discovery of a free port in the 24678–24690 range; the resolved port is conditionally applied to Vite's HMR server.

Changes

HMR Port Configuration

Layer / File(s) Summary
CLI Option Definition
packages/likec4/src/cli/options.ts
New exported hmrPort option with numeric type and nargs: 1.
CLI Wiring
packages/likec4/src/cli/serve/index.ts
--hmr-port imported and wired into the serve command builder and passed to the handler.
Handler Type Contract
packages/likec4/src/cli/serve/serve.ts
HandlerParams adds optional hmrPort?: number.
Handler Implementation
packages/likec4/src/cli/serve/serve.ts
Handler destructures hmrPort and forwards it to viteDev.
HMR Port Resolution Logic
packages/likec4/src/vite/vite-dev.ts
Exported resolveHmrPort validates ports, returns undefined when HMR is disabled, and resolves via explicit → HMR_PORT → auto-discovery (24678–24690).
Vite Dev Server Integration
packages/likec4/src/vite/vite-dev.ts
Config type gains optional hmrPort; viteDev calls resolveHmrPort, logs source, and sets server.hmr.port only when a port is resolved.
Handler Tests
packages/likec4/src/cli/serve/serve.spec.ts
Vitest suite mocks heavy deps and verifies hmrPort is forwarded to viteDev in various scenarios.
HMR Resolution Tests
packages/likec4/src/vite/vite-dev.spec.ts
Unit tests for resolveHmrPort covering auto-discovery, explicit override, env fallback, precedence, and disabled-HMR behavior with mocked get-port and std-env.
Documentation
.changeset/specify-hmr-port.md, apps/docs/src/content/docs/tooling/cli.mdx, apps/docs/src/content/docs/tooling/docker.mdx
Changelog and docs updated to describe --hmr-port, HMR_PORT, auto-discovery range, and Docker pinning example.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant CLI
  participant Handler
  participant resolveHmrPort
  participant Vite
  User->>CLI: run start --hmr-port / omit
  CLI->>Handler: pass hmrPort (or undefined)
  Handler->>resolveHmrPort: resolve(hmrPort, hmrEnabled)
  resolveHmrPort-->>Handler: resolvedHmrPort
  Handler->>Vite: createServer({ server.hmr.port: resolvedHmrPort? })
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Suggested reviewers

  • davydkov
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main feature added: support for specifying the HMR port in the CLI start command, which is the core change across all modified files.
Description check ✅ Passed The PR description follows the template structure with all checklist items completed and checked, indicating thorough adherence to contribution requirements including tests, documentation updates, and changesets.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kieron/specify-hmr-port

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/likec4/src/vite/vite-dev.ts (1)

31-31: ⚡ Quick win

Prefer Number.parseInt over global parseInt.

Modern JavaScript best practice is to use Number.parseInt for better clarity and to avoid potential global namespace pollution.

♻️ Proposed fix
-  const port = explicitPort ?? (env['HMR_PORT'] ? parseInt(env['HMR_PORT'], 10) : undefined)
+  const port = explicitPort ?? (env['HMR_PORT'] ? Number.parseInt(env['HMR_PORT'], 10) : undefined)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4/src/vite/vite-dev.ts` at line 31, Replace the use of the
global parseInt when deriving port so it uses Number.parseInt for clarity and to
avoid global namespace usage; specifically update the expression assigning port
(which checks explicitPort and env['HMR_PORT']) to call
Number.parseInt(env['HMR_PORT'], 10) instead of parseInt, keeping the same
fallback/undefined behavior for explicitPort and missing HMR_PORT.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/likec4/src/vite/vite-dev.ts`:
- Line 31: Replace the use of the global parseInt when deriving port so it uses
Number.parseInt for clarity and to avoid global namespace usage; specifically
update the expression assigning port (which checks explicitPort and
env['HMR_PORT']) to call Number.parseInt(env['HMR_PORT'], 10) instead of
parseInt, keeping the same fallback/undefined behavior for explicitPort and
missing HMR_PORT.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8c697e6c-a5df-406f-bda5-63e6b2129e24

📥 Commits

Reviewing files that changed from the base of the PR and between 87aabdb and 96d2e17.

📒 Files selected for processing (9)
  • .changeset/specify-hmr-port.md
  • apps/docs/src/content/docs/tooling/cli.mdx
  • apps/docs/src/content/docs/tooling/docker.mdx
  • packages/likec4/src/cli/options.ts
  • packages/likec4/src/cli/serve/index.ts
  • packages/likec4/src/cli/serve/serve.spec.ts
  • packages/likec4/src/cli/serve/serve.ts
  • packages/likec4/src/vite/vite-dev.spec.ts
  • packages/likec4/src/vite/vite-dev.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new CLI option to pin the Vite HMR WebSocket port for likec4 start (and its serve/dev aliases), improving reliability in containerized/networked setups where port publishing must be explicit.

Changes:

  • Added --hmr-port CLI option (and HMR_PORT env support) and wired it through the start handler into Vite dev server creation.
  • Refactored HMR port selection into a testable helper with unit tests.
  • Updated CLI and Docker documentation plus added a changeset entry.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/likec4/src/vite/vite-dev.ts Introduces resolveHmrPort and uses it to configure Vite HMR port.
packages/likec4/src/vite/vite-dev.spec.ts Adds unit tests for HMR port resolution behavior.
packages/likec4/src/cli/serve/serve.ts Extends handler params to accept hmrPort and passes it to viteDev.
packages/likec4/src/cli/serve/serve.spec.ts Adds unit tests verifying hmrPort wiring from handler to viteDev.
packages/likec4/src/cli/serve/index.ts Adds --hmr-port yargs option for start/serve/dev.
packages/likec4/src/cli/options.ts Defines the hmrPort yargs option metadata/description.
apps/docs/src/content/docs/tooling/docker.mdx Documents HMR port pinning and docker port publishing guidance.
apps/docs/src/content/docs/tooling/cli.mdx Documents --hmr-port alongside other dev server options.
.changeset/specify-hmr-port.md Adds a patch changeset describing the new option and env var behavior.

Comment thread packages/likec4/src/vite/vite-dev.ts Outdated
Comment on lines +31 to +35
const port = explicitPort ?? (env['HMR_PORT'] ? parseInt(env['HMR_PORT'], 10) : undefined)
if (port) {
return port
}
return getPort({ port: portNumbers(24678, 24690) })
Comment on lines +47 to +56
await handler({
path: '/tmp/test',
useDotBin: false,
webcomponentPrefix: 'likec4',
title: undefined,
useHashHistory: undefined,
enableHMR: false, // disable HMR to simplify – we only care about propagation
enableWebcomponent: false,
hmrPort: 24700,
})
@kieronlanning kieronlanning requested a review from davydkov May 9, 2026 11:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (3)
packages/likec4/src/vite/vite-dev.ts (3)

31-31: 💤 Low value

Consider using Number.parseInt for clarity.

While parseInt works correctly here, using Number.parseInt makes it explicit that you're calling the method from the global Number object, which is preferred in modern TypeScript codebases.

♻️ Optional refactor
-  const port = explicitPort ?? (env['HMR_PORT'] ? parseInt(env['HMR_PORT'], 10) : undefined)
+  const port = explicitPort ?? (env['HMR_PORT'] ? Number.parseInt(env['HMR_PORT'], 10) : undefined)

As per coding guidelines, use oxlint for linting (which flagged this via SonarCloud).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4/src/vite/vite-dev.ts` at line 31, The variable declaration
for port uses the global parseInt; update it to use Number.parseInt for clarity
and consistency: change the parseInt call in the expression assigning port
(referencing variables explicitPort and env['HMR_PORT']) to
Number.parseInt(env['HMR_PORT'], 10) so the codebase explicitly uses the Number
namespace as per linting guidelines.

90-95: ⚡ Quick win

Enhance logging to distinguish port sources.

The current logging shows (explicit) only when hmrPort argument is provided, but doesn't distinguish between environment variable and auto-discovered ports. Users who set HMR_PORT environment variable won't see any source label, which could be confusing.

📊 Suggested logging enhancement
  const resolvedHmrPort = await resolveHmrPort(hmrPort, hmr)
  if (hmr && resolvedHmrPort !== undefined) {
-    const source = hmrPort ? ' (explicit)' : ''
+    let source = ''
+    if (hmrPort !== undefined) {
+      source = ' (via --hmr-port)'
+    } else if (env['HMR_PORT']) {
+      source = ' (via HMR_PORT env)'
+    } else {
+      source = ' (auto-discovered)'
+    }
     logger.info(`Enabling HMR: localhost:${resolvedHmrPort}${source}`)
     if (isInsideContainer()) {
       logger.info(k.yellow(`ensure port ${resolvedHmrPort} is published from container`))
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4/src/vite/vite-dev.ts` around lines 90 - 95, The log for HMR
port should indicate whether the port came from an explicit hmrPort argument,
from the HMR_PORT environment variable, or was auto-discovered; update the
message around the hmr/resolvedHmrPort logic so the source string is set based
on hmrPort (explicit), process.env.HMR_PORT (env), or default/auto
(auto-discovered) and include that source label in the logger.info call that
currently references logger.info(`Enabling HMR:
localhost:${resolvedHmrPort}${source}`); keep the isInsideContainer() check and
its message unchanged.

24-36: ⚡ Quick win

Consider validating port numbers are in valid range.

The function accepts explicitPort without validating it's a valid port number (1–65535). Similarly, when parsing HMR_PORT from the environment, the result isn't range-checked. While invalid ports will cause Vite server startup to fail with an error, early validation would provide clearer feedback to users.

🛡️ Suggested validation
 export async function resolveHmrPort(
   explicitPort: number | undefined,
   hmrEnabled: boolean,
 ): Promise<number | undefined> {
   if (!hmrEnabled) {
     return undefined
   }
   const port = explicitPort ?? (env['HMR_PORT'] ? Number.parseInt(env['HMR_PORT'], 10) : undefined)
-  if (port) {
+  if (port !== undefined && !Number.isNaN(port)) {
+    if (port < 1 || port > 65535) {
+      throw new Error(`Invalid HMR port: ${port}. Must be between 1 and 65535.`)
+    }
     return port
   }
   return getPort({ port: portNumbers(24678, 24690) })
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4/src/vite/vite-dev.ts` around lines 24 - 36, The
resolveHmrPort function currently accepts explicitPort and parses
env['HMR_PORT'] without range checks; validate both explicitPort and the parsed
envPort are integers between 1 and 65535 before returning them, and if either is
out of range throw a clear Error indicating the invalid value and whether it
came from explicitPort or HMR_PORT; keep the fallback to getPort({ port:
portNumbers(24678, 24690) }) unchanged and only call it when no valid
explicit/env port is provided.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/likec4/src/vite/vite-dev.ts`:
- Line 31: The variable declaration for port uses the global parseInt; update it
to use Number.parseInt for clarity and consistency: change the parseInt call in
the expression assigning port (referencing variables explicitPort and
env['HMR_PORT']) to Number.parseInt(env['HMR_PORT'], 10) so the codebase
explicitly uses the Number namespace as per linting guidelines.
- Around line 90-95: The log for HMR port should indicate whether the port came
from an explicit hmrPort argument, from the HMR_PORT environment variable, or
was auto-discovered; update the message around the hmr/resolvedHmrPort logic so
the source string is set based on hmrPort (explicit), process.env.HMR_PORT
(env), or default/auto (auto-discovered) and include that source label in the
logger.info call that currently references logger.info(`Enabling HMR:
localhost:${resolvedHmrPort}${source}`); keep the isInsideContainer() check and
its message unchanged.
- Around line 24-36: The resolveHmrPort function currently accepts explicitPort
and parses env['HMR_PORT'] without range checks; validate both explicitPort and
the parsed envPort are integers between 1 and 65535 before returning them, and
if either is out of range throw a clear Error indicating the invalid value and
whether it came from explicitPort or HMR_PORT; keep the fallback to getPort({
port: portNumbers(24678, 24690) }) unchanged and only call it when no valid
explicit/env port is provided.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a86df92f-c78c-462a-b9b3-614f41d57902

📥 Commits

Reviewing files that changed from the base of the PR and between 96d2e17 and a482c72.

📒 Files selected for processing (1)
  • packages/likec4/src/vite/vite-dev.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/likec4/src/vite/vite-dev.ts (1)

100-100: ⚡ Quick win

Extract nested ternary for improved readability.

The nested ternary operator reduces readability. As per the static analysis hint, consider extracting this logic into a separate variable or using if-else statements.

♻️ Proposed refactor
   const resolvedHmrPort = await resolveHmrPort(hmrPort, hmr)
   if (hmr && resolvedHmrPort !== undefined) {
-    const source = hmrPort ? ' (explicit)' : env['HMR_PORT'] ? ' (env)' : ' (auto-discovered)'
+    let source = ' (auto-discovered)'
+    if (hmrPort) {
+      source = ' (explicit)'
+    } else if (env['HMR_PORT']) {
+      source = ' (env)'
+    }
     logger.info(`Enabling HMR: localhost:${resolvedHmrPort}${source}`)

As per coding guidelines, this aligns with the preference for clearer control flow over compact but harder-to-read expressions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4/src/vite/vite-dev.ts` at line 100, The nested ternary
assigning source is hard to read; replace it by computing a descriptive string
with a small if/else or switch before the assignment so source is set from a
clear variable — use the existing identifiers hmrPort and env['HMR_PORT'] to
decide between " (explicit)", " (env)", and " (auto-discovered)" and then assign
that value to source (keep the symbol name source so downstream code is
unchanged).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/likec4/src/vite/vite-dev.ts`:
- Around line 32-34: Extract the duplicated port validation into a single helper
(e.g., validatePort) and call it from both the explicitPort branch and the
environment-variable branch instead of repeating the Number.isInteger/1-65535
checks; update the code that currently uses explicitPort and the code that reads
the HMR port from env (the duplicated checks around explicitPort and the
corresponding env path) to invoke validatePort(port, 'explicitPort'|'env') which
throws the same Error message on invalid input so validation behavior remains
consistent and maintainable.

---

Nitpick comments:
In `@packages/likec4/src/vite/vite-dev.ts`:
- Line 100: The nested ternary assigning source is hard to read; replace it by
computing a descriptive string with a small if/else or switch before the
assignment so source is set from a clear variable — use the existing identifiers
hmrPort and env['HMR_PORT'] to decide between " (explicit)", " (env)", and "
(auto-discovered)" and then assign that value to source (keep the symbol name
source so downstream code is unchanged).
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1e591671-c807-4cf9-b804-25b86c67babf

📥 Commits

Reviewing files that changed from the base of the PR and between a482c72 and 42be85b.

📒 Files selected for processing (1)
  • packages/likec4/src/vite/vite-dev.ts

Comment thread packages/likec4/src/vite/vite-dev.ts Outdated
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • packages/likec4/src/vite/vite-dev.ts

Commit: 0018e841791aa3f5637c1d91841b18ea4389c9b6

The changes have been pushed to the kieron/specify-hmr-port branch.

Time taken: 4m 20s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/likec4/src/vite/vite-dev.ts (1)

107-116: ⚡ Quick win

Consider extracting the nested ternary for clarity.

The nested ternary at line 109 correctly determines the source of the HMR port, but could be made more readable by extracting it into separate if statements or a small helper. Additionally, using hmrPort !== undefined instead of the truthiness check would be more consistent with the logic in resolveHmrPort and more robust.

♻️ Proposed refactor
  const resolvedHmrPort = await resolveHmrPort(hmrPort, hmr)
  if (hmr && resolvedHmrPort !== undefined) {
-    const source = hmrPort ? ' (explicit)' : env['HMR_PORT'] ? ' (env)' : ' (auto-discovered)'
+    let source: string
+    if (hmrPort !== undefined) {
+      source = ' (explicit)'
+    } else if (env['HMR_PORT']) {
+      source = ' (env)'
+    } else {
+      source = ' (auto-discovered)'
+    }
    logger.info(`Enabling HMR: localhost:${resolvedHmrPort}${source}`)

As per coding guidelines, the repository prefers clarity in TypeScript code; extracting the nested ternary aligns with best practices for maintainable code.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/likec4/src/vite/vite-dev.ts` around lines 107 - 116, The nested
ternary that builds the source label for HMR is hard to read and uses a
truthiness check on hmrPort; replace that expression by computing the source
string in a small local block (e.g., before the logger.info) using explicit
if/else or a helper so you can check hmrPort !== undefined, then fall back to
env['HMR_PORT'] and then to 'auto-discovered'; update the logger.info call that
uses resolvedHmrPort and source to use the new variable and keep the existing
isInsideContainer() branch as-is (references: resolvedHmrPort, hmrPort,
env['HMR_PORT'], logger.info, isInsideContainer()).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/likec4/src/vite/vite-dev.ts`:
- Around line 107-116: The nested ternary that builds the source label for HMR
is hard to read and uses a truthiness check on hmrPort; replace that expression
by computing the source string in a small local block (e.g., before the
logger.info) using explicit if/else or a helper so you can check hmrPort !==
undefined, then fall back to env['HMR_PORT'] and then to 'auto-discovered';
update the logger.info call that uses resolvedHmrPort and source to use the new
variable and keep the existing isInsideContainer() branch as-is (references:
resolvedHmrPort, hmrPort, env['HMR_PORT'], logger.info, isInsideContainer()).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 99e4968a-0c43-48a6-be7e-56a2bb2bb7ee

📥 Commits

Reviewing files that changed from the base of the PR and between 42be85b and 0018e84.

📒 Files selected for processing (1)
  • packages/likec4/src/vite/vite-dev.ts

@davydkov davydkov merged commit 3726863 into main May 16, 2026
18 checks passed
@davydkov davydkov deleted the kieron/specify-hmr-port branch May 16, 2026 11:19
@likec4-ci likec4-ci Bot mentioned this pull request May 16, 2026
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.

3 participants