Force refresh Figma design cache and update Linear with latest data
Force refresh cached Figma design data for a Linear issue and update with latest design system mappings. Use this when designers notify you of Figma updates to get fresh Tailwind tokens and detect changes.
/plugin marketplace add duongdev/ccpm/plugin install ccpm@duongdev-ccpm-marketplace<issue-id>Force refresh cached Figma design data for a Linear issue and update with latest design system.
When designers update Figma files, this command fetches the latest design system data and updates Linear descriptions with fresh Tailwind mappings.
# Refresh Figma cache for a task
/ccpm:figma-refresh PSN-123
# After designer updates Figma
/ccpm:figma-refresh WORK-456
Use the Task tool:
Invoke ccpm:linear-operations:
operation: get_issue
params:
issueId: "{issue ID from argument}"
context:
cache: false # Always fresh for refresh operation
command: "figma-refresh"
Extract:
Use helpers/figma-detection.md logic to extract Figma links:
# Search issue description and comments for Figma URLs
FIGMA_LINKS=$(./scripts/figma-utils.sh extract-markdown "$LINEAR_DESC")
if [ -z "$FIGMA_LINKS" ] || [ "$(echo "$FIGMA_LINKS" | jq 'length')" -eq 0 ]; then
echo "ā No Figma links found in issue $1"
echo ""
echo "Add Figma links to issue description, then run this command again."
exit 1
fi
FIGMA_COUNT=$(echo "$FIGMA_LINKS" | jq 'length')
echo "š Found $FIGMA_COUNT Figma design(s)"
For each Figma link, check if cached data exists:
echo ""
echo "š¦ Checking cache status..."
echo "$FIGMA_LINKS" | jq -c '.[]' | while read -r link; do
FILE_ID=$(echo "$link" | jq -r '.file_id')
FILE_NAME=$(echo "$link" | jq -r '.file_name')
CACHE_STATUS=$(./scripts/figma-cache-manager.sh status "$1" "$FILE_ID")
if [ -n "$CACHE_STATUS" ]; then
CACHE_AGE=$(echo "$CACHE_STATUS" | jq -r '.age_hours')
echo " ā
Cached: $FILE_NAME (${CACHE_AGE}h old)"
else
echo " ā ļø Not cached: $FILE_NAME"
fi
done
For each Figma link:
# Get project ID from issue
PROJECT_ID=$(echo "$ISSUE_DATA" | jq -r '.project.id')
# Select Figma MCP server for this project
FIGMA_SERVER=$(./scripts/figma-server-manager.sh select "$PROJECT_ID")
if [ -z "$FIGMA_SERVER" ]; then
echo "ā No Figma MCP server configured for this project"
echo ""
echo "Configure Figma MCP server in ~/.config/agent-mcp-gateway/.mcp.json"
exit 1
fi
echo ""
echo "š Refreshing Figma data from server: $FIGMA_SERVER"
echo "$FIGMA_LINKS" | jq -c '.[]' | while read -r link; do
FILE_ID=$(echo "$link" | jq -r '.file_id')
FILE_NAME=$(echo "$link" | jq -r '.file_name')
FILE_URL=$(echo "$link" | jq -r '.url')
echo ""
echo " š Refreshing: $FILE_NAME"
# Get old cache for change detection
OLD_CACHE=$(./scripts/figma-cache-manager.sh get "$1" "$FILE_ID" 2>/dev/null || echo "{}")
# Extract design data via Figma MCP
echo " š Fetching from Figma MCP..."
FIGMA_DATA=$(./scripts/figma-data-extractor.sh extract "$FIGMA_SERVER" "$FILE_URL")
if [ -z "$FIGMA_DATA" ] || [ "$FIGMA_DATA" == "null" ]; then
echo " ā Failed to fetch design data"
continue
fi
# Analyze design system
echo " šØ Analyzing design system..."
DESIGN_SYSTEM=$(echo "$FIGMA_DATA" | ./scripts/figma-design-analyzer.sh analyze -)
# Update cache
echo " š¾ Updating cache..."
./scripts/figma-cache-manager.sh set "$1" "$FILE_URL" "$DESIGN_SYSTEM"
echo " ā
Cache updated successfully"
# Detect changes from previous version
if [ -n "$OLD_CACHE" ] && [ "$OLD_CACHE" != "{}" ]; then
echo " š Detecting design changes..."
# Compare color palettes
OLD_COLORS=$(echo "$OLD_CACHE" | jq -r '.colors | length')
NEW_COLORS=$(echo "$DESIGN_SYSTEM" | jq -r '.colors | length')
if [ "$OLD_COLORS" != "$NEW_COLORS" ]; then
echo " ā ļø Color palette changed: $OLD_COLORS ā $NEW_COLORS colors"
fi
# Compare typography
OLD_FONTS=$(echo "$OLD_CACHE" | jq -r '.typography | length')
NEW_FONTS=$(echo "$DESIGN_SYSTEM" | jq -r '.typography | length')
if [ "$OLD_FONTS" != "$NEW_FONTS" ]; then
echo " ā ļø Typography changed: $OLD_FONTS ā $NEW_FONTS font styles"
fi
fi
done
Update the design system section in Linear description:
Use the Task tool:
Invoke ccpm:linear-operations:
operation: update_issue_description
params:
issueId: "{issue ID}"
description: |
{existing description with updated design system section}
## šØ Design System Analysis
**Figma Files**: {count} file(s)
**Last Refreshed**: {timestamp}
{for each Figma file:}
### {file_name}
**URL**: {figma_url}
**Colors** (Tailwind mappings):
{colors.map(c => `- ${c.hex} ā \`${c.tailwind}\``).join('\n')}
**Typography** (Tailwind mappings):
{typography.map(t => `- ${t.family} ā \`${t.tailwind}\``).join('\n')}
**Spacing** (Tailwind scale):
{spacing.map(s => `- ${s.value} ā \`${s.tailwind}\``).join('\n')}
---
*Refresh: `/ccpm:figma-refresh {issueId}` | Cache expires in 1 hour*
context:
command: "figma-refresh"
Add a comment documenting the refresh operation:
Use the Task tool:
Invoke ccpm:linear-operations:
operation: create_comment
params:
issueId: "{issue ID}"
body: |
## š Figma Design Refresh
**Refreshed**: {timestamp}
**Files updated**: {count}
**Server**: {figma_server}
${changes.length > 0 ? `
### Changes Detected
${changes.map(c => `- ${c.file}: ${c.summary}`).join('\n')}
` : '### No changes detected since last refresh'}
### Updated Data
- ā
Design tokens refreshed
- ā
Tailwind mappings updated
- ā
Component library synced
Cache will expire in 1 hour. Run `/ccpm:figma-refresh {issueId}` to refresh again.
context:
command: "figma-refresh"
console.log('\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
console.log('ā
Figma Cache Refreshed');
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\n');
console.log(`š Issue: ${issueId}`);
console.log(`šØ Refreshed: ${figmaCount} Figma design(s)`);
console.log(`š Changes: ${changesCount} change(s) detected`);
console.log(`\nš¾ Cache Details:`);
console.log(` ⢠Design System: Updated`);
console.log(` ⢠Linear Description: Updated`);
console.log(` ⢠Expires: 1 hour`);
console.log('\nš” Next: /ccpm:work {issueId}');
ā No Figma links found in issue PSN-123
Add Figma links to issue description, then run this command again.
ā No Figma MCP server configured for this project
Configure Figma MCP server in ~/.config/agent-mcp-gateway/.mcp.json
ā Failed to fetch design data from Figma
Suggestions:
- Check Figma MCP server is running
- Verify FIGMA_PERSONAL_ACCESS_TOKEN is valid
- Check Figma file permissions