syntaur 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -7262,11 +7262,24 @@ async function findAvailablePort(startPort, maxAttempts = 20) {
7262
7262
  async function dashboardCommand(options) {
7263
7263
  const config = await readConfig();
7264
7264
  const missionsDir = config.defaultMissionDir;
7265
- const port = parseInt(options.port, 10);
7266
- if (isNaN(port) || port < 1 || port > 65535) {
7265
+ const requestedPort = parseInt(options.port, 10);
7266
+ if (isNaN(requestedPort) || requestedPort < 1 || requestedPort > 65535) {
7267
7267
  throw new Error(`Invalid port "${options.port}". Must be a number between 1 and 65535.`);
7268
7268
  }
7269
7269
  const mode = resolveDashboardMode(options);
7270
+ let port = requestedPort;
7271
+ if (options.autoPort) {
7272
+ const availablePort = await findAvailablePort(requestedPort);
7273
+ if (availablePort === null) {
7274
+ throw new Error(
7275
+ `Could not find an available dashboard port starting at ${requestedPort}. Run "syntaur dashboard --port <number>" to choose one manually.`
7276
+ );
7277
+ }
7278
+ if (availablePort !== requestedPort) {
7279
+ console.log(`Port ${requestedPort} is busy. Launching the dashboard on port ${availablePort} instead.`);
7280
+ }
7281
+ port = availablePort;
7282
+ }
7270
7283
  const server = createDashboardServer({
7271
7284
  port,
7272
7285
  missionsDir,
@@ -9435,9 +9448,13 @@ program.command("create-assignment").description("Create a new assignment within
9435
9448
  process.exit(1);
9436
9449
  }
9437
9450
  });
9438
- program.command("dashboard").description("Start the local Syntaur dashboard web UI").option("--port <number>", "Port to run the dashboard on", "4800").option("--dev", "Run the dashboard with the Vite dev server", false).option("--server-only", "Run only the API server without any UI", false).option("--api-only", "Deprecated alias for --server-only", false).option("--no-open", "Do not automatically open the browser").action(async (options) => {
9451
+ program.command("dashboard").description("Start the local Syntaur dashboard web UI").option("--port <number>", "Port to run the dashboard on", "4800").option("--dev", "Run the dashboard with the Vite dev server", false).option("--server-only", "Run only the API server without any UI", false).option("--api-only", "Deprecated alias for --server-only", false).option("--no-open", "Do not automatically open the browser").action(async (options, command) => {
9439
9452
  try {
9440
- await dashboardCommand(options);
9453
+ const autoPort = command.getOptionValueSource("port") !== "cli";
9454
+ await dashboardCommand({
9455
+ ...options,
9456
+ autoPort
9457
+ });
9441
9458
  } catch (error) {
9442
9459
  console.error(
9443
9460
  "Error:",