#!/usr/bin/env node
import { spawnSync } from 'node:child_process';

const vitePort = Number(process.env.VITE_PORT ?? 5173);
const url = `http://127.0.0.1:${vitePort}/?preview=mindspace`;

const result = spawnSync('open', [url], { stdio: 'ignore' });
if (result.status === 0) {
  console.log(`已打开 ${url}`);
} else {
  console.log(`请手动打开：${url}`);
}
