|
208 | 208 | var name = getProjectName(); |
209 | 209 |
|
210 | 210 | var skillRef = 'Read skills/figma.md for Figma-to-Reactor control mapping, theme tokens, typography, and layout rules. Read skills/design.md for WinUI design best practices. Match every dimension, gap, and padding value exactly from the Figma design for pixel-accurate output.'; |
211 | | - var watchSuffix = ' Then start watching for Figma changes: run mur figma watch "' + url + '" --interval 10 in the background. When a change is detected, re-fetch the design via get_figma_data and update the code accordingly.'; |
| 211 | + var watchCmd = 'dotnet run --project src/Reactor.Cli -- figma watch "' + url + '" --interval 10'; |
| 212 | + var watchLoop = ' After the initial sync, start a live watch loop: run `' + watchCmd + |
| 213 | + '` in a background shell. It emits JSON events to stdout when the Figma file changes.' + |
| 214 | + ' When you see an event with "event":"changed", re-fetch the design via get_figma_data MCP tool for file key ' + (frameInfo.fileKey || '') + ' node ' + (frameInfo.nodeId || '') + |
| 215 | + ', diff it against the current code, and apply only the changes needed.' + |
| 216 | + ' Keep this loop running — do NOT exit after the first sync. You are a live sync agent.'; |
212 | 217 |
|
213 | 218 | var prompt; |
214 | 219 | if (isNewProject()) { |
|
217 | 222 | ', then translate this Figma design into it: ' + url + |
218 | 223 | '. ' + skillRef + |
219 | 224 | ' After generating the code, run: dotnet watch run --project ' + csproj + '.' + |
220 | | - watchSuffix; |
| 225 | + watchLoop; |
221 | 226 | } else { |
222 | 227 | if (!csproj) { |
223 | 228 | showToast('Set the project path first'); |
224 | 229 | return; |
225 | 230 | } |
226 | | - prompt = 'I have an existing Reactor app at ' + csproj + |
227 | | - '. Fetch this Figma design via get_figma_data: ' + url + |
228 | | - '. Then read the current Program.cs in the project and diff it against the Figma frame.' + |
| 231 | + prompt = 'You are a live Figma-to-code sync agent for the Reactor app at ' + csproj + '.' + |
| 232 | + ' First, fetch this Figma design via get_figma_data: ' + url + |
| 233 | + '. Read the current Program.cs in the project and diff it against the Figma frame.' + |
229 | 234 | ' Apply only the changes needed to bring the code in sync with the design — update text, spacing, sizing, colors, and layout to match.' + |
230 | 235 | ' Do not regenerate from scratch unless the structure has fundamentally changed.' + |
231 | 236 | ' ' + skillRef + |
232 | | - ' After updating the code, run: dotnet watch run --project ' + csproj + '.' + |
233 | | - watchSuffix; |
| 237 | + ' Make sure dotnet watch run --project ' + csproj + ' is running.' + |
| 238 | + watchLoop; |
234 | 239 | } |
235 | 240 |
|
236 | | - var cmd = "copilot -p '" + prompt.replace(/'/g, "''") + "'"; |
| 241 | + var cmd = "copilot --yolo -p '" + prompt.replace(/'/g, "''") + "'"; |
237 | 242 | copyToClipboard(cmd); |
238 | 243 |
|
239 | 244 | if (isNewProject()) { |
|
0 commit comments