Files
davila7--claude-code-templates/dashboard/public/component-content/commands/sync/sync-status.json
T
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

1 line
11 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"content": "---\nallowed-tools: Read, Bash\nargument-hint: [--detailed] | [--health-check] | [--diagnostics]\ndescription: Monitor GitHub-Linear sync health status with performance metrics and diagnostics\n---\n\n# Sync Status Monitor\n\nMonitor GitHub-Linear sync health: $ARGUMENTS\n\n## Current Sync State\n\n- Sync configuration: @.sync-config.json or @sync/ (if exists)\n- Recent sync logs: !`find . -name \"*sync*.log\" | head -3`\n- GitHub status: !`gh api rate_limit` (if GitHub CLI available)\n- Process status: !`ps aux | grep -i sync | head -3`\n\n## Task\n\nAnalyze synchronization status between GitHub and Linear. When checking synchronization status:\n\n1. **Sync State Overview**\n ```javascript\n async function getSyncOverview() {\n const state = await loadSyncState();\n \n return {\n lastFullSync: state.lastFullSync,\n lastIncrementalSync: state.lastIncremental,\n totalSyncedItems: Object.keys(state.entities).length,\n pendingSync: state.queue.length,\n failedSync: state.failures.length,\n syncEnabled: state.config.enabled,\n syncDirection: state.config.direction,\n webhooksActive: await checkWebhooks()\n };\n }\n ```\n\n2. **Health Metrics**\n ```javascript\n const healthMetrics = {\n // Performance metrics\n avgSyncTime: calculateAverage(syncTimes),\n maxSyncTime: Math.max(...syncTimes),\n syncSuccessRate: (successful / total) * 100,\n \n // Data quality metrics\n conflictRate: (conflicts / syncs) * 100,\n duplicateRate: (duplicates / total) * 100,\n orphanedItems: countOrphaned(),\n \n // API health\n githubRateLimit: await getGitHubRateLimit(),\n linearRateLimit: await getLinearRateLimit(),\n apiErrors: recentErrors.length,\n \n // Sync lag\n avgSyncLag: calculateSyncLag(),\n maxSyncLag: findMaxLag(),\n itemsOutOfSync: findOutOfSync().length\n };\n ```\n\n3. **Consistency Checks**\n ```javascript\n async function checkConsistency() {\n const issues = [];\n \n // Check GitHub → Linear\n const githubIssues = await fetchAllGitHubIssues();\n for (const issue of githubIssues) {\n const linearTask = await findLinearTask(issue);\n if (!linearTask) {\n issues.push({\n type: 'MISSING_IN_LINEAR',\n github: issue.number,\n severity: 'high'\n });\n } else {\n const diffs = compareFields(issue, linearTask);\n if (diffs.length > 0) {\n issues.push({\n type: 'FIELD_MISMATCH',\n github: issue.number,\n linear: linearTask.identifier,\n differences: diffs,\n severity: 'medium'\n });\n }\n }\n }\n \n return issues;\n }\n ```\n\n4. **Sync History Analysis**\n ```javascript\n function analyzeSyncHistory(days = 7) {\n const history = loadSyncHistory(days);\n \n return {\n totalSyncs: history.length,\n byType: groupBy(history, 'type'),\n byDirection: groupBy(history, 'direction'),\n successRate: calculateRate(history, 'success'),\n \n patterns: {\n peakHours: findPeakSyncHours(history),\n commonErrors: findCommonErrors(history),\n slowestOperations: findSlowestOps(history)\n },\n \n trends: {\n syncVolume: calculateTrend(history, 'volume'),\n errorRate: calculateTrend(history, 'errors'),\n performance: calculateTrend(history, 'duration')\n }\n };\n }\n ```\n\n5. **Real-time Monitoring**\n ```javascript\n class SyncMonitor {\n constructor() {\n this.metrics = new Map();\n this.alerts = [];\n }\n \n track(operation) {\n const start = Date.now();\n \n return {\n complete: (success, details) => {\n const duration = Date.now() - start;\n this.metrics.set(operation.id, {\n ...operation,\n duration,\n success,\n details,\n timestamp: new Date()\n });\n \n // Check for alerts\n if (duration > SLOW_SYNC_THRESHOLD) {\n this.alert('SLOW_SYNC', operation);\n }\n if (!success) {\n this.alert('SYNC_FAILURE', operation);\n }\n }\n };\n }\n }\n ```\n\n6. **Webhook Status**\n ```bash\n # Check GitHub webhooks\n gh api repos/:owner/:repo/hooks --jq '.[] | select(.config.url | contains(\"linear\"))'\n \n # Validate webhook health\n gh api repos/:owner/:repo/hooks/:id/deliveries --jq '.[0:10] | .[] | {id, status_code, delivered_at}'\n ```\n\n7. **Queue Management**\n ```javascript\n async function getQueueStatus() {\n const queue = await loadSyncQueue();\n \n return {\n size: queue.length,\n oldest: queue[0]?.createdAt,\n byPriority: groupBy(queue, 'priority'),\n estimatedTime: estimateProcessingTime(queue),\n \n blocked: queue.filter(item => item.retries >= MAX_RETRIES),\n processing: queue.filter(item => item.status === 'processing'),\n pending: queue.filter(item => item.status === 'pending')\n };\n }\n ```\n\n8. **Diagnostic Reports**\n ```javascript\n function generateDiagnostics() {\n return {\n systemInfo: {\n version: SYNC_VERSION,\n githubCLI: checkGitHubCLI(),\n linearMCP: checkLinearMCP(),\n config: loadSyncConfig()\n },\n \n connectivity: {\n github: testGitHubAPI(),\n linear: testLinearAPI(),\n webhooks: testWebhooks()\n },\n \n dataIntegrity: {\n orphanedGitHub: findOrphanedGitHubIssues(),\n orphanedLinear: findOrphanedLinearTasks(),\n duplicates: findDuplicates(),\n conflicts: findConflicts()\n },\n \n recommendations: generateRecommendations()\n };\n }\n ```\n\n9. **Alert Configuration**\n ```yaml\n alerts:\n - name: high_conflict_rate\n condition: conflict_rate > 10%\n severity: warning\n action: notify\n \n - name: sync_failure\n condition: success_rate < 95%\n severity: critical\n action: pause_sync\n \n - name: api_rate_limit\n condition: rate_limit_remaining < 100\n severity: warning\n action: throttle\n ```\n\n10. **Performance Visualization**\n ```\n Sync Performance (Last 24h)\n ━━━━━━━━━━━━━━━━━━━━━━━━━━\n \n Sync Volume:\n 00:00 ▁▁▂▁▁▁▂▃▄▅▆▇█▇▆▅▄▃▂▁▁▁▂▁ 23:59\n \n Success Rate: 98.5%\n ████████████████████░ \n \n Avg Duration: 2.3s\n ████████░░░░░░░░░░░░ (Target: 5s)\n ```\n\n## Examples\n\n### Basic Status Check\n```bash\n# Get current sync status\nclaude sync-status\n\n# Detailed status with history\nclaude sync-status --detailed\n\n# Check specific sync types\nclaude sync-status --type=\"issue-to-linear\"\n```\n\n### Health Monitoring\n```bash\n# Run health check\nclaude sync-status --health-check\n\n# Continuous monitoring\nclaude sync-status --monitor --interval=5m\n\n# Generate diagnostic report\nclaude sync-status --diagnostics\n```\n\n### Troubleshooting\n```bash\n# Check for sync issues\nclaude sync-status --check-issues\n\n# Verify specific items\nclaude sync-status --verify=\"gh-123,ABC-456\"\n\n# Queue management\nclaude sync-status --queue --clear-failed\n```\n\n## Output Format\n\n```\nGitHub-Linear Sync Status\n=========================\nLast Updated: 2025-01-16 10:45:00\n\nOverview:\n✓ Sync Enabled: Bidirectional\n✓ Webhooks: Active (GitHub: ✓, Linear: ✓)\n✓ Last Full Sync: 2 hours ago\n✓ Last Activity: 5 minutes ago\n\nStatistics:\n- Total Synced Items: 1,234\n- Items in Queue: 3\n- Failed Items: 1\n\nHealth Metrics:\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\nSuccess Rate █████████████████░░░ 96.5%\nConflict Rate ███░░░░░░░░░░░░░░░░ 8.2%\nSync Lag ████░░░░░░░░░░░░░░░ ~2min\n\nAPI Status:\n- GitHub: 4,832/5,000 requests remaining\n- Linear: 1,245/1,500 requests remaining\n\nRecent Activity:\n10:44 ✓ Issue #123 → ABC-789 (1.2s)\n10:42 ✓ ABC-788 → Issue #122 (0.8s)\n10:40 ⚠ Issue #121 → Conflict detected\n10:38 ✓ PR #456 → ABC-787 linked\n\nAlerts:\n⚠ High conflict rate in last hour (12%)\n⚠ 1 item failed after max retries\n\nRecommendations:\n1. Review and resolve conflict for Issue #121\n2. Retry failed sync for ABC-456\n3. Consider increasing sync frequency\n```\n\n## Advanced Features\n\n### Sync Analytics Dashboard\n```\n═══════════════════════════════════════════════════════\n SYNC ANALYTICS DASHBOARD\n═══════════════════════════════════════════════════════\n\nDaily Sync Volume │ Sync Types\n─────────────────────────┼─────────────────────────\n 150 ┤ │ Issues → Linear 45%\n 120 ┤ ╭─╮ │ Linear → Issues 30%\n 90 ┤ ╲ │ PR → Task 20%\n 60 ┤ ╲ │ Comments 5%\n 30 ┤ ╲___ │\n 0 └───────────── │\n Mon Wed Fri │\n\nError Distribution │ Performance Trends\n─────────────────────────┼─────────────────────────\nNetwork ████ 40% │ Avg Time ▂▄▆█▆▄▂ 2.3s\nRate Limit ███ 30% │ P95 Time ▃▅▇█▇▅▃ 5.1s\nConflicts ██ 20% │ P99 Time ▄▆███▆▄ 8.2s\nOther █ 10% │\n```\n\n### Predictive Analysis\n```javascript\nfunction predictSyncIssues() {\n const patterns = analyzeHistoricalData();\n \n return {\n likelyConflicts: predictConflicts(patterns),\n peakLoadTimes: predictPeakLoad(patterns),\n rateLimitRisk: calculateRateLimitRisk(),\n recommendations: {\n optimalSyncInterval: calculateOptimalInterval(),\n suggestedBatchSize: calculateOptimalBatch(),\n conflictPrevention: suggestConflictStrategies()\n }\n };\n}\n```\n\n## Best Practices\n\n1. **Regular Monitoring**\n - Set up automated health checks\n - Review sync metrics daily\n - Act on alerts promptly\n\n2. **Proactive Maintenance**\n - Clear failed items regularly\n - Optimize sync intervals\n - Update conflict strategies\n\n3. **Documentation**\n - Log all sync issues\n - Document resolution steps\n - Track performance trends"}