Skip to content

feat(desktop): reusable screenshot workflow for agents#826

Merged
wpfleger96 merged 5 commits into
mainfrom
wpfleger/desktop-screenshot-workflow
Jun 3, 2026
Merged

feat(desktop): reusable screenshot workflow for agents#826
wpfleger96 merged 5 commits into
mainfrom
wpfleger/desktop-screenshot-workflow

Conversation

@wpfleger96

@wpfleger96 wpfleger96 commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Adds tooling so agents working on desktop UI changes can take screenshots and post them to PRs without manual intervention or external image hosting.

The existing screenshot.mjs helper could only navigate to static routes. For PR #803 we manually wrote custom Playwright scripts to inject messages, take screenshots, and host images via git plumbing — this codifies that ad-hoc process into reusable tooling.

  • Extend desktop/tests/helpers/screenshot.mjs with a --messages <path> option that injects mock messages into the channel timeline (via __SPROUT_E2E_EMIT_MOCK_MESSAGE__) before capturing, with subscription-ready gating, JSON validation, multi-channel rejection, and channelName format checks
  • Add scripts/post-screenshots.sh that hosts PNGs on a shared agent-screenshots orphan branch (flat pr-<N>-- namespace, idempotent on re-runs, --force-with-lease for push safety) and posts a gh pr comment with embedded image URLs
  • Add just desktop-screenshot target that always rebuilds the frontend and manages the preview server lifecycle automatically
  • Wrap all post-init browser work in try/finally for guaranteed browser cleanup on errors
  • Update AGENTS.md with the full workflow: message injection, PR posting, orphan branch lifecycle, and concurrency notes

@wpfleger96 wpfleger96 force-pushed the wpfleger/desktop-screenshot-workflow branch from d0f745b to 727377c Compare June 3, 2026 16:14
…tion

Agents working on desktop UI changes had no automated way to capture and
share visual results. Extends screenshot.mjs with --messages injection so
agents can populate the channel timeline before capturing, adds
scripts/post-screenshots.sh for hosting PNGs via a shared orphan branch
on GitHub, wires up a just desktop-screenshot target that handles build
and server lifecycle automatically, and updates AGENTS.md with the full
workflow.

Signed-off-by: Will Pfleger <wpfleger@block.xyz>
@wpfleger96 wpfleger96 force-pushed the wpfleger/desktop-screenshot-workflow branch from 727377c to 7527e16 Compare June 3, 2026 16:57
Fixes all issues from the crossfire review (3 Claude specialists +
Codex + Gemini):

- Replace slashed tree paths with flat pr-N-- namespace so git mktree
  accepts them (was failing on every invocation)
- Add PR number validation, channelName format check, and multi-channel
  rejection with clear error messages
- Wrap screenshot.mjs main logic in try/finally for browser cleanup
- Warn when --messages and --route are both provided
- Use --force-with-lease instead of --force for push safety
- Replace literal tabs with printf/explicit $'\t' for robustness
- Deduplicate image URL markdown loop in post-screenshots.sh
- Always rebuild frontend in just desktop-screenshot for freshness
wpfleger96 added a commit that referenced this pull request Jun 3, 2026
wpfleger96 added a commit that referenced this pull request Jun 3, 2026
wpfleger96 added a commit that referenced this pull request Jun 3, 2026
The justfile `desktop-screenshot` recipe used `cd ..; just desktop-build`
which navigated above the worktree root, breaking the subsequent
`cd desktop`. The post-screenshots.sh script had two issues: command
substitution stripped trailing newlines from printf, concatenating tree
entries into a single malformed filename; and the grep filter didn't
account for git quoting filenames that contain special characters.
wpfleger96 added a commit that referenced this pull request Jun 3, 2026
@wpfleger96

Copy link
Copy Markdown
Collaborator Author

Screenshots

pr-826--channel-messages

pr-826--code-blocks

pr-826--home

pr-826--search

pr-826--settings

Derive GitHub username via `gh api user` and push to
`agent-screenshots/<username>` instead of a shared branch. Eliminates
cross-developer contention on `--force-with-lease` pushes.
Trim from 67 to 46 lines by removing subheaders, heredoc scaffolding,
the Playwright MCP browser note, and verbose explanations. All flags,
JSON schema, mock channel list, and post-screenshots usage preserved.
@wpfleger96 wpfleger96 marked this pull request as ready for review June 3, 2026 19:26
@wpfleger96 wpfleger96 requested a review from a team as a code owner June 3, 2026 19:26
@wpfleger96 wpfleger96 enabled auto-merge (squash) June 3, 2026 19:28
@wpfleger96 wpfleger96 merged commit 06bc67f into main Jun 3, 2026
16 checks passed
@wpfleger96 wpfleger96 deleted the wpfleger/desktop-screenshot-workflow branch June 3, 2026 19:33
michaelneale added a commit that referenced this pull request Jun 4, 2026
* origin/main: (36 commits)
  fix: use immutable commit-SHA URLs in screenshot PR comments (#842)
  feat(mobile+desktop): two-tier Slack-style app icon badge (#802)
  chore: simplify file-size check to a flat 1000-line limit (#839)
  fix(desktop): robust emoji picker — unify picker + fix custom emoji in editing, status, reactions (#837)
  feat(desktop): reusable screenshot workflow for agents (#826)
  desktop(mesh-llm): let a serving node route a different model (#833)
  chore(release): release version 0.3.9 (#832)
  fix: native arbitrary-file download + image context-menu flash (#830)
  fix(desktop): custom emoji reaction rendering + picker autofocus (#831)
  Mesh-LLM v1: relay-gated direct-iroh inference between users (WAN) (#822)
  chore(release): release version 0.3.8 (#829)
  chore(release): release version 0.3.7 (#825)
  feat: code block rendering, syntax highlighting, and compose fixes (#803)
  feat: custom emoji — user-owned NIP-30 sets with a client-side union (#816)
  Install sprout-cli skill at repo root + fix desktop clippy (#818)
  fix(desktop): use public re-export path for ensure_client_node_for_model (#824)
  refactor(desktop): feature-gate mesh-llm-sdk behind optional Cargo feature (#823)
  fix(desktop): align workflow read/save commands to the frontend contract (#820)
  fix(desktop): disable mesh-llm auto-build to prevent git config corruption (#819)
  fix(desktop): clear clippy lints in agents/mesh_llm commands (#817)
  ...

# Conflicts:
#	Cargo.lock
#	desktop/scripts/check-file-sizes.mjs
#	desktop/src-tauri/Cargo.toml
#	desktop/src/app/AppShell.tsx
#	desktop/src/app/AppTopChrome.tsx
#	desktop/src/features/messages/hooks.ts
#	desktop/src/features/workspaces/useWorkspaceInit.ts
#	desktop/src/shared/api/tauri.ts
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