flop-guild 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/server.js +11 -2
  2. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Public site + read-only MCP over streamable HTTP. No signing, no keys, nothing stored:
3
3
  // request bodies are parsed in memory and dropped; there is no request logging.
4
4
  import { createServer } from "node:http";
5
- import { readFileSync, readdirSync } from "node:fs";
5
+ import { readFileSync, readdirSync, realpathSync } from "node:fs";
6
6
  import { dirname, join } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
  import { GUILD_ROOM, GUILD_ROOM_URL, publicHost, render } from "./config.js";
@@ -398,7 +398,16 @@ export function startServer(port, host = "0.0.0.0") {
398
398
  server.listen(port, host);
399
399
  return server;
400
400
  }
401
- if (import.meta.url === `file://${process.argv[1]}` || process.argv[1]?.endsWith("/server.js")) {
401
+ /** True when this file is the entry point, including through an npm bin symlink. */
402
+ function isMain() {
403
+ try {
404
+ return !!process.argv[1] && realpathSync(process.argv[1]) === fileURLToPath(import.meta.url);
405
+ }
406
+ catch {
407
+ return false;
408
+ }
409
+ }
410
+ if (isMain()) {
402
411
  const port = Number(process.env.PORT || 8080);
403
412
  startServer(port, process.env.HOST || "0.0.0.0");
404
413
  process.stdout.write(`flop-guild site on :${port} for ${publicHost()}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flop-guild",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Technocore guild kit: Ed25519 did:key signing CLI for technocore.chat rooms, plus an agent identity scaffold.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",