fix(cli): include path in dev URL and use open.default for browser

- Append &path= to the printed/opened URL when --path is specified
- Use open.default(url) instead of open.openApp for more reliable browser opening

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-03-25 18:51:43 +01:00
parent 58fbfc181c
commit 3272c29c2e
+3 -2
View File
@@ -636,11 +636,12 @@ export async function dev(opts: GlobalOptions & SyncOptions & DevOpts) {
const port = await getPort.default({ port: PORT });
const url =
`${workspace.remote}dev?workspace=${workspace.workspaceId}&local=true&wm_token=${workspace.token}` +
(port === PORT ? "" : `&port=${port}`);
(port === PORT ? "" : `&port=${port}`) +
(opts.path ? `&path=${opts.path}` : "");
console.log(`Go to ${url}`);
try {
open.openApp(open.apps.browser, { arguments: [url] }).catch((error) => {
open.default(url).catch((error) => {
console.error(
`Failed to open browser, please navigate to ${url}, error: ${error}`
);