mirror of
https://github.com/obra/superpowers.git
synced 2026-04-23 09:59:05 +08:00
Write server-info to file so agents can find URL after background launch
The server now writes its startup JSON to $SCREEN_DIR/.server-info. Agents that launch the server via background execution (where stdout is hidden) can read this file to get the URL, port, and screen_dir.
This commit is contained in:
@@ -130,12 +130,18 @@ chokidar.watch(SCREEN_DIR, { ignoreInitial: true })
|
||||
});
|
||||
|
||||
server.listen(PORT, HOST, () => {
|
||||
console.log(JSON.stringify({
|
||||
const info = JSON.stringify({
|
||||
type: 'server-started',
|
||||
port: PORT,
|
||||
host: HOST,
|
||||
url_host: URL_HOST,
|
||||
url: `http://${URL_HOST}:${PORT}`,
|
||||
screen_dir: SCREEN_DIR
|
||||
}));
|
||||
});
|
||||
console.log(info);
|
||||
// Write to .server-info so agents can find connection details
|
||||
// even when stdout is hidden (e.g. background execution)
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
fs.writeFileSync(path.join(SCREEN_DIR, '.server-info'), info + '\n');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user