bps-kit 1.0.19 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +156 -28
- package/package.json +2 -2
- package/templates/VAULT_INDEX.md +5 -4
- package/templates/agents-template/agents/frontend-specialist.md +1 -1
- package/templates/agents-template/agents/site-builder.md +177 -0
- package/templates/agents-template/rules/GEMINI.md +22 -2
- package/templates/agents-template/workflows/build-site.md +122 -0
- package/templates/agents-template/workflows/recall.md +34 -0
- package/templates/skills_extra/stitch-loop/README.md +54 -0
- package/templates/skills_extra/stitch-loop/SKILL.md +263 -0
- package/templates/skills_extra/stitch-loop/examples/SITE.md +73 -0
- package/templates/skills_extra/stitch-loop/examples/next-prompt.md +25 -0
- package/templates/skills_extra/stitch-loop/resources/baton-schema.md +61 -0
- package/templates/skills_extra/stitch-loop/resources/site-template.md +104 -0
- package/templates/skills_normal/design-md/README.md +34 -0
- package/templates/skills_normal/design-md/SKILL.md +172 -0
- package/templates/skills_normal/design-md/examples/DESIGN.md +154 -0
- package/templates/skills_normal/enhance-prompt/README.md +34 -0
- package/templates/skills_normal/enhance-prompt/SKILL.md +204 -0
- package/templates/skills_normal/enhance-prompt/references/KEYWORDS.md +114 -0
- package/templates/skills_normal/react-components/README.md +36 -0
- package/templates/skills_normal/react-components/SKILL.md +47 -0
- package/templates/skills_normal/react-components/examples/gold-standard-card.tsx +80 -0
- package/templates/skills_normal/react-components/package-lock.json +231 -0
- package/templates/skills_normal/react-components/package.json +16 -0
- package/templates/skills_normal/react-components/resources/architecture-checklist.md +15 -0
- package/templates/skills_normal/react-components/resources/component-template.tsx +37 -0
- package/templates/skills_normal/react-components/resources/stitch-api-reference.md +14 -0
- package/templates/skills_normal/react-components/resources/style-guide.json +27 -0
- package/templates/skills_normal/react-components/scripts/fetch-stitch.sh +30 -0
- package/templates/skills_normal/react-components/scripts/validate.js +70 -0
- package/templates/vault/remotion/README.md +105 -0
- package/templates/vault/remotion/examples/WalkthroughComposition.tsx +78 -0
- package/templates/vault/remotion/examples/screens.json +56 -0
- package/templates/vault/remotion/resources/composition-checklist.md +124 -0
- package/templates/vault/remotion/resources/screen-slide-template.tsx +123 -0
- package/templates/vault/remotion/scripts/download-stitch-asset.sh +38 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: enhance-prompt
|
|
3
|
+
description: Transforms vague UI ideas into polished, Stitch-optimized prompts. Enhances specificity, adds UI/UX keywords, injects design system context, and structures output for better generation results.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- "Read"
|
|
6
|
+
- "Write"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Enhance Prompt for Stitch
|
|
10
|
+
|
|
11
|
+
You are a **Stitch Prompt Engineer**. Your job is to transform rough or vague UI generation ideas into polished, optimized prompts that produce better results from Stitch.
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
Before enhancing prompts, consult the official Stitch documentation for the latest best practices:
|
|
16
|
+
|
|
17
|
+
- **Stitch Effective Prompting Guide**: https://stitch.withgoogle.com/docs/learn/prompting/
|
|
18
|
+
|
|
19
|
+
This guide contains up-to-date recommendations that may supersede or complement the patterns in this skill.
|
|
20
|
+
|
|
21
|
+
## When to Use This Skill
|
|
22
|
+
|
|
23
|
+
Activate when a user wants to:
|
|
24
|
+
- Polish a UI prompt before sending to Stitch
|
|
25
|
+
- Improve a prompt that produced poor results
|
|
26
|
+
- Add design system consistency to a simple idea
|
|
27
|
+
- Structure a vague concept into an actionable prompt
|
|
28
|
+
|
|
29
|
+
## Enhancement Pipeline
|
|
30
|
+
|
|
31
|
+
Follow these steps to enhance any prompt:
|
|
32
|
+
|
|
33
|
+
### Step 1: Assess the Input
|
|
34
|
+
|
|
35
|
+
Evaluate what's missing from the user's prompt:
|
|
36
|
+
|
|
37
|
+
| Element | Check for | If missing... |
|
|
38
|
+
|---------|-----------|---------------|
|
|
39
|
+
| **Platform** | "web", "mobile", "desktop" | Add based on context or ask |
|
|
40
|
+
| **Page type** | "landing page", "dashboard", "form" | Infer from description |
|
|
41
|
+
| **Structure** | Numbered sections/components | Create logical page structure |
|
|
42
|
+
| **Visual style** | Adjectives, mood, vibe | Add appropriate descriptors |
|
|
43
|
+
| **Colors** | Specific values or roles | Add design system or suggest |
|
|
44
|
+
| **Components** | UI-specific terms | Translate to proper keywords |
|
|
45
|
+
|
|
46
|
+
### Step 2: Check for DESIGN.md
|
|
47
|
+
|
|
48
|
+
Look for a `DESIGN.md` file in the current project:
|
|
49
|
+
|
|
50
|
+
**If DESIGN.md exists:**
|
|
51
|
+
1. Read the file to extract the design system block
|
|
52
|
+
2. Include the color palette, typography, and component styles
|
|
53
|
+
3. Format as a "DESIGN SYSTEM (REQUIRED)" section in the output
|
|
54
|
+
|
|
55
|
+
**If DESIGN.md does not exist:**
|
|
56
|
+
1. Add this note at the end of the enhanced prompt:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
---
|
|
60
|
+
💡 **Tip:** For consistent designs across multiple screens, create a DESIGN.md
|
|
61
|
+
file using the `design-md` skill. This ensures all generated pages share the
|
|
62
|
+
same visual language.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Step 3: Apply Enhancements
|
|
66
|
+
|
|
67
|
+
Transform the input using these techniques:
|
|
68
|
+
|
|
69
|
+
#### A. Add UI/UX Keywords
|
|
70
|
+
|
|
71
|
+
Replace vague terms with specific component names:
|
|
72
|
+
|
|
73
|
+
| Vague | Enhanced |
|
|
74
|
+
|-------|----------|
|
|
75
|
+
| "menu at the top" | "navigation bar with logo and menu items" |
|
|
76
|
+
| "button" | "primary call-to-action button" |
|
|
77
|
+
| "list of items" | "card grid layout" or "vertical list with thumbnails" |
|
|
78
|
+
| "form" | "form with labeled input fields and submit button" |
|
|
79
|
+
| "picture area" | "hero section with full-width image" |
|
|
80
|
+
|
|
81
|
+
#### B. Amplify the Vibe
|
|
82
|
+
|
|
83
|
+
Add descriptive adjectives to set the mood:
|
|
84
|
+
|
|
85
|
+
| Basic | Enhanced |
|
|
86
|
+
|-------|----------|
|
|
87
|
+
| "modern" | "clean, minimal, with generous whitespace" |
|
|
88
|
+
| "professional" | "sophisticated, trustworthy, with subtle shadows" |
|
|
89
|
+
| "fun" | "vibrant, playful, with rounded corners and bold colors" |
|
|
90
|
+
| "dark mode" | "dark theme with high-contrast accents on deep backgrounds" |
|
|
91
|
+
|
|
92
|
+
#### C. Structure the Page
|
|
93
|
+
|
|
94
|
+
Organize content into numbered sections:
|
|
95
|
+
|
|
96
|
+
```markdown
|
|
97
|
+
**Page Structure:**
|
|
98
|
+
1. **Header:** Navigation with logo and menu items
|
|
99
|
+
2. **Hero Section:** Headline, subtext, and primary CTA
|
|
100
|
+
3. **Content Area:** [Describe the main content]
|
|
101
|
+
4. **Footer:** Links, social icons, copyright
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### D. Format Colors Properly
|
|
105
|
+
|
|
106
|
+
When colors are mentioned, format them as:
|
|
107
|
+
```
|
|
108
|
+
Descriptive Name (#hexcode) for functional role
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Examples:
|
|
112
|
+
- "Deep Ocean Blue (#1a365d) for primary buttons and links"
|
|
113
|
+
- "Warm Cream (#faf5f0) for page background"
|
|
114
|
+
- "Soft Gray (#6b7280) for secondary text"
|
|
115
|
+
|
|
116
|
+
### Step 4: Format the Output
|
|
117
|
+
|
|
118
|
+
Structure the enhanced prompt in this order:
|
|
119
|
+
|
|
120
|
+
```markdown
|
|
121
|
+
[One-line description of the page purpose and vibe]
|
|
122
|
+
|
|
123
|
+
**DESIGN SYSTEM (REQUIRED):**
|
|
124
|
+
- Platform: [Web/Mobile], [Desktop/Mobile]-first
|
|
125
|
+
- Theme: [Light/Dark], [style descriptors]
|
|
126
|
+
- Background: [Color description] (#hex)
|
|
127
|
+
- Primary Accent: [Color description] (#hex) for [role]
|
|
128
|
+
- Text Primary: [Color description] (#hex)
|
|
129
|
+
- [Additional design tokens...]
|
|
130
|
+
|
|
131
|
+
**Page Structure:**
|
|
132
|
+
1. **[Section]:** [Description]
|
|
133
|
+
2. **[Section]:** [Description]
|
|
134
|
+
...
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Output Options
|
|
138
|
+
|
|
139
|
+
**Default:** Return the enhanced prompt as text for the user to copy.
|
|
140
|
+
|
|
141
|
+
**Optional file output:** If the user requests, write to a file:
|
|
142
|
+
- `next-prompt.md` — for use with the `stitch-loop` skill
|
|
143
|
+
- Custom filename specified by user
|
|
144
|
+
|
|
145
|
+
## Examples
|
|
146
|
+
|
|
147
|
+
### Example 1: Vague Input → Structured Prompt
|
|
148
|
+
|
|
149
|
+
**User input:**
|
|
150
|
+
> "make me a login page"
|
|
151
|
+
|
|
152
|
+
**Enhanced output:**
|
|
153
|
+
```markdown
|
|
154
|
+
A clean, trustworthy login page with a centered form and subtle branding.
|
|
155
|
+
|
|
156
|
+
**DESIGN SYSTEM (REQUIRED):**
|
|
157
|
+
- Platform: Web, Desktop-first
|
|
158
|
+
- Theme: Light, minimal, professional
|
|
159
|
+
- Background: Clean White (#ffffff)
|
|
160
|
+
- Surface: Soft Gray (#f9fafb) for form card
|
|
161
|
+
- Primary Accent: Deep Blue (#2563eb) for submit button and links
|
|
162
|
+
- Text Primary: Near Black (#111827) for headings
|
|
163
|
+
- Text Secondary: Medium Gray (#6b7280) for labels
|
|
164
|
+
- Buttons: Subtly rounded (8px), full-width on form
|
|
165
|
+
- Cards: Gently rounded (12px), soft shadow for elevation
|
|
166
|
+
|
|
167
|
+
**Page Structure:**
|
|
168
|
+
1. **Header:** Minimal logo, centered
|
|
169
|
+
2. **Login Card:** Centered form with email, password fields, "Forgot password?" link
|
|
170
|
+
3. **Submit Button:** Primary blue "Sign In" button
|
|
171
|
+
4. **Footer:** "Don't have an account? Sign up" link
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
💡 **Tip:** For consistent designs across multiple screens, create a DESIGN.md
|
|
175
|
+
file using the `design-md` skill.
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Example 2: Feature Request → Targeted Edit
|
|
179
|
+
|
|
180
|
+
**User input:**
|
|
181
|
+
> "add a search bar"
|
|
182
|
+
|
|
183
|
+
**Enhanced output:**
|
|
184
|
+
```markdown
|
|
185
|
+
Add a search bar to the header navigation.
|
|
186
|
+
|
|
187
|
+
**Specific changes:**
|
|
188
|
+
- Location: Header, right side before user avatar
|
|
189
|
+
- Style: Pill-shaped input with subtle gray background (#f3f4f6)
|
|
190
|
+
- Icon: Magnifying glass icon on the left, inside the input
|
|
191
|
+
- Placeholder: "Search..." in light gray (#9ca3af)
|
|
192
|
+
- Behavior: Expands on focus with subtle shadow
|
|
193
|
+
- Width: 240px default, 320px on focus
|
|
194
|
+
|
|
195
|
+
**Context:** This is a targeted edit. Make only this change while preserving all existing elements.
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Tips for Best Results
|
|
199
|
+
|
|
200
|
+
1. **Be specific early** — Vague inputs need more enhancement
|
|
201
|
+
2. **Match the user's intent** — Don't over-design if they want simple
|
|
202
|
+
3. **Keep it structured** — Numbered sections help Stitch understand hierarchy
|
|
203
|
+
4. **Include the design system** — Consistency is key for multi-page projects
|
|
204
|
+
5. **One change at a time for edits** — Don't bundle unrelated changes
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# UI/UX Keywords Reference
|
|
2
|
+
|
|
3
|
+
Progressive disclosure reference for common UI terminology and adjective palettes.
|
|
4
|
+
|
|
5
|
+
## Component Keywords
|
|
6
|
+
|
|
7
|
+
### Navigation
|
|
8
|
+
- navigation bar, nav menu, header
|
|
9
|
+
- breadcrumbs, tabs, sidebar
|
|
10
|
+
- hamburger menu, dropdown menu
|
|
11
|
+
- back button, close button
|
|
12
|
+
|
|
13
|
+
### Content Containers
|
|
14
|
+
- hero section, hero banner
|
|
15
|
+
- card, card grid, tile
|
|
16
|
+
- modal, dialog, popup
|
|
17
|
+
- accordion, collapsible section
|
|
18
|
+
- carousel, slider
|
|
19
|
+
|
|
20
|
+
### Forms
|
|
21
|
+
- input field, text input
|
|
22
|
+
- dropdown, select menu
|
|
23
|
+
- checkbox, radio button
|
|
24
|
+
- toggle switch
|
|
25
|
+
- date picker, time picker
|
|
26
|
+
- search bar, search input
|
|
27
|
+
- submit button, form actions
|
|
28
|
+
|
|
29
|
+
### Calls to Action
|
|
30
|
+
- primary button, secondary button
|
|
31
|
+
- ghost button, text link
|
|
32
|
+
- floating action button (FAB)
|
|
33
|
+
- icon button
|
|
34
|
+
|
|
35
|
+
### Feedback
|
|
36
|
+
- toast notification, snackbar
|
|
37
|
+
- alert banner, warning message
|
|
38
|
+
- loading spinner, skeleton loader
|
|
39
|
+
- progress bar, step indicator
|
|
40
|
+
|
|
41
|
+
### Layout
|
|
42
|
+
- grid layout, flexbox
|
|
43
|
+
- sidebar layout, split view
|
|
44
|
+
- sticky header, fixed footer
|
|
45
|
+
- full-width, contained width
|
|
46
|
+
- centered content, max-width container
|
|
47
|
+
|
|
48
|
+
## Adjective Palettes
|
|
49
|
+
|
|
50
|
+
### Minimal / Clean
|
|
51
|
+
- minimal, clean, uncluttered
|
|
52
|
+
- generous whitespace, breathing room
|
|
53
|
+
- subtle, understated, refined
|
|
54
|
+
- simple, focused, distraction-free
|
|
55
|
+
|
|
56
|
+
### Professional / Corporate
|
|
57
|
+
- sophisticated, polished, trustworthy
|
|
58
|
+
- corporate, business-like, formal
|
|
59
|
+
- subtle shadows, clean lines
|
|
60
|
+
- structured, organized, hierarchical
|
|
61
|
+
|
|
62
|
+
### Playful / Fun
|
|
63
|
+
- vibrant, colorful, energetic
|
|
64
|
+
- rounded corners, soft edges
|
|
65
|
+
- bold, expressive, dynamic
|
|
66
|
+
- friendly, approachable, warm
|
|
67
|
+
|
|
68
|
+
### Premium / Luxury
|
|
69
|
+
- elegant, luxurious, high-end
|
|
70
|
+
- dramatic, bold contrasts
|
|
71
|
+
- sleek, modern, cutting-edge
|
|
72
|
+
- exclusive, boutique, curated
|
|
73
|
+
|
|
74
|
+
### Dark Mode
|
|
75
|
+
- dark theme, night mode
|
|
76
|
+
- high-contrast accents
|
|
77
|
+
- soft glows, subtle highlights
|
|
78
|
+
- deep backgrounds, muted surfaces
|
|
79
|
+
|
|
80
|
+
### Organic / Natural
|
|
81
|
+
- earthy tones, natural colors
|
|
82
|
+
- warm, inviting, cozy
|
|
83
|
+
- textured, tactile, handcrafted
|
|
84
|
+
- flowing, organic shapes
|
|
85
|
+
|
|
86
|
+
## Color Role Terminology
|
|
87
|
+
|
|
88
|
+
### Backgrounds
|
|
89
|
+
- page background, canvas
|
|
90
|
+
- surface color, card background
|
|
91
|
+
- overlay, scrim
|
|
92
|
+
|
|
93
|
+
### Text
|
|
94
|
+
- primary text, heading color
|
|
95
|
+
- secondary text, body copy
|
|
96
|
+
- muted text, placeholder
|
|
97
|
+
- inverse text (on dark backgrounds)
|
|
98
|
+
|
|
99
|
+
### Accents
|
|
100
|
+
- primary accent, brand color
|
|
101
|
+
- secondary accent, highlight
|
|
102
|
+
- success, error, warning colors
|
|
103
|
+
- hover state, active state
|
|
104
|
+
|
|
105
|
+
## Shape Descriptions
|
|
106
|
+
|
|
107
|
+
| Technical | Natural Language |
|
|
108
|
+
|-----------|------------------|
|
|
109
|
+
| `rounded-none` | sharp, squared-off edges |
|
|
110
|
+
| `rounded-sm` | slightly softened corners |
|
|
111
|
+
| `rounded-md` | gently rounded corners |
|
|
112
|
+
| `rounded-lg` | generously rounded corners |
|
|
113
|
+
| `rounded-xl` | very rounded, pillow-like |
|
|
114
|
+
| `rounded-full` | pill-shaped, circular |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Stitch to React Components Skill
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx skills add google-labs-code/stitch-skills --skill react:components --global
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Example Prompt
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Convert my Landing Page screen in my Podcast Stitch Project to a React component system.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Skill Structure
|
|
16
|
+
|
|
17
|
+
This repository follows the **Agent Skills** open standard. Each skill is self-contained with its own logic, validation scripts, and design tokens.
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
skills/react-components/
|
|
21
|
+
├── SKILL.md — Core instructions & workflow
|
|
22
|
+
├── package.json — Validator dependencies
|
|
23
|
+
├── scripts/ — Networking & AST validation
|
|
24
|
+
├── resources/ — Style guides & API references
|
|
25
|
+
└── examples/ — Gold-standard code samples
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## How it Works
|
|
29
|
+
|
|
30
|
+
When activated, the agent follows a high-fidelity engineering pipeline:
|
|
31
|
+
|
|
32
|
+
1. **Retrieval**: Uses a system-level `curl` script to bypass TLS/SNI issues on Google Cloud Storage.
|
|
33
|
+
2. **Mapping**: Cross-references Stitch metadata with the local `style-guide.json` to ensure token consistency.
|
|
34
|
+
3. **Generation**: Scaffolds components using a strict Atomic Design pattern.
|
|
35
|
+
4. **Validation**: Runs an automated AST check using `@swc/core` to prevent hardcoded hex values or missing interfaces.
|
|
36
|
+
5. **Audit**: Performs a final self-correction check against a 20-point architecture checklist.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react:components
|
|
3
|
+
description: Converts Stitch designs into modular Vite and React components using system-level networking and AST-based validation.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- "stitch*:*"
|
|
6
|
+
- "Bash"
|
|
7
|
+
- "Read"
|
|
8
|
+
- "Write"
|
|
9
|
+
- "web_fetch"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Stitch to React Components
|
|
13
|
+
|
|
14
|
+
You are a frontend engineer focused on transforming designs into clean React code. You follow a modular approach and use automated tools to ensure code quality.
|
|
15
|
+
|
|
16
|
+
## Retrieval and networking
|
|
17
|
+
1. **Namespace discovery**: Run `list_tools` to find the Stitch MCP prefix. Use this prefix (e.g., `stitch:`) for all subsequent calls.
|
|
18
|
+
2. **Metadata fetch**: Call `[prefix]:get_screen` to retrieve the design JSON.
|
|
19
|
+
3. **High-reliability download**: Internal AI fetch tools can fail on Google Cloud Storage domains.
|
|
20
|
+
- Use the `Bash` tool to run: `bash scripts/fetch-stitch.sh "[htmlCode.downloadUrl]" "temp/source.html"`.
|
|
21
|
+
- This script handles the necessary redirects and security handshakes.
|
|
22
|
+
4. **Visual audit**: Check `screenshot.downloadUrl` to confirm the design intent and layout details.
|
|
23
|
+
|
|
24
|
+
## Architectural rules
|
|
25
|
+
* **Modular components**: Break the design into independent files. Avoid large, single-file outputs.
|
|
26
|
+
* **Logic isolation**: Move event handlers and business logic into custom hooks in `src/hooks/`.
|
|
27
|
+
* **Data decoupling**: Move all static text, image URLs, and lists into `src/data/mockData.ts`.
|
|
28
|
+
* **Type safety**: Every component must include a `Readonly` TypeScript interface named `[ComponentName]Props`.
|
|
29
|
+
* **Project specific**: Focus on the target project's needs and constraints. Leave Google license headers out of the generated React components.
|
|
30
|
+
* **Style mapping**:
|
|
31
|
+
* Extract the `tailwind.config` from the HTML `<head>`.
|
|
32
|
+
* Sync these values with `resources/style-guide.json`.
|
|
33
|
+
* Use theme-mapped Tailwind classes instead of arbitrary hex codes.
|
|
34
|
+
|
|
35
|
+
## Execution steps
|
|
36
|
+
1. **Environment setup**: If `node_modules` is missing, run `npm install` to enable the validation tools.
|
|
37
|
+
2. **Data layer**: Create `src/data/mockData.ts` based on the design content.
|
|
38
|
+
3. **Component drafting**: Use `resources/component-template.tsx` as a base. Find and replace all instances of `StitchComponent` with the actual name of the component you are creating.
|
|
39
|
+
4. **Application wiring**: Update the project entry point (like `App.tsx`) to render the new components.
|
|
40
|
+
5. **Quality check**:
|
|
41
|
+
* Run `npm run validate <file_path>` for each component.
|
|
42
|
+
* Verify the final output against the `resources/architecture-checklist.md`.
|
|
43
|
+
* Start the dev server with `npm run dev` to verify the live result.
|
|
44
|
+
|
|
45
|
+
## Troubleshooting
|
|
46
|
+
* **Fetch errors**: Ensure the URL is quoted in the bash command to prevent shell errors.
|
|
47
|
+
* **Validation errors**: Review the AST report and fix any missing interfaces or hardcoded styles.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import React from 'react';
|
|
18
|
+
// Note for Agent: The '@' alias refers to the target project's src directory.
|
|
19
|
+
// Ensure src/data/mockData.ts is created before generating this component.
|
|
20
|
+
import { cardData } from '../data/mockData';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Gold Standard: ActivityCard
|
|
24
|
+
* This file serves as the definitive reference for the agent.
|
|
25
|
+
*/
|
|
26
|
+
interface ActivityCardProps {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly username: string;
|
|
29
|
+
readonly action: 'MERGED' | 'COMMIT';
|
|
30
|
+
readonly timestamp: string;
|
|
31
|
+
readonly avatarUrl: string;
|
|
32
|
+
readonly repoName: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const ActivityCard: React.FC<ActivityCardProps> = ({
|
|
36
|
+
username,
|
|
37
|
+
action,
|
|
38
|
+
timestamp,
|
|
39
|
+
avatarUrl,
|
|
40
|
+
repoName,
|
|
41
|
+
}) => {
|
|
42
|
+
const isMerged = action === 'MERGED';
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<div className="flex items-center justify-between gap-4 rounded-lg bg-surface-dark p-4 min-h-14 shadow-sm ring-1 ring-white/10">
|
|
46
|
+
<div className="flex items-center gap-4 overflow-hidden">
|
|
47
|
+
<div
|
|
48
|
+
className="aspect-square h-10 w-10 flex-shrink-0 rounded-full bg-cover bg-center bg-no-repeat"
|
|
49
|
+
style={{ backgroundImage: `url(${avatarUrl})` }}
|
|
50
|
+
aria-label={`Avatar for ${username}`}
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
<div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-sm sm:text-base">
|
|
54
|
+
<a href="#" className="font-semibold text-primary hover:underline truncate">
|
|
55
|
+
{username}
|
|
56
|
+
</a>
|
|
57
|
+
|
|
58
|
+
<span className={`inline-block px-2 py-0.5 text-xs font-semibold rounded-full ${isMerged ? 'bg-purple-500/30 text-purple-300' : 'bg-primary/30 text-primary'
|
|
59
|
+
}`}>
|
|
60
|
+
{action}
|
|
61
|
+
</span>
|
|
62
|
+
|
|
63
|
+
<span className="text-white/60">in</span>
|
|
64
|
+
|
|
65
|
+
<a href="#" className="text-primary hover:underline truncate">
|
|
66
|
+
{repoName}
|
|
67
|
+
</a>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div className="shrink-0">
|
|
72
|
+
<p className="text-sm font-normal leading-normal text-white/50">
|
|
73
|
+
{timestamp}
|
|
74
|
+
</p>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default ActivityCard;
|