chore: import upstream snapshot with attribution
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:38:58 +08:00
commit bb5c75ce05
8824 changed files with 1946442 additions and 0 deletions
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [sync-mode] | --full | --incremental | --dry-run | --conflict-strategy
description: Enable comprehensive bidirectional GitHub-Linear synchronization with conflict resolution
---
# Bidirectional Sync
Enable comprehensive bidirectional GitHub-Linear synchronization: **$ARGUMENTS**
## Current Sync Environment
- GitHub status: !`gh api user 2>/dev/null && echo "✓ Authenticated" || echo "⚠ Not authenticated"`
- Linear MCP: Check if Linear MCP server is available and configured
- Sync state: @.sync-state.json or @sync/ (if exists)
- Webhooks: !`gh api repos/{owner}/{repo}/hooks 2>/dev/null | grep -c linear || echo "0"`
## Task
Implement robust bidirectional synchronization between GitHub Issues and Linear tasks:
**Sync Mode**: Use $ARGUMENTS to specify full sync, incremental sync, dry-run preview, or conflict resolution strategy
**Synchronization Framework**:
1. **Sync State Management** - Initialize sync database, track entity relationships, maintain sync history
2. **Conflict Detection** - Identify simultaneous changes, field-level conflicts, timing issues
3. **Resolution Strategies** - NEWER_WINS, GITHUB_WINS, LINEAR_WINS, or intelligent field-level merge
4. **Transaction Management** - Atomic operations, rollback capability, distributed locking
5. **Webhook Integration** - Real-time event handling, sync loop prevention, automated triggers
6. **Data Integrity** - Bidirectional validation, cross-reference maintenance, audit trails
**Advanced Features**: Field-level merge rules, sync loop prevention, webhook automation, performance optimization, comprehensive monitoring.
**Production Ready**: Transaction safety, conflict resolution, error recovery, performance monitoring, comprehensive logging.
**Output**: Complete bidirectional sync system with conflict resolution, webhook integration, performance metrics, and comprehensive sync reporting.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [import-scope] | --state | --label | --milestone | --batch-size
description: Bulk import GitHub issues to Linear with comprehensive progress tracking and error handling
---
# Bulk Import Issues
Bulk import GitHub issues to Linear with advanced processing capabilities: **$ARGUMENTS**
## Current Import Context
- Repository: !`gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || echo "No repo context"`
- Issue count: !`gh api repos/{owner}/{repo}/issues?state=all --paginate | jq length 2>/dev/null || echo "Check manually"`
- Linear teams: Check available Linear teams and projects for import mapping
- Rate limits: !`gh api rate_limit -q '.rate | "GitHub: \(.remaining)/\(.limit)"' 2>/dev/null || echo "Check GitHub rate limit"`
## Task
Execute efficient bulk import of GitHub issues to Linear with comprehensive management:
**Import Scope**: Use $ARGUMENTS to filter by state, labels, milestones, or configure batch processing parameters
**Import Pipeline**:
1. **Pre-Import Analysis** - Issue discovery, duplicate detection, import estimation, resource planning
2. **Batch Configuration** - Dynamic batch sizing, rate limit management, progress tracking, error handling
3. **Data Transformation** - Field mapping, priority inference, user mapping, content enhancement
4. **Import Execution** - Parallel processing, retry logic, transaction management, progress reporting
5. **Error Recovery** - Failed item handling, retry mechanisms, partial import recovery, validation
6. **Post-Import Actions** - Cross-reference creation, GitHub updates, mapping files, notifications
**Advanced Features**: Dynamic batch adjustment, intelligent rate limiting, duplicate detection, comprehensive error recovery, progress visualization.
**Quality Assurance**: Pre-import validation, post-import verification, data integrity checks, comprehensive audit trails.
**Output**: Complete import results with success metrics, failed item reports, mapping documentation, and performance analytics for large-scale issue migration.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [action] | audit | repair | map | validate | export
description: Manage cross-platform reference links between GitHub and Linear with integrity checking
---
# Cross-Reference Manager
Manage comprehensive cross-platform reference links with integrity validation: **$ARGUMENTS**
## Current Reference State
- GitHub CLI: !`gh --version 2>/dev/null && echo "✓ Available" || echo "⚠ Not available"`
- Linear MCP: Check Linear MCP server connectivity and authentication
- Reference database: @.reference-mappings.json or reference state files
- Link integrity: !`find . -name "*sync*" -o -name "*reference*" | wc -l` mapping files found
## Task
Implement comprehensive cross-reference management for GitHub-Linear integration:
**Management Action**: Use $ARGUMENTS to specify audit, repair, mapping, validation, or export operations
**Reference Management Framework**:
1. **Reference Database** - Initialize mapping storage, track bidirectional links, maintain sync history
2. **Integrity Auditing** - Scan cross-references, identify orphaned links, detect mismatches, validate consistency
3. **Smart Repair** - Fix broken references, update outdated links, consolidate duplicates, remove invalid entries
4. **Mapping Visualization** - Display reference networks, show connection health, highlight problems, provide statistics
5. **Deep Validation** - Verify link functionality, test bidirectional navigation, check field consistency, ensure data integrity
6. **Export & Documentation** - Generate mapping reports, create backup files, provide import instructions, maintain audit trails
**Advanced Features**: Automated orphan detection, intelligent reference reconstruction, duplicate consolidation, comprehensive validation.
**Data Protection**: Backup before modifications, transaction-based operations, rollback capabilities, comprehensive logging.
**Output**: Complete reference management system with integrity reports, repair summaries, mapping visualizations, and comprehensive cross-platform link maintenance.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [issue-number] | --team | --project | --close-github | --skip-comments
description: Convert individual GitHub issues to Linear tasks with comprehensive data preservation
---
# Issue to Linear Task
Convert GitHub issues to Linear tasks with comprehensive field mapping: **$ARGUMENTS**
## Current Conversion Context
- Repository: !`gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || echo "No repo context"`
- Issue details: Based on $ARGUMENTS issue number or selection criteria
- Linear teams: Available Linear teams and project assignments
- User mappings: @user-mappings.json or GitHub-Linear user correspondence
## Task
Execute precise conversion of individual GitHub issues to Linear tasks:
**Issue Target**: Use $ARGUMENTS to specify issue number, conversion options, team assignment, or processing preferences
**Conversion Framework**:
1. **Issue Analysis** - Fetch complete issue data, extract metadata, analyze content structure, infer priorities
2. **Data Transformation** - Map fields accurately, convert formats, preserve relationships, enhance descriptions
3. **Linear Integration** - Create task with proper formatting, assign team/project, set priorities, manage labels
4. **Content Migration** - Import comments with attribution, handle attachments, preserve formatting, maintain threading
5. **Reference Management** - Create bidirectional links, update sync database, maintain cross-references, enable navigation
6. **Validation & Confirmation** - Verify conversion accuracy, confirm field mappings, validate relationships, provide preview
**Advanced Features**: Smart priority inference, intelligent user mapping, attachment handling, comment threading, comprehensive validation.
**Data Fidelity**: Preserve original formatting, maintain all metadata, keep comment attribution, ensure relationship integrity.
**Output**: Successfully converted Linear task with complete data preservation, accurate field mappings, bidirectional references, and comprehensive conversion summary.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [task-id] | --repo | --milestone | --close-linear | --skip-attachments
description: Convert Linear tasks to GitHub issues with relationship preservation and metadata mapping
---
# Linear Task to Issue
Convert Linear tasks to GitHub issues with comprehensive relationship mapping: **$ARGUMENTS**
## Current Task Context
- Task details: Based on $ARGUMENTS task identifier or selection criteria
- Target repository: !`gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || echo "No repo context"`
- User mappings: Linear email to GitHub username correspondence
- Attachment handling: Linear attachment access and GitHub upload capabilities
## Task
Execute precise conversion of Linear tasks to GitHub issues:
**Task Target**: Use $ARGUMENTS to specify task identifier, target repository, milestone mapping, or processing preferences
**Conversion Framework**:
1. **Task Analysis** - Fetch complete Linear task data, extract relationships, analyze content structure, identify priorities
2. **Content Transformation** - Build GitHub issue body, map Linear fields, preserve formatting, handle rich content
3. **GitHub Integration** - Create issue with proper structure, apply labels, assign users, set milestones, manage relationships
4. **Attachment Migration** - Download Linear attachments, upload to GitHub, update references, maintain accessibility
5. **Comment Import** - Transfer comments with attribution, preserve timestamps, maintain context, handle mentions
6. **Cross-Reference Setup** - Create bidirectional links, update Linear task, maintain sync database, enable navigation
**Advanced Features**: Rich content conversion, attachment handling, relationship mapping, user mention translation, comprehensive validation.
**Relationship Management**: Preserve parent-child relationships, maintain team context, map project associations, handle dependencies.
**Output**: Successfully created GitHub issue with complete data migration, accurate field mappings, preserved relationships, and comprehensive conversion report.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [setup-mode] | --full | --webhooks-only | --monitoring | --deploy-target
description: Setup comprehensive automated synchronization workflows with monitoring and CI/CD integration
---
# Sync Automation Setup
Setup comprehensive automated synchronization workflows: **$ARGUMENTS**
## Current Infrastructure State
- GitHub CLI: !`gh --version 2>/dev/null && echo "✓ Available" || echo "⚠ Not available"`
- Linear MCP: Check Linear MCP server availability and configuration
- Infrastructure: Docker, webhook endpoints, database connectivity, queue services
- CI/CD: !`find . -name ".github" -o -name ".gitlab-ci.yml" -o -name "azure-pipelines.yml" | wc -l` existing workflows
## Task
Configure production-ready automated synchronization with comprehensive infrastructure:
**Setup Mode**: Use $ARGUMENTS to specify full automation, webhooks-only, monitoring setup, or deployment target
**Automation Framework**:
1. **Prerequisites Setup** - Validate GitHub/Linear access, check infrastructure requirements, configure authentication, test connectivity
2. **Webhook Configuration** - Setup GitHub/Linear webhooks, configure endpoints, implement security, test delivery
3. **CI/CD Integration** - Create GitHub Actions workflows, setup scheduled syncs, implement event handling, configure deployments
4. **Sync Server Deployment** - Configure sync engine, setup queue management, implement error handling, enable monitoring
5. **Database & State Management** - Initialize sync databases, setup schema, configure backups, implement state tracking
6. **Monitoring & Alerting** - Configure dashboards, setup alerts, implement health checks, enable notifications
**Advanced Features**: Real-time webhook processing, intelligent conflict resolution, comprehensive monitoring, scalable infrastructure.
**Production Ready**: High availability setup, comprehensive error handling, performance monitoring, security implementation, automated backups.
**Output**: Complete automation infrastructure with webhook integration, CI/CD workflows, monitoring dashboards, and production deployment capabilities.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [action] | detect | resolve | analyze | configure | report
description: Resolve synchronization conflicts with intelligent strategies and automated resolution
---
# Sync Conflict Resolver
Resolve synchronization conflicts with intelligent automation: **$ARGUMENTS**
## Current Conflict State
- Sync database: @.sync-state.json or sync state files with potential conflicts
- Conflict history: !`find . -name "*conflict*" -o -name "*sync-errors*" | wc -l` conflict logs
- Resolution rules: @conflict-rules.json or existing resolution configuration
- Active conflicts: Current unresolved synchronization conflicts requiring attention
## Task
Implement comprehensive conflict resolution with intelligent automation:
**Resolution Action**: Use $ARGUMENTS to specify detect conflicts, resolve using strategies, analyze patterns, configure rules, or generate reports
**Conflict Resolution Framework**:
1. **Conflict Detection** - Scan synchronized items, compare field versions, identify timing conflicts, flag structural issues
2. **Intelligent Resolution** - Apply resolution strategies, handle field merging, preserve critical data, maintain relationships
3. **Pattern Analysis** - Study conflict trends, identify frequent issues, suggest process improvements, optimize strategies
4. **Configuration Management** - Set resolution preferences, define field priorities, configure merge rules, save automation settings
5. **Reporting & Analytics** - Generate conflict reports, track resolution success, analyze team patterns, provide insights
6. **Automated Prevention** - Implement locking mechanisms, optimize sync timing, enable change notifications, reduce conflicts
**Resolution Strategies**: Latest-wins, smart field-level merging, manual interactive resolution, system-priority resolution, custom rule-based resolution.
**Quality Assurance**: Backup before resolution, validation after changes, rollback capabilities, comprehensive audit trails.
**Output**: Resolved conflicts with detailed resolution reports, updated sync state, pattern analysis insights, and optimized conflict prevention strategies.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [scope] | --github | --linear | --webhooks | --performance | --report
description: Monitor and diagnose GitHub-Linear sync health with performance analytics and automated troubleshooting
---
# Sync Health Monitor
Monitor comprehensive GitHub-Linear synchronization health and performance: **$ARGUMENTS**
## Current Sync Environment
- GitHub API status: !`gh api rate_limit -q '.rate | "GitHub: \(.remaining)/\(.limit) requests"' 2>/dev/null || echo "GitHub API check needed"`
- Linear connectivity: Linear MCP server status and authentication validation
- Webhook status: Active webhook configurations and event processing health
- Sync performance: Current throughput, latency metrics, and error rates
## Task
Implement comprehensive sync health monitoring with automated diagnostics and performance optimization:
**Monitor Scope**: Use $ARGUMENTS to specify GitHub health, Linear connectivity, webhook diagnostics, performance analysis, or complete health report
**Health Monitoring Framework**:
1. **API Health Assessment** - Monitor GitHub/Linear API status, rate limits, authentication, connectivity issues
2. **Sync Performance Analysis** - Track throughput metrics, latency patterns, processing times, queue depths
3. **Error Pattern Detection** - Identify recurring failures, classify error types, analyze failure trends
4. **Webhook Diagnostics** - Validate webhook configurations, test event delivery, monitor processing latency
5. **Data Integrity Validation** - Verify sync consistency, detect orphaned records, validate cross-references
6. **Automated Troubleshooting** - Run diagnostic tests, suggest fixes, implement automated recovery procedures
**Advanced Features**: Real-time health dashboards, predictive failure detection, automated recovery workflows, comprehensive performance profiling.
**Diagnostic Capabilities**: Deep error analysis, bottleneck identification, configuration validation, automated testing suites.
**Output**: Complete health assessment with performance metrics, error analysis, recommended optimizations, and automated diagnostic reports.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [sync-scope] | --state | --label | --assignee | --milestone
description: Sync GitHub issues to Linear workspace with comprehensive field mapping and rate limit management
---
# Sync Issues to Linear
Sync GitHub issues to Linear workspace with intelligent field mapping: **$ARGUMENTS**
## Current Repository Context
- Repository: !`gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || echo "No repo context"`
- Issue count: !`gh issue list --state all --limit 1 --json number | jq length 2>/dev/null || echo "Check manually"`
- Linear teams: Available Linear teams and project assignments
- Rate limits: !`gh api rate_limit -q '.rate | "GitHub: \(.remaining)/\(.limit)"' 2>/dev/null`
## Task
Execute comprehensive synchronization of GitHub issues to Linear workspace:
**Sync Scope**: Use $ARGUMENTS to filter by issue state, labels, assignees, milestones, or specific issue sets
**Synchronization Framework**:
1. **Issue Discovery** - Fetch GitHub issues with comprehensive metadata, apply filters, validate requirements
2. **Field Mapping** - Transform GitHub fields to Linear format, map priorities, convert labels, handle assignees
3. **Data Validation** - Check required fields, validate user mappings, ensure data integrity, prevent duplicates
4. **Linear Integration** - Create tasks with proper formatting, apply team assignments, set projects, manage relationships
5. **Rate Limit Management** - Implement exponential backoff, batch operations, monitor API limits, optimize requests
6. **Progress Tracking** - Provide real-time updates, handle errors gracefully, maintain sync state, generate reports
**Advanced Features**: Smart priority inference, intelligent user mapping, incremental sync capabilities, comprehensive error recovery.
**Data Integrity**: Preserve formatting, maintain metadata, create bidirectional references, ensure audit trails.
**Output**: Complete synchronization results with success metrics, error reports, mapping summaries, and comprehensive sync analytics.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [sync-scope] | --team | --project | --priority | --states
description: Sync Linear tasks to GitHub issues with state mapping and attachment handling
---
# Sync Linear to Issues
Sync Linear tasks to GitHub issues with comprehensive state and field mapping: **$ARGUMENTS**
## Current Linear Context
- Linear teams: Available teams and project assignments
- Task count: Linear task query to determine scope
- Target repository: !`gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || echo "No repo context"`
- User mappings: Linear email to GitHub username correspondence
## Task
Execute comprehensive synchronization of Linear tasks to GitHub issues:
**Sync Scope**: Use $ARGUMENTS to filter by Linear team, project, priority levels, or task states
**Synchronization Framework**:
1. **Task Discovery** - Query Linear tasks with filters, extract metadata, validate requirements, prioritize sync
2. **State Mapping** - Transform Linear states to GitHub equivalents, handle priority conversion, map project assignments
3. **Content Transformation** - Build GitHub issue body, preserve formatting, handle attachments, maintain structure
4. **GitHub Integration** - Create issues with proper labels, assign users, set milestones, manage relationships
5. **Attachment Migration** - Download Linear attachments, upload to GitHub, update references, maintain accessibility
6. **Comment Synchronization** - Transfer comments with attribution, preserve context, handle mentions, maintain threading
**Advanced Features**: Intelligent state mapping, attachment handling, comment threading, user mention translation, comprehensive validation.
**Data Fidelity**: Preserve Linear formatting, maintain task relationships, keep timestamps, ensure reference integrity.
**Output**: Complete synchronization results with created issues, attachment migrations, comment transfers, and comprehensive sync reporting.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [migration-type] | --github-to-linear | --linear-to-github | --bidirectional | --validate
description: Comprehensive migration assistant for large-scale GitHub-Linear data transitions with validation and rollback
---
# Sync Migration Assistant
Execute comprehensive data migration between GitHub and Linear with enterprise-grade capabilities: **$ARGUMENTS**
## Current Migration Environment
- Source system: !`gh --version 2>/dev/null && echo "GitHub CLI available" || echo "GitHub CLI needed"`
- Target system: Linear MCP server connectivity and authentication status
- Migration scope: Analysis of data volume and complexity for planning
- Infrastructure: Database, queue services, and processing capacity assessment
## Task
Implement large-scale data migration with comprehensive validation and enterprise features:
**Migration Type**: Use $ARGUMENTS to specify GitHub-to-Linear, Linear-to-GitHub, bidirectional setup, or validation mode
**Migration Framework**:
1. **Pre-Migration Assessment** - Data volume analysis, dependency mapping, risk assessment, resource planning
2. **Migration Planning** - Phased approach design, rollback strategy, validation checkpoints, timeline estimation
3. **Data Extraction** - Comprehensive data harvesting, relationship preservation, metadata capture, error handling
4. **Transformation Engine** - Field mapping, format conversion, validation rules, data enrichment
5. **Migration Execution** - Batch processing, progress tracking, error recovery, quality assurance
6. **Post-Migration Validation** - Data integrity verification, relationship validation, performance testing, rollback readiness
**Enterprise Features**: Large-scale batch processing, comprehensive error recovery, detailed audit trails, rollback capabilities, performance optimization.
**Quality Assurance**: Multi-stage validation, data integrity checks, relationship verification, comprehensive testing, enterprise monitoring.
**Output**: Complete migration system with phased execution, comprehensive validation, detailed reporting, and enterprise-grade reliability for large-scale data transitions.
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [pr-number] | --task | --auto-detect | --enable-auto | --update-state
description: Link GitHub pull requests to Linear tasks with automated state synchronization and workflow integration
---
# Sync PR to Task
Link GitHub pull requests to Linear tasks with comprehensive workflow integration: **$ARGUMENTS**
## Current PR Context
- Repository: !`gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || echo "No repo context"`
- PR details: Based on $ARGUMENTS PR number or auto-detection criteria
- Linear references: Detection of task IDs in PR content and branch names
- Webhook status: Current automation configuration for PR-task synchronization
## Task
Implement comprehensive pull request to Linear task linking with automated workflow integration:
**PR Target**: Use $ARGUMENTS to specify PR number, task assignment, auto-detection mode, or automation configuration
**Integration Framework**:
1. **Reference Detection** - Extract Linear task IDs from PR title, body, branch names, commit messages
2. **PR Analysis** - Fetch complete PR data, analyze state, review status, change metrics, timeline
3. **State Synchronization** - Map PR states to Linear equivalents, handle review cycles, merge events
4. **Task Updates** - Update Linear task status, add PR references, create comments, sync metadata
5. **GitHub Enhancement** - Add Linear context to PR, create labels, post task summaries, maintain links
6. **Workflow Automation** - Configure webhooks, enable real-time sync, implement event handlers, maintain consistency
**Advanced Features**: Smart branch detection, automated state mapping, review integration, commit analysis, comprehensive validation.
**Workflow Integration**: Real-time updates, bidirectional sync, event-driven automation, comprehensive monitoring.
**Output**: Complete PR-task integration with automated synchronization, workflow enhancement, state management, and comprehensive relationship tracking.
@@ -0,0 +1,390 @@
---
allowed-tools: Read, Bash
argument-hint: [--detailed] | [--health-check] | [--diagnostics]
description: Monitor GitHub-Linear sync health status with performance metrics and diagnostics
---
# Sync Status Monitor
Monitor GitHub-Linear sync health: $ARGUMENTS
## Current Sync State
- Sync configuration: @.sync-config.json or @sync/ (if exists)
- Recent sync logs: !`find . -name "*sync*.log" | head -3`
- GitHub status: !`gh api rate_limit` (if GitHub CLI available)
- Process status: !`ps aux | grep -i sync | head -3`
## Task
Analyze synchronization status between GitHub and Linear. When checking synchronization status:
1. **Sync State Overview**
```javascript
async function getSyncOverview() {
const state = await loadSyncState();
return {
lastFullSync: state.lastFullSync,
lastIncrementalSync: state.lastIncremental,
totalSyncedItems: Object.keys(state.entities).length,
pendingSync: state.queue.length,
failedSync: state.failures.length,
syncEnabled: state.config.enabled,
syncDirection: state.config.direction,
webhooksActive: await checkWebhooks()
};
}
```
2. **Health Metrics**
```javascript
const healthMetrics = {
// Performance metrics
avgSyncTime: calculateAverage(syncTimes),
maxSyncTime: Math.max(...syncTimes),
syncSuccessRate: (successful / total) * 100,
// Data quality metrics
conflictRate: (conflicts / syncs) * 100,
duplicateRate: (duplicates / total) * 100,
orphanedItems: countOrphaned(),
// API health
githubRateLimit: await getGitHubRateLimit(),
linearRateLimit: await getLinearRateLimit(),
apiErrors: recentErrors.length,
// Sync lag
avgSyncLag: calculateSyncLag(),
maxSyncLag: findMaxLag(),
itemsOutOfSync: findOutOfSync().length
};
```
3. **Consistency Checks**
```javascript
async function checkConsistency() {
const issues = [];
// Check GitHub → Linear
const githubIssues = await fetchAllGitHubIssues();
for (const issue of githubIssues) {
const linearTask = await findLinearTask(issue);
if (!linearTask) {
issues.push({
type: 'MISSING_IN_LINEAR',
github: issue.number,
severity: 'high'
});
} else {
const diffs = compareFields(issue, linearTask);
if (diffs.length > 0) {
issues.push({
type: 'FIELD_MISMATCH',
github: issue.number,
linear: linearTask.identifier,
differences: diffs,
severity: 'medium'
});
}
}
}
return issues;
}
```
4. **Sync History Analysis**
```javascript
function analyzeSyncHistory(days = 7) {
const history = loadSyncHistory(days);
return {
totalSyncs: history.length,
byType: groupBy(history, 'type'),
byDirection: groupBy(history, 'direction'),
successRate: calculateRate(history, 'success'),
patterns: {
peakHours: findPeakSyncHours(history),
commonErrors: findCommonErrors(history),
slowestOperations: findSlowestOps(history)
},
trends: {
syncVolume: calculateTrend(history, 'volume'),
errorRate: calculateTrend(history, 'errors'),
performance: calculateTrend(history, 'duration')
}
};
}
```
5. **Real-time Monitoring**
```javascript
class SyncMonitor {
constructor() {
this.metrics = new Map();
this.alerts = [];
}
track(operation) {
const start = Date.now();
return {
complete: (success, details) => {
const duration = Date.now() - start;
this.metrics.set(operation.id, {
...operation,
duration,
success,
details,
timestamp: new Date()
});
// Check for alerts
if (duration > SLOW_SYNC_THRESHOLD) {
this.alert('SLOW_SYNC', operation);
}
if (!success) {
this.alert('SYNC_FAILURE', operation);
}
}
};
}
}
```
6. **Webhook Status**
```bash
# Check GitHub webhooks
gh api repos/:owner/:repo/hooks --jq '.[] | select(.config.url | contains("linear"))'
# Validate webhook health
gh api repos/:owner/:repo/hooks/:id/deliveries --jq '.[0:10] | .[] | {id, status_code, delivered_at}'
```
7. **Queue Management**
```javascript
async function getQueueStatus() {
const queue = await loadSyncQueue();
return {
size: queue.length,
oldest: queue[0]?.createdAt,
byPriority: groupBy(queue, 'priority'),
estimatedTime: estimateProcessingTime(queue),
blocked: queue.filter(item => item.retries >= MAX_RETRIES),
processing: queue.filter(item => item.status === 'processing'),
pending: queue.filter(item => item.status === 'pending')
};
}
```
8. **Diagnostic Reports**
```javascript
function generateDiagnostics() {
return {
systemInfo: {
version: SYNC_VERSION,
githubCLI: checkGitHubCLI(),
linearMCP: checkLinearMCP(),
config: loadSyncConfig()
},
connectivity: {
github: testGitHubAPI(),
linear: testLinearAPI(),
webhooks: testWebhooks()
},
dataIntegrity: {
orphanedGitHub: findOrphanedGitHubIssues(),
orphanedLinear: findOrphanedLinearTasks(),
duplicates: findDuplicates(),
conflicts: findConflicts()
},
recommendations: generateRecommendations()
};
}
```
9. **Alert Configuration**
```yaml
alerts:
- name: high_conflict_rate
condition: conflict_rate > 10%
severity: warning
action: notify
- name: sync_failure
condition: success_rate < 95%
severity: critical
action: pause_sync
- name: api_rate_limit
condition: rate_limit_remaining < 100
severity: warning
action: throttle
```
10. **Performance Visualization**
```
Sync Performance (Last 24h)
━━━━━━━━━━━━━━━━━━━━━━━━━━
Sync Volume:
00:00 ▁▁▂▁▁▁▂▃▄▅▆▇█▇▆▅▄▃▂▁▁▁▂▁ 23:59
Success Rate: 98.5%
████████████████████░
Avg Duration: 2.3s
████████░░░░░░░░░░░░ (Target: 5s)
```
## Examples
### Basic Status Check
```bash
# Get current sync status
claude sync-status
# Detailed status with history
claude sync-status --detailed
# Check specific sync types
claude sync-status --type="issue-to-linear"
```
### Health Monitoring
```bash
# Run health check
claude sync-status --health-check
# Continuous monitoring
claude sync-status --monitor --interval=5m
# Generate diagnostic report
claude sync-status --diagnostics
```
### Troubleshooting
```bash
# Check for sync issues
claude sync-status --check-issues
# Verify specific items
claude sync-status --verify="gh-123,ABC-456"
# Queue management
claude sync-status --queue --clear-failed
```
## Output Format
```
GitHub-Linear Sync Status
=========================
Last Updated: 2025-01-16 10:45:00
Overview:
✓ Sync Enabled: Bidirectional
✓ Webhooks: Active (GitHub: ✓, Linear: ✓)
✓ Last Full Sync: 2 hours ago
✓ Last Activity: 5 minutes ago
Statistics:
- Total Synced Items: 1,234
- Items in Queue: 3
- Failed Items: 1
Health Metrics:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Success Rate █████████████████░░░ 96.5%
Conflict Rate ███░░░░░░░░░░░░░░░░ 8.2%
Sync Lag ████░░░░░░░░░░░░░░░ ~2min
API Status:
- GitHub: 4,832/5,000 requests remaining
- Linear: 1,245/1,500 requests remaining
Recent Activity:
10:44 ✓ Issue #123 → ABC-789 (1.2s)
10:42 ✓ ABC-788 → Issue #122 (0.8s)
10:40 ⚠ Issue #121 → Conflict detected
10:38 ✓ PR #456 → ABC-787 linked
Alerts:
⚠ High conflict rate in last hour (12%)
⚠ 1 item failed after max retries
Recommendations:
1. Review and resolve conflict for Issue #121
2. Retry failed sync for ABC-456
3. Consider increasing sync frequency
```
## Advanced Features
### Sync Analytics Dashboard
```
═══════════════════════════════════════════════════════
SYNC ANALYTICS DASHBOARD
═══════════════════════════════════════════════════════
Daily Sync Volume │ Sync Types
─────────────────────────┼─────────────────────────
150 ┤ │ Issues → Linear 45%
120 ┤ ╭─╮ │ Linear → Issues 30%
90 ┤ ╱ ╲ │ PR → Task 20%
60 ┤ ╲ │ Comments 5%
30 ┤ ╲___ │
0 └───────────── │
Mon Wed Fri │
Error Distribution │ Performance Trends
─────────────────────────┼─────────────────────────
Network ████ 40% │ Avg Time ▂▄▆█▆▄▂ 2.3s
Rate Limit ███ 30% │ P95 Time ▃▅▇█▇▅▃ 5.1s
Conflicts ██ 20% │ P99 Time ▄▆███▆▄ 8.2s
Other █ 10% │
```
### Predictive Analysis
```javascript
function predictSyncIssues() {
const patterns = analyzeHistoricalData();
return {
likelyConflicts: predictConflicts(patterns),
peakLoadTimes: predictPeakLoad(patterns),
rateLimitRisk: calculateRateLimitRisk(),
recommendations: {
optimalSyncInterval: calculateOptimalInterval(),
suggestedBatchSize: calculateOptimalBatch(),
conflictPrevention: suggestConflictStrategies()
}
};
}
```
## Best Practices
1. **Regular Monitoring**
- Set up automated health checks
- Review sync metrics daily
- Act on alerts promptly
2. **Proactive Maintenance**
- Clear failed items regularly
- Optimize sync intervals
- Update conflict strategies
3. **Documentation**
- Log all sync issues
- Document resolution steps
- Track performance trends
@@ -0,0 +1,36 @@
---
allowed-tools: Read, Write, Edit, Bash
argument-hint: [pr-number] | --team | --estimate | --batch-process | --auto-create
description: Create Linear tasks from GitHub pull requests with intelligent content extraction and task sizing
---
# Task from PR
Create Linear tasks from GitHub pull requests with intelligent analysis: **$ARGUMENTS**
## Current PR Environment
- Repository: !`gh repo view --json nameWithOwner -q .nameWithOwner 2>/dev/null || echo "No repo context"`
- PR status: Based on $ARGUMENTS PR number or batch processing criteria
- Linear teams: Available teams for task assignment
- User mappings: GitHub username to Linear user correspondence
## Task
Generate Linear tasks from GitHub pull requests with comprehensive content analysis:
**PR Source**: Use $ARGUMENTS to specify PR number, team assignment, size estimation, or batch processing mode
**Task Generation Framework**:
1. **PR Analysis** - Extract comprehensive PR data, parse description structure, identify key components, analyze changes
2. **Content Extraction** - Parse structured sections, extract checklists, identify technical details, capture requirements
3. **Intelligent Sizing** - Estimate task complexity from code changes, file count, review comments, testing requirements
4. **Task Construction** - Build Linear task with proper formatting, preserve PR context, maintain references, structure content
5. **Team Assignment** - Map to appropriate Linear team, assign based on code areas, set priorities from labels
6. **Validation & Creation** - Check for duplicates, validate task structure, create in Linear, establish bidirectional links
**Advanced Features**: Smart content parsing, automated size estimation, intelligent team mapping, comprehensive validation, batch processing.
**Quality Assurance**: Duplicate detection, content validation, proper formatting, relationship maintenance, comprehensive error handling.
**Output**: Successfully created Linear tasks with comprehensive PR context, accurate sizing estimates, proper team assignments, and complete bidirectional linking.