feat: auto-open browser after onboard completes
Set PAPERCLIP_OPEN_ON_LISTEN env flag when onboard triggers a run, and open the browser to the UI URL once the server starts listening. Uses the `open` package for cross-platform browser launching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -497,6 +497,18 @@ if (config.heartbeatSchedulerEnabled) {
|
||||
|
||||
server.listen(listenPort, config.host, () => {
|
||||
logger.info(`Server listening on ${config.host}:${listenPort}`);
|
||||
if (process.env.PAPERCLIP_OPEN_ON_LISTEN === "true") {
|
||||
const openHost = config.host === "0.0.0.0" || config.host === "::" ? "127.0.0.1" : config.host;
|
||||
const url = `http://${openHost}:${listenPort}`;
|
||||
void import("open")
|
||||
.then((mod) => mod.default(url))
|
||||
.then(() => {
|
||||
logger.info(`Opened browser at ${url}`);
|
||||
})
|
||||
.catch((err) => {
|
||||
logger.warn({ err, url }, "Failed to open browser on startup");
|
||||
});
|
||||
}
|
||||
printStartupBanner({
|
||||
host: config.host,
|
||||
deploymentMode: config.deploymentMode,
|
||||
|
||||
Reference in New Issue
Block a user