Repository navigation
CLI and Orchestration
Role. The omnisnap command: parse the arguments, build the job, run every runtime module in order, report progress, and map the outcome to an exit code. Module cli, package internal/cli, with the analysis glue in internal/pipeline.
From the usage text in root.go:
| Command | Does | Code |
|---|---|---|
omnisnap <url> [<url>...] [flags] |
a job from URLs | root.go |
omnisnap run <job.json> [flags] |
a job from a file; flags override it | root.go |
omnisnap report <bundle-dir> |
re-render report.html from a bundle's summary.json
|
report.go |
omnisnap merge <bundle-dir>... -o <dir> [--rename-hosts] |
one bundle from several machines | merge.go |
omnisnap comment <merged-bundle> [--report-url U] [--run-url U] |
the PR comment as Markdown | comment.go |
omnisnap browsers [--json] |
discovery's result | browsers.go |
omnisnap check-fonts |
the font-parity table | fonts.go |
omnisnap warm <browser> |
warm a branded browser's template | warm.go |
omnisnap install firefox, uninstall firefox
|
Install | install.go |
omnisnap version |
the version | root.go |
Flags for <url> and run: --engines, --baseline, --out, --runs, --viewport, --timeout, --resume, --retry-failed, --allow-small-pages, --no-audit, --neutral, --json, --quiet, --verbose (options.go).
Main sets up a context that SIGINT, SIGTERM and SIGHUP cancel, runs the sweeper before any command but version and help (Process management), and dispatches. main in cmd/omnisnap only calls os.Exit(cli.Main(...)), so every command is a function from arguments to an exit code, and tests call it directly.
For <url> and run, the job is built (jobFromURLs or readJob, which reads strictly), the flags that were set override it (apply), and runJob runs:
-
resolve: defaults, URL checks, slugs. - Discovery, then
makePlan: the baseline is the job's (which must be an installed Blink browser), elsechrome, else the first Blink found. The engines are the job's, or every discovered browser. An engine that is not installed, or whose family has no driver, is skipped with the reason, and listed insummary.json. - Launch the engines in groups of at most
--max-browserslive browsers (default 3;options.go), in job order with the baseline first. A failed launch does not count toward the cap. With N engines or fewer there is one group, and the steps below run exactly as without the cap; with more, steps 3 to 5 repeat per group, each group's browsers closed before the next launches. Each browser starts throughenv.launch(CDP for Blink, from a warmed template for branded ones; BiDi for Gecko; Classic for WebKit), each wrapped in arestartable:NewSessionopens a page,Relaunchcloses a dead browser and launches a fresh one the same way, which is the capture's crash retry. After every new session,env.oomre-applies the Linux out-of-memory score to the launched trees (Process management). A browser that fails to launch is skipped. If the baseline did not start, exit 2, unless the run was interrupted while it launched. A Ctrl-C between groups, or one that makes the baseline's or a whole group's launches fail, ends the run like any interrupt (exit 4, no summary): those engines are not broken, and a summary would pass the job off as finished. - The font pre-flight for the group's engines, against the baseline's report kept from the first group (its browser is closed by then), and a hint naming
omnisnap install firefoxwhen only one engine family is left. - Per page,
capture.RunPage(Capture pipeline) with the group's engines. Only the first group carries the baseline and its failure policy; later groups skip the pages it found unreachable.--resumeaskscapture.ResumeStatewith the group's engine ids. Each page gets onepage-startbefore its first capture and onepage-doneafter its last: right after the page with one group, after the last group otherwise. TheOutcomecallback that prints a line or an event per capture, aLOSTline for a lost engine, and "(in a fresh browser: the first attempt crashed)" after a successful retry. -
writeBundle: the analysis of every page and engine,findings.json,host.json,summary.json,report.html(Architecture).
The reporter prints either one human line per event, or with --json one NDJSON event per line and nothing else on stdout (Data contracts, progress events). --quiet prints only the report path and errors.
| Code | Meaning |
|---|---|
| 0 | the job completed, with or without findings (report-only) |
| 1 | usage error: a bad flag, an unknown command, an invalid job file, nothing to capture |
| 2 | no usable browsers: fewer than two engine families, or no baseline |
| 3 | every capture of every page failed |
| 4 | internal error: a bug; the message asks for a report |
-
run_test.gowith a fake environment: usage errors, exit codes 2, 3 and 4, a URL run writing a bundle, a job file's interleaving, flags after the URL, resume, check-fonts, the font pre-flight, install and uninstall, the single-family hint, merge, the neutral profile. -
root_test.go:TestMainExitCodesAndOutput. -
crash_test.go: a crashed engine leaves the job with one message and oneengine failedevent. -
comment_test.go,report_test.go. -
TestWalkingSkeleton(browserstag): a real job end to end.
-
--no-probesand--opendo not exist.SPEC-cli.mdlists both. Probes can be turned off only in the job file ("probes": false). The report is never opened automatically; the CLI prints its path.
-
cmd/omnisnap/main.go: the released binary's entry point: callscli.Mainand exits with its code -
internal/cli/root.go:Main: command dispatch, the progress reporter choice,omnisnap version -
internal/cli/options.go: flag parsing, building a job from URLs or reading a job file -
internal/cli/run.go:runJobandmakePlan: discovery, the plan, the engine groups, each page, the bundle -
internal/cli/env.go:canDriveandlaunch: which engines can run here and how each starts -
internal/cli/restart.go: a session that can be relaunched after a crash -
internal/cli/bundle.go:writeBundle: summary.json, the audit findings, the report -
internal/cli/progress.go: the human and JSON progress reporters -
internal/cli/exit.go: the exit codes, public API for the wrappers and the Action -
internal/cli/browsers.go:omnisnap browsers -
internal/cli/report.go:omnisnap report: re-render report.html from a bundle -
internal/cli/fonts.go:omnisnap check-fonts -
internal/cli/signals_unix.go: the signals that stop a run, on Unix -
internal/cli/signals_windows.go: the signals that stop a run, on Windows -
internal/cli/webkit_engine.go: a WebKit session that owns its driver process (Linux and macOS) -
internal/cli/webkit_linux.go:launchWebKiton Linux: WPE or WebKitGTK -
internal/cli/webkit_darwin.go:launchWebKiton macOS: Safari -
internal/cli/webkit_other.go:launchWebKitelsewhere: not available -
internal/pipeline/diff.go:pipeline.Run: layout diff, appearance and triage for one page pair -
internal/pipeline/findings.go: findings.json: the causes and findings per pair -
internal/pipeline/intent.go: intent violations joined into the findings' words -
internal/fsutil/atomic.go:WriteAtomic: every bundle file is written whole or not at all
This wiki is published from docs/internals/ on main. Edits made here are overwritten on the next publish: change the pages there, in a pull request. The specs are normative; where a page and a spec disagree, the page says what the code does.
Start
Contracts
Capture side
Analysis side
Output
Quality