constants.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * User-facing constants for the `codegraph ui` server.
  3. *
  4. * Deliberately dependency-free so the CLI can import them for `--help` text
  5. * without pulling `node:http` (and the rest of the server) into every
  6. * invocation of every other subcommand. `ui-server/index.ts` re-exports them,
  7. * so consumers have one import to reach for.
  8. */
  9. /** The port `codegraph ui` asks for first. */
  10. export const DEFAULT_UI_PORT = 4747;
  11. /** How many consecutive ports to try before giving up. */
  12. export const DEFAULT_PORT_ATTEMPTS = 20;
  13. /**
  14. * The only interface the server ever binds. Not configurable, on purpose: this
  15. * process serves the user's source code, and a `--host` flag is one typo away
  16. * from publishing it to the local network.
  17. */
  18. export const LOOPBACK_ADDRESS = '127.0.0.1';
  19. /**
  20. * Overrides which browser (if any) `codegraph ui` launches. `none` — or `0`,
  21. * `false`, `off`, or an empty value — suppresses the launch entirely, the same
  22. * as `--no-open`. Any other value is run as a command with the URL as its
  23. * single argument.
  24. */
  25. export const BROWSER_ENV = 'CODEGRAPH_BROWSER';
  26. /**
  27. * Development/test override for the directory served as the viewer. Point it at
  28. * a directory containing an `index.html` to serve something other than the
  29. * shipped build.
  30. */
  31. export const VIEWER_PATH_ENV = 'CODEGRAPH_VIEWER_PATH';