screw-bugs 0.1.9 → 0.1.11
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.
- package/README.md +100 -54
- package/dist/browser-playwright/capture.js +1 -1
- package/dist/build-info.json +3 -3
- package/dist/cli/app.js +6 -2
- package/dist/cli/commands.js +4 -3
- package/dist/cli/doctor.d.ts +17 -2
- package/dist/cli/doctor.js +62 -4
- package/dist/cli/mcp.js +7 -4
- package/dist/cli/report-server.d.ts +19 -10
- package/dist/cli/report-server.js +43 -18
- package/dist/cli/share.js +2 -2
- package/dist/cli/sign-in.d.ts +9 -3
- package/dist/cli/sign-in.js +12 -9
- package/dist/cli/tailnet.d.ts +57 -0
- package/dist/cli/tailnet.js +82 -0
- package/dist/core/index.d.ts +1 -14
- package/dist/core/index.js +3 -14
- package/dist/report/index.d.ts +1 -10
- package/dist/report/index.js +3 -10
- package/dist/schema/index.d.ts +1 -9
- package/dist/schema/index.js +3 -9
- package/package.json +14 -14
- package/dist/core/accounts.d.ts +0 -40
- package/dist/core/accounts.js +0 -95
- package/dist/core/css.d.ts +0 -95
- package/dist/core/css.js +0 -436
- package/dist/core/engine.d.ts +0 -75
- package/dist/core/engine.js +0 -560
- package/dist/core/errors.d.ts +0 -85
- package/dist/core/errors.js +0 -36
- package/dist/core/evidence.d.ts +0 -14
- package/dist/core/evidence.js +0 -131
- package/dist/core/labels.d.ts +0 -47
- package/dist/core/labels.js +0 -199
- package/dist/core/liveness.d.ts +0 -45
- package/dist/core/liveness.js +0 -66
- package/dist/core/marks.d.ts +0 -63
- package/dist/core/marks.js +0 -410
- package/dist/core/services.d.ts +0 -579
- package/dist/core/services.js +0 -25
- package/dist/core/share.d.ts +0 -68
- package/dist/core/share.js +0 -318
- package/dist/core/steps.d.ts +0 -106
- package/dist/core/steps.js +0 -722
- package/dist/core/uploads.d.ts +0 -49
- package/dist/core/uploads.js +0 -133
- package/dist/core/video.d.ts +0 -53
- package/dist/core/video.js +0 -241
- package/dist/core/viewport.d.ts +0 -28
- package/dist/core/viewport.js +0 -50
- package/dist/report/assets.d.ts +0 -34
- package/dist/report/assets.js +0 -105
- package/dist/report/bug.d.ts +0 -11
- package/dist/report/bug.js +0 -20
- package/dist/report/html.d.ts +0 -47
- package/dist/report/html.js +0 -923
- package/dist/report/icons.d.ts +0 -51
- package/dist/report/icons.js +0 -93
- package/dist/report/live.d.ts +0 -7
- package/dist/report/live.js +0 -135
- package/dist/report/logos.d.ts +0 -4
- package/dist/report/logos.js +0 -19
- package/dist/report/markup.d.ts +0 -50
- package/dist/report/markup.js +0 -156
- package/dist/report/menu-bar.d.ts +0 -60
- package/dist/report/menu-bar.js +0 -157
- package/dist/report/player.d.ts +0 -102
- package/dist/report/player.js +0 -315
- package/dist/report/pr-summary.d.ts +0 -11
- package/dist/report/pr-summary.js +0 -119
- package/dist/report/sha256.d.ts +0 -9
- package/dist/report/sha256.js +0 -97
- package/dist/report/share-page.d.ts +0 -48
- package/dist/report/share-page.js +0 -291
- package/dist/report/shots.d.ts +0 -59
- package/dist/report/shots.js +0 -280
- package/dist/report/sign-in.d.ts +0 -41
- package/dist/report/sign-in.js +0 -568
- package/dist/report/styles.d.ts +0 -3
- package/dist/report/styles.js +0 -274
- package/dist/report/view.d.ts +0 -296
- package/dist/report/view.js +0 -702
- package/dist/report/walkthrough.d.ts +0 -93
- package/dist/report/walkthrough.js +0 -716
- package/dist/schema/accounts.d.ts +0 -137
- package/dist/schema/accounts.js +0 -121
- package/dist/schema/config.d.ts +0 -7
- package/dist/schema/config.js +0 -6
- package/dist/schema/doctor.d.ts +0 -46
- package/dist/schema/doctor.js +0 -30
- package/dist/schema/evidence.d.ts +0 -1115
- package/dist/schema/evidence.js +0 -565
- package/dist/schema/findings.d.ts +0 -161
- package/dist/schema/findings.js +0 -82
- package/dist/schema/job.d.ts +0 -1905
- package/dist/schema/job.js +0 -577
- package/dist/schema/ledger.d.ts +0 -1124
- package/dist/schema/ledger.js +0 -285
- package/dist/schema/share.d.ts +0 -55
- package/dist/schema/share.js +0 -64
- package/dist/schema/status.d.ts +0 -7
- package/dist/schema/status.js +0 -11
package/README.md
CHANGED
|
@@ -186,7 +186,16 @@ fixed slots with short texts:
|
|
|
186
186
|
"title": "Show an error for a wrong password",
|
|
187
187
|
"severity": "high",
|
|
188
188
|
"caseIds": ["wrong-password"],
|
|
189
|
-
"why": "Users are left on the form with no idea what happened."
|
|
189
|
+
"why": "Users are left on the form with no idea what happened.",
|
|
190
|
+
"evidence": [
|
|
191
|
+
{ "shot": "02-02", "target": { "label": "Password" }, "mark": "red", "note": "No error" },
|
|
192
|
+
{
|
|
193
|
+
"shot": "01-03",
|
|
194
|
+
"target": { "role": "alert" },
|
|
195
|
+
"mark": "green",
|
|
196
|
+
"note": "Sign-up shows one"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
190
199
|
}
|
|
191
200
|
],
|
|
192
201
|
"cases": [
|
|
@@ -208,12 +217,16 @@ fixed slots with short texts:
|
|
|
208
217
|
"observed": ["The button stays enabled while signing in."]
|
|
209
218
|
}
|
|
210
219
|
],
|
|
211
|
-
"notTested": [
|
|
220
|
+
"notTested": [
|
|
221
|
+
{ "what": "Password reset", "why": "The test inbox was not available." },
|
|
222
|
+
{ "what": "Signing out", "why": "Sign-in failed first.", "caseId": "wrong-password" }
|
|
223
|
+
],
|
|
212
224
|
"nextTests": ["A locked account"]
|
|
213
225
|
}
|
|
214
226
|
```
|
|
215
227
|
|
|
216
|
-
Case IDs, screenshot IDs and timecodes must be ones `run_status` gave for that case
|
|
228
|
+
Case IDs, screenshot IDs and timecodes must be ones `run_status` gave for that case (a fix's
|
|
229
|
+
`evidence` may use a screenshot of any case of the run); findings that
|
|
217
230
|
do not fit are rejected with one line per problem saying what to change (exit code 6), and nothing
|
|
218
231
|
is saved. A case named that does not exist is one of those problems.
|
|
219
232
|
|
|
@@ -262,9 +275,24 @@ only on what the screenshot shows: an element that was in the page or frame but
|
|
|
262
275
|
it was taken (transparent, such as a section that had not faded in yet, or cut away by its box or
|
|
263
276
|
by its frame) gets no box and says why; and when another match is on the screenshot, matches
|
|
264
277
|
outside it (a copy far below a viewport screenshot, or outside the part of its frame that shows)
|
|
265
|
-
or not visible are left out, and the legend says how many.
|
|
266
|
-
|
|
267
|
-
"
|
|
278
|
+
or not visible are left out, and the legend says how many. A highlight's optional `region` marks
|
|
279
|
+
only a part of its element, as fractions of the element's box (`{ "x": 0.4, "y": 0.6, "width":
|
|
280
|
+
0.3, "height": 0.2 }`), such as a line of text inside a picture: code clips it to the box it found
|
|
281
|
+
and draws the part, with the whole element dashed around it; the agent still never gives
|
|
282
|
+
coordinates on the screenshot.
|
|
283
|
+
|
|
284
|
+
A fix's `evidence` is marks like highlights, on screenshots of any case, in the order to compare
|
|
285
|
+
them: give a mismatch both sides (the preview, then the page it should match). The report shows
|
|
286
|
+
each fix as an issue, with its evidence side by side, each screenshot zoomed in on those marks and
|
|
287
|
+
captioned with the mark's note and its case; every other mark on that screenshot is drawn too.
|
|
288
|
+
A fix without evidence shows its cases' Actual and Expected screenshots, and a failed case no fix
|
|
289
|
+
names gets an issue of its own. A mark that is both a case's highlight and a fix's evidence (the
|
|
290
|
+
same element, colour and region) is drawn once.
|
|
291
|
+
|
|
292
|
+
`notTested` lists what the run did not cover and why (and, with `caseId`, the case that did not
|
|
293
|
+
finish and left it out); the report shows it in the fold "What I didn't check" with the cases that
|
|
294
|
+
could not finish, and a run whose cases all passed then reads "7 of 7 cases passed · 3 areas not tested"
|
|
295
|
+
rather than "All 7 cases passed". `observed` lines are
|
|
268
296
|
shown as "observed, not checked by a step". The findings go to `findings.json`; screenshots with
|
|
269
297
|
highlights get a copy with the boxes drawn in, under `annotated/` (named for that write-up, so a
|
|
270
298
|
copy drawn for an earlier one is never shown), and the report is written again, so it shows the
|
|
@@ -280,6 +308,7 @@ Limits (each text is one line, not blank; findings past them are rejected with w
|
|
|
280
308
|
| `did`, `worked`, `didnt` (per case) | at most 8 lines each, 160 characters a line |
|
|
281
309
|
| `failed` (per case) | 160 characters |
|
|
282
310
|
| `highlights` (per case) | at most 6; `note` 120 characters |
|
|
311
|
+
| `evidence` (per fix) | at most 4; `note` 60 characters |
|
|
283
312
|
| `keyMoments` (per case) | at most 8; `label` 80 characters |
|
|
284
313
|
| `observed` (per case) | at most 5 lines, 200 characters a line |
|
|
285
314
|
| `notTested` | at most 8; `what` 100 characters, `why` 160 |
|
|
@@ -720,7 +749,8 @@ flow itself, or what a visitor sees. The saved accounts are listed in
|
|
|
720
749
|
agent can pick the one whose `about` fits what it tests, such as a user on a trial or a paying one.
|
|
721
750
|
|
|
722
751
|
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
|
|
752
|
+
reply gives a link to the live view (`http://127.0.0.1:<port>/<token>/`, or this machine's tailnet
|
|
753
|
+
name in place of `127.0.0.1` when Tailscale is running); open it, sign in as that
|
|
724
754
|
user (OAuth redirects and codes by email or an app work; passkeys and security keys do not, since
|
|
725
755
|
they need your own device), press **Save sign-in**, then
|
|
726
756
|
have your agent start the job again. `start_run` also takes an optional `waitSeconds` (0–600,
|
|
@@ -739,10 +769,12 @@ you can sign in meanwhile. From the CLI, `screw-bugs run` exits with code 9
|
|
|
739
769
|
npx screw-bugs accounts sign-in trial-user --url http://localhost:3000 --about "On a 14-day trial"
|
|
740
770
|
```
|
|
741
771
|
|
|
742
|
-
- **On another device.**
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
772
|
+
- **On another device.** When Tailscale is running, the live view listens at this machine's
|
|
773
|
+
MagicDNS name, so you can sign in from your phone or another computer on your tailnet; without
|
|
774
|
+
it, on 127.0.0.1, so it opens only on this machine (in your coding tool's browser, for example).
|
|
775
|
+
It follows `SCREW_BUGS_REPORT_HOST` (below; `127.0.0.1` keeps it on this machine), or set
|
|
776
|
+
`SCREW_BUGS_SIGN_IN_HOST` for the live view alone: `tailnet`, this machine's full MagicDNS name
|
|
777
|
+
or its Tailscale IP (`tailscale ip -4`). The link
|
|
746
778
|
then uses what you set, and with a name the IP it resolves to works too. It never listens on
|
|
747
779
|
every interface. The link holds a random token and works only while that
|
|
748
780
|
sign-in is open; it closes when you save or cancel, after 15 minutes without use, or when the
|
|
@@ -762,24 +794,24 @@ npx screw-bugs accounts sign-in trial-user --url http://localhost:3000 --about "
|
|
|
762
794
|
|
|
763
795
|
## CLI
|
|
764
796
|
|
|
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
|
|
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)
|
|
797
|
+
| Command | What it does |
|
|
798
|
+
| ---------------------------------------------- | ------------------------------------------------------- |
|
|
799
|
+
| `doctor` | Check Node, browser, video, disk, Tailscale and updates |
|
|
800
|
+
| `run [--spec job.json] [--url <url>]` | Run cases and wait; exit 1 unless all passed |
|
|
801
|
+
| `status <job-id>` | State and case results of a run |
|
|
802
|
+
| `answer <job-id> <question-id>` | Answer a question a waiting run asked |
|
|
803
|
+
| `mcp` | Serve the MCP server over stdio |
|
|
804
|
+
| `setup [--agent <name>] [--no-downloads]` | Set up this project in one command (above) |
|
|
805
|
+
| `init` | Write `screw-bugs.json` for this project |
|
|
806
|
+
| `accounts [sign-in <label> \| remove <label>]` | List, sign in to or remove test accounts |
|
|
807
|
+
| `report <job-id> [--format markdown]` | Write the report, or print a PR summary |
|
|
808
|
+
| `report <job-id> --serve [--port N]` | Serve the report at a local or tailnet URL |
|
|
809
|
+
| `walkthrough <job-id> [--serve]` | Write (or serve) the run's video walkthrough |
|
|
810
|
+
| `findings <job-id> <file\|->` | Submit an agent's write-up of an ended run |
|
|
811
|
+
| `schema <job\|findings>` | Print the JSON Schema of a job or write-up |
|
|
812
|
+
| `share <job-id>` | Share a report through Screw Bugs Cloud |
|
|
813
|
+
| `runs` | List recent runs |
|
|
814
|
+
| `analytics` | Show whether analytics are on (off by default) |
|
|
783
815
|
|
|
784
816
|
Every command accepts `--json`. `run --url <url>` alone checks that the page loads. `init --url
|
|
785
817
|
<url>` saves a default URL, so a bare `run` uses it.
|
|
@@ -840,21 +872,22 @@ report rules below do not change.
|
|
|
840
872
|
### Report
|
|
841
873
|
|
|
842
874
|
Every run that ends, finished or errored, writes `report.html` into its folder. One page, one
|
|
843
|
-
player:
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
arrow keys step through the case's screenshots. "Steps and details" opens the case's steps with
|
|
854
|
-
|
|
855
|
-
(what it checks, target, times, video, version, raw
|
|
856
|
-
|
|
857
|
-
|
|
875
|
+
player: the run's video in a browser window (a phone, for a run on a phone) with the page's address
|
|
876
|
+
at each moment, as the run recorded it, its timeline in one segment per case, and the case playing
|
|
877
|
+
now; on a phone the player stays pinned at the top while the rest scrolls. Beside it: the run's
|
|
878
|
+
title, how long it ran and its counts, and the verdict (the agent's headline; without a write-up,
|
|
879
|
+
the counts). Then the issues, numbered, most severe first: each fix with its evidence side by side
|
|
880
|
+
(the screenshot that shows the bug on a red tile), each screenshot with its time on the video, the
|
|
881
|
+
mark's note and its case. Then one card per case: its status (an icon and its word), its time on
|
|
882
|
+
the video, why it did not pass, and its screenshots as a pile (for a case that did not pass, the
|
|
883
|
+
page when it stopped, in red). A screenshot opens in a viewer with the highlights drawn over it and
|
|
884
|
+
the element the step acted on, the issue's or case's title and the legend of its marks under it;
|
|
885
|
+
the arrow keys step through the case's screenshots. "Steps and details" opens the case's steps with their timecodes and the agent's
|
|
886
|
+
write-up of it. Last, three folds: what was not checked and why, what to test next, and the run's
|
|
887
|
+
details (what was asked, what it checks, target, device, browser, times, video, version, raw
|
|
888
|
+
files, and which parts are the agent's write-up). Scrolling the cases drives the player:
|
|
889
|
+
the case at the reading line plays and the cases follow the video; with "Loop case" on (it starts
|
|
890
|
+
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
891
|
may mark a case failed (its card then says so, as the agent's verdict, beside the code's result);
|
|
859
892
|
the write-up fills fixed slots and is labelled as its own.
|
|
860
893
|
|
|
@@ -865,7 +898,8 @@ load by relative paths, so it opens from disk and still works when the run folde
|
|
|
865
898
|
moved. It has a light and a dark theme: it follows the
|
|
866
899
|
system, and a switch picks one (kept in the browser where it allows). Without script it follows the
|
|
867
900
|
system, the video has the browser's own controls, timecodes are plain links that open the video at
|
|
868
|
-
that time
|
|
901
|
+
that time. A screenshot opens only in the report's viewer (a card over the page, dimmed and
|
|
902
|
+
blurred), never in a tab. One video loads at a time, so the screenshots load from
|
|
869
903
|
any static server, also one without HTTP range requests such as `python3 -m http.server`.
|
|
870
904
|
`run`, `status` and the MCP tool `run_status` give its path once the run has ended.
|
|
871
905
|
|
|
@@ -960,7 +994,7 @@ leaves the report as it is. The report links it near the top when it exists.
|
|
|
960
994
|
|
|
961
995
|
```sh
|
|
962
996
|
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
|
|
997
|
+
screw-bugs walkthrough <job-id> --serve # serve it at a local or tailnet URL, as report --serve
|
|
964
998
|
```
|
|
965
999
|
|
|
966
1000
|
With `--json`, `walkthrough` prints `{ "ok": true, "path": "...", "reportPath": "...", "reportUrl":
|
|
@@ -993,11 +1027,18 @@ desktop app, cannot open `file://` pages, but they can open `http://127.0.0.1`.
|
|
|
993
1027
|
- From a terminal, `screw-bugs report <job-id> --serve` (or `walkthrough <job-id> --serve`) writes
|
|
994
1028
|
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
1029
|
`--json` it prints `{ "url": "...", "ok": true, "path": "...", "reused": false }`.
|
|
996
|
-
- **On another device.**
|
|
997
|
-
|
|
998
|
-
tailnet,
|
|
999
|
-
|
|
1000
|
-
|
|
1030
|
+
- **On another device.** When Tailscale is running, the report server listens at this machine's
|
|
1031
|
+
MagicDNS name (asked from Tailscale when screw-bugs starts), so its links open on your phone or
|
|
1032
|
+
another computer on your tailnet, and on every other device on it. Without Tailscale (and always
|
|
1033
|
+
in CI, `CI=true`) it listens on 127.0.0.1, so links open only on this machine. `doctor` says
|
|
1034
|
+
which. To keep reports and sign-ins on this machine with Tailscale running, set
|
|
1035
|
+
`SCREW_BUGS_REPORT_HOST=127.0.0.1` in the MCP server's environment (or the shell that runs the
|
|
1036
|
+
commands); on a Linux desktop, for every agent and terminal, put that line in
|
|
1037
|
+
`~/.config/environment.d/screw-bugs.conf` and log out and back in. You can also set it to
|
|
1038
|
+
`tailnet` (the MagicDNS name; when Tailscale is not running, reports stay on 127.0.0.1 and one
|
|
1039
|
+
line on stderr says so, until screw-bugs restarts), this machine's full MagicDNS name
|
|
1040
|
+
(`pop-os.tail1234.ts.net`, from `tailscale status --self`) or its Tailscale IP (`tailscale ip
|
|
1041
|
+
-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
1042
|
server listens only on the one address that resolves to, never on every interface, and answers
|
|
1002
1043
|
requests addressed to the name you set or to that address, so `http://100.x.y.z:…` works with
|
|
1003
1044
|
the name set (but a bare `http://pop-os:…` only when you set `pop-os`). A name is looked up each
|
|
@@ -1050,7 +1091,9 @@ This check cannot stop a process from taking the port after it, such as one that
|
|
|
1050
1091
|
moment between another screw-bugs process stopping and this one trying the port again. Links given
|
|
1051
1092
|
out then reach that process until screw-bugs serves on the port again.
|
|
1052
1093
|
|
|
1053
|
-
Both listen on 127.0.0.1
|
|
1094
|
+
Both listen on one address: 127.0.0.1, or this machine's tailnet name when Tailscale is running
|
|
1095
|
+
(see On another device, above). They answer only requests addressed to that host or its address (and, on
|
|
1096
|
+
127.0.0.1, `localhost`), and
|
|
1054
1097
|
serve only the project's run folders, read-only: reports, screenshots, videos and JSON files. They
|
|
1055
1098
|
never list folders or serve dotfiles, anything outside `.screw-bugs/runs` or symlinks out of it.
|
|
1056
1099
|
Videos are served with HTTP range requests, so they play and seek (unlike `python3 -m
|
|
@@ -1201,5 +1244,8 @@ It uses your Claude subscription: a full run is three Sonnet sessions, about a m
|
|
|
1201
1244
|
roughly 70k input tokens (mostly cached) and a few thousand output tokens. It is never run in CI.
|
|
1202
1245
|
|
|
1203
1246
|
`src/` holds one folder per module, each published as a sub-path (`screw-bugs/core`,
|
|
1204
|
-
`screw-bugs/schema`, ...). `schema`, `core` and `report`
|
|
1205
|
-
|
|
1247
|
+
`screw-bugs/schema`, ...). `schema`, `core` and `report` are their own package,
|
|
1248
|
+
[`@screw-bugs/core`](packages/core/README.md) (`packages/core`), which screw-bugs re-exports: it
|
|
1249
|
+
depends only on `effect` and runs on Cloudflare Workers, so it must not import Node, Playwright,
|
|
1250
|
+
any other package or other modules' internals. `pnpm lint` enforces this, and `pnpm check:workers`
|
|
1251
|
+
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
|
|
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)])] : []),
|
package/dist/build-info.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "2026-11-
|
|
3
|
-
"builtAt": "2026-11-
|
|
4
|
-
"commit": "
|
|
2
|
+
"id": "2026-11-20T22:33:17.848Z-f23b348d",
|
|
3
|
+
"builtAt": "2026-11-20T22:33:17.848Z",
|
|
4
|
+
"commit": "dc1484a8aafb8268724d9cbbb5612f980dbcefa9"
|
|
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
|
package/dist/cli/commands.js
CHANGED
|
@@ -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
|
|
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(
|
|
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(
|
|
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);
|
package/dist/cli/doctor.d.ts
CHANGED
|
@@ -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. `
|
|
23
|
-
*
|
|
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>;
|
package/dist/cli/doctor.js
CHANGED
|
@@ -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. `
|
|
101
|
-
*
|
|
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
|
|
23
|
-
* `
|
|
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
|
|
@@ -338,8 +338,11 @@ const SubmitFindingsInput = Schema.Struct({
|
|
|
338
338
|
description: 'Your write-up, from run_status: a one-sentence headline, fixes (most important first, by ' +
|
|
339
339
|
'case ID), per case what you did, what worked and what did not, highlights (an element on ' +
|
|
340
340
|
'one of its screenshot IDs, named like a step target, red for a problem, green for as ' +
|
|
341
|
-
'expected
|
|
342
|
-
'
|
|
341
|
+
'expected; region marks only a part of it, such as text in a picture) and key moments (its ' +
|
|
342
|
+
'timecodes), per fix its evidence (marks on screenshots of any case, shown side by side ' +
|
|
343
|
+
'under the fix: give every mismatch both sides), what you did not test and why (notTested: ' +
|
|
344
|
+
'what and why, and the caseId of a case that did not finish and left it untested; a ' +
|
|
345
|
+
'passing run covers only what its cases did), and next tests. Short ' +
|
|
343
346
|
'texts and capped lists; see the field limits. Use only IDs and timecodes ' +
|
|
344
347
|
"from run_status. The run's checks decide statuses; you can only mark a case failed (its " +
|
|
345
348
|
'failed: what is wrong), whenever your own evidence (a database, logs, the screenshots) ' +
|
|
@@ -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
|
|
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.
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
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`)
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
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
|