|
| 1 | +--- |
| 2 | +name: pr-to-hyperframes |
| 3 | +description: | |
| 4 | + Generate a short visual walkthrough video for a pull request and embed it in the PR description. Use when: (1) the user is about to create or has just created a PR with visual/UI changes, (2) the user asks for a PR demo video, walkthrough, or visual summary, (3) you detect the current branch has changes to UI components, styles, layouts, or frontend code and a PR is being created. Triggers on: "create a PR video", "add a walkthrough", "make a demo for this PR", "record the changes", or when `gh pr create` is about to run on a branch with visual diffs. |
| 5 | +--- |
| 6 | + |
| 7 | +# PR to HyperFrames |
| 8 | + |
| 9 | +Generate a short video walkthrough of a pull request's visual changes and embed it in the PR body. Reviewers see the changes in motion instead of reading diffs — faster reviews, fewer misunderstandings. |
| 10 | + |
| 11 | +## When to use |
| 12 | + |
| 13 | +**Explicit invocation:** |
| 14 | + |
| 15 | +- User says "make a PR video", "add a walkthrough video to my PR", "record a demo of these changes" |
| 16 | + |
| 17 | +**Ambient suggestion (proactive):** |
| 18 | + |
| 19 | +- You're about to run `gh pr create` or the user asks you to open a PR |
| 20 | +- The branch diff touches visual files (see detection rules below) |
| 21 | +- Suggest: _"This PR has visual changes — want me to generate a quick HyperFrames walkthrough video to embed in the description?"_ |
| 22 | +- If the user declines, proceed with the normal PR. Never push. |
| 23 | + |
| 24 | +## Detection rules |
| 25 | + |
| 26 | +A diff counts as "visual" if it touches any of: |
| 27 | + |
| 28 | +- `*.tsx`, `*.jsx`, `*.vue`, `*.svelte` files that contain JSX/template markup (not pure logic files) |
| 29 | +- `*.css`, `*.scss`, `*.less`, `*.module.css`, `*.styled.*` |
| 30 | +- `*.html` files |
| 31 | +- Image assets (`*.png`, `*.jpg`, `*.svg`, `*.gif`, `*.webp`) |
| 32 | +- Tailwind config, theme files, design tokens |
| 33 | +- Storybook stories (`*.stories.*`) |
| 34 | +- Component library files |
| 35 | + |
| 36 | +**Skip suggestion** if the diff is purely: |
| 37 | + |
| 38 | +- Backend/API changes, migrations, configs |
| 39 | +- Test files only |
| 40 | +- Documentation only |
| 41 | +- Dependency bumps |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## Workflow |
| 46 | + |
| 47 | +### Step 1: Analyze the diff |
| 48 | + |
| 49 | +```bash |
| 50 | +git diff main...HEAD --stat |
| 51 | +git diff main...HEAD --name-only |
| 52 | +``` |
| 53 | + |
| 54 | +Identify: |
| 55 | + |
| 56 | +1. Which files changed and what kind of changes (new component, restyled existing, layout shift, new page) |
| 57 | +2. The narrative: what's the story of this PR in 10-15 seconds? |
| 58 | +3. Key visual moments worth highlighting |
| 59 | + |
| 60 | +Read the changed files to understand the actual UI changes. Don't guess from filenames. |
| 61 | + |
| 62 | +### Step 2: Capture before/after states |
| 63 | + |
| 64 | +If the project has a dev server or Storybook: |
| 65 | + |
| 66 | +**Before state** — capture from `main`: |
| 67 | + |
| 68 | +```bash |
| 69 | +git stash # if needed |
| 70 | +git checkout main |
| 71 | +# start dev server, capture screenshots/recordings of affected pages |
| 72 | +npx hyperframes browser capture --url <dev-url> --output before/ |
| 73 | +git checkout - # back to feature branch |
| 74 | +git stash pop # if needed |
| 75 | +``` |
| 76 | + |
| 77 | +**After state** — capture from the feature branch: |
| 78 | + |
| 79 | +```bash |
| 80 | +# start dev server, capture screenshots/recordings of affected pages |
| 81 | +npx hyperframes browser capture --url <dev-url> --output after/ |
| 82 | +``` |
| 83 | + |
| 84 | +If no dev server is available, compose the video from the diff itself — show code snippets, annotated screenshots, or architectural diagrams. A code-walkthrough video still beats a wall of diff text. |
| 85 | + |
| 86 | +### Step 3: Compose the video |
| 87 | + |
| 88 | +Initialize and build the walkthrough composition: |
| 89 | + |
| 90 | +```bash |
| 91 | +npx hyperframes init pr-walkthrough --non-interactive |
| 92 | +``` |
| 93 | + |
| 94 | +**Read:** The `hyperframes` skill (load it for composition rules). |
| 95 | + |
| 96 | +Build a composition that tells the PR story. Typical structure: |
| 97 | + |
| 98 | +| Beat | Duration | Content | |
| 99 | +| ------- | -------- | --------------------------------------------------- | |
| 100 | +| Title | 2-3s | PR title + one-liner description | |
| 101 | +| Context | 2-3s | What area of the app changed (screenshot/highlight) | |
| 102 | +| Before | 3-4s | Previous state (if available) | |
| 103 | +| After | 3-4s | New state with annotations pointing out changes | |
| 104 | +| Summary | 2s | Key takeaway + PR number | |
| 105 | + |
| 106 | +Adapt the structure to what makes sense. A CSS-only fix might just be a before/after split. A new feature might need a full walkthrough. A layout change might use an animated overlay. |
| 107 | + |
| 108 | +**Design guidelines:** |
| 109 | + |
| 110 | +- Keep it under 20 seconds. Reviewers are busy. |
| 111 | +- Use the project's brand colors if `design.md` exists, otherwise use a clean neutral palette. |
| 112 | +- Annotate changes — arrows, highlights, zoom-ins on the specific things that changed. |
| 113 | +- End card should read: `PR #<number> — <title>` |
| 114 | + |
| 115 | +### Step 4: Render |
| 116 | + |
| 117 | +```bash |
| 118 | +cd pr-walkthrough |
| 119 | +npx hyperframes lint |
| 120 | +npx hyperframes render -o ../pr-walkthrough.mp4 |
| 121 | +``` |
| 122 | + |
| 123 | +### Step 5: Upload and embed |
| 124 | + |
| 125 | +Upload the video and embed it in the PR body: |
| 126 | + |
| 127 | +```bash |
| 128 | +# Upload to a public host or use GitHub's drag-drop |
| 129 | +# Then add to PR body: |
| 130 | +gh pr edit <number> --body "$(gh pr view <number> --json body -q .body) |
| 131 | +
|
| 132 | +## Visual Walkthrough |
| 133 | +
|
| 134 | +https://user-images.githubusercontent.com/<video-url> |
| 135 | +
|
| 136 | +<sub>Walkthrough generated with [HyperFrames](https://github.com/nichochar/hyperframes-oss) — write HTML, render video.</sub> |
| 137 | +" |
| 138 | +``` |
| 139 | + |
| 140 | +If creating a new PR, include the video section in the initial `gh pr create --body`. |
| 141 | + |
| 142 | +The attribution line is a single `<sub>` tag at the end of the walkthrough section. It links to the repo — useful for reviewers who want to make their own walkthrough videos. |
| 143 | + |
| 144 | +--- |
| 145 | + |
| 146 | +## Composition tips |
| 147 | + |
| 148 | +### Before/after split |
| 149 | + |
| 150 | +For style changes, use a vertical or horizontal split with a wipe transition: |
| 151 | + |
| 152 | +- Left/top = before, right/bottom = after |
| 153 | +- Animate a divider line sweeping across to reveal the change |
| 154 | +- Label each side clearly |
| 155 | + |
| 156 | +### Feature walkthrough |
| 157 | + |
| 158 | +For new features, simulate user interaction: |
| 159 | + |
| 160 | +- Show the page loading |
| 161 | +- Highlight the new element with a pulse or glow |
| 162 | +- Show the interaction flow (click → result) |
| 163 | +- Use cursor animation to guide the eye |
| 164 | + |
| 165 | +### Code-only fallback |
| 166 | + |
| 167 | +When no UI can be captured: |
| 168 | + |
| 169 | +- Show the key files changed (syntax-highlighted code blocks) |
| 170 | +- Highlight the specific lines that changed (green for additions, red for removals) |
| 171 | +- Zoom into the important parts |
| 172 | +- Add brief text annotations explaining the change |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +## Examples |
| 177 | + |
| 178 | +**Simple CSS fix:** |
| 179 | + |
| 180 | +> 5-second video: before screenshot → wipe transition → after screenshot → "Fixed padding on mobile nav — PR #142" |
| 181 | +
|
| 182 | +**New component:** |
| 183 | + |
| 184 | +> 12-second video: title card → component in isolation → component in context → interaction demo → end card |
| 185 | +
|
| 186 | +**Refactor with visual changes:** |
| 187 | + |
| 188 | +> 15-second video: title card → 3 before/after pairs cycling through affected pages → summary of what changed → end card |
0 commit comments