Skip to content

Support configurable default viewport via BROWSE_VIEWPORT#874

Open
FredAmartey wants to merge 1 commit intogarrytan:mainfrom
FredAmartey:feat/configurable-viewport
Open

Support configurable default viewport via BROWSE_VIEWPORT#874
FredAmartey wants to merge 1 commit intogarrytan:mainfrom
FredAmartey:feat/configurable-viewport

Conversation

@FredAmartey
Copy link
Copy Markdown

@FredAmartey FredAmartey commented Apr 7, 2026

Summary

The default browse viewport (1280x720) is hardcoded in three places in browser-manager.ts plus the responsive desktop preset. This adds a BROWSE_VIEWPORT environment variable so users can configure their preferred default without patching source.

  • New exported getDefaultViewport() function in browser-manager.ts reads BROWSE_VIEWPORT env var (format: WIDTHxHEIGHT)
  • Falls back to 1280x720 if unset or malformed
  • Dimensions clamped to sane bounds (320-7680 width, 240-4320 height) consistent with existing viewport clamping
  • Responsive desktop preset also uses the configured default
  • 4 unit tests covering: default fallback, valid parsing, malformed input, bounds clamping

Usage with gstack-config:

gstack-config set browse_viewport 1920x1080

Then in a skill preamble:

export BROWSE_VIEWPORT=$(~/.claude/skills/gstack/bin/gstack-config get browse_viewport 2>/dev/null)

Files changed:

  • browse/src/browser-manager.ts — new getDefaultViewport(), replaces 3 hardcoded viewports
  • browse/src/meta-commands.ts — responsive desktop preset uses getDefaultViewport()
  • browse/src/commands.ts — updated responsive description
  • browse/test/browser-manager-unit.test.ts — 4 new tests
  • browse/SKILL.md, SKILL.md — auto-regenerated from templates

Test plan

  • 4 new unit tests pass (bun test browse/test/browser-manager-unit.test.ts — 6/6)
  • All 195 browse command tests pass (bun test browse/test/commands.test.ts — 195/195)
  • All 77 security audit tests pass (bun test browse/test/security-audit-r2.test.ts — 77/77)
  • Verified: unset BROWSE_VIEWPORT → 1280x720 (backward compatible)
  • Verified: BROWSE_VIEWPORT=1728x996 → 1728x996 viewport
  • Verified: malformed input → 1280x720 fallback

@FredAmartey FredAmartey force-pushed the feat/configurable-viewport branch from 085f0e6 to f8f6c91 Compare April 7, 2026 07:26
The default viewport (1280x720) is now read from the BROWSE_VIEWPORT
environment variable when set (format: "WIDTHxHEIGHT"). Falls back to
1280x720 if unset or malformed. Dimensions are clamped to sane bounds
(320-7680 width, 240-4320 height).

This lets users configure their preferred viewport without patching
source. Works with gstack-config:

  gstack-config set browse_viewport 1920x1080

Then in SKILL.md preamble:

  export BROWSE_VIEWPORT=$(gstack-config get browse_viewport)
@FredAmartey FredAmartey force-pushed the feat/configurable-viewport branch from f8f6c91 to 0476efc Compare April 7, 2026 07:29
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.

1 participant