Add terminal-mockup canvas extension for marketing screenshots by BagToad · Pull Request #13612 · cli/cli · GitHub
Skip to content

Add terminal-mockup canvas extension for marketing screenshots#13612

Merged
BagToad merged 3 commits into
trunkfrom
bagtoad/kw-terminal-mockup-canvas
Jun 8, 2026
Merged

Add terminal-mockup canvas extension for marketing screenshots#13612
BagToad merged 3 commits into
trunkfrom
bagtoad/kw-terminal-mockup-canvas

Conversation

@BagToad

@BagToad BagToad commented Jun 7, 2026

Copy link
Copy Markdown
Member

Description

Adds a GitHub Copilot app canvas extension under .github/extensions/terminal-mockup that renders mock-up gh output as VSCode-styled terminal screenshots, intended for producing standardized demo materials for design discussions or marketing use-cases.

image

Key Points

The extension is a self-contained GitHub Copilot App canvas. The SDK entry point (extension.mjs) spins up a loopback HTTP server on a random port, serves a small static iframe app, and exposes an SSE channel and a REST API so the agent can drive content and options from one side while the user edits in the iframe on the other.

Rendering is done in-browser with the VSCode Dark+ palette and the GitHub Mono font, then rasterized to PNG with a vendored html2canvas 1.4.1 bundle (MIT, unmodified). No build step, no Node dependencies beyond the SDK.

Content authoring supports raw ANSI escapes plus a more readable bracket markup ([red], [bold], [c:#hex], [/], etc.), and an auto-style toggle that colorizes common gh output patterns (PR/issue states, labels, checkboxes, timestamps) without inline tags.

Mockups live in two libraries: the library/ directory committed with the repo, plus a user-scoped directory under $COPILOT_HOME for local-only experiments. The agent can save, load, list, delete, and batch export across both.

Self-contained GitHub Copilot app canvas under .github/extensions/terminal-mockup
for rendering mock-up gh output as VSCode-styled terminal screenshots.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@BagToad BagToad marked this pull request as ready for review June 7, 2026 16:40
@BagToad BagToad requested a review from a team as a code owner June 7, 2026 16:40
@BagToad BagToad requested review from babakks and Copilot June 7, 2026 16:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a self-contained GitHub Copilot Canvas extension under .github/extensions/terminal-mockup that serves a local iframe UI for authoring and exporting VSCode-styled “terminal screenshot” mockups, plus a small on-disk library system for saved mockups and sample templates.

Changes:

  • Introduces a loopback HTTP server + SSE channel + REST API for state sync and mockup library CRUD.
  • Adds an in-iframe web app (HTML/CSS/JS) that renders ANSI/bracket-marked content and exports images via vendored html2canvas.
  • Seeds a set of sample mockups in a committed library/ directory.
Show a summary per file
File Description
.github/extensions/terminal-mockup/README.md Usage + markup + library documentation for the canvas extension
.github/extensions/terminal-mockup/extension.mjs Extension entrypoint: loopback server, SSE, /mockups REST API, canvas actions
.github/extensions/terminal-mockup/assets/index.html Iframe UI layout (toolbar, preview, editor, dialogs)
.github/extensions/terminal-mockup/assets/styles.css App + mockup styling and typography rules
.github/extensions/terminal-mockup/assets/app.js UI logic: SSE sync, library CRUD, export, resizing, pane toggles
.github/extensions/terminal-mockup/assets/ansi.js ANSI SGR + bracket-markup parsing and optional auto-styling
.github/extensions/terminal-mockup/assets/html2canvas.min.js Vendored html2canvas distribution used for rasterization
.github/extensions/terminal-mockup/library/sample-run-watch.json Sample mockup: gh run watch
.github/extensions/terminal-mockup/library/sample-repo-view.json Sample mockup: gh repo view
.github/extensions/terminal-mockup/library/sample-pr-view-comments.json Sample mockup: gh pr view --comments
.github/extensions/terminal-mockup/library/sample-pr-list.json Sample mockup: gh pr list
.github/extensions/terminal-mockup/library/sample-issue-list.json Sample mockup: gh issue list
.github/extensions/terminal-mockup/library/issue-view-monas-cafe.json Sample mockup: issue view (Mona’s Cafe)
.github/extensions/terminal-mockup/library/issue-view-json-monas-cafe.json Sample mockup: issue view --json (Mona’s Cafe)
.github/extensions/terminal-mockup/library/issue-create-monas-cafe.json Sample mockup: issue create (Mona’s Cafe)
.github/extensions/terminal-mockup/library/discussion-view-monas-cafe.json Sample mockup: discussion view (Mona’s Cafe)
.github/extensions/terminal-mockup/library/discussion-list-monas-cafe.json Sample mockup: discussion list (Mona’s Cafe)

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 16/17 changed files
  • Comments generated: 8

Comment thread .github/extensions/terminal-mockup/extension.mjs
Comment thread .github/extensions/terminal-mockup/extension.mjs
Comment thread .github/extensions/terminal-mockup/assets/app.js
Comment thread .github/extensions/terminal-mockup/assets/app.js
Comment thread .github/extensions/terminal-mockup/README.md Outdated
Comment thread .github/extensions/terminal-mockup/README.md Outdated
Comment thread .github/extensions/terminal-mockup/README.md Outdated
Comment thread .github/extensions/terminal-mockup/assets/styles.css

@babakks babakks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice mockups! 🙌

BagToad and others added 2 commits June 8, 2026 09:59
- Restore descendant selector for JetBrains font rule (missing space)
- Resolve save dialog promise before closing to avoid sync close-event race
- Add fontSize and bodyGradient to set_options schema (already in state)
- Guard against canvas.toBlob returning null in both export paths
- Fix README markup reference (no [c:#hex] or [/]) and chrome list (no Windows)
- Reword export location to match browser behaviour

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Two-model security review found:

- DNS-rebinding + cross-origin CSRF: an attacker page can hit the loopback
  server through a rebound DNS name or a localhost-permissive page and
  read/write mockup files without any check. Now rejects any request whose
  Host header is not 127.0.0.1:<port> or localhost:<port>, and any request
  whose Origin (if present) is not loopback.

- Symlink-following on writeMockup/deleteMockup: a malicious PR could land
  a symlink at library/<slug>.json pointing at ~/.bashrc, ~/.ssh/*, etc.,
  and any subsequent save under that slug would overwrite the link target.
  refuseSymlink() now lstats first and refuses if the target is a symlink.

Verified end-to-end against the running canvas: legitimate flows still
succeed (200), rebound-Host probes are blocked (403), cross-origin POSTs
are blocked (403), symlink overwrite is refused and the link target is
untouched.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@BagToad BagToad enabled auto-merge (squash) June 8, 2026 16:33
@BagToad BagToad disabled auto-merge June 8, 2026 16:35
@BagToad BagToad enabled auto-merge June 8, 2026 16:35
@BagToad BagToad disabled auto-merge June 8, 2026 16:35
@BagToad BagToad enabled auto-merge (squash) June 8, 2026 16:35
@BagToad BagToad merged commit da68cb8 into trunk Jun 8, 2026
9 checks passed
@BagToad BagToad deleted the bagtoad/kw-terminal-mockup-canvas branch June 8, 2026 16:42
laserlemon added a commit to laserlemon/gh-cru that referenced this pull request Jun 9, 2026
Three call sites (score.Compute, format_test.mkScore, demo-output.buildScore)
swap cru.SizeOf -> cru.CalculateSize. JSON output for cli/cli#13612 is
byte-identical.
@p68175655-bot

Copy link
Copy Markdown

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.

4 participants