feat: integrate HAI-001 auto-open browser

This commit is contained in:
Dustin Byrne
2026-03-25 18:33:16 -04:00
parent f70bd6895d
commit c99b08b585
2 changed files with 16 additions and 2 deletions

View File

@@ -1,8 +1,17 @@
import { exec } from "node:child_process";
import { TaskStore } from "@hai/core";
import { createServer } from "@hai/dashboard";
import { TriageProcessor, TaskExecutor, Scheduler } from "@hai/engine";
export async function runDashboard(port: number, opts: { engine?: boolean } = {}) {
function openBrowser(url: string): void {
const cmd =
process.platform === "darwin" ? `open "${url}"`
: process.platform === "win32" ? `start "" "${url}"`
: `xdg-open "${url}"`;
exec(cmd, () => {});
}
export async function runDashboard(port: number, opts: { engine?: boolean; open?: boolean } = {}) {
const cwd = process.cwd();
const store = new TaskStore(cwd);
await store.init();
@@ -56,5 +65,9 @@ export async function runDashboard(port: number, opts: { engine?: boolean } = {}
}
console.log(` Press Ctrl+C to stop`);
console.log();
if (opts.open !== false) {
openBrowser(`http://localhost:${port}`);
}
});
}