garrytan / garrytan/gstack

prettyscreenshot: --hide as the trailing flag drops the explicit path argument

Open
#1,378 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
133k
Forks
19.9k
Avg merge
18h 46m
Merged PRs (30d)
26

Description

## Description

`prettyscreenshot --hide ` silently drops the explicit path argument when `--hide` is the last flag before the positional path. The screenshot lands at the default timestamped path (`/tmp/browse-pretty-.png`) instead of the path the caller passed.

The `--hide` parser appears to consume the next positional argument as another selector value, even when that positional is the documented output path (per `prettyscreenshot [--scroll-to sel|text] [--cleanup] [--hide sel...] [--width px] [path]`).

Possibly the same family as #495 (`browse screenshot: relative paths starting with . are misidentified as CSS selectors`), but that one was about `screenshot`/CSS-selector disambiguation, while this is about `prettyscreenshot`/`--hide` consuming an unrelated positional.

## Reproduction matrix (gstack 1.28.0.0 on macOS 26.4.1, Bun-compiled)

```bash
B=~/.claude/skills/gstack/browse/dist/browse
$B goto https://example.com

# Case A — BROKEN: --hide
$ $B prettyscreenshot --hide 'header' /tmp/case-a.png
Screenshot saved : /tmp/browse-pretty-2026-05-08T16-27-54.png # path dropped

# Case B — WORKS: --hide --cleanup
$ $B prettyscreenshot --hide 'header' --cleanup /tmp/case-b.png
Screenshot saved (cleaned) : /tmp/case-b.png # path honored

# Case C — BROKEN: --hide --hide
$ $B prettyscreenshot --hide 'header' --hide 'footer' /tmp/case-c.png
Screenshot saved : /tmp/browse-pretty-...png # path dropped

# Case D — BROKEN: --cleanup --hide
$ $B prettyscreenshot --cleanup --hide 'header' /tmp/case-d.png
Screenshot saved (cleaned) : /tmp/browse-pretty-...png # path dropped
```

## Pattern

The path argument is honored only when `--hide` is followed by another flag *before* the positional path. Whenever `--hide` is the trailing flag, the parser swallows the path as another `--hide` value.

## Workaround

Always place another flag (e.g. `--cleanup`) after the last `--hide` before the explicit path, or rely on the auto-generated timestamped filename.

## Expected behavior

`prettyscreenshot --hide ` should treat the trailing positional as `[path]` per the documented signature, regardless of which flag comes immediately before it.

## Environment

- gstack: **1.28.0.0**
- Platform: **macOS 26.4.1** (arm64)
- Binary: `~/.claude/skills/gstack/browse/dist/browse` (Bun-compiled)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.