Skip to content

Make web-screenshot feel like a real CLI (v2.1.0) - #9

Merged
Helvio88 merged 2 commits into
masterfrom
cursor/cli-hardening-882a
Aug 13, 2026
Merged

Make web-screenshot feel like a real CLI (v2.1.0)#9
Helvio88 merged 2 commits into
masterfrom
cursor/cli-hardening-882a

Conversation

@Helvio88

@Helvio88 Helvio88 commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

Hardens @helvio/web-screenshot 2.1.0 so the CLI matches its docs and behaves like a real tool, without renaming the package or bin and without dropping existing flags.

Compatibility kept

  • Package: @helvio/web-screenshot
  • Bin: web-screenshot
  • Flags: -u/--url, -o/--out, -t/--time, -x/-y/-w/-h, -c/--crop, -b/--batch, -d/--debug, -a/--auth, -p/--path
  • Defaults: extra wait 3s (sanitizer: integer 1–600 seconds → ms, else 5000ms), viewport 1920×1080, PNG if no extension
  • Batch file: one arg-set per line, # comments

Behavior

  • Full-page when width or height is 0, as the README already promised. Clip path is unchanged otherwise; default size is still 1920×1080.
  • page.goto(..., { waitUntil: 'networkidle2' }), then the existing -t extra wait. -t still means extra seconds after load.
  • Batch lines are split with quote-aware argv parsing and then parsed by Commander, so paths like "My Screenshots/home.png" work.
  • Sanitizer hygiene: CLI string numbers (-t 3) are treated as integers; sanitizeAuth is string | undefined.
  • Empty invocation now errors and asks for --url or --batch instead of launching a browser and exiting.

Docs / CI

  • README matches Commander help (Usage: web-screenshot), documents -p/--path, drops Travis and --unsafe-perm, and explains install via npm i -g / npx.
  • Added ISC LICENSE to match package.json (documenting, not relicensing).
  • GitHub Actions CI on push/PR: lint, typecheck, test, build, and a check that committed dist/ is up to date.
  • Committed dist/screenshot.js is bundled without minify so that freshness check is deterministic (esbuild identifier mangling was failing CI).
  • Publish workflow kept (same filename) but fixed: Node 22, npm run build (esbuild) instead of Node 16 + the stub tsc package. Not published to npm from this PR.

Tests

46 tests covering Sanitizer, CLI help/args, batch quoting, capture planning (clip vs full-page + networkidle2), and a mocked Puppeteer screenshot flow. No live network required.

Dependabot PR #8 (@sideway/formula) is left alone. After the lockfile refresh that dependency is gone (it came from stale jimp lockfile entries).

Version

Minor bump to 2.1.0 because 0-size full-page and waitUntil are user-visible behavior changes. Changelog is in CHANGELOG.md. Please do not npm publish until you want this released.

Open in Web Open in Cursor 

Honor full-page screenshots when width or height is 0, wait for
networkidle2 before the extra -t delay, and parse batch lines with
quoted argv. Align the README with Commander, replace Travis with
GitHub Actions CI, and fix the npm publish workflow.

Co-authored-by: Helvio Pedreschi <Helvio88@users.noreply.github.com>
@Helvio88
Helvio88 marked this pull request as ready for review August 13, 2026 04:43
Drop esbuild --minify. Identifier mangling made git diff --exit-code dist
fail on GitHub Actions even when the source was current.

Co-authored-by: Helvio Pedreschi <Helvio88@users.noreply.github.com>
@Helvio88
Helvio88 merged commit 39ce0ab into master Aug 13, 2026
1 check passed
@Helvio88
Helvio88 deleted the cursor/cli-hardening-882a branch August 13, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants