Zacznij od małego
Rozpocznij od prostych automatyzacji i stopniowo zwiększaj złożoność
Możliwości AI Cursor wykraczają daleko poza interaktywne kodowanie. Ten przewodnik pokazuje, jak budować zaawansowane przepływy automatyzacji wykorzystujące AI do ciągłego rozwoju, testowania i konserwacji.
{ "mcpServers": { "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_TOKEN": "your-github-token" } }, "gitlab": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-gitlab"], "env": { "GITLAB_TOKEN": "your-gitlab-token", "GITLAB_URL": "https://gitlab.com" } }, "jenkins": { "command": "npx", "args": ["-y", "jenkins-mcp-server"], "env": { "JENKINS_URL": "https://jenkins.company.com", "JENKINS_USER": "your-username", "JENKINS_TOKEN": "your-api-token" } }, "terraform": { "command": "npx", "args": ["-y", "terraform-mcp"], "env": { "TF_WORKSPACE": "production" } }, "kubernetes": { "command": "npx", "args": ["-y", "kubernetes-mcp-server"], "env": { "KUBECONFIG": "~/.kube/config" } } }}"Używając GitHub MCP, zautomatyzuj nasze CI/CD:1. Uzyskaj status uruchomienia przepływu pracy dla głównej gałęzi2. Wyzwól przepływ pracy wdrożenia, jeśli testy przeszły3. Stwórz wydanie z dziennikiem zmian4. Zaktualizuj problem śledzenia wdrożenia"
// Zaawansowana orkiestracja przepływu pracy"Używając GitHub MCP:
- Sprawdź, czy kontrole PR #123 przeszły- Jeśli tak, automatycznie połącz ze squash- Wyzwól wdrożenie produkcyjne- Monitoruj status wdrożenia- Cofnij, jeśli kontrole zdrowia nie powiodą się""Używając Jenkins MCP:- Wyzwól zadanie 'build-and-test'- Poczekaj na ukończenie- Jeśli pomyślne, wyzwól 'deploy-staging'- Uruchom testy integracyjne- Promuj do produkcji, jeśli wszystko przejdzie"
// Monitorowanie potoku"Monitoruj potok Jenkins:- Uzyskaj obecny status budowy- Pokaż szczegóły nieudanych testów- Wylistuj blokujące problemy- Zaproponuj naprawy na podstawie logów""Używając GitLab MCP:- Stwórz żądanie połączenia z gałęzi funkcji- Uruchom potok CI- Automatycznie przypisz recenzentów na podstawie CODEOWNERS- Zaplanuj wdrożenie na staging- Stwórz notatki wdrożenia"// Orkiestracja Terraform + Kubernetes"Koordynuj wdrożenie infrastruktury:1. Używając Terraform MCP: - Zaplanuj zmiany infrastruktury - Pokaż mi, co zostanie utworzone/zmodyfikowane - Zastosuj zmiany po zatwierdzeniu
2. Używając Kubernetes MCP: - Wdróż nową wersję aplikacji - Monitoruj zdrowie podów - Skaluj na podstawie obciążenia - Zaktualizuj reguły ingress"
// Kompletny przykład automatyzacji"Zautomatyzuj pełne wdrożenie:1. GitHub MCP: Uzyskaj najnowszy tag wydania2. Jenkins MCP: Zbuduj obraz Docker3. Terraform MCP: Zaktualizuj infrastrukturę4. Kubernetes MCP: Wdróż nową wersję5. Slack MCP: Powiadom zespół o wdrożeniu"// Automatyczne zarządzanie problemami"Używając Linear MCP i GitHub MCP razem:- Gdy PR zostanie połączone z main- Znajdź powiązane problemy Linear- Przenieś problemy do statusu 'Done'- Dodaj datę wdrożenia- Połącz z URL produkcyjnym"
// Automatyzacja bezpieczeństwa"Automatyzacja skanowania bezpieczeństwa:1. GitHub MCP: Uzyskaj zmienione pliki2. Uruchom skanowanie bezpieczeństwa na zmianach3. Jeśli znaleziono luki: - Stwórz problem GitHub - Przypisz do zespołu bezpieczeństwa - Zablokuj wdrożenie - Zaproponuj naprawy"Agenty w tle to pracownicy AI działający w chmurze, działający w izolowanych maszynach wirtualnych Ubuntu, pozwalający:
Stwórz .cursor/environment.json w swoim repozytorium:
{ "snapshot": "POPULATED_FROM_SETTINGS", "install": "npm ci", "start": "sudo service docker start", "terminals": [ { "name": "Dev Server", "command": "npm run dev" }, { "name": "Test Runner", "command": "npm run test:watch" } ], "secrets": { "DATABASE_URL": "${DATABASE_URL}", "API_KEY": "${API_KEY}" }}Dla złożonych środowisk użyj niestandardowego Dockerfile:
# .cursor/DockerfileFROM ubuntu:22.04
# Zależności systemoweRUN apt-get update && apt-get install -y \ build-essential \ python3.11 \ python3-pip \ nodejs \ npm \ postgresql-client \ redis-tools
# Środowisko PythonRUN pip3 install --upgrade pipRUN pip3 install pytest black flake8 mypy
# Środowisko NodeRUN npm install -g typescript@latest \ @nestjs/cli \ nx \ pnpm
# Niestandardowe narzędzia projektoweCOPY requirements.txt /tmp/RUN pip3 install -r /tmp/requirements.txt
WORKDIR /workspaceUruchom wielu agentów do pracy nad różnymi funkcjami jednocześnie:
Uruchamianie wielu agentów przez Slack:
# W Slack uruchom wielu agentów do równoległego rozwoju@Cursor [branch=feature/auth] implement OAuth 2.0 authentication:- Set up Passport.js with Google/GitHub strategies- Create login/logout endpoints- Add session management with Redis- Implement role-based access control- Write integration tests- Update API documentation
@Cursor [branch=feature/payments] add Stripe payment integration:- Create payment endpoints for subscriptions- Implement webhook handlers- Add payment method management- Create billing dashboard components- Add comprehensive error handling- Write unit and integration tests
@Cursor [branch=feature/notifications] build email notification system:- Set up SendGrid integration- Create email templates (welcome, password reset, etc.)- Implement queue system with Bull- Add user preferences for notifications- Create unsubscribe mechanism- Test with different email providersMonitorowanie przez panel webowy:
Przepływ pracy automatycznego rozwiązywania błędów:
name: Auto Fix Bugs
on: issues: types: [labeled]
jobs: trigger-fix: if: github.event.label.name == 'auto-fix' runs-on: ubuntu-latest steps: - name: Send to Slack for Cursor uses: slackapi/slack-github-action@v1.24.0 with: channel-id: 'cursor-bug-fixes' slack-message: | @Cursor fix bug from ${{ github.event.issue.html_url }} Issue: ${{ github.event.issue.title }} Description: ${{ github.event.issue.body }} - Reproduce the issue - Identify root cause - Implement fix following patterns - Add regression tests - Create PR linked to issue# Bezpośrednio w Slack@Cursor [repo=myorg/myrepo] fix bug #456- Check issue description for details- Follow our bug fix checklist- Ensure all tests pass- Link PR to original issuePrzepływ pracy ciągłego testowania i dokumentacji:
name: Request Test Generation
on: push: branches: [main, develop]
jobs: request-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3
- name: Get Changed Files id: changed-files uses: tj-actions/changed-files@v35 with: files: | **/*.ts **/*.js **/*.tsx **/*.jsx
- name: Request Tests via Slack if: steps.changed-files.outputs.any_changed == 'true' uses: slackapi/slack-github-action@v1.24.0 with: channel-id: 'cursor-testing' slack-message: | @Cursor generate tests for recently changed files: ${{ steps.changed-files.outputs.all_changed_files }} - Write comprehensive unit tests - Add integration tests where needed - Cover edge cases - Achieve >90% coverage# W Slack@Cursor update documentation based on recent changes- Check recent commits for new features- Update API documentation- Regenerate TypeScript definitions- Update README if needed- Add entries to CHANGELOG.mdJak działają agenty w tle w Slack:
Podstawowa konfiguracja:
@Cursor settingsWyzwalanie agentów:
# Podstawowe żądanie implementacji@Cursor implement the user profile feature- Add avatar upload- Include bio and social links- Make it responsive- Write tests
# Z konkretnymi opcjami@Cursor [repo=company/app] [branch=feature/profile] implement user profile
# Wiele zadań@Cursor task 1: Fix the login bug reported in #support@Cursor task 2: Add dark mode to settings page@Cursor task 3: Update API documentationMonitorowanie postępu:
Powiadomienia zespołu:
Automatyczna cotygodniowa konserwacja przez Slack:
name: Weekly Maintenance
on: schedule: - cron: '0 2 * * 0' # Niedziela 2:00
jobs: trigger-maintenance: runs-on: ubuntu-latest steps: - name: Request Dependency Updates uses: slackapi/slack-github-action@v1.24.0 with: channel-id: 'cursor-maintenance' slack-message: | @Cursor update all dependencies - Check for minor version updates - Run security audit - Update lock files - Run test suite - Update CHANGELOG.md
- name: Request Code Quality Check uses: slackapi/slack-github-action@v1.24.0 with: channel-id: 'cursor-maintenance' slack-message: | @Cursor improve code quality - Fix ESLint warnings - Remove unused imports - Update deprecated APIs - Improve TypeScript types - Add missing JSDoc comments
- name: Request Test Coverage uses: slackapi/slack-github-action@v1.24.0 with: channel-id: 'cursor-maintenance' slack-message: | @Cursor improve test coverage to 95% - Identify untested code - Add missing unit tests - Add integration tests - Update test descriptionsRęczne wyzwalanie konserwacji:
# Wyzwól zadania konserwacji ręcznie w Slack@Cursor perform weekly maintenance- Update dependencies- Fix linting issues- Improve test coverage- Update documentation- Clean up technical debtOrkiestracja wielu agentów przez Slack:
# Faza 1: Uruchom równoległych agentów implementacji@Cursor [branch=feature/shop-backend] implement backend API for online shop- Create REST endpoints for products, cart, checkout- Add database models- Implement business logic- Add validation and error handling
@Cursor [branch=feature/shop-frontend] build frontend for online shop- Create React components for product listing- Implement shopping cart state management- Add API integration- Ensure responsive design
@Cursor [branch=feature/shop-tests] create tests for online shop- Unit tests for all components- Integration tests for API- E2E tests for checkout flow- Performance tests
# Faza 2: Po zakończeniu przez agentów, integruj@Cursor [branch=feature/shop-integration] integrate shop components- Merge backend and frontend branches- Resolve any conflicts- Run full integration tests- Create unified PRMonitorowanie projektów wielu agentów:
Panel webowy (cursor.com/agents):
Organizacja wątków Slack:
Najlepsze praktyki zarządzania kosztami agentów w tle:
Ocena złożoności zadania:
Strategia wsadowa:
# Zamiast jednego złożonego żądania:@Cursor implement complete e-commerce platform
# Podziel na mniejsze, skoncentrowane zadania:@Cursor implement product catalog API@Cursor create shopping cart functionality@Cursor add payment processing@Cursor build admin dashboardZarządzanie budżetem:
Efektywna konfiguracja środowiska:
{ "snapshot": "cached-node-18", "install": "npm ci --prefer-offline", "cache": { "node_modules": true, "build": true }}Panel monitorowania kosztów:
#!/bin/bashecho "Uruchamiam kontrole przed zatwierdzeniem Cursor AI..."
# 1. Kontrola jakości koducursor lint --ai-enhanced --fix
# 2. Skanowanie bezpieczeństwacursor security scan --staged
# 3. Generuj brakujące testycursor agent run --task generate-tests --target staged
# 4. Zaktualizuj dokumentacjęcursor docs update --auto
# 5. Sprawdź zapachy koducursor analyze --smells --complexity
if [ $? -ne 0 ]; then echo "Kontrole przed zatwierdzeniem nie powiodły się. Proszę przejrzeć i naprawić problemy." exit 1fi
echo "Kontrole przed zatwierdzeniem zakończone sukcesem!"#!/bin/bash# post-merge-automation.sh
# Uzyskaj listę połączonych plikówMERGED_FILES=$(git diff --name-only HEAD~1 HEAD)
# 1. Zaktualizuj dokumentacjęecho "Aktualizuję dokumentację..."cursor README.md docs/# W trybie Agent (Ctrl+I), użyj:# "Update all documentation based on @Git changes in the recent merge"# "Include architecture diagrams if structural changes were made"
# 2. Sprawdź zmiany API i wygeneruj testyif echo "$MERGED_FILES" | grep -q "api/"; then echo "Wykryto zmiany API, generuję testy integracyjne..." cursor tests/integration/ # Prompt agenta: "Generate integration tests for the API endpoints modified in @Recent Changes"fi
# 3. Zaktualizuj dokumentację zależnościcursor package.json docs/dependencies.md# Prompt agenta: "Update dependency graph documentation based on @Files package.json changes"
# 4. Wygeneruj podsumowanie i powiadomecho "Automatyzacja po połączeniu ukończona"# Użyj agenta do stworzenia podsumowania: "Summarize the impact of @Recent Changes for the team"name: Przegląd kodu AI
on: pull_request: types: [opened, synchronize]
jobs: ai-review: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0
- name: Przegląd Cursor AI id: review run: | cursor review \ --base ${{ github.base_ref }} \ --head ${{ github.head_ref }} \ --output review.md
- name: Opublikuj komentarz przeglądu uses: actions/github-script@v6 with: script: | const review = fs.readFileSync('review.md', 'utf8'); github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: review });class ContinuousTestGenerator { async generateTestsForChanges(changes: FileChange[]) { const testPlan = await this.createTestPlan(changes);
for (const item of testPlan) { switch (item.type) { case 'unit': await this.generateUnitTests(item); break;
case 'integration': await this.generateIntegrationTests(item); break;
case 'e2e': await this.generateE2ETests(item); break; } }
// Uruchom wygenerowane testy const results = await this.runGeneratedTests();
// Dopracuj na podstawie rezultatów if (results.failures.length > 0) { await this.refineFailingTests(results.failures); } }
# Generuj testy jednostkowe używając agenta Cursor generateUnitTests() { local TARGET_FILE=$1
# Otwórz plik w Cursor cursor "$TARGET_FILE"
# Użyj trybu Agent (Ctrl+I) z tym kompleksowym promptem: cat << 'EOF' Generate comprehensive Jest unit tests for @Files following AAA pattern: - Arrange-Act-Assert structure - Target 90% statement coverage - Include edge cases and error scenarios - Mock external dependencies appropriately - Use descriptive test names - Group related tests in describe blocks
Reference @Code to understand all functions and their parameters. Check @Definitions for type information. EOF }}export class ScheduledRefactoring { async performWeeklyMaintenance() { const tasks = [ this.removeDeadCode(), this.updateDeprecatedPatterns(), this.optimizeImports(), this.consolidateDuplicates(), this.improveNaming() ];
const results = await Promise.allSettled(tasks);
// Stwórz PR podsumowania if (this.hasChanges(results)) { await this.createMaintenancePR(results); } }
# Usuń martwy kod używając Cursor removeDeadCode() { echo "Analizuję bazę kodu pod kątem martwego kodu..."
# Użyj agenta Cursor do znalezienia martwego kodu cursor .
# Prompty agenta do wykrywania martwego kodu: # "Find unused functions in @Codebase" # "Identify unreachable code in @Files" # "Look for unused imports across the project"
# Dla każdego zidentyfikowanego martwego kodu: # 1. Przejrzyj z: "Verify this code is truly unused by checking @Code references" # 2. Usuń z: "Remove this unused code and update any related tests" }
# Zaktualizuj przestarzałe wzorce updateDeprecatedPatterns() { # Stwórz plik wzorców cat > .cursor/deprecated-patterns.md << 'EOF' # Deprecated Patterns to Update
1. Old: `findOne()` → New: `findFirst()` 2. Old: `callback pattern` → New: `async/await` 3. Old: `require()` → New: `import` EOF
# Otwórz w Cursor do aktualizacji wzorców cursor .cursor/deprecated-patterns.md
# Use Agent with prompts like: # "Find all occurrences of findOne() in @Codebase and suggest updates to findFirst()" # "Update callback patterns to async/await in @Files" # "Modernize require statements to ES6 imports across the project" }}class AutoDocumentation { async generateComprehensiveDocs() { // Dokumentacja API await this.generateApiDocs();
// Diagramy architektury await this.generateArchitectureDiagrams();
// Przewodniki konfiguracji await this.updateSetupGuides();
// Przykłady kodu await this.generateCodeExamples(); }
# Generuj dokumentację API używając Cursor generateApiDocs() { # Znajdź wszystkie punkty końcowe API API_FILES=$(find . -path "*/api/*" -name "*.ts" -o -name "*.js")
for endpoint_file in $API_FILES; do cursor "$endpoint_file"
# Use Agent mode (Ctrl+I) with these prompts: # "Generate OpenAPI documentation for the endpoints in @Files" # "Include request/response examples and error codes" # "Add authentication requirements and rate limiting info" # "Create a Postman collection from these endpoints" done }
# Generuj diagramy architektury generateArchitectureDiagrams() { # Stwórz szablon do analizy architektury cat > architecture-prompt.md << 'EOF' Analyze the codebase architecture and create: 1. System overview diagram showing main components 2. Data flow diagram showing how data moves through the system 3. Deployment diagram showing infrastructure setup 4. Sequence diagrams for key user flows
Use @Codebase to understand the project structure Use @Files in src/ to analyze component relationships Reference @Docs for existing architecture notes EOF
cursor architecture-prompt.md docs/architecture/
await this.saveDiagrams(diagrams); }}export class WebhookAutomation { async handleWebhook(event: WebhookEvent) { switch (event.type) { case 'issue.created': await this.handleNewIssue(event); break;
case 'deployment.failed': await this.handleFailedDeployment(event); break;
case 'security.vulnerability': await this.handleSecurityAlert(event); break;
case 'performance.degradation': await this.handlePerformanceIssue(event); break; } }
# Obsługuj nowe problemy GitHub za pomocą Cursor handleNewIssue() { local ISSUE_NUMBER=$1 local ISSUE_TITLE=$2 local ISSUE_BODY=$3
# Stwórz plik analizy problemu cat > "issue-${ISSUE_NUMBER}.md" << EOF# Problem #${ISSUE_NUMBER}: ${ISSUE_TITLE}
## Opis:${ISSUE_BODY}
## Zadania analizy:1. Zidentyfikuj główną przyczynę2. Określ, czy można automatycznie naprawić3. Zaproponuj podejście implementacyjneEOF
# Otwórz w Cursor do analizy cursor "issue-${ISSUE_NUMBER}.md"
# Use Agent mode (Ctrl+I) with prompts: # "Analyze this issue and determine if it can be fixed automatically" # "Search @Codebase for related code that might be causing this issue" # "Check @Recent Changes that might have introduced this problem"
# Jeśli naprawa jest możliwa, stwórz gałąź i implementuj echo "Tworzę gałąź naprawy..." git checkout -b "fix/issue-${ISSUE_NUMBER}"
# Use Agent to implement fix: # "Implement a fix for the issue described based on your analysis" # "Add tests to prevent this issue from recurring" # "Update documentation if needed" }}class MonitoringAutomation { private monitors = new Map<string, Monitor>();
async initialize() { // Monitor jakości kodu this.monitors.set('quality', new QualityMonitor({ threshold: { complexity: 10, duplication: 5 }, action: this.handleQualityIssue.bind(this) }));
// Monitor wydajności this.monitors.set('performance', new PerformanceMonitor({ threshold: { responseTime: 200, cpu: 80 }, action: this.handlePerformanceIssue.bind(this) }));
// Monitor bezpieczeństwa this.monitors.set('security', new SecurityMonitor({ scanInterval: '1h', action: this.handleSecurityIssue.bind(this) })); }
# Obsługuj problemy jakości kodu za pomocą Cursor handleQualityIssue() { local ISSUE_FILE=$1 local ISSUE_TYPE=$2
# Otwórz problematyczny plik w Cursor cursor "$ISSUE_FILE"
# Use Agent mode (Ctrl+I) based on issue type: case $ISSUE_TYPE in "complexity") # "Refactor @Files to reduce complexity. Break down large functions." ;; "duplication") # "Find and eliminate duplicate code in @Files. Extract common logic." ;; "performance") # "Optimize performance bottlenecks in @Files. Focus on loops and queries." ;; esac }}#!/bin/bash# scaffold-microservice.sh
# Scaffold microservice with CursorscaffoldMicroservice() { SERVICE_NAME=$1 LANGUAGE=$2 FRAMEWORK=$3
# Stwórz strukturę serwisu mkdir -p "services/$SERVICE_NAME"/{src,tests,docs,config} cd "services/$SERVICE_NAME"
# Stwórz instrukcje szkieletowania cat > .cursor/scaffold-instructions.md << EOF# Scaffold $SERVICE_NAME Microservice
## Configuration:- Language: $LANGUAGE- Framework: $FRAMEWORK- Service: $SERVICE_NAME
## Generate these files:
### 1. Project StructureCreate standard microservice structure with:- src/ - Source code- tests/ - Test files- docs/ - Documentation- config/ - Configuration files
### 2. Core Files- Package/dependency file (package.json, requirements.txt, etc.)- Main application entry point- Configuration management- Health check endpoint- Example CRUD endpoints
### 3. Testing Setup- Test framework configuration- Example unit tests- Example integration tests
### 4. CI/CD- Dockerfile- docker-compose.yml- GitHub Actions workflow
### 5. Documentation- README.md with setup instructions- API documentation template- Architecture decision recordsEOF
# Open in Cursor for scaffolding cursor .cursor/scaffold-instructions.md
# Use Agent mode (Ctrl+I) with prompts: # "Create the complete microservice structure as described" # "Use @Docs to follow our organization's microservice patterns" # "Reference @Cursor Rules for coding standards and best practices" # "Include proper error handling and logging throughout"}#!/bin/bash# Perform batch updates across filesperformBatchUpdate() { local PATTERN=$1 local TRANSFORMATION=$2
# Znajdź wszystkie pasujące pliki FILES=$(find . -name "$PATTERN" -type f)
# Stwórz instrukcje transformacji cat > batch-transform.md << EOF# Batch Transformation Instructions
## Pattern: $PATTERN## Transformation: $TRANSFORMATION
### For each file:1. Apply the transformation consistently2. Preserve existing logic and behavior3. Update related tests if they exist4. Maintain code style and formatting
### Validation:- Ensure no syntax errors- Verify logic is preserved- Check that tests still passEOF
# Process files in batches using Cursor echo "$FILES" | xargs -n 10 | while read -r batch; do echo "Processing batch: $batch"
# Stwórz punkt kontrolny, zatwierdzając obecny stan git add -A && git commit -m "Checkpoint before batch transformation"
# Open files in Cursor cursor $batch batch-transform.md
# Use Agent mode (Ctrl+I) with prompts: # "Apply the transformation described to all @Files" # "Ensure consistency across all files" # "Update any related test files"
# Waliduj po transformacji echo "Validating transformations..." npm test || yarn test || make test
if [ $? -ne 0 ]; then echo "Validation failed, rolling back..." git reset --hard HEAD~1 fi done}
# Example transformations# performBatchUpdate "*.js" "Convert CommonJS to ES6 modules"# performBatchUpdate "*.test.ts" "Update to new testing framework syntax"# performBatchUpdate "*Controller.ts" "Add proper error handling to all endpoints"// Using GitHub MCP for advanced automation"Implement smart PR automation:1. Monitor all open PRs2. For each PR: - Check if reviews are approved - Verify CI/CD status - Check for merge conflicts - Auto-merge if all conditions met - Update related issues"
// Automated release management"Create automated release process:1. Using GitHub MCP: - Generate changelog from commits - Create release draft - Upload build artifacts - Tag release version - Trigger deployment workflow""Using Kubernetes MCP for deployment automation:1. Check cluster health2. Perform rolling update: - Update deployment image - Monitor rollout status - Check pod health - Verify service endpoints3. If issues detected: - Pause rollout - Collect logs - Rollback if necessary - Alert team via Slack MCP"// Complex automation workflowclass MCPOrchestrator { async deployWithFullAutomation(version: string) { // Phase 1: Build and Test await this.runWithMCP('GitHub MCP: Create release branch'); await this.runWithMCP('Jenkins MCP: Run full test suite');
// Phase 2: Infrastructure await this.runWithMCP('Terraform MCP: Update infrastructure'); await this.runWithMCP('Kubernetes MCP: Prepare cluster');
// Phase 3: Deploy await this.runWithMCP('Deploy application version'); await this.runWithMCP('Run health checks');
// Phase 4: Monitor await this.runWithMCP('Sentry MCP: Check for errors'); await this.runWithMCP('Grafana MCP: Monitor metrics');
// Phase 5: Notify await this.runWithMCP('Slack MCP: Send deployment summary'); await this.runWithMCP('Linear MCP: Update task status'); }}#!/bin/bash# Sync Jira tickets with development workflowsyncWithJira() { # Get current sprint tickets using Jira CLI TICKETS=$(jira list --query "sprint = activeSprint()" --json)
# Process each ticket echo "$TICKETS" | jq -r '.[] | @base64' | while read -r ticket_data; do # Decode ticket data TICKET=$(echo "$ticket_data" | base64 -d) TICKET_KEY=$(echo "$TICKET" | jq -r '.key') TICKET_TYPE=$(echo "$TICKET" | jq -r '.fields.issuetype.name') TICKET_SUMMARY=$(echo "$TICKET" | jq -r '.fields.summary')
# Create feature branch if needed if ! git branch -r | grep -q "feature/$TICKET_KEY"; then git checkout -b "feature/$TICKET_KEY" fi
# Generate boilerplate for stories if [ "$TICKET_TYPE" = "Story" ]; then generateStoryBoilerplate "$TICKET_KEY" "$TICKET" fi done}
# Generate story implementation with CursorgenerateStoryBoilerplate() { local TICKET_KEY=$1 local TICKET_JSON=$2
# Extract ticket details DESCRIPTION=$(echo "$TICKET_JSON" | jq -r '.fields.description') ACCEPTANCE_CRITERIA=$(echo "$TICKET_JSON" | jq -r '.fields.customfield_10100')
# Create requirements file cat > ".cursor/tickets/${TICKET_KEY}-requirements.md" << EOF# $TICKET_KEY Implementation
## Description$DESCRIPTION
## Acceptance Criteria$ACCEPTANCE_CRITERIA
## Implementation Tasks1. Analyze requirements and create technical design2. Implement core functionality with tests3. Add integration tests4. Update documentation5. Create PR with detailed descriptionEOF
# Open in Cursor for implementation cursor ".cursor/tickets/${TICKET_KEY}-requirements.md" src/
# Use Agent mode (Ctrl+I) with prompts: # "Analyze the requirements in this ticket and suggest implementation approach" # "Create the necessary files and folder structure for this feature" # "Implement the feature following TDD - write tests first" # "Reference @Docs for our coding patterns and @Cursor Rules for standards"
# Update documentation cursor docs/features/ # "Update the feature documentation to include $TICKET_KEY implementation"}
# Example usage:# ./jira-automation.sh# This will sync all active sprint tickets and help implement themclass ParallelAutomation { private workers: Worker[] = [];
async executeParallel(tasks: AutomationTask[]) { // Initialize worker pool const numWorkers = os.cpus().length; for (let i = 0; i < numWorkers; i++) { this.workers.push(new Worker('./automation-worker.js')); }
// Distribute tasks const taskQueue = [...tasks]; const results = [];
await Promise.all( this.workers.map(async (worker) => { while (taskQueue.length > 0) { const task = taskQueue.shift(); const result = await this.executeTask(worker, task); results.push(result); } }) );
return results; }}Zacznij od małego
Rozpocznij od prostych automatyzacji i stopniowo zwiększaj złożoność
Monitoruj wszystko
Śledź wskaźniki sukcesu automatyzacji i wpływ na wydajność
Eleganckie niepowodzenia
Zawsze uwzględnij mechanizmy wycofania i obsługę błędów
Nadzór ludzki
Zachowaj przegląd ludzki dla krytycznych automatyzacji
Inteligentne łączenie MCP
Kombinuj wiele serwerów MCP dla złożonych przepływów pracy
Obsługuj awarie MCP
Zawsze miej plany awaryjne, gdy serwery MCP są niedostępne
Zabezpiecz poświadczenia MCP
Używaj zmiennych środowiskowych i zarządzania sekretami dla tokenów MCP
Loguj operacje MCP
Śledź wszystkie operacje MCP dla audytu i debugowania
// Single command orchestrates everything"Deploy version 2.1.0 to production:- GitHub MCP: Create release- Jenkins MCP: Build and test- Terraform MCP: Update infra- K8s MCP: Deploy application- Slack MCP: Notify team"
// Time: 2 minutes setup// Maintenance: Minimal// Flexibility: High// Custom scripts for each toolasync function deploy(version) { // GitHub API integration const github = new GitHubAPI(token); await github.createRelease(...);
// Jenkins API integration const jenkins = new JenkinsAPI(...); await jenkins.triggerBuild(...);
// Terraform CLI wrapper await exec('terraform apply...');
// Kubernetes client const k8s = new K8sClient(...); await k8s.updateDeployment(...);
// Slack webhook await sendSlackMessage(...);}
// Time: Days of development// Maintenance: High// Flexibility: LimitedOkreśl jasne cele
Implementuj stopniowo
Monitoruj i iteruj
Dokumentuj wszystko
Pamiętaj: celem automatyzacji nie jest zastąpienie deweloperów, ale wzmocnienie ich możliwości. Skup się na automatyzacji monotonnych zadań, aby ludzie mogli skupić się na kreatywności.