screw-bugs 0.1.9 → 0.1.10

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 (102) hide show
  1. package/README.md +49 -34
  2. package/dist/browser-playwright/capture.js +1 -1
  3. package/dist/build-info.json +3 -3
  4. package/dist/cli/app.js +6 -2
  5. package/dist/cli/commands.js +4 -3
  6. package/dist/cli/doctor.d.ts +17 -2
  7. package/dist/cli/doctor.js +62 -4
  8. package/dist/cli/mcp.js +2 -2
  9. package/dist/cli/report-server.d.ts +19 -10
  10. package/dist/cli/report-server.js +43 -18
  11. package/dist/cli/share.js +2 -2
  12. package/dist/cli/sign-in.d.ts +9 -3
  13. package/dist/cli/sign-in.js +12 -9
  14. package/dist/cli/tailnet.d.ts +57 -0
  15. package/dist/cli/tailnet.js +82 -0
  16. package/dist/core/index.d.ts +1 -14
  17. package/dist/core/index.js +3 -14
  18. package/dist/report/index.d.ts +1 -10
  19. package/dist/report/index.js +3 -10
  20. package/dist/schema/index.d.ts +1 -9
  21. package/dist/schema/index.js +3 -9
  22. package/package.json +14 -14
  23. package/dist/core/accounts.d.ts +0 -40
  24. package/dist/core/accounts.js +0 -95
  25. package/dist/core/css.d.ts +0 -95
  26. package/dist/core/css.js +0 -436
  27. package/dist/core/engine.d.ts +0 -75
  28. package/dist/core/engine.js +0 -560
  29. package/dist/core/errors.d.ts +0 -85
  30. package/dist/core/errors.js +0 -36
  31. package/dist/core/evidence.d.ts +0 -14
  32. package/dist/core/evidence.js +0 -131
  33. package/dist/core/labels.d.ts +0 -47
  34. package/dist/core/labels.js +0 -199
  35. package/dist/core/liveness.d.ts +0 -45
  36. package/dist/core/liveness.js +0 -66
  37. package/dist/core/marks.d.ts +0 -63
  38. package/dist/core/marks.js +0 -410
  39. package/dist/core/services.d.ts +0 -579
  40. package/dist/core/services.js +0 -25
  41. package/dist/core/share.d.ts +0 -68
  42. package/dist/core/share.js +0 -318
  43. package/dist/core/steps.d.ts +0 -106
  44. package/dist/core/steps.js +0 -722
  45. package/dist/core/uploads.d.ts +0 -49
  46. package/dist/core/uploads.js +0 -133
  47. package/dist/core/video.d.ts +0 -53
  48. package/dist/core/video.js +0 -241
  49. package/dist/core/viewport.d.ts +0 -28
  50. package/dist/core/viewport.js +0 -50
  51. package/dist/report/assets.d.ts +0 -34
  52. package/dist/report/assets.js +0 -105
  53. package/dist/report/bug.d.ts +0 -11
  54. package/dist/report/bug.js +0 -20
  55. package/dist/report/html.d.ts +0 -47
  56. package/dist/report/html.js +0 -923
  57. package/dist/report/icons.d.ts +0 -51
  58. package/dist/report/icons.js +0 -93
  59. package/dist/report/live.d.ts +0 -7
  60. package/dist/report/live.js +0 -135
  61. package/dist/report/logos.d.ts +0 -4
  62. package/dist/report/logos.js +0 -19
  63. package/dist/report/markup.d.ts +0 -50
  64. package/dist/report/markup.js +0 -156
  65. package/dist/report/menu-bar.d.ts +0 -60
  66. package/dist/report/menu-bar.js +0 -157
  67. package/dist/report/player.d.ts +0 -102
  68. package/dist/report/player.js +0 -315
  69. package/dist/report/pr-summary.d.ts +0 -11
  70. package/dist/report/pr-summary.js +0 -119
  71. package/dist/report/sha256.d.ts +0 -9
  72. package/dist/report/sha256.js +0 -97
  73. package/dist/report/share-page.d.ts +0 -48
  74. package/dist/report/share-page.js +0 -291
  75. package/dist/report/shots.d.ts +0 -59
  76. package/dist/report/shots.js +0 -280
  77. package/dist/report/sign-in.d.ts +0 -41
  78. package/dist/report/sign-in.js +0 -568
  79. package/dist/report/styles.d.ts +0 -3
  80. package/dist/report/styles.js +0 -274
  81. package/dist/report/view.d.ts +0 -296
  82. package/dist/report/view.js +0 -702
  83. package/dist/report/walkthrough.d.ts +0 -93
  84. package/dist/report/walkthrough.js +0 -716
  85. package/dist/schema/accounts.d.ts +0 -137
  86. package/dist/schema/accounts.js +0 -121
  87. package/dist/schema/config.d.ts +0 -7
  88. package/dist/schema/config.js +0 -6
  89. package/dist/schema/doctor.d.ts +0 -46
  90. package/dist/schema/doctor.js +0 -30
  91. package/dist/schema/evidence.d.ts +0 -1115
  92. package/dist/schema/evidence.js +0 -565
  93. package/dist/schema/findings.d.ts +0 -161
  94. package/dist/schema/findings.js +0 -82
  95. package/dist/schema/job.d.ts +0 -1905
  96. package/dist/schema/job.js +0 -577
  97. package/dist/schema/ledger.d.ts +0 -1124
  98. package/dist/schema/ledger.js +0 -285
  99. package/dist/schema/share.d.ts +0 -55
  100. package/dist/schema/share.js +0 -64
  101. package/dist/schema/status.d.ts +0 -7
  102. package/dist/schema/status.js +0 -11
package/README.md CHANGED
@@ -720,7 +720,8 @@ flow itself, or what a visitor sees. The saved accounts are listed in
720
720
  agent can pick the one whose `about` fits what it tests, such as a user on a trial or a paying one.
721
721
 
722
722
  When the account has no saved session for the job URL's origin, nothing starts. Over MCP, the
723
- reply gives a link to the live view (`http://127.0.0.1:<port>/<token>/`); open it, sign in as that
723
+ reply gives a link to the live view (`http://127.0.0.1:<port>/<token>/`, or this machine's tailnet
724
+ name in place of `127.0.0.1` when Tailscale is running); open it, sign in as that
724
725
  user (OAuth redirects and codes by email or an app work; passkeys and security keys do not, since
725
726
  they need your own device), press **Save sign-in**, then
726
727
  have your agent start the job again. `start_run` also takes an optional `waitSeconds` (0–600,
@@ -739,10 +740,12 @@ you can sign in meanwhile. From the CLI, `screw-bugs run` exits with code 9
739
740
  npx screw-bugs accounts sign-in trial-user --url http://localhost:3000 --about "On a 14-day trial"
740
741
  ```
741
742
 
742
- - **On another device.** The live view listens on 127.0.0.1, so by default it opens only on this
743
- machine (in your coding tool's browser, for example). To sign in from your phone or another
744
- computer on your network or tailnet, set `SCREW_BUGS_SIGN_IN_HOST` as `SCREW_BUGS_REPORT_HOST`
745
- (below): this machine's full MagicDNS name or its Tailscale IP (`tailscale ip -4`). The link
743
+ - **On another device.** When Tailscale is running, the live view listens at this machine's
744
+ MagicDNS name, so you can sign in from your phone or another computer on your tailnet; without
745
+ it, on 127.0.0.1, so it opens only on this machine (in your coding tool's browser, for example).
746
+ It follows `SCREW_BUGS_REPORT_HOST` (below; `127.0.0.1` keeps it on this machine), or set
747
+ `SCREW_BUGS_SIGN_IN_HOST` for the live view alone: `tailnet`, this machine's full MagicDNS name
748
+ or its Tailscale IP (`tailscale ip -4`). The link
746
749
  then uses what you set, and with a name the IP it resolves to works too. It never listens on
747
750
  every interface. The link holds a random token and works only while that
748
751
  sign-in is open; it closes when you save or cancel, after 15 minutes without use, or when the
@@ -762,24 +765,24 @@ npx screw-bugs accounts sign-in trial-user --url http://localhost:3000 --about "
762
765
 
763
766
  ## CLI
764
767
 
765
- | Command | What it does |
766
- | ---------------------------------------------- | ---------------------------------------------- |
767
- | `doctor` | Check Node, browser, video, disk and updates |
768
- | `run [--spec job.json] [--url <url>]` | Run cases and wait; exit 1 unless all passed |
769
- | `status <job-id>` | State and case results of a run |
770
- | `answer <job-id> <question-id>` | Answer a question a waiting run asked |
771
- | `mcp` | Serve the MCP server over stdio |
772
- | `setup [--agent <name>] [--no-downloads]` | Set up this project in one command (above) |
773
- | `init` | Write `screw-bugs.json` for this project |
774
- | `accounts [sign-in <label> \| remove <label>]` | List, sign in to or remove test accounts |
775
- | `report <job-id> [--format markdown]` | Write the report, or print a PR summary |
776
- | `report <job-id> --serve [--port N]` | Serve the report at a `http://127.0.0.1` URL |
777
- | `walkthrough <job-id> [--serve]` | Write (or serve) the run's video walkthrough |
778
- | `findings <job-id> <file\|->` | Submit an agent's write-up of an ended run |
779
- | `schema <job\|findings>` | Print the JSON Schema of a job or write-up |
780
- | `share <job-id>` | Share a report through Screw Bugs Cloud |
781
- | `runs` | List recent runs |
782
- | `analytics` | Show whether analytics are on (off by default) |
768
+ | Command | What it does |
769
+ | ---------------------------------------------- | ------------------------------------------------------- |
770
+ | `doctor` | Check Node, browser, video, disk, Tailscale and updates |
771
+ | `run [--spec job.json] [--url <url>]` | Run cases and wait; exit 1 unless all passed |
772
+ | `status <job-id>` | State and case results of a run |
773
+ | `answer <job-id> <question-id>` | Answer a question a waiting run asked |
774
+ | `mcp` | Serve the MCP server over stdio |
775
+ | `setup [--agent <name>] [--no-downloads]` | Set up this project in one command (above) |
776
+ | `init` | Write `screw-bugs.json` for this project |
777
+ | `accounts [sign-in <label> \| remove <label>]` | List, sign in to or remove test accounts |
778
+ | `report <job-id> [--format markdown]` | Write the report, or print a PR summary |
779
+ | `report <job-id> --serve [--port N]` | Serve the report at a local or tailnet URL |
780
+ | `walkthrough <job-id> [--serve]` | Write (or serve) the run's video walkthrough |
781
+ | `findings <job-id> <file\|->` | Submit an agent's write-up of an ended run |
782
+ | `schema <job\|findings>` | Print the JSON Schema of a job or write-up |
783
+ | `share <job-id>` | Share a report through Screw Bugs Cloud |
784
+ | `runs` | List recent runs |
785
+ | `analytics` | Show whether analytics are on (off by default) |
783
786
 
784
787
  Every command accepts `--json`. `run --url <url>` alone checks that the page loads. `init --url
785
788
  <url>` saves a default URL, so a bare `run` uses it.
@@ -853,8 +856,8 @@ with the highlights drawn over it (a checkbox hides them) and the element the st
853
856
  arrow keys step through the case's screenshots. "Steps and details" opens the case's steps with
854
857
  their timecodes and the agent's write-up of it. Then what to test next, and the run's details
855
858
  (what it checks, target, times, video, version, raw files). Scrolling the cases drives the player:
856
- the case at the reading line plays, in a loop unless "Loop case" is off, when the cases follow the
857
- video instead. Code lays out the page and decides every status, except that the agent's write-up
859
+ the case at the reading line plays and the cases follow the video; with "Loop case" on (it starts
860
+ off) the case plays in a loop instead. Code lays out the page and decides every status, except that the agent's write-up
858
861
  may mark a case failed (its card then says so, as the agent's verdict, beside the code's result);
859
862
  the write-up fills fixed slots and is labelled as its own.
860
863
 
@@ -960,7 +963,7 @@ leaves the report as it is. The report links it near the top when it exists.
960
963
 
961
964
  ```sh
962
965
  screw-bugs walkthrough <job-id> # (re)write it (not the report) and print its URL
963
- screw-bugs walkthrough <job-id> --serve # serve it at a http://127.0.0.1 URL, as report --serve
966
+ screw-bugs walkthrough <job-id> --serve # serve it at a local or tailnet URL, as report --serve
964
967
  ```
965
968
 
966
969
  With `--json`, `walkthrough` prints `{ "ok": true, "path": "...", "reportPath": "...", "reportUrl":
@@ -993,11 +996,18 @@ desktop app, cannot open `file://` pages, but they can open `http://127.0.0.1`.
993
996
  - From a terminal, `screw-bugs report <job-id> --serve` (or `walkthrough <job-id> --serve`) writes
994
997
  the report as `report` does, prints its URL (or the walkthrough's) and serves until Ctrl+C (which exits with 130, like any interrupted command). With
995
998
  `--json` it prints `{ "url": "...", "ok": true, "path": "...", "reused": false }`.
996
- - **On another device.** The report server listens on 127.0.0.1, so by default its links open only
997
- on this machine. To open reports from your phone or another computer on your network or
998
- tailnet, set `SCREW_BUGS_REPORT_HOST` in the MCP server's environment (or the shell that runs
999
- the commands) to this machine's full MagicDNS name (`pop-os.tail1234.ts.net`, from `tailscale
1000
- status --self`) or its Tailscale IP (`tailscale ip -4`). Links then use what you set. The
999
+ - **On another device.** When Tailscale is running, the report server listens at this machine's
1000
+ MagicDNS name (asked from Tailscale when screw-bugs starts), so its links open on your phone or
1001
+ another computer on your tailnet, and on every other device on it. Without Tailscale (and always
1002
+ in CI, `CI=true`) it listens on 127.0.0.1, so links open only on this machine. `doctor` says
1003
+ which. To keep reports and sign-ins on this machine with Tailscale running, set
1004
+ `SCREW_BUGS_REPORT_HOST=127.0.0.1` in the MCP server's environment (or the shell that runs the
1005
+ commands); on a Linux desktop, for every agent and terminal, put that line in
1006
+ `~/.config/environment.d/screw-bugs.conf` and log out and back in. You can also set it to
1007
+ `tailnet` (the MagicDNS name; when Tailscale is not running, reports stay on 127.0.0.1 and one
1008
+ line on stderr says so, until screw-bugs restarts), this machine's full MagicDNS name
1009
+ (`pop-os.tail1234.ts.net`, from `tailscale status --self`) or its Tailscale IP (`tailscale ip
1010
+ -4`). The sign-in live view follows this setting unless `SCREW_BUGS_SIGN_IN_HOST` is set. Links then use what you set. The
1001
1011
  server listens only on the one address that resolves to, never on every interface, and answers
1002
1012
  requests addressed to the name you set or to that address, so `http://100.x.y.z:…` works with
1003
1013
  the name set (but a bare `http://pop-os:…` only when you set `pop-os`). A name is looked up each
@@ -1050,7 +1060,9 @@ This check cannot stop a process from taking the port after it, such as one that
1050
1060
  moment between another screw-bugs process stopping and this one trying the port again. Links given
1051
1061
  out then reach that process until screw-bugs serves on the port again.
1052
1062
 
1053
- Both listen on 127.0.0.1 only, answer only requests addressed to `127.0.0.1` or `localhost`, and
1063
+ Both listen on one address: 127.0.0.1, or this machine's tailnet name when Tailscale is running
1064
+ (see On another device, above). They answer only requests addressed to that host or its address (and, on
1065
+ 127.0.0.1, `localhost`), and
1054
1066
  serve only the project's run folders, read-only: reports, screenshots, videos and JSON files. They
1055
1067
  never list folders or serve dotfiles, anything outside `.screw-bugs/runs` or symlinks out of it.
1056
1068
  Videos are served with HTTP range requests, so they play and seek (unlike `python3 -m
@@ -1201,5 +1213,8 @@ It uses your Claude subscription: a full run is three Sonnet sessions, about a m
1201
1213
  roughly 70k input tokens (mostly cached) and a few thousand output tokens. It is never run in CI.
1202
1214
 
1203
1215
  `src/` holds one folder per module, each published as a sub-path (`screw-bugs/core`,
1204
- `screw-bugs/schema`, ...). `schema`, `core` and `report` must not import Node, Playwright or other
1205
- modules' internals; `pnpm lint` enforces this.
1216
+ `screw-bugs/schema`, ...). `schema`, `core` and `report` are their own package,
1217
+ [`@screw-bugs/core`](packages/core/README.md) (`packages/core`), which screw-bugs re-exports: it
1218
+ depends only on `effect` and runs on Cloudflare Workers, so it must not import Node, Playwright,
1219
+ any other package or other modules' internals. `pnpm lint` enforces this, and `pnpm check:workers`
1220
+ bundles it for Workers and renders a report with only Workers' globals.
@@ -399,7 +399,7 @@ export const captureState = (options) => {
399
399
  const alt = altOf(el, tag, role);
400
400
  return { label, name, text, alt, testId: testId === null ? undefined : String(testId) };
401
401
  };
402
- // The keys of `candidateKeys` in src/schema; the two must make the same strings.
402
+ // The keys of `candidateKeys` in @screw-bugs/core's schema; the two must make the same strings.
403
403
  const matchText = (text) => text.replace(/\s+/g, ' ').trim().toLowerCase();
404
404
  const keysOf = (c) => [
405
405
  ...(c.role !== undefined ? [JSON.stringify(['role', matchText(c.role)])] : []),
@@ -1,5 +1,5 @@
1
1
  {
2
- "id": "2026-11-18T15:59:29.049Z-56409fa9",
3
- "builtAt": "2026-11-18T15:59:29.049Z",
4
- "commit": "b14b4e16b08bf564288261d44bbf6d89fbf2d061"
2
+ "id": "2026-11-19T22:18:52.547Z-02cb4258",
3
+ "builtAt": "2026-11-19T22:18:52.547Z",
4
+ "commit": "28f7e492960f28e8592ee2f1938b07a080cd9600"
5
5
  }
package/dist/cli/app.js CHANGED
@@ -15,6 +15,7 @@ import { ReportServer } from './report-server.js';
15
15
  import { PlaywrightDownloads, Setup } from './setup.js';
16
16
  import { ShareSource } from './share.js';
17
17
  import { SignIns } from './sign-in.js';
18
+ import { TailnetLive } from './tailnet.js';
18
19
  import { CLI_WAIT, UpdateCheck } from './update-check.js';
19
20
  /** Progress goes nowhere yet; the terminal and MCP notifiers come with real runs. */
20
21
  const NotifierSilent = Layer.succeed(Notifier, { notify: () => Effect.void });
@@ -52,7 +53,10 @@ export const appLayer = (projectRoot) => {
52
53
  Layer.provideMerge(UpdateCheckLive), Layer.provideMerge(PackageInfo.layer),
53
54
  // Starts nothing until a CLI command first gives a report URL.
54
55
  Layer.merge(ReportLinks.layer(projectRoot).pipe(Layer.provide(ReportServerLauncherLive))));
55
- return Setup.layer(projectRoot).pipe(Layer.provide(PlaywrightDownloads.layer), Layer.provideMerge(operations));
56
+ return Setup.layer(projectRoot).pipe(Layer.provide(PlaywrightDownloads.layer), Layer.provideMerge(operations),
57
+ // Under everything, and given to the program too: every link and server of the process uses
58
+ // the one lookup of Tailscale (`SCREW_BUGS_REPORT_HOST=tailnet`).
59
+ Layer.provideMerge(TailnetLive));
56
60
  };
57
61
  /**
58
62
  * The engine on top of the local adapters (which it gives too), for one project folder; it needs
@@ -63,7 +67,7 @@ const engineLayer = (projectRoot) => Engine.layer.pipe(Layer.provideMerge(Layer.
63
67
  * What the detached report server (`serveDetached`) shares runs with: the engine of the project whose
64
68
  * folder is `projectRoot`.
65
69
  */
66
- export const detachedShareLayer = (projectRoot) => ShareSource.layer.pipe(Layer.provide(engineLayer(projectRoot)), Layer.provide(PackageInfo.layer));
70
+ export const detachedShareLayer = (projectRoot) => ShareSource.layer.pipe(Layer.provide(engineLayer(projectRoot)), Layer.provide(PackageInfo.layer), Layer.merge(TailnetLive));
67
71
  /**
68
72
  * Before a command: the line about a newer version (when one is known and due), and, when a check
69
73
  * is due, a check of the registry in the background. Returns the wait for that check, which the
@@ -208,7 +208,8 @@ const status = Command.make('status', { json, jobId: Argument.String('job-id') }
208
208
  }))).pipe(Command.withDescription('Show the state and case results of a run'));
209
209
  const portFlag = Flag.Int('port').pipe(Flag.withDescription("Port for --serve, which fails if it is taken (default: the project's port in 41000-41999, else a free one)"), Flag.optional);
210
210
  /**
211
- * Serves the run folders on 127.0.0.1 or `SCREW_BUGS_REPORT_HOST` (the project's port, see
211
+ * Serves the run folders on the report host (`reportHost`: the tailnet, 127.0.0.1 or
212
+ * `SCREW_BUGS_REPORT_HOST`'s; the project's port, see
212
213
  * `startReportServer`) and prints the URL of `path`, a page in a run folder; runs until Ctrl+C,
213
214
  * unless another screw-bugs process already serves them. `report --serve` and `walkthrough --serve` share it.
214
215
  */
@@ -247,7 +248,7 @@ const report = Command.make('report', {
247
248
  ['html', 'html'],
248
249
  ['markdown', 'markdown'],
249
250
  ]).pipe(Flag.withDescription('html prints the path of the report; markdown prints a pull request summary'), Flag.withDefault('html')),
250
- serve: Flag.Boolean('serve').pipe(Flag.withDescription('Serve the run folders on 127.0.0.1 (or SCREW_BUGS_REPORT_HOST) and print the report URL, for browsers that cannot open files (such as those built into coding tools); runs until Ctrl+C'), Flag.withDefault(false)),
251
+ serve: Flag.Boolean('serve').pipe(Flag.withDescription("Serve the run folders (on this machine's tailnet name when Tailscale runs, else 127.0.0.1; SCREW_BUGS_REPORT_HOST sets it) and print the report URL, for browsers that cannot open files (such as those built into coding tools); runs until Ctrl+C"), Flag.withDefault(false)),
251
252
  port: portFlag,
252
253
  }, (flags) => handle(flags.json)(Effect.gen(function* () {
253
254
  const { path, bundle, walkthroughPath } = yield* (yield* Operations).report(flags.jobId);
@@ -278,7 +279,7 @@ const report = Command.make('report', {
278
279
  const walkthrough = Command.make('walkthrough', {
279
280
  json,
280
281
  jobId: Argument.String('job-id'),
281
- serve: Flag.Boolean('serve').pipe(Flag.withDescription('Serve the run folders on 127.0.0.1 (or SCREW_BUGS_REPORT_HOST) and print the walkthrough URL, as report --serve does; runs until Ctrl+C'), Flag.withDefault(false)),
282
+ serve: Flag.Boolean('serve').pipe(Flag.withDescription("Serve the run folders (on this machine's tailnet name when Tailscale runs, else 127.0.0.1; SCREW_BUGS_REPORT_HOST sets it) and print the walkthrough URL, as report --serve does; runs until Ctrl+C"), Flag.withDefault(false)),
282
283
  port: portFlag,
283
284
  }, (flags) => handle(flags.json)(Effect.gen(function* () {
284
285
  const { path, reportPath } = yield* (yield* Operations).walkthrough(flags.jobId);
@@ -4,6 +4,7 @@ import { Browser, type BrowserInfo } from '../core/index.js';
4
4
  import type { DoctorCheck, DoctorReport } from '../schema/index.js';
5
5
  import { type BuildInfo } from './build-info.js';
6
6
  import { PackageInfo } from './package-info.js';
7
+ import { type TailnetStatus } from './tailnet.js';
7
8
  /** Room for a few runs' screenshots, traces and videos. */
8
9
  export declare const MIN_FREE_BYTES: number;
9
10
  /**
@@ -17,9 +18,23 @@ export declare const checkBrowser: (found: BrowserInfo | undefined, installComma
17
18
  /** A failure: every run is recorded as video, so without ffmpeg no run starts. */
18
19
  export declare const checkVideo: (lookup: FfmpegLookup, installCommand: string) => DoctorCheck;
19
20
  export declare const checkDisk: (path: string, freeBytes: number | undefined) => DoctorCheck;
21
+ /** The host settings as set, trimmed; empty when unset. */
22
+ export interface HostSettings {
23
+ readonly report: string;
24
+ readonly signIn: string;
25
+ }
26
+ /**
27
+ * Tailscale and the host settings, a warning at most; none when Tailscale is not running and no
28
+ * setting is `tailnet`, or when the report host is set otherwise. With nothing set and Tailscale running,
29
+ * reports and sign-ins are on the tailnet by default: it passes, saying so and how to turn it off.
30
+ */
31
+ export declare const checkTailnet: (status: TailnetStatus, settings: HostSettings, ci?: boolean) => DoctorCheck | undefined;
32
+ /** `checkTailnet` for this process: its tailnet lookup and environment. */
33
+ export declare const tailnetCheck: Effect.Effect<DoctorCheck | undefined>;
20
34
  /**
21
35
  * Checks the machine without changing it: nothing is installed or downloaded. `lookupFfmpeg` is
22
- * replaceable so tests need not depend on this machine's Playwright cache. `update` is the check
23
- * for a newer or stale screw-bugs (see `UpdateCheck`), last when given; a warning at most.
36
+ * replaceable so tests need not depend on this machine's Playwright cache. `tailnet` (see
37
+ * `checkTailnet`) comes when there is something to say about Tailscale. `update` is the check for
38
+ * a newer or stale screw-bugs (see `UpdateCheck`), last when given; a warning at most.
24
39
  */
25
40
  export declare const runDoctor: (projectRoot: string, lookupFfmpeg?: Effect.Effect<FfmpegLookup, never, FileSystem.FileSystem>, update?: Effect.Effect<DoctorCheck>) => Effect.Effect<DoctorReport, never, Browser | PackageInfo | FileSystem.FileSystem | Path.Path>;
@@ -1,11 +1,13 @@
1
1
  // Boundary: Effect's FileSystem has no statfs, so free disk space is read with node:fs.
2
2
  import { statfs } from 'node:fs/promises';
3
- import { Effect, Option } from 'effect';
3
+ import { Config, Effect, Option } from 'effect';
4
4
  import { ffmpegProblem, findFfmpeg, installBrowserCommand, installFfmpegCommand, } from '../browser-playwright/index.js';
5
5
  import { Browser } from '../core/index.js';
6
6
  import { describeBuild, RunningBuild } from './build-info.js';
7
7
  import { isAtLeast, minimumNode } from './node-version.js';
8
8
  import { PackageInfo } from './package-info.js';
9
+ import { isCi } from './environment.js';
10
+ import { TAILNET, Tailnet } from './tailnet.js';
9
11
  /** Room for a few runs' screenshots, traces and videos. */
10
12
  export const MIN_FREE_BYTES = 1024 ** 3;
11
13
  const browserNames = {
@@ -90,6 +92,59 @@ export const checkDisk = (path, freeBytes) => {
90
92
  },
91
93
  };
92
94
  };
95
+ const REPORT_VARIABLE = 'SCREW_BUGS_REPORT_HOST';
96
+ const SIGN_IN_VARIABLE = 'SCREW_BUGS_SIGN_IN_HOST';
97
+ /**
98
+ * Tailscale and the host settings, a warning at most; none when Tailscale is not running and no
99
+ * setting is `tailnet`, or when the report host is set otherwise. With nothing set and Tailscale running,
100
+ * reports and sign-ins are on the tailnet by default: it passes, saying so and how to turn it off.
101
+ */
102
+ export const checkTailnet = (status, settings, ci = false) => {
103
+ const isTailnet = (value) => value.toLowerCase() === TAILNET;
104
+ const tailnetVariable = isTailnet(settings.report)
105
+ ? REPORT_VARIABLE
106
+ : isTailnet(settings.signIn)
107
+ ? SIGN_IN_VARIABLE
108
+ : undefined;
109
+ if (tailnetVariable !== undefined)
110
+ return status.running
111
+ ? {
112
+ id: 'tailnet',
113
+ ok: true,
114
+ detail: `${tailnetVariable} is ${TAILNET}: served at ${status.host} on the tailnet`,
115
+ }
116
+ : {
117
+ id: 'tailnet',
118
+ ok: false,
119
+ severity: 'warning',
120
+ detail: `${tailnetVariable} is ${TAILNET}, but ${status.why} (when screw-bugs started), ` +
121
+ 'so its pages are served on 127.0.0.1 only.',
122
+ fix: {
123
+ action: 'Start Tailscale with the command, then restart the MCP server.',
124
+ command: 'tailscale up',
125
+ why: 'Reports and sign-ins open from your other devices only while Tailscale runs.',
126
+ },
127
+ };
128
+ // Unset, the report host is the tailnet; the sign-in host follows it unless set otherwise.
129
+ if (ci || !status.running || settings.report !== '')
130
+ return undefined;
131
+ const what = settings.signIn === '' ? 'reports and sign-ins are' : 'reports are';
132
+ return {
133
+ id: 'tailnet',
134
+ ok: true,
135
+ detail: `Tailscale is running, so ${what} served at ${status.host} on the tailnet, for every ` +
136
+ `device on it; to keep them on this machine only, set ${REPORT_VARIABLE}=127.0.0.1.`,
137
+ };
138
+ };
139
+ const readSetting = (name) => Config.String(name).pipe(Config.withDefault(''), Effect.orDie, Effect.map((v) => v.trim()));
140
+ /** `checkTailnet` for this process: its tailnet lookup and environment. */
141
+ export const tailnetCheck = Effect.gen(function* () {
142
+ const tailnet = yield* Tailnet;
143
+ const status = yield* tailnet.status;
144
+ const report = yield* readSetting(REPORT_VARIABLE);
145
+ const signIn = yield* readSetting(SIGN_IN_VARIABLE);
146
+ return checkTailnet(status, { report, signIn }, yield* isCi);
147
+ });
93
148
  const formatGb = (bytes) => `${(bytes / 1024 ** 3).toFixed(1)} GB`;
94
149
  /** The statfs boundary: the only Node file system call left (see the import). */
95
150
  const freeBytes = (path) => Effect.tryPromise(() => statfs(path)).pipe(Effect.map((stats) => stats.bavail * stats.bsize), Effect.orElseSucceed(() => undefined));
@@ -97,8 +152,9 @@ const freeBytes = (path) => Effect.tryPromise(() => statfs(path)).pipe(Effect.ma
97
152
  const passes = (check) => check.ok || check.severity === 'warning';
98
153
  /**
99
154
  * Checks the machine without changing it: nothing is installed or downloaded. `lookupFfmpeg` is
100
- * replaceable so tests need not depend on this machine's Playwright cache. `update` is the check
101
- * for a newer or stale screw-bugs (see `UpdateCheck`), last when given; a warning at most.
155
+ * replaceable so tests need not depend on this machine's Playwright cache. `tailnet` (see
156
+ * `checkTailnet`) comes when there is something to say about Tailscale. `update` is the check for
157
+ * a newer or stale screw-bugs (see `UpdateCheck`), last when given; a warning at most.
102
158
  */
103
159
  export const runDoctor = (projectRoot, lookupFfmpeg = findFfmpeg, update) => Effect.gen(function* () {
104
160
  const browser = yield* Browser;
@@ -106,11 +162,12 @@ export const runDoctor = (projectRoot, lookupFfmpeg = findFfmpeg, update) => Eff
106
162
  // What this process loaded when it started (an MCP server may run an older build than is on
107
163
  // disk now); without the service, the version alone.
108
164
  const running = yield* Effect.serviceOption(RunningBuild);
109
- const [found, ffmpeg, free, updateCheck] = yield* Effect.all([
165
+ const [found, ffmpeg, free, updateCheck, tailnet] = yield* Effect.all([
110
166
  browser.detect.pipe(Effect.orElseSucceed(() => undefined)),
111
167
  lookupFfmpeg,
112
168
  freeBytes(projectRoot),
113
169
  update ?? Effect.succeed(undefined),
170
+ tailnetCheck,
114
171
  ], { concurrency: 'unbounded' });
115
172
  const installCommand = found ? '' : yield* installBrowserCommand;
116
173
  const ffmpegCommand = ffmpeg.found ? '' : yield* installFfmpegCommand;
@@ -121,6 +178,7 @@ export const runDoctor = (projectRoot, lookupFfmpeg = findFfmpeg, update) => Eff
121
178
  checkBrowser(found, installCommand),
122
179
  checkVideo(ffmpeg, ffmpegCommand),
123
180
  checkDisk(projectRoot, free),
181
+ ...(tailnet ? [tailnet] : []),
124
182
  ...(updateCheck ? [updateCheck] : []),
125
183
  ];
126
184
  return { ok: checks.every(passes), checks };
package/dist/cli/mcp.js CHANGED
@@ -19,8 +19,8 @@ import { UpdateCheck } from './update-check.js';
19
19
  * account has no session to start from starts nothing either: one sentence, then the link of the
20
20
  * sign-in it opened for the user, then `accounts.json`; with `waitSeconds` it first waits for the
21
21
  * user to save that sign-in, then starts the run (a normal reply), or says it was cancelled.
22
- * Wherever the report is given, it is its http://127.0.0.1 URL (or `SCREW_BUGS_REPORT_HOST`'s, see
23
- * `ReportServer`) in place of
22
+ * Wherever the report is given, it is its URL on the report server (127.0.0.1, the tailnet or
23
+ * `SCREW_BUGS_REPORT_HOST`'s host, see `reportHost`) in place of
24
24
  * its path, for browsers built into coding tools, which cannot open file:// pages and whose file
25
25
  * viewers do not play its video; the path only when there is no URL. Then the run's walkthrough
26
26
  * (`walkthrough.html`), when it has one, the same way, and the reply's sentence names it as the
@@ -4,8 +4,8 @@ import { type ShareRoutes } from './share.js';
4
4
  import { Failure } from './failure.js';
5
5
  /**
6
6
  * A local HTTP server for reports, for browsers that cannot open `file://` (the ones built into
7
- * coding tools). It binds one address, 127.0.0.1 unless `SCREW_BUGS_REPORT_HOST` says another
8
- * (see `reportHost`), and serves the runs folder read-only: only files with
7
+ * coding tools). It binds one address: `SCREW_BUGS_REPORT_HOST`'s, or unset this machine's on
8
+ * the tailnet when Tailscale runs, else 127.0.0.1 (see `reportHost`), and serves the runs folder read-only: only files with
9
9
  * the extensions a report uses, never a directory listing, a dotfile, or anything outside the
10
10
  * folder (also through symlinks). Range requests (206, 416) come from `HttpStaticServer`, so
11
11
  * videos seek and play. In a process that can share (see `ShareSource`), it also answers the
@@ -18,18 +18,27 @@ export declare const isLoopback: (host: string) => boolean;
18
18
  /** A host as it goes in a URL: an IPv6 address in brackets. */
19
19
  export declare const urlHost: (host: string) => string;
20
20
  /**
21
- * `SCREW_BUGS_REPORT_HOST`: where the report server listens, and the host in its links. 127.0.0.1
22
- * unless set; set it to this machine's MagicDNS name or tailnet IP to open reports from another
23
- * device (a name binds the one address it resolves to). Never every interface: `0.0.0.0` or `::`
24
- * is a `Failure` (an empty value is unset).
21
+ * `SCREW_BUGS_REPORT_HOST`: where the report server listens, and the host in its links. Unset,
22
+ * this machine's name on the tailnet when Tailscale is running (see `Tailnet`; never in CI), else
23
+ * 127.0.0.1; `127.0.0.1` keeps reports on this machine. A MagicDNS name, tailnet IP or `tailnet`
24
+ * opens reports from another device (a name binds the one address it resolves to). Never every
25
+ * interface: `0.0.0.0` or `::` is a `Failure` (an empty value is unset).
25
26
  */
26
27
  export declare const reportHost: Effect.Effect<string, Failure, never>;
27
28
  /**
28
29
  * A server's host setting (`SCREW_BUGS_REPORT_HOST`, `SCREW_BUGS_SIGN_IN_HOST`): one address or
29
- * name of this machine, canonical (`canonicalHost`); 127.0.0.1 when unset or empty. Every
30
- * spelling of every interface (`0.0.0.0`, `0`, `::`, …) is a `Failure` with `reason`.
31
- */
32
- export declare const hostSetting: (variable: string, reason: string) => Effect.Effect<string, Failure, never>;
30
+ * name of this machine, canonical (`canonicalHost`). When `variable` is unset or empty,
31
+ * `follows` (another variable) is read in its place. Unset or empty, and `tailnet` (any case), are
32
+ * this machine's host on the tailnet, or 127.0.0.1 when Tailscale is not running (see `Tailnet`;
33
+ * only `tailnet` says so on stderr); unset is 127.0.0.1 in CI. Every spelling of every interface (`0.0.0.0`, `0`, `::`, …) is a `Failure` with
34
+ * `reason`.
35
+ */
36
+ export declare const hostSetting: (variable: string, reason: string, follows?: string) => Effect.Effect<string, Failure, never>;
37
+ /** `hostSetting`, with the variable it was read from (`variable`, or `follows` in its place). */
38
+ export declare const hostSettingOf: (variable: string, reason: string, follows?: string) => Effect.Effect<{
39
+ host: string;
40
+ variable: string;
41
+ }, Failure, never>;
33
42
  /**
34
43
  * The address a server set to `host` (from `variable`) listens on, as a URL writes it without
35
44
  * brackets; a `Failure` with `reason` when that is every interface (a name that resolved to an
@@ -9,10 +9,12 @@ import { runsDir } from '../store-local/index.js';
9
9
  import { ExitCode } from './exit-codes.js';
10
10
  import { makeShareRoutes, ShareSource } from './share.js';
11
11
  import { Failure } from './failure.js';
12
+ import { isCi } from './environment.js';
13
+ import { TAILNET, Tailnet } from './tailnet.js';
12
14
  /**
13
15
  * A local HTTP server for reports, for browsers that cannot open `file://` (the ones built into
14
- * coding tools). It binds one address, 127.0.0.1 unless `SCREW_BUGS_REPORT_HOST` says another
15
- * (see `reportHost`), and serves the runs folder read-only: only files with
16
+ * coding tools). It binds one address: `SCREW_BUGS_REPORT_HOST`'s, or unset this machine's on
17
+ * the tailnet when Tailscale runs, else 127.0.0.1 (see `reportHost`), and serves the runs folder read-only: only files with
16
18
  * the extensions a report uses, never a directory listing, a dotfile, or anything outside the
17
19
  * folder (also through symlinks). Range requests (206, 416) come from `HttpStaticServer`, so
18
20
  * videos seek and play. In a process that can share (see `ShareSource`), it also answers the
@@ -28,29 +30,52 @@ const unbracketed = (host) => host.replace(/^\[(.*)\]$/, '$1');
28
30
  /** A host as it goes in a URL: an IPv6 address in brackets. */
29
31
  export const urlHost = (host) => (host.includes(':') ? `[${host}]` : host);
30
32
  /**
31
- * `SCREW_BUGS_REPORT_HOST`: where the report server listens, and the host in its links. 127.0.0.1
32
- * unless set; set it to this machine's MagicDNS name or tailnet IP to open reports from another
33
- * device (a name binds the one address it resolves to). Never every interface: `0.0.0.0` or `::`
34
- * is a `Failure` (an empty value is unset).
33
+ * `SCREW_BUGS_REPORT_HOST`: where the report server listens, and the host in its links. Unset,
34
+ * this machine's name on the tailnet when Tailscale is running (see `Tailnet`; never in CI), else
35
+ * 127.0.0.1; `127.0.0.1` keeps reports on this machine. A MagicDNS name, tailnet IP or `tailnet`
36
+ * opens reports from another device (a name binds the one address it resolves to). Never every
37
+ * interface: `0.0.0.0` or `::` is a `Failure` (an empty value is unset).
35
38
  */
36
39
  export const reportHost = Effect.suspend(() => hostSetting('SCREW_BUGS_REPORT_HOST', 'report_host'));
37
40
  /**
38
41
  * A server's host setting (`SCREW_BUGS_REPORT_HOST`, `SCREW_BUGS_SIGN_IN_HOST`): one address or
39
- * name of this machine, canonical (`canonicalHost`); 127.0.0.1 when unset or empty. Every
40
- * spelling of every interface (`0.0.0.0`, `0`, `::`, …) is a `Failure` with `reason`.
42
+ * name of this machine, canonical (`canonicalHost`). When `variable` is unset or empty,
43
+ * `follows` (another variable) is read in its place. Unset or empty, and `tailnet` (any case), are
44
+ * this machine's host on the tailnet, or 127.0.0.1 when Tailscale is not running (see `Tailnet`;
45
+ * only `tailnet` says so on stderr); unset is 127.0.0.1 in CI. Every spelling of every interface (`0.0.0.0`, `0`, `::`, …) is a `Failure` with
46
+ * `reason`.
41
47
  */
42
- export const hostSetting = (variable, reason) => Config.String(variable).pipe(Config.withDefault(REPORT_HOST), Effect.orDie, Effect.flatMap((value) => {
43
- const trimmed = value.trim();
44
- const host = trimmed === '' ? REPORT_HOST : canonicalHost(unbracketed(trimmed));
45
- return host === undefined || isUnspecified(host)
46
- ? Effect.fail(new Failure({
48
+ export const hostSetting = (variable, reason, follows) => hostSettingOf(variable, reason, follows).pipe(Effect.map(({ host }) => host));
49
+ /** `hostSetting`, with the variable it was read from (`variable`, or `follows` in its place). */
50
+ export const hostSettingOf = (variable, reason, follows) => Effect.gen(function* () {
51
+ const read = (name) => Config.String(name).pipe(Config.withDefault(''), Effect.orDie, Effect.map((v) => v.trim()));
52
+ let from = variable;
53
+ let value = yield* read(variable);
54
+ if (value === '' && follows !== undefined) {
55
+ from = follows;
56
+ value = yield* read(follows);
57
+ }
58
+ // Unset: on the tailnet when Tailscale is running (never in CI), else 127.0.0.1, silently.
59
+ if (value === '') {
60
+ if (yield* isCi)
61
+ return { host: REPORT_HOST, variable: from };
62
+ const status = yield* (yield* Tailnet).status;
63
+ return { host: status.running ? status.host : REPORT_HOST, variable: from };
64
+ }
65
+ if (value.toLowerCase() === TAILNET) {
66
+ const tailnet = yield* Tailnet;
67
+ return { host: (yield* tailnet.host) ?? REPORT_HOST, variable: from };
68
+ }
69
+ const host = canonicalHost(unbracketed(value));
70
+ if (host === undefined || isUnspecified(host))
71
+ return yield* new Failure({
47
72
  code: ExitCode.Usage,
48
73
  reason,
49
- message: `${variable} is "${value}"; give one address or name of this machine, ` +
50
- 'such as its MagicDNS name or tailnet IP, or leave it unset for 127.0.0.1.',
51
- }))
52
- : Effect.succeed(host);
53
- }));
74
+ message: `${from} is "${value}"; give one address or name of this machine, ` +
75
+ `such as its MagicDNS name or tailnet IP, or "${TAILNET}", or 127.0.0.1 for this machine only.`,
76
+ });
77
+ return { host, variable: from };
78
+ });
54
79
  /**
55
80
  * The address a server set to `host` (from `variable`) listens on, as a URL writes it without
56
81
  * brackets; a `Failure` with `reason` when that is every interface (a name that resolved to an
package/dist/cli/share.js CHANGED
@@ -7,7 +7,7 @@ import { base64, hex, renderSharePage, SHARE_START_PATH, sha256, sharePageCsp, }
7
7
  import { CompletedShare, CreatedShare, JobId, ShareCallback, ShareClaimed, ShareErrorReply, ShareRequestCreated, ShareState, } from '../schema/index.js';
8
8
  /*
9
9
  * The Share button's local side: routes of the report server that put a run on screw-bugs Cloud,
10
- * following Cloud's upload protocol (see `src/schema/share.ts`). Only a person can share: it
10
+ * following Cloud's upload protocol (see `packages/core/src/schema/share.ts`). Only a person can share: it
11
11
  * takes a click in a report this server served, and a confirmation on Cloud.
12
12
  *
13
13
  * start the report's Share button: remembers a random `state` for the run, and sends the
@@ -764,7 +764,7 @@ export const makeShareRoutes = (root) => Effect.gen(function* () {
764
764
  const phase = entry.phase;
765
765
  switch (phase._tag) {
766
766
  case 'pairing':
767
- return sharePage('Type this code on Screw Bugs Cloud', 'Open Screw Bugs Cloud, sign in, and type this code to share the report. This page moves on by itself once you confirm there.', {
767
+ return sharePage('Enter this code on Screw Bugs Cloud', 'Open Screw Bugs Cloud (that copies this code), sign in, and paste the code there to share the report. This page moves on by itself once you confirm there.', {
768
768
  code: phase.code,
769
769
  link: { href: phase.confirmUrl, text: 'Open Screw Bugs Cloud' },
770
770
  refresh: PAIRING_REFRESH_S,
@@ -9,10 +9,16 @@ export declare const FRAME_WAIT_MS = 15000;
9
9
  /** How long fetching the app's icon may take in all; the sign-in opens without it after. */
10
10
  export declare const SIGN_IN_ICON_TIMEOUT: Duration.Duration;
11
11
  /**
12
- * `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link.
13
- * 127.0.0.1 unless set; set it to this machine's MagicDNS name or tailnet IP to sign in from
14
- * another device. Read as `SCREW_BUGS_REPORT_HOST` is (`hostSetting`): never every interface.
12
+ * `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link. When
13
+ * unset, `SCREW_BUGS_REPORT_HOST`'s value (so one variable covers both); with both unset, this
14
+ * machine's tailnet host when Tailscale runs (not in CI), else 127.0.0.1. Set it to `127.0.0.1` to
15
+ * keep sign-ins on this machine, or to a MagicDNS name, tailnet IP or `tailnet`. Read as `SCREW_BUGS_REPORT_HOST` is (`hostSetting`): never every interface.
15
16
  */
17
+ export declare const signInHostOf: Effect.Effect<{
18
+ host: string;
19
+ variable: string;
20
+ }, Failure, never>;
21
+ /** The host of `signInHostOf` alone. */
16
22
  export declare const signInHost: Effect.Effect<string, Failure, never>;
17
23
  /** How a sign-in ended. */
18
24
  export type SignInOutcome = 'saved' | 'cancelled' | 'idle';
@@ -10,12 +10,12 @@ import { hex, renderSignInPage, SIGN_IN_CSP } from '../report/index.js';
10
10
  import { SignInInputs } from '../schema/index.js';
11
11
  import { ExitCode } from './exit-codes.js';
12
12
  import { Failure } from './failure.js';
13
- import { boundAddress, hostSetting, isLoopback, urlHost } from './report-server.js';
13
+ import { boundAddress, hostSettingOf, isLoopback, urlHost } from './report-server.js';
14
14
  /*
15
15
  * Signing in to a test account: a headless browser at the app, which a person drives from a web
16
16
  * page (the live view, `renderSignInPage`) in whatever browser reaches this machine: the one built
17
17
  * into their coding tool, or a phone on their tailnet. Each sign-in gets a server of its own on a
18
- * free port, bound to `SCREW_BUGS_SIGN_IN_HOST` (127.0.0.1 unless set), answering only under a
18
+ * free port, bound to `SCREW_BUGS_SIGN_IN_HOST` (else `SCREW_BUGS_REPORT_HOST`'s host, see `hostSetting`), answering only under a
19
19
  * random token and only to its own Host; it ends when the person saves or cancels, after
20
20
  * `SIGN_IN_IDLE` without a request, or with the process. Only the session is kept: the cookies
21
21
  * the browser sends to the app and its origin's storage, in the account book. Nothing typed is
@@ -30,11 +30,14 @@ export const SIGN_IN_ICON_TIMEOUT = Duration.seconds(3);
30
30
  /** The largest input request taken: a few hundred inputs. */
31
31
  const INPUT_BYTES_MAX = 256 * 1024;
32
32
  /**
33
- * `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link.
34
- * 127.0.0.1 unless set; set it to this machine's MagicDNS name or tailnet IP to sign in from
35
- * another device. Read as `SCREW_BUGS_REPORT_HOST` is (`hostSetting`): never every interface.
33
+ * `SCREW_BUGS_SIGN_IN_HOST`: where the sign-in server listens, and the host in its link. When
34
+ * unset, `SCREW_BUGS_REPORT_HOST`'s value (so one variable covers both); with both unset, this
35
+ * machine's tailnet host when Tailscale runs (not in CI), else 127.0.0.1. Set it to `127.0.0.1` to
36
+ * keep sign-ins on this machine, or to a MagicDNS name, tailnet IP or `tailnet`. Read as `SCREW_BUGS_REPORT_HOST` is (`hostSetting`): never every interface.
36
37
  */
37
- export const signInHost = Effect.suspend(() => hostSetting('SCREW_BUGS_SIGN_IN_HOST', 'sign_in_host'));
38
+ export const signInHostOf = Effect.suspend(() => hostSettingOf('SCREW_BUGS_SIGN_IN_HOST', 'sign_in_host', 'SCREW_BUGS_REPORT_HOST'));
39
+ /** The host of `signInHostOf` alone. */
40
+ export const signInHost = signInHostOf.pipe(Effect.map(({ host }) => host));
38
41
  /** The handle for an open sign-in. */
39
42
  const handleOf = (entry) => ({
40
43
  link: entry.link,
@@ -210,7 +213,7 @@ export class SignIns extends Context.Service()('screw-bugs/SignIns') {
210
213
  const lock = yield* Semaphore.make(1);
211
214
  const pending = new Map();
212
215
  const open = (request) => Effect.gen(function* () {
213
- const host = yield* signInHost;
216
+ const { host, variable } = yield* signInHostOf;
214
217
  const own = yield* Scope.fork(scope);
215
218
  const opened = yield* Effect.gen(function* () {
216
219
  const live = yield* browser.signIn(request.url).pipe(Effect.mapError((error) => new Failure({
@@ -256,12 +259,12 @@ export class SignIns extends Context.Service()('screw-bugs/SignIns') {
256
259
  const server = yield* NodeHttpServer.make(() => createServer(), { port: 0, host }).pipe(Effect.mapError((error) => new Failure({
257
260
  code: ExitCode.Usage,
258
261
  reason: 'sign_in_serve',
259
- message: `Could not serve the sign-in page on ${host} (check SCREW_BUGS_SIGN_IN_HOST): ` +
262
+ message: `Could not serve the sign-in page on ${host} (check ${variable}): ` +
260
263
  String(error.cause),
261
264
  })));
262
265
  if ('port' in server.address)
263
266
  port = server.address.port;
264
- const bound = yield* boundAddress(server.address, host, 'SCREW_BUGS_SIGN_IN_HOST', 'sign_in_host');
267
+ const bound = yield* boundAddress(server.address, host, variable, 'sign_in_host');
265
268
  // The host it was set to, and the address that is (a name's IP): both can be opened.
266
269
  hosts.add(`${urlHost(host)}:${port}`);
267
270
  hosts.add(`${urlHost(bound)}:${port}`);