deployment-automation

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Vercel Production Deploy Loop

Vercel生产部署循环

Instructions

操作说明

When requested to deploy to Vercel production with automatic error fixing:
  1. Initial Deployment Attempt
    • Run
      vercel --prod
      to start production deployment
    • Wait for deployment to complete
  2. Error Detection & Analysis
    • CRITICAL: Use Vercel MCP tool to fetch detailed logs:
      • The MCP logs provide much more detail than CLI output
    • Analyze the build logs to identify root cause:
      • Build errors (TypeScript, ESLint, compilation)
      • Runtime errors
      • Environment variable issues
      • Dependency problems
      • Configuration issues
    • Extract specific error messages
  3. Error Fixing
    • Make minimal, targeted fixes to resolve the specific error
  4. Retry Deployment
    • Run
      vercel --prod
      again with the fixes applied
    • Repeat steps until deployment succeeds
  5. Success Confirmation
    • Once deployment succeeds, report:
      • Deployment URL
      • All errors that were fixed
      • Summary of changes made
    • Ask if user wants to commit/push the fixes
当被要求部署至Vercel生产环境并自动修复错误时:
  1. 首次部署尝试
    • 运行
      vercel --prod
      启动生产环境部署
    • 等待部署完成
  2. 错误检测与分析
    • 关键步骤:使用Vercel MCP工具获取详细日志:
      • MCP日志提供的细节远多于CLI输出
    • 分析构建日志以确定根本原因:
      • 构建错误(TypeScript、ESLint、编译问题)
      • 运行时错误
      • 环境变量问题
      • 依赖项问题
      • 配置问题
    • 提取具体错误信息
  3. 错误修复
    • 进行最小化、针对性的修复以解决具体错误
  4. 重试部署
    • 应用修复后再次运行
      vercel --prod
    • 重复步骤直至部署成功
  5. 成功确认
    • 部署成功后,汇报:
      • 部署URL
      • 已修复的所有错误
      • 所做更改的摘要
    • 询问用户是否需要提交/推送修复内容

Loop Exit Conditions

循环终止条件

  • ✅ Deployment succeeds
  • ❌ SAME error occurs 5+ times (suggest manual intervention)
  • ❌ User requests to stop
  • ✅ 部署成功
  • ❌ 相同错误出现5次及以上(建议手动干预)
  • ❌ 用户要求停止

Best Practices

最佳实践

  • Make incremental fixes rather than large refactors
  • Preserve user's code style and patterns when fixing
  • 采用增量修复而非大规模重构
  • 修复时保留用户的代码风格与模式

Example Flow

示例流程

User: "Deploy to production and fix any errors"
  • Vercel MCP build logs are the PRIMARY source of error information
  • CLI output alone is insufficient for proper error diagnosis
  • Always wait for deployment to complete before fetching logs
  • If errors require user input (like API keys), prompt user immediately
用户: "部署至生产环境并修复所有错误"
  • Vercel MCP构建日志是错误信息的主要来源
  • 仅CLI输出不足以进行正确的错误诊断
  • 始终等待部署完成后再获取日志
  • 如果错误需要用户输入(如API密钥),立即提示用户