初始化项目版本

This commit is contained in:
Axhub Make
2026-07-29 16:04:39 +08:00
commit 4305a1082b
2629 changed files with 760590 additions and 0 deletions

View File

@@ -0,0 +1,105 @@
# Stitch-Remotion Video Walkthrough Skill
Generate professional walkthrough videos from Stitch app designs using Remotion.
## What This Skill Does
This skill bridges Stitch (UI design platform) and Remotion (programmatic video library) to automatically create walkthrough videos showcasing app screens with:
- **Smooth transitions**: Cross-fades, slides, and zoom effects
- **Text overlays**: Screen titles, descriptions, and feature callouts
- **Professional animations**: Spring-based natural motion
- **Customizable timing**: Control display duration per screen
## Prerequisites
1. **Stitch MCP Server**: Access to retrieve screens from Stitch projects
2. **Node.js**: For running Remotion
3. **Remotion**: Either Remotion MCP Server or Remotion CLI
## Example Use Case
**User Request:**
> "Look up the screens in my Stitch project 'Calculator App' and build a remotion video that shows a walkthrough of the screens."
**What Happens:**
1. Agent retrieves all screens from the Stitch project
2. Downloads screenshots for each screen
3. Creates a Remotion composition with transitions
4. Generates video with smooth animations and text overlays
5. Renders final MP4 video
## Key Features
- **Automated asset retrieval** from Stitch projects
- **Modular Remotion components** for easy customization
- **Multiple transition styles** (fade, slide, zoom)
- **Text overlay system** for annotations
- **Configurable timing** per screen
- **Professional rendering** with quality optimization
## Installation
Install this skill using:
```bash
npx skills add google-labs-code/stitch-skills --skill remotion --global
```
## File Structure
When using this skill, the agent will create:
```
project/
├── video/ # Remotion project
│ ├── src/
│ │ ├── WalkthroughComposition.tsx
│ │ ├── ScreenSlide.tsx
│ │ └── components/
│ ├── public/assets/screens/ # Stitch screenshots
│ └── remotion.config.ts
├── screens.json # Screen manifest
└── output.mp4 # Final video
```
## How It Works
1. **Discovery**: Identifies Stitch and Remotion MCP servers
2. **Retrieval**: Fetches screens and metadata from Stitch project
3. **Asset Download**: Downloads screenshots for each screen
4. **Composition**: Generates Remotion React components
5. **Preview**: Opens Remotion Studio for refinement (optional)
6. **Render**: Produces final video file
## Integration Points
**With Stitch:**
- Uses Stitch MCP to list projects and screens
- Downloads screenshots and HTML code
- Extracts screen metadata (title, dimensions)
**With Remotion:**
- Creates TypeScript/React components
- Configures composition settings
- Renders video using Remotion CLI or MCP
## Advanced Capabilities
- **Dynamic text extraction**: Parse Stitch HTML to auto-generate annotations
- **Interactive hotspots**: Highlight clickable elements
- **Voiceover integration**: Sync narration with screen transitions
- **Multiple video patterns**: Slide show, feature highlight, user flow
## Related Skills
- **design-md**: Extract design system from Stitch projects (useful for consistent branding in videos)
- **react-components**: Convert Stitch designs to React (if you want interactive demos instead of videos)
## Learn More
See the full [SKILL.md](./SKILL.md) for detailed instructions, troubleshooting, and best practices.
## License
This is not an officially supported Google product.

View File

@@ -0,0 +1,393 @@
---
name: remotion
description: Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays
allowed-tools:
- "stitch*:*"
- "remotion*:*"
- "Bash"
- "Read"
- "Write"
- "web_fetch"
---
# Stitch to Remotion Walkthrough Videos
You are a video production specialist focused on creating engaging walkthrough videos from app designs. You combine Stitch's screen retrieval capabilities with Remotion's programmatic video generation to produce smooth, professional presentations.
## Overview
This skill enables you to create walkthrough videos that showcase app screens with professional transitions, zoom effects, and contextual text overlays. The workflow retrieves screens from Stitch projects and orchestrates them into a Remotion video composition.
## Prerequisites
**Required:**
- Access to the Stitch MCP Server
- Access to the Remotion MCP Server (or Remotion CLI)
- Node.js and npm installed
- A Stitch project with designed screens
**Recommended:**
- Familiarity with Remotion's video capabilities
- Understanding of React components (Remotion uses React)
## Retrieval and Networking
### Step 1: Discover Available MCP Servers
Run `list_tools` to identify available MCP servers and their prefixes:
- **Stitch MCP**: Look for `stitch:` or `mcp_stitch:` prefix
- **Remotion MCP**: Look for `remotion:` or `mcp_remotion:` prefix
### Step 2: Retrieve Stitch Project Information
1. **Project lookup** (if Project ID is not provided):
- Call `[stitch_prefix]:list_projects` with `filter: "view=owned"`
- Identify target project by title (e.g., "Calculator App")
- Extract Project ID from `name` field (e.g., `projects/13534454087919359824`)
2. **Screen retrieval**:
- Call `[stitch_prefix]:list_screens` with the project ID (numeric only)
- Review screen titles to identify all screens for the walkthrough
- Extract Screen IDs from each screen's `name` field
3. **Screen metadata fetch**:
For each screen:
- Call `[stitch_prefix]:get_screen` with `projectId` and `screenId`
- Retrieve:
- `screenshot.downloadUrl` — Visual asset for the video
- `htmlCode.downloadUrl` — Optional: for extracting text/content
- `width`, `height` — Screen dimensions for proper scaling
- Screen title and description for text overlays
4. **Asset download**:
- Use `web_fetch` or `Bash` with `curl` to download screenshots
- Save to a staging directory: `assets/screens/{screen-name}.png`
- Organize assets in order of the intended walkthrough flow
### Step 3: Set Up Remotion Project
1. **Check for existing Remotion project**:
- Look for `remotion.config.ts` or `package.json` with Remotion dependencies
- If exists, use the existing project structure
2. **Create new Remotion project** (if needed):
```bash
npm create video@latest -- --blank
```
- Choose TypeScript template
- Set up in a dedicated `video/` directory
3. **Install dependencies**:
```bash
cd video
npm install @remotion/transitions @remotion/animated-emoji
```
## Video Composition Strategy
### Architecture
Create a modular Remotion composition with these components:
1. **`ScreenSlide.tsx`** — Individual screen display component
- Props: `imageSrc`, `title`, `description`, `width`, `height`
- Features: Zoom-in animation, fade transitions
- Duration: Configurable (default 3-5 seconds per screen)
2. **`WalkthroughComposition.tsx`** — Main video composition
- Sequences multiple `ScreenSlide` components
- Handles transitions between screens
- Adds text overlays and annotations
3. **`config.ts`** — Video configuration
- Frame rate (default: 30 fps)
- Video dimensions (match Stitch screen dimensions or scale appropriately)
- Total duration calculation
### Transition Effects
Use Remotion's `@remotion/transitions` for professional effects:
- **Fade**: Smooth cross-fade between screens
```tsx
import {fade} from '@remotion/transitions/fade';
```
- **Slide**: Directional slide transitions
```tsx
import {slide} from '@remotion/transitions/slide';
```
- **Zoom**: Zoom in/out effects for emphasis
- Use `spring()` animation for smooth zoom
- Apply to important UI elements
### Text Overlays
Add contextual information using Remotion's text rendering:
1. **Screen titles**: Display at the top or bottom of each frame
2. **Feature callouts**: Highlight specific UI elements with animated pointers
3. **Descriptions**: Fade in descriptive text for each screen
4. **Progress indicator**: Show current screen position in walkthrough
## Execution Steps
### Step 1: Gather Screen Assets
1. Identify target Stitch project
2. List all screens in the project
3. Download screenshots for each screen
4. Organize in order of walkthrough flow
5. Create a manifest file (`screens.json`):
```json
{
"projectName": "Calculator App",
"screens": [
{
"id": "1",
"title": "Home Screen",
"description": "Main calculator interface with number pad",
"imagePath": "assets/screens/home.png",
"width": 1200,
"height": 800,
"duration": 4
},
{
"id": "2",
"title": "History View",
"description": "View of previous calculations",
"imagePath": "assets/screens/history.png",
"width": 1200,
"height": 800,
"duration": 3
}
]
}
```
### Step 2: Generate Remotion Components
Create the video components following Remotion best practices:
1. **Create `ScreenSlide.tsx`**:
- Use `useCurrentFrame()` and `spring()` for animations
- Implement zoom and fade effects
- Add text overlays with proper timing
2. **Create `WalkthroughComposition.tsx`**:
- Import screen manifest
- Sequence screens with `<Sequence>` components
- Apply transitions between screens
- Calculate proper timing and offsets
3. **Update `remotion.config.ts`**:
- Set composition ID
- Configure video dimensions
- Set frame rate and duration
**Reference Resources:**
- Use `resources/screen-slide-template.tsx` as starting point
- Follow `resources/composition-checklist.md` for completeness
- Review examples in `examples/` directory
### Step 3: Preview and Refine
1. **Start Remotion Studio**:
```bash
npm run dev
```
- Opens browser-based preview
- Allows real-time editing and refinement
2. **Adjust timing**:
- Ensure each screen has appropriate display duration
- Verify transitions are smooth
- Check text overlay timing
3. **Fine-tune animations**:
- Adjust spring configurations for zoom effects
- Modify easing functions for transitions
- Ensure text is readable at all times
### Step 4: Render Video
1. **Render using Remotion CLI**:
```bash
npx remotion render WalkthroughComposition output.mp4
```
2. **Alternative: Use Remotion MCP** (if available):
- Call `[remotion_prefix]:render` with composition details
- Specify output format (MP4, WebM, etc.)
3. **Optimization options**:
- Set quality level (`--quality`)
- Configure codec (`--codec h264` or `h265`)
- Enable parallel rendering (`--concurrency`)
## Advanced Features
### Interactive Hotspots
Highlight clickable elements or important features:
```tsx
import {interpolate, useCurrentFrame} from 'remotion';
const Hotspot = ({x, y, label}) => {
const frame = useCurrentFrame();
const scale = spring({
frame,
fps: 30,
config: {damping: 10, stiffness: 100}
});
return (
<div style={{
position: 'absolute',
left: x,
top: y,
transform: `scale(${scale})`
}}>
<div className="pulse-ring" />
<span>{label}</span>
</div>
);
};
```
### Voiceover Integration
Add narration to the walkthrough:
1. Generate voiceover script from screen descriptions
2. Use text-to-speech or record audio
3. Import audio into Remotion with `<Audio>` component
4. Sync screen timing with voiceover pacing
### Dynamic Text Extraction
Extract text from Stitch HTML code for automatic annotations:
1. Download `htmlCode.downloadUrl` for each screen
2. Parse HTML to extract key text elements (headings, buttons, labels)
3. Generate automatic callouts for important UI elements
4. Add to composition as timed text overlays
## File Structure
```
project/
├── video/ # Remotion project directory
│ ├── src/
│ │ ├── WalkthroughComposition.tsx
│ │ ├── ScreenSlide.tsx
│ │ ├── components/
│ │ │ ├── Hotspot.tsx
│ │ │ └── TextOverlay.tsx
│ │ └── Root.tsx
│ ├── public/
│ │ └── assets/
│ │ └── screens/ # Downloaded Stitch screenshots
│ │ ├── home.png
│ │ └── history.png
│ ├── remotion.config.ts
│ └── package.json
├── screens.json # Screen manifest
└── output.mp4 # Rendered video
```
## Integration with Remotion Skills
Remotion maintains its own Agent Skills that define best practices. Review these for advanced techniques:
- **Repository**: https://github.com/remotion-dev/remotion/tree/main/packages/skills
- **Installation**: `npx skills add remotion-dev/skills`
Key Remotion skills to leverage:
- Animation timing and easing
- Composition architecture patterns
- Performance optimization
- Audio synchronization
## Common Patterns
### Pattern 1: Simple Slide Show
Basic walkthrough with fade transitions:
- 3-5 seconds per screen
- Cross-fade transitions
- Bottom text overlay with screen title
- Progress bar at top
### Pattern 2: Feature Highlight
Focus on specific UI elements:
- Zoom into specific regions
- Animated circles/arrows pointing to features
- Slow-motion emphasis on key interactions
- Side-by-side before/after comparisons
### Pattern 3: User Flow
Show step-by-step user journey:
- Sequential screen flow with directional slides
- Numbered steps overlay
- Highlight user actions (clicks, taps)
- Connect screens with animated paths
## Troubleshooting
| Issue | Solution |
|-------|----------|
| **Blurry screenshots** | Ensure downloaded images are at full resolution; check `screenshot.downloadUrl` quality settings |
| **Misaligned text** | Verify screen dimensions match composition size; adjust text positioning based on actual screen size |
| **Choppy animations** | Increase frame rate to 60fps; use proper spring configurations with appropriate damping |
| **Remotion build fails** | Check Node version compatibility; ensure all dependencies are installed; review Remotion docs |
| **Timing feels off** | Adjust duration per screen in manifest; preview in Remotion Studio; test with actual users |
## Best Practices
1. **Maintain aspect ratio**: Use actual Stitch screen dimensions or scale proportionally
2. **Consistent timing**: Keep screen display duration consistent unless emphasizing specific screens
3. **Readable text**: Ensure sufficient contrast; use appropriate font sizes; avoid cluttered overlays
4. **Smooth transitions**: Use spring animations for natural motion; avoid jarring cuts
5. **Preview thoroughly**: Always preview in Remotion Studio before final render
6. **Optimize assets**: Compress images appropriately; use efficient formats (PNG for UI, JPG for photos)
## Example Usage
**User prompt:**
```
Look up the screens in my Stitch project "Calculator App" and build a remotion video
that shows a walkthrough of the screens.
```
**Agent workflow:**
1. List Stitch projects → Find "Calculator App" → Extract project ID
2. List screens in project → Identify all screens (Home, History, Settings)
3. Download screenshots for each screen → Save to `assets/screens/`
4. Create `screens.json` manifest with screen metadata
5. Generate Remotion components (`ScreenSlide.tsx`, `WalkthroughComposition.tsx`)
6. Preview in Remotion Studio → Refine timing and transitions
7. Render final video → `calculator-walkthrough.mp4`
8. Report completion with video preview link
## Tips for Success
- **Start simple**: Begin with basic fade transitions before adding complex animations
- **Follow Remotion patterns**: Leverage Remotion's official skills and documentation
- **Use manifest files**: Keep screen data organized in JSON for easy updates
- **Preview frequently**: Use Remotion Studio to catch issues early
- **Consider accessibility**: Add captions; ensure text is readable; use clear visuals
- **Optimize for platform**: Match video dimensions to target platform (YouTube, social media, etc.)
## References
- **Stitch Documentation**: https://stitch.withgoogle.com/docs/
- **Remotion Documentation**: https://www.remotion.dev/docs/
- **Remotion Skills**: https://www.remotion.dev/docs/ai/skills
- **Remotion MCP**: https://www.remotion.dev/docs/ai/mcp
- **Remotion Transitions**: https://www.remotion.dev/docs/transitions

View File

@@ -0,0 +1,78 @@
import {Composition} from 'remotion';
import {Sequence} from 'remotion';
import {fade} from '@remotion/transitions/fade';
import {slide} from '@remotion/transitions/slide';
import {TransitionSeries} from '@remotion/transitions';
import {ScreenSlide} from './ScreenSlide';
import screensManifest from '../screens.json';
// Calculate total duration in frames
const calculateDuration = () => {
const totalSeconds = screensManifest.screens.reduce(
(sum, screen) => sum + screen.duration,
0
);
return totalSeconds * screensManifest.videoConfig.fps;
};
export const WalkthroughComposition: React.FC = () => {
const {fps, width, height} = screensManifest.videoConfig;
return (
<TransitionSeries>
{screensManifest.screens.map((screen, index) => {
const durationInFrames = screen.duration * fps;
// Select transition based on screen config
const transition =
screen.transitionType === 'slide'
? slide()
: screen.transitionType === 'zoom'
? fade() // Can customize with zoom effect
: fade();
return (
<TransitionSeries.Sequence
key={screen.id}
durationInFrames={durationInFrames}
>
<ScreenSlide
imageSrc={screen.imagePath}
title={screen.title}
description={screen.description}
width={screen.width}
height={screen.height}
/>
{index < screensManifest.screens.length - 1 && (
<TransitionSeries.Transition
presentation={transition}
timing={{
durationInFrames: 20, // 20 frames for transition
}}
/>
)}
</TransitionSeries.Sequence>
);
})}
</TransitionSeries>
);
};
// Register composition
export const RemotionRoot: React.FC = () => {
const {fps, width, height} = screensManifest.videoConfig;
const durationInFrames = calculateDuration();
return (
<>
<Composition
id="WalkthroughComposition"
component={WalkthroughComposition}
durationInFrames={durationInFrames}
fps={fps}
width={width}
height={height}
/>
</>
);
};

View File

@@ -0,0 +1,56 @@
{
"projectName": "Calculator App",
"projectId": "projects/13534454087919359824",
"videoConfig": {
"fps": 30,
"width": 1920,
"height": 1080,
"durationInSeconds": 20
},
"screens": [
{
"id": "1",
"screenId": "12345",
"title": "Home Screen",
"description": "Main calculator interface with number pad and basic operations",
"imagePath": "assets/screens/home.png",
"width": 1200,
"height": 800,
"duration": 5,
"transitionType": "fade"
},
{
"id": "2",
"screenId": "12346",
"title": "History View",
"description": "View of previous calculations with option to reuse results",
"imagePath": "assets/screens/history.png",
"width": 1200,
"height": 800,
"duration": 4,
"transitionType": "slide"
},
{
"id": "3",
"screenId": "12347",
"title": "Settings Panel",
"description": "Customize calculator behavior and appearance",
"imagePath": "assets/screens/settings.png",
"width": 1200,
"height": 800,
"duration": 4,
"transitionType": "fade"
},
{
"id": "4",
"screenId": "12348",
"title": "Scientific Mode",
"description": "Advanced mathematical functions and operations",
"imagePath": "assets/screens/scientific.png",
"width": 1200,
"height": 800,
"duration": 5,
"transitionType": "zoom"
}
]
}

View File

@@ -0,0 +1,124 @@
# Remotion Composition Checklist
Use this checklist to ensure your Remotion walkthrough video composition is complete and follows best practices.
## ✅ Project Setup
- [ ] Remotion project initialized (or existing project verified)
- [ ] Dependencies installed (`@remotion/transitions`, etc.)
- [ ] Asset directory created (`public/assets/screens/`)
- [ ] Screen manifest created (`screens.json`)
## ✅ Asset Preparation
- [ ] All Stitch screenshots downloaded
- [ ] Images saved with descriptive names
- [ ] Image dimensions recorded in manifest
- [ ] Images optimized for size (if needed)
- [ ] Asset paths are correct and relative to `public/`
## ✅ Component Structure
- [ ] `ScreenSlide.tsx` component created
- [ ] Props interface defined
- [ ] Zoom animation implemented
- [ ] Fade animation implemented
- [ ] Text overlay included
- [ ] `WalkthroughComposition.tsx` created
- [ ] Screen manifest imported
- [ ] `<Sequence>` components for each screen
- [ ] Transitions between screens configured
- [ ] Proper timing offsets calculated
## ✅ Configuration
- [ ] `remotion.config.ts` updated
- [ ] Composition ID set
- [ ] Video dimensions configured
- [ ] Frame rate set (30 or 60 fps)
- [ ] Duration calculated correctly
- [ ] Video metadata set (if applicable)
- [ ] Title
- [ ] Description
## ✅ Animations & Transitions
- [ ] Spring animations use appropriate configs
- [ ] Damping values (8-15 typical)
- [ ] Stiffness values (60-100 typical)
- [ ] Transitions feel smooth
- [ ] Text overlays timed correctly
- [ ] No jarring or abrupt changes
## ✅ Visual Quality
- [ ] Text is readable at all times
- [ ] Sufficient contrast between text and background
- [ ] Font sizes appropriate for video resolution
- [ ] Images display without distortion
- [ ] Aspect ratios maintained
## ✅ Timing
- [ ] Each screen displays for appropriate duration
- [ ] Total video length is reasonable (not too long/short)
- [ ] Transitions don't feel rushed
- [ ] Text has time to be read
## ✅ Preview & Testing
- [ ] Preview in Remotion Studio (`npm run dev`)
- [ ] Scrub through timeline to check all frames
- [ ] Verify smooth playback
- [ ] Check for any rendering errors
- [ ] Test on different screen sizes (if responsive)
## ✅ Rendering
- [ ] Render command tested and works
- [ ] Output format chosen (MP4, WebM, etc.)
- [ ] Quality settings configured
- [ ] Codec specified (h264 recommended)
- [ ] Final video renders without errors
## ✅ Final Output
- [ ] Video file generated successfully
- [ ] File size is reasonable
- [ ] Video plays correctly in media players
- [ ] Audio included (if applicable)
- [ ] Metadata embedded (if needed)
## 🎨 Optional Enhancements
- [ ] Progress indicator showing current screen
- [ ] Custom logo or branding
- [ ] Background music or sound effects
- [ ] Voiceover narration
- [ ] Interactive hotspots highlighting features
- [ ] Call-to-action at end
## 📋 Best Practices Verified
- [ ] Component code is modular and reusable
- [ ] TypeScript interfaces used for props
- [ ] No hardcoded values (use manifest/config)
- [ ] Code follows Remotion conventions
- [ ] Comments added for complex logic
- [ ] Assets organized in clear folder structure
## 🐛 Common Issues Checked
- [ ] No blurry images (check source resolution)
- [ ] No misaligned text (verify positioning)
- [ ] No choppy animations (check spring configs)
- [ ] No missing assets (verify all paths)
- [ ] No build errors (run `npm run build` test)
---
**Notes:**
- Mark items with `[x]` as you complete them
- Add custom checklist items specific to your project
- Review Remotion documentation for updates
- Test final video on target platform (YouTube, social, etc.)

View File

@@ -0,0 +1,123 @@
import {AbsoluteFill, spring, useCurrentFrame, useVideoConfig} from 'remotion';
import {Img} from 'remotion';
interface ScreenSlideProps {
imageSrc: string;
title: string;
description?: string;
width: number;
height: number;
}
export const ScreenSlide: React.FC<ScreenSlideProps> = ({
imageSrc,
title,
description,
width,
height,
}) => {
const frame = useCurrentFrame();
const {fps} = useVideoConfig();
// Zoom in animation
const zoom = spring({
frame,
fps,
from: 0.95,
to: 1,
config: {
damping: 12,
stiffness: 80,
},
});
// Fade in animation
const opacity = spring({
frame,
fps,
from: 0,
to: 1,
config: {
damping: 10,
},
});
// Text overlay fade in (delayed)
const textOpacity = spring({
frame: frame - 15, // Delay by 15 frames
fps,
from: 0,
to: 1,
config: {
damping: 10,
},
});
return (
<AbsoluteFill
style={{
backgroundColor: '#000',
justifyContent: 'center',
alignItems: 'center',
}}
>
{/* Screen Image */}
<div
style={{
transform: `scale(${zoom})`,
opacity,
maxWidth: '90%',
maxHeight: '80%',
position: 'relative',
}}
>
<Img
src={imageSrc}
style={{
width: '100%',
height: 'auto',
borderRadius: '8px',
boxShadow: '0 20px 60px rgba(0, 0, 0, 0.3)',
}}
/>
</div>
{/* Text Overlay */}
<div
style={{
position: 'absolute',
bottom: '10%',
left: '50%',
transform: 'translateX(-50%)',
textAlign: 'center',
opacity: textOpacity,
width: '80%',
}}
>
<h1
style={{
fontSize: '48px',
fontWeight: 'bold',
color: '#fff',
margin: '0 0 12px 0',
textShadow: '0 2px 10px rgba(0, 0, 0, 0.5)',
}}
>
{title}
</h1>
{description && (
<p
style={{
fontSize: '24px',
color: '#ddd',
margin: 0,
textShadow: '0 1px 5px rgba(0, 0, 0, 0.5)',
}}
>
{description}
</p>
)}
</div>
</AbsoluteFill>
);
};

View File

@@ -0,0 +1,38 @@
#!/bin/bash
# Download Stitch screen asset with proper handling of Google Cloud Storage URLs
# Usage: ./download-stitch-asset.sh "https://storage.googleapis.com/..." "output-path.png"
set -e
if [ $# -ne 2 ]; then
echo "Usage: $0 <download_url> <output_path>"
echo "Example: $0 'https://storage.googleapis.com/stitch/screenshot.png' 'assets/screen.png'"
exit 1
fi
DOWNLOAD_URL="$1"
OUTPUT_PATH="$2"
# Create directory if it doesn't exist
OUTPUT_DIR=$(dirname "$OUTPUT_PATH")
mkdir -p "$OUTPUT_DIR"
echo "Downloading from: $DOWNLOAD_URL"
echo "Saving to: $OUTPUT_PATH"
# Use curl with follow redirects; -f fails on HTTP errors so an error
# response (e.g. an expired signed URL) is not saved as the asset
if curl -L -f -o "$OUTPUT_PATH" "$DOWNLOAD_URL"; then
echo "✓ Successfully downloaded to $OUTPUT_PATH"
# Display file size for verification
if command -v stat &> /dev/null; then
FILE_SIZE=$(stat -f%z "$OUTPUT_PATH" 2>/dev/null || stat -c%s "$OUTPUT_PATH" 2>/dev/null)
echo " File size: $FILE_SIZE bytes"
fi
else
echo "✗ Download failed"
rm -f "$OUTPUT_PATH"
exit 1
fi